Skip to content

Commit 9aa6bad

Browse files
authored
Merge branch 'main' into addDuration
2 parents 56e461f + 72ff7d1 commit 9aa6bad

File tree

1,038 files changed

+30807
-17348
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,038 files changed

+30807
-17348
lines changed

features.txt

-4
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515
# https://github.com/tc39/proposal-intl-locale-info
1616
Intl.Locale-info
1717

18-
# FinalizationRegistry#cleanupSome
19-
# https://github.com/tc39/proposal-cleanup-some
20-
FinalizationRegistry.prototype.cleanupSome
21-
2218
# Intl.NumberFormat V3
2319
# https://github.com/tc39/proposal-intl-numberformat-v3
2420
Intl.NumberFormat-v3

harness/async-gc.js

-57
This file was deleted.

harness/compareArray.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ assert.compareArray = function(actual, expected, message) {
3737
message = message.toString();
3838
}
3939

40-
assert(actual != null, `First argument shouldn't be nullish. ${message}`);
41-
assert(expected != null, `Second argument shouldn't be nullish. ${message}`);
40+
assert(actual != null, `Actual argument shouldn't be nullish. ${message}`);
41+
assert(expected != null, `Expected argument shouldn't be nullish. ${message}`);
4242
var format = compareArray.format;
4343
var result = compareArray(actual, expected);
4444

4545
// The following prevents actual and expected from being iterated and evaluated
4646
// more than once unless absolutely necessary.
4747
if (!result) {
48-
assert(false, `Expected ${format(actual)} and ${format(expected)} to have the same contents. ${message}`);
48+
assert(false, `Actual ${format(actual)} and expected ${format(expected)} should have the the same contents. ${message}`);
4949
}
5050
};

harness/propertyHelper.js

+32-20
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@ defines:
1717

1818
// @ts-check
1919

