| Index: src/arraybuffer.js
|
| diff --git a/src/arraybuffer.js b/src/arraybuffer.js
|
| index 07924e4b818952dab5a3378b17c058a5a8b1f143..3f434eee86d31a3db4a78e0cb7a394daff6bfa48 100644
|
| --- a/src/arraybuffer.js
|
| +++ b/src/arraybuffer.js
|
| @@ -31,10 +31,11 @@ var $ArrayBuffer = global.ArrayBuffer;
|
|
|
| // -------------------------------------------------------------------
|
|
|
| -function ArrayBufferConstructor(length) { // length = 1
|
| +function ArrayBufferConstructor(length, shared) { // length = 1
|
| if (%_IsConstructCall()) {
|
| var byteLength = ToPositiveInteger(length, 'invalid_array_buffer_length');
|
| - %ArrayBufferInitialize(this, byteLength);
|
| + var is_shared = !!shared;
|
| + %ArrayBufferInitialize(this, byteLength, is_shared);
|
| } else {
|
| throw MakeTypeError('constructor_not_function', ["ArrayBuffer"]);
|
| }
|
| @@ -48,6 +49,14 @@ function ArrayBufferGetByteLength() {
|
| return %_ArrayBufferGetByteLength(this);
|
| }
|
|
|
| +function ArrayBufferGetShared() {
|
| + if (!IS_ARRAYBUFFER(this)) {
|
| + throw MakeTypeError('incompatible_method_receiver',
|
| + ['ArrayBuffer.prototype.shared', this]);
|
| + }
|
| + return %ArrayBufferGetShared(this);
|
| +}
|
| +
|
| // ES6 Draft 15.13.5.5.3
|
| function ArrayBufferSlice(start, end) {
|
| if (!IS_ARRAYBUFFER(this)) {
|
| @@ -89,6 +98,80 @@ function ArrayBufferIsView(obj) {
|
| return %ArrayBufferIsView(obj);
|
| }
|
|
|
| +function ArrayBufferMutexInit(addr) {
|
| + var a = TO_INTEGER(addr);
|
| + return %ArrayBufferMutexInit(this, a);
|
| +}
|
| +
|
| +function ArrayBufferMutexDestroy(addr) {
|
| + var a = TO_INTEGER(addr);
|
| + return %ArrayBufferMutexDestroy(this, a);
|
| +}
|
| +
|
| +function ArrayBufferMutexLock(addr) {
|
| + var a = TO_INTEGER(addr);
|
| + return %ArrayBufferMutexLock(this, a);
|
| +}
|
| +
|
| +function ArrayBufferMutexUnlock(addr) {
|
| + var a = TO_INTEGER(addr);
|
| + return %ArrayBufferMutexUnlock(this, a);
|
| +}
|
| +
|
| +function ArrayBufferMutexSize(obj) {
|
| + return %ArrayBufferMutexSize(obj);
|
| +}
|
| +
|
| +function ArrayBufferCondInit(addr) {
|
| + var a = TO_INTEGER(addr);
|
| + return %ArrayBufferCondInit(this, a);
|
| +}
|
| +
|
| +function ArrayBufferCondDestroy(addr) {
|
| + var a = TO_INTEGER(addr);
|
| + return %ArrayBufferCondDestroy(this, a);
|
| +}
|
| +
|
| +function ArrayBufferCondWait(caddr, maddr) {
|
| + var ca = TO_INTEGER(caddr);
|
| + var ma = TO_INTEGER(maddr);
|
| + return %ArrayBufferCondWait(this, ca, ma);
|
| +}
|
| +
|
| +function ArrayBufferCondSignal(addr) {
|
| + var a = TO_INTEGER(addr);
|
| + return %ArrayBufferCondSignal(this, a);
|
| +}
|
| +
|
| +function ArrayBufferCondBroadcast(addr) {
|
| + var a = TO_INTEGER(addr);
|
| + return %ArrayBufferCondBroadcast(this, a);
|
| +}
|
| +
|
| +function ArrayBufferCondSize(obj) {
|
| + return %ArrayBufferCondSize(obj);
|
| +}
|
| +
|
| +function ArrayBufferBarrierInit(addr, count) {
|
| + var a = TO_INTEGER(addr);
|
| + var c = TO_INTEGER(count);
|
| + return %ArrayBufferBarrierInit(this, a, c);
|
| +}
|
| +
|
| +function ArrayBufferBarrierDestroy(addr) {
|
| + var a = TO_INTEGER(addr);
|
| + return %ArrayBufferBarrierDestroy(this, a);
|
| +}
|
| +
|
| +function ArrayBufferBarrierWait(addr) {
|
| + var a = TO_INTEGER(addr);
|
| + return %ArrayBufferBarrierWait(this, a);
|
| +}
|
| +
|
| +function ArrayBufferBarrierSize(obj) {
|
| + return %ArrayBufferBarrierSize(obj);
|
| +}
|
| +
|
| function SetUpArrayBuffer() {
|
| %CheckIsBootstrapping();
|
|
|
| @@ -101,11 +184,28 @@ function SetUpArrayBuffer() {
|
|
|
| InstallGetter($ArrayBuffer.prototype, "byteLength", ArrayBufferGetByteLength);
|
|
|
| + InstallGetter($ArrayBuffer.prototype, "shared", ArrayBufferGetShared);
|
| +
|
| InstallFunctions($ArrayBuffer, DONT_ENUM, $Array(
|
| "isView", ArrayBufferIsView
|
| ));
|
|
|
| InstallFunctions($ArrayBuffer.prototype, DONT_ENUM, $Array(
|
| + "mutexInit", ArrayBufferMutexInit,
|
| + "mutexDestroy", ArrayBufferMutexDestroy,
|
| + "mutexLock", ArrayBufferMutexLock,
|
| + "mutexUnlock", ArrayBufferMutexUnlock,
|
| + "mutexSize", ArrayBufferMutexSize,
|
| + "condInit", ArrayBufferCondInit,
|
| + "condDestroy", ArrayBufferCondDestroy,
|
| + "condWait", ArrayBufferCondWait,
|
| + "condSignal", ArrayBufferCondSignal,
|
| + "condBroadcast", ArrayBufferCondBroadcast,
|
| + "condSize", ArrayBufferCondSize,
|
| + "barrierInit", ArrayBufferBarrierInit,
|
| + "barrierDestroy", ArrayBufferBarrierDestroy,
|
| + "barrierWait", ArrayBufferBarrierWait,
|
| + "barrierSize", ArrayBufferBarrierSize,
|
| "slice", ArrayBufferSlice
|
| ));
|
| }
|
|
|