Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Unified Diff: test/cctest/wasm/test-run-wasm-interpreter.cc

Issue 2055803002: [wasm] Fix CFI failures due to Wasm threads. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/cctest/wasm/test-run-wasm-interpreter.cc
diff --git a/test/cctest/wasm/test-run-wasm-interpreter.cc b/test/cctest/wasm/test-run-wasm-interpreter.cc
index fcb886c3fa36da3e30090fd3b20f07183d2bf097..42b0f8811286a00968f68a650d6a8f7cf658bde9 100644
--- a/test/cctest/wasm/test-run-wasm-interpreter.cc
+++ b/test/cctest/wasm/test-run-wasm-interpreter.cc
@@ -176,7 +176,7 @@ TEST(Breakpoint_I32Add) {
r.Build(code, code + arraysize(code));
WasmInterpreter* interpreter = r.interpreter();
- WasmInterpreter::Thread& thread = interpreter->GetThread(0);
+ WasmInterpreter::Thread* thread = interpreter->GetThread(0);
for (int i = 0; i < kNumBreakpoints; i++) {
interpreter->SetBreakpoint(r.function(), kLocalsDeclSize + offsets[i],
true);
@@ -184,23 +184,23 @@ TEST(Breakpoint_I32Add) {
FOR_UINT32_INPUTS(a) {
for (uint32_t b = 11; b < 3000000000u; b += 1000000000u) {
- thread.Reset();
+ thread->Reset();
WasmVal args[] = {WasmVal(*a), WasmVal(b)};
- thread.PushFrame(r.function(), args);
+ thread->PushFrame(r.function(), args);
for (int i = 0; i < kNumBreakpoints; i++) {
- thread.Run(); // run to next breakpoint
+ thread->Run(); // run to next breakpoint
// Check the thread stopped at the right pc.
- CHECK_EQ(WasmInterpreter::PAUSED, thread.state());
- CHECK_EQ(kLocalsDeclSize + offsets[i], thread.GetBreakpointPc());
+ CHECK_EQ(WasmInterpreter::PAUSED, thread->state());
+ CHECK_EQ(kLocalsDeclSize + offsets[i], thread->GetBreakpointPc());
}
- thread.Run(); // run to completion
+ thread->Run(); // run to completion
// Check the thread finished with the right value.
- CHECK_EQ(WasmInterpreter::FINISHED, thread.state());
+ CHECK_EQ(WasmInterpreter::FINISHED, thread->state());
uint32_t expected = (*a) + (b);
- CHECK_EQ(expected, thread.GetReturnValue().to<uint32_t>());
+ CHECK_EQ(expected, thread->GetReturnValue().to<uint32_t>());
}
}
}
@@ -215,28 +215,28 @@ TEST(Step_I32Mul) {
r.Build(code, code + arraysize(code));
WasmInterpreter* interpreter = r.interpreter();
- WasmInterpreter::Thread& thread = interpreter->GetThread(0);
+ WasmInterpreter::Thread* thread = interpreter->GetThread(0);
FOR_UINT32_INPUTS(a) {
for (uint32_t b = 33; b < 3000000000u; b += 1000000000u) {
- thread.Reset();
+ thread->Reset();
WasmVal args[] = {WasmVal(*a), WasmVal(b)};
- thread.PushFrame(r.function(), args);
+ thread->PushFrame(r.function(), args);
// Run instructions one by one.
for (int i = 0; i < kTraceLength - 1; i++) {
- thread.Step();
+ thread->Step();
// Check the thread stopped.
- CHECK_EQ(WasmInterpreter::PAUSED, thread.state());
+ CHECK_EQ(WasmInterpreter::PAUSED, thread->state());
}
// Run last instruction.
- thread.Step();
+ thread->Step();
// Check the thread finished with the right value.
- CHECK_EQ(WasmInterpreter::FINISHED, thread.state());
+ CHECK_EQ(WasmInterpreter::FINISHED, thread->state());
uint32_t expected = (*a) * (b);
- CHECK_EQ(expected, thread.GetReturnValue().to<uint32_t>());
+ CHECK_EQ(expected, thread->GetReturnValue().to<uint32_t>());
}
}
}
@@ -254,7 +254,7 @@ TEST(Breakpoint_I32And_disable) {
r.Build(code, code + arraysize(code));
WasmInterpreter* interpreter = r.interpreter();
- WasmInterpreter::Thread& thread = interpreter->GetThread(0);
+ WasmInterpreter::Thread* thread = interpreter->GetThread(0);
FOR_UINT32_INPUTS(a) {
for (uint32_t b = 11; b < 3000000000u; b += 1000000000u) {
@@ -262,23 +262,23 @@ TEST(Breakpoint_I32And_disable) {
for (int do_break = 0; do_break < 2; do_break++) {
interpreter->SetBreakpoint(r.function(), kLocalsDeclSize + offsets[0],
do_break);
- thread.Reset();
+ thread->Reset();
WasmVal args[] = {WasmVal(*a), WasmVal(b)};
- thread.PushFrame(r.function(), args);
+ thread->PushFrame(r.function(), args);
if (do_break) {
- thread.Run(); // run to next breakpoint
+ thread->Run(); // run to next breakpoint
// Check the thread stopped at the right pc.
- CHECK_EQ(WasmInterpreter::PAUSED, thread.state());
- CHECK_EQ(kLocalsDeclSize + offsets[0], thread.GetBreakpointPc());
+ CHECK_EQ(WasmInterpreter::PAUSED, thread->state());
+ CHECK_EQ(kLocalsDeclSize + offsets[0], thread->GetBreakpointPc());
}
- thread.Run(); // run to completion
+ thread->Run(); // run to completion
// Check the thread finished with the right value.
- CHECK_EQ(WasmInterpreter::FINISHED, thread.state());
+ CHECK_EQ(WasmInterpreter::FINISHED, thread->state());
uint32_t expected = (*a) & (b);
- CHECK_EQ(expected, thread.GetReturnValue().to<uint32_t>());
+ CHECK_EQ(expected, thread->GetReturnValue().to<uint32_t>());
}
}
}

Powered by Google App Engine
This is Rietveld 408576698