20+
// Capture primordial functions and receiver-uncurried primordial methods that
21+
// are used in verification but might be destroyed *by* that process itself.
22+
var __isArray = Array.isArray;
23+
var __defineProperty = Object.defineProperty;
24+
var __join = Function.prototype.call.bind(Array.prototype.join);
25+
var __push = Function.prototype.call.bind(Array.prototype.push);
26+
var __hasOwnProperty = Function.prototype.call.bind(Object.prototype.hasOwnProperty);
27+
var __propertyIsEnumerable = Function.prototype.call.bind(Object.prototype.propertyIsEnumerable);
28+
var nonIndexNumericPropertyName = Math.pow(2, 32) - 1;
29+
2030
/**
2131
* @param {object} obj
2232
* @param {string|symbol} name
@@ -46,7 +56,7 @@ function verifyProperty(obj, name, desc, options) {
4656
}
4757

4858
assert(
49-
Object.prototype.hasOwnProperty.call(obj, name),
59+
__hasOwnProperty(obj, name),
5060
"obj should have an own property " + nameStr
5161
);
5262

@@ -77,55 +87,56 @@ function verifyProperty(obj, name, desc, options) {
7787

7888
var failures = [];
7989

80-
if (Object.prototype.hasOwnProperty.call(desc, 'value')) {
90+
if (__hasOwnProperty(desc, 'value')) {
8191
if (!isSameValue(desc.value, originalDesc.value)) {
82-
failures.push("descriptor value should be " + desc.value);
92+
__push(failures, "descriptor value should be " + desc.value);
8393
}
8494
if (!isSameValue(desc.value, obj[name])) {
85-
failures.push("object value should be " + desc.value);
95+
__push(failures, "object value should be " + desc.value);
8696
}
8797
}
8898

89-
if (Object.prototype.hasOwnProperty.call(desc, 'enumerable')) {
99+
if (__hasOwnProperty(desc, 'enumerable')) {
90100
if (desc.enumerable !== originalDesc.enumerable ||
91101
desc.enumerable !== isEnumerable(obj, name)) {
92-
failures.push('descriptor should ' + (desc.enumerable ? '' : 'not ') + 'be enumerable');
102+
__push(failures, 'descriptor should ' + (desc.enumerable ? '' : 'not ') + 'be enumerable');
93103
}
94104
}
95105

96-
if (Object.prototype.hasOwnProperty.call(desc, 'writable')) {
106+
// Operations past this point are potentially destructive!
107+
108+
if (__hasOwnProperty(desc, 'writable')) {
97109
if (desc.writable !== originalDesc.writable ||
98110
desc.writable !== isWritable(obj, name)) {
99-
failures.push('descriptor should ' + (desc.writable ? '' : 'not ') + 'be writable');
111+
__push(failures, 'descriptor should ' + (desc.writable ? '' : 'not ') + 'be writable');
100112
}
101113
}
102114

103-
if (Object.prototype.hasOwnProperty.call(desc, 'configurable')) {
115+
if (__hasOwnProperty(desc, 'configurable')) {
104116
if (desc.configurable !== originalDesc.configurable ||
105117
desc.configurable !== isConfigurable(obj, name)) {
106-
failures.push('descriptor should ' + (desc.configurable ? '' : 'not ') + 'be configurable');
118+
__push(failures, 'descriptor should ' + (desc.configurable ? '' : 'not ') + 'be configurable');
107119
}
108120
}
109121

110-
assert(!failures.length, failures.join('; '));
122+
assert(!failures.length, __join(failures, '; '));
111123

112124
if (options && options.restore) {
113-
Object.defineProperty(obj, name, originalDesc);
125+
__defineProperty(obj, name, originalDesc);
114126
}
115127

116128
return true;
117129
}
118130

119131
function isConfigurable(obj, name) {
120-
var hasOwnProperty = Object.prototype.hasOwnProperty;
121132
try {
122133
delete obj[name];
123134
} catch (e) {
124135
if (!(e instanceof TypeError)) {
125136
throw new Test262Error("Expected TypeError, got " + e);
126137
}
127138
}
128-
return !hasOwnProperty.call(obj, name);
139+
return !__hasOwnProperty(obj, name);
129140
}
130141

131142
function isEnumerable(obj, name) {
@@ -143,9 +154,7 @@ function isEnumerable(obj, name) {
143154
stringCheck = true;
144155
}
145156

146-
return stringCheck &&
147-
Object.prototype.hasOwnProperty.call(obj, name) &&
148-
Object.prototype.propertyIsEnumerable.call(obj, name);
157+
return stringCheck && __hasOwnProperty(obj, name) && __propertyIsEnumerable(obj, name);
149158
}
150159

151160
function isSameValue(a, b) {
@@ -155,16 +164,19 @@ function isSameValue(a, b) {
155164
return a === b;
156165
}
157166

158-
var __isArray = Array.isArray;
159167
function isWritable(obj, name, verifyProp, value) {
160168
var unlikelyValue = __isArray(obj) && name === "length" ?
161-
Math.pow(2, 32) - 1 :
169+
nonIndexNumericPropertyName :
162170
"unlikelyValue";
163171
var newValue = value || unlikelyValue;
164-
var hadValue = Object.prototype.hasOwnProperty.call(obj, name);
172+
var hadValue = __hasOwnProperty(obj, name);
165173
var oldValue = obj[name];
166174
var writeSucceeded;
167175

176+
if (arguments.length < 4 && newValue === oldValue) {
177+
newValue = newValue + "2";
178+
}
179+
168180
try {
169181
obj[name] = newValue;
170182
} catch (e) {

harness/resizableArrayBufferUtils.js

+11-10
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ defines:
99
- ctors
1010
- MyBigInt64Array
1111
- CreateResizableArrayBuffer
12-
- WriteToTypedArray
12+
- MayNeedBigInt
1313
- Convert
1414
- ToNumbers
1515
- CreateRabForTest
@@ -74,14 +74,6 @@ function CreateResizableArrayBuffer(byteLength, maxByteLength) {
7474
return new ArrayBuffer(byteLength, { maxByteLength: maxByteLength });
7575
}
7676

77-
function WriteToTypedArray(array, index, value) {
78-
if (array instanceof BigInt64Array || array instanceof BigUint64Array) {
79-
array[index] = BigInt(value);
80-
} else {
81-
array[index] = value;
82-
}
83-
}
84-
8577
function Convert(item) {
8678
if (typeof item == 'bigint') {
8779
return Number(item);
@@ -98,12 +90,21 @@ function ToNumbers(array) {
9890
return result;
9991
}
10092

93+
function MayNeedBigInt(ta, n) {
94+
assert.sameValue(typeof n, 'number');
95+
if ((BigInt64Array !== 'undefined' && ta instanceof BigInt64Array)
96+
|| (BigUint64Array !== 'undefined' && ta instanceof BigUint64Array)) {
97+
return BigInt(n);
98+
}
99+
return n;
100+
}
101+
101102
function CreateRabForTest(ctor) {
102103
const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT);
103104
// Write some data into the array.
104105
const taWrite = new ctor(rab);
105106
for (let i = 0; i < 4; ++i) {
106-
WriteToTypedArray(taWrite, i, 2 * i);
107+
taWrite[i] = MayNeedBigInt(taWrite, 2 * i);
107108
}
108109
return rab;
109110
}

test/built-ins/Array/prototype/at/typed-array-resizable-buffer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ for (let ctor of ctors) {
2424
// Write some data into the array.
2525
let ta_write = new ctor(rab);
2626
for (let i = 0; i < 4; ++i) {
27-
WriteToTypedArray(ta_write, i, i);
27+
ta_write[i] = MayNeedBigInt(ta_write, i);
2828
}
2929
assert.sameValue(ArrayAtHelper(fixedLength, -1), 3);
3030
assert.sameValue(ArrayAtHelper(lengthTracking, -1), 3);

test/built-ins/Array/prototype/copyWithin/resizable-buffer.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ for (let ctor of ctors) {
2424
// Write some data into the array.
2525
const taWrite = new ctor(rab);
2626
for (let i = 0; i < 4; ++i) {
27-
WriteToTypedArray(taWrite, i, i);
27+
taWrite[i] = MayNeedBigInt(taWrite, i);
2828
}
2929

3030
// Orig. array: [0, 1, 2, 3]
@@ -41,15 +41,15 @@ for (let ctor of ctors) {
4141
3
4242
]);
4343
for (let i = 0; i < 4; ++i) {
44-
WriteToTypedArray(taWrite, i, i);
44+
taWrite[i] = MayNeedBigInt(taWrite, i);
4545
}
4646
ArrayCopyWithinHelper(fixedLengthWithOffset, 0, 1);
4747
assert.compareArray(ToNumbers(fixedLengthWithOffset), [
4848
3,
4949
3
5050
]);
5151
for (let i = 0; i < 4; ++i) {
52-
WriteToTypedArray(taWrite, i, i);
52+
taWrite[i] = MayNeedBigInt(taWrite, i);
5353
}
5454
ArrayCopyWithinHelper(lengthTracking, 0, 2);
5555
assert.compareArray(ToNumbers(lengthTracking), [
@@ -67,7 +67,7 @@ for (let ctor of ctors) {
6767
// Shrink so that fixed length TAs go out of bounds.
6868
rab.resize(3 * ctor.BYTES_PER_ELEMENT);
6969
for (let i = 0; i < 3; ++i) {
70-
WriteToTypedArray(taWrite, i, i);
70+
taWrite[i] = MayNeedBigInt(taWrite, i);
7171
}
7272

7373
// Orig. array: [0, 1, 2]
@@ -99,7 +99,7 @@ for (let ctor of ctors) {
9999

100100
// Shrink so that the TAs with offset go out of bounds.
101101
rab.resize(1 * ctor.BYTES_PER_ELEMENT);
102-
WriteToTypedArray(taWrite, 0, 0);
102+
taWrite[0] = MayNeedBigInt(taWrite, 0);
103103
ArrayCopyWithinHelper(fixedLength, 0, 1, 1);
104104
ArrayCopyWithinHelper(fixedLengthWithOffset, 0, 1, 1);
105105
ArrayCopyWithinHelper(lengthTrackingWithOffset, 0, 1, 1);
@@ -121,7 +121,7 @@ for (let ctor of ctors) {
121121
// Grow so that all TAs are back in-bounds.
122122
rab.resize(6 * ctor.BYTES_PER_ELEMENT);
123123
for (let i = 0; i < 6; ++i) {
124-
WriteToTypedArray(taWrite, i, i);
124+
taWrite[i] = MayNeedBigInt(taWrite, i);
125125
}
126126

127127
// Orig. array: [0, 1, 2, 3, 4, 5]
@@ -138,15 +138,15 @@ for (let ctor of ctors) {
138138
3
139139
]);
140140
for (let i = 0; i < 6; ++i) {
141-
WriteToTypedArray(taWrite, i, i);
141+
taWrite[i] = MayNeedBigInt(taWrite, i);
142142
}
143143
ArrayCopyWithinHelper(fixedLengthWithOffset, 0, 1);
144144
assert.compareArray(ToNumbers(fixedLengthWithOffset), [
145145
3,
146146
3
147147
]);
148148
for (let i = 0; i < 6; ++i) {
149-
WriteToTypedArray(taWrite, i, i);
149+
taWrite[i] = MayNeedBigInt(taWrite, i);
150150
}
151151

152152
// [0, 1, 2, 3, 4, 5, ...] << lengthTracking
@@ -161,7 +161,7 @@ for (let ctor of ctors) {
161161
5
162162
]);
163163
for (let i = 0; i < 6; ++i) {
164-
WriteToTypedArray(taWrite, i, i);
164+
taWrite[i] = MayNeedBigInt(taWrite, i);
165165
}
166166

167167
// [2, 3, 4, 5, ...] << lengthTrackingWithOffset

test/built-ins/Array/prototype/entries/resizable-buffer.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ for (let ctor of ctors) {
3535
// Write some data into the array.
3636
const taWrite = new ctor(rab);
3737
for (let i = 0; i < 4; ++i) {
38-
WriteToTypedArray(taWrite, i, 2 * i);
38+
taWrite[i] = MayNeedBigInt(taWrite, 2 * i);
3939
}
4040

4141
// Orig. array: [0, 2, 4, 6]
@@ -128,7 +128,7 @@ for (let ctor of ctors) {
128128
// Grow so that all TAs are back in-bounds.
129129
rab.resize(6 * ctor.BYTES_PER_ELEMENT);
130130
for (let i = 0; i < 6; ++i) {
131-
WriteToTypedArray(taWrite, i, 2 * i);
131+
taWrite[i] = MayNeedBigInt(taWrite, 2 * i);
132132
}
133133

134134
// Orig. array: [0, 2, 4, 6, 8, 10]

test/built-ins/Array/prototype/every/resizable-buffer.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ for (let ctor of ctors) {
2020
// Write some data into the array.
2121
const taWrite = new ctor(rab);
2222
for (let i = 0; i < 4; ++i) {
23-
WriteToTypedArray(taWrite, i, 2 * i);
23+
taWrite[i] = MayNeedBigInt(taWrite, 2 * i);
2424
}
2525

2626
// Orig. array: [0, 2, 4, 6]
@@ -86,7 +86,7 @@ for (let ctor of ctors) {
8686
// Grow so that all TAs are back in-bounds.
8787
rab.resize(6 * ctor.BYTES_PER_ELEMENT);
8888
for (let i = 0; i < 6; ++i) {
89-
WriteToTypedArray(taWrite, i, 2 * i);
89+
taWrite[i] = MayNeedBigInt(taWrite, 2 * i);
9090
}
9191

9292
// Orig. array: [0, 2, 4, 6, 8, 10]

0 commit comments

Comments
 (0)