mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-09 18:41:53 +00:00
LibJS: Add fast path for float to int put
This commit adds a fast path for putting values into a TypedArray of an integer type, when the value being put in is a double. This leads to a 6% speedup on JetStream/gcc-loops.js.
This commit is contained in:
parent
0061c64ee6
commit
34c14d4e6d
Notes:
github-actions[bot]
2025-05-14 10:34:33 +00:00
Author: https://github.com/R-Goc
Commit: 34c14d4e6d
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4723
Reviewed-by: https://github.com/awesomekling
1 changed files with 18 additions and 0 deletions
|
@ -1431,6 +1431,24 @@ inline ThrowCompletionOr<void> put_by_value(VM& vm, Value base, Optional<FlyStri
|
|||
case TypedArrayBase::Kind::Float64Array:
|
||||
fast_typed_array_set_element<double>(typed_array, index, value.as_double());
|
||||
return {};
|
||||
case TypedArrayBase::Kind::Int8Array:
|
||||
fast_typed_array_set_element<i8>(typed_array, index, MUST(value.to_i8(vm)));
|
||||
return {};
|
||||
case TypedArrayBase::Kind::Int16Array:
|
||||
fast_typed_array_set_element<i16>(typed_array, index, MUST(value.to_i16(vm)));
|
||||
return {};
|
||||
case TypedArrayBase::Kind::Int32Array:
|
||||
fast_typed_array_set_element<i32>(typed_array, index, MUST(value.to_i32(vm)));
|
||||
return {};
|
||||
case TypedArrayBase::Kind::Uint8Array:
|
||||
fast_typed_array_set_element<u8>(typed_array, index, MUST(value.to_u8(vm)));
|
||||
return {};
|
||||
case TypedArrayBase::Kind::Uint16Array:
|
||||
fast_typed_array_set_element<u16>(typed_array, index, MUST(value.to_u16(vm)));
|
||||
return {};
|
||||
case TypedArrayBase::Kind::Uint32Array:
|
||||
fast_typed_array_set_element<u32>(typed_array, index, MUST(value.to_u32(vm)));
|
||||
return {};
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue