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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 os << " (result"; | 62 os << " (result"; |
63 for (size_t i = 0; i < return_count; ++i) | 63 for (size_t i = 0; i < return_count; ++i) |
64 os << ' ' << WasmOpcodes::TypeName(fun->sig->GetReturn(i)); | 64 os << ' ' << WasmOpcodes::TypeName(fun->sig->GetReturn(i)); |
65 os << ')'; | 65 os << ')'; |
66 } | 66 } |
67 os << "\n"; | 67 os << "\n"; |
68 ++line_nr; | 68 ++line_nr; |
69 | 69 |
70 // Print the local declarations. | 70 // Print the local declarations. |
71 BodyLocalDecls decls(&zone); | 71 BodyLocalDecls decls(&zone); |
72 Vector<const byte> func_bytes = wire_bytes.module_bytes.SubVector( | 72 Vector<const byte> func_bytes = wire_bytes.GetFunctionBytes(fun); |
73 fun->code_start_offset, fun->code_end_offset); | |
74 BytecodeIterator i(func_bytes.begin(), func_bytes.end(), &decls); | 73 BytecodeIterator i(func_bytes.begin(), func_bytes.end(), &decls); |
75 DCHECK_LT(func_bytes.begin(), i.pc()); | 74 DCHECK_LT(func_bytes.begin(), i.pc()); |
76 if (!decls.type_list.empty()) { | 75 if (!decls.type_list.empty()) { |
77 os << "(local"; | 76 os << "(local"; |
78 for (const ValueType &v : decls.type_list) { | 77 for (const ValueType &v : decls.type_list) { |
79 os << ' ' << WasmOpcodes::TypeName(v); | 78 os << ' ' << WasmOpcodes::TypeName(v); |
80 } | 79 } |
81 os << ")\n"; | 80 os << ")\n"; |
82 ++line_nr; | 81 ++line_nr; |
83 } | 82 } |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 default: | 201 default: |
203 UNREACHABLE(); | 202 UNREACHABLE(); |
204 break; | 203 break; |
205 } | 204 } |
206 os << '\n'; | 205 os << '\n'; |
207 ++line_nr; | 206 ++line_nr; |
208 } | 207 } |
209 DCHECK_EQ(0, control_depth); | 208 DCHECK_EQ(0, control_depth); |
210 DCHECK(i.ok()); | 209 DCHECK(i.ok()); |
211 } | 210 } |
OLD | NEW |