Commit 1c154540 authored by Matheus Marchini's avatar Matheus Marchini Committed by Commit Bot

[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.

R=jgruber@chromium.org, yangguo@google.com

Bug: v8:8911
Change-Id: I172d4735671726d32328de246990b513106e3a7f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1516692
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60288}
parent 0a703c5b
...@@ -332,7 +332,7 @@ void TurboAssembler::LoadCodeObjectEntry(Register destination, ...@@ -332,7 +332,7 @@ void TurboAssembler::LoadCodeObjectEntry(Register destination,
if (options().isolate_independent_code) { if (options().isolate_independent_code) {
DCHECK(root_array_available()); DCHECK(root_array_available());
Label if_code_is_builtin, out; Label if_code_is_off_heap, out;
UseScratchRegisterScope temps(this); UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire(); Register scratch = temps.Acquire();
...@@ -340,23 +340,22 @@ void TurboAssembler::LoadCodeObjectEntry(Register destination, ...@@ -340,23 +340,22 @@ void TurboAssembler::LoadCodeObjectEntry(Register destination,
DCHECK(!AreAliased(destination, scratch)); DCHECK(!AreAliased(destination, scratch));
DCHECK(!AreAliased(code_object, scratch)); DCHECK(!AreAliased(code_object, scratch));
// Check whether the Code object is a builtin. If so, call its (off-heap) // Check whether the Code object is an off-heap trampoline. If so, call its
// entry point directly without going through the (on-heap) trampoline. // (off-heap) entry point directly without going through the (on-heap)
// Otherwise, just call the Code object as always. // trampoline. Otherwise, just call the Code object as always.
ldr(scratch, FieldMemOperand(code_object, Code::kFlagsOffset));
tst(scratch, Operand(Code::IsOffHeapTrampoline::kMask));
b(ne, &if_code_is_off_heap);
ldr(scratch, FieldMemOperand(code_object, Code::kBuiltinIndexOffset)); // Not an off-heap trampoline, the entry point is at
cmp(scratch, Operand(Builtins::kNoBuiltinId));
b(ne, &if_code_is_builtin);
// A non-builtin Code object, the entry point is at
// Code::raw_instruction_start(). // Code::raw_instruction_start().
add(destination, code_object, Operand(Code::kHeaderSize - kHeapObjectTag)); add(destination, code_object, Operand(Code::kHeaderSize - kHeapObjectTag));
jmp(&out); jmp(&out);
// A builtin Code object, the entry point is loaded from the builtin entry // An off-heap trampoline, the entry point is loaded from the builtin entry
// table. // table.
// The builtin index is loaded in scratch. bind(&if_code_is_off_heap);
bind(&if_code_is_builtin); ldr(scratch, FieldMemOperand(code_object, Code::kBuiltinIndexOffset));
lsl(destination, scratch, Operand(kSystemPointerSizeLog2)); lsl(destination, scratch, Operand(kSystemPointerSizeLog2));
add(destination, destination, kRootRegister); add(destination, destination, kRootRegister);
ldr(destination, ldr(destination,
......
...@@ -2054,7 +2054,7 @@ void TurboAssembler::LoadCodeObjectEntry(Register destination, ...@@ -2054,7 +2054,7 @@ void TurboAssembler::LoadCodeObjectEntry(Register destination,
if (options().isolate_independent_code) { if (options().isolate_independent_code) {
DCHECK(root_array_available()); DCHECK(root_array_available());
Label if_code_is_builtin, out; Label if_code_is_off_heap, out;
UseScratchRegisterScope temps(this); UseScratchRegisterScope temps(this);
Register scratch = temps.AcquireX(); Register scratch = temps.AcquireX();
...@@ -2062,23 +2062,23 @@ void TurboAssembler::LoadCodeObjectEntry(Register destination, ...@@ -2062,23 +2062,23 @@ void TurboAssembler::LoadCodeObjectEntry(Register destination,
DCHECK(!AreAliased(destination, scratch)); DCHECK(!AreAliased(destination, scratch));
DCHECK(!AreAliased(code_object, scratch)); DCHECK(!AreAliased(code_object, scratch));
// Check whether the Code object is a builtin. If so, call its (off-heap) // Check whether the Code object is an off-heap trampoline. If so, call its
// entry point directly without going through the (on-heap) trampoline. // (off-heap) entry point directly without going through the (on-heap)
// Otherwise, just call the Code object as always. // trampoline. Otherwise, just call the Code object as always.
Ldrsw(scratch, FieldMemOperand(code_object, Code::kBuiltinIndexOffset)); Ldrsw(scratch, FieldMemOperand(code_object, Code::kFlagsOffset));
Cmp(scratch, Operand(Builtins::kNoBuiltinId)); Tst(scratch, Operand(Code::IsOffHeapTrampoline::kMask));
B(ne, &if_code_is_builtin); B(ne, &if_code_is_off_heap);
// A non-builtin Code object, the entry point is at // Not an off-heap trampoline object, the entry point is at
// Code::raw_instruction_start(). // Code::raw_instruction_start().
Add(destination, code_object, Code::kHeaderSize - kHeapObjectTag); Add(destination, code_object, Code::kHeaderSize - kHeapObjectTag);
B(&out); B(&out);
// A builtin Code object, the entry point is loaded from the builtin entry // An off-heap trampoline, the entry point is loaded from the builtin entry
// table. // table.
// The builtin index is loaded in scratch. bind(&if_code_is_off_heap);
bind(&if_code_is_builtin); Ldrsw(scratch, FieldMemOperand(code_object, Code::kBuiltinIndexOffset));
Lsl(destination, scratch, kSystemPointerSizeLog2); Lsl(destination, scratch, kSystemPointerSizeLog2);
Add(destination, destination, kRootRegister); Add(destination, destination, kRootRegister);
Ldr(destination, Ldr(destination,
......
...@@ -1902,24 +1902,24 @@ void TurboAssembler::LoadCodeObjectEntry(Register destination, ...@@ -1902,24 +1902,24 @@ void TurboAssembler::LoadCodeObjectEntry(Register destination,
if (options().isolate_independent_code) { if (options().isolate_independent_code) {
DCHECK(root_array_available()); DCHECK(root_array_available());
Label if_code_is_builtin, out; Label if_code_is_off_heap, out;
// Check whether the Code object is a builtin. If so, call its (off-heap) // Check whether the Code object is an off-heap trampoline. If so, call its
// entry point directly without going through the (on-heap) trampoline. // (off-heap) entry point directly without going through the (on-heap)
// Otherwise, just call the Code object as always. // trampoline. Otherwise, just call the Code object as always.
cmp(FieldOperand(code_object, Code::kBuiltinIndexOffset), test(FieldOperand(code_object, Code::kFlagsOffset),
Immediate(Builtins::kNoBuiltinId)); Immediate(Code::IsOffHeapTrampoline::kMask));
j(not_equal, &if_code_is_builtin); j(not_equal, &if_code_is_off_heap);
// A non-builtin Code object, the entry point is at // Not an off-heap trampoline, the entry point is at
// Code::raw_instruction_start(). // Code::raw_instruction_start().
Move(destination, code_object); Move(destination, code_object);
add(destination, Immediate(Code::kHeaderSize - kHeapObjectTag)); add(destination, Immediate(Code::kHeaderSize - kHeapObjectTag));
jmp(&out); jmp(&out);
// A builtin Code object, the entry point is loaded from the builtin entry // An off-heap trampoline, the entry point is loaded from the builtin entry
// table. // table.
bind(&if_code_is_builtin); bind(&if_code_is_off_heap);
mov(destination, FieldOperand(code_object, Code::kBuiltinIndexOffset)); mov(destination, FieldOperand(code_object, Code::kBuiltinIndexOffset));
mov(destination, mov(destination,
Operand(kRootRegister, destination, times_system_pointer_size, Operand(kRootRegister, destination, times_system_pointer_size,
......
...@@ -1588,24 +1588,24 @@ void TurboAssembler::LoadCodeObjectEntry(Register destination, ...@@ -1588,24 +1588,24 @@ void TurboAssembler::LoadCodeObjectEntry(Register destination,
if (options().isolate_independent_code) { if (options().isolate_independent_code) {
DCHECK(root_array_available()); DCHECK(root_array_available());
Label if_code_is_builtin, out; Label if_code_is_off_heap, out;
// Check whether the Code object is a builtin. If so, call its (off-heap) // Check whether the Code object is an off-heap trampoline. If so, call its
// entry point directly without going through the (on-heap) trampoline. // (off-heap) entry point directly without going through the (on-heap)
// Otherwise, just call the Code object as always. // trampoline. Otherwise, just call the Code object as always.
cmpl(FieldOperand(code_object, Code::kBuiltinIndexOffset), testl(FieldOperand(code_object, Code::kFlagsOffset),
Immediate(Builtins::kNoBuiltinId)); Immediate(Code::IsOffHeapTrampoline::kMask));
j(not_equal, &if_code_is_builtin); j(not_equal, &if_code_is_off_heap);
// A non-builtin Code object, the entry point is at // Not an off-heap trampoline, the entry point is at
// Code::raw_instruction_start(). // Code::raw_instruction_start().
Move(destination, code_object); Move(destination, code_object);
addq(destination, Immediate(Code::kHeaderSize - kHeapObjectTag)); addq(destination, Immediate(Code::kHeaderSize - kHeapObjectTag));
jmp(&out); jmp(&out);
// A builtin Code object, the entry point is loaded from the builtin entry // An off-heap trampoline, the entry point is loaded from the builtin entry
// table. // table.
bind(&if_code_is_builtin); bind(&if_code_is_off_heap);
movl(destination, FieldOperand(code_object, Code::kBuiltinIndexOffset)); movl(destination, FieldOperand(code_object, Code::kBuiltinIndexOffset));
movq(destination, movq(destination,
Operand(kRootRegister, destination, times_system_pointer_size, Operand(kRootRegister, destination, times_system_pointer_size,
......
...@@ -584,6 +584,10 @@ ...@@ -584,6 +584,10 @@
'test-run-wasm-exceptions/RunWasmTurbofan_TryCatchThrow': [SKIP], 'test-run-wasm-exceptions/RunWasmTurbofan_TryCatchThrow': [SKIP],
'test-run-wasm-exceptions/RunWasmTurbofan_TryCatchTrapTypeError': [SKIP], 'test-run-wasm-exceptions/RunWasmTurbofan_TryCatchTrapTypeError': [SKIP],
# --interpreted-frames-native-stack tests
'test-log/ExternalCodeEventListenerWithInterpretedFramesNativeStack': [SKIP],
'test-log/LogInterpretedFramesNativeStack': [SKIP],
# Crashes on native arm. # Crashes on native arm.
'test-macro-assembler-arm/ExtractLane': [PASS, ['arch == arm and not simulator_run', SKIP]], 'test-macro-assembler-arm/ExtractLane': [PASS, ['arch == arm and not simulator_run', SKIP]],
'test-macro-assembler-arm/LoadAndStoreWithRepresentation': [PASS, ['arch == arm and not simulator_run', SKIP]], 'test-macro-assembler-arm/LoadAndStoreWithRepresentation': [PASS, ['arch == arm and not simulator_run', SKIP]],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment