Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Unified Diff: test/cctest/wasm/test-run-wasm-module.cc

Issue 2091533002: [wasm] Consolidate CompileAndRunWasmModule (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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))};
« src/wasm/wasm-module.cc ('K') | « src/wasm/wasm-module.cc ('k') | test/fuzzer/wasm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698