Index: test/cctest/wasm/test-run-wasm-module.cc |
diff --git a/test/cctest/wasm/test-run-wasm-module.cc b/test/cctest/wasm/test-run-wasm-module.cc |
index eb614bcf43f4583b969ee266b5aa43867fa65af1..7a79d677923889964c7908b27ccd98582fc01727 100644 |
--- a/test/cctest/wasm/test-run-wasm-module.cc |
+++ b/test/cctest/wasm/test-run-wasm-module.cc |
@@ -29,9 +29,15 @@ void TestModule(Zone* zone, WasmModuleBuilder* builder, |
HandleScope scope(isolate); |
WasmJs::InstallWasmFunctionMap(isolate, isolate->native_context()); |
int32_t result = |
- CompileAndRunWasmModule(isolate, buffer.begin(), buffer.end()); |
+ testing::CompileAndRunWasmModule(isolate, buffer.begin(), buffer.end()); |
CHECK_EQ(expected_result, result); |
} |
+ |
+void ExportAsMain(WasmFunctionBuilder* f) { |
+ static const char kMainName[] = "main"; |
+ f->SetExported(); |
+ f->SetName(kMainName, arraysize(kMainName) - 1); |
+} |
} // namespace |
TEST(Run_WasmModule_Return114) { |
@@ -44,7 +50,7 @@ TEST(Run_WasmModule_Return114) { |
uint16_t f_index = builder->AddFunction(); |
WasmFunctionBuilder* f = builder->FunctionAt(f_index); |
f->SetSignature(sigs.i_v()); |
- f->SetExported(); |
+ ExportAsMain(f); |
byte code[] = {WASM_I8(kReturnValue)}; |
f->EmitCode(code, sizeof(code)); |
TestModule(&zone, builder, kReturnValue); |
@@ -69,7 +75,7 @@ TEST(Run_WasmModule_CallAdd) { |
f = builder->FunctionAt(f2_index); |
f->SetSignature(sigs.i_v()); |
- f->SetExported(); |
+ ExportAsMain(f); |
byte code2[] = {WASM_CALL_FUNCTION2(f1_index, WASM_I8(77), WASM_I8(22))}; |
f->EmitCode(code2, sizeof(code2)); |
TestModule(&zone, builder, 99); |
@@ -86,7 +92,7 @@ TEST(Run_WasmModule_ReadLoadedDataSegment) { |
WasmFunctionBuilder* f = builder->FunctionAt(f_index); |
f->SetSignature(sigs.i_v()); |
- f->SetExported(); |
+ ExportAsMain(f); |
byte code[] = { |
WASM_LOAD_MEM(MachineType::Int32(), WASM_I8(kDataSegmentDest0))}; |
f->EmitCode(code, sizeof(code)); |
@@ -108,7 +114,7 @@ TEST(Run_WasmModule_CheckMemoryIsZero) { |
f->SetSignature(sigs.i_v()); |
uint16_t localIndex = f->AddLocal(kAstI32); |
- f->SetExported(); |
+ ExportAsMain(f); |
byte code[] = {WASM_BLOCK( |
2, |
WASM_WHILE( |
@@ -132,7 +138,7 @@ TEST(Run_WasmModule_CallMain_recursive) { |
f->SetSignature(sigs.i_v()); |
uint16_t localIndex = f->AddLocal(kAstI32); |
- f->SetExported(); |
+ ExportAsMain(f); |
byte code[] = {WASM_BLOCK( |
2, WASM_SET_LOCAL(localIndex, |
WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO)), |
@@ -162,7 +168,7 @@ TEST(Run_WasmModule_Global) { |
uint16_t f2_index = builder->AddFunction(); |
f = builder->FunctionAt(f2_index); |
f->SetSignature(sigs.i_v()); |
- f->SetExported(); |
+ ExportAsMain(f); |
byte code2[] = {WASM_STORE_GLOBAL(global1, WASM_I32V_1(56)), |
WASM_STORE_GLOBAL(global2, WASM_I32V_1(41)), |
WASM_RETURN1(WASM_CALL_FUNCTION0(f1_index))}; |