Bug 1289165 - Apply the optimizations in moveDenseElements to unboxed objects; r=sfink
authorTerrence Cole <terrence@mozilla.com>
Tue, 06 Sep 2016 13:47:34 -0700
changeset 313075 319788a816f33f7275ba129977cb0378b26ed6a5
parent 313074 8c9117de1e7f40af42b7cbce25bc3780c032fe45
child 313076 7452e706f98556cec41158761f700b84d726ec98
push id30669
push userkwierso@gmail.com
push dateThu, 08 Sep 2016 00:56:12 +0000
treeherdermozilla-central@77940cbf0c2a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink
bugs1289165
milestone51.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 1289165 - Apply the optimizations in moveDenseElements to unboxed objects; r=sfink
js/src/vm/UnboxedObject-inl.h
--- a/js/src/vm/UnboxedObject-inl.h
+++ b/js/src/vm/UnboxedObject-inl.h
@@ -563,20 +563,22 @@ MoveBoxedOrUnboxedDenseElements(JSContex
     if (Type == JSVAL_TYPE_MAGIC) {
         if (!obj->as<NativeObject>().maybeCopyElementsForWrite(cx))
             return DenseElementResult::Failure;
         obj->as<NativeObject>().moveDenseElements(dstStart, srcStart, length);
     } else {
         uint8_t* data = obj->as<UnboxedArrayObject>().elements();
         size_t elementSize = UnboxedTypeSize(Type);
 
-        if (UnboxedTypeNeedsPreBarrier(Type)) {
+        if (UnboxedTypeNeedsPreBarrier(Type) &&
+            JS::shadow::Zone::asShadowZone(obj->zone())->needsIncrementalBarrier())
+        {
             // Trigger pre barriers on any elements we are overwriting. See
-            // moveDenseElements::moveDenseElements. No post barrier is needed
-            // as only whole cell post barriers are used with unboxed objects.
+            // NativeObject::moveDenseElements. No post barrier is needed as
+            // only whole cell post barriers are used with unboxed objects.
             for (size_t i = 0; i < length; i++)
                 obj->as<UnboxedArrayObject>().triggerPreBarrier<Type>(dstStart + i);
         }
 
         memmove(data + dstStart * elementSize,
                 data + srcStart * elementSize,
                 length * elementSize);
     }