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 ea4efa5325fc47b3fe2bb558174a7dae34d6fab8..4e3cb06d5c0c6e7d6f5dbfe2ddf85151ad252a86 100644 |
--- a/test/cctest/wasm/wasm-run-utils.h |
+++ b/test/cctest/wasm/wasm-run-utils.h |
@@ -140,14 +140,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. |