Truly independent web browser
LibJS: Store the shape of every object compressed
Andreas Kling88d8dd7f4d29
diff --git a/Libraries/LibJS/Flap/tests/interpreter-assembly/aarch64.S b/Libraries/LibJS/Flap/tests/interpreter-assembly/aarch64.Sindex ff8d7c7ef19..07a9f8b7f4c 100644--- a/Libraries/LibJS/Flap/tests/interpreter-assembly/aarch64.S+++ b/Libraries/LibJS/Flap/tests/interpreter-assembly/aarch64.S@@ -4931,7 +4931,7 @@ asm_handler_PutByValue:ldr w1, [x3, #16]cmp x0, x1b.hs .Lasm_PutByValue.ssa_block_1- ldr x1, [x3, #40]+ ldr x1, [x3, #32]cbz x1, .Lasm_PutByValue.assert_predicate_failure_66ldur w2, [x1, #-8]cmp x0, x2@@ -4949,7 +4949,7 @@ asm_handler_PutByValue:ldr w1, [x3, #16]cmp x0, x1b.hs .Lasm_PutByValue.ssa_block_1- ldr x1, [x3, #40]+ ldr x1, [x3, #32]cbz x1, .Lasm_PutByValue.ssa_block_5ldur w2, [x1, #-8]cmp x0, x2@@ -4966,16 +4966,16 @@ asm_handler_PutByValue:ldr x10, [x19, x9, lsl #3]br x10.Lasm_PutByValue.ssa_block_11:- ldr x2, [x3, #88]+ ldr x2, [x3, #80]cmn x2, #1b.eq .Lasm_PutByValue.ssa_block_6mov x1, x20ldr x1, [x1, #64]cbz x1, .Lasm_PutByValue.assert_failure_0- ldr w4, [x3, #76]+ ldr w4, [x3, #68]cmp x0, x4b.hs .Lasm_PutByValue.ssa_block_1- ldrb w3, [x3, #72]+ ldrb w3, [x3, #64]ldr w4, [x21, #12]ldr x4, [x27, x4, lsl #3]lsr x5, x4, #48@@ -5189,8 +5189,9 @@ asm_handler_PutByValue:b.ne .Lasm_PutByValue.ssa_block_3and x2, x2, #0x7ffffffffadd x2, x2, x24- ldr x1, [x2, #24]+ ldr w1, [x2, #20]cbz x1, .Lasm_PutByValue.assert_failure_2+ add x1, x24, w1, uxtw #3ldp x4, x3, [x0, #24]cmp x4, x1b.ne .Lasm_PutByValue.ssa_block_3@@ -5201,7 +5202,7 @@ asm_handler_PutByValue:b.ne .Lasm_PutByValue.ssa_block_3ldrb w9, [x0, #12]cbz w9, .Lasm_PutByValue.ssa_block_3- ldr x0, [x2, #32]+ ldr x0, [x2, #24]cbz x0, .Lasm_PutByValue.assert_failure_3ldr x1, [x0, x3, lsl #3]lsr x9, x1, #48@@ -5227,8 +5228,9 @@ asm_handler_GetById:b.ne .Lasm_GetById.ssa_block_14and x3, x3, #0x7ffffffffadd x3, x3, x24- ldr x0, [x3, #24]+ ldr w0, [x3, #20]cbz x0, .Lasm_GetById.assert_failure_0+ add x0, x24, w0, uxtw #3ldr x1, [x28, #88]cbz x1, .Lasm_GetById.assert_predicate_failure_123ldr x2, [x1, #152]@@ -5252,7 +5254,7 @@ asm_handler_GetById:ldr w9, [x0, #52]cmp w9, w5b.ne .Lasm_GetById.ssa_block_1- ldr x0, [x1, #32]+ ldr x0, [x1, #24]cbz x0, .Lasm_GetById.assert_failure_2ldr x0, [x0, x4, lsl #3]lsr x9, x0, #48@@ -5298,7 +5300,7 @@ asm_handler_GetById:ldr x0, [x1, #32]cbnz x0, .Lasm_GetById.ssa_block_12.Lasm_GetById.ssa_block_13:- ldr x0, [x3, #32]+ ldr x0, [x3, #24]cbz x0, .Lasm_GetById.assert_failure_4ldr w1, [x1, #4]ldr x0, [x0, x1, lsl #3]@@ -5324,8 +5326,9 @@ asm_handler_PutById:b.ne .Lasm_PutById.ssa_block_2and x2, x2, #0x7ffffffffadd x2, x2, x24- ldr x1, [x2, #24]+ ldr w1, [x2, #20]cbz x1, .Lasm_PutById.assert_failure_0+ add x1, x24, w1, uxtw #3ldr x0, [x28, #88]cbz x0, .Lasm_PutById.assert_predicate_failure_14ldr x0, [x0, #152]@@ -5345,7 +5348,7 @@ asm_handler_PutById:b.ne .Lasm_PutById.ssa_block_2ldrb w9, [x0, #12]cbz w9, .Lasm_PutById.ssa_block_2- ldr x0, [x2, #32]+ ldr x0, [x2, #24]cbz x0, .Lasm_PutById.assert_failure_2ldr x1, [x0, x3, lsl #3]lsr x9, x1, #48@@ -5364,8 +5367,8 @@ asm_handler_PutById_hot_end:.p2align 4asm_handler_GetByValue:ldr w0, [x21, #16]- ldr x2, [x27, x0, lsl #3]- lsr x9, x2, #48+ ldr x1, [x27, x0, lsl #3]+ lsr x9, x1, #48cmp x9, x22b.ne .Lasm_GetByValue.ssa_block_5ldr w0, [x21, #12]@@ -5376,10 +5379,10 @@ asm_handler_GetByValue:b.ne .Lasm_GetByValue.ssa_block_8and x3, x3, #0x7ffffffffadd x3, x3, x24- ldrh w1, [x3, #12]- mov w0, w2- tbnz x1, #3, .Lasm_GetByValue.ssa_block_20- tbz x1, #4, 1f+ ldrh w2, [x3, #12]+ mov w0, w1+ tbnz x2, #3, .Lasm_GetByValue.ssa_block_20+ tbz x2, #4, 1fb .Lasm_GetByValue.ssa_block_11:ldrb w1, [x3, #14]@@ -5388,7 +5391,7 @@ asm_handler_GetByValue:ldr w1, [x3, #16]cmp x0, x1b.hs .Lasm_GetByValue.ssa_block_1- ldr x1, [x3, #40]+ ldr x1, [x3, #32]cbz x1, .Lasm_GetByValue.assert_predicate_failure_70ldur w2, [x1, #-8]cmp x0, x2@@ -5406,7 +5409,7 @@ asm_handler_GetByValue:ldr w1, [x3, #16]cmp x0, x1b.hs .Lasm_GetByValue.ssa_block_1- ldr x1, [x3, #40]+ ldr x1, [x3, #32]cbz x1, .Lasm_GetByValue.ssa_block_1ldur w2, [x1, #-8]cmp x0, x2@@ -5422,16 +5425,16 @@ asm_handler_GetByValue:ldr x10, [x19, x9, lsl #3]br x10.Lasm_GetByValue.ssa_block_20:- ldr x2, [x3, #88]+ ldr x2, [x3, #80]cmn x2, #1b.eq .Lasm_GetByValue.ssa_block_4mov x1, x20ldr x1, [x1, #64]cbz x1, .Lasm_GetByValue.assert_failure_0- ldr w4, [x3, #76]+ ldr w4, [x3, #68]cmp x0, x4b.hs .Lasm_GetByValue.ssa_block_4- ldrb w3, [x3, #72]+ ldrb w3, [x3, #64]cmp x3, #2b.hs .Lasm_GetByValue.ssa_switch_20_after_preferredadd x0, x2, x0@@ -5552,7 +5555,7 @@ asm_handler_GetByValue:mov w9, #65530cmp w0, w9b.ne .Lasm_GetByValue.ssa_block_1- sxtw x0, w2+ sxtw x0, w1tbz w0, #31, 1fb .Lasm_GetByValue.ssa_block_11:@@ -5610,8 +5613,8 @@ asm_handler_GetByValue:br x10.Lasm_GetByValue.ssa_block_5:ldr w0, [x21, #12]- ldr x1, [x27, x0, lsl #3]- lsr x9, x1, #48+ ldr x2, [x27, x0, lsl #3]+ lsr x9, x2, #48mov w10, #65529cmp x9, x10b.ne .Lasm_GetByValue.ssa_block_1@@ -5620,8 +5623,8 @@ asm_handler_GetByValue:cbz x3, .Lasm_GetByValue.assert_failure_2ldr w4, [x21, #24]ldr x3, [x3, x4, lsl #3]- and x1, x1, #0x7ffffffff- add x1, x1, x24+ and x2, x2, #0x7ffffffff+ add x2, x2, x24cmp x3, #3b.eq .Lasm_GetByValue.ssa_block_6cbz x0, .Lasm_GetByValue.assert_predicate_failure_227@@ -5634,22 +5637,23 @@ asm_handler_GetByValue:b.eq .Lasm_GetByValue.ssa_block_2and x0, x0, #0xfffffffffffffffcldr x9, [x0, #48]- cmp x9, x2+ cmp x9, x1b.ne .Lasm_GetByValue.ssa_block_3- ldr x2, [x1, #24]- cbz x2, .Lasm_GetByValue.assert_failure_4+ ldr w1, [x2, #20]+ cbz x1, .Lasm_GetByValue.assert_failure_4+ add x1, x24, w1, uxtw #3ldp x4, x3, [x0, #24]- cmp x4, x2+ cmp x4, x1b.ne .Lasm_GetByValue.ssa_block_3ldr w4, [x0]cmp w4, #6b.eq .Lasm_GetByValue.ssa_block_3ldr w4, [x0, #8]- ldr w9, [x2, #52]+ ldr w9, [x1, #52]cmp w9, w4b.ne .Lasm_GetByValue.ssa_block_3cbnz x3, .Lasm_GetByValue.ssa_block_3- ldr x1, [x1, #32]+ ldr x1, [x2, #24]cbz x1, .Lasm_GetByValue.assert_failure_5ldr w0, [x0, #4]ldr x0, [x1, x0, lsl #3]@@ -5668,16 +5672,16 @@ asm_handler_GetByValue_hot_end:.p2align 4asm_handler_GetLength:ldr w0, [x21, #12]- ldr x1, [x27, x0, lsl #3]- lsr x0, x1, #48+ ldr x2, [x27, x0, lsl #3]+ lsr x0, x2, #48mov w9, #65529cmp w0, w9b.ne .Lasm_GetLength.ssa_block_2- and x1, x1, #0x7ffffffff- add x1, x1, x24- ldrh w0, [x1, #12]+ and x2, x2, #0x7ffffffff+ add x2, x2, x24+ ldrh w0, [x2, #12]tbz x0, #2, .Lasm_GetLength.ssa_block_6- ldr w0, [x1, #16]+ ldr w0, [x2, #16]tbz x0, #31, 1fb .Lasm_GetLength.ssa_block_31:@@ -5689,8 +5693,9 @@ asm_handler_GetLength:ldr x10, [x19, x9, lsl #3]br x10.Lasm_GetLength.ssa_block_6:- ldr x2, [x1, #24]- cbz x2, .Lasm_GetLength.assert_failure_0+ ldr w1, [x2, #20]+ cbz x1, .Lasm_GetLength.assert_failure_0+ add x1, x24, w1, uxtw #3ldr x0, [x28, #88]cbz x0, .Lasm_GetLength.assert_predicate_failure_21ldr x0, [x0, #152]@@ -5701,17 +5706,17 @@ asm_handler_GetLength:and x0, x0, #0xfffffffffffffffccbz x0, .Lasm_GetLength.assert_predicate_failure_43ldp x4, x3, [x0, #24]- cmp x4, x2+ cmp x4, x1b.ne .Lasm_GetLength.ssa_block_1ldr w4, [x0]cmp w4, #6b.eq .Lasm_GetLength.ssa_block_1cbnz x3, .Lasm_GetLength.ssa_block_1ldp w3, w0, [x0, #4]- ldr w9, [x2, #52]+ ldr w9, [x1, #52]cmp w9, w0b.ne .Lasm_GetLength.ssa_block_1- ldr x0, [x1, #32]+ ldr x0, [x2, #24]cbz x0, .Lasm_GetLength.assert_failure_2ldr x0, [x0, x3, lsl #3]lsr x9, x0, #48@@ -5728,9 +5733,9 @@ asm_handler_GetLength:mov w9, #65530cmp w0, w9b.ne .Lasm_GetLength.ssa_block_1- and x1, x1, #0x7ffffffff- add x1, x1, x24- ldr w0, [x1, #12]+ and x2, x2, #0x7ffffffff+ add x2, x2, x24+ ldr w0, [x2, #12]tbz x0, #31, 1fb .Lasm_GetLength.ssa_block_11:@@ -5760,8 +5765,9 @@ asm_handler_GetGlobal:ldr x9, [x2, #56]cmp x9, x1b.ne .Lasm_GetGlobal.ssa_block_1- ldr x1, [x3, #24]+ ldr w1, [x3, #20]cbz x1, .Lasm_GetGlobal.assert_failure_1+ add x1, x24, w1, uxtw #3ldr x9, [x0, #24]cmp x9, x1b.ne .Lasm_GetGlobal.ssa_block_2@@ -5769,7 +5775,7 @@ asm_handler_GetGlobal:ldr w9, [x1, #52]cmp w9, w5b.ne .Lasm_GetGlobal.ssa_block_2- ldr x0, [x3, #32]+ ldr x0, [x3, #24]cbz x0, .Lasm_GetGlobal.assert_failure_2ldr x0, [x0, x4, lsl #3]lsr x9, x0, #48@@ -5817,8 +5823,9 @@ asm_handler_ResolveGlobalBinding:ldr x9, [x3, #56]cmp x9, x1b.ne .Lasm_ResolveGlobalBinding.ssa_block_1- ldr x1, [x2, #24]+ ldr w1, [x2, #20]cbz x1, .Lasm_ResolveGlobalBinding.assert_failure_1+ add x1, x24, w1, uxtw #3ldr x9, [x0, #24]cmp x9, x1b.ne .Lasm_ResolveGlobalBinding.ssa_block_2@@ -5864,8 +5871,9 @@ asm_handler_SetGlobal:ldr x9, [x1, #56]cmp x9, x2b.ne .Lasm_SetGlobal.ssa_block_1- ldr x2, [x3, #24]+ ldr w2, [x3, #20]cbz x2, .Lasm_SetGlobal.assert_failure_1+ add x2, x24, w2, uxtw #3ldr x9, [x0, #24]cmp x9, x2b.ne .Lasm_SetGlobal.ssa_block_2@@ -5873,7 +5881,7 @@ asm_handler_SetGlobal:ldr w9, [x2, #52]cmp w9, w5b.ne .Lasm_SetGlobal.ssa_block_2- ldr x1, [x3, #32]+ ldr x1, [x3, #24]cbz x1, .Lasm_SetGlobal.assert_failure_2ldr x2, [x1, x4, lsl #3]lsr x9, x2, #48@@ -5952,7 +5960,7 @@ asm_handler_Call:b .Lasm_Call.ssa_block_11:tbz x0, #6, .Lasm_Call.ssa_block_3- ldr w0, [x1, #76]+ ldr w0, [x1, #68]cbz x0, .Lasm_Call.assert_failure_0add x0, x24, w0, uxtw #3ldr w2, [x0, #12]@@ -5975,8 +5983,9 @@ asm_handler_Call:mov w9, #32766cmp w4, w9b.ne .Lasm_Call.ssa_block_13- ldr x3, [x1, #24]+ ldr w3, [x1, #20]cbz x3, .Lasm_Call.assert_failure_1+ add x3, x24, w3, uxtw #3ldr x3, [x3, #16]cbz x3, .Lasm_Call.assert_failure_2ldr x3, [x3, #32]@@ -6023,16 +6032,17 @@ asm_handler_Call:stp w7, w3, [x0, #116]ldr w5, [x21, #24]str w5, [x0, #104]- ldr x5, [x1, #24]+ ldr w5, [x1, #20]cbz x5, .Lasm_Call.assert_failure_6+ add x5, x24, w5, uxtw #3ldr x5, [x5, #16]cbz x5, .Lasm_Call.assert_failure_7stp x1, x5, [x0, #0]- ldr w5, [x1, #80]+ ldr w5, [x1, #72]add x9, x24, w5, uxtw #3cmp w5, #0csel x5, x9, xzr, ne- ldr w7, [x1, #84]+ ldr w7, [x1, #76]add x9, x24, w7, uxtw #3cmp w7, #0csel x7, x9, xzr, ne@@ -6045,7 +6055,7 @@ asm_handler_Call:str x6, [x0, #144]stp x2, x2, [x0, #152]add x2, x0, #16- add x1, x1, #96+ add x1, x1, #88ldp x1, x5, [x1, #0]stp x1, x5, [x2, #0]str wzr, [x0, #64]@@ -6138,8 +6148,9 @@ asm_handler_Call:str x2, [x4, #16]stp w3, w3, [x0, #116]str w3, [x0, #104]- ldr x2, [x1, #24]+ ldr w2, [x1, #20]cbz x2, .Lasm_Call.assert_failure_12+ add x2, x24, w2, uxtw #3ldr x2, [x2, #16]cbz x2, .Lasm_Call.assert_failure_13stp x1, x2, [x0, #0]@@ -6195,7 +6206,7 @@ asm_handler_Call:str x0, [x2]mov x28, x0add x27, x28, #128- ldr w0, [x1, #104]+ ldr w0, [x1, #96]ldr x1, [x2, #80]cbz x1, .Lasm_Call.assert_failure_15and w0, w0, #0xffff@@ -6312,18 +6323,18 @@ asm_handler_Call_hot_end:.p2align 4asm_handler_ObjectPropertyIteratorNext:ldr w0, [x21, #12]- ldr x1, [x27, x0, lsl #3]- lsr x9, x1, #48+ ldr x2, [x27, x0, lsl #3]+ lsr x9, x2, #48mov w10, #65529cmp x9, x10b.ne .Lasm_ObjectPropertyIteratorNext.ssa_block_1- and x1, x1, #0x7ffffffff- add x1, x1, x24+ and x2, x2, #0x7ffffffff+ add x2, x2, x24ldr w0, [x21, #16]ldr x0, [x27, x0, lsl #3]- lsr x2, x0, #48+ lsr x1, x0, #48mov w9, #65528- cmp w2, w9+ cmp w1, w9b.ne .Lasm_ObjectPropertyIteratorNext.assert_predicate_failure_9and x0, x0, #0x7ffffffffadd x0, x0, x24@@ -6332,23 +6343,24 @@ asm_handler_ObjectPropertyIteratorNext:b.eq .Lasm_ObjectPropertyIteratorNext.ssa_block_1ldr x4, [x0, #24]cbz x4, .Lasm_ObjectPropertyIteratorNext.assert_predicate_failure_18- ldr x2, [x1, #24]- cbz x2, .Lasm_ObjectPropertyIteratorNext.assert_failure_0- cmp x2, x4+ ldr w1, [x2, #20]+ cbz x1, .Lasm_ObjectPropertyIteratorNext.assert_failure_0+ add x1, x24, w1, uxtw #3+ cmp x1, x4b.ne .Lasm_ObjectPropertyIteratorNext.ssa_block_1ldrb w9, [x0, #11]cbz w9, .Lasm_ObjectPropertyIteratorNext.ssa_block_4- ldr w2, [x2, #52]+ ldr w1, [x1, #52]ldr w9, [x0, #20]- cmp w9, w2+ cmp w9, w1b.ne .Lasm_ObjectPropertyIteratorNext.ssa_block_1.Lasm_ObjectPropertyIteratorNext.ssa_block_4:cmp x3, #2b.ne .Lasm_ObjectPropertyIteratorNext.ssa_block_6- ldrb w9, [x1, #14]+ ldrb w9, [x2, #14]cmp x9, #1b.ne .Lasm_ObjectPropertyIteratorNext.ssa_block_1- ldr w1, [x1, #16]+ ldr w1, [x2, #16]ldr w9, [x0, #16]cmp w9, w1b.ne .Lasm_ObjectPropertyIteratorNext.ssa_block_1@@ -6488,7 +6500,7 @@ asm_handler_IteratorNextUnpack:b.lo .Lasm_IteratorNextUnpack.ssa_block_1cmp x3, #3b.hs .Lasm_IteratorNextUnpack.ssa_block_1- ldr x1, [x1, #40]+ ldr x1, [x1, #32]cbz x1, .Lasm_IteratorNextUnpack.ssa_block_1ldur w3, [x1, #-8]cmp x0, x3@@ -14044,17 +14056,17 @@ asm_handler_GetById_cold:tbnz x0, #9, 1fb .Lasm_GetById.ssa_block_31:- ldr w0, [x1, #112]+ ldr w0, [x1, #104]ldr x0, [x3, x0, lsl #3]cbz x0, .Lasm_GetById.ssa_block_3- ldr w2, [x1, #120]+ ldr w2, [x1, #112]ldr x5, [x0, x2, lsl #3]cbz x5, .Lasm_GetById.ssa_block_3- ldr w4, [x1, #124]+ ldr w4, [x1, #116]ldr x5, [x5, x4, lsl #3]cmp x5, x3b.ne .Lasm_GetById.ssa_block_3- ldr w1, [x1, #116]+ ldr w1, [x1, #108]ldr x0, [x0, x1, lsl #3]cbnz x0, .Lasm_GetById.ssa_block_50movz x0, #0x7fff, lsl #48@@ -14079,15 +14091,15 @@ asm_handler_GetById_cold:ldr x10, [x19, x9, lsl #3]br x10.Lasm_GetById.ssa_block_25:- ldr w2, [x1, #104]+ ldr w4, [x1, #96]mov x0, x20ldr x0, [x0, #80]cbz x0, .Lasm_GetById.assert_failure_5- and w2, w2, #0xffff- lsl x2, x2, #4- adds x2, x2, x0- ldr w4, [x2, #8]- cmp x4, #1+ and w4, w4, #0xffff+ lsl x4, x4, #4+ adds x4, x4, x0+ ldr w2, [x4, #8]+ cmp x2, #1b.hs .Lasm_GetById.assert_predicate_failure_160mov x0, x20ldp x0, x6, [x0, #16]@@ -14108,17 +14120,18 @@ asm_handler_GetById_cold:b.hi .Lasm_GetById.ssa_block_3mov x6, x20str x5, [x6, #16]- stp w4, w4, [x0, #116]+ stp w2, w2, [x0, #116]str wzr, [x0, #104]- ldr x4, [x1, #24]- cbz x4, .Lasm_GetById.assert_failure_8- ldr x4, [x4, #16]- cbz x4, .Lasm_GetById.assert_failure_9- stp x1, x4, [x0, #0]- ldp x1, x4, [x28, #32]+ ldr w2, [x1, #20]+ cbz x2, .Lasm_GetById.assert_failure_8+ add x2, x24, w2, uxtw #3+ ldr x2, [x2, #16]+ cbz x2, .Lasm_GetById.assert_failure_9+ stp x1, x2, [x0, #0]+ ldp x1, x2, [x28, #32]cbz x1, .Lasm_GetById.assert_predicate_failure_202- cbz x4, .Lasm_GetById.assert_predicate_failure_204- stp x1, x4, [x0, #32]+ cbz x2, .Lasm_GetById.assert_predicate_failure_204+ stp x1, x2, [x0, #32]ldr x1, [x28, #48]str x1, [x0, #48]and x3, x3, #0x7ffffffff@@ -14126,8 +14139,8 @@ asm_handler_GetById_cold:orr x3, x3, x1str x3, [x0, #80]mov x1, #0- add x3, x0, #16- stp x1, x1, [x3, #0]+ add x2, x0, #16+ stp x1, x1, [x2, #0]str xzr, [x0, #88]str wzr, [x0, #64]str wzr, [x0, #68]@@ -14140,16 +14153,16 @@ asm_handler_GetById_cold:strb wzr, [x0, #124]strb wzr, [x0, #125]sub w1, w21, w26- ldp w3, w4, [x21, #4]+ ldp w2, w3, [x21, #4]str w1, [x28, #64]str x28, [x0, #96]add x1, x1, #1- stp w1, w3, [x0, #108]+ stp w1, w2, [x0, #108]mov x1, x20str x0, [x1]mov x28, x0add x27, x28, #128- ldr x2, [x2]+ ldr x2, [x4]cbz x2, .Lasm_GetById.assert_failure_10mov x9, x2mov x0, x20@@ -14576,39 +14589,40 @@ asm_handler_GetByValue_cold:and x0, x0, #0x7ffffffffadd x0, x0, x24ldr x3, [x0, #16]- ldr x2, [x1, #24]- cbz x2, .Lasm_GetByValue.assert_failure_6- mov x0, x2- eor x0, x0, x3- mov w4, w0+ ldr w0, [x2, #20]+ cbz x0, .Lasm_GetByValue.assert_failure_6+ add x0, x24, w0, uxtw #3+ mov x1, x0+ eor x1, x1, x3+ mov w4, w1movz x9, #0x79b9, lsl #0movk x9, #0x9e37, lsl #16movk x9, #0xffff, lsl #32movk x9, #0xffff, lsl #48mul x4, x4, x9lsr w4, w4, #21- mov x0, x20- ldr x0, [x0, #136]- cbz x0, .Lasm_GetByValue.assert_failure_7+ mov x1, x20+ ldr x1, [x1, #136]+ cbz x1, .Lasm_GetByValue.assert_failure_7lsl x4, x4, #6- adds x0, x0, x4- ldr x9, [x0, #48]+ adds x1, x1, x4+ ldr x9, [x1, #48]cmp x9, x3b.ne .Lasm_GetByValue.ssa_block_2- ldr x9, [x0, #16]- cmp x9, x2+ ldr x9, [x1, #16]+ cmp x9, x0b.ne .Lasm_GetByValue.ssa_block_2- ldr w3, [x0]+ ldr w3, [x1]cmp w3, #3b.ne .Lasm_GetByValue.ssa_block_2- ldr w3, [x0, #8]- ldr w9, [x2, #52]+ ldr w3, [x1, #8]+ ldr w9, [x0, #52]cmp w9, w3b.ne .Lasm_GetByValue.ssa_block_2- ldr x1, [x1, #32]- cbz x1, .Lasm_GetByValue.assert_failure_8- ldr w0, [x0, #4]- ldr x0, [x1, x0, lsl #3]+ ldr x0, [x2, #24]+ cbz x0, .Lasm_GetByValue.assert_failure_8+ ldr w1, [x1, #4]+ ldr x0, [x0, x1, lsl #3]lsr x9, x0, #48mov w10, #65532cmp x9, x10diff --git a/Libraries/LibJS/Flap/tests/interpreter-assembly/x86_64.S b/Libraries/LibJS/Flap/tests/interpreter-assembly/x86_64.Sindex 7a7bb6f986a..ee2279abf98 100644--- a/Libraries/LibJS/Flap/tests/interpreter-assembly/x86_64.S+++ b/Libraries/LibJS/Flap/tests/interpreter-assembly/x86_64.S@@ -4955,7 +4955,7 @@ asm_handler_PutByValue:mov edx, DWORD PTR [rcx + 16]cmp rax, rdxjae .Lasm_PutByValue.ssa_block_1- mov rcx, QWORD PTR [rcx + 40]+ mov rcx, QWORD PTR [rcx + 32]test rcx, rcxjz .Lasm_PutByValue.assert_predicate_failure_66mov edx, DWORD PTR [rcx - 8]@@ -4973,7 +4973,7 @@ asm_handler_PutByValue:mov edx, DWORD PTR [rcx + 16]cmp rax, rdxjae .Lasm_PutByValue.ssa_block_1- mov rcx, QWORD PTR [rcx + 40]+ mov rcx, QWORD PTR [rcx + 32]test rcx, rcxjz .Lasm_PutByValue.ssa_block_5mov edx, DWORD PTR [rcx - 8]@@ -4991,17 +4991,17 @@ asm_handler_PutByValue:movzx eax, BYTE PTR [r14 + r13]jmp [r12 + rax * 8].Lasm_PutByValue.ssa_block_11:- mov rsi, QWORD PTR [rcx + 88]+ mov rsi, QWORD PTR [rcx + 80]cmp rsi, -1je .Lasm_PutByValue.ssa_block_6mov rdx, QWORD PTR [rbp - 48]mov rdx, QWORD PTR [rdx + 64]test rdx, rdxjz .Lasm_PutByValue.assert_failure_0- mov edi, DWORD PTR [rcx + 76]+ mov edi, DWORD PTR [rcx + 68]cmp rax, rdijae .Lasm_PutByValue.ssa_block_1- movzx ecx, BYTE PTR [rcx + 72]+ movzx ecx, BYTE PTR [rcx + 64]mov edi, DWORD PTR [r14 + r13 + 12]mov rdi, QWORD PTR [rbx + rdi * 8]mov r8, rdi@@ -5224,9 +5224,10 @@ asm_handler_PutByValue:movabs r11, 34359738367and rsi, r11add rsi, r15- mov rcx, QWORD PTR [rsi + 24]+ mov ecx, DWORD PTR [rsi + 20]test rcx, rcxjz .Lasm_PutByValue.assert_failure_2+ lea rcx, [r15 + rcx * 8]mov rdi, QWORD PTR [rax + 24]mov rdx, QWORD PTR [rax + 32]cmp rdi, rcx@@ -5239,7 +5240,7 @@ asm_handler_PutByValue:jne .Lasm_PutByValue.ssa_block_3cmp BYTE PTR [rax + 12], 0jz .Lasm_PutByValue.ssa_block_3- mov rax, QWORD PTR [rsi + 32]+ mov rax, QWORD PTR [rsi + 24]test rax, raxjz .Lasm_PutByValue.assert_failure_3mov rcx, QWORD PTR [rax + rdx * 8]@@ -5266,9 +5267,10 @@ asm_handler_GetById:movabs r11, 34359738367and rsi, r11add rsi, r15- mov rax, QWORD PTR [rsi + 24]+ mov eax, DWORD PTR [rsi + 20]test rax, raxjz .Lasm_GetById.assert_failure_0+ lea rax, [r15 + rax * 8]mov rcx, QWORD PTR [rbx - 40]test rcx, rcxjz .Lasm_GetById.assert_predicate_failure_123@@ -5296,7 +5298,7 @@ asm_handler_GetById:mov r8d, DWORD PTR [rdx + 8]cmp DWORD PTR [rax + 52], r8djne .Lasm_GetById.ssa_block_1- mov rax, QWORD PTR [rcx + 32]+ mov rax, QWORD PTR [rcx + 24]test rax, raxjz .Lasm_GetById.assert_failure_2mov rax, QWORD PTR [rax + rdi * 8]@@ -5340,7 +5342,7 @@ asm_handler_GetById:test rax, raxjnz .Lasm_GetById.ssa_block_12.Lasm_GetById.ssa_block_13:- mov rax, QWORD PTR [rsi + 32]+ mov rax, QWORD PTR [rsi + 24]test rax, raxjz .Lasm_GetById.assert_failure_4mov ecx, DWORD PTR [rcx + 4]@@ -5367,9 +5369,10 @@ asm_handler_PutById:movabs r11, 34359738367and rdx, r11add rdx, r15- mov rcx, QWORD PTR [rdx + 24]+ mov ecx, DWORD PTR [rdx + 20]test rcx, rcxjz .Lasm_PutById.assert_failure_0+ lea rcx, [r15 + rcx * 8]mov rax, QWORD PTR [rbx - 40]test rax, raxjz .Lasm_PutById.assert_predicate_failure_14@@ -5395,7 +5398,7 @@ asm_handler_PutById:jne .Lasm_PutById.ssa_block_2cmp BYTE PTR [rax + 12], 0jz .Lasm_PutById.ssa_block_2- mov rax, QWORD PTR [rdx + 32]+ mov rax, QWORD PTR [rdx + 24]test rax, raxjz .Lasm_PutById.assert_failure_2mov rcx, QWORD PTR [rax + rsi * 8]@@ -5414,8 +5417,8 @@ asm_handler_PutById_hot_end:.p2align 6asm_handler_GetByValue:mov eax, DWORD PTR [r14 + r13 + 16]- mov rdx, QWORD PTR [rbx + rax * 8]- mov r11, rdx+ mov rcx, QWORD PTR [rbx + rax * 8]+ mov r11, rcxshr r11, 48cmp r11w, 32762jne .Lasm_GetByValue.ssa_block_5@@ -5428,11 +5431,11 @@ asm_handler_GetByValue:movabs r11, 34359738367and rsi, r11add rsi, r15- movzx ecx, WORD PTR [rsi + 12]- mov eax, edx- test ecx, 8+ movzx edx, WORD PTR [rsi + 12]+ mov eax, ecx+ test edx, 8jnz .Lasm_GetByValue.ssa_block_20- test ecx, 16+ test edx, 16jnz .Lasm_GetByValue.ssa_block_1movzx ecx, BYTE PTR [rsi + 14]cmp rcx, 1@@ -5440,7 +5443,7 @@ asm_handler_GetByValue:mov ecx, DWORD PTR [rsi + 16]cmp rax, rcxjae .Lasm_GetByValue.ssa_block_1- mov rcx, QWORD PTR [rsi + 40]+ mov rcx, QWORD PTR [rsi + 32]test rcx, rcxjz .Lasm_GetByValue.assert_predicate_failure_70mov edx, DWORD PTR [rcx - 8]@@ -5458,7 +5461,7 @@ asm_handler_GetByValue:mov ecx, DWORD PTR [rsi + 16]cmp rax, rcxjae .Lasm_GetByValue.ssa_block_1- mov rcx, QWORD PTR [rsi + 40]+ mov rcx, QWORD PTR [rsi + 32]test rcx, rcxjz .Lasm_GetByValue.ssa_block_1mov edx, DWORD PTR [rcx - 8]@@ -5475,17 +5478,17 @@ asm_handler_GetByValue:movzx eax, BYTE PTR [r14 + r13]jmp [r12 + rax * 8].Lasm_GetByValue.ssa_block_20:- mov rdx, QWORD PTR [rsi + 88]+ mov rdx, QWORD PTR [rsi + 80]cmp rdx, -1je .Lasm_GetByValue.ssa_block_4mov rcx, QWORD PTR [rbp - 48]mov rcx, QWORD PTR [rcx + 64]test rcx, rcxjz .Lasm_GetByValue.assert_failure_0- mov edi, DWORD PTR [rsi + 76]+ mov edi, DWORD PTR [rsi + 68]cmp rax, rdijae .Lasm_GetByValue.ssa_block_4- movzx esi, BYTE PTR [rsi + 72]+ movzx esi, BYTE PTR [rsi + 64]cmp rsi, 2jae .Lasm_GetByValue.ssa_switch_20_after_preferredlea rax, [rdx + rax * 1]@@ -5615,7 +5618,7 @@ asm_handler_GetByValue:.Lasm_GetByValue.ssa_block_8:cmp ax, 65530jne .Lasm_GetByValue.ssa_block_1- movsxd rax, edx+ movsxd rax, ecxtest eax, eaxjs .Lasm_GetByValue.ssa_block_1movabs r11, 34359738367@@ -5677,8 +5680,8 @@ asm_handler_GetByValue:jmp [r12 + rax * 8].Lasm_GetByValue.ssa_block_5:mov eax, DWORD PTR [r14 + r13 + 12]- mov rcx, QWORD PTR [rbx + rax * 8]- mov r11, rcx+ mov rdx, QWORD PTR [rbx + rax * 8]+ mov r11, rdxshr r11, 48cmp r11w, 65529jne .Lasm_GetByValue.ssa_block_1@@ -5689,8 +5692,8 @@ asm_handler_GetByValue:mov edi, DWORD PTR [r14 + r13 + 24]mov rsi, QWORD PTR [rsi + rdi * 8]movabs r11, 34359738367- and rcx, r11- add rcx, r15+ and rdx, r11+ add rdx, r15cmp rsi, 3je .Lasm_GetByValue.ssa_block_6test rax, rax@@ -5705,24 +5708,25 @@ asm_handler_GetByValue:cmp rax, 3je .Lasm_GetByValue.ssa_block_2and rax, -4- cmp QWORD PTR [rax + 48], rdx+ cmp QWORD PTR [rax + 48], rcxjne .Lasm_GetByValue.ssa_block_3- mov rdx, QWORD PTR [rcx + 24]- test rdx, rdx+ mov ecx, DWORD PTR [rdx + 20]+ test rcx, rcxjz .Lasm_GetByValue.assert_failure_4+ lea rcx, [r15 + rcx * 8]mov rdi, QWORD PTR [rax + 24]mov rsi, QWORD PTR [rax + 32]- cmp rdi, rdx+ cmp rdi, rcxjne .Lasm_GetByValue.ssa_block_3mov edi, DWORD PTR [rax]cmp edi, 6je .Lasm_GetByValue.ssa_block_3mov edi, DWORD PTR [rax + 8]- cmp DWORD PTR [rdx + 52], edi+ cmp DWORD PTR [rcx + 52], edijne .Lasm_GetByValue.ssa_block_3test rsi, rsijnz .Lasm_GetByValue.ssa_block_3- mov rcx, QWORD PTR [rcx + 32]+ mov rcx, QWORD PTR [rdx + 24]test rcx, rcxjz .Lasm_GetByValue.assert_failure_5mov eax, DWORD PTR [rax + 4]@@ -5741,18 +5745,18 @@ asm_handler_GetByValue_hot_end:.p2align 6asm_handler_GetLength:mov eax, DWORD PTR [r14 + r13 + 12]- mov rcx, QWORD PTR [rbx + rax * 8]- mov rax, rcx+ mov rdx, QWORD PTR [rbx + rax * 8]+ mov rax, rdxshr rax, 48cmp ax, 65529jne .Lasm_GetLength.ssa_block_2movabs r11, 34359738367- and rcx, r11- add rcx, r15- movzx eax, WORD PTR [rcx + 12]+ and rdx, r11+ add rdx, r15+ movzx eax, WORD PTR [rdx + 12]test eax, 4jz .Lasm_GetLength.ssa_block_6- mov eax, DWORD PTR [rcx + 16]+ mov eax, DWORD PTR [rdx + 16]test eax, eaxjs .Lasm_GetLength.ssa_block_3movabs r11, 9221683186994511872@@ -5763,9 +5767,10 @@ asm_handler_GetLength:movzx eax, BYTE PTR [r14 + r13]jmp [r12 + rax * 8].Lasm_GetLength.ssa_block_6:- mov rdx, QWORD PTR [rcx + 24]- test rdx, rdx+ mov ecx, DWORD PTR [rdx + 20]+ test rcx, rcxjz .Lasm_GetLength.assert_failure_0+ lea rcx, [r15 + rcx * 8]mov rax, QWORD PTR [rbx - 40]test rax, raxjz .Lasm_GetLength.assert_predicate_failure_21@@ -5781,7 +5786,7 @@ asm_handler_GetLength:jz .Lasm_GetLength.assert_predicate_failure_43mov rdi, QWORD PTR [rax + 24]mov rsi, QWORD PTR [rax + 32]- cmp rdi, rdx+ cmp rdi, rcxjne .Lasm_GetLength.ssa_block_1mov edi, DWORD PTR [rax]cmp edi, 6@@ -5790,9 +5795,9 @@ asm_handler_GetLength:jnz .Lasm_GetLength.ssa_block_1mov esi, DWORD PTR [rax + 4]mov eax, DWORD PTR [rax + 8]- cmp DWORD PTR [rdx + 52], eax+ cmp DWORD PTR [rcx + 52], eaxjne .Lasm_GetLength.ssa_block_1- mov rax, QWORD PTR [rcx + 32]+ mov rax, QWORD PTR [rdx + 24]test rax, raxjz .Lasm_GetLength.assert_failure_2mov rax, QWORD PTR [rax + rsi * 8]@@ -5809,9 +5814,9 @@ asm_handler_GetLength:cmp ax, 65530jne .Lasm_GetLength.ssa_block_1movabs r11, 34359738367- and rcx, r11- add rcx, r15- mov eax, DWORD PTR [rcx + 12]+ and rdx, r11+ add rdx, r15+ mov eax, DWORD PTR [rdx + 12]test eax, eaxjs .Lasm_GetLength.ssa_block_1movabs r11, 9221683186994511872@@ -5842,16 +5847,17 @@ asm_handler_GetGlobal:mov rcx, QWORD PTR [rax + 64]cmp QWORD PTR [rdx + 56], rcxjne .Lasm_GetGlobal.ssa_block_1- mov rcx, QWORD PTR [rsi + 24]+ mov ecx, DWORD PTR [rsi + 20]test rcx, rcxjz .Lasm_GetGlobal.assert_failure_1+ lea rcx, [r15 + rcx * 8]cmp QWORD PTR [rax + 24], rcxjne .Lasm_GetGlobal.ssa_block_2mov edi, DWORD PTR [rax + 4]mov r8d, DWORD PTR [rax + 8]cmp DWORD PTR [rcx + 52], r8djne .Lasm_GetGlobal.ssa_block_2- mov rax, QWORD PTR [rsi + 32]+ mov rax, QWORD PTR [rsi + 24]test rax, raxjz .Lasm_GetGlobal.assert_failure_2mov rax, QWORD PTR [rax + rdi * 8]@@ -5902,9 +5908,10 @@ asm_handler_ResolveGlobalBinding:mov rcx, QWORD PTR [rax + 64]cmp QWORD PTR [rsi + 56], rcxjne .Lasm_ResolveGlobalBinding.ssa_block_1- mov rcx, QWORD PTR [rdx + 24]+ mov ecx, DWORD PTR [rdx + 20]test rcx, rcxjz .Lasm_ResolveGlobalBinding.assert_failure_1+ lea rcx, [r15 + rcx * 8]cmp QWORD PTR [rax + 24], rcxjne .Lasm_ResolveGlobalBinding.ssa_block_2mov edx, DWORD PTR [rax + 8]@@ -5946,16 +5953,17 @@ asm_handler_SetGlobal:mov rdx, QWORD PTR [rax + 64]cmp QWORD PTR [rcx + 56], rdxjne .Lasm_SetGlobal.ssa_block_1- mov rdx, QWORD PTR [rsi + 24]+ mov edx, DWORD PTR [rsi + 20]test rdx, rdxjz .Lasm_SetGlobal.assert_failure_1+ lea rdx, [r15 + rdx * 8]cmp QWORD PTR [rax + 24], rdxjne .Lasm_SetGlobal.ssa_block_2mov edi, DWORD PTR [rax + 4]mov r8d, DWORD PTR [rax + 8]cmp DWORD PTR [rdx + 52], r8djne .Lasm_SetGlobal.ssa_block_2- mov rcx, QWORD PTR [rsi + 32]+ mov rcx, QWORD PTR [rsi + 24]test rcx, rcxjz .Lasm_SetGlobal.assert_failure_2mov rdx, QWORD PTR [rcx + rdi * 8]@@ -6039,7 +6047,7 @@ asm_handler_Call:jz .Lasm_Call.ssa_block_1test eax, 64jz .Lasm_Call.ssa_block_3- mov eax, DWORD PTR [rcx + 76]+ mov eax, DWORD PTR [rcx + 68]test rax, raxjz .Lasm_Call.assert_failure_0lea rax, [r15 + rax * 8]@@ -6065,9 +6073,10 @@ asm_handler_Call:and di, 65534cmp di, 32766jne .Lasm_Call.ssa_block_13- mov rsi, QWORD PTR [rcx + 24]+ mov esi, DWORD PTR [rcx + 20]test rsi, rsijz .Lasm_Call.assert_failure_1+ lea rsi, [r15 + rsi * 8]mov rsi, QWORD PTR [rsi + 16]test rsi, rsijz .Lasm_Call.assert_failure_2@@ -6123,19 +6132,20 @@ asm_handler_Call:mov DWORD PTR [rax + 120], esimov r8d, DWORD PTR [r14 + r13 + 24]mov DWORD PTR [rax + 104], r8d- mov r8, QWORD PTR [rcx + 24]+ mov r8d, DWORD PTR [rcx + 20]test r8, r8jz .Lasm_Call.assert_failure_6+ lea r8, [r15 + r8 * 8]mov r8, QWORD PTR [r8 + 16]test r8, r8jz .Lasm_Call.assert_failure_7mov QWORD PTR [rax], rcxmov QWORD PTR [rax + 8], r8- mov r8d, DWORD PTR [rcx + 80]+ mov r8d, DWORD PTR [rcx + 72]lea r11, [r15 + r8 * 8]test r8d, r8dcmovnz r8, r11- mov r10d, DWORD PTR [rcx + 84]+ mov r10d, DWORD PTR [rcx + 76]lea r11, [r15 + r10 * 8]test r10d, r10dcmovnz r10, r11@@ -6153,7 +6163,7 @@ asm_handler_Call:mov QWORD PTR [rax + 152], rdxmov QWORD PTR [rax + 160], rdxlea rdx, [rax + 16]- lea rcx, [rcx + 96]+ lea rcx, [rcx + 88]mov r8, QWORD PTR [rcx + 8]mov rcx, QWORD PTR [rcx]mov QWORD PTR [rdx], rcx@@ -6254,9 +6264,10 @@ asm_handler_Call:mov DWORD PTR [rax + 116], esimov DWORD PTR [rax + 120], esimov DWORD PTR [rax + 104], esi- mov rdx, QWORD PTR [rcx + 24]+ mov edx, DWORD PTR [rcx + 20]test rdx, rdxjz .Lasm_Call.assert_failure_12+ lea rdx, [r15 + rdx * 8]mov rdx, QWORD PTR [rdx + 16]test rdx, rdxjz .Lasm_Call.assert_failure_13@@ -6321,7 +6332,7 @@ asm_handler_Call:mov rdx, QWORD PTR [rbp - 48]mov QWORD PTR [rdx], raxlea rbx, [rax + 128]- mov eax, DWORD PTR [rcx + 104]+ mov eax, DWORD PTR [rcx + 96]mov rcx, QWORD PTR [rdx + 80]test rcx, rcxjz .Lasm_Call.assert_failure_15@@ -6447,19 +6458,19 @@ asm_handler_Call_hot_end:.p2align 6asm_handler_ObjectPropertyIteratorNext:mov eax, DWORD PTR [r14 + r13 + 12]- mov rcx, QWORD PTR [rbx + rax * 8]- mov r11, rcx+ mov rdx, QWORD PTR [rbx + rax * 8]+ mov r11, rdxshr r11, 48cmp r11w, 65529jne .Lasm_ObjectPropertyIteratorNext.ssa_block_1movabs r11, 34359738367- and rcx, r11- add rcx, r15+ and rdx, r11+ add rdx, r15mov eax, DWORD PTR [r14 + r13 + 16]mov rax, QWORD PTR [rbx + rax * 8]- mov rdx, rax- shr rdx, 48- cmp dx, 65528+ mov rcx, rax+ shr rcx, 48+ cmp cx, 65528jne .Lasm_ObjectPropertyIteratorNext.assert_predicate_failure_9movabs r11, 34359738367and rax, r11@@ -6470,22 +6481,23 @@ asm_handler_ObjectPropertyIteratorNext:mov rdi, QWORD PTR [rax + 24]test rdi, rdijz .Lasm_ObjectPropertyIteratorNext.assert_predicate_failure_18- mov rdx, QWORD PTR [rcx + 24]- test rdx, rdx+ mov ecx, DWORD PTR [rdx + 20]+ test rcx, rcxjz .Lasm_ObjectPropertyIteratorNext.assert_failure_0- cmp rdx, rdi+ lea rcx, [r15 + rcx * 8]+ cmp rcx, rdijne .Lasm_ObjectPropertyIteratorNext.ssa_block_1cmp BYTE PTR [rax + 11], 0jz .Lasm_ObjectPropertyIteratorNext.ssa_block_4- mov edx, DWORD PTR [rdx + 52]- cmp DWORD PTR [rax + 20], edx+ mov ecx, DWORD PTR [rcx + 52]+ cmp DWORD PTR [rax + 20], ecxjne .Lasm_ObjectPropertyIteratorNext.ssa_block_1.Lasm_ObjectPropertyIteratorNext.ssa_block_4:cmp rsi, 2jne .Lasm_ObjectPropertyIteratorNext.ssa_block_6- cmp BYTE PTR [rcx + 14], 1+ cmp BYTE PTR [rdx + 14], 1jnz .Lasm_ObjectPropertyIteratorNext.ssa_block_1- mov ecx, DWORD PTR [rcx + 16]+ mov ecx, DWORD PTR [rdx + 16]cmp DWORD PTR [rax + 16], ecxjne .Lasm_ObjectPropertyIteratorNext.ssa_block_1.Lasm_ObjectPropertyIteratorNext.ssa_block_6:@@ -6621,7 +6633,7 @@ asm_handler_IteratorNextUnpack:jb .Lasm_IteratorNextUnpack.ssa_block_1cmp rsi, 3jae .Lasm_IteratorNextUnpack.ssa_block_1- mov rax, QWORD PTR [rax + 40]+ mov rax, QWORD PTR [rax + 32]test rax, raxjz .Lasm_IteratorNextUnpack.ssa_block_1mov esi, DWORD PTR [rax - 8]@@ -13693,19 +13705,19 @@ asm_handler_GetById_cold:movzx eax, WORD PTR [rsi + 12]test eax, 512jz .Lasm_GetById.ssa_block_3- mov eax, DWORD PTR [rcx + 112]+ mov eax, DWORD PTR [rcx + 104]mov rax, QWORD PTR [rsi + rax * 8]test rax, raxjz .Lasm_GetById.ssa_block_3- mov edx, DWORD PTR [rcx + 120]+ mov edx, DWORD PTR [rcx + 112]mov r8, QWORD PTR [rax + rdx * 8]test r8, r8jz .Lasm_GetById.ssa_block_3- mov edi, DWORD PTR [rcx + 124]+ mov edi, DWORD PTR [rcx + 116]mov r8, QWORD PTR [r8 + rdi * 8]cmp r8, rsijne .Lasm_GetById.ssa_block_3- mov ecx, DWORD PTR [rcx + 116]+ mov ecx, DWORD PTR [rcx + 108]mov rax, QWORD PTR [rax + rcx * 8]test rax, raxjnz .Lasm_GetById.ssa_block_50@@ -13732,16 +13744,16 @@ asm_handler_GetById_cold:movzx eax, BYTE PTR [r14 + r13]jmp [r12 + rax * 8].Lasm_GetById.ssa_block_25:- mov edx, DWORD PTR [rcx + 104]+ mov edi, DWORD PTR [rcx + 96]mov rax, QWORD PTR [rbp - 48]mov rax, QWORD PTR [rax + 80]test rax, raxjz .Lasm_GetById.assert_failure_5- and edx, 65535- shl rdx, 4- add rdx, rax- mov edi, DWORD PTR [rdx + 8]- cmp rdi, 1+ and edi, 65535+ shl rdi, 4+ add rdi, rax+ mov edx, DWORD PTR [rdi + 8]+ cmp rdx, 1jae .Lasm_GetById.assert_predicate_failure_160mov rax, QWORD PTR [rbp - 48]mov r9, QWORD PTR [rax + 24]@@ -13765,25 +13777,26 @@ asm_handler_GetById_cold:ja .Lasm_GetById.ssa_block_3mov r9, QWORD PTR [rbp - 48]mov QWORD PTR [r9 + 16], r8- mov DWORD PTR [rax + 116], edi- mov DWORD PTR [rax + 120], edi+ mov DWORD PTR [rax + 116], edx+ mov DWORD PTR [rax + 120], edxmov DWORD PTR [rax + 104], 0- mov rdi, QWORD PTR [rcx + 24]- test rdi, rdi+ mov edx, DWORD PTR [rcx + 20]+ test rdx, rdxjz .Lasm_GetById.assert_failure_8- mov rdi, QWORD PTR [rdi + 16]- test rdi, rdi+ lea rdx, [r15 + rdx * 8]+ mov rdx, QWORD PTR [rdx + 16]+ test rdx, rdxjz .Lasm_GetById.assert_failure_9mov QWORD PTR [rax], rcx- mov QWORD PTR [rax + 8], rdi+ mov QWORD PTR [rax + 8], rdxmov rcx, QWORD PTR [rbx - 96]- mov rdi, QWORD PTR [rbx - 88]+ mov rdx, QWORD PTR [rbx - 88]test rcx, rcxjz .Lasm_GetById.assert_predicate_failure_202- test rdi, rdi+ test rdx, rdxjz .Lasm_GetById.assert_predicate_failure_204mov QWORD PTR [rax + 32], rcx- mov QWORD PTR [rax + 40], rdi+ mov QWORD PTR [rax + 40], rdxmov rcx, QWORD PTR [rbx - 80]mov QWORD PTR [rax + 48], rcxmovabs rcx, 34359738367@@ -13792,9 +13805,9 @@ asm_handler_GetById_cold:or rsi, rcxmov QWORD PTR [rax + 80], rsixor rcx, rcx- lea rsi, [rax + 16]- mov QWORD PTR [rsi], rcx- mov QWORD PTR [rsi + 8], rcx+ lea rdx, [rax + 16]+ mov QWORD PTR [rdx], rcx+ mov QWORD PTR [rdx + 8], rcxmov QWORD PTR [rax + 88], 0mov DWORD PTR [rax + 64], 0mov DWORD PTR [rax + 68], 0@@ -13806,18 +13819,18 @@ asm_handler_GetById_cold:mov BYTE PTR [rax + 124], 0mov BYTE PTR [rax + 125], 0mov ecx, r13d- mov esi, DWORD PTR [r14 + r13 + 4]- mov edi, DWORD PTR [r14 + r13 + 8]+ mov edx, DWORD PTR [r14 + r13 + 4]+ mov esi, DWORD PTR [r14 + r13 + 8]mov DWORD PTR [rbx - 64], ecxlea r11, [rbx - 128]mov QWORD PTR [rax + 96], r11lea rcx, [rcx + 1]mov DWORD PTR [rax + 108], ecx- mov DWORD PTR [rax + 112], esi+ mov DWORD PTR [rax + 112], edxmov rcx, QWORD PTR [rbp - 48]mov QWORD PTR [rcx], raxlea rbx, [rax + 128]- mov rdx, QWORD PTR [rdx]+ mov rdx, QWORD PTR [rdi]test rdx, rdxjz .Lasm_GetById.assert_failure_10mov r11, rdx@@ -14247,35 +14260,36 @@ asm_handler_GetByValue_cold:and rax, r11add rax, r15mov rsi, QWORD PTR [rax + 16]- mov rdx, QWORD PTR [rcx + 24]- test rdx, rdx+ mov eax, DWORD PTR [rdx + 20]+ test rax, raxjz .Lasm_GetByValue.assert_failure_6- mov rax, rdx- xor rax, rsi- mov edi, eax+ lea rax, [r15 + rax * 8]+ mov rcx, rax+ xor rcx, rsi+ mov edi, ecximul rdi, rdi, -1640531527shr edi, 21- mov rax, QWORD PTR [rbp - 48]- mov rax, QWORD PTR [rax + 136]- test rax, rax+ mov rcx, QWORD PTR [rbp - 48]+ mov rcx, QWORD PTR [rcx + 136]+ test rcx, rcxjz .Lasm_GetByValue.assert_failure_7shl rdi, 6- add rax, rdi- cmp QWORD PTR [rax + 48], rsi+ add rcx, rdi+ cmp QWORD PTR [rcx + 48], rsijne .Lasm_GetByValue.ssa_block_2- cmp QWORD PTR [rax + 16], rdx+ cmp QWORD PTR [rcx + 16], raxjne .Lasm_GetByValue.ssa_block_2- mov esi, DWORD PTR [rax]+ mov esi, DWORD PTR [rcx]cmp esi, 3jne .Lasm_GetByValue.ssa_block_2- mov esi, DWORD PTR [rax + 8]- cmp DWORD PTR [rdx + 52], esi+ mov esi, DWORD PTR [rcx + 8]+ cmp DWORD PTR [rax + 52], esijne .Lasm_GetByValue.ssa_block_2- mov rcx, QWORD PTR [rcx + 32]- test rcx, rcx+ mov rax, QWORD PTR [rdx + 24]+ test rax, raxjz .Lasm_GetByValue.assert_failure_8- mov eax, DWORD PTR [rax + 4]- mov rax, QWORD PTR [rcx + rax * 8]+ mov ecx, DWORD PTR [rcx + 4]+ mov rax, QWORD PTR [rax + rcx * 8]mov r11, raxshr r11, 48cmp r11w, 65532diff --git a/Libraries/LibJS/Flap/tests/interpreter-layout.conf b/Libraries/LibJS/Flap/tests/interpreter-layout.confindex 02b56260c96..0de42725eab 100644--- a/Libraries/LibJS/Flap/tests/interpreter-layout.conf+++ b/Libraries/LibJS/Flap/tests/interpreter-layout.conf@@ -1,17 +1,17 @@# Generated by the libjs_rust build script -- DO NOT EDIT# Object layout-const OBJECT_SHAPE = 24-field Object.shape Shape OBJECT_SHAPE nonnull cell-const OBJECT_NAMED_PROPERTIES = 32+const OBJECT_SHAPE = 20+field Object.shape Shape OBJECT_SHAPE nonnull compressed+const OBJECT_NAMED_PROPERTIES = 24field Object.named_properties PropertyStorage OBJECT_NAMED_PROPERTIES nonnull scalar-const OBJECT_INDEXED_ELEMENTS = 40+const OBJECT_INDEXED_ELEMENTS = 32field Object.indexed_elements IndexedElements OBJECT_INDEXED_ELEMENTS nullable scalarconst OBJECT_INDEXED_STORAGE_KIND = 14field Object.indexed_storage_kind u8 OBJECT_INDEXED_STORAGE_KIND nullable scalarconst OBJECT_INDEXED_ARRAY_LIKE_SIZE = 16field Object.indexed_array_like_size u32 OBJECT_INDEXED_ARRAY_LIKE_SIZE nullable scalar-const OBJECT_SIZE = 72+const OBJECT_SIZE = 64# Accessor layoutconst ACCESSOR_GETTER = 16@@ -348,7 +348,7 @@ field GlobalVariableCache.environment_binding_index u32 GLOBAL_VARIABLE_CACHE_ENfield GlobalVariableCache.has_environment_binding_index u8 GLOBAL_VARIABLE_CACHE_HAS_ENVIRONMENT_BINDING nullable scalar# RawNativeFunction layout-const RAW_NATIVE_FUNCTION_NATIVE_FUNCTION_INDEX = 104+const RAW_NATIVE_FUNCTION_NATIVE_FUNCTION_INDEX = 96field RawNativeFunction.native_function_index u32 RAW_NATIVE_FUNCTION_NATIVE_FUNCTION_INDEX nullable scalarconst NATIVE_FUNCTION_TABLE_ENTRY_FUNCTION = 0const NATIVE_FUNCTION_TABLE_ENTRY_TYPE = 8@@ -358,23 +358,23 @@ field NativeFunctionTableEntry.function u64 NATIVE_FUNCTION_TABLE_ENTRY_FUNCTIONfield NativeFunctionTableEntry.type u32 NATIVE_FUNCTION_TABLE_ENTRY_TYPE nullable scalar native_function_table_entry# DirectGetterFunction layout-const DIRECT_GETTER_FUNCTION_WRAPPER_IMPLEMENTATION_WORD_OFFSET = 112+const DIRECT_GETTER_FUNCTION_WRAPPER_IMPLEMENTATION_WORD_OFFSET = 104field DirectGetterFunction.wrapper_implementation_word_offset u32 DIRECT_GETTER_FUNCTION_WRAPPER_IMPLEMENTATION_WORD_OFFSET nullable scalar-const DIRECT_GETTER_FUNCTION_IMPLEMENTATION_VALUE_WORD_OFFSET = 116+const DIRECT_GETTER_FUNCTION_IMPLEMENTATION_VALUE_WORD_OFFSET = 108field DirectGetterFunction.implementation_value_word_offset u32 DIRECT_GETTER_FUNCTION_IMPLEMENTATION_VALUE_WORD_OFFSET nullable scalar-const DIRECT_GETTER_FUNCTION_MAIN_WORLD_WRAPPER_WORD_OFFSET = 120+const DIRECT_GETTER_FUNCTION_MAIN_WORLD_WRAPPER_WORD_OFFSET = 112field DirectGetterFunction.main_world_wrapper_word_offset u32 DIRECT_GETTER_FUNCTION_MAIN_WORLD_WRAPPER_WORD_OFFSET nullable scalar-const DIRECT_GETTER_FUNCTION_WEAK_IMPL_VALUE_WORD_OFFSET = 124+const DIRECT_GETTER_FUNCTION_WEAK_IMPL_VALUE_WORD_OFFSET = 116field DirectGetterFunction.weak_impl_value_word_offset u32 DIRECT_GETTER_FUNCTION_WEAK_IMPL_VALUE_WORD_OFFSET nullable scalar# ECMAScriptFunctionObject layout-const ECMASCRIPT_FUNCTION_OBJECT_SHARED_DATA = 76+const ECMASCRIPT_FUNCTION_OBJECT_SHARED_DATA = 68field ECMAScriptFunctionObject.shared_data SharedFunctionInstanceData ECMASCRIPT_FUNCTION_OBJECT_SHARED_DATA nonnull compressed-const ECMASCRIPT_FUNCTION_OBJECT_ENVIRONMENT = 80+const ECMASCRIPT_FUNCTION_OBJECT_ENVIRONMENT = 72field ECMAScriptFunctionObject.environment Environment ECMASCRIPT_FUNCTION_OBJECT_ENVIRONMENT nullable compressed-const ECMASCRIPT_FUNCTION_OBJECT_PRIVATE_ENVIRONMENT = 84+const ECMASCRIPT_FUNCTION_OBJECT_PRIVATE_ENVIRONMENT = 76field ECMAScriptFunctionObject.private_environment PrivateEnvironment ECMASCRIPT_FUNCTION_OBJECT_PRIVATE_ENVIRONMENT nullable compressed-const ECMASCRIPT_FUNCTION_OBJECT_SCRIPT_OR_MODULE = 96+const ECMASCRIPT_FUNCTION_OBJECT_SCRIPT_OR_MODULE = 88field ECMAScriptFunctionObject.script_or_module ScriptOrModule ECMASCRIPT_FUNCTION_OBJECT_SCRIPT_OR_MODULE nullable scalar# SharedFunctionInstanceData layout@@ -466,12 +466,12 @@ field EnvironmentCoordinateEntry.hops u32 ENVIRONMENT_COORDINATE_HOPS nullable sfield EnvironmentCoordinateEntry.binding_index u32 ENVIRONMENT_COORDINATE_INDEX nullable scalar environment_coordinate# TypedArrayBase layout-const TYPED_ARRAY_ELEMENT_SIZE = 73-const TYPED_ARRAY_ARRAY_LENGTH = 76-const TYPED_ARRAY_BYTE_OFFSET = 84-const TYPED_ARRAY_KIND = 72+const TYPED_ARRAY_ELEMENT_SIZE = 65+const TYPED_ARRAY_ARRAY_LENGTH = 68+const TYPED_ARRAY_BYTE_OFFSET = 76+const TYPED_ARRAY_KIND = 64field Object.typed_array_kind u8 TYPED_ARRAY_KIND nullable scalar-const TYPED_ARRAY_CACHED_DATA_OFFSET = 88+const TYPED_ARRAY_CACHED_DATA_OFFSET = 80field Object.typed_array_cached_data_offset u64 TYPED_ARRAY_CACHED_DATA_OFFSET nullable scalarconst TYPED_ARRAY_CACHED_DATA_OFFSET_INVALID = 0xFFFFFFFFFFFFFFFFconst PRIMITIVE_STORAGE_CAGE_OFFSET_MASK = 0x3FFFFFFFFFF@@ -481,9 +481,9 @@ const HEAP_REGION_OFFSET_MASK = 0x7FFFFFFFF# ByteLength layoutconst BYTE_LENGTH_U32_INDEX = 2const BYTE_LENGTH_SIZE = 8-const TYPED_ARRAY_ARRAY_LENGTH_VALUE = 76+const TYPED_ARRAY_ARRAY_LENGTH_VALUE = 68field Object.typed_array_array_length u32 TYPED_ARRAY_ARRAY_LENGTH_VALUE nullable scalar-const TYPED_ARRAY_ARRAY_LENGTH_INDEX = 80+const TYPED_ARRAY_ARRAY_LENGTH_INDEX = 72# TypedArrayBase::Kind valuesconst TYPED_ARRAY_KIND_UINT8 = 0diff --git a/Libraries/LibJS/HostObjectABI.h b/Libraries/LibJS/HostObjectABI.hindex 2fc875b1550..0e6e0a0502e 100644--- a/Libraries/LibJS/HostObjectABI.h+++ b/Libraries/LibJS/HostObjectABI.h@@ -32,12 +32,12 @@ enum {// Layout of every host object of kind JS_HOST_CLASS_OBJECT. Direct getter functions read the wrappable slot without// checking what it holds, so it only ever holds the embedder's wrapped implementation object. Any other per-object state-// belongs in the host data slot.+// belongs in the host data slot. The host object's own fields follow the engine's object, which is 64 bytes.enum {- JS_HOST_OBJECT_HOST_CLASS_OFFSET = 72,- JS_HOST_OBJECT_WRAPPABLE_OFFSET = 80,- JS_HOST_OBJECT_HOST_DATA_OFFSET = 88,- JS_HOST_OBJECT_SIZE = 96,+ JS_HOST_OBJECT_HOST_CLASS_OFFSET = 64,+ JS_HOST_OBJECT_WRAPPABLE_OFFSET = JS_HOST_OBJECT_HOST_CLASS_OFFSET + 8,+ JS_HOST_OBJECT_HOST_DATA_OFFSET = JS_HOST_OBJECT_WRAPPABLE_OFFSET + 8,+ JS_HOST_OBJECT_SIZE = JS_HOST_OBJECT_HOST_DATA_OFFSET + 8,};typedef uint64_t JSValue;diff --git a/Libraries/LibJS/JIT/Rust/src/codegen/allocation.rs b/Libraries/LibJS/JIT/Rust/src/codegen/allocation.rsindex 73ecffd303a..e8d27b6d888 100644--- a/Libraries/LibJS/JIT/Rust/src/codegen/allocation.rs+++ b/Libraries/LibJS/JIT/Rust/src/codegen/allocation.rs@@ -119,7 +119,7 @@ impl<M: PortableMacroAssembler> Codegen<'_, M> {let fields_fit = u64::from(info.inline_storage_offset) <= template_bytes&& info.inline_storage_offset.is_multiple_of(8)&& info.named_properties_offset.is_multiple_of(8)- && info.shape_offset + 8 <= info.inline_storage_offset+ && info.shape_offset + 4 <= info.inline_storage_offset&& info.inline_capacity_offset < info.inline_storage_offset;let size_class = info.size_class_for(reserve).copied().filter(|_| fields_fit);let Some(size_class) = size_class else {@@ -149,7 +149,7 @@ impl<M: PortableMacroAssembler> Codegen<'_, M> {.take(info.inline_storage_offset as usize).collect::<Vec<u8>>();let shape_offset = info.shape_offset as usize;- image[shape_offset..shape_offset + 8].copy_from_slice(&shape.0.to_le_bytes());+ image[shape_offset..shape_offset + 4].copy_from_slice(&shape.compressed().to_le_bytes());image[info.inline_capacity_offset as usize] =u8::try_from(size_class.inline_capacity).map_err(|_| CompileFailure::CodeGeneration)?;let mut fields: Vec<ConstantField> = (0u32..)diff --git a/Libraries/LibJS/JIT/Rust/src/codegen/arrays.rs b/Libraries/LibJS/JIT/Rust/src/codegen/arrays.rsindex 527e7c3265f..b9041de0fdc 100644--- a/Libraries/LibJS/JIT/Rust/src/codegen/arrays.rs+++ b/Libraries/LibJS/JIT/Rust/src/codegen/arrays.rs@@ -160,8 +160,7 @@ impl<M: PortableMacroAssembler> Codegen<'_, M> {u32::from(layout.object_flag_has_magical_length),fail,);- self.masm- .load64(shape, &Address::new(object, offsets.object_shape as i32));+ self.emit_load_compressed_cell(shape, &Address::new(object, offsets.object_shape as i32));self.masm.load64(scratch, &Address::new(shape, layout.shape_prototype as i32));self.masm.branch64_imm(@@ -225,8 +224,7 @@ impl<M: PortableMacroAssembler> Codegen<'_, M> {let scratch = self.pinned.scratch;let offsets = self.runtime.offsets;let layout = self.runtime.layout;- self.masm- .load64(scratch, &Address::new(object, offsets.object_shape as i32));+ self.emit_load_compressed_cell(scratch, &Address::new(object, offsets.object_shape as i32));self.masm.load64(scratch, &Address::new(scratch, layout.shape_prototype as i32));self.masm.move_imm64(dst, expected);diff --git a/Libraries/LibJS/JIT/Rust/src/codegen/call_stub.rs b/Libraries/LibJS/JIT/Rust/src/codegen/call_stub.rsindex 1442f25d706..d1274842aca 100644--- a/Libraries/LibJS/JIT/Rust/src/codegen/call_stub.rs+++ b/Libraries/LibJS/JIT/Rust/src/codegen/call_stub.rs@@ -505,8 +505,7 @@ impl<M: PortableMacroAssembler> Codegen<'_, M> {self.masm.store64(&field(offsets.execution_context_variable_environment), scratch);self.masm.bind(prepared_environment);- self.masm- .load64(scratch, &Address::new(function_register, offsets.object_shape as i32));+ self.emit_load_compressed_cell(scratch, &Address::new(function_register, offsets.object_shape as i32));self.masm.load64(scratch, &Address::new(scratch, layout.shape_realm as i32));self.masm.store64(&field(offsets.execution_context_realm), scratch);@@ -792,8 +791,7 @@ impl<M: PortableMacroAssembler> Codegen<'_, M> {self.masm.store64(&field(offsets.execution_context_caller_frame), frame);self.masm.store64(&field(offsets.execution_context_function), function_register);- self.masm- .load64(temp, &Address::new(function_register, offsets.object_shape as i32));+ self.emit_load_compressed_cell(temp, &Address::new(function_register, offsets.object_shape as i32));self.masm.load64(temp, &Address::new(temp, layout.shape_realm as i32));self.masm.store64(&field(offsets.execution_context_realm), temp);self.masm.store32(&field(offsets.execution_context_slot_count), count);diff --git a/Libraries/LibJS/JIT/Rust/src/codegen/environments.rs b/Libraries/LibJS/JIT/Rust/src/codegen/environments.rsindex c34653ed2fe..6c5bf98bf7f 100644--- a/Libraries/LibJS/JIT/Rust/src/codegen/environments.rs+++ b/Libraries/LibJS/JIT/Rust/src/codegen/environments.rs@@ -237,8 +237,7 @@ impl<M: PortableMacroAssembler> Codegen<'_, M> {slow,);- self.masm- .load64(scratch, &Address::new(object, self.runtime.offsets.object_shape as i32));+ self.emit_load_compressed_cell(scratch, &Address::new(object, self.runtime.offsets.object_shape as i32));self.masm.branch64_memory(Condition::NotEqual,&Address::new(cache, layout.global_variable_cache_shape as i32),diff --git a/Libraries/LibJS/JIT/Rust/src/codegen/mod.rs b/Libraries/LibJS/JIT/Rust/src/codegen/mod.rsindex 31a7b231957..20a9bc1c00d 100644--- a/Libraries/LibJS/JIT/Rust/src/codegen/mod.rs+++ b/Libraries/LibJS/JIT/Rust/src/codegen/mod.rs@@ -1684,7 +1684,7 @@ impl<M: PortableMacroAssembler> Codegen<'_, M> {Op::AddNamed { offset, shape, .. } => self.emit_add_named(node_id, *offset, *shape)?,Op::ShapeSwitch { cases } => {let exit = self.exit_site(node_id);- self.emit_load_shape_of(node_id, self.pinned.scratch, 1);+ self.emit_load_compressed_shape_of(node_id, self.pinned.scratch, 1);for (shape, block) in cases {let label = self.label(*block);self.emit_branch_on_shape(*shape, label, exit);@@ -1884,8 +1884,7 @@ impl<M: PortableMacroAssembler> Codegen<'_, M> {0,exit,);- self.masm- .load64(object, &Address::new(object, offsets.object_shape as i32));+ self.emit_load_compressed_cell(object, &Address::new(object, offsets.object_shape as i32));self.masm.load64(object, &Address::new(object, layout.shape_prototype as i32));self.masm.branch_test64(Condition::Zero, object, u64::MAX, not_found);@@ -1938,12 +1937,19 @@ impl<M: PortableMacroAssembler> Codegen<'_, M> {temp}- /// `dst` = the shape of the object in input 0 of `node`, whose- /// `CellAddress` may be input `address_input`.- fn emit_load_shape_of(&mut self, node: NodeId, dst: Gpr, address_input: usize) {- let cell = self.cell_address_of(node, dst, address_input);- let shape = Address::new(cell, self.runtime.offsets.object_shape as i32);- self.masm.load64(dst, &shape);+ /// `dst` = the compressed shape of the object in input 0 of `node`,+ /// whose `CellAddress` may be input `address_input`.+ fn emit_load_compressed_shape_of(&mut self, node: NodeId, dst: Gpr, address_input: usize) {+ let shape = self.shape_field_of(node, dst, address_input);+ self.masm.load32(dst, &shape);+ }++ /// The address of the shape field of the object in input 0 of `node`,+ /// whose `CellAddress` may be input `address_input`, or else is decoded+ /// into `temp`.+ fn shape_field_of(&mut self, node: NodeId, temp: Gpr, address_input: usize) -> Address {+ let cell = self.cell_address_of(node, temp, address_input);+ Address::new(cell, self.runtime.offsets.object_shape as i32)}/// `StoreSlot`: writes input 0, boxed if it is unboxed, to frame slot/// `slot`.@@ -1998,13 +2004,18 @@ impl<M: PortableMacroAssembler> Codegen<'_, M> {/// `CheckShape`: exits unless the object has one of `shapes`.fn emit_check_shape(&mut self, node_id: NodeId, shapes: &[ShapeCheck]) {let exit = self.exit_site(node_id);- self.emit_load_shape_of(node_id, self.pinned.scratch, 1);+ // OPTIMIZATION: An object has a shape exactly when its compressed+ // shape is the shape's compressed pointer, so shapes+ // are compared without decoding, against 32-bit+ // immediates.match shapes {[shape] if shape.dictionary_generation.is_none() => {+ let field = self.shape_field_of(node_id, self.pinned.scratch, 1);self.masm- .branch64_imm(Condition::NotEqual, self.pinned.scratch, shape.shape.0 as i64, exit);+ .branch32_memory_imm(Condition::NotEqual, &field, shape.shape.compressed() as i32, exit);}_ => {+ self.emit_load_compressed_shape_of(node_id, self.pinned.scratch, 1);let matched = self.masm.new_label();for shape in shapes {self.emit_branch_on_shape(*shape, matched, exit);@@ -2023,9 +2034,8 @@ impl<M: PortableMacroAssembler> Codegen<'_, M> {let storage = Gpr(self.allocation.node(node_id).temps[0]);let cell = self.cell_address_of(node_id, storage, 2);let offsets = self.runtime.offsets;- self.masm.move_imm64(self.pinned.scratch, shape.0);self.masm- .store64(&Address::new(cell, offsets.object_shape as i32), self.pinned.scratch);+ .store_imm32(&Address::new(cell, offsets.object_shape as i32), shape.compressed());self.masm.load64(storage, &Address::new(cell, offsets.object_named_properties as i32));let slot = self.named_property_address(storage, offset)?;@@ -2033,19 +2043,21 @@ impl<M: PortableMacroAssembler> Codegen<'_, M> {Ok(())}- /// Branches to `matched` if the shape in the scratch register is- /// `shape`, or to `exit` if it is `shape` but its dictionary generation- /// changed. Clobbers the scratch register only in the latter case.+ /// Branches to `matched` if the compressed shape in the scratch register+ /// is that of `shape`, or to `exit` if it is `shape` but its dictionary+ /// generation changed. Clobbers the scratch register only in the latter+ /// case.fn emit_branch_on_shape(&mut self, shape: ShapeCheck, matched: Label, exit: Label) {let scratch = self.pinned.scratch;+ let compressed = shape.shape.compressed() as i32;let Some(generation) = shape.dictionary_generation else {- self.masm- .branch64_imm(Condition::Equal, scratch, shape.shape.0 as i64, matched);+ self.masm.branch32_imm(Condition::Equal, scratch, compressed, matched);return;};let other_shape = self.masm.new_label();self.masm- .branch64_imm(Condition::NotEqual, scratch, shape.shape.0 as i64, other_shape);+ .branch32_imm(Condition::NotEqual, scratch, compressed, other_shape);+ self.emit_decompress_cell(scratch);let generation_address = Address::new(scratch, self.runtime.offsets.shape_dictionary_generation as i32);self.masm.load32(scratch, &generation_address);self.masmdiff --git a/Libraries/LibJS/JIT/Rust/src/codegen/probes/keyed.rs b/Libraries/LibJS/JIT/Rust/src/codegen/probes/keyed.rsindex 9be4a5f8de6..e4fb36885d7 100644--- a/Libraries/LibJS/JIT/Rust/src/codegen/probes/keyed.rs+++ b/Libraries/LibJS/JIT/Rust/src/codegen/probes/keyed.rs@@ -217,8 +217,7 @@ impl<M: PortableMacroAssembler> Codegen<'_, M> {self.masm.load64(name, &Address::new(name, layout.primitive_string_storage as i32));self.emit_unbox_cell(object, base);- self.masm- .load64(shape, &Address::new(object, self.runtime.offsets.object_shape as i32));+ self.emit_load_compressed_cell(shape, &Address::new(object, self.runtime.offsets.object_shape as i32));// The entry: the top bits of the Fibonacci hash of the shape and the name.let entry_size_log2 = layout.keyed_lookup_cache_entry_size.trailing_zeros();let bits = layout.keyed_lookup_cache_index_bits;@@ -294,8 +293,7 @@ impl<M: PortableMacroAssembler> Codegen<'_, M> {);self.masm.and64_imm(entry, entry, layout.property_lookup_cache_data_pointer_mask);- self.masm- .load64(shape, &Address::new(object, self.runtime.offsets.object_shape as i32));+ self.emit_load_compressed_cell(shape, &Address::new(object, self.runtime.offsets.object_shape as i32));self.emit_megamorphic_cache_lookup(shape, entry, MegamorphicKey::Keyed { key }, found, miss);self.masm.bind(not_megamorphic);}@@ -306,8 +304,7 @@ impl<M: PortableMacroAssembler> Codegen<'_, M> {self.masm.move64(scratch, entry);self.masm.and64_imm(entry, entry, layout.property_lookup_cache_data_pointer_mask);- self.masm- .load64(shape, &Address::new(object, self.runtime.offsets.object_shape as i32));+ self.emit_load_compressed_cell(shape, &Address::new(object, self.runtime.offsets.object_shape as i32));let entry_key = Address::new(entry, layout.property_lookup_cache_entry_key as i32);for index in 0..layout.property_lookup_cache_polymorphic_entry_count {let next = self.masm.new_label();diff --git a/Libraries/LibJS/JIT/Rust/src/codegen/probes/property.rs b/Libraries/LibJS/JIT/Rust/src/codegen/probes/property.rsindex 422eecc30a7..f3dbe8770d6 100644--- a/Libraries/LibJS/JIT/Rust/src/codegen/probes/property.rs+++ b/Libraries/LibJS/JIT/Rust/src/codegen/probes/property.rs@@ -127,8 +127,7 @@ impl<M: PortableMacroAssembler> Codegen<'_, M> {let scratch = self.pinned.scratch;let CacheRegisters { object, shape, entry } = *registers;let found = self.masm.new_label();- self.masm- .load64(shape, &Address::new(object, self.runtime.offsets.object_shape as i32));+ self.emit_load_compressed_cell(shape, &Address::new(object, self.runtime.offsets.object_shape as i32));self.property_cache_address(entry, executable, cache_index)?;self.masm.load64(entry, &Address::new(entry, 0));let was_megamorphic = self.executables[executable as usize]@@ -281,8 +280,7 @@ impl<M: PortableMacroAssembler> Codegen<'_, M> {self.masm.branch_test64(Condition::NonZero, shape, u64::MAX, has_chain);// Entries without a prototype chain validity are for shapes without// a prototype.- self.masm- .load64(shape, &Address::new(object, offsets.object_shape as i32));+ self.emit_load_compressed_cell(shape, &Address::new(object, offsets.object_shape as i32));self.masm.branch64_memory_imm(Condition::NotEqual,&Address::new(shape, layout.shape_prototype as i32),@@ -438,8 +436,7 @@ impl<M: PortableMacroAssembler> Codegen<'_, M> {};self.unbox_object_or_branch(object, base, failure.0);- self.masm- .load64(shape, &Address::new(object, self.runtime.offsets.object_shape as i32));+ self.emit_load_compressed_cell(shape, &Address::new(object, self.runtime.offsets.object_shape as i32));self.property_cache_address(entry, executable, cache_index)?;self.masm.load64(entry, &Address::new(entry, 0));self.masm.branch_test64(Condition::Zero, entry, u64::MAX, probe);@@ -577,8 +574,7 @@ impl<M: PortableMacroAssembler> Codegen<'_, M> {self.masm.branch32(Condition::Above, storage, scratch, grow);self.masm.bind(has_room);- self.masm- .store64(&Address::new(object, offsets.object_shape as i32), shape);+ self.emit_store_compressed_cell(&Address::new(object, offsets.object_shape as i32), shape, shape);self.masm.load32(scratch, &Address::new(entry, fields.property_offset));self.masm.load64(storage, &Address::new(object, offsets.object_named_properties as i32));diff --git a/Libraries/LibJS/JIT/Rust/src/codegen/property_iterator.rs b/Libraries/LibJS/JIT/Rust/src/codegen/property_iterator.rsindex 39df0b3aad6..4395122e3a1 100644--- a/Libraries/LibJS/JIT/Rust/src/codegen/property_iterator.rs+++ b/Libraries/LibJS/JIT/Rust/src/codegen/property_iterator.rs@@ -49,8 +49,7 @@ impl<M: PortableMacroAssembler> Codegen<'_, M> {);// The receiver's shape, and for dictionaries its generation.- self.masm- .load64(temp, &Address::new(object, self.runtime.offsets.object_shape as i32));+ self.emit_load_compressed_cell(temp, &Address::new(object, self.runtime.offsets.object_shape as i32));self.masm.branch64_memory(Condition::NotEqual,&Address::new(cache, layout.property_iterator_shape as i32),diff --git a/Libraries/LibJS/JIT/Rust/src/codegen/tests.rs b/Libraries/LibJS/JIT/Rust/src/codegen/tests.rsindex 72574cb08bb..8279d9d05f6 100644--- a/Libraries/LibJS/JIT/Rust/src/codegen/tests.rs+++ b/Libraries/LibJS/JIT/Rust/src/codegen/tests.rs@@ -659,6 +659,69 @@ pub(super) mod fake_heap {pub fn decompressed(compressed: u64) -> u64 {base() + (compressed << COMPRESSED_POINTER_SHIFT)}++ /// Committed memory below the size of the region, so that code with a+ /// heap region base of 0 (like that of `test_runtime()`) decodes the+ /// compressed pointers of the fake cells there to their addresses, like it+ /// decodes cell values to any address.+ fn low_region() -> &'static Region {+ static REGION: OnceLock<Region> = OnceLock::new();+ REGION.get_or_init(|| {+ const LOWEST_ADDRESS: usize = 1 << 32;+ let mut hint = LOWEST_ADDRESS;+ loop {+ assert!(hint + COMMITTED_SIZE <= REGION_SIZE, "no room for the low fake heap");+ // NB: The address is only a hint, so this never replaces an+ // existing mapping, which MAP_FIXED_NOREPLACE would need+ // and only Linux has. The kernel places the mapping at the+ // hint if that is free, and anywhere else otherwise.+ // SAFETY: A fresh private anonymous mapping.+ let mapping = unsafe {+ libc::mmap(+ core::ptr::with_exposed_provenance_mut(hint),+ COMMITTED_SIZE,+ libc::PROT_READ | libc::PROT_WRITE,+ libc::MAP_PRIVATE | libc::MAP_ANONYMOUS | libc::MAP_NORESERVE,+ -1,+ 0,+ )+ };+ assert_ne!(mapping, libc::MAP_FAILED);+ let address = mapping.expose_provenance();+ if address >= LOWEST_ADDRESS && address + COMMITTED_SIZE <= REGION_SIZE {+ return Region {+ base: address,+ next: Mutex::new(address),+ };+ }+ // SAFETY: The mapping was just made, and nothing uses it.+ assert_eq!(unsafe { libc::munmap(mapping, COMMITTED_SIZE) }, 0);+ hint += 1 << 30;+ }+ })+ }++ /// A fake cell with `words` whose compressed pointer `low_compressed()`+ /// gives, for code with a heap region base of 0. It lives for the rest of+ /// the test process.+ pub fn low_cell(words: &[u64]) -> &'static mut [u64] {+ let region = low_region();+ let mut next = region.next.lock().unwrap();+ let address = *next;+ *next = (address + 8 * words.len().max(1)).next_multiple_of(16);+ assert!(*next <= region.base + COMMITTED_SIZE, "the low fake heap is full");+ // SAFETY: The words are committed, and no other cell has them.+ let cell =+ unsafe { core::slice::from_raw_parts_mut(core::ptr::with_exposed_provenance_mut(address), words.len()) };+ cell.copy_from_slice(words);+ cell+ }++ /// The compressed pointer to the low fake cell at `address`.+ pub fn low_compressed(address: u64) -> u64 {+ assert!(address < REGION_SIZE as u64 && address.is_multiple_of(8));+ address >> COMPRESSED_POINTER_SHIFT+ }}#[repr(C)]@@ -1818,8 +1881,9 @@ mod execution {number_of_arguments: 2,};// Three shapes; the caches know the first two.- let shapes = [[0u64; 1], [0u64; 1], [0u64; 1]];- let shape = |index: usize| shapes[index].as_ptr() as u64;+ let shapes = [0; 3].map(|_| fake_heap::low_cell(&[0]).as_ptr() as u64);+ let shape = |index: usize| shapes[index];+ let compressed_shape = |index: usize| fake_heap::low_compressed(shape(index));let cache_entries = [vec![(shape(0), 0), (shape(1), 0)],vec![(shape(0), 1), (shape(1), 2)],@@ -1846,7 +1910,8 @@ mod execution {let program = ProgramGenerator::generate_with(seed.wrapping_mul(0x9E37_79B9_7F4A_7C15), layout, true);let mut random = Random(seed);let toggles = random.chance(50);- // Objects: [shape word, flags, storage pointer] and their storage.+ // Objects: [compressed shape, flags, storage pointer] and their+ // storage.let mut storages = (0..3).map(|index| {(0..3)@@ -1855,7 +1920,7 @@ mod execution {}).collect::<Vec<_>>();let mut objects = (0..3)- .map(|index| [shape(index), 0, storages[index].as_mut_ptr() as u64])+ .map(|index| [compressed_shape(index), 0, storages[index].as_mut_ptr() as u64]).collect::<Vec<_>>();let object_value = |objects: &[[u64; 3]], index: usize| {(u64::from(value::OBJECT_TAG) << 48) | objects[index].as_ptr() as u64@@ -1887,7 +1952,8 @@ mod execution {continue;}if toggles {- machine.state.borrow_mut().call_toggles = Some((objects[0].as_mut_ptr(), shape(0), shape(2)));+ machine.state.borrow_mut().call_toggles =+ Some((objects[0].as_mut_ptr(), compressed_shape(0), compressed_shape(2)));}let result = machine.run(&snapshot, &compiled);// NB: Compiled code may exit before the reference interpreter@@ -1906,7 +1972,10 @@ mod execution {.map(|index| {(objects[index].as_ptr() as u64,- objects[index][0],+ (0..3)+ .map(shape)+ .find(|shape| fake_heap::low_compressed(*shape) == objects[index][0])+ .expect("objects have one of the shapes"),storages[index].clone(),)})@@ -1984,7 +2053,11 @@ mod execution {}for (index, (_, shape, values)) in heap.objects.iter().enumerate() {assert_eq!(&storages[index], values, "seed {seed}: object {index}");- assert_eq!(objects[index][0], *shape, "seed {seed}: object {index}");+ assert_eq!(+ objects[index][0],+ fake_heap::low_compressed(*shape),+ "seed {seed}: object {index}"+ );}checked += 1;}@@ -2244,11 +2317,13 @@ mod property_access {use crate::snapshot::PropertyCacheEntryType::GetPropertyInPrototypeChain;use crate::snapshot::PropertyCacheSnapshot;- struct Cell(Box<[u64; 3]>);+ /// A fake cell, in the low fake heap so that objects can have it as+ /// their compressed shape.+ struct Cell(&'static mut [u64]);impl Cell {fn new(words: [u64; 3]) -> Self {- Self(Box::new(words))+ Self(fake_heap::low_cell(&words))}fn address(&self) -> u64 {@@ -2268,7 +2343,7 @@ mod property_access {impl Object {fn new(shape: &Cell, values: &[u64]) -> Self {let storage = values.to_vec().into_boxed_slice();- let cell = Cell::new([shape.address(), 0, storage.as_ptr() as u64]);+ let cell = Cell::new([fake_heap::low_compressed(shape.address()), 0, storage.as_ptr() as u64]);Self { cell, storage }}@@ -2385,7 +2460,7 @@ mod property_access {let receiver_shape = Cell::new([7, 0, 0]);let holder_shape = Cell::new([0; 3]);let holder = Object::new(&holder_shape, &[0, value::int32(42)]);- let mut validity = Cell::new([1, 0, 0]);+ let validity = Cell::new([1, 0, 0]);let mut entry = own(GetPropertyInPrototypeChain, receiver_shape.address(), 1);entry.prototype = Some(holder.cell.id());entry.prototype_chain_validity = Some(validity.id());@@ -2439,7 +2514,7 @@ mod property_access {impl FakeObject {fn new(shape: &Cell, flags: u64, elements: &[u64], size: u32) -> Self {Self(Box::new([- shape.address(),+ fake_heap::low_compressed(shape.address()),flags,0,elements.as_ptr() as u64,@@ -2652,7 +2727,7 @@ mod property_access {&program,caches(),object.value(),- Some((shape_word, other_shape.address())),+ Some((shape_word, fake_heap::low_compressed(other_shape.address()))),);assert_eq!(result.status, RESUME);assert_eq!(exit_kinds_taken(&machine, &compiled), [ExitKind::BadShape]);@@ -3638,7 +3713,7 @@ mod direct_calls {}}- /// A fake ECMAScript function for dynamic calls: shape, flags, shared+ /// A fake ECMAScript function for dynamic calls: compressed shape, flags, shared/// data, then the words `FUNCTION_WORDS` has (see `dynamic_runtime()`),/// whose environments are compressed. The function, its shared data and/// its executable are in the fake heap region; shared data has the@@ -3647,7 +3722,7 @@ mod direct_calls {struct DynamicCallee {callee: Callee,function: &'static mut [u64],- shape: Vec<u64>,+ shape: &'static mut [u64],shared_data: &'static mut [u64],}@@ -3665,14 +3740,14 @@ mod direct_calls {fn new(formal_parameter_count: u64, flags: u64) -> Self {let callee = Callee::new();callee.executable[EXECUTABLE_ARGUMENTS_BASE_WORD] = 9;- let shape = vec![REALM];+ let shape = fake_heap::cell(&[REALM]);let shared_data = fake_heap::cell(&[fake_heap::compressed(callee.executable.as_ptr() as u64),formal_parameter_count | flags,0,]);let mut function = vec![- shape.as_ptr() as u64,+ fake_heap::compressed(shape.as_ptr() as u64),u64::from(ECMASCRIPT_FUNCTION_FLAG),fake_heap::compressed(shared_data.as_ptr() as u64),];@@ -4136,9 +4211,13 @@ mod direct_calls {const RAW_NATIVE_FLAG: u16 = 1 << 7;for through_call in [false, true] {let mut callee = DynamicCallee::new(0, 0);- let shape = vec![REALM];+ let shape = fake_heap::cell(&[REALM]);// Native function index 1, with a bit above the table's index mask that the call stub drops.- let native = fake_heap::cell(&[shape.as_ptr() as u64, u64::from(RAW_NATIVE_FLAG), 0x1_0001]);+ let native = fake_heap::cell(&[+ fake_heap::compressed(shape.as_ptr() as u64),+ u64::from(RAW_NATIVE_FLAG),+ 0x1_0001,+ ]);let table = vec![0, 0, fake_native as *const () as u64, 0];let native_value = (u64::from(value::OBJECT_TAG) << 48) | native.as_ptr() as u64;let call_function = (u64::from(value::OBJECT_TAG) << 48) | CALL_FUNCTION;diff --git a/Libraries/LibJS/JIT/Rust/src/codegen/tests/lowerings.rs b/Libraries/LibJS/JIT/Rust/src/codegen/tests/lowerings.rsindex 4485764114e..f5aba6c16d6 100644--- a/Libraries/LibJS/JIT/Rust/src/codegen/tests/lowerings.rs+++ b/Libraries/LibJS/JIT/Rust/src/codegen/tests/lowerings.rs@@ -1373,6 +1373,18 @@ impl FakeArray {}}+/// A fake shape with `words`, in the low fake heap so that objects can have+/// it as their compressed shape.+fn fake_shape(words: &[u64]) -> &'static mut [u64] {+ super::fake_heap::low_cell(words)+}++/// The shape word of an object with the fake shape `shape`: its compressed+/// pointer.+fn shape_word(shape: &[u64]) -> u64 {+ super::fake_heap::low_compressed(shape.as_ptr() as u64)+}+/// A typed array of `kind` over `data`.fn fake_typed_array(kind: u8, data: &[u8], length: u32) -> Vec<u64> {let mut object = vec![0; 8];@@ -1773,9 +1785,9 @@ fn property_iterator_next(receiver: u64, keys: u64, cursor: u64) -> (u64, u64, u#[test]fn property_iterator_next_reads_key_snapshots() {- let shape = vec![0u64; 12];+ let shape = fake_shape(&[0; 12]);let mut object = FakeArray::new(0, PACKED, 2, &[], 2);- object.object[6] = shape.as_ptr() as u64;+ object.object[6] = shape_word(shape);let keys = [value::int32(100), value::int32(101)];let named = FakeKeySnapshot::new(1, &shape, &keys);let empty = value::EMPTY;@@ -1794,8 +1806,8 @@ fn property_iterator_next_reads_key_snapshots() {(empty, value::TRUE, value::int32(2), 0));// Other shapes, cursors and receivers are slow.- let other_shape = vec![0u64; 12];- let other = FakeKeySnapshot::new(1, &other_shape, &keys);+ let other_shape = fake_shape(&[0; 12]);+ let other = FakeKeySnapshot::new(1, other_shape, &keys);assert_eq!(property_iterator_next(object.value(), other.value(), value::int32(0)).3,1@@ -2158,7 +2170,7 @@ struct FakeGlobals {realm: Vec<u64>,object: Vec<u64>,named_properties: Vec<u64>,- shape: Vec<u64>,+ shape: &'static mut [u64],environment: Box<FakeEnvironment>,executable: Vec<u64>,caches: Vec<u64>,@@ -2170,7 +2182,7 @@ impl FakeGlobals {realm: vec![0; 8],object: vec![0; 8],named_properties: vec![value::int32(10), u64::from(0xFFFC_u16) << 48 | 0x1000, value::int32(12)],- shape: vec![0; 12],+ shape: fake_shape(&[0; 12]),environment: FakeEnvironment::new(&[value::int32(20), value::EMPTY, value::int32(22)],&[BINDING_MUTABLE, BINDING_MUTABLE, 0],@@ -2180,7 +2192,7 @@ impl FakeGlobals {executable: vec![0; 4],caches: vec![0; 16],});- globals.object[6] = globals.shape.as_ptr() as u64;+ globals.object[6] = shape_word(globals.shape);globals.object[7] = globals.named_properties.as_ptr() as u64;globals.shape[10] = 7 << 32;globals.environment.words[8] = 99;@@ -2448,17 +2460,17 @@ fn instance_of_global_functions_walks_prototype_chains() {// `shape_prototype`, 0), with named properties.struct Fake {object: Vec<u64>,- shape: Vec<u64>,+ shape: &'static mut [u64],properties: Vec<u64>,}let fake = |class: &[u64], prototype: Option<&Fake>, properties: Vec<u64>| {let mut fake = Box::new(Fake {object: vec![0; 8],- shape: vec![prototype.map_or(0, |prototype| prototype.object.as_ptr() as u64)],+ shape: fake_shape(&[prototype.map_or(0, |prototype| prototype.object.as_ptr() as u64)]),properties,});fake.object[0] = class.as_ptr() as u64;- fake.object[6] = fake.shape.as_ptr() as u64;+ fake.object[6] = shape_word(fake.shape);fake.object[7] = fake.properties.as_ptr() as u64;fake};@@ -2473,7 +2485,7 @@ fn instance_of_global_functions_walks_prototype_chains() {None,vec![value::int32(1), object_value(&prototype.object)],);- let (function_value, function_shape) = (object_value(&function.object), function.object[6]);+ let (function_value, function_shape) = (object_value(&function.object), function.shape.as_ptr() as u64);let program = assemble(|_| {vec![@@ -2830,7 +2842,7 @@ struct PrimitivePrototypes {struct FakeCachedObject {object: Vec<u64>,properties: Vec<u64>,- shape: Vec<u64>,+ shape: &'static mut [u64],entry: Vec<u64>,caches: Vec<u64>,executable: Vec<u64>,@@ -2851,7 +2863,7 @@ impl FakeCachedObject {.into_iter().chain(properties.iter().copied()).collect(),- shape: vec![0; 12],+ shape: fake_shape(&[0; 12]),entry: vec![0; 6],caches: vec![0; 2],executable: vec![0; 4],@@ -2860,7 +2872,7 @@ impl FakeCachedObject {keyed_store_cache: std::cell::Cell::new(0),});fake.object[5] = 2;- fake.object[6] = fake.shape.as_ptr() as u64;+ fake.object[6] = shape_word(fake.shape);fake.object[7] = fake.properties[1..].as_ptr() as u64;fake.shape[10] = 5 << 32;fake.caches[1] = fake.entry.as_ptr() as u64 | 1;@@ -3206,17 +3218,17 @@ fn put_by_id_calls_native_setters_of_prototypes() {#[test]fn put_by_id_adds_properties_through_property_caches() {let mut fake = FakeCachedObject::new(&[value::int32(10), value::int32(11), value::EMPTY]);- let old_shape = fake.shape.as_ptr() as u64;+ let old_shape = shape_word(fake.shape);// A shape with three properties, and dictionary generation 5.- let mut new_shape = vec![0u64; 12];+ let new_shape = fake_shape(&[0; 12]);new_shape[10] = 3 | 5 << 32;- let new_shape_address = new_shape.as_ptr() as u64;- fake.set_add_entry(&new_shape, 2);+ let new_shape_word = shape_word(new_shape);+ fake.set_add_entry(new_shape, 2);let add = |fake: &mut FakeCachedObject, flags: u16| {fake.object[1] = u64::from(flags);fake.object[6] = old_shape;let slow_paths = fake.put(fake.value(), value::TRUE);- assert_eq!(fake.object[6] == new_shape_address, slow_paths == 0);+ assert_eq!(fake.object[6] == new_shape_word, slow_paths == 0);slow_paths};assert_eq!(add(&mut fake, FLAG_IS_EXTENSIBLE), 0);@@ -4335,23 +4347,23 @@ fn keyed_accesses_of_missing_and_added_properties_through_property_caches() {assert_eq!(fake.properties[2], value::NULL);// Additions, from the shape the entry adds a property to.- let mut new_shape = vec![0u64; 12];+ let new_shape = fake_shape(&[0; 12]);new_shape[10] = 3 | 5 << 32;let new_shape_address = new_shape.as_ptr() as u64;set_entry(&mut data, 1, 2, new_shape_address, shape);assert_eq!(put(&fake, other_key, value::TRUE), 1);assert_eq!(put(&fake, key, value::TRUE), 0);- assert_eq!(fake.object[6], new_shape_address);+ assert_eq!(fake.object[6], shape_word(new_shape));assert_eq!(fake.properties[3], value::TRUE);// Objects that already have the new shape take the slow path.assert_eq!(put(&fake, key, value::FALSE), 1);assert_eq!(fake.properties[3], value::TRUE);// So do objects that may not cache additions.- fake.object[6] = shape;+ fake.object[6] = shape_word(fake.shape);fake.object[1] = u64::from(FLAG_IS_EXTENSIBLE | FLAG_HAS_MAGICAL_LENGTH);assert_eq!(put(&fake, key, value::FALSE), 1);- assert_eq!(fake.object[6], shape);- std::hint::black_box((&data, &new_shape));+ assert_eq!(fake.object[6], shape_word(fake.shape));+ std::hint::black_box(&data);}#[test]diff --git a/Libraries/LibJS/Runtime/Object.h b/Libraries/LibJS/Runtime/Object.hindex 4f8ddd1d667..bc6399b823c 100644--- a/Libraries/LibJS/Runtime/Object.h+++ b/Libraries/LibJS/Runtime/Object.h@@ -12,6 +12,7 @@#include <AK/Function.h>#include <AK/StringView.h>#include <LibGC/CellAllocator.h>+#include <LibGC/CompressedPointer.h>#include <LibGC/RootVector.h>#include <LibJS/Embedding/Layout.h>#include <LibJS/Export.h>@@ -184,8 +185,8 @@ public:// Removes the first element, which must exist, and shifts the others down.void indexed_take_first();- Shape& shape() { return *engine_field<Shape*>(JS_LAYOUT_OBJECT_SHAPE_OFFSET); }- Shape const& shape() const { return *engine_field<Shape*>(JS_LAYOUT_OBJECT_SHAPE_OFFSET); }+ Shape& shape() { return *reinterpret_cast<Shape*>(GC::decompress_nonnull(engine_field<u32>(JS_LAYOUT_OBJECT_SHAPE_OFFSET))); }+ Shape const& shape() const { return *reinterpret_cast<Shape const*>(GC::decompress_nonnull(engine_field<u32>(JS_LAYOUT_OBJECT_SHAPE_OFFSET))); }void convert_to_prototype_if_needed();void invalidate_property_lookup_caches();@@ -239,7 +240,7 @@ protected:}private:- static_assert(JS_LAYOUT_OBJECT_SHAPE_SIZE == sizeof(void*));+ static_assert(JS_LAYOUT_OBJECT_SHAPE_SIZE == sizeof(u32));static_assert(JS_LAYOUT_CELL_CLASS_SIZE == sizeof(void*));static_assert(JS_LAYOUT_CLASS_ID_SIZE == sizeof(u16));static_assert(JS_LAYOUT_CLASS_PARENT_SIZE == sizeof(void*));diff --git a/Libraries/LibJS/Rust/generate/layout_table.rs b/Libraries/LibJS/Rust/generate/layout_table.rsindex 41f68d968f7..ae393b613ce 100644--- a/Libraries/LibJS/Rust/generate/layout_table.rs+++ b/Libraries/LibJS/Rust/generate/layout_table.rs@@ -174,7 +174,7 @@ pub fn generate(configuration: &LayoutConfiguration) -> LayoutWriter {w.line("# Generated by the libjs_rust build script -- DO NOT EDIT");w.section("Object layout");- field!(w, "OBJECT_SHAPE", "Object.shape", "Shape", Object, shape, 8, "nonnull", "cell");+ field!(w, "OBJECT_SHAPE", "Object.shape", "Shape", Object, shape, 4, "nonnull", "compressed");field!(w, "OBJECT_NAMED_PROPERTIES", "Object.named_properties", "PropertyStorage", Object, named_properties, 8, "nonnull", "scalar");field!(w, "OBJECT_INDEXED_ELEMENTS", "Object.indexed_elements", "IndexedElements", Object, indexed_elements, 8, "nullable", "scalar");field!(w, "OBJECT_INDEXED_STORAGE_KIND", "Object.indexed_storage_kind", "u8", Object, indexed_storage_kind, 1, "nullable", "scalar");diff --git a/Libraries/LibJS/Rust/src/layout/function_object.rs b/Libraries/LibJS/Rust/src/layout/function_object.rsindex ed2398bf38f..b9d540bc3e3 100644--- a/Libraries/LibJS/Rust/src/layout/function_object.rs+++ b/Libraries/LibJS/Rust/src/layout/function_object.rs@@ -31,7 +31,7 @@ pub struct FunctionObject {pub ecmascript_shared_data: NullableMember<SharedFunctionInstanceData>,}-const _: () = assert!(size_of::<FunctionObject>() == 80);+const _: () = assert!(size_of::<FunctionObject>() == 72);#[repr(C)]pub struct NativeFunction {diff --git a/Libraries/LibJS/Rust/src/layout/host_object.rs b/Libraries/LibJS/Rust/src/layout/host_object.rsindex 5e47d4d3ab7..9ce49896dde 100644--- a/Libraries/LibJS/Rust/src/layout/host_object.rs+++ b/Libraries/LibJS/Rust/src/layout/host_object.rs@@ -13,10 +13,11 @@ use super::host_class::JSHostClass;use super::object::Object;use crate::layout_forward::ForeignCellSlot;-pub const JS_HOST_OBJECT_HOST_CLASS_OFFSET: usize = 72;-pub const JS_HOST_OBJECT_WRAPPABLE_OFFSET: usize = 80;-pub const JS_HOST_OBJECT_HOST_DATA_OFFSET: usize = 88;-pub const JS_HOST_OBJECT_SIZE: usize = 96;+// NB: The host object's own fields follow the object. Layout.h checks these against LibJS/HostObjectABI.h.+pub const JS_HOST_OBJECT_HOST_CLASS_OFFSET: usize = size_of::<Object>();+pub const JS_HOST_OBJECT_WRAPPABLE_OFFSET: usize = JS_HOST_OBJECT_HOST_CLASS_OFFSET + size_of::<usize>();+pub const JS_HOST_OBJECT_HOST_DATA_OFFSET: usize = JS_HOST_OBJECT_WRAPPABLE_OFFSET + size_of::<usize>();+pub const JS_HOST_OBJECT_SIZE: usize = JS_HOST_OBJECT_HOST_DATA_OFFSET + size_of::<usize>();#[repr(C)]pub struct HostObject {diff --git a/Libraries/LibJS/Rust/src/layout/object.rs b/Libraries/LibJS/Rust/src/layout/object.rsindex 04b9e488ccb..b18b0129f3e 100644--- a/Libraries/LibJS/Rust/src/layout/object.rs+++ b/Libraries/LibJS/Rust/src/layout/object.rs@@ -6,7 +6,8 @@use core::cell::Cell;-use super::cell::{CellHeader, Gc};+use super::cell::CellHeader;+use super::member::Member;use super::shape::Shape;use super::value::Value;use crate::layout_forward::{PrivateElements, TypedArrayBaseStorage};@@ -56,7 +57,7 @@ pub struct Object {/// mapped arguments objects have cells with room for more than INLINE_NAMED_STORAGE_CAPACITY.pub inline_named_capacity: Cell<u8>,pub indexed_array_like_size: Cell<u32>,- pub shape: Cell<Gc<Shape>>,+ pub shape: Member<Shape>,/// Points at `inline_named_storage` until the object needs more room.pub named_properties: Cell<*mut Value>,pub indexed_elements: Cell<*mut Value>,@@ -65,7 +66,7 @@ pub struct Object {}// NB: The inline capacity fits in the padding in front of the array-like size, and the inline storage ends the object.-const _: () = assert!(size_of::<Object>() == 72);+const _: () = assert!(size_of::<Object>() == 64);const _: () = assert!(core::mem::offset_of!(Object, inline_named_storage) + INLINE_NAMED_STORAGE_CAPACITY * size_of::<Value>()== size_of::<Object>()diff --git a/Libraries/LibJS/Rust/src/runtime/array.rs b/Libraries/LibJS/Rust/src/runtime/array.rsindex 0c05acb4b51..aef80beed13 100644--- a/Libraries/LibJS/Rust/src/runtime/array.rs+++ b/Libraries/LibJS/Rust/src/runtime/array.rs@@ -43,7 +43,7 @@ pub struct Array {is_proxy_target: Cell<bool>,}-const _: () = assert!(size_of::<Array>() == 80);+const _: () = assert!(size_of::<Array>() == 72);/// The offsets of the flags JIT code checks before writing elements of an array.pub const ARRAY_LENGTH_WRITABLE_OFFSET: usize = core::mem::offset_of!(Array, length_writable);diff --git a/Libraries/LibJS/Rust/src/runtime/ecmascript_function_object.rs b/Libraries/LibJS/Rust/src/runtime/ecmascript_function_object.rsindex f5779244e26..ea57e240faa 100644--- a/Libraries/LibJS/Rust/src/runtime/ecmascript_function_object.rs+++ b/Libraries/LibJS/Rust/src/runtime/ecmascript_function_object.rs@@ -76,7 +76,7 @@ pub struct EcmascriptFunctionObjectStorage {}// NB: Every ECMAScript function has these bytes, so keep what only some functions need in the rare data.-const _: () = assert!(size_of::<EcmascriptFunctionObject>() == 120);+const _: () = assert!(size_of::<EcmascriptFunctionObject>() == 112);// SAFETY: Visits the cells of the rare data, if there is any.unsafe impl Trace for EcmascriptFunctionObjectStorage {diff --git a/Libraries/LibJS/Rust/src/runtime/object.rs b/Libraries/LibJS/Rust/src/runtime/object.rsindex e0e388385dd..b64d306c671 100644--- a/Libraries/LibJS/Rust/src/runtime/object.rs+++ b/Libraries/LibJS/Rust/src/runtime/object.rs@@ -27,6 +27,7 @@ use crate::layout::cell::{CellHeader, Gc};use crate::layout::execution_context::ExecutionContext;use crate::layout::function_object::{EcmascriptFunctionObject, FunctionObject, SharedFunctionInstanceData};use crate::layout::host_class::JSValue;+use crate::layout::member::Member;pub use crate::layout::object::{INDEXED_ELEMENTS_HEADER_SIZE, INLINE_NAMED_STORAGE_CAPACITY, IndexedStorageKind, Object, object_flag,};@@ -613,7 +614,7 @@ impl Object {indexed_storage_kind: Cell::new(IndexedStorageKind::None),inline_named_capacity: Cell::new(INLINE_NAMED_STORAGE_CAPACITY as u8),indexed_array_like_size: Cell::new(0),- shape: Cell::new(shape),+ shape: Member::new(shape),named_properties: Cell::new(core::ptr::null_mut()),indexed_elements: Cell::new(core::ptr::null_mut()),private_elements: PrivateElements::default(),diff --git a/Libraries/LibJS/Rust/src/runtime/promise_resolving_function.rs b/Libraries/LibJS/Rust/src/runtime/promise_resolving_function.rsindex ce513b22762..50ba7bde571 100644--- a/Libraries/LibJS/Rust/src/runtime/promise_resolving_function.rs+++ b/Libraries/LibJS/Rust/src/runtime/promise_resolving_function.rs@@ -41,7 +41,7 @@ pub struct PromiseResolvingFunction {kind: PromiseResolvingFunctionKind,}-const _: () = assert!(size_of::<PromiseResolvingFunction>() == 120);+const _: () = assert!(size_of::<PromiseResolvingFunction>() == 112);static PROMISE_RESOLVING_FUNCTION_VIRTUAL_METHODS: NativeFunctionMethods = NativeFunctionMethods {call: PromiseResolvingFunction::call,diff --git a/Libraries/LibJS/Rust/src/runtime/proxy_object.rs b/Libraries/LibJS/Rust/src/runtime/proxy_object.rsindex 9b0486ccaf3..4dea968005d 100644--- a/Libraries/LibJS/Rust/src/runtime/proxy_object.rs+++ b/Libraries/LibJS/Rust/src/runtime/proxy_object.rs@@ -85,7 +85,7 @@ pub struct ProxyObject {is_revoked: Cell<bool>,}-const _: () = assert!(size_of::<ProxyObject>() == 96);+const _: () = assert!(size_of::<ProxyObject>() == 88);/// The internal methods of a Proxy exotic object. Every proxy has [[Call]] and [[Construct]]: IsCallable and/// IsConstructor only reach them for a proxy whose target has them, since the proxy keeps the IsFunction flag only ifdiff --git a/Libraries/LibJS/Rust/src/runtime/regexp_object.rs b/Libraries/LibJS/Rust/src/runtime/regexp_object.rsindex 9101d91bed9..635159a34bb 100644--- a/Libraries/LibJS/Rust/src/runtime/regexp_object.rs+++ b/Libraries/LibJS/Rust/src/runtime/regexp_object.rs@@ -148,7 +148,7 @@ pub struct RegExpObject {cached_regex: RefCell<Option<Rc<EcmaScriptRegex>>>,}-const _: () = assert!(size_of::<RegExpObject>() == 128);+const _: () = assert!(size_of::<RegExpObject>() == 120);static REGEXP_OBJECT_METHODS: ObjectMethods = ObjectMethods {initialize: RegExpObject::initialize,