| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 char buffer[1024]; | 163 char buffer[1024]; |
| 164 BufferFormatter f(buffer, sizeof(buffer)); | 164 BufferFormatter f(buffer, sizeof(buffer)); |
| 165 PrintICDataHelper(&f, ic_data); | 165 PrintICDataHelper(&f, ic_data); |
| 166 OS::Print("%s ", buffer); | 166 OS::Print("%s ", buffer); |
| 167 const Array& a = Array::Handle(ic_data.arguments_descriptor()); | 167 const Array& a = Array::Handle(ic_data.arguments_descriptor()); |
| 168 OS::Print(" arg-desc %" Pd "\n", a.Length()); | 168 OS::Print(" arg-desc %" Pd "\n", a.Length()); |
| 169 } | 169 } |
| 170 | 170 |
| 171 | 171 |
| 172 static void PrintUse(BufferFormatter* f, const Definition& definition) { | 172 static void PrintUse(BufferFormatter* f, const Definition& definition) { |
| 173 if (definition.is_used()) { | 173 if (definition.HasSSATemp()) { |
| 174 if (definition.HasSSATemp()) { | 174 if (definition.HasPairRepresentation()) { |
| 175 if (definition.HasPairRepresentation()) { | 175 f->Print("v%" Pd ", v%" Pd "", definition.ssa_temp_index(), |
| 176 f->Print("v%" Pd ", v%" Pd "", definition.ssa_temp_index(), | 176 definition.ssa_temp_index() + 1); |
| 177 definition.ssa_temp_index() + 1); | 177 } else { |
| 178 } else { | 178 f->Print("v%" Pd "", definition.ssa_temp_index()); |
| 179 f->Print("v%" Pd "", definition.ssa_temp_index()); | |
| 180 } | |
| 181 } else if (definition.temp_index() != -1) { | |
| 182 f->Print("t%" Pd "", definition.temp_index()); | |
| 183 } | 179 } |
| 180 } else if (definition.HasTemp()) { |
| 181 f->Print("t%" Pd "", definition.temp_index()); |
| 184 } | 182 } |
| 185 } | 183 } |
| 186 | 184 |
| 187 | 185 |
| 188 const char* Instruction::ToCString() const { | 186 const char* Instruction::ToCString() const { |
| 189 char buffer[1024]; | 187 char buffer[1024]; |
| 190 BufferFormatter f(buffer, sizeof(buffer)); | 188 BufferFormatter f(buffer, sizeof(buffer)); |
| 191 PrintTo(&f); | 189 PrintTo(&f); |
| 192 return Isolate::Current()->current_zone()->MakeCopyOfString(buffer); | 190 return Isolate::Current()->current_zone()->MakeCopyOfString(buffer); |
| 193 } | 191 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 207 void Instruction::PrintOperandsTo(BufferFormatter* f) const { | 205 void Instruction::PrintOperandsTo(BufferFormatter* f) const { |
| 208 for (int i = 0; i < InputCount(); ++i) { | 206 for (int i = 0; i < InputCount(); ++i) { |
| 209 if (i > 0) f->Print(", "); | 207 if (i > 0) f->Print(", "); |
| 210 if (InputAt(i) != NULL) InputAt(i)->PrintTo(f); | 208 if (InputAt(i) != NULL) InputAt(i)->PrintTo(f); |
| 211 } | 209 } |
| 212 } | 210 } |
| 213 | 211 |
| 214 | 212 |
| 215 void Definition::PrintTo(BufferFormatter* f) const { | 213 void Definition::PrintTo(BufferFormatter* f) const { |
| 216 PrintUse(f, *this); | 214 PrintUse(f, *this); |
| 217 if (is_used()) { | 215 if (HasSSATemp() || HasTemp()) f->Print(" <- "); |
| 218 if (HasSSATemp() || (temp_index() != -1)) f->Print(" <- "); | |
| 219 } | |
| 220 if (GetDeoptId() != Isolate::kNoDeoptId) { | 216 if (GetDeoptId() != Isolate::kNoDeoptId) { |
| 221 f->Print("%s:%" Pd "(", DebugName(), GetDeoptId()); | 217 f->Print("%s:%" Pd "(", DebugName(), GetDeoptId()); |
| 222 } else { | 218 } else { |
| 223 f->Print("%s(", DebugName()); | 219 f->Print("%s(", DebugName()); |
| 224 } | 220 } |
| 225 PrintOperandsTo(f); | 221 PrintOperandsTo(f); |
| 226 f->Print(")"); | 222 f->Print(")"); |
| 227 if (range_ != NULL) { | 223 if (range_ != NULL) { |
| 228 f->Print(" "); | 224 f->Print(" "); |
| 229 range_->PrintTo(f); | 225 range_->PrintTo(f); |
| (...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1073 } | 1069 } |
| 1074 | 1070 |
| 1075 const char* Environment::ToCString() const { | 1071 const char* Environment::ToCString() const { |
| 1076 char buffer[1024]; | 1072 char buffer[1024]; |
| 1077 BufferFormatter bf(buffer, 1024); | 1073 BufferFormatter bf(buffer, 1024); |
| 1078 PrintTo(&bf); | 1074 PrintTo(&bf); |
| 1079 return Isolate::Current()->current_zone()->MakeCopyOfString(buffer); | 1075 return Isolate::Current()->current_zone()->MakeCopyOfString(buffer); |
| 1080 } | 1076 } |
| 1081 | 1077 |
| 1082 } // namespace dart | 1078 } // namespace dart |
| OLD | NEW |