| Index: src/runtime/runtime-typedarray.cc
|
| diff --git a/src/runtime/runtime-typedarray.cc b/src/runtime/runtime-typedarray.cc
|
| index 14368e58c6e796cae3e100c392037cd4869ca665..753cf97f9f5f113f662ba7a4d08a35709abeedbd 100644
|
| --- a/src/runtime/runtime-typedarray.cc
|
| +++ b/src/runtime/runtime-typedarray.cc
|
| @@ -12,6 +12,32 @@
|
|
|
| namespace v8 {
|
| namespace internal {
|
| +
|
| +
|
| +RUNTIME_FUNCTION(Runtime_ArrayBufferInitialize) {
|
| + HandleScope scope(isolate);
|
| + DCHECK(args.length() == 3);
|
| + CONVERT_ARG_HANDLE_CHECKED(JSArrayBuffer, holder, 0);
|
| + CONVERT_NUMBER_ARG_HANDLE_CHECKED(byteLength, 1);
|
| + CONVERT_BOOLEAN_ARG_CHECKED(is_shared, 2);
|
| + if (!holder->byte_length()->IsUndefined()) {
|
| + // ArrayBuffer is already initialized; probably a fuzz test.
|
| + return *holder;
|
| + }
|
| + size_t allocated_length = 0;
|
| + if (!TryNumberToSize(isolate, *byteLength, &allocated_length)) {
|
| + THROW_NEW_ERROR_RETURN_FAILURE(
|
| + isolate, NewRangeError(MessageTemplate::kInvalidArrayBufferLength));
|
| + }
|
| + if (!JSArrayBuffer::SetupAllocatingData(
|
| + holder, isolate, allocated_length, true,
|
| + is_shared ? SharedFlag::kShared : SharedFlag::kNotShared)) {
|
| + THROW_NEW_ERROR_RETURN_FAILURE(
|
| + isolate, NewRangeError(MessageTemplate::kArrayBufferAllocationFailed));
|
| + }
|
| + return *holder;
|
| +}
|
| +
|
|
|
| RUNTIME_FUNCTION(Runtime_ArrayBufferGetByteLength) {
|
| SealHandleScope shs(isolate);
|
| @@ -41,6 +67,14 @@
|
| uint8_t* target_data = reinterpret_cast<uint8_t*>(target->backing_store());
|
| CopyBytes(target_data, source_data + start, target_length);
|
| return isolate->heap()->undefined_value();
|
| +}
|
| +
|
| +
|
| +RUNTIME_FUNCTION(Runtime_ArrayBufferIsView) {
|
| + HandleScope scope(isolate);
|
| + DCHECK(args.length() == 1);
|
| + CONVERT_ARG_CHECKED(Object, object, 0);
|
| + return isolate->heap()->ToBoolean(object->IsJSArrayBufferView());
|
| }
|
|
|
|
|
|
|