 Chromium Code Reviews
 Chromium Code Reviews Issue 2061583002:
  [ia32] Propagate rmodes when computing MemoryOperands  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@master
    
  
    Issue 2061583002:
  [ia32] Propagate rmodes when computing MemoryOperands  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@master| 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..4abb251022da5388a3c09be7b2e550ae740419ac 100644 | 
| --- a/test/cctest/wasm/test-run-wasm-asmjs.cc | 
| +++ b/test/cctest/wasm/test-run-wasm-asmjs.cc | 
| @@ -26,6 +26,22 @@ using namespace v8::internal::wasm; | 
| #define RET(x) x, kExprReturn, 1 | 
| #define RET_I8(x) kExprI8Const, x, kExprReturn, 1 | 
| +#define IF_COMPILED(expr) \ | 
| + if (execution_mode == kExecuteCompiled) { \ | 
| + expr; \ | 
| + } | 
| + | 
| +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()); | 
| @@ -122,6 +138,9 @@ WASM_EXEC_TEST(LoadMemI32_oob_asm) { | 
| BUILD(r, WASM_UNOP(kExprI32AsmjsLoadMem, WASM_GET_LOCAL(0))); | 
| + IF_COMPILED( | 
| 
bradnelson
2016/06/12 20:50:14
Worth making these separate from the oob test? Thi
 
Mircea Trofin
2016/06/13 03:33:09
Good point, thanks. Added a battery of tests for t
 | 
| + CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0], | 
| + RelocInfo::WASM_MEMORY_REFERENCE))); | 
| memory[0] = 999999; | 
| CHECK_EQ(999999, r.Call(0u)); | 
| // TODO(titzer): offset 29-31 should also be OOB. | 
| @@ -142,6 +161,10 @@ WASM_EXEC_TEST(LoadMemF32_oob_asm) { | 
| BUILD(r, WASM_UNOP(kExprF32AsmjsLoadMem, WASM_GET_LOCAL(0))); | 
| + IF_COMPILED( | 
| + CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0], | 
| + RelocInfo::WASM_MEMORY_REFERENCE))); | 
| + | 
| memory[0] = 9999.5f; | 
| CHECK_EQ(9999.5f, r.Call(0u)); | 
| // TODO(titzer): offset 29-31 should also be OOB. | 
| @@ -162,6 +185,10 @@ WASM_EXEC_TEST(LoadMemF64_oob_asm) { | 
| BUILD(r, WASM_UNOP(kExprF64AsmjsLoadMem, WASM_GET_LOCAL(0))); | 
| + IF_COMPILED( | 
| + CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0], | 
| + RelocInfo::WASM_MEMORY_REFERENCE))); | 
| + | 
| memory[0] = 9799.5; | 
| CHECK_EQ(9799.5, r.Call(0u)); | 
| memory[1] = 11799.25; | 
| @@ -185,6 +212,10 @@ WASM_EXEC_TEST(StoreMemI32_oob_asm) { | 
| BUILD(r, WASM_BINOP(kExprI32AsmjsStoreMem, WASM_GET_LOCAL(0), | 
| WASM_GET_LOCAL(1))); | 
| + IF_COMPILED( | 
| + CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0], | 
| + RelocInfo::WASM_MEMORY_REFERENCE))); | 
| + | 
| memory[0] = 7777; | 
| CHECK_EQ(999999, r.Call(0u, 999999)); | 
| CHECK_EQ(999999, memory[0]); |