| 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |