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

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

Issue 2628203003: Reland of [wasm] Enforce that function bodies end with the \"end\" opcode. (Closed)
Patch Set: Created 3 years, 11 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 | « src/wasm/wasm-macro-gen.h ('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 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-text.h" 5 #include "src/wasm/wasm-text.h"
6 6
7 #include "src/debug/interface-types.h" 7 #include "src/debug/interface-types.h"
8 #include "src/ostreams.h" 8 #include "src/ostreams.h"
9 #include "src/vector.h" 9 #include "src/vector.h"
10 #include "src/wasm/function-body-decoder.h" 10 #include "src/wasm/function-body-decoder.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 const ModuleWireBytes &wire_bytes, uint32_t func_index, 134 const ModuleWireBytes &wire_bytes, uint32_t func_index,
135 std::ostream &os, 135 std::ostream &os,
136 debug::WasmDisassembly::OffsetTable *offset_table) { 136 debug::WasmDisassembly::OffsetTable *offset_table) {
137 DCHECK_NOT_NULL(module); 137 DCHECK_NOT_NULL(module);
138 DCHECK_GT(module->functions.size(), func_index); 138 DCHECK_GT(module->functions.size(), func_index);
139 const WasmFunction *fun = &module->functions[func_index]; 139 const WasmFunction *fun = &module->functions[func_index];
140 140
141 AccountingAllocator allocator; 141 AccountingAllocator allocator;
142 Zone zone(&allocator, ZONE_NAME); 142 Zone zone(&allocator, ZONE_NAME);
143 int line_nr = 0; 143 int line_nr = 0;
144 int control_depth = 0; 144 int control_depth = 1;
145 145
146 // Print the function signature. 146 // Print the function signature.
147 os << "func"; 147 os << "func";
148 WasmName fun_name = wire_bytes.GetNameOrNull(fun); 148 WasmName fun_name = wire_bytes.GetNameOrNull(fun);
149 if (IsValidFunctionName(fun_name)) { 149 if (IsValidFunctionName(fun_name)) {
150 os << " $"; 150 os << " $";
151 os.write(fun_name.start(), fun_name.length()); 151 os.write(fun_name.start(), fun_name.length());
152 } 152 }
153 size_t param_count = fun->sig->parameter_count(); 153 size_t param_count = fun->sig->parameter_count();
154 if (param_count) { 154 if (param_count) {
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 default: 303 default:
304 UNREACHABLE(); 304 UNREACHABLE();
305 break; 305 break;
306 } 306 }
307 os << '\n'; 307 os << '\n';
308 ++line_nr; 308 ++line_nr;
309 } 309 }
310 DCHECK_EQ(0, control_depth); 310 DCHECK_EQ(0, control_depth);
311 DCHECK(i.ok()); 311 DCHECK(i.ok());
312 } 312 }
OLDNEW
« no previous file with comments | « src/wasm/wasm-macro-gen.h ('k') | test/cctest/wasm/test-run-wasm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698