summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint')
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/bufferbyteoffset-throws-from-modulo-element-size-sab.js36
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/bufferbyteoffset-throws-from-modulo-element-size.js34
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-is-negative-throws-sab.js35
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-is-negative-throws.js33
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-is-negative-zero-sab.js26
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-is-negative-zero.js25
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-is-symbol-throws-sab.js32
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-is-symbol-throws.js30
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-throws-from-modulo-element-size-sab.js31
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-throws-from-modulo-element-size.js29
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-to-number-detachbuffer.js23
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-to-number-throws-sab.js36
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-to-number-throws.js34
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/custom-proto-access-throws-sab.js51
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/custom-proto-access-throws.js49
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/defined-length-and-offset-sab.js36
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/defined-length-and-offset.js34
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/defined-length-sab.js38
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/defined-length.js36
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/defined-negative-length-sab.js32
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/defined-negative-length.js30
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/defined-offset-sab.js36
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/defined-offset.js34
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/detachedbuffer.js23
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/excessive-length-throws-sab.js35
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/excessive-length-throws.js33
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/excessive-offset-throws-sab.js39
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/excessive-offset-throws.js37
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/invoked-with-undefined-newtarget-sab.js30
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/invoked-with-undefined-newtarget.js28
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/is-referenced-sab.js36
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/is-referenced.js34
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/length-access-throws-sab.js37
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/length-access-throws.js35
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/length-is-symbol-throws-sab.js33
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/length-is-symbol-throws.js31
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/length-to-number-detachbuffer.js23
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/new-instance-extensibility-sab.js41
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/new-instance-extensibility.js39
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/proto-from-ctor-realm-sab.js41
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/proto-from-ctor-realm.js39
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/returns-new-instance-sab.js37
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/returns-new-instance.js35
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/shell.js60
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/toindex-bytelength-sab.js76
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/toindex-bytelength.js74
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/toindex-byteoffset-sab.js90
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/toindex-byteoffset.js88
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/typedarray-backed-by-sharedarraybuffer.js28
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/use-custom-proto-if-object-sab.js52
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/use-custom-proto-if-object.js50
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/use-default-proto-if-custom-proto-is-not-object-sab.js51
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/use-default-proto-if-custom-proto-is-not-object.js49
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/custom-proto-access-throws.js45
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/init-zeros.js57
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/is-infinity-throws-rangeerror.js29
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/is-negative-integer-throws-rangeerror.js39
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/is-symbol-throws.js28
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/new-instance-extensibility.js40
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/proto-from-ctor-realm.js38
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/returns-object.js35
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/shell.js42
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/toindex-length.js55
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/undefined-newtarget-throws.js30
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/use-custom-proto-if-object.js46
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/use-default-proto-if-custom-proto-is-not-object.js45
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/no-args/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/no-args/custom-proto-access-throws.js45
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/no-args/new-instance-extensibility.js40
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/no-args/proto-from-ctor-realm.js38
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/no-args/returns-object.js34
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/no-args/shell.js42
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/no-args/undefined-newtarget-throws.js25
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/no-args/use-custom-proto-if-object.js46
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/no-args/use-default-proto-if-custom-proto-is-not-object.js45
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/as-array-returns.js28
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/as-generator-iterable-returns.js32
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/bigint-tobigint64.js106
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/bigint-tobiguint64.js106
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/boolean-tobigint.js64
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/custom-proto-access-throws.js50
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/iterating-throws.js33
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/iterator-not-callable-throws.js41
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/iterator-throws.js36
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/length-excessive-throws.js32
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/length-is-symbol-throws.js32
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/length-throws.js36
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/new-instance-extensibility.js45
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/null-tobigint.js65
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/number-tobigint.js93
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/proto-from-ctor-realm.js39
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/shell.js42
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/string-nan-tobigint.js72
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/string-tobigint.js88
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/symbol-tobigint.js71
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-from-property.js42
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-to-primitive-typeerror.js88
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-to-primitive.js86
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-tostring.js99
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-valueof-typeerror.js100
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-valueof.js93
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-property.js42
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-symbol-property.js36
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/undefined-newtarget-throws.js32
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/undefined-tobigint.js65
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/use-custom-proto-if-object.js49
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/use-default-proto-if-custom-proto-is-not-object.js49
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/custom-proto-access-throws.js49
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/new-instance-extensibility.js48
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/other-ctor-buffer-ctor-species-null.js46
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/other-ctor-buffer-ctor-species-undefined.js45
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/other-ctor-returns-new-typedarray.js30
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/proto-from-ctor-realm.js39
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/same-ctor-buffer-ctor-species-null.js51
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/same-ctor-buffer-ctor-species-undefined.js51
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/same-ctor-returns-new-cloned-typedarray.js34
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/shell.js166
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/src-typedarray-not-big-throws.js38
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/undefined-newtarget-throws.js29
125 files changed, 5446 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/browser.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/browser.js
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/browser.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/browser.js
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/bufferbyteoffset-throws-from-modulo-element-size-sab.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/bufferbyteoffset-throws-from-modulo-element-size-sab.js
new file mode 100644
index 0000000000..17a67c109c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/bufferbyteoffset-throws-from-modulo-element-size-sab.js
@@ -0,0 +1,36 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2016 the V8 project authors. 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-typedarray-buffer-byteoffset-length
+description: >
+ Throws a RangeError if bufferByteLength modulo elementSize ≠ 0
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+
+ ...
+ 13. If length is undefined, then
+ a. If bufferByteLength modulo elementSize ≠ 0, throw a RangeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, SharedArrayBuffer, TypedArray]
+---*/
+
+var buffer = new SharedArrayBuffer(1);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert.throws(RangeError, function() {
+ new TA(buffer);
+ });
+
+ assert.throws(RangeError, function() {
+ new TA(buffer, 0, undefined);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/bufferbyteoffset-throws-from-modulo-element-size.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/bufferbyteoffset-throws-from-modulo-element-size.js
new file mode 100644
index 0000000000..4fd2fe7557
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/bufferbyteoffset-throws-from-modulo-element-size.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-buffer-byteoffset-length
+description: >
+ Throws a RangeError if bufferByteLength modulo elementSize ≠ 0
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+
+ ...
+ 13. If length is undefined, then
+ a. If bufferByteLength modulo elementSize ≠ 0, throw a RangeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var buffer = new ArrayBuffer(1);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert.throws(RangeError, function() {
+ new TA(buffer);
+ });
+
+ assert.throws(RangeError, function() {
+ new TA(buffer, 0, undefined);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-is-negative-throws-sab.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-is-negative-throws-sab.js
new file mode 100644
index 0000000000..8de2a88295
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-is-negative-throws-sab.js
@@ -0,0 +1,35 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2016 the V8 project authors. 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-typedarray-buffer-byteoffset-length
+description: >
+ Throws a RangeError if ToInteger(byteOffset) is < 0
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+
+ ...
+ 7. Let offset be ? ToInteger(byteOffset).
+ 8. If offset < 0, throw a RangeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, SharedArrayBuffer, TypedArray]
+---*/
+
+var buffer = new SharedArrayBuffer(8);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert.throws(RangeError, function() {
+ new TA(buffer, -1);
+ });
+ assert.throws(RangeError, function() {
+ new TA(buffer, -Infinity);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-is-negative-throws.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-is-negative-throws.js
new file mode 100644
index 0000000000..17c490f7d5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-is-negative-throws.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-buffer-byteoffset-length
+description: >
+ Throws a RangeError if ToInteger(byteOffset) is < 0
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+
+ ...
+ 7. Let offset be ? ToInteger(byteOffset).
+ 8. If offset < 0, throw a RangeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var buffer = new ArrayBuffer(8);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert.throws(RangeError, function() {
+ new TA(buffer, -1);
+ });
+ assert.throws(RangeError, function() {
+ new TA(buffer, -Infinity);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-is-negative-zero-sab.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-is-negative-zero-sab.js
new file mode 100644
index 0000000000..067562add9
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-is-negative-zero-sab.js
@@ -0,0 +1,26 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: pending
+description: >
+ TypedArray's [[ByteOffset]] internal slot is always a positive number, test with negative zero.
+info: |
+ %TypedArray% ( buffer [ , byteOffset [ , length ] ] )
+
+ ...
+ 6. Let offset be ? ToInteger(byteOffset).
+ 7. If offset < 0, throw a RangeError exception.
+ 8. If offset is -0, let offset be +0.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, SharedArrayBuffer, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TAConstructor) {
+ var typedArray = new TAConstructor(new SharedArrayBuffer(8), -0);
+ assert.sameValue(typedArray.byteOffset, +0);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-is-negative-zero.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-is-negative-zero.js
new file mode 100644
index 0000000000..e67b124ab2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-is-negative-zero.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: pending
+description: >
+ TypedArray's [[ByteOffset]] internal slot is always a positive number, test with negative zero.
+info: |
+ %TypedArray% ( buffer [ , byteOffset [ , length ] ] )
+
+ ...
+ 6. Let offset be ? ToInteger(byteOffset).
+ 7. If offset < 0, throw a RangeError exception.
+ 8. If offset is -0, let offset be +0.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TAConstructor) {
+ var typedArray = new TAConstructor(new ArrayBuffer(8), -0);
+ assert.sameValue(typedArray.byteOffset, +0);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-is-symbol-throws-sab.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-is-symbol-throws-sab.js
new file mode 100644
index 0000000000..ad2a67f321
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-is-symbol-throws-sab.js
@@ -0,0 +1,32 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2016 the V8 project authors. 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-typedarray-buffer-byteoffset-length
+description: >
+ Return abrupt from parsing integer value from byteOffset as a symbol
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+
+ ...
+ 7. Let offset be ? ToInteger(byteOffset).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, SharedArrayBuffer, TypedArray]
+---*/
+
+var byteOffset = Symbol("1");
+var buffer = new SharedArrayBuffer(8);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert.throws(TypeError, function() {
+ new TA(buffer, byteOffset);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-is-symbol-throws.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-is-symbol-throws.js
new file mode 100644
index 0000000000..020fe02256
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-is-symbol-throws.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-buffer-byteoffset-length
+description: >
+ Return abrupt from parsing integer value from byteOffset as a symbol
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+
+ ...
+ 7. Let offset be ? ToInteger(byteOffset).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var byteOffset = Symbol("1");
+var buffer = new ArrayBuffer(8);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert.throws(TypeError, function() {
+ new TA(buffer, byteOffset);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-throws-from-modulo-element-size-sab.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-throws-from-modulo-element-size-sab.js
new file mode 100644
index 0000000000..af8fee1332
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-throws-from-modulo-element-size-sab.js
@@ -0,0 +1,31 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2016 the V8 project authors. 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-typedarray-buffer-byteoffset-length
+description: >
+ Throws a RangeError if ToInteger(byteOffset) modulo elementSize is not 0
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+
+ ...
+ 10. If offset modulo elementSize ≠ 0, throw a RangeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, SharedArrayBuffer, TypedArray]
+---*/
+
+var buffer = new SharedArrayBuffer(8);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert.throws(RangeError, function() {
+ new TA(buffer, 7);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-throws-from-modulo-element-size.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-throws-from-modulo-element-size.js
new file mode 100644
index 0000000000..7a06d2d90e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-throws-from-modulo-element-size.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-buffer-byteoffset-length
+description: >
+ Throws a RangeError if ToInteger(byteOffset) modulo elementSize is not 0
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+
+ ...
+ 10. If offset modulo elementSize ≠ 0, throw a RangeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var buffer = new ArrayBuffer(8);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert.throws(RangeError, function() {
+ new TA(buffer, 7);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-to-number-detachbuffer.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-to-number-detachbuffer.js
new file mode 100644
index 0000000000..f7ed2b83f4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-to-number-detachbuffer.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2017 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-buffer-byteoffset-length
+description: If TypedArray() is passed a detached buffer, throw
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ ...
+ 9. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var offset = TA.BYTES_PER_ELEMENT;
+ var buffer = new ArrayBuffer(3 * offset);
+ var byteOffset = { valueOf() { $DETACHBUFFER(buffer); return offset; } };
+ assert.throws(TypeError, () => new TA(buffer, byteOffset));
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-to-number-throws-sab.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-to-number-throws-sab.js
new file mode 100644
index 0000000000..cb1f36aa18
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-to-number-throws-sab.js
@@ -0,0 +1,36 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2016 the V8 project authors. 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-typedarray-buffer-byteoffset-length
+description: >
+ Return abrupt from parsing integer value from byteOffset
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+
+ ...
+ 7. Let offset be ? ToInteger(byteOffset).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, SharedArrayBuffer, TypedArray]
+---*/
+
+var buffer = new SharedArrayBuffer(8);
+var byteOffset = {
+ valueOf: function() {
+ throw new Test262Error();
+ }
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert.throws(Test262Error, function() {
+ new TA(buffer, byteOffset);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-to-number-throws.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-to-number-throws.js
new file mode 100644
index 0000000000..4506ef7091
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-to-number-throws.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-buffer-byteoffset-length
+description: >
+ Return abrupt from parsing integer value from byteOffset
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+
+ ...
+ 7. Let offset be ? ToInteger(byteOffset).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var buffer = new ArrayBuffer(8);
+var byteOffset = {
+ valueOf: function() {
+ throw new Test262Error();
+ }
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert.throws(Test262Error, function() {
+ new TA(buffer, byteOffset);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/custom-proto-access-throws-sab.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/custom-proto-access-throws-sab.js
new file mode 100644
index 0000000000..6e5409b30a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/custom-proto-access-throws-sab.js
@@ -0,0 +1,51 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2016 the V8 project authors. 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-typedarray-buffer-byteoffset-length
+description: >
+ Return abrupt completion getting newTarget's prototype
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+
+ ...
+ 4. Let O be ? AllocateTypedArray(constructorName, NewTarget,
+ %TypedArrayPrototype%).
+ ...
+
+ 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget,
+ defaultProto [ , length ])
+
+ 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto).
+ ...
+
+ 9.1.15 GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto )
+
+ ...
+ 3. Let proto be ? Get(constructor, "prototype").
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Reflect, SharedArrayBuffer, TypedArray]
+---*/
+
+var buffer = new SharedArrayBuffer(8);
+
+var newTarget = function() {}.bind(null);
+Object.defineProperty(newTarget, "prototype", {
+ get() {
+ throw new Test262Error();
+ }
+});
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert.throws(Test262Error, function() {
+ Reflect.construct(TA, [buffer], newTarget);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/custom-proto-access-throws.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/custom-proto-access-throws.js
new file mode 100644
index 0000000000..108824e778
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/custom-proto-access-throws.js
@@ -0,0 +1,49 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-buffer-byteoffset-length
+description: >
+ Return abrupt completion getting newTarget's prototype
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+
+ ...
+ 4. Let O be ? AllocateTypedArray(constructorName, NewTarget,
+ %TypedArrayPrototype%).
+ ...
+
+ 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget,
+ defaultProto [ , length ])
+
+ 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto).
+ ...
+
+ 9.1.15 GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto )
+
+ ...
+ 3. Let proto be ? Get(constructor, "prototype").
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Reflect, TypedArray]
+---*/
+
+var buffer = new ArrayBuffer(8);
+
+var newTarget = function() {}.bind(null);
+Object.defineProperty(newTarget, "prototype", {
+ get() {
+ throw new Test262Error();
+ }
+});
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert.throws(Test262Error, function() {
+ Reflect.construct(TA, [buffer], newTarget);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/defined-length-and-offset-sab.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/defined-length-and-offset-sab.js
new file mode 100644
index 0000000000..48548d742f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/defined-length-and-offset-sab.js
@@ -0,0 +1,36 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2016 the V8 project authors. 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-typedarray-buffer-byteoffset-length
+description: >
+ Return new typedArray from defined length and offset
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, SharedArrayBuffer, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var offset = TA.BYTES_PER_ELEMENT;
+ var buffer = new SharedArrayBuffer(3 * offset);
+
+ var ta1 = new TA(buffer, offset, 2);
+ assert.sameValue(ta1.length, 2, "ta1.length");
+ assert.sameValue(ta1.buffer, buffer, "ta1.buffer");
+ assert.sameValue(ta1.constructor, TA);
+ assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype);
+
+ var ta2 = new TA(buffer, offset, 0);
+ assert.sameValue(ta2.length, 0, "ta2.length");
+ assert.sameValue(ta2.buffer, buffer, "ta2.buffer");
+ assert.sameValue(ta2.constructor, TA);
+ assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/defined-length-and-offset.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/defined-length-and-offset.js
new file mode 100644
index 0000000000..2805a58bae
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/defined-length-and-offset.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-buffer-byteoffset-length
+description: >
+ Return new typedArray from defined length and offset
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var offset = TA.BYTES_PER_ELEMENT;
+ var buffer = new ArrayBuffer(3 * offset);
+
+ var ta1 = new TA(buffer, offset, 2);
+ assert.sameValue(ta1.length, 2, "ta1.length");
+ assert.sameValue(ta1.buffer, buffer, "ta1.buffer");
+ assert.sameValue(ta1.constructor, TA);
+ assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype);
+
+ var ta2 = new TA(buffer, offset, 0);
+ assert.sameValue(ta2.length, 0, "ta2.length");
+ assert.sameValue(ta2.buffer, buffer, "ta2.buffer");
+ assert.sameValue(ta2.constructor, TA);
+ assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/defined-length-sab.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/defined-length-sab.js
new file mode 100644
index 0000000000..b96e70672d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/defined-length-sab.js
@@ -0,0 +1,38 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2016 the V8 project authors. 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-typedarray-buffer-byteoffset-length
+description: >
+ Return new typedArray from defined length
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+
+includes: [testBigIntTypedArray.js]
+features: [BigInt, SharedArrayBuffer, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var bpe = TA.BYTES_PER_ELEMENT;
+ var length = 4;
+ var buffer = new SharedArrayBuffer(bpe * length * 4);
+
+ var ta1 = new TA(buffer, 0, length);
+ assert.sameValue(ta1.length, length);
+ assert.sameValue(ta1.buffer, buffer);
+ assert.sameValue(ta1.constructor, TA);
+ assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype);
+
+ var ta2 = new TA(buffer, 0, 0);
+ assert.sameValue(ta2.length, 0);
+ assert.sameValue(ta2.buffer, buffer);
+ assert.sameValue(ta2.constructor, TA);
+ assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/defined-length.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/defined-length.js
new file mode 100644
index 0000000000..67ea4cacef
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/defined-length.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-buffer-byteoffset-length
+description: >
+ Return new typedArray from defined length
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var bpe = TA.BYTES_PER_ELEMENT;
+ var length = 4;
+ var buffer = new ArrayBuffer(bpe * length * 4);
+
+ var ta1 = new TA(buffer, 0, length);
+ assert.sameValue(ta1.length, length);
+ assert.sameValue(ta1.buffer, buffer);
+ assert.sameValue(ta1.constructor, TA);
+ assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype);
+
+ var ta2 = new TA(buffer, 0, 0);
+ assert.sameValue(ta2.length, 0);
+ assert.sameValue(ta2.buffer, buffer);
+ assert.sameValue(ta2.constructor, TA);
+ assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/defined-negative-length-sab.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/defined-negative-length-sab.js
new file mode 100644
index 0000000000..8af91702b4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/defined-negative-length-sab.js
@@ -0,0 +1,32 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2016 the V8 project authors. 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-typedarray-buffer-byteoffset-length
+description: >
+ Throws RangeError for negative ToInteger(length)
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+
+includes: [testBigIntTypedArray.js]
+features: [BigInt, SharedArrayBuffer, TypedArray]
+---*/
+
+var buffer = new SharedArrayBuffer(16);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert.throws(RangeError, function() {
+ new TA(buffer, 0, -1);
+ });
+
+ assert.throws(RangeError, function() {
+ new TA(buffer, 0, -Infinity);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/defined-negative-length.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/defined-negative-length.js
new file mode 100644
index 0000000000..9132a9611f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/defined-negative-length.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-buffer-byteoffset-length
+description: >
+ Throws RangeError for negative ToInteger(length)
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var buffer = new ArrayBuffer(16);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert.throws(RangeError, function() {
+ new TA(buffer, 0, -1);
+ });
+
+ assert.throws(RangeError, function() {
+ new TA(buffer, 0, -Infinity);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/defined-offset-sab.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/defined-offset-sab.js
new file mode 100644
index 0000000000..08b4ee8c7b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/defined-offset-sab.js
@@ -0,0 +1,36 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2016 the V8 project authors. 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-typedarray-buffer-byteoffset-length
+description: >
+ Return new typedArray from defined offset
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, SharedArrayBuffer, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var bpe = TA.BYTES_PER_ELEMENT;
+ var buffer = new SharedArrayBuffer(bpe * 4);
+
+ var ta1 = new TA(buffer, bpe * 2);
+ assert.sameValue(ta1.length, 2);
+ assert.sameValue(ta1.buffer, buffer);
+ assert.sameValue(ta1.constructor, TA);
+ assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype);
+
+ var ta2 = new TA(buffer, 0);
+ assert.sameValue(ta2.length, 4);
+ assert.sameValue(ta2.buffer, buffer);
+ assert.sameValue(ta2.constructor, TA);
+ assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/defined-offset.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/defined-offset.js
new file mode 100644
index 0000000000..883f17b91f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/defined-offset.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-buffer-byteoffset-length
+description: >
+ Return new typedArray from defined offset
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var bpe = TA.BYTES_PER_ELEMENT;
+ var buffer = new ArrayBuffer(bpe * 4);
+
+ var ta1 = new TA(buffer, bpe * 2);
+ assert.sameValue(ta1.length, 2);
+ assert.sameValue(ta1.buffer, buffer);
+ assert.sameValue(ta1.constructor, TA);
+ assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype);
+
+ var ta2 = new TA(buffer, 0);
+ assert.sameValue(ta2.length, 4);
+ assert.sameValue(ta2.buffer, buffer);
+ assert.sameValue(ta2.constructor, TA);
+ assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/detachedbuffer.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/detachedbuffer.js
new file mode 100644
index 0000000000..c9137f8f25
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/detachedbuffer.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2017 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-buffer-byteoffset-length
+description: If TypedArray() is passed a detached buffer, throw
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ ...
+ 9. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var offset = TA.BYTES_PER_ELEMENT;
+ var buffer = new ArrayBuffer(3 * offset);
+ $DETACHBUFFER(buffer);
+ assert.throws(TypeError, () => new TA(buffer));
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/excessive-length-throws-sab.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/excessive-length-throws-sab.js
new file mode 100644
index 0000000000..d79be12adf
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/excessive-length-throws-sab.js
@@ -0,0 +1,35 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2016 the V8 project authors. 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-typedarray-buffer-byteoffset-length
+description: >
+ If offset + newByteLength > bufferByteLength, throw a RangeError exception.
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+
+ ...
+ 14. Else,
+ a. Let newLength be ? ToLength(length).
+ b. Let newByteLength be newLength × elementSize.
+ c. If offset+newByteLength > bufferByteLength, throw a RangeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, SharedArrayBuffer, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var bpe = TA.BYTES_PER_ELEMENT;
+ var buffer = new SharedArrayBuffer(bpe);
+
+ assert.throws(RangeError, function() {
+ new TA(buffer, 0, bpe * 2);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/excessive-length-throws.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/excessive-length-throws.js
new file mode 100644
index 0000000000..c617926519
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/excessive-length-throws.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-buffer-byteoffset-length
+description: >
+ If offset + newByteLength > bufferByteLength, throw a RangeError exception.
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+
+ ...
+ 14. Else,
+ a. Let newLength be ? ToLength(length).
+ b. Let newByteLength be newLength × elementSize.
+ c. If offset+newByteLength > bufferByteLength, throw a RangeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var bpe = TA.BYTES_PER_ELEMENT;
+ var buffer = new ArrayBuffer(bpe);
+
+ assert.throws(RangeError, function() {
+ new TA(buffer, 0, bpe * 2);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/excessive-offset-throws-sab.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/excessive-offset-throws-sab.js
new file mode 100644
index 0000000000..7eeb93fcea
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/excessive-offset-throws-sab.js
@@ -0,0 +1,39 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2016 the V8 project authors. 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-typedarray-buffer-byteoffset-length
+description: >
+ Throws a RangeError if bufferByteLength - ToInteger(byteOffset) < 0
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+
+ ...
+ 13. If length is undefined, then
+ a. If bufferByteLength modulo elementSize ≠ 0, throw a RangeError exception.
+ b. Let newByteLength be bufferByteLength - offset.
+ c. If newByteLength < 0, throw a RangeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, SharedArrayBuffer, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var bpe = TA.BYTES_PER_ELEMENT;
+ var buffer = new SharedArrayBuffer(bpe);
+
+ assert.throws(RangeError, function() {
+ new TA(buffer, bpe * 2);
+ });
+
+ assert.throws(RangeError, function() {
+ new TA(buffer, bpe * 2, undefined);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/excessive-offset-throws.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/excessive-offset-throws.js
new file mode 100644
index 0000000000..134c621afc
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/excessive-offset-throws.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-buffer-byteoffset-length
+description: >
+ Throws a RangeError if bufferByteLength - ToInteger(byteOffset) < 0
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+
+ ...
+ 13. If length is undefined, then
+ a. If bufferByteLength modulo elementSize ≠ 0, throw a RangeError exception.
+ b. Let newByteLength be bufferByteLength - offset.
+ c. If newByteLength < 0, throw a RangeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var bpe = TA.BYTES_PER_ELEMENT;
+ var buffer = new ArrayBuffer(bpe);
+
+ assert.throws(RangeError, function() {
+ new TA(buffer, bpe * 2);
+ });
+
+ assert.throws(RangeError, function() {
+ new TA(buffer, bpe * 2, undefined);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/invoked-with-undefined-newtarget-sab.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/invoked-with-undefined-newtarget-sab.js
new file mode 100644
index 0000000000..c531b120af
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/invoked-with-undefined-newtarget-sab.js
@@ -0,0 +1,30 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2016 the V8 project authors. 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-typedarray-buffer-byteoffset-length
+description: >
+ Throws a TypeError if NewTarget is undefined.
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+
+ ...
+ 2. If NewTarget is undefined, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, SharedArrayBuffer, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var buffer = new SharedArrayBuffer(TA.BYTES_PER_ELEMENT);
+ assert.throws(TypeError, function() {
+ TA(buffer);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/invoked-with-undefined-newtarget.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/invoked-with-undefined-newtarget.js
new file mode 100644
index 0000000000..3f4ead077e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/invoked-with-undefined-newtarget.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-buffer-byteoffset-length
+description: >
+ Throws a TypeError if NewTarget is undefined.
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+
+ ...
+ 2. If NewTarget is undefined, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var buffer = new ArrayBuffer(TA.BYTES_PER_ELEMENT);
+ assert.throws(TypeError, function() {
+ TA(buffer);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/is-referenced-sab.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/is-referenced-sab.js
new file mode 100644
index 0000000000..9d4c5fc17f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/is-referenced-sab.js
@@ -0,0 +1,36 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2016 the V8 project authors. 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-typedarray-buffer-byteoffset-length
+description: >
+ Reuse buffer argument instead of making a new clone
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+
+ ...
+ 15. Set O's [[ViewedArrayBuffer]] internal slot to buffer.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, SharedArrayBuffer, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var bpe = TA.BYTES_PER_ELEMENT;
+
+ var buffer = new SharedArrayBuffer(bpe);
+
+ var ta1 = new TA(buffer);
+ var ta2 = new TA(buffer);
+
+ assert.sameValue(ta1.buffer, buffer);
+ assert.sameValue(ta2.buffer, buffer);
+ assert.sameValue(ta1.buffer, ta2.buffer);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/is-referenced.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/is-referenced.js
new file mode 100644
index 0000000000..45428dfbe4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/is-referenced.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-buffer-byteoffset-length
+description: >
+ Reuse buffer argument instead of making a new clone
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+
+ ...
+ 15. Set O's [[ViewedArrayBuffer]] internal slot to buffer.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var bpe = TA.BYTES_PER_ELEMENT;
+
+ var buffer = new ArrayBuffer(bpe);
+
+ var ta1 = new TA(buffer);
+ var ta2 = new TA(buffer);
+
+ assert.sameValue(ta1.buffer, buffer);
+ assert.sameValue(ta2.buffer, buffer);
+ assert.sameValue(ta1.buffer, ta2.buffer);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/length-access-throws-sab.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/length-access-throws-sab.js
new file mode 100644
index 0000000000..c427ae805b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/length-access-throws-sab.js
@@ -0,0 +1,37 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2016 the V8 project authors. 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-typedarray-buffer-byteoffset-length
+description: >
+ Returns abrupt from ToLength(length)
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+
+ ...
+ 14. Else,
+ a. Let newLength be ? ToLength(length).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, SharedArrayBuffer, TypedArray]
+---*/
+
+var buffer = new SharedArrayBuffer(8);
+var len = {
+ valueOf() {
+ throw new Test262Error();
+ }
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert.throws(Test262Error, function() {
+ new TA(buffer, 0, len);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/length-access-throws.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/length-access-throws.js
new file mode 100644
index 0000000000..ce616b31b5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/length-access-throws.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-buffer-byteoffset-length
+description: >
+ Returns abrupt from ToLength(length)
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+
+ ...
+ 14. Else,
+ a. Let newLength be ? ToLength(length).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var buffer = new ArrayBuffer(8);
+var len = {
+ valueOf() {
+ throw new Test262Error();
+ }
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert.throws(Test262Error, function() {
+ new TA(buffer, 0, len);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/length-is-symbol-throws-sab.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/length-is-symbol-throws-sab.js
new file mode 100644
index 0000000000..c28a05dada
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/length-is-symbol-throws-sab.js
@@ -0,0 +1,33 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2016 the V8 project authors. 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-typedarray-buffer-byteoffset-length
+description: >
+ Throws a TypeError if length is a Symbol
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+
+ ...
+ 14. Else,
+ a. Let newLength be ? ToLength(length).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, SharedArrayBuffer, TypedArray]
+---*/
+
+var buffer = new SharedArrayBuffer(8);
+var s = Symbol("1");
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert.throws(TypeError, function() {
+ new TA(buffer, 0, s);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/length-is-symbol-throws.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/length-is-symbol-throws.js
new file mode 100644
index 0000000000..adcbfc36e2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/length-is-symbol-throws.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-buffer-byteoffset-length
+description: >
+ Throws a TypeError if length is a Symbol
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+
+ ...
+ 14. Else,
+ a. Let newLength be ? ToLength(length).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var buffer = new ArrayBuffer(8);
+var s = Symbol("1");
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert.throws(TypeError, function() {
+ new TA(buffer, 0, s);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/length-to-number-detachbuffer.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/length-to-number-detachbuffer.js
new file mode 100644
index 0000000000..83ca72fc7c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/length-to-number-detachbuffer.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2017 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-buffer-byteoffset-length
+description: If TypedArray() is passed a detached buffer, throw
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ ...
+ 9. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var offset = TA.BYTES_PER_ELEMENT;
+ var buffer = new ArrayBuffer(3 * offset);
+ var length = { valueOf() { $DETACHBUFFER(buffer); return 1; } };
+ assert.throws(TypeError, () => new TA(buffer, 0, length));
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/new-instance-extensibility-sab.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/new-instance-extensibility-sab.js
new file mode 100644
index 0000000000..8c464be41b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/new-instance-extensibility-sab.js
@@ -0,0 +1,41 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2016 the V8 project authors. 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-typedarray-buffer-byteoffset-length
+description: >
+ The new typedArray instance from a buffer argument is extensible
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ ...
+ 4. Let O be ? AllocateTypedArray(constructorName, NewTarget,
+ "%TypedArrayPrototype%").
+ ...
+
+ 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget,
+ defaultProto [ , length ])
+
+ ...
+ 2. Let obj be IntegerIndexedObjectCreate(proto, « [[ViewedArrayBuffer]],
+ [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]] »).
+ ...
+
+ 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList)
+
+ ...
+ 11. Set the [[Extensible]] internal slot of A to true.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, SharedArrayBuffer, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var buffer = new SharedArrayBuffer(8);
+ var sample = new TA(buffer);
+
+ assert(Object.isExtensible(sample));
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/new-instance-extensibility.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/new-instance-extensibility.js
new file mode 100644
index 0000000000..c85d2e32f3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/new-instance-extensibility.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-buffer-byteoffset-length
+description: >
+ The new typedArray instance from a buffer argument is extensible
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ ...
+ 4. Let O be ? AllocateTypedArray(constructorName, NewTarget,
+ "%TypedArrayPrototype%").
+ ...
+
+ 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget,
+ defaultProto [ , length ])
+
+ ...
+ 2. Let obj be IntegerIndexedObjectCreate(proto, « [[ViewedArrayBuffer]],
+ [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]] »).
+ ...
+
+ 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList)
+
+ ...
+ 11. Set the [[Extensible]] internal slot of A to true.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var buffer = new ArrayBuffer(8);
+ var sample = new TA(buffer);
+
+ assert(Object.isExtensible(sample));
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/proto-from-ctor-realm-sab.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/proto-from-ctor-realm-sab.js
new file mode 100644
index 0000000000..e91da4c63c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/proto-from-ctor-realm-sab.js
@@ -0,0 +1,41 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2016 the V8 project authors. 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-typedarray-buffer-byteoffset-length
+description: Default [[Prototype]] value derived from realm of the newTarget
+info: |
+ [...]
+ 4. Let O be ? AllocateTypedArray(constructorName, NewTarget,
+ "%TypedArrayPrototype%").
+ [...]
+
+ 22.2.4.2.1 Runtime Semantics: AllocateTypedArray
+
+ 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto).
+ [...]
+
+ 9.1.14 GetPrototypeFromConstructor
+
+ [...]
+ 3. Let proto be ? Get(constructor, "prototype").
+ 4. If Type(proto) is not Object, then
+ a. Let realm be ? GetFunctionRealm(constructor).
+ b. Let proto be realm's intrinsic object named intrinsicDefaultProto.
+ 5. Return proto.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, cross-realm, SharedArrayBuffer, Reflect, TypedArray]
+---*/
+
+var other = $262.createRealm().global;
+var C = new other.Function();
+C.prototype = null;
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var ta = Reflect.construct(TA, [new SharedArrayBuffer(8)], C);
+
+ assert.sameValue(Object.getPrototypeOf(ta), other[TA.name].prototype);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/proto-from-ctor-realm.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/proto-from-ctor-realm.js
new file mode 100644
index 0000000000..3aefc42967
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/proto-from-ctor-realm.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-buffer-byteoffset-length
+description: Default [[Prototype]] value derived from realm of the newTarget
+info: |
+ [...]
+ 4. Let O be ? AllocateTypedArray(constructorName, NewTarget,
+ "%TypedArrayPrototype%").
+ [...]
+
+ 22.2.4.2.1 Runtime Semantics: AllocateTypedArray
+
+ 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto).
+ [...]
+
+ 9.1.14 GetPrototypeFromConstructor
+
+ [...]
+ 3. Let proto be ? Get(constructor, "prototype").
+ 4. If Type(proto) is not Object, then
+ a. Let realm be ? GetFunctionRealm(constructor).
+ b. Let proto be realm's intrinsic object named intrinsicDefaultProto.
+ 5. Return proto.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, cross-realm, Reflect, TypedArray]
+---*/
+
+var other = $262.createRealm().global;
+var C = new other.Function();
+C.prototype = null;
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var ta = Reflect.construct(TA, [new ArrayBuffer(8)], C);
+
+ assert.sameValue(Object.getPrototypeOf(ta), other[TA.name].prototype);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/returns-new-instance-sab.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/returns-new-instance-sab.js
new file mode 100644
index 0000000000..bbf1124b01
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/returns-new-instance-sab.js
@@ -0,0 +1,37 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2016 the V8 project authors. 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-typedarray-buffer-byteoffset-length
+description: >
+ Return new typedArray from undefined offset and length
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, SharedArrayBuffer, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var bpe = TA.BYTES_PER_ELEMENT;
+
+ var buffer1 = new SharedArrayBuffer(bpe * 4);
+ var ta1 = new TA(buffer1);
+ assert.sameValue(ta1.length, 4);
+ assert.sameValue(ta1.buffer, buffer1);
+ assert.sameValue(ta1.constructor, TA);
+ assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype);
+
+ var buffer2 = new SharedArrayBuffer(0);
+ var ta2 = new TA(buffer2);
+ assert.sameValue(ta2.length, 0);
+ assert.sameValue(ta2.buffer, buffer2);
+ assert.sameValue(ta2.constructor, TA);
+ assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/returns-new-instance.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/returns-new-instance.js
new file mode 100644
index 0000000000..f307a9dd17
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/returns-new-instance.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-buffer-byteoffset-length
+description: >
+ Return new typedArray from undefined offset and length
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var bpe = TA.BYTES_PER_ELEMENT;
+
+ var buffer1 = new ArrayBuffer(bpe * 4);
+ var ta1 = new TA(buffer1);
+ assert.sameValue(ta1.length, 4);
+ assert.sameValue(ta1.buffer, buffer1);
+ assert.sameValue(ta1.constructor, TA);
+ assert.sameValue(Object.getPrototypeOf(ta1), TA.prototype);
+
+ var buffer2 = new ArrayBuffer(0);
+ var ta2 = new TA(buffer2);
+ assert.sameValue(ta2.length, 0);
+ assert.sameValue(ta2.buffer, buffer2);
+ assert.sameValue(ta2.constructor, TA);
+ assert.sameValue(Object.getPrototypeOf(ta2), TA.prototype);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/shell.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/shell.js
new file mode 100644
index 0000000000..1c02f57631
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/shell.js
@@ -0,0 +1,60 @@
+// GENERATED, DO NOT EDIT
+// file: detachArrayBuffer.js
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: |
+ A function used in the process of asserting correctness of TypedArray objects.
+
+ $262.detachArrayBuffer is defined by a host.
+defines: [$DETACHBUFFER]
+---*/
+
+function $DETACHBUFFER(buffer) {
+ if (!$262 || typeof $262.detachArrayBuffer !== "function") {
+ throw new Test262Error("No method available to detach an ArrayBuffer");
+ }
+ $262.detachArrayBuffer(buffer);
+}
+
+// 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/TypedArrayConstructors/ctors-bigint/buffer-arg/toindex-bytelength-sab.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/toindex-bytelength-sab.js
new file mode 100644
index 0000000000..ee266307a8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/toindex-bytelength-sab.js
@@ -0,0 +1,76 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2016 the V8 project authors. 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-typedarray-buffer-byteoffset-length
+description: >
+ ToIndex(length) operations
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+
+ ...
+ 11. If length is either not present or undefined, then
+ ...
+ 12. Else,
+ a. Let newLength be ? ToIndex(length).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, SharedArrayBuffer, TypedArray]
+---*/
+
+var buffer = new SharedArrayBuffer(16);
+
+var obj1 = {
+ valueOf: function() {
+ return 1;
+ }
+};
+
+var obj2 = {
+ toString: function() {
+ return 1;
+ }
+};
+
+var items = [
+ [-0, 0, "-0"],
+ [obj1, 1, "object's valueOf"],
+ [obj2, 1, "object's toString"],
+ ["", 0, "the Empty string"],
+ ["0", 0, "string '0'"],
+ ["1", 1, "string '1'"],
+ [false, 0, "false"],
+ [true, 1, "true"],
+ [NaN, 0, "NaN"],
+ [null, 0, "null"],
+ [0.1, 0, "0.1"],
+ [0.9, 0, "0.9"],
+ [1.1, 1, "1.1"],
+ [1.9, 1, "1.9"],
+ [-0.1, 0, "-0.1"],
+ [-0.99999, 0, "-0.99999"]
+];
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ items.forEach(function(item) {
+ var len = item[0];
+ var expected = item[1];
+ var name = item[2];
+
+ var typedArray = new TA(buffer, 0, len);
+ assert.sameValue(typedArray.length, expected, name + " length");
+ assert.sameValue(typedArray.constructor, TA, name + " constructor");
+ assert.sameValue(
+ Object.getPrototypeOf(typedArray),
+ TA.prototype,
+ name + " prototype"
+ );
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/toindex-bytelength.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/toindex-bytelength.js
new file mode 100644
index 0000000000..3822a656f8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/toindex-bytelength.js
@@ -0,0 +1,74 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-buffer-byteoffset-length
+description: >
+ ToIndex(length) operations
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+
+ ...
+ 11. If length is either not present or undefined, then
+ ...
+ 12. Else,
+ a. Let newLength be ? ToIndex(length).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var buffer = new ArrayBuffer(16);
+
+var obj1 = {
+ valueOf: function() {
+ return 1;
+ }
+};
+
+var obj2 = {
+ toString: function() {
+ return 1;
+ }
+};
+
+var items = [
+ [-0, 0, "-0"],
+ [obj1, 1, "object's valueOf"],
+ [obj2, 1, "object's toString"],
+ ["", 0, "the Empty string"],
+ ["0", 0, "string '0'"],
+ ["1", 1, "string '1'"],
+ [false, 0, "false"],
+ [true, 1, "true"],
+ [NaN, 0, "NaN"],
+ [null, 0, "null"],
+ [0.1, 0, "0.1"],
+ [0.9, 0, "0.9"],
+ [1.1, 1, "1.1"],
+ [1.9, 1, "1.9"],
+ [-0.1, 0, "-0.1"],
+ [-0.99999, 0, "-0.99999"]
+];
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ items.forEach(function(item) {
+ var len = item[0];
+ var expected = item[1];
+ var name = item[2];
+
+ var typedArray = new TA(buffer, 0, len);
+ assert.sameValue(typedArray.length, expected, name + " length");
+ assert.sameValue(typedArray.constructor, TA, name + " constructor");
+ assert.sameValue(
+ Object.getPrototypeOf(typedArray),
+ TA.prototype,
+ name + " prototype"
+ );
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/toindex-byteoffset-sab.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/toindex-byteoffset-sab.js
new file mode 100644
index 0000000000..b0ef7909c3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/toindex-byteoffset-sab.js
@@ -0,0 +1,90 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2016 the V8 project authors. 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-typedarray-buffer-byteoffset-length
+description: >
+ ToIndex(byteOffset) operations
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+
+ ...
+ 7. Let offset be ? ToIndex(byteOffset).
+ 8. If offset modulo elementSize ≠ 0, throw a RangeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, SharedArrayBuffer, TypedArray]
+---*/
+
+var buffer = new SharedArrayBuffer(16);
+
+var obj1 = {
+ valueOf: function() {
+ return 8;
+ }
+};
+
+var obj2 = {
+ toString: function() {
+ return 8;
+ }
+};
+
+var items = [
+ [-0, 0, "-0"],
+ [obj1, 8, "object's valueOf"],
+ [obj2, 8, "object's toString"],
+ ["", 0, "the Empty string"],
+ ["0", 0, "string '0'"],
+ ["8", 8, "string '8'"],
+ [false, 0, "false"],
+ [NaN, 0, "NaN"],
+ [null, 0, "null"],
+ [undefined, 0, "undefined"],
+ [0.1, 0, "0.1"],
+ [0.9, 0, "0.9"],
+ [8.1, 8, "8.1"],
+ [8.9, 8, "8.9"],
+ [-0.1, 0, "-0.1"],
+ [-0.99999, 0, "-0.99999"]
+];
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ items.forEach(function(item) {
+ var offset = item[0];
+ var expected = item[1];
+ var name = item[2];
+
+ var typedArray = new TA(buffer, offset);
+ assert.sameValue(typedArray.byteOffset, expected, name + " byteOffset");
+ assert.sameValue(typedArray.constructor, TA, name + " constructor");
+ assert.sameValue(
+ Object.getPrototypeOf(typedArray),
+ TA.prototype,
+ name + " prototype"
+ );
+ });
+
+ // Testing `true`. See step 8
+ if (TA.BYTES_PER_ELEMENT === 1) {
+ var typedArray = new TA(buffer, true);
+ assert.sameValue(typedArray.byteOffset, 1, "true => 1 byteOffset");
+ assert.sameValue(typedArray.constructor, TA, "true => 1 constructor");
+ assert.sameValue(
+ Object.getPrototypeOf(typedArray),
+ TA.prototype,
+ "true => 1 prototype"
+ );
+ } else {
+ assert.throws(RangeError, function() {
+ new TA(buffer, true);
+ }, "1 modulo elementSize ≠ 0, throws a RangeError");
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/toindex-byteoffset.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/toindex-byteoffset.js
new file mode 100644
index 0000000000..5d11140a7c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/toindex-byteoffset.js
@@ -0,0 +1,88 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-buffer-byteoffset-length
+description: >
+ ToIndex(byteOffset) operations
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+
+ ...
+ 7. Let offset be ? ToIndex(byteOffset).
+ 8. If offset modulo elementSize ≠ 0, throw a RangeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var buffer = new ArrayBuffer(16);
+
+var obj1 = {
+ valueOf: function() {
+ return 8;
+ }
+};
+
+var obj2 = {
+ toString: function() {
+ return 8;
+ }
+};
+
+var items = [
+ [-0, 0, "-0"],
+ [obj1, 8, "object's valueOf"],
+ [obj2, 8, "object's toString"],
+ ["", 0, "the Empty string"],
+ ["0", 0, "string '0'"],
+ ["8", 8, "string '8'"],
+ [false, 0, "false"],
+ [NaN, 0, "NaN"],
+ [null, 0, "null"],
+ [undefined, 0, "undefined"],
+ [0.1, 0, "0.1"],
+ [0.9, 0, "0.9"],
+ [8.1, 8, "8.1"],
+ [8.9, 8, "8.9"],
+ [-0.1, 0, "-0.1"],
+ [-0.99999, 0, "-0.99999"]
+];
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ items.forEach(function(item) {
+ var offset = item[0];
+ var expected = item[1];
+ var name = item[2];
+
+ var typedArray = new TA(buffer, offset);
+ assert.sameValue(typedArray.byteOffset, expected, name + " byteOffset");
+ assert.sameValue(typedArray.constructor, TA, name + " constructor");
+ assert.sameValue(
+ Object.getPrototypeOf(typedArray),
+ TA.prototype,
+ name + " prototype"
+ );
+ });
+
+ // Testing `true`. See step 8
+ if (TA.BYTES_PER_ELEMENT === 1) {
+ var typedArray = new TA(buffer, true);
+ assert.sameValue(typedArray.byteOffset, 1, "true => 1 byteOffset");
+ assert.sameValue(typedArray.constructor, TA, "true => 1 constructor");
+ assert.sameValue(
+ Object.getPrototypeOf(typedArray),
+ TA.prototype,
+ "true => 1 prototype"
+ );
+ } else {
+ assert.throws(RangeError, function() {
+ new TA(buffer, true);
+ }, "1 modulo elementSize ≠ 0, throws a RangeError");
+ }
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/typedarray-backed-by-sharedarraybuffer.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/typedarray-backed-by-sharedarraybuffer.js
new file mode 100644
index 0000000000..d72633b53c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/typedarray-backed-by-sharedarraybuffer.js
@@ -0,0 +1,28 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-typedarray-typedarray
+description: >
+ Passing a SharedArrayBuffer-backed TypedArray to a TypedArray constructor
+ produces an ArrayBuffer-backed TypedArray.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, SharedArrayBuffer, TypedArray]
+---*/
+
+var sab = new SharedArrayBuffer(8);
+
+testWithBigIntTypedArrayConstructors(function(View1) {
+ var ta1 = new View1(sab);
+ testWithBigIntTypedArrayConstructors(function(View2) {
+ var ta2 = new View2(ta1);
+ assert.sameValue(
+ ta2.buffer.constructor,
+ ArrayBuffer,
+ "TypedArray of SharedArrayBuffer-backed TypedArray is ArrayBuffer-backed"
+ );
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/use-custom-proto-if-object-sab.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/use-custom-proto-if-object-sab.js
new file mode 100644
index 0000000000..d03bc4726b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/use-custom-proto-if-object-sab.js
@@ -0,0 +1,52 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2016 the V8 project authors. 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-typedarray-buffer-byteoffset-length
+description: >
+ Use prototype from new target if it's an Object
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+
+ ...
+ 4. Let O be ? AllocateTypedArray(constructorName, NewTarget,
+ %TypedArrayPrototype%).
+ ...
+
+ 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget,
+ defaultProto [ , length ])
+
+ 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto).
+ 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]],
+ [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ).
+ ...
+
+ 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList)
+
+ ...
+ 10. Set the [[Prototype]] internal slot of A to prototype.
+ ...
+ 12. Return A.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, SharedArrayBuffer, Reflect, TypedArray]
+---*/
+
+var buffer = new SharedArrayBuffer(8);
+
+function newTarget() {}
+var proto = {};
+newTarget.prototype = proto;
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var ta = Reflect.construct(TA, [buffer], newTarget);
+
+ assert.sameValue(ta.constructor, Object);
+ assert.sameValue(Object.getPrototypeOf(ta), proto);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/use-custom-proto-if-object.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/use-custom-proto-if-object.js
new file mode 100644
index 0000000000..6baa8c836c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/use-custom-proto-if-object.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-buffer-byteoffset-length
+description: >
+ Use prototype from new target if it's an Object
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+
+ ...
+ 4. Let O be ? AllocateTypedArray(constructorName, NewTarget,
+ %TypedArrayPrototype%).
+ ...
+
+ 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget,
+ defaultProto [ , length ])
+
+ 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto).
+ 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]],
+ [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ).
+ ...
+
+ 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList)
+
+ ...
+ 10. Set the [[Prototype]] internal slot of A to prototype.
+ ...
+ 12. Return A.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Reflect, TypedArray]
+---*/
+
+var buffer = new ArrayBuffer(8);
+
+function newTarget() {}
+var proto = {};
+newTarget.prototype = proto;
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var ta = Reflect.construct(TA, [buffer], newTarget);
+
+ assert.sameValue(ta.constructor, Object);
+ assert.sameValue(Object.getPrototypeOf(ta), proto);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/use-default-proto-if-custom-proto-is-not-object-sab.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/use-default-proto-if-custom-proto-is-not-object-sab.js
new file mode 100644
index 0000000000..0a442701f2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/use-default-proto-if-custom-proto-is-not-object-sab.js
@@ -0,0 +1,51 @@
+// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
+// Copyright (C) 2016 the V8 project authors. 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-typedarray-buffer-byteoffset-length
+description: >
+ Use prototype from %TypedArray% if newTarget's prototype is not an Object
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+
+ ...
+ 4. Let O be ? AllocateTypedArray(constructorName, NewTarget,
+ %TypedArrayPrototype%).
+ ...
+
+ 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget,
+ defaultProto [ , length ])
+
+ 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto).
+ 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]],
+ [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ).
+ ...
+
+ 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList)
+
+ ...
+ 10. Set the [[Prototype]] internal slot of A to prototype.
+ ...
+ 12. Return A.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, SharedArrayBuffer, TypedArray]
+---*/
+
+var buffer = new SharedArrayBuffer(8);
+
+function newTarget() {}
+newTarget.prototype = null;
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var ta = Reflect.construct(TA, [buffer], newTarget);
+
+ assert.sameValue(ta.constructor, TA);
+ assert.sameValue(Object.getPrototypeOf(ta), TA.prototype);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/use-default-proto-if-custom-proto-is-not-object.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/use-default-proto-if-custom-proto-is-not-object.js
new file mode 100644
index 0000000000..520a8d1f61
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/use-default-proto-if-custom-proto-is-not-object.js
@@ -0,0 +1,49 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-buffer-byteoffset-length
+description: >
+ Use prototype from %TypedArray% if newTarget's prototype is not an Object
+info: |
+ 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has an [[ArrayBufferData]] internal slot.
+
+ ...
+ 4. Let O be ? AllocateTypedArray(constructorName, NewTarget,
+ %TypedArrayPrototype%).
+ ...
+
+ 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget,
+ defaultProto [ , length ])
+
+ 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto).
+ 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]],
+ [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ).
+ ...
+
+ 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList)
+
+ ...
+ 10. Set the [[Prototype]] internal slot of A to prototype.
+ ...
+ 12. Return A.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var buffer = new ArrayBuffer(8);
+
+function newTarget() {}
+newTarget.prototype = null;
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var ta = Reflect.construct(TA, [buffer], newTarget);
+
+ assert.sameValue(ta.constructor, TA);
+ assert.sameValue(Object.getPrototypeOf(ta), TA.prototype);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/browser.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/browser.js
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/custom-proto-access-throws.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/custom-proto-access-throws.js
new file mode 100644
index 0000000000..51cf40ab6f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/custom-proto-access-throws.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-length
+description: >
+ Return abrupt completion getting newTarget's prototype
+info: |
+ 22.2.4.2 TypedArray ( length )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is not Object.
+
+ ...
+ 8. Return ? AllocateTypedArray(constructorName, NewTarget,
+ %TypedArrayPrototype%, elementLength).
+
+ 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget,
+ defaultProto [ , length ])
+
+ 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto).
+ ...
+
+ 9.1.15 GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto )
+
+ ...
+ 3. Let proto be ? Get(constructor, "prototype").
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Reflect, TypedArray]
+---*/
+
+var newTarget = function() {}.bind(null);
+Object.defineProperty(newTarget, "prototype", {
+ get() {
+ throw new Test262Error();
+ }
+});
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert.throws(Test262Error, function() {
+ Reflect.construct(TA, [1], newTarget);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/init-zeros.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/init-zeros.js
new file mode 100644
index 0000000000..b857489ae1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/init-zeros.js
@@ -0,0 +1,57 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-length
+description: All bytes are initialized to zero
+info: |
+ 22.2.4.2 TypedArray ( length )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is not Object.
+
+ ...
+ 8. Return ? AllocateTypedArray(constructorName, NewTarget,
+ %TypedArrayPrototype%, elementLength).
+
+ 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget,
+ defaultProto [ , length ])
+
+ 5. If length was not passed, then
+ ...
+ 6. Else,
+ a. Perform ? AllocateTypedArrayBuffer(obj, length).
+
+ 22.2.4.2.2 Runtime Semantics: AllocateTypedArrayBuffer
+
+ 7. Let data be ? AllocateArrayBuffer(%ArrayBuffer%, byteLength).
+
+ 24.1.1.1 AllocateArrayBuffer
+
+ 3. Let block be ? CreateByteDataBlock(byteLength).
+
+ 6.2.6.1 CreateByteDataBlock
+
+ 1. Assert: size≥0.
+ 2. Let db be a new Data Block value consisting of size bytes. If it is
+ impossible to create such a Data Block, throw a RangeError exception.
+ 3. Set all of the bytes of db to 0.
+ 4. Return db.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var subject = new TA(9);
+
+ assert.sameValue(subject[0], 0n, 'index 0');
+ assert.sameValue(subject[1], 0n, 'index 1');
+ assert.sameValue(subject[2], 0n, 'index 2');
+ assert.sameValue(subject[3], 0n, 'index 3');
+ assert.sameValue(subject[4], 0n, 'index 4');
+ assert.sameValue(subject[5], 0n, 'index 5');
+ assert.sameValue(subject[6], 0n, 'index 6');
+ assert.sameValue(subject[7], 0n, 'index 7');
+ assert.sameValue(subject[8], 0n, 'index 8');
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/is-infinity-throws-rangeerror.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/is-infinity-throws-rangeerror.js
new file mode 100644
index 0000000000..e1a9d812ec
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/is-infinity-throws-rangeerror.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-length
+description: >
+ Throws a RangeError if length is a Infinity value
+info: |
+ 22.2.4.2 TypedArray ( length )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is not Object.
+
+ ...
+ 4. Let numberLength be ? ToNumber(length).
+ 5. Let elementLength be ToLength(numberLength).
+ 6. If SameValueZero(numberLength, elementLength) is false, throw a RangeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert.throws(RangeError, function() {
+ new TA(Infinity);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/is-negative-integer-throws-rangeerror.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/is-negative-integer-throws-rangeerror.js
new file mode 100644
index 0000000000..57f8f11914
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/is-negative-integer-throws-rangeerror.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-length
+description: >
+ Throws a RangeError if ToInteger(length) is a negative value
+info: |
+ 22.2.4.2 TypedArray ( length )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is not Object.
+
+ ...
+ 3. Let elementLength be ? ToIndex(length).
+ ...
+
+ 7.1.17 ToIndex ( value )
+
+ 1. If value is undefined, then
+ ...
+ 2. Else,
+ a. Let integerIndex be ? ToInteger(value).
+ b. If integerIndex < 0, throw a RangeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert.throws(RangeError, function() {
+ new TA(-1);
+ });
+
+ assert.throws(RangeError, function() {
+ new TA(-Infinity);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/is-symbol-throws.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/is-symbol-throws.js
new file mode 100644
index 0000000000..130470811b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/is-symbol-throws.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-length
+description: >
+ If length is a Symbol, throw a TypeError exception.
+info: |
+ 22.2.4.2 TypedArray ( length )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is not Object.
+
+ ...
+ 4. Let numberLength be ? ToNumber(length).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var s = Symbol('1');
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert.throws(TypeError, function() {
+ new TA(s);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/new-instance-extensibility.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/new-instance-extensibility.js
new file mode 100644
index 0000000000..6378d55d33
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/new-instance-extensibility.js
@@ -0,0 +1,40 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-length
+description: >
+ The new typedArray instance from a length argument is extensible
+info: |
+ 22.2.4.2 TypedArray ( length )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is not Object.
+
+ ...
+ 8. Return ? AllocateTypedArray(constructorName, NewTarget,
+ %TypedArrayPrototype%, elementLength).
+
+ 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget,
+ defaultProto [ , length ])
+
+ ...
+ 2. Let obj be IntegerIndexedObjectCreate(proto, « [[ViewedArrayBuffer]],
+ [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]] »).
+ ...
+
+ 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList)
+
+ ...
+ 11. Set the [[Extensible]] internal slot of A to true.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(4);
+
+ assert(Object.isExtensible(sample));
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/proto-from-ctor-realm.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/proto-from-ctor-realm.js
new file mode 100644
index 0000000000..6351fd73f7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/proto-from-ctor-realm.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-length
+description: Default [[Prototype]] value derived from realm of the newTarget
+info: |
+ [...]
+ 8. Return ? AllocateTypedArray(constructorName, NewTarget,
+ "%TypedArrayPrototype%", elementLength).
+
+ 22.2.4.2.1 Runtime Semantics: AllocateTypedArray
+
+ 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto).
+ [...]
+
+ 9.1.14 GetPrototypeFromConstructor
+
+ [...]
+ 3. Let proto be ? Get(constructor, "prototype").
+ 4. If Type(proto) is not Object, then
+ a. Let realm be ? GetFunctionRealm(constructor).
+ b. Let proto be realm's intrinsic object named intrinsicDefaultProto.
+ 5. Return proto.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, cross-realm, Reflect, TypedArray]
+---*/
+
+var other = $262.createRealm().global;
+var C = new other.Function();
+C.prototype = null;
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var ta = Reflect.construct(TA, [0], C);
+
+ assert.sameValue(Object.getPrototypeOf(ta), other[TA.name].prototype);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/returns-object.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/returns-object.js
new file mode 100644
index 0000000000..b8b24235fd
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/returns-object.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-length
+description: >
+ Return a TypedArray object
+info: |
+ 22.2.4.2 TypedArray ( length )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is not Object.
+
+ ...
+ 8. Return ? AllocateTypedArray(constructorName, NewTarget,
+ %TypedArrayPrototype%, elementLength).
+
+ 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget,
+ defaultProto [ , length ])
+
+ ...
+ 7. Return obj
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var typedArray = new TA(4);
+ var length = typedArray.length;
+
+ assert.sameValue(length, 4, "length");
+ assert.sameValue(typedArray.constructor, TA);
+ assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/shell.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/shell.js
new file mode 100644
index 0000000000..90ee9c114d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/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/TypedArrayConstructors/ctors-bigint/length-arg/toindex-length.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/toindex-length.js
new file mode 100644
index 0000000000..64ef8ac3c6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/toindex-length.js
@@ -0,0 +1,55 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-length
+description: >
+ ToIndex(length) operations
+info: |
+ 22.2.4.2 TypedArray ( length )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is not Object.
+
+ ...
+ 3. Let elementLength be ? ToIndex(length).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var items = [
+ [-0, 0, "-0"],
+ ["", 0, "the Empty string"],
+ ["0", 0, "string '0'"],
+ ["1", 1, "string '1'"],
+ [true, 1, "true"],
+ [false, 0, "false"],
+ [NaN, 0, "NaN"],
+ [null, 0, "null"],
+ [undefined, 0, "undefined"],
+ [0.1, 0, "0.1"],
+ [0.9, 0, "0.9"],
+ [1.1, 1, "1.1"],
+ [1.9, 1, "1.9"],
+ [-0.1, 0, "-0.1"],
+ [-0.99999, 0, "-0.99999"]
+];
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ items.forEach(function(item) {
+ var len = item[0];
+ var expected = item[1];
+ var name = item[2];
+
+ var typedArray = new TA(len);
+ assert.sameValue(typedArray.length, expected, name + " length");
+ assert.sameValue(typedArray.constructor, TA, name + " constructor");
+ assert.sameValue(
+ Object.getPrototypeOf(typedArray),
+ TA.prototype,
+ name + " prototype"
+ );
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/undefined-newtarget-throws.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/undefined-newtarget-throws.js
new file mode 100644
index 0000000000..65bc5efd6f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/undefined-newtarget-throws.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-length
+description: >
+ Throws a TypeError if NewTarget is undefined.
+info: |
+ 22.2.4.2 TypedArray ( length )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is not Object.
+
+ ...
+ 2. If NewTarget is undefined, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert.throws(TypeError, function() {
+ TA(0);
+ });
+
+ assert.throws(TypeError, function() {
+ TA(Infinity);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/use-custom-proto-if-object.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/use-custom-proto-if-object.js
new file mode 100644
index 0000000000..87cef3c04c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/use-custom-proto-if-object.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-length
+description: >
+ Use prototype from new target if it's an Object
+info: |
+ 22.2.4.2 TypedArray ( length )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is not Object.
+
+ ...
+ 8. Return ? AllocateTypedArray(constructorName, NewTarget,
+ %TypedArrayPrototype%, elementLength).
+
+ 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget,
+ defaultProto [ , length ])
+
+ 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto).
+ 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]],
+ [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ).
+ ...
+
+ 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList)
+
+ ...
+ 10. Set the [[Prototype]] internal slot of A to prototype.
+ ...
+ 12. Return A.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Reflect, TypedArray]
+---*/
+
+function newTarget() {}
+var proto = {};
+newTarget.prototype = proto;
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var ta = Reflect.construct(TA, [1], newTarget);
+
+ assert.sameValue(ta.constructor, Object);
+ assert.sameValue(Object.getPrototypeOf(ta), proto);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/use-default-proto-if-custom-proto-is-not-object.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/use-default-proto-if-custom-proto-is-not-object.js
new file mode 100644
index 0000000000..b1fd97885e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/length-arg/use-default-proto-if-custom-proto-is-not-object.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-length
+description: >
+ Use prototype from %TypedArray% if newTarget's prototype is not an Object
+info: |
+ 22.2.4.2 TypedArray ( length )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is not Object.
+
+ ...
+ 8. Return ? AllocateTypedArray(constructorName, NewTarget,
+ %TypedArrayPrototype%, elementLength).
+
+ 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget,
+ defaultProto [ , length ])
+
+ 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto).
+ 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]],
+ [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ).
+ ...
+
+ 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList)
+
+ ...
+ 10. Set the [[Prototype]] internal slot of A to prototype.
+ ...
+ 12. Return A.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+function newTarget() {}
+newTarget.prototype = null;
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var ta = Reflect.construct(TA, [1], newTarget);
+
+ assert.sameValue(ta.constructor, TA);
+ assert.sameValue(Object.getPrototypeOf(ta), TA.prototype);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/no-args/browser.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/no-args/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/no-args/browser.js
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/no-args/custom-proto-access-throws.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/no-args/custom-proto-access-throws.js
new file mode 100644
index 0000000000..460a899803
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/no-args/custom-proto-access-throws.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray
+description: >
+ Return abrupt completion getting newTarget's prototype
+info: |
+ 22.2.4.1 TypedArray( )
+
+ This description applies only if the TypedArray function is called with no
+ arguments.
+
+ ...
+ 3. Return ? AllocateTypedArray(constructorName, NewTarget,
+ %TypedArrayPrototype%, 0).
+
+ 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget,
+ defaultProto [ , length ])
+
+ 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto).
+ ...
+
+ 9.1.15 GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto )
+
+ ...
+ 3. Let proto be ? Get(constructor, "prototype").
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Reflect, TypedArray]
+---*/
+
+var newTarget = function() {}.bind(null);
+Object.defineProperty(newTarget, "prototype", {
+ get() {
+ throw new Test262Error();
+ }
+});
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert.throws(Test262Error, function() {
+ Reflect.construct(TA, [], newTarget);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/no-args/new-instance-extensibility.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/no-args/new-instance-extensibility.js
new file mode 100644
index 0000000000..8c6adc6e50
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/no-args/new-instance-extensibility.js
@@ -0,0 +1,40 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray
+description: >
+ The new typedArray instance is extensible
+info: |
+ 22.2.4.1 TypedArray( )
+
+ This description applies only if the TypedArray function is called with no
+ arguments.
+
+ ...
+ 3. Return ? AllocateTypedArray(constructorName, NewTarget,
+ %TypedArrayPrototype%, 0).
+
+ 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget,
+ defaultProto [ , length ])
+
+ ...
+ 2. Let obj be IntegerIndexedObjectCreate(proto, « [[ViewedArrayBuffer]],
+ [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]] »).
+ ...
+
+ 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList)
+
+ ...
+ 11. Set the [[Extensible]] internal slot of A to true.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+
+ assert(Object.isExtensible(sample));
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/no-args/proto-from-ctor-realm.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/no-args/proto-from-ctor-realm.js
new file mode 100644
index 0000000000..9a68a4185a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/no-args/proto-from-ctor-realm.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray
+description: Default [[Prototype]] value derived from realm of the newTarget
+info: |
+ [...]
+ 3. Return ? AllocateTypedArray(constructorName, NewTarget,
+ "%TypedArrayPrototype%", 0).
+
+ 22.2.4.2.1 Runtime Semantics: AllocateTypedArray
+
+ 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto).
+ [...]
+
+ 9.1.14 GetPrototypeFromConstructor
+
+ [...]
+ 3. Let proto be ? Get(constructor, "prototype").
+ 4. If Type(proto) is not Object, then
+ a. Let realm be ? GetFunctionRealm(constructor).
+ b. Let proto be realm's intrinsic object named intrinsicDefaultProto.
+ 5. Return proto.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, cross-realm, Reflect, TypedArray]
+---*/
+
+var other = $262.createRealm().global;
+var C = new other.Function();
+C.prototype = null;
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var ta = Reflect.construct(TA, [], C);
+
+ assert.sameValue(Object.getPrototypeOf(ta), other[TA.name].prototype);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/no-args/returns-object.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/no-args/returns-object.js
new file mode 100644
index 0000000000..13b94816ac
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/no-args/returns-object.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray
+description: >
+ Return a TypedArray object
+info: |
+ 22.2.4.1 TypedArray( )
+
+ This description applies only if the TypedArray function is called with no
+ arguments.
+
+ ...
+ 3. Return ? AllocateTypedArray(constructorName, NewTarget,
+ %TypedArrayPrototype%, 0).
+
+ 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget,
+ defaultProto [ , length ])
+
+ ...
+ 7. Return obj
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var typedArray = new TA();
+
+ assert.sameValue(typedArray.length, 0);
+ assert.sameValue(typedArray.constructor, TA);
+ assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/no-args/shell.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/no-args/shell.js
new file mode 100644
index 0000000000..90ee9c114d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/no-args/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/TypedArrayConstructors/ctors-bigint/no-args/undefined-newtarget-throws.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/no-args/undefined-newtarget-throws.js
new file mode 100644
index 0000000000..7706a65bcf
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/no-args/undefined-newtarget-throws.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray
+description: >
+ Throws a TypeError if NewTarget is undefined.
+info: |
+ 22.2.4.1 TypedArray( )
+
+ This description applies only if the TypedArray function is called with no
+ arguments.
+
+ 1. If NewTarget is undefined, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert.throws(TypeError, function() {
+ TA();
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/no-args/use-custom-proto-if-object.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/no-args/use-custom-proto-if-object.js
new file mode 100644
index 0000000000..2e836d96c7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/no-args/use-custom-proto-if-object.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray
+description: >
+ Use prototype from new target if it's an Object
+info: |
+ 22.2.4.1 TypedArray( )
+
+ This description applies only if the TypedArray function is called with no
+ arguments.
+
+ ...
+ 3. Return ? AllocateTypedArray(constructorName, NewTarget,
+ %TypedArrayPrototype%, 0).
+
+ 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget,
+ defaultProto [ , length ])
+
+ 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto).
+ 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]],
+ [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ).
+ ...
+
+ 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList)
+
+ ...
+ 10. Set the [[Prototype]] internal slot of A to prototype.
+ ...
+ 12. Return A.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Reflect, TypedArray]
+---*/
+
+function newTarget() {}
+var proto = {};
+newTarget.prototype = proto;
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var ta = Reflect.construct(TA, [], newTarget);
+
+ assert.sameValue(ta.constructor, Object);
+ assert.sameValue(Object.getPrototypeOf(ta), proto);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/no-args/use-default-proto-if-custom-proto-is-not-object.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/no-args/use-default-proto-if-custom-proto-is-not-object.js
new file mode 100644
index 0000000000..bbaf57989a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/no-args/use-default-proto-if-custom-proto-is-not-object.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray
+description: >
+ Use prototype from %TypedArray% if newTarget's prototype is not an Object
+info: |
+ 22.2.4.1 TypedArray( )
+
+ This description applies only if the TypedArray function is called with no
+ arguments.
+
+ ...
+ 3. Return ? AllocateTypedArray(constructorName, NewTarget,
+ %TypedArrayPrototype%, 0).
+
+ 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget,
+ defaultProto [ , length ])
+
+ 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto).
+ 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]],
+ [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ).
+ ...
+
+ 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList)
+
+ ...
+ 10. Set the [[Prototype]] internal slot of A to prototype.
+ ...
+ 12. Return A.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+function newTarget() {}
+newTarget.prototype = null;
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var ta = Reflect.construct(TA, [], newTarget);
+
+ assert.sameValue(ta.constructor, TA);
+ assert.sameValue(Object.getPrototypeOf(ta), TA.prototype);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/as-array-returns.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/as-array-returns.js
new file mode 100644
index 0000000000..0387477cfc
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/as-array-returns.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-object
+description: >
+ Return typedArray from array argument
+info: |
+ 22.2.4.4 TypedArray ( object )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]]
+ internal slot.
+
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var typedArray = new TA([7n, 42n]);
+ assert.sameValue(typedArray.length, 2);
+ assert.sameValue(typedArray[0], 7n);
+ assert.sameValue(typedArray[1], 42n);
+ assert.sameValue(typedArray.constructor, TA);
+ assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/as-generator-iterable-returns.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/as-generator-iterable-returns.js
new file mode 100644
index 0000000000..22f9358687
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/as-generator-iterable-returns.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-object
+description: >
+ Return typedArray from iterable argument
+info: |
+ 22.2.4.4 TypedArray ( object )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]]
+ internal slot.
+
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var obj = (function *() {
+ yield 7n; yield 42n;
+ })();
+
+ var typedArray = new TA(obj);
+ assert.sameValue(typedArray.length, 2);
+ assert.sameValue(typedArray[0], 7n);
+ assert.sameValue(typedArray[1], 42n);
+ assert.sameValue(typedArray.constructor, TA);
+ assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/bigint-tobigint64.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/bigint-tobigint64.js
new file mode 100644
index 0000000000..b69f3f7759
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/bigint-tobigint64.js
@@ -0,0 +1,106 @@
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-object
+description: >
+ Behavior for input array of BigInts
+info: |
+ TypedArray ( object )
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]]
+ internal slot.
+ ...
+ 8. Repeat, while k < len
+ ...
+ b. Let kValue be ? Get(arrayLike, Pk).
+ c. Perform ? Set(O, Pk, kValue, true).
+ ...
+
+ [[Set]] ( P, V, Receiver)
+ ...
+ 2. If Type(P) is String and if SameValue(O, Receiver) is true, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ i. Perform ? IntegerIndexedElementSet(O, numericIndex, V).
+ ii. Return true.
+ ...
+
+ IntegerIndexedElementSet ( O, index, value )
+
+ Assert: O is an Integer-Indexed exotic object.
+ If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value).
+ Otherwise, let numValue be ? ToNumber(value).
+ Let buffer be O.[[ViewedArrayBuffer]].
+ If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then
+ Let offset be O.[[ByteOffset]].
+ Let arrayTypeName be the String value of O.[[TypedArrayName]].
+ Let elementSize be the Element Size value specified in Table 62 for arrayTypeName.
+ Let indexedPosition be (ℝ(index) × elementSize) + offset.
+ Let elementType be the Element Type value in Table 62 for arrayTypeName.
+ Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered).
+ Return NormalCompletion(undefined).
+
+ SetValueInBuffer ( arrayBuffer, byteIndex, type, value, isTypedArray, order [ , isLittleEndian ] )
+ ...
+ 8. Let rawBytes be NumberToRawBytes(type, value, isLittleEndian).
+ ...
+
+ NumberToRawBytes( type, value, isLittleEndian )
+ ...
+ 3. Else,
+ a. Let n be the Number value of the Element Size specified in Table
+ [The TypedArray Constructors] for Element Type type.
+ b. Let convOp be the abstract operation named in the Conversion Operation
+ column in Table 9 for Element Type type.
+
+ The TypedArray Constructors
+ Element Type: BigInt64
+ Conversion Operation: ToBigInt64
+
+ ToBigInt64 ( argument )
+ The abstract operation ToBigInt64 converts argument to one of 264 integer
+ values in the range -2^63 through 2^63-1, inclusive.
+ This abstract operation functions as follows:
+ 1. Let n be ? ToBigInt(argument).
+ 2. Let int64bit be n modulo 2^64.
+ 3. If int64bit ≥ 2^63, return int64bit - 2^64; otherwise return int64bit.
+
+features: [BigInt, TypedArray]
+---*/
+
+var vals = [
+ 18446744073709551618n, // 2n ** 64n + 2n
+ 9223372036854775810n, // 2n ** 63n + 2n
+ 2n,
+ 0n,
+ -2n,
+ -9223372036854775810n, // -(2n ** 63n) - 2n
+ -18446744073709551618n, // -(2n ** 64n) - 2n
+];
+
+var typedArray = new BigInt64Array(vals);
+
+assert.sameValue(typedArray[0], 2n,
+ "ToBigInt64(2n ** 64n + 2n) => 2n");
+
+assert.sameValue(typedArray[1], -9223372036854775806n, // 2n - 2n ** 63n
+ "ToBigInt64(2n ** 63n + 2n) => -9223372036854775806n");
+
+assert.sameValue(typedArray[2], 2n,
+ "ToBigInt64(2n) => 2n");
+
+assert.sameValue(typedArray[3], 0n,
+ "ToBigInt64(0n) => 0n");
+
+assert.sameValue(typedArray[4], -2n,
+ "ToBigInt64( -2n) => -2n");
+
+assert.sameValue(typedArray[5], 9223372036854775806n, // 2n ** 63n - 2
+ "ToBigInt64( -(2n ** 64n) - 2n) => 9223372036854775806n");
+
+assert.sameValue(typedArray[6], -2n,
+ "ToBigInt64( -(2n ** 64n) - 2n) => -2n");
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/bigint-tobiguint64.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/bigint-tobiguint64.js
new file mode 100644
index 0000000000..4d7dca6050
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/bigint-tobiguint64.js
@@ -0,0 +1,106 @@
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-object
+description: >
+ Behavior for input array of BigInts
+info: |
+ TypedArray ( object )
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]]
+ internal slot.
+ ...
+ 8. Repeat, while k < len
+ ...
+ b. Let kValue be ? Get(arrayLike, Pk).
+ c. Perform ? Set(O, Pk, kValue, true).
+ ...
+
+ [[Set]] ( P, V, Receiver)
+ ...
+ 2. If Type(P) is String and if SameValue(O, Receiver) is true, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ i. Perform ? IntegerIndexedElementSet(O, numericIndex, V).
+ ii. Return true.
+ ...
+
+ IntegerIndexedElementSet ( O, index, value )
+
+ Assert: O is an Integer-Indexed exotic object.
+ If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value).
+ Otherwise, let numValue be ? ToNumber(value).
+ Let buffer be O.[[ViewedArrayBuffer]].
+ If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then
+ Let offset be O.[[ByteOffset]].
+ Let arrayTypeName be the String value of O.[[TypedArrayName]].
+ Let elementSize be the Element Size value specified in Table 62 for arrayTypeName.
+ Let indexedPosition be (ℝ(index) × elementSize) + offset.
+ Let elementType be the Element Type value in Table 62 for arrayTypeName.
+ Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered).
+ Return NormalCompletion(undefined).
+
+ SetValueInBuffer ( arrayBuffer, byteIndex, type, value, isTypedArray, order [ , isLittleEndian ] )
+ ...
+ 8. Let rawBytes be NumberToRawBytes(type, value, isLittleEndian).
+ ...
+
+ NumberToRawBytes( type, value, isLittleEndian )
+ ...
+ 3. Else,
+ a. Let n be the Number value of the Element Size specified in Table
+ [The TypedArray Constructors] for Element Type type.
+ b. Let convOp be the abstract operation named in the Conversion Operation
+ column in Table 9 for Element Type type.
+
+ The TypedArray Constructors
+ Element Type: BigUint64
+ Conversion Operation: ToBigUint64
+
+ ToBigUint64 ( argument )
+ The abstract operation ToBigInt64 converts argument to one of 264 integer
+ values in the range -2^63 through 2^63-1, inclusive.
+ This abstract operation functions as follows:
+ 1. Let n be ? ToBigInt(argument).
+ 2. Let int64bit be n modulo 2^64.
+ 3. Return int64bit.
+
+features: [BigInt, TypedArray]
+---*/
+
+var vals = [
+ 18446744073709551618n, // 2n ** 64n + 2n
+ 9223372036854775810n, // 2n ** 63n + 2n
+ 2n,
+ 0n,
+ -2n,
+ -9223372036854775810n, // -(2n ** 63n) - 2n
+ -18446744073709551618n, // -(2n ** 64n) - 2n
+];
+
+var typedArray = new BigUint64Array(vals);
+
+
+assert.sameValue(typedArray[0], 2n,
+ "ToBigUint64(2n ** 64n + 2n) => 2n");
+
+assert.sameValue(typedArray[1], 9223372036854775810n, // 2n ** 63n + 2n
+ "ToBigUint64(2n ** 63n + 2n) => 9223372036854775810");
+
+assert.sameValue(typedArray[2], 2n,
+ "ToBigUint64(2n) => 2n");
+
+assert.sameValue(typedArray[3], 0n,
+ "ToBigUint64(0n) => 0n");
+
+assert.sameValue(typedArray[4], 18446744073709551614n, // 2n ** 64n - 2n
+ "ToBigUint64( -2n) => 18446744073709551614n");
+
+assert.sameValue(typedArray[5], 9223372036854775806n, // 2n ** 63n - 2n
+ "ToBigUint64( -(2n ** 63n) - 2n) => 9223372036854775806n");
+
+assert.sameValue(typedArray[6], 18446744073709551614n, // 2n ** 64n - 2n
+ "ToBigUint64( -(2n ** 64n) - 2n) => 18446744073709551614n");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/boolean-tobigint.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/boolean-tobigint.js
new file mode 100644
index 0000000000..a3ed66ff5c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/boolean-tobigint.js
@@ -0,0 +1,64 @@
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-object
+description: >
+ Behavior for input array of Booleans
+info: |
+ TypedArray ( object )
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]]
+ internal slot.
+ ...
+ 8. Repeat, while k < len
+ ...
+ b. Let kValue be ? Get(arrayLike, Pk).
+ c. Perform ? Set(O, Pk, kValue, true).
+ ...
+
+ [[Set]] ( P, V, Receiver)
+ ...
+ 2. If Type(P) is String and if SameValue(O, Receiver) is true, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ i. Perform ? IntegerIndexedElementSet(O, numericIndex, V).
+ ii. Return true.
+ ...
+
+ IntegerIndexedElementSet ( O, index, value )
+
+ Assert: O is an Integer-Indexed exotic object.
+ If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value).
+ Otherwise, let numValue be ? ToNumber(value).
+ Let buffer be O.[[ViewedArrayBuffer]].
+ If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then
+ Let offset be O.[[ByteOffset]].
+ Let arrayTypeName be the String value of O.[[TypedArrayName]].
+ Let elementSize be the Element Size value specified in Table 62 for arrayTypeName.
+ Let indexedPosition be (ℝ(index) × elementSize) + offset.
+ Let elementType be the Element Type value in Table 62 for arrayTypeName.
+ Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered).
+ Return NormalCompletion(undefined).
+
+ ToBigInt ( argument )
+ Object, Apply the following steps:
+ 1. Let prim be ? ToPrimitive(argument, hint Number).
+ 2. Return the value that prim corresponds to in Table [BigInt Conversions]
+
+ BigInt Conversions
+ Argument Type: Boolean
+ Result: Return 1n if prim is true and 0n if prim is false.
+
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var typedArray = new TA([false, true]);
+
+ assert.sameValue(typedArray[0], 0n);
+ assert.sameValue(typedArray[1], 1n);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/browser.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/browser.js
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/custom-proto-access-throws.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/custom-proto-access-throws.js
new file mode 100644
index 0000000000..78ec0dcf6b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/custom-proto-access-throws.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-object
+description: >
+ Return abrupt completion getting newTarget's prototype
+info: |
+ 22.2.4.4 TypedArray ( object )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]]
+ internal slot.
+
+ ...
+ 3. Let O be ? AllocateTypedArray(TypedArray.[[TypedArrayConstructorName]],
+ NewTarget, "%TypedArrayPrototype%").
+ ...
+
+ 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget,
+ defaultProto [ , length ])
+
+ 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto).
+ ...
+
+ 9.1.15 GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto )
+
+ ...
+ 3. Let proto be ? Get(constructor, "prototype").
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Reflect, TypedArray]
+---*/
+
+var newTarget = function() {}.bind(null);
+Object.defineProperty(newTarget, "prototype", {
+ get() {
+ throw new Test262Error();
+ }
+});
+
+var o = {};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert.throws(Test262Error, function() {
+ Reflect.construct(TA, [o], newTarget);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/iterating-throws.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/iterating-throws.js
new file mode 100644
index 0000000000..c043d54876
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/iterating-throws.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-object
+description: >
+ Return abrupt from iterating object argument
+info: |
+ 22.2.4.4 TypedArray ( object )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]]
+ internal slot.
+
+ ...
+ 4. Let arrayLike be ? IterableToArrayLike(object).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var obj = (function *() {
+ yield 0;
+ throw new Test262Error();
+ })();
+
+ assert.throws(Test262Error, function() {
+ new TA(obj);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/iterator-not-callable-throws.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/iterator-not-callable-throws.js
new file mode 100644
index 0000000000..fd884b5656
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/iterator-not-callable-throws.js
@@ -0,0 +1,41 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-object
+description: >
+ Return abrupt when object @@iterator is not callable
+info: |
+ 22.2.4.4 TypedArray ( object )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]]
+ internal slot.
+
+ ...
+ 4. Let arrayLike be ? IterableToArrayLike(object).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol.iterator, TypedArray]
+---*/
+
+var obj = function () {};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ obj[Symbol.iterator] = {};
+ assert.throws(TypeError, function() {
+ new TA(obj);
+ });
+
+ obj[Symbol.iterator] = true;
+ assert.throws(TypeError, function() {
+ new TA(obj);
+ });
+
+ obj[Symbol.iterator] = 42;
+ assert.throws(TypeError, function() {
+ new TA(obj);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/iterator-throws.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/iterator-throws.js
new file mode 100644
index 0000000000..613de71ced
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/iterator-throws.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-object
+description: >
+ Return abrupt from getting object @@iterator
+info: |
+ 22.2.4.4 TypedArray ( object )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]]
+ internal slot.
+
+ ...
+ 4. Let arrayLike be ? IterableToArrayLike(object).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol.iterator, TypedArray]
+---*/
+
+var obj = function () {};
+
+Object.defineProperty(obj, Symbol.iterator, {
+ get() {
+ throw new Test262Error();
+ }
+});
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert.throws(Test262Error, function() {
+ new TA(obj);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/length-excessive-throws.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/length-excessive-throws.js
new file mode 100644
index 0000000000..3492481689
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/length-excessive-throws.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-object
+description: >
+ Return abrupt from allocating array buffer with excessive length
+info: |
+ 22.2.4.4 TypedArray ( object )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]]
+ internal slot.
+
+ ...
+ 6. Perform ? AllocateTypedArrayBuffer(O, len).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var obj = {
+ length: Math.pow(2, 53)
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert.throws(RangeError, function() {
+ new TA(obj);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/length-is-symbol-throws.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/length-is-symbol-throws.js
new file mode 100644
index 0000000000..b12e29585f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/length-is-symbol-throws.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-object
+description: >
+ Return abrupt from length property as a Symbol on the object argument
+info: |
+ 22.2.4.4 TypedArray ( object )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]]
+ internal slot.
+
+ ...
+ 5. Let len be ? ToLength(? Get(arrayLike, "length")).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var obj = {
+ length: Symbol("1")
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert.throws(TypeError, function() {
+ new TA(obj);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/length-throws.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/length-throws.js
new file mode 100644
index 0000000000..2c670d66d4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/length-throws.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-object
+description: >
+ Return abrupt from getting length property on the object argument
+info: |
+ 22.2.4.4 TypedArray ( object )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]]
+ internal slot.
+
+ ...
+ 5. Let len be ? ToLength(? Get(arrayLike, "length")).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var obj = {};
+
+Object.defineProperty(obj, "length", {
+ get() {
+ throw new Test262Error();
+ }
+});
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert.throws(Test262Error, function() {
+ new TA(obj);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/new-instance-extensibility.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/new-instance-extensibility.js
new file mode 100644
index 0000000000..8bec71adf4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/new-instance-extensibility.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-object
+description: >
+ The new typedArray instance from an object argument is extensible
+info: |
+ 22.2.4.4 TypedArray ( object )
+
+ ...
+ 4. Let O be ? AllocateTypedArray(constructorName, NewTarget,
+ "%TypedArrayPrototype%").
+ ...
+
+ 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget,
+ defaultProto [ , length ])
+
+ ...
+ 2. Let obj be IntegerIndexedObjectCreate(proto, « [[ViewedArrayBuffer]],
+ [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]] »).
+ ...
+
+ 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList)
+
+ ...
+ 11. Set the [[Extensible]] internal slot of A to true.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var obj = {
+ "0": 0n,
+ "1": 1n,
+ "2": 2n,
+ length: 3
+ };
+
+ var sample = new TA(obj);
+
+ assert(Object.isExtensible(sample));
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/null-tobigint.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/null-tobigint.js
new file mode 100644
index 0000000000..78a81a68fd
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/null-tobigint.js
@@ -0,0 +1,65 @@
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-object
+description: >
+ Return abrupt on null
+info: |
+ TypedArray ( object )
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]]
+ internal slot.
+ ...
+ 8. Repeat, while k < len
+ ...
+ b. Let kValue be ? Get(arrayLike, Pk).
+ c. Perform ? Set(O, Pk, kValue, true).
+ ...
+
+ [[Set]] ( P, V, Receiver)
+ ...
+ 2. If Type(P) is String and if SameValue(O, Receiver) is true, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ i. Perform ? IntegerIndexedElementSet(O, numericIndex, V).
+ ii. Return true.
+ ...
+
+ IntegerIndexedElementSet ( O, index, value )
+
+ Assert: O is an Integer-Indexed exotic object.
+ If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value).
+ Otherwise, let numValue be ? ToNumber(value).
+ Let buffer be O.[[ViewedArrayBuffer]].
+ If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then
+ Let offset be O.[[ByteOffset]].
+ Let arrayTypeName be the String value of O.[[TypedArrayName]].
+ Let elementSize be the Element Size value specified in Table 62 for arrayTypeName.
+ Let indexedPosition be (ℝ(index) × elementSize) + offset.
+ Let elementType be the Element Type value in Table 62 for arrayTypeName.
+ Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered).
+ Return NormalCompletion(undefined).
+
+ ToBigInt ( argument )
+ Object, Apply the following steps:
+ 1. Let prim be ? ToPrimitive(argument, hint Number).
+ 2. Return the value that prim corresponds to in Table [BigInt Conversions]
+
+ BigInt Conversions
+ Argument Type: Null
+ Result: Throw a TypeError exception.
+
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+
+ assert.throws(TypeError, function() {
+ new TA([null]);
+ }, "abrupt completion from Null");
+
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/number-tobigint.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/number-tobigint.js
new file mode 100644
index 0000000000..caedd3ca5d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/number-tobigint.js
@@ -0,0 +1,93 @@
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-object
+description: >
+ Return abrupt on Number
+info: |
+ 22.2.4.4 TypedArray ( object )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]]
+ internal slot.
+
+ ...
+ 8. Repeat, while k < len
+ ...
+ b. Let kValue be ? Get(arrayLike, Pk).
+ c. Perform ? Set(O, Pk, kValue, true).
+ ...
+
+ 9.4.5.5 [[Set]] ( P, V, Receiver)
+
+ ...
+ 2. If Type(P) is String and if SameValue(O, Receiver) is true, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ i. Perform ? IntegerIndexedElementSet(O, numericIndex, V).
+ ii. Return true.
+ ...
+
+ IntegerIndexedElementSet ( O, index, value )
+
+ Assert: O is an Integer-Indexed exotic object.
+ If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value).
+ Otherwise, let numValue be ? ToNumber(value).
+ Let buffer be O.[[ViewedArrayBuffer]].
+ If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then
+ Let offset be O.[[ByteOffset]].
+ Let arrayTypeName be the String value of O.[[TypedArrayName]].
+ Let elementSize be the Element Size value specified in Table 62 for arrayTypeName.
+ Let indexedPosition be (ℝ(index) × elementSize) + offset.
+ Let elementType be the Element Type value in Table 62 for arrayTypeName.
+ Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered).
+ Return NormalCompletion(undefined).
+
+ ToBigInt ( argument )
+
+ Object, Apply the following steps:
+ 1. Let prim be ? ToPrimitive(argument, hint Number).
+ 2. Return the value that prim corresponds to in Table [BigInt Conversions]
+
+ BigInt Conversions
+ Argument Type: Number
+ Result: Throw a TypeError exception.
+
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+
+ assert.throws(TypeError, function() {
+ new TA([1]);
+ }, "abrupt completion from Number: 1");
+
+ assert.throws(TypeError, function() {
+ new TA([Math.pow(2, 63)]);
+ }, "abrupt completion from Number: 2**63");
+
+ assert.throws(TypeError, function() {
+ new TA([+0]);
+ }, "abrupt completion from Number: +0");
+
+ assert.throws(TypeError, function() {
+ new TA([-0]);
+ }, "abrupt completion from Number: -0");
+
+ assert.throws(TypeError, function() {
+ new TA([Infinity]);
+ }, "abrupt completion from Number: Infinity");
+
+ assert.throws(TypeError, function() {
+ new TA([-Infinity]);
+ }, "abrupt completion from Number: -Infinity");
+
+ assert.throws(TypeError, function() {
+ new TA([NaN]);
+ }, "abrupt completion from Number: NaN");
+
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/proto-from-ctor-realm.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/proto-from-ctor-realm.js
new file mode 100644
index 0000000000..36c1419438
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/proto-from-ctor-realm.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-object
+description: Default [[Prototype]] value derived from realm of the newTarget
+info: |
+ [...]
+ 4. Let O be ? AllocateTypedArray(constructorName, NewTarget,
+ "%TypedArrayPrototype%").
+ [...]
+
+ 22.2.4.2.1 Runtime Semantics: AllocateTypedArray
+
+ 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto).
+ [...]
+
+ 9.1.14 GetPrototypeFromConstructor
+
+ [...]
+ 3. Let proto be ? Get(constructor, "prototype").
+ 4. If Type(proto) is not Object, then
+ a. Let realm be ? GetFunctionRealm(constructor).
+ b. Let proto be realm's intrinsic object named intrinsicDefaultProto.
+ 5. Return proto.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, cross-realm, Reflect, TypedArray]
+---*/
+
+var other = $262.createRealm().global;
+var C = new other.Function();
+C.prototype = null;
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var ta = Reflect.construct(TA, [{}], C);
+
+ assert.sameValue(Object.getPrototypeOf(ta), other[TA.name].prototype);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/shell.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/shell.js
new file mode 100644
index 0000000000..90ee9c114d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/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/TypedArrayConstructors/ctors-bigint/object-arg/string-nan-tobigint.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/string-nan-tobigint.js
new file mode 100644
index 0000000000..f117b1c110
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/string-nan-tobigint.js
@@ -0,0 +1,72 @@
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-object
+description: >
+ Return abrupt String, when StringToBigInt returns NaN
+info: |
+ 22.2.4.4 TypedArray ( object )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]]
+ internal slot.
+
+ ...
+ 8. Repeat, while k < len
+ ...
+ b. Let kValue be ? Get(arrayLike, Pk).
+ c. Perform ? Set(O, Pk, kValue, true).
+ ...
+
+ 9.4.5.5 [[Set]] ( P, V, Receiver)
+
+ ...
+ 2. If Type(P) is String and if SameValue(O, Receiver) is true, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ i. Perform ? IntegerIndexedElementSet(O, numericIndex, V).
+ ii. Return true.
+ ...
+
+ IntegerIndexedElementSet ( O, index, value )
+
+ Assert: O is an Integer-Indexed exotic object.
+ If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value).
+ Otherwise, let numValue be ? ToNumber(value).
+ Let buffer be O.[[ViewedArrayBuffer]].
+ If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then
+ Let offset be O.[[ByteOffset]].
+ Let arrayTypeName be the String value of O.[[TypedArrayName]].
+ Let elementSize be the Element Size value specified in Table 62 for arrayTypeName.
+ Let indexedPosition be (ℝ(index) × elementSize) + offset.
+ Let elementType be the Element Type value in Table 62 for arrayTypeName.
+ Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered).
+ Return NormalCompletion(undefined).
+
+ ToBigInt ( argument )
+
+ Object, Apply the following steps:
+ 1. Let prim be ? ToPrimitive(argument, hint Number).
+ 2. Return the value that prim corresponds to in Table [BigInt Conversions]
+
+ BigInt Conversions
+ Argument Type: String
+ Result:
+ 1. Let n be StringToBigInt(prim).
+ 2. If n is NaN, throw a SyntaxError exception.
+ 3. Return n.
+
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+
+ assert.throws(SyntaxError, function() {
+ new TA(["definately not a number"]);
+ }, "StringToBigInt(prim) == NaN");
+
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/string-tobigint.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/string-tobigint.js
new file mode 100644
index 0000000000..631f126299
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/string-tobigint.js
@@ -0,0 +1,88 @@
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-object
+description: >
+ Behavior for input array of Strings, successful conversion
+info: |
+ 22.2.4.4 TypedArray ( object )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]]
+ internal slot.
+
+ ...
+ 8. Repeat, while k < len
+ ...
+ b. Let kValue be ? Get(arrayLike, Pk).
+ c. Perform ? Set(O, Pk, kValue, true).
+ ...
+
+ 9.4.5.5 [[Set]] ( P, V, Receiver)
+
+ ...
+ 2. If Type(P) is String and if SameValue(O, Receiver) is true, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ i. Perform ? IntegerIndexedElementSet(O, numericIndex, V).
+ ii. Return true.
+ ...
+
+ IntegerIndexedElementSet ( O, index, value )
+
+ Assert: O is an Integer-Indexed exotic object.
+ If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value).
+ Otherwise, let numValue be ? ToNumber(value).
+ Let buffer be O.[[ViewedArrayBuffer]].
+ If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then
+ Let offset be O.[[ByteOffset]].
+ Let arrayTypeName be the String value of O.[[TypedArrayName]].
+ Let elementSize be the Element Size value specified in Table 62 for arrayTypeName.
+ Let indexedPosition be (ℝ(index) × elementSize) + offset.
+ Let elementType be the Element Type value in Table 62 for arrayTypeName.
+ Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered).
+ Return NormalCompletion(undefined).
+
+ ToBigInt ( argument )
+
+ Object, Apply the following steps:
+ 1. Let prim be ? ToPrimitive(argument, hint Number).
+ 2. Return the value that prim corresponds to in Table [BigInt Conversions]
+
+ BigInt Conversions
+ Argument Type: String
+ Result:
+ 1. Let n be StringToBigInt(prim).
+ 2. If n is NaN, throw a SyntaxError exception.
+ 3. Return n.
+
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var typedArray = new TA(['', '1']);
+
+ assert.sameValue(typedArray[0], 0n);
+ assert.sameValue(typedArray[1], 1n);
+
+ assert.throws(SyntaxError, function() {
+ new TA(["1n"]);
+ }, "A StringNumericLiteral may not include a BigIntLiteralSuffix.");
+
+ assert.throws(SyntaxError, function() {
+ new TA(["Infinity"]);
+ }, "Replace the StrUnsignedDecimalLiteral production with DecimalDigits to not allow Infinity..");
+
+ assert.throws(SyntaxError, function() {
+ new TA(["1.1"]);
+ }, "Replace the StrUnsignedDecimalLiteral production with DecimalDigits to not allow... decimal points...");
+
+ assert.throws(SyntaxError, function() {
+ new TA(["1e7"]);
+ }, "Replace the StrUnsignedDecimalLiteral production with DecimalDigits to not allow... exponents...");
+
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/symbol-tobigint.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/symbol-tobigint.js
new file mode 100644
index 0000000000..4315e69e0d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/symbol-tobigint.js
@@ -0,0 +1,71 @@
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-object
+description: >
+ Return abrupt on Symbol
+info: |
+ 22.2.4.4 TypedArray ( object )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]]
+ internal slot.
+
+ ...
+ 8. Repeat, while k < len
+ ...
+ b. Let kValue be ? Get(arrayLike, Pk).
+ c. Perform ? Set(O, Pk, kValue, true).
+ ...
+
+ 9.4.5.5 [[Set]] ( P, V, Receiver)
+
+ ...
+ 2. If Type(P) is String and if SameValue(O, Receiver) is true, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ i. Perform ? IntegerIndexedElementSet(O, numericIndex, V).
+ ii. Return true.
+ ...
+
+ IntegerIndexedElementSet ( O, index, value )
+
+ Assert: O is an Integer-Indexed exotic object.
+ If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value).
+ Otherwise, let numValue be ? ToNumber(value).
+ Let buffer be O.[[ViewedArrayBuffer]].
+ If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then
+ Let offset be O.[[ByteOffset]].
+ Let arrayTypeName be the String value of O.[[TypedArrayName]].
+ Let elementSize be the Element Size value specified in Table 62 for arrayTypeName.
+ Let indexedPosition be (ℝ(index) × elementSize) + offset.
+ Let elementType be the Element Type value in Table 62 for arrayTypeName.
+ Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered).
+ Return NormalCompletion(undefined).
+
+ ToBigInt ( argument )
+
+ Object, Apply the following steps:
+ 1. Let prim be ? ToPrimitive(argument, hint Number).
+ 2. Return the value that prim corresponds to in Table [BigInt Conversions]
+
+ BigInt Conversions
+ Argument Type: Symbol
+ Result: Throw a TypeError exception.
+
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray, Symbol]
+---*/
+
+var s = Symbol()
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+
+ assert.throws(TypeError, function() {
+ new TA([s]);
+ }, "abrupt completion from Symbol");
+
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-from-property.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-from-property.js
new file mode 100644
index 0000000000..3b6564b2f5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-from-property.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-object
+description: >
+ Return abrupt from getting object property
+info: |
+ 22.2.4.4 TypedArray ( object )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]]
+ internal slot.
+
+ ...
+ 8. Repeat, while k < len
+ ...
+ b. Let kValue be ? Get(arrayLike, Pk).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var obj = {
+ length: 4
+};
+
+Object.defineProperty(obj, "2", {
+ get() {
+ throw new Test262Error();
+ }
+});
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ obj[0] = 0n;
+ obj[1] = 0n;
+ assert.throws(Test262Error, function() {
+ new TA(obj);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-to-primitive-typeerror.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-to-primitive-typeerror.js
new file mode 100644
index 0000000000..a2b1f6c1f7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-to-primitive-typeerror.js
@@ -0,0 +1,88 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-object
+description: >
+ Throw TypeError from @@toPrimitive returning an Object when setting a property
+info: |
+ 22.2.4.4 TypedArray ( object )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]]
+ internal slot.
+
+ ...
+ 8. Repeat, while k < len
+ ...
+ b. Let kValue be ? Get(arrayLike, Pk).
+ c. Perform ? Set(O, Pk, kValue, true).
+ ...
+
+ 9.4.5.5 [[Set]] ( P, V, Receiver)
+
+ ...
+ 2. If Type(P) is String and if SameValue(O, Receiver) is true, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ i. Perform ? IntegerIndexedElementSet(O, numericIndex, V).
+ ii. Return true.
+ ...
+
+ IntegerIndexedElementSet ( O, index, value )
+
+ Assert: O is an Integer-Indexed exotic object.
+ If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value).
+ Otherwise, let numValue be ? ToNumber(value).
+ Let buffer be O.[[ViewedArrayBuffer]].
+ If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then
+ Let offset be O.[[ByteOffset]].
+ Let arrayTypeName be the String value of O.[[TypedArrayName]].
+ Let elementSize be the Element Size value specified in Table 62 for arrayTypeName.
+ Let indexedPosition be (ℝ(index) × elementSize) + offset.
+ Let elementType be the Element Type value in Table 62 for arrayTypeName.
+ Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered).
+ Return NormalCompletion(undefined).
+
+ ToBigInt ( argument )
+
+ Object, Apply the following steps:
+ 1. Let prim be ? ToPrimitive(argument, hint Number).
+ 2. Return the value that prim corresponds to in Table 10.
+
+ 7.1.1 ToPrimitive ( input [ , PreferredType ] )
+
+ ...
+ 4. Let exoticToPrim be ? GetMethod(input, @@toPrimitive).
+ 5. If exoticToPrim is not undefined, then
+ a. Let result be ? Call(exoticToPrim, input, « hint »).
+ b. If Type(result) is not Object, return result.
+ c. Throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol.toPrimitive, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new Int8Array(1);
+ var toPrimitive = 0;
+ var valueOf = 0;
+
+ sample[Symbol.toPrimitive] = function() {
+ toPrimitive++;
+ return {};
+ };
+
+ sample.valueOf = function() {
+ valueOf++;
+ };
+
+ assert.throws(TypeError, function() {
+ new TA([8n, sample]);
+ }, "abrupt completion from sample @@toPrimitive");
+
+ assert.sameValue(toPrimitive, 1, "toPrimitive was called once");
+ assert.sameValue(valueOf, 0, "sample.valueOf is not called");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-to-primitive.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-to-primitive.js
new file mode 100644
index 0000000000..1a6627e153
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-to-primitive.js
@@ -0,0 +1,86 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-object
+description: >
+ Return abrupt from @@toPrimitive when setting a property
+info: |
+ 22.2.4.4 TypedArray ( object )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]]
+ internal slot.
+
+ ...
+ 8. Repeat, while k < len
+ ...
+ b. Let kValue be ? Get(arrayLike, Pk).
+ c. Perform ? Set(O, Pk, kValue, true).
+ ...
+
+ 9.4.5.5 [[Set]] ( P, V, Receiver)
+
+ ...
+ 2. If Type(P) is String and if SameValue(O, Receiver) is true, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ i. Perform ? IntegerIndexedElementSet(O, numericIndex, V).
+ ii. Return true.
+ ...
+
+ IntegerIndexedElementSet ( O, index, value )
+
+ Assert: O is an Integer-Indexed exotic object.
+ If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value).
+ Otherwise, let numValue be ? ToNumber(value).
+ Let buffer be O.[[ViewedArrayBuffer]].
+ If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then
+ Let offset be O.[[ByteOffset]].
+ Let arrayTypeName be the String value of O.[[TypedArrayName]].
+ Let elementSize be the Element Size value specified in Table 62 for arrayTypeName.
+ Let indexedPosition be (ℝ(index) × elementSize) + offset.
+ Let elementType be the Element Type value in Table 62 for arrayTypeName.
+ Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered).
+ Return NormalCompletion(undefined).
+
+ ToBigInt ( argument )
+
+ Object, Apply the following steps:
+ 1. Let prim be ? ToPrimitive(argument, hint Number).
+ 2. Return the value that prim corresponds to in Table 10.
+
+ 7.1.1 ToPrimitive ( input [ , PreferredType ] )
+
+ ...
+ 4. Let exoticToPrim be ? GetMethod(input, @@toPrimitive).
+ 5. If exoticToPrim is not undefined, then
+ a. Let result be ? Call(exoticToPrim, input, « hint »).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol.toPrimitive, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new Int8Array(1);
+ var toPrimitive = 0;
+ var valueOf = 0;
+
+ sample[Symbol.toPrimitive] = function() {
+ toPrimitive++;
+ throw new Test262Error();
+ };
+
+ sample.valueOf = function() {
+ valueOf++;
+ };
+
+ assert.throws(Test262Error, function() {
+ new TA([8n, sample]);
+ }, "abrupt completion from sample @@toPrimitive");
+
+ assert.sameValue(toPrimitive, 1, "toPrimitive was called once");
+ assert.sameValue(valueOf, 0, "it does not call sample.valueOf");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-tostring.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-tostring.js
new file mode 100644
index 0000000000..dee658572f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-tostring.js
@@ -0,0 +1,99 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-object
+description: >
+ Return abrupt from toString() when setting a property
+info: |
+ 22.2.4.4 TypedArray ( object )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]]
+ internal slot.
+
+ ...
+ 8. Repeat, while k < len
+ ...
+ b. Let kValue be ? Get(arrayLike, Pk).
+ c. Perform ? Set(O, Pk, kValue, true).
+ ...
+
+ 9.4.5.5 [[Set]] ( P, V, Receiver)
+
+ ...
+ 2. If Type(P) is String and if SameValue(O, Receiver) is true, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ i. Perform ? IntegerIndexedElementSet(O, numericIndex, V).
+ ii. Return true.
+ ...
+
+ IntegerIndexedElementSet ( O, index, value )
+
+ Assert: O is an Integer-Indexed exotic object.
+ If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value).
+ Otherwise, let numValue be ? ToNumber(value).
+ Let buffer be O.[[ViewedArrayBuffer]].
+ If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then
+ Let offset be O.[[ByteOffset]].
+ Let arrayTypeName be the String value of O.[[TypedArrayName]].
+ Let elementSize be the Element Size value specified in Table 62 for arrayTypeName.
+ Let indexedPosition be (ℝ(index) × elementSize) + offset.
+ Let elementType be the Element Type value in Table 62 for arrayTypeName.
+ Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered).
+ Return NormalCompletion(undefined).
+
+ ToBigInt ( argument )
+
+ Object, Apply the following steps:
+ 1. Let prim be ? ToPrimitive(argument, hint Number).
+ 2. Return the value that prim corresponds to in Table 10.
+
+ 7.1.1 ToPrimitive ( input [ , PreferredType ] )
+
+ ...
+ 4. Let exoticToPrim be ? GetMethod(input, @@toPrimitive).
+ 5. If exoticToPrim is not undefined, then
+ a. Let result be ? Call(exoticToPrim, input, « hint »).
+ b. If Type(result) is not Object, return result.
+ c. Throw a TypeError exception.
+ ...
+ 7. Return ? OrdinaryToPrimitive(input, hint).
+
+ OrdinaryToPrimitive
+
+ ...
+ 5. For each name in methodNames in List order, do
+ a. Let method be ? Get(O, name).
+ b. If IsCallable(method) is true, then
+ i. Let result be ? Call(method, O).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new Int8Array(1);
+ var valueOf = 0;
+ var toString = 0;
+
+ sample.valueOf = function() {
+ valueOf++;
+ return {};
+ };
+
+ sample.toString = function() {
+ toString++;
+ throw new Test262Error();
+ };
+
+ assert.throws(Test262Error, function() {
+ new TA([8n, sample]);
+ }, "abrupt completion from ToBigInt(sample)");
+
+ assert.sameValue(valueOf, 1, "valueOf called once");
+ assert.sameValue(toString, 1, "toString called once");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-valueof-typeerror.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-valueof-typeerror.js
new file mode 100644
index 0000000000..b0bae2c1bb
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-valueof-typeerror.js
@@ -0,0 +1,100 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-object
+description: >
+ Throw TypeError from OrdinaryToPrimitive when setting a property
+info: |
+ 22.2.4.4 TypedArray ( object )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]]
+ internal slot.
+
+ ...
+ 8. Repeat, while k < len
+ ...
+ b. Let kValue be ? Get(arrayLike, Pk).
+ c. Perform ? Set(O, Pk, kValue, true).
+ ...
+
+ 9.4.5.5 [[Set]] ( P, V, Receiver)
+
+ ...
+ 2. If Type(P) is String and if SameValue(O, Receiver) is true, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ i. Perform ? IntegerIndexedElementSet(O, numericIndex, V).
+ ii. Return true.
+ ...
+
+ IntegerIndexedElementSet ( O, index, value )
+
+ Assert: O is an Integer-Indexed exotic object.
+ If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value).
+ Otherwise, let numValue be ? ToNumber(value).
+ Let buffer be O.[[ViewedArrayBuffer]].
+ If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then
+ Let offset be O.[[ByteOffset]].
+ Let arrayTypeName be the String value of O.[[TypedArrayName]].
+ Let elementSize be the Element Size value specified in Table 62 for arrayTypeName.
+ Let indexedPosition be (ℝ(index) × elementSize) + offset.
+ Let elementType be the Element Type value in Table 62 for arrayTypeName.
+ Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered).
+ Return NormalCompletion(undefined).
+
+ ToBigInt ( argument )
+
+ Object, Apply the following steps:
+ 1. Let prim be ? ToPrimitive(argument, hint Number).
+ 2. Return the value that prim corresponds to in Table 10.
+
+ 7.1.1 ToPrimitive ( input [ , PreferredType ] )
+
+ ...
+ 4. Let exoticToPrim be ? GetMethod(input, @@toPrimitive).
+ 5. If exoticToPrim is not undefined, then
+ a. Let result be ? Call(exoticToPrim, input, « hint »).
+ b. If Type(result) is not Object, return result.
+ c. Throw a TypeError exception.
+ ...
+ 7. Return ? OrdinaryToPrimitive(input, hint).
+
+ OrdinaryToPrimitive
+
+ ...
+ 5. For each name in methodNames in List order, do
+ a. Let method be ? Get(O, name).
+ b. If IsCallable(method) is true, then
+ i. Let result be ? Call(method, O).
+ ii. If Type(result) is not Object, return result.
+ 6. Throw a TypeError exception.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new Int8Array(1);
+ var valueOf = 0;
+ var toString = 0;
+
+ sample.valueOf = function() {
+ valueOf++;
+ return {};
+ };
+
+ sample.toString = function() {
+ toString++;
+ return {};
+ };
+
+ assert.throws(TypeError, function() {
+ new TA([8n, sample]);
+ }, "abrupt completion from ToBigInt(sample)");
+
+ assert.sameValue(valueOf, 1, "valueOf called once");
+ assert.sameValue(toString, 1, "toString called once");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-valueof.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-valueof.js
new file mode 100644
index 0000000000..b2eaa9904d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-valueof.js
@@ -0,0 +1,93 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-object
+description: >
+ Return abrupt from valueOf() when setting a property
+info: |
+ 22.2.4.4 TypedArray ( object )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]]
+ internal slot.
+
+ ...
+ 8. Repeat, while k < len
+ ...
+ b. Let kValue be ? Get(arrayLike, Pk).
+ c. Perform ? Set(O, Pk, kValue, true).
+ ...
+
+ 9.4.5.5 [[Set]] ( P, V, Receiver)
+
+ ...
+ 2. If Type(P) is String and if SameValue(O, Receiver) is true, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ i. Perform ? IntegerIndexedElementSet(O, numericIndex, V).
+ ii. Return true.
+ ...
+
+ IntegerIndexedElementSet ( O, index, value )
+
+ Assert: O is an Integer-Indexed exotic object.
+ If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value).
+ Otherwise, let numValue be ? ToNumber(value).
+ Let buffer be O.[[ViewedArrayBuffer]].
+ If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then
+ Let offset be O.[[ByteOffset]].
+ Let arrayTypeName be the String value of O.[[TypedArrayName]].
+ Let elementSize be the Element Size value specified in Table 62 for arrayTypeName.
+ Let indexedPosition be (ℝ(index) × elementSize) + offset.
+ Let elementType be the Element Type value in Table 62 for arrayTypeName.
+ Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered).
+ Return NormalCompletion(undefined).
+
+ ToBigInt ( argument )
+
+ Object, Apply the following steps:
+ 1. Let prim be ? ToPrimitive(argument, hint Number).
+ 2. Return the value that prim corresponds to in Table 10.
+
+ 7.1.1 ToPrimitive ( input [ , PreferredType ] )
+
+ ...
+ 4. Let exoticToPrim be ? GetMethod(input, @@toPrimitive).
+ 5. If exoticToPrim is not undefined, then
+ a. Let result be ? Call(exoticToPrim, input, « hint »).
+ b. If Type(result) is not Object, return result.
+ c. Throw a TypeError exception.
+ ...
+ 7. Return ? OrdinaryToPrimitive(input, hint).
+
+ OrdinaryToPrimitive
+
+ ...
+ 5. For each name in methodNames in List order, do
+ a. Let method be ? Get(O, name).
+ b. If IsCallable(method) is true, then
+ i. Let result be ? Call(method, O).
+ ii. If Type(result) is not Object, return result.
+ 6. Throw a TypeError exception.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new Int8Array(1);
+ var valueOf = 0;
+
+ sample.valueOf = function() {
+ valueOf++;
+ throw new Test262Error();
+ };
+
+ assert.throws(Test262Error, function() {
+ new TA([8n, sample]);
+ }, "abrupt completion from ToBigInt(sample)");
+
+ assert.sameValue(valueOf, 1, "valueOf called once");
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-property.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-property.js
new file mode 100644
index 0000000000..e56a95c7f5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-property.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-object
+description: >
+ Return abrupt from setting property
+info: |
+ 22.2.4.4 TypedArray ( object )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]]
+ internal slot.
+
+ ...
+ 8. Repeat, while k < len
+ ...
+ b. Let kValue be ? Get(arrayLike, Pk).
+ c. Perform ? Set(O, Pk, kValue, true).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var obj = {
+ "2": {
+ valueOf() {
+ throw new Test262Error();
+ }
+ },
+ length: 4
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ obj[0] = 0n;
+ obj[1] = 0n;
+ assert.throws(Test262Error, function() {
+ new TA(obj);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-symbol-property.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-symbol-property.js
new file mode 100644
index 0000000000..7094f1b416
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-symbol-property.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-object
+description: >
+ Return abrupt from setting property
+info: |
+ 22.2.4.4 TypedArray ( object )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]]
+ internal slot.
+
+ ...
+ 8. Repeat, while k < len
+ ...
+ b. Let kValue be ? Get(arrayLike, Pk).
+ c. Perform ? Set(O, Pk, kValue, true).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var obj = {
+ "2": Symbol("1"),
+ length: 4
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert.throws(TypeError, function() {
+ new TA(obj);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/undefined-newtarget-throws.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/undefined-newtarget-throws.js
new file mode 100644
index 0000000000..9e8d92fb0f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/undefined-newtarget-throws.js
@@ -0,0 +1,32 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-object
+description: >
+ Throws a TypeError if NewTarget is undefined.
+info: |
+ 22.2.4.4 TypedArray ( object )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]]
+ internal slot.
+
+ ...
+ 2. If NewTarget is undefined, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert.throws(TypeError, function() {
+ TA({});
+ });
+
+ assert.throws(TypeError, function() {
+ TA([]);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/undefined-tobigint.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/undefined-tobigint.js
new file mode 100644
index 0000000000..5ae317141e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/undefined-tobigint.js
@@ -0,0 +1,65 @@
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-object
+description: >
+ Return abrupt on undefined
+info: |
+ TypedArray ( object )
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]]
+ internal slot.
+ ...
+ 8. Repeat, while k < len
+ ...
+ b. Let kValue be ? Get(arrayLike, Pk).
+ c. Perform ? Set(O, Pk, kValue, true).
+ ...
+
+ [[Set]] ( P, V, Receiver)
+ ...
+ 2. If Type(P) is String and if SameValue(O, Receiver) is true, then
+ a. Let numericIndex be ! CanonicalNumericIndexString(P).
+ b. If numericIndex is not undefined, then
+ i. Perform ? IntegerIndexedElementSet(O, numericIndex, V).
+ ii. Return true.
+ ...
+
+ IntegerIndexedElementSet ( O, index, value )
+
+ Assert: O is an Integer-Indexed exotic object.
+ If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value).
+ Otherwise, let numValue be ? ToNumber(value).
+ Let buffer be O.[[ViewedArrayBuffer]].
+ If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then
+ Let offset be O.[[ByteOffset]].
+ Let arrayTypeName be the String value of O.[[TypedArrayName]].
+ Let elementSize be the Element Size value specified in Table 62 for arrayTypeName.
+ Let indexedPosition be (ℝ(index) × elementSize) + offset.
+ Let elementType be the Element Type value in Table 62 for arrayTypeName.
+ Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered).
+ Return NormalCompletion(undefined).
+
+ ToBigInt ( argument )
+ Object, Apply the following steps:
+ 1. Let prim be ? ToPrimitive(argument, hint Number).
+ 2. Return the value that prim corresponds to in Table [BigInt Conversions]
+
+ BigInt Conversions
+ Argument Type: Undefined
+ Result: Throw a TypeError exception.
+
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+
+ assert.throws(TypeError, function() {
+ new TA([undefined]);
+ }, "abrupt completion from undefined");
+
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/use-custom-proto-if-object.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/use-custom-proto-if-object.js
new file mode 100644
index 0000000000..ee60d97474
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/use-custom-proto-if-object.js
@@ -0,0 +1,49 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-object
+description: >
+ Use prototype from new target if it's an Object
+info: |
+ 22.2.4.4 TypedArray ( object )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]]
+ internal slot.
+
+ ...
+ 3. Let O be ? AllocateTypedArray(TypedArray.[[TypedArrayConstructorName]],
+ NewTarget, "%TypedArrayPrototype%").
+ ...
+
+ 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget,
+ defaultProto [ , length ])
+
+ 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto).
+ 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]],
+ [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ).
+ ...
+
+ 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList)
+
+ ...
+ 10. Set the [[Prototype]] internal slot of A to prototype.
+ ...
+ 12. Return A.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Reflect, TypedArray]
+---*/
+
+function newTarget() {}
+var proto = {};
+newTarget.prototype = proto;
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var ta = Reflect.construct(TA, [], newTarget);
+
+ assert.sameValue(ta.constructor, Object);
+ assert.sameValue(Object.getPrototypeOf(ta), proto);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/use-default-proto-if-custom-proto-is-not-object.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/use-default-proto-if-custom-proto-is-not-object.js
new file mode 100644
index 0000000000..4855ab6159
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/use-default-proto-if-custom-proto-is-not-object.js
@@ -0,0 +1,49 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-object
+description: >
+ Use prototype from %TypedArray% if newTarget's prototype is not an Object
+info: |
+ 22.2.4.4 TypedArray ( object )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object does not have either a [[TypedArrayName]] or an [[ArrayBufferData]]
+ internal slot.
+
+ ...
+ 3. Let O be ? AllocateTypedArray(TypedArray.[[TypedArrayConstructorName]],
+ NewTarget, "%TypedArrayPrototype%").
+ ...
+
+ 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget,
+ defaultProto [ , length ])
+
+ 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto).
+ 2. Let obj be IntegerIndexedObjectCreate (proto, «[[ViewedArrayBuffer]],
+ [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]]» ).
+ ...
+
+ 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList)
+
+ ...
+ 10. Set the [[Prototype]] internal slot of A to prototype.
+ ...
+ 12. Return A.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+function newTarget() {}
+newTarget.prototype = null;
+var o = [];
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var ta = Reflect.construct(TA, [o], newTarget);
+
+ assert.sameValue(ta.constructor, TA);
+ assert.sameValue(Object.getPrototypeOf(ta), TA.prototype);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/shell.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/shell.js
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/browser.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/browser.js
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/custom-proto-access-throws.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/custom-proto-access-throws.js
new file mode 100644
index 0000000000..e5c9eb3679
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/custom-proto-access-throws.js
@@ -0,0 +1,49 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-typedarray
+description: >
+ Return abrupt completion getting newTarget's prototype
+info: |
+ 22.2.4.3 TypedArray ( typedArray )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has a [[TypedArrayName]] internal slot.
+
+ ...
+ 4. Let O be ? AllocateTypedArray(constructorName, NewTarget,
+ %TypedArrayPrototype%).
+ ...
+
+ 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget,
+ defaultProto [ , length ])
+
+ 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto).
+ ...
+
+ 9.1.15 GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto )
+
+ ...
+ 3. Let proto be ? Get(constructor, "prototype").
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Reflect, TypedArray]
+---*/
+
+var newTarget = function() {}.bind(null);
+Object.defineProperty(newTarget, "prototype", {
+ get() {
+ throw new Test262Error();
+ }
+});
+
+var sample = new BigInt64Array();
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert.throws(Test262Error, function() {
+ Reflect.construct(TA, [sample], newTarget);
+ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/new-instance-extensibility.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/new-instance-extensibility.js
new file mode 100644
index 0000000000..485ef634d6
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/new-instance-extensibility.js
@@ -0,0 +1,48 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-typedarray
+description: >
+ The new typedArray instance from a typedArray argument is extensible
+info: |
+ 22.2.4.3 TypedArray ( typedArray )
+
+ ...
+ 4. Let O be ? AllocateTypedArray(constructorName, NewTarget,
+ "%TypedArrayPrototype%").
+ ...
+
+ 22.2.4.2.1 Runtime Semantics: AllocateTypedArray (constructorName, newTarget,
+ defaultProto [ , length ])
+
+ ...
+ 2. Let obj be IntegerIndexedObjectCreate(proto, « [[ViewedArrayBuffer]],
+ [[TypedArrayName]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]] »).
+ ...
+
+ 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList)
+
+ ...
+ 11. Set the [[Extensible]] internal slot of A to true.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var typedArraySample1 = new BigInt64Array();
+var typedArraySample2 = new BigInt64Array();
+Object.preventExtensions(typedArraySample2);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample1 = new TA(typedArraySample1);
+
+ assert(Object.isExtensible(sample1), "new instance is extensible");
+
+ var sample2 = new TA(typedArraySample2);
+ assert(
+ Object.isExtensible(sample2),
+ "new instance does not inherit extensibility from typedarray argument"
+ );
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/other-ctor-buffer-ctor-species-null.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/other-ctor-buffer-ctor-species-null.js
new file mode 100644
index 0000000000..7708637ae9
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/other-ctor-buffer-ctor-species-null.js
@@ -0,0 +1,46 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-typedarray
+description: >
+ Use default ArrayBuffer constructor on null buffer.constructor.@@species
+info: |
+ 22.2.4.3 TypedArray ( typedArray )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has a [[TypedArrayName]] internal slot.
+
+ ...
+ 18. Else,
+ a. Let bufferConstructor be ? SpeciesConstructor(srcData, %ArrayBuffer%).
+ ...
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ ...
+ 5. Let S be ? Get(C, @@species).
+ 6. If S is either undefined or null, return defaultConstructor.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var OtherCtor = TA === BigInt64Array ? BigUint64Array : BigInt64Array;
+ var sample = new OtherCtor();
+ var ctor = {};
+
+ sample.buffer.constructor = ctor;
+
+ ctor[Symbol.species] = null;
+ var typedArray = new TA(sample);
+
+ assert.sameValue(
+ Object.getPrototypeOf(typedArray.buffer),
+ ArrayBuffer.prototype,
+ "buffer ctor is not called when species is null"
+ );
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/other-ctor-buffer-ctor-species-undefined.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/other-ctor-buffer-ctor-species-undefined.js
new file mode 100644
index 0000000000..a14374aa2d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/other-ctor-buffer-ctor-species-undefined.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-typedarray
+description: >
+ Use default ArrayBuffer constructor on undefined buffer.constructor.@@species
+info: |
+ 22.2.4.3 TypedArray ( typedArray )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has a [[TypedArrayName]] internal slot.
+
+ ...
+ 18. Else,
+ a. Let bufferConstructor be ? SpeciesConstructor(srcData, %ArrayBuffer%).
+ ...
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ ...
+ 5. Let S be ? Get(C, @@species).
+ 6. If S is either undefined or null, return defaultConstructor.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var OtherCtor = TA === BigInt64Array ? BigUint64Array : BigInt64Array;
+ var sample = new OtherCtor();
+ var ctor = {};
+
+ sample.buffer.constructor = ctor;
+
+ ctor[Symbol.species] = undefined;
+ var a = new TA(sample);
+ assert.sameValue(
+ Object.getPrototypeOf(a.buffer),
+ ArrayBuffer.prototype,
+ "buffer ctor is not called when species is undefined"
+ );
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/other-ctor-returns-new-typedarray.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/other-ctor-returns-new-typedarray.js
new file mode 100644
index 0000000000..f81decd8e1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/other-ctor-returns-new-typedarray.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-typedarray
+description: Instantiate a new TypedArray with an existing TypedArray
+info: |
+ 22.2.4.3 TypedArray ( typedArray )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has a [[TypedArrayName]] internal slot.
+
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var sample1 = new BigInt64Array(7);
+var sample2 = new BigUint64Array(7);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = TA === BigInt64Array ? sample2 : sample1;
+ var typedArray = new TA(sample);
+
+ assert.sameValue(typedArray.length, 7);
+ assert.notSameValue(typedArray, sample);
+ assert.sameValue(typedArray.constructor, TA);
+ assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/proto-from-ctor-realm.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/proto-from-ctor-realm.js
new file mode 100644
index 0000000000..1346caf1fd
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/proto-from-ctor-realm.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-typedarray
+description: Default [[Prototype]] value derived from realm of the newTarget
+info: |
+ [...]
+ 4. Let O be ? AllocateTypedArray(constructorName, NewTarget,
+ "%TypedArrayPrototype%").
+ [...]
+
+ 22.2.4.2.1 Runtime Semantics: AllocateTypedArray
+
+ 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto).
+ [...]
+
+ 9.1.14 GetPrototypeFromConstructor
+
+ [...]
+ 3. Let proto be ? Get(constructor, "prototype").
+ 4. If Type(proto) is not Object, then
+ a. Let realm be ? GetFunctionRealm(constructor).
+ b. Let proto be realm's intrinsic object named intrinsicDefaultProto.
+ 5. Return proto.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, cross-realm, Reflect, TypedArray]
+---*/
+
+var other = $262.createRealm().global;
+var C = new other.Function();
+C.prototype = null;
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var ta = Reflect.construct(TA, [new TA()], C);
+
+ assert.sameValue(Object.getPrototypeOf(ta), other[TA.name].prototype);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/same-ctor-buffer-ctor-species-null.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/same-ctor-buffer-ctor-species-null.js
new file mode 100644
index 0000000000..afc55e0dba
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/same-ctor-buffer-ctor-species-null.js
@@ -0,0 +1,51 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-typedarray
+description: >
+ Use default ArrayBuffer constructor on null buffer.constructor.@@species
+info: |
+ 22.2.4.3 TypedArray ( typedArray )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has a [[TypedArrayName]] internal slot.
+
+ ...
+ 17. If SameValue(elementType, srcType) is true, then
+ a. Let data be ? CloneArrayBuffer(srcData, srcByteOffset).
+ ...
+
+ 24.1.1.4 CloneArrayBuffer ( srcBuffer, srcByteOffset [ , cloneConstructor ] )
+
+ ...
+ 2. If cloneConstructor is not present, then
+ a. Let cloneConstructor be ? SpeciesConstructor(srcBuffer, %ArrayBuffer%).
+ ...
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ ...
+ 5. Let S be ? Get(C, @@species).
+ 6. If S is either undefined or null, return defaultConstructor.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(4);
+ var ctor = {};
+
+ sample.buffer.constructor = ctor;
+
+ ctor[Symbol.species] = null;
+ var typedArray = new TA(sample);
+ assert.sameValue(
+ Object.getPrototypeOf(typedArray.buffer),
+ ArrayBuffer.prototype,
+ "buffer ctor is not called when species is null"
+ );
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/same-ctor-buffer-ctor-species-undefined.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/same-ctor-buffer-ctor-species-undefined.js
new file mode 100644
index 0000000000..a0bd03691e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/same-ctor-buffer-ctor-species-undefined.js
@@ -0,0 +1,51 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-typedarray
+description: >
+ Use default ArrayBuffer constructor on undefined buffer.constructor.@@species
+info: |
+ 22.2.4.3 TypedArray ( typedArray )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has a [[TypedArrayName]] internal slot.
+
+ ...
+ 17. If SameValue(elementType, srcType) is true, then
+ a. Let data be ? CloneArrayBuffer(srcData, srcByteOffset).
+ ...
+
+ 24.1.1.4 CloneArrayBuffer ( srcBuffer, srcByteOffset [ , cloneConstructor ] )
+
+ ...
+ 2. If cloneConstructor is not present, then
+ a. Let cloneConstructor be ? SpeciesConstructor(srcBuffer, %ArrayBuffer%).
+ ...
+
+ 7.3.20 SpeciesConstructor ( O, defaultConstructor )
+
+ ...
+ 5. Let S be ? Get(C, @@species).
+ 6. If S is either undefined or null, return defaultConstructor.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol.species, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(4);
+ var ctor = {};
+
+ sample.buffer.constructor = ctor;
+
+ ctor[Symbol.species] = undefined;
+ var typedArray = new TA(sample);
+ assert.sameValue(
+ Object.getPrototypeOf(typedArray.buffer),
+ ArrayBuffer.prototype,
+ "buffer ctor is not called when species is undefined"
+ );
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/same-ctor-returns-new-cloned-typedarray.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/same-ctor-returns-new-cloned-typedarray.js
new file mode 100644
index 0000000000..9b44fd800d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/same-ctor-returns-new-cloned-typedarray.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-typedarray
+description: >
+ Same typedArray ctor argument returns a new cloned typedArray
+info: |
+ 22.2.4.3 TypedArray ( typedArray )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has a [[TypedArrayName]] internal slot.
+
+ ...
+ 17. If SameValue(elementType, srcType) is true, then
+ a. Let data be ? CloneArrayBuffer(srcData, srcByteOffset).
+ ...
+ 23. Return O.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(7);
+ var typedArray = new TA(sample);
+
+ assert.sameValue(typedArray.length, 7);
+ assert.notSameValue(typedArray, sample);
+ assert.notSameValue(typedArray.buffer, sample.buffer);
+ assert.sameValue(typedArray.constructor, TA);
+ assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/shell.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/shell.js
new file mode 100644
index 0000000000..1157ee5318
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/shell.js
@@ -0,0 +1,166 @@
+// 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;
+ }
+ }
+}
+
+// file: testTypedArray.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 TypedArray objects.
+defines:
+ - typedArrayConstructors
+ - floatArrayConstructors
+ - intArrayConstructors
+ - TypedArray
+ - testWithTypedArrayConstructors
+ - testWithAtomicsFriendlyTypedArrayConstructors
+ - testWithNonAtomicsFriendlyTypedArrayConstructors
+ - testTypedArrayConversions
+---*/
+
+/**
+ * Array containing every typed array constructor.
+ */
+var typedArrayConstructors = [
+ Float64Array,
+ Float32Array,
+ Int32Array,
+ Int16Array,
+ Int8Array,
+ Uint32Array,
+ Uint16Array,
+ Uint8Array,
+ Uint8ClampedArray
+];
+
+var floatArrayConstructors = typedArrayConstructors.slice(0, 2);
+var intArrayConstructors = typedArrayConstructors.slice(2, 7);
+
+/**
+ * The %TypedArray% intrinsic constructor function.
+ */
+var TypedArray = Object.getPrototypeOf(Int8Array);
+
+/**
+ * Callback for testing a typed array constructor.
+ *
+ * @callback typedArrayConstructorCallback
+ * @param {Function} Constructor the constructor object to test with.
+ */
+
+/**
+ * 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 testWithTypedArrayConstructors(f, selected) {
+ var constructors = selected || typedArrayConstructors;
+ 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;
+ }
+ }
+}
+
+/**
+ * Calls the provided function for every non-"Atomics Friendly" 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 testWithNonAtomicsFriendlyTypedArrayConstructors(f) {
+ testWithTypedArrayConstructors(f, [
+ Float64Array,
+ Float32Array,
+ Uint8ClampedArray
+ ]);
+}
+
+/**
+ * Calls the provided function for every "Atomics Friendly" 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 testWithAtomicsFriendlyTypedArrayConstructors(f) {
+ testWithTypedArrayConstructors(f, [
+ Int32Array,
+ Int16Array,
+ Int8Array,
+ Uint32Array,
+ Uint16Array,
+ Uint8Array,
+ ]);
+}
+
+/**
+ * Helper for conversion operations on TypedArrays, the expected values
+ * properties are indexed in order to match the respective value for each
+ * TypedArray constructor
+ * @param {Function} fn - the function to call for each constructor and value.
+ * will be called with the constructor, value, expected
+ * value, and a initial value that can be used to avoid
+ * a false positive with an equivalent expected value.
+ */
+function testTypedArrayConversions(byteConversionValues, fn) {
+ var values = byteConversionValues.values;
+ var expected = byteConversionValues.expected;
+
+ testWithTypedArrayConstructors(function(TA) {
+ var name = TA.name.slice(0, -5);
+
+ return values.forEach(function(value, index) {
+ var exp = expected[name][index];
+ var initial = 0;
+ if (exp === 0) {
+ initial = 1;
+ }
+ fn(TA, value, exp, initial);
+ });
+ });
+}
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/src-typedarray-not-big-throws.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/src-typedarray-not-big-throws.js
new file mode 100644
index 0000000000..385307c130
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/src-typedarray-not-big-throws.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-typedarray
+description: >
+ If typedArray constructor argument is not a Big(U)Int, throw
+info: |
+ 22.2.4.3 TypedArray ( typedArray )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has a [[TypedArrayName]] internal slot.
+
+ ...
+ 19. Else,
+ ...
+ c. If one of srcType and elementType contains the substring "Big" and the other
+ does not, throw a TypeError exception.
+
+includes: [testBigIntTypedArray.js, testTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var notBigTypedArray;
+
+testWithTypedArrayConstructors(function(TA) {
+
+ notBigTypedArray = new TA(16);
+
+ testWithBigIntTypedArrayConstructors(function(BTA) {
+ assert.throws(TypeError, function() {
+ new BTA(notBigTypedArray);
+ });
+ });
+
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/undefined-newtarget-throws.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/undefined-newtarget-throws.js
new file mode 100644
index 0000000000..d664255beb
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/typedarray-arg/undefined-newtarget-throws.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-typedarray-typedarray
+description: >
+ Throws a TypeError if NewTarget is undefined.
+info: |
+ 22.2.4.3 TypedArray ( typedArray )
+
+ This description applies only if the TypedArray function is called with at
+ least one argument and the Type of the first argument is Object and that
+ object has a [[TypedArrayName]] internal slot.
+
+ ...
+ 2. If NewTarget is undefined, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var typedArray = new TA(4);
+
+ assert.throws(TypeError, function() {
+ TA(typedArray);
+ });
+});
+
+reportCompare(0, 0);