[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/+/1529990
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Ben Smith <binji@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60345}
diff --git a/test/cctest/wasm/test-run-wasm-js.cc b/test/cctest/wasm/test-run-wasm-js.cc
index 040a760..a381b1c 100644
--- a/test/cctest/wasm/test-run-wasm-js.cc
+++ b/test/cctest/wasm/test-run-wasm-js.cc
@@ -152,10 +152,10 @@
                                    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 @@
     }
 
     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 @@
     };
 
     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 @@
 
     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 @@
 
     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 @@
   }
 
   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) {
diff --git a/test/cctest/wasm/wasm-run-utils.h b/test/cctest/wasm/wasm-run-utils.h
index 821040c..093d14e 100644
--- a/test/cctest/wasm/wasm-run-utils.h
+++ b/test/cctest/wasm/wasm-run-utils.h
@@ -505,8 +505,8 @@
     }
   }
 
-  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 @@
   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(); }