Skip to content

Commit e2e6f72

Browse files
committed
Merge branch 'main' into kai/nodevm-dynamic-import
2 parents 5afbd56 + a4e17c6 commit e2e6f72

File tree

1,188 files changed

+16008
-49093
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,188 files changed

+16008
-49093
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//@ runDefault("--useConcurrentJIT=0", "--jitPolicyScale=0")
2+
const a = new Int8Array(4);
3+
a[3];
4+
function opt() {
5+
const arr = [...[1, 2, 3]];
6+
const func = arr?.constructor;
7+
try {
8+
new func(arr); // JSC use GetLocal to get Constructor, GetLocal is converted into Undefined in constant folding
9+
describe(1234)
10+
} catch (e) {
11+
throw e;
12+
}
13+
for (let i = 0; i < 100; i++) {}
14+
}
15+
for (let i = 0; i < 5; i++) {
16+
opt();
17+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
function assert(actual, expected) {
2+
if (actual.length !== expected.length)
3+
throw new Error(`Length mismatch: got [${actual}], expected [${expected}]`);
4+
5+
for (let i = 0; i < expected.length; i++) {
6+
if (actual[i] !== expected[i])
7+
throw new Error(`Mismatch at index ${i}: got "${actual[i]}", expected "${expected[i]}"`);
8+
}
9+
}
10+
11+
function getKey(x) {
12+
var arr = [];
13+
for (var i in x) {
14+
arr.push(i);
15+
}
16+
return arr;
17+
}
18+
19+
function opt() {
20+
var x = new String("ab");
21+
function B() {
22+
this[0] = 4;
23+
this.bar = 77;
24+
}
25+
B.prototype = x;
26+
var y = new B();
27+
return getKey(y);
28+
}
29+
30+
for (let i = 0; i < testLoopCount; i++) {
31+
assert(opt(), ['0', 'bar', '1']);
32+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
function shouldBe(a, b) {
2+
if (a !== b)
3+
throw new Error(`Expected ${b} but got ${a}`);
4+
}
5+
6+
const unknownChar = "\uE000";
7+
const knownChar = "A";
8+
9+
shouldBe(/\p{Script=Unknown}/u.test(unknownChar), true);
10+
shouldBe(/\p{Script=Unknown}/u.test(knownChar), false);
11+
12+
shouldBe(/\p{Script=Zzzz}/u.test(unknownChar), true);
13+
shouldBe(/\p{Script=Zzzz}/u.test(knownChar), false);
14+
15+
shouldBe(/\p{Script_Extensions=Unknown}/u.test(unknownChar), true);
16+
shouldBe(/\p{Script_Extensions=Unknown}/u.test(knownChar), false);
17+
18+
shouldBe(/\p{Script_Extensions=Zzzz}/u.test(unknownChar), true);
19+
shouldBe(/\p{Script_Extensions=Zzzz}/u.test(knownChar), false);

JSTests/stress/regexp-vflag-property-of-strings.js

Lines changed: 70 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// With verbose set to false, this test is successful if there is no output. Set verbose to true to see expected matches.
22
let verbose = false;
33

4+
let errors = 0;
5+
46
function arrayToString(arr)
57
{
68
let str = '';
@@ -30,7 +32,7 @@ function objectToString(obj)
3032

3133
firstEntry = false;
3234
}
33-
35+
3436
return "{ " + str + " }";
3537
}
3638

@@ -139,17 +141,21 @@ function testRegExp(re, str, exp, groups)
139141
if (result) {
140142
if (verbose)
141143
print(re.toString() + ".exec(" + dumpValue(str) + "), passed ", dumpValue(exp));
142-
} else
144+
} else {
143145
print(re.toString() + ".exec(" + dumpValue(str) + "), FAILED test #" + testNumber + ", Expected ", dumpValue(exp), " got ", dumpValue(actual));
146+
errors++;
147+
}
144148
}
145149

146150
function testRegExpSyntaxError(reString, flags, expError)
147151
{
148152
testNumber++;
149153

154+
150155
try {
151156
let re = new RegExp(reString, flags);
152-
print("FAILED test #" + testNumber + ", Expected /" + reString + "/" + flags + " to throw \"" + expError);
157+
print("FAILED test #" + testNumber + ", Expected /" + reString + "/" + flags + " to throw \"" + expError + "\", but it didn't");
158+
errors++;
153159
} catch (e) {
154160
if (e != expError)
155161
print("FAILED test #" + testNumber + ", Expected /" + reString + "/" + flags + " to throw \"" + expError + "\" got \"" + e + "\"");
@@ -158,6 +164,12 @@ function testRegExpSyntaxError(reString, flags, expError)
158164
}
159165
}
160166

