Revert "[wasm][fuzzer] Fix exception detection"

This reverts commit 899cb34868.

Reason for revert: Added regression test fails on Arm Sim:
https://ci.chromium.org/p/v8/builders/ci/V8%20Linux%20-%20arm%20-%20sim%20-%20lite/11584

Original change's description:
> [wasm][fuzzer] Fix exception detection
> 
> Exceptions were detected by checking for a pending exception on the
> isolate, but {CallWasmFunctionForTesting} was clearing any pending
> exception before returning.
> This CL fixes that by explicitly passing back a boolean which is set if
> an exception occurred during execution.
> 
> R=​ahaas@chromium.org
> 
> Bug: chromium:1115280
> Change-Id: Ife71ceef0751d18e0870335b9520c2bf77e351cc
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2352787
> Reviewed-by: Andreas Haas <ahaas@chromium.org>
> Commit-Queue: Clemens Backes <clemensb@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#69404}

TBR=ahaas@chromium.org,clemensb@chromium.org

Change-Id: I1d3c0e57df7ec25b09f2037c31c9b30eb0866548
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:1115280
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2357189
Reviewed-by: Bill Budge <bbudge@chromium.org>
Commit-Queue: Bill Budge <bbudge@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69405}
This commit is contained in:
Bill Budge 2020-08-14 18:31:09 +00:00 committed by Commit Bot
parent 899cb34868
commit a2268e6e2a
4 changed files with 9 additions and 11 deletions

View File

@ -172,8 +172,7 @@ MaybeHandle<WasmExportedFunction> GetExportedFunction(
int32_t CallWasmFunctionForTesting(Isolate* isolate,
Handle<WasmInstanceObject> instance,
const char* name, int argc,
Handle<Object> argv[], bool* exception) {
if (exception) *exception = false;
Handle<Object> argv[]) {
MaybeHandle<WasmExportedFunction> maybe_export =
GetExportedFunction(isolate, instance, name);
Handle<WasmExportedFunction> main_export;
@ -190,7 +189,6 @@ int32_t CallWasmFunctionForTesting(Isolate* isolate,
if (retval.is_null()) {
DCHECK(isolate->has_pending_exception());
isolate->clear_pending_exception();
if (exception) *exception = true;
return -1;
}
Handle<Object> result = retval.ToHandleChecked();

View File

@ -31,13 +31,11 @@ MaybeHandle<WasmExportedFunction> GetExportedFunction(
// Call an exported wasm function by name. Returns -1 if the export does not
// exist or throws an error. Errors are cleared from the isolate before
// returning. {exception} is set to to true if an exception happened during
// execution of the wasm function.
// returning.
int32_t CallWasmFunctionForTesting(Isolate* isolate,
Handle<WasmInstanceObject> instance,
const char* name, int argc,
Handle<Object> argv[],
bool* exception = nullptr);
Handle<Object> argv[]);
// Decode, verify, and run the function labeled "main" in the
// given encoded module. The module should have no imports.

View File

@ -82,19 +82,21 @@ void InterpretAndExecuteModule(i::Isolate* isolate,
.ToHandle(&instance));
}
bool exception = false;
int32_t result_compiled = testing::CallWasmFunctionForTesting(
isolate, instance, "main", 0, nullptr, &exception);
if (interpreter_result.trapped() != exception) {
isolate, instance, "main", 0, nullptr);
if (interpreter_result.trapped() != isolate->has_pending_exception()) {
const char* exception_text[] = {"no exception", "exception"};
FATAL("interpreter: %s; compiled: %s",
exception_text[interpreter_result.trapped()],
exception_text[exception]);
exception_text[isolate->has_pending_exception()]);
}
if (interpreter_result.finished()) {
CHECK_EQ(interpreter_result.result(), result_compiled);
}
// Cleanup any pending exception.
isolate->clear_pending_exception();
}
namespace {