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

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

Issue 2083523002: Reland of "Implement WASM big-endian support". (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 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.
« 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