167+
function printErrors()
168+
{
169+
if (errors)
170+
throw "Test had " + errors + " errors";
171+
}
172+
161173
// Test 1
162174
testRegExpSyntaxError("[\\p{RGI_Emoji_Tag_Sequence}a]", "u", "SyntaxError: Invalid regular expression: invalid property expression");
163175
testRegExpSyntaxError("\\P{Emoji_Keycap_Sequence}", "v", "SyntaxError: Invalid regular expression: negated class set may contain strings");
@@ -520,58 +532,105 @@ testRegExpSyntaxError("\\%", "u", "SyntaxError: Invalid regular expression: inva
520532
testRegExpSyntaxError("\\,", "u", "SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern");
521533
testRegExpSyntaxError("\\:", "u", "SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern");
522534

523-
// Test 256
535+
// Test 261
524536
testRegExpSyntaxError("\\;", "u", "SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern");
525537
testRegExpSyntaxError("\\<", "u", "SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern");
526538
testRegExpSyntaxError("\\=", "u", "SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern");
527539
testRegExpSyntaxError("\\>", "u", "SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern");
528540
testRegExpSyntaxError("\\@", "u", "SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern");
529541

530-
// Test 261
542+
// Test 266
531543
testRegExpSyntaxError("\\`", "u", "SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern");
532544
testRegExpSyntaxError("\\~", "u", "SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern");
533545
testRegExpSyntaxError("[\\&]", "u", "SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern");
534546
testRegExpSyntaxError("[\\!]", "u", "SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern");
535547
testRegExpSyntaxError("[\\#]", "u", "SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern");
536548

537-
// Test 255
549+
// Test 260
538550
testRegExpSyntaxError("[\\%]", "u", "SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern");
539551
testRegExpSyntaxError("[\\,]", "u", "SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern");
540552
testRegExpSyntaxError("[\\:]", "u", "SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern");
541553
testRegExpSyntaxError("[\\;]", "u", "SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern");
542554
testRegExpSyntaxError("[\\<]", "u", "SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern");
543555

544-
// Test 271
556+
// Test 276
545557
testRegExpSyntaxError("[\\=]", "u", "SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern");
546558
testRegExpSyntaxError("[\\>]", "u", "SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern");
547559
testRegExpSyntaxError("[\\@]", "u", "SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern");
548560
testRegExpSyntaxError("[\\`]", "u", "SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern");
549561
testRegExpSyntaxError("[\\~]", "u", "SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern");
550562

551-
// Test 276
563+
// Test 281
552564
testRegExpSyntaxError("\\&", "v", "SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern");
553565
testRegExpSyntaxError("\\-", "v", "SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern");
554566
testRegExpSyntaxError("\\!", "v", "SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern");
555567
testRegExpSyntaxError("\\#", "v", "SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern");
556568
testRegExpSyntaxError("\\%", "v", "SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern");
557569

558-
// Test 281
570+
// Test 286
559571
testRegExpSyntaxError("\\,", "v", "SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern");
560572
testRegExpSyntaxError("\\:", "v", "SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern");
561573
testRegExpSyntaxError("\\;", "v", "SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern");
562574
testRegExpSyntaxError("\\<", "v", "SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern");
563575
testRegExpSyntaxError("\\=", "v", "SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern");
564576

565-
// Test 286
577+
// Test 291
566578
testRegExpSyntaxError("\\>", "v", "SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern");
567579
testRegExpSyntaxError("\\@", "v", "SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern");
568580
testRegExpSyntaxError("\\`", "v", "SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern");
569581
testRegExpSyntaxError("\\~", "v", "SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern");
570582
testRegExpSyntaxError("\\q{a}", "v", "SyntaxError: Invalid regular expression: invalid escaped character for Unicode pattern");
571583

572-
// Test 291
584+
// Test 296
573585
testRegExp(/[\&\-\!\#\%\,\:\;\<\=\>\@\`\~]*/v, "&-!#%,:;<=>@`~", ["&-!#%,:;<=>@`~"]);
574586
testRegExp(/[\q{\&\-\!\#\%\,\:\;\<\=\>\@\`\~}X]*/v, "X&-!#%,:;<=>@`~X", ["X&-!#%,:;<=>@`~X"]);
575587
testRegExp(/[\q{}]/v, "", [""]);
576588
testRegExp(/[\q{\u{0095}|k}]/vi, "k", ["k"]);
577589
testRegExp(/[\q{\u{0095}|s}]/vi, "s", ["s"]);
590+
591+
// Test 301
592+
testRegExp(/[f[^a-z]]/v, "f", ["f"]);
593+
testRegExp(/[f[^a-z]]/v, "a", null);
594+
testRegExp(/[f[^a-z]]/v, "2", ["2"]);
595+
596+
// Test 304
597+
testRegExp(/[^f[^a-z]]/v, "f", null);
598+
testRegExp(/[^f[^a-z]]/v, "a", ["a"]);
599+
testRegExp(/[^f[^a-z]]/v, "2", null);
600+
601+
// Test 307
602+
testRegExp(/[^f[a-z]]/v, "f", null);
603+
testRegExp(/[^f[a-z]]/v, "a", null);
604+
testRegExp(/[^f[a-z]]/v, "2", ["2"]);
605+
606+
// Test 310
607+
testRegExp(/[^[^[^[^[^[^[^[^[^[^[^[^abc]]]]]]]]]]]]/v, "a", ["a"]);
608+
testRegExp(/[^[^[^[^[^[^[^[^[^[^[^[^abc]]]]]]]]]]]]/v, "d", null);
609+
610+
testRegExp(/[^[^[^[^[^[^[^[^[^[^[^abc]]]]]]]]]]]/v, "a", null);
611+
testRegExp(/[^[^[^[^[^[^[^[^[^[^[^abc]]]]]]]]]]]/v, "d", ["d"]);
612+
613+
// Test 314
614+
testRegExp(/[a\u{1813}[^\u{0250}-\u{3373}a]]/v, "\u{0250}", null);
615+
testRegExp(/[a\u{1813}[^\u{0250}-\u{3373}a]]/v, "\u{1813}", ["\u{1813}"]);
616+
testRegExp(/[a\u{1813}[^\u{0250}-\u{3373}a]]/v, "a", ["a"]);
617+
618+
// Test 317
619+
testRegExpSyntaxError("[a-[^a-z]]", "v", "SyntaxError: Invalid regular expression: invalid class set character");
620+
621+
// Test 318
622+
testRegExp(/[f[^[a-m][n-z]]]/v, "f", "f");
623+
testRegExp(/[f[^[a-m][n-z]]]/v, "a", null);
624+
testRegExp(/[f[^[a-m][n-z]]]/v, "2", "2");
625+
626+
// Test 321
627+
testRegExp(/[f[^[a-z]&&[a-f]]]/v, "f", "f");
628+
testRegExp(/[f[^[a-z]&&[a-f]]]/v, "a", null);
629+
testRegExp(/[f[^[a-z]&&[a-f]]]/v, "g", "g");
630+
testRegExp(/[f[^[a-z]&&[a-f]]]/v, "2", "2");
631+
632+
testRegExp(/[f[^[a-z]--[a-f]]]/v, "f", "f");
633+
testRegExp(/[f[^[a-z]--[a-f]]]/v, "a", "a");
634+
testRegExp(/[f[^[a-z]--[a-f]]]/v, "g", null);
635+
testRegExp(/[f[^[a-z]--[a-f]]]/v, "2", "2");
636+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//@ runDefault("--useConcurrentJIT=0", "--jitPolicyScale=0")
2+
function shouldBe(actual, expected) {
3+
if (actual !== expected)
4+
throw new Error('bad value: ' + actual);
5+
}
6+
7+
function f1(o, value) {
8+
function f2()
9+
{
10+
o.x=value
11+
return 2
12+
}
13+
let y={}
14+
y.toString = f2
15+
y >>> 1;
16+
}
17+
18+
noInline(f1)
19+
let obj={}
20+
for (let v25 = 0; v25 < 100; v25++) {
21+
f1(obj, v25);
22+
23+
}
24+
shouldBe(obj.x, 99)

JSTests/test262/expectations.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,6 @@ test/built-ins/Proxy/construct/return-not-object-throws-undefined-realm.js:
7676
test/built-ins/Proxy/construct/trap-is-not-callable-realm.js:
7777
default: 'Test262Error: Expected a TypeError but got a different error constructor with the same name'
7878
strict mode: 'Test262Error: Expected a TypeError but got a different error constructor with the same name'
79-
test/built-ins/RegExp/property-escapes/special-property-value-Script_Extensions-Unknown.js:
80-
default: 'SyntaxError: Invalid regular expression: invalid property expression'
81-
strict mode: 'SyntaxError: Invalid regular expression: invalid property expression'
8279
test/built-ins/Temporal/Duration/compare/compare-no-precision-loss.js:
8380
default: 'Test262Error: Expected SameValue(«0», «0») to be false'
8481
strict mode: 'Test262Error: Expected SameValue(«0», «0») to be false'

0 commit comments

Comments
 (0)