Bug 925397 - Add JSObject::initDenseElementsUnbarriered() for use from PJS r=terrence
☠☠ backed out by 8634b1561f79 ☠ ☠
authorJon Coppeard <jcoppeard@mozilla.com>
Mon, 14 Oct 2013 10:15:47 +0100
changeset 150620 c52934a52f94a46fdc18a68ce221388b9cda5fa1
parent 150619 3620f49eb6e9b5367ee682d24832d87b80cb01df
child 150621 36e0e491b83ce4401e7806dc616695e5a11401e6
push id34919
push userjcoppeard@mozilla.com
push dateMon, 14 Oct 2013 09:33:45 +0000
treeherdermozilla-inbound@36e0e491b83c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersterrence
bugs925397
milestone27.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 925397 - Add JSObject::initDenseElementsUnbarriered() for use from PJS r=terrence
js/src/jit/ParallelFunctions.cpp
js/src/jsobj.h
--- a/js/src/jit/ParallelFunctions.cpp
+++ b/js/src/jit/ParallelFunctions.cpp
@@ -561,14 +561,14 @@ jit::InitRestParameterPar(ForkJoinSlice 
     JS_ASSERT(!res->getDenseInitializedLength());
     JS_ASSERT(res->type() == templateObj->type());
 
     if (length > 0) {
         JSObject::EnsureDenseResult edr =
             res->ensureDenseElementsPreservePackedFlag(slice, 0, length);
         if (edr != JSObject::ED_OK)
             return nullptr;
-        res->initDenseElements(0, rest, length);
+        res->initDenseElementsUnbarriered(0, rest, length);
         res->as<ArrayObject>().setLengthInt32(length);
     }
 
     return res;
 }
--- a/js/src/jsobj.h
+++ b/js/src/jsobj.h
@@ -662,17 +662,27 @@ class JSObject : public js::ObjectImpl
             memcpy(&elements[dstStart], src, count * sizeof(js::HeapSlot));
             DenseRangeWriteBarrierPost(rt, this, dstStart, count);
         }
     }
 
     void initDenseElements(uint32_t dstStart, const js::Value *src, uint32_t count) {
         JS_ASSERT(dstStart + count <= getDenseCapacity());
         memcpy(&elements[dstStart], src, count * sizeof(js::HeapSlot));
-        DenseRangeWriteBarrierPost(runtimeFromAnyThread(), this, dstStart, count);
+        DenseRangeWriteBarrierPost(runtimeFromMainThread(), this, dstStart, count);
+    }
+
+    void initDenseElementsUnbarriered(uint32_t dstStart, const js::Value *src, uint32_t count) {
+        /*
+         * For use by parallel threads, which since they cannot see nursery
+         * things do not require a barrier.
+         */
+        JS_ASSERT(!js::CurrentThreadCanAccessRuntime(runtimeFromAnyThread()));
+        JS_ASSERT(dstStart + count <= getDenseCapacity());
+        memcpy(&elements[dstStart], src, count * sizeof(js::HeapSlot));
     }
 
     void moveDenseElements(uint32_t dstStart, uint32_t srcStart, uint32_t count) {
         JS_ASSERT(dstStart + count <= getDenseCapacity());
         JS_ASSERT(srcStart + count <= getDenseInitializedLength());
 
         /*
          * Using memmove here would skip write barriers. Also, we need to consider