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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 | 250 |
251 const char* Instruction::ToCString() const { | 251 const char* Instruction::ToCString() const { |
252 char buffer[1024]; | 252 char buffer[1024]; |
253 BufferFormatter f(buffer, sizeof(buffer)); | 253 BufferFormatter f(buffer, sizeof(buffer)); |
254 PrintTo(&f); | 254 PrintTo(&f); |
255 return Thread::Current()->zone()->MakeCopyOfString(buffer); | 255 return Thread::Current()->zone()->MakeCopyOfString(buffer); |
256 } | 256 } |
257 | 257 |
258 | 258 |
259 void Instruction::PrintTo(BufferFormatter* f) const { | 259 void Instruction::PrintTo(BufferFormatter* f) const { |
260 if (GetDeoptId() != Isolate::kNoDeoptId) { | 260 if (GetDeoptId() != Thread::kNoDeoptId) { |
261 f->Print("%s:%" Pd "(", DebugName(), GetDeoptId()); | 261 f->Print("%s:%" Pd "(", DebugName(), GetDeoptId()); |
262 } else { | 262 } else { |
263 f->Print("%s(", DebugName()); | 263 f->Print("%s(", DebugName()); |
264 } | 264 } |
265 PrintOperandsTo(f); | 265 PrintOperandsTo(f); |
266 f->Print(")"); | 266 f->Print(")"); |
267 } | 267 } |
268 | 268 |
269 | 269 |
270 void Instruction::PrintOperandsTo(BufferFormatter* f) const { | 270 void Instruction::PrintOperandsTo(BufferFormatter* f) const { |
271 for (int i = 0; i < InputCount(); ++i) { | 271 for (int i = 0; i < InputCount(); ++i) { |
272 if (i > 0) f->Print(", "); | 272 if (i > 0) f->Print(", "); |
273 if (InputAt(i) != NULL) InputAt(i)->PrintTo(f); | 273 if (InputAt(i) != NULL) InputAt(i)->PrintTo(f); |
274 } | 274 } |
275 } | 275 } |
276 | 276 |
277 | 277 |
278 void Definition::PrintTo(BufferFormatter* f) const { | 278 void Definition::PrintTo(BufferFormatter* f) const { |
279 PrintUse(f, *this); | 279 PrintUse(f, *this); |
280 if (HasSSATemp() || HasTemp()) f->Print(" <- "); | 280 if (HasSSATemp() || HasTemp()) f->Print(" <- "); |
281 if (GetDeoptId() != Isolate::kNoDeoptId) { | 281 if (GetDeoptId() != Thread::kNoDeoptId) { |
282 f->Print("%s:%" Pd "(", DebugName(), GetDeoptId()); | 282 f->Print("%s:%" Pd "(", DebugName(), GetDeoptId()); |
283 } else { | 283 } else { |
284 f->Print("%s(", DebugName()); | 284 f->Print("%s(", DebugName()); |
285 } | 285 } |
286 PrintOperandsTo(f); | 286 PrintOperandsTo(f); |
287 f->Print(")"); | 287 f->Print(")"); |
288 if (range_ != NULL) { | 288 if (range_ != NULL) { |
289 f->Print(" "); | 289 f->Print(" "); |
290 range_->PrintTo(f); | 290 range_->PrintTo(f); |
291 } | 291 } |
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1148 void PushArgumentInstr::PrintOperandsTo(BufferFormatter* f) const { | 1148 void PushArgumentInstr::PrintOperandsTo(BufferFormatter* f) const { |
1149 value()->PrintTo(f); | 1149 value()->PrintTo(f); |
1150 } | 1150 } |
1151 | 1151 |
1152 | 1152 |
1153 void GotoInstr::PrintTo(BufferFormatter* f) const { | 1153 void GotoInstr::PrintTo(BufferFormatter* f) const { |
1154 if (HasParallelMove()) { | 1154 if (HasParallelMove()) { |
1155 parallel_move()->PrintTo(f); | 1155 parallel_move()->PrintTo(f); |
1156 f->Print(" "); | 1156 f->Print(" "); |
1157 } | 1157 } |
1158 if (GetDeoptId() != Isolate::kNoDeoptId) { | 1158 if (GetDeoptId() != Thread::kNoDeoptId) { |
1159 f->Print("goto:%" Pd " B%" Pd "", GetDeoptId(), successor()->block_id()); | 1159 f->Print("goto:%" Pd " B%" Pd "", GetDeoptId(), successor()->block_id()); |
1160 } else { | 1160 } else { |
1161 f->Print("goto: B%" Pd "", successor()->block_id()); | 1161 f->Print("goto: B%" Pd "", successor()->block_id()); |
1162 } | 1162 } |
1163 } | 1163 } |
1164 | 1164 |
1165 | 1165 |
1166 void IndirectGotoInstr::PrintTo(BufferFormatter* f) const { | 1166 void IndirectGotoInstr::PrintTo(BufferFormatter* f) const { |
1167 if (GetDeoptId() != Isolate::kNoDeoptId) { | 1167 if (GetDeoptId() != Thread::kNoDeoptId) { |
1168 f->Print("igoto:%" Pd "(", GetDeoptId()); | 1168 f->Print("igoto:%" Pd "(", GetDeoptId()); |
1169 } else { | 1169 } else { |
1170 f->Print("igoto:("); | 1170 f->Print("igoto:("); |
1171 } | 1171 } |
1172 InputAt(0)->PrintTo(f); | 1172 InputAt(0)->PrintTo(f); |
1173 f->Print(")"); | 1173 f->Print(")"); |
1174 } | 1174 } |
1175 | 1175 |
1176 | 1176 |
1177 void BranchInstr::PrintTo(BufferFormatter* f) const { | 1177 void BranchInstr::PrintTo(BufferFormatter* f) const { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1217 } | 1217 } |
1218 | 1218 |
1219 const char* Environment::ToCString() const { | 1219 const char* Environment::ToCString() const { |
1220 char buffer[1024]; | 1220 char buffer[1024]; |
1221 BufferFormatter bf(buffer, 1024); | 1221 BufferFormatter bf(buffer, 1024); |
1222 PrintTo(&bf); | 1222 PrintTo(&bf); |
1223 return Thread::Current()->zone()->MakeCopyOfString(buffer); | 1223 return Thread::Current()->zone()->MakeCopyOfString(buffer); |
1224 } | 1224 } |
1225 | 1225 |
1226 } // namespace dart | 1226 } // namespace dart |
OLD | NEW |