mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 20:57:41 +00:00
LibJS: Make CreateDataByteBlock AO publicly available
At the same time, make CopyDataBlockBytes const-correct.
This commit is contained in:
parent
267074cd81
commit
56d0a0ac0f
2 changed files with 4 additions and 3 deletions
|
@ -51,7 +51,7 @@ void ArrayBuffer::visit_edges(Cell::Visitor& visitor)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 6.2.9.1 CreateByteDataBlock ( size ), https://tc39.es/ecma262/#sec-createbytedatablock
|
// 6.2.9.1 CreateByteDataBlock ( size ), https://tc39.es/ecma262/#sec-createbytedatablock
|
||||||
static ThrowCompletionOr<ByteBuffer> create_byte_data_block(VM& vm, size_t size)
|
ThrowCompletionOr<ByteBuffer> create_byte_data_block(VM& vm, size_t size)
|
||||||
{
|
{
|
||||||
// 1. If size > 2^53 - 1, throw a RangeError exception.
|
// 1. If size > 2^53 - 1, throw a RangeError exception.
|
||||||
if (size > MAX_ARRAY_LIKE_INDEX)
|
if (size > MAX_ARRAY_LIKE_INDEX)
|
||||||
|
@ -68,7 +68,7 @@ static ThrowCompletionOr<ByteBuffer> create_byte_data_block(VM& vm, size_t size)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 6.2.9.3 CopyDataBlockBytes ( toBlock, toIndex, fromBlock, fromIndex, count ), https://tc39.es/ecma262/#sec-copydatablockbytes
|
// 6.2.9.3 CopyDataBlockBytes ( toBlock, toIndex, fromBlock, fromIndex, count ), https://tc39.es/ecma262/#sec-copydatablockbytes
|
||||||
void copy_data_block_bytes(ByteBuffer& to_block, u64 to_index, ByteBuffer& from_block, u64 from_index, u64 count)
|
void copy_data_block_bytes(ByteBuffer& to_block, u64 to_index, ByteBuffer const& from_block, u64 from_index, u64 count)
|
||||||
{
|
{
|
||||||
// 1. Assert: fromBlock and toBlock are distinct values.
|
// 1. Assert: fromBlock and toBlock are distinct values.
|
||||||
VERIFY(&to_block != &from_block);
|
VERIFY(&to_block != &from_block);
|
||||||
|
|
|
@ -99,7 +99,8 @@ private:
|
||||||
Value m_detach_key;
|
Value m_detach_key;
|
||||||
};
|
};
|
||||||
|
|
||||||
void copy_data_block_bytes(ByteBuffer& to_block, u64 to_index, ByteBuffer& from_block, u64 from_index, u64 count);
|
ThrowCompletionOr<ByteBuffer> create_byte_data_block(VM& vm, size_t size);
|
||||||
|
void copy_data_block_bytes(ByteBuffer& to_block, u64 to_index, ByteBuffer const& from_block, u64 from_index, u64 count);
|
||||||
ThrowCompletionOr<ArrayBuffer*> allocate_array_buffer(VM&, FunctionObject& constructor, size_t byte_length);
|
ThrowCompletionOr<ArrayBuffer*> allocate_array_buffer(VM&, FunctionObject& constructor, size_t byte_length);
|
||||||
ThrowCompletionOr<void> detach_array_buffer(VM&, ArrayBuffer& array_buffer, Optional<Value> key = {});
|
ThrowCompletionOr<void> detach_array_buffer(VM&, ArrayBuffer& array_buffer, Optional<Value> key = {});
|
||||||
ThrowCompletionOr<ArrayBuffer*> clone_array_buffer(VM&, ArrayBuffer& source_buffer, size_t source_byte_offset, size_t source_length);
|
ThrowCompletionOr<ArrayBuffer*> clone_array_buffer(VM&, ArrayBuffer& source_buffer, size_t source_byte_offset, size_t source_length);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue