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

Side by Side Diff: src/wasm/wasm-interpreter.cc

Issue 2531533003: Revert of [base] Define CHECK comparison for signed vs. unsigned (Closed)
Patch Set: Created 4 years 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 unified diff | Download patch
« no previous file with comments | « src/wasm/wasm-debug.cc ('k') | src/wasm/wasm-module.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/wasm/wasm-interpreter.h" 5 #include "src/wasm/wasm-interpreter.h"
6 6
7 #include "src/utils.h" 7 #include "src/utils.h"
8 #include "src/wasm/ast-decoder.h" 8 #include "src/wasm/ast-decoder.h"
9 #include "src/wasm/decoder.h" 9 #include "src/wasm/decoder.h"
10 #include "src/wasm/wasm-external-refs.h" 10 #include "src/wasm/wasm-external-refs.h"
(...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after
1166 1166
1167 int DoBreak(InterpreterCode* code, pc_t pc, size_t depth) { 1167 int DoBreak(InterpreterCode* code, pc_t pc, size_t depth) {
1168 size_t bp = blocks_.size() - depth - 1; 1168 size_t bp = blocks_.size() - depth - 1;
1169 Block* target = &blocks_[bp]; 1169 Block* target = &blocks_[bp];
1170 DoStackTransfer(target->sp, target->arity); 1170 DoStackTransfer(target->sp, target->arity);
1171 blocks_.resize(bp); 1171 blocks_.resize(bp);
1172 return LookupTarget(code, pc); 1172 return LookupTarget(code, pc);
1173 } 1173 }
1174 1174
1175 bool DoReturn(InterpreterCode** code, pc_t* pc, pc_t* limit, size_t arity) { 1175 bool DoReturn(InterpreterCode** code, pc_t* pc, pc_t* limit, size_t arity) {
1176 DCHECK_GT(frames_.size(), 0); 1176 DCHECK_GT(frames_.size(), 0u);
1177 // Pop all blocks for this frame. 1177 // Pop all blocks for this frame.
1178 while (!blocks_.empty() && blocks_.back().fp == frames_.size()) { 1178 while (!blocks_.empty() && blocks_.back().fp == frames_.size()) {
1179 blocks_.pop_back(); 1179 blocks_.pop_back();
1180 } 1180 }
1181 1181
1182 sp_t dest = frames_.back().sp; 1182 sp_t dest = frames_.back().sp;
1183 frames_.pop_back(); 1183 frames_.pop_back();
1184 if (frames_.size() == 0) { 1184 if (frames_.size() == 0) {
1185 // A return from the last frame terminates the execution. 1185 // A return from the last frame terminates the execution.
1186 state_ = WasmInterpreter::FINISHED; 1186 state_ = WasmInterpreter::FINISHED;
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
1673 code->start[pc], OpcodeName(code->start[pc])); 1673 code->start[pc], OpcodeName(code->start[pc]));
1674 UNREACHABLE(); 1674 UNREACHABLE();
1675 } 1675 }
1676 1676
1677 pc += len; 1677 pc += len;
1678 } 1678 }
1679 UNREACHABLE(); // above decoding loop should run forever. 1679 UNREACHABLE(); // above decoding loop should run forever.
1680 } 1680 }
1681 1681
1682 WasmVal Pop() { 1682 WasmVal Pop() {
1683 DCHECK_GT(stack_.size(), 0); 1683 DCHECK_GT(stack_.size(), 0u);
1684 DCHECK_GT(frames_.size(), 0); 1684 DCHECK_GT(frames_.size(), 0u);
1685 DCHECK_GT(stack_.size(), frames_.back().llimit()); // can't pop into locals 1685 DCHECK_GT(stack_.size(), frames_.back().llimit()); // can't pop into locals
1686 WasmVal val = stack_.back(); 1686 WasmVal val = stack_.back();
1687 stack_.pop_back(); 1687 stack_.pop_back();
1688 return val; 1688 return val;
1689 } 1689 }
1690 1690
1691 void PopN(int n) { 1691 void PopN(int n) {
1692 DCHECK_GE(stack_.size(), n); 1692 DCHECK_GE(stack_.size(), static_cast<size_t>(n));
1693 DCHECK_GT(frames_.size(), 0); 1693 DCHECK_GT(frames_.size(), 0u);
1694 size_t nsize = stack_.size() - n; 1694 size_t nsize = stack_.size() - n;
1695 DCHECK_GE(nsize, frames_.back().llimit()); // can't pop into locals 1695 DCHECK_GE(nsize, frames_.back().llimit()); // can't pop into locals
1696 stack_.resize(nsize); 1696 stack_.resize(nsize);
1697 } 1697 }
1698 1698
1699 WasmVal PopArity(size_t arity) { 1699 WasmVal PopArity(size_t arity) {
1700 if (arity == 0) return WasmVal(); 1700 if (arity == 0) return WasmVal();
1701 CHECK_EQ(1, arity); 1701 CHECK_EQ(1u, arity);
1702 return Pop(); 1702 return Pop();
1703 } 1703 }
1704 1704
1705 void Push(pc_t pc, WasmVal val) { 1705 void Push(pc_t pc, WasmVal val) {
1706 // TODO(titzer): store PC as well? 1706 // TODO(titzer): store PC as well?
1707 if (val.type != kAstStmt) stack_.push_back(val); 1707 if (val.type != kAstStmt) stack_.push_back(val);
1708 } 1708 }
1709 1709
1710 void TraceStack(const char* phase, pc_t pc) { 1710 void TraceStack(const char* phase, pc_t pc) {
1711 if (FLAG_trace_wasm_interpreter) { 1711 if (FLAG_trace_wasm_interpreter) {
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
1885 1885
1886 ControlTransferMap WasmInterpreter::ComputeControlTransfersForTesting( 1886 ControlTransferMap WasmInterpreter::ComputeControlTransfersForTesting(
1887 Zone* zone, const byte* start, const byte* end) { 1887 Zone* zone, const byte* start, const byte* end) {
1888 ControlTransfers targets(zone, nullptr, nullptr, start, end); 1888 ControlTransfers targets(zone, nullptr, nullptr, start, end);
1889 return targets.map_; 1889 return targets.map_;
1890 } 1890 }
1891 1891
1892 } // namespace wasm 1892 } // namespace wasm
1893 } // namespace internal 1893 } // namespace internal
1894 } // namespace v8 1894 } // namespace v8
OLDNEW
« no previous file with comments | « src/wasm/wasm-debug.cc ('k') | src/wasm/wasm-module.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698