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/flow_graph_range_analysis.h" | 7 #include "vm/flow_graph_range_analysis.h" |
8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
9 #include "vm/os.h" | 9 #include "vm/os.h" |
10 #include "vm/parser.h" | 10 #include "vm/parser.h" |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 if (i > 0) f->Print(", "); | 235 if (i > 0) f->Print(", "); |
236 if (InputAt(i) != NULL) { | 236 if (InputAt(i) != NULL) { |
237 InputAt(i)->PrintTo(f); | 237 InputAt(i)->PrintTo(f); |
238 } | 238 } |
239 } | 239 } |
240 } | 240 } |
241 | 241 |
242 | 242 |
243 void Value::PrintTo(BufferFormatter* f) const { | 243 void Value::PrintTo(BufferFormatter* f) const { |
244 PrintUse(f, *definition()); | 244 PrintUse(f, *definition()); |
| 245 |
245 if ((reaching_type_ != NULL) && | 246 if ((reaching_type_ != NULL) && |
246 (reaching_type_ != definition()->type_)) { | 247 (reaching_type_ != definition()->type_)) { |
247 f->Print(" "); | 248 f->Print(" "); |
248 reaching_type_->PrintTo(f); | 249 reaching_type_->PrintTo(f); |
249 } | 250 } |
250 } | 251 } |
251 | 252 |
252 | 253 |
253 void ConstantInstr::PrintOperandsTo(BufferFormatter* f) const { | 254 void ConstantInstr::PrintOperandsTo(BufferFormatter* f) const { |
254 const char* cstr = value().ToCString(); | 255 const char* cstr = value().ToCString(); |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 | 596 |
596 | 597 |
597 void BinarySmiOpInstr::PrintOperandsTo(BufferFormatter* f) const { | 598 void BinarySmiOpInstr::PrintOperandsTo(BufferFormatter* f) const { |
598 f->Print("%s, ", Token::Str(op_kind())); | 599 f->Print("%s, ", Token::Str(op_kind())); |
599 left()->PrintTo(f); | 600 left()->PrintTo(f); |
600 f->Print(", "); | 601 f->Print(", "); |
601 right()->PrintTo(f); | 602 right()->PrintTo(f); |
602 } | 603 } |
603 | 604 |
604 | 605 |
| 606 void BinaryInt32OpInstr::PrintTo(BufferFormatter* f) const { |
| 607 Definition::PrintTo(f); |
| 608 f->Print(" %co", overflow_ ? '+' : '-'); |
| 609 f->Print(" %ct", IsTruncating() ? '+' : '-'); |
| 610 } |
| 611 |
| 612 |
| 613 void BinaryInt32OpInstr::PrintOperandsTo(BufferFormatter* f) const { |
| 614 f->Print("%s, ", Token::Str(op_kind())); |
| 615 left()->PrintTo(f); |
| 616 f->Print(", "); |
| 617 right()->PrintTo(f); |
| 618 } |
| 619 |
| 620 |
605 void BinaryDoubleOpInstr::PrintOperandsTo(BufferFormatter* f) const { | 621 void BinaryDoubleOpInstr::PrintOperandsTo(BufferFormatter* f) const { |
606 f->Print("%s, ", Token::Str(op_kind())); | 622 f->Print("%s, ", Token::Str(op_kind())); |
607 left()->PrintTo(f); | 623 left()->PrintTo(f); |
608 f->Print(", "); | 624 f->Print(", "); |
609 right()->PrintTo(f); | 625 right()->PrintTo(f); |
610 } | 626 } |
611 | 627 |
612 | 628 |
613 void BinaryFloat32x4OpInstr::PrintOperandsTo(BufferFormatter* f) const { | 629 void BinaryFloat32x4OpInstr::PrintOperandsTo(BufferFormatter* f) const { |
614 f->Print("%s, ", Token::Str(op_kind())); | 630 f->Print("%s, ", Token::Str(op_kind())); |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
958 } | 974 } |
959 f->Print("\n}"); | 975 f->Print("\n}"); |
960 } | 976 } |
961 if (HasParallelMove()) { | 977 if (HasParallelMove()) { |
962 f->Print(" "); | 978 f->Print(" "); |
963 parallel_move()->PrintTo(f); | 979 parallel_move()->PrintTo(f); |
964 } | 980 } |
965 } | 981 } |
966 | 982 |
967 | 983 |
| 984 static const char *RepresentationToCString(Representation rep) { |
| 985 switch (rep) { |
| 986 case kTagged: |
| 987 return "tagged"; |
| 988 case kUntagged: |
| 989 return "untagged"; |
| 990 case kUnboxedDouble: |
| 991 return "double"; |
| 992 case kUnboxedInt32: |
| 993 return "int32"; |
| 994 case kUnboxedUint32: |
| 995 return "uint32"; |
| 996 case kUnboxedMint: |
| 997 return "mint"; |
| 998 case kUnboxedFloat32x4: |
| 999 return "float32x4"; |
| 1000 case kUnboxedInt32x4: |
| 1001 return "int32x4"; |
| 1002 case kUnboxedFloat64x2: |
| 1003 return "float64x2"; |
| 1004 case kPairOfTagged: |
| 1005 return "tagged-pair"; |
| 1006 case kPairOfUnboxedDouble: |
| 1007 return "double-pair"; |
| 1008 case kNoRepresentation: |
| 1009 return "none"; |
| 1010 case kNumRepresentations: |
| 1011 UNREACHABLE(); |
| 1012 } |
| 1013 return "?"; |
| 1014 } |
| 1015 |
| 1016 |
968 void PhiInstr::PrintTo(BufferFormatter* f) const { | 1017 void PhiInstr::PrintTo(BufferFormatter* f) const { |
969 f->Print("v%" Pd " <- phi(", ssa_temp_index()); | 1018 f->Print("v%" Pd " <- phi(", ssa_temp_index()); |
970 for (intptr_t i = 0; i < inputs_.length(); ++i) { | 1019 for (intptr_t i = 0; i < inputs_.length(); ++i) { |
971 if (inputs_[i] != NULL) inputs_[i]->PrintTo(f); | 1020 if (inputs_[i] != NULL) inputs_[i]->PrintTo(f); |
972 if (i < inputs_.length() - 1) f->Print(", "); | 1021 if (i < inputs_.length() - 1) f->Print(", "); |
973 } | 1022 } |
974 f->Print(")"); | 1023 f->Print(")"); |
975 if (is_alive()) { | 1024 if (is_alive()) { |
976 f->Print(" alive"); | 1025 f->Print(" alive"); |
977 } else { | 1026 } else { |
978 f->Print(" dead"); | 1027 f->Print(" dead"); |
979 } | 1028 } |
980 if (range_ != NULL) { | 1029 if (range_ != NULL) { |
981 f->Print(" "); | 1030 f->Print(" "); |
982 range_->PrintTo(f); | 1031 range_->PrintTo(f); |
983 } | 1032 } |
| 1033 |
| 1034 if (representation() != kNoRepresentation && |
| 1035 representation() != kTagged) { |
| 1036 f->Print(" %s", RepresentationToCString(representation())); |
| 1037 } |
| 1038 |
984 if (type_ != NULL) { | 1039 if (type_ != NULL) { |
985 f->Print(" "); | 1040 f->Print(" "); |
986 type_->PrintTo(f); | 1041 type_->PrintTo(f); |
987 } | 1042 } |
988 } | 1043 } |
989 | 1044 |
990 | 1045 |
| 1046 void UnboxedIntConverterInstr::PrintOperandsTo(BufferFormatter* f) const { |
| 1047 f->Print("%s->%s, ", |
| 1048 RepresentationToCString(from()), |
| 1049 RepresentationToCString(to())); |
| 1050 Definition::PrintOperandsTo(f); |
| 1051 } |
| 1052 |
| 1053 |
991 void ParameterInstr::PrintOperandsTo(BufferFormatter* f) const { | 1054 void ParameterInstr::PrintOperandsTo(BufferFormatter* f) const { |
992 f->Print("%" Pd, index()); | 1055 f->Print("%" Pd, index()); |
993 } | 1056 } |
994 | 1057 |
995 | 1058 |
996 void CheckStackOverflowInstr::PrintOperandsTo(BufferFormatter* f) const { | 1059 void CheckStackOverflowInstr::PrintOperandsTo(BufferFormatter* f) const { |
997 if (in_loop()) f->Print("depth %" Pd, loop_depth()); | 1060 if (in_loop()) f->Print("depth %" Pd, loop_depth()); |
998 } | 1061 } |
999 | 1062 |
1000 | 1063 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1094 } | 1157 } |
1095 | 1158 |
1096 const char* Environment::ToCString() const { | 1159 const char* Environment::ToCString() const { |
1097 char buffer[1024]; | 1160 char buffer[1024]; |
1098 BufferFormatter bf(buffer, 1024); | 1161 BufferFormatter bf(buffer, 1024); |
1099 PrintTo(&bf); | 1162 PrintTo(&bf); |
1100 return Isolate::Current()->current_zone()->MakeCopyOfString(buffer); | 1163 return Isolate::Current()->current_zone()->MakeCopyOfString(buffer); |
1101 } | 1164 } |
1102 | 1165 |
1103 } // namespace dart | 1166 } // namespace dart |
OLD | NEW |