Commit 75289506 authored by Zhi An Ng's avatar Zhi An Ng Committed by Commit Bot

[wasm] Handle multi-value return in compiled fuzzing result

When a function returns multiple result, we check the only the first
result. We correctly get the first return value from the interpreter
results, but did not handle the compiled code correctly, which returns a
JSArray.

Bug: chromium:1153406
Change-Id: I32198cea131cab18094fac3e66a44e976907773d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2562816Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71488}
parent 63c95cad
......@@ -237,6 +237,13 @@ int32_t CallWasmFunctionForTesting(Isolate* isolate,
return -1;
}
Handle<Object> result = retval.ToHandleChecked();
// Multi-value returns, get the first return value (see InterpretWasmModule).
if (result->IsJSArray()) {
auto receiver = Handle<JSReceiver>::cast(result);
result = JSObject::GetElement(isolate, receiver, 0).ToHandleChecked();
}
if (result->IsSmi()) {
return Smi::ToInt(*result);
}
......
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