mirror of
https://github.com/tc39/test262.git
synced 2025-07-26 23:44:27 +02:00
Atomics: house keeping.
This commit is contained in:
parent
89fda0dbd5
commit
a19232ca4c
@ -15,6 +15,10 @@ var views = intArrayConstructors.slice();
|
||||
testWithTypedArrayConstructors(function(TA) {
|
||||
let view = new TA(buffer);
|
||||
testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
|
||||
assert.throws(RangeError, () => Atomics.add(view, IdxGen(view), 10));
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Atomics.add(view, IdxGen(view), 10),
|
||||
'Atomics.add(view, IdxGen(view), 10) throws RangeError'
|
||||
);
|
||||
});
|
||||
}, views);
|
||||
|
@ -14,6 +14,10 @@ var buffer = new SharedArrayBuffer(8);
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
let view = new TA(buffer);
|
||||
testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
|
||||
assert.throws(RangeError, () => Atomics.add(view, IdxGen(view), 10));
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Atomics.add(view, IdxGen(view), 10),
|
||||
'Atomics.add(view, IdxGen(view), 10) throws RangeError'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@ -19,27 +19,27 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
|
||||
// Add positive number
|
||||
view[8] = 0;
|
||||
assert.sameValue(Atomics.add(view, 8, 10), 0);
|
||||
assert.sameValue(view[8], 10);
|
||||
assert.sameValue(Atomics.add(view, 8, 10), 0, 'Atomics.add(view, 8, 10) returns 0');
|
||||
assert.sameValue(view[8], 10, 'The value of view[8] is 10');
|
||||
|
||||
// Add negative number
|
||||
assert.sameValue(Atomics.add(view, 8, -5), 10);
|
||||
assert.sameValue(view[8], 5);
|
||||
assert.sameValue(Atomics.add(view, 8, -5), 10, 'Atomics.add(view, 8, -5) returns 10');
|
||||
assert.sameValue(view[8], 5, 'The value of view[8] is 5');
|
||||
|
||||
view[3] = -5;
|
||||
control[0] = -5;
|
||||
assert.sameValue(Atomics.add(view, 3, 0), control[0],
|
||||
"Result is negative and subject to coercion");
|
||||
'Atomics.add(view, 3, 0) equals the value of control[0] (-5)');
|
||||
|
||||
control[0] = 12345;
|
||||
view[3] = 12345;
|
||||
assert.sameValue(Atomics.add(view, 3, 0), control[0],
|
||||
"Result is subject to chopping");
|
||||
'Atomics.add(view, 3, 0) equals the value of control[0] (12345)');
|
||||
|
||||
control[0] = 123456789;
|
||||
view[3] = 123456789;
|
||||
assert.sameValue(Atomics.add(view, 3, 0), control[0],
|
||||
"Result is subject to chopping");
|
||||
'Atomics.add(view, 3, 0) equals the value of control[0] (123456789)');
|
||||
|
||||
// In-bounds boundary cases for indexing
|
||||
testWithAtomicsInBoundsIndices(function(IdxGen) {
|
||||
@ -48,6 +48,6 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
// Atomics.store() computes an index from Idx in the same way as other
|
||||
// Atomics operations, not quite like view[Idx].
|
||||
Atomics.store(view, Idx, 37);
|
||||
assert.sameValue(Atomics.add(view, Idx, 0), 37);
|
||||
assert.sameValue(Atomics.add(view, Idx, 0), 37, 'Atomics.add(view, Idx, 0) returns 37');
|
||||
});
|
||||
});
|
||||
|
@ -12,5 +12,9 @@ features: [ArrayBuffer, arrow-function, Atomics, BigInt, TypedArray]
|
||||
var ab = new ArrayBuffer(16);
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
assert.throws(TypeError, () => Atomics.add(new TA(ab), 0, 0));
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => Atomics.add(new TA(ab), 0, 0),
|
||||
'Atomics.add(new TA(ab), 0, 0) throws TypeError'
|
||||
);
|
||||
});
|
||||
|
@ -8,6 +8,8 @@ includes: [propertyHelper.js]
|
||||
features: [Atomics]
|
||||
---*/
|
||||
|
||||
verifyWritable(Atomics, "add");
|
||||
verifyNotEnumerable(Atomics, "add");
|
||||
verifyConfigurable(Atomics, "add");
|
||||
verifyProperty(Atomics, 'add', {
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true,
|
||||
});
|
||||
|
@ -29,7 +29,7 @@ features: [Atomics, SharedArrayBuffer, TypedArray]
|
||||
|
||||
var buffer = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT);
|
||||
var i32a = new Int32Array(buffer);
|
||||
var value = 0b00000001000000001000000010000001;
|
||||
var newValue = 0b00000001000000001000000010000001;
|
||||
|
||||
assert.sameValue(Atomics.add(i32a, 0, value), 0);
|
||||
assert.sameValue(i32a[0], value);
|
||||
assert.sameValue(Atomics.add(i32a, 0, newValue), 0, 'Atomics.add(i32a, 0, newValue) returns 0');
|
||||
assert.sameValue(i32a[0], newValue, 'The value of i32a[0] equals the value of newValue (0b00000001000000001000000010000001)');
|
||||
|
@ -20,27 +20,27 @@ testWithTypedArrayConstructors(function(TA) {
|
||||
|
||||
// Add positive number
|
||||
view[8] = 0;
|
||||
assert.sameValue(Atomics.add(view, 8, 10), 0);
|
||||
assert.sameValue(view[8], 10);
|
||||
assert.sameValue(Atomics.add(view, 8, 10), 0, 'Atomics.add(view, 8, 10) returns 0');
|
||||
assert.sameValue(view[8], 10, 'The value of view[8] is 10');
|
||||
|
||||
// Add negative number
|
||||
assert.sameValue(Atomics.add(view, 8, -5), 10);
|
||||
assert.sameValue(view[8], 5);
|
||||
assert.sameValue(Atomics.add(view, 8, -5), 10, 'Atomics.add(view, 8, -5) returns 10');
|
||||
assert.sameValue(view[8], 5, 'The value of view[8] is 5');
|
||||
|
||||
view[3] = -5;
|
||||
control[0] = -5;
|
||||
assert.sameValue(Atomics.add(view, 3, 0), control[0],
|
||||
"Result is negative and subject to coercion");
|
||||
'Atomics.add(view, 3, 0) equals the value of control[0] (-5)');
|
||||
|
||||
control[0] = 12345;
|
||||
view[3] = 12345;
|
||||
assert.sameValue(Atomics.add(view, 3, 0), control[0],
|
||||
"Result is subject to chopping");
|
||||
'Atomics.add(view, 3, 0) equals the value of control[0] (12345)');
|
||||
|
||||
control[0] = 123456789;
|
||||
view[3] = 123456789;
|
||||
assert.sameValue(Atomics.add(view, 3, 0), control[0],
|
||||
"Result is subject to chopping");
|
||||
'Atomics.add(view, 3, 0) equals the value of control[0] (123456789)');
|
||||
|
||||
// In-bounds boundary cases for indexing
|
||||
testWithAtomicsInBoundsIndices(function(IdxGen) {
|
||||
@ -49,6 +49,6 @@ testWithTypedArrayConstructors(function(TA) {
|
||||
// Atomics.store() computes an index from Idx in the same way as other
|
||||
// Atomics operations, not quite like view[Idx].
|
||||
Atomics.store(view, Idx, 37);
|
||||
assert.sameValue(Atomics.add(view, Idx, 0), 37);
|
||||
assert.sameValue(Atomics.add(view, Idx, 0), 37, 'Atomics.add(view, Idx, 0) returns 37');
|
||||
});
|
||||
}, views);
|
||||
|
@ -24,8 +24,9 @@ includes: [propertyHelper.js]
|
||||
features: [Atomics]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Atomics.add.length, 3);
|
||||
|
||||
verifyNotEnumerable(Atomics.add, "length");
|
||||
verifyNotWritable(Atomics.add, "length");
|
||||
verifyConfigurable(Atomics.add, "length");
|
||||
verifyProperty(Atomics.add, 'length', {
|
||||
value: 3,
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: true,
|
||||
});
|
||||
|
@ -10,8 +10,9 @@ includes: [propertyHelper.js]
|
||||
features: [Atomics]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Atomics.add.name, "add");
|
||||
|
||||
verifyNotEnumerable(Atomics.add, "name");
|
||||
verifyNotWritable(Atomics.add, "name");
|
||||
verifyConfigurable(Atomics.add, "name");
|
||||
verifyProperty(Atomics.add, 'name', {
|
||||
value: 'add',
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: true,
|
||||
});
|
||||
|
@ -10,5 +10,9 @@ features: [ArrayBuffer, arrow-function, Atomics, DataView, for-of, let, SharedAr
|
||||
---*/
|
||||
|
||||
testWithAtomicsNonViewValues(function(view) {
|
||||
assert.throws(TypeError, (() => Atomics.add(view, 0, 0)));
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => Atomics.add(view, 0, 0),
|
||||
'Atomics.add(view, 0, 0) throws TypeError'
|
||||
);
|
||||
});
|
||||
|
@ -13,5 +13,9 @@ var ab = new ArrayBuffer(16);
|
||||
var views = intArrayConstructors.slice();
|
||||
|
||||
testWithTypedArrayConstructors(function(TA) {
|
||||
assert.throws(TypeError, (() => Atomics.add(new TA(ab), 0, 0)));
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => Atomics.add(new TA(ab), 0, 0),
|
||||
'Atomics.add(new TA(ab), 0, 0) throws TypeError'
|
||||
);
|
||||
}, views);
|
||||
|
@ -12,5 +12,9 @@ features: [Atomics, SharedArrayBuffer, TypedArray]
|
||||
var buffer = new SharedArrayBuffer(1024);
|
||||
|
||||
testWithTypedArrayConstructors(function(TA) {
|
||||
assert.throws(TypeError, (() => Atomics.add(new TA(buffer), 0, 0)));
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => Atomics.add(new TA(buffer), 0, 0),
|
||||
'Atomics.add(new TA(buffer), 0, 0) throws TypeError'
|
||||
);
|
||||
}, floatArrayConstructors);
|
||||
|
@ -15,6 +15,10 @@ var views = intArrayConstructors.slice();
|
||||
testWithTypedArrayConstructors(function(TA) {
|
||||
let view = new TA(buffer);
|
||||
testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
|
||||
assert.throws(RangeError, () => Atomics.and(view, IdxGen(view), 10));
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Atomics.and(view, IdxGen(view), 10),
|
||||
'Atomics.and(view, IdxGen(view), 10) throws RangeError'
|
||||
);
|
||||
});
|
||||
}, views);
|
||||
|
@ -14,6 +14,10 @@ var buffer = new SharedArrayBuffer(8);
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
let view = new TA(buffer);
|
||||
testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
|
||||
assert.throws(RangeError, () => Atomics.and(view, IdxGen(view), 10));
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Atomics.and(view, IdxGen(view), 10),
|
||||
'Atomics.and(view, IdxGen(view), 10) throws RangeError'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@ -20,33 +20,41 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
view[8] = 0x33333333;
|
||||
control[0] = 0x33333333;
|
||||
assert.sameValue(Atomics.and(view, 8, 0x55555555), control[0],
|
||||
"Result is subject to chopping");
|
||||
'Atomics.and(view, 8, 0x55555555) equals the value of control[0] (0x33333333)');
|
||||
|
||||
control[0] = 0x11111111;
|
||||
assert.sameValue(view[8], control[0]);
|
||||
assert.sameValue(
|
||||
view[8],
|
||||
control[0],
|
||||
'The value of view[8] equals the value of control[0] (0x11111111)'
|
||||
);
|
||||
assert.sameValue(Atomics.and(view, 8, 0xF0F0F0F0), control[0],
|
||||
"Result is subject to chopping");
|
||||
'Atomics.and(view, 8, 0xF0F0F0F0) equals the value of control[0] (0x11111111)');
|
||||
|
||||
control[0] = 0x10101010;
|
||||
assert.sameValue(view[8], control[0]);
|
||||
assert.sameValue(
|
||||
view[8],
|
||||
control[0],
|
||||
'The value of view[8] equals the value of control[0] (0x10101010)'
|
||||
);
|
||||
|
||||
view[3] = -5;
|
||||
control[0] = -5;
|
||||
assert.sameValue(Atomics.and(view, 3, 0), control[0],
|
||||
"Result is negative and subject to coercion");
|
||||
assert.sameValue(view[3], 0);
|
||||
'Atomics.and(view, 3, 0) equals the value of control[0] (-5)');
|
||||
assert.sameValue(view[3], 0, 'The value of view[3] is 0');
|
||||
|
||||
control[0] = 12345;
|
||||
view[3] = 12345;
|
||||
assert.sameValue(Atomics.and(view, 3, 0), control[0],
|
||||
"Result is subjective to chopping");
|
||||
assert.sameValue(view[3], 0);
|
||||
'Atomics.and(view, 3, 0) equals the value of control[0] (12345)');
|
||||
assert.sameValue(view[3], 0, 'The value of view[3] is 0');
|
||||
|
||||
control[0] = 123456789;
|
||||
view[3] = 123456789;
|
||||
assert.sameValue(Atomics.and(view, 3, 0), control[0],
|
||||
"Result is subjective to chopping");
|
||||
assert.sameValue(view[3], 0);
|
||||
'Atomics.and(view, 3, 0) equals the value of control[0] (123456789)');
|
||||
assert.sameValue(view[3], 0, 'The value of view[3] is 0');
|
||||
|
||||
// In-bounds boundary cases for indexing
|
||||
testWithAtomicsInBoundsIndices(function(IdxGen) {
|
||||
@ -55,6 +63,6 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
// Atomics.store() computes an index from Idx in the same way as other
|
||||
// Atomics operations, not quite like view[Idx].
|
||||
Atomics.store(view, Idx, 37);
|
||||
assert.sameValue(Atomics.and(view, Idx, 0), 37);
|
||||
assert.sameValue(Atomics.and(view, Idx, 0), 37, 'Atomics.and(view, Idx, 0) returns 37');
|
||||
});
|
||||
});
|
||||
|
@ -12,5 +12,9 @@ features: [ArrayBuffer, arrow-function, Atomics, BigInt, TypedArray]
|
||||
var buffer = new ArrayBuffer(16);
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
assert.throws(TypeError, () => Atomics.and(new TA(buffer), 0, 0));
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => Atomics.and(new TA(buffer), 0, 0),
|
||||
'Atomics.and(new TA(buffer), 0, 0) throws TypeError'
|
||||
);
|
||||
});
|
||||
|
@ -8,6 +8,8 @@ includes: [propertyHelper.js]
|
||||
features: [Atomics]
|
||||
---*/
|
||||
|
||||
verifyWritable(Atomics, "and");
|
||||
verifyNotEnumerable(Atomics, "and");
|
||||
verifyConfigurable(Atomics, "and");
|
||||
verifyProperty(Atomics, 'and', {
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true,
|
||||
});
|
||||
|
@ -34,5 +34,9 @@ var other = 0b00000001111111111000000011111111;
|
||||
|
||||
i32a[0] = value;
|
||||
|
||||
assert.sameValue(Atomics.and(i32a, 0, value), value);
|
||||
assert.sameValue(i32a[0], value & other);
|
||||
assert.sameValue(
|
||||
Atomics.and(i32a, 0, value),
|
||||
value,
|
||||
'Atomics.and(i32a, 0, value) equals the value of value (0b00000001000000001000000010000001)'
|
||||
);
|
||||
assert.sameValue(i32a[0], value & other, 'The value of i32a[0] is value & other');
|
||||
|
@ -21,33 +21,41 @@ testWithTypedArrayConstructors(function(TA) {
|
||||
view[8] = 0x33333333;
|
||||
control[0] = 0x33333333;
|
||||
assert.sameValue(Atomics.and(view, 8, 0x55555555), control[0],
|
||||
"Result is subject to chopping");
|
||||
'Atomics.and(view, 8, 0x55555555) equals the value of control[0] (0x33333333)');
|
||||
|
||||
control[0] = 0x11111111;
|
||||
assert.sameValue(view[8], control[0]);
|
||||
assert.sameValue(
|
||||
view[8],
|
||||
control[0],
|
||||
'The value of view[8] equals the value of control[0] (0x11111111)'
|
||||
);
|
||||
assert.sameValue(Atomics.and(view, 8, 0xF0F0F0F0), control[0],
|
||||
"Result is subject to chopping");
|
||||
'Atomics.and(view, 8, 0xF0F0F0F0) equals the value of control[0] (0x11111111)');
|
||||
|
||||
control[0] = 0x10101010;
|
||||
assert.sameValue(view[8], control[0]);
|
||||
assert.sameValue(
|
||||
view[8],
|
||||
control[0],
|
||||
'The value of view[8] equals the value of control[0] (0x10101010)'
|
||||
);
|
||||
|
||||
view[3] = -5;
|
||||
control[0] = -5;
|
||||
assert.sameValue(Atomics.and(view, 3, 0), control[0],
|
||||
"Result is negative and subject to coercion");
|
||||
assert.sameValue(view[3], 0);
|
||||
'Atomics.and(view, 3, 0) equals the value of control[0] (-5)');
|
||||
assert.sameValue(view[3], 0, 'The value of view[3] is 0');
|
||||
|
||||
control[0] = 12345;
|
||||
view[3] = 12345;
|
||||
assert.sameValue(Atomics.and(view, 3, 0), control[0],
|
||||
"Result is subjective to chopping");
|
||||
assert.sameValue(view[3], 0);
|
||||
'Atomics.and(view, 3, 0) equals the value of control[0] (12345)');
|
||||
assert.sameValue(view[3], 0, 'The value of view[3] is 0');
|
||||
|
||||
control[0] = 123456789;
|
||||
view[3] = 123456789;
|
||||
assert.sameValue(Atomics.and(view, 3, 0), control[0],
|
||||
"Result is subjective to chopping");
|
||||
assert.sameValue(view[3], 0);
|
||||
'Atomics.and(view, 3, 0) equals the value of control[0] (123456789)');
|
||||
assert.sameValue(view[3], 0, 'The value of view[3] is 0');
|
||||
|
||||
// In-bounds boundary cases for indexing
|
||||
testWithAtomicsInBoundsIndices(function(IdxGen) {
|
||||
@ -56,6 +64,6 @@ testWithTypedArrayConstructors(function(TA) {
|
||||
// Atomics.store() computes an index from Idx in the same way as other
|
||||
// Atomics operations, not quite like view[Idx].
|
||||
Atomics.store(view, Idx, 37);
|
||||
assert.sameValue(Atomics.and(view, Idx, 0), 37);
|
||||
assert.sameValue(Atomics.and(view, Idx, 0), 37, 'Atomics.and(view, Idx, 0) returns 37');
|
||||
});
|
||||
}, views);
|
||||
|
@ -24,8 +24,9 @@ includes: [propertyHelper.js]
|
||||
features: [Atomics]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Atomics.and.length, 3);
|
||||
|
||||
verifyNotEnumerable(Atomics.and, "length");
|
||||
verifyNotWritable(Atomics.and, "length");
|
||||
verifyConfigurable(Atomics.and, "length");
|
||||
verifyProperty(Atomics.and, 'length', {
|
||||
value: 3,
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: true,
|
||||
});
|
||||
|
@ -10,8 +10,9 @@ includes: [propertyHelper.js]
|
||||
features: [Atomics]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Atomics.and.name, "and");
|
||||
|
||||
verifyNotEnumerable(Atomics.and, "name");
|
||||
verifyNotWritable(Atomics.and, "name");
|
||||
verifyConfigurable(Atomics.and, "name");
|
||||
verifyProperty(Atomics.and, 'name', {
|
||||
value: 'and',
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: true,
|
||||
});
|
||||
|
@ -10,5 +10,9 @@ features: [ArrayBuffer, arrow-function, Atomics, DataView, for-of, let, SharedAr
|
||||
---*/
|
||||
|
||||
testWithAtomicsNonViewValues(function(view) {
|
||||
assert.throws(TypeError, (() => Atomics.and(view, 0, 0)));
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => Atomics.and(view, 0, 0),
|
||||
'Atomics.and(view, 0, 0) throws TypeError'
|
||||
);
|
||||
});
|
||||
|
@ -13,5 +13,9 @@ var buffer = new ArrayBuffer(16);
|
||||
var views = intArrayConstructors.slice();
|
||||
|
||||
testWithTypedArrayConstructors(function(TA) {
|
||||
assert.throws(TypeError, (() => Atomics.and(new TA(buffer), 0, 0)));
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => Atomics.and(new TA(buffer), 0, 0),
|
||||
'Atomics.and(new TA(buffer), 0, 0) throws TypeError'
|
||||
);
|
||||
}, views);
|
||||
|
@ -12,5 +12,9 @@ features: [Atomics, SharedArrayBuffer, TypedArray]
|
||||
var buffer = new SharedArrayBuffer(1024);
|
||||
|
||||
testWithTypedArrayConstructors(function(TA) {
|
||||
assert.throws(TypeError, (() => Atomics.and(new TA(buffer), 0, 0)));
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => Atomics.and(new TA(buffer), 0, 0),
|
||||
'Atomics.and(new TA(buffer), 0, 0) throws TypeError'
|
||||
);
|
||||
}, floatArrayConstructors);
|
||||
|
@ -15,6 +15,10 @@ var views = intArrayConstructors.slice();
|
||||
testWithTypedArrayConstructors(function(TA) {
|
||||
let view = new TA(buffer);
|
||||
testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
|
||||
assert.throws(RangeError, () => Atomics.compareExchange(view, IdxGen(view), 10, 0));
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Atomics.compareExchange(view, IdxGen(view), 10, 0),
|
||||
'Atomics.compareExchange(view, IdxGen(view), 10, 0) throws RangeError'
|
||||
);
|
||||
});
|
||||
}, views);
|
||||
|
@ -14,6 +14,10 @@ var buffer = new SharedArrayBuffer(8);
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
let view = new TA(buffer);
|
||||
testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
|
||||
assert.throws(RangeError, () => Atomics.compareExchange(view, IdxGen(view), 10, 0));
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Atomics.compareExchange(view, IdxGen(view), 10, 0),
|
||||
'Atomics.compareExchange(view, IdxGen(view), 10, 0) throws RangeError'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@ -19,39 +19,43 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
|
||||
// Performs the exchange
|
||||
view[8] = 0;
|
||||
assert.sameValue(Atomics.compareExchange(view, 8, 0, 10), 0);
|
||||
assert.sameValue(view[8], 10);
|
||||
assert.sameValue(
|
||||
Atomics.compareExchange(view, 8, 0, 10),
|
||||
0,
|
||||
'Atomics.compareExchange(view, 8, 0, 10) returns 0'
|
||||
);
|
||||
assert.sameValue(view[8], 10, 'The value of view[8] is 10');
|
||||
|
||||
view[8] = 0;
|
||||
assert.sameValue(Atomics.compareExchange(view, 8, 1, 10), 0,
|
||||
"Does not perform the exchange");
|
||||
assert.sameValue(view[8], 0);
|
||||
'Atomics.compareExchange(view, 8, 1, 10) returns 0');
|
||||
assert.sameValue(view[8], 0, 'The value of view[8] is 0');
|
||||
|
||||
view[8] = 0;
|
||||
assert.sameValue(Atomics.compareExchange(view, 8, 0, -5), 0,
|
||||
"Performs the exchange, coercing the value being stored");
|
||||
'Atomics.compareExchange(view, 8, 0, -5) returns 0');
|
||||
control[0] = -5;
|
||||
assert.sameValue(view[8], control[0]);
|
||||
assert.sameValue(view[8], control[0], 'The value of view[8] equals the value of control[0] (-5)');
|
||||
|
||||
|
||||
view[3] = -5;
|
||||
control[0] = -5;
|
||||
assert.sameValue(Atomics.compareExchange(view, 3, -5, 0), control[0],
|
||||
"Performs the exchange, coercing the value being tested");
|
||||
assert.sameValue(view[3], 0);
|
||||
'Atomics.compareExchange(view, 3, -5, 0) equals the value of control[0] (-5)');
|
||||
assert.sameValue(view[3], 0, 'The value of view[3] is 0');
|
||||
|
||||
|
||||
control[0] = 12345;
|
||||
view[3] = 12345;
|
||||
assert.sameValue(Atomics.compareExchange(view, 3, 12345, 0), control[0],
|
||||
"Performs the exchange, chopping the value being tested");
|
||||
assert.sameValue(view[3], 0);
|
||||
'Atomics.compareExchange(view, 3, 12345, 0) equals the value of control[0] (12345)');
|
||||
assert.sameValue(view[3], 0, 'The value of view[3] is 0');
|
||||
|
||||
control[0] = 123456789;
|
||||
view[3] = 123456789;
|
||||
assert.sameValue(Atomics.compareExchange(view, 3, 123456789, 0), control[0],
|
||||
"Performs the exchange, chopping the value being tested");
|
||||
assert.sameValue(view[3], 0);
|
||||
'Atomics.compareExchange(view, 3, 123456789, 0) equals the value of control[0] (123456789)');
|
||||
assert.sameValue(view[3], 0, 'The value of view[3] is 0');
|
||||
|
||||
// In-bounds boundary cases for indexing
|
||||
testWithAtomicsInBoundsIndices(function(IdxGen) {
|
||||
@ -60,6 +64,10 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
// Atomics.store() computes an index from Idx in the same way as other
|
||||
// Atomics operations, not quite like view[Idx].
|
||||
Atomics.store(view, Idx, 37);
|
||||
assert.sameValue(Atomics.compareExchange(view, Idx, 37, 0), 37);
|
||||
assert.sameValue(
|
||||
Atomics.compareExchange(view, Idx, 37, 0),
|
||||
37,
|
||||
'Atomics.compareExchange(view, Idx, 37, 0) returns 37'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@ -12,5 +12,9 @@ features: [ArrayBuffer, arrow-function, Atomics, BigInt, TypedArray]
|
||||
var buffer = new ArrayBuffer(16);
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
assert.throws(TypeError, (() => Atomics.compareExchange(new TA(buffer), 0, 0, 0)));
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => Atomics.compareExchange(new TA(buffer), 0, 0, 0),
|
||||
'Atomics.compareExchange(new TA(buffer), 0, 0, 0) throws TypeError'
|
||||
);
|
||||
});
|
||||
|
@ -8,6 +8,8 @@ includes: [propertyHelper.js]
|
||||
features: [Atomics]
|
||||
---*/
|
||||
|
||||
verifyWritable(Atomics, "compareExchange");
|
||||
verifyNotEnumerable(Atomics, "compareExchange");
|
||||
verifyConfigurable(Atomics, "compareExchange");
|
||||
verifyProperty(Atomics, 'compareExchange', {
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true,
|
||||
});
|
||||
|
@ -28,9 +28,13 @@ features: [Atomics, SharedArrayBuffer, TypedArray]
|
||||
|
||||
var buffer = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT);
|
||||
var i32a = new Int32Array(buffer);
|
||||
var value = 0b00000001000000001000000010000001;
|
||||
var update = 0b00000001000000001000000010000001;
|
||||
|
||||
i32a[0] = value;
|
||||
i32a[0] = update;
|
||||
|
||||
assert.sameValue(Atomics.compareExchange(i32a, 0, value, 0), value);
|
||||
assert.sameValue(i32a[0], 0);
|
||||
assert.sameValue(
|
||||
Atomics.compareExchange(i32a, 0, update, 0),
|
||||
update,
|
||||
'Atomics.compareExchange(i32a, 0, update, 0) equals the value of update (0b00000001000000001000000010000001)'
|
||||
);
|
||||
assert.sameValue(i32a[0], 0, 'The value of i32a[0] is 0');
|
||||
|
@ -20,39 +20,43 @@ testWithTypedArrayConstructors(function(TA) {
|
||||
|
||||
// Performs the exchange
|
||||
view[8] = 0;
|
||||
assert.sameValue(Atomics.compareExchange(view, 8, 0, 10), 0);
|
||||
assert.sameValue(view[8], 10);
|
||||
assert.sameValue(
|
||||
Atomics.compareExchange(view, 8, 0, 10),
|
||||
0,
|
||||
'Atomics.compareExchange(view, 8, 0, 10) returns 0'
|
||||
);
|
||||
assert.sameValue(view[8], 10, 'The value of view[8] is 10');
|
||||
|
||||
view[8] = 0;
|
||||
assert.sameValue(Atomics.compareExchange(view, 8, 1, 10), 0,
|
||||
"Does not perform the exchange");
|
||||
assert.sameValue(view[8], 0);
|
||||
'Atomics.compareExchange(view, 8, 1, 10) returns 0');
|
||||
assert.sameValue(view[8], 0, 'The value of view[8] is 0');
|
||||
|
||||
view[8] = 0;
|
||||
assert.sameValue(Atomics.compareExchange(view, 8, 0, -5), 0,
|
||||
"Performs the exchange, coercing the value being stored");
|
||||
'Atomics.compareExchange(view, 8, 0, -5) returns 0');
|
||||
control[0] = -5;
|
||||
assert.sameValue(view[8], control[0]);
|
||||
assert.sameValue(view[8], control[0], 'The value of view[8] equals the value of control[0] (-5)');
|
||||
|
||||
|
||||
view[3] = -5;
|
||||
control[0] = -5;
|
||||
assert.sameValue(Atomics.compareExchange(view, 3, -5, 0), control[0],
|
||||
"Performs the exchange, coercing the value being tested");
|
||||
assert.sameValue(view[3], 0);
|
||||
'Atomics.compareExchange(view, 3, -5, 0) equals the value of control[0] (-5)');
|
||||
assert.sameValue(view[3], 0, 'The value of view[3] is 0');
|
||||
|
||||
|
||||
control[0] = 12345;
|
||||
view[3] = 12345;
|
||||
assert.sameValue(Atomics.compareExchange(view, 3, 12345, 0), control[0],
|
||||
"Performs the exchange, chopping the value being tested");
|
||||
assert.sameValue(view[3], 0);
|
||||
'Atomics.compareExchange(view, 3, 12345, 0) equals the value of control[0] (12345)');
|
||||
assert.sameValue(view[3], 0, 'The value of view[3] is 0');
|
||||
|
||||
control[0] = 123456789;
|
||||
view[3] = 123456789;
|
||||
assert.sameValue(Atomics.compareExchange(view, 3, 123456789, 0), control[0],
|
||||
"Performs the exchange, chopping the value being tested");
|
||||
assert.sameValue(view[3], 0);
|
||||
'Atomics.compareExchange(view, 3, 123456789, 0) equals the value of control[0] (123456789)');
|
||||
assert.sameValue(view[3], 0, 'The value of view[3] is 0');
|
||||
|
||||
// In-bounds boundary cases for indexing
|
||||
testWithAtomicsInBoundsIndices(function(IdxGen) {
|
||||
@ -61,6 +65,10 @@ testWithTypedArrayConstructors(function(TA) {
|
||||
// Atomics.store() computes an index from Idx in the same way as other
|
||||
// Atomics operations, not quite like view[Idx].
|
||||
Atomics.store(view, Idx, 37);
|
||||
assert.sameValue(Atomics.compareExchange(view, Idx, 37, 0), 37);
|
||||
assert.sameValue(
|
||||
Atomics.compareExchange(view, Idx, 37, 0),
|
||||
37,
|
||||
'Atomics.compareExchange(view, Idx, 37, 0) returns 37'
|
||||
);
|
||||
});
|
||||
}, views);
|
||||
|
@ -24,8 +24,9 @@ includes: [propertyHelper.js]
|
||||
features: [Atomics]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Atomics.compareExchange.length, 4);
|
||||
|
||||
verifyNotEnumerable(Atomics.compareExchange, "length");
|
||||
verifyNotWritable(Atomics.compareExchange, "length");
|
||||
verifyConfigurable(Atomics.compareExchange, "length");
|
||||
verifyProperty(Atomics.compareExchange, 'length', {
|
||||
value: 4,
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: true,
|
||||
});
|
||||
|
@ -10,8 +10,9 @@ includes: [propertyHelper.js]
|
||||
features: [Atomics]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Atomics.compareExchange.name, "compareExchange");
|
||||
|
||||
verifyNotEnumerable(Atomics.compareExchange, "name");
|
||||
verifyNotWritable(Atomics.compareExchange, "name");
|
||||
verifyConfigurable(Atomics.compareExchange, "name");
|
||||
verifyProperty(Atomics.compareExchange, 'name', {
|
||||
value: 'compareExchange',
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: true,
|
||||
});
|
||||
|
@ -10,5 +10,9 @@ features: [ArrayBuffer, arrow-function, Atomics, DataView, for-of, let, SharedAr
|
||||
---*/
|
||||
|
||||
testWithAtomicsNonViewValues(function(view) {
|
||||
assert.throws(TypeError, (() => Atomics.compareExchange(view, 0, 0, 0)));
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => Atomics.compareExchange(view, 0, 0, 0),
|
||||
'Atomics.compareExchange(view, 0, 0, 0) throws TypeError'
|
||||
);
|
||||
});
|
||||
|
@ -13,5 +13,9 @@ var buffer = new ArrayBuffer(16);
|
||||
var views = intArrayConstructors.slice();
|
||||
|
||||
testWithTypedArrayConstructors(function(TA) {
|
||||
assert.throws(TypeError, (() => Atomics.compareExchange(new TA(buffer), 0, 0, 0)));
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => Atomics.compareExchange(new TA(buffer), 0, 0, 0),
|
||||
'Atomics.compareExchange(new TA(buffer), 0, 0, 0) throws TypeError'
|
||||
);
|
||||
}, views);
|
||||
|
@ -12,5 +12,9 @@ features: [Atomics, SharedArrayBuffer, TypedArray]
|
||||
var buffer = new SharedArrayBuffer(1024);
|
||||
|
||||
testWithTypedArrayConstructors(function(TA) {
|
||||
assert.throws(TypeError, (() => Atomics.compareExchange(new TA(buffer), 0, 0, 0)));
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => Atomics.compareExchange(new TA(buffer), 0, 0, 0),
|
||||
'Atomics.compareExchange(new TA(buffer), 0, 0, 0) throws TypeError'
|
||||
);
|
||||
}, floatArrayConstructors);
|
||||
|
@ -15,6 +15,10 @@ var views = intArrayConstructors.slice();
|
||||
testWithTypedArrayConstructors(function(TA) {
|
||||
let view = new TA(buffer);
|
||||
testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
|
||||
assert.throws(RangeError, () => Atomics.exchange(view, IdxGen(view), 10, 0));
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Atomics.exchange(view, IdxGen(view), 10, 0),
|
||||
'Atomics.exchange(view, IdxGen(view), 10, 0) throws RangeError'
|
||||
);
|
||||
});
|
||||
}, views);
|
||||
|
@ -14,6 +14,10 @@ var buffer = new SharedArrayBuffer(8);
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
let view = new TA(buffer);
|
||||
testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
|
||||
assert.throws(RangeError, () => Atomics.exchange(view, IdxGen(view), 10, 0));
|
||||
assert.throws(
|
||||
RangeError,
|
||||
() => Atomics.exchange(view, IdxGen(view), 10, 0),
|
||||
'Atomics.exchange(view, IdxGen(view), 10, 0) throws RangeError'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@ -19,28 +19,28 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
|
||||
view[8] = 0;
|
||||
assert.sameValue(Atomics.exchange(view, 8, 10), 0,
|
||||
"Exchange returns the value previously in the array");
|
||||
assert.sameValue(view[8], 10);
|
||||
'Atomics.exchange(view, 8, 10) returns 0');
|
||||
assert.sameValue(view[8], 10, 'The value of view[8] is 10');
|
||||
|
||||
assert.sameValue(Atomics.exchange(view, 8, -5), 10,
|
||||
"Exchange returns the value previously in the array");
|
||||
'Atomics.exchange(view, 8, -5) returns 10');
|
||||
control[0] = -5;
|
||||
assert.sameValue(view[8], control[0]);
|
||||
assert.sameValue(view[8], control[0], 'The value of view[8] equals the value of control[0] (-5)');
|
||||
|
||||
view[3] = -5;
|
||||
control[0] = -5;
|
||||
assert.sameValue(Atomics.exchange(view, 3, 0), control[0],
|
||||
"Result is subject to coercion");
|
||||
'Atomics.exchange(view, 3, 0) equals the value of control[0] (-5)');
|
||||
|
||||
control[0] = 12345;
|
||||
view[3] = 12345;
|
||||
assert.sameValue(Atomics.exchange(view, 3, 0), control[0],
|
||||
"Result is subject to chopping");
|
||||
'Atomics.exchange(view, 3, 0) equals the value of control[0] (12345)');
|
||||
|
||||
control[0] = 123456789;
|
||||
view[3] = 123456789;
|
||||
assert.sameValue(Atomics.exchange(view, 3, 0), control[0],
|
||||
"Result is subject to chopping");
|
||||
'Atomics.exchange(view, 3, 0) equals the value of control[0] (123456789)');
|
||||
|
||||
// In-bounds boundary cases for indexing
|
||||
testWithAtomicsInBoundsIndices(function(IdxGen) {
|
||||
@ -49,6 +49,6 @@ testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
// Atomics.store() computes an index from Idx in the same way as other
|
||||
// Atomics operations, not quite like view[Idx].
|
||||
Atomics.store(view, Idx, 37);
|
||||
assert.sameValue(Atomics.exchange(view, Idx, 0), 37);
|
||||
assert.sameValue(Atomics.exchange(view, Idx, 0), 37, 'Atomics.exchange(view, Idx, 0) returns 37');
|
||||
});
|
||||
});
|
||||
|
@ -12,5 +12,9 @@ features: [ArrayBuffer, arrow-function, Atomics, BigInt, TypedArray]
|
||||
var buffer = new ArrayBuffer(16);
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
assert.throws(TypeError, (() => Atomics.exchange(new TA(buffer), 0, 0)));
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => Atomics.exchange(new TA(buffer), 0, 0),
|
||||
'Atomics.exchange(new TA(buffer), 0, 0) throws TypeError'
|
||||
);
|
||||
});
|
||||
|
@ -8,6 +8,8 @@ includes: [propertyHelper.js]
|
||||
features: [Atomics]
|
||||
---*/
|
||||
|
||||
verifyWritable(Atomics, "exchange");
|
||||
verifyNotEnumerable(Atomics, "exchange");
|
||||
verifyConfigurable(Atomics, "exchange");
|
||||
verifyProperty(Atomics, 'exchange', {
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true,
|
||||
});
|
||||
|
@ -29,7 +29,15 @@ features: [Atomics, SharedArrayBuffer, TypedArray]
|
||||
|
||||
var buffer = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT);
|
||||
var i32a = new Int32Array(buffer);
|
||||
var value = 0b00000001000000001000000010000001;
|
||||
var update = 0b00000001000000001000000010000001;
|
||||
|
||||
assert.sameValue(Atomics.exchange(i32a, 0, value), 0);
|
||||
assert.sameValue(i32a[0], value);
|
||||
assert.sameValue(
|
||||
Atomics.exchange(i32a, 0, update),
|
||||
0,
|
||||
'Atomics.exchange(i32a, 0, update) returns 0'
|
||||
);
|
||||
assert.sameValue(
|
||||
i32a[0],
|
||||
update,
|
||||
'The value of i32a[0] equals the value of update (0b00000001000000001000000010000001)'
|
||||
);
|
||||
|
@ -20,28 +20,28 @@ testWithTypedArrayConstructors(function(TA) {
|
||||
|
||||
view[8] = 0;
|
||||
assert.sameValue(Atomics.exchange(view, 8, 10), 0,
|
||||
"Exchange returns the value previously in the array");
|
||||
assert.sameValue(view[8], 10);
|
||||
'Atomics.exchange(view, 8, 10) returns 0');
|
||||
assert.sameValue(view[8], 10, 'The value of view[8] is 10');
|
||||
|
||||
assert.sameValue(Atomics.exchange(view, 8, -5), 10,
|
||||
"Exchange returns the value previously in the array");
|
||||
'Atomics.exchange(view, 8, -5) returns 10');
|
||||
control[0] = -5;
|
||||
assert.sameValue(view[8], control[0]);
|
||||
assert.sameValue(view[8], control[0], 'The value of view[8] equals the value of control[0] (-5)');
|
||||
|
||||
view[3] = -5;
|
||||
control[0] = -5;
|
||||
assert.sameValue(Atomics.exchange(view, 3, 0), control[0],
|
||||
"Result is subject to coercion");
|
||||
'Atomics.exchange(view, 3, 0) equals the value of control[0] (-5)');
|
||||
|
||||
control[0] = 12345;
|
||||
view[3] = 12345;
|
||||
assert.sameValue(Atomics.exchange(view, 3, 0), control[0],
|
||||
"Result is subject to chopping");
|
||||
'Atomics.exchange(view, 3, 0) equals the value of control[0] (12345)');
|
||||
|
||||
control[0] = 123456789;
|
||||
view[3] = 123456789;
|
||||
assert.sameValue(Atomics.exchange(view, 3, 0), control[0],
|
||||
"Result is subject to chopping");
|
||||
'Atomics.exchange(view, 3, 0) equals the value of control[0] (123456789)');
|
||||
|
||||
// In-bounds boundary cases for indexing
|
||||
testWithAtomicsInBoundsIndices(function(IdxGen) {
|
||||
@ -50,6 +50,6 @@ testWithTypedArrayConstructors(function(TA) {
|
||||
// Atomics.store() computes an index from Idx in the same way as other
|
||||
// Atomics operations, not quite like view[Idx].
|
||||
Atomics.store(view, Idx, 37);
|
||||
assert.sameValue(Atomics.exchange(view, Idx, 0), 37);
|
||||
assert.sameValue(Atomics.exchange(view, Idx, 0), 37, 'Atomics.exchange(view, Idx, 0) returns 37');
|
||||
});
|
||||
}, views);
|
||||
|
@ -24,8 +24,9 @@ includes: [propertyHelper.js]
|
||||
features: [Atomics]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Atomics.exchange.length, 3);
|
||||
|
||||
verifyNotEnumerable(Atomics.exchange, "length");
|
||||
verifyNotWritable(Atomics.exchange, "length");
|
||||
verifyConfigurable(Atomics.exchange, "length");
|
||||
verifyProperty(Atomics.exchange, 'length', {
|
||||
value: 3,
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: true,
|
||||
});
|
||||
|
@ -10,8 +10,9 @@ includes: [propertyHelper.js]
|
||||
features: [Atomics]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Atomics.exchange.name, "exchange");
|
||||
|
||||
verifyNotEnumerable(Atomics.exchange, "name");
|
||||
verifyNotWritable(Atomics.exchange, "name");
|
||||
verifyConfigurable(Atomics.exchange, "name");
|
||||
verifyProperty(Atomics.exchange, 'name', {
|
||||
value: 'exchange',
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: true,
|
||||
});
|
||||
|
@ -10,5 +10,9 @@ features: [ArrayBuffer, arrow-function, Atomics, DataView, for-of, let, SharedAr
|
||||
---*/
|
||||
|
||||
testWithAtomicsNonViewValues(function(view) {
|
||||
assert.throws(TypeError, (() => Atomics.exchange(view, 0, 0)));
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => Atomics.exchange(view, 0, 0),
|
||||
'Atomics.exchange(view, 0, 0) throws TypeError'
|
||||
);
|
||||
});
|
||||
|
@ -13,5 +13,9 @@ var buffer = new ArrayBuffer(16);
|
||||
var views = intArrayConstructors.slice();
|
||||
|
||||
testWithTypedArrayConstructors(function(TA) {
|
||||
assert.throws(TypeError, (() => Atomics.exchange(new TA(buffer), 0, 0)));
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => Atomics.exchange(new TA(buffer), 0, 0),
|
||||
'Atomics.exchange(new TA(buffer), 0, 0) throws TypeError'
|
||||
);
|
||||
}, views);
|
||||
|
@ -12,5 +12,9 @@ features: [Atomics, SharedArrayBuffer, TypedArray]
|
||||
var buffer = new SharedArrayBuffer(1024);
|
||||
|
||||
testWithTypedArrayConstructors(function(TA) {
|
||||
assert.throws(TypeError, (() => Atomics.exchange(new TA(buffer), 0, 0)));
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => Atomics.exchange(new TA(buffer), 0, 0),
|
||||
'Atomics.exchange(new TA(buffer), 0, 0) throws TypeError'
|
||||
);
|
||||
}, floatArrayConstructors);
|
||||
|
@ -9,20 +9,64 @@ features: [arrow-function, Atomics]
|
||||
includes: [testAtomics.js, testBigIntTypedArray.js]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Atomics.isLockFree(hide(3, Number.NaN)), false);
|
||||
assert.sameValue(Atomics.isLockFree(hide(3, -1)), false);
|
||||
assert.sameValue(Atomics.isLockFree(hide(3, 3.14)), false);
|
||||
assert.sameValue(Atomics.isLockFree(hide(3, 0)), false);
|
||||
assert.sameValue(
|
||||
Atomics.isLockFree(hide(3, Number.NaN)),
|
||||
false,
|
||||
'Atomics.isLockFree(hide(3, Number.NaN)) returns false'
|
||||
);
|
||||
assert.sameValue(
|
||||
Atomics.isLockFree(hide(3, -1)),
|
||||
false,
|
||||
'Atomics.isLockFree(hide(3, -1)) returns false'
|
||||
);
|
||||
assert.sameValue(
|
||||
Atomics.isLockFree(hide(3, 3.14)),
|
||||
false,
|
||||
'Atomics.isLockFree(hide(3, 3.14)) returns false'
|
||||
);
|
||||
assert.sameValue(
|
||||
Atomics.isLockFree(hide(3, 0)),
|
||||
false,
|
||||
'Atomics.isLockFree(hide(3, 0)) returns false'
|
||||
);
|
||||
|
||||
assert.sameValue(Atomics.isLockFree('1'), Atomics.isLockFree(1));
|
||||
assert.sameValue(Atomics.isLockFree('3'), Atomics.isLockFree(3));
|
||||
assert.sameValue(
|
||||
Atomics.isLockFree('1'),
|
||||
Atomics.isLockFree(1),
|
||||
'Atomics.isLockFree(\'1\') returns Atomics.isLockFree(1)'
|
||||
);
|
||||
assert.sameValue(
|
||||
Atomics.isLockFree('3'),
|
||||
Atomics.isLockFree(3),
|
||||
'Atomics.isLockFree(\'3\') returns Atomics.isLockFree(3)'
|
||||
);
|
||||
|
||||
assert.sameValue(Atomics.isLockFree(true), Atomics.isLockFree(1));
|
||||
assert.sameValue(
|
||||
Atomics.isLockFree(true),
|
||||
Atomics.isLockFree(1),
|
||||
'Atomics.isLockFree(true) returns Atomics.isLockFree(1)'
|
||||
);
|
||||
|
||||
assert.sameValue(Atomics.isLockFree(1), Atomics.isLockFree({valueOf: () => 1}));
|
||||
assert.sameValue(Atomics.isLockFree(3), Atomics.isLockFree({valueOf: () => 3}));
|
||||
assert.sameValue(Atomics.isLockFree(1), Atomics.isLockFree({toString: () => '1'}));
|
||||
assert.sameValue(Atomics.isLockFree(3), Atomics.isLockFree({toString: () => '3'}));
|
||||
assert.sameValue(
|
||||
Atomics.isLockFree(1),
|
||||
Atomics.isLockFree({valueOf: () => 1}),
|
||||
'Atomics.isLockFree(1) returns Atomics.isLockFree({valueOf: () => 1})'
|
||||
);
|
||||
assert.sameValue(
|
||||
Atomics.isLockFree(3),
|
||||
Atomics.isLockFree({valueOf: () => 3}),
|
||||
'Atomics.isLockFree(3) returns Atomics.isLockFree({valueOf: () => 3})'
|
||||
);
|
||||
assert.sameValue(
|
||||
Atomics.isLockFree(1),
|
||||
Atomics.isLockFree({toString: () => '1'}),
|
||||
'Atomics.isLockFree(1) returns Atomics.isLockFree({toString: () => \'1\'})'
|
||||
);
|
||||
assert.sameValue(
|
||||
Atomics.isLockFree(3),
|
||||
Atomics.isLockFree({toString: () => '3'}),
|
||||
'Atomics.isLockFree(3) returns Atomics.isLockFree({toString: () => \'3\'})'
|
||||
);
|
||||
|
||||
function hide(k, x) {
|
||||
if (k) {
|
||||
|
@ -23,7 +23,13 @@ includes: [testBigIntTypedArray.js]
|
||||
---*/
|
||||
|
||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||
assert.sameValue(Atomics.isLockFree(TA.BYTES_PER_ELEMENT), true);
|
||||
var observed = Atomics.isLockFree(TA.BYTES_PER_ELEMENT);
|
||||
|
||||
assert.sameValue(
|
||||
Atomics.isLockFree(TA.BYTES_PER_ELEMENT),
|
||||
observed,
|
||||
'Atomics.isLockFree(TA.BYTES_PER_ELEMENT) equals the value of `observed` (Atomics.isLockFree(TA.BYTES_PER_ELEMENT))'
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
|
@ -1,46 +0,0 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-atomics.islockfree
|
||||
description: >
|
||||
Test isLockFree on nonnegative integer arguments
|
||||
features: [Atomics, computed-property-names]
|
||||
includes: [testAtomics.js, testBigIntTypedArray.js]
|
||||
---*/
|
||||
|
||||
var sizes = [ 1, 2, 3, 4, 5, 6, 7, 8,
|
||||
9, 10, 11, 12];
|
||||
var answers = [ {}, {}, false, true, false, false, false, false,
|
||||
false, false, false, false];
|
||||
|
||||
var saved = {};
|
||||
|
||||
// This should defeat most optimizations.
|
||||
|
||||
for (var i = 0; i < sizes.length; i++) {
|
||||
var v = Atomics.isLockFree(sizes[i]);
|
||||
var a = answers[i];
|
||||
assert.sameValue(typeof v, 'boolean');
|
||||
if (typeof a == 'boolean') {
|
||||
assert.sameValue(v, a);
|
||||
} else {
|
||||
saved[sizes[i]] = v;
|
||||
}
|
||||
}
|
||||
|
||||
// This ought to be optimizable. Make sure the answers are the same
|
||||
// as for the unoptimized case.
|
||||
|
||||
assert.sameValue(Atomics.isLockFree(1), saved[1]);
|
||||
assert.sameValue(Atomics.isLockFree(2), saved[2]);
|
||||
assert.sameValue(Atomics.isLockFree(3), false);
|
||||
assert.sameValue(Atomics.isLockFree(4), true);
|
||||
assert.sameValue(Atomics.isLockFree(5), false);
|
||||
assert.sameValue(Atomics.isLockFree(6), false);
|
||||
assert.sameValue(Atomics.isLockFree(7), false);
|
||||
assert.sameValue(Atomics.isLockFree(8), false);
|
||||
assert.sameValue(Atomics.isLockFree(9), false);
|
||||
assert.sameValue(Atomics.isLockFree(10), false);
|
||||
assert.sameValue(Atomics.isLockFree(11), false);
|
||||
assert.sameValue(Atomics.isLockFree(12), false);
|
@ -8,20 +8,64 @@ description: >
|
||||
features: [Atomics]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Atomics.isLockFree(hide(3, Number.NaN)), false);
|
||||
assert.sameValue(Atomics.isLockFree(hide(3, -1)), false);
|
||||
assert.sameValue(Atomics.isLockFree(hide(3, 3.14)), false);
|
||||
assert.sameValue(Atomics.isLockFree(hide(3, 0)), false);
|
||||
assert.sameValue(
|
||||
Atomics.isLockFree(hide(3, Number.NaN)),
|
||||
false,
|
||||
'Atomics.isLockFree(hide(3, Number.NaN)) returns false'
|
||||
);
|
||||
assert.sameValue(
|
||||
Atomics.isLockFree(hide(3, -1)),
|
||||
false,
|
||||
'Atomics.isLockFree(hide(3, -1)) returns false'
|
||||
);
|
||||
assert.sameValue(
|
||||
Atomics.isLockFree(hide(3, 3.14)),
|
||||
false,
|
||||
'Atomics.isLockFree(hide(3, 3.14)) returns false'
|
||||
);
|
||||
assert.sameValue(
|
||||
Atomics.isLockFree(hide(3, 0)),
|
||||
false,
|
||||
'Atomics.isLockFree(hide(3, 0)) returns false'
|
||||
);
|
||||
|
||||
assert.sameValue(Atomics.isLockFree('1'), Atomics.isLockFree(1));
|
||||
assert.sameValue(Atomics.isLockFree('3'), Atomics.isLockFree(3));
|
||||
assert.sameValue(
|
||||
Atomics.isLockFree('1'),
|
||||
Atomics.isLockFree(1),
|
||||
'Atomics.isLockFree("1") returns Atomics.isLockFree(1)'
|
||||
);
|
||||
assert.sameValue(
|
||||
Atomics.isLockFree('3'),
|
||||
Atomics.isLockFree(3),
|
||||
'Atomics.isLockFree("3") returns Atomics.isLockFree(3)'
|
||||
);
|
||||
|
||||
assert.sameValue(Atomics.isLockFree(true), Atomics.isLockFree(1));
|
||||
assert.sameValue(
|
||||
Atomics.isLockFree(true),
|
||||
Atomics.isLockFree(1),
|
||||
'Atomics.isLockFree(true) returns Atomics.isLockFree(1)'
|
||||
);
|
||||
|
||||
assert.sameValue(Atomics.isLockFree(1), Atomics.isLockFree({valueOf: () => 1}));
|
||||
assert.sameValue(Atomics.isLockFree(3), Atomics.isLockFree({valueOf: () => 3}));
|
||||
assert.sameValue(Atomics.isLockFree(1), Atomics.isLockFree({toString: () => '1'}));
|
||||
assert.sameValue(Atomics.isLockFree(3), Atomics.isLockFree({toString: () => '3'}));
|
||||
assert.sameValue(
|
||||
Atomics.isLockFree(1),
|
||||
Atomics.isLockFree({valueOf: () => 1}),
|
||||
'Atomics.isLockFree(1) returns Atomics.isLockFree({valueOf: () => 1})'
|
||||
);
|
||||
assert.sameValue(
|
||||
Atomics.isLockFree(3),
|
||||
Atomics.isLockFree({valueOf: () => 3}),
|
||||
'Atomics.isLockFree(3) returns Atomics.isLockFree({valueOf: () => 3})'
|
||||
);
|
||||
assert.sameValue(
|
||||
Atomics.isLockFree(1),
|
||||
Atomics.isLockFree({toString: () => '1'}),
|
||||
'Atomics.isLockFree(1) returns Atomics.isLockFree({toString: () => "1"})'
|
||||
);
|
||||
assert.sameValue(
|
||||
Atomics.isLockFree(3),
|
||||
Atomics.isLockFree({toString: () => '3'}),
|
||||
'Atomics.isLockFree(3) returns Atomics.isLockFree({toString: () => "3"})'
|
||||
);
|
||||
|
||||
function hide(k, x) {
|
||||
if (k) {
|
||||
|
@ -8,6 +8,8 @@ includes: [propertyHelper.js]
|
||||
features: [Atomics]
|
||||
---*/
|
||||
|
||||
verifyWritable(Atomics, "add");
|
||||
verifyNotEnumerable(Atomics, "add");
|
||||
verifyConfigurable(Atomics, "add");
|
||||
verifyProperty(Atomics, 'add', {
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true,
|
||||
});
|
||||
|
@ -1,30 +1,111 @@
|
||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||
// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-atomics.isLockFree
|
||||
esid: sec-atomics.islockfree
|
||||
description: >
|
||||
Atomics.isLockFree returns a boolean that indicates whether
|
||||
operations on datum of size will be performed without the agent
|
||||
acquiring a lock outside of size bytes.
|
||||
info: |
|
||||
Atomics.isLockFree( size )
|
||||
|
||||
1. Let n be ? ToInteger(size).
|
||||
2. Let AR be the Agent Record of the surrounding agent.
|
||||
3. If n equals 1, return AR.[[IsLockFree1]].
|
||||
4. If n equals 2, return AR.[[IsLockFree2]].
|
||||
5. If n equals 4, return true.
|
||||
6. Return false.
|
||||
|
||||
features: [Atomics, SharedArrayBuffer, TypedArray]
|
||||
includes: [testTypedArray.js]
|
||||
Let n be ? ToInteger(size).
|
||||
Let AR be the Agent Record of the surrounding agent.
|
||||
If n equals 1, return AR.[[IsLockFree1]].
|
||||
If n equals 2, return AR.[[IsLockFree2]].
|
||||
If n equals 4, return true.
|
||||
If n equals 8, return AR.[[IsLockFree8]].
|
||||
Return false.
|
||||
features: [Atomics]
|
||||
---*/
|
||||
|
||||
var views = intArrayConstructors.slice();
|
||||
// These are the only counts that we care about tracking.
|
||||
var isLockFree1;
|
||||
var isLockFree2;
|
||||
var isLockFree8;
|
||||
|
||||
testWithTypedArrayConstructors(function(TA) {
|
||||
assert.sameValue(Atomics.isLockFree(TA.BYTES_PER_ELEMENT), true);
|
||||
}, views);
|
||||
{
|
||||
isLockFree1 = Atomics.isLockFree(1);
|
||||
//
|
||||
// If n equals 1, return AR.[[IsLockFree1]].
|
||||
//
|
||||
assert.sameValue(typeof isLockFree1, 'boolean', 'The value of `typeof isLockFree1` is "boolean"');
|
||||
// Once the values of [[Signifier]], [[IsLockFree1]], [[IsLockFree2]],
|
||||
// and [[IsLockFree8]] have been observed by any agent in the agent
|
||||
// cluster they cannot change.
|
||||
assert.sameValue(
|
||||
Atomics.isLockFree(1),
|
||||
isLockFree1,
|
||||
'Atomics.isLockFree(1) equals the value of `isLockFree1` (Atomics.isLockFree(1))'
|
||||
);
|
||||
};
|
||||
{
|
||||
isLockFree2 = Atomics.isLockFree(2);
|
||||
//
|
||||
// If n equals 2, return AR.[[IsLockFree2]].
|
||||
//
|
||||
assert.sameValue(typeof isLockFree2, 'boolean', 'The value of `typeof isLockFree2` is "boolean"');
|
||||
// Once the values of [[Signifier]], [[IsLockFree1]], [[IsLockFree2]],
|
||||
// and [[IsLockFree8]] have been observed by any agent in the agent
|
||||
// cluster they cannot change.
|
||||
assert.sameValue(
|
||||
Atomics.isLockFree(2),
|
||||
isLockFree2,
|
||||
'Atomics.isLockFree(2) equals the value of `isLockFree2` (Atomics.isLockFree(2))'
|
||||
);
|
||||
};
|
||||
{
|
||||
let isLockFree4 = Atomics.isLockFree(4);
|
||||
//
|
||||
// If n equals 4, return true.
|
||||
//
|
||||
assert.sameValue(typeof isLockFree4, 'boolean', 'The value of `typeof isLockFree` is "boolean"');
|
||||
assert.sameValue(isLockFree4, true, 'The value of `isLockFree` is true');
|
||||
};
|
||||
|
||||
{
|
||||
let isLockFree8 = Atomics.isLockFree(8);
|
||||
//
|
||||
// If n equals 8, return AR.[[IsLockFree8]].
|
||||
//
|
||||
assert.sameValue(typeof isLockFree8, 'boolean', 'The value of `typeof isLockFree8` is "boolean"');
|
||||
// Once the values of [[Signifier]], [[IsLockFree1]], [[IsLockFree2]],
|
||||
// and [[IsLockFree8]] have been observed by any agent in the agent
|
||||
// cluster they cannot change.
|
||||
assert.sameValue(
|
||||
Atomics.isLockFree(8),
|
||||
isLockFree8,
|
||||
'Atomics.isLockFree(8) equals the value of `isLockFree8` (Atomics.isLockFree(8))'
|
||||
);
|
||||
};
|
||||
|
||||
{
|
||||
for (let i = 0; i < 12; i++) {
|
||||
if (![1, 2, 4, 8].includes(i)) {
|
||||
assert.sameValue(Atomics.isLockFree(i), false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
assert.sameValue(
|
||||
Atomics.isLockFree(1),
|
||||
isLockFree1,
|
||||
'Later call to Atomics.isLockFree(1) equals the value of `isLockFree1` (Atomics.isLockFree(1))'
|
||||
);
|
||||
assert.sameValue(
|
||||
Atomics.isLockFree(2),
|
||||
isLockFree2,
|
||||
'Later call to Atomics.isLockFree(2) equals the value of `isLockFree2` (Atomics.isLockFree(2))'
|
||||
);
|
||||
assert.sameValue(
|
||||
Atomics.isLockFree(8),
|
||||
isLockFree8,
|
||||
'Later call to Atomics.isLockFree(8) equals the value of `isLockFree8` (Atomics.isLockFree(8))'
|
||||
);
|
||||
|
||||
// Duplicates behavior created by loop from above
|
||||
assert.sameValue(Atomics.isLockFree(3), false, 'Atomics.isLockFree(3) returns false');
|
||||
assert.sameValue(Atomics.isLockFree(4), true, 'Atomics.isLockFree(4) returns true');
|
||||
assert.sameValue(Atomics.isLockFree(5), false, 'Atomics.isLockFree(5) returns false');
|
||||
assert.sameValue(Atomics.isLockFree(6), false, 'Atomics.isLockFree(6) returns false');
|
||||
assert.sameValue(Atomics.isLockFree(7), false, 'Atomics.isLockFree(7) returns false');
|
||||
assert.sameValue(Atomics.isLockFree(9), false, 'Atomics.isLockFree(9) returns false');
|
||||
assert.sameValue(Atomics.isLockFree(10), false, 'Atomics.isLockFree(10) returns false');
|
||||
assert.sameValue(Atomics.isLockFree(11), false, 'Atomics.isLockFree(11) returns false');
|
||||
assert.sameValue(Atomics.isLockFree(12), false, 'Atomics.isLockFree(12) returns false');
|
||||
|
@ -24,8 +24,9 @@ includes: [propertyHelper.js]
|
||||
features: [Atomics]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Atomics.isLockFree.length, 1);
|
||||
|
||||
verifyNotEnumerable(Atomics.isLockFree, "length");
|
||||
verifyNotWritable(Atomics.isLockFree, "length");
|
||||
verifyConfigurable(Atomics.isLockFree, "length");
|
||||
verifyProperty(Atomics.isLockFree, 'length', {
|
||||
value: 1,
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: true,
|
||||
});
|
||||
|
@ -10,8 +10,9 @@ includes: [propertyHelper.js]
|
||||
features: [Atomics]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Atomics.isLockFree.name, "isLockFree");
|
||||
|
||||
verifyNotEnumerable(Atomics.isLockFree, "name");
|
||||
verifyNotWritable(Atomics.isLockFree, "name");
|
||||
verifyConfigurable(Atomics.isLockFree, "name");
|
||||
verifyProperty(Atomics.isLockFree, 'name', {
|
||||
value: 'isLockFree',
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: true,
|
||||
});
|
||||
|
@ -1,45 +0,0 @@
|
||||
// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-atomics.islockfree
|
||||
description: >
|
||||
Test isLockFree on nonnegative integer arguments
|
||||
features: [Atomics]
|
||||
---*/
|
||||
|
||||
var sizes = [ 1, 2, 3, 4, 5, 6, 7, 8,
|
||||
9, 10, 11, 12];
|
||||
var answers = [ {}, {}, false, true, false, false, false, false,
|
||||
false, false, false, false];
|
||||
|
||||
var saved = {};
|
||||
|
||||
// This should defeat most optimizations.
|
||||
|
||||
for (var i = 0; i < sizes.length; i++) {
|
||||
var v = Atomics.isLockFree(sizes[i]);
|
||||
var a = answers[i];
|
||||
assert.sameValue(typeof v, 'boolean');
|
||||
if (typeof a == 'boolean') {
|
||||
assert.sameValue(v, a);
|
||||
} else {
|
||||
saved[sizes[i]] = v;
|
||||
}
|
||||
}
|
||||
|
||||
// This ought to be optimizable. Make sure the answers are the same
|
||||
// as for the unoptimized case.
|
||||
|
||||
assert.sameValue(Atomics.isLockFree(1), saved[1]);
|
||||
assert.sameValue(Atomics.isLockFree(2), saved[2]);
|
||||
assert.sameValue(Atomics.isLockFree(3), false);
|
||||
assert.sameValue(Atomics.isLockFree(4), true);
|
||||
assert.sameValue(Atomics.isLockFree(5), false);
|
||||
assert.sameValue(Atomics.isLockFree(6), false);
|
||||
assert.sameValue(Atomics.isLockFree(7), false);
|
||||
assert.sameValue(Atomics.isLockFree(8), false);
|
||||
assert.sameValue(Atomics.isLockFree(9), false);
|
||||
assert.sameValue(Atomics.isLockFree(10), false);
|
||||
assert.sameValue(Atomics.isLockFree(11), false);
|
||||
assert.sameValue(Atomics.isLockFree(12), false);
|
@ -8,6 +8,8 @@ includes: [propertyHelper.js]
|
||||
features: [Atomics]
|
||||
---*/
|
||||
|
||||
verifyWritable(Atomics, "load");
|
||||
verifyNotEnumerable(Atomics, "load");
|
||||
verifyConfigurable(Atomics, "load");
|
||||
verifyProperty(Atomics, 'load', {
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true,
|
||||
});
|
||||
|
@ -30,11 +30,11 @@ features: [Atomics, SharedArrayBuffer, TypedArray]
|
||||
|
||||
var buffer = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT);
|
||||
var i32a = new Int32Array(buffer);
|
||||
var value = 0b00000001000000001000000010000001;
|
||||
var update = 0b00000001000000001000000010000001;
|
||||
|
||||
assert.sameValue(Atomics.load(i32a, 0), 0);
|
||||
|
||||
i32a[0] = value;
|
||||
i32a[0] = update;
|
||||
|
||||
assert.sameValue(Atomics.load(i32a, 0), value);
|
||||
assert.sameValue(Atomics.load(i32a, 0), update);
|
||||
|
||||
|
@ -24,8 +24,9 @@ includes: [propertyHelper.js]
|
||||
features: [Atomics]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Atomics.load.length, 2);
|
||||
|
||||
verifyNotEnumerable(Atomics.load, "length");
|
||||
verifyNotWritable(Atomics.load, "length");
|
||||
verifyConfigurable(Atomics.load, "length");
|
||||
verifyProperty(Atomics.load, 'length', {
|
||||
value: 2,
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: true,
|
||||
});
|
||||
|
@ -10,8 +10,9 @@ includes: [propertyHelper.js]
|
||||
features: [Atomics]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Atomics.load.name, "load");
|
||||
|
||||
verifyNotEnumerable(Atomics.load, "name");
|
||||
verifyNotWritable(Atomics.load, "name");
|
||||
verifyConfigurable(Atomics.load, "name");
|
||||
verifyProperty(Atomics.load, 'name', {
|
||||
value: 'load',
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: true,
|
||||
});
|
||||
|
@ -7,7 +7,8 @@ description: Testing descriptor property of Atomics.or
|
||||
includes: [propertyHelper.js]
|
||||
features: [Atomics]
|
||||
---*/
|
||||
|
||||
verifyWritable(Atomics, "or");
|
||||
verifyNotEnumerable(Atomics, "or");
|
||||
verifyConfigurable(Atomics, "or");
|
||||
verifyProperty(Atomics, 'or', {
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true,
|
||||
});
|
||||
|
@ -29,7 +29,7 @@ features: [Atomics, SharedArrayBuffer, TypedArray]
|
||||
|
||||
var buffer = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT);
|
||||
var i32a = new Int32Array(buffer);
|
||||
var value = 0b00000001000000001000000010000001;
|
||||
var update = 0b00000001000000001000000010000001;
|
||||
|
||||
assert.sameValue(Atomics.or(i32a, 0, value), 0);
|
||||
assert.sameValue(i32a[0], 0 | value);
|
||||
assert.sameValue(Atomics.or(i32a, 0, update), 0);
|
||||
assert.sameValue(i32a[0], 0 | update);
|
||||
|
@ -24,8 +24,9 @@ includes: [propertyHelper.js]
|
||||
features: [Atomics]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Atomics.or.length, 3);
|
||||
|
||||
verifyNotEnumerable(Atomics.or, "length");
|
||||
verifyNotWritable(Atomics.or, "length");
|
||||
verifyConfigurable(Atomics.or, "length");
|
||||
verifyProperty(Atomics.or, 'length', {
|
||||
value: 3,
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: true,
|
||||
});
|
||||
|
@ -10,8 +10,9 @@ includes: [propertyHelper.js]
|
||||
features: [Atomics]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Atomics.or.name, "or");
|
||||
|
||||
verifyNotEnumerable(Atomics.or, "name");
|
||||
verifyNotWritable(Atomics.or, "name");
|
||||
verifyConfigurable(Atomics.or, "name");
|
||||
verifyProperty(Atomics.or, 'name', {
|
||||
value: 'or',
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: true,
|
||||
});
|
||||
|
@ -7,7 +7,8 @@ description: Testing descriptor property of Atomics.store
|
||||
includes: [propertyHelper.js]
|
||||
features: [Atomics]
|
||||
---*/
|
||||
|
||||
verifyWritable(Atomics, "store");
|
||||
verifyNotEnumerable(Atomics, "store");
|
||||
verifyConfigurable(Atomics, "store");
|
||||
verifyProperty(Atomics, 'store', {
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true,
|
||||
});
|
||||
|
@ -20,7 +20,7 @@ features: [Atomics, SharedArrayBuffer, TypedArray]
|
||||
|
||||
var buffer = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT);
|
||||
var i32a = new Int32Array(buffer);
|
||||
var expect = 0b00000001000000001000000010000001;
|
||||
var update = 0b00000001000000001000000010000001;
|
||||
|
||||
assert.sameValue(Atomics.store(i32a, 0, expect), expect);
|
||||
assert.sameValue(i32a[0], expect);
|
||||
assert.sameValue(Atomics.store(i32a, 0, update), update);
|
||||
assert.sameValue(i32a[0], update);
|
||||
|
@ -24,8 +24,9 @@ includes: [propertyHelper.js]
|
||||
features: [Atomics]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Atomics.store.length, 3);
|
||||
|
||||
verifyNotEnumerable(Atomics.store, "length");
|
||||
verifyNotWritable(Atomics.store, "length");
|
||||
verifyConfigurable(Atomics.store, "length");
|
||||
verifyProperty(Atomics.store, 'length', {
|
||||
value: 3,
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: true,
|
||||
});
|
||||
|
@ -10,8 +10,9 @@ includes: [propertyHelper.js]
|
||||
features: [Atomics]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Atomics.store.name, "store");
|
||||
|
||||
verifyNotEnumerable(Atomics.store, "name");
|
||||
verifyNotWritable(Atomics.store, "name");
|
||||
verifyConfigurable(Atomics.store, "name");
|
||||
verifyProperty(Atomics.store, 'name', {
|
||||
value: 'store',
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: true,
|
||||
});
|
||||
|
@ -8,6 +8,8 @@ includes: [propertyHelper.js]
|
||||
features: [Atomics]
|
||||
---*/
|
||||
|
||||
verifyWritable(Atomics, "sub");
|
||||
verifyNotEnumerable(Atomics, "sub");
|
||||
verifyConfigurable(Atomics, "sub");
|
||||
verifyProperty(Atomics, 'sub', {
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true,
|
||||
});
|
||||
|
@ -29,9 +29,9 @@ features: [Atomics, SharedArrayBuffer, TypedArray]
|
||||
|
||||
var buffer = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT);
|
||||
var i32a = new Int32Array(buffer);
|
||||
var value = 0b00000001000000001000000010000001;
|
||||
var update = 0b00000001000000001000000010000001;
|
||||
|
||||
i32a[0] = value;
|
||||
i32a[0] = update;
|
||||
|
||||
assert.sameValue(Atomics.sub(i32a, 0, value), value);
|
||||
assert.sameValue(Atomics.sub(i32a, 0, update), update);
|
||||
assert.sameValue(i32a[0], 0);
|
||||
|
@ -24,8 +24,9 @@ includes: [propertyHelper.js]
|
||||
features: [Atomics]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Atomics.sub.length, 3);
|
||||
|
||||
verifyNotEnumerable(Atomics.sub, "length");
|
||||
verifyNotWritable(Atomics.sub, "length");
|
||||
verifyConfigurable(Atomics.sub, "length");
|
||||
verifyProperty(Atomics.sub, 'length', {
|
||||
value: 3,
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: true,
|
||||
});
|
||||
|
@ -10,8 +10,10 @@ includes: [propertyHelper.js]
|
||||
features: [Atomics]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Atomics.sub.name, "sub");
|
||||
verifyProperty(Atomics.sub, 'name', {
|
||||
value: 'sub',
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: true,
|
||||
});
|
||||
|
||||
verifyNotEnumerable(Atomics.sub, "name");
|
||||
verifyNotWritable(Atomics.sub, "name");
|
||||
verifyConfigurable(Atomics.sub, "name");
|
||||
|
@ -26,9 +26,9 @@ function getReport() {
|
||||
$262.agent.start(`
|
||||
$262.agent.receiveBroadcast(function(sab, id) {
|
||||
var ia = new BigInt64Array(sab);
|
||||
var then = Date.now();
|
||||
var then = $262.agent.monotonicNow();
|
||||
$262.agent.report(Atomics.wait(ia, 0, 0, 500)); // Timeout 500ms
|
||||
$262.agent.report(Date.now() - then); // Actual time can be more than 500ms
|
||||
$262.agent.report($262.agent.monotonicNow() - then); // Actual time can be more than 500ms
|
||||
$262.agent.leaving();
|
||||
});
|
||||
`);
|
||||
|
@ -38,11 +38,11 @@ var toPrimitive = {
|
||||
|
||||
$262.agent.receiveBroadcast(function(sab) {
|
||||
var i64a = new BigInt64Array(sab);
|
||||
var start = Date.now();
|
||||
var start = $262.agent.monotonicNow();
|
||||
$262.agent.report(Atomics.wait(i64a, 0, 0, false));
|
||||
$262.agent.report(Atomics.wait(i64a, 0, 0, valueOf));
|
||||
$262.agent.report(Atomics.wait(i64a, 0, 0, toPrimitive));
|
||||
$262.agent.report(Date.now() - start);
|
||||
$262.agent.report($262.agent.monotonicNow() - start);
|
||||
$262.agent.leaving();
|
||||
});
|
||||
`);
|
||||
|
@ -13,9 +13,9 @@ features: [Atomics, BigInt, SharedArrayBuffer, TypedArray]
|
||||
$262.agent.start(`
|
||||
$262.agent.receiveBroadcast(function(sab, id) {
|
||||
var ia = new BigInt64Array(sab);
|
||||
var then = Date.now();
|
||||
var then = $262.agent.monotonicNow();
|
||||
Atomics.wait(ia, 0, 0);
|
||||
var diff = Date.now() - then; // Should be about 1000 ms but can be more
|
||||
var diff = $262.agent.monotonicNow() - then; // Should be about 1000 ms but can be more
|
||||
$262.agent.report(diff);
|
||||
$262.agent.leaving();
|
||||
})
|
||||
|
@ -23,10 +23,10 @@ const i64a = new BigInt64Array(
|
||||
$262.agent.start(`
|
||||
$262.agent.receiveBroadcast(function(sab) {
|
||||
var i64a = new BigInt64Array(sab);
|
||||
var before = Date.now();
|
||||
var before = $262.agent.monotonicNow();
|
||||
$262.agent.report("ready");
|
||||
Atomics.wait(i64a, 0, 0, ${TWO_SECOND_TIMEOUT});
|
||||
$262.agent.report(Date.now() - before);
|
||||
$262.agent.report($262.agent.monotonicNow() - before);
|
||||
$262.agent.leaving();
|
||||
});
|
||||
`);
|
||||
|
@ -8,6 +8,9 @@ includes: [propertyHelper.js]
|
||||
features: [Atomics]
|
||||
---*/
|
||||
|
||||
verifyWritable(Atomics, "wait");
|
||||
verifyNotEnumerable(Atomics, "wait");
|
||||
verifyConfigurable(Atomics, "wait");
|
||||
verifyProperty(Atomics, 'wait', {
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true,
|
||||
});
|
||||
|
||||
|
@ -27,9 +27,9 @@ function getReport() {
|
||||
$262.agent.start(`
|
||||
$262.agent.receiveBroadcast(function(sab, id) {
|
||||
var i32a = new Int32Array(sab);
|
||||
var then = Date.now();
|
||||
var before = $262.agent.monotonicNow();
|
||||
$262.agent.report(Atomics.wait(i32a, 0, 0, 500)); // Timeout 500ms
|
||||
$262.agent.report(Date.now() - then); // Actual time can be more than 500ms
|
||||
$262.agent.report($262.agent.monotonicNow() - before); // Actual time can be more than 500ms
|
||||
$262.agent.leaving();
|
||||
})
|
||||
`);
|
||||
|
@ -40,11 +40,11 @@ var toPrimitive = {
|
||||
|
||||
$262.agent.receiveBroadcast(function(sab) {
|
||||
var i32a = new Int32Array(sab);
|
||||
var start = Date.now();
|
||||
var before = $262.agent.monotonicNow();
|
||||
$262.agent.report(Atomics.wait(i32a, 0, 0, false));
|
||||
$262.agent.report(Atomics.wait(i32a, 0, 0, valueOf));
|
||||
$262.agent.report(Atomics.wait(i32a, 0, 0, toPrimitive));
|
||||
$262.agent.report(Date.now() - start);
|
||||
$262.agent.report($262.agent.monotonicNow() - before);
|
||||
$262.agent.leaving();
|
||||
})
|
||||
`);
|
||||
|
@ -24,8 +24,9 @@ includes: [propertyHelper.js]
|
||||
features: [Atomics]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Atomics.wait.length, 4);
|
||||
|
||||
verifyNotEnumerable(Atomics.wait, "length");
|
||||
verifyNotWritable(Atomics.wait, "length");
|
||||
verifyConfigurable(Atomics.wait, "length");
|
||||
verifyProperty(Atomics.wait, 'length', {
|
||||
value: 4,
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: true,
|
||||
});
|
||||
|
@ -10,8 +10,9 @@ includes: [propertyHelper.js]
|
||||
features: [Atomics]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Atomics.wait.name, "wait");
|
||||
|
||||
verifyNotEnumerable(Atomics.wait, "name");
|
||||
verifyNotWritable(Atomics.wait, "name");
|
||||
verifyConfigurable(Atomics.wait, "name");
|
||||
verifyProperty(Atomics.wait, 'name', {
|
||||
value: 'wait',
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: true,
|
||||
});
|
||||
|
@ -23,10 +23,10 @@ const i32a = new Int32Array(
|
||||
$262.agent.start(`
|
||||
$262.agent.receiveBroadcast(function(sab) {
|
||||
var i32a = new Int32Array(sab);
|
||||
var before = Date.now();
|
||||
var before = $262.agent.monotonicNow();
|
||||
$262.agent.report("ready");
|
||||
Atomics.wait(i32a, 0, 0, ${TWO_SECOND_TIMEOUT});
|
||||
$262.agent.report(Date.now() - before);
|
||||
$262.agent.report($262.agent.monotonicNow() - before);
|
||||
$262.agent.leaving();
|
||||
});
|
||||
`);
|
||||
|
@ -23,10 +23,10 @@ const i32a = new Int32Array(
|
||||
$262.agent.start(`
|
||||
$262.agent.receiveBroadcast(function(sab) {
|
||||
var i32a = new Int32Array(sab);
|
||||
var before = Date.now();
|
||||
var before = $262.agent.monotonicNow();
|
||||
$262.agent.report("ready");
|
||||
Atomics.wait(i32a, 0, 0, ${TWO_SECOND_TIMEOUT});
|
||||
$262.agent.report(Date.now() - before);
|
||||
$262.agent.report($262.agent.monotonicNow() - before);
|
||||
$262.agent.leaving();
|
||||
});
|
||||
`);
|
||||
|
@ -23,10 +23,10 @@ const i32a = new Int32Array(
|
||||
$262.agent.start(`
|
||||
$262.agent.receiveBroadcast(function(sab) {
|
||||
var i32a = new Int32Array(sab);
|
||||
var before = Date.now();
|
||||
var before = $262.agent.monotonicNow();
|
||||
$262.agent.report("ready");
|
||||
Atomics.wait(i32a, 0, 0, ${TWO_SECOND_TIMEOUT});
|
||||
$262.agent.report(Date.now() - before);
|
||||
$262.agent.report($262.agent.monotonicNow() - before);
|
||||
$262.agent.leaving();
|
||||
});
|
||||
`);
|
||||
|
@ -23,10 +23,10 @@ const i32a = new Int32Array(
|
||||
$262.agent.start(`
|
||||
$262.agent.receiveBroadcast(function(sab) {
|
||||
var i32a = new Int32Array(sab);
|
||||
var before = Date.now();
|
||||
var before = $262.agent.monotonicNow();
|
||||
$262.agent.report("ready");
|
||||
Atomics.wait(i32a, 0, 0, ${TWO_SECOND_TIMEOUT});
|
||||
$262.agent.report(Date.now() - before);
|
||||
$262.agent.report($262.agent.monotonicNow() - before);
|
||||
$262.agent.leaving();
|
||||
});
|
||||
`);
|
||||
|
@ -23,10 +23,10 @@ const i32a = new Int32Array(
|
||||
$262.agent.start(`
|
||||
$262.agent.receiveBroadcast(function(sab) {
|
||||
var i32a = new Int32Array(sab);
|
||||
var before = Date.now();
|
||||
var before = $262.agent.monotonicNow();
|
||||
$262.agent.report("ready");
|
||||
Atomics.wait(i32a, 0, 0, ${TWO_SECOND_TIMEOUT});
|
||||
$262.agent.report(Date.now() - before);
|
||||
$262.agent.report($262.agent.monotonicNow() - before);
|
||||
$262.agent.leaving();
|
||||
});
|
||||
`);
|
||||
|
@ -13,9 +13,9 @@ features: [Atomics, SharedArrayBuffer, TypedArray]
|
||||
$262.agent.start(`
|
||||
$262.agent.receiveBroadcast(function(sab, id) {
|
||||
var i32a = new Int32Array(sab);
|
||||
var then = Date.now();
|
||||
var then = $262.agent.monotonicNow();
|
||||
Atomics.wait(i32a, 0, 0);
|
||||
var diff = Date.now() - then; // Should be about 1000 ms but can be more
|
||||
var diff = $262.agent.monotonicNow() - then; // Should be about 1000 ms but can be more
|
||||
$262.agent.report(diff);
|
||||
$262.agent.leaving();
|
||||
})
|
||||
|
@ -23,10 +23,10 @@ const i32a = new Int32Array(
|
||||
$262.agent.start(`
|
||||
$262.agent.receiveBroadcast(function(sab) {
|
||||
var i32a = new Int32Array(sab);
|
||||
var before = Date.now();
|
||||
var before = $262.agent.monotonicNow();
|
||||
$262.agent.report("ready");
|
||||
Atomics.wait(i32a, 0, 0, ${TWO_SECOND_TIMEOUT});
|
||||
$262.agent.report(Date.now() - before);
|
||||
$262.agent.report($262.agent.monotonicNow() - before);
|
||||
$262.agent.leaving();
|
||||
});
|
||||
`);
|
||||
|
@ -23,10 +23,10 @@ const i32a = new Int32Array(
|
||||
$262.agent.start(`
|
||||
$262.agent.receiveBroadcast(function(sab) {
|
||||
var i32a = new Int32Array(sab);
|
||||
var before = Date.now();
|
||||
var before = $262.agent.monotonicNow();
|
||||
$262.agent.report("ready");
|
||||
Atomics.wait(i32a, 0, 0, ${TWO_SECOND_TIMEOUT});
|
||||
$262.agent.report(Date.now() - before);
|
||||
$262.agent.report($262.agent.monotonicNow() - before);
|
||||
$262.agent.leaving();
|
||||
});
|
||||
`);
|
||||
|
@ -23,10 +23,10 @@ const i32a = new Int32Array(
|
||||
$262.agent.start(`
|
||||
$262.agent.receiveBroadcast(function(sab) {
|
||||
var i32a = new Int32Array(sab);
|
||||
var before = Date.now();
|
||||
var before = $262.agent.monotonicNow();
|
||||
$262.agent.report("ready");
|
||||
Atomics.wait(i32a, 0, 0, ${TWO_SECOND_TIMEOUT});
|
||||
$262.agent.report(Date.now() - before);
|
||||
$262.agent.report($262.agent.monotonicNow() - before);
|
||||
$262.agent.leaving();
|
||||
});
|
||||
`);
|
||||
|
@ -40,11 +40,11 @@ var toPrimitive = {
|
||||
|
||||
$262.agent.receiveBroadcast(function(sab) {
|
||||
var i32a = new Int32Array(sab);
|
||||
var start = Date.now();
|
||||
var before = $262.agent.monotonicNow();
|
||||
$262.agent.report(Atomics.wait(i32a, 0, 0, null));
|
||||
$262.agent.report(Atomics.wait(i32a, 0, 0, valueOf));
|
||||
$262.agent.report(Atomics.wait(i32a, 0, 0, toPrimitive));
|
||||
$262.agent.report(Date.now() - start);
|
||||
$262.agent.report($262.agent.monotonicNow() - before);
|
||||
$262.agent.leaving();
|
||||
})
|
||||
`);
|
||||
|
@ -47,11 +47,11 @@ var toPrimitive = {
|
||||
|
||||
$262.agent.receiveBroadcast(function(sab) {
|
||||
var i32a = new Int32Array(sab);
|
||||
var start = Date.now();
|
||||
var start = $262.agent.monotonicNow();
|
||||
$262.agent.report(Atomics.wait(i32a, 0, 0, valueOf));
|
||||
$262.agent.report(Atomics.wait(i32a, 0, 0, toString));
|
||||
$262.agent.report(Atomics.wait(i32a, 0, 0, toPrimitive));
|
||||
$262.agent.report(Date.now() - start);
|
||||
$262.agent.report($262.agent.monotonicNow() - start);
|
||||
$262.agent.leaving();
|
||||
})
|
||||
`);
|
||||
|
@ -40,7 +40,7 @@ var poisonedToPrimitive = {
|
||||
|
||||
$262.agent.receiveBroadcast(function(sab) {
|
||||
var i32a = new Int32Array(sab);
|
||||
var start = Date.now();
|
||||
var start = $262.agent.monotonicNow();
|
||||
try {
|
||||
Atomics.wait(i32a, 0, 0, poisonedValueOf);
|
||||
} catch (error) {
|
||||
@ -51,7 +51,7 @@ $262.agent.receiveBroadcast(function(sab) {
|
||||
} catch (error) {
|
||||
$262.agent.report("poisonedToPrimitive");
|
||||
}
|
||||
$262.agent.report(Date.now() - start);
|
||||
$262.agent.report($262.agent.monotonicNow() - start);
|
||||
$262.agent.leaving();
|
||||
});
|
||||
`);
|
||||
|
@ -53,7 +53,7 @@ var poisonedToPrimitive = {
|
||||
|
||||
$262.agent.receiveBroadcast(function(sab) {
|
||||
var i32a = new Int32Array(sab);
|
||||
var start = Date.now();
|
||||
var start = $262.agent.monotonicNow();
|
||||
try {
|
||||
Atomics.wait(i32a, Symbol("1"), poisonedValueOf, poisonedValueOf);
|
||||
} catch (error) {
|
||||
@ -64,7 +64,7 @@ $262.agent.receiveBroadcast(function(sab) {
|
||||
} catch (error) {
|
||||
$262.agent.report('Symbol("2")');
|
||||
}
|
||||
$262.agent.report(Date.now() - start);
|
||||
$262.agent.report($262.agent.monotonicNow() - start);
|
||||
$262.agent.leaving();
|
||||
});
|
||||
`);
|
||||
|
@ -26,7 +26,7 @@ function getReport() {
|
||||
$262.agent.start(`
|
||||
$262.agent.receiveBroadcast(function(sab) {
|
||||
var i32a = new Int32Array(sab);
|
||||
var start = Date.now();
|
||||
var start = $262.agent.monotonicNow();
|
||||
try {
|
||||
Atomics.wait(i32a, 0, 0, Symbol("1"));
|
||||
} catch (error) {
|
||||
@ -37,7 +37,7 @@ $262.agent.receiveBroadcast(function(sab) {
|
||||
} catch (error) {
|
||||
$262.agent.report('Symbol("2")');
|
||||
}
|
||||
$262.agent.report(Date.now() - start);
|
||||
$262.agent.report($262.agent.monotonicNow() - start);
|
||||
$262.agent.leaving();
|
||||
});
|
||||
`);
|
||||
|
@ -43,7 +43,7 @@ var poisonedToPrimitive = {
|
||||
|
||||
$262.agent.receiveBroadcast(function(sab) {
|
||||
var i32a = new Int32Array(sab);
|
||||
var start = Date.now();
|
||||
var start = $262.agent.monotonicNow();
|
||||
try {
|
||||
Atomics.wait(i32a, 0, Symbol("1"), poisonedValueOf);
|
||||
} catch (error) {
|
||||
@ -54,7 +54,7 @@ $262.agent.receiveBroadcast(function(sab) {
|
||||
} catch (error) {
|
||||
$262.agent.report('Symbol("2")');
|
||||
}
|
||||
$262.agent.report(Date.now() - start);
|
||||
$262.agent.report($262.agent.monotonicNow() - start);
|
||||
$262.agent.leaving();
|
||||
});
|
||||
`);
|
||||
|
@ -40,11 +40,11 @@ var toPrimitive = {
|
||||
|
||||
$262.agent.receiveBroadcast(function(sab) {
|
||||
var i32a = new Int32Array(sab);
|
||||
var start = Date.now();
|
||||
var start = $262.agent.monotonicNow();
|
||||
$262.agent.report(Atomics.wait(i32a, 0, 0, true));
|
||||
$262.agent.report(Atomics.wait(i32a, 0, 0, valueOf));
|
||||
$262.agent.report(Atomics.wait(i32a, 0, 0, toPrimitive));
|
||||
$262.agent.report(Date.now() - start);
|
||||
$262.agent.report($262.agent.monotonicNow() - start);
|
||||
$262.agent.leaving();
|
||||
})
|
||||
`);
|
||||
|
@ -70,7 +70,7 @@ var i32a = new Int32Array(new SharedArrayBuffer(4));
|
||||
|
||||
$262.agent.broadcast(i32a.buffer);
|
||||
|
||||
var orderWhichAgentsWereStarted = getReport() + getReport() + getReport(); // can be started in any order
|
||||
var orderAgentsStarted = getReport() + getReport() + getReport(); // can be started in any order
|
||||
|
||||
assert.sameValue(Atomics.wake(i32a, 0, 1), 1);
|
||||
|
||||
@ -84,4 +84,4 @@ assert.sameValue(Atomics.wake(i32a, 0, 1), 1);
|
||||
|
||||
orderAgentsWereWoken += getReport();
|
||||
|
||||
assert.sameValue(orderWhichAgentsWereStarted, orderAgentsWereWoken); // agents should wake in the same order as they were started FIFO
|
||||
assert.sameValue(orderAgentsStarted, orderAgentsWereWoken); // agents should wake in the same order as they were started FIFO
|
||||
|
@ -18,15 +18,15 @@ function getReport() {
|
||||
|
||||
$262.agent.start(`
|
||||
$262.agent.receiveBroadcast(function(sab, id) {
|
||||
var ia = new Int32Array(sab);
|
||||
$262.agent.report(Atomics.wait(ia, 0, 0)); // No timeout => Infinity
|
||||
var i32a = new Int32Array(sab);
|
||||
$262.agent.report(Atomics.wait(i32a, 0, 0)); // No timeout => Infinity
|
||||
$262.agent.leaving();
|
||||
});
|
||||
`);
|
||||
|
||||
var ia = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
|
||||
var i32a = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
|
||||
|
||||
$262.agent.broadcast(ia.buffer);
|
||||
$262.agent.broadcast(i32a.buffer);
|
||||
$262.agent.sleep(500); // Give the agent a chance to wait
|
||||
Atomics.wake(ia, 0);
|
||||
Atomics.wake(i32a, 0);
|
||||
assert.sameValue(getReport(), "ok");
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user