From c2a63b819fef24dc0bd73d134016d3ba4e7795d1 Mon Sep 17 00:00:00 2001 From: Hans Larsen Date: Wed, 11 Dec 2024 14:55:08 -0800 Subject: [PATCH 1/5] Replace all u64/i64 for length, index or offsets into usize/isize On platforms that are 32-bits (or 128?) this should make array and iterations faster in general. On platforms that are 64-bits, this will have no effect. --- cli/src/debug/limits.rs | 16 +-- .../src/builtins/array/array_iterator.rs | 2 +- core/engine/src/builtins/array/mod.rs | 109 +++++++++--------- core/engine/src/builtins/array/tests.rs | 4 +- core/engine/src/builtins/array_buffer/mod.rs | 33 +++--- .../src/builtins/array_buffer/shared.rs | 23 ++-- .../engine/src/builtins/array_buffer/tests.rs | 4 +- .../engine/src/builtins/array_buffer/utils.rs | 2 +- core/engine/src/builtins/atomics/mod.rs | 7 +- core/engine/src/builtins/dataview/mod.rs | 25 ++-- core/engine/src/builtins/regexp/mod.rs | 42 +++---- core/engine/src/builtins/string/mod.rs | 12 +- .../src/builtins/typed_array/builtin.rs | 103 +++++++++-------- core/engine/src/builtins/typed_array/mod.rs | 10 +- .../engine/src/builtins/typed_array/object.rs | 30 +++-- core/engine/src/context/hooks.rs | 2 +- core/engine/src/error.rs | 2 +- core/engine/src/object/builtins/jsarray.rs | 4 +- .../src/object/builtins/jsarraybuffer.rs | 2 +- core/engine/src/object/builtins/jsdataview.rs | 20 ++-- .../object/builtins/jssharedarraybuffer.rs | 2 +- core/engine/src/object/operations.rs | 6 +- .../src/value/conversions/serde_json.rs | 2 +- core/engine/src/value/mod.rs | 8 +- core/engine/src/value/tests.rs | 2 +- core/engine/src/vm/opcode/templates/mod.rs | 4 +- examples/src/bin/jsarraybuffer.rs | 2 +- 27 files changed, 233 insertions(+), 245 deletions(-) diff --git a/cli/src/debug/limits.rs b/cli/src/debug/limits.rs index b73e7a45fa5..84017a3e1e1 100644 --- a/cli/src/debug/limits.rs +++ b/cli/src/debug/limits.rs @@ -2,7 +2,7 @@ use boa_engine::{ js_string, object::{FunctionObjectBuilder, ObjectInitializer}, property::Attribute, - Context, JsArgs, JsNativeError, JsObject, JsResult, JsValue, NativeFunction, + Context, JsArgs, JsObject, JsResult, JsValue, NativeFunction, }; fn get_loop(_: &JsValue, _: &[JsValue], context: &mut Context) -> JsResult { @@ -12,7 +12,9 @@ fn get_loop(_: &JsValue, _: &[JsValue], context: &mut Context) -> JsResult JsResult { let value = args.get_or_undefined(0).to_length(context)?; - context.runtime_limits_mut().set_loop_iteration_limit(value); + context + .runtime_limits_mut() + .set_loop_iteration_limit(value as u64); Ok(JsValue::undefined()) } @@ -23,11 +25,6 @@ fn get_stack(_: &JsValue, _: &[JsValue], context: &mut Context) -> JsResult JsResult { let value = args.get_or_undefined(0).to_length(context)?; - let Ok(value) = value.try_into() else { - return Err(JsNativeError::range() - .with_message(format!("Argument {value} greater than usize::MAX")) - .into()); - }; context.runtime_limits_mut().set_stack_size_limit(value); Ok(JsValue::undefined()) } @@ -39,11 +36,6 @@ fn get_recursion(_: &JsValue, _: &[JsValue], context: &mut Context) -> JsResult< fn set_recursion(_: &JsValue, args: &[JsValue], context: &mut Context) -> JsResult { let value = args.get_or_undefined(0).to_length(context)?; - let Ok(value) = value.try_into() else { - return Err(JsNativeError::range() - .with_message(format!("Argument {value} greater than usize::MAX")) - .into()); - }; context.runtime_limits_mut().set_recursion_limit(value); Ok(JsValue::undefined()) } diff --git a/core/engine/src/builtins/array/array_iterator.rs b/core/engine/src/builtins/array/array_iterator.rs index d323a7ad60a..1290769f35d 100644 --- a/core/engine/src/builtins/array/array_iterator.rs +++ b/core/engine/src/builtins/array/array_iterator.rs @@ -31,7 +31,7 @@ use boa_profiler::Profiler; #[derive(Debug, Clone, Finalize, Trace, JsData)] pub(crate) struct ArrayIterator { array: JsObject, - next_index: u64, + next_index: usize, #[unsafe_ignore_trace] kind: PropertyNameKind, done: bool, diff --git a/core/engine/src/builtins/array/mod.rs b/core/engine/src/builtins/array/mod.rs index f392efbe74f..4f0f109f12a 100644 --- a/core/engine/src/builtins/array/mod.rs +++ b/core/engine/src/builtins/array/mod.rs @@ -267,7 +267,7 @@ impl BuiltInConstructor for Array { debug_assert!(number_of_args >= 2); // b. Let array be ? ArrayCreate(numberOfArgs, proto). - let array = Self::array_create(number_of_args as u64, Some(prototype), context)?; + let array = Self::array_create(number_of_args, Some(prototype), context)?; // c. Let k be 0. // d. Repeat, while k < numberOfArgs, @@ -289,8 +289,8 @@ impl BuiltInConstructor for Array { impl Array { /// Optimized helper function, that sets the length of the array. - fn set_length(o: &JsObject, len: u64, context: &mut Context) -> JsResult<()> { - if o.is_array() && len < (2u64.pow(32) - 1) { + fn set_length(o: &JsObject, len: usize, context: &mut Context) -> JsResult<()> { + if o.is_array() && len < (u32::MAX - 1) as usize { let mut borrowed_object = o.borrow_mut(); if borrowed_object.properties().shape.to_addr_usize() == context @@ -317,12 +317,12 @@ impl Array { /// /// [spec]: https://tc39.es/ecma262/#sec-arraycreate pub(crate) fn array_create( - length: u64, + length: usize, prototype: Option, context: &mut Context, ) -> JsResult { // 1. If length > 2^32 - 1, throw a RangeError exception. - if length > 2u64.pow(32) - 1 { + if length > (u32::MAX - 1) as usize { return Err(JsNativeError::range() .with_message("array exceeded max size") .into()); @@ -455,7 +455,7 @@ impl Array { /// see: pub(crate) fn array_species_create( original_array: &JsObject, - length: u64, + length: usize, context: &mut Context, ) -> JsResult { // 1. Let isArray be ? IsArray(originalArray). @@ -617,7 +617,7 @@ impl Array { // i. If k ≥ 2^53 - 1 (MAX_SAFE_INTEGER), then // ... // ix. Set k to k + 1. - for k in 0..9_007_199_254_740_991_u64 { + for k in 0..(Number::MAX_SAFE_INTEGER as usize) { // iii. Let next be ? IteratorStepValue(iteratorRecord). let Some(next) = iterator_record.step_value(context)? else { // iv. If next is done, then @@ -702,7 +702,7 @@ impl Array { // a. Let A be ? ArrayCreate(len). let a = match this.as_constructor() { Some(constructor) => constructor.construct(&[len.into()], None, context)?, - _ => Self::array_create(len as u64, None, context)?, + _ => Self::array_create(len, None, context)?, }; // 6. Let k be 0. @@ -716,7 +716,7 @@ impl Array { } // 8. Perform ? Set(A, "length", lenNumber, true). - Self::set_length(&a, len as u64, context)?; + Self::set_length(&a, len, context)?; // 9. Return A. Ok(a.into()) @@ -781,7 +781,7 @@ impl Array { // 2. Let A be ? ArraySpeciesCreate(O, 0). let arr = Self::array_species_create(&obj, 0, context)?; // 3. Let n be 0. - let mut n = 0; + let mut n: usize = 0; // 4. Prepend O to items. // 5. For each element E of items, do for item in std::iter::once(&JsValue::new(obj)).chain(args.iter()) { @@ -796,7 +796,7 @@ impl Array { // ii. Let len be ? LengthOfArrayLike(E). let len = item.length_of_array_like(context)?; // iii. If n + len > 2^53 - 1, throw a TypeError exception. - if n + len > Number::MAX_SAFE_INTEGER as u64 { + if n.saturating_add(len) > Number::MAX_SAFE_INTEGER as usize { return Err(JsNativeError::typ() .with_message( "length + number of arguments exceeds the max safe integer limit", @@ -822,7 +822,7 @@ impl Array { else { // i. NOTE: E is added as a single item rather than spread. // ii. If n ≥ 2^53 - 1, throw a TypeError exception. - if n >= Number::MAX_SAFE_INTEGER as u64 { + if n >= Number::MAX_SAFE_INTEGER as usize { return Err(JsNativeError::typ() .with_message("length exceeds the max safe integer limit") .into()); @@ -862,9 +862,9 @@ impl Array { // 2. Let len be ? LengthOfArrayLike(O). let mut len = o.length_of_array_like(context)?; // 3. Let argCount be the number of elements in items. - let arg_count = args.len() as u64; + let arg_count = args.len(); // 4. If len + argCount > 2^53 - 1, throw a TypeError exception. - if len + arg_count > 2u64.pow(53) - 1 { + if len + arg_count > (Number::MAX_SAFE_INTEGER as usize) { return Err(JsNativeError::typ() .with_message( "the length + the number of arguments exceed the maximum safe integer limit", @@ -1200,7 +1200,7 @@ impl Array { if let IndexedProperties::DenseI32(dense) = &mut o_borrow.properties_mut().indexed_properties { - if len <= dense.len() as u64 { + if len <= dense.len() { let v = dense.remove(0); drop(o_borrow); Self::set_length(&o, len - 1, context)?; @@ -1210,7 +1210,7 @@ impl Array { if let IndexedProperties::DenseF64(dense) = &mut o_borrow.properties_mut().indexed_properties { - if len <= dense.len() as u64 { + if len <= dense.len() { let v = dense.remove(0); drop(o_borrow); Self::set_length(&o, len - 1, context)?; @@ -1218,7 +1218,7 @@ impl Array { } } if let Some(dense) = o_borrow.properties_mut().dense_indexed_properties_mut() { - if len <= dense.len() as u64 { + if len <= dense.len() { let v = dense.remove(0); drop(o_borrow); Self::set_length(&o, len - 1, context)?; @@ -1280,11 +1280,11 @@ impl Array { // 2. Let len be ? LengthOfArrayLike(O). let len = o.length_of_array_like(context)?; // 3. Let argCount be the number of elements in items. - let arg_count = args.len() as u64; + let arg_count = args.len(); // 4. If argCount > 0, then if arg_count > 0 { // a. If len + argCount > 2^53 - 1, throw a TypeError exception. - if len + arg_count > 2u64.pow(53) - 1 { + if len + arg_count > Number::MAX_SAFE_INTEGER as usize { return Err(JsNativeError::typ() .with_message("length + number of arguments exceeds the max safe integer limit") .into()); @@ -1768,8 +1768,8 @@ impl Array { // a. Set depthNum to ? ToIntegerOrInfinity(depth). // b. If depthNum < 0, set depthNum to 0. match depth.to_integer_or_infinity(context)? { - IntegerOrInfinity::Integer(value) if value >= 0 => depth_num = value as u64, - IntegerOrInfinity::PositiveInfinity => depth_num = u64::MAX, + IntegerOrInfinity::Integer(value) if value >= 0 => depth_num = value as usize, + IntegerOrInfinity::PositiveInfinity => depth_num = usize::MAX, _ => depth_num = 0, } }; @@ -1850,13 +1850,13 @@ impl Array { fn flatten_into_array( target: &JsObject, source: &JsObject, - source_len: u64, - start: u64, - depth: u64, + source_len: usize, + start: usize, + depth: usize, mapper_function: Option<&JsObject>, this_arg: &JsValue, context: &mut Context, - ) -> JsResult { + ) -> JsResult { // 1. Assert target is Object // 2. Assert source is Object @@ -1905,8 +1905,8 @@ impl Array { let element = element.as_object().expect("must be an object"); // 1. If depth is +Infinity let newDepth be +Infinity - let new_depth = if depth == u64::MAX { - u64::MAX + let new_depth = if depth == usize::MAX { + usize::MAX // 2. Else, let newDepth be depth - 1 } else { depth - 1 @@ -1930,7 +1930,7 @@ impl Array { // vi. Else } else { // 1. If targetIndex >= 2^53 - 1, throw a TypeError exception - if target_index >= Number::MAX_SAFE_INTEGER as u64 { + if target_index >= Number::MAX_SAFE_INTEGER as usize { return Err(JsNativeError::typ() .with_message("Target index exceeded max safe integer value") .into()); @@ -2117,7 +2117,7 @@ impl Array { let a = Self::array_species_create(&o, count, context)?; // 13. Let n be 0. - let mut n: u64 = 0; + let mut n = 0; // 14. Repeat, while k < final, while k < final_ { // a. Let Pk be ! ToString(𝔽(k)). @@ -2210,12 +2210,12 @@ impl Array { /// Gets the delete count of a splice operation. fn get_delete_count( - len: u64, - actual_start: u64, + len: usize, + actual_start: usize, start: Option<&JsValue>, delete_count: Option<&JsValue>, context: &mut Context, - ) -> JsResult { + ) -> JsResult { // 8. If start is not present, then let actual_delete_count = if start.is_none() { // a. Let actualDeleteCount be 0. @@ -2229,7 +2229,7 @@ impl Array { // b. Let actualDeleteCount be the result of clamping dc between 0 and len - actualStart. let max = len - actual_start; match dc { - IntegerOrInfinity::Integer(i) => u64::try_from(i) + IntegerOrInfinity::Integer(i) => usize::try_from(i) .unwrap_or_default() .clamp(0, len - actual_start), IntegerOrInfinity::PositiveInfinity => max, @@ -2272,13 +2272,13 @@ impl Array { Self::get_relative_start(context, start.unwrap_or(&JsValue::undefined()), len)?; // 7. Let itemCount be the number of elements in items. - let item_count = items.len() as u64; + let item_count = items.len(); let actual_delete_count = Self::get_delete_count(len, actual_start, start, delete_count, context)?; // If len + itemCount - actualDeleteCount > 2**53 - 1, throw a TypeError exception. - if len + item_count - actual_delete_count > Number::MAX_SAFE_INTEGER as u64 { + if len + item_count - actual_delete_count > Number::MAX_SAFE_INTEGER as usize { return Err(JsNativeError::typ() .with_message("Target splice exceeded max safe integer value") .into()); @@ -2303,7 +2303,7 @@ impl Array { // 15. Perform ? Set(A, "length", 𝔽(actualDeleteCount), true). Self::set_length(&arr, actual_delete_count, context)?; - let item_count = items.len() as u64; + let item_count = items.len(); match item_count.cmp(&actual_delete_count) { Ordering::Equal => {} @@ -2372,7 +2372,7 @@ impl Array { for (i, item) in items.iter().enumerate() { // a. Perform ? Set(O, ! ToString(𝔽(k)), E, true). // b. Set k to k + 1. - o.set(actual_start + i as u64, item.clone(), true, context)?; + o.set(actual_start + i, item.clone(), true, context)?; } // 20. Perform ? Set(O, "length", 𝔽(len - actualDeleteCount + itemCount), true). @@ -2406,7 +2406,7 @@ impl Array { Self::get_relative_start(context, start.unwrap_or(&JsValue::undefined()), len)?; // 7. Let insertCount be the number of elements in items. - let insert_count = items.len() as u64; + let insert_count = items.len(); let actual_skip_count = Self::get_delete_count(len, actual_start, start, skip_count, context)?; @@ -2415,7 +2415,7 @@ impl Array { let new_len = len + insert_count - actual_skip_count; // 12. If newLen > 2**53 - 1, throw a TypeError exception. - if new_len > Number::MAX_SAFE_INTEGER as u64 { + if new_len > Number::MAX_SAFE_INTEGER as usize { return Err(JsNativeError::typ() .with_message("Target splice exceeded max safe integer value") .into()); @@ -2593,7 +2593,7 @@ impl Array { /// [spec]: https://tc39.es/ecma262/#sec-sortindexedproperties pub(crate) fn sort_indexed_properties( obj: &JsObject, - len: u64, + len: usize, sort_compare: F, skip_holes: bool, context: &mut Context, @@ -2603,7 +2603,7 @@ impl Array { { // 1. Let items be a new empty List. // doesn't matter if it clamps since it's just a best-effort optimization - let mut items = Vec::with_capacity(len as usize); + let mut items = Vec::with_capacity(len); // 2. Let k be 0. // 3. Repeat, while k < len, @@ -2691,7 +2691,7 @@ impl Array { // 5. Let sortedList be ? SortIndexedProperties(obj, len, SortCompare, skip-holes). let sorted = Self::sort_indexed_properties(&obj, len, sort_compare, true, context)?; - let sorted_len = sorted.len() as u64; + let sorted_len = sorted.len(); // 6. Let itemCount be the number of elements in sortedList. // 7. Let j be 0. @@ -3144,11 +3144,12 @@ impl Array { .with_message("invalid integer index for TypedArray operation") .into()); }; + let relative_index = relative_index as isize; let value = args.get_or_undefined(1); // 4. If relativeIndex ≥ 0, let actualIndex be relativeIndex. - let actual_index = u64::try_from(relative_index) // should succeed if `relative_index >= 0` + let actual_index = usize::try_from(relative_index) // should succeed if `relative_index >= 0` .ok() // 5. Else, let actualIndex be len + relativeIndex. .or_else(|| len.checked_add_signed(relative_index)) @@ -3190,17 +3191,19 @@ impl Array { pub(super) fn get_relative_start( context: &mut Context, arg: &JsValue, - len: u64, - ) -> JsResult { + len: usize, + ) -> JsResult { // 1. Let relativeStart be ? ToIntegerOrInfinity(start). let relative_start = arg.to_integer_or_infinity(context)?; let start = match relative_start { // 2. If relativeStart is -∞, let k be 0. IntegerOrInfinity::NegativeInfinity => 0, // 3. Else if relativeStart < 0, let k be max(len + relativeStart, 0). - IntegerOrInfinity::Integer(i) if i < 0 => len.checked_add_signed(i).unwrap_or(0), + IntegerOrInfinity::Integer(i) if i < 0 => { + len.checked_add_signed(i as isize).unwrap_or(0) + } // 4. Else, let k be min(relativeStart, len). - IntegerOrInfinity::Integer(i) => min(i as u64, len), + IntegerOrInfinity::Integer(i) => min(i as usize, len), // Special case - positive infinity. `len` is always smaller than +inf, thus from (4) IntegerOrInfinity::PositiveInfinity => len, @@ -3213,8 +3216,8 @@ impl Array { pub(super) fn get_relative_end( context: &mut Context, value: &JsValue, - len: u64, - ) -> JsResult { + len: usize, + ) -> JsResult { // 1. If end is undefined, let relativeEnd be len [and return it] if value.is_undefined() { Ok(len) @@ -3225,10 +3228,12 @@ impl Array { // 2. If relativeEnd is -∞, let final be 0. IntegerOrInfinity::NegativeInfinity => 0, // 3. Else if relativeEnd < 0, let final be max(len + relativeEnd, 0). - IntegerOrInfinity::Integer(i) if i < 0 => len.checked_add_signed(i).unwrap_or(0), + IntegerOrInfinity::Integer(i) if i < 0 => { + len.checked_add_signed(i as isize).unwrap_or(0) + } // 4. Else, let final be min(relativeEnd, len). // Both `as` casts are safe as both variables are non-negative - IntegerOrInfinity::Integer(i) => min(i as u64, len), + IntegerOrInfinity::Integer(i) => min(i as usize, len), // Special case - positive infinity. `len` is always smaller than +inf, thus from (4) IntegerOrInfinity::PositiveInfinity => len, @@ -3350,7 +3355,7 @@ fn compare_array_elements( /// [spec]: https://tc39.es/ecma262/#sec-findviapredicate pub(crate) fn find_via_predicate( o: &JsObject, - len: u64, + len: usize, direction: Direction, predicate: &JsValue, this_arg: &JsValue, diff --git a/core/engine/src/builtins/array/tests.rs b/core/engine/src/builtins/array/tests.rs index 4df066ca815..d6e8a27469a 100644 --- a/core/engine/src/builtins/array/tests.rs +++ b/core/engine/src/builtins/array/tests.rs @@ -874,7 +874,7 @@ fn array_spread_non_iterable() { #[test] fn get_relative_start() { #[track_caller] - fn assert(context: &mut Context, arg: Option<&JsValue>, len: u64, expected: u64) { + fn assert(context: &mut Context, arg: Option<&JsValue>, len: usize, expected: usize) { let arg = arg.unwrap_or(&JsValue::Undefined); assert_eq!( Array::get_relative_start(context, arg, len).unwrap(), @@ -901,7 +901,7 @@ fn get_relative_start() { #[test] fn get_relative_end() { #[track_caller] - fn assert(context: &mut Context, arg: Option<&JsValue>, len: u64, expected: u64) { + fn assert(context: &mut Context, arg: Option<&JsValue>, len: usize, expected: usize) { let arg = arg.unwrap_or(&JsValue::Undefined); assert_eq!( Array::get_relative_end(context, arg, len).unwrap(), diff --git a/core/engine/src/builtins/array_buffer/mod.rs b/core/engine/src/builtins/array_buffer/mod.rs index 7c2e3197022..0052be69156 100644 --- a/core/engine/src/builtins/array_buffer/mod.rs +++ b/core/engine/src/builtins/array_buffer/mod.rs @@ -201,7 +201,7 @@ pub struct ArrayBuffer { data: Option>, /// The `[[ArrayBufferMaxByteLength]]` internal slot. - max_byte_len: Option, + max_byte_len: Option, /// The `[[ArrayBufferDetachKey]]` internal slot. detach_key: JsValue, @@ -501,7 +501,7 @@ impl ArrayBuffer { // 6. Else, // a. Let length be O.[[ArrayBufferMaxByteLength]]. // 7. Return 𝔽(length). - Ok(buf.max_byte_len.unwrap_or(data.len() as u64).into()) + Ok(buf.max_byte_len.unwrap_or(data.len()).into()) } /// [`get ArrayBuffer.prototype.resizable`][spec]. @@ -609,7 +609,7 @@ impl ArrayBuffer { // Implementations may implement this method as in-place growth or shrinkage. // 14. Set O.[[ArrayBufferData]] to newBlock. // 15. Set O.[[ArrayBufferByteLength]] to newByteLength. - buf.resize(new_byte_length as usize, 0); + buf.resize(new_byte_length, 0); // 16. Return undefined. Ok(JsValue::undefined()) @@ -642,7 +642,7 @@ impl ArrayBuffer { .into()); } // 5. Let len be O.[[ArrayBufferByteLength]]. - buf.data.len() as u64 + buf.data.len() }; // 6. Let relativeStart be ? ToIntegerOrInfinity(start). @@ -695,7 +695,7 @@ impl ArrayBuffer { }; // 21. If new.[[ArrayBufferByteLength]] < newLen, throw a TypeError exception. - if (to_buf.len() as u64) < new_len { + if to_buf.len() < new_len { return Err(JsNativeError::typ() .with_message("new ArrayBuffer length too small") .into()); @@ -712,8 +712,8 @@ impl ArrayBuffer { }; // 26. Perform CopyDataBlockBytes(toBuf, 0, fromBuf, first, newLen). - let first = first as usize; - let new_len = new_len as usize; + let first = first; + let new_len = new_len; to_buf[..new_len].copy_from_slice(&from_buf[first..first + new_len]); } @@ -756,7 +756,7 @@ impl ArrayBuffer { // 3. If newLength is undefined, then let new_len = if new_length.is_undefined() { // a. Let newByteLength be arrayBuffer.[[ArrayBufferByteLength]]. - buf.borrow().data.len() as u64 + buf.borrow().data.len() } else { // 4. Else, // a. Let newByteLength be ? ToIndex(newLength). @@ -805,9 +805,9 @@ impl ArrayBuffer { .into()); } // Should only truncate without reallocating. - bytes.resize(new_len as usize, 0); + bytes.resize(new_len, 0); } else { - bytes.resize(new_len as usize, 0); + bytes.resize(new_len, 0); // Realloc the vec to fit onto the new exact length. bytes.shrink_to_fit(); @@ -839,8 +839,8 @@ impl ArrayBuffer { /// [spec]: https://tc39.es/ecma262/#sec-allocatearraybuffer pub(crate) fn allocate( constructor: &JsValue, - byte_len: u64, - max_byte_len: Option, + byte_len: usize, + max_byte_len: Option, context: &mut Context, ) -> JsResult> { // 1. Let slots be « [[ArrayBufferData]], [[ArrayBufferByteLength]], [[ArrayBufferDetachKey]] ». @@ -892,7 +892,7 @@ impl ArrayBuffer { /// Abstract operation [`GetArrayBufferMaxByteLengthOption ( options )`][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-getarraybuffermaxbytelengthoption -fn get_max_byte_len(options: &JsValue, context: &mut Context) -> JsResult> { +fn get_max_byte_len(options: &JsValue, context: &mut Context) -> JsResult> { // 1. If options is not an Object, return empty. let Some(options) = options.as_object() else { return Ok(None); @@ -917,8 +917,8 @@ fn get_max_byte_len(options: &JsValue, context: &mut Context) -> JsResult