mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:34:59 +00:00
Revert "LibJS: Add fast path for getting the TA length of valid TAs"
This reverts commit 9c943f36ed
.
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
98552bf4c9
commit
d0d22304e4
2 changed files with 6 additions and 16 deletions
|
@ -639,8 +639,11 @@ u32 typed_array_byte_length(TypedArrayWithBufferWitness const& typed_array_recor
|
|||
}
|
||||
|
||||
// 10.4.5.12 TypedArrayLength ( taRecord ), https://tc39.es/ecma262/#sec-typedarraylength
|
||||
u32 typed_array_length_with_known_valid_bounds(TypedArrayWithBufferWitness const& typed_array_record)
|
||||
u32 typed_array_length(TypedArrayWithBufferWitness const& typed_array_record)
|
||||
{
|
||||
// 1. Assert: IsTypedArrayOutOfBounds(taRecord) is false.
|
||||
VERIFY(!is_typed_array_out_of_bounds(typed_array_record));
|
||||
|
||||
// 2. Let O be taRecord.[[Object]].
|
||||
auto object = typed_array_record.object;
|
||||
|
||||
|
@ -723,7 +726,7 @@ bool is_valid_integer_index_slow_case(TypedArrayBase const& typed_array, Canonic
|
|||
return false;
|
||||
|
||||
// 7. Let length be TypedArrayLength(taRecord).
|
||||
auto length = typed_array_length_with_known_valid_bounds(typed_array_record);
|
||||
auto length = typed_array_length(typed_array_record);
|
||||
|
||||
// 8. If ℝ(index) < 0 or ℝ(index) ≥ length, return false.
|
||||
if (property_index.as_index() >= length)
|
||||
|
|
|
@ -96,21 +96,8 @@ struct TypedArrayWithBufferWitness {
|
|||
|
||||
TypedArrayWithBufferWitness make_typed_array_with_buffer_witness_record(TypedArrayBase const&, ArrayBuffer::Order);
|
||||
u32 typed_array_byte_length(TypedArrayWithBufferWitness const&);
|
||||
u32 typed_array_length(TypedArrayWithBufferWitness const&);
|
||||
bool is_typed_array_out_of_bounds(TypedArrayWithBufferWitness const&);
|
||||
|
||||
// Fast-path version of TypedArrayLength when you already know the TA is within its bounds,
|
||||
// i.e. you previously checked IsTypedArrayOutOfBounds.
|
||||
u32 typed_array_length_with_known_valid_bounds(TypedArrayWithBufferWitness const&);
|
||||
|
||||
// 10.4.5.12 TypedArrayLength ( taRecord ), https://tc39.es/ecma262/#sec-typedarraylength
|
||||
inline u32 typed_array_length(TypedArrayWithBufferWitness const& typed_array_record)
|
||||
{
|
||||
// 1. Assert: IsTypedArrayOutOfBounds(taRecord) is false.
|
||||
VERIFY(!is_typed_array_out_of_bounds(typed_array_record));
|
||||
|
||||
return typed_array_length_with_known_valid_bounds(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