diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-06-13 10:54:46 +0000 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-06-13 10:54:46 +0000 |
commit | 7ba3b14487a9116f963a5ff4634196da9a3c37e7 (patch) | |
tree | 0ad534cf743ec3e2425ffdfbd1cb3d0f7097155b | |
parent | ef8e0ce6075150ed4501edad1376e4046cd8e3cb (diff) | |
download | UXP-7ba3b14487a9116f963a5ff4634196da9a3c37e7.tar UXP-7ba3b14487a9116f963a5ff4634196da9a3c37e7.tar.gz UXP-7ba3b14487a9116f963a5ff4634196da9a3c37e7.tar.lz UXP-7ba3b14487a9116f963a5ff4634196da9a3c37e7.tar.xz UXP-7ba3b14487a9116f963a5ff4634196da9a3c37e7.zip |
Convert CopyBoxedOrUnboxedDenseElements to calls to initDenseElement
-rw-r--r-- | js/src/jit/BaselineIC.cpp | 4 | ||||
-rw-r--r-- | js/src/jsarray.cpp | 18 | ||||
-rw-r--r-- | js/src/vm/UnboxedObject-inl.h | 18 |
3 files changed, 13 insertions, 27 deletions
diff --git a/js/src/jit/BaselineIC.cpp b/js/src/jit/BaselineIC.cpp index 2b0822655..4a6382955 100644 --- a/js/src/jit/BaselineIC.cpp +++ b/js/src/jit/BaselineIC.cpp @@ -5769,7 +5769,9 @@ CopyArray(JSContext* cx, HandleArrayObject arr, MutableHandleValue result) if (!nobj) return false; EnsureArrayGroupAnalyzed(cx, nobj); //XXX - CopyBoxedOrUnboxedDenseElements(cx, nobj, arr, 0, 0, length); + nobj->as<NativeObject>().setDenseInitializedLength(length); + const Value* vp = arr->as<NativeObject>().getDenseElements(); + nobj->as<NativeObject>().initDenseElements(0, vp, length); result.setObject(*nobj); return true; diff --git a/js/src/jsarray.cpp b/js/src/jsarray.cpp index 9abc99e34..74f7c7c58 100644 --- a/js/src/jsarray.cpp +++ b/js/src/jsarray.cpp @@ -2458,9 +2458,9 @@ js::array_splice_impl(JSContext* cx, unsigned argc, Value* vp, bool returnValueI return false; /* Steps 10-11. */ - DebugOnly<DenseElementResult> result = - CopyBoxedOrUnboxedDenseElements(cx, arr, obj, 0, actualStart, actualDeleteCount); - MOZ_ASSERT(result.value == DenseElementResult::Success); + arr->as<NativeObject>().setDenseInitializedLength(actualStart + actualDeleteCount); + const Value* vp = obj->as<NativeObject>().getDenseElements() + actualStart; + arr->as<NativeObject>().initDenseElements(actualStart, vp, actualDeleteCount); /* Step 12 (implicit). */ } @@ -2825,10 +2825,10 @@ ArraySliceOrdinary(JSContext* cx, HandleObject obj, uint32_t length, uint32_t be MOZ_ASSERT(count >= narr->as<ArrayObject>().length()); narr->as<ArrayObject>().setLength(cx, count); - if (count) { - DebugOnly<DenseElementResult> result = - CopyBoxedOrUnboxedDenseElements(cx, narr, obj, 0, begin, count); - MOZ_ASSERT(result.value == DenseElementResult::Success); + if (count > 0) { + narr->as<NativeObject>().setDenseInitializedLength(begin + count); + const Value* vp = obj->as<NativeObject>().getDenseElements() + begin; + narr->as<NativeObject>().initDenseElements(begin, vp, count); } arr.set(narr); return true; @@ -2968,7 +2968,9 @@ ArraySliceDenseKernel(JSContext* cx, ArrayObject* arr, int32_t beginArg, int32_t if (count) { if (!result->ensureElements(cx, count)) return false; - CopyBoxedOrUnboxedDenseElements(cx, result, arr, 0, begin, count); + result->as<NativeObject>().setDenseInitializedLength(begin + count); + const Value* vp = arr->as<NativeObject>().getDenseElements() + begin; + result->as<NativeObject>().initDenseElements(begin, vp, count); } } diff --git a/js/src/vm/UnboxedObject-inl.h b/js/src/vm/UnboxedObject-inl.h index 711a064f2..069527141 100644 --- a/js/src/vm/UnboxedObject-inl.h +++ b/js/src/vm/UnboxedObject-inl.h @@ -226,24 +226,6 @@ MoveBoxedOrUnboxedDenseElements(JSContext* cx, JSObject* obj, uint32_t dstStart, return DenseElementResult::Success; } -static inline DenseElementResult -CopyBoxedOrUnboxedDenseElements(JSContext* cx, JSObject* dst, JSObject* src, - uint32_t dstStart, uint32_t srcStart, uint32_t length) -{ - MOZ_ASSERT(src->isNative()); - MOZ_ASSERT(dst->isNative()); - MOZ_ASSERT(dst->as<NativeObject>().getDenseInitializedLength() == dstStart); - MOZ_ASSERT(src->as<NativeObject>().getDenseInitializedLength() >= srcStart + length); - MOZ_ASSERT(dst->as<NativeObject>().getDenseCapacity() >= dstStart + length); - - dst->as<NativeObject>().setDenseInitializedLength(dstStart + length); - - const Value* vp = src->as<NativeObject>().getDenseElements() + srcStart; - dst->as<NativeObject>().initDenseElements(dstStart, vp, length); - - return DenseElementResult::Success; -} - } // namespace js #endif // vm_UnboxedObject_inl_h |