OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/builtins/builtins.h" | 5 #include "src/builtins/builtins.h" |
6 #include "src/builtins/builtins-utils.h" | 6 #include "src/builtins/builtins-utils.h" |
7 | 7 |
8 namespace v8 { | 8 namespace v8 { |
9 namespace internal { | 9 namespace internal { |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, number_length, | 34 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, number_length, |
35 Object::ToInteger(isolate, length)); | 35 Object::ToInteger(isolate, length)); |
36 if (number_length->Number() < 0.0) { | 36 if (number_length->Number() < 0.0) { |
37 THROW_NEW_ERROR_RETURN_FAILURE( | 37 THROW_NEW_ERROR_RETURN_FAILURE( |
38 isolate, NewRangeError(MessageTemplate::kInvalidArrayBufferLength)); | 38 isolate, NewRangeError(MessageTemplate::kInvalidArrayBufferLength)); |
39 } | 39 } |
40 Handle<JSObject> result; | 40 Handle<JSObject> result; |
41 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, | 41 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, |
42 JSObject::New(target, new_target)); | 42 JSObject::New(target, new_target)); |
43 size_t byte_length; | 43 size_t byte_length; |
44 if (!TryNumberToSize(isolate, *number_length, &byte_length)) { | 44 if (!TryNumberToSize(*number_length, &byte_length)) { |
45 THROW_NEW_ERROR_RETURN_FAILURE( | 45 THROW_NEW_ERROR_RETURN_FAILURE( |
46 isolate, NewRangeError(MessageTemplate::kInvalidArrayBufferLength)); | 46 isolate, NewRangeError(MessageTemplate::kInvalidArrayBufferLength)); |
47 } | 47 } |
48 SharedFlag shared_flag = | 48 SharedFlag shared_flag = |
49 (*target == target->native_context()->array_buffer_fun()) | 49 (*target == target->native_context()->array_buffer_fun()) |
50 ? SharedFlag::kNotShared | 50 ? SharedFlag::kNotShared |
51 : SharedFlag::kShared; | 51 : SharedFlag::kShared; |
52 if (!JSArrayBuffer::SetupAllocatingData(Handle<JSArrayBuffer>::cast(result), | 52 if (!JSArrayBuffer::SetupAllocatingData(Handle<JSArrayBuffer>::cast(result), |
53 isolate, byte_length, true, | 53 isolate, byte_length, true, |
54 shared_flag)) { | 54 shared_flag)) { |
(...skipping 24 matching lines...) Expand all Loading... |
79 // ES6 section 24.1.3.1 ArrayBuffer.isView ( arg ) | 79 // ES6 section 24.1.3.1 ArrayBuffer.isView ( arg ) |
80 BUILTIN(ArrayBufferIsView) { | 80 BUILTIN(ArrayBufferIsView) { |
81 SealHandleScope shs(isolate); | 81 SealHandleScope shs(isolate); |
82 DCHECK_EQ(2, args.length()); | 82 DCHECK_EQ(2, args.length()); |
83 Object* arg = args[1]; | 83 Object* arg = args[1]; |
84 return isolate->heap()->ToBoolean(arg->IsJSArrayBufferView()); | 84 return isolate->heap()->ToBoolean(arg->IsJSArrayBufferView()); |
85 } | 85 } |
86 | 86 |
87 } // namespace internal | 87 } // namespace internal |
88 } // namespace v8 | 88 } // namespace v8 |
OLD | NEW |