| 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 } | 183 } |
| 184 | 184 |
| 185 for (; i.has_next(); i.next()) { | 185 for (; i.has_next(); i.next()) { |
| 186 WasmOpcode opcode = i.current(); | 186 WasmOpcode opcode = i.current(); |
| 187 if (opcode == kExprElse || opcode == kExprEnd) --control_depth; | 187 if (opcode == kExprElse || opcode == kExprEnd) --control_depth; |
| 188 | 188 |
| 189 DCHECK_LE(0, control_depth); | 189 DCHECK_LE(0, control_depth); |
| 190 const int kMaxIndentation = 64; | 190 const int kMaxIndentation = 64; |
| 191 int indentation = std::min(kMaxIndentation, 2 * control_depth); | 191 int indentation = std::min(kMaxIndentation, 2 * control_depth); |
| 192 if (offset_table) { | 192 if (offset_table) { |
| 193 offset_table->push_back(debug::WasmDisassemblyOffsetTableEntry( | 193 offset_table->emplace_back(i.pc_offset(), line_nr, indentation); |
| 194 i.pc_offset(), line_nr, indentation)); | |
| 195 } | 194 } |
| 196 | 195 |
| 197 // 64 whitespaces | 196 // 64 whitespaces |
| 198 const char padding[kMaxIndentation + 1] = | 197 const char padding[kMaxIndentation + 1] = |
| 199 " "; | 198 " "; |
| 200 os.write(padding, indentation); | 199 os.write(padding, indentation); |
| 201 | 200 |
| 202 switch (opcode) { | 201 switch (opcode) { |
| 203 case kExprLoop: | 202 case kExprLoop: |
| 204 case kExprIf: | 203 case kExprIf: |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 default: | 302 default: |
| 304 UNREACHABLE(); | 303 UNREACHABLE(); |
| 305 break; | 304 break; |
| 306 } | 305 } |
| 307 os << '\n'; | 306 os << '\n'; |
| 308 ++line_nr; | 307 ++line_nr; |
| 309 } | 308 } |
| 310 DCHECK_EQ(0, control_depth); | 309 DCHECK_EQ(0, control_depth); |
| 311 DCHECK(i.ok()); | 310 DCHECK(i.ok()); |
| 312 } | 311 } |
| OLD | NEW |