| Index: src/harmony-sharedarraybuffer.js
|
| diff --git a/src/harmony-sharedarraybuffer.js b/src/harmony-sharedarraybuffer.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..915e2b41460a98573c36624058f01225add76e81
|
| --- /dev/null
|
| +++ b/src/harmony-sharedarraybuffer.js
|
| @@ -0,0 +1,54 @@
|
| +// Copyright 2015 the V8 project authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +(function() {
|
| +
|
| +"use strict";
|
| +
|
| +%CheckIsBootstrapping();
|
| +
|
| +// -------------------------------------------------------------------
|
| +
|
| +var GlobalSharedArrayBuffer = global.SharedArrayBuffer;
|
| +
|
| +function SharedArrayBufferConstructor(length) { // length = 1
|
| + if (%_IsConstructCall()) {
|
| + var byteLength = ToPositiveInteger(length, 'invalid_array_buffer_length');
|
| + %ArrayBufferInitialize(this, byteLength);
|
| + } else {
|
| + throw MakeTypeError('constructor_not_function', ["SharedArrayBuffer"]);
|
| + }
|
| +}
|
| +
|
| +function SharedArrayBufferGetByteLen() {
|
| + if (!IS_SHAREDARRAYBUFFER(this)) {
|
| + throw MakeTypeError('incompatible_method_receiver',
|
| + ['SharedArrayBuffer.prototype.byteLength', this]);
|
| + }
|
| + return %_ArrayBufferGetByteLength(this);
|
| +}
|
| +
|
| +function SharedArrayBufferIsViewJS(obj) {
|
| + return %ArrayBufferIsView(obj);
|
| +}
|
| +
|
| +// Set up the SharedArrayBuffer constructor function.
|
| +%SetCode(GlobalSharedArrayBuffer, SharedArrayBufferConstructor);
|
| +%FunctionSetPrototype(GlobalSharedArrayBuffer, new $Object());
|
| +
|
| +// Set up the constructor property on the SharedArrayBuffer prototype object.
|
| +%AddNamedProperty(GlobalSharedArrayBuffer.prototype, "constructor",
|
| + GlobalSharedArrayBuffer, DONT_ENUM);
|
| +
|
| +%AddNamedProperty(GlobalSharedArrayBuffer.prototype,
|
| + symbolToStringTag, "SharedArrayBuffer", DONT_ENUM | READ_ONLY);
|
| +
|
| +InstallGetter(GlobalSharedArrayBuffer.prototype, "byteLength",
|
| + SharedArrayBufferGetByteLen);
|
| +
|
| +InstallFunctions(GlobalSharedArrayBuffer, DONT_ENUM, $Array(
|
| + "isView", SharedArrayBufferIsViewJS
|
| +));
|
| +
|
| +})();
|
|
|