| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
| 6 | 6 |
| 7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
| 8 #include "src/factory.h" | 8 #include "src/factory.h" |
| 9 #include "src/messages.h" | 9 #include "src/messages.h" |
| 10 #include "src/objects-inl.h" | 10 #include "src/objects-inl.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 } | 26 } |
| 27 size_t allocated_length = 0; | 27 size_t allocated_length = 0; |
| 28 if (!TryNumberToSize(isolate, *byteLength, &allocated_length)) { | 28 if (!TryNumberToSize(isolate, *byteLength, &allocated_length)) { |
| 29 THROW_NEW_ERROR_RETURN_FAILURE( | 29 THROW_NEW_ERROR_RETURN_FAILURE( |
| 30 isolate, NewRangeError(MessageTemplate::kInvalidArrayBufferLength)); | 30 isolate, NewRangeError(MessageTemplate::kInvalidArrayBufferLength)); |
| 31 } | 31 } |
| 32 if (!JSArrayBuffer::SetupAllocatingData( | 32 if (!JSArrayBuffer::SetupAllocatingData( |
| 33 holder, isolate, allocated_length, true, | 33 holder, isolate, allocated_length, true, |
| 34 is_shared ? SharedFlag::kShared : SharedFlag::kNotShared)) { | 34 is_shared ? SharedFlag::kShared : SharedFlag::kNotShared)) { |
| 35 THROW_NEW_ERROR_RETURN_FAILURE( | 35 THROW_NEW_ERROR_RETURN_FAILURE( |
| 36 isolate, NewRangeError(MessageTemplate::kInvalidArrayBufferLength)); | 36 isolate, NewRangeError(MessageTemplate::kArrayBufferAllocationFailed)); |
| 37 } | 37 } |
| 38 return *holder; | 38 return *holder; |
| 39 } | 39 } |
| 40 | 40 |
| 41 | 41 |
| 42 RUNTIME_FUNCTION(Runtime_ArrayBufferGetByteLength) { | 42 RUNTIME_FUNCTION(Runtime_ArrayBufferGetByteLength) { |
| 43 SealHandleScope shs(isolate); | 43 SealHandleScope shs(isolate); |
| 44 DCHECK(args.length() == 1); | 44 DCHECK(args.length() == 1); |
| 45 CONVERT_ARG_CHECKED(JSArrayBuffer, holder, 0); | 45 CONVERT_ARG_CHECKED(JSArrayBuffer, holder, 0); |
| 46 return holder->byte_length(); | 46 return holder->byte_length(); |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 DATA_VIEW_SETTER(Uint16, uint16_t) | 681 DATA_VIEW_SETTER(Uint16, uint16_t) |
| 682 DATA_VIEW_SETTER(Int16, int16_t) | 682 DATA_VIEW_SETTER(Int16, int16_t) |
| 683 DATA_VIEW_SETTER(Uint32, uint32_t) | 683 DATA_VIEW_SETTER(Uint32, uint32_t) |
| 684 DATA_VIEW_SETTER(Int32, int32_t) | 684 DATA_VIEW_SETTER(Int32, int32_t) |
| 685 DATA_VIEW_SETTER(Float32, float) | 685 DATA_VIEW_SETTER(Float32, float) |
| 686 DATA_VIEW_SETTER(Float64, double) | 686 DATA_VIEW_SETTER(Float64, double) |
| 687 | 687 |
| 688 #undef DATA_VIEW_SETTER | 688 #undef DATA_VIEW_SETTER |
| 689 } // namespace internal | 689 } // namespace internal |
| 690 } // namespace v8 | 690 } // namespace v8 |
| OLD | NEW |