[wasm][fuzzer] Fix instantiation in fuzzer

Reset the instance before the test run, to ensure it runs with the
same initial state as the reference run.

R=clemensb@chromium.org

Bug: chromium:1227591
Change-Id: Ie78b4b84e3df37ab8955c240f1d41e2f5e89a5de
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3015572
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75658}
This commit is contained in:
Thibaud Michaud 2021-07-09 12:45:30 +02:00 committed by V8 LUCI CQ
parent 431598af59
commit dd8ee88c87

View File

@ -142,6 +142,15 @@ void InterpretAndExecuteModule(i::Isolate* isolate,
DCHECK(interpreter_result.trapped());
exception_ref = true;
}
// Reset the instance before the test run.
{
ErrorThrower thrower(isolate, "Second Instantiation");
// We instantiated before, so the second instantiation must also succeed:
CHECK(GetWasmEngine()
->SyncInstantiate(isolate, &thrower, module_object, {},
{}) // no imports & memory
.ToHandle(&instance));
}
} else {
Handle<WasmInstanceObject> instance_ref;
{