diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-06-12 03:19:09 +0000 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-06-12 03:19:09 +0000 |
commit | e95089d84ac71276bd059e52293ab42c2259d89e (patch) | |
tree | 38c9c7a6b5f482d81bdfec1cf81ebc7bbb234800 /js/src/jsarray.h | |
parent | e34920575d6dac353cb3d8a5d1b9c11ae05c5a8c (diff) | |
download | UXP-e95089d84ac71276bd059e52293ab42c2259d89e.tar UXP-e95089d84ac71276bd059e52293ab42c2259d89e.tar.gz UXP-e95089d84ac71276bd059e52293ab42c2259d89e.tar.lz UXP-e95089d84ac71276bd059e52293ab42c2259d89e.tar.xz UXP-e95089d84ac71276bd059e52293ab42c2259d89e.zip |
Make use of ArrayObjects in favor of generic JS objects.
ArrayObjects has been a thing for years but been under-used. About time
they are used where prudent.
Diffstat (limited to 'js/src/jsarray.h')
-rw-r--r-- | js/src/jsarray.h | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/js/src/jsarray.h b/js/src/jsarray.h index e22cde881..ecde87c3b 100644 --- a/js/src/jsarray.h +++ b/js/src/jsarray.h @@ -72,30 +72,30 @@ 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 JSObject* +extern ArrayObject* NewDenseCopyOnWriteArray(JSContext* cx, HandleArrayObject templateObject, gc::InitialHeap heap); // The methods below can create either boxed or unboxed arrays. -extern JSObject* +extern ArrayObject* NewFullyAllocatedArrayTryUseGroup(ExclusiveContext* cx, HandleObjectGroup group, size_t length, NewObjectKind newKind = GenericObject); -extern JSObject* +extern ArrayObject* NewPartlyAllocatedArrayTryUseGroup(ExclusiveContext* cx, HandleObjectGroup group, size_t length); -extern JSObject* +extern ArrayObject* NewFullyAllocatedArrayTryReuseGroup(JSContext* cx, JSObject* obj, size_t length, NewObjectKind newKind = GenericObject); -extern JSObject* +extern ArrayObject* NewPartlyAllocatedArrayTryReuseGroup(JSContext* cx, JSObject* obj, size_t length); -extern JSObject* +extern ArrayObject* NewFullyAllocatedArrayForCallingAllocationSite(JSContext* cx, size_t length, NewObjectKind newKind = GenericObject); -extern JSObject* +extern ArrayObject* NewPartlyAllocatedArrayForCallingAllocationSite(JSContext* cx, size_t length, HandleObject proto); enum class ShouldUpdateTypes @@ -104,17 +104,13 @@ enum class ShouldUpdateTypes DontUpdate }; -extern bool -MaybeAnalyzeBeforeCreatingLargeArray(ExclusiveContext* cx, HandleObjectGroup group, - const Value* vp, size_t length); - -extern JSObject* +extern ArrayObject* NewCopiedArrayTryUseGroup(ExclusiveContext* cx, HandleObjectGroup group, const Value* vp, size_t length, NewObjectKind newKind = GenericObject, ShouldUpdateTypes updateTypes = ShouldUpdateTypes::Update); -extern JSObject* +extern ArrayObject* NewCopiedArrayForCallingAllocationSite(JSContext* cx, const Value* vp, size_t length, HandleObject proto = nullptr); @@ -202,7 +198,7 @@ array_splice(JSContext* cx, unsigned argc, js::Value* vp); extern bool NewbornArrayPush(JSContext* cx, HandleObject obj, const Value& v); -extern JSObject* +extern ArrayObject* ArrayConstructorOneArg(JSContext* cx, HandleObjectGroup group, int32_t lengthInt); #ifdef DEBUG |