Skip to content

Commit 0cdf8da

Browse files
ssrliveCopilot
andcommitted
Fix yield* method lookups and cross-realm Proxy traps
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 325fd01 commit 0cdf8da

File tree

3 files changed

+108
-91
lines changed

3 files changed

+108
-91
lines changed

.github/workflows/test262.yml

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -11,47 +11,47 @@ jobs:
1111
fail-fast: false
1212
matrix:
1313
include:
14-
- id: 1
15-
- id: 2
16-
- id: 3
17-
- id: 4
18-
- id: 5
19-
- id: 6
20-
- id: 7
21-
- id: 8
22-
- id: 9
23-
- id: 10
24-
- id: 11
25-
- id: 12
26-
- id: 13
27-
- id: 14
28-
- id: 15
29-
- id: 16
30-
- id: 17
31-
- id: 18
32-
- id: 19
33-
- id: 20
34-
- id: 21
35-
- id: 22
36-
- id: 23
37-
- id: 24
38-
- id: 25
39-
- id: 26
40-
- id: 27
41-
- id: 28
42-
- id: 29
43-
- id: 30
44-
- id: 31
45-
- id: 32
46-
- id: 33
47-
- id: 34
48-
- id: 35
49-
- id: 36
50-
- id: 37
51-
- id: 38
52-
- id: 39
53-
- id: 40
54-
- id: 41
14+
- cluster: 1
15+
- cluster: 2
16+
- cluster: 3
17+
- cluster: 4
18+
- cluster: 5
19+
- cluster: 6
20+
- cluster: 7
21+
- cluster: 8
22+
- cluster: 9
23+
- cluster: 10
24+
- cluster: 11
25+
- cluster: 12
26+
- cluster: 13
27+
- cluster: 14
28+
- cluster: 15
29+
- cluster: 16
30+
- cluster: 17
31+
- cluster: 18
32+
- cluster: 19
33+
- cluster: 20
34+
- cluster: 21
35+
- cluster: 22
36+
- cluster: 23
37+
- cluster: 24
38+
- cluster: 25
39+
- cluster: 26
40+
- cluster: 27
41+
- cluster: 28
42+
- cluster: 29
43+
- cluster: 30
44+
- cluster: 31
45+
- cluster: 32
46+
- cluster: 33
47+
- cluster: 34
48+
- cluster: 35
49+
- cluster: 36
50+
- cluster: 37
51+
- cluster: 38
52+
- cluster: 39
53+
- cluster: 40
54+
- cluster: 41
5555
runs-on: ubuntu-latest
5656
steps:
5757
- name: Checkout
@@ -70,7 +70,7 @@ jobs:
7070
run: |
7171
cargo build --all-features --release --package js
7272
73-
- name: Run test262 subset ${{ matrix.id }}
73+
- name: Run test262 subset ${{ matrix.cluster }}
7474
if: ${{ !cancelled() }}
7575
env:
7676
FAIL_ON_FAILURE: 'true'
@@ -82,7 +82,7 @@ jobs:
8282
RUN_TESTS=""
8383
TITLE=""
8484
85-
case "${{ matrix.id }}" in
85+
case "${{ matrix.cluster }}" in
8686
1)
8787
TITLE='"language/arguments-object" - "language/export"'
8888
FOCUS='language/arguments-object,language/asi,language/block-scope,language/comments,language/computed-property-names,language/destructuring,language/directive-prologue,language/eval-code,language/export'
@@ -293,12 +293,12 @@ jobs:
293293
RUN_TESTS='true'
294294
;;
295295
*)
296-
echo "Unknown subset id: ${{ matrix.id }}" >&2
296+
echo "Unknown subset: ${{ matrix.cluster }}" >&2
297297
exit 1
298298
;;
299299
esac
300300
301-
echo "Running subset ${{ matrix.id }}: $TITLE"
301+
echo "Running subset ${{ matrix.cluster }}: $TITLE"
302302
RUN_ARGS=(--limit 10000 --focus "$FOCUS")
303303
if [ -n "$TIMEOUT" ]; then
304304
RUN_ARGS+=(--timeout "$TIMEOUT")
@@ -313,7 +313,7 @@ jobs:
313313
if: ${{ always() && !cancelled() }}
314314
uses: actions/upload-artifact@v6
315315
with:
316-
name: test262-results-${{ matrix.id }}
316+
name: test262-results-${{ matrix.cluster }}
317317
path: test262-results.log
318318

