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

Unified Diff: src/wasm/wasm-interpreter.cc

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 | « src/wasm/encoder.h ('k') | test/cctest/cctest.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/wasm-interpreter.cc
diff --git a/src/wasm/wasm-interpreter.cc b/src/wasm/wasm-interpreter.cc
index fc727801b983555a21f2992b3676eb92f59f648d..c5cedefa343ac5fb1a51939807c89b2537f1c62a 100644
--- a/src/wasm/wasm-interpreter.cc
+++ b/src/wasm/wasm-interpreter.cc
@@ -1437,20 +1437,20 @@ class ThreadImpl : public WasmInterpreter::Thread {
break;
}
-#define LOAD_CASE(name, ctype, mtype) \
- case kExpr##name: { \
- MemoryAccessOperand operand(&decoder, code->at(pc)); \
- uint32_t index = Pop().to<uint32_t>(); \
- size_t effective_mem_size = instance()->mem_size - sizeof(mtype); \
- if (operand.offset > effective_mem_size || \
- index > (effective_mem_size - operand.offset)) { \
- return DoTrap(kTrapMemOutOfBounds, pc); \
- } \
- byte* addr = instance()->mem_start + operand.offset + index; \
- WasmVal result(static_cast<ctype>(ReadUnalignedValue<mtype>(addr))); \
- Push(pc, result); \
- len = 1 + operand.length; \
- break; \
+#define LOAD_CASE(name, ctype, mtype) \
+ case kExpr##name: { \
+ MemoryAccessOperand operand(&decoder, code->at(pc)); \
+ uint32_t index = Pop().to<uint32_t>(); \
+ size_t effective_mem_size = instance()->mem_size - sizeof(mtype); \
+ if (operand.offset > effective_mem_size || \
+ index > (effective_mem_size - operand.offset)) { \
+ return DoTrap(kTrapMemOutOfBounds, pc); \
+ } \
+ byte* addr = instance()->mem_start + operand.offset + index; \
+ WasmVal result(static_cast<ctype>(ReadLittleEndianValue<mtype>(addr))); \
+ Push(pc, result); \
+ len = 1 + operand.length; \
+ break; \
}
LOAD_CASE(I32LoadMem8S, int32_t, int8_t);
@@ -1469,21 +1469,21 @@ class ThreadImpl : public WasmInterpreter::Thread {
LOAD_CASE(F64LoadMem, double, double);
#undef LOAD_CASE
-#define STORE_CASE(name, ctype, mtype) \
- case kExpr##name: { \
- MemoryAccessOperand operand(&decoder, code->at(pc)); \
- WasmVal val = Pop(); \
- uint32_t index = Pop().to<uint32_t>(); \
- size_t effective_mem_size = instance()->mem_size - sizeof(mtype); \
- if (operand.offset > effective_mem_size || \
- index > (effective_mem_size - operand.offset)) { \
- return DoTrap(kTrapMemOutOfBounds, pc); \
- } \
- byte* addr = instance()->mem_start + operand.offset + index; \
- WriteUnalignedValue<mtype>(addr, static_cast<mtype>(val.to<ctype>())); \
- Push(pc, val); \
- len = 1 + operand.length; \
- break; \
+#define STORE_CASE(name, ctype, mtype) \
+ case kExpr##name: { \
+ MemoryAccessOperand operand(&decoder, code->at(pc)); \
+ WasmVal val = Pop(); \
+ uint32_t index = Pop().to<uint32_t>(); \
+ size_t effective_mem_size = instance()->mem_size - sizeof(mtype); \
+ if (operand.offset > effective_mem_size || \
+ index > (effective_mem_size - operand.offset)) { \
+ return DoTrap(kTrapMemOutOfBounds, pc); \
+ } \
+ byte* addr = instance()->mem_start + operand.offset + index; \
+ WriteLittleEndianValue<mtype>(addr, static_cast<mtype>(val.to<ctype>())); \
+ Push(pc, val); \
+ len = 1 + operand.length; \
+ break; \
}
STORE_CASE(I32StoreMem8, int32_t, int8_t);
« no previous file with comments | « src/wasm/encoder.h ('k') | test/cctest/cctest.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698