Commit 0d05e8d2 authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[liftoff][debug] Add nops to avoid source position collisions

Without the nops, the PC after the call might be the same as the PC of
the next instruction, and we might emit two different source positions
for the same PC.
This will not be the final solution, see attached bug.

R=thibaudm@chromium.org

Bug: v8:10337
Change-Id: I8c893d8d7ad00684ec6e1bc7f6c00f649695029f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2108029
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: 's avatarThibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66775}
parent 21dde46b
......@@ -720,6 +720,10 @@ class LiftoffCompiler {
__ pc_offset(), SourcePosition(decoder->position()), false);
RegisterDebugSideTableEntry(DebugSideTableBuilder::kAllowRegisters);
safepoint_table_builder_.DefineSafepoint(&asm_, Safepoint::kNoLazyDeopt);
// Add a nop after the breakpoint, such that following code has another PC
// and does not collide with the source position recorded above.
// TODO(thibaudm/clemens): Remove this.
__ nop();
}
void Block(FullDecoder* decoder, Control* block) {}
......@@ -2113,16 +2117,20 @@ class LiftoffCompiler {
__ CallNativeWasmCode(addr);
}
RegisterDebugSideTableEntry(DebugSideTableBuilder::kDidSpill);
safepoint_table_builder_.DefineSafepoint(&asm_, Safepoint::kNoLazyDeopt);
if (V8_UNLIKELY(env_->debug)) {
// This source position helps updating return addresses on the stack after
// installing a new Liftoff code object.
source_position_table_builder_.AddPosition(
__ pc_offset(), SourcePosition(decoder->position()), false);
// Add a nop after the call, such that following code has another PC
// and does not collide with the source position recorded above.
// TODO(thibaudm/clemens): Remove this.
__ nop();
}
RegisterDebugSideTableEntry(DebugSideTableBuilder::kDidSpill);
safepoint_table_builder_.DefineSafepoint(&asm_, Safepoint::kNoLazyDeopt);
__ FinishCall(imm.sig, call_descriptor);
}
......@@ -2253,16 +2261,20 @@ class LiftoffCompiler {
__ PrepareCall(imm.sig, call_descriptor, &target, explicit_instance);
__ CallIndirect(imm.sig, call_descriptor, target);
RegisterDebugSideTableEntry(DebugSideTableBuilder::kDidSpill);
safepoint_table_builder_.DefineSafepoint(&asm_, Safepoint::kNoLazyDeopt);
if (V8_UNLIKELY(env_->debug)) {
// This source position helps updating return addresses on the stack after
// installing a new Liftoff code object.
source_position_table_builder_.AddPosition(
__ pc_offset(), SourcePosition(decoder->position()), false);
// Add a nop after the call, such that following code has another PC
// and does not collide with the source position recorded above.
// TODO(thibaudm/clemens): Remove this.
__ nop();
}
RegisterDebugSideTableEntry(DebugSideTableBuilder::kDidSpill);
safepoint_table_builder_.DefineSafepoint(&asm_, Safepoint::kNoLazyDeopt);
__ FinishCall(imm.sig, call_descriptor);
}
......
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