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

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

Issue 2061583002: [ia32] Propagate rmodes when computing MemoryOperands (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: sep tests 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
« no previous file with comments | « src/compiler/ia32/code-generator-ia32.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-asmjs.cc
diff --git a/test/cctest/wasm/test-run-wasm-asmjs.cc b/test/cctest/wasm/test-run-wasm-asmjs.cc
index 30de588a062e45344ab0f313c380f4853d602841..0fe7faeb99e76818b48372136a509e70c18dad93 100644
--- a/test/cctest/wasm/test-run-wasm-asmjs.cc
+++ b/test/cctest/wasm/test-run-wasm-asmjs.cc
@@ -26,6 +26,17 @@ using namespace v8::internal::wasm;
#define RET(x) x, kExprReturn, 1
#define RET_I8(x) kExprI8Const, x, kExprReturn, 1
+namespace {
+uint32_t GetMatchingRelocInfoCount(Handle<Code> code, RelocInfo::Mode rmode) {
+ int filter = 1 << rmode;
+ uint32_t ret = 0;
+ for (RelocIterator it(*code, filter); !it.done(); it.next()) {
+ ++ret;
+ }
+ return ret;
+}
+}
+
WASM_EXEC_TEST(Int32AsmjsDivS) {
WasmRunner<int32_t> r(execution_mode, MachineType::Int32(),
MachineType::Int32());
@@ -197,3 +208,77 @@ WASM_EXEC_TEST(StoreMemI32_oob_asm) {
CHECK_EQ(7777, r.Call(offset, 7777));
}
}
+
+#define FOREACH_INT_CHECKED_LOAD_OP(TEST_BODY) \
+ TEST_BODY(kExprI32AsmjsLoadMem8S) \
+ TEST_BODY(kExprI32AsmjsLoadMem8U) \
+ TEST_BODY(kExprI32AsmjsLoadMem16S) \
+ TEST_BODY(kExprI32AsmjsLoadMem16U) \
+ TEST_BODY(kExprI32AsmjsLoadMem)
+
+#define FOREACH_INT_CHECKED_STORE_OP(TEST_BODY) \
+ TEST_BODY(kExprI32AsmjsStoreMem8) \
+ TEST_BODY(kExprI32AsmjsStoreMem16) \
+ TEST_BODY(kExprI32AsmjsStoreMem)
+
+#define INT_LOAD_TEST(OP_TYPE) \
+ TEST(RunWasm_AsmCheckedRelocInfo##OP_TYPE) { \
+ TestingModule module(kExecuteCompiled); \
+ WasmRunner<int32_t> r(&module, MachineType::Uint32()); \
+ BUILD(r, WASM_UNOP(OP_TYPE, WASM_GET_LOCAL(0))); \
+ CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0], \
+ RelocInfo::WASM_MEMORY_REFERENCE)); \
+ }
+
+FOREACH_INT_CHECKED_LOAD_OP(INT_LOAD_TEST)
+
+#define INT_STORE_TEST(OP_TYPE) \
+ TEST(RunWasm_AsmCheckedRelocInfo##OP_TYPE) { \
+ TestingModule module(kExecuteCompiled); \
+ WasmRunner<int32_t> r(&module, MachineType::Uint32(), \
+ MachineType::Uint32()); \
+ BUILD(r, WASM_BINOP(OP_TYPE, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); \
+ CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0], \
+ RelocInfo::WASM_MEMORY_REFERENCE)); \
+ }
+
+FOREACH_INT_CHECKED_STORE_OP(INT_STORE_TEST)
+
+TEST(RunWasm_AsmCheckedLoadFloat32RelocInfo) {
+ TestingModule module(kExecuteCompiled);
+ WasmRunner<float_t> r(&module, MachineType::Uint32());
+ BUILD(r, WASM_UNOP(kExprF32AsmjsLoadMem, WASM_GET_LOCAL(0)));
+
+ CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0],
+ RelocInfo::WASM_MEMORY_REFERENCE));
+}
+
+TEST(RunWasm_AsmCheckedStoreFloat32RelocInfo) {
+ TestingModule module(kExecuteCompiled);
+ WasmRunner<float_t> r(&module, MachineType::Uint32(), MachineType::Float32());
+ BUILD(r, WASM_BINOP(kExprF32AsmjsStoreMem, WASM_GET_LOCAL(0),
+ WASM_GET_LOCAL(1)));
+
+ CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0],
+ RelocInfo::WASM_MEMORY_REFERENCE));
+}
+
+TEST(RunWasm_AsmCheckedLoadFloat64RelocInfo) {
+ TestingModule module(kExecuteCompiled);
+ WasmRunner<double_t> r(&module, MachineType::Uint32());
+ BUILD(r, WASM_UNOP(kExprF64AsmjsLoadMem, WASM_GET_LOCAL(0)));
+
+ CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0],
+ RelocInfo::WASM_MEMORY_REFERENCE));
+}
+
+TEST(RunWasm_AsmCheckedStoreFloat64RelocInfo) {
+ TestingModule module(kExecuteCompiled);
+ WasmRunner<double_t> r(&module, MachineType::Uint32(),
+ MachineType::Float64());
+ BUILD(r, WASM_BINOP(kExprF64AsmjsStoreMem, WASM_GET_LOCAL(0),
+ WASM_GET_LOCAL(1)));
+
+ CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0],
+ RelocInfo::WASM_MEMORY_REFERENCE));
+}
« no previous file with comments | « src/compiler/ia32/code-generator-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698