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

Unified Diff: test/cctest/wasm/wasm-run-utils.h

Issue 2034093002: Implement WASM big-endian support (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Small fixes. Rebase to master 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 | « test/cctest/wasm/test-run-wasm-64.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/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.
« no previous file with comments | « test/cctest/wasm/test-run-wasm-64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698