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

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

Issue 2479283002: Revert of [wasm] Indirect calls without function table cause validation errors. (Closed)
Patch Set: Created 4 years, 1 month 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/compiler/wasm-compiler.cc ('k') | test/cctest/wasm/test-run-wasm.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/zone-containers.h" 10 #include "src/zone/zone-containers.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 inline bool Complete(const byte* pc, CallIndirectOperand& operand) { 220 inline bool Complete(const byte* pc, CallIndirectOperand& operand) {
221 ModuleEnv* m = module_; 221 ModuleEnv* m = module_;
222 if (m && m->module && operand.index < m->module->signatures.size()) { 222 if (m && m->module && operand.index < m->module->signatures.size()) {
223 operand.sig = m->module->signatures[operand.index]; 223 operand.sig = m->module->signatures[operand.index];
224 return true; 224 return true;
225 } 225 }
226 return false; 226 return false;
227 } 227 }
228 228
229 inline bool Validate(const byte* pc, CallIndirectOperand& operand) { 229 inline bool Validate(const byte* pc, CallIndirectOperand& operand) {
230 uint32_t table_index = 0;
231 if (!module_->IsValidTable(table_index)) {
232 error("function table has to exist to execute call_indirect");
233 return false;
234 }
235 if (Complete(pc, operand)) { 230 if (Complete(pc, operand)) {
236 return true; 231 return true;
237 } 232 }
238 error(pc, pc + 1, "invalid signature index: #%u", operand.index); 233 error(pc, pc + 1, "invalid signature index: #%u", operand.index);
239 return false; 234 return false;
240 } 235 }
241 236
242 inline bool Validate(const byte* pc, BreakDepthOperand& operand, 237 inline bool Validate(const byte* pc, BreakDepthOperand& operand,
243 ZoneVector<Control>& control) { 238 ZoneVector<Control>& control) {
244 if (operand.depth < control.size()) { 239 if (operand.depth < control.size()) {
(...skipping 1790 matching lines...) Expand 10 before | Expand all | Expand 10 after
2035 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, 2030 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals,
2036 const byte* start, const byte* end) { 2031 const byte* start, const byte* end) {
2037 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; 2032 FunctionBody body = {nullptr, nullptr, nullptr, start, end};
2038 WasmFullDecoder decoder(zone, nullptr, body); 2033 WasmFullDecoder decoder(zone, nullptr, body);
2039 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); 2034 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals);
2040 } 2035 }
2041 2036
2042 } // namespace wasm 2037 } // namespace wasm
2043 } // namespace internal 2038 } // namespace internal
2044 } // namespace v8 2039 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | test/cctest/wasm/test-run-wasm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698