Commit ea1b92ce authored by Marja Hölttä's avatar Marja Hölttä Committed by V8 LUCI CQ

[cleanup] Cleanup JSArray::AllowsSetLength

Looks like historical leftovers from the time when we had "pixel arrays"
and external array elements kinds. See
https://codereview.chromium.org/1262583002

Bug: v8:11111
Change-Id: I288d47ae802218737bd6226cbb999c3289d1dbaf
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3574548Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Commit-Queue: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79823}
parent f3e0ee23
...@@ -43,12 +43,6 @@ bool JSArray::SetLengthWouldNormalize(Heap* heap, uint32_t new_length) { ...@@ -43,12 +43,6 @@ bool JSArray::SetLengthWouldNormalize(Heap* heap, uint32_t new_length) {
return new_length > kMaxFastArrayLength; return new_length > kMaxFastArrayLength;
} }
bool JSArray::AllowsSetLength() {
bool result = elements().IsFixedArray() || elements().IsFixedDoubleArray();
DCHECK(result == !HasTypedArrayElements());
return result;
}
void JSArray::SetContent(Handle<JSArray> array, void JSArray::SetContent(Handle<JSArray> array,
Handle<FixedArrayBase> storage) { Handle<FixedArrayBase> storage) {
EnsureCanContainElements(array, storage, storage->length(), EnsureCanContainElements(array, storage, storage->length(),
......
...@@ -57,8 +57,6 @@ class JSArray : public TorqueGeneratedJSArray<JSArray, JSObject> { ...@@ -57,8 +57,6 @@ class JSArray : public TorqueGeneratedJSArray<JSArray, JSObject> {
static inline bool SetLengthWouldNormalize(Heap* heap, uint32_t new_length); static inline bool SetLengthWouldNormalize(Heap* heap, uint32_t new_length);
// Initializes the array to a certain length. // Initializes the array to a certain length.
inline bool AllowsSetLength();
V8_EXPORT_PRIVATE static Maybe<bool> SetLength(Handle<JSArray> array, V8_EXPORT_PRIVATE static Maybe<bool> SetLength(Handle<JSArray> array,
uint32_t length); uint32_t length);
......
...@@ -5192,8 +5192,6 @@ void JSArray::Initialize(Handle<JSArray> array, int capacity, int length) { ...@@ -5192,8 +5192,6 @@ void JSArray::Initialize(Handle<JSArray> array, int capacity, int length) {
} }
Maybe<bool> JSArray::SetLength(Handle<JSArray> array, uint32_t new_length) { Maybe<bool> JSArray::SetLength(Handle<JSArray> array, uint32_t new_length) {
// We should never end in here with a pixel or external array.
DCHECK(array->AllowsSetLength());
if (array->SetLengthWouldNormalize(new_length)) { if (array->SetLengthWouldNormalize(new_length)) {
JSObject::NormalizeElements(array); JSObject::NormalizeElements(array);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment