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

Side by Side Diff: src/wasm/ast-decoder.cc

Issue 1961853002: [wasm] Verify expressions do not cross control boundaries in WASM. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | test/unittests/wasm/ast-decoder-unittest.cc » ('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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/signature.h" 5 #include "src/signature.h"
6 6
7 #include "src/bit-vector.h" 7 #include "src/bit-vector.h"
8 #include "src/flags.h" 8 #include "src/flags.h"
9 #include "src/handles.h" 9 #include "src/handles.h"
10 #include "src/zone-containers.h" 10 #include "src/zone-containers.h"
(...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 if (val.type != kAstEnd) { 1150 if (val.type != kAstEnd) {
1151 error(pc_, val.pc, "%s[%d] expected type %s, found %s of type %s", 1151 error(pc_, val.pc, "%s[%d] expected type %s, found %s of type %s",
1152 SafeOpcodeNameAt(pc_), index, WasmOpcodes::TypeName(expected), 1152 SafeOpcodeNameAt(pc_), index, WasmOpcodes::TypeName(expected),
1153 SafeOpcodeNameAt(val.pc), WasmOpcodes::TypeName(val.type)); 1153 SafeOpcodeNameAt(val.pc), WasmOpcodes::TypeName(val.type));
1154 } 1154 }
1155 } 1155 }
1156 return val; 1156 return val;
1157 } 1157 }
1158 1158
1159 Value Pop() { 1159 Value Pop() {
1160 if (stack_.empty()) { 1160 size_t limit = control_.empty() ? 0 : control_.back().stack_depth;
ahaas 2016/05/09 09:55:43 Could you add a comment at the declaration of cont
titzer 2016/05/09 09:57:20 Done.
1161 if (stack_.size() <= limit) {
1161 Value val = {pc_, nullptr, kAstStmt}; 1162 Value val = {pc_, nullptr, kAstStmt};
1162 error(pc_, pc_, "%s found empty stack", SafeOpcodeNameAt(pc_)); 1163 error(pc_, pc_, "%s found empty stack", SafeOpcodeNameAt(pc_));
1163 return val; 1164 return val;
1164 } 1165 }
1165 Value val = stack_.back(); 1166 Value val = stack_.back();
1166 stack_.pop_back(); 1167 stack_.pop_back();
1167 return val; 1168 return val;
1168 } 1169 }
1169 1170
1170 Value PopUpTo(int stack_depth) { 1171 Value PopUpTo(int stack_depth) {
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
1647 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, 1648 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals,
1648 const byte* start, const byte* end) { 1649 const byte* start, const byte* end) {
1649 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; 1650 FunctionBody body = {nullptr, nullptr, nullptr, start, end};
1650 SR_WasmDecoder decoder(zone, nullptr, body); 1651 SR_WasmDecoder decoder(zone, nullptr, body);
1651 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); 1652 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals);
1652 } 1653 }
1653 1654
1654 } // namespace wasm 1655 } // namespace wasm
1655 } // namespace internal 1656 } // namespace internal
1656 } // namespace v8 1657 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/unittests/wasm/ast-decoder-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698