summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Atomics/load
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /js/src/tests/test262/built-ins/Atomics/load
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/built-ins/Atomics/load')
-rw-r--r--js/src/tests/test262/built-ins/Atomics/load/bad-range.js25
-rw-r--r--js/src/tests/test262/built-ins/Atomics/load/bigint/bad-range.js24
-rw-r--r--js/src/tests/test262/built-ins/Atomics/load/bigint/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Atomics/load/bigint/good-views.js51
-rw-r--r--js/src/tests/test262/built-ins/Atomics/load/bigint/non-shared-bufferdata.js17
-rw-r--r--js/src/tests/test262/built-ins/Atomics/load/bigint/shell.js42
-rw-r--r--js/src/tests/test262/built-ins/Atomics/load/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/Atomics/load/descriptor.js18
-rw-r--r--js/src/tests/test262/built-ins/Atomics/load/expected-return-value.js48
-rw-r--r--js/src/tests/test262/built-ins/Atomics/load/good-views.js49
-rw-r--r--js/src/tests/test262/built-ins/Atomics/load/length.js35
-rw-r--r--js/src/tests/test262/built-ins/Atomics/load/name.js21
-rw-r--r--js/src/tests/test262/built-ins/Atomics/load/non-shared-bufferdata.js20
-rw-r--r--js/src/tests/test262/built-ins/Atomics/load/non-shared-int-views-throws.js20
-rw-r--r--js/src/tests/test262/built-ins/Atomics/load/non-views.js19
-rw-r--r--js/src/tests/test262/built-ins/Atomics/load/not-a-constructor.js32
-rw-r--r--js/src/tests/test262/built-ins/Atomics/load/shell.js24
-rw-r--r--js/src/tests/test262/built-ins/Atomics/load/validate-arraytype-before-index-coercion.js43
18 files changed, 488 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Atomics/load/bad-range.js b/js/src/tests/test262/built-ins/Atomics/load/bad-range.js
new file mode 100644
index 0000000000..3dfe8ae858
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Atomics/load/bad-range.js
@@ -0,0 +1,25 @@
+// |reftest| skip-if(!this.hasOwnProperty('Atomics')||!this.hasOwnProperty('SharedArrayBuffer')||(this.hasOwnProperty('getBuildConfiguration')&&getBuildConfiguration('arm64-simulator'))) -- Atomics,SharedArrayBuffer is not enabled unconditionally, ARM64 Simulator cannot emulate atomics
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-atomics.load
+description: >
+ Test range checking of Atomics.load on arrays that allow atomic operations
+includes: [testAtomics.js, testTypedArray.js]
+features: [ArrayBuffer, Atomics, DataView, SharedArrayBuffer, Symbol, TypedArray]
+---*/
+
+var buffer = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 2);
+var views = nonClampedIntArrayConstructors.slice();
+
+testWithTypedArrayConstructors(function(TA) {
+ let view = new TA(buffer);
+ testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
+ assert.throws(RangeError, function() {
+ Atomics.load(view, IdxGen(view));
+ }, '`Atomics.load(view, IdxGen(view))` throws RangeError');
+ });
+}, views);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Atomics/load/bigint/bad-range.js b/js/src/tests/test262/built-ins/Atomics/load/bigint/bad-range.js
new file mode 100644
index 0000000000..bdb8eed01e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Atomics/load/bigint/bad-range.js
@@ -0,0 +1,24 @@
+// |reftest| skip-if(!this.hasOwnProperty('Atomics')||!this.hasOwnProperty('SharedArrayBuffer')||(this.hasOwnProperty('getBuildConfiguration')&&getBuildConfiguration('arm64-simulator'))) -- Atomics,SharedArrayBuffer is not enabled unconditionally, ARM64 Simulator cannot emulate atomics
+// Copyright (C) 2018 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-atomics.load
+description: >
+ Test range checking of Atomics.load on arrays that allow atomic operations
+includes: [testAtomics.js, testBigIntTypedArray.js]
+features: [ArrayBuffer, Atomics, BigInt, DataView, SharedArrayBuffer, Symbol, TypedArray]
+---*/
+
+var buffer = new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 2);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ let view = new TA(buffer);
+ testWithAtomicsOutOfBoundsIndices(function(IdxGen) {
+ assert.throws(RangeError, function() {
+ Atomics.load(view, IdxGen(view));
+ }, '`Atomics.load(view, IdxGen(view))` throws RangeError');
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Atomics/load/bigint/browser.js b/js/src/tests/test262/built-ins/Atomics/load/bigint/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Atomics/load/bigint/browser.js
diff --git a/js/src/tests/test262/built-ins/Atomics/load/bigint/good-views.js b/js/src/tests/test262/built-ins/Atomics/load/bigint/good-views.js
new file mode 100644
index 0000000000..995587f1eb
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Atomics/load/bigint/good-views.js
@@ -0,0 +1,51 @@
+// |reftest| skip-if(!this.hasOwnProperty('Atomics')||!this.hasOwnProperty('SharedArrayBuffer')||(this.hasOwnProperty('getBuildConfiguration')&&getBuildConfiguration('arm64-simulator'))) -- Atomics,SharedArrayBuffer is not enabled unconditionally, ARM64 Simulator cannot emulate atomics
+// Copyright (C) 2018 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-atomics.load
+description: Test Atomics.load on arrays that allow atomic operations.
+includes: [testAtomics.js, testBigIntTypedArray.js]
+features: [ArrayBuffer, Atomics, BigInt, DataView, SharedArrayBuffer, Symbol, TypedArray]
+---*/
+const sab = new SharedArrayBuffer(1024);
+const ab = new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 2);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ const view = new TA(sab, 32, 20);
+ const control = new TA(ab, 0, 2);
+ view[3] = -5n;
+ control[0] = -5n;
+
+ assert.sameValue(
+ Atomics.load(view, 3),
+ control[0],
+ 'Atomics.load(view, 3) returns the value of `control[0]` (-5n)'
+ );
+
+ control[0] = 12345n;
+ view[3] = 12345n;
+
+ assert.sameValue(
+ Atomics.load(view, 3),
+ control[0],
+ 'Atomics.load(view, 3) returns the value of `control[0]` (12345n)'
+ );
+
+ control[0] = 123456789n;
+ view[3] = 123456789n;
+
+ assert.sameValue(
+ Atomics.load(view, 3),
+ control[0],
+ 'Atomics.load(view, 3) returns the value of `control[0]` (123456789n)'
+ );
+
+ testWithAtomicsInBoundsIndices(function(IdxGen) {
+ let Idx = IdxGen(view);
+ view.fill(0n);
+ Atomics.store(view, Idx, 37n);
+ assert.sameValue(Atomics.load(view, Idx), 37n, 'Atomics.load(view, Idx) returns 37n');
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Atomics/load/bigint/non-shared-bufferdata.js b/js/src/tests/test262/built-ins/Atomics/load/bigint/non-shared-bufferdata.js
new file mode 100644
index 0000000000..74d61a6988
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Atomics/load/bigint/non-shared-bufferdata.js
@@ -0,0 +1,17 @@
+// |reftest| skip-if(!this.hasOwnProperty('Atomics')) -- Atomics is not enabled unconditionally
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-atomics.load
+description: >
+ Atomics.load will operate on TA when TA.buffer is not a SharedArrayBuffer
+includes: [testBigIntTypedArray.js]
+features: [ArrayBuffer, Atomics, BigInt, TypedArray]
+---*/
+testWithBigIntTypedArrayConstructors(TA => {
+ const buffer = new ArrayBuffer(TA.BYTES_PER_ELEMENT * 4);
+ const view = new TA(buffer);
+ assert.sameValue(Atomics.load(view, 0), 0n, 'Atomics.load(view, 0) returns 0n');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Atomics/load/bigint/shell.js b/js/src/tests/test262/built-ins/Atomics/load/bigint/shell.js
new file mode 100644
index 0000000000..90ee9c114d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Atomics/load/bigint/shell.js
@@ -0,0 +1,42 @@
+// GENERATED, DO NOT EDIT
+// file: testBigIntTypedArray.js
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: |
+ Collection of functions used to assert the correctness of BigInt TypedArray objects.
+defines:
+ - TypedArray
+ - testWithBigIntTypedArrayConstructors
+---*/
+
+/**
+ * The %TypedArray% intrinsic constructor function.
+ */
+var TypedArray = Object.getPrototypeOf(Int8Array);
+
+/**
+ * Calls the provided function for every typed array constructor.
+ *
+ * @param {typedArrayConstructorCallback} f - the function to call for each typed array constructor.
+ * @param {Array} selected - An optional Array with filtered typed arrays
+ */
+function testWithBigIntTypedArrayConstructors(f, selected) {
+ /**
+ * Array containing every BigInt typed array constructor.
+ */
+ var constructors = selected || [
+ BigInt64Array,
+ BigUint64Array
+ ];
+
+ for (var i = 0; i < constructors.length; ++i) {
+ var constructor = constructors[i];
+ try {
+ f(constructor);
+ } catch (e) {
+ e.message += " (Testing with " + constructor.name + ".)";
+ throw e;
+ }
+ }
+}
diff --git a/js/src/tests/test262/built-ins/Atomics/load/browser.js b/js/src/tests/test262/built-ins/Atomics/load/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Atomics/load/browser.js
diff --git a/js/src/tests/test262/built-ins/Atomics/load/descriptor.js b/js/src/tests/test262/built-ins/Atomics/load/descriptor.js
new file mode 100644
index 0000000000..d3d6899b29
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Atomics/load/descriptor.js
@@ -0,0 +1,18 @@
+// |reftest| skip-if(!this.hasOwnProperty('Atomics')) -- Atomics is not enabled unconditionally
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the license found in the LICENSE file.
+
+/*---
+esid: sec-atomics.load
+description: Testing descriptor property of Atomics.load
+includes: [propertyHelper.js]
+features: [Atomics]
+---*/
+
+verifyProperty(Atomics, 'load', {
+ enumerable: false,
+ writable: true,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Atomics/load/expected-return-value.js b/js/src/tests/test262/built-ins/Atomics/load/expected-return-value.js
new file mode 100644
index 0000000000..bcbeb5b99d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Atomics/load/expected-return-value.js
@@ -0,0 +1,48 @@
+// |reftest| skip-if(!this.hasOwnProperty('Atomics')||!this.hasOwnProperty('SharedArrayBuffer')||(this.hasOwnProperty('getBuildConfiguration')&&getBuildConfiguration('arm64-simulator'))) -- Atomics,SharedArrayBuffer is not enabled unconditionally, ARM64 Simulator cannot emulate atomics
+// Copyright (C) 2018 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-atomics.load
+description: >
+ Atomics.load returns the value that existed at the
+ index prior to the operation.
+info: |
+ Atomics.load( typedArray, index, value )
+
+ 1. Return ? AtomicLoad(typedArray, index).
+
+ AtomicLoad( typedArray, index )
+
+ 1. Let buffer be ? ValidateSharedIntegerTypedArray(typedArray).
+ 2. Let i be ? ValidateAtomicAccess(typedArray, index).
+ 3. Let arrayTypeName be typedArray.[[TypedArrayName]].
+ 4. Let elementSize be the Number value of the Element Size value
+ specified in Table 56 for arrayTypeName.
+ 5. Let elementType be the String value of the Element Type value
+ in Table 56 for arrayTypeName.
+ 6. Let offset be typedArray.[[ByteOffset]].
+ 7. Let indexedPosition be (i × elementSize) + offset.
+ 8. Return GetValueFromBuffer(buffer, indexedPosition, elementType,
+ true, "SeqCst").
+
+features: [Atomics, SharedArrayBuffer, TypedArray]
+---*/
+
+const i32a = new Int32Array(
+ new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
+);
+const update = 0b00000001000000001000000010000001;
+
+assert.sameValue(Atomics.load(i32a, 0), 0, 'Atomics.load(i32a, 0) returns 0');
+
+i32a[0] = update;
+
+assert.sameValue(
+ Atomics.load(i32a, 0),
+ update,
+ 'Atomics.load(i32a, 0) returns the value of `update` (0b00000001000000001000000010000001)'
+);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Atomics/load/good-views.js b/js/src/tests/test262/built-ins/Atomics/load/good-views.js
new file mode 100644
index 0000000000..6f77377428
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Atomics/load/good-views.js
@@ -0,0 +1,49 @@
+// |reftest| skip-if(!this.hasOwnProperty('Atomics')||!this.hasOwnProperty('SharedArrayBuffer')||(this.hasOwnProperty('getBuildConfiguration')&&getBuildConfiguration('arm64-simulator'))) -- Atomics,SharedArrayBuffer is not enabled unconditionally, ARM64 Simulator cannot emulate atomics
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-atomics.load
+description: Test Atomics.load on arrays that allow atomic operations.
+includes: [testAtomics.js, testTypedArray.js]
+features: [ArrayBuffer, Atomics, DataView, SharedArrayBuffer, Symbol, TypedArray]
+---*/
+
+const sab = new SharedArrayBuffer(1024);
+const ab = new ArrayBuffer(16);
+
+const views = nonClampedIntArrayConstructors.slice();
+
+testWithTypedArrayConstructors(function(TA) {
+ // Make it interesting - use non-zero byteOffsets and non-zero indexes.
+
+ const view = new TA(sab, 32, 20);
+ const control = new TA(ab, 0, 2);
+
+ view[3] = -5;
+ control[0] = -5;
+ assert.sameValue(Atomics.load(view, 3), control[0],
+ 'Atomics.load(view, 3) returns the value of `control[0]` (-5)');
+
+ control[0] = 12345;
+ view[3] = 12345;
+ assert.sameValue(Atomics.load(view, 3), control[0],
+ 'Atomics.load(view, 3) returns the value of `control[0]` (12345)');
+
+ control[0] = 123456789;
+ view[3] = 123456789;
+ assert.sameValue(Atomics.load(view, 3), control[0],
+ 'Atomics.load(view, 3) returns the value of `control[0]` (123456789)');
+
+ // In-bounds boundary cases for indexing
+ testWithAtomicsInBoundsIndices(function(IdxGen) {
+ let Idx = IdxGen(view);
+ view.fill(0);
+ // 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.load(view, Idx), 37, 'Atomics.load(view, Idx) returns 37');
+ });
+}, views);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Atomics/load/length.js b/js/src/tests/test262/built-ins/Atomics/load/length.js
new file mode 100644
index 0000000000..20ca0c90f6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Atomics/load/length.js
@@ -0,0 +1,35 @@
+// |reftest| skip-if(!this.hasOwnProperty('Atomics')) -- Atomics is not enabled unconditionally
+// Copyright (C) 2015 André Bargull. 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.load
+description: >
+ Atomics.load.length is 2.
+info: |
+ Atomics.load ( ia, index )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, has a length
+ property whose value is an integer. Unless otherwise specified, this
+ value is equal to the largest number of named arguments shown in the
+ subclause headings for the function description, including optional
+ parameters. However, rest parameters shown using the form “...name”
+ are not included in the default argument count.
+
+ Unless otherwise specified, the length property of a built-in Function
+ object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js]
+features: [Atomics]
+---*/
+
+verifyProperty(Atomics.load, 'length', {
+ value: 2,
+ enumerable: false,
+ writable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Atomics/load/name.js b/js/src/tests/test262/built-ins/Atomics/load/name.js
new file mode 100644
index 0000000000..3b78cfe95b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Atomics/load/name.js
@@ -0,0 +1,21 @@
+// |reftest| skip-if(!this.hasOwnProperty('Atomics')) -- Atomics is not enabled unconditionally
+// Copyright (C) 2015 André Bargull. 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.load
+description: >
+ Atomics.load.name is "load".
+includes: [propertyHelper.js]
+features: [Atomics]
+---*/
+
+verifyProperty(Atomics.load, 'name', {
+ value: 'load',
+ enumerable: false,
+ writable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Atomics/load/non-shared-bufferdata.js b/js/src/tests/test262/built-ins/Atomics/load/non-shared-bufferdata.js
new file mode 100644
index 0000000000..73ae85260c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Atomics/load/non-shared-bufferdata.js
@@ -0,0 +1,20 @@
+// |reftest| skip-if(!this.hasOwnProperty('Atomics')) -- Atomics is not enabled unconditionally
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-atomics.load
+description: >
+ Atomics.load will operate on TA when TA.buffer is not a SharedArrayBuffer
+includes: [testTypedArray.js]
+features: [ArrayBuffer, Atomics, TypedArray]
+---*/
+testWithAtomicsFriendlyTypedArrayConstructors(TA => {
+ const view = new TA(
+ new ArrayBuffer(TA.BYTES_PER_ELEMENT * 4)
+ );
+
+ assert.sameValue(Atomics.load(view, 0), 0, 'Atomics.load(view, 0) returns 0');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Atomics/load/non-shared-int-views-throws.js b/js/src/tests/test262/built-ins/Atomics/load/non-shared-int-views-throws.js
new file mode 100644
index 0000000000..a8bb46083c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Atomics/load/non-shared-int-views-throws.js
@@ -0,0 +1,20 @@
+// |reftest| skip-if(!this.hasOwnProperty('Atomics')) -- Atomics is not enabled unconditionally
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-atomics.load
+description: >
+ Atomics.load throws when operating on non-sharable integer TypedArrays
+includes: [testTypedArray.js]
+features: [ArrayBuffer, Atomics, TypedArray]
+---*/
+testWithNonAtomicsFriendlyTypedArrayConstructors(TA => {
+ const buffer = new ArrayBuffer(TA.BYTES_PER_ELEMENT * 4);
+ const view = new TA(buffer);
+ assert.throws(TypeError, function() {
+ Atomics.load(view, 0);
+ }, `Atomics.load(new ${TA.name}(buffer), 0) throws TypeError`);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Atomics/load/non-views.js b/js/src/tests/test262/built-ins/Atomics/load/non-views.js
new file mode 100644
index 0000000000..a88dc89ee8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Atomics/load/non-views.js
@@ -0,0 +1,19 @@
+// |reftest| skip-if(!this.hasOwnProperty('Atomics')||!this.hasOwnProperty('SharedArrayBuffer')||(this.hasOwnProperty('getBuildConfiguration')&&getBuildConfiguration('arm64-simulator'))) -- Atomics,SharedArrayBuffer is not enabled unconditionally, ARM64 Simulator cannot emulate atomics
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-atomics.load
+description: >
+ Test Atomics.load on view values other than TypedArrays
+includes: [testAtomics.js]
+features: [ArrayBuffer, Atomics, DataView, SharedArrayBuffer, Symbol, TypedArray]
+---*/
+
+testWithAtomicsNonViewValues(function(view) {
+ assert.throws(TypeError, function() {
+ Atomics.load(view, 0);
+ }, '`Atomics.load(view, 0)` throws TypeError');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Atomics/load/not-a-constructor.js b/js/src/tests/test262/built-ins/Atomics/load/not-a-constructor.js
new file mode 100644
index 0000000000..270660c5cf
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Atomics/load/not-a-constructor.js
@@ -0,0 +1,32 @@
+// |reftest| skip-if(!this.hasOwnProperty('Atomics')||!this.hasOwnProperty('SharedArrayBuffer')||(this.hasOwnProperty('getBuildConfiguration')&&getBuildConfiguration('arm64-simulator'))) -- Atomics,SharedArrayBuffer is not enabled unconditionally, ARM64 Simulator cannot emulate atomics
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-standard-built-in-objects
+description: >
+ Atomics.load does not implement [[Construct]], is not new-able
+info: |
+ ECMAScript Function Objects
+
+ Built-in function objects that are not identified as constructors do not
+ implement the [[Construct]] internal method unless otherwise specified in
+ the description of a particular function.
+
+ sec-evaluatenew
+
+ ...
+ 7. If IsConstructor(constructor) is false, throw a TypeError exception.
+ ...
+includes: [isConstructor.js]
+features: [Reflect.construct, Atomics, arrow-function, TypedArray, SharedArrayBuffer]
+---*/
+
+assert.sameValue(isConstructor(Atomics.load), false, 'isConstructor(Atomics.load) must return false');
+
+assert.throws(TypeError, () => {
+ new Atomics.load(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT)));
+}, '`new Atomics.load(new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT)))` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/Atomics/load/shell.js b/js/src/tests/test262/built-ins/Atomics/load/shell.js
new file mode 100644
index 0000000000..eda1477282
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Atomics/load/shell.js
@@ -0,0 +1,24 @@
+// GENERATED, DO NOT EDIT
+// file: isConstructor.js
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: |
+ Test if a given function is a constructor function.
+defines: [isConstructor]
+features: [Reflect.construct]
+---*/
+
+function isConstructor(f) {
+ if (typeof f !== "function") {
+ throw new Test262Error("isConstructor invoked with a non-function value");
+ }
+
+ try {
+ Reflect.construct(function(){}, [], f);
+ } catch (e) {
+ return false;
+ }
+ return true;
+}
diff --git a/js/src/tests/test262/built-ins/Atomics/load/validate-arraytype-before-index-coercion.js b/js/src/tests/test262/built-ins/Atomics/load/validate-arraytype-before-index-coercion.js
new file mode 100644
index 0000000000..70ef58f258
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Atomics/load/validate-arraytype-before-index-coercion.js
@@ -0,0 +1,43 @@
+// |reftest| skip-if(!this.hasOwnProperty('Atomics')) -- Atomics is not enabled unconditionally
+// Copyright (C) 2019 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-atomics.store
+description: >
+ TypedArray type is validated before `index` argument is coerced.
+info: |
+ 24.4.7 Atomics.load ( typedArray, index )
+ 1. Return ? AtomicLoad(typedArray, index).
+
+ 24.4.1.12 AtomicLoad ( typedArray, index )
+ 1. Let buffer be ? ValidateSharedIntegerTypedArray(typedArray).
+ ...
+
+ 24.4.1.1 ValidateSharedIntegerTypedArray ( typedArray [ , onlyInt32 ] )
+ ...
+ 4. Let typeName be typedArray.[[TypedArrayName]].
+ 5. If onlyInt32 is true, then
+ a. If typeName is not "Int32Array", throw a TypeError exception.
+ 6. Else,
+ a. If typeName is not "Int8Array", "Uint8Array", "Int16Array", "Uint16Array", "Int32Array",
+ or "Uint32Array", throw a TypeError exception.
+ ...
+includes: [testTypedArray.js]
+features: [Atomics, TypedArray]
+---*/
+
+var index = {
+ valueOf() {
+ throw new Test262Error("index coerced");
+ }
+};
+
+for (var badArrayType of nonAtomicsFriendlyTypedArrayConstructors) {
+ var typedArray = new badArrayType(new SharedArrayBuffer(8));
+ assert.throws(TypeError, function() {
+ Atomics.load(typedArray, index);
+ });
+}
+
+reportCompare(0, 0);