| 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 toStringTagSymbol = utils.ImportNow("to_string_tag_symbol"); |
| 13 | 14 |
| 14 // ------------------------------------------------------------------- | 15 // ------------------------------------------------------------------- |
| 15 | 16 |
| 16 function SharedArrayBufferConstructor(length) { // length = 1 | 17 function SharedArrayBufferConstructor(length) { // length = 1 |
| 17 if (%_IsConstructCall()) { | 18 if (%_IsConstructCall()) { |
| 18 var byteLength = $toPositiveInteger(length, kInvalidArrayBufferLength); | 19 var byteLength = $toPositiveInteger(length, kInvalidArrayBufferLength); |
| 19 %ArrayBufferInitialize(this, byteLength, kShared); | 20 %ArrayBufferInitialize(this, byteLength, kShared); |
| 20 } else { | 21 } else { |
| 21 throw MakeTypeError(kConstructorNotFunction, "SharedArrayBuffer"); | 22 throw MakeTypeError(kConstructorNotFunction, "SharedArrayBuffer"); |
| 22 } | 23 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 37 | 38 |
| 38 // Set up the SharedArrayBuffer constructor function. | 39 // Set up the SharedArrayBuffer constructor function. |
| 39 %SetCode(GlobalSharedArrayBuffer, SharedArrayBufferConstructor); | 40 %SetCode(GlobalSharedArrayBuffer, SharedArrayBufferConstructor); |
| 40 %FunctionSetPrototype(GlobalSharedArrayBuffer, new GlobalObject()); | 41 %FunctionSetPrototype(GlobalSharedArrayBuffer, new GlobalObject()); |
| 41 | 42 |
| 42 // Set up the constructor property on the SharedArrayBuffer prototype object. | 43 // Set up the constructor property on the SharedArrayBuffer prototype object. |
| 43 %AddNamedProperty(GlobalSharedArrayBuffer.prototype, "constructor", | 44 %AddNamedProperty(GlobalSharedArrayBuffer.prototype, "constructor", |
| 44 GlobalSharedArrayBuffer, DONT_ENUM); | 45 GlobalSharedArrayBuffer, DONT_ENUM); |
| 45 | 46 |
| 46 %AddNamedProperty(GlobalSharedArrayBuffer.prototype, | 47 %AddNamedProperty(GlobalSharedArrayBuffer.prototype, |
| 47 symbolToStringTag, "SharedArrayBuffer", DONT_ENUM | READ_ONLY); | 48 toStringTagSymbol, "SharedArrayBuffer", DONT_ENUM | READ_ONLY); |
| 48 | 49 |
| 49 utils.InstallGetter(GlobalSharedArrayBuffer.prototype, "byteLength", | 50 utils.InstallGetter(GlobalSharedArrayBuffer.prototype, "byteLength", |
| 50 SharedArrayBufferGetByteLen); | 51 SharedArrayBufferGetByteLen); |
| 51 | 52 |
| 52 utils.InstallFunctions(GlobalSharedArrayBuffer, DONT_ENUM, [ | 53 utils.InstallFunctions(GlobalSharedArrayBuffer, DONT_ENUM, [ |
| 53 "isView", SharedArrayBufferIsViewJS | 54 "isView", SharedArrayBufferIsViewJS |
| 54 ]); | 55 ]); |
| 55 | 56 |
| 56 }) | 57 }) |
| OLD | NEW |