diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-02-23 14:41:40 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-04-14 12:57:13 +0200 |
commit | af69cb07db0d810a1a1a507b890e6beb23dc421c (patch) | |
tree | 2d52b9d0ac0dc9c48cd91631b7431b90d6703be6 /js/src/jsarray.h | |
parent | dc4695406f02e26009f5f54a858344911f1aa404 (diff) | |
download | UXP-af69cb07db0d810a1a1a507b890e6beb23dc421c.tar UXP-af69cb07db0d810a1a1a507b890e6beb23dc421c.tar.gz UXP-af69cb07db0d810a1a1a507b890e6beb23dc421c.tar.lz UXP-af69cb07db0d810a1a1a507b890e6beb23dc421c.tar.xz UXP-af69cb07db0d810a1a1a507b890e6beb23dc421c.zip |
Revert #1137 - Remove unboxed arrays
- accounting for removal of watch()/unwatch()
- updated for intermediate code changes.
Diffstat (limited to 'js/src/jsarray.h')
-rw-r--r-- | js/src/jsarray.h | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/js/src/jsarray.h b/js/src/jsarray.h index d0084731f..0ca580ba7 100644 --- a/js/src/jsarray.h +++ b/js/src/jsarray.h @@ -72,37 +72,49 @@ extern ArrayObject* NewDenseFullyAllocatedArrayWithTemplate(JSContext* cx, uint32_t length, JSObject* templateObject); /* Create a dense array with the same copy-on-write elements as another object. */ -extern ArrayObject* +extern JSObject* NewDenseCopyOnWriteArray(JSContext* cx, HandleArrayObject templateObject, gc::InitialHeap heap); -extern ArrayObject* +// The methods below can create either boxed or unboxed arrays. + +extern JSObject* NewFullyAllocatedArrayTryUseGroup(ExclusiveContext* cx, HandleObjectGroup group, size_t length, NewObjectKind newKind = GenericObject); -extern ArrayObject* +extern JSObject* NewPartlyAllocatedArrayTryUseGroup(ExclusiveContext* cx, HandleObjectGroup group, size_t length); -extern ArrayObject* +extern JSObject* NewFullyAllocatedArrayTryReuseGroup(JSContext* cx, HandleObject obj, size_t length, NewObjectKind newKind = GenericObject); -extern ArrayObject* +extern JSObject* NewPartlyAllocatedArrayTryReuseGroup(JSContext* cx, HandleObject obj, size_t length); -extern ArrayObject* +extern JSObject* NewFullyAllocatedArrayForCallingAllocationSite(JSContext* cx, size_t length, NewObjectKind newKind = GenericObject); -extern ArrayObject* +extern JSObject* NewPartlyAllocatedArrayForCallingAllocationSite(JSContext* cx, size_t length, HandleObject proto); -extern ArrayObject* +enum class ShouldUpdateTypes +{ + Update, + DontUpdate +}; + +extern bool +MaybeAnalyzeBeforeCreatingLargeArray(ExclusiveContext* cx, HandleObjectGroup group, + const Value* vp, size_t length); + +extern JSObject* NewCopiedArrayTryUseGroup(ExclusiveContext* cx, HandleObjectGroup group, const Value* vp, size_t length, NewObjectKind newKind = GenericObject, ShouldUpdateTypes updateTypes = ShouldUpdateTypes::Update); -extern ArrayObject* +extern JSObject* NewCopiedArrayForCallingAllocationSite(JSContext* cx, const Value* vp, size_t length, HandleObject proto = nullptr); @@ -117,6 +129,13 @@ NewValuePair(JSContext* cx, const Value& val1, const Value& val2, MutableHandleV extern bool WouldDefinePastNonwritableLength(HandleNativeObject obj, uint32_t index); +/* + * Canonicalize |vp| to a uint32_t value potentially suitable for use as an + * array length. + */ +extern bool +CanonicalizeArrayLengthValue(JSContext* cx, HandleValue v, uint32_t* canonicalized); + extern bool GetLengthProperty(JSContext* cx, HandleObject obj, uint32_t* lengthp); @@ -150,7 +169,7 @@ extern bool array_join(JSContext* cx, unsigned argc, js::Value* vp); extern void -ArrayShiftMoveElements(NativeObject* obj); +ArrayShiftMoveElements(JSObject* obj); extern bool array_shift(JSContext* cx, unsigned argc, js::Value* vp); @@ -182,7 +201,7 @@ extern const JSJitInfo array_splice_info; extern bool NewbornArrayPush(JSContext* cx, HandleObject obj, const Value& v); -extern ArrayObject* +extern JSObject* ArrayConstructorOneArg(JSContext* cx, HandleObjectGroup group, int32_t lengthInt); #ifdef DEBUG |