-
Notifications
You must be signed in to change notification settings - Fork 452
/
typed-array-prototype.js
53 lines (45 loc) · 1.14 KB
/
typed-array-prototype.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Copyright 2021 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-arraybuffer-length
description: >
Automatically ported from TypedArrayPrototype test
in V8's mjsunit test typedarray-resizablearraybuffer.js
features: [resizable-arraybuffer]
flags: [onlyStrict]
---*/
class MyUint8Array extends Uint8Array {
}
class MyFloat32Array extends Float32Array {
}
class MyBigInt64Array extends BigInt64Array {
}
const builtinCtors = [
Uint8Array,
Int8Array,
Uint16Array,
Int16Array,
Uint32Array,
Int32Array,
Float32Array,
Float64Array,
Uint8ClampedArray,
BigUint64Array,
BigInt64Array
];
const ctors = [
...builtinCtors,
MyUint8Array,
MyFloat32Array,
MyBigInt64Array
];
function CreateResizableArrayBuffer(byteLength, maxByteLength) {
return new ArrayBuffer(byteLength, { maxByteLength: maxByteLength });
}
const rab = CreateResizableArrayBuffer(40, 80);
const ab = new ArrayBuffer(80);
for (let ctor of ctors) {
const ta_rab = new ctor(rab, 0, 3);
const ta_ab = new ctor(ab, 0, 3);
assert.sameValue(ta_ab.__proto__, ta_rab.__proto__);
}