Commit 4a7c98e5 authored by Andreas Haas's avatar Andreas Haas Committed by Commit Bot

[wasm][fuzzer] Clear pending exception unconditionally

Pending exceptions were not cleared when the TurboFan result was not
compared to the Interpreter result, which happens when the result may be
affected by potential nondeterminism. With this CL we always clear
pending exceptions.

R=clemensh@chromium.org

Bug: chromium:782267
Change-Id: Ibe9b33c94810cccb6282c6c8dc49748fb79b07e4
Reviewed-on: https://chromium-review.googlesource.com/758272Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49265}
parent 6003457c
......@@ -31,9 +31,7 @@ int FuzzWasmSection(SectionCode section, const uint8_t* data, size_t size) {
i::Isolate* i_isolate = reinterpret_cast<Isolate*>(isolate);
// Clear any pending exceptions from a prior run.
if (i_isolate->has_pending_exception()) {
i_isolate->clear_pending_exception();
}
i_isolate->clear_pending_exception();
v8::Isolate::Scope isolate_scope(isolate);
v8::HandleScope handle_scope(isolate);
......@@ -119,9 +117,7 @@ int WasmExecutionFuzzer::FuzzWasmModule(const uint8_t* data, size_t size,
i::Isolate* i_isolate = reinterpret_cast<Isolate*>(isolate);
// Clear any pending exceptions from a prior run.
if (i_isolate->has_pending_exception()) {
i_isolate->clear_pending_exception();
}
i_isolate->clear_pending_exception();
v8::Isolate::Scope isolate_scope(isolate);
v8::HandleScope handle_scope(isolate);
......@@ -223,11 +219,13 @@ int WasmExecutionFuzzer::FuzzWasmModule(const uint8_t* data, size_t size,
// if the execution may have produced a NaN at some point.
if (!possible_nondeterminism) {
CHECK_EQ(expect_exception, i_isolate->has_pending_exception());
i_isolate->clear_pending_exception();
if (!expect_exception) CHECK_EQ(result_interpreter, result_turbofan);
}
// Clear any pending exceptions for the next run.
i_isolate->clear_pending_exception();
int32_t result_liftoff;
{
FlagScope<bool> liftoff(&FLAG_liftoff, true);
......@@ -244,11 +242,12 @@ int WasmExecutionFuzzer::FuzzWasmModule(const uint8_t* data, size_t size,
}
if (!possible_nondeterminism) {
CHECK_EQ(expect_exception, i_isolate->has_pending_exception());
i_isolate->clear_pending_exception();
if (!expect_exception) CHECK_EQ(result_interpreter, result_liftoff);
}
// Cleanup any pending exception.
i_isolate->clear_pending_exception();
return 0;
}
......
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