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

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

Issue 2341653002: [wasm] Implement GrowMemory in the wasm interpreter (Closed)
Patch Set: Add comment Created 4 years, 3 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
« no previous file with comments | « src/wasm/wasm-interpreter.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/wasm/test-run-wasm-interpreter.cc
diff --git a/test/cctest/wasm/test-run-wasm-interpreter.cc b/test/cctest/wasm/test-run-wasm-interpreter.cc
index c4e03b50d6138cbf45c124fa06c3efeee2890378..ff5f57ea432f2cb9a53c7a7535551fceb5605a66 100644
--- a/test/cctest/wasm/test-run-wasm-interpreter.cc
+++ b/test/cctest/wasm/test-run-wasm-interpreter.cc
@@ -286,6 +286,26 @@ TEST(Breakpoint_I32And_disable) {
}
}
+TEST(GrowMemory) {
+ TestingModule module(kExecuteInterpreted);
+ WasmRunner<int32_t> r(&module, MachineType::Uint32());
+ module.AddMemory(WasmModule::kPageSize);
+ BUILD(r, WASM_GROW_MEMORY(WASM_GET_LOCAL(0)));
+ CHECK_EQ(1, r.Call(1));
+}
+
+TEST(GrowMemoryPreservesData) {
+ int32_t index = 16;
+ int32_t value = 2335;
+ TestingModule module(kExecuteInterpreted);
+ WasmRunner<int32_t> r(&module, MachineType::Uint32());
+ module.AddMemory(WasmModule::kPageSize);
+ BUILD(r, WASM_BLOCK(WASM_STORE_MEM(MachineType::Int32(), WASM_I32V(index),
+ WASM_I32V(value)),
+ WASM_GROW_MEMORY(WASM_GET_LOCAL(0)),
+ WASM_LOAD_MEM(MachineType::Int32(), WASM_I32V(index))));
+ CHECK_EQ(value, r.Call(1));
+}
} // namespace wasm
} // namespace internal
} // namespace v8
« no previous file with comments | « src/wasm/wasm-interpreter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698