Commit 0d894585 authored by Jakob Kummerow's avatar Jakob Kummerow Committed by Commit Bot

[wasm-c-api] Fix signature deserialization

Func::type() was broken for functions created with Func::make().

Change-Id: I2867bcf00d9e5c1488165a804598c9ca8081ff25
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1655648
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Tamer Tas <tmrts@chromium.org>
Reviewed-by: 's avatarTamer Tas <tmrts@chromium.org>
Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62167}
parent b4324bd1
......@@ -1618,12 +1618,12 @@ class SignatureHelper : public i::AllStatic {
vec<ValType*> params = vec<ValType*>::make_uninitialized(param_arity);
int i = 0;
for (; i < sig.length(); ++i) {
for (; i < result_arity; ++i) {
results[i] = ValType::make(v8::wasm::v8_valtype_to_wasm(sig.get(i)));
}
i++;
for (; i < param_arity; ++i) {
params[i] = ValType::make(v8::wasm::v8_valtype_to_wasm(sig.get(i)));
i++; // Skip marker.
for (int p = 0; i < sig.length(); ++i, ++p) {
params[p] = ValType::make(v8::wasm::v8_valtype_to_wasm(sig.get(i)));
}
return FuncType::make(std::move(params), std::move(results));
}
......
file://COMMON_OWNERS
......@@ -180,6 +180,8 @@ TEST_F(WasmCapiTest, GC) {
i::Isolate* isolate =
reinterpret_cast<::wasm::StoreImpl*>(store())->i_isolate();
own<Func*> stage4 = Func::make(store(), cpp_sig(), Stage4_GC, isolate);
EXPECT_EQ(cpp_sig()->params().size(), stage4->type()->params().size());
EXPECT_EQ(cpp_sig()->results().size(), stage4->type()->results().size());
Extern* imports[] = {stage2(), stage4.get()};
Val args[] = {Val::i32(42)};
Val results[1];
......
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