diff --git a/test/cctest/wasm/test-grow-memory.cc b/test/cctest/wasm/test-grow-memory.cc
index a984fc9706..b796e8ff9a 100644
--- a/test/cctest/wasm/test-grow-memory.cc
+++ b/test/cctest/wasm/test-grow-memory.cc
@@ -114,8 +114,7 @@ TEST(Run_WasmModule_Buffer_Externalized_GrowMem) {
handle(memory_object->array_buffer(), isolate));
// Grow using an internal Wasm bytecode.
- result = testing::CallWasmFunctionForTesting(isolate, instance, "main", 0,
- nullptr);
+ result = testing::CallWasmFunctionForTesting(isolate, instance, "main", {});
CHECK_EQ(26, result);
CHECK(external2.buffer_->was_detached()); // growing always detaches
CHECK_EQ(0, external2.buffer_->byte_length());
diff --git a/test/cctest/wasm/test-run-wasm-module.cc b/test/cctest/wasm/test-run-wasm-module.cc
index 8de6b4224d..e46be43703 100644
--- a/test/cctest/wasm/test-run-wasm-module.cc
+++ b/test/cctest/wasm/test-run-wasm-module.cc
@@ -138,7 +138,7 @@ TEST(Run_WasmModule_CompilationHintsLazy) {
isolate, &thrower, module.ToHandleChecked(), {}, {});
CHECK(!instance.is_null());
int32_t result = testing::CallWasmFunctionForTesting(
- isolate, instance.ToHandleChecked(), "main", 0, nullptr);
+ isolate, instance.ToHandleChecked(), "main", {});
CHECK_EQ(kReturnValue, result);
// Lazy function was invoked and therefore compiled.
@@ -578,7 +578,7 @@ TEST(TestInterruptLoop) {
InterruptThread thread(isolate, memory_array);
CHECK(thread.Start());
- testing::CallWasmFunctionForTesting(isolate, instance, "main", 0, nullptr);
+ testing::CallWasmFunctionForTesting(isolate, instance, "main", {});
Address address = reinterpret_cast
(
&memory_array[InterruptThread::interrupt_location_]);
CHECK_EQ(InterruptThread::interrupt_value_,
@@ -658,16 +658,17 @@ TEST(Run_WasmModule_GrowMemOobFixedIndex) {
// Initial memory size is 16 pages, should trap till index > MemSize on
// consecutive GrowMem calls
for (uint32_t i = 1; i < 5; i++) {
- Handle params[1] = {Handle(Smi::FromInt(i), isolate)};
+ Handle params[1] = {handle(Smi::FromInt(i), isolate)};
v8::TryCatch try_catch(reinterpret_cast(isolate));
- testing::CallWasmFunctionForTesting(isolate, instance, "main", 1, params);
+ testing::CallWasmFunctionForTesting(isolate, instance, "main",
+ base::ArrayVector(params));
CHECK(try_catch.HasCaught());
isolate->clear_pending_exception();
}
- Handle params[1] = {Handle(Smi::FromInt(1), isolate)};
- int32_t result = testing::CallWasmFunctionForTesting(isolate, instance,
- "main", 1, params);
+ Handle params[1] = {handle(Smi::FromInt(1), isolate)};
+ int32_t result = testing::CallWasmFunctionForTesting(
+ isolate, instance, "main", base::ArrayVector(params));
CHECK_EQ(0xACED, result);
}
Cleanup();
@@ -708,23 +709,24 @@ TEST(Run_WasmModule_GrowMemOobVariableIndex) {
Handle params[1] = {
Handle(Smi::FromInt((16 + i) * kPageSize - 3), isolate)};
v8::TryCatch try_catch(reinterpret_cast(isolate));
- testing::CallWasmFunctionForTesting(isolate, instance, "main", 1, params);
+ testing::CallWasmFunctionForTesting(isolate, instance, "main",
+ base::ArrayVector(params));
CHECK(try_catch.HasCaught());
isolate->clear_pending_exception();
}
for (int i = 1; i < 5; i++) {
Handle params[1] = {
- Handle(Smi::FromInt((20 + i) * kPageSize - 4), isolate)};
- int32_t result = testing::CallWasmFunctionForTesting(isolate, instance,
- "main", 1, params);
+ handle(Smi::FromInt((20 + i) * kPageSize - 4), isolate)};
+ int32_t result = testing::CallWasmFunctionForTesting(
+ isolate, instance, "main", base::ArrayVector(params));
CHECK_EQ(0xACED, result);
}
v8::TryCatch try_catch(reinterpret_cast(isolate));
- Handle params[1] = {
- Handle(Smi::FromInt(25 * kPageSize), isolate)};
- testing::CallWasmFunctionForTesting(isolate, instance, "main", 1, params);
+ Handle params[1] = {handle(Smi::FromInt(25 * kPageSize), isolate)};
+ testing::CallWasmFunctionForTesting(isolate, instance, "main",
+ base::ArrayVector(params));
CHECK(try_catch.HasCaught());
isolate->clear_pending_exception();
}
diff --git a/test/cctest/wasm/test-wasm-serialization.cc b/test/cctest/wasm/test-wasm-serialization.cc
index 27daee1762..b23bf65e5a 100644
--- a/test/cctest/wasm/test-wasm-serialization.cc
+++ b/test/cctest/wasm/test-wasm-serialization.cc
@@ -96,10 +96,10 @@ class WasmSerializationTest {
Handle::null(),
MaybeHandle())
.ToHandleChecked();
- Handle params[1] = {
- Handle(Smi::FromInt(41), CcTest::i_isolate())};
+ Handle params[1] = {handle(Smi::FromInt(41), CcTest::i_isolate())};
int32_t result = testing::CallWasmFunctionForTesting(
- CcTest::i_isolate(), instance, kFunctionName, 1, params);
+ CcTest::i_isolate(), instance, kFunctionName,
+ base::ArrayVector(params));
CHECK_EQ(42, result);
}
@@ -171,7 +171,7 @@ class WasmSerializationTest {
CHECK_EQ(0, data_.size);
while (data_.size == 0) {
testing::CallWasmFunctionForTesting(serialization_isolate, instance,
- kFunctionName, 0, nullptr);
+ kFunctionName, {});
data_ = compiled_module.Serialize();
}
CHECK_LT(0, data_.size);
diff --git a/test/cctest/wasm/test-wasm-shared-engine.cc b/test/cctest/wasm/test-wasm-shared-engine.cc
index 2591cf92d1..d02c8ff6ad 100644
--- a/test/cctest/wasm/test-wasm-shared-engine.cc
+++ b/test/cctest/wasm/test-wasm-shared-engine.cc
@@ -73,8 +73,7 @@ class SharedEngineIsolate {
}
int32_t Run(Handle instance) {
- return testing::CallWasmFunctionForTesting(isolate(), instance, "main", 0,
- nullptr);
+ return testing::CallWasmFunctionForTesting(isolate(), instance, "main", {});
}
private:
diff --git a/test/common/wasm/wasm-module-runner.cc b/test/common/wasm/wasm-module-runner.cc
index e1f9fb3138..bab0241c70 100644
--- a/test/common/wasm/wasm-module-runner.cc
+++ b/test/common/wasm/wasm-module-runner.cc
@@ -130,7 +130,7 @@ int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start,
return -1;
}
return CallWasmFunctionForTesting(isolate, instance.ToHandleChecked(), "main",
- 0, nullptr);
+ {});
}
WasmInterpretationResult InterpretWasmModule(
@@ -218,8 +218,8 @@ MaybeHandle GetExportedFunction(
int32_t CallWasmFunctionForTesting(Isolate* isolate,
Handle instance,
- const char* name, int argc,
- Handle argv[],
+ const char* name,
+ base::Vector> args,
std::unique_ptr* exception) {
DCHECK_IMPLIES(exception != nullptr, *exception == nullptr);
MaybeHandle maybe_export =
@@ -231,8 +231,8 @@ int32_t CallWasmFunctionForTesting(Isolate* isolate,
// Call the JS function.
Handle undefined = isolate->factory()->undefined_value();
- MaybeHandle retval =
- Execution::Call(isolate, main_export, undefined, argc, argv);
+ MaybeHandle retval = Execution::Call(isolate, main_export, undefined,
+ args.length(), args.begin());
// The result should be a number.
if (retval.is_null()) {
diff --git a/test/common/wasm/wasm-module-runner.h b/test/common/wasm/wasm-module-runner.h
index 92d740e352..00ddca519f 100644
--- a/test/common/wasm/wasm-module-runner.h
+++ b/test/common/wasm/wasm-module-runner.h
@@ -34,7 +34,7 @@ MaybeHandle GetExportedFunction(
// set and an exception occurs).
int32_t CallWasmFunctionForTesting(
Isolate* isolate, Handle instance, const char* name,
- int argc, Handle argv[],
+ base::Vector> args,
std::unique_ptr* exception = nullptr);
// Decode, verify, and run the function labeled "main" in the
diff --git a/test/fuzzer/wasm-fuzzer-common.cc b/test/fuzzer/wasm-fuzzer-common.cc
index 3fecc31ef6..eb219fbe29 100644
--- a/test/fuzzer/wasm-fuzzer-common.cc
+++ b/test/fuzzer/wasm-fuzzer-common.cc
@@ -124,8 +124,7 @@ void ExecuteAgainstReference(Isolate* isolate,
testing::MakeDefaultArguments(isolate, main_function->sig());
std::unique_ptr exception_ref;
int32_t result_ref = testing::CallWasmFunctionForTesting(
- isolate, instance_ref, "main", static_cast(compiled_args.size()),
- compiled_args.begin(), &exception_ref);
+ isolate, instance_ref, "main", compiled_args.as_vector(), &exception_ref);
// Reached max steps, do not try to execute the test module as it might
// never terminate.
if (max_steps < 0) return;
@@ -157,8 +156,7 @@ void ExecuteAgainstReference(Isolate* isolate,
std::unique_ptr exception;
int32_t result = testing::CallWasmFunctionForTesting(
- isolate, instance, "main", static_cast(compiled_args.size()),
- compiled_args.begin(), &exception);
+ isolate, instance, "main", compiled_args.as_vector(), &exception);
if ((exception_ref != nullptr) != (exception != nullptr)) {
FATAL("Exception mispatch! Expected: <%s>; got: <%s>",