mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:17:44 +00:00
LibJS: Make TypedArray::element_name return FlyString instead of String
This ensures that comparison between TypedArray names will be essentially free (just a pointer comparison), which will allow us to efficiently implement specification steps like: "24. If srcType is the same as targetType, then" efficiently.
This commit is contained in:
parent
9839e2eeb6
commit
c7a8902746
3 changed files with 5 additions and 5 deletions
|
@ -28,14 +28,14 @@ static ThrowCompletionOr<ArrayBuffer*> validate_integer_typed_array(GlobalObject
|
|||
auto* buffer = typed_array.viewed_array_buffer();
|
||||
|
||||
// 4. Let typeName be typedArray.[[TypedArrayName]].
|
||||
auto type_name = typed_array.element_name();
|
||||
auto const& type_name = typed_array.element_name();
|
||||
|
||||
// 5. Let type be the Element Type value in Table 72 for typeName.
|
||||
|
||||
// 6. If waitable is true, then
|
||||
if (waitable) {
|
||||
// a. If typeName is not "Int32Array" or "BigInt64Array", throw a TypeError exception.
|
||||
if ((type_name != "Int32Array"sv) && (type_name != "BigInt64Array"sv))
|
||||
if ((type_name != vm.names.Int32Array.as_string()) && (type_name != vm.names.BigInt64Array.as_string()))
|
||||
return vm.throw_completion<TypeError>(global_object, ErrorType::TypedArrayTypeIsNot, type_name, "Int32 or BigInt64"sv);
|
||||
}
|
||||
// 7. Else,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue