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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 } | 81 } |
82 | 82 |
83 // 10. Let O be ? OrdinaryCreateFromConstructor(NewTarget, | 83 // 10. Let O be ? OrdinaryCreateFromConstructor(NewTarget, |
84 // "%DataViewPrototype%", «[[DataView]], [[ViewedArrayBuffer]], | 84 // "%DataViewPrototype%", «[[DataView]], [[ViewedArrayBuffer]], |
85 // [[ByteLength]], [[ByteOffset]]»). | 85 // [[ByteLength]], [[ByteOffset]]»). |
86 // 11. Set O's [[DataView]] internal slot to true. | 86 // 11. Set O's [[DataView]] internal slot to true. |
87 Handle<JSObject> result; | 87 Handle<JSObject> result; |
88 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, | 88 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, |
89 JSObject::New(target, new_target)); | 89 JSObject::New(target, new_target)); |
90 for (int i = 0; i < ArrayBufferView::kInternalFieldCount; ++i) { | 90 for (int i = 0; i < ArrayBufferView::kInternalFieldCount; ++i) { |
91 Handle<JSDataView>::cast(result)->SetInternalField(i, Smi::kZero); | 91 Handle<JSDataView>::cast(result)->SetInternalField(i, Smi::FromInt(0)); |
92 } | 92 } |
93 | 93 |
94 // 12. Set O's [[ViewedArrayBuffer]] internal slot to buffer. | 94 // 12. Set O's [[ViewedArrayBuffer]] internal slot to buffer. |
95 Handle<JSDataView>::cast(result)->set_buffer(*array_buffer); | 95 Handle<JSDataView>::cast(result)->set_buffer(*array_buffer); |
96 | 96 |
97 // 13. Set O's [[ByteLength]] internal slot to viewByteLength. | 97 // 13. Set O's [[ByteLength]] internal slot to viewByteLength. |
98 Handle<JSDataView>::cast(result)->set_byte_length(*view_byte_length); | 98 Handle<JSDataView>::cast(result)->set_byte_length(*view_byte_length); |
99 | 99 |
100 // 14. Set O's [[ByteOffset]] internal slot to offset. | 100 // 14. Set O's [[ByteOffset]] internal slot to offset. |
101 Handle<JSDataView>::cast(result)->set_byte_offset(*offset); | 101 Handle<JSDataView>::cast(result)->set_byte_offset(*offset); |
(...skipping 226 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 |