Index: test/cctest/wasm/wasm-run-utils.h |
diff --git a/test/cctest/wasm/wasm-run-utils.h b/test/cctest/wasm/wasm-run-utils.h |
index 1f758bb8535dcf5ec316210a4a2b70829aa35aa9..0b4a5b8b81128075076e1e07c44d90ddb0bba548 100644 |
--- a/test/cctest/wasm/wasm-run-utils.h |
+++ b/test/cctest/wasm/wasm-run-utils.h |
@@ -139,14 +139,22 @@ class TestingModule : public ModuleEnv { |
template <typename T> |
T raw_mem_at(int i) { |
DCHECK(instance->mem_start); |
- return reinterpret_cast<T*>(instance->mem_start)[i]; |
+ return ReadMemory(&(reinterpret_cast<T*>(instance->mem_start)[i])); |
} |
template <typename T> |
T raw_val_at(int i) { |
- T val; |
- memcpy(&val, reinterpret_cast<void*>(instance->mem_start + i), sizeof(T)); |
- return val; |
+ return ReadMemory(reinterpret_cast<T*>(instance->mem_start + i)); |
+ } |
+ |
+ template <typename T> |
+ void WriteMemory(T* p, T val) { |
+ WriteLittleEndianValue<T>(p, val); |
+ } |
+ |
+ template <typename T> |
+ T ReadMemory(T* p) { |
+ return ReadLittleEndianValue<T>(p); |
} |
// Zero-initialize the memory. |