diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-04-18 17:56:23 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-04-18 17:56:23 -0700 |
commit | eb50dce005ad4ca10aaad7d15aa7a518d39ae887 (patch) | |
tree | 384eb285911224c5fb80f96aaa3c205a9963536f /src/wasm-interpreter.h | |
parent | 684ed50648fd45199edca7532c743b16a7050695 (diff) | |
parent | 237cb832673ba6478bcd9bfa395f2f2c07e97a9d (diff) | |
download | binaryen-eb50dce005ad4ca10aaad7d15aa7a518d39ae887.tar.gz binaryen-eb50dce005ad4ca10aaad7d15aa7a518d39ae887.tar.bz2 binaryen-eb50dce005ad4ca10aaad7d15aa7a518d39ae887.zip |
Merge pull request #364 from WebAssembly/updates
Spec test updates
Diffstat (limited to 'src/wasm-interpreter.h')
-rw-r--r-- | src/wasm-interpreter.h | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h index 8f3f09ed1..3d4eea722 100644 --- a/src/wasm-interpreter.h +++ b/src/wasm-interpreter.h @@ -292,24 +292,23 @@ private: } Flow visitSwitch(Switch *curr) { NOTE_ENTER("Switch"); - Flow flow = visit(curr->condition); - if (flow.breaking()) return flow; - NOTE_EVAL1(flow.value); - int64_t index = flow.value.getInteger(); - + Flow flow; + Literal value; if (curr->value) { flow = visit(curr->value); if (flow.breaking()) return flow; - NOTE_EVAL1(flow.value); - } else { - flow = Flow(); + value = flow.value; + NOTE_EVAL1(value); } - + flow = visit(curr->condition); + if (flow.breaking()) return flow; + int64_t index = flow.value.getInteger(); Name target = curr->default_; if (index >= 0 && (size_t)index < curr->targets.size()) { target = curr->targets[(size_t)index]; } flow.breakTo = target; + flow.value = value; return flow; } @@ -605,7 +604,7 @@ private: NOTE_ENTER("Host"); switch (curr->op) { case PageSize: return Literal((int32_t)Memory::kPageSize); - case MemorySize: return Literal(int32_t(instance.memorySize * Memory::kPageSize)); + case CurrentMemory: return Literal(int32_t(instance.memorySize)); case GrowMemory: { Flow flow = visit(curr->operands[0]); if (flow.breaking()) return flow; @@ -617,7 +616,7 @@ private: if (newSize > instance.wasm.memory.max) trap("growMemory: exceeds max"); instance.externalInterface->growMemory(instance.memorySize * Memory::kPageSize, newSize * Memory::kPageSize); instance.memorySize = newSize; - return Literal(int32_t(ret * Memory::kPageSize)); + return Literal(int32_t(ret)); } case HasFeature: { IString id = curr->nameOperand; |