OLD | NEW |
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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 } | 166 } |
167 os << "\n"; | 167 os << "\n"; |
168 ++line_nr; | 168 ++line_nr; |
169 | 169 |
170 // Print the local declarations. | 170 // Print the local declarations. |
171 BodyLocalDecls decls(&zone); | 171 BodyLocalDecls decls(&zone); |
172 Vector<const byte> func_bytes = wire_bytes.module_bytes.SubVector( | 172 Vector<const byte> func_bytes = wire_bytes.module_bytes.SubVector( |
173 fun->code_start_offset, fun->code_end_offset); | 173 fun->code_start_offset, fun->code_end_offset); |
174 BytecodeIterator i(func_bytes.begin(), func_bytes.end(), &decls); | 174 BytecodeIterator i(func_bytes.begin(), func_bytes.end(), &decls); |
175 DCHECK_LT(func_bytes.begin(), i.pc()); | 175 DCHECK_LT(func_bytes.begin(), i.pc()); |
176 if (!decls.local_types.empty()) { | 176 if (!decls.type_list.empty()) { |
177 os << "(local"; | 177 os << "(local"; |
178 for (auto p : decls.local_types) { | 178 for (const ValueType &v : decls.type_list) { |
179 for (unsigned i = 0; i < p.second; ++i) | 179 os << ' ' << WasmOpcodes::TypeName(v); |
180 os << ' ' << WasmOpcodes::TypeName(p.first); | |
181 } | 180 } |
182 os << ")\n"; | 181 os << ")\n"; |
183 ++line_nr; | 182 ++line_nr; |
184 } | 183 } |
185 | 184 |
186 for (; i.has_next(); i.next()) { | 185 for (; i.has_next(); i.next()) { |
187 WasmOpcode opcode = i.current(); | 186 WasmOpcode opcode = i.current(); |
188 if (opcode == kExprElse || opcode == kExprEnd) --control_depth; | 187 if (opcode == kExprElse || opcode == kExprEnd) --control_depth; |
189 | 188 |
190 DCHECK_LE(0, control_depth); | 189 DCHECK_LE(0, control_depth); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 default: | 304 default: |
306 UNREACHABLE(); | 305 UNREACHABLE(); |
307 break; | 306 break; |
308 } | 307 } |
309 os << '\n'; | 308 os << '\n'; |
310 ++line_nr; | 309 ++line_nr; |
311 } | 310 } |
312 DCHECK_EQ(0, control_depth); | 311 DCHECK_EQ(0, control_depth); |
313 DCHECK(i.ok()); | 312 DCHECK(i.ok()); |
314 } | 313 } |
OLD | NEW |