Commit b077d88e authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[wasm] Support anyref for external calls in interpreter.

This adds support for passing/returning reference type parameter/return
values when the interpreter is calling extern functions. It expands the
existing test coverage to the interpreter.

R=clemensh@chromium.org
TEST=mjsunit/wasm/anyref-interpreter,mjsunit/wasm/anyfunc-interpreter
BUG=v8:8091,v8:7581

Change-Id: I377e9d28aa36866c0441683ffd6a48160b721ec1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1559853Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60715}
parent 31b49aee
......@@ -3517,6 +3517,12 @@ class ThreadImpl {
case kWasmF64:
WriteUnalignedValue(address, arg.to<double>());
break;
case kWasmAnyRef:
case kWasmAnyFunc:
case kWasmExceptRef:
DCHECK_EQ(kSystemPointerSize, param_size);
WriteUnalignedValue<Object>(address, *arg.to_anyref());
break;
default:
UNIMPLEMENTED();
}
......@@ -3588,6 +3594,13 @@ class ThreadImpl {
case kWasmF64:
Push(WasmValue(ReadUnalignedValue<double>(address)));
break;
case kWasmAnyRef:
case kWasmAnyFunc:
case kWasmExceptRef: {
Handle<Object> ref(ReadUnalignedValue<Object>(address), isolate);
Push(WasmValue(ref));
break;
}
default:
UNIMPLEMENTED();
}
......
// Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-wasm --experimental-wasm-anyref --expose-gc
// Flags: --wasm-interpret-all
// This is just a wrapper for an existing reference types test case that runs
// with the --wasm-interpret-all flag added. If we ever decide to add a test
// variant for this, then we can remove this file.
load("test/mjsunit/wasm/anyfunc.js");
// Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-wasm --experimental-wasm-anyref --expose-gc
// Flags: --wasm-interpret-all
// This is just a wrapper for an existing reference types test case that runs
// with the --wasm-interpret-all flag added. If we ever decide to add a test
// variant for this, then we can remove this file.
load("test/mjsunit/wasm/anyref.js");
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