Commit e652f8da authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[wasm][debug] Test debug side tables in debug mode

In production, the debug side tables will always be produced with
Liftoff in debug mode ({CompilationEnv::debug} being set).
Thus, this CL switches the tests to also test this configuration.

R=thibaudm@chromium.org

Bug: v8:10410
Change-Id: I3fa16f099d2bb612c7abf8c3ef518e1446564306
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2144119Reviewed-by: 's avatarThibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67090}
parent ec3731d7
...@@ -39,7 +39,8 @@ class LiftoffCompileEnvironment { ...@@ -39,7 +39,8 @@ class LiftoffCompileEnvironment {
auto test_func = AddFunction(return_types, param_types, raw_function_bytes); auto test_func = AddFunction(return_types, param_types, raw_function_bytes);
// Now compile the function with Liftoff two times. // Now compile the function with Liftoff two times.
CompilationEnv env = module_builder_.CreateCompilationEnv(); CompilationEnv env =
module_builder_.CreateCompilationEnv(TestingModuleBuilder::kDebug);
WasmFeatures detected1; WasmFeatures detected1;
WasmFeatures detected2; WasmFeatures detected2;
WasmCompilationResult result1 = ExecuteLiftoffCompilation( WasmCompilationResult result1 = ExecuteLiftoffCompilation(
...@@ -68,9 +69,8 @@ class LiftoffCompileEnvironment { ...@@ -68,9 +69,8 @@ class LiftoffCompileEnvironment {
std::vector<int> breakpoints = {}) { std::vector<int> breakpoints = {}) {
auto test_func = AddFunction(return_types, param_types, raw_function_bytes); auto test_func = AddFunction(return_types, param_types, raw_function_bytes);
CompilationEnv env = module_builder_.CreateCompilationEnv( CompilationEnv env =
breakpoints.empty() ? TestingModuleBuilder::kNoDebug module_builder_.CreateCompilationEnv(TestingModuleBuilder::kDebug);
: TestingModuleBuilder::kDebug);
WasmFeatures detected; WasmFeatures detected;
std::unique_ptr<DebugSideTable> debug_side_table_via_compilation; std::unique_ptr<DebugSideTable> debug_side_table_via_compilation;
ExecuteLiftoffCompilation( ExecuteLiftoffCompilation(
...@@ -306,6 +306,8 @@ TEST(Liftoff_debug_side_table_simple) { ...@@ -306,6 +306,8 @@ TEST(Liftoff_debug_side_table_simple) {
{WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))}); {WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))});
CheckDebugSideTable( CheckDebugSideTable(
{ {
// function entry, locals in registers.
{Register(kWasmI32), Register(kWasmI32)},
// OOL stack check, locals spilled, stack empty. // OOL stack check, locals spilled, stack empty.
{Stack(kWasmI32), Stack(kWasmI32)}, {Stack(kWasmI32), Stack(kWasmI32)},
}, },
...@@ -320,6 +322,8 @@ TEST(Liftoff_debug_side_table_call) { ...@@ -320,6 +322,8 @@ TEST(Liftoff_debug_side_table_call) {
WASM_GET_LOCAL(0))}); WASM_GET_LOCAL(0))});
CheckDebugSideTable( CheckDebugSideTable(
{ {
// function entry, local in register.
{Register(kWasmI32)},
// call, local spilled, stack empty. // call, local spilled, stack empty.
{Stack(kWasmI32)}, {Stack(kWasmI32)},
// OOL stack check, local spilled, stack empty. // OOL stack check, local spilled, stack empty.
...@@ -338,6 +342,8 @@ TEST(Liftoff_debug_side_table_call_const) { ...@@ -338,6 +342,8 @@ TEST(Liftoff_debug_side_table_call_const) {
WASM_GET_LOCAL(0))}); WASM_GET_LOCAL(0))});
CheckDebugSideTable( CheckDebugSideTable(
{ {
// function entry, local in register.
{Register(kWasmI32)},
// call, local is kConst. // call, local is kConst.
{Constant(kWasmI32, kConst)}, {Constant(kWasmI32, kConst)},
// OOL stack check, local spilled. // OOL stack check, local spilled.
...@@ -355,6 +361,8 @@ TEST(Liftoff_debug_side_table_indirect_call) { ...@@ -355,6 +361,8 @@ TEST(Liftoff_debug_side_table_indirect_call) {
WASM_GET_LOCAL(0))}); WASM_GET_LOCAL(0))});
CheckDebugSideTable( CheckDebugSideTable(
{ {
// function entry, local in register.
{Register(kWasmI32)},
// indirect call, local spilled, stack empty. // indirect call, local spilled, stack empty.
{Stack(kWasmI32)}, {Stack(kWasmI32)},
// OOL stack check, local spilled, stack empty. // OOL stack check, local spilled, stack empty.
...@@ -375,6 +383,8 @@ TEST(Liftoff_debug_side_table_loop) { ...@@ -375,6 +383,8 @@ TEST(Liftoff_debug_side_table_loop) {
{WASM_I32V_1(kConst), WASM_LOOP(WASM_BR_IF(0, WASM_GET_LOCAL(0)))}); {WASM_I32V_1(kConst), WASM_LOOP(WASM_BR_IF(0, WASM_GET_LOCAL(0)))});
CheckDebugSideTable( CheckDebugSideTable(
{ {
// function entry, local in register.
{Register(kWasmI32)},
// OOL stack check, local spilled, stack empty. // OOL stack check, local spilled, stack empty.
{Stack(kWasmI32)}, {Stack(kWasmI32)},
// OOL loop stack check, local spilled, stack has {kConst}. // OOL loop stack check, local spilled, stack has {kConst}.
...@@ -390,6 +400,8 @@ TEST(Liftoff_debug_side_table_trap) { ...@@ -390,6 +400,8 @@ TEST(Liftoff_debug_side_table_trap) {
{WASM_I32_DIVS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))}); {WASM_I32_DIVS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))});
CheckDebugSideTable( CheckDebugSideTable(
{ {
// function entry, locals in registers.
{Register(kWasmI32), Register(kWasmI32)},
// OOL stack check, local spilled, stack empty. // OOL stack check, local spilled, stack empty.
{Stack(kWasmI32), Stack(kWasmI32)}, {Stack(kWasmI32), Stack(kWasmI32)},
// OOL trap (div by zero), locals spilled, stack empty. // OOL trap (div by zero), locals spilled, stack empty.
......
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