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/ast-decoder.h" | 10 #include "src/wasm/function-body-decoder.h" |
11 #include "src/wasm/wasm-module.h" | 11 #include "src/wasm/wasm-module.h" |
12 #include "src/wasm/wasm-opcodes.h" | 12 #include "src/wasm/wasm-opcodes.h" |
13 #include "src/zone/zone.h" | 13 #include "src/zone/zone.h" |
14 | 14 |
15 using namespace v8; | 15 using namespace v8; |
16 using namespace v8::internal; | 16 using namespace v8::internal; |
17 using namespace v8::internal::wasm; | 17 using namespace v8::internal::wasm; |
18 | 18 |
19 namespace { | 19 namespace { |
20 const char *GetOpName(WasmOpcode opcode) { | 20 const char *GetOpName(WasmOpcode opcode) { |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 if (return_count) { | 161 if (return_count) { |
162 os << " (result"; | 162 os << " (result"; |
163 for (size_t i = 0; i < return_count; ++i) | 163 for (size_t i = 0; i < return_count; ++i) |
164 os << ' ' << WasmOpcodes::TypeName(fun->sig->GetReturn(i)); | 164 os << ' ' << WasmOpcodes::TypeName(fun->sig->GetReturn(i)); |
165 os << ')'; | 165 os << ')'; |
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 AstLocalDecls 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.local_types.empty()) { |
177 os << "(local"; | 177 os << "(local"; |
178 for (auto p : decls.local_types) { | 178 for (auto p : decls.local_types) { |
179 for (unsigned i = 0; i < p.second; ++i) | 179 for (unsigned i = 0; i < p.second; ++i) |
180 os << ' ' << WasmOpcodes::TypeName(p.first); | 180 os << ' ' << WasmOpcodes::TypeName(p.first); |
181 } | 181 } |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 default: | 305 default: |
306 UNREACHABLE(); | 306 UNREACHABLE(); |
307 break; | 307 break; |
308 } | 308 } |
309 os << '\n'; | 309 os << '\n'; |
310 ++line_nr; | 310 ++line_nr; |
311 } | 311 } |
312 DCHECK_EQ(0, control_depth); | 312 DCHECK_EQ(0, control_depth); |
313 DCHECK(i.ok()); | 313 DCHECK(i.ok()); |
314 } | 314 } |
OLD | NEW |