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

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

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 | « 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 a88fa93f06df0fc95d18d60594744981546d90f6..dda4c1bb7dab0d7e0eeeb13dd19effbb0b0c056d 100644
--- a/src/wasm/wasm-interpreter.cc
+++ b/src/wasm/wasm-interpreter.cc
@@ -1459,20 +1459,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);
@@ -1491,21 +1491,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