mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:34:59 +00:00
Revert "LibJS: Add fast path for checking if attached TAs are OOB"
This reverts commit 5fd53652b7
.
This optimization is superseded by optimizing IsValidIntegerIndex for
TypedArrays with non-resizable ArrayBuffers. Reverting this commit has
no impact on test-js, test262, or live website performance.
This commit is contained in:
parent
d8eb297b95
commit
98552bf4c9
2 changed files with 6 additions and 14 deletions
|
@ -668,7 +668,7 @@ u32 typed_array_length_with_known_valid_bounds(TypedArrayWithBufferWitness const
|
|||
}
|
||||
|
||||
// 10.4.5.13 IsTypedArrayOutOfBounds ( taRecord ), https://tc39.es/ecma262/#sec-istypedarrayoutofbounds
|
||||
bool is_typed_array_out_of_bounds_for_known_attached_array(TypedArrayWithBufferWitness const& typed_array_record)
|
||||
bool is_typed_array_out_of_bounds(TypedArrayWithBufferWitness const& typed_array_record)
|
||||
{
|
||||
// 1. Let O be taRecord.[[Object]].
|
||||
auto object = typed_array_record.object;
|
||||
|
@ -677,7 +677,11 @@ bool is_typed_array_out_of_bounds_for_known_attached_array(TypedArrayWithBufferW
|
|||
auto const& buffer_byte_length = typed_array_record.cached_buffer_byte_length;
|
||||
|
||||
// 3. Assert: IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true if and only if bufferByteLength is detached.
|
||||
VERIFY(object->viewed_array_buffer()->is_detached() == buffer_byte_length.is_detached());
|
||||
|
||||
// 4. If bufferByteLength is detached, return true.
|
||||
if (buffer_byte_length.is_detached())
|
||||
return true;
|
||||
|
||||
// 5. Let byteOffsetStart be O.[[ByteOffset]].
|
||||
auto byte_offset_start = object->byte_offset();
|
||||
|
@ -715,7 +719,7 @@ bool is_valid_integer_index_slow_case(TypedArrayBase const& typed_array, Canonic
|
|||
// 5. NOTE: Bounds checking is not a synchronizing operation when O's backing buffer is a growable SharedArrayBuffer.
|
||||
|
||||
// 6. If IsTypedArrayOutOfBounds(taRecord) is true, return false.
|
||||
if (is_typed_array_out_of_bounds_for_known_attached_array(typed_array_record))
|
||||
if (is_typed_array_out_of_bounds(typed_array_record))
|
||||
return false;
|
||||
|
||||
// 7. Let length be TypedArrayLength(taRecord).
|
||||
|
|
|
@ -111,18 +111,6 @@ inline u32 typed_array_length(TypedArrayWithBufferWitness const& typed_array_rec
|
|||
return typed_array_length_with_known_valid_bounds(typed_array_record);
|
||||
}
|
||||
|
||||
// Fast-path version of IsTypedArrayOutOfBounds when you already know the TA is not detached.
|
||||
bool is_typed_array_out_of_bounds_for_known_attached_array(TypedArrayWithBufferWitness const&);
|
||||
|
||||
// 10.4.5.13 IsTypedArrayOutOfBounds ( taRecord ), https://tc39.es/ecma262/#sec-istypedarrayoutofbounds
|
||||
inline bool is_typed_array_out_of_bounds(TypedArrayWithBufferWitness const& typed_array_record)
|
||||
{
|
||||
if (typed_array_record.cached_buffer_byte_length.is_detached())
|
||||
return true;
|
||||
|
||||
return is_typed_array_out_of_bounds_for_known_attached_array(typed_array_record);
|
||||
}
|
||||
|
||||
bool is_valid_integer_index_slow_case(TypedArrayBase const&, CanonicalIndex property_index);
|
||||
|
||||
// 10.4.5.14 IsValidIntegerIndex ( O, index ), https://tc39.es/ecma262/#sec-isvalidintegerindex
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue