OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 (function(global, utils) { | 5 (function(global, utils) { |
6 | 6 |
7 "use strict"; | 7 "use strict"; |
8 | 8 |
9 %CheckIsBootstrapping(); | 9 %CheckIsBootstrapping(); |
10 | 10 |
11 var GlobalSharedArrayBuffer = global.SharedArrayBuffer; | 11 var GlobalSharedArrayBuffer = global.SharedArrayBuffer; |
12 var GlobalObject = global.Object; | 12 var GlobalObject = global.Object; |
| 13 var ToPositiveInteger; |
13 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol"); | 14 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol"); |
14 | 15 |
| 16 utils.Import(function(from) { |
| 17 ToPositiveInteger = from.ToPositiveInteger; |
| 18 }) |
| 19 |
15 // ------------------------------------------------------------------- | 20 // ------------------------------------------------------------------- |
16 | 21 |
17 function SharedArrayBufferConstructor(length) { // length = 1 | 22 function SharedArrayBufferConstructor(length) { // length = 1 |
18 if (%_IsConstructCall()) { | 23 if (%_IsConstructCall()) { |
19 var byteLength = $toPositiveInteger(length, kInvalidArrayBufferLength); | 24 var byteLength = ToPositiveInteger(length, kInvalidArrayBufferLength); |
20 %ArrayBufferInitialize(this, byteLength, kShared); | 25 %ArrayBufferInitialize(this, byteLength, kShared); |
21 } else { | 26 } else { |
22 throw MakeTypeError(kConstructorNotFunction, "SharedArrayBuffer"); | 27 throw MakeTypeError(kConstructorNotFunction, "SharedArrayBuffer"); |
23 } | 28 } |
24 } | 29 } |
25 | 30 |
26 function SharedArrayBufferGetByteLen() { | 31 function SharedArrayBufferGetByteLen() { |
27 if (!IS_SHAREDARRAYBUFFER(this)) { | 32 if (!IS_SHAREDARRAYBUFFER(this)) { |
28 throw MakeTypeError(kIncompatibleMethodReceiver, | 33 throw MakeTypeError(kIncompatibleMethodReceiver, |
29 'SharedArrayBuffer.prototype.byteLength', this); | 34 'SharedArrayBuffer.prototype.byteLength', this); |
(...skipping 18 matching lines...) Expand all Loading... |
48 toStringTagSymbol, "SharedArrayBuffer", DONT_ENUM | READ_ONLY); | 53 toStringTagSymbol, "SharedArrayBuffer", DONT_ENUM | READ_ONLY); |
49 | 54 |
50 utils.InstallGetter(GlobalSharedArrayBuffer.prototype, "byteLength", | 55 utils.InstallGetter(GlobalSharedArrayBuffer.prototype, "byteLength", |
51 SharedArrayBufferGetByteLen); | 56 SharedArrayBufferGetByteLen); |
52 | 57 |
53 utils.InstallFunctions(GlobalSharedArrayBuffer, DONT_ENUM, [ | 58 utils.InstallFunctions(GlobalSharedArrayBuffer, DONT_ENUM, [ |
54 "isView", SharedArrayBufferIsViewJS | 59 "isView", SharedArrayBufferIsViewJS |
55 ]); | 60 ]); |
56 | 61 |
57 }) | 62 }) |
OLD | NEW |