Commit c4119758 authored by ahaas's avatar ahaas Committed by Commit bot

[wasm] Use correct parameter type in wasm-run-utils.h

Due to a typo wasm-run-utils used the type of the first parameter for
all parameters. This caused problems if not all parameters had the same
type.

R=titzer@chromium.org, clemensh@chromium.org

Review-Url: https://codereview.chromium.org/2463743002
Cr-Commit-Position: refs/heads/master@{#40667}
parent fde9039f
...@@ -827,6 +827,15 @@ WASM_EXEC_TEST(Return_F64) { ...@@ -827,6 +827,15 @@ WASM_EXEC_TEST(Return_F64) {
} }
} }
WASM_EXEC_TEST(Select_float_parameters) {
WasmRunner<float> r(execution_mode, MachineType::Float32(),
MachineType::Float32(), MachineType::Int32());
// return select(11, 22, a);
BUILD(r,
WASM_SELECT(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1), WASM_GET_LOCAL(2)));
CHECK_FLOAT_EQ(2.0f, r.Call(2.0f, 1.0f, 1));
}
WASM_EXEC_TEST(Select) { WASM_EXEC_TEST(Select) {
WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); WasmRunner<int32_t> r(execution_mode, MachineType::Int32());
// return select(11, 22, a); // return select(11, 22, a);
......
...@@ -355,7 +355,7 @@ class WasmFunctionWrapper : public HandleAndZoneScope, ...@@ -355,7 +355,7 @@ class WasmFunctionWrapper : public HandleAndZoneScope,
} }
if (p1 != MachineType::None()) { if (p1 != MachineType::None()) {
parameters[parameter_count] = graph()->NewNode( parameters[parameter_count] = graph()->NewNode(
machine()->Load(p0), machine()->Load(p1),
graph()->NewNode(common()->Parameter(1), graph()->start()), graph()->NewNode(common()->Parameter(1), graph()->start()),
graph()->NewNode(common()->Int32Constant(0)), effect, graph()->NewNode(common()->Int32Constant(0)), effect,
graph()->start()); graph()->start());
...@@ -363,7 +363,7 @@ class WasmFunctionWrapper : public HandleAndZoneScope, ...@@ -363,7 +363,7 @@ class WasmFunctionWrapper : public HandleAndZoneScope,
} }
if (p2 != MachineType::None()) { if (p2 != MachineType::None()) {
parameters[parameter_count] = graph()->NewNode( parameters[parameter_count] = graph()->NewNode(
machine()->Load(p0), machine()->Load(p2),
graph()->NewNode(common()->Parameter(2), graph()->start()), graph()->NewNode(common()->Parameter(2), graph()->start()),
graph()->NewNode(common()->Int32Constant(0)), effect, graph()->NewNode(common()->Int32Constant(0)), effect,
graph()->start()); graph()->start());
...@@ -371,7 +371,7 @@ class WasmFunctionWrapper : public HandleAndZoneScope, ...@@ -371,7 +371,7 @@ class WasmFunctionWrapper : public HandleAndZoneScope,
} }
if (p3 != MachineType::None()) { if (p3 != MachineType::None()) {
parameters[parameter_count] = graph()->NewNode( parameters[parameter_count] = graph()->NewNode(
machine()->Load(p0), machine()->Load(p3),
graph()->NewNode(common()->Parameter(3), graph()->start()), graph()->NewNode(common()->Parameter(3), graph()->start()),
graph()->NewNode(common()->Int32Constant(0)), effect, graph()->NewNode(common()->Int32Constant(0)), effect,
graph()->start()); graph()->start());
......
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