Skip to content

Truly independent web browser

LibJS: Compress the outer pointers and shapes of environments

Andreas Kling9e4ae84663c3
diff --git a/Libraries/LibJS/Flap/tests/interpreter-assembly/aarch64.S b/Libraries/LibJS/Flap/tests/interpreter-assembly/aarch64.S
index 4bb39d9ee01..ff8d7c7ef19 100644
--- a/Libraries/LibJS/Flap/tests/interpreter-assembly/aarch64.S
+++ b/Libraries/LibJS/Flap/tests/interpreter-assembly/aarch64.S
@@ -3351,19 +3351,22 @@ asm_handler_SetLexicalEnvironment_hot_end:
.p2align 4
asm_handler_GetBinding:
- ldr x1, [x28, #32]
- add x0, x21, #12
- ldp w0, w2, [x0, #0]
- cbz x1, .Lasm_GetBinding.assert_predicate_failure_9
- cbz w0, .Lasm_GetBinding.ssa_block_3
+ ldr x0, [x28, #32]
+ add x1, x21, #12
+ ldp w1, w2, [x1, #0]
+ cbz x0, .Lasm_GetBinding.assert_predicate_failure_9
+ cbz w1, .Lasm_GetBinding.ssa_block_3
.Lasm_GetBinding.ssa_block_4:
- ldr x1, [x1, #16]
- cbz x1, .Lasm_GetBinding.assert_predicate_failure_25
- subs x0, x0, #1
- cbnz w0, .Lasm_GetBinding.ssa_block_4
+ ldr w0, [x0, #16]
+ add x9, x24, w0, uxtw #3
+ cmp w0, #0
+ csel x0, x9, xzr, ne
+ cbz x0, .Lasm_GetBinding.assert_predicate_failure_25
+ subs x1, x1, #1
+ cbnz w1, .Lasm_GetBinding.ssa_block_4
.Lasm_GetBinding.ssa_block_3:
- cbz x1, .Lasm_GetBinding.assert_predicate_failure_13
- ldr x0, [x1, #32]
+ cbz x0, .Lasm_GetBinding.assert_predicate_failure_13
+ ldr x0, [x0, #24]
cbz x0, .Lasm_GetBinding.assert_failure_0
ldr x0, [x0, x2, lsl #3]
movz x9, #0x7ffb, lsl #48
@@ -3395,7 +3398,10 @@ asm_handler_DynamicGetBinding:
cbz w9, .Lasm_DynamicGetBinding.ssa_block_1
ldrb w9, [x0, #12]
cbnz w9, .Lasm_DynamicGetBinding.ssa_block_1
- ldr x0, [x0, #16]
+ ldr w0, [x0, #16]
+ add x9, x24, w0, uxtw #3
+ cmp w0, #0
+ csel x0, x9, xzr, ne
cbz x0, .Lasm_DynamicGetBinding.ssa_block_1
subs x1, x1, #1
cbnz w1, .Lasm_DynamicGetBinding.ssa_block_5
@@ -3405,7 +3411,7 @@ asm_handler_DynamicGetBinding:
cbz w9, .Lasm_DynamicGetBinding.ssa_block_1
ldrb w9, [x0, #12]
cbnz w9, .Lasm_DynamicGetBinding.ssa_block_1
- ldr x0, [x0, #32]
+ ldr x0, [x0, #24]
cbz x0, .Lasm_DynamicGetBinding.assert_failure_0
ldr x0, [x0, x2, lsl #3]
movz x9, #0x7ffb, lsl #48
@@ -3421,19 +3427,22 @@ asm_handler_DynamicGetBinding_hot_end:
.p2align 4
asm_handler_GetInitializedBinding:
- ldr x1, [x28, #32]
- add x0, x21, #12
- ldp w0, w2, [x0, #0]
- cbz x1, .Lasm_GetInitializedBinding.assert_predicate_failure_9
- cbz w0, .Lasm_GetInitializedBinding.ssa_block_2
+ ldr x0, [x28, #32]
+ add x1, x21, #12
+ ldp w1, w2, [x1, #0]
+ cbz x0, .Lasm_GetInitializedBinding.assert_predicate_failure_9
+ cbz w1, .Lasm_GetInitializedBinding.ssa_block_2
.Lasm_GetInitializedBinding.ssa_block_3:
- ldr x1, [x1, #16]
- cbz x1, .Lasm_GetInitializedBinding.assert_predicate_failure_25
- subs x0, x0, #1
- cbnz w0, .Lasm_GetInitializedBinding.ssa_block_3
+ ldr w0, [x0, #16]
+ add x9, x24, w0, uxtw #3
+ cmp w0, #0
+ csel x0, x9, xzr, ne
+ cbz x0, .Lasm_GetInitializedBinding.assert_predicate_failure_25
+ subs x1, x1, #1
+ cbnz w1, .Lasm_GetInitializedBinding.ssa_block_3
.Lasm_GetInitializedBinding.ssa_block_2:
- cbz x1, .Lasm_GetInitializedBinding.assert_predicate_failure_12
- ldr x0, [x1, #32]
+ cbz x0, .Lasm_GetInitializedBinding.assert_predicate_failure_12
+ ldr x0, [x0, #24]
cbz x0, .Lasm_GetInitializedBinding.assert_failure_0
ldr x0, [x0, x2, lsl #3]
ldr w9, [x21, #4]
@@ -3462,7 +3471,10 @@ asm_handler_DynamicGetInitializedBinding:
cbz w9, .Lasm_DynamicGetInitializedBinding.ssa_block_1
ldrb w9, [x0, #12]
cbnz w9, .Lasm_DynamicGetInitializedBinding.ssa_block_1
- ldr x0, [x0, #16]
+ ldr w0, [x0, #16]
+ add x9, x24, w0, uxtw #3
+ cmp w0, #0
+ csel x0, x9, xzr, ne
cbz x0, .Lasm_DynamicGetInitializedBinding.ssa_block_1
subs x1, x1, #1
cbnz w1, .Lasm_DynamicGetInitializedBinding.ssa_block_5
@@ -3472,7 +3484,7 @@ asm_handler_DynamicGetInitializedBinding:
cbz w9, .Lasm_DynamicGetInitializedBinding.ssa_block_1
ldrb w9, [x0, #12]
cbnz w9, .Lasm_DynamicGetInitializedBinding.ssa_block_1
- ldr x0, [x0, #32]
+ ldr x0, [x0, #24]
cbz x0, .Lasm_DynamicGetInitializedBinding.assert_failure_0
ldr x0, [x0, x2, lsl #3]
ldr w9, [x21, #4]
@@ -3485,19 +3497,22 @@ asm_handler_DynamicGetInitializedBinding_hot_end:
.p2align 4
asm_handler_InitializeLexicalBinding:
- ldr x1, [x28, #32]
- add x0, x21, #12
- ldp w0, w2, [x0, #0]
- cbz x1, .Lasm_InitializeLexicalBinding.assert_predicate_failure_9
- cbz w0, .Lasm_InitializeLexicalBinding.ssa_block_2
+ ldr x0, [x28, #32]
+ add x1, x21, #12
+ ldp w1, w2, [x1, #0]
+ cbz x0, .Lasm_InitializeLexicalBinding.assert_predicate_failure_9
+ cbz w1, .Lasm_InitializeLexicalBinding.ssa_block_2
.Lasm_InitializeLexicalBinding.ssa_block_3:
- ldr x1, [x1, #16]
- cbz x1, .Lasm_InitializeLexicalBinding.assert_predicate_failure_25
- subs x0, x0, #1
- cbnz w0, .Lasm_InitializeLexicalBinding.ssa_block_3
+ ldr w0, [x0, #16]
+ add x9, x24, w0, uxtw #3
+ cmp w0, #0
+ csel x0, x9, xzr, ne
+ cbz x0, .Lasm_InitializeLexicalBinding.assert_predicate_failure_25
+ subs x1, x1, #1
+ cbnz w1, .Lasm_InitializeLexicalBinding.ssa_block_3
.Lasm_InitializeLexicalBinding.ssa_block_2:
- cbz x1, .Lasm_InitializeLexicalBinding.assert_predicate_failure_12
- ldr x0, [x1, #32]
+ cbz x0, .Lasm_InitializeLexicalBinding.assert_predicate_failure_12
+ ldr x0, [x0, #24]
cbz x0, .Lasm_InitializeLexicalBinding.assert_failure_0
ldr w1, [x21, #8]
ldr x1, [x27, x1, lsl #3]
@@ -3510,19 +3525,22 @@ asm_handler_InitializeLexicalBinding_hot_end:
.p2align 4
asm_handler_InitializeVariableBinding:
- ldr x1, [x28, #40]
- add x0, x21, #12
- ldp w0, w2, [x0, #0]
- cbz x1, .Lasm_InitializeVariableBinding.assert_predicate_failure_9
- cbz w0, .Lasm_InitializeVariableBinding.ssa_block_2
+ ldr x0, [x28, #40]
+ add x1, x21, #12
+ ldp w1, w2, [x1, #0]
+ cbz x0, .Lasm_InitializeVariableBinding.assert_predicate_failure_9
+ cbz w1, .Lasm_InitializeVariableBinding.ssa_block_2
.Lasm_InitializeVariableBinding.ssa_block_3:
- ldr x1, [x1, #16]
- cbz x1, .Lasm_InitializeVariableBinding.assert_predicate_failure_25
- subs x0, x0, #1
- cbnz w0, .Lasm_InitializeVariableBinding.ssa_block_3
+ ldr w0, [x0, #16]
+ add x9, x24, w0, uxtw #3
+ cmp w0, #0
+ csel x0, x9, xzr, ne
+ cbz x0, .Lasm_InitializeVariableBinding.assert_predicate_failure_25
+ subs x1, x1, #1
+ cbnz w1, .Lasm_InitializeVariableBinding.ssa_block_3
.Lasm_InitializeVariableBinding.ssa_block_2:
- cbz x1, .Lasm_InitializeVariableBinding.assert_predicate_failure_12
- ldr x0, [x1, #32]
+ cbz x0, .Lasm_InitializeVariableBinding.assert_predicate_failure_12
+ ldr x0, [x0, #24]
cbz x0, .Lasm_InitializeVariableBinding.assert_failure_0
ldr w1, [x21, #8]
ldr x1, [x27, x1, lsl #3]
@@ -3551,7 +3569,10 @@ asm_handler_DynamicInitializeLexicalBinding:
cbz w9, .Lasm_DynamicInitializeLexicalBinding.ssa_block_1
ldrb w9, [x0, #12]
cbnz w9, .Lasm_DynamicInitializeLexicalBinding.ssa_block_1
- ldr x0, [x0, #16]
+ ldr w0, [x0, #16]
+ add x9, x24, w0, uxtw #3
+ cmp w0, #0
+ csel x0, x9, xzr, ne
cbz x0, .Lasm_DynamicInitializeLexicalBinding.ssa_block_1
subs x1, x1, #1
cbnz w1, .Lasm_DynamicInitializeLexicalBinding.ssa_block_5
@@ -3561,7 +3582,7 @@ asm_handler_DynamicInitializeLexicalBinding:
cbz w9, .Lasm_DynamicInitializeLexicalBinding.ssa_block_1
ldrb w9, [x0, #12]
cbnz w9, .Lasm_DynamicInitializeLexicalBinding.ssa_block_1
- ldr x0, [x0, #32]
+ ldr x0, [x0, #24]
cbz x0, .Lasm_DynamicInitializeLexicalBinding.assert_failure_0
ldr w1, [x21, #8]
ldr x1, [x27, x1, lsl #3]
@@ -3590,7 +3611,10 @@ asm_handler_DynamicInitializeVariableBinding:
cbz w9, .Lasm_DynamicInitializeVariableBinding.ssa_block_1
ldrb w9, [x0, #12]
cbnz w9, .Lasm_DynamicInitializeVariableBinding.ssa_block_1
- ldr x0, [x0, #16]
+ ldr w0, [x0, #16]
+ add x9, x24, w0, uxtw #3
+ cmp w0, #0
+ csel x0, x9, xzr, ne
cbz x0, .Lasm_DynamicInitializeVariableBinding.ssa_block_1
subs x1, x1, #1
cbnz w1, .Lasm_DynamicInitializeVariableBinding.ssa_block_5
@@ -3600,7 +3624,7 @@ asm_handler_DynamicInitializeVariableBinding:
cbz w9, .Lasm_DynamicInitializeVariableBinding.ssa_block_1
ldrb w9, [x0, #12]
cbnz w9, .Lasm_DynamicInitializeVariableBinding.ssa_block_1
- ldr x0, [x0, #32]
+ ldr x0, [x0, #24]
cbz x0, .Lasm_DynamicInitializeVariableBinding.assert_failure_0
ldr w1, [x21, #8]
ldr x1, [x27, x1, lsl #3]
@@ -3619,38 +3643,44 @@ asm_handler_SetLexicalBinding:
cbz x1, .Lasm_SetLexicalBinding.assert_predicate_failure_9
cbz w2, .Lasm_SetLexicalBinding.ssa_block_5
.Lasm_SetLexicalBinding.ssa_block_6:
- ldr x1, [x1, #16]
+ ldr w1, [x1, #16]
+ add x9, x24, w1, uxtw #3
+ cmp w1, #0
+ csel x1, x9, xzr, ne
cbz x1, .Lasm_SetLexicalBinding.assert_predicate_failure_31
subs x2, x2, #1
cbnz w2, .Lasm_SetLexicalBinding.ssa_block_6
.Lasm_SetLexicalBinding.ssa_block_5:
cbz x1, .Lasm_SetLexicalBinding.assert_predicate_failure_19
- ldr x2, [x1, #32]
- cbz x2, .Lasm_SetLexicalBinding.assert_failure_0
- ldr x3, [x2, x0, lsl #3]
+ ldr x3, [x1, #24]
+ cbz x3, .Lasm_SetLexicalBinding.assert_failure_0
+ ldr x2, [x3, x0, lsl #3]
movz x9, #0x7ffb, lsl #48
- cmp x3, x9
+ cmp x2, x9
b.eq .Lasm_SetLexicalBinding.ssa_block_1
- ldr x3, [x1, #24]
- cbnz x3, .Lasm_SetLexicalBinding.ssa_block_9
- ldr x1, [x1, #56]
+ ldr w2, [x1, #20]
+ add x9, x24, w2, uxtw #3
+ cmp w2, #0
+ csel x2, x9, xzr, ne
+ cbnz x2, .Lasm_SetLexicalBinding.ssa_block_9
+ ldr x1, [x1, #48]
ldr x1, [x1]
cbz x1, .Lasm_SetLexicalBinding.assert_failure_1
ldrb w1, [x1, x0]
b .Lasm_SetLexicalBinding.ssa_block_10
.Lasm_SetLexicalBinding.ssa_block_9:
- ldr x4, [x3, #24]
+ ldr x4, [x2, #24]
cmp x4, x0
b.hi .Lasm_SetLexicalBinding.ssa_block_12
- ldr x1, [x1, #56]
+ ldr x1, [x1, #48]
ldr x1, [x1]
cbz x1, .Lasm_SetLexicalBinding.assert_failure_2
- mov x3, x0
- subs x3, x3, x4
- ldrb w1, [x1, x3]
+ mov x2, x0
+ subs x2, x2, x4
+ ldrb w1, [x1, x2]
b .Lasm_SetLexicalBinding.ssa_block_10
.Lasm_SetLexicalBinding.ssa_block_12:
- ldr x1, [x3, #16]
+ ldr x1, [x2, #16]
cbz x1, .Lasm_SetLexicalBinding.assert_failure_3
ldrb w1, [x1, x0]
.Lasm_SetLexicalBinding.ssa_block_10:
@@ -3659,7 +3689,7 @@ asm_handler_SetLexicalBinding:
1:
ldr w1, [x21, #8]
ldr x1, [x27, x1, lsl #3]
- str x1, [x2, x0, lsl #3]
+ str x1, [x3, x0, lsl #3]
ldrb w9, [x21, #24]
add x21, x21, #24
ldr x10, [x19, x9, lsl #3]
@@ -3674,38 +3704,44 @@ asm_handler_SetVariableBinding:
cbz x1, .Lasm_SetVariableBinding.assert_predicate_failure_9
cbz w2, .Lasm_SetVariableBinding.ssa_block_5
.Lasm_SetVariableBinding.ssa_block_6:
- ldr x1, [x1, #16]
+ ldr w1, [x1, #16]
+ add x9, x24, w1, uxtw #3
+ cmp w1, #0
+ csel x1, x9, xzr, ne
cbz x1, .Lasm_SetVariableBinding.assert_predicate_failure_31
subs x2, x2, #1
cbnz w2, .Lasm_SetVariableBinding.ssa_block_6
.Lasm_SetVariableBinding.ssa_block_5:
cbz x1, .Lasm_SetVariableBinding.assert_predicate_failure_19
- ldr x2, [x1, #32]
- cbz x2, .Lasm_SetVariableBinding.assert_failure_0
- ldr x3, [x2, x0, lsl #3]
+ ldr x3, [x1, #24]
+ cbz x3, .Lasm_SetVariableBinding.assert_failure_0
+ ldr x2, [x3, x0, lsl #3]
movz x9, #0x7ffb, lsl #48
- cmp x3, x9
+ cmp x2, x9
b.eq .Lasm_SetVariableBinding.ssa_block_1
- ldr x3, [x1, #24]
- cbnz x3, .Lasm_SetVariableBinding.ssa_block_9
- ldr x1, [x1, #56]
+ ldr w2, [x1, #20]
+ add x9, x24, w2, uxtw #3
+ cmp w2, #0
+ csel x2, x9, xzr, ne
+ cbnz x2, .Lasm_SetVariableBinding.ssa_block_9
+ ldr x1, [x1, #48]
ldr x1, [x1]
cbz x1, .Lasm_SetVariableBinding.assert_failure_1
ldrb w1, [x1, x0]
b .Lasm_SetVariableBinding.ssa_block_10
.Lasm_SetVariableBinding.ssa_block_9:
- ldr x4, [x3, #24]
+ ldr x4, [x2, #24]
cmp x4, x0
b.hi .Lasm_SetVariableBinding.ssa_block_12
- ldr x1, [x1, #56]
+ ldr x1, [x1, #48]
ldr x1, [x1]
cbz x1, .Lasm_SetVariableBinding.assert_failure_2
- mov x3, x0
- subs x3, x3, x4
- ldrb w1, [x1, x3]
+ mov x2, x0
+ subs x2, x2, x4
+ ldrb w1, [x1, x2]
b .Lasm_SetVariableBinding.ssa_block_10
.Lasm_SetVariableBinding.ssa_block_12:
- ldr x1, [x3, #16]
+ ldr x1, [x2, #16]
cbz x1, .Lasm_SetVariableBinding.assert_failure_3
ldrb w1, [x1, x0]
.Lasm_SetVariableBinding.ssa_block_10:
@@ -3714,7 +3750,7 @@ asm_handler_SetVariableBinding:
1:
ldr w1, [x21, #8]
ldr x1, [x27, x1, lsl #3]
- str x1, [x2, x0, lsl #3]
+ str x1, [x3, x0, lsl #3]
ldrb w9, [x21, #24]
add x21, x21, #24
ldr x10, [x19, x9, lsl #3]
@@ -3739,7 +3775,10 @@ asm_handler_DynamicSetLexicalBinding:
cbz w9, .Lasm_DynamicSetLexicalBinding.ssa_block_1
ldrb w9, [x0, #12]
cbnz w9, .Lasm_DynamicSetLexicalBinding.ssa_block_1
- ldr x0, [x0, #16]
+ ldr w0, [x0, #16]
+ add x9, x24, w0, uxtw #3
+ cmp w0, #0
+ csel x0, x9, xzr, ne
cbz x0, .Lasm_DynamicSetLexicalBinding.ssa_block_1
subs x2, x2, #1
cbnz w2, .Lasm_DynamicSetLexicalBinding.ssa_block_5
@@ -3749,32 +3788,35 @@ asm_handler_DynamicSetLexicalBinding:
cbz w9, .Lasm_DynamicSetLexicalBinding.ssa_block_1
ldrb w9, [x0, #12]
cbnz w9, .Lasm_DynamicSetLexicalBinding.ssa_block_1
- ldr x2, [x0, #32]
- cbz x2, .Lasm_DynamicSetLexicalBinding.assert_failure_0
- ldr x3, [x2, x1, lsl #3]
+ ldr x3, [x0, #24]
+ cbz x3, .Lasm_DynamicSetLexicalBinding.assert_failure_0
+ ldr x2, [x3, x1, lsl #3]
movz x9, #0x7ffb, lsl #48
- cmp x3, x9
+ cmp x2, x9
b.eq .Lasm_DynamicSetLexicalBinding.ssa_block_1
- ldr x3, [x0, #24]
- cbnz x3, .Lasm_DynamicSetLexicalBinding.ssa_block_13
- ldr x0, [x0, #56]
+ ldr w2, [x0, #20]
+ add x9, x24, w2, uxtw #3
+ cmp w2, #0
+ csel x2, x9, xzr, ne
+ cbnz x2, .Lasm_DynamicSetLexicalBinding.ssa_block_13
+ ldr x0, [x0, #48]
ldr x0, [x0]
cbz x0, .Lasm_DynamicSetLexicalBinding.assert_failure_1
ldrb w0, [x0, x1]
b .Lasm_DynamicSetLexicalBinding.ssa_block_14
.Lasm_DynamicSetLexicalBinding.ssa_block_13:
- ldr x4, [x3, #24]
+ ldr x4, [x2, #24]
cmp x4, x1
b.hi .Lasm_DynamicSetLexicalBinding.ssa_block_16
- ldr x0, [x0, #56]
+ ldr x0, [x0, #48]
ldr x0, [x0]
cbz x0, .Lasm_DynamicSetLexicalBinding.assert_failure_2
- mov x3, x1
- subs x3, x3, x4
- ldrb w0, [x0, x3]
+ mov x2, x1
+ subs x2, x2, x4
+ ldrb w0, [x0, x2]
b .Lasm_DynamicSetLexicalBinding.ssa_block_14
.Lasm_DynamicSetLexicalBinding.ssa_block_16:
- ldr x0, [x3, #16]
+ ldr x0, [x2, #16]
cbz x0, .Lasm_DynamicSetLexicalBinding.assert_failure_3
ldrb w0, [x0, x1]
.Lasm_DynamicSetLexicalBinding.ssa_block_14:
@@ -3783,7 +3825,7 @@ asm_handler_DynamicSetLexicalBinding:
1:
ldr w0, [x21, #8]
ldr x0, [x27, x0, lsl #3]
- str x0, [x2, x1, lsl #3]
+ str x0, [x3, x1, lsl #3]
ldrb w9, [x21, #16]
add x21, x21, #16
ldr x10, [x19, x9, lsl #3]
@@ -3808,7 +3850,10 @@ asm_handler_DynamicSetVariableBinding:
cbz w9, .Lasm_DynamicSetVariableBinding.ssa_block_1
ldrb w9, [x0, #12]
cbnz w9, .Lasm_DynamicSetVariableBinding.ssa_block_1
- ldr x0, [x0, #16]
+ ldr w0, [x0, #16]
+ add x9, x24, w0, uxtw #3
+ cmp w0, #0
+ csel x0, x9, xzr, ne
cbz x0, .Lasm_DynamicSetVariableBinding.ssa_block_1
subs x2, x2, #1
cbnz w2, .Lasm_DynamicSetVariableBinding.ssa_block_5
@@ -3818,32 +3863,35 @@ asm_handler_DynamicSetVariableBinding:
cbz w9, .Lasm_DynamicSetVariableBinding.ssa_block_1
ldrb w9, [x0, #12]
cbnz w9, .Lasm_DynamicSetVariableBinding.ssa_block_1
- ldr x2, [x0, #32]
- cbz x2, .Lasm_DynamicSetVariableBinding.assert_failure_0
- ldr x3, [x2, x1, lsl #3]
+ ldr x3, [x0, #24]
+ cbz x3, .Lasm_DynamicSetVariableBinding.assert_failure_0
+ ldr x2, [x3, x1, lsl #3]
movz x9, #0x7ffb, lsl #48
- cmp x3, x9
+ cmp x2, x9
b.eq .Lasm_DynamicSetVariableBinding.ssa_block_1
- ldr x3, [x0, #24]
- cbnz x3, .Lasm_DynamicSetVariableBinding.ssa_block_13
- ldr x0, [x0, #56]
+ ldr w2, [x0, #20]
+ add x9, x24, w2, uxtw #3
+ cmp w2, #0
+ csel x2, x9, xzr, ne
+ cbnz x2, .Lasm_DynamicSetVariableBinding.ssa_block_13
+ ldr x0, [x0, #48]
ldr x0, [x0]
cbz x0, .Lasm_DynamicSetVariableBinding.assert_failure_1
ldrb w0, [x0, x1]
b .Lasm_DynamicSetVariableBinding.ssa_block_14
.Lasm_DynamicSetVariableBinding.ssa_block_13:
- ldr x4, [x3, #24]
+ ldr x4, [x2, #24]
cmp x4, x1
b.hi .Lasm_DynamicSetVariableBinding.ssa_block_16
- ldr x0, [x0, #56]
+ ldr x0, [x0, #48]
ldr x0, [x0]
cbz x0, .Lasm_DynamicSetVariableBinding.assert_failure_2
- mov x3, x1
- subs x3, x3, x4
- ldrb w0, [x0, x3]
+ mov x2, x1
+ subs x2, x2, x4
+ ldrb w0, [x0, x2]
b .Lasm_DynamicSetVariableBinding.ssa_block_14
.Lasm_DynamicSetVariableBinding.ssa_block_16:
- ldr x0, [x3, #16]
+ ldr x0, [x2, #16]
cbz x0, .Lasm_DynamicSetVariableBinding.assert_failure_3
ldrb w0, [x0, x1]
.Lasm_DynamicSetVariableBinding.ssa_block_14:
@@ -3852,7 +3900,7 @@ asm_handler_DynamicSetVariableBinding:
1:
ldr w0, [x21, #8]
ldr x0, [x27, x0, lsl #3]
- str x0, [x2, x1, lsl #3]
+ str x0, [x3, x1, lsl #3]
ldrb w9, [x21, #16]
add x21, x21, #16
ldr x10, [x19, x9, lsl #3]
@@ -4521,19 +4569,22 @@ asm_handler_StrictlyInequals_hot_end:
.p2align 4
asm_handler_GetCalleeAndThisFromEnvironment:
- ldr x1, [x28, #32]
- add x0, x21, #16
- ldp w0, w2, [x0, #0]
- cbz x1, .Lasm_GetCalleeAndThisFromEnvironment.assert_predicate_failure_9
- cbz w0, .Lasm_GetCalleeAndThisFromEnvironment.ssa_block_3
+ ldr x0, [x28, #32]
+ add x1, x21, #16
+ ldp w1, w2, [x1, #0]
+ cbz x0, .Lasm_GetCalleeAndThisFromEnvironment.assert_predicate_failure_9
+ cbz w1, .Lasm_GetCalleeAndThisFromEnvironment.ssa_block_3
.Lasm_GetCalleeAndThisFromEnvironment.ssa_block_4:
- ldr x1, [x1, #16]
- cbz x1, .Lasm_GetCalleeAndThisFromEnvironment.assert_predicate_failure_25
- subs x0, x0, #1
- cbnz w0, .Lasm_GetCalleeAndThisFromEnvironment.ssa_block_4
+ ldr w0, [x0, #16]
+ add x9, x24, w0, uxtw #3
+ cmp w0, #0
+ csel x0, x9, xzr, ne
+ cbz x0, .Lasm_GetCalleeAndThisFromEnvironment.assert_predicate_failure_25
+ subs x1, x1, #1
+ cbnz w1, .Lasm_GetCalleeAndThisFromEnvironment.ssa_block_4
.Lasm_GetCalleeAndThisFromEnvironment.ssa_block_3:
- cbz x1, .Lasm_GetCalleeAndThisFromEnvironment.assert_predicate_failure_13
- ldr x0, [x1, #32]
+ cbz x0, .Lasm_GetCalleeAndThisFromEnvironment.assert_predicate_failure_13
+ ldr x0, [x0, #24]
cbz x0, .Lasm_GetCalleeAndThisFromEnvironment.assert_failure_0
ldr x0, [x0, x2, lsl #3]
movz x9, #0x7ffb, lsl #48
@@ -4568,7 +4619,10 @@ asm_handler_DynamicGetCalleeAndThisFromEnvironment:
cbz w9, .Lasm_DynamicGetCalleeAndThisFromEnvironment.ssa_block_1
ldrb w9, [x0, #12]
cbnz w9, .Lasm_DynamicGetCalleeAndThisFromEnvironment.ssa_block_1
- ldr x0, [x0, #16]
+ ldr w0, [x0, #16]
+ add x9, x24, w0, uxtw #3
+ cmp w0, #0
+ csel x0, x9, xzr, ne
cbz x0, .Lasm_DynamicGetCalleeAndThisFromEnvironment.ssa_block_1
subs x1, x1, #1
cbnz w1, .Lasm_DynamicGetCalleeAndThisFromEnvironment.ssa_block_5
@@ -4578,7 +4632,7 @@ asm_handler_DynamicGetCalleeAndThisFromEnvironment:
cbz w9, .Lasm_DynamicGetCalleeAndThisFromEnvironment.ssa_block_1
ldrb w9, [x0, #12]
cbnz w9, .Lasm_DynamicGetCalleeAndThisFromEnvironment.ssa_block_1
- ldr x0, [x0, #32]
+ ldr x0, [x0, #24]
cbz x0, .Lasm_DynamicGetCalleeAndThisFromEnvironment.assert_failure_0
ldr x0, [x0, x2, lsl #3]
movz x9, #0x7ffb, lsl #48
@@ -5703,7 +5757,7 @@ asm_handler_GetGlobal:
adds x0, x0, x1
cbz x0, .Lasm_GetGlobal.assert_predicate_failure_15
ldr x1, [x0, #64]
- ldr x9, [x2, #64]
+ ldr x9, [x2, #56]
cmp x9, x1
b.ne .Lasm_GetGlobal.ssa_block_1
ldr x1, [x3, #24]
@@ -5731,7 +5785,7 @@ asm_handler_GetGlobal:
.Lasm_GetGlobal.ssa_block_2:
ldrb w9, [x0, #76]
cbz w9, .Lasm_GetGlobal.ssa_block_1
- ldr x1, [x2, #32]
+ ldr x1, [x2, #24]
cbz x1, .Lasm_GetGlobal.assert_failure_3
ldr w0, [x0, #72]
ldr x0, [x1, x0, lsl #3]
@@ -5760,7 +5814,7 @@ asm_handler_ResolveGlobalBinding:
adds x0, x0, x1
cbz x0, .Lasm_ResolveGlobalBinding.assert_predicate_failure_15
ldr x1, [x0, #64]
- ldr x9, [x3, #64]
+ ldr x9, [x3, #56]
cmp x9, x1
b.ne .Lasm_ResolveGlobalBinding.ssa_block_1
ldr x1, [x2, #24]
@@ -5807,7 +5861,7 @@ asm_handler_SetGlobal:
adds x0, x0, x2
cbz x0, .Lasm_SetGlobal.assert_predicate_failure_15
ldr x2, [x0, #64]
- ldr x9, [x1, #64]
+ ldr x9, [x1, #56]
cmp x9, x2
b.ne .Lasm_SetGlobal.ssa_block_1
ldr x2, [x3, #24]
@@ -5839,32 +5893,35 @@ asm_handler_SetGlobal:
ldrb w9, [x0, #76]
cbz w9, .Lasm_SetGlobal.ssa_block_1
ldr w0, [x0, #72]
- ldr x2, [x1, #32]
- cbz x2, .Lasm_SetGlobal.assert_failure_3
- ldr x3, [x2, x0, lsl #3]
+ ldr x3, [x1, #24]
+ cbz x3, .Lasm_SetGlobal.assert_failure_3
+ ldr x2, [x3, x0, lsl #3]
movz x9, #0x7ffb, lsl #48
- cmp x3, x9
+ cmp x2, x9
b.eq .Lasm_SetGlobal.ssa_block_1
- ldr x3, [x1, #24]
- cbnz x3, .Lasm_SetGlobal.ssa_block_6
- ldr x1, [x1, #56]
+ ldr w2, [x1, #20]
+ add x9, x24, w2, uxtw #3
+ cmp w2, #0
+ csel x2, x9, xzr, ne
+ cbnz x2, .Lasm_SetGlobal.ssa_block_6
+ ldr x1, [x1, #48]
ldr x1, [x1]
cbz x1, .Lasm_SetGlobal.assert_failure_4
ldrb w1, [x1, x0]
b .Lasm_SetGlobal.ssa_block_7
.Lasm_SetGlobal.ssa_block_6:
- ldr x4, [x3, #24]
+ ldr x4, [x2, #24]
cmp x4, x0
b.hi .Lasm_SetGlobal.ssa_block_9
- ldr x1, [x1, #56]
+ ldr x1, [x1, #48]
ldr x1, [x1]
cbz x1, .Lasm_SetGlobal.assert_failure_5
- mov x3, x0
- subs x3, x3, x4
- ldrb w1, [x1, x3]
+ mov x2, x0
+ subs x2, x2, x4
+ ldrb w1, [x1, x2]
b .Lasm_SetGlobal.ssa_block_7
.Lasm_SetGlobal.ssa_block_9:
- ldr x1, [x3, #16]
+ ldr x1, [x2, #16]
cbz x1, .Lasm_SetGlobal.assert_failure_6
ldrb w1, [x1, x0]
.Lasm_SetGlobal.ssa_block_7:
@@ -5873,7 +5930,7 @@ asm_handler_SetGlobal:
1:
ldr w1, [x21, #8]
ldr x1, [x27, x1, lsl #3]
- str x1, [x2, x0, lsl #3]
+ str x1, [x3, x0, lsl #3]
ldrb w9, [x21, #16]
add x21, x21, #16
ldr x10, [x19, x9, lsl #3]
@@ -6489,7 +6546,10 @@ asm_handler_IsCallable_hot_end:
asm_handler_LeavePrivateEnvironment:
ldr x0, [x28, #48]
cbz x0, .Lasm_LeavePrivateEnvironment.assert_predicate_failure_3
- ldr x0, [x0, #16]
+ ldr w0, [x0, #12]
+ add x9, x24, w0, uxtw #3
+ cmp w0, #0
+ csel x0, x9, xzr, ne
str x0, [x28, #48]
ldrb w9, [x21, #8]
add x21, x21, #8
diff --git a/Libraries/LibJS/Flap/tests/interpreter-assembly/x86_64.S b/Libraries/LibJS/Flap/tests/interpreter-assembly/x86_64.S
index 1469c83f405..7a7bb6f986a 100644
--- a/Libraries/LibJS/Flap/tests/interpreter-assembly/x86_64.S
+++ b/Libraries/LibJS/Flap/tests/interpreter-assembly/x86_64.S
@@ -3273,25 +3273,28 @@ asm_handler_SetLexicalEnvironment_hot_end:
.p2align 6
asm_handler_GetBinding:
- mov rcx, QWORD PTR [rbx - 96]
- lea rax, [r14 + r13 + 12]
- mov edx, DWORD PTR [rax + 4]
- mov eax, DWORD PTR [rax]
- test rcx, rcx
+ mov rax, QWORD PTR [rbx - 96]
+ lea rcx, [r14 + r13 + 12]
+ mov edx, DWORD PTR [rcx + 4]
+ mov ecx, DWORD PTR [rcx]
+ test rax, rax
jz .Lasm_GetBinding.assert_predicate_failure_9
- test eax, eax
+ test ecx, ecx
jz .Lasm_GetBinding.ssa_block_3
.Lasm_GetBinding.ssa_block_4:
- mov rcx, QWORD PTR [rcx + 16]
- test rcx, rcx
- jz .Lasm_GetBinding.assert_predicate_failure_25
- sub rax, 1
+ mov eax, DWORD PTR [rax + 16]
+ lea r11, [r15 + rax * 8]
test eax, eax
+ cmovnz rax, r11
+ test rax, rax
+ jz .Lasm_GetBinding.assert_predicate_failure_25
+ sub rcx, 1
+ test ecx, ecx
jnz .Lasm_GetBinding.ssa_block_4
.Lasm_GetBinding.ssa_block_3:
- test rcx, rcx
+ test rax, rax
jz .Lasm_GetBinding.assert_predicate_failure_13
- mov rax, QWORD PTR [rcx + 32]
+ mov rax, QWORD PTR [rax + 24]
test rax, rax
jz .Lasm_GetBinding.assert_failure_0
mov rax, QWORD PTR [rax + rdx * 8]
@@ -3326,7 +3329,10 @@ asm_handler_DynamicGetBinding:
jz .Lasm_DynamicGetBinding.ssa_block_1
cmp BYTE PTR [rax + 12], 0
jnz .Lasm_DynamicGetBinding.ssa_block_1
- mov rax, QWORD PTR [rax + 16]
+ mov eax, DWORD PTR [rax + 16]
+ lea r11, [r15 + rax * 8]
+ test eax, eax
+ cmovnz rax, r11
test rax, rax
jz .Lasm_DynamicGetBinding.ssa_block_1
sub rcx, 1
@@ -3339,7 +3345,7 @@ asm_handler_DynamicGetBinding:
jz .Lasm_DynamicGetBinding.ssa_block_1
cmp BYTE PTR [rax + 12], 0
jnz .Lasm_DynamicGetBinding.ssa_block_1
- mov rax, QWORD PTR [rax + 32]
+ mov rax, QWORD PTR [rax + 24]
test rax, rax
jz .Lasm_DynamicGetBinding.assert_failure_0
mov rax, QWORD PTR [rax + rdx * 8]
@@ -3356,25 +3362,28 @@ asm_handler_DynamicGetBinding_hot_end:
.p2align 6
asm_handler_GetInitializedBinding:
- mov rcx, QWORD PTR [rbx - 96]
- lea rax, [r14 + r13 + 12]
- mov edx, DWORD PTR [rax + 4]
- mov eax, DWORD PTR [rax]
- test rcx, rcx
+ mov rax, QWORD PTR [rbx - 96]
+ lea rcx, [r14 + r13 + 12]
+ mov edx, DWORD PTR [rcx + 4]
+ mov ecx, DWORD PTR [rcx]
+ test rax, rax
jz .Lasm_GetInitializedBinding.assert_predicate_failure_9
- test eax, eax
+ test ecx, ecx
jz .Lasm_GetInitializedBinding.ssa_block_2
.Lasm_GetInitializedBinding.ssa_block_3:
- mov rcx, QWORD PTR [rcx + 16]
- test rcx, rcx
- jz .Lasm_GetInitializedBinding.assert_predicate_failure_25
- sub rax, 1
+ mov eax, DWORD PTR [rax + 16]
+ lea r11, [r15 + rax * 8]
test eax, eax
+ cmovnz rax, r11
+ test rax, rax
+ jz .Lasm_GetInitializedBinding.assert_predicate_failure_25
+ sub rcx, 1
+ test ecx, ecx
jnz .Lasm_GetInitializedBinding.ssa_block_3
.Lasm_GetInitializedBinding.ssa_block_2:
- test rcx, rcx
+ test rax, rax
jz .Lasm_GetInitializedBinding.assert_predicate_failure_12
- mov rax, QWORD PTR [rcx + 32]
+ mov rax, QWORD PTR [rax + 24]
test rax, rax
jz .Lasm_GetInitializedBinding.assert_failure_0
mov rax, QWORD PTR [rax + rdx * 8]
@@ -3405,7 +3414,10 @@ asm_handler_DynamicGetInitializedBinding:
jz .Lasm_DynamicGetInitializedBinding.ssa_block_1
cmp BYTE PTR [rax + 12], 0
jnz .Lasm_DynamicGetInitializedBinding.ssa_block_1
- mov rax, QWORD PTR [rax + 16]
+ mov eax, DWORD PTR [rax + 16]
+ lea r11, [r15 + rax * 8]
+ test eax, eax
+ cmovnz rax, r11
test rax, rax
jz .Lasm_DynamicGetInitializedBinding.ssa_block_1
sub rcx, 1
@@ -3418,7 +3430,7 @@ asm_handler_DynamicGetInitializedBinding:
jz .Lasm_DynamicGetInitializedBinding.ssa_block_1
cmp BYTE PTR [rax + 12], 0
jnz .Lasm_DynamicGetInitializedBinding.ssa_block_1
- mov rax, QWORD PTR [rax + 32]
+ mov rax, QWORD PTR [rax + 24]
test rax, rax
jz .Lasm_DynamicGetInitializedBinding.assert_failure_0
mov rax, QWORD PTR [rax + rdx * 8]
@@ -3431,25 +3443,28 @@ asm_handler_DynamicGetInitializedBinding_hot_end:
.p2align 6
asm_handler_InitializeLexicalBinding:
- mov rcx, QWORD PTR [rbx - 96]
- lea rax, [r14 + r13 + 12]
- mov edx, DWORD PTR [rax + 4]
- mov eax, DWORD PTR [rax]
- test rcx, rcx
+ mov rax, QWORD PTR [rbx - 96]
+ lea rcx, [r14 + r13 + 12]
+ mov edx, DWORD PTR [rcx + 4]
+ mov ecx, DWORD PTR [rcx]
+ test rax, rax
jz .Lasm_InitializeLexicalBinding.assert_predicate_failure_9
- test eax, eax
+ test ecx, ecx
jz .Lasm_InitializeLexicalBinding.ssa_block_2
.Lasm_InitializeLexicalBinding.ssa_block_3:
- mov rcx, QWORD PTR [rcx + 16]
- test rcx, rcx
- jz .Lasm_InitializeLexicalBinding.assert_predicate_failure_25
- sub rax, 1
+ mov eax, DWORD PTR [rax + 16]
+ lea r11, [r15 + rax * 8]
test eax, eax
+ cmovnz rax, r11
+ test rax, rax
+ jz .Lasm_InitializeLexicalBinding.assert_predicate_failure_25
+ sub rcx, 1
+ test ecx, ecx
jnz .Lasm_InitializeLexicalBinding.ssa_block_3
.Lasm_InitializeLexicalBinding.ssa_block_2:
- test rcx, rcx
+ test rax, rax
jz .Lasm_InitializeLexicalBinding.assert_predicate_failure_12
- mov rax, QWORD PTR [rcx + 32]
+ mov rax, QWORD PTR [rax + 24]
test rax, rax
jz .Lasm_InitializeLexicalBinding.assert_failure_0
mov ecx, DWORD PTR [r14 + r13 + 8]
@@ -3462,25 +3477,28 @@ asm_handler_InitializeLexicalBinding_hot_end:
.p2align 6
asm_handler_InitializeVariableBinding:
- mov rcx, QWORD PTR [rbx - 88]
- lea rax, [r14 + r13 + 12]
- mov edx, DWORD PTR [rax + 4]
- mov eax, DWORD PTR [rax]
- test rcx, rcx
+ mov rax, QWORD PTR [rbx - 88]
+ lea rcx, [r14 + r13 + 12]
+ mov edx, DWORD PTR [rcx + 4]
+ mov ecx, DWORD PTR [rcx]
+ test rax, rax
jz .Lasm_InitializeVariableBinding.assert_predicate_failure_9
- test eax, eax
+ test ecx, ecx
jz .Lasm_InitializeVariableBinding.ssa_block_2
.Lasm_InitializeVariableBinding.ssa_block_3:
- mov rcx, QWORD PTR [rcx + 16]
- test rcx, rcx
- jz .Lasm_InitializeVariableBinding.assert_predicate_failure_25
- sub rax, 1
+ mov eax, DWORD PTR [rax + 16]
+ lea r11, [r15 + rax * 8]
test eax, eax
+ cmovnz rax, r11
+ test rax, rax
+ jz .Lasm_InitializeVariableBinding.assert_predicate_failure_25
+ sub rcx, 1
+ test ecx, ecx
jnz .Lasm_InitializeVariableBinding.ssa_block_3
.Lasm_InitializeVariableBinding.ssa_block_2:
- test rcx, rcx
+ test rax, rax
jz .Lasm_InitializeVariableBinding.assert_predicate_failure_12
- mov rax, QWORD PTR [rcx + 32]
+ mov rax, QWORD PTR [rax + 24]
test rax, rax
jz .Lasm_InitializeVariableBinding.assert_failure_0
mov ecx, DWORD PTR [r14 + r13 + 8]
@@ -3511,7 +3529,10 @@ asm_handler_DynamicInitializeLexicalBinding:
jz .Lasm_DynamicInitializeLexicalBinding.ssa_block_1
cmp BYTE PTR [rax + 12], 0
jnz .Lasm_DynamicInitializeLexicalBinding.ssa_block_1
- mov rax, QWORD PTR [rax + 16]
+ mov eax, DWORD PTR [rax + 16]
+ lea r11, [r15 + rax * 8]
+ test eax, eax
+ cmovnz rax, r11
test rax, rax
jz .Lasm_DynamicInitializeLexicalBinding.ssa_block_1
sub rcx, 1
@@ -3524,7 +3545,7 @@ asm_handler_DynamicInitializeLexicalBinding:
jz .Lasm_DynamicInitializeLexicalBinding.ssa_block_1
cmp BYTE PTR [rax + 12], 0
jnz .Lasm_DynamicInitializeLexicalBinding.ssa_block_1
- mov rax, QWORD PTR [rax + 32]
+ mov rax, QWORD PTR [rax + 24]
test rax, rax
jz .Lasm_DynamicInitializeLexicalBinding.assert_failure_0
mov ecx, DWORD PTR [r14 + r13 + 8]
@@ -3555,7 +3576,10 @@ asm_handler_DynamicInitializeVariableBinding:
jz .Lasm_DynamicInitializeVariableBinding.ssa_block_1
cmp BYTE PTR [rax + 12], 0
jnz .Lasm_DynamicInitializeVariableBinding.ssa_block_1
- mov rax, QWORD PTR [rax + 16]
+ mov eax, DWORD PTR [rax + 16]
+ lea r11, [r15 + rax * 8]
+ test eax, eax
+ cmovnz rax, r11
test rax, rax
jz .Lasm_DynamicInitializeVariableBinding.ssa_block_1
sub rcx, 1
@@ -3568,7 +3592,7 @@ asm_handler_DynamicInitializeVariableBinding:
jz .Lasm_DynamicInitializeVariableBinding.ssa_block_1
cmp BYTE PTR [rax + 12], 0
jnz .Lasm_DynamicInitializeVariableBinding.ssa_block_1
- mov rax, QWORD PTR [rax + 32]
+ mov rax, QWORD PTR [rax + 24]
test rax, rax
jz .Lasm_DynamicInitializeVariableBinding.assert_failure_0
mov ecx, DWORD PTR [r14 + r13 + 8]
@@ -3590,7 +3614,10 @@ asm_handler_SetLexicalBinding:
test edx, edx
jz .Lasm_SetLexicalBinding.ssa_block_5
.Lasm_SetLexicalBinding.ssa_block_6:
- mov rcx, QWORD PTR [rcx + 16]
+ mov ecx, DWORD PTR [rcx + 16]
+ lea r11, [r15 + rcx * 8]
+ test ecx, ecx
+ cmovnz rcx, r11
test rcx, rcx
jz .Lasm_SetLexicalBinding.assert_predicate_failure_31
sub rdx, 1
@@ -3599,37 +3626,40 @@ asm_handler_SetLexicalBinding:
.Lasm_SetLexicalBinding.ssa_block_5:
test rcx, rcx
jz .Lasm_SetLexicalBinding.assert_predicate_failure_19
- mov rdx, QWORD PTR [rcx + 32]
- test rdx, rdx
+ mov rsi, QWORD PTR [rcx + 24]
+ test rsi, rsi
jz .Lasm_SetLexicalBinding.assert_failure_0
- mov rsi, QWORD PTR [rdx + rax * 8]
- mov r11, rsi
+ mov rdx, QWORD PTR [rsi + rax * 8]
+ mov r11, rdx
shr r11, 48
cmp r11w, 32763
je .Lasm_SetLexicalBinding.ssa_block_1
- mov rsi, QWORD PTR [rcx + 24]
- test rsi, rsi
+ mov edx, DWORD PTR [rcx + 20]
+ lea r11, [r15 + rdx * 8]
+ test edx, edx
+ cmovnz rdx, r11
+ test rdx, rdx
jnz .Lasm_SetLexicalBinding.ssa_block_9
- mov rcx, QWORD PTR [rcx + 56]
+ mov rcx, QWORD PTR [rcx + 48]
mov rcx, QWORD PTR [rcx]
test rcx, rcx
jz .Lasm_SetLexicalBinding.assert_failure_1
movzx ecx, BYTE PTR [rcx + rax]
jmp .Lasm_SetLexicalBinding.ssa_block_10
.Lasm_SetLexicalBinding.ssa_block_9:
- mov rdi, QWORD PTR [rsi + 24]
+ mov rdi, QWORD PTR [rdx + 24]
cmp rdi, rax
ja .Lasm_SetLexicalBinding.ssa_block_12
- mov rcx, QWORD PTR [rcx + 56]
+ mov rcx, QWORD PTR [rcx + 48]
mov rcx, QWORD PTR [rcx]
test rcx, rcx
jz .Lasm_SetLexicalBinding.assert_failure_2
- mov rsi, rax
- sub rsi, rdi
- movzx ecx, BYTE PTR [rcx + rsi]
+ mov rdx, rax
+ sub rdx, rdi
+ movzx ecx, BYTE PTR [rcx + rdx]
jmp .Lasm_SetLexicalBinding.ssa_block_10
.Lasm_SetLexicalBinding.ssa_block_12:
- mov rcx, QWORD PTR [rsi + 16]
+ mov rcx, QWORD PTR [rdx + 16]
test rcx, rcx
jz .Lasm_SetLexicalBinding.assert_failure_3
movzx ecx, BYTE PTR [rcx + rax]
@@ -3638,7 +3668,7 @@ asm_handler_SetLexicalBinding:
jz .Lasm_SetLexicalBinding.ssa_block_1
mov ecx, DWORD PTR [r14 + r13 + 8]
mov rcx, QWORD PTR [rbx + rcx * 8]
- mov QWORD PTR [rdx + rax * 8], rcx
+ mov QWORD PTR [rsi + rax * 8], rcx
add r13d, 24
movzx eax, BYTE PTR [r14 + r13]
jmp [r12 + rax * 8]
@@ -3655,7 +3685,10 @@ asm_handler_SetVariableBinding:
test edx, edx
jz .Lasm_SetVariableBinding.ssa_block_5
.Lasm_SetVariableBinding.ssa_block_6:
- mov rcx, QWORD PTR [rcx + 16]
+ mov ecx, DWORD PTR [rcx + 16]
+ lea r11, [r15 + rcx * 8]
+ test ecx, ecx
+ cmovnz rcx, r11
test rcx, rcx
jz .Lasm_SetVariableBinding.assert_predicate_failure_31
sub rdx, 1
@@ -3664,37 +3697,40 @@ asm_handler_SetVariableBinding:
.Lasm_SetVariableBinding.ssa_block_5:
test rcx, rcx
jz .Lasm_SetVariableBinding.assert_predicate_failure_19
- mov rdx, QWORD PTR [rcx + 32]
- test rdx, rdx
+ mov rsi, QWORD PTR [rcx + 24]
+ test rsi, rsi
jz .Lasm_SetVariableBinding.assert_failure_0
- mov rsi, QWORD PTR [rdx + rax * 8]
- mov r11, rsi
+ mov rdx, QWORD PTR [rsi + rax * 8]
+ mov r11, rdx
shr r11, 48
cmp r11w, 32763
je .Lasm_SetVariableBinding.ssa_block_1
- mov rsi, QWORD PTR [rcx + 24]
- test rsi, rsi
+ mov edx, DWORD PTR [rcx + 20]
+ lea r11, [r15 + rdx * 8]
+ test edx, edx
+ cmovnz rdx, r11
+ test rdx, rdx
jnz .Lasm_SetVariableBinding.ssa_block_9
- mov rcx, QWORD PTR [rcx + 56]
+ mov rcx, QWORD PTR [rcx + 48]
mov rcx, QWORD PTR [rcx]
test rcx, rcx
jz .Lasm_SetVariableBinding.assert_failure_1
movzx ecx, BYTE PTR [rcx + rax]
jmp .Lasm_SetVariableBinding.ssa_block_10
.Lasm_SetVariableBinding.ssa_block_9:
- mov rdi, QWORD PTR [rsi + 24]
+ mov rdi, QWORD PTR [rdx + 24]
cmp rdi, rax
ja .Lasm_SetVariableBinding.ssa_block_12
- mov rcx, QWORD PTR [rcx + 56]
+ mov rcx, QWORD PTR [rcx + 48]
mov rcx, QWORD PTR [rcx]
test rcx, rcx
jz .Lasm_SetVariableBinding.assert_failure_2
- mov rsi, rax
- sub rsi, rdi
- movzx ecx, BYTE PTR [rcx + rsi]
+ mov rdx, rax
+ sub rdx, rdi
+ movzx ecx, BYTE PTR [rcx + rdx]
jmp .Lasm_SetVariableBinding.ssa_block_10
.Lasm_SetVariableBinding.ssa_block_12:
- mov rcx, QWORD PTR [rsi + 16]
+ mov rcx, QWORD PTR [rdx + 16]
test rcx, rcx
jz .Lasm_SetVariableBinding.assert_failure_3
movzx ecx, BYTE PTR [rcx + rax]
@@ -3703,7 +3739,7 @@ asm_handler_SetVariableBinding:
jz .Lasm_SetVariableBinding.ssa_block_1
mov ecx, DWORD PTR [r14 + r13 + 8]
mov rcx, QWORD PTR [rbx + rcx * 8]
- mov QWORD PTR [rdx + rax * 8], rcx
+ mov QWORD PTR [rsi + rax * 8], rcx
add r13d, 24
movzx eax, BYTE PTR [r14 + r13]
jmp [r12 + rax * 8]
@@ -3729,7 +3765,10 @@ asm_handler_DynamicSetLexicalBinding:
jz .Lasm_DynamicSetLexicalBinding.ssa_block_1
cmp BYTE PTR [rax + 12], 0
jnz .Lasm_DynamicSetLexicalBinding.ssa_block_1
- mov rax, QWORD PTR [rax + 16]
+ mov eax, DWORD PTR [rax + 16]
+ lea r11, [r15 + rax * 8]
+ test eax, eax
+ cmovnz rax, r11
test rax, rax
jz .Lasm_DynamicSetLexicalBinding.ssa_block_1
sub rdx, 1
@@ -3742,37 +3781,40 @@ asm_handler_DynamicSetLexicalBinding:
jz .Lasm_DynamicSetLexicalBinding.ssa_block_1
cmp BYTE PTR [rax + 12], 0
jnz .Lasm_DynamicSetLexicalBinding.ssa_block_1
- mov rdx, QWORD PTR [rax + 32]
- test rdx, rdx
+ mov rsi, QWORD PTR [rax + 24]
+ test rsi, rsi
jz .Lasm_DynamicSetLexicalBinding.assert_failure_0
- mov rsi, QWORD PTR [rdx + rcx * 8]
- mov r11, rsi
+ mov rdx, QWORD PTR [rsi + rcx * 8]
+ mov r11, rdx
shr r11, 48
cmp r11w, 32763
je .Lasm_DynamicSetLexicalBinding.ssa_block_1
- mov rsi, QWORD PTR [rax + 24]
- test rsi, rsi
+ mov edx, DWORD PTR [rax + 20]
+ lea r11, [r15 + rdx * 8]
+ test edx, edx
+ cmovnz rdx, r11
+ test rdx, rdx
jnz .Lasm_DynamicSetLexicalBinding.ssa_block_13
- mov rax, QWORD PTR [rax + 56]
+ mov rax, QWORD PTR [rax + 48]
mov rax, QWORD PTR [rax]
test rax, rax
jz .Lasm_DynamicSetLexicalBinding.assert_failure_1
movzx eax, BYTE PTR [rax + rcx]
jmp .Lasm_DynamicSetLexicalBinding.ssa_block_14
.Lasm_DynamicSetLexicalBinding.ssa_block_13:
- mov rdi, QWORD PTR [rsi + 24]
+ mov rdi, QWORD PTR [rdx + 24]
cmp rdi, rcx
ja .Lasm_DynamicSetLexicalBinding.ssa_block_16
- mov rax, QWORD PTR [rax + 56]
+ mov rax, QWORD PTR [rax + 48]
mov rax, QWORD PTR [rax]
test rax, rax
jz .Lasm_DynamicSetLexicalBinding.assert_failure_2
- mov rsi, rcx
- sub rsi, rdi
- movzx eax, BYTE PTR [rax + rsi]
+ mov rdx, rcx
+ sub rdx, rdi
+ movzx eax, BYTE PTR [rax + rdx]
jmp .Lasm_DynamicSetLexicalBinding.ssa_block_14
.Lasm_DynamicSetLexicalBinding.ssa_block_16:
- mov rax, QWORD PTR [rsi + 16]
+ mov rax, QWORD PTR [rdx + 16]
test rax, rax
jz .Lasm_DynamicSetLexicalBinding.assert_failure_3
movzx eax, BYTE PTR [rax + rcx]
@@ -3781,7 +3823,7 @@ asm_handler_DynamicSetLexicalBinding:
jz .Lasm_DynamicSetLexicalBinding.ssa_block_1
mov eax, DWORD PTR [r14 + r13 + 8]
mov rax, QWORD PTR [rbx + rax * 8]
- mov QWORD PTR [rdx + rcx * 8], rax
+ mov QWORD PTR [rsi + rcx * 8], rax
add r13d, 16
movzx eax, BYTE PTR [r14 + r13]
jmp [r12 + rax * 8]
@@ -3807,7 +3849,10 @@ asm_handler_DynamicSetVariableBinding:
jz .Lasm_DynamicSetVariableBinding.ssa_block_1
cmp BYTE PTR [rax + 12], 0
jnz .Lasm_DynamicSetVariableBinding.ssa_block_1
- mov rax, QWORD PTR [rax + 16]
+ mov eax, DWORD PTR [rax + 16]
+ lea r11, [r15 + rax * 8]
+ test eax, eax
+ cmovnz rax, r11
test rax, rax
jz .Lasm_DynamicSetVariableBinding.ssa_block_1
sub rdx, 1
@@ -3820,37 +3865,40 @@ asm_handler_DynamicSetVariableBinding:
jz .Lasm_DynamicSetVariableBinding.ssa_block_1
cmp BYTE PTR [rax + 12], 0
jnz .Lasm_DynamicSetVariableBinding.ssa_block_1
- mov rdx, QWORD PTR [rax + 32]
- test rdx, rdx
+ mov rsi, QWORD PTR [rax + 24]
+ test rsi, rsi
jz .Lasm_DynamicSetVariableBinding.assert_failure_0
- mov rsi, QWORD PTR [rdx + rcx * 8]
- mov r11, rsi
+ mov rdx, QWORD PTR [rsi + rcx * 8]
+ mov r11, rdx
shr r11, 48
cmp r11w, 32763
je .Lasm_DynamicSetVariableBinding.ssa_block_1
- mov rsi, QWORD PTR [rax + 24]
- test rsi, rsi
+ mov edx, DWORD PTR [rax + 20]
+ lea r11, [r15 + rdx * 8]
+ test edx, edx
+ cmovnz rdx, r11
+ test rdx, rdx
jnz .Lasm_DynamicSetVariableBinding.ssa_block_13
- mov rax, QWORD PTR [rax + 56]
+ mov rax, QWORD PTR [rax + 48]
mov rax, QWORD PTR [rax]
test rax, rax
jz .Lasm_DynamicSetVariableBinding.assert_failure_1
movzx eax, BYTE PTR [rax + rcx]
jmp .Lasm_DynamicSetVariableBinding.ssa_block_14
.Lasm_DynamicSetVariableBinding.ssa_block_13:
- mov rdi, QWORD PTR [rsi + 24]
+ mov rdi, QWORD PTR [rdx + 24]
cmp rdi, rcx
ja .Lasm_DynamicSetVariableBinding.ssa_block_16
- mov rax, QWORD PTR [rax + 56]
+ mov rax, QWORD PTR [rax + 48]
mov rax, QWORD PTR [rax]
test rax, rax
jz .Lasm_DynamicSetVariableBinding.assert_failure_2
- mov rsi, rcx
- sub rsi, rdi
- movzx eax, BYTE PTR [rax + rsi]
+ mov rdx, rcx
+ sub rdx, rdi
+ movzx eax, BYTE PTR [rax + rdx]
jmp .Lasm_DynamicSetVariableBinding.ssa_block_14
.Lasm_DynamicSetVariableBinding.ssa_block_16:
- mov rax, QWORD PTR [rsi + 16]
+ mov rax, QWORD PTR [rdx + 16]
test rax, rax
jz .Lasm_DynamicSetVariableBinding.assert_failure_3
movzx eax, BYTE PTR [rax + rcx]
@@ -3859,7 +3907,7 @@ asm_handler_DynamicSetVariableBinding:
jz .Lasm_DynamicSetVariableBinding.ssa_block_1
mov eax, DWORD PTR [r14 + r13 + 8]
mov rax, QWORD PTR [rbx + rax * 8]
- mov QWORD PTR [rdx + rcx * 8], rax
+ mov QWORD PTR [rsi + rcx * 8], rax
add r13d, 16
movzx eax, BYTE PTR [r14 + r13]
jmp [r12 + rax * 8]
@@ -4539,25 +4587,28 @@ asm_handler_StrictlyInequals_hot_end:
.p2align 6
asm_handler_GetCalleeAndThisFromEnvironment:
- mov rcx, QWORD PTR [rbx - 96]
- lea rax, [r14 + r13 + 16]
- mov edx, DWORD PTR [rax + 4]
- mov eax, DWORD PTR [rax]
- test rcx, rcx
+ mov rax, QWORD PTR [rbx - 96]
+ lea rcx, [r14 + r13 + 16]
+ mov edx, DWORD PTR [rcx + 4]
+ mov ecx, DWORD PTR [rcx]
+ test rax, rax
jz .Lasm_GetCalleeAndThisFromEnvironment.assert_predicate_failure_9
- test eax, eax
+ test ecx, ecx
jz .Lasm_GetCalleeAndThisFromEnvironment.ssa_block_3
.Lasm_GetCalleeAndThisFromEnvironment.ssa_block_4:
- mov rcx, QWORD PTR [rcx + 16]
- test rcx, rcx
- jz .Lasm_GetCalleeAndThisFromEnvironment.assert_predicate_failure_25
- sub rax, 1
+ mov eax, DWORD PTR [rax + 16]
+ lea r11, [r15 + rax * 8]
test eax, eax
+ cmovnz rax, r11
+ test rax, rax
+ jz .Lasm_GetCalleeAndThisFromEnvironment.assert_predicate_failure_25
+ sub rcx, 1
+ test ecx, ecx
jnz .Lasm_GetCalleeAndThisFromEnvironment.ssa_block_4
.Lasm_GetCalleeAndThisFromEnvironment.ssa_block_3:
- test rcx, rcx
+ test rax, rax
jz .Lasm_GetCalleeAndThisFromEnvironment.assert_predicate_failure_13
- mov rax, QWORD PTR [rcx + 32]
+ mov rax, QWORD PTR [rax + 24]
test rax, rax
jz .Lasm_GetCalleeAndThisFromEnvironment.assert_failure_0
mov rax, QWORD PTR [rax + rdx * 8]
@@ -4595,7 +4646,10 @@ asm_handler_DynamicGetCalleeAndThisFromEnvironment:
jz .Lasm_DynamicGetCalleeAndThisFromEnvironment.ssa_block_1
cmp BYTE PTR [rax + 12], 0
jnz .Lasm_DynamicGetCalleeAndThisFromEnvironment.ssa_block_1
- mov rax, QWORD PTR [rax + 16]
+ mov eax, DWORD PTR [rax + 16]
+ lea r11, [r15 + rax * 8]
+ test eax, eax
+ cmovnz rax, r11
test rax, rax
jz .Lasm_DynamicGetCalleeAndThisFromEnvironment.ssa_block_1
sub rcx, 1
@@ -4608,7 +4662,7 @@ asm_handler_DynamicGetCalleeAndThisFromEnvironment:
jz .Lasm_DynamicGetCalleeAndThisFromEnvironment.ssa_block_1
cmp BYTE PTR [rax + 12], 0
jnz .Lasm_DynamicGetCalleeAndThisFromEnvironment.ssa_block_1
- mov rax, QWORD PTR [rax + 32]
+ mov rax, QWORD PTR [rax + 24]
test rax, rax
jz .Lasm_DynamicGetCalleeAndThisFromEnvironment.assert_failure_0
mov rax, QWORD PTR [rax + rdx * 8]
@@ -5786,7 +5840,7 @@ asm_handler_GetGlobal:
test rax, rax
jz .Lasm_GetGlobal.assert_predicate_failure_15
mov rcx, QWORD PTR [rax + 64]
- cmp QWORD PTR [rdx + 64], rcx
+ cmp QWORD PTR [rdx + 56], rcx
jne .Lasm_GetGlobal.ssa_block_1
mov rcx, QWORD PTR [rsi + 24]
test rcx, rcx
@@ -5813,7 +5867,7 @@ asm_handler_GetGlobal:
.Lasm_GetGlobal.ssa_block_2:
cmp BYTE PTR [rax + 76], 0
jz .Lasm_GetGlobal.ssa_block_1
- mov rcx, QWORD PTR [rdx + 32]
+ mov rcx, QWORD PTR [rdx + 24]
test rcx, rcx
jz .Lasm_GetGlobal.assert_failure_3
mov eax, DWORD PTR [rax + 72]
@@ -5846,7 +5900,7 @@ asm_handler_ResolveGlobalBinding:
test rax, rax
jz .Lasm_ResolveGlobalBinding.assert_predicate_failure_15
mov rcx, QWORD PTR [rax + 64]
- cmp QWORD PTR [rsi + 64], rcx
+ cmp QWORD PTR [rsi + 56], rcx
jne .Lasm_ResolveGlobalBinding.ssa_block_1
mov rcx, QWORD PTR [rdx + 24]
test rcx, rcx
@@ -5890,7 +5944,7 @@ asm_handler_SetGlobal:
test rax, rax
jz .Lasm_SetGlobal.assert_predicate_failure_15
mov rdx, QWORD PTR [rax + 64]
- cmp QWORD PTR [rcx + 64], rdx
+ cmp QWORD PTR [rcx + 56], rdx
jne .Lasm_SetGlobal.ssa_block_1
mov rdx, QWORD PTR [rsi + 24]
test rdx, rdx
@@ -5921,37 +5975,40 @@ asm_handler_SetGlobal:
cmp BYTE PTR [rax + 76], 0
jz .Lasm_SetGlobal.ssa_block_1
mov eax, DWORD PTR [rax + 72]
- mov rdx, QWORD PTR [rcx + 32]
- test rdx, rdx
+ mov rsi, QWORD PTR [rcx + 24]
+ test rsi, rsi
jz .Lasm_SetGlobal.assert_failure_3
- mov rsi, QWORD PTR [rdx + rax * 8]
- mov r11, rsi
+ mov rdx, QWORD PTR [rsi + rax * 8]
+ mov r11, rdx
shr r11, 48
cmp r11w, 32763
je .Lasm_SetGlobal.ssa_block_1
- mov rsi, QWORD PTR [rcx + 24]
- test rsi, rsi
+ mov edx, DWORD PTR [rcx + 20]
+ lea r11, [r15 + rdx * 8]
+ test edx, edx
+ cmovnz rdx, r11
+ test rdx, rdx
jnz .Lasm_SetGlobal.ssa_block_6
- mov rcx, QWORD PTR [rcx + 56]
+ mov rcx, QWORD PTR [rcx + 48]
mov rcx, QWORD PTR [rcx]
test rcx, rcx
jz .Lasm_SetGlobal.assert_failure_4
movzx ecx, BYTE PTR [rcx + rax]
jmp .Lasm_SetGlobal.ssa_block_7
.Lasm_SetGlobal.ssa_block_6:
- mov rdi, QWORD PTR [rsi + 24]
+ mov rdi, QWORD PTR [rdx + 24]
cmp rdi, rax
ja .Lasm_SetGlobal.ssa_block_9
- mov rcx, QWORD PTR [rcx + 56]
+ mov rcx, QWORD PTR [rcx + 48]
mov rcx, QWORD PTR [rcx]
test rcx, rcx
jz .Lasm_SetGlobal.assert_failure_5
- mov rsi, rax
- sub rsi, rdi
- movzx ecx, BYTE PTR [rcx + rsi]
+ mov rdx, rax
+ sub rdx, rdi
+ movzx ecx, BYTE PTR [rcx + rdx]
jmp .Lasm_SetGlobal.ssa_block_7
.Lasm_SetGlobal.ssa_block_9:
- mov rcx, QWORD PTR [rsi + 16]
+ mov rcx, QWORD PTR [rdx + 16]
test rcx, rcx
jz .Lasm_SetGlobal.assert_failure_6
movzx ecx, BYTE PTR [rcx + rax]
@@ -5960,7 +6017,7 @@ asm_handler_SetGlobal:
jz .Lasm_SetGlobal.ssa_block_1
mov ecx, DWORD PTR [r14 + r13 + 8]
mov rcx, QWORD PTR [rbx + rcx * 8]
- mov QWORD PTR [rdx + rax * 8], rcx
+ mov QWORD PTR [rsi + rax * 8], rcx
add r13d, 16
movzx eax, BYTE PTR [r14 + r13]
jmp [r12 + rax * 8]
@@ -6624,7 +6681,10 @@ asm_handler_LeavePrivateEnvironment:
mov rax, QWORD PTR [rbx - 80]
test rax, rax
jz .Lasm_LeavePrivateEnvironment.assert_predicate_failure_3
- mov rax, QWORD PTR [rax + 16]
+ mov eax, DWORD PTR [rax + 12]
+ lea r11, [r15 + rax * 8]
+ test eax, eax
+ cmovnz rax, r11
mov QWORD PTR [rbx - 80], rax
add r13d, 8
movzx eax, BYTE PTR [r14 + r13]
diff --git a/Libraries/LibJS/Flap/tests/interpreter-layout.conf b/Libraries/LibJS/Flap/tests/interpreter-layout.conf
index 6ec5f25f429..02b56260c96 100644
--- a/Libraries/LibJS/Flap/tests/interpreter-layout.conf
+++ b/Libraries/LibJS/Flap/tests/interpreter-layout.conf
@@ -324,9 +324,9 @@ const WATCHPOINT_SET_VALID = 11
field WatchpointSet.valid bool WATCHPOINT_SET_VALID nonnull scalar
# DeclarativeEnvironment layout
-const DECLARATIVE_ENVIRONMENT_RARE_DATA = 56
+const DECLARATIVE_ENVIRONMENT_RARE_DATA = 48
field DeclarativeEnvironment.rare_data DeclarativeEnvironmentRareData DECLARATIVE_ENVIRONMENT_RARE_DATA nullable scalar
-const DECLARATIVE_ENVIRONMENT_SERIAL = 64
+const DECLARATIVE_ENVIRONMENT_SERIAL = 56
field DeclarativeEnvironment.serial_number u64 DECLARATIVE_ENVIRONMENT_SERIAL nullable scalar
# GlobalVariableCache layout
@@ -435,20 +435,20 @@ field Environment.permanently_screwed_by_eval bool ENVIRONMENT_SCREWED_BY_EVAL n
const ENVIRONMENT_DECLARATIVE = 13
field Environment.declarative bool ENVIRONMENT_DECLARATIVE nullable scalar
const ENVIRONMENT_OUTER = 16
-field Environment.outer Environment ENVIRONMENT_OUTER nullable cell
+field Environment.outer Environment ENVIRONMENT_OUTER nullable compressed
# PrivateEnvironment layout
-const PRIVATE_ENVIRONMENT_OUTER = 16
-field PrivateEnvironment.outer PrivateEnvironment PRIVATE_ENVIRONMENT_OUTER nullable cell
+const PRIVATE_ENVIRONMENT_OUTER = 12
+field PrivateEnvironment.outer PrivateEnvironment PRIVATE_ENVIRONMENT_OUTER nullable compressed
# DeclarativeEnvironment binding storage layout
-const DECLARATIVE_ENVIRONMENT_SHAPE = 24
-field DeclarativeEnvironment.shape EnvironmentShape DECLARATIVE_ENVIRONMENT_SHAPE nullable cell
-const DECLARATIVE_ENVIRONMENT_BINDING_VALUES = 32
+const DECLARATIVE_ENVIRONMENT_SHAPE = 20
+field DeclarativeEnvironment.shape EnvironmentShape DECLARATIVE_ENVIRONMENT_SHAPE nullable compressed
+const DECLARATIVE_ENVIRONMENT_BINDING_VALUES = 24
const DECLARATIVE_ENVIRONMENT_RARE_DATA_BINDING_FLAGS = 0
const ENVIRONMENT_SHAPE_BINDING_FLAGS = 16
const BINDING_FLAG_MUTABLE = 2
-const BINDING_VALUES_DATA_PTR = 32
+const BINDING_VALUES_DATA_PTR = 24
field DeclarativeEnvironment.binding_values BindingValues BINDING_VALUES_DATA_PTR nonnull scalar
const BINDING_FLAGS_DATA_PTR = 0
field DeclarativeEnvironmentRareData.binding_flags BindingFlags BINDING_FLAGS_DATA_PTR nonnull scalar
diff --git a/Libraries/LibJS/JIT/Rust/src/codegen/allocation.rs b/Libraries/LibJS/JIT/Rust/src/codegen/allocation.rs
index 18577075e87..73ecffd303a 100644
--- a/Libraries/LibJS/JIT/Rust/src/codegen/allocation.rs
+++ b/Libraries/LibJS/JIT/Rust/src/codegen/allocation.rs
@@ -559,7 +559,7 @@ impl<M: PortableMacroAssembler> Codegen<'_, M> {
.ok_or(CompileFailure::CodeGeneration)?;
let (entry, resume) = self.defer_allocation(node, AllocationCall::Environment(shape_cache, capacity));
let template_bytes = 8 * template.words.len() as u64;
- let stored = [(template.binding_values_offset, 8), (template.outer_offset, 8)];
+ let stored = [(template.binding_values_offset, 8), (template.outer_offset, 4)];
let fits = template.allocator != 0
&& template_bytes <= u64::from(template.cell_size)
&& stored_fields_fit(&stored, template_bytes);
@@ -590,8 +590,9 @@ impl<M: PortableMacroAssembler> Codegen<'_, M> {
self.masm
.store_imm64(&at(environment, template.binding_values_offset), 0);
}
- self.emit_unbox_cell(temp, parent);
- self.masm.store64(&at(environment, template.outer_offset), temp);
+ // NB: A cell value has the cell's offset into the heap region below its tag, so its low 32 bits shifted like
+ // a cell pointer are the cell's compressed pointer.
+ self.emit_store_compressed_cell(&at(environment, template.outer_offset), parent, temp);
self.masm.move64(output, environment);
self.box_cell(output, output);
self.masm.bind(resume);
diff --git a/Libraries/LibJS/JIT/Rust/src/codegen/call_stub.rs b/Libraries/LibJS/JIT/Rust/src/codegen/call_stub.rs
index 12054fa3d52..1442f25d706 100644
--- a/Libraries/LibJS/JIT/Rust/src/codegen/call_stub.rs
+++ b/Libraries/LibJS/JIT/Rust/src/codegen/call_stub.rs
@@ -229,12 +229,13 @@ impl<M: PortableMacroAssembler> Codegen<'_, M> {
self.masm
.store64(&at(cell, layout.function_environment_binding_values), scratch);
self.masm.bind(outside_the_cell);
- // NB: The outer environment is the callee's environment, which ECMAScript functions always have.
- self.emit_load_compressed_cell(
+ // NB: The outer environment is the callee's environment, which stays
+ // compressed on the way.
+ self.masm.load32(
scratch,
&at(function, self.runtime.offsets.ecmascript_function_environment),
);
- self.masm.store64(&at(cell, layout.function_environment_outer), scratch);
+ self.masm.store32(&at(cell, layout.function_environment_outer), scratch);
self.masm
.store64(&at(cell, layout.function_environment_function_object), function);
let no_this = self.masm.new_label();
diff --git a/Libraries/LibJS/JIT/Rust/src/codegen/environments.rs b/Libraries/LibJS/JIT/Rust/src/codegen/environments.rs
index 08a365afed0..c34653ed2fe 100644
--- a/Libraries/LibJS/JIT/Rust/src/codegen/environments.rs
+++ b/Libraries/LibJS/JIT/Rust/src/codegen/environments.rs
@@ -48,12 +48,11 @@ impl<M: PortableMacroAssembler> Codegen<'_, M> {
.load64(scratch, &Address::new(scratch, layout.rare_data_binding_flags as i32));
};
- self.masm.load64(
+ self.emit_load_compressed_cell_or_branch(
scratch,
&Address::new(environment, layout.declarative_environment_shape as i32),
+ rare_at_index,
);
- self.masm
- .branch_test64(Condition::Zero, scratch, u64::MAX, rare_at_index);
// Flags past the shape's are in the rare data, after the shape's.
self.masm.load64(
temp,
@@ -113,11 +112,11 @@ impl<M: PortableMacroAssembler> Codegen<'_, M> {
self.masm.move_imm64(shape, layout.module_environment_class);
self.masm.branch64(Condition::Equal, scratch, shape, fail);
- self.masm.load64(
+ self.emit_load_compressed_cell_or_branch(
shape,
&Address::new(environment, layout.declarative_environment_shape as i32),
+ fail,
);
- self.masm.branch_test64(Condition::Zero, shape, u64::MAX, fail);
self.masm.load8(
scratch,
&Address::new(shape, layout.environment_shape_has_unique_binding_names as i32),
diff --git a/Libraries/LibJS/JIT/Rust/src/codegen/mod.rs b/Libraries/LibJS/JIT/Rust/src/codegen/mod.rs
index b395f9a8595..31a7b231957 100644
--- a/Libraries/LibJS/JIT/Rust/src/codegen/mod.rs
+++ b/Libraries/LibJS/JIT/Rust/src/codegen/mod.rs
@@ -1314,9 +1314,10 @@ impl<M: PortableMacroAssembler> Codegen<'_, M> {
}
Op::PublishFrame => self.emit_publish_frame(),
Op::LoadOuterEnvironment => {
+ // NB: The environments static coordinates walk through have outer environments.
let (output, input) = (self.output(node_id), self.input(node_id, 0));
let outer = Address::new(input, self.runtime.layout.environment_outer as i32);
- self.masm.load64(output, &outer);
+ self.emit_load_compressed_cell(output, &outer);
}
Op::LoadEnvironmentBinding { index } => {
let (output, input) = (self.output(node_id), self.input(node_id, 0));
@@ -1374,7 +1375,7 @@ impl<M: PortableMacroAssembler> Codegen<'_, M> {
let scratch = self.pinned.scratch;
let field = self.frame_field(self.runtime.offsets.execution_context_private_environment);
self.masm.load64(scratch, &field);
- self.masm.load64(
+ self.emit_load_nullable_compressed_cell(
scratch,
&Address::new(scratch, self.runtime.offsets.private_environment_outer as i32),
);
diff --git a/Libraries/LibJS/JIT/Rust/src/codegen/tests.rs b/Libraries/LibJS/JIT/Rust/src/codegen/tests.rs
index 5fe57f18a3e..72574cb08bb 100644
--- a/Libraries/LibJS/JIT/Rust/src/codegen/tests.rs
+++ b/Libraries/LibJS/JIT/Rust/src/codegen/tests.rs
@@ -1413,12 +1413,14 @@ mod execution {
#[test]
fn frame_fields() {
- // Environments and objects are cells; the fake heap region starts at 0.
- let outer_private_environment = [0u64; 2];
- let private_environment = [outer_private_environment.as_ptr() as u64, 0];
- let lexical_environment = [0u64; 2];
- let function_object = [0, u64::from(FUNCTION_FLAG)];
- let plain_object = [0u64, 0];
+ // Environments and objects are cells in the fake heap region, and a
+ // private environment has its outer environment compressed.
+ let outer_private_environment = fake_heap::cell(&[0; 2]);
+ let private_environment =
+ fake_heap::cell(&[fake_heap::compressed(outer_private_environment.as_ptr() as u64), 0]);
+ let lexical_environment = fake_heap::cell(&[0; 2]);
+ let function_object = fake_heap::cell(&[0, u64::from(FUNCTION_FLAG)]);
+ let plain_object = fake_heap::cell(&[0, 0]);
let object_tag = u64::from(value::OBJECT_TAG) << 48;
let program = assemble(|_| {
vec![
@@ -1436,10 +1438,13 @@ mod execution {
(plain_object.as_ptr() as u64 | object_tag, value::FALSE),
(value::int32(1), value::FALSE),
] {
- let (result, machine) = run_with(&program, test_layout(), &[argument], &[], |machine| {
- machine.frame[1] = lexical_environment.as_ptr() as u64;
- machine.frame[2] = private_environment.as_ptr() as u64;
+ let (snapshot, compiled) = compile_program_with(&program, test_layout(), &[], |snapshot| {
+ fake_heap::use_in(&mut snapshot.runtime)
});
+ let mut machine = Machine::new(test_layout(), &[argument]);
+ machine.frame[1] = lexical_environment.as_ptr() as u64;
+ machine.frame[2] = private_environment.as_ptr() as u64;
+ let result = machine.run(&snapshot, &compiled);
assert_eq!(result, returned(expected));
assert_eq!(machine.frame[2], outer_private_environment.as_ptr() as u64);
assert_eq!(machine.frame[1], lexical_environment.as_ptr() as u64);
@@ -4054,7 +4059,7 @@ mod direct_calls {
assert_eq!(frame[120 / 8], this, "this");
assert_eq!(&cell[..2], &[0x1000, 0x1001]);
assert_eq!(cell[2], if in_cell { address + 48 } else { 0 });
- assert_eq!(cell[3], environment(FUNCTION_WORDS[0]), "outer environment");
+ assert_eq!(cell[3] as u32, FUNCTION_WORDS[0] as u32, "compressed outer environment");
assert_eq!(cell[4], callee.function.as_ptr() as u64, "function object");
assert_eq!(cell[5], if binds_this { value::int32(3) } else { 0 });
assert_eq!(heap, [164, 10_000, 1064]);
diff --git a/Libraries/LibJS/JIT/Rust/src/codegen/tests/lowerings.rs b/Libraries/LibJS/JIT/Rust/src/codegen/tests/lowerings.rs
index 0bc74096621..4485764114e 100644
--- a/Libraries/LibJS/JIT/Rust/src/codegen/tests/lowerings.rs
+++ b/Libraries/LibJS/JIT/Rust/src/codegen/tests/lowerings.rs
@@ -1845,7 +1845,9 @@ fn property_iterator_next_reads_key_snapshots() {
}
// Environments, laid out like this, in words: 2 the outer environment, 3
-// the shape, 6 the binding values, 7 the rare data, 8 the serial number.
+// the shape (both compressed, in the low half), 6 the binding values, 7 the
+// rare data, 8 the serial number. Environments and their shapes are cells in
+// the fake heap region.
// Rare data has its binding flags at word 5. Environment shapes have their
// flag count at word 5 and their flags at word 7. Realms have the global
// object at word 3 and the global declarative environment at word 4. The
@@ -1854,11 +1856,11 @@ fn property_iterator_next_reads_key_snapshots() {
const BINDING_MUTABLE: u8 = 2;
struct FakeEnvironment {
- words: Vec<u64>,
+ words: &'static mut [u64],
values: Vec<u64>,
rare_data: Vec<u64>,
rare_flags: Vec<u8>,
- shape: Vec<u64>,
+ shape: &'static mut [u64],
shape_flags: Vec<u8>,
}
@@ -1868,19 +1870,19 @@ impl FakeEnvironment {
fn new(values: &[u64], flags: &[u8], shape_flags: Option<usize>, outer: Option<&FakeEnvironment>) -> Box<Self> {
let in_shape = shape_flags.unwrap_or(0);
let mut environment = Box::new(Self {
- words: vec![0; 10],
+ words: super::fake_heap::cell(&[0; 10]),
values: values.to_vec(),
rare_data: vec![0; 8],
rare_flags: flags[in_shape..].to_vec(),
- shape: vec![0; 8],
+ shape: super::fake_heap::cell(&[0; 8]),
shape_flags: flags[..in_shape].to_vec(),
});
environment.rare_data[5] = environment.rare_flags.as_ptr() as u64;
environment.shape[5] = in_shape as u64;
environment.shape[7] = environment.shape_flags.as_ptr() as u64;
- environment.words[2] = outer.map_or(0, |outer| outer.words.as_ptr() as u64);
+ environment.words[2] = outer.map_or(0, |outer| super::fake_heap::compressed(outer.address()));
if shape_flags.is_some() {
- environment.words[3] = environment.shape.as_ptr() as u64;
+ environment.words[3] = super::fake_heap::compressed(environment.shape.as_ptr() as u64);
}
environment.words[6] = environment.values.as_ptr() as u64;
environment.words[7] = environment.rare_data.as_ptr() as u64;
@@ -1910,7 +1912,10 @@ fn run_with_environments(
let (result, machine) = run_program_with_snapshot(
&program,
arguments,
- |snapshot| snapshot.executables[0].exit_sites = exit_sites,
+ |snapshot| {
+ snapshot.executables[0].exit_sites = exit_sites;
+ super::fake_heap::use_in(&mut snapshot.runtime);
+ },
|machine| {
machine.frame[1] = lexical.address();
machine.frame[12] = variable.address();
@@ -2091,7 +2096,10 @@ fn create_variable() {
let (result, machine) = run_program_with_snapshot(
&program,
&[],
- |snapshot| snapshot.executables[0].identifiers = NAMES.to_vec(),
+ |snapshot| {
+ snapshot.executables[0].identifiers = NAMES.to_vec();
+ super::fake_heap::use_in(&mut snapshot.runtime);
+ },
|machine| {
machine.frame[1] = environment.address();
machine.frame[12] = environment.address();
@@ -2103,7 +2111,7 @@ fn create_variable() {
// A declarative environment with room for `capacity` values, `size` of
// them bindings already.
let environment = |size: u64, capacity: usize| {
- let mut environment = FakeEnvironment::new(&vec![value::int32(7); capacity], &flags, Some(2), None);
+ let environment = FakeEnvironment::new(&vec![value::int32(7); capacity], &flags, Some(2), None);
environment.words[1] = 1 << 40;
environment.words[4] = size;
environment.words[5] = capacity as u64;
@@ -2132,14 +2140,14 @@ fn create_variable() {
assert_eq!(slow(environment(0, 2), 1, true, true), 0);
assert_eq!(slow(environment(0, 2), 0, true, false), 0);
assert_eq!(slow(environment(0, 2), 0, false, true), 0);
- let mut duplicates = environment(0, 2);
+ let duplicates = environment(0, 2);
duplicates.shape[4] = 0;
assert_eq!(slow(duplicates, 0, false, false), 0);
assert_eq!(slow(environment(1, 1), 1, true, true), 1);
- let mut module = environment(0, 2);
+ let module = environment(0, 2);
module.words[0] = MODULE_ENVIRONMENT_CLASS;
assert_eq!(slow(module, 0, false, false), 0);
- let mut object_environment = environment(0, 2);
+ let object_environment = environment(0, 2);
object_environment.words[1] = 0;
assert_eq!(slow(object_environment, 0, false, false), 0);
}
diff --git a/Libraries/LibJS/Rust/generate/layout_table.rs b/Libraries/LibJS/Rust/generate/layout_table.rs
index 54971badd7e..41f68d968f7 100644
--- a/Libraries/LibJS/Rust/generate/layout_table.rs
+++ b/Libraries/LibJS/Rust/generate/layout_table.rs
@@ -549,13 +549,13 @@ pub fn generate(configuration: &LayoutConfiguration) -> LayoutWriter {
w.section("Environment layout");
field!(w, "ENVIRONMENT_SCREWED_BY_EVAL", "Environment.permanently_screwed_by_eval", "bool", Environment, permanently_screwed_by_eval, 1, "nullable", "scalar");
field!(w, "ENVIRONMENT_DECLARATIVE", "Environment.declarative", "bool", Environment, declarative, 1, "nullable", "scalar");
- field!(w, "ENVIRONMENT_OUTER", "Environment.outer", "Environment", Environment, outer, 8, "nullable", "cell");
+ field!(w, "ENVIRONMENT_OUTER", "Environment.outer", "Environment", Environment, outer, 4, "nullable", "compressed");
w.section("PrivateEnvironment layout");
- field!(w, "PRIVATE_ENVIRONMENT_OUTER", "PrivateEnvironment.outer", "PrivateEnvironment", PrivateEnvironment, outer, 8, "nullable", "cell");
+ field!(w, "PRIVATE_ENVIRONMENT_OUTER", "PrivateEnvironment.outer", "PrivateEnvironment", PrivateEnvironment, outer, 4, "nullable", "compressed");
w.section("DeclarativeEnvironment binding storage layout");
- field!(w, "DECLARATIVE_ENVIRONMENT_SHAPE", "DeclarativeEnvironment.shape", "EnvironmentShape", DeclarativeEnvironment, shape, 8, "nullable", "cell");
+ field!(w, "DECLARATIVE_ENVIRONMENT_SHAPE", "DeclarativeEnvironment.shape", "EnvironmentShape", Environment, shape, 4, "nullable", "compressed");
offset!(w, "DECLARATIVE_ENVIRONMENT_BINDING_VALUES", DeclarativeEnvironment, binding_values);
offset!(w, "DECLARATIVE_ENVIRONMENT_RARE_DATA_BINDING_FLAGS", DeclarativeEnvironmentRareData, binding_flags);
offset!(w, "ENVIRONMENT_SHAPE_BINDING_FLAGS", EnvironmentShape, binding_flags);
diff --git a/Libraries/LibJS/Rust/src/jit/allocation.rs b/Libraries/LibJS/Rust/src/jit/allocation.rs
index 8f86543cd28..28c42e01b25 100644
--- a/Libraries/LibJS/Rust/src/jit/allocation.rs
+++ b/Libraries/LibJS/Rust/src/jit/allocation.rs
@@ -28,6 +28,7 @@ use crate::interpreter::vm::Vm;
use crate::layout::cell::{CellHeader, Gc};
use crate::layout::environment::{DeclarativeEnvironment, Environment, PrivateEnvironment};
use crate::layout::function_object::{CallEnvironmentTemplate, EcmascriptFunctionObject, FUNCTION_ENVIRONMENT_WORDS};
+use crate::layout::member::NullableMember;
use crate::layout::object::{INLINE_NAMED_STORAGE_CAPACITY, Object};
use crate::layout::primitive_string::PrimitiveString;
use crate::layout::realm::Realm;
@@ -69,6 +70,13 @@ fn cell_words<T>(cell: Gc<T>, size: usize) -> Vec<u64> {
words
}
+/// Clears the `size` bytes at `offset` of `words`, which may share their word with other fields.
+fn clear_bytes(words: &mut [u64], offset: usize, size: usize) {
+ for byte in offset..offset + size {
+ words[byte / 8] &= !(0xff << (8 * (byte % 8)));
+ }
+}
+
/// What JIT code needs to allocate cells itself, for code of `realm`. The templates come from cells allocated here,
/// so this may collect garbage.
pub struct AllocationInfos<'d> {
@@ -303,13 +311,16 @@ pub fn make_call_environment_template(vm: &Vm, function: Gc<EcmascriptFunctionOb
words: [0; FUNCTION_ENVIRONMENT_WORDS],
};
template.words.copy_from_slice(&words);
- for offset in [
- core::mem::offset_of!(DeclarativeEnvironment, binding_values.data),
- core::mem::offset_of!(Environment, outer),
- FUNCTION_ENVIRONMENT_FUNCTION_OBJECT_OFFSET,
- FUNCTION_ENVIRONMENT_THIS_VALUE_OFFSET,
+ for (offset, size) in [
+ (core::mem::offset_of!(DeclarativeEnvironment, binding_values.data), 8),
+ (
+ core::mem::offset_of!(Environment, outer),
+ size_of::<NullableMember<Environment>>(),
+ ),
+ (FUNCTION_ENVIRONMENT_FUNCTION_OBJECT_OFFSET, 8),
+ (FUNCTION_ENVIRONMENT_THIS_VALUE_OFFSET, 8),
] {
- template.words[offset / 8] = 0;
+ clear_bytes(&mut template.words, offset, size);
}
shared_data
.call_environment_template
diff --git a/Libraries/LibJS/Rust/src/jit/runtime_info.rs b/Libraries/LibJS/Rust/src/jit/runtime_info.rs
index f217ef9495b..ad625ac9ddf 100644
--- a/Libraries/LibJS/Rust/src/jit/runtime_info.rs
+++ b/Libraries/LibJS/Rust/src/jit/runtime_info.rs
@@ -270,7 +270,7 @@ fn runtime_layout() -> RuntimeLayout {
environment_shape_binding_names: offset(offset_of!(EnvironmentShape, binding_names)),
environment_shape_has_unique_binding_names: offset(offset_of!(EnvironmentShape, has_unique_binding_names)),
declarative_environment_binding_values: offset(offset_of!(DeclarativeEnvironment, binding_values.data)),
- declarative_environment_shape: offset(offset_of!(DeclarativeEnvironment, shape)),
+ declarative_environment_shape: offset(offset_of!(Environment, shape)),
declarative_environment_rare_data: offset(offset_of!(DeclarativeEnvironment, rare_data)),
rare_data_binding_flags: offset(offset_of!(DeclarativeEnvironmentRareData, binding_flags.data)),
environment_shape_binding_flags_size: offset(offset_of!(EnvironmentShape, binding_flags.size)),
diff --git a/Libraries/LibJS/Rust/src/layout/environment.rs b/Libraries/LibJS/Rust/src/layout/environment.rs
index f50172ed30b..a8439d275cf 100644
--- a/Libraries/LibJS/Rust/src/layout/environment.rs
+++ b/Libraries/LibJS/Rust/src/layout/environment.rs
@@ -8,6 +8,7 @@ use core::cell::Cell;
use super::buffer::InterpreterBuffer;
use super::cell::{CellHeader, Gc};
+use super::member::NullableMember;
use super::object::Object;
use super::value::Value;
use crate::layout_forward::{
@@ -25,18 +26,23 @@ pub struct Environment {
pub declarative: Cell<bool>,
/// Whether the binding values of a declarative environment are stored in its cell, after the fields of its class.
pub binding_values_are_inline: Cell<bool>,
- pub outer: Cell<Option<Gc<Environment>>>,
+ pub outer: NullableMember<Environment>,
+ /// The shape of a declarative environment, in what would otherwise be padding (null for other environments).
+ pub shape: NullableMember<EnvironmentShape>,
}
+const _: () = assert!(size_of::<Environment>() == 24);
+
#[repr(C)]
pub struct DeclarativeEnvironment {
pub base: Environment,
- pub shape: Cell<Option<Gc<EnvironmentShape>>>,
pub binding_values: InterpreterBuffer<Value>,
pub rare_data: Cell<*mut DeclarativeEnvironmentRareData>,
pub serial_number: Cell<u64>,
}
+const _: () = assert!(size_of::<DeclarativeEnvironment>() == 64);
+
#[repr(C)]
pub struct DeclarativeEnvironmentRareData {
pub binding_flags: InterpreterBuffer<u8>,
@@ -54,7 +60,7 @@ pub struct GlobalEnvironment {
#[repr(C)]
pub struct PrivateEnvironment {
pub header: CellHeader,
- pub outer: Cell<Option<Gc<PrivateEnvironment>>>,
+ pub outer: NullableMember<PrivateEnvironment>,
pub storage: PrivateEnvironmentStorage,
}
diff --git a/Libraries/LibJS/Rust/src/runtime/declarative_environment.rs b/Libraries/LibJS/Rust/src/runtime/declarative_environment.rs
index 11b7234ffd3..4aa58d3b672 100644
--- a/Libraries/LibJS/Rust/src/runtime/declarative_environment.rs
+++ b/Libraries/LibJS/Rust/src/runtime/declarative_environment.rs
@@ -171,15 +171,14 @@ unsafe impl Trace for DeclarativeEnvironmentRareData {
define_cell!(DeclarativeEnvironment, Other, extends: [Environment], finalize: finalize);
-// SAFETY: Visits the outer environment, the rare data's dispose capability and shape cache, the shape and every
-// binding value.
+// SAFETY: Visits the outer environment and the shape (in the Environment), the rare data's dispose capability and shape
+// cache and every binding value.
unsafe impl Trace for DeclarativeEnvironment {
fn trace(&self, visitor: &mut Visitor) {
self.base.trace(visitor);
if let Some(rare_data) = self.rare_data() {
rare_data.trace(visitor);
}
- self.shape.trace(visitor);
self.binding_values.trace(visitor);
}
}
@@ -300,7 +299,6 @@ impl DeclarativeEnvironment {
pub fn new(class: &'static Class, outer_environment: Option<Gc<Environment>>) -> Self {
Self {
base: Environment::new(class, outer_environment, true),
- shape: Cell::new(None),
binding_values: InterpreterBuffer::new(),
rare_data: Cell::new(core::ptr::null_mut()),
serial_number: Cell::new(0),
diff --git a/Libraries/LibJS/Rust/src/runtime/environment.rs b/Libraries/LibJS/Rust/src/runtime/environment.rs
index a9bdcdbce80..dfbfaafc04b 100644
--- a/Libraries/LibJS/Rust/src/runtime/environment.rs
+++ b/Libraries/LibJS/Rust/src/runtime/environment.rs
@@ -25,6 +25,7 @@ use crate::interpreter::vm::Vm;
use crate::layout::cell::{CellHeader, Gc};
use crate::layout::environment::DeclarativeEnvironment;
pub use crate::layout::environment::Environment;
+use crate::layout::member::NullableMember;
use crate::layout::object::Object;
use crate::layout::value::Value;
use crate::runtime::completion::ThrowCompletionOr;
@@ -111,10 +112,11 @@ pub const ENVIRONMENT_METHODS: EnvironmentMethods = EnvironmentMethods {
define_cell!(Environment, Other);
-// SAFETY: The outer environment is the only cell an Environment holds.
+// SAFETY: The outer environment and the shape of a declarative environment are the cells an Environment holds.
unsafe impl Trace for Environment {
fn trace(&self, visitor: &mut Visitor) {
self.outer.trace(visitor);
+ self.shape.trace(visitor);
}
}
@@ -127,7 +129,8 @@ impl Environment {
permanently_screwed_by_eval: false.into(),
declarative: is_declarative.into(),
binding_values_are_inline: false.into(),
- outer: outer_environment.into(),
+ outer: NullableMember::new(outer_environment),
+ shape: NullableMember::null(),
}
}
diff --git a/Libraries/LibJS/Rust/src/runtime/private_environment.rs b/Libraries/LibJS/Rust/src/runtime/private_environment.rs
index bf9c2459743..cabaad2b6f3 100644
--- a/Libraries/LibJS/Rust/src/runtime/private_environment.rs
+++ b/Libraries/LibJS/Rust/src/runtime/private_environment.rs
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-use core::cell::{Cell, RefCell};
+use core::cell::RefCell;
use ak::Utf16FlyString;
@@ -13,6 +13,7 @@ use crate::gc::visitor::{Trace, Visitor};
use crate::interpreter::vm::Vm;
use crate::layout::cell::{CellHeader, Gc};
pub use crate::layout::environment::PrivateEnvironment;
+use crate::layout::member::NullableMember;
#[derive(Clone, Default)]
pub struct PrivateName {
@@ -58,6 +59,8 @@ pub struct PrivateEnvironmentStorage {
unique_id: u64,
}
+const _: () = assert!(size_of::<PrivateEnvironment>() == 56);
+
define_cell!(PrivateEnvironment, Other);
// SAFETY: The outer environment is the only cell a private environment reaches; names hold no cells.
@@ -76,7 +79,7 @@ impl PrivateEnvironment {
vm.next_private_environment_id().set(unique_id + 1);
vm.heap().allocate(|_| PrivateEnvironment {
header: CellHeader::for_class(Self::CLASS),
- outer: Cell::new(parent),
+ outer: NullableMember::new(parent),
storage: PrivateEnvironmentStorage {
private_names: RefCell::new(Vec::new()),
unique_id,