Bug 1020290 - reduce the proliferation of names by introducing overloading. r=shu
authorLars T Hansen <lhansen@mozilla.com>
Thu, 26 Jun 2014 09:22:19 +0200
changeset 191005 dca83d9c4132d819d43f292705b7a68cc631924a
parent 191004 6f8cc863fe3046209d8b15d99ff22a60c236c911
child 191006 814bda3bac4ea49924438db2beae93652fd6dcde
push id8417
push userryanvm@gmail.com
push dateThu, 26 Jun 2014 21:15:47 +0000
treeherderb2g-inbound@3bef42144aab [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersshu
bugs1020290
milestone33.0a1
Bug 1020290 - reduce the proliferation of names by introducing overloading. r=shu
js/src/jsgcinlines.h
--- a/js/src/jsgcinlines.h
+++ b/js/src/jsgcinlines.h
@@ -476,20 +476,18 @@ typedef CompartmentsIterT<GCZoneGroupIte
 
 #ifdef JSGC_GENERATIONAL
 /*
  * Attempt to allocate a new GC thing out of the nursery. If there is not enough
  * room in the nursery or there is an OOM, this method will return nullptr.
  */
 template <AllowGC allowGC>
 inline JSObject *
-TryNewNurseryObject(ThreadSafeContext *cxArg, size_t thingSize, size_t nDynamicSlots)
+TryNewNurseryObject(JSContext *cx, size_t thingSize, size_t nDynamicSlots)
 {
-    JSContext *cx = cxArg->asJSContext();
-
     JS_ASSERT(!IsAtomsCompartment(cx->compartment()));
     JSRuntime *rt = cx->runtime();
     Nursery &nursery = rt->gc.nursery;
     JSObject *obj = nursery.allocateObject(cx, thingSize, nDynamicSlots);
     if (obj)
         return obj;
     if (allowGC && !rt->mainThread.suppressGC) {
         MinorGC(cx, JS::gcreason::OUT_OF_NURSERY);
@@ -503,17 +501,17 @@ TryNewNurseryObject(ThreadSafeContext *c
     }
     return nullptr;
 }
 #endif /* JSGC_GENERATIONAL */
 
 #ifdef JSGC_FJGENERATIONAL
 template <AllowGC allowGC>
 inline JSObject *
-TryNewFJNurseryObject(ForkJoinContext *cx, size_t thingSize, size_t nDynamicSlots)
+TryNewNurseryObject(ForkJoinContext *cx, size_t thingSize, size_t nDynamicSlots)
 {
     ForkJoinNursery &nursery = cx->nursery();
     bool tooLarge = false;
     JSObject *obj = nursery.allocateObject(thingSize, nDynamicSlots, tooLarge);
     if (obj)
         return obj;
 
     if (!tooLarge && allowGC) {
@@ -612,27 +610,27 @@ AllocateObject(ThreadSafeContext *cx, Al
                   "All allocations must be at least the allocator-imposed minimum size.");
 
     if (!CheckAllocatorState<allowGC>(cx, kind))
         return nullptr;
 
 #ifdef JSGC_GENERATIONAL
     if (cx->isJSContext() &&
         ShouldNurseryAllocate(cx->asJSContext()->nursery(), kind, heap)) {
-        JSObject *obj = TryNewNurseryObject<allowGC>(cx, thingSize, nDynamicSlots);
+        JSObject *obj = TryNewNurseryObject<allowGC>(cx->asJSContext(), thingSize, nDynamicSlots);
         if (obj)
             return obj;
     }
 #endif
 #ifdef JSGC_FJGENERATIONAL
     if (cx->isForkJoinContext() &&
         ShouldFJNurseryAllocate(cx->asForkJoinContext()->nursery(), kind, heap))
     {
         JSObject *obj =
-            TryNewFJNurseryObject<allowGC>(cx->asForkJoinContext(), thingSize, nDynamicSlots);
+            TryNewNurseryObject<allowGC>(cx->asForkJoinContext(), thingSize, nDynamicSlots);
         if (obj)
             return obj;
     }
 #endif
 
     HeapSlot *slots = nullptr;
     if (nDynamicSlots) {
         slots = cx->pod_malloc<HeapSlot>(nDynamicSlots);