From e0cbacc7e40f130069b75685069f1e47f524092c Mon Sep 17 00:00:00 2001 From: Thibaud Michaud Date: Tue, 9 Mar 2021 15:32:03 +0100 Subject: [PATCH] [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 Reviewed-by: Clemens Backes Cr-Commit-Position: refs/heads/master@{#73302} --- src/wasm/baseline/liftoff-compiler.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/wasm/baseline/liftoff-compiler.cc b/src/wasm/baseline/liftoff-compiler.cc index b6d634cbbe..648456004e 100644 --- a/src/wasm/baseline/liftoff-compiler.cc +++ b/src/wasm/baseline/liftoff-compiler.cc @@ -3849,8 +3849,8 @@ class LiftoffCompiler { source_position_table_builder_.AddPosition( __ pc_offset(), SourcePosition(decoder->position()), true); __ CallRuntimeStub(WasmCode::kWasmThrow); - EmitLandingPad(decoder); DefineSafepoint(); + EmitLandingPad(decoder); } void AtomicStoreMem(FullDecoder* decoder, StoreType type, @@ -5211,7 +5211,6 @@ class LiftoffCompiler { source_position_table_builder_.AddPosition( __ pc_offset(), SourcePosition(decoder->position()), true); __ CallIndirect(sig, call_descriptor, target); - EmitLandingPad(decoder); } } else { // A direct call within this module just gets the current instance. @@ -5229,12 +5228,12 @@ class LiftoffCompiler { source_position_table_builder_.AddPosition( __ pc_offset(), SourcePosition(decoder->position()), true); __ CallNativeWasmCode(addr); - EmitLandingPad(decoder); } } DefineSafepoint(); RegisterDebugSideTableEntry(decoder, DebugSideTableBuilder::kDidSpill); + EmitLandingPad(decoder); __ FinishCall(sig, call_descriptor); } @@ -5401,11 +5400,11 @@ class LiftoffCompiler { source_position_table_builder_.AddPosition( __ pc_offset(), SourcePosition(decoder->position()), true); __ CallIndirect(sig, call_descriptor, target); - EmitLandingPad(decoder); } DefineSafepoint(); RegisterDebugSideTableEntry(decoder, DebugSideTableBuilder::kDidSpill); + EmitLandingPad(decoder); __ FinishCall(sig, call_descriptor); } @@ -5612,10 +5611,10 @@ class LiftoffCompiler { source_position_table_builder_.AddPosition( __ pc_offset(), SourcePosition(decoder->position()), true); __ CallIndirect(sig, call_descriptor, target_reg); - EmitLandingPad(decoder); } DefineSafepoint(); RegisterDebugSideTableEntry(decoder, DebugSideTableBuilder::kDidSpill); + EmitLandingPad(decoder); __ FinishCall(sig, call_descriptor); }