Truly independent web browser
LibJS: Hold environment coordinates in three bytes of bytecode
Andreas Klingb8dd3b78150c
diff --git a/Libraries/LibJS/Flap/src/hir/mod.rs b/Libraries/LibJS/Flap/src/hir/mod.rsindex 2e4661ba659..73df9a57bcc 100644--- a/Libraries/LibJS/Flap/src/hir/mod.rs+++ b/Libraries/LibJS/Flap/src/hir/mod.rs@@ -1950,7 +1950,7 @@ impl<'a> Checker<'a> {return self.error(operand.span, format!("unknown binding '{name}'"));};let return_type = if symbol.ty == Type::EnvironmentCoordinate {- Type::EnvironmentCoordinateEntry+ Type::BytecodeEnvironmentCoordinate} else if self.bytecode_fields.contains(&symbol.id) && matches!(symbol.ty, Type::Sequence(_)) {symbol.ty.clone()} else {diff --git a/Libraries/LibJS/Flap/src/metadata.rs b/Libraries/LibJS/Flap/src/metadata.rsindex aa118d17993..83df1541ff2 100644--- a/Libraries/LibJS/Flap/src/metadata.rs+++ b/Libraries/LibJS/Flap/src/metadata.rs@@ -685,7 +685,7 @@ fn try_field_type_info(ty: &str) -> Option<FieldType> {"PropertyKeyTableIndex" => ("PropertyKeyTableIndex", 3, "u32_newtype"),"StringTableIndex" => ("StringTableIndex", 3, "u32_newtype"),"Optional<StringTableIndex>" => ("Option<StringTableIndex>", 3, "optional_u32_newtype"),- "EnvironmentCoordinate" => ("EnvironmentCoordinate", 8, "env_coord"),+ "EnvironmentCoordinate" => ("EnvironmentCoordinate", 3, "env_coord"),"Builtin" | "Completion::Type" | "IteratorHint" | "EnvironmentMode" | "PutKind" | "ArgumentsKind"| "FunctionNamePrefix" => ("u8", 1, "u8"),"Value" => ("u64", 8, "u64"),diff --git a/Libraries/LibJS/Flap/src/rust_bytecode.rs b/Libraries/LibJS/Flap/src/rust_bytecode.rsindex 5cc5f12a743..5e08ae4bc09 100644--- a/Libraries/LibJS/Flap/src/rust_bytecode.rs+++ b/Libraries/LibJS/Flap/src/rust_bytecode.rs@@ -132,7 +132,7 @@ pub fn read_expr_for_type(ty: &str, offset: &str, reader: &str) -> String {)}"EnvironmentCoordinate" => format!(- "EnvironmentCoordinate {{ hops: {reader}read_u32(bytes, {offset}), index: {reader}read_u32(bytes, {offset} + 4) }}"+ "EnvironmentCoordinate {{ hops: u32::from(bytes[{offset}]), index: u32::from({reader}read_u16(bytes, {offset} + 1)) }}"),"Builtin" | "Completion::Type" | "IteratorHint" | "EnvironmentMode" | "PutKind" | "ArgumentsKind"| "FunctionNamePrefix" => format!("bytes[{offset}]"),@@ -629,12 +629,15 @@ fn emit_field_store(mut w: impl Write, name: &str, kind: &str, offset: usize) ->writeln!(w, "{prefix}{}", store(&value, 3))?;}"env_coord" => {- writeln!(w, "{prefix}{}", store(&format!("{name}.hops.to_ne_bytes()"), 4))?;writeln!(w,- "{prefix}out[{}..{}].copy_from_slice(&{name}.index.to_ne_bytes());",- offset + 4,- offset + 8+ "{prefix}out[{offset}] = u8::try_from({name}.hops).expect(\"coordinates fit in their bytecode field\");"+ )?;+ writeln!(+ w,+ "{prefix}out[{}..{}].copy_from_slice(&u16::try_from({name}.index).expect(\"coordinates fit in their bytecode field\").to_ne_bytes());",+ offset + 1,+ offset + 3)?;}other => panic!("Unknown encoding kind: {other}"),diff --git a/Libraries/LibJS/Flap/src/types.rs b/Libraries/LibJS/Flap/src/types.rsindex c070b4ccb97..9d1a2fcba92 100644--- a/Libraries/LibJS/Flap/src/types.rs+++ b/Libraries/LibJS/Flap/src/types.rs@@ -254,6 +254,7 @@ define_named_types! {layout {Value => "Value", Some(8), false;EnvironmentCoordinateEntry => "EnvironmentCoordinateEntry", Some(4), false;+ BytecodeEnvironmentCoordinate => "BytecodeEnvironmentCoordinate", Some(1), false;NativeFunctionTableEntry => "NativeFunctionTableEntry", Some(8), false;}internal {diff --git a/Libraries/LibJS/Flap/tests/interpreter-assembly/aarch64.S b/Libraries/LibJS/Flap/tests/interpreter-assembly/aarch64.Sindex 657a7b5acb8..3f9f8600788 100644--- a/Libraries/LibJS/Flap/tests/interpreter-assembly/aarch64.S+++ b/Libraries/LibJS/Flap/tests/interpreter-assembly/aarch64.S@@ -3386,20 +3386,21 @@ asm_handler_SetLexicalEnvironment_hot_end:.p2align 4asm_handler_GetBinding:ldr x0, [x28, #32]- add x1, x21, #7- ldp w1, w2, [x1, #0]- cbz x0, .Lasm_GetBinding.assert_predicate_failure_9+ add x2, x21, #7+ ldrb w1, [x2]+ ldurh w2, [x2, #1]+ cbz x0, .Lasm_GetBinding.assert_predicate_failure_11cbz w1, .Lasm_GetBinding.ssa_block_3.Lasm_GetBinding.ssa_block_4:ldr w0, [x0, #16]add x9, x24, w0, uxtw #3cmp w0, #0csel x0, x9, xzr, ne- cbz x0, .Lasm_GetBinding.assert_predicate_failure_25+ cbz x0, .Lasm_GetBinding.assert_predicate_failure_27subs x1, x1, #1cbnz w1, .Lasm_GetBinding.ssa_block_4.Lasm_GetBinding.ssa_block_3:- cbz x0, .Lasm_GetBinding.assert_predicate_failure_13+ cbz x0, .Lasm_GetBinding.assert_predicate_failure_15ldr x0, [x0, #24]cbz x0, .Lasm_GetBinding.assert_failure_0ldr x0, [x0, x2, lsl #3]@@ -3408,8 +3409,8 @@ asm_handler_GetBinding:b.eq .Lasm_GetBinding.ssa_block_1ldrb w9, [x21, #3]str x0, [x27, x9, lsl #3]- ldrb w9, [x21, #15]- add x21, x21, #15+ ldrb w9, [x21, #10]+ add x21, x21, #10ldr x10, [x19, x9, lsl #3]br x10asm_handler_GetBinding_hot_end:@@ -3462,27 +3463,28 @@ asm_handler_DynamicGetBinding_hot_end:.p2align 4asm_handler_GetInitializedBinding:ldr x0, [x28, #32]- add x1, x21, #7- ldp w1, w2, [x1, #0]- cbz x0, .Lasm_GetInitializedBinding.assert_predicate_failure_9+ add x2, x21, #7+ ldrb w1, [x2]+ ldurh w2, [x2, #1]+ cbz x0, .Lasm_GetInitializedBinding.assert_predicate_failure_11cbz w1, .Lasm_GetInitializedBinding.ssa_block_2.Lasm_GetInitializedBinding.ssa_block_3:ldr w0, [x0, #16]add x9, x24, w0, uxtw #3cmp w0, #0csel x0, x9, xzr, ne- cbz x0, .Lasm_GetInitializedBinding.assert_predicate_failure_25+ cbz x0, .Lasm_GetInitializedBinding.assert_predicate_failure_27subs x1, x1, #1cbnz w1, .Lasm_GetInitializedBinding.ssa_block_3.Lasm_GetInitializedBinding.ssa_block_2:- cbz x0, .Lasm_GetInitializedBinding.assert_predicate_failure_12+ cbz x0, .Lasm_GetInitializedBinding.assert_predicate_failure_14ldr x0, [x0, #24]cbz x0, .Lasm_GetInitializedBinding.assert_failure_0ldr x0, [x0, x2, lsl #3]ldrb w9, [x21, #3]str x0, [x27, x9, lsl #3]- ldrb w9, [x21, #15]- add x21, x21, #15+ ldrb w9, [x21, #10]+ add x21, x21, #10ldr x10, [x19, x9, lsl #3]br x10asm_handler_GetInitializedBinding_hot_end:@@ -3532,27 +3534,28 @@ asm_handler_DynamicGetInitializedBinding_hot_end:.p2align 4asm_handler_InitializeLexicalBinding:ldr x0, [x28, #32]- add x1, x21, #5- ldp w1, w2, [x1, #0]- cbz x0, .Lasm_InitializeLexicalBinding.assert_predicate_failure_9+ add x2, x21, #5+ ldrb w1, [x2]+ ldurh w2, [x2, #1]+ cbz x0, .Lasm_InitializeLexicalBinding.assert_predicate_failure_11cbz w1, .Lasm_InitializeLexicalBinding.ssa_block_2.Lasm_InitializeLexicalBinding.ssa_block_3:ldr w0, [x0, #16]add x9, x24, w0, uxtw #3cmp w0, #0csel x0, x9, xzr, ne- cbz x0, .Lasm_InitializeLexicalBinding.assert_predicate_failure_25+ cbz x0, .Lasm_InitializeLexicalBinding.assert_predicate_failure_27subs x1, x1, #1cbnz w1, .Lasm_InitializeLexicalBinding.ssa_block_3.Lasm_InitializeLexicalBinding.ssa_block_2:- cbz x0, .Lasm_InitializeLexicalBinding.assert_predicate_failure_12+ cbz x0, .Lasm_InitializeLexicalBinding.assert_predicate_failure_14ldr x0, [x0, #24]cbz x0, .Lasm_InitializeLexicalBinding.assert_failure_0ldrb w1, [x21, #4]ldr x1, [x27, x1, lsl #3]str x1, [x0, x2, lsl #3]- ldrb w9, [x21, #13]- add x21, x21, #13+ ldrb w9, [x21, #8]+ add x21, x21, #8ldr x10, [x19, x9, lsl #3]br x10asm_handler_InitializeLexicalBinding_hot_end:@@ -3560,27 +3563,28 @@ asm_handler_InitializeLexicalBinding_hot_end:.p2align 4asm_handler_InitializeVariableBinding:ldr x0, [x28, #40]- add x1, x21, #5- ldp w1, w2, [x1, #0]- cbz x0, .Lasm_InitializeVariableBinding.assert_predicate_failure_9+ add x2, x21, #5+ ldrb w1, [x2]+ ldurh w2, [x2, #1]+ cbz x0, .Lasm_InitializeVariableBinding.assert_predicate_failure_11cbz w1, .Lasm_InitializeVariableBinding.ssa_block_2.Lasm_InitializeVariableBinding.ssa_block_3:ldr w0, [x0, #16]add x9, x24, w0, uxtw #3cmp w0, #0csel x0, x9, xzr, ne- cbz x0, .Lasm_InitializeVariableBinding.assert_predicate_failure_25+ cbz x0, .Lasm_InitializeVariableBinding.assert_predicate_failure_27subs x1, x1, #1cbnz w1, .Lasm_InitializeVariableBinding.ssa_block_3.Lasm_InitializeVariableBinding.ssa_block_2:- cbz x0, .Lasm_InitializeVariableBinding.assert_predicate_failure_12+ cbz x0, .Lasm_InitializeVariableBinding.assert_predicate_failure_14ldr x0, [x0, #24]cbz x0, .Lasm_InitializeVariableBinding.assert_failure_0ldrb w1, [x21, #4]ldr x1, [x27, x1, lsl #3]str x1, [x0, x2, lsl #3]- ldrb w9, [x21, #13]- add x21, x21, #13+ ldrb w9, [x21, #8]+ add x21, x21, #8ldr x10, [x19, x9, lsl #3]br x10asm_handler_InitializeVariableBinding_hot_end:@@ -3673,19 +3677,20 @@ asm_handler_DynamicInitializeVariableBinding_hot_end:asm_handler_SetLexicalBinding:ldr x1, [x28, #32]add x0, x21, #5- ldp w2, w0, [x0, #0]- cbz x1, .Lasm_SetLexicalBinding.assert_predicate_failure_9+ ldrb w2, [x0]+ ldurh w0, [x0, #1]+ cbz x1, .Lasm_SetLexicalBinding.assert_predicate_failure_11cbz w2, .Lasm_SetLexicalBinding.ssa_block_5.Lasm_SetLexicalBinding.ssa_block_6:ldr w1, [x1, #16]add x9, x24, w1, uxtw #3cmp w1, #0csel x1, x9, xzr, ne- cbz x1, .Lasm_SetLexicalBinding.assert_predicate_failure_31+ cbz x1, .Lasm_SetLexicalBinding.assert_predicate_failure_33subs x2, x2, #1cbnz w2, .Lasm_SetLexicalBinding.ssa_block_6.Lasm_SetLexicalBinding.ssa_block_5:- cbz x1, .Lasm_SetLexicalBinding.assert_predicate_failure_19+ cbz x1, .Lasm_SetLexicalBinding.assert_predicate_failure_21ldr x3, [x1, #24]cbz x3, .Lasm_SetLexicalBinding.assert_failure_0ldr x2, [x3, x0, lsl #3]@@ -3730,8 +3735,8 @@ asm_handler_SetLexicalBinding:ldrb w1, [x21, #4]ldr x1, [x27, x1, lsl #3]str x1, [x3, x0, lsl #3]- ldrb w9, [x21, #13]- add x21, x21, #13+ ldrb w9, [x21, #8]+ add x21, x21, #8ldr x10, [x19, x9, lsl #3]br x10asm_handler_SetLexicalBinding_hot_end:@@ -3740,19 +3745,20 @@ asm_handler_SetLexicalBinding_hot_end:asm_handler_SetVariableBinding:ldr x1, [x28, #40]add x0, x21, #5- ldp w2, w0, [x0, #0]- cbz x1, .Lasm_SetVariableBinding.assert_predicate_failure_9+ ldrb w2, [x0]+ ldurh w0, [x0, #1]+ cbz x1, .Lasm_SetVariableBinding.assert_predicate_failure_11cbz w2, .Lasm_SetVariableBinding.ssa_block_5.Lasm_SetVariableBinding.ssa_block_6:ldr w1, [x1, #16]add x9, x24, w1, uxtw #3cmp w1, #0csel x1, x9, xzr, ne- cbz x1, .Lasm_SetVariableBinding.assert_predicate_failure_31+ cbz x1, .Lasm_SetVariableBinding.assert_predicate_failure_33subs x2, x2, #1cbnz w2, .Lasm_SetVariableBinding.ssa_block_6.Lasm_SetVariableBinding.ssa_block_5:- cbz x1, .Lasm_SetVariableBinding.assert_predicate_failure_19+ cbz x1, .Lasm_SetVariableBinding.assert_predicate_failure_21ldr x3, [x1, #24]cbz x3, .Lasm_SetVariableBinding.assert_failure_0ldr x2, [x3, x0, lsl #3]@@ -3797,8 +3803,8 @@ asm_handler_SetVariableBinding:ldrb w1, [x21, #4]ldr x1, [x27, x1, lsl #3]str x1, [x3, x0, lsl #3]- ldrb w9, [x21, #13]- add x21, x21, #13+ ldrb w9, [x21, #8]+ add x21, x21, #8ldr x10, [x19, x9, lsl #3]br x10asm_handler_SetVariableBinding_hot_end:@@ -4641,20 +4647,21 @@ asm_handler_StrictlyInequals_hot_end:.p2align 4asm_handler_GetCalleeAndThisFromEnvironment:ldr x0, [x28, #32]- add x1, x21, #8- ldp w1, w2, [x1, #0]- cbz x0, .Lasm_GetCalleeAndThisFromEnvironment.assert_predicate_failure_9+ add x2, x21, #8+ ldrb w1, [x2]+ ldurh w2, [x2, #1]+ cbz x0, .Lasm_GetCalleeAndThisFromEnvironment.assert_predicate_failure_11cbz w1, .Lasm_GetCalleeAndThisFromEnvironment.ssa_block_3.Lasm_GetCalleeAndThisFromEnvironment.ssa_block_4:ldr w0, [x0, #16]add x9, x24, w0, uxtw #3cmp w0, #0csel x0, x9, xzr, ne- cbz x0, .Lasm_GetCalleeAndThisFromEnvironment.assert_predicate_failure_25+ cbz x0, .Lasm_GetCalleeAndThisFromEnvironment.assert_predicate_failure_27subs x1, x1, #1cbnz w1, .Lasm_GetCalleeAndThisFromEnvironment.ssa_block_4.Lasm_GetCalleeAndThisFromEnvironment.ssa_block_3:- cbz x0, .Lasm_GetCalleeAndThisFromEnvironment.assert_predicate_failure_13+ cbz x0, .Lasm_GetCalleeAndThisFromEnvironment.assert_predicate_failure_15ldr x0, [x0, #24]cbz x0, .Lasm_GetCalleeAndThisFromEnvironment.assert_failure_0ldr x0, [x0, x2, lsl #3]@@ -4666,8 +4673,8 @@ asm_handler_GetCalleeAndThisFromEnvironment:ldrb w9, [x21, #4]movz x10, #0x7ffe, lsl #48str x10, [x27, x9, lsl #3]- ldrb w9, [x21, #16]- add x21, x21, #16+ ldrb w9, [x21, #11]+ add x21, x21, #11ldr x10, [x19, x9, lsl #3]br x10asm_handler_GetCalleeAndThisFromEnvironment_hot_end:@@ -20931,11 +20938,11 @@ asm_assertion_failure_traps:brk #0.Lasm_SetLexicalEnvironment.assert_predicate_failure_3:brk #0-.Lasm_GetBinding.assert_predicate_failure_9:+.Lasm_GetBinding.assert_predicate_failure_11:brk #0-.Lasm_GetBinding.assert_predicate_failure_25:+.Lasm_GetBinding.assert_predicate_failure_27:brk #0-.Lasm_GetBinding.assert_predicate_failure_13:+.Lasm_GetBinding.assert_predicate_failure_15:brk #0.Lasm_GetBinding.assert_failure_0:brk #0@@ -20945,11 +20952,11 @@ asm_assertion_failure_traps:brk #0.Lasm_DynamicGetBinding.assert_failure_0:brk #0-.Lasm_GetInitializedBinding.assert_predicate_failure_9:+.Lasm_GetInitializedBinding.assert_predicate_failure_11:brk #0-.Lasm_GetInitializedBinding.assert_predicate_failure_25:+.Lasm_GetInitializedBinding.assert_predicate_failure_27:brk #0-.Lasm_GetInitializedBinding.assert_predicate_failure_12:+.Lasm_GetInitializedBinding.assert_predicate_failure_14:brk #0.Lasm_GetInitializedBinding.assert_failure_0:brk #0@@ -20959,19 +20966,19 @@ asm_assertion_failure_traps:brk #0.Lasm_DynamicGetInitializedBinding.assert_failure_0:brk #0-.Lasm_InitializeLexicalBinding.assert_predicate_failure_9:+.Lasm_InitializeLexicalBinding.assert_predicate_failure_11:brk #0-.Lasm_InitializeLexicalBinding.assert_predicate_failure_25:+.Lasm_InitializeLexicalBinding.assert_predicate_failure_27:brk #0-.Lasm_InitializeLexicalBinding.assert_predicate_failure_12:+.Lasm_InitializeLexicalBinding.assert_predicate_failure_14:brk #0.Lasm_InitializeLexicalBinding.assert_failure_0:brk #0-.Lasm_InitializeVariableBinding.assert_predicate_failure_9:+.Lasm_InitializeVariableBinding.assert_predicate_failure_11:brk #0-.Lasm_InitializeVariableBinding.assert_predicate_failure_25:+.Lasm_InitializeVariableBinding.assert_predicate_failure_27:brk #0-.Lasm_InitializeVariableBinding.assert_predicate_failure_12:+.Lasm_InitializeVariableBinding.assert_predicate_failure_14:brk #0.Lasm_InitializeVariableBinding.assert_failure_0:brk #0@@ -20987,11 +20994,11 @@ asm_assertion_failure_traps:brk #0.Lasm_DynamicInitializeVariableBinding.assert_failure_0:brk #0-.Lasm_SetLexicalBinding.assert_predicate_failure_9:+.Lasm_SetLexicalBinding.assert_predicate_failure_11:brk #0-.Lasm_SetLexicalBinding.assert_predicate_failure_31:+.Lasm_SetLexicalBinding.assert_predicate_failure_33:brk #0-.Lasm_SetLexicalBinding.assert_predicate_failure_19:+.Lasm_SetLexicalBinding.assert_predicate_failure_21:brk #0.Lasm_SetLexicalBinding.assert_failure_0:brk #0@@ -21001,11 +21008,11 @@ asm_assertion_failure_traps:brk #0.Lasm_SetLexicalBinding.assert_failure_3:brk #0-.Lasm_SetVariableBinding.assert_predicate_failure_9:+.Lasm_SetVariableBinding.assert_predicate_failure_11:brk #0-.Lasm_SetVariableBinding.assert_predicate_failure_31:+.Lasm_SetVariableBinding.assert_predicate_failure_33:brk #0-.Lasm_SetVariableBinding.assert_predicate_failure_19:+.Lasm_SetVariableBinding.assert_predicate_failure_21:brk #0.Lasm_SetVariableBinding.assert_failure_0:brk #0@@ -21039,11 +21046,11 @@ asm_assertion_failure_traps:brk #0.Lasm_DynamicSetVariableBinding.assert_failure_3:brk #0-.Lasm_GetCalleeAndThisFromEnvironment.assert_predicate_failure_9:+.Lasm_GetCalleeAndThisFromEnvironment.assert_predicate_failure_11:brk #0-.Lasm_GetCalleeAndThisFromEnvironment.assert_predicate_failure_25:+.Lasm_GetCalleeAndThisFromEnvironment.assert_predicate_failure_27:brk #0-.Lasm_GetCalleeAndThisFromEnvironment.assert_predicate_failure_13:+.Lasm_GetCalleeAndThisFromEnvironment.assert_predicate_failure_15:brk #0.Lasm_GetCalleeAndThisFromEnvironment.assert_failure_0:brk #0diff --git a/Libraries/LibJS/Flap/tests/interpreter-assembly/x86_64.S b/Libraries/LibJS/Flap/tests/interpreter-assembly/x86_64.Sindex 30fbe4fbeac..5528d40f6ef 100644--- a/Libraries/LibJS/Flap/tests/interpreter-assembly/x86_64.S+++ b/Libraries/LibJS/Flap/tests/interpreter-assembly/x86_64.S@@ -3286,11 +3286,11 @@ asm_handler_SetLexicalEnvironment_hot_end:.p2align 6asm_handler_GetBinding:mov rax, QWORD PTR [rbx - 96]- lea rcx, [r14 + r13 + 7]- mov edx, DWORD PTR [rcx + 4]- mov ecx, DWORD PTR [rcx]+ lea rdx, [r14 + r13 + 7]+ movzx ecx, BYTE PTR [rdx]+ movzx edx, WORD PTR [rdx + 1]test rax, rax- jz .Lasm_GetBinding.assert_predicate_failure_9+ jz .Lasm_GetBinding.assert_predicate_failure_11test ecx, ecxjz .Lasm_GetBinding.ssa_block_3.Lasm_GetBinding.ssa_block_4:@@ -3299,13 +3299,13 @@ asm_handler_GetBinding:test eax, eaxcmovnz rax, r11test rax, rax- jz .Lasm_GetBinding.assert_predicate_failure_25+ jz .Lasm_GetBinding.assert_predicate_failure_27sub rcx, 1test ecx, ecxjnz .Lasm_GetBinding.ssa_block_4.Lasm_GetBinding.ssa_block_3:test rax, rax- jz .Lasm_GetBinding.assert_predicate_failure_13+ jz .Lasm_GetBinding.assert_predicate_failure_15mov rax, QWORD PTR [rax + 24]test rax, raxjz .Lasm_GetBinding.assert_failure_0@@ -3316,7 +3316,7 @@ asm_handler_GetBinding:je .Lasm_GetBinding.ssa_block_1movzx r11d, BYTE PTR [r14 + r13 + 3]mov QWORD PTR [rbx + r11 * 8], rax- add r13d, 15+ add r13d, 10movzx eax, BYTE PTR [r14 + r13]jmp [r12 + rax * 8]asm_handler_GetBinding_hot_end:@@ -3375,11 +3375,11 @@ asm_handler_DynamicGetBinding_hot_end:.p2align 6asm_handler_GetInitializedBinding:mov rax, QWORD PTR [rbx - 96]- lea rcx, [r14 + r13 + 7]- mov edx, DWORD PTR [rcx + 4]- mov ecx, DWORD PTR [rcx]+ lea rdx, [r14 + r13 + 7]+ movzx ecx, BYTE PTR [rdx]+ movzx edx, WORD PTR [rdx + 1]test rax, rax- jz .Lasm_GetInitializedBinding.assert_predicate_failure_9+ jz .Lasm_GetInitializedBinding.assert_predicate_failure_11test ecx, ecxjz .Lasm_GetInitializedBinding.ssa_block_2.Lasm_GetInitializedBinding.ssa_block_3:@@ -3388,20 +3388,20 @@ asm_handler_GetInitializedBinding:test eax, eaxcmovnz rax, r11test rax, rax- jz .Lasm_GetInitializedBinding.assert_predicate_failure_25+ jz .Lasm_GetInitializedBinding.assert_predicate_failure_27sub rcx, 1test ecx, ecxjnz .Lasm_GetInitializedBinding.ssa_block_3.Lasm_GetInitializedBinding.ssa_block_2:test rax, rax- jz .Lasm_GetInitializedBinding.assert_predicate_failure_12+ jz .Lasm_GetInitializedBinding.assert_predicate_failure_14mov rax, QWORD PTR [rax + 24]test rax, raxjz .Lasm_GetInitializedBinding.assert_failure_0mov rax, QWORD PTR [rax + rdx * 8]movzx r11d, BYTE PTR [r14 + r13 + 3]mov QWORD PTR [rbx + r11 * 8], rax- add r13d, 15+ add r13d, 10movzx eax, BYTE PTR [r14 + r13]jmp [r12 + rax * 8]asm_handler_GetInitializedBinding_hot_end:@@ -3456,11 +3456,11 @@ asm_handler_DynamicGetInitializedBinding_hot_end:.p2align 6asm_handler_InitializeLexicalBinding:mov rax, QWORD PTR [rbx - 96]- lea rcx, [r14 + r13 + 5]- mov edx, DWORD PTR [rcx + 4]- mov ecx, DWORD PTR [rcx]+ lea rdx, [r14 + r13 + 5]+ movzx ecx, BYTE PTR [rdx]+ movzx edx, WORD PTR [rdx + 1]test rax, rax- jz .Lasm_InitializeLexicalBinding.assert_predicate_failure_9+ jz .Lasm_InitializeLexicalBinding.assert_predicate_failure_11test ecx, ecxjz .Lasm_InitializeLexicalBinding.ssa_block_2.Lasm_InitializeLexicalBinding.ssa_block_3:@@ -3469,20 +3469,20 @@ asm_handler_InitializeLexicalBinding:test eax, eaxcmovnz rax, r11test rax, rax- jz .Lasm_InitializeLexicalBinding.assert_predicate_failure_25+ jz .Lasm_InitializeLexicalBinding.assert_predicate_failure_27sub rcx, 1test ecx, ecxjnz .Lasm_InitializeLexicalBinding.ssa_block_3.Lasm_InitializeLexicalBinding.ssa_block_2:test rax, rax- jz .Lasm_InitializeLexicalBinding.assert_predicate_failure_12+ jz .Lasm_InitializeLexicalBinding.assert_predicate_failure_14mov rax, QWORD PTR [rax + 24]test rax, raxjz .Lasm_InitializeLexicalBinding.assert_failure_0movzx ecx, BYTE PTR [r14 + r13 + 4]mov rcx, QWORD PTR [rbx + rcx * 8]mov QWORD PTR [rax + rdx * 8], rcx- add r13d, 13+ add r13d, 8movzx eax, BYTE PTR [r14 + r13]jmp [r12 + rax * 8]asm_handler_InitializeLexicalBinding_hot_end:@@ -3490,11 +3490,11 @@ asm_handler_InitializeLexicalBinding_hot_end:.p2align 6asm_handler_InitializeVariableBinding:mov rax, QWORD PTR [rbx - 88]- lea rcx, [r14 + r13 + 5]- mov edx, DWORD PTR [rcx + 4]- mov ecx, DWORD PTR [rcx]+ lea rdx, [r14 + r13 + 5]+ movzx ecx, BYTE PTR [rdx]+ movzx edx, WORD PTR [rdx + 1]test rax, rax- jz .Lasm_InitializeVariableBinding.assert_predicate_failure_9+ jz .Lasm_InitializeVariableBinding.assert_predicate_failure_11test ecx, ecxjz .Lasm_InitializeVariableBinding.ssa_block_2.Lasm_InitializeVariableBinding.ssa_block_3:@@ -3503,20 +3503,20 @@ asm_handler_InitializeVariableBinding:test eax, eaxcmovnz rax, r11test rax, rax- jz .Lasm_InitializeVariableBinding.assert_predicate_failure_25+ jz .Lasm_InitializeVariableBinding.assert_predicate_failure_27sub rcx, 1test ecx, ecxjnz .Lasm_InitializeVariableBinding.ssa_block_3.Lasm_InitializeVariableBinding.ssa_block_2:test rax, rax- jz .Lasm_InitializeVariableBinding.assert_predicate_failure_12+ jz .Lasm_InitializeVariableBinding.assert_predicate_failure_14mov rax, QWORD PTR [rax + 24]test rax, raxjz .Lasm_InitializeVariableBinding.assert_failure_0movzx ecx, BYTE PTR [r14 + r13 + 4]mov rcx, QWORD PTR [rbx + rcx * 8]mov QWORD PTR [rax + rdx * 8], rcx- add r13d, 13+ add r13d, 8movzx eax, BYTE PTR [r14 + r13]jmp [r12 + rax * 8]asm_handler_InitializeVariableBinding_hot_end:@@ -3619,10 +3619,10 @@ asm_handler_DynamicInitializeVariableBinding_hot_end:asm_handler_SetLexicalBinding:mov rcx, QWORD PTR [rbx - 96]lea rax, [r14 + r13 + 5]- mov edx, DWORD PTR [rax]- mov eax, DWORD PTR [rax + 4]+ movzx edx, BYTE PTR [rax]+ movzx eax, WORD PTR [rax + 1]test rcx, rcx- jz .Lasm_SetLexicalBinding.assert_predicate_failure_9+ jz .Lasm_SetLexicalBinding.assert_predicate_failure_11test edx, edxjz .Lasm_SetLexicalBinding.ssa_block_5.Lasm_SetLexicalBinding.ssa_block_6:@@ -3631,13 +3631,13 @@ asm_handler_SetLexicalBinding:test ecx, ecxcmovnz rcx, r11test rcx, rcx- jz .Lasm_SetLexicalBinding.assert_predicate_failure_31+ jz .Lasm_SetLexicalBinding.assert_predicate_failure_33sub rdx, 1test edx, edxjnz .Lasm_SetLexicalBinding.ssa_block_6.Lasm_SetLexicalBinding.ssa_block_5:test rcx, rcx- jz .Lasm_SetLexicalBinding.assert_predicate_failure_19+ jz .Lasm_SetLexicalBinding.assert_predicate_failure_21mov rsi, QWORD PTR [rcx + 24]test rsi, rsijz .Lasm_SetLexicalBinding.assert_failure_0@@ -3687,7 +3687,7 @@ asm_handler_SetLexicalBinding:movzx ecx, BYTE PTR [r14 + r13 + 4]mov rcx, QWORD PTR [rbx + rcx * 8]mov QWORD PTR [rsi + rax * 8], rcx- add r13d, 13+ add r13d, 8movzx eax, BYTE PTR [r14 + r13]jmp [r12 + rax * 8]asm_handler_SetLexicalBinding_hot_end:@@ -3696,10 +3696,10 @@ asm_handler_SetLexicalBinding_hot_end:asm_handler_SetVariableBinding:mov rcx, QWORD PTR [rbx - 88]lea rax, [r14 + r13 + 5]- mov edx, DWORD PTR [rax]- mov eax, DWORD PTR [rax + 4]+ movzx edx, BYTE PTR [rax]+ movzx eax, WORD PTR [rax + 1]test rcx, rcx- jz .Lasm_SetVariableBinding.assert_predicate_failure_9+ jz .Lasm_SetVariableBinding.assert_predicate_failure_11test edx, edxjz .Lasm_SetVariableBinding.ssa_block_5.Lasm_SetVariableBinding.ssa_block_6:@@ -3708,13 +3708,13 @@ asm_handler_SetVariableBinding:test ecx, ecxcmovnz rcx, r11test rcx, rcx- jz .Lasm_SetVariableBinding.assert_predicate_failure_31+ jz .Lasm_SetVariableBinding.assert_predicate_failure_33sub rdx, 1test edx, edxjnz .Lasm_SetVariableBinding.ssa_block_6.Lasm_SetVariableBinding.ssa_block_5:test rcx, rcx- jz .Lasm_SetVariableBinding.assert_predicate_failure_19+ jz .Lasm_SetVariableBinding.assert_predicate_failure_21mov rsi, QWORD PTR [rcx + 24]test rsi, rsijz .Lasm_SetVariableBinding.assert_failure_0@@ -3764,7 +3764,7 @@ asm_handler_SetVariableBinding:movzx ecx, BYTE PTR [r14 + r13 + 4]mov rcx, QWORD PTR [rbx + rcx * 8]mov QWORD PTR [rsi + rax * 8], rcx- add r13d, 13+ add r13d, 8movzx eax, BYTE PTR [r14 + r13]jmp [r12 + rax * 8]asm_handler_SetVariableBinding_hot_end:@@ -4624,11 +4624,11 @@ asm_handler_StrictlyInequals_hot_end:.p2align 6asm_handler_GetCalleeAndThisFromEnvironment:mov rax, QWORD PTR [rbx - 96]- lea rcx, [r14 + r13 + 8]- mov edx, DWORD PTR [rcx + 4]- mov ecx, DWORD PTR [rcx]+ lea rdx, [r14 + r13 + 8]+ movzx ecx, BYTE PTR [rdx]+ movzx edx, WORD PTR [rdx + 1]test rax, rax- jz .Lasm_GetCalleeAndThisFromEnvironment.assert_predicate_failure_9+ jz .Lasm_GetCalleeAndThisFromEnvironment.assert_predicate_failure_11test ecx, ecxjz .Lasm_GetCalleeAndThisFromEnvironment.ssa_block_3.Lasm_GetCalleeAndThisFromEnvironment.ssa_block_4:@@ -4637,13 +4637,13 @@ asm_handler_GetCalleeAndThisFromEnvironment:test eax, eaxcmovnz rax, r11test rax, rax- jz .Lasm_GetCalleeAndThisFromEnvironment.assert_predicate_failure_25+ jz .Lasm_GetCalleeAndThisFromEnvironment.assert_predicate_failure_27sub rcx, 1test ecx, ecxjnz .Lasm_GetCalleeAndThisFromEnvironment.ssa_block_4.Lasm_GetCalleeAndThisFromEnvironment.ssa_block_3:test rax, rax- jz .Lasm_GetCalleeAndThisFromEnvironment.assert_predicate_failure_13+ jz .Lasm_GetCalleeAndThisFromEnvironment.assert_predicate_failure_15mov rax, QWORD PTR [rax + 24]test rax, raxjz .Lasm_GetCalleeAndThisFromEnvironment.assert_failure_0@@ -4657,7 +4657,7 @@ asm_handler_GetCalleeAndThisFromEnvironment:movabs r11, 9222809086901354496movzx eax, BYTE PTR [r14 + r13 + 4]mov QWORD PTR [rbx + rax * 8], r11- add r13d, 16+ add r13d, 11movzx eax, BYTE PTR [r14 + r13]jmp [r12 + rax * 8]asm_handler_GetCalleeAndThisFromEnvironment_hot_end:@@ -20331,11 +20331,11 @@ asm_assertion_failure_traps:ud2.Lasm_SetLexicalEnvironment.assert_predicate_failure_3:ud2-.Lasm_GetBinding.assert_predicate_failure_9:+.Lasm_GetBinding.assert_predicate_failure_11:ud2-.Lasm_GetBinding.assert_predicate_failure_25:+.Lasm_GetBinding.assert_predicate_failure_27:ud2-.Lasm_GetBinding.assert_predicate_failure_13:+.Lasm_GetBinding.assert_predicate_failure_15:ud2.Lasm_GetBinding.assert_failure_0:ud2@@ -20345,11 +20345,11 @@ asm_assertion_failure_traps:ud2.Lasm_DynamicGetBinding.assert_failure_0:ud2-.Lasm_GetInitializedBinding.assert_predicate_failure_9:+.Lasm_GetInitializedBinding.assert_predicate_failure_11:ud2-.Lasm_GetInitializedBinding.assert_predicate_failure_25:+.Lasm_GetInitializedBinding.assert_predicate_failure_27:ud2-.Lasm_GetInitializedBinding.assert_predicate_failure_12:+.Lasm_GetInitializedBinding.assert_predicate_failure_14:ud2.Lasm_GetInitializedBinding.assert_failure_0:ud2@@ -20359,19 +20359,19 @@ asm_assertion_failure_traps:ud2.Lasm_DynamicGetInitializedBinding.assert_failure_0:ud2-.Lasm_InitializeLexicalBinding.assert_predicate_failure_9:+.Lasm_InitializeLexicalBinding.assert_predicate_failure_11:ud2-.Lasm_InitializeLexicalBinding.assert_predicate_failure_25:+.Lasm_InitializeLexicalBinding.assert_predicate_failure_27:ud2-.Lasm_InitializeLexicalBinding.assert_predicate_failure_12:+.Lasm_InitializeLexicalBinding.assert_predicate_failure_14:ud2.Lasm_InitializeLexicalBinding.assert_failure_0:ud2-.Lasm_InitializeVariableBinding.assert_predicate_failure_9:+.Lasm_InitializeVariableBinding.assert_predicate_failure_11:ud2-.Lasm_InitializeVariableBinding.assert_predicate_failure_25:+.Lasm_InitializeVariableBinding.assert_predicate_failure_27:ud2-.Lasm_InitializeVariableBinding.assert_predicate_failure_12:+.Lasm_InitializeVariableBinding.assert_predicate_failure_14:ud2.Lasm_InitializeVariableBinding.assert_failure_0:ud2@@ -20387,11 +20387,11 @@ asm_assertion_failure_traps:ud2.Lasm_DynamicInitializeVariableBinding.assert_failure_0:ud2-.Lasm_SetLexicalBinding.assert_predicate_failure_9:+.Lasm_SetLexicalBinding.assert_predicate_failure_11:ud2-.Lasm_SetLexicalBinding.assert_predicate_failure_31:+.Lasm_SetLexicalBinding.assert_predicate_failure_33:ud2-.Lasm_SetLexicalBinding.assert_predicate_failure_19:+.Lasm_SetLexicalBinding.assert_predicate_failure_21:ud2.Lasm_SetLexicalBinding.assert_failure_0:ud2@@ -20401,11 +20401,11 @@ asm_assertion_failure_traps:ud2.Lasm_SetLexicalBinding.assert_failure_3:ud2-.Lasm_SetVariableBinding.assert_predicate_failure_9:+.Lasm_SetVariableBinding.assert_predicate_failure_11:ud2-.Lasm_SetVariableBinding.assert_predicate_failure_31:+.Lasm_SetVariableBinding.assert_predicate_failure_33:ud2-.Lasm_SetVariableBinding.assert_predicate_failure_19:+.Lasm_SetVariableBinding.assert_predicate_failure_21:ud2.Lasm_SetVariableBinding.assert_failure_0:ud2@@ -20439,11 +20439,11 @@ asm_assertion_failure_traps:ud2.Lasm_DynamicSetVariableBinding.assert_failure_3:ud2-.Lasm_GetCalleeAndThisFromEnvironment.assert_predicate_failure_9:+.Lasm_GetCalleeAndThisFromEnvironment.assert_predicate_failure_11:ud2-.Lasm_GetCalleeAndThisFromEnvironment.assert_predicate_failure_25:+.Lasm_GetCalleeAndThisFromEnvironment.assert_predicate_failure_27:ud2-.Lasm_GetCalleeAndThisFromEnvironment.assert_predicate_failure_13:+.Lasm_GetCalleeAndThisFromEnvironment.assert_predicate_failure_15:ud2.Lasm_GetCalleeAndThisFromEnvironment.assert_failure_0:ud2diff --git a/Libraries/LibJS/Flap/tests/interpreter-layout.conf b/Libraries/LibJS/Flap/tests/interpreter-layout.confindex 130e5486e1a..678b61423c9 100644--- a/Libraries/LibJS/Flap/tests/interpreter-layout.conf+++ b/Libraries/LibJS/Flap/tests/interpreter-layout.conf@@ -460,6 +460,8 @@ const ENVIRONMENT_COORDINATE_INVALID = 0xFFFFFFFEconst ENVIRONMENT_COORDINATE_SIZE = 8field EnvironmentCoordinateEntry.hops u32 ENVIRONMENT_COORDINATE_HOPS nullable scalar environment_coordinate stride 8field EnvironmentCoordinateEntry.binding_index u32 ENVIRONMENT_COORDINATE_INDEX nullable scalar environment_coordinate+field BytecodeEnvironmentCoordinate.hops u8 0 nullable scalar+field BytecodeEnvironmentCoordinate.binding_index u16 1 nullable scalar# TypedArrayBase layoutconst TYPED_ARRAY_ELEMENT_SIZE = 65diff --git a/Libraries/LibJS/Interpreter/interpreter.flap b/Libraries/LibJS/Interpreter/interpreter.flapindex e3c10530960..50378bbd3c0 100644--- a/Libraries/LibJS/Interpreter/interpreter.flap+++ b/Libraries/LibJS/Interpreter/interpreter.flap@@ -226,8 +226,8 @@ inline fn walk_environment_chain() -> (DeclarativeEnvironment, u32) {let mut environment = initial_environment;let coordinate = &coordinate;- let mut hops = coordinate.hops;- let binding_index = coordinate.binding_index;+ let mut hops = u32(coordinate.hops);+ let binding_index = u32(coordinate.binding_index);assert(environment != 0);if hops != 0 {do {diff --git a/Libraries/LibJS/JIT/Rust/src/builder/tests.rs b/Libraries/LibJS/JIT/Rust/src/builder/tests.rsindex 293deedfcd3..170642ea4e6 100644--- a/Libraries/LibJS/JIT/Rust/src/builder/tests.rs+++ b/Libraries/LibJS/JIT/Rust/src/builder/tests.rs@@ -1945,7 +1945,7 @@ pub(crate) mod inlining {[[B3]] <- [[B2]], [[B7]]:[[V15]] = Phi ([[V9]], [[V12]])EnsureFrameInitialized- [[V16]] = CallSlowPath Add @25 ([[V6]], [[V15]]) [[[FS1]]]+ [[V16]] = CallSlowPath Add @20 ([[V6]], [[V15]]) [[[FS1]]]BranchBindingMutable 2 ([[V5]]) -> [[B4]], [[B8]][[B4]] <- [[B3]]:[[V20]] = LoadEnvironmentBinding 2 ([[V5]])@@ -1957,19 +1957,19 @@ pub(crate) mod inlining {[[V29]] = EmptyToUndefined ([[V16]])Return ([[V29]])[[B7]] <- [[B1]] cold:- [[V12]] = CallSlowPath GetGlobal @16 [[[FS0]]]+ [[V12]] = CallSlowPath GetGlobal @11 [[[FS0]]]Jump [[B3]][[B8]] <- [[B3]] cold:Jump [[B10]][[B9]] <- [[B4]] cold:Jump [[B10]][[B10]] <- [[B8]], [[B9]] cold:- CallSlowPath SetLexicalBinding @31 ([[V16]]) [[[FS2]]]+ CallSlowPath SetLexicalBinding @26 ([[V16]]) [[[FS2]]]Jump [[B6]]frame states:- [[FS0]]: pc 16 at {r5=[[V6]]}- [[FS1]]: pc 25 after -> r7 {} frame [r7]- [[FS2]]: pc 31 at {r7=[[V16]]}+ [[FS0]]: pc 11 at {r5=[[V6]]}+ [[FS1]]: pc 20 after -> r7 {} frame [r7]+ [[FS2]]: pc 26 at {r7=[[V16]]}",);// Inlined callees have constant ones: those of their function.@@ -1992,7 +1992,7 @@ pub(crate) mod inlining {[[B4]] <- [[B3]], [[B9]]:[[V20]] = Phi ([[V14]], [[V17]])PublishFrame- [[V21]] = CallSlowPath Add @e1:25 ([[V11]], [[V20]]) [[[FS3]]]+ [[V21]] = CallSlowPath Add @e1:20 ([[V11]], [[V20]]) [[[FS3]]]BranchBindingMutable 2 ([[V10]]) -> [[B5]], [[B10]][[B5]] <- [[B4]]:[[V25]] = LoadEnvironmentBinding 2 ([[V10]])@@ -2007,21 +2007,21 @@ pub(crate) mod inlining {Return ([[V34]])[[B9]] <- [[B2]] cold:PublishFrame- [[V17]] = CallSlowPath GetGlobal @e1:16 [[[FS2]]]+ [[V17]] = CallSlowPath GetGlobal @e1:11 [[[FS2]]]Jump [[B4]][[B10]] <- [[B4]] cold:Jump [[B12]][[B11]] <- [[B5]] cold:Jump [[B12]][[B12]] <- [[B10]], [[B11]] cold:- CallSlowPath SetLexicalBinding @e1:31 ([[V21]]) [[[FS4]]]+ CallSlowPath SetLexicalBinding @e1:26 ([[V21]]) [[[FS4]]]Jump [[B7]]frame states:[[FS0]]: pc 1 at {} frame [a0][[FS1]]: pc 1 after -> r5 {}- [[FS2]]: e1 pc 16 at {r0=#empty, r2=#empty, r3=#empty, r4=#empty, r5=[[V11]]} in [[FS1]]- [[FS3]]: e1 pc 25 after -> r7 {r0=#empty, r2=#empty, r3=#empty, r4=#empty, r7=#empty} in [[FS1]]- [[FS4]]: e1 pc 31 at {r0=#empty, r2=#empty, r3=#empty, r4=#empty, r7=[[V21]]} in [[FS1]]+ [[FS2]]: e1 pc 11 at {r0=#empty, r2=#empty, r3=#empty, r4=#empty, r5=[[V11]]} in [[FS1]]+ [[FS3]]: e1 pc 20 after -> r7 {r0=#empty, r2=#empty, r3=#empty, r4=#empty, r7=#empty} in [[FS1]]+ [[FS4]]: e1 pc 26 at {r0=#empty, r2=#empty, r3=#empty, r4=#empty, r7=[[V21]]} in [[FS1]]",);}diff --git a/Libraries/LibJS/Rust/generate/layout_table.rs b/Libraries/LibJS/Rust/generate/layout_table.rsindex 7d6dee682b5..a3bf233e98c 100644--- a/Libraries/LibJS/Rust/generate/layout_table.rs+++ b/Libraries/LibJS/Rust/generate/layout_table.rs@@ -573,6 +573,8 @@ pub fn generate(configuration: &LayoutConfiguration) -> LayoutWriter {let environment_coordinate_size = size!(w, "ENVIRONMENT_COORDINATE_SIZE", EnvironmentCoordinate);w.line(&format!("field EnvironmentCoordinateEntry.hops u32 ENVIRONMENT_COORDINATE_HOPS nullable scalar environment_coordinate stride {environment_coordinate_size}"));w.line("field EnvironmentCoordinateEntry.binding_index u32 ENVIRONMENT_COORDINATE_INDEX nullable scalar environment_coordinate");+ w.line("field BytecodeEnvironmentCoordinate.hops u8 0 nullable scalar");+ w.line("field BytecodeEnvironmentCoordinate.binding_index u16 1 nullable scalar");w.section("TypedArrayBase layout");offset!(w, "TYPED_ARRAY_ELEMENT_SIZE", TypedArrayBase, element_size);diff --git a/Libraries/LibJS/Rust/generate/ops.rs b/Libraries/LibJS/Rust/generate/ops.rsindex b8739057e17..14db8f4c146 100644--- a/Libraries/LibJS/Rust/generate/ops.rs+++ b/Libraries/LibJS/Rust/generate/ops.rs@@ -42,7 +42,7 @@ fn rust_type(ty: &str) -> String {"IdentifierTableIndex" | "PropertyKeyTableIndex" | "StringTableIndex" => ty.to_string(),"Optional<IdentifierTableIndex>" => "OptionalIndex<IdentifierTableIndex>".to_string(),"Optional<StringTableIndex>" => "OptionalIndex<StringTableIndex>".to_string(),- "EnvironmentCoordinate" => "EnvironmentCoordinate".to_string(),+ "EnvironmentCoordinate" => "BytecodeEnvironmentCoordinate".to_string(),"Value" => "Value".to_string(),"Builtin" => "u8".to_string(),_ => {diff --git a/Libraries/LibJS/Rust/src/bytecode/codegen/bindings.rs b/Libraries/LibJS/Rust/src/bytecode/codegen/bindings.rsindex 0bb361f657a..fdadb70682a 100644--- a/Libraries/LibJS/Rust/src/bytecode/codegen/bindings.rs+++ b/Libraries/LibJS/Rust/src/bytecode/codegen/bindings.rs@@ -11,6 +11,7 @@ use crate::bytecode::operand::*;use super::context::Generator;use super::environment::BindingLocation;+use super::environment::location_for_instructions;use super::registers::ScopedOperand;pub(super) fn emit_get_binding(@@ -35,7 +36,7 @@ pub(super) fn emit_get_binding_at(// the binding lives in a known declarative environment. The dynamic forms// remain necessary for script and eval code, eval-poisoned scopes, and// `with`.- match (location, known_initialized) {+ match (location_for_instructions(location), known_initialized) {(Some(BindingLocation::Import(import_index)), _) => generator.emit(op::GetImport {dst,identifier,@@ -88,7 +89,7 @@ pub(super) fn emit_get_callee_and_this_from_environment(this_value: Operand,identifier: IdentifierTableIndex,) {- match generator.binding_location_for_identifier(identifier) {+ match location_for_instructions(generator.binding_location_for_identifier(identifier)) {Some(BindingLocation::Environment(cache)) => {let value_feedback = generator.next_value_feedback();generator.emit(op::GetCalleeAndThisFromEnvironment {@@ -175,7 +176,7 @@ pub(super) fn emit_set_variable_binding(generator: &mut Generator<'_>, identifie}pub(super) fn emit_typeof_binding(generator: &mut Generator<'_>, dst: Operand, identifier: IdentifierTableIndex) {- match generator.binding_location_for_identifier(identifier) {+ match location_for_instructions(generator.binding_location_for_identifier(identifier)) {Some(BindingLocation::Environment(cache)) => {generator.emit(op::TypeofBinding { dst, identifier, cache });}diff --git a/Libraries/LibJS/Rust/src/bytecode/codegen/environment.rs b/Libraries/LibJS/Rust/src/bytecode/codegen/environment.rsindex 98d71131b71..5d309276ca6 100644--- a/Libraries/LibJS/Rust/src/bytecode/codegen/environment.rs+++ b/Libraries/LibJS/Rust/src/bytecode/codegen/environment.rs@@ -65,6 +65,14 @@ pub enum BindingLocation {Import(u32),}+/// Where instructions find a binding at `location`: by name, unless they can hold its coordinate.+pub(super) fn location_for_instructions(location: Option<BindingLocation>) -> Option<BindingLocation> {+ match location {+ Some(BindingLocation::Environment(coordinate)) if !coordinate.fits_in_instruction() => None,+ location => location,+ }+}+pub(super) enum ScopeLookup {Found(u32),NotFound,@@ -293,7 +301,7 @@ impl Generator<'_> {name: &Utf16FlyString,scope_index: Option<usize>,) -> Option<EnvironmentCoordinate> {- match self.binding_location_for_from_scope_index(name, scope_index)? {+ match location_for_instructions(self.binding_location_for_from_scope_index(name, scope_index))? {BindingLocation::Environment(coordinate) => Some(coordinate),BindingLocation::Import(_) => None,}@@ -356,7 +364,7 @@ impl Generator<'_> {&mut self,identifier: IdentifierTableIndex,) -> Option<EnvironmentCoordinate> {- match self.binding_location_for_identifier(identifier)? {+ match location_for_instructions(self.binding_location_for_identifier(identifier))? {BindingLocation::Environment(coordinate) => Some(coordinate),BindingLocation::Import(_) => None,}diff --git a/Libraries/LibJS/Rust/src/bytecode/encoding.rs b/Libraries/LibJS/Rust/src/bytecode/encoding.rsindex 9c2e20f4493..1aebaa04157 100644--- a/Libraries/LibJS/Rust/src/bytecode/encoding.rs+++ b/Libraries/LibJS/Rust/src/bytecode/encoding.rs@@ -6,6 +6,8 @@use core::marker::PhantomData;+use crate::layout::property_lookup_cache::EnvironmentCoordinate;+/// The bytes every instruction starts with.#[repr(C)]pub struct InstructionHeader {@@ -53,6 +55,24 @@ impl OptionalLabel {}}+/// The coordinate of a binding as an instruction holds it: a byte of hops and two bytes of binding index. The generator+/// looks bindings up by name where a coordinate does not fit.+#[derive(Clone, Copy, Debug)]+#[repr(C, packed)]+pub struct BytecodeEnvironmentCoordinate {+ hops: u8,+ index: [u8; 2],+}++impl BytecodeEnvironmentCoordinate {+ pub fn get(self) -> EnvironmentCoordinate {+ EnvironmentCoordinate {+ hops: u32::from(self.hops),+ index: u32::from(u16::from_ne_bytes(self.index)),+ }+ }+}+macro_rules! define_table_index {($($name:ident),*) => {$(diff --git a/Libraries/LibJS/Rust/src/bytecode/mod.rs b/Libraries/LibJS/Rust/src/bytecode/mod.rsindex f7091e200e5..4ec2f32b3da 100644--- a/Libraries/LibJS/Rust/src/bytecode/mod.rs+++ b/Libraries/LibJS/Rust/src/bytecode/mod.rs@@ -83,7 +83,6 @@ pub fn instruction_at<Op: BytecodeOp>(executable: &executable::Executable, pc: u)]pub mod op {use super::encoding::*;- use crate::layout::property_lookup_cache::EnvironmentCoordinate;use crate::layout::value::Value;include!(concat!(env!("OUT_DIR"), "/bytecode_ops.rs"));diff --git a/Libraries/LibJS/Rust/src/bytecode/operand.rs b/Libraries/LibJS/Rust/src/bytecode/operand.rsindex 0a9dbfa85c6..1e9dffe0484 100644--- a/Libraries/LibJS/Rust/src/bytecode/operand.rs+++ b/Libraries/LibJS/Rust/src/bytecode/operand.rs@@ -205,8 +205,7 @@ impl IdentifierTableIndex {#[derive(Debug, Clone, Copy)]pub struct PropertyKeyTableIndex(pub u32);-/// Environment coordinate used by environment lookup instructions.-/// Layout: two `u32` fields (hops + index).+/// Environment coordinate used by environment lookup instructions, which hold the hops in a byte and the index in two.#[derive(Debug, Clone, Copy)]pub struct EnvironmentCoordinate {pub hops: u32,@@ -216,6 +215,11 @@ pub struct EnvironmentCoordinate {impl EnvironmentCoordinate {pub const INVALID: u32 = 0xFFFF_FFFE;+ /// Whether an instruction can hold the coordinate. Bindings past it are looked up by name.+ pub fn fits_in_instruction(&self) -> bool {+ self.hops <= u32::from(u8::MAX) && self.index <= u32::from(u16::MAX)+ }+pub fn empty() -> Self {Self {hops: Self::INVALID,diff --git a/Libraries/LibJS/Rust/src/interpreter/slow_paths/bindings.rs b/Libraries/LibJS/Rust/src/interpreter/slow_paths/bindings.rsindex f4138499581..044a7adf95f 100644--- a/Libraries/LibJS/Rust/src/interpreter/slow_paths/bindings.rs+++ b/Libraries/LibJS/Rust/src/interpreter/slow_paths/bindings.rs@@ -666,7 +666,7 @@ pub fn get_binding(vm,pc,&mut values.dst,- instruction.cache,+ instruction.cache.get(),AsmBindingIsKnownToBeInitialized::No,);advance_or_continue(pc, next_pc, op::GetBinding::LENGTH)@@ -683,7 +683,7 @@ pub fn get_initialized_binding(vm,pc,&mut values.dst,- instruction.cache,+ instruction.cache.get(),AsmBindingIsKnownToBeInitialized::Yes,);advance_or_continue(pc, next_pc, op::GetInitializedBinding::LENGTH)@@ -703,7 +703,7 @@ pub fn initialize_lexical_binding(BindingInitializationMode::Initialize,strict_at(vm, pc),values.src,- instruction.cache,+ instruction.cache.get(),);advance_or_continue(pc, next_pc, op::InitializeLexicalBinding::LENGTH)}@@ -722,7 +722,7 @@ pub fn initialize_variable_binding(BindingInitializationMode::Initialize,strict_at(vm, pc),values.src,- instruction.cache,+ instruction.cache.get(),);advance_or_continue(pc, next_pc, op::InitializeVariableBinding::LENGTH)}@@ -771,7 +771,7 @@ pub fn get_callee_and_this(instruction: &op::GetCalleeAndThisFromEnvironment,values: &mut op::GetCalleeAndThisFromEnvironmentValues,) -> SlowPathControl {- let cache = instruction.cache;+ let cache = instruction.cache.get();assert!(cache.is_valid());let environment = environment_at_hops(running_lexical_environment(vm), cache.hops);@@ -1152,7 +1152,7 @@ pub fn set_lexical_binding(BindingInitializationMode::Set,strict_at(vm, pc),values.src,- instruction.cache,+ instruction.cache.get(),);advance_or_continue(pc, next_pc, op::SetLexicalBinding::LENGTH)}@@ -1189,7 +1189,7 @@ pub fn set_variable_binding(BindingInitializationMode::Set,strict_at(vm, pc),values.src,- instruction.cache,+ instruction.cache.get(),);advance_or_continue(pc, next_pc, op::SetVariableBinding::LENGTH)}@@ -1366,15 +1366,15 @@ pub fn typeof_binding(instruction: &op::TypeofBinding,values: &mut op::TypeofBindingValues,) -> SlowPathControl {- let cache = instruction.cache;+ let cache = instruction.cache.get();assert!(cache.is_valid());- let environment = environment_at_hops(running_lexical_environment(vm), instruction.cache.hops);+ let environment = environment_at_hops(running_lexical_environment(vm), cache.hops);let value = asm_try!(vm,pc,- as_declarative(&environment).get_binding_value_direct(vm, instruction.cache.index as usize)+ as_declarative(&environment).get_binding_value_direct(vm, cache.index as usize));values.dst = Value::from_string(value.typeof_(vm));SlowPathControl::continue_at(pc + op::TypeofBinding::LENGTH)@@ -1438,7 +1438,7 @@ pub fn verify_environment_coordinate(instruction: &op::VerifyEnvironmentCoordinate,_values: &mut op::VerifyEnvironmentCoordinateValues,) -> SlowPathControl {- let coordinate = instruction.coordinate;+ let coordinate = instruction.coordinate.get();assert!(coordinate.is_valid());let name = get_identifier(vm, instruction.identifier);diff --git a/Tests/LibJS/Bytecode/expected/annexb-var-coordinate-with-default-param.txt b/Tests/LibJS/Bytecode/expected/annexb-var-coordinate-with-default-param.txtindex fa88e80e5dd..41aedda229d 100644--- a/Tests/LibJS/Bytecode/expected/annexb-var-coordinate-with-default-param.txt+++ b/Tests/LibJS/Bytecode/expected/annexb-var-coordinate-with-default-param.txt@@ -12,7 +12,7 @@ block0:[ 16] End value:reg5-f$afc1bbae annexb-var-coordinate-with-default-param.js:3:12+f$8e074504 annexb-var-coordinate-with-default-param.js:3:12Registers: 7Blocks: 3Locals: g~0, g~1@@ -32,24 +32,24 @@ block1:block2:[ 18] InitializeLexicalBinding `x`, src:arg0- [ 25] CreateVariableEnvironment capacity:1- [ 2a] GetLexicalEnvironment dst:reg5- [ 2c] Mov dst:g~0, src:Undefined- [ 2f] CreateVariable `y`, is_immutable:false, is_global:false, is_strict:false- [ 37] InitializeLexicalBinding `y`, src:Int32(2)- [ 44] NewFunction dst:g~1, shared_function_data_index:0- [ 4c] Mov dst:g~0, src:g~1- [ 4f] Call value_feedback:0, call_feedback:0, dst:reg6, callee:g~0, this_value:Undefined- [ 58] Return value:reg6---g$66f9ea5f annexb-var-coordinate-with-default-param.js:7:13+ [ 20] CreateVariableEnvironment capacity:1+ [ 25] GetLexicalEnvironment dst:reg5+ [ 27] Mov dst:g~0, src:Undefined+ [ 2a] CreateVariable `y`, is_immutable:false, is_global:false, is_strict:false+ [ 32] InitializeLexicalBinding `y`, src:Int32(2)+ [ 3a] NewFunction dst:g~1, shared_function_data_index:0+ [ 42] Mov dst:g~0, src:g~1+ [ 45] Call value_feedback:0, call_feedback:0, dst:reg6, callee:g~0, this_value:Undefined+ [ 4e] Return value:reg6+++g$427b82a5 annexb-var-coordinate-with-default-param.js:7:13Registers: 7Blocks: 1block0:[ 0] Enter[ 1] GetBinding value_feedback:0, dst:reg5, `x`- [ 10] GetBinding value_feedback:1, dst:reg6, `y`- [ 1f] Add arith_feedback:0, dst:reg5, lhs:reg5, rhs:reg6- [ 25] Return value:reg5+ [ b] GetBinding value_feedback:1, dst:reg6, `y`+ [ 15] Add arith_feedback:0, dst:reg5, lhs:reg5, rhs:reg6+ [ 1b] Return value:reg5diff --git a/Tests/LibJS/Bytecode/expected/block-scoping.txt b/Tests/LibJS/Bytecode/expected/block-scoping.txtindex 8e83e578ba4..89284b743d0 100644--- a/Tests/LibJS/Bytecode/expected/block-scoping.txt+++ b/Tests/LibJS/Bytecode/expected/block-scoping.txt@@ -20,7 +20,7 @@ block0:[ 62] End value:reg5-closureOverBlockScope$703fcb0e block-scoping.js:2:15+closureOverBlockScope$51494574 block-scoping.js:2:15Registers: 8Blocks: 1Locals: fns~0@@ -36,46 +36,46 @@ block0:[ 6] CreateLexicalEnvironment dst:reg5, parent:reg4, capacity:1, is_catch_environment:false[ 12] CreateVariable `x`, is_immutable:false, is_global:false, is_strict:false[ 1a] InitializeLexicalBinding `x`, src:Int32(1)- [ 27] GetById value_feedback:0, dst:reg6, base:fns~0, `push`- [ 31] NewFunction dst:reg7, shared_function_data_index:0- [ 39] Call value_feedback:1, call_feedback:0, dst:reg6, callee:reg6, this_value:fns~0, arguments:[reg7]- [ 43] SetLexicalEnvironment environment:reg4- [ 45] CreateLexicalEnvironment dst:reg5, parent:reg4, capacity:1, is_catch_environment:false- [ 51] CreateVariable `y`, is_immutable:false, is_global:false, is_strict:false- [ 59] InitializeLexicalBinding `y`, src:Int32(2)- [ 66] GetById value_feedback:2, dst:reg6, base:fns~0, `push`- [ 70] NewFunction dst:reg7, shared_function_data_index:1- [ 78] Call value_feedback:3, call_feedback:1, dst:reg6, callee:reg6, this_value:fns~0, arguments:[reg7]- [ 82] SetLexicalEnvironment environment:reg4- [ 84] GetByValue value_feedback:4, keyed_feedback:0, dst:reg5, base:fns~0, property:Int32(0)- [ 8e] Call value_feedback:5, call_feedback:2, dst:reg5, callee:reg5, this_value:fns~0- [ 97] GetByValue value_feedback:6, keyed_feedback:1, dst:reg6, base:fns~0, property:Int32(1)- [ a1] Call value_feedback:7, call_feedback:3, dst:reg6, callee:reg6, this_value:fns~0- [ aa] Add arith_feedback:0, dst:reg5, lhs:reg5, rhs:reg6- [ b0] Return value:reg5---$ae3a72e0 block-scoping.js:5:18+ [ 22] GetById value_feedback:0, dst:reg6, base:fns~0, `push`+ [ 2c] NewFunction dst:reg7, shared_function_data_index:0+ [ 34] Call value_feedback:1, call_feedback:0, dst:reg6, callee:reg6, this_value:fns~0, arguments:[reg7]+ [ 3e] SetLexicalEnvironment environment:reg4+ [ 40] CreateLexicalEnvironment dst:reg5, parent:reg4, capacity:1, is_catch_environment:false+ [ 4c] CreateVariable `y`, is_immutable:false, is_global:false, is_strict:false+ [ 54] InitializeLexicalBinding `y`, src:Int32(2)+ [ 5c] GetById value_feedback:2, dst:reg6, base:fns~0, `push`+ [ 66] NewFunction dst:reg7, shared_function_data_index:1+ [ 6e] Call value_feedback:3, call_feedback:1, dst:reg6, callee:reg6, this_value:fns~0, arguments:[reg7]+ [ 78] SetLexicalEnvironment environment:reg4+ [ 7a] GetByValue value_feedback:4, keyed_feedback:0, dst:reg5, base:fns~0, property:Int32(0)+ [ 84] Call value_feedback:5, call_feedback:2, dst:reg5, callee:reg5, this_value:fns~0+ [ 8d] GetByValue value_feedback:6, keyed_feedback:1, dst:reg6, base:fns~0, property:Int32(1)+ [ 97] Call value_feedback:7, call_feedback:3, dst:reg6, callee:reg6, this_value:fns~0+ [ a0] Add arith_feedback:0, dst:reg5, lhs:reg5, rhs:reg6+ [ a6] Return value:reg5+++$639615ef block-scoping.js:5:18Registers: 6Blocks: 1block0:[ 0] Enter[ 1] GetBinding value_feedback:0, dst:reg5, `x`- [ 10] Return value:reg5+ [ b] Return value:reg5-$98cfb52c block-scoping.js:9:18+$ca056ea3 block-scoping.js:9:18Registers: 6Blocks: 1block0:[ 0] Enter[ 1] GetBinding value_feedback:0, dst:reg5, `y`- [ 10] Return value:reg5+ [ b] Return value:reg5-breakThroughBlockScopes$d1ff9a51 block-scoping.js:16:9+breakThroughBlockScopes$c664ac27 block-scoping.js:16:9Registers: 7Blocks: 6Locals: result~0, i~1, f~2@@ -94,35 +94,35 @@ block1:[ e] CreateLexicalEnvironment dst:reg5, parent:reg4, capacity:1, is_catch_environment:false[ 1a] CreateVariable `x`, is_immutable:false, is_global:false, is_strict:false[ 22] InitializeLexicalBinding `x`, src:i~1- [ 2f] NewFunction dst:f~2, shared_function_data_index:0 (f)- [ 37] GetBinding value_feedback:0, dst:reg6, `x`- [ 46] JumpGreaterThanRhsInt32 arith_feedback:0, lhs:reg6, rhs:1, true_target:block2, false_target:block3+ [ 2a] NewFunction dst:f~2, shared_function_data_index:0 (f)+ [ 32] GetBinding value_feedback:0, dst:reg6, `x`+ [ 3c] JumpGreaterThanRhsInt32 arith_feedback:0, lhs:reg6, rhs:1, true_target:block2, false_target:block3block2:- [ 56] Mov dst:result~0, src:f~2- [ 59] SetLexicalEnvironment environment:reg4- [ 5b] Jump target:block5+ [ 4c] Mov dst:result~0, src:f~2+ [ 4f] SetLexicalEnvironment environment:reg4+ [ 51] Jump target:block5block3:- [ 60] SetLexicalEnvironment environment:reg4- [ 62] Increment arith_feedback:1, dst:i~1+ [ 56] SetLexicalEnvironment environment:reg4+ [ 58] Increment arith_feedback:1, dst:i~1block4:- [ 66] JumpLessThanLoopRhsInt32 arith_feedback:2, lhs:i~1, rhs:3, true_target:block1, false_target:block5+ [ 5c] JumpLessThanLoopRhsInt32 arith_feedback:2, lhs:i~1, rhs:3, true_target:block1, false_target:block5block5:- [ 76] Call value_feedback:1, call_feedback:0, dst:reg5, callee:result~0, this_value:Undefined- [ 7f] Return value:reg5+ [ 6c] Call value_feedback:1, call_feedback:0, dst:reg5, callee:result~0, this_value:Undefined+ [ 75] Return value:reg5-f$44bfa1d8 block-scoping.js:20:21+f$f1cf71b7 block-scoping.js:20:21Registers: 6Blocks: 1block0:[ 0] Enter[ 1] GetBinding value_feedback:0, dst:reg5, `x`- [ 10] Return value:reg5+ [ b] Return value:reg53diff --git a/Tests/LibJS/Bytecode/expected/captured-variables.txt b/Tests/LibJS/Bytecode/expected/captured-variables.txtindex 77715a0d465..a839a6a489e 100644--- a/Tests/LibJS/Bytecode/expected/captured-variables.txt+++ b/Tests/LibJS/Bytecode/expected/captured-variables.txt@@ -12,7 +12,7 @@ block0:[ 16] End value:reg5-outer$674616fc captured-variables.js:5:9+outer$d668dba7 captured-variables.js:5:9Registers: 6Blocks: 1Locals: inner~0@@ -26,15 +26,15 @@ block0:[ 9] Mov dst:inner~0, src:Undefined[ c] NewFunction dst:inner~0, shared_function_data_index:0[ 14] InitializeLexicalBinding `captured`, src:Int32(1)- [ 21] Call value_feedback:0, call_feedback:0, dst:reg5, callee:inner~0, this_value:Undefined- [ 2a] Return value:reg5+ [ 1c] Call value_feedback:0, call_feedback:0, dst:reg5, callee:inner~0, this_value:Undefined+ [ 25] Return value:reg5-inner$878e6817 captured-variables.js:7:9+inner$da7e9838 captured-variables.js:7:9Registers: 6Blocks: 1block0:[ 0] Enter[ 1] GetBinding value_feedback:0, dst:reg5, `captured`- [ 10] Return value:reg5+ [ b] Return value:reg5diff --git a/Tests/LibJS/Bytecode/expected/class-environment.txt b/Tests/LibJS/Bytecode/expected/class-environment.txtindex f4570663e5f..d1cfd19a7a8 100644--- a/Tests/LibJS/Bytecode/expected/class-environment.txt+++ b/Tests/LibJS/Bytecode/expected/class-environment.txt@@ -48,14 +48,14 @@ block0:[ 1] End value:Undefined-method$48f47d59 class-environment.js:4:13+method$5b33b136 class-environment.js:4:13Registers: 6Blocks: 1block0:[ 0] Enter[ 1] GetBinding value_feedback:0, dst:reg5, `Foo`- [ 10] Return value:reg5+ [ b] Return value:reg5truediff --git a/Tests/LibJS/Bytecode/expected/destructuring-assignment.txt b/Tests/LibJS/Bytecode/expected/destructuring-assignment.txtindex d7c8218879d..aaf8de860db 100644--- a/Tests/LibJS/Bytecode/expected/destructuring-assignment.txt+++ b/Tests/LibJS/Bytecode/expected/destructuring-assignment.txt@@ -101,7 +101,7 @@ block2:[ 2c] Return value:x~0-setter_parameter_resolution$0fb4c346 destructuring-assignment.js:17:9+setter_parameter_resolution$b2d13278 destructuring-assignment.js:17:9Registers: 13Blocks: 12Constants:@@ -112,54 +112,54 @@ block0:[ 0] Enter[ 1] CreateVariable `setValue`, is_immutable:false, is_global:false, is_strict:false[ 9] InitializeVariableBinding `setValue`, src:Undefined- [ 16] NewPrimitiveArray dst:reg6, elements:[23]- [ 24] Mov dst:reg7, src:Bool(false)- [ 27] GetIterator dst_iterator_object:reg8, dst_iterator_next:reg9, dst_iterator_done:reg10, iterable:reg6, fast_array_mode_allowed:true+ [ 11] NewPrimitiveArray dst:reg6, elements:[23]+ [ 1f] Mov dst:reg7, src:Bool(false)+ [ 22] GetIterator dst_iterator_object:reg8, dst_iterator_next:reg9, dst_iterator_done:reg10, iterable:reg6, fast_array_mode_allowed:trueblock1:- [ 30] NewObject dst:reg11- [ 34] NewFunction dst:reg12, shared_function_data_index:0 (set y), home_object:reg11- [ 3c] PutById base:reg11, `y`, src:reg12, kind:Setter+ [ 2b] NewObject dst:reg11+ [ 2f] NewFunction dst:reg12, shared_function_data_index:0 (set y), home_object:reg11+ [ 37] PutById base:reg11, `y`, src:reg12, kind:Setterblock2:- [ 45] IteratorNextUnpack dst_value:reg12, dst_done:reg7, iterator_object:reg8, iterator_next:reg9, iterator_done:reg10+ [ 40] IteratorNextUnpack dst_value:reg12, dst_done:reg7, iterator_object:reg8, iterator_next:reg9, iterator_done:reg10block3:- [ 4b] JumpFalse condition:reg7, target:block5+ [ 46] JumpFalse condition:reg7, target:block5block4:- [ 51] Mov dst:reg12, src:Undefined+ [ 4c] Mov dst:reg12, src:Undefinedblock5:- [ 54] PutById base:reg11, `y`, src:reg12, kind:Normal+ [ 4f] PutById base:reg11, `y`, src:reg12, kind:Normalblock6:- [ 5d] JumpTrue condition:reg10, target:block11+ [ 58] JumpTrue condition:reg10, target:block11block7:- [ 63] IteratorClose iterator_object:reg8, iterator_next:reg9, iterator_done:reg10, completion_value:Undefined- [ 6b] Jump target:block11+ [ 5e] IteratorClose iterator_object:reg8, iterator_next:reg9, iterator_done:reg10, completion_value:Undefined+ [ 66] Jump target:block11block8:- [ 70] Catch value_feedback:0, dst:reg11- [ 74] JumpTrue condition:reg10, target:block10+ [ 6b] Catch value_feedback:0, dst:reg11+ [ 6f] JumpTrue condition:reg10, target:block10block9:- [ 7a] IteratorClose iterator_object:reg8, iterator_next:reg9, iterator_done:reg10, completion_value:reg11+ [ 75] IteratorClose iterator_object:reg8, iterator_next:reg9, iterator_done:reg10, completion_value:reg11block10:- [ 82] Throw src:reg11+ [ 7d] Throw src:reg11block11:- [ 84] GetInitializedBinding value_feedback:1, dst:reg5, `setValue`- [ 93] Return value:reg5+ [ 7f] GetInitializedBinding value_feedback:1, dst:reg5, `setValue`+ [ 89] Return value:reg5Exception handlers:- [ 30 .. 45] => handler block8- [ 4b .. 5d] => handler block8+ [ 2b .. 40] => handler block8+ [ 46 .. 58] => handler block8-set y$755940b9 destructuring-assignment.js:21:26+set y$46e77852 destructuring-assignment.js:21:26Registers: 5Blocks: 1Constants:@@ -168,4 +168,4 @@ set y$755940b9 destructuring-assignment.js:21:26block0:[ 0] Enter[ 1] SetLexicalBinding `setValue`, src:arg0- [ e] End value:Undefined+ [ 9] End value:Undefineddiff --git a/Tests/LibJS/Bytecode/expected/destructuring-param-no-param-expressions.txt b/Tests/LibJS/Bytecode/expected/destructuring-param-no-param-expressions.txtindex 049ee08b0ea..66bc9901be2 100644--- a/Tests/LibJS/Bytecode/expected/destructuring-param-no-param-expressions.txt+++ b/Tests/LibJS/Bytecode/expected/destructuring-param-no-param-expressions.txt@@ -18,7 +18,7 @@ block0:[ 33] End value:reg5-f$e5589008 destructuring-param-no-param-expressions.js:6:12+f$f4d3d2d5 destructuring-param-no-param-expressions.js:6:12Registers: 7Blocks: 1Locals: local~0@@ -30,6 +30,6 @@ block0:[ b] Mov dst:reg5, src:arg0[ e] GetById value_feedback:0, dst:reg6, base:reg5, `captured`[ 18] InitializeLexicalBinding `captured`, src:reg6- [ 25] GetById value_feedback:1, dst:local~0, base:reg5, `local`- [ 2f] NewFunction dst:reg5, shared_function_data_index:0- [ 37] Return value:reg5+ [ 20] GetById value_feedback:1, dst:local~0, base:reg5, `local`+ [ 2a] NewFunction dst:reg5, shared_function_data_index:0+ [ 32] Return value:reg5diff --git a/Tests/LibJS/Bytecode/expected/enclosing-function-bindings-with-eval-or-with.txt b/Tests/LibJS/Bytecode/expected/enclosing-function-bindings-with-eval-or-with.txtindex 369b459e2b0..cbfc6743412 100644--- a/Tests/LibJS/Bytecode/expected/enclosing-function-bindings-with-eval-or-with.txt+++ b/Tests/LibJS/Bytecode/expected/enclosing-function-bindings-with-eval-or-with.txt@@ -12,7 +12,7 @@ block0:[ 16] End value:reg5-outer$49da123d enclosing-function-bindings-with-eval-or-with.js:2:9+outer$3212fc40 enclosing-function-bindings-with-eval-or-with.js:2:9Registers: 11Blocks: 1Constants:@@ -24,22 +24,22 @@ block0:[ 1] CreateVariable `a`, is_immutable:false, is_global:false, is_strict:false[ 9] CreateVariable `evaluates`, is_immutable:false, is_global:false, is_strict:false[ 11] InitializeVariableBinding `evaluates`, src:Undefined- [ 1e] NewFunction dst:reg5, shared_function_data_index:0- [ 26] SetVariableBinding `evaluates`, src:reg5- [ 33] CreateVariable `withObject`, is_immutable:false, is_global:false, is_strict:false- [ 3b] InitializeVariableBinding `withObject`, src:Undefined- [ 48] NewFunction dst:reg6, shared_function_data_index:1- [ 50] SetVariableBinding `withObject`, src:reg6- [ 5d] InitializeLexicalBinding `a`, src:Int32(1)- [ 6a] GetCalleeAndThisFromEnvironment value_feedback:0, callee:reg7, this_value:reg8, `evaluates`- [ 7a] Call value_feedback:1, call_feedback:0, dst:reg7, callee:reg7, this_value:reg8- [ 83] Call value_feedback:2, call_feedback:1, dst:reg7, callee:reg7, this_value:Undefined- [ 8c] GetCalleeAndThisFromEnvironment value_feedback:3, callee:reg8, this_value:reg9, `withObject`- [ 9c] NewObject dst:reg10- [ a0] Call value_feedback:4, call_feedback:2, dst:reg8, callee:reg8, this_value:reg9, arguments:[reg10]- [ aa] Call value_feedback:5, call_feedback:3, dst:reg8, callee:reg8, this_value:Undefined- [ b3] NewArray dst:reg9, elements:[reg7, reg8]- [ b8] Return value:reg9+ [ 19] NewFunction dst:reg5, shared_function_data_index:0+ [ 21] SetVariableBinding `evaluates`, src:reg5+ [ 29] CreateVariable `withObject`, is_immutable:false, is_global:false, is_strict:false+ [ 31] InitializeVariableBinding `withObject`, src:Undefined+ [ 39] NewFunction dst:reg6, shared_function_data_index:1+ [ 41] SetVariableBinding `withObject`, src:reg6+ [ 49] InitializeLexicalBinding `a`, src:Int32(1)+ [ 51] GetCalleeAndThisFromEnvironment value_feedback:0, callee:reg7, this_value:reg8, `evaluates`+ [ 5c] Call value_feedback:1, call_feedback:0, dst:reg7, callee:reg7, this_value:reg8+ [ 65] Call value_feedback:2, call_feedback:1, dst:reg7, callee:reg7, this_value:Undefined+ [ 6e] GetCalleeAndThisFromEnvironment value_feedback:3, callee:reg8, this_value:reg9, `withObject`+ [ 79] NewObject dst:reg10+ [ 7d] Call value_feedback:4, call_feedback:2, dst:reg8, callee:reg8, this_value:reg9, arguments:[reg10]+ [ 87] Call value_feedback:5, call_feedback:3, dst:reg8, callee:reg8, this_value:Undefined+ [ 90] NewArray dst:reg9, elements:[reg7, reg8]+ [ 95] Return value:reg9evaluates$fc8042a8 enclosing-function-bindings-with-eval-or-with.js:4:13diff --git a/Tests/LibJS/Bytecode/expected/enclosing-function-bindings.txt b/Tests/LibJS/Bytecode/expected/enclosing-function-bindings.txtindex f2acc106caf..c74aa5ff6eb 100644--- a/Tests/LibJS/Bytecode/expected/enclosing-function-bindings.txt+++ b/Tests/LibJS/Bytecode/expected/enclosing-function-bindings.txt@@ -19,7 +19,7 @@ block0:[ 3e] End value:reg5-outer$f9e4a76f enclosing-function-bindings.js:4:9+outer$7fb21e84 enclosing-function-bindings.js:4:9Registers: 7Blocks: 1Constants:@@ -29,15 +29,15 @@ block0:[ 0] Enter[ 1] CreateVariable `a`, is_immutable:false, is_global:false, is_strict:false[ 9] InitializeLexicalBinding `a`, src:arg0- [ 16] CreateVariable `b`, is_immutable:false, is_global:false, is_strict:false- [ 1e] CreateVariable `callee`, is_immutable:false, is_global:false, is_strict:false- [ 26] InitializeVariableBinding `callee`, src:Undefined- [ 33] NewFunction dst:reg5, shared_function_data_index:0- [ 3b] SetVariableBinding `callee`, src:reg5- [ 48] GetBinding value_feedback:0, dst:reg5, `a`- [ 57] InitializeLexicalBinding `b`, src:reg5- [ 64] NewFunction dst:reg6, shared_function_data_index:1- [ 6c] Return value:reg6+ [ 11] CreateVariable `b`, is_immutable:false, is_global:false, is_strict:false+ [ 19] CreateVariable `callee`, is_immutable:false, is_global:false, is_strict:false+ [ 21] InitializeVariableBinding `callee`, src:Undefined+ [ 29] NewFunction dst:reg5, shared_function_data_index:0+ [ 31] SetVariableBinding `callee`, src:reg5+ [ 39] GetBinding value_feedback:0, dst:reg5, `a`+ [ 43] InitializeLexicalBinding `b`, src:reg5+ [ 4b] NewFunction dst:reg6, shared_function_data_index:1+ [ 53] Return value:reg6$ef9da64a enclosing-function-bindings.js:8:12@@ -50,32 +50,32 @@ block0:[ 9] Return value:reg5-inner$580e0425 enclosing-function-bindings.js:10:15+inner$90732d39 enclosing-function-bindings.js:10:15Registers: 8Blocks: 1block0:[ 0] Enter[ 1] GetBinding value_feedback:0, dst:reg5, `b`- [ 10] SetLexicalBinding `a`, src:reg5- [ 1d] TypeofBinding dst:reg5, `a`- [ 2a] GetCalleeAndThisFromEnvironment value_feedback:1, callee:reg6, this_value:reg7, `callee`- [ 3a] Call value_feedback:2, call_feedback:0, dst:reg6, callee:reg6, this_value:reg7- [ 43] Add arith_feedback:0, dst:reg5, lhs:reg5, rhs:reg6- [ 49] Return value:reg5+ [ b] SetLexicalBinding `a`, src:reg5+ [ 13] TypeofBinding dst:reg5, `a`+ [ 1b] GetCalleeAndThisFromEnvironment value_feedback:1, callee:reg6, this_value:reg7, `callee`+ [ 26] Call value_feedback:2, call_feedback:0, dst:reg6, callee:reg6, this_value:reg7+ [ 2f] Add arith_feedback:0, dst:reg5, lhs:reg5, rhs:reg6+ [ 35] Return value:reg5-callee$e12fb7fa enclosing-function-bindings.js:6:9+callee$4d8e8b95 enclosing-function-bindings.js:6:9Registers: 6Blocks: 1block0:[ 0] Enter[ 1] GetBinding value_feedback:0, dst:reg5, `b`- [ 10] Return value:reg5+ [ b] Return value:reg5-blockFunctions$0346f60a enclosing-function-bindings.js:16:9+blockFunctions$e4507070 enclosing-function-bindings.js:16:9Registers: 7Blocks: 1Locals: first~0@@ -88,23 +88,23 @@ block0:[ 1] CreateVariable `c`, is_immutable:false, is_global:false, is_strict:false[ 9] GetLexicalEnvironment dst:reg4[ b] InitializeLexicalBinding `c`, src:Int32(1)- [ 18] CreateLexicalEnvironment dst:reg5, parent:reg4, capacity:1, is_catch_environment:false- [ 24] CreateVariable `second`, is_immutable:false, is_global:false, is_strict:false- [ 2c] NewFunction dst:first~0, shared_function_data_index:0- [ 34] NewFunction dst:reg6, shared_function_data_index:1- [ 3c] InitializeLexicalBinding `second`, src:reg6- [ 49] Call value_feedback:0, call_feedback:0, dst:reg6, callee:first~0, this_value:Undefined- [ 52] SetLexicalEnvironment environment:reg4- [ 54] Return value:reg6+ [ 13] CreateLexicalEnvironment dst:reg5, parent:reg4, capacity:1, is_catch_environment:false+ [ 1f] CreateVariable `second`, is_immutable:false, is_global:false, is_strict:false+ [ 27] NewFunction dst:first~0, shared_function_data_index:0+ [ 2f] NewFunction dst:reg6, shared_function_data_index:1+ [ 37] InitializeLexicalBinding `second`, src:reg6+ [ 3f] Call value_feedback:0, call_feedback:0, dst:reg6, callee:first~0, this_value:Undefined+ [ 48] SetLexicalEnvironment environment:reg4+ [ 4a] Return value:reg6-first$fd6705ac enclosing-function-bindings.js:19:13+first$d8e89df2 enclosing-function-bindings.js:19:13Registers: 7Blocks: 1block0:[ 0] Enter[ 1] GetBinding value_feedback:0, dst:reg5, `c`- [ 10] TypeofBinding dst:reg6, `second`- [ 1d] Add arith_feedback:0, dst:reg5, lhs:reg5, rhs:reg6- [ 23] Return value:reg5+ [ b] TypeofBinding dst:reg6, `second`+ [ 13] Add arith_feedback:0, dst:reg5, lhs:reg5, rhs:reg6+ [ 19] Return value:reg5diff --git a/Tests/LibJS/Bytecode/expected/eval-prevents-locals.txt b/Tests/LibJS/Bytecode/expected/eval-prevents-locals.txtindex 3772254de5a..614304964de 100644--- a/Tests/LibJS/Bytecode/expected/eval-prevents-locals.txt+++ b/Tests/LibJS/Bytecode/expected/eval-prevents-locals.txt@@ -14,7 +14,7 @@ block0:[ 28] End value:reg5-with_eval$45ca119f eval-prevents-locals.js:6:9+with_eval$240f9af5 eval-prevents-locals.js:6:9Registers: 8Blocks: 1Constants:@@ -28,10 +28,10 @@ block0:[ 8] CreateLexicalEnvironment dst:reg5, parent:reg4, capacity:1, is_catch_environment:false[ 14] CreateVariable `x`, is_immutable:false, is_global:false, is_strict:false[ 1c] InitializeLexicalBinding `x`, src:Int32(1)- [ 29] DynamicGetCalleeAndThisFromEnvironment value_feedback:0, callee:reg6, this_value:reg7, `eval`- [ 33] CallDirectEval value_feedback:1, call_feedback:0, dst:reg6, callee:reg6, this_value:reg7, arguments:[String("")]- [ 3d] GetBinding value_feedback:2, dst:reg6, `x`- [ 4c] Return value:reg6+ [ 24] DynamicGetCalleeAndThisFromEnvironment value_feedback:0, callee:reg6, this_value:reg7, `eval`+ [ 2e] CallDirectEval value_feedback:1, call_feedback:0, dst:reg6, callee:reg6, this_value:reg7, arguments:[String("")]+ [ 38] GetBinding value_feedback:2, dst:reg6, `x`+ [ 42] Return value:reg6eval$d8dbb89d@@ -46,7 +46,7 @@ block0:[ 4] End value:reg5-outer_eval$e242c94f eval-prevents-locals.js:14:9+outer_eval$f481fd2c eval-prevents-locals.js:14:9Registers: 9Blocks: 1Constants:@@ -60,13 +60,13 @@ block0:[ 8] CreateLexicalEnvironment dst:reg5, parent:reg4, capacity:1, is_catch_environment:false[ 14] CreateVariable `inner`, is_immutable:false, is_global:false, is_strict:false[ 1c] InitializeVariableBinding `inner`, src:Undefined- [ 29] NewFunction dst:reg6, shared_function_data_index:0- [ 31] SetVariableBinding `inner`, src:reg6- [ 3e] DynamicGetCalleeAndThisFromEnvironment value_feedback:0, callee:reg6, this_value:reg7, `eval`- [ 48] CallDirectEval value_feedback:1, call_feedback:0, dst:reg6, callee:reg6, this_value:reg7, arguments:[String("")]- [ 52] GetCalleeAndThisFromEnvironment value_feedback:2, callee:reg7, this_value:reg8, `inner`- [ 62] Call value_feedback:3, call_feedback:1, dst:reg7, callee:reg7, this_value:reg8- [ 6b] Return value:reg7+ [ 24] NewFunction dst:reg6, shared_function_data_index:0+ [ 2c] SetVariableBinding `inner`, src:reg6+ [ 34] DynamicGetCalleeAndThisFromEnvironment value_feedback:0, callee:reg6, this_value:reg7, `eval`+ [ 3e] CallDirectEval value_feedback:1, call_feedback:0, dst:reg6, callee:reg6, this_value:reg7, arguments:[String("")]+ [ 48] GetCalleeAndThisFromEnvironment value_feedback:2, callee:reg7, this_value:reg8, `inner`+ [ 53] Call value_feedback:3, call_feedback:1, dst:reg7, callee:reg7, this_value:reg8+ [ 5c] Return value:reg7eval$d8dbb89ddiff --git a/Tests/LibJS/Bytecode/expected/eval-scope-optimization.txt b/Tests/LibJS/Bytecode/expected/eval-scope-optimization.txtindex 974e494c017..f6823990375 100644--- a/Tests/LibJS/Bytecode/expected/eval-scope-optimization.txt+++ b/Tests/LibJS/Bytecode/expected/eval-scope-optimization.txt@@ -12,7 +12,7 @@ block0:[ 16] End value:reg5-outer$deb72320 eval-scope-optimization.js:6:5+outer$007199ca eval-scope-optimization.js:6:5Registers: 7Blocks: 1Constants:@@ -23,8 +23,8 @@ block0:[ 0] Enter[ 1] CreateVariable `inner`, is_immutable:false, is_global:false, is_strict:false[ 9] InitializeVariableBinding `inner`, src:Undefined- [ 16] NewFunction dst:reg5, shared_function_data_index:0- [ 1e] SetVariableBinding `inner`, src:reg5- [ 2b] GetGlobal value_feedback:0, dst:reg6, `Number`- [ 34] CallConstruct value_feedback:1, call_feedback:0, dst:reg6, callee:reg6, arguments:[Int32(42)]- [ 3d] Return value:reg6+ [ 11] NewFunction dst:reg5, shared_function_data_index:0+ [ 19] SetVariableBinding `inner`, src:reg5+ [ 21] GetGlobal value_feedback:0, dst:reg6, `Number`+ [ 2a] CallConstruct value_feedback:1, call_feedback:0, dst:reg6, callee:reg6, arguments:[Int32(42)]+ [ 33] Return value:reg6diff --git a/Tests/LibJS/Bytecode/expected/for-in-lexical-scope.txt b/Tests/LibJS/Bytecode/expected/for-in-lexical-scope.txtindex a5b5a68bcca..8c98806c5cf 100644--- a/Tests/LibJS/Bytecode/expected/for-in-lexical-scope.txt+++ b/Tests/LibJS/Bytecode/expected/for-in-lexical-scope.txt@@ -1,4 +1,4 @@-$09e76c91 for-in-lexical-scope.js:1:5+$de39953a for-in-lexical-scope.js:1:5Registers: 13Blocks: 5Locals: probeDecl~0@@ -32,10 +32,10 @@ block3:[ 55] CreateLexicalEnvironment dst:reg12, parent:reg4, capacity:1, is_catch_environment:false[ 61] CreateVariable `x`, is_immutable:false, is_global:false, is_strict:false[ 69] InitializeLexicalBinding `x`, src:reg10- [ 76] NewFunction dst:probeDecl~0, shared_function_data_index:0- [ 7e] SetVariableBindingOfBlockFunction `probeDecl`, src:probeDecl~0, program_environment_depth:1- [ 87] SetLexicalEnvironment environment:reg4- [ 89] JumpLoop target:block2+ [ 71] NewFunction dst:probeDecl~0, shared_function_data_index:0+ [ 79] SetVariableBindingOfBlockFunction `probeDecl`, src:probeDecl~0, program_environment_depth:1+ [ 82] SetLexicalEnvironment environment:reg4+ [ 84] JumpLoop target:block2block4:- [ 8e] End value:reg5+ [ 89] End value:reg5diff --git a/Tests/LibJS/Bytecode/expected/for-loop-scoping.txt b/Tests/LibJS/Bytecode/expected/for-loop-scoping.txtindex 81750586d5b..6244561732b 100644--- a/Tests/LibJS/Bytecode/expected/for-loop-scoping.txt+++ b/Tests/LibJS/Bytecode/expected/for-loop-scoping.txt@@ -15,7 +15,7 @@ block0:[ 33] End value:reg5-forLetClosure$8f3168f8 for-loop-scoping.js:2:15+forLetClosure$763143ab for-loop-scoping.js:2:15Registers: 8Blocks: 4Locals: fns~0@@ -29,36 +29,36 @@ block0:[ 6] CreateLexicalEnvironment dst:reg5, parent:reg4, capacity:1, is_catch_environment:false[ 12] CreateVariable `i`, is_immutable:false, is_global:false, is_strict:false[ 1a] InitializeLexicalBinding `i`, src:Int32(0)- [ 27] GetBinding value_feedback:0, dst:reg6, `i`- [ 36] SetLexicalEnvironment environment:reg4- [ 38] CreateLexicalEnvironment dst:reg5, parent:reg4, capacity:1, is_catch_environment:false- [ 44] CreateVariable `i`, is_immutable:false, is_global:false, is_strict:false- [ 4c] InitializeLexicalBinding `i`, src:reg6- [ 59] Jump target:block2+ [ 22] GetBinding value_feedback:0, dst:reg6, `i`+ [ 2c] SetLexicalEnvironment environment:reg4+ [ 2e] CreateLexicalEnvironment dst:reg5, parent:reg4, capacity:1, is_catch_environment:false+ [ 3a] CreateVariable `i`, is_immutable:false, is_global:false, is_strict:false+ [ 42] InitializeLexicalBinding `i`, src:reg6+ [ 4a] Jump target:block2block1:- [ 5e] GetById value_feedback:1, dst:reg6, base:fns~0, `push`- [ 68] NewFunction dst:reg7, shared_function_data_index:0- [ 70] Call value_feedback:2, call_feedback:0, dst:reg6, callee:reg6, this_value:fns~0, arguments:[reg7]- [ 7a] GetBinding value_feedback:3, dst:reg6, `i`- [ 89] SetLexicalEnvironment environment:reg4- [ 8b] CreateLexicalEnvironment dst:reg5, parent:reg4, capacity:1, is_catch_environment:false- [ 97] CreateVariable `i`, is_immutable:false, is_global:false, is_strict:false- [ 9f] InitializeLexicalBinding `i`, src:reg6- [ ac] GetBinding value_feedback:4, dst:reg6, `i`- [ bb] PostfixIncrement arith_feedback:0, dst:reg7, src:reg6- [ c0] SetLexicalBinding `i`, src:reg6+ [ 4f] GetById value_feedback:1, dst:reg6, base:fns~0, `push`+ [ 59] NewFunction dst:reg7, shared_function_data_index:0+ [ 61] Call value_feedback:2, call_feedback:0, dst:reg6, callee:reg6, this_value:fns~0, arguments:[reg7]+ [ 6b] GetBinding value_feedback:3, dst:reg6, `i`+ [ 75] SetLexicalEnvironment environment:reg4+ [ 77] CreateLexicalEnvironment dst:reg5, parent:reg4, capacity:1, is_catch_environment:false+ [ 83] CreateVariable `i`, is_immutable:false, is_global:false, is_strict:false+ [ 8b] InitializeLexicalBinding `i`, src:reg6+ [ 93] GetBinding value_feedback:4, dst:reg6, `i`+ [ 9d] PostfixIncrement arith_feedback:0, dst:reg7, src:reg6+ [ a2] SetLexicalBinding `i`, src:reg6block2:- [ cd] GetBinding value_feedback:5, dst:reg6, `i`- [ dc] JumpLessThanLoopRhsInt32 arith_feedback:1, lhs:reg6, rhs:3, true_target:block1, false_target:block3+ [ aa] GetBinding value_feedback:5, dst:reg6, `i`+ [ b4] JumpLessThanLoopRhsInt32 arith_feedback:1, lhs:reg6, rhs:3, true_target:block1, false_target:block3block3:- [ ec] SetLexicalEnvironment environment:reg4- [ ee] GetById value_feedback:6, dst:reg5, base:fns~0, `map`- [ f8] NewFunction dst:reg6, shared_function_data_index:1- [ 100] Call value_feedback:7, call_feedback:1, dst:reg5, callee:reg5, this_value:fns~0, arguments:[reg6]- [ 10a] Return value:reg5+ [ c4] SetLexicalEnvironment environment:reg4+ [ c6] GetById value_feedback:6, dst:reg5, base:fns~0, `map`+ [ d0] NewFunction dst:reg6, shared_function_data_index:1+ [ d8] Call value_feedback:7, call_feedback:1, dst:reg5, callee:reg5, this_value:fns~0, arguments:[reg6]+ [ e2] Return value:reg5map$55eca889 BuiltinFile:275:11@@ -123,14 +123,14 @@ block0:[ a] Return value:reg5-$d59afef1 for-loop-scoping.js:4:18+$ea9e23de for-loop-scoping.js:4:18Registers: 6Blocks: 1block0:[ 0] Enter[ 1] GetBinding value_feedback:0, dst:reg5, `i`- [ 10] Return value:reg5+ [ b] Return value:reg5Array [0, 1, 2]diff --git a/Tests/LibJS/Bytecode/expected/for-of-continue-with-block-scope.txt b/Tests/LibJS/Bytecode/expected/for-of-continue-with-block-scope.txtindex 4b03f123db8..d665a7fe28d 100644--- a/Tests/LibJS/Bytecode/expected/for-of-continue-with-block-scope.txt+++ b/Tests/LibJS/Bytecode/expected/for-of-continue-with-block-scope.txt@@ -13,7 +13,7 @@ block0:[ 1a] End value:reg5-f$85feb199 for-of-continue-with-block-scope.js:2:15+f$9579f466 for-of-continue-with-block-scope.js:2:15Registers: 14Blocks: 7Locals: t~0, o~1@@ -36,33 +36,33 @@ block2:[ 34] CreateLexicalEnvironment dst:reg11, parent:reg4, capacity:1, is_catch_environment:false[ 40] CreateVariable `r`, is_immutable:true, is_global:false, is_strict:true[ 48] InitializeLexicalBinding `r`, src:reg9- [ 55] GetBinding value_feedback:0, dst:reg12, `r`- [ 64] Not dst:reg12, src:reg12- [ 67] JumpFalse condition:reg12, target:block4+ [ 50] GetBinding value_feedback:0, dst:reg12, `r`+ [ 5a] Not dst:reg12, src:reg12+ [ 5d] JumpFalse condition:reg12, target:block4block3:- [ 6d] GetById value_feedback:1, dst:reg12, base:t~0, `push`- [ 77] GetBinding value_feedback:2, dst:reg13, `r`- [ 86] Call value_feedback:3, call_feedback:0, dst:reg12, callee:reg12, this_value:t~0, arguments:[reg13]- [ 90] SetLexicalEnvironment environment:reg4- [ 92] Jump target:block1+ [ 63] GetById value_feedback:1, dst:reg12, base:t~0, `push`+ [ 6d] GetBinding value_feedback:2, dst:reg13, `r`+ [ 77] Call value_feedback:3, call_feedback:0, dst:reg12, callee:reg12, this_value:t~0, arguments:[reg13]+ [ 81] SetLexicalEnvironment environment:reg4+ [ 83] Jump target:block1block4:- [ 97] GetById value_feedback:4, dst:reg12, base:t~0, `find`- [ a1] NewFunction dst:reg13, shared_function_data_index:0- [ a9] Call value_feedback:5, call_feedback:1, dst:reg12, callee:reg12, this_value:t~0, arguments:[reg13]- [ b3] Mov dst:o~1, src:reg12- [ b6] SetLexicalEnvironment environment:reg4- [ b8] JumpLoop target:block1+ [ 88] GetById value_feedback:4, dst:reg12, base:t~0, `find`+ [ 92] NewFunction dst:reg13, shared_function_data_index:0+ [ 9a] Call value_feedback:5, call_feedback:1, dst:reg12, callee:reg12, this_value:t~0, arguments:[reg13]+ [ a4] Mov dst:o~1, src:reg12+ [ a7] SetLexicalEnvironment environment:reg4+ [ a9] JumpLoop target:block1block5:- [ bd] Catch value_feedback:6, dst:reg11- [ c1] SetLexicalEnvironment environment:reg4- [ c3] IteratorClose iterator_object:reg6, iterator_next:reg7, iterator_done:reg8, completion_value:reg11- [ cb] Throw src:reg11+ [ ae] Catch value_feedback:6, dst:reg11+ [ b2] SetLexicalEnvironment environment:reg4+ [ b4] IteratorClose iterator_object:reg6, iterator_next:reg7, iterator_done:reg8, completion_value:reg11+ [ bc] Throw src:reg11block6:- [ cd] Return value:t~0+ [ be] Return value:t~0Exception handlers:- [ 34 .. bd] => handler block5+ [ 34 .. ae] => handler block5diff --git a/Tests/LibJS/Bytecode/expected/lexical-env-teardown.txt b/Tests/LibJS/Bytecode/expected/lexical-env-teardown.txtindex 609a6a13591..ffdd36b7cb1 100644--- a/Tests/LibJS/Bytecode/expected/lexical-env-teardown.txt+++ b/Tests/LibJS/Bytecode/expected/lexical-env-teardown.txt@@ -1,4 +1,4 @@-$ae39a612 lexical-env-teardown.js:13:1+$fd954441 lexical-env-teardown.js:13:1Registers: 9Blocks: 1Constants:@@ -37,17 +37,17 @@ block0:[ fd] CreateVariable `myName`, is_immutable:true, is_global:false, is_strict:false[ 105] NewFunction dst:reg6, shared_function_data_index:0[ 10d] InitializeLexicalBinding `myName`, src:reg6- [ 11a] SetLexicalEnvironment environment:reg4- [ 11c] SetGlobal `namedFn`, src:reg6- [ 123] GetGlobal value_feedback:25, dst:reg6, `console`- [ 12c] GetById value_feedback:26, dst:reg7, base:reg6, `log`- [ 136] GetGlobal value_feedback:27, dst:reg8, `namedFn`- [ 13f] Call value_feedback:28, call_feedback:10, dst:reg8, callee:reg8, this_value:Undefined- [ 148] Call value_feedback:29, call_feedback:11, dst:reg5, callee:reg7, this_value:reg6, arguments:[reg8]- [ 152] End value:reg5+ [ 115] SetLexicalEnvironment environment:reg4+ [ 117] SetGlobal `namedFn`, src:reg6+ [ 11e] GetGlobal value_feedback:25, dst:reg6, `console`+ [ 127] GetById value_feedback:26, dst:reg7, base:reg6, `log`+ [ 131] GetGlobal value_feedback:27, dst:reg8, `namedFn`+ [ 13a] Call value_feedback:28, call_feedback:10, dst:reg8, callee:reg8, this_value:Undefined+ [ 143] Call value_feedback:29, call_feedback:11, dst:reg5, callee:reg7, this_value:reg6, arguments:[reg8]+ [ 14d] End value:reg5-withTeardown$13fd8729 lexical-env-teardown.js:7:9+withTeardown$f243107f lexical-env-teardown.js:7:9Registers: 9Blocks: 1Locals: inner~0@@ -60,16 +60,16 @@ block0:[ 1] CreateVariable `outer`, is_immutable:false, is_global:false, is_strict:false[ 9] GetLexicalEnvironment dst:reg4[ b] InitializeLexicalBinding `outer`, src:Int32(1)- [ 18] NewObject dst:reg5- [ 1c] InitObjectLiteralProperty object:reg5, `x`, src:Int32(10), shape_cache_index:0, property_slot:0- [ 26] CacheObjectShape object:reg5- [ 2a] EnterObjectEnvironment dst:reg6, object:reg5- [ 2d] DynamicGetBinding value_feedback:0, dst:reg7, `x`- [ 36] DynamicGetBinding value_feedback:1, dst:reg8, `outer`- [ 3f] Add arith_feedback:0, dst:inner~0, lhs:reg7, rhs:reg8- [ 45] SetLexicalEnvironment environment:reg4- [ 47] GetBinding value_feedback:2, dst:reg5, `outer`- [ 56] Return value:reg5+ [ 13] NewObject dst:reg5+ [ 17] InitObjectLiteralProperty object:reg5, `x`, src:Int32(10), shape_cache_index:0, property_slot:0+ [ 21] CacheObjectShape object:reg5+ [ 25] EnterObjectEnvironment dst:reg6, object:reg5+ [ 28] DynamicGetBinding value_feedback:0, dst:reg7, `x`+ [ 31] DynamicGetBinding value_feedback:1, dst:reg8, `outer`+ [ 3a] Add arith_feedback:0, dst:inner~0, lhs:reg7, rhs:reg8+ [ 40] SetLexicalEnvironment environment:reg4+ [ 42] GetBinding value_feedback:2, dst:reg5, `outer`+ [ 4c] Return value:reg5blockTeardown$e0c89ee5 lexical-env-teardown.js:17:9@@ -191,14 +191,14 @@ Exception handlers:[ 4 .. 18] => handler block2-myName$ad026f37 lexical-env-teardown.js:60:5+myName$40a39b9c lexical-env-teardown.js:60:5Registers: 6Blocks: 1block0:[ 0] Enter[ 1] TypeofBinding dst:reg5, `myName`- [ e] Return value:reg5+ [ 9] Return value:reg51diff --git a/Tests/LibJS/Bytecode/expected/mapped-arguments-parameter-bindings.txt b/Tests/LibJS/Bytecode/expected/mapped-arguments-parameter-bindings.txtindex f655e1fd127..728d41f334c 100644--- a/Tests/LibJS/Bytecode/expected/mapped-arguments-parameter-bindings.txt+++ b/Tests/LibJS/Bytecode/expected/mapped-arguments-parameter-bindings.txt@@ -15,7 +15,7 @@ block0:[ 19] End value:reg5-forward$50e96685 mapped-arguments-parameter-bindings.js:2:5+forward$ba844910 mapped-arguments-parameter-bindings.js:2:5Registers: 7Blocks: 1Locals: arguments~0@@ -26,13 +26,13 @@ block0:[ 0] Enter[ 1] CreateArguments dst:arguments~0, is_immutable:false, creates_parameter_bindings:true[ 6] InitializeLexicalBinding `a`, src:Undefined- [ 13] SetLexicalBinding `a`, src:arg0- [ 20] InitializeLexicalBinding `b`, src:Undefined- [ 2d] SetLexicalBinding `b`, src:arg1- [ 3a] SetLexicalBinding `a`, src:arg2- [ 47] GetLength value_feedback:0, keyed_feedback:0, dst:reg5, base:arguments~0- [ 50] GetBinding value_feedback:1, dst:reg6, `a`- [ 5f] Add arith_feedback:0, dst:reg5, lhs:reg5, rhs:reg6- [ 65] GetBinding value_feedback:2, dst:reg6, `b`- [ 74] Add arith_feedback:1, dst:reg5, lhs:reg5, rhs:reg6- [ 7a] Return value:reg5+ [ e] SetLexicalBinding `a`, src:arg0+ [ 16] InitializeLexicalBinding `b`, src:Undefined+ [ 1e] SetLexicalBinding `b`, src:arg1+ [ 26] SetLexicalBinding `a`, src:arg2+ [ 2e] GetLength value_feedback:0, keyed_feedback:0, dst:reg5, base:arguments~0+ [ 37] GetBinding value_feedback:1, dst:reg6, `a`+ [ 41] Add arith_feedback:0, dst:reg5, lhs:reg5, rhs:reg6+ [ 47] GetBinding value_feedback:2, dst:reg6, `b`+ [ 51] Add arith_feedback:1, dst:reg5, lhs:reg5, rhs:reg6+ [ 57] Return value:reg5diff --git a/Tests/LibJS/Bytecode/expected/module-level-bindings.txt b/Tests/LibJS/Bytecode/expected/module-level-bindings.txtindex 09da3236518..73d6e0bf2c3 100644--- a/Tests/LibJS/Bytecode/expected/module-level-bindings.txt+++ b/Tests/LibJS/Bytecode/expected/module-level-bindings.txt@@ -8,26 +8,26 @@ block0:[ 9] Return value:reg5-inner$8b85ab43 module-level-bindings.mjs:7:18+inner$da0a5cd7 module-level-bindings.mjs:7:18Registers: 7Blocks: 1block0:[ 0] Enter[ 1] GetBinding value_feedback:0, dst:reg5, `lexical`- [ 10] GetBinding value_feedback:1, dst:reg6, `constant`- [ 1f] Add arith_feedback:0, dst:reg5, lhs:reg5, rhs:reg6- [ 25] SetLexicalBinding `variable`, src:reg5- [ 32] GetCalleeAndThisFromEnvironment value_feedback:2, callee:reg5, this_value:reg6, `declared`- [ 42] Call value_feedback:3, call_feedback:0, dst:reg5, callee:reg5, this_value:reg6- [ 4b] Return value:reg5+ [ b] GetBinding value_feedback:1, dst:reg6, `constant`+ [ 15] Add arith_feedback:0, dst:reg5, lhs:reg5, rhs:reg6+ [ 1b] SetLexicalBinding `variable`, src:reg5+ [ 23] GetCalleeAndThisFromEnvironment value_feedback:2, callee:reg5, this_value:reg6, `declared`+ [ 2e] Call value_feedback:3, call_feedback:0, dst:reg5, callee:reg5, this_value:reg6+ [ 37] Return value:reg5-declared$e1cd3589 module-level-bindings.mjs:13:5+declared$add38b02 module-level-bindings.mjs:13:5Registers: 6Blocks: 1block0:[ 0] Enter[ 1] TypeofBinding dst:reg5, `lexical`- [ e] Return value:reg5+ [ 9] Return value:reg5diff --git a/Tests/LibJS/Bytecode/expected/named-function-expression-unused-name.txt b/Tests/LibJS/Bytecode/expected/named-function-expression-unused-name.txtindex 3228c710f56..572099b580a 100644--- a/Tests/LibJS/Bytecode/expected/named-function-expression-unused-name.txt+++ b/Tests/LibJS/Bytecode/expected/named-function-expression-unused-name.txt@@ -15,7 +15,7 @@ block0:[ 29] End value:reg5-outer$dcae033a named-function-expression-unused-name.js:6:20+outer$248e6f1b named-function-expression-unused-name.js:6:20Registers: 7Blocks: 1Locals: unused~0, used~1, nested~2@@ -24,25 +24,25 @@ block0:[ 0] Enter[ 1] CreateVariable `x`, is_immutable:false, is_global:false, is_strict:false[ 9] InitializeLexicalBinding `x`, src:arg0- [ 16] GetLexicalEnvironment dst:reg4- [ 18] NewFunction dst:unused~0, shared_function_data_index:0- [ 20] CreateLexicalEnvironment dst:reg6, parent:reg4, capacity:1, is_catch_environment:false- [ 2c] CreateVariable `g`, is_immutable:true, is_global:false, is_strict:false- [ 34] NewFunction dst:reg5, shared_function_data_index:1- [ 3c] InitializeLexicalBinding `g`, src:reg5- [ 49] SetLexicalEnvironment environment:reg4- [ 4b] Mov dst:used~1, src:reg5- [ 4e] CreateLexicalEnvironment dst:reg6, parent:reg4, capacity:1, is_catch_environment:false- [ 5a] CreateVariable `h`, is_immutable:true, is_global:false, is_strict:false- [ 62] NewFunction dst:reg5, shared_function_data_index:2- [ 6a] InitializeLexicalBinding `h`, src:reg5- [ 77] SetLexicalEnvironment environment:reg4- [ 79] Mov dst:nested~2, src:reg5- [ 7c] NewArray dst:reg5, elements:[unused~0, used~1, nested~2]- [ 82] Return value:reg5+ [ 11] GetLexicalEnvironment dst:reg4+ [ 13] NewFunction dst:unused~0, shared_function_data_index:0+ [ 1b] CreateLexicalEnvironment dst:reg6, parent:reg4, capacity:1, is_catch_environment:false+ [ 27] CreateVariable `g`, is_immutable:true, is_global:false, is_strict:false+ [ 2f] NewFunction dst:reg5, shared_function_data_index:1+ [ 37] InitializeLexicalBinding `g`, src:reg5+ [ 3f] SetLexicalEnvironment environment:reg4+ [ 41] Mov dst:used~1, src:reg5+ [ 44] CreateLexicalEnvironment dst:reg6, parent:reg4, capacity:1, is_catch_environment:false+ [ 50] CreateVariable `h`, is_immutable:true, is_global:false, is_strict:false+ [ 58] NewFunction dst:reg5, shared_function_data_index:2+ [ 60] InitializeLexicalBinding `h`, src:reg5+ [ 68] SetLexicalEnvironment environment:reg4+ [ 6a] Mov dst:nested~2, src:reg5+ [ 6d] NewArray dst:reg5, elements:[unused~0, used~1, nested~2]+ [ 73] Return value:reg5-outerWithEval$7405b07e named-function-expression-unused-name.js:19:5+outerWithEval$9fb387d5 named-function-expression-unused-name.js:19:5Registers: 7Blocks: 1@@ -53,5 +53,5 @@ block0:[ f] CreateVariable `i`, is_immutable:true, is_global:false, is_strict:false[ 17] NewFunction dst:reg5, shared_function_data_index:0[ 1f] InitializeLexicalBinding `i`, src:reg5- [ 2c] SetLexicalEnvironment environment:reg4- [ 2e] Return value:reg5+ [ 27] SetLexicalEnvironment environment:reg4+ [ 29] Return value:reg5diff --git a/Tests/LibJS/Bytecode/expected/named-function-expression.txt b/Tests/LibJS/Bytecode/expected/named-function-expression.txtindex 1225ace4116..3acefb466b8 100644--- a/Tests/LibJS/Bytecode/expected/named-function-expression.txt+++ b/Tests/LibJS/Bytecode/expected/named-function-expression.txt@@ -1,4 +1,4 @@-$7e89aeb1 named-function-expression.js:4:1+$f334557c named-function-expression.js:4:1Registers: 9Blocks: 4Constants:@@ -14,19 +14,19 @@ block0:[ 19] CreateVariable `Oops`, is_immutable:true, is_global:false, is_strict:false[ 21] NewFunction dst:reg7, shared_function_data_index:0[ 29] InitializeLexicalBinding `Oops`, src:reg7- [ 36] SetLexicalEnvironment environment:reg4- [ 38] JumpIf condition:reg6, true_target:block1, false_target:block2+ [ 31] SetLexicalEnvironment environment:reg4+ [ 33] JumpIf condition:reg6, true_target:block1, false_target:block2block1:- [ 42] SetGlobal `Oops`, src:reg7- [ 49] Jump target:block3+ [ 3d] SetGlobal `Oops`, src:reg7+ [ 44] Jump target:block3block2:- [ 4e] SetResolvedBinding environment:Null, `Oops`, src:reg7- [ 54] Jump target:block3+ [ 49] SetResolvedBinding environment:Null, `Oops`, src:reg7+ [ 4f] Jump target:block3block3:- [ 59] Mov dst:reg5, src:reg7- [ 5c] GetGlobal value_feedback:0, dst:reg6, `Oops`- [ 65] GetById value_feedback:1, dst:reg5, base:reg6, `x`- [ 6f] End value:reg5+ [ 54] Mov dst:reg5, src:reg7+ [ 57] GetGlobal value_feedback:0, dst:reg6, `Oops`+ [ 60] GetById value_feedback:1, dst:reg5, base:reg6, `x`+ [ 6a] End value:reg5diff --git a/Tests/LibJS/Bytecode/expected/parameter-createvariable-order.txt b/Tests/LibJS/Bytecode/expected/parameter-createvariable-order.txtindex 1fa81a188e2..0f4732a3d16 100644--- a/Tests/LibJS/Bytecode/expected/parameter-createvariable-order.txt+++ b/Tests/LibJS/Bytecode/expected/parameter-createvariable-order.txt@@ -15,7 +15,7 @@ block0:[ 19] End value:reg5-f$5f1ead96 parameter-createvariable-order.js:2:9+f$ac86fb97 parameter-createvariable-order.js:2:9Registers: 6Blocks: 1Locals: inner~0@@ -26,25 +26,25 @@ block0:[ 0] Enter[ 1] CreateVariable `a`, is_immutable:false, is_global:false, is_strict:false[ 9] InitializeLexicalBinding `a`, src:arg0- [ 16] CreateVariable `b`, is_immutable:false, is_global:false, is_strict:false- [ 1e] InitializeLexicalBinding `b`, src:arg1- [ 2b] CreateVariable `c`, is_immutable:false, is_global:false, is_strict:false- [ 33] InitializeLexicalBinding `c`, src:arg2- [ 40] Mov dst:inner~0, src:Undefined- [ 43] NewFunction dst:inner~0, shared_function_data_index:0 (inner)- [ 4b] Call value_feedback:0, call_feedback:0, dst:reg5, callee:inner~0, this_value:Undefined- [ 54] Return value:reg5+ [ 11] CreateVariable `b`, is_immutable:false, is_global:false, is_strict:false+ [ 19] InitializeLexicalBinding `b`, src:arg1+ [ 21] CreateVariable `c`, is_immutable:false, is_global:false, is_strict:false+ [ 29] InitializeLexicalBinding `c`, src:arg2+ [ 31] Mov dst:inner~0, src:Undefined+ [ 34] NewFunction dst:inner~0, shared_function_data_index:0 (inner)+ [ 3c] Call value_feedback:0, call_feedback:0, dst:reg5, callee:inner~0, this_value:Undefined+ [ 45] Return value:reg5-inner$558f3bdd parameter-createvariable-order.js:3:9+inner$0826eddc parameter-createvariable-order.js:3:9Registers: 7Blocks: 1block0:[ 0] Enter[ 1] GetBinding value_feedback:0, dst:reg5, `a`- [ 10] GetBinding value_feedback:1, dst:reg6, `b`- [ 1f] Add arith_feedback:0, dst:reg5, lhs:reg5, rhs:reg6- [ 25] GetBinding value_feedback:2, dst:reg6, `c`- [ 34] Add arith_feedback:1, dst:reg5, lhs:reg5, rhs:reg6- [ 3a] Return value:reg5+ [ b] GetBinding value_feedback:1, dst:reg6, `b`+ [ 15] Add arith_feedback:0, dst:reg5, lhs:reg5, rhs:reg6+ [ 1b] GetBinding value_feedback:2, dst:reg6, `c`+ [ 25] Add arith_feedback:1, dst:reg5, lhs:reg5, rhs:reg6+ [ 2b] Return value:reg5diff --git a/Tests/LibJS/Bytecode/expected/parameter-environment-capacity.txt b/Tests/LibJS/Bytecode/expected/parameter-environment-capacity.txtindex c5c8f73bac6..9bad71dac0b 100644--- a/Tests/LibJS/Bytecode/expected/parameter-environment-capacity.txt+++ b/Tests/LibJS/Bytecode/expected/parameter-environment-capacity.txt@@ -23,7 +23,7 @@ block0:[ 69] End value:reg5-sloppy$8971ced1 parameter-environment-capacity.js:6:17+sloppy$9e74f3be parameter-environment-capacity.js:6:17Registers: 6Blocks: 3Constants:@@ -40,8 +40,8 @@ block1:block2:[ 1b] InitializeLexicalBinding `a`, src:arg0- [ 28] NewFunction dst:reg5, shared_function_data_index:0- [ 30] Return value:reg5+ [ 23] NewFunction dst:reg5, shared_function_data_index:0+ [ 2b] Return value:reg5Strict$3395ae05@@ -55,7 +55,7 @@ block0:[ 1] End value:Undefined-method$95b87cd0 parameter-environment-capacity.js:11:12+method$d3a58804 parameter-environment-capacity.js:11:12Registers: 7Blocks: 3Constants:@@ -74,12 +74,12 @@ block1:block2:[ 20] InitializeLexicalBinding `mode`, src:arg0- [ 2d] InitializeLexicalBinding `index`, src:arg1- [ 3a] CreateVariableEnvironment capacity:1- [ 3f] GetLexicalEnvironment dst:reg5- [ 41] CreateVariable `active`, is_immutable:true, is_global:false, is_strict:true- [ 49] GetBinding value_feedback:0, dst:reg6, `mode`- [ 58] StrictlyEquals arith_feedback:0, dst:reg6, lhs:reg6, rhs:String("a")- [ 5e] InitializeLexicalBinding `active`, src:reg6- [ 6b] NewFunction dst:reg6, shared_function_data_index:0- [ 73] Return value:reg6+ [ 28] InitializeLexicalBinding `index`, src:arg1+ [ 30] CreateVariableEnvironment capacity:1+ [ 35] GetLexicalEnvironment dst:reg5+ [ 37] CreateVariable `active`, is_immutable:true, is_global:false, is_strict:true+ [ 3f] GetBinding value_feedback:0, dst:reg6, `mode`+ [ 49] StrictlyEquals arith_feedback:0, dst:reg6, lhs:reg6, rhs:String("a")+ [ 4f] InitializeLexicalBinding `active`, src:reg6+ [ 57] NewFunction dst:reg6, shared_function_data_index:0+ [ 5f] Return value:reg6diff --git a/Tests/LibJS/Bytecode/expected/switch-scoping.txt b/Tests/LibJS/Bytecode/expected/switch-scoping.txtindex c633ec83435..62e5c6efa1c 100644--- a/Tests/LibJS/Bytecode/expected/switch-scoping.txt+++ b/Tests/LibJS/Bytecode/expected/switch-scoping.txt@@ -22,7 +22,7 @@ block0:[ 64] End value:reg5-switchWithBlockDecl$63e53a99 switch-scoping.js:2:9+switchWithBlockDecl$6e69d4ef switch-scoping.js:2:9Registers: 8Blocks: 6Locals: result~0@@ -51,37 +51,37 @@ block2:block3:[ 44] InitializeLexicalBinding `a`, src:String("one")- [ 51] NewFunction dst:result~0, shared_function_data_index:0 (result)- [ 59] Jump target:block5+ [ 4c] NewFunction dst:result~0, shared_function_data_index:0 (result)+ [ 54] Jump target:block5block4:- [ 5e] InitializeLexicalBinding `b`, src:String("two")- [ 6b] NewFunction dst:result~0, shared_function_data_index:1 (result)+ [ 59] InitializeLexicalBinding `b`, src:String("two")+ [ 61] NewFunction dst:result~0, shared_function_data_index:1 (result)block5:- [ 73] SetLexicalEnvironment environment:reg4- [ 75] Call value_feedback:0, call_feedback:0, dst:reg5, callee:result~0, this_value:Undefined- [ 7e] Return value:reg5+ [ 69] SetLexicalEnvironment environment:reg4+ [ 6b] Call value_feedback:0, call_feedback:0, dst:reg5, callee:result~0, this_value:Undefined+ [ 74] Return value:reg5-result$e15525de switch-scoping.js:6:22+result$cc5200f1 switch-scoping.js:6:22Registers: 6Blocks: 1block0:[ 0] Enter[ 1] GetBinding value_feedback:0, dst:reg5, `a`- [ 10] Return value:reg5+ [ b] Return value:reg5-result$a8186c12 switch-scoping.js:10:22+result$173b30bd switch-scoping.js:10:22Registers: 6Blocks: 1block0:[ 0] Enter[ 1] GetBinding value_feedback:0, dst:reg5, `b`- [ 10] Return value:reg5+ [ b] Return value:reg5"one"diff --git a/Tests/LibJS/Bytecode/expected/switch-with-block-scope-return.txt b/Tests/LibJS/Bytecode/expected/switch-with-block-scope-return.txtindex 86e50e39055..4de7ab1f4fe 100644--- a/Tests/LibJS/Bytecode/expected/switch-with-block-scope-return.txt+++ b/Tests/LibJS/Bytecode/expected/switch-with-block-scope-return.txt@@ -13,7 +13,7 @@ block0:[ 17] End value:reg5-f$f1f32237 switch-with-block-scope-return.js:2:13+f$eac3b29a switch-with-block-scope-return.js:2:13Registers: 8Blocks: 6Constants:@@ -44,11 +44,11 @@ block3:block4:[ 3d] InitializeLexicalBinding `y`, src:String("two")- [ 4a] NewFunction dst:reg7, shared_function_data_index:0- [ 52] Call value_feedback:0, call_feedback:0, dst:reg7, callee:reg7, this_value:Undefined- [ 5b] SetLexicalEnvironment environment:reg4- [ 5d] Return value:reg7+ [ 45] NewFunction dst:reg7, shared_function_data_index:0+ [ 4d] Call value_feedback:0, call_feedback:0, dst:reg7, callee:reg7, this_value:Undefined+ [ 56] SetLexicalEnvironment environment:reg4+ [ 58] Return value:reg7block5:- [ 5f] SetLexicalEnvironment environment:reg4- [ 61] Return value:String("other")+ [ 5a] SetLexicalEnvironment environment:reg4+ [ 5c] Return value:String("other")diff --git a/Tests/LibJS/Bytecode/expected/using-declaration-non-local-env.txt b/Tests/LibJS/Bytecode/expected/using-declaration-non-local-env.txtindex 21cb8fae578..4353f64b08b 100644--- a/Tests/LibJS/Bytecode/expected/using-declaration-non-local-env.txt+++ b/Tests/LibJS/Bytecode/expected/using-declaration-non-local-env.txt@@ -30,7 +30,7 @@ Exception handlers:[ 7 .. 1d] => handler block2-$fe06658a using-declaration-non-local-env.js:1:19+$8ee3a0df using-declaration-non-local-env.js:1:19Registers: 10Blocks: 6Constants:@@ -49,26 +49,26 @@ block1:[ 19] NewObject dst:reg9[ 1d] AddDisposableResource stack:reg6, value:reg9, hint:0[ 24] InitializeLexicalBinding `x`, src:reg9- [ 31] NewFunction dst:reg9, shared_function_data_index:0- [ 39] Call value_feedback:0, call_feedback:0, dst:reg9, callee:reg9, this_value:Undefined- [ 42] Mov dst:reg7, src:Int32(0)- [ 45] Jump target:block3+ [ 2c] NewFunction dst:reg9, shared_function_data_index:0+ [ 34] Call value_feedback:0, call_feedback:0, dst:reg9, callee:reg9, this_value:Undefined+ [ 3d] Mov dst:reg7, src:Int32(0)+ [ 40] Jump target:block3block2:- [ 4a] Catch value_feedback:1, dst:reg8- [ 4e] SetLexicalEnvironment environment:reg5- [ 50] Mov dst:reg7, src:Int32(1)+ [ 45] Catch value_feedback:1, dst:reg8+ [ 49] SetLexicalEnvironment environment:reg5+ [ 4b] Mov dst:reg7, src:Int32(1)block3:- [ 53] DisposeResources stack:reg6, completion_type:reg7, completion_value:reg8- [ 57] JumpStrictlyEqualsRhsInt32 arith_feedback:0, lhs:reg7, rhs:0, true_target:block5, false_target:block4+ [ 4e] DisposeResources stack:reg6, completion_type:reg7, completion_value:reg8+ [ 52] JumpStrictlyEqualsRhsInt32 arith_feedback:0, lhs:reg7, rhs:0, true_target:block5, false_target:block4block4:- [ 67] Throw src:reg8+ [ 62] Throw src:reg8block5:- [ 69] SetLexicalEnvironment environment:reg4- [ 6b] End value:Undefined+ [ 64] SetLexicalEnvironment environment:reg4+ [ 66] End value:UndefinedException handlers:- [ 19 .. 4a] => handler block2+ [ 19 .. 45] => handler block2diff --git a/Tests/LibJS/Bytecode/expected/var-binding-access.txt b/Tests/LibJS/Bytecode/expected/var-binding-access.txtindex d5d15c7402e..af6a89f14bb 100644--- a/Tests/LibJS/Bytecode/expected/var-binding-access.txt+++ b/Tests/LibJS/Bytecode/expected/var-binding-access.txt@@ -14,7 +14,7 @@ block0:[ 28] End value:reg5-var_access$64ed5ef3 var-binding-access.js:5:9+var_access$178510f2 var-binding-access.js:5:9Registers: 6Blocks: 1Constants:@@ -25,13 +25,13 @@ block0:[ 0] Enter[ 1] CreateVariable `x`, is_immutable:false, is_global:false, is_strict:false[ 9] InitializeVariableBinding `x`, src:Undefined- [ 16] SetLexicalBinding `x`, src:Int32(1)- [ 23] NewFunction dst:reg5, shared_function_data_index:0- [ 2b] GetInitializedBinding value_feedback:0, dst:reg5, `x`- [ 3a] Return value:reg5+ [ 11] SetLexicalBinding `x`, src:Int32(1)+ [ 19] NewFunction dst:reg5, shared_function_data_index:0+ [ 21] GetInitializedBinding value_feedback:0, dst:reg5, `x`+ [ 2b] Return value:reg5-let_access$e09a3543 var-binding-access.js:14:9+let_access$c1a3afa9 var-binding-access.js:14:9Registers: 6Blocks: 1Constants:@@ -41,6 +41,6 @@ block0:[ 0] Enter[ 1] CreateVariable `x`, is_immutable:false, is_global:false, is_strict:false[ 9] InitializeLexicalBinding `x`, src:Int32(1)- [ 16] NewFunction dst:reg5, shared_function_data_index:0- [ 1e] GetBinding value_feedback:0, dst:reg5, `x`- [ 2d] Return value:reg5+ [ 11] NewFunction dst:reg5, shared_function_data_index:0+ [ 19] GetBinding value_feedback:0, dst:reg5, `x`+ [ 23] Return value:reg5diff --git a/Tests/LibJS/Bytecode/expected/var-env-capacity-with-param-expressions.txt b/Tests/LibJS/Bytecode/expected/var-env-capacity-with-param-expressions.txtindex 2ee4a2a76d5..07364d35f33 100644--- a/Tests/LibJS/Bytecode/expected/var-env-capacity-with-param-expressions.txt+++ b/Tests/LibJS/Bytecode/expected/var-env-capacity-with-param-expressions.txt@@ -12,7 +12,7 @@ block0:[ 16] End value:reg5-f$b44956c8 var-env-capacity-with-param-expressions.js:1:12+f$f7be441c var-env-capacity-with-param-expressions.js:1:12Registers: 10Blocks: 3Constants:@@ -33,18 +33,18 @@ block1:block2:[ 29] InitializeLexicalBinding `x`, src:arg0- [ 36] CreateVariableEnvironment capacity:3- [ 3b] GetLexicalEnvironment dst:reg6- [ 3d] CreateLexicalEnvironment dst:reg7, parent:reg6, capacity:3, is_catch_environment:false- [ 49] CreateVariable `a`, is_immutable:false, is_global:false, is_strict:false- [ 51] InitializeVariableBinding `a`, src:Undefined- [ 5e] CreateVariable `b`, is_immutable:false, is_global:false, is_strict:false- [ 66] InitializeVariableBinding `b`, src:Undefined- [ 73] CreateVariable `c`, is_immutable:false, is_global:false, is_strict:false- [ 7b] InitializeVariableBinding `c`, src:Undefined- [ 88] DynamicGetCalleeAndThisFromEnvironment value_feedback:0, callee:reg8, this_value:reg9, `eval`- [ 92] CallDirectEval value_feedback:1, call_feedback:0, dst:reg8, callee:reg8, this_value:reg9, arguments:[String("")]- [ 9c] End value:Undefined+ [ 31] CreateVariableEnvironment capacity:3+ [ 36] GetLexicalEnvironment dst:reg6+ [ 38] CreateLexicalEnvironment dst:reg7, parent:reg6, capacity:3, is_catch_environment:false+ [ 44] CreateVariable `a`, is_immutable:false, is_global:false, is_strict:false+ [ 4c] InitializeVariableBinding `a`, src:Undefined+ [ 54] CreateVariable `b`, is_immutable:false, is_global:false, is_strict:false+ [ 5c] InitializeVariableBinding `b`, src:Undefined+ [ 64] CreateVariable `c`, is_immutable:false, is_global:false, is_strict:false+ [ 6c] InitializeVariableBinding `c`, src:Undefined+ [ 74] DynamicGetCalleeAndThisFromEnvironment value_feedback:0, callee:reg8, this_value:reg9, `eval`+ [ 7e] CallDirectEval value_feedback:1, call_feedback:0, dst:reg8, callee:reg8, this_value:reg9, arguments:[String("")]+ [ 88] End value:Undefinedeval$d8dbb89ddiff --git a/Tests/LibJS/Runtime/environment-coordinates-past-instruction-fields.js b/Tests/LibJS/Runtime/environment-coordinates-past-instruction-fields.jsnew file mode 100644index 00000000000..d5e69ff6109--- /dev/null+++ b/Tests/LibJS/Runtime/environment-coordinates-past-instruction-fields.js@@ -0,0 +1,31 @@+// Instructions hold the coordinate of a binding as a byte of hops and two bytes of binding index. Bindings past that+// are looked up by name, which must give the same results.++test("bindings of an environment past the first 65536", () => {+ const count = 65600;+ let source = "";+ for (let i = 0; i < count; ++i) source += `var p${i} = ${i};`;+ source += "let a = 1; var b = 2; function h() { return 7; }";+ source += "function padding() { return [";+ for (let i = 0; i < count; ++i) source += `p${i},`;+ source += "]; }";+ source += "return [function g() { a = a + b; b = 3; return [a, typeof a, h()]; }, padding];";+ const [g, padding] = new Function(source)();+ expect(g()).toEqual([3, "number", 7]);+ expect(g()).toEqual([6, "number", 7]);+ expect(g()).toEqual([9, "number", 7]);+ const values = padding();+ expect(values).toHaveLength(count);+ for (const i of [0, 65535, 65536, count - 1]) expect(values[i]).toBe(i);+});++test("bindings more than 255 environments out", () => {+ const depth = 270;+ let source = "";+ for (let i = 0; i < depth; ++i) source += `{ let x${i} = ${i}; (() => x${i});`;+ source += "return () => { x0 = x0 + 1; return [x0, x1, typeof x2, x268]; };";+ source += "}".repeat(depth);+ const f = new Function(source)();+ expect(f()).toEqual([1, 1, "number", 268]);+ expect(f()).toEqual([2, 1, "number", 268]);+});