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 MakeTypeError; | 13 var MakeTypeError; |
14 var ToPositiveInteger; | 14 var ToPositiveInteger; |
15 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol"); | 15 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol"); |
16 | 16 |
17 utils.Import(function(from) { | 17 utils.Import(function(from) { |
18 MakeTypeError = from.MakeTypeError; | 18 MakeTypeError = from.MakeTypeError; |
19 ToPositiveInteger = from.ToPositiveInteger; | 19 ToPositiveInteger = from.ToPositiveInteger; |
20 }) | 20 }) |
21 | 21 |
22 // ------------------------------------------------------------------- | 22 // ------------------------------------------------------------------- |
23 | 23 |
24 function SharedArrayBufferConstructor(length) { // length = 1 | 24 function SharedArrayBufferConstructor(length) { // length = 1 |
25 if (%_IsConstructCall()) { | 25 if (!IS_UNDEFINED(new.target)) { |
26 var byteLength = ToPositiveInteger(length, kInvalidArrayBufferLength); | 26 var byteLength = ToPositiveInteger(length, kInvalidArrayBufferLength); |
27 %ArrayBufferInitialize(this, byteLength, kShared); | 27 %ArrayBufferInitialize(this, byteLength, kShared); |
28 } else { | 28 } else { |
29 throw MakeTypeError(kConstructorNotFunction, "SharedArrayBuffer"); | 29 throw MakeTypeError(kConstructorNotFunction, "SharedArrayBuffer"); |
30 } | 30 } |
31 } | 31 } |
32 | 32 |
33 function SharedArrayBufferGetByteLen() { | 33 function SharedArrayBufferGetByteLen() { |
34 if (!IS_SHAREDARRAYBUFFER(this)) { | 34 if (!IS_SHAREDARRAYBUFFER(this)) { |
35 throw MakeTypeError(kIncompatibleMethodReceiver, | 35 throw MakeTypeError(kIncompatibleMethodReceiver, |
(...skipping 19 matching lines...) Expand all Loading... |
55 toStringTagSymbol, "SharedArrayBuffer", DONT_ENUM | READ_ONLY); | 55 toStringTagSymbol, "SharedArrayBuffer", DONT_ENUM | READ_ONLY); |
56 | 56 |
57 utils.InstallGetter(GlobalSharedArrayBuffer.prototype, "byteLength", | 57 utils.InstallGetter(GlobalSharedArrayBuffer.prototype, "byteLength", |
58 SharedArrayBufferGetByteLen); | 58 SharedArrayBufferGetByteLen); |
59 | 59 |
60 utils.InstallFunctions(GlobalSharedArrayBuffer, DONT_ENUM, [ | 60 utils.InstallFunctions(GlobalSharedArrayBuffer, DONT_ENUM, [ |
61 "isView", SharedArrayBufferIsViewJS | 61 "isView", SharedArrayBufferIsViewJS |
62 ]); | 62 ]); |
63 | 63 |
64 }) | 64 }) |
OLD | NEW |