Commit ea9e5a76 authored by Ben Smith's avatar Ben Smith Committed by Commit Bot

[wasm] Rename CheckCallViaJS with argument array

WasmRunner provides CheckCallViaJS, which calls a wasm function through
JS and checks its result.

There are currently two overloads, one that takes a variable number of
arguments, and another more general 4-argument version that takes an
array of arguments. This means if you run code like:

    r.CheckCallViaJS(0, 0, 0, 0);

The overload resolution kicks in, and chooses the general version, which
will always segfault.

This CL renames the general version to `CheckCallApplyViaJS` so the
above example will call the variable-argument version instead.

Change-Id: I14a742c467692e09e84f03504cec2306a794fc24
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1529990Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Ben Smith <binji@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60345}
parent 9a05c175
......@@ -152,10 +152,10 @@ WASM_EXEC_TEST(Run_IndirectCallJSFunction) {
WASM_I32V(right), WASM_GET_LOCAL(0)));
Handle<Object> args_left[] = {isolate->factory()->NewNumber(1)};
r.CheckCallViaJS(left, rc_fn.function_index(), args_left, 1);
r.CheckCallApplyViaJS(left, rc_fn.function_index(), args_left, 1);
Handle<Object> args_right[] = {isolate->factory()->NewNumber(0)};
r.CheckCallViaJS(right, rc_fn.function_index(), args_right, 1);
r.CheckCallApplyViaJS(right, rc_fn.function_index(), args_right, 1);
}
void RunJSSelectTest(ExecutionTier tier, int which) {
......@@ -189,7 +189,7 @@ void RunJSSelectTest(ExecutionTier tier, int which) {
}
double expected = inputs.arg_d(which);
r.CheckCallViaJS(expected, t.function_index(), nullptr, 0);
r.CheckCallApplyViaJS(expected, t.function_index(), nullptr, 0);
}
}
......@@ -259,7 +259,7 @@ void RunWASMSelectTest(ExecutionTier tier, int which) {
};
double expected = inputs.arg_d(which);
r.CheckCallViaJS(expected, t.function_index(), args, kMaxParams);
r.CheckCallApplyViaJS(expected, t.function_index(), args, kMaxParams);
}
}
......@@ -331,7 +331,7 @@ void RunWASMSelectAlignTest(ExecutionTier tier, int num_args, int num_params) {
double nan = std::numeric_limits<double>::quiet_NaN();
double expected = which < num_args ? inputs.arg_d(which) : nan;
r.CheckCallViaJS(expected, t.function_index(), args, num_args);
r.CheckCallApplyViaJS(expected, t.function_index(), args, num_args);
}
}
......@@ -446,7 +446,7 @@ void RunJSSelectAlignTest(ExecutionTier tier, int num_args, int num_params) {
double nan = std::numeric_limits<double>::quiet_NaN();
double expected = which < num_args ? inputs.arg_d(which) : nan;
r.CheckCallViaJS(expected, t.function_index(), args, num_args);
r.CheckCallApplyViaJS(expected, t.function_index(), args, num_args);
}
}
......@@ -556,10 +556,10 @@ void RunPickerTest(ExecutionTier tier, bool indirect) {
}
Handle<Object> args_left[] = {isolate->factory()->NewNumber(1)};
r.CheckCallViaJS(left, rc_fn.function_index(), args_left, 1);
r.CheckCallApplyViaJS(left, rc_fn.function_index(), args_left, 1);
Handle<Object> args_right[] = {isolate->factory()->NewNumber(0)};
r.CheckCallViaJS(right, rc_fn.function_index(), args_right, 1);
r.CheckCallApplyViaJS(right, rc_fn.function_index(), args_right, 1);
}
WASM_EXEC_TEST(Run_ReturnCallImportedFunction) {
......
......@@ -505,8 +505,8 @@ class WasmRunner : public WasmRunnerBase {
}
}
void CheckCallViaJS(double expected, uint32_t function_index,
Handle<Object>* buffer, int count) {
void CheckCallApplyViaJS(double expected, uint32_t function_index,
Handle<Object>* buffer, int count) {
Isolate* isolate = builder_.isolate();
if (jsfuncs_.size() <= function_index) {
jsfuncs_.resize(function_index + 1);
......@@ -536,7 +536,7 @@ class WasmRunner : public WasmRunnerBase {
void CheckCallViaJS(double expected, ParamTypes... p) {
Isolate* isolate = builder_.isolate();
Handle<Object> buffer[] = {isolate->factory()->NewNumber(p)...};
CheckCallViaJS(expected, function()->func_index, buffer, sizeof...(p));
CheckCallApplyViaJS(expected, function()->func_index, buffer, sizeof...(p));
}
Handle<Code> GetWrapperCode() { return wrapper_.GetWrapperCode(); }
......
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