Skip to content

Commit 1c15454

Browse files
mmarchiniCommit Bot
authored andcommitted
[masm] make LoadCodeObjectEntry compatible with duplicated IET
On LoadCodeObjectEntry check for IsOffHeapTrampoline instead of BuiltinIndexOffset so LoadCodeObjectEntry can correctly jump to the on-heap trampoline when we use --interpreted-frames-native-stack. [email protected], [email protected] Bug: v8:8911 Change-Id: I172d4735671726d32328de246990b513106e3a7f Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1516692 Commit-Queue: Jakob Gruber <[email protected]> Reviewed-by: Jakob Gruber <[email protected]> Cr-Commit-Position: refs/heads/master@{#60288}
1 parent 0a703c5 commit 1c15454

5 files changed

Lines changed: 46 additions & 43 deletions

File tree

src/arm/macro-assembler-arm.cc

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -332,31 +332,30 @@ void TurboAssembler::LoadCodeObjectEntry(Register destination,
332332

333333
if (options().isolate_independent_code) {
334334
DCHECK(root_array_available());
335-
Label if_code_is_builtin, out;
335+
Label if_code_is_off_heap, out;
336336

337337
UseScratchRegisterScope temps(this);
338338
Register scratch = temps.Acquire();
339339

340340
DCHECK(!AreAliased(destination, scratch));
341341
DCHECK(!AreAliased(code_object, scratch));
342342

343-
// Check whether the Code object is a builtin. If so, call its (off-heap)
344-
// entry point directly without going through the (on-heap) trampoline.
345-
// Otherwise, just call the Code object as always.
343+
// Check whether the Code object is an off-heap trampoline. If so, call its
344+
// (off-heap) entry point directly without going through the (on-heap)
345+
// trampoline. Otherwise, just call the Code object as always.
346+
ldr(scratch, FieldMemOperand(code_object, Code::kFlagsOffset));
347+
tst(scratch, Operand(Code::IsOffHeapTrampoline::kMask));
348+
b(ne, &if_code_is_off_heap);
346349

347-
ldr(scratch, FieldMemOperand(code_object, Code::kBuiltinIndexOffset));
348-
cmp(scratch, Operand(Builtins::kNoBuiltinId));
349-
b(ne, &if_code_is_builtin);
350-
351-
// A non-builtin Code object, the entry point is at
350+
// Not an off-heap trampoline, the entry point is at
352351
// Code::raw_instruction_start().
353352
add(destination, code_object, Operand(Code::kHeaderSize - kHeapObjectTag));
354353
jmp(&out);
355354

356-
// A builtin Code object, the entry point is loaded from the builtin entry
355+
// An off-heap trampoline, the entry point is loaded from the builtin entry
357356
// table.
358-
// The builtin index is loaded in scratch.
359-
bind(&if_code_is_builtin);
357+
bind(&if_code_is_off_heap);
358+
ldr(scratch, FieldMemOperand(code_object, Code::kBuiltinIndexOffset));
360359
lsl(destination, scratch, Operand(kSystemPointerSizeLog2));
361360
add(destination, destination, kRootRegister);
362361
ldr(destination,

src/arm64/macro-assembler-arm64.cc

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2054,31 +2054,31 @@ void TurboAssembler::LoadCodeObjectEntry(Register destination,
20542054

20552055
if (options().isolate_independent_code) {
20562056
DCHECK(root_array_available());
2057-
Label if_code_is_builtin, out;
2057+
Label if_code_is_off_heap, out;
20582058

20592059
UseScratchRegisterScope temps(this);
20602060
Register scratch = temps.AcquireX();
20612061

20622062
DCHECK(!AreAliased(destination, scratch));
20632063
DCHECK(!AreAliased(code_object, scratch));
20642064

2065-
// Check whether the Code object is a builtin. If so, call its (off-heap)
2066-
// entry point directly without going through the (on-heap) trampoline.
2067-
// Otherwise, just call the Code object as always.
2065+
// Check whether the Code object is an off-heap trampoline. If so, call its
2066+
// (off-heap) entry point directly without going through the (on-heap)
2067+
// trampoline. Otherwise, just call the Code object as always.
20682068

2069-
Ldrsw(scratch, FieldMemOperand(code_object, Code::kBuiltinIndexOffset));
2070-
Cmp(scratch, Operand(Builtins::kNoBuiltinId));
2071-
B(ne, &if_code_is_builtin);
2069+
Ldrsw(scratch, FieldMemOperand(code_object, Code::kFlagsOffset));
2070+
Tst(scratch, Operand(Code::IsOffHeapTrampoline::kMask));
2071+
B(ne, &if_code_is_off_heap);
20722072

2073-
// A non-builtin Code object, the entry point is at
2073+
// Not an off-heap trampoline object, the entry point is at
20742074
// Code::raw_instruction_start().
20752075
Add(destination, code_object, Code::kHeaderSize - kHeapObjectTag);
20762076
B(&out);
20772077

2078-
// A builtin Code object, the entry point is loaded from the builtin entry
2078+
// An off-heap trampoline, the entry point is loaded from the builtin entry
20792079
// table.
2080-
// The builtin index is loaded in scratch.
2081-
bind(&if_code_is_builtin);
2080+
bind(&if_code_is_off_heap);
2081+
Ldrsw(scratch, FieldMemOperand(code_object, Code::kBuiltinIndexOffset));
20822082
Lsl(destination, scratch, kSystemPointerSizeLog2);
20832083
Add(destination, destination, kRootRegister);
20842084
Ldr(destination,

src/ia32/macro-assembler-ia32.cc

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1902,24 +1902,24 @@ void TurboAssembler::LoadCodeObjectEntry(Register destination,
19021902

19031903
if (options().isolate_independent_code) {
19041904
DCHECK(root_array_available());
1905-
Label if_code_is_builtin, out;
1905+
Label if_code_is_off_heap, out;
19061906

1907-
// Check whether the Code object is a builtin. If so, call its (off-heap)
1908-
// entry point directly without going through the (on-heap) trampoline.
1909-
// Otherwise, just call the Code object as always.
1910-
cmp(FieldOperand(code_object, Code::kBuiltinIndexOffset),
1911-
Immediate(Builtins::kNoBuiltinId));
1912-
j(not_equal, &if_code_is_builtin);
1907+
// Check whether the Code object is an off-heap trampoline. If so, call its
1908+
// (off-heap) entry point directly without going through the (on-heap)
1909+
// trampoline. Otherwise, just call the Code object as always.
1910+
test(FieldOperand(code_object, Code::kFlagsOffset),
1911+
Immediate(Code::IsOffHeapTrampoline::kMask));
1912+
j(not_equal, &if_code_is_off_heap);
19131913

1914-
// A non-builtin Code object, the entry point is at
1914+
// Not an off-heap trampoline, the entry point is at
19151915
// Code::raw_instruction_start().
19161916
Move(destination, code_object);
19171917
add(destination, Immediate(Code::kHeaderSize - kHeapObjectTag));
19181918
jmp(&out);
19191919

1920-
// A builtin Code object, the entry point is loaded from the builtin entry
1920+
// An off-heap trampoline, the entry point is loaded from the builtin entry
19211921
// table.
1922-
bind(&if_code_is_builtin);
1922+
bind(&if_code_is_off_heap);
19231923
mov(destination, FieldOperand(code_object, Code::kBuiltinIndexOffset));
19241924
mov(destination,
19251925
Operand(kRootRegister, destination, times_system_pointer_size,

src/x64/macro-assembler-x64.cc

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1588,24 +1588,24 @@ void TurboAssembler::LoadCodeObjectEntry(Register destination,
15881588

15891589
if (options().isolate_independent_code) {
15901590
DCHECK(root_array_available());
1591-
Label if_code_is_builtin, out;
1591+
Label if_code_is_off_heap, out;
15921592

1593-
// Check whether the Code object is a builtin. If so, call its (off-heap)
1594-
// entry point directly without going through the (on-heap) trampoline.
1595-
// Otherwise, just call the Code object as always.
1596-
cmpl(FieldOperand(code_object, Code::kBuiltinIndexOffset),
1597-
Immediate(Builtins::kNoBuiltinId));
1598-
j(not_equal, &if_code_is_builtin);
1593+
// Check whether the Code object is an off-heap trampoline. If so, call its
1594+
// (off-heap) entry point directly without going through the (on-heap)
1595+
// trampoline. Otherwise, just call the Code object as always.
1596+
testl(FieldOperand(code_object, Code::kFlagsOffset),
1597+
Immediate(Code::IsOffHeapTrampoline::kMask));
1598+
j(not_equal, &if_code_is_off_heap);
15991599

1600-
// A non-builtin Code object, the entry point is at
1600+
// Not an off-heap trampoline, the entry point is at
16011601
// Code::raw_instruction_start().
16021602
Move(destination, code_object);
16031603
addq(destination, Immediate(Code::kHeaderSize - kHeapObjectTag));
16041604
jmp(&out);
16051605

1606-
// A builtin Code object, the entry point is loaded from the builtin entry
1606+
// An off-heap trampoline, the entry point is loaded from the builtin entry
16071607
// table.
1608-
bind(&if_code_is_builtin);
1608+
bind(&if_code_is_off_heap);
16091609
movl(destination, FieldOperand(code_object, Code::kBuiltinIndexOffset));
16101610
movq(destination,
16111611
Operand(kRootRegister, destination, times_system_pointer_size,

test/cctest/cctest.status

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,10 @@
584584
'test-run-wasm-exceptions/RunWasmTurbofan_TryCatchThrow': [SKIP],
585585
'test-run-wasm-exceptions/RunWasmTurbofan_TryCatchTrapTypeError': [SKIP],
586586

587+
# --interpreted-frames-native-stack tests
588+
'test-log/ExternalCodeEventListenerWithInterpretedFramesNativeStack': [SKIP],
589+
'test-log/LogInterpretedFramesNativeStack': [SKIP],
590+
587591
# Crashes on native arm.
588592
'test-macro-assembler-arm/ExtractLane': [PASS, ['arch == arm and not simulator_run', SKIP]],
589593
'test-macro-assembler-arm/LoadAndStoreWithRepresentation': [PASS, ['arch == arm and not simulator_run', SKIP]],

0 commit comments

Comments
 (0)