1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
4 esid: sec-get-%typedarray%.prototype.byteoffset
6 Return value from [[ByteOffset]] internal slot
8 22.2.3.3 get %TypedArray%.prototype.byteOffset
11 6. Let offset be the value of O's [[ByteOffset]] internal slot.
13 includes: [testTypedArray.js]
14 features: [TypedArray]
17 testWithTypedArrayConstructors(function(TA) {
19 assert.sameValue(ta1.byteOffset, 0, "Regular typedArray");
21 var offset = 4 * TA.BYTES_PER_ELEMENT;
23 var buffer1 = new ArrayBuffer(8 * TA.BYTES_PER_ELEMENT);
24 var ta2 = new TA(buffer1, offset);
25 assert.sameValue(ta2.byteOffset, offset, "TA(buffer, offset)");
27 var buffer2 = new ArrayBuffer(8 * TA.BYTES_PER_ELEMENT);
28 var sample = new TA(buffer2, offset);
29 var ta3 = new TA(sample);
30 assert.sameValue(ta3.byteOffset, 0, "TA(typedArray)");