Index: src/arraybuffer.js |
diff --git a/src/arraybuffer.js b/src/arraybuffer.js |
index cbb51433bb68e7781aa98443019f88d64f8d9c49..3c5ccbddf7db2baedc128357ae78a4c0f04f73d2 100644 |
--- a/src/arraybuffer.js |
+++ b/src/arraybuffer.js |
@@ -11,7 +11,7 @@ var $ArrayBuffer = global.ArrayBuffer; |
function ArrayBufferConstructor(length) { // length = 1 |
if (%_IsConstructCall()) { |
var byteLength = ToPositiveInteger(length, 'invalid_array_buffer_length'); |
- %ArrayBufferInitialize(this, byteLength); |
+ %ArrayBufferInitialize(this, byteLength, false); |
} else { |
throw MakeTypeError('constructor_not_function', ["ArrayBuffer"]); |
} |
@@ -92,3 +92,52 @@ function SetUpArrayBuffer() { |
} |
SetUpArrayBuffer(); |
+ |
+// ------------------------------------------------------------------- |
+ |
+var $SharedArrayBuffer = global.SharedArrayBuffer; |
+ |
+function SharedArrayBufferConstructor(length) { // length = 1 |
+ if (%_IsConstructCall()) { |
+ var byteLength = ToPositiveInteger(length, 'invalid_array_buffer_length'); |
+ %ArrayBufferInitialize(this, byteLength, true); |
+ } 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); |
+} |
+ |
+function SetUpSharedArrayBuffer() { |
+ %CheckIsBootstrapping(); |
+ |
+ // Set up the SharedArrayBuffer constructor function. |
+ %SetCode($SharedArrayBuffer, SharedArrayBufferConstructor); |
+ %FunctionSetPrototype($SharedArrayBuffer, new $Object()); |
+ |
+ // Set up the constructor property on the SharedArrayBuffer prototype object. |
+ %AddNamedProperty($SharedArrayBuffer.prototype, "constructor", |
+ $SharedArrayBuffer, DONT_ENUM); |
+ |
+ %AddNamedProperty($SharedArrayBuffer.prototype, |
+ symbolToStringTag, "SharedArrayBuffer", DONT_ENUM | READ_ONLY); |
+ |
+ InstallGetter($SharedArrayBuffer.prototype, "byteLength", |
+ SharedArrayBufferGetByteLen); |
+ |
+ InstallFunctions($SharedArrayBuffer, DONT_ENUM, $Array( |
+ "isView", SharedArrayBufferIsViewJS |
+ )); |
+} |
+ |
+SetUpSharedArrayBuffer(); |