Bug 1158357 - Inline processMarkStackOther to make the dispatch obvious; r=jonco
authorTerrence Cole <terrence@mozilla.com>
Fri, 24 Apr 2015 15:44:20 -0700
changeset 241728 250eb7785cf7d18037db0d1c21edc419d5bc8858
parent 241727 9ebb49787cc1839e715e95027e9ec0bcc0f4704a
child 241729 bcbd4118f34156bad7bff5779f8da8610029b6ef
push id28669
push userryanvm@gmail.com
push dateThu, 30 Apr 2015 17:57:05 +0000
treeherdermozilla-central@7723b15ea695 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonco
bugs1158357
milestone40.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1158357 - Inline processMarkStackOther to make the dispatch obvious; r=jonco
js/src/gc/Marking.cpp
js/src/gc/Tracer.h
--- a/js/src/gc/Marking.cpp
+++ b/js/src/gc/Marking.cpp
@@ -1523,74 +1523,79 @@ GCMarker::restoreValueArray(NativeObject
             *vpp = *endp = vp;
         }
     }
 
     MOZ_ASSERT(*vpp <= *endp);
     return true;
 }
 
-void
-GCMarker::processMarkStackOther(uintptr_t tag, uintptr_t addr)
-{
-    if (tag == GroupTag) {
-        lazilyMarkChildren(reinterpret_cast<ObjectGroup*>(addr));
-    } else if (tag == SavedValueArrayTag) {
-        MOZ_ASSERT(!(addr & CellMask));
-        NativeObject* obj = reinterpret_cast<NativeObject*>(addr);
-        HeapValue* vp;
-        HeapValue* end;
-        if (restoreValueArray(obj, (void**)&vp, (void**)&end))
-            pushValueArray(obj, vp, end);
-        else
-            repush(obj);
-    } else if (tag == JitCodeTag) {
-        reinterpret_cast<jit::JitCode*>(addr)->traceChildren(this);
-    }
-}
-
 inline void
 GCMarker::processMarkStackTop(SliceBudget& budget)
 {
     /*
      * The function uses explicit goto and implements the scanning of the
      * object directly. It allows to eliminate the tail recursion and
      * significantly improve the marking performance, see bug 641025.
      */
     HeapSlot* vp;
     HeapSlot* end;
     JSObject* obj;
 
     const int32_t* unboxedTraceList;
     uint8_t* unboxedMemory;
 
+    // Decode
     uintptr_t addr = stack.pop();
     uintptr_t tag = addr & StackTagMask;
     addr &= ~StackTagMask;
 
-    if (tag == ValueArrayTag) {
+    // Dispatch
+    switch (tag) {
+      case ValueArrayTag: {
         JS_STATIC_ASSERT(ValueArrayTag == 0);
         MOZ_ASSERT(!(addr & CellMask));
         obj = reinterpret_cast<JSObject*>(addr);
         uintptr_t addr2 = stack.pop();
         uintptr_t addr3 = stack.pop();
         MOZ_ASSERT(addr2 <= addr3);
         MOZ_ASSERT((addr3 - addr2) % sizeof(Value) == 0);
         vp = reinterpret_cast<HeapSlot*>(addr2);
         end = reinterpret_cast<HeapSlot*>(addr3);
         goto scan_value_array;
-    }
+      }
 
-    if (tag == ObjectTag) {
+      case ObjectTag: {
         obj = reinterpret_cast<JSObject*>(addr);
         JS_COMPARTMENT_ASSERT(runtime(), obj);
         goto scan_obj;
-    }
+      }
+
+      case GroupTag: {
+        return lazilyMarkChildren(reinterpret_cast<ObjectGroup*>(addr));
+      }
+
+      case JitCodeTag: {
+        return reinterpret_cast<jit::JitCode*>(addr)->traceChildren(this);
+      }
 
-    processMarkStackOther(tag, addr);
+      case SavedValueArrayTag: {
+        MOZ_ASSERT(!(addr & CellMask));
+        NativeObject* obj = reinterpret_cast<NativeObject*>(addr);
+        HeapValue* vp;
+        HeapValue* end;
+        if (restoreValueArray(obj, (void**)&vp, (void**)&end))
+            pushValueArray(obj, vp, end);
+        else
+            repush(obj);
+        return;
+      }
+
+      default: MOZ_CRASH("Invalid tag in mark stack");
+    }
     return;
 
   scan_value_array:
     MOZ_ASSERT(vp <= end);
     while (vp != end) {
         budget.step();
         if (budget.isOverBudget()) {
             pushValueArray(obj, vp, end);
--- a/js/src/gc/Tracer.h
+++ b/js/src/gc/Tracer.h
@@ -289,17 +289,16 @@ class GCMarker : public JSTracer
 
     bool isMarkStackEmpty() {
         return stack.isEmpty();
     }
 
     bool restoreValueArray(NativeObject* obj, void** vpp, void** endp);
     void saveValueRanges();
     inline void processMarkStackTop(SliceBudget& budget);
-    void processMarkStackOther(uintptr_t tag, uintptr_t addr);
 
     /* The color is only applied to objects and functions. */
     uint32_t color;
 
     /* Pointer to the top of the stack of arenas we are delaying marking on. */
     js::gc::ArenaHeader* unmarkedArenaStackTop;
 
     /* Count of arenas that are currently in the stack. */