| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/il_printer.h" | 5 #include "vm/il_printer.h" |
| 6 | 6 |
| 7 #include "vm/intermediate_language.h" | 7 #include "vm/intermediate_language.h" |
| 8 #include "vm/os.h" | 8 #include "vm/os.h" |
| 9 #include "vm/parser.h" | 9 #include "vm/parser.h" |
| 10 | 10 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 176 |
| 177 void Definition::PrintTo(BufferFormatter* f) const { | 177 void Definition::PrintTo(BufferFormatter* f) const { |
| 178 PrintUse(f, *this); | 178 PrintUse(f, *this); |
| 179 if (is_used()) { | 179 if (is_used()) { |
| 180 if (HasSSATemp() || (temp_index() != -1)) f->Print(" <- "); | 180 if (HasSSATemp() || (temp_index() != -1)) f->Print(" <- "); |
| 181 } | 181 } |
| 182 f->Print("%s:%"Pd"(", DebugName(), GetDeoptId()); | 182 f->Print("%s:%"Pd"(", DebugName(), GetDeoptId()); |
| 183 PrintOperandsTo(f); | 183 PrintOperandsTo(f); |
| 184 f->Print(")"); | 184 f->Print(")"); |
| 185 PrintPropagatedType(f, *this); | 185 PrintPropagatedType(f, *this); |
| 186 if (range_ != NULL) { |
| 187 f->Print(" "); |
| 188 range_->PrintTo(f); |
| 189 } |
| 186 } | 190 } |
| 187 | 191 |
| 188 | 192 |
| 189 void Definition::PrintOperandsTo(BufferFormatter* f) const { | 193 void Definition::PrintOperandsTo(BufferFormatter* f) const { |
| 190 for (int i = 0; i < InputCount(); ++i) { | 194 for (int i = 0; i < InputCount(); ++i) { |
| 191 if (i > 0) f->Print(", "); | 195 if (i > 0) f->Print(", "); |
| 192 if (InputAt(i) != NULL) InputAt(i)->PrintTo(f); | 196 if (InputAt(i) != NULL) InputAt(i)->PrintTo(f); |
| 193 } | 197 } |
| 194 } | 198 } |
| 195 | 199 |
| 196 | 200 |
| 197 void Definition::PrintToVisualizer(BufferFormatter* f) const { | 201 void Definition::PrintToVisualizer(BufferFormatter* f) const { |
| 198 PrintTo(f); | 202 PrintTo(f); |
| 199 } | 203 } |
| 200 | 204 |
| 201 | 205 |
| 202 void Value::PrintTo(BufferFormatter* f) const { | 206 void Value::PrintTo(BufferFormatter* f) const { |
| 203 PrintUse(f, *definition()); | 207 PrintUse(f, *definition()); |
| 204 } | 208 } |
| 205 | 209 |
| 206 | 210 |
| 207 void ConstantInstr::PrintOperandsTo(BufferFormatter* f) const { | 211 void ConstantInstr::PrintOperandsTo(BufferFormatter* f) const { |
| 208 f->Print("#%s", value().ToCString()); | 212 f->Print("#%s", value().ToCString()); |
| 209 } | 213 } |
| 210 | 214 |
| 211 | 215 |
| 216 void ConstraintInstr::PrintOperandsTo(BufferFormatter* f) const { |
| 217 value()->PrintTo(f); |
| 218 f->Print(" ^ "); |
| 219 constraint()->PrintTo(f); |
| 220 } |
| 221 |
| 222 |
| 223 void Range::PrintTo(BufferFormatter* f) const { |
| 224 f->Print("["); |
| 225 min_.PrintTo(f); |
| 226 f->Print(", "); |
| 227 max_.PrintTo(f); |
| 228 f->Print("]"); |
| 229 } |
| 230 |
| 231 |
| 232 void RangeBoundary::PrintTo(BufferFormatter* f) const { |
| 233 switch (kind_) { |
| 234 case kSymbol: |
| 235 f->Print("v%d", reinterpret_cast<Definition*>(value_)->ssa_temp_index()); |
| 236 if (offs_ != 0) f->Print("%+d", offs_); |
| 237 break; |
| 238 case kConstant: |
| 239 f->Print("%d", value_); |
| 240 break; |
| 241 case kUnknown: |
| 242 f->Print("_|_"); |
| 243 break; |
| 244 } |
| 245 } |
| 246 |
| 247 |
| 212 void AssertAssignableInstr::PrintOperandsTo(BufferFormatter* f) const { | 248 void AssertAssignableInstr::PrintOperandsTo(BufferFormatter* f) const { |
| 213 value()->PrintTo(f); | 249 value()->PrintTo(f); |
| 214 f->Print(", %s, '%s'%s", | 250 f->Print(", %s, '%s'%s", |
| 215 String::Handle(dst_type().Name()).ToCString(), | 251 String::Handle(dst_type().Name()).ToCString(), |
| 216 dst_name().ToCString(), | 252 dst_name().ToCString(), |
| 217 is_eliminated() ? " eliminated" : ""); | 253 is_eliminated() ? " eliminated" : ""); |
| 218 f->Print(" instantiator("); | 254 f->Print(" instantiator("); |
| 219 instantiator()->PrintTo(f); | 255 instantiator()->PrintTo(f); |
| 220 f->Print(")"); | 256 f->Print(")"); |
| 221 f->Print(" instantiator_type_arguments("); | 257 f->Print(" instantiator_type_arguments("); |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 } | 458 } |
| 423 | 459 |
| 424 | 460 |
| 425 void CatchEntryInstr::PrintOperandsTo(BufferFormatter* f) const { | 461 void CatchEntryInstr::PrintOperandsTo(BufferFormatter* f) const { |
| 426 f->Print("%s, %s", | 462 f->Print("%s, %s", |
| 427 exception_var().name().ToCString(), | 463 exception_var().name().ToCString(), |
| 428 stacktrace_var().name().ToCString()); | 464 stacktrace_var().name().ToCString()); |
| 429 } | 465 } |
| 430 | 466 |
| 431 | 467 |
| 468 void BinarySmiOpInstr::PrintTo(BufferFormatter* f) const { |
| 469 Definition::PrintTo(f); |
| 470 f->Print(" %co", overflow_ ? '+' : '-'); |
| 471 } |
| 472 |
| 432 void BinarySmiOpInstr::PrintOperandsTo(BufferFormatter* f) const { | 473 void BinarySmiOpInstr::PrintOperandsTo(BufferFormatter* f) const { |
| 433 f->Print("%s, ", Token::Str(op_kind())); | 474 f->Print("%s, ", Token::Str(op_kind())); |
| 434 left()->PrintTo(f); | 475 left()->PrintTo(f); |
| 435 f->Print(", "); | 476 f->Print(", "); |
| 436 right()->PrintTo(f); | 477 right()->PrintTo(f); |
| 437 } | 478 } |
| 438 | 479 |
| 439 | 480 |
| 440 void BinaryMintOpInstr::PrintOperandsTo(BufferFormatter* f) const { | 481 void BinaryMintOpInstr::PrintOperandsTo(BufferFormatter* f) const { |
| 441 f->Print("%s, ", Token::Str(op_kind())); | 482 f->Print("%s, ", Token::Str(op_kind())); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 | 540 |
| 500 | 541 |
| 501 void PhiInstr::PrintTo(BufferFormatter* f) const { | 542 void PhiInstr::PrintTo(BufferFormatter* f) const { |
| 502 f->Print("v%"Pd" <- phi(", ssa_temp_index()); | 543 f->Print("v%"Pd" <- phi(", ssa_temp_index()); |
| 503 for (intptr_t i = 0; i < inputs_.length(); ++i) { | 544 for (intptr_t i = 0; i < inputs_.length(); ++i) { |
| 504 if (inputs_[i] != NULL) inputs_[i]->PrintTo(f); | 545 if (inputs_[i] != NULL) inputs_[i]->PrintTo(f); |
| 505 if (i < inputs_.length() - 1) f->Print(", "); | 546 if (i < inputs_.length() - 1) f->Print(", "); |
| 506 } | 547 } |
| 507 f->Print(")"); | 548 f->Print(")"); |
| 508 PrintPropagatedType(f, *this); | 549 PrintPropagatedType(f, *this); |
| 550 if (range_ != NULL) { |
| 551 f->Print(" "); |
| 552 range_->PrintTo(f); |
| 553 } |
| 509 } | 554 } |
| 510 | 555 |
| 511 | 556 |
| 512 void ParameterInstr::PrintOperandsTo(BufferFormatter* f) const { | 557 void ParameterInstr::PrintOperandsTo(BufferFormatter* f) const { |
| 513 f->Print("%"Pd, index()); | 558 f->Print("%"Pd, index()); |
| 514 } | 559 } |
| 515 | 560 |
| 516 | 561 |
| 517 void TargetEntryInstr::PrintTo(BufferFormatter* f) const { | 562 void TargetEntryInstr::PrintTo(BufferFormatter* f) const { |
| 518 f->Print("B%"Pd"[target", block_id()); | 563 f->Print("B%"Pd"[target", block_id()); |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 f->Print(" ["); | 831 f->Print(" ["); |
| 787 locations_[i].PrintTo(f); | 832 locations_[i].PrintTo(f); |
| 788 f->Print("]"); | 833 f->Print("]"); |
| 789 } | 834 } |
| 790 } | 835 } |
| 791 f->Print(" }"); | 836 f->Print(" }"); |
| 792 if (outer_ != NULL) outer_->PrintTo(f); | 837 if (outer_ != NULL) outer_->PrintTo(f); |
| 793 } | 838 } |
| 794 | 839 |
| 795 } // namespace dart | 840 } // namespace dart |
| OLD | NEW |