[wasm][liftoff] Emit landing pad after the safepoint

... and after creating the debug side table entry. The safepoint and the
debug side table entry should be generated right after the call, so that
they are associated with the return address of the previous call.

R=clemensb@chromium.org

Bug: v8:11453
Change-Id: I71395851c5a7f4e2c873907454245c9d04f972f1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2739629
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73302}
This commit is contained in:
Thibaud Michaud 2021-03-09 15:32:03 +01:00 committed by Commit Bot
parent 22e759d4f8
commit e0cbacc7e4

View File

@ -3849,8 +3849,8 @@ class LiftoffCompiler {
source_position_table_builder_.AddPosition( source_position_table_builder_.AddPosition(
__ pc_offset(), SourcePosition(decoder->position()), true); __ pc_offset(), SourcePosition(decoder->position()), true);
__ CallRuntimeStub(WasmCode::kWasmThrow); __ CallRuntimeStub(WasmCode::kWasmThrow);
EmitLandingPad(decoder);
DefineSafepoint(); DefineSafepoint();
EmitLandingPad(decoder);
} }
void AtomicStoreMem(FullDecoder* decoder, StoreType type, void AtomicStoreMem(FullDecoder* decoder, StoreType type,
@ -5211,7 +5211,6 @@ class LiftoffCompiler {
source_position_table_builder_.AddPosition( source_position_table_builder_.AddPosition(
__ pc_offset(), SourcePosition(decoder->position()), true); __ pc_offset(), SourcePosition(decoder->position()), true);
__ CallIndirect(sig, call_descriptor, target); __ CallIndirect(sig, call_descriptor, target);
EmitLandingPad(decoder);
} }
} else { } else {
// A direct call within this module just gets the current instance. // A direct call within this module just gets the current instance.
@ -5229,12 +5228,12 @@ class LiftoffCompiler {
source_position_table_builder_.AddPosition( source_position_table_builder_.AddPosition(
__ pc_offset(), SourcePosition(decoder->position()), true); __ pc_offset(), SourcePosition(decoder->position()), true);
__ CallNativeWasmCode(addr); __ CallNativeWasmCode(addr);
EmitLandingPad(decoder);
} }
} }
DefineSafepoint(); DefineSafepoint();
RegisterDebugSideTableEntry(decoder, DebugSideTableBuilder::kDidSpill); RegisterDebugSideTableEntry(decoder, DebugSideTableBuilder::kDidSpill);
EmitLandingPad(decoder);
__ FinishCall(sig, call_descriptor); __ FinishCall(sig, call_descriptor);
} }
@ -5401,11 +5400,11 @@ class LiftoffCompiler {
source_position_table_builder_.AddPosition( source_position_table_builder_.AddPosition(
__ pc_offset(), SourcePosition(decoder->position()), true); __ pc_offset(), SourcePosition(decoder->position()), true);
__ CallIndirect(sig, call_descriptor, target); __ CallIndirect(sig, call_descriptor, target);
EmitLandingPad(decoder);
} }
DefineSafepoint(); DefineSafepoint();
RegisterDebugSideTableEntry(decoder, DebugSideTableBuilder::kDidSpill); RegisterDebugSideTableEntry(decoder, DebugSideTableBuilder::kDidSpill);
EmitLandingPad(decoder);
__ FinishCall(sig, call_descriptor); __ FinishCall(sig, call_descriptor);
} }
@ -5612,10 +5611,10 @@ class LiftoffCompiler {
source_position_table_builder_.AddPosition( source_position_table_builder_.AddPosition(
__ pc_offset(), SourcePosition(decoder->position()), true); __ pc_offset(), SourcePosition(decoder->position()), true);
__ CallIndirect(sig, call_descriptor, target_reg); __ CallIndirect(sig, call_descriptor, target_reg);
EmitLandingPad(decoder);
} }
DefineSafepoint(); DefineSafepoint();
RegisterDebugSideTableEntry(decoder, DebugSideTableBuilder::kDidSpill); RegisterDebugSideTableEntry(decoder, DebugSideTableBuilder::kDidSpill);
EmitLandingPad(decoder);
__ FinishCall(sig, call_descriptor); __ FinishCall(sig, call_descriptor);
} }