Commit d16f404c authored by Thibaud Michaud's avatar Thibaud Michaud Committed by Commit Bot

[wasm][debug] Fix OSR at stack check

Add missing source position for stack check, used by OSR to find the
correct return address.

R=clemensb@chromium.org

Bug: v8:10235
Change-Id: Ie26dd3b2079168e846f84b3a4ffe18b838649be7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2339625Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69309}
parent bea6922b
......@@ -728,7 +728,7 @@ class LiftoffCompiler {
}
source_position_table_builder_.AddPosition(
__ pc_offset(), SourcePosition(ool->position), true);
__ pc_offset(), SourcePosition(ool->position), false);
__ CallRuntimeStub(ool->stub);
DCHECK_EQ(!debug_sidetable_builder_, !ool->debug_sidetable_entry_builder);
if (V8_UNLIKELY(ool->debug_sidetable_entry_builder)) {
......@@ -738,10 +738,10 @@ class LiftoffCompiler {
DCHECK_EQ(ool->continuation.get()->is_bound(), is_stack_check);
if (!ool->regs_to_save.is_empty()) __ PopRegisters(ool->regs_to_save);
if (is_stack_check) {
// TODO(thibaudm): If the top frame is OSR'ed during stack check,
// execution will resume at the next instruction, skipping the following
// register reloads.
if (V8_UNLIKELY(ool->spilled_registers != nullptr)) {
DCHECK(for_debugging_);
source_position_table_builder_.AddPosition(
__ pc_offset(), SourcePosition(ool->position), true);
for (auto& entry : ool->spilled_registers->entries) {
__ Fill(entry.reg, entry.offset, entry.type);
}
......
......@@ -5,4 +5,8 @@ Got wasm script: wasm://wasm/c84b7cde
Run
Expecting to pause at 61
Paused at offset 61; local: [12]; wasm-expression-stack: []
Paused at offset 62; local: [12]; wasm-expression-stack: []
Paused at offset 64; local: [12]; wasm-expression-stack: [12]
Paused at offset 66; local: [12]; wasm-expression-stack: [12, 1]
Paused at offset 67; local: [12]; wasm-expression-stack: [13]
Finished!
......@@ -46,12 +46,11 @@ function instantiate(bytes, imports) {
InspectorTest.log('Run');
Protocol.Runtime.evaluate({expression: 'instance.exports.main()'});
// TODO(thibaudm): Fix source position and OSR at stack checks.
InspectorTest.log('Expecting to pause at ' + (f.body_offset - 1));
// await waitForPauseAndStep('stepInto');
// await waitForPauseAndStep('stepInto');
// await waitForPauseAndStep('stepInto');
// await waitForPauseAndStep('stepInto');
await waitForPauseAndStep('stepInto');
await waitForPauseAndStep('stepInto');
await waitForPauseAndStep('stepInto');
await waitForPauseAndStep('stepInto');
await waitForPauseAndStep('resume');
InspectorTest.log('Finished!');
InspectorTest.completeTest();
......
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