Chromium Code Reviews| 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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 393 void ToDoubleComp::PrintOperandsTo(BufferFormatter* f) const { | 393 void ToDoubleComp::PrintOperandsTo(BufferFormatter* f) const { |
| 394 ASSERT(from() == kDoubleCid || from() == kSmiCid); | 394 ASSERT(from() == kDoubleCid || from() == kSmiCid); |
| 395 f->Print("%s ", from() == kDoubleCid ? "double2double" : "smi2double"); | 395 f->Print("%s ", from() == kDoubleCid ? "double2double" : "smi2double"); |
| 396 value()->PrintTo(f); | 396 value()->PrintTo(f); |
| 397 } | 397 } |
| 398 | 398 |
| 399 | 399 |
| 400 void GraphEntryInstr::PrintTo(BufferFormatter* f) const { | 400 void GraphEntryInstr::PrintTo(BufferFormatter* f) const { |
| 401 f->Print("%2d: [graph]", block_id()); | 401 f->Print("%2d: [graph]", block_id()); |
| 402 if (start_env_ != NULL) { | 402 if (start_env_ != NULL) { |
| 403 f->Print("\n{\n"); | |
| 404 const GrowableArray<Value*>& values = start_env_->values(); | |
| 405 for (intptr_t i = 0; i < values.length(); i++) { | |
| 406 if (values[i]->IsUse()) { | |
| 407 Definition* def = values[i]->AsUse()->definition(); | |
| 408 f->Print(" ", i); | |
| 409 def->PrintTo(f); | |
| 410 f->Print("\n"); | |
| 411 } | |
| 412 } | |
| 413 f->Print("} "); | |
| 403 start_env_->PrintTo(f); | 414 start_env_->PrintTo(f); |
| 404 } | 415 } |
| 405 } | 416 } |
| 406 | 417 |
| 407 | 418 |
| 408 void JoinEntryInstr::PrintTo(BufferFormatter* f) const { | 419 void JoinEntryInstr::PrintTo(BufferFormatter* f) const { |
| 409 f->Print("%2d: [join]", block_id()); | 420 f->Print("%2d: [join]", block_id()); |
| 410 if (phis_ != NULL) { | 421 if (phis_ != NULL) { |
| 411 for (intptr_t i = 0; i < phis_->length(); ++i) { | 422 for (intptr_t i = 0; i < phis_->length(); ++i) { |
| 412 if ((*phis_)[i] == NULL) continue; | 423 if ((*phis_)[i] == NULL) continue; |
| 413 f->Print("\n"); | 424 f->Print("\n"); |
| 414 (*phis_)[i]->PrintTo(f); | 425 (*phis_)[i]->PrintTo(f); |
| 415 } | 426 } |
| 416 } | 427 } |
| 417 if (HasParallelMove()) { | 428 if (HasParallelMove()) { |
| 418 f->Print("\n"); | 429 f->Print("\n"); |
| 419 parallel_move()->PrintTo(f); | 430 parallel_move()->PrintTo(f); |
| 420 } | 431 } |
| 421 } | 432 } |
| 422 | 433 |
| 423 | 434 |
| 435 static void PrintPropagatedType(BufferFormatter* f, const Definition& def) { | |
| 436 if (def.HasPropagatedType()) { | |
| 437 String& name = String::Handle(); | |
| 438 name = AbstractType::Handle(def.PropagatedType()).Name(); | |
| 439 f->Print(" {PT: %s}", name.ToCString()); | |
| 440 } | |
| 441 } | |
| 442 | |
| 424 void PhiInstr::PrintTo(BufferFormatter* f) const { | 443 void PhiInstr::PrintTo(BufferFormatter* f) const { |
| 425 f->Print(" v%d <- phi(", ssa_temp_index()); | 444 f->Print(" v%d <- phi(", ssa_temp_index()); |
| 426 for (intptr_t i = 0; i < inputs_.length(); ++i) { | 445 for (intptr_t i = 0; i < inputs_.length(); ++i) { |
| 427 if (inputs_[i] != NULL) inputs_[i]->PrintTo(f); | 446 if (inputs_[i] != NULL) inputs_[i]->PrintTo(f); |
| 428 if (i < inputs_.length() - 1) f->Print(", "); | 447 if (i < inputs_.length() - 1) f->Print(", "); |
| 429 } | 448 } |
| 430 f->Print(")"); | 449 f->Print(")"); |
| 450 PrintPropagatedType(f, *this); | |
| 431 } | 451 } |
| 432 | 452 |
| 433 | 453 |
| 434 void ParameterInstr::PrintTo(BufferFormatter* f) const { | 454 void ParameterInstr::PrintTo(BufferFormatter* f) const { |
| 435 f->Print(" v%d <- parameter(%d)", | 455 f->Print(" v%d <- parameter(%d)", |
| 436 HasSSATemp() ? ssa_temp_index() : temp_index(), | 456 HasSSATemp() ? ssa_temp_index() : temp_index(), |
| 437 index()); | 457 index()); |
|
regis
2012/08/10 23:18:49
You should also call PrintPropagatedType(f, *this)
srdjan
2012/08/10 23:30:05
Done.
| |
| 438 } | 458 } |
| 439 | 459 |
| 440 | 460 |
| 441 void TargetEntryInstr::PrintTo(BufferFormatter* f) const { | 461 void TargetEntryInstr::PrintTo(BufferFormatter* f) const { |
| 442 f->Print("%2d: [target", block_id()); | 462 f->Print("%2d: [target", block_id()); |
| 443 if (HasTryIndex()) { | 463 if (HasTryIndex()) { |
| 444 f->Print(" catch %d]", try_index()); | 464 f->Print(" catch %d]", try_index()); |
| 445 } else { | 465 } else { |
| 446 f->Print("]"); | 466 f->Print("]"); |
| 447 } | 467 } |
| 448 if (HasParallelMove()) { | 468 if (HasParallelMove()) { |
| 449 f->Print("\n"); | 469 f->Print("\n"); |
| 450 parallel_move()->PrintTo(f); | 470 parallel_move()->PrintTo(f); |
| 451 } | 471 } |
| 452 } | 472 } |
| 453 | 473 |
| 454 | 474 |
| 455 void BindInstr::PrintTo(BufferFormatter* f) const { | 475 void BindInstr::PrintTo(BufferFormatter* f) const { |
| 456 if (!is_used()) { | 476 if (!is_used()) { |
| 457 f->Print(" "); | 477 f->Print(" "); |
| 458 } else if (HasSSATemp()) { | 478 } else if (HasSSATemp()) { |
| 459 f->Print(" v%d <- ", ssa_temp_index()); | 479 f->Print(" v%d <- ", ssa_temp_index()); |
| 460 } else { | 480 } else { |
| 461 f->Print(" t%d <- ", temp_index()); | 481 f->Print(" t%d <- ", temp_index()); |
| 462 } | 482 } |
| 463 computation()->PrintTo(f); | 483 computation()->PrintTo(f); |
| 484 PrintPropagatedType(f, *this); | |
| 464 } | 485 } |
| 465 | 486 |
| 466 | 487 |
| 467 void PushArgumentInstr::PrintTo(BufferFormatter* f) const { | 488 void PushArgumentInstr::PrintTo(BufferFormatter* f) const { |
| 468 f->Print(" %s ", DebugName()); | 489 f->Print(" %s ", DebugName()); |
| 469 value()->PrintTo(f); | 490 value()->PrintTo(f); |
| 470 } | 491 } |
| 471 | 492 |
| 472 | 493 |
| 473 void ReturnInstr::PrintTo(BufferFormatter* f) const { | 494 void ReturnInstr::PrintTo(BufferFormatter* f) const { |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 781 if ((locations_ != NULL) && !locations_[i].IsInvalid()) { | 802 if ((locations_ != NULL) && !locations_[i].IsInvalid()) { |
| 782 f->Print(" ["); | 803 f->Print(" ["); |
| 783 locations_[i].PrintTo(f); | 804 locations_[i].PrintTo(f); |
| 784 f->Print("]"); | 805 f->Print("]"); |
| 785 } | 806 } |
| 786 } | 807 } |
| 787 f->Print(" }"); | 808 f->Print(" }"); |
| 788 } | 809 } |
| 789 | 810 |
| 790 } // namespace dart | 811 } // namespace dart |
| OLD | NEW |