summaryrefslogtreecommitdiff
path: root/deps/v8/test/fuzzer/wasm-fuzzer-common.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/test/fuzzer/wasm-fuzzer-common.cc')
-rw-r--r--deps/v8/test/fuzzer/wasm-fuzzer-common.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/deps/v8/test/fuzzer/wasm-fuzzer-common.cc b/deps/v8/test/fuzzer/wasm-fuzzer-common.cc
index 6884728ff1..b2e0b4bd2b 100644
--- a/deps/v8/test/fuzzer/wasm-fuzzer-common.cc
+++ b/deps/v8/test/fuzzer/wasm-fuzzer-common.cc
@@ -165,7 +165,7 @@ void GenerateTestCase(Isolate* isolate, ModuleWireBytes wire_bytes,
"load('test/mjsunit/wasm/wasm-module-builder.js');\n"
"\n"
"(function() {\n"
- " var builder = new WasmModuleBuilder();\n";
+ " const builder = new WasmModuleBuilder();\n";
if (module->has_memory) {
os << " builder.addMemory(" << module->initial_pages;
@@ -185,14 +185,15 @@ void GenerateTestCase(Isolate* isolate, ModuleWireBytes wire_bytes,
for (const WasmFunction& func : module->functions) {
Vector<const uint8_t> func_code = wire_bytes.GetFunctionBytes(&func);
- os << " // Generate function " << func.func_index << " (out of "
+ os << " // Generate function " << (func.func_index + 1) << " (out of "
<< module->functions.size() << ").\n";
// Generate signature.
- os << " sig" << func.func_index << " = makeSig("
+ os << " sig" << (func.func_index + 1) << " = makeSig("
<< PrintParameters(func.sig) << ", " << PrintReturns(func.sig) << ");\n";
// Add function.
- os << " builder.addFunction(undefined, sig" << func.func_index << ")\n";
+ os << " builder.addFunction(undefined, sig" << (func.func_index + 1)
+ << ")\n";
// Add locals.
BodyLocalDecls decls(&tmp_zone);
@@ -226,8 +227,8 @@ void GenerateTestCase(Isolate* isolate, ModuleWireBytes wire_bytes,
}
if (compiles) {
- os << " var module = builder.instantiate();\n"
- " module.exports.main(1, 2, 3);\n";
+ os << " const instance = builder.instantiate();\n"
+ " print(instance.exports.main(1, 2, 3));\n";
} else {
os << " assertThrows(function() { builder.instantiate(); }, "
"WebAssembly.CompileError);\n";