| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 char str[1000]; | 76 char str[1000]; |
| 77 BufferFormatter f(str, sizeof(str)); | 77 BufferFormatter f(str, sizeof(str)); |
| 78 instr->PrintTo(&f); | 78 instr->PrintTo(&f); |
| 79 if (FLAG_print_environments && (instr->env() != NULL)) { | 79 if (FLAG_print_environments && (instr->env() != NULL)) { |
| 80 instr->env()->PrintTo(&f); | 80 instr->env()->PrintTo(&f); |
| 81 } | 81 } |
| 82 if (print_locations && (instr->locs() != NULL)) { | 82 if (print_locations && (instr->locs() != NULL)) { |
| 83 instr->locs()->PrintTo(&f); | 83 instr->locs()->PrintTo(&f); |
| 84 } | 84 } |
| 85 if (instr->lifetime_position() != -1) { | 85 if (instr->lifetime_position() != -1) { |
| 86 OS::Print("%3"Pd": ", instr->lifetime_position()); | 86 OS::Print("%3" Pd ": ", instr->lifetime_position()); |
| 87 } | 87 } |
| 88 if (!instr->IsBlockEntry()) OS::Print(" "); | 88 if (!instr->IsBlockEntry()) OS::Print(" "); |
| 89 OS::Print("%s", str); | 89 OS::Print("%s", str); |
| 90 } | 90 } |
| 91 | 91 |
| 92 | 92 |
| 93 void FlowGraphPrinter::PrintTypeCheck(const ParsedFunction& parsed_function, | 93 void FlowGraphPrinter::PrintTypeCheck(const ParsedFunction& parsed_function, |
| 94 intptr_t token_pos, | 94 intptr_t token_pos, |
| 95 Value* value, | 95 Value* value, |
| 96 const AbstractType& dst_type, | 96 const AbstractType& dst_type, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 126 | 126 |
| 127 const char* CompileType::ToCString() const { | 127 const char* CompileType::ToCString() const { |
| 128 char buffer[1024]; | 128 char buffer[1024]; |
| 129 BufferFormatter f(buffer, sizeof(buffer)); | 129 BufferFormatter f(buffer, sizeof(buffer)); |
| 130 PrintTo(&f); | 130 PrintTo(&f); |
| 131 return Isolate::Current()->current_zone()->MakeCopyOfString(buffer); | 131 return Isolate::Current()->current_zone()->MakeCopyOfString(buffer); |
| 132 } | 132 } |
| 133 | 133 |
| 134 | 134 |
| 135 static void PrintICData(BufferFormatter* f, const ICData& ic_data) { | 135 static void PrintICData(BufferFormatter* f, const ICData& ic_data) { |
| 136 f->Print(" IC[%"Pd": ", ic_data.NumberOfChecks()); | 136 f->Print(" IC[%" Pd ": ", ic_data.NumberOfChecks()); |
| 137 Function& target = Function::Handle(); | 137 Function& target = Function::Handle(); |
| 138 for (intptr_t i = 0; i < ic_data.NumberOfChecks(); i++) { | 138 for (intptr_t i = 0; i < ic_data.NumberOfChecks(); i++) { |
| 139 GrowableArray<intptr_t> class_ids; | 139 GrowableArray<intptr_t> class_ids; |
| 140 ic_data.GetCheckAt(i, &class_ids, &target); | 140 ic_data.GetCheckAt(i, &class_ids, &target); |
| 141 const intptr_t count = ic_data.GetCountAt(i); | 141 const intptr_t count = ic_data.GetCountAt(i); |
| 142 if (i > 0) { | 142 if (i > 0) { |
| 143 f->Print(" | "); | 143 f->Print(" | "); |
| 144 } | 144 } |
| 145 for (intptr_t k = 0; k < class_ids.length(); k++) { | 145 for (intptr_t k = 0; k < class_ids.length(); k++) { |
| 146 if (k > 0) { | 146 if (k > 0) { |
| 147 f->Print(", "); | 147 f->Print(", "); |
| 148 } | 148 } |
| 149 const Class& cls = | 149 const Class& cls = |
| 150 Class::Handle(Isolate::Current()->class_table()->At(class_ids[k])); | 150 Class::Handle(Isolate::Current()->class_table()->At(class_ids[k])); |
| 151 f->Print("%s", String::Handle(cls.Name()).ToCString()); | 151 f->Print("%s", String::Handle(cls.Name()).ToCString()); |
| 152 } | 152 } |
| 153 if (count > 0) { | 153 if (count > 0) { |
| 154 f->Print(" #%"Pd, count); | 154 f->Print(" #%" Pd, count); |
| 155 } | 155 } |
| 156 f->Print(" <%p>", static_cast<void*>(target.raw())); | 156 f->Print(" <%p>", static_cast<void*>(target.raw())); |
| 157 } | 157 } |
| 158 f->Print("]"); | 158 f->Print("]"); |
| 159 } | 159 } |
| 160 | 160 |
| 161 | 161 |
| 162 static void PrintUse(BufferFormatter* f, const Definition& definition) { | 162 static void PrintUse(BufferFormatter* f, const Definition& definition) { |
| 163 if (definition.is_used()) { | 163 if (definition.is_used()) { |
| 164 if (definition.HasSSATemp()) { | 164 if (definition.HasSSATemp()) { |
| 165 f->Print("v%"Pd, definition.ssa_temp_index()); | 165 f->Print("v%" Pd, definition.ssa_temp_index()); |
| 166 } else if (definition.temp_index() != -1) { | 166 } else if (definition.temp_index() != -1) { |
| 167 f->Print("t%"Pd, definition.temp_index()); | 167 f->Print("t%" Pd, definition.temp_index()); |
| 168 } | 168 } |
| 169 } | 169 } |
| 170 } | 170 } |
| 171 | 171 |
| 172 | 172 |
| 173 const char* Instruction::ToCString() const { | 173 const char* Instruction::ToCString() const { |
| 174 char buffer[1024]; | 174 char buffer[1024]; |
| 175 BufferFormatter f(buffer, sizeof(buffer)); | 175 BufferFormatter f(buffer, sizeof(buffer)); |
| 176 PrintTo(&f); | 176 PrintTo(&f); |
| 177 return Isolate::Current()->current_zone()->MakeCopyOfString(buffer); | 177 return Isolate::Current()->current_zone()->MakeCopyOfString(buffer); |
| 178 } | 178 } |
| 179 | 179 |
| 180 | 180 |
| 181 void Instruction::PrintTo(BufferFormatter* f) const { | 181 void Instruction::PrintTo(BufferFormatter* f) const { |
| 182 if (GetDeoptId() != Isolate::kNoDeoptId) { | 182 if (GetDeoptId() != Isolate::kNoDeoptId) { |
| 183 f->Print("%s:%"Pd"(", DebugName(), GetDeoptId()); | 183 f->Print("%s:%" Pd "(", DebugName(), GetDeoptId()); |
| 184 } else { | 184 } else { |
| 185 f->Print("%s(", DebugName()); | 185 f->Print("%s(", DebugName()); |
| 186 } | 186 } |
| 187 PrintOperandsTo(f); | 187 PrintOperandsTo(f); |
| 188 f->Print(")"); | 188 f->Print(")"); |
| 189 } | 189 } |
| 190 | 190 |
| 191 | 191 |
| 192 void Instruction::PrintOperandsTo(BufferFormatter* f) const { | 192 void Instruction::PrintOperandsTo(BufferFormatter* f) const { |
| 193 for (int i = 0; i < InputCount(); ++i) { | 193 for (int i = 0; i < InputCount(); ++i) { |
| 194 if (i > 0) f->Print(", "); | 194 if (i > 0) f->Print(", "); |
| 195 if (InputAt(i) != NULL) InputAt(i)->PrintTo(f); | 195 if (InputAt(i) != NULL) InputAt(i)->PrintTo(f); |
| 196 } | 196 } |
| 197 } | 197 } |
| 198 | 198 |
| 199 | 199 |
| 200 void Definition::PrintTo(BufferFormatter* f) const { | 200 void Definition::PrintTo(BufferFormatter* f) const { |
| 201 PrintUse(f, *this); | 201 PrintUse(f, *this); |
| 202 if (is_used()) { | 202 if (is_used()) { |
| 203 if (HasSSATemp() || (temp_index() != -1)) f->Print(" <- "); | 203 if (HasSSATemp() || (temp_index() != -1)) f->Print(" <- "); |
| 204 } | 204 } |
| 205 if (GetDeoptId() != Isolate::kNoDeoptId) { | 205 if (GetDeoptId() != Isolate::kNoDeoptId) { |
| 206 f->Print("%s:%"Pd"(", DebugName(), GetDeoptId()); | 206 f->Print("%s:%" Pd "(", DebugName(), GetDeoptId()); |
| 207 } else { | 207 } else { |
| 208 f->Print("%s(", DebugName()); | 208 f->Print("%s(", DebugName()); |
| 209 } | 209 } |
| 210 PrintOperandsTo(f); | 210 PrintOperandsTo(f); |
| 211 f->Print(")"); | 211 f->Print(")"); |
| 212 if (range_ != NULL) { | 212 if (range_ != NULL) { |
| 213 f->Print(" "); | 213 f->Print(" "); |
| 214 range_->PrintTo(f); | 214 range_->PrintTo(f); |
| 215 } | 215 } |
| 216 | 216 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 char buffer[256]; | 276 char buffer[256]; |
| 277 BufferFormatter f(buffer, sizeof(buffer)); | 277 BufferFormatter f(buffer, sizeof(buffer)); |
| 278 range->PrintTo(&f); | 278 range->PrintTo(&f); |
| 279 return Isolate::Current()->current_zone()->MakeCopyOfString(buffer); | 279 return Isolate::Current()->current_zone()->MakeCopyOfString(buffer); |
| 280 } | 280 } |
| 281 | 281 |
| 282 | 282 |
| 283 void RangeBoundary::PrintTo(BufferFormatter* f) const { | 283 void RangeBoundary::PrintTo(BufferFormatter* f) const { |
| 284 switch (kind_) { | 284 switch (kind_) { |
| 285 case kSymbol: | 285 case kSymbol: |
| 286 f->Print("v%"Pd, reinterpret_cast<Definition*>(value_)->ssa_temp_index()); | 286 f->Print("v%" Pd, |
| 287 if (offset_ != 0) f->Print("%+"Pd, offset_); | 287 reinterpret_cast<Definition*>(value_)->ssa_temp_index()); |
| 288 if (offset_ != 0) f->Print("%+" Pd, offset_); |
| 288 break; | 289 break; |
| 289 case kConstant: | 290 case kConstant: |
| 290 if (value_ == kMinusInfinity) { | 291 if (value_ == kMinusInfinity) { |
| 291 f->Print("-inf"); | 292 f->Print("-inf"); |
| 292 } else if (value_ == kPlusInfinity) { | 293 } else if (value_ == kPlusInfinity) { |
| 293 f->Print("+inf"); | 294 f->Print("+inf"); |
| 294 } else { | 295 } else { |
| 295 f->Print("%"Pd, value_); | 296 f->Print("%" Pd, value_); |
| 296 } | 297 } |
| 297 break; | 298 break; |
| 298 case kUnknown: | 299 case kUnknown: |
| 299 f->Print("_|_"); | 300 f->Print("_|_"); |
| 300 break; | 301 break; |
| 301 } | 302 } |
| 302 } | 303 } |
| 303 | 304 |
| 304 | 305 |
| 305 const char* RangeBoundary::ToCString() const { | 306 const char* RangeBoundary::ToCString() const { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 | 413 |
| 413 f->Print("%s [%s %s], ", | 414 f->Print("%s [%s %s], ", |
| 414 String::Handle(field().name()).ToCString(), | 415 String::Handle(field().name()).ToCString(), |
| 415 field().is_nullable() ? "nullable" : "non-nullable", | 416 field().is_nullable() ? "nullable" : "non-nullable", |
| 416 expected); | 417 expected); |
| 417 value()->PrintTo(f); | 418 value()->PrintTo(f); |
| 418 } | 419 } |
| 419 | 420 |
| 420 | 421 |
| 421 void StoreInstanceFieldInstr::PrintOperandsTo(BufferFormatter* f) const { | 422 void StoreInstanceFieldInstr::PrintOperandsTo(BufferFormatter* f) const { |
| 422 f->Print("%s {%"Pd"}, ", | 423 f->Print("%s {%" Pd "}, ", |
| 423 String::Handle(field().name()).ToCString(), | 424 String::Handle(field().name()).ToCString(), |
| 424 field().Offset()); | 425 field().Offset()); |
| 425 instance()->PrintTo(f); | 426 instance()->PrintTo(f); |
| 426 f->Print(", "); | 427 f->Print(", "); |
| 427 value()->PrintTo(f); | 428 value()->PrintTo(f); |
| 428 } | 429 } |
| 429 | 430 |
| 430 | 431 |
| 431 void IfThenElseInstr::PrintOperandsTo(BufferFormatter* f) const { | 432 void IfThenElseInstr::PrintOperandsTo(BufferFormatter* f) const { |
| 432 left()->PrintTo(f); | 433 left()->PrintTo(f); |
| 433 f->Print(" %s ", Token::Str(kind_)); | 434 f->Print(" %s ", Token::Str(kind_)); |
| 434 right()->PrintTo(f); | 435 right()->PrintTo(f); |
| 435 f->Print(" ? %"Pd" : %"Pd, | 436 f->Print(" ? %" Pd " : %" Pd, |
| 436 if_true_, | 437 if_true_, |
| 437 if_false_); | 438 if_false_); |
| 438 } | 439 } |
| 439 | 440 |
| 440 | 441 |
| 441 void LoadStaticFieldInstr::PrintOperandsTo(BufferFormatter* f) const { | 442 void LoadStaticFieldInstr::PrintOperandsTo(BufferFormatter* f) const { |
| 442 field_value()->PrintTo(f); | 443 field_value()->PrintTo(f); |
| 443 } | 444 } |
| 444 | 445 |
| 445 | 446 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 f->Print("%s", function().ToCString()); | 518 f->Print("%s", function().ToCString()); |
| 518 for (intptr_t i = 0; i < ArgumentCount(); ++i) { | 519 for (intptr_t i = 0; i < ArgumentCount(); ++i) { |
| 519 if (i > 0) f->Print(", "); | 520 if (i > 0) f->Print(", "); |
| 520 PushArgumentAt(i)->value()->PrintTo(f); | 521 PushArgumentAt(i)->value()->PrintTo(f); |
| 521 } | 522 } |
| 522 } | 523 } |
| 523 | 524 |
| 524 | 525 |
| 525 void LoadFieldInstr::PrintOperandsTo(BufferFormatter* f) const { | 526 void LoadFieldInstr::PrintOperandsTo(BufferFormatter* f) const { |
| 526 instance()->PrintTo(f); | 527 instance()->PrintTo(f); |
| 527 f->Print(", %"Pd, offset_in_bytes()); | 528 f->Print(", %" Pd, offset_in_bytes()); |
| 528 | 529 |
| 529 if (field() != NULL) { | 530 if (field() != NULL) { |
| 530 f->Print(" {%s}", String::Handle(field()->name()).ToCString()); | 531 f->Print(" {%s}", String::Handle(field()->name()).ToCString()); |
| 531 const char* expected = "?"; | 532 const char* expected = "?"; |
| 532 if (field()->guarded_cid() != kIllegalCid) { | 533 if (field()->guarded_cid() != kIllegalCid) { |
| 533 const Class& cls = Class::Handle( | 534 const Class& cls = Class::Handle( |
| 534 Isolate::Current()->class_table()->At(field()->guarded_cid())); | 535 Isolate::Current()->class_table()->At(field()->guarded_cid())); |
| 535 expected = String::Handle(cls.Name()).ToCString(); | 536 expected = String::Handle(cls.Name()).ToCString(); |
| 536 } | 537 } |
| 537 | 538 |
| 538 f->Print(" [%s %s]", | 539 f->Print(" [%s %s]", |
| 539 field()->is_nullable() ? "nullable" : "non-nullable", | 540 field()->is_nullable() ? "nullable" : "non-nullable", |
| 540 expected); | 541 expected); |
| 541 } | 542 } |
| 542 | 543 |
| 543 f->Print(", immutable=%d", immutable_); | 544 f->Print(", immutable=%d", immutable_); |
| 544 } | 545 } |
| 545 | 546 |
| 546 | 547 |
| 547 void StoreVMFieldInstr::PrintOperandsTo(BufferFormatter* f) const { | 548 void StoreVMFieldInstr::PrintOperandsTo(BufferFormatter* f) const { |
| 548 dest()->PrintTo(f); | 549 dest()->PrintTo(f); |
| 549 f->Print(", %"Pd", ", offset_in_bytes()); | 550 f->Print(", %" Pd ", ", offset_in_bytes()); |
| 550 value()->PrintTo(f); | 551 value()->PrintTo(f); |
| 551 } | 552 } |
| 552 | 553 |
| 553 | 554 |
| 554 void InstantiateTypeInstr::PrintOperandsTo(BufferFormatter* f) const { | 555 void InstantiateTypeInstr::PrintOperandsTo(BufferFormatter* f) const { |
| 555 const String& type_name = String::Handle(type().Name()); | 556 const String& type_name = String::Handle(type().Name()); |
| 556 f->Print("%s, ", type_name.ToCString()); | 557 f->Print("%s, ", type_name.ToCString()); |
| 557 instantiator()->PrintTo(f); | 558 instantiator()->PrintTo(f); |
| 558 } | 559 } |
| 559 | 560 |
| 560 | 561 |
| 561 void InstantiateTypeArgumentsInstr::PrintOperandsTo(BufferFormatter* f) const { | 562 void InstantiateTypeArgumentsInstr::PrintOperandsTo(BufferFormatter* f) const { |
| 562 const String& type_args = String::Handle(type_arguments().Name()); | 563 const String& type_args = String::Handle(type_arguments().Name()); |
| 563 f->Print("%s, ", type_args.ToCString()); | 564 f->Print("%s, ", type_args.ToCString()); |
| 564 instantiator()->PrintTo(f); | 565 instantiator()->PrintTo(f); |
| 565 } | 566 } |
| 566 | 567 |
| 567 | 568 |
| 568 void ExtractConstructorTypeArgumentsInstr::PrintOperandsTo( | 569 void ExtractConstructorTypeArgumentsInstr::PrintOperandsTo( |
| 569 BufferFormatter* f) const { | 570 BufferFormatter* f) const { |
| 570 const String& type_args = String::Handle(type_arguments().Name()); | 571 const String& type_args = String::Handle(type_arguments().Name()); |
| 571 f->Print("%s, ", type_args.ToCString()); | 572 f->Print("%s, ", type_args.ToCString()); |
| 572 instantiator()->PrintTo(f); | 573 instantiator()->PrintTo(f); |
| 573 } | 574 } |
| 574 | 575 |
| 575 | 576 |
| 576 void AllocateContextInstr::PrintOperandsTo(BufferFormatter* f) const { | 577 void AllocateContextInstr::PrintOperandsTo(BufferFormatter* f) const { |
| 577 f->Print("%"Pd"", num_context_variables()); | 578 f->Print("%" Pd "", num_context_variables()); |
| 578 } | 579 } |
| 579 | 580 |
| 580 | 581 |
| 581 void BinarySmiOpInstr::PrintTo(BufferFormatter* f) const { | 582 void BinarySmiOpInstr::PrintTo(BufferFormatter* f) const { |
| 582 Definition::PrintTo(f); | 583 Definition::PrintTo(f); |
| 583 f->Print(" %co", overflow_ ? '+' : '-'); | 584 f->Print(" %co", overflow_ ? '+' : '-'); |
| 584 f->Print(" %ct", is_truncating() ? '+' : '-'); | 585 f->Print(" %ct", is_truncating() ? '+' : '-'); |
| 585 } | 586 } |
| 586 | 587 |
| 587 | 588 |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 799 | 800 |
| 800 | 801 |
| 801 void InvokeMathCFunctionInstr::PrintOperandsTo(BufferFormatter* f) const { | 802 void InvokeMathCFunctionInstr::PrintOperandsTo(BufferFormatter* f) const { |
| 802 f->Print("%s, ", MethodRecognizer::KindToCString(recognized_kind_)); | 803 f->Print("%s, ", MethodRecognizer::KindToCString(recognized_kind_)); |
| 803 Definition::PrintOperandsTo(f); | 804 Definition::PrintOperandsTo(f); |
| 804 } | 805 } |
| 805 | 806 |
| 806 | 807 |
| 807 void GraphEntryInstr::PrintTo(BufferFormatter* f) const { | 808 void GraphEntryInstr::PrintTo(BufferFormatter* f) const { |
| 808 const GrowableArray<Definition*>& defns = initial_definitions_; | 809 const GrowableArray<Definition*>& defns = initial_definitions_; |
| 809 f->Print("B%"Pd"[graph]:%"Pd, block_id(), GetDeoptId()); | 810 f->Print("B%" Pd "[graph]:%" Pd, block_id(), GetDeoptId()); |
| 810 if (defns.length() > 0) { | 811 if (defns.length() > 0) { |
| 811 f->Print(" {"); | 812 f->Print(" {"); |
| 812 for (intptr_t i = 0; i < defns.length(); ++i) { | 813 for (intptr_t i = 0; i < defns.length(); ++i) { |
| 813 Definition* def = defns[i]; | 814 Definition* def = defns[i]; |
| 814 f->Print("\n "); | 815 f->Print("\n "); |
| 815 def->PrintTo(f); | 816 def->PrintTo(f); |
| 816 } | 817 } |
| 817 f->Print("\n}"); | 818 f->Print("\n}"); |
| 818 } | 819 } |
| 819 } | 820 } |
| 820 | 821 |
| 821 | 822 |
| 822 void JoinEntryInstr::PrintTo(BufferFormatter* f) const { | 823 void JoinEntryInstr::PrintTo(BufferFormatter* f) const { |
| 823 if (try_index() != CatchClauseNode::kInvalidTryIndex) { | 824 if (try_index() != CatchClauseNode::kInvalidTryIndex) { |
| 824 f->Print("B%"Pd"[join try_idx %"Pd"]:%"Pd" pred(", | 825 f->Print("B%" Pd "[join try_idx %" Pd "]:%" Pd " pred(", |
| 825 block_id(), try_index(), GetDeoptId()); | 826 block_id(), try_index(), GetDeoptId()); |
| 826 } else { | 827 } else { |
| 827 f->Print("B%"Pd"[join]:%"Pd" pred(", block_id(), GetDeoptId()); | 828 f->Print("B%" Pd "[join]:%" Pd " pred(", block_id(), GetDeoptId()); |
| 828 } | 829 } |
| 829 for (intptr_t i = 0; i < predecessors_.length(); ++i) { | 830 for (intptr_t i = 0; i < predecessors_.length(); ++i) { |
| 830 if (i > 0) f->Print(", "); | 831 if (i > 0) f->Print(", "); |
| 831 f->Print("B%"Pd, predecessors_[i]->block_id()); | 832 f->Print("B%" Pd, predecessors_[i]->block_id()); |
| 832 } | 833 } |
| 833 f->Print(")"); | 834 f->Print(")"); |
| 834 if (phis_ != NULL) { | 835 if (phis_ != NULL) { |
| 835 f->Print(" {"); | 836 f->Print(" {"); |
| 836 for (intptr_t i = 0; i < phis_->length(); ++i) { | 837 for (intptr_t i = 0; i < phis_->length(); ++i) { |
| 837 if ((*phis_)[i] == NULL) continue; | 838 if ((*phis_)[i] == NULL) continue; |
| 838 f->Print("\n "); | 839 f->Print("\n "); |
| 839 (*phis_)[i]->PrintTo(f); | 840 (*phis_)[i]->PrintTo(f); |
| 840 } | 841 } |
| 841 f->Print("\n}"); | 842 f->Print("\n}"); |
| 842 } | 843 } |
| 843 if (HasParallelMove()) { | 844 if (HasParallelMove()) { |
| 844 f->Print(" "); | 845 f->Print(" "); |
| 845 parallel_move()->PrintTo(f); | 846 parallel_move()->PrintTo(f); |
| 846 } | 847 } |
| 847 } | 848 } |
| 848 | 849 |
| 849 | 850 |
| 850 void PhiInstr::PrintTo(BufferFormatter* f) const { | 851 void PhiInstr::PrintTo(BufferFormatter* f) const { |
| 851 f->Print("v%"Pd" <- phi(", ssa_temp_index()); | 852 f->Print("v%" Pd " <- phi(", ssa_temp_index()); |
| 852 for (intptr_t i = 0; i < inputs_.length(); ++i) { | 853 for (intptr_t i = 0; i < inputs_.length(); ++i) { |
| 853 if (inputs_[i] != NULL) inputs_[i]->PrintTo(f); | 854 if (inputs_[i] != NULL) inputs_[i]->PrintTo(f); |
| 854 if (i < inputs_.length() - 1) f->Print(", "); | 855 if (i < inputs_.length() - 1) f->Print(", "); |
| 855 } | 856 } |
| 856 f->Print(")"); | 857 f->Print(")"); |
| 857 if (is_alive()) { | 858 if (is_alive()) { |
| 858 f->Print(" alive"); | 859 f->Print(" alive"); |
| 859 } else { | 860 } else { |
| 860 f->Print(" dead"); | 861 f->Print(" dead"); |
| 861 } | 862 } |
| 862 if (range_ != NULL) { | 863 if (range_ != NULL) { |
| 863 f->Print(" "); | 864 f->Print(" "); |
| 864 range_->PrintTo(f); | 865 range_->PrintTo(f); |
| 865 } | 866 } |
| 866 if (type_ != NULL) { | 867 if (type_ != NULL) { |
| 867 f->Print(" "); | 868 f->Print(" "); |
| 868 type_->PrintTo(f); | 869 type_->PrintTo(f); |
| 869 } | 870 } |
| 870 } | 871 } |
| 871 | 872 |
| 872 | 873 |
| 873 void ParameterInstr::PrintOperandsTo(BufferFormatter* f) const { | 874 void ParameterInstr::PrintOperandsTo(BufferFormatter* f) const { |
| 874 f->Print("%"Pd, index()); | 875 f->Print("%" Pd, index()); |
| 875 } | 876 } |
| 876 | 877 |
| 877 | 878 |
| 878 void CheckStackOverflowInstr::PrintOperandsTo(BufferFormatter* f) const { | 879 void CheckStackOverflowInstr::PrintOperandsTo(BufferFormatter* f) const { |
| 879 if (in_loop()) f->Print("depth %"Pd, loop_depth()); | 880 if (in_loop()) f->Print("depth %" Pd, loop_depth()); |
| 880 } | 881 } |
| 881 | 882 |
| 882 | 883 |
| 883 void TargetEntryInstr::PrintTo(BufferFormatter* f) const { | 884 void TargetEntryInstr::PrintTo(BufferFormatter* f) const { |
| 884 if (try_index() != CatchClauseNode::kInvalidTryIndex) { | 885 if (try_index() != CatchClauseNode::kInvalidTryIndex) { |
| 885 f->Print("B%"Pd"[target try_idx %"Pd"]:%"Pd, | 886 f->Print("B%" Pd "[target try_idx %" Pd "]:%" Pd, |
| 886 block_id(), try_index(), GetDeoptId()); | 887 block_id(), try_index(), GetDeoptId()); |
| 887 } else { | 888 } else { |
| 888 f->Print("B%"Pd"[target]:%"Pd, block_id(), GetDeoptId()); | 889 f->Print("B%" Pd "[target]:%" Pd, block_id(), GetDeoptId()); |
| 889 } | 890 } |
| 890 if (HasParallelMove()) { | 891 if (HasParallelMove()) { |
| 891 f->Print(" "); | 892 f->Print(" "); |
| 892 parallel_move()->PrintTo(f); | 893 parallel_move()->PrintTo(f); |
| 893 } | 894 } |
| 894 } | 895 } |
| 895 | 896 |
| 896 | 897 |
| 897 void CatchBlockEntryInstr::PrintTo(BufferFormatter* f) const { | 898 void CatchBlockEntryInstr::PrintTo(BufferFormatter* f) const { |
| 898 f->Print("B%"Pd"[target catch try_idx %"Pd" catch_try_idx %"Pd"]", | 899 f->Print("B%" Pd "[target catch try_idx %" Pd " catch_try_idx %" Pd "]", |
| 899 block_id(), try_index(), catch_try_index()); | 900 block_id(), try_index(), catch_try_index()); |
| 900 if (HasParallelMove()) { | 901 if (HasParallelMove()) { |
| 901 f->Print("\n"); | 902 f->Print("\n"); |
| 902 parallel_move()->PrintTo(f); | 903 parallel_move()->PrintTo(f); |
| 903 } | 904 } |
| 904 | 905 |
| 905 const GrowableArray<Definition*>& defns = initial_definitions_; | 906 const GrowableArray<Definition*>& defns = initial_definitions_; |
| 906 if (defns.length() > 0) { | 907 if (defns.length() > 0) { |
| 907 f->Print(" {"); | 908 f->Print(" {"); |
| 908 for (intptr_t i = 0; i < defns.length(); ++i) { | 909 for (intptr_t i = 0; i < defns.length(); ++i) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 919 value()->PrintTo(f); | 920 value()->PrintTo(f); |
| 920 } | 921 } |
| 921 | 922 |
| 922 | 923 |
| 923 void GotoInstr::PrintTo(BufferFormatter* f) const { | 924 void GotoInstr::PrintTo(BufferFormatter* f) const { |
| 924 if (HasParallelMove()) { | 925 if (HasParallelMove()) { |
| 925 parallel_move()->PrintTo(f); | 926 parallel_move()->PrintTo(f); |
| 926 f->Print(" "); | 927 f->Print(" "); |
| 927 } | 928 } |
| 928 if (GetDeoptId() != Isolate::kNoDeoptId) { | 929 if (GetDeoptId() != Isolate::kNoDeoptId) { |
| 929 f->Print("goto:%"Pd" %"Pd"", GetDeoptId(), successor()->block_id()); | 930 f->Print("goto:%" Pd " %" Pd "", GetDeoptId(), successor()->block_id()); |
| 930 } else { | 931 } else { |
| 931 f->Print("goto: %"Pd"", successor()->block_id()); | 932 f->Print("goto: %" Pd "", successor()->block_id()); |
| 932 } | 933 } |
| 933 } | 934 } |
| 934 | 935 |
| 935 | 936 |
| 936 void BranchInstr::PrintTo(BufferFormatter* f) const { | 937 void BranchInstr::PrintTo(BufferFormatter* f) const { |
| 937 f->Print("%s ", DebugName()); | 938 f->Print("%s ", DebugName()); |
| 938 f->Print("if "); | 939 f->Print("if "); |
| 939 comparison()->PrintTo(f); | 940 comparison()->PrintTo(f); |
| 940 | 941 |
| 941 f->Print(" goto (%"Pd", %"Pd")", | 942 f->Print(" goto (%" Pd ", %" Pd ")", |
| 942 true_successor()->block_id(), | 943 true_successor()->block_id(), |
| 943 false_successor()->block_id()); | 944 false_successor()->block_id()); |
| 944 } | 945 } |
| 945 | 946 |
| 946 | 947 |
| 947 void ParallelMoveInstr::PrintTo(BufferFormatter* f) const { | 948 void ParallelMoveInstr::PrintTo(BufferFormatter* f) const { |
| 948 f->Print("%s ", DebugName()); | 949 f->Print("%s ", DebugName()); |
| 949 for (intptr_t i = 0; i < moves_.length(); i++) { | 950 for (intptr_t i = 0; i < moves_.length(); i++) { |
| 950 if (i != 0) f->Print(", "); | 951 if (i != 0) f->Print(", "); |
| 951 moves_[i]->dest().PrintTo(f); | 952 moves_[i]->dest().PrintTo(f); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 969 f->Print(" ["); | 970 f->Print(" ["); |
| 970 locations_[i].PrintTo(f); | 971 locations_[i].PrintTo(f); |
| 971 f->Print("]"); | 972 f->Print("]"); |
| 972 } | 973 } |
| 973 } | 974 } |
| 974 f->Print(" }"); | 975 f->Print(" }"); |
| 975 if (outer_ != NULL) outer_->PrintTo(f); | 976 if (outer_ != NULL) outer_->PrintTo(f); |
| 976 } | 977 } |
| 977 | 978 |
| 978 } // namespace dart | 979 } // namespace dart |
| OLD | NEW |