diff options
-rw-r--r-- | js/src/jit/BaselineIC.cpp | 5 | ||||
-rw-r--r-- | js/src/jsarray.cpp | 6 | ||||
-rw-r--r-- | js/src/vm/UnboxedObject-inl.h | 25 |
3 files changed, 5 insertions, 31 deletions
diff --git a/js/src/jit/BaselineIC.cpp b/js/src/jit/BaselineIC.cpp index 7933160747..f11a254440 100644 --- a/js/src/jit/BaselineIC.cpp +++ b/js/src/jit/BaselineIC.cpp @@ -5830,10 +5830,7 @@ TryAttachStringSplit(JSContext* cx, ICCall_Fallback* stub, HandleScript script, if (!str) return false; - if (!SetAnyBoxedOrUnboxedDenseElement(cx, arrObj, i, StringValue(str))) { - // The value could not be stored to an unboxed dense element. - return true; - } + arrObj->as<NativeObject>().setDenseElementWithType(cx, i, StringValue(str)); } ICCall_StringSplit::Compiler compiler(cx, stub->fallbackMonitorStub()->firstMonitorStub(), diff --git a/js/src/jsarray.cpp b/js/src/jsarray.cpp index 05f7d371b1..a620621e5e 100644 --- a/js/src/jsarray.cpp +++ b/js/src/jsarray.cpp @@ -2888,7 +2888,8 @@ ArraySliceOrdinary(JSContext* cx, HandleObject obj, uint32_t length, uint32_t be RootedObject narr(cx, NewFullyAllocatedArrayTryReuseGroup(cx, obj, count)); if (!narr) return false; - SetAnyBoxedOrUnboxedArrayLength(cx, narr, end - begin); + MOZ_ASSERT((end - begin) >= narr->as<ArrayObject>().length()); + narr->as<ArrayObject>().setLength(cx, end - begin); if (count) { DebugOnly<DenseElementResult> result = @@ -3039,7 +3040,8 @@ ArraySliceDenseKernel(JSContext* cx, JSObject* obj, int32_t beginArg, int32_t en } } - SetAnyBoxedOrUnboxedArrayLength(cx, result, end - begin); + MOZ_ASSERT((end - begin) >= result->as<ArrayObject>().length()); + result->as<ArrayObject>().setLength(cx, end - begin); return DenseElementResult::Success; } diff --git a/js/src/vm/UnboxedObject-inl.h b/js/src/vm/UnboxedObject-inl.h index 606e457280..9dd64dd809 100644 --- a/js/src/vm/UnboxedObject-inl.h +++ b/js/src/vm/UnboxedObject-inl.h @@ -173,31 +173,6 @@ UnboxedPlainObject::layout() const } ///////////////////////////////////////////////////////////////////// -// Combined methods for NativeObject and UnboxedArrayObject accesses. -///////////////////////////////////////////////////////////////////// - -static inline void -SetAnyBoxedOrUnboxedArrayLength(JSContext* cx, JSObject* obj, size_t length) -{ - MOZ_ASSERT(length >= obj->as<ArrayObject>().length()); - obj->as<ArrayObject>().setLength(cx, length); -} - -static inline bool -SetAnyBoxedOrUnboxedDenseElement(JSContext* cx, JSObject* obj, size_t index, const Value& value) -{ - obj->as<NativeObject>().setDenseElementWithType(cx, index, value); - return true; -} - -static inline bool -InitAnyBoxedOrUnboxedDenseElement(JSContext* cx, JSObject* obj, size_t index, const Value& value) -{ - obj->as<NativeObject>().initDenseElementWithType(cx, index, value); - return true; -} - -///////////////////////////////////////////////////////////////////// // Template methods for NativeObject and UnboxedArrayObject accesses. ///////////////////////////////////////////////////////////////////// |