| 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 | 214 |
| 215 | 215 |
| 216 void EqualityCompareComp::PrintOperandsTo(BufferFormatter* f) const { | 216 void EqualityCompareComp::PrintOperandsTo(BufferFormatter* f) const { |
| 217 left()->PrintTo(f); | 217 left()->PrintTo(f); |
| 218 f->Print(" %s ", Token::Str(kind())); | 218 f->Print(" %s ", Token::Str(kind())); |
| 219 right()->PrintTo(f); | 219 right()->PrintTo(f); |
| 220 } | 220 } |
| 221 | 221 |
| 222 | 222 |
| 223 void StaticCallComp::PrintOperandsTo(BufferFormatter* f) const { | 223 void StaticCallComp::PrintOperandsTo(BufferFormatter* f) const { |
| 224 f->Print("%s", String::Handle(function().name()).ToCString()); | 224 f->Print("%s ", String::Handle(function().name()).ToCString()); |
| 225 for (intptr_t i = 0; i < ArgumentCount(); ++i) { | 225 for (intptr_t i = 0; i < ArgumentCount(); ++i) { |
| 226 if (i > 0) f->Print(", "); | 226 if (i > 0) f->Print(", "); |
| 227 ArgumentAt(i)->value()->PrintTo(f); | 227 ArgumentAt(i)->value()->PrintTo(f); |
| 228 } | 228 } |
| 229 } | 229 } |
| 230 | 230 |
| 231 | 231 |
| 232 void LoadLocalComp::PrintOperandsTo(BufferFormatter* f) const { | 232 void LoadLocalComp::PrintOperandsTo(BufferFormatter* f) const { |
| 233 f->Print("%s lvl:%d", local().name().ToCString(), context_level()); | 233 f->Print("%s lvl:%d", local().name().ToCString(), context_level()); |
| 234 } | 234 } |
| (...skipping 158 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()); |
| 458 PrintPropagatedType(f, *this); |
| 438 } | 459 } |
| 439 | 460 |
| 440 | 461 |
| 441 void TargetEntryInstr::PrintTo(BufferFormatter* f) const { | 462 void TargetEntryInstr::PrintTo(BufferFormatter* f) const { |
| 442 f->Print("%2d: [target", block_id()); | 463 f->Print("%2d: [target", block_id()); |
| 443 if (HasTryIndex()) { | 464 if (HasTryIndex()) { |
| 444 f->Print(" catch %d]", try_index()); | 465 f->Print(" catch %d]", try_index()); |
| 445 } else { | 466 } else { |
| 446 f->Print("]"); | 467 f->Print("]"); |
| 447 } | 468 } |
| 448 if (HasParallelMove()) { | 469 if (HasParallelMove()) { |
| 449 f->Print("\n"); | 470 f->Print("\n"); |
| 450 parallel_move()->PrintTo(f); | 471 parallel_move()->PrintTo(f); |
| 451 } | 472 } |
| 452 } | 473 } |
| 453 | 474 |
| 454 | 475 |
| 455 void BindInstr::PrintTo(BufferFormatter* f) const { | 476 void BindInstr::PrintTo(BufferFormatter* f) const { |
| 456 if (!is_used()) { | 477 if (!is_used()) { |
| 457 f->Print(" "); | 478 f->Print(" "); |
| 458 } else if (HasSSATemp()) { | 479 } else if (HasSSATemp()) { |
| 459 f->Print(" v%d <- ", ssa_temp_index()); | 480 f->Print(" v%d <- ", ssa_temp_index()); |
| 460 } else { | 481 } else { |
| 461 f->Print(" t%d <- ", temp_index()); | 482 f->Print(" t%d <- ", temp_index()); |
| 462 } | 483 } |
| 463 computation()->PrintTo(f); | 484 computation()->PrintTo(f); |
| 485 PrintPropagatedType(f, *this); |
| 464 } | 486 } |
| 465 | 487 |
| 466 | 488 |
| 467 void PushArgumentInstr::PrintTo(BufferFormatter* f) const { | 489 void PushArgumentInstr::PrintTo(BufferFormatter* f) const { |
| 468 f->Print(" %s ", DebugName()); | 490 f->Print(" %s ", DebugName()); |
| 469 value()->PrintTo(f); | 491 value()->PrintTo(f); |
| 470 } | 492 } |
| 471 | 493 |
| 472 | 494 |
| 473 void ReturnInstr::PrintTo(BufferFormatter* f) const { | 495 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()) { | 803 if ((locations_ != NULL) && !locations_[i].IsInvalid()) { |
| 782 f->Print(" ["); | 804 f->Print(" ["); |
| 783 locations_[i].PrintTo(f); | 805 locations_[i].PrintTo(f); |
| 784 f->Print("]"); | 806 f->Print("]"); |
| 785 } | 807 } |
| 786 } | 808 } |
| 787 f->Print(" }"); | 809 f->Print(" }"); |
| 788 } | 810 } |
| 789 | 811 |
| 790 } // namespace dart | 812 } // namespace dart |
| OLD | NEW |