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 313087 319788a816f33f7275ba129977cb0378b26ed6a5
parent 313086 8c9117de1e7f40af42b7cbce25bc3780c032fe45
child 313088 7452e706f98556cec41158761f700b84d726ec98
push id20479
push userkwierso@gmail.com
push dateThu, 08 Sep 2016 01:08:46 +0000
treeherderfx-team@fb7c6b034329 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink
bugs1289165
milestone51.0a1
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);
     }