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 |
11 // ----------------------------------------------------------------------------- | 11 // ----------------------------------------------------------------------------- |
12 // ES6 section 24.2 DataView Objects | 12 // ES6 section 24.2 DataView Objects |
13 | 13 |
14 // ES6 section 24.2.2 The DataView Constructor for the [[Call]] case. | 14 // ES6 section 24.2.2 The DataView Constructor for the [[Call]] case. |
15 BUILTIN(DataViewConstructor) { | 15 BUILTIN(DataViewConstructor) { |
16 HandleScope scope(isolate); | 16 HandleScope scope(isolate); |
17 THROW_NEW_ERROR_RETURN_FAILURE( | 17 THROW_NEW_ERROR_RETURN_FAILURE( |
18 isolate, | 18 isolate, |
19 NewTypeError(MessageTemplate::kConstructorNotFunction, | 19 NewTypeError(MessageTemplate::kConstructorNotFunction, |
20 isolate->factory()->NewStringFromAsciiChecked("DataView"))); | 20 isolate->factory()->NewStringFromAsciiChecked("DataView"))); |
21 } | 21 } |
22 | 22 |
23 // ES6 section 24.2.2 The DataView Constructor for the [[Construct]] case. | 23 // ES6 section 24.2.2 The DataView Constructor for the [[Construct]] case. |
24 BUILTIN(DataViewConstructor_ConstructStub) { | 24 BUILTIN(DataViewConstructor_ConstructStub) { |
25 HandleScope scope(isolate); | 25 HandleScope scope(isolate); |
26 Handle<JSFunction> target = args.target<JSFunction>(); | 26 Handle<JSFunction> target = args.target(); |
27 Handle<JSReceiver> new_target = Handle<JSReceiver>::cast(args.new_target()); | 27 Handle<JSReceiver> new_target = Handle<JSReceiver>::cast(args.new_target()); |
28 Handle<Object> buffer = args.atOrUndefined(isolate, 1); | 28 Handle<Object> buffer = args.atOrUndefined(isolate, 1); |
29 Handle<Object> byte_offset = args.atOrUndefined(isolate, 2); | 29 Handle<Object> byte_offset = args.atOrUndefined(isolate, 2); |
30 Handle<Object> byte_length = args.atOrUndefined(isolate, 3); | 30 Handle<Object> byte_length = args.atOrUndefined(isolate, 3); |
31 | 31 |
32 // 2. If Type(buffer) is not Object, throw a TypeError exception. | 32 // 2. If Type(buffer) is not Object, throw a TypeError exception. |
33 // 3. If buffer does not have an [[ArrayBufferData]] internal slot, throw a | 33 // 3. If buffer does not have an [[ArrayBufferData]] internal slot, throw a |
34 // TypeError exception. | 34 // TypeError exception. |
35 if (!buffer->IsJSArrayBuffer()) { | 35 if (!buffer->IsJSArrayBuffer()) { |
36 THROW_NEW_ERROR_RETURN_FAILURE( | 36 THROW_NEW_ERROR_RETURN_FAILURE( |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 DATA_VIEW_PROTOTYPE_SET(Int16, int16_t) | 328 DATA_VIEW_PROTOTYPE_SET(Int16, int16_t) |
329 DATA_VIEW_PROTOTYPE_SET(Uint16, uint16_t) | 329 DATA_VIEW_PROTOTYPE_SET(Uint16, uint16_t) |
330 DATA_VIEW_PROTOTYPE_SET(Int32, int32_t) | 330 DATA_VIEW_PROTOTYPE_SET(Int32, int32_t) |
331 DATA_VIEW_PROTOTYPE_SET(Uint32, uint32_t) | 331 DATA_VIEW_PROTOTYPE_SET(Uint32, uint32_t) |
332 DATA_VIEW_PROTOTYPE_SET(Float32, float) | 332 DATA_VIEW_PROTOTYPE_SET(Float32, float) |
333 DATA_VIEW_PROTOTYPE_SET(Float64, double) | 333 DATA_VIEW_PROTOTYPE_SET(Float64, double) |
334 #undef DATA_VIEW_PROTOTYPE_SET | 334 #undef DATA_VIEW_PROTOTYPE_SET |
335 | 335 |
336 } // namespace internal | 336 } // namespace internal |
337 } // namespace v8 | 337 } // namespace v8 |
OLD | NEW |