319319
summarize-test262-results:

src/core/compiler.rs

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6243,24 +6243,21 @@ impl<'gc> Compiler<'gc> {
62436243
let throw_idx = self.chunk.add_constant(Value::String(throw_key));
62446244
self.chunk.write_opcode(Opcode::GetProperty);
62456245
self.chunk.write_u16(throw_idx);
6246+
self.chunk.write_opcode(Opcode::Dup);
62466247
let null_check_idx = self.chunk.add_constant(Value::Undefined);
62476248
self.chunk.write_opcode(Opcode::Constant);
62486249
self.chunk.write_u16(null_check_idx);
62496250
self.chunk.write_opcode(Opcode::StrictNotEqual);
62506251
self.chunk.write_opcode(Opcode::Not);
62516252
let throw_is_undefined = self.emit_jump(Opcode::JumpIfTrue);
6252-
self.emit_helper_get(&ys_iter);
6253-
let throw_key_null = crate::unicode::utf8_to_utf16("throw");
6254-
let throw_idx_null = self.chunk.add_constant(Value::String(throw_key_null));
6255-
self.chunk.write_opcode(Opcode::GetProperty);
6256-
self.chunk.write_u16(throw_idx_null);
6253+
self.chunk.write_opcode(Opcode::Dup);
62576254
let null_check_idx = self.chunk.add_constant(Value::Null);
62586255
self.chunk.write_opcode(Opcode::Constant);
62596256
self.chunk.write_u16(null_check_idx);
62606257
self.chunk.write_opcode(Opcode::StrictNotEqual);
62616258
self.chunk.write_opcode(Opcode::Not);
62626259
let no_throw_method = self.emit_jump(Opcode::JumpIfTrue);
6263-
self.patch_jump(throw_is_undefined);
6260+
self.chunk.write_opcode(Opcode::Pop);
62646261

62656262
// Has .throw method: ys_result = iter.throw(thrown)
62666263
self.emit_helper_get(&ys_iter);
@@ -6287,30 +6284,29 @@ impl<'gc> Compiler<'gc> {
62876284
self.chunk.write_u32(result_check as u32);
62886285

62896286
// No .throw method: close iterator then throw TypeError
6287+
self.patch_jump(throw_is_undefined);
62906288
self.patch_jump(no_throw_method);
6289+
self.chunk.write_opcode(Opcode::Pop);
62916290
self.emit_helper_get(&ys_iter);
62926291
let return_key = crate::unicode::utf8_to_utf16("return");
62936292
let return_idx = self.chunk.add_constant(Value::String(return_key));
62946293
self.chunk.write_opcode(Opcode::GetProperty);
62956294
self.chunk.write_u16(return_idx);
6295+
self.chunk.write_opcode(Opcode::Dup);
62966296
let null_check2_idx = self.chunk.add_constant(Value::Undefined);
62976297
self.chunk.write_opcode(Opcode::Constant);
62986298
self.chunk.write_u16(null_check2_idx);
62996299
self.chunk.write_opcode(Opcode::StrictNotEqual);
63006300
self.chunk.write_opcode(Opcode::Not);
63016301
let return_is_undefined = self.emit_jump(Opcode::JumpIfTrue);
6302-
self.emit_helper_get(&ys_iter);
6303-
let return_key_null = crate::unicode::utf8_to_utf16("return");
6304-
let return_idx_null = self.chunk.add_constant(Value::String(return_key_null));
6305-
self.chunk.write_opcode(Opcode::GetProperty);
6306-
self.chunk.write_u16(return_idx_null);
6302+
self.chunk.write_opcode(Opcode::Dup);
63076303
let null_check2_idx = self.chunk.add_constant(Value::Null);
63086304
self.chunk.write_opcode(Opcode::Constant);
63096305
self.chunk.write_u16(null_check2_idx);
63106306
self.chunk.write_opcode(Opcode::StrictNotEqual);
63116307
self.chunk.write_opcode(Opcode::Not);
63126308
let no_return_method = self.emit_jump(Opcode::JumpIfTrue);
6313-
self.patch_jump(return_is_undefined);
6309+
self.chunk.write_opcode(Opcode::Pop);
63146310
self.emit_helper_get(&ys_iter);
63156311
let return_key2 = crate::unicode::utf8_to_utf16("return");
63166312
let return_idx2 = self.chunk.add_constant(Value::String(return_key2));
@@ -6319,7 +6315,9 @@ impl<'gc> Compiler<'gc> {
63196315
self.chunk.write_u16(return_idx2);
63206316
self.emit_call_opcode(0, 0x80);
63216317
self.chunk.write_opcode(Opcode::Pop);
6318+
self.patch_jump(return_is_undefined);
63226319
self.patch_jump(no_return_method);
6320+
self.chunk.write_opcode(Opcode::Pop);
63236321
let te_msg = "The iterator does not provide a 'throw' method";
63246322
let te_msg_idx = self.chunk.add_constant(Value::from(te_msg));
63256323
self.chunk.write_opcode(Opcode::Constant);
@@ -6339,24 +6337,21 @@ impl<'gc> Compiler<'gc> {
63396337
let ret_idx_rd = self.chunk.add_constant(Value::String(ret_key_rd));
63406338
self.chunk.write_opcode(Opcode::GetProperty);
63416339
self.chunk.write_u16(ret_idx_rd);
6340+
self.chunk.write_opcode(Opcode::Dup);
63426341
let undef_rd = self.chunk.add_constant(Value::Undefined);
63436342
self.chunk.write_opcode(Opcode::Constant);
63446343
self.chunk.write_u16(undef_rd);
63456344
self.chunk.write_opcode(Opcode::StrictNotEqual);
63466345
self.chunk.write_opcode(Opcode::Not);
63476346
let return_is_undefined = self.emit_jump(Opcode::JumpIfTrue);
6348-
self.emit_helper_get(&ys_iter);
6349-
let ret_key_rd_null = crate::unicode::utf8_to_utf16("return");
6350-
let ret_idx_rd_null = self.chunk.add_constant(Value::String(ret_key_rd_null));
6351-
self.chunk.write_opcode(Opcode::GetProperty);
6352-
self.chunk.write_u16(ret_idx_rd_null);
6347+
self.chunk.write_opcode(Opcode::Dup);
63536348
let null_rd = self.chunk.add_constant(Value::Null);
63546349
self.chunk.write_opcode(Opcode::Constant);
63556350
self.chunk.write_u16(null_rd);
63566351
self.chunk.write_opcode(Opcode::StrictNotEqual);
63576352
self.chunk.write_opcode(Opcode::Not);
63586353
let has_return_method = self.emit_jump(Opcode::JumpIfTrue);
6359-
self.patch_jump(return_is_undefined);
6354+
self.chunk.write_opcode(Opcode::Pop);
63606355

63616356
// c.iv: innerReturnResult = Call(return, iterator, « received.[[Value]] »)
63626357
self.emit_helper_get(&ys_iter);
@@ -6404,7 +6399,9 @@ impl<'gc> Compiler<'gc> {
64046399
// c.iii: return is undefined — return Completion(received)
64056400
// Restore generator_return_pending before throwing so the return
64066401
// propagates through finally handlers as a return completion.
6402+
self.patch_jump(return_is_undefined);
64076403
self.patch_jump(has_return_method);
6404+
self.chunk.write_opcode(Opcode::Pop);
64086405
self.emit_helper_get(&ys_thrown);
64096406
self.chunk.write_opcode(Opcode::Dup);
64106407
self.chunk.write_opcode(Opcode::SetGeneratorReturn);

0 commit comments

Comments
 (0)