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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 if (print_locations_ && (instr->locs() != NULL)) { | 68 if (print_locations_ && (instr->locs() != NULL)) { |
69 instr->locs()->PrintTo(&f); | 69 instr->locs()->PrintTo(&f); |
70 } | 70 } |
71 if (instr->lifetime_position() != -1) { | 71 if (instr->lifetime_position() != -1) { |
72 OS::Print("%3d: ", instr->lifetime_position()); | 72 OS::Print("%3d: ", instr->lifetime_position()); |
73 } | 73 } |
74 OS::Print("%s", str); | 74 OS::Print("%s", str); |
75 } | 75 } |
76 | 76 |
77 | 77 |
78 void FlowGraphPrinter::PrintComputation(Computation* comp) { | |
79 char str[1000]; | |
80 BufferFormatter f(str, sizeof(str)); | |
81 comp->PrintTo(&f); | |
82 OS::Print("%s", str); | |
83 } | |
84 | |
85 | |
86 void FlowGraphPrinter::PrintTypeCheck(const ParsedFunction& parsed_function, | 78 void FlowGraphPrinter::PrintTypeCheck(const ParsedFunction& parsed_function, |
87 intptr_t token_pos, | 79 intptr_t token_pos, |
88 Value* value, | 80 Value* value, |
89 const AbstractType& dst_type, | 81 const AbstractType& dst_type, |
90 const String& dst_name, | 82 const String& dst_name, |
91 bool eliminated) { | 83 bool eliminated) { |
92 const Script& script = Script::Handle(parsed_function.function().script()); | 84 const Script& script = Script::Handle(parsed_function.function().script()); |
93 const char* compile_type_name = "unknown"; | 85 const char* compile_type_name = "unknown"; |
94 if (value != NULL) { | 86 if (value != NULL) { |
95 const AbstractType& type = AbstractType::Handle(value->CompileType()); | 87 const AbstractType& type = AbstractType::Handle(value->CompileType()); |
(...skipping 27 matching lines...) Expand all Loading... |
123 } | 115 } |
124 const Class& cls = | 116 const Class& cls = |
125 Class::Handle(Isolate::Current()->class_table()->At(class_ids[k])); | 117 Class::Handle(Isolate::Current()->class_table()->At(class_ids[k])); |
126 f->Print("%s", String::Handle(cls.Name()).ToCString()); | 118 f->Print("%s", String::Handle(cls.Name()).ToCString()); |
127 } | 119 } |
128 } | 120 } |
129 f->Print("]"); | 121 f->Print("]"); |
130 } | 122 } |
131 | 123 |
132 | 124 |
133 void Computation::PrintTo(BufferFormatter* f) const { | 125 void Definition::PrintTo(BufferFormatter* f) const { |
134 // Do not access 'deopt_id()' as it asserts that the computation can | 126 // Do not access 'deopt_id()' as it asserts that the computation can |
135 // deoptimize. | 127 // deoptimize. |
136 f->Print("%s:%d(", DebugName(), deopt_id_); | 128 f->Print("%s:%d(", DebugName(), deopt_id_); |
137 PrintOperandsTo(f); | 129 PrintOperandsTo(f); |
138 f->Print(")"); | 130 f->Print(")"); |
139 } | 131 } |
140 | 132 |
141 | 133 |
142 void Computation::PrintOperandsTo(BufferFormatter* f) const { | 134 void Definition::PrintOperandsTo(BufferFormatter* f) const { |
143 for (int i = 0; i < InputCount(); ++i) { | 135 for (int i = 0; i < InputCount(); ++i) { |
144 if (i > 0) f->Print(", "); | 136 if (i > 0) f->Print(", "); |
145 if (InputAt(i) != NULL) InputAt(i)->PrintTo(f); | 137 if (InputAt(i) != NULL) InputAt(i)->PrintTo(f); |
146 } | 138 } |
147 } | 139 } |
148 | 140 |
149 | 141 |
| 142 void Definition::PrintToVisualizer(BufferFormatter* f) const { |
| 143 PrintTo(f); |
| 144 } |
| 145 |
| 146 |
150 void Value::PrintTo(BufferFormatter* f) const { | 147 void Value::PrintTo(BufferFormatter* f) const { |
151 if (definition()->HasSSATemp()) { | 148 if (definition()->HasSSATemp()) { |
152 f->Print("v%d", definition()->ssa_temp_index()); | 149 f->Print("v%d", definition()->ssa_temp_index()); |
153 } else { | 150 } else { |
154 f->Print("t%d", definition()->temp_index()); | 151 f->Print("t%d", definition()->temp_index()); |
155 } | 152 } |
156 } | 153 } |
157 | 154 |
158 | 155 |
159 void ConstantComp::PrintOperandsTo(BufferFormatter* f) const { | 156 void ConstantInstr::PrintOperandsTo(BufferFormatter* f) const { |
160 f->Print("#%s", value().ToCString()); | 157 f->Print("#%s", value().ToCString()); |
161 } | 158 } |
162 | 159 |
163 | 160 |
164 void AssertAssignableComp::PrintOperandsTo(BufferFormatter* f) const { | 161 void AssertAssignableInstr::PrintOperandsTo(BufferFormatter* f) const { |
165 value()->PrintTo(f); | 162 value()->PrintTo(f); |
166 f->Print(", %s, '%s'%s", | 163 f->Print(", %s, '%s'%s", |
167 String::Handle(dst_type().Name()).ToCString(), | 164 String::Handle(dst_type().Name()).ToCString(), |
168 dst_name().ToCString(), | 165 dst_name().ToCString(), |
169 is_eliminated() ? " eliminated" : ""); | 166 is_eliminated() ? " eliminated" : ""); |
170 f->Print(" instantiator("); | 167 f->Print(" instantiator("); |
171 instantiator()->PrintTo(f); | 168 instantiator()->PrintTo(f); |
172 f->Print(")"); | 169 f->Print(")"); |
173 f->Print(" instantiator_type_arguments("); | 170 f->Print(" instantiator_type_arguments("); |
174 instantiator_type_arguments()->PrintTo(f); | 171 instantiator_type_arguments()->PrintTo(f); |
175 f->Print(")"); | 172 f->Print(")"); |
176 } | 173 } |
177 | 174 |
178 | 175 |
179 void AssertBooleanComp::PrintOperandsTo(BufferFormatter* f) const { | 176 void AssertBooleanInstr::PrintOperandsTo(BufferFormatter* f) const { |
180 value()->PrintTo(f); | 177 value()->PrintTo(f); |
181 f->Print("%s", is_eliminated() ? " eliminated" : ""); | 178 f->Print("%s", is_eliminated() ? " eliminated" : ""); |
182 } | 179 } |
183 | 180 |
184 | 181 |
185 void ArgumentDefinitionTestComp::PrintOperandsTo(BufferFormatter* f) const { | 182 void ArgumentDefinitionTestInstr::PrintOperandsTo(BufferFormatter* f) const { |
186 saved_arguments_descriptor()->PrintTo(f); | 183 saved_arguments_descriptor()->PrintTo(f); |
187 f->Print(", ?%s @%d", | 184 f->Print(", ?%s @%d", |
188 formal_parameter_name().ToCString(), | 185 formal_parameter_name().ToCString(), |
189 formal_parameter_index()); | 186 formal_parameter_index()); |
190 } | 187 } |
191 | 188 |
192 | 189 |
193 void ClosureCallComp::PrintOperandsTo(BufferFormatter* f) const { | 190 void ClosureCallInstr::PrintOperandsTo(BufferFormatter* f) const { |
194 for (intptr_t i = 0; i < ArgumentCount(); ++i) { | 191 for (intptr_t i = 0; i < ArgumentCount(); ++i) { |
195 if (i > 0) f->Print(", "); | 192 if (i > 0) f->Print(", "); |
196 ArgumentAt(i)->value()->PrintTo(f); | 193 ArgumentAt(i)->value()->PrintTo(f); |
197 } | 194 } |
198 } | 195 } |
199 | 196 |
200 | 197 |
201 void InstanceCallComp::PrintOperandsTo(BufferFormatter* f) const { | 198 void InstanceCallInstr::PrintOperandsTo(BufferFormatter* f) const { |
202 f->Print("%s", function_name().ToCString()); | 199 f->Print("%s", function_name().ToCString()); |
203 for (intptr_t i = 0; i < ArgumentCount(); ++i) { | 200 for (intptr_t i = 0; i < ArgumentCount(); ++i) { |
204 f->Print(", "); | 201 f->Print(", "); |
205 ArgumentAt(i)->value()->PrintTo(f); | 202 ArgumentAt(i)->value()->PrintTo(f); |
206 } | 203 } |
207 if (HasICData()) { | 204 if (HasICData()) { |
208 PrintICData(f, *ic_data()); | 205 PrintICData(f, *ic_data()); |
209 } | 206 } |
210 } | 207 } |
211 | 208 |
212 | 209 |
213 void PolymorphicInstanceCallComp::PrintTo(BufferFormatter* f) const { | 210 void PolymorphicInstanceCallInstr::PrintTo(BufferFormatter* f) const { |
214 f->Print("%s(", DebugName()); | 211 f->Print("%s(", DebugName()); |
215 instance_call()->PrintOperandsTo(f); | 212 instance_call()->PrintOperandsTo(f); |
216 f->Print(") "); | 213 f->Print(") "); |
217 PrintICData(f, ic_data()); | 214 PrintICData(f, ic_data()); |
218 } | 215 } |
219 | 216 |
220 | 217 |
221 void StrictCompareComp::PrintOperandsTo(BufferFormatter* f) const { | 218 void StrictCompareInstr::PrintOperandsTo(BufferFormatter* f) const { |
222 f->Print("%s, ", Token::Str(kind())); | 219 f->Print("%s, ", Token::Str(kind())); |
223 left()->PrintTo(f); | 220 left()->PrintTo(f); |
224 f->Print(", "); | 221 f->Print(", "); |
225 right()->PrintTo(f); | 222 right()->PrintTo(f); |
226 } | 223 } |
227 | 224 |
228 | 225 |
229 void EqualityCompareComp::PrintOperandsTo(BufferFormatter* f) const { | 226 void EqualityCompareInstr::PrintOperandsTo(BufferFormatter* f) const { |
230 left()->PrintTo(f); | 227 left()->PrintTo(f); |
231 f->Print(" %s ", Token::Str(kind())); | 228 f->Print(" %s ", Token::Str(kind())); |
232 right()->PrintTo(f); | 229 right()->PrintTo(f); |
233 if (HasICData()) { | 230 if (HasICData()) { |
234 PrintICData(f, *ic_data()); | 231 PrintICData(f, *ic_data()); |
235 } | 232 } |
236 } | 233 } |
237 | 234 |
238 | 235 |
239 void StaticCallComp::PrintOperandsTo(BufferFormatter* f) const { | 236 void StaticCallInstr::PrintOperandsTo(BufferFormatter* f) const { |
240 f->Print("%s ", String::Handle(function().name()).ToCString()); | 237 f->Print("%s ", String::Handle(function().name()).ToCString()); |
241 for (intptr_t i = 0; i < ArgumentCount(); ++i) { | 238 for (intptr_t i = 0; i < ArgumentCount(); ++i) { |
242 if (i > 0) f->Print(", "); | 239 if (i > 0) f->Print(", "); |
243 ArgumentAt(i)->value()->PrintTo(f); | 240 ArgumentAt(i)->value()->PrintTo(f); |
244 } | 241 } |
245 } | 242 } |
246 | 243 |
247 | 244 |
248 void LoadLocalComp::PrintOperandsTo(BufferFormatter* f) const { | 245 void LoadLocalInstr::PrintOperandsTo(BufferFormatter* f) const { |
249 f->Print("%s lvl:%d", local().name().ToCString(), context_level()); | 246 f->Print("%s lvl:%d", local().name().ToCString(), context_level()); |
250 } | 247 } |
251 | 248 |
252 | 249 |
253 void StoreLocalComp::PrintOperandsTo(BufferFormatter* f) const { | 250 void StoreLocalInstr::PrintOperandsTo(BufferFormatter* f) const { |
254 f->Print("%s, ", local().name().ToCString()); | 251 f->Print("%s, ", local().name().ToCString()); |
255 value()->PrintTo(f); | 252 value()->PrintTo(f); |
256 f->Print(", lvl: %d", context_level()); | 253 f->Print(", lvl: %d", context_level()); |
257 } | 254 } |
258 | 255 |
259 | 256 |
260 void NativeCallComp::PrintOperandsTo(BufferFormatter* f) const { | 257 void NativeCallInstr::PrintOperandsTo(BufferFormatter* f) const { |
261 f->Print("%s", native_name().ToCString()); | 258 f->Print("%s", native_name().ToCString()); |
262 } | 259 } |
263 | 260 |
264 | 261 |
265 void LoadInstanceFieldComp::PrintOperandsTo(BufferFormatter* f) const { | 262 void LoadInstanceFieldInstr::PrintOperandsTo(BufferFormatter* f) const { |
266 f->Print("%s, ", String::Handle(field().name()).ToCString()); | 263 f->Print("%s, ", String::Handle(field().name()).ToCString()); |
267 instance()->PrintTo(f); | 264 instance()->PrintTo(f); |
268 } | 265 } |
269 | 266 |
270 | 267 |
271 void StoreInstanceFieldComp::PrintOperandsTo(BufferFormatter* f) const { | 268 void StoreInstanceFieldInstr::PrintOperandsTo(BufferFormatter* f) const { |
272 f->Print("%s, ", String::Handle(field().name()).ToCString()); | 269 f->Print("%s, ", String::Handle(field().name()).ToCString()); |
273 instance()->PrintTo(f); | 270 instance()->PrintTo(f); |
274 f->Print(", "); | 271 f->Print(", "); |
275 value()->PrintTo(f); | 272 value()->PrintTo(f); |
276 } | 273 } |
277 | 274 |
278 | 275 |
279 void LoadStaticFieldComp::PrintOperandsTo(BufferFormatter* f) const { | 276 void LoadStaticFieldInstr::PrintOperandsTo(BufferFormatter* f) const { |
280 f->Print("%s", String::Handle(field().name()).ToCString()); | 277 f->Print("%s", String::Handle(field().name()).ToCString()); |
281 } | 278 } |
282 | 279 |
283 | 280 |
284 void StoreStaticFieldComp::PrintOperandsTo(BufferFormatter* f) const { | 281 void StoreStaticFieldInstr::PrintOperandsTo(BufferFormatter* f) const { |
285 f->Print("%s, ", String::Handle(field().name()).ToCString()); | 282 f->Print("%s, ", String::Handle(field().name()).ToCString()); |
286 value()->PrintTo(f); | 283 value()->PrintTo(f); |
287 } | 284 } |
288 | 285 |
289 | 286 |
290 void InstanceOfComp::PrintOperandsTo(BufferFormatter* f) const { | 287 void InstanceOfInstr::PrintOperandsTo(BufferFormatter* f) const { |
291 value()->PrintTo(f); | 288 value()->PrintTo(f); |
292 f->Print(" %s %s", | 289 f->Print(" %s %s", |
293 negate_result() ? "ISNOT" : "IS", | 290 negate_result() ? "ISNOT" : "IS", |
294 String::Handle(type().Name()).ToCString()); | 291 String::Handle(type().Name()).ToCString()); |
295 f->Print(" instantiator("); | 292 f->Print(" instantiator("); |
296 instantiator()->PrintTo(f); | 293 instantiator()->PrintTo(f); |
297 f->Print(")"); | 294 f->Print(")"); |
298 f->Print(" type-arg("); | 295 f->Print(" type-arg("); |
299 instantiator_type_arguments()->PrintTo(f); | 296 instantiator_type_arguments()->PrintTo(f); |
300 f->Print(")"); | 297 f->Print(")"); |
301 } | 298 } |
302 | 299 |
303 | 300 |
304 void RelationalOpComp::PrintOperandsTo(BufferFormatter* f) const { | 301 void RelationalOpInstr::PrintOperandsTo(BufferFormatter* f) const { |
305 f->Print("%s, ", Token::Str(kind())); | 302 f->Print("%s, ", Token::Str(kind())); |
306 left()->PrintTo(f); | 303 left()->PrintTo(f); |
307 f->Print(", "); | 304 f->Print(", "); |
308 right()->PrintTo(f); | 305 right()->PrintTo(f); |
309 if (HasICData()) { | 306 if (HasICData()) { |
310 PrintICData(f, *ic_data()); | 307 PrintICData(f, *ic_data()); |
311 } | 308 } |
312 } | 309 } |
313 | 310 |
314 | 311 |
315 void AllocateObjectComp::PrintOperandsTo(BufferFormatter* f) const { | 312 void AllocateObjectInstr::PrintOperandsTo(BufferFormatter* f) const { |
316 f->Print("%s", Class::Handle(constructor().Owner()).ToCString()); | 313 f->Print("%s", Class::Handle(constructor().Owner()).ToCString()); |
317 for (intptr_t i = 0; i < ArgumentCount(); i++) { | 314 for (intptr_t i = 0; i < ArgumentCount(); i++) { |
318 f->Print(", "); | 315 f->Print(", "); |
319 ArgumentAt(i)->value()->PrintTo(f); | 316 ArgumentAt(i)->value()->PrintTo(f); |
320 } | 317 } |
321 } | 318 } |
322 | 319 |
323 | 320 |
324 void AllocateObjectWithBoundsCheckComp::PrintOperandsTo( | 321 void AllocateObjectWithBoundsCheckInstr::PrintOperandsTo( |
325 BufferFormatter* f) const { | 322 BufferFormatter* f) const { |
326 f->Print("%s", Class::Handle(constructor().Owner()).ToCString()); | 323 f->Print("%s", Class::Handle(constructor().Owner()).ToCString()); |
327 for (intptr_t i = 0; i < InputCount(); i++) { | 324 for (intptr_t i = 0; i < InputCount(); i++) { |
328 f->Print(", "); | 325 f->Print(", "); |
329 InputAt(i)->PrintTo(f); | 326 InputAt(i)->PrintTo(f); |
330 } | 327 } |
331 } | 328 } |
332 | 329 |
333 | 330 |
334 void CreateArrayComp::PrintOperandsTo(BufferFormatter* f) const { | 331 void CreateArrayInstr::PrintOperandsTo(BufferFormatter* f) const { |
335 for (int i = 0; i < ArgumentCount(); ++i) { | 332 for (int i = 0; i < ArgumentCount(); ++i) { |
336 if (i != 0) f->Print(", "); | 333 if (i != 0) f->Print(", "); |
337 ArgumentAt(i)->value()->PrintTo(f); | 334 ArgumentAt(i)->value()->PrintTo(f); |
338 } | 335 } |
339 if (ArgumentCount() > 0) f->Print(", "); | 336 if (ArgumentCount() > 0) f->Print(", "); |
340 element_type()->PrintTo(f); | 337 element_type()->PrintTo(f); |
341 } | 338 } |
342 | 339 |
343 | 340 |
344 void CreateClosureComp::PrintOperandsTo(BufferFormatter* f) const { | 341 void CreateClosureInstr::PrintOperandsTo(BufferFormatter* f) const { |
345 f->Print("%s", function().ToCString()); | 342 f->Print("%s", function().ToCString()); |
346 for (intptr_t i = 0; i < ArgumentCount(); ++i) { | 343 for (intptr_t i = 0; i < ArgumentCount(); ++i) { |
347 if (i > 0) f->Print(", "); | 344 if (i > 0) f->Print(", "); |
348 ArgumentAt(i)->value()->PrintTo(f); | 345 ArgumentAt(i)->value()->PrintTo(f); |
349 } | 346 } |
350 } | 347 } |
351 | 348 |
352 | 349 |
353 void LoadVMFieldComp::PrintOperandsTo(BufferFormatter* f) const { | 350 void LoadVMFieldInstr::PrintOperandsTo(BufferFormatter* f) const { |
354 value()->PrintTo(f); | 351 value()->PrintTo(f); |
355 f->Print(", %d", offset_in_bytes()); | 352 f->Print(", %d", offset_in_bytes()); |
356 } | 353 } |
357 | 354 |
358 | 355 |
359 void StoreVMFieldComp::PrintOperandsTo(BufferFormatter* f) const { | 356 void StoreVMFieldInstr::PrintOperandsTo(BufferFormatter* f) const { |
360 dest()->PrintTo(f); | 357 dest()->PrintTo(f); |
361 f->Print(", %d, ", offset_in_bytes()); | 358 f->Print(", %d, ", offset_in_bytes()); |
362 value()->PrintTo(f); | 359 value()->PrintTo(f); |
363 } | 360 } |
364 | 361 |
365 | 362 |
366 void InstantiateTypeArgumentsComp::PrintOperandsTo(BufferFormatter* f) const { | 363 void InstantiateTypeArgumentsInstr::PrintOperandsTo(BufferFormatter* f) const { |
367 const String& type_args = String::Handle(type_arguments().Name()); | 364 const String& type_args = String::Handle(type_arguments().Name()); |
368 f->Print("%s, ", type_args.ToCString()); | 365 f->Print("%s, ", type_args.ToCString()); |
369 instantiator()->PrintTo(f); | 366 instantiator()->PrintTo(f); |
370 } | 367 } |
371 | 368 |
372 | 369 |
373 void ExtractConstructorTypeArgumentsComp::PrintOperandsTo( | 370 void ExtractConstructorTypeArgumentsInstr::PrintOperandsTo( |
374 BufferFormatter* f) const { | 371 BufferFormatter* f) const { |
375 const String& type_args = String::Handle(type_arguments().Name()); | 372 const String& type_args = String::Handle(type_arguments().Name()); |
376 f->Print("%s, ", type_args.ToCString()); | 373 f->Print("%s, ", type_args.ToCString()); |
377 instantiator()->PrintTo(f); | 374 instantiator()->PrintTo(f); |
378 } | 375 } |
379 | 376 |
380 | 377 |
381 void AllocateContextComp::PrintOperandsTo(BufferFormatter* f) const { | 378 void AllocateContextInstr::PrintOperandsTo(BufferFormatter* f) const { |
382 f->Print("%d", num_context_variables()); | 379 f->Print("%d", num_context_variables()); |
383 } | 380 } |
384 | 381 |
385 | 382 |
386 void CatchEntryComp::PrintOperandsTo(BufferFormatter* f) const { | 383 void CatchEntryInstr::PrintOperandsTo(BufferFormatter* f) const { |
387 f->Print("%s, %s", | 384 f->Print("%s, %s", |
388 exception_var().name().ToCString(), | 385 exception_var().name().ToCString(), |
389 stacktrace_var().name().ToCString()); | 386 stacktrace_var().name().ToCString()); |
390 } | 387 } |
391 | 388 |
392 | 389 |
393 void BinarySmiOpComp::PrintOperandsTo(BufferFormatter* f) const { | 390 void BinarySmiOpInstr::PrintOperandsTo(BufferFormatter* f) const { |
394 f->Print("%s, ", Token::Str(op_kind())); | 391 f->Print("%s, ", Token::Str(op_kind())); |
395 left()->PrintTo(f); | 392 left()->PrintTo(f); |
396 f->Print(", "); | 393 f->Print(", "); |
397 right()->PrintTo(f); | 394 right()->PrintTo(f); |
398 } | 395 } |
399 | 396 |
400 | 397 |
401 void BinaryMintOpComp::PrintOperandsTo(BufferFormatter* f) const { | 398 void BinaryMintOpInstr::PrintOperandsTo(BufferFormatter* f) const { |
402 f->Print("%s, ", Token::Str(op_kind())); | 399 f->Print("%s, ", Token::Str(op_kind())); |
403 left()->PrintTo(f); | 400 left()->PrintTo(f); |
404 f->Print(", "); | 401 f->Print(", "); |
405 right()->PrintTo(f); | 402 right()->PrintTo(f); |
406 } | 403 } |
407 | 404 |
408 | 405 |
409 void UnboxedDoubleBinaryOpComp::PrintOperandsTo(BufferFormatter* f) const { | 406 void UnboxedDoubleBinaryOpInstr::PrintOperandsTo(BufferFormatter* f) const { |
410 f->Print("%s, ", Token::Str(op_kind())); | 407 f->Print("%s, ", Token::Str(op_kind())); |
411 left()->PrintTo(f); | 408 left()->PrintTo(f); |
412 f->Print(", "); | 409 f->Print(", "); |
413 right()->PrintTo(f); | 410 right()->PrintTo(f); |
414 } | 411 } |
415 | 412 |
416 | 413 |
417 void UnarySmiOpComp::PrintOperandsTo(BufferFormatter* f) const { | 414 void UnarySmiOpInstr::PrintOperandsTo(BufferFormatter* f) const { |
418 f->Print("%s, ", Token::Str(op_kind())); | 415 f->Print("%s, ", Token::Str(op_kind())); |
419 value()->PrintTo(f); | 416 value()->PrintTo(f); |
420 } | 417 } |
421 | 418 |
422 | 419 |
423 void CheckClassComp::PrintOperandsTo(BufferFormatter* f) const { | 420 void CheckClassInstr::PrintOperandsTo(BufferFormatter* f) const { |
424 value()->PrintTo(f); | 421 value()->PrintTo(f); |
425 PrintICData(f, unary_checks()); | 422 PrintICData(f, unary_checks()); |
426 } | 423 } |
427 | 424 |
428 | 425 |
429 void GraphEntryInstr::PrintTo(BufferFormatter* f) const { | 426 void GraphEntryInstr::PrintTo(BufferFormatter* f) const { |
430 f->Print("%2d: [graph]", block_id()); | 427 f->Print("%2d: [graph]", block_id()); |
431 if (start_env_ != NULL) { | 428 if (start_env_ != NULL) { |
432 f->Print("\n{\n"); | 429 f->Print("\n{\n"); |
433 const GrowableArray<Value*>& values = start_env_->values(); | 430 const GrowableArray<Value*>& values = start_env_->values(); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 } else { | 496 } else { |
500 f->Print("]"); | 497 f->Print("]"); |
501 } | 498 } |
502 if (HasParallelMove()) { | 499 if (HasParallelMove()) { |
503 f->Print("\n"); | 500 f->Print("\n"); |
504 parallel_move()->PrintTo(f); | 501 parallel_move()->PrintTo(f); |
505 } | 502 } |
506 } | 503 } |
507 | 504 |
508 | 505 |
509 void BindInstr::PrintTo(BufferFormatter* f) const { | |
510 if (!is_used()) { | |
511 f->Print(" "); | |
512 } else if (HasSSATemp()) { | |
513 f->Print(" v%d <- ", ssa_temp_index()); | |
514 } else { | |
515 f->Print(" t%d <- ", temp_index()); | |
516 } | |
517 computation()->PrintTo(f); | |
518 PrintPropagatedType(f, *this); | |
519 } | |
520 | |
521 | |
522 void PushArgumentInstr::PrintTo(BufferFormatter* f) const { | 506 void PushArgumentInstr::PrintTo(BufferFormatter* f) const { |
523 f->Print(" %s ", DebugName()); | 507 f->Print(" %s ", DebugName()); |
524 value()->PrintTo(f); | 508 value()->PrintTo(f); |
525 } | 509 } |
526 | 510 |
527 | 511 |
528 void ReturnInstr::PrintTo(BufferFormatter* f) const { | 512 void ReturnInstr::PrintTo(BufferFormatter* f) const { |
529 f->Print(" %s:%d ", DebugName(), deopt_id()); | 513 f->Print(" %s:%d ", DebugName(), deopt_id()); |
530 value()->PrintTo(f); | 514 value()->PrintTo(f); |
531 } | 515 } |
(...skipping 15 matching lines...) Expand all Loading... |
547 } else { | 531 } else { |
548 f->Print(" "); | 532 f->Print(" "); |
549 } | 533 } |
550 f->Print(" goto %d", successor()->block_id()); | 534 f->Print(" goto %d", successor()->block_id()); |
551 } | 535 } |
552 | 536 |
553 | 537 |
554 void BranchInstr::PrintTo(BufferFormatter* f) const { | 538 void BranchInstr::PrintTo(BufferFormatter* f) const { |
555 f->Print(" %s ", DebugName()); | 539 f->Print(" %s ", DebugName()); |
556 f->Print("if "); | 540 f->Print("if "); |
557 computation()->PrintTo(f); | 541 comparison()->PrintTo(f); |
558 | 542 |
559 f->Print(" goto (%d, %d)", | 543 f->Print(" goto (%d, %d)", |
560 true_successor()->block_id(), | 544 true_successor()->block_id(), |
561 false_successor()->block_id()); | 545 false_successor()->block_id()); |
562 } | 546 } |
563 | 547 |
564 | 548 |
565 void ParallelMoveInstr::PrintTo(BufferFormatter* f) const { | 549 void ParallelMoveInstr::PrintTo(BufferFormatter* f) const { |
566 f->Print(" %s ", DebugName()); | 550 f->Print(" %s ", DebugName()); |
567 for (intptr_t i = 0; i < moves_.length(); i++) { | 551 for (intptr_t i = 0; i < moves_.length(); i++) { |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 void TargetEntryInstr::PrintToVisualizer(BufferFormatter* f) const { | 726 void TargetEntryInstr::PrintToVisualizer(BufferFormatter* f) const { |
743 f->Print("_ [target"); | 727 f->Print("_ [target"); |
744 if (IsCatchEntry()) { | 728 if (IsCatchEntry()) { |
745 f->Print(" catch %d]", catch_try_index()); | 729 f->Print(" catch %d]", catch_try_index()); |
746 } else { | 730 } else { |
747 f->Print("]"); | 731 f->Print("]"); |
748 } | 732 } |
749 } | 733 } |
750 | 734 |
751 | 735 |
752 void BindInstr::PrintToVisualizer(BufferFormatter* f) const { | |
753 if (!is_used()) { | |
754 f->Print("_ "); | |
755 } else if (HasSSATemp()) { | |
756 f->Print("v%d ", ssa_temp_index()); | |
757 } else { | |
758 f->Print("t%d ", temp_index()); | |
759 } | |
760 computation()->PrintTo(f); | |
761 } | |
762 | |
763 | |
764 void PushArgumentInstr::PrintToVisualizer(BufferFormatter* f) const { | 736 void PushArgumentInstr::PrintToVisualizer(BufferFormatter* f) const { |
765 f->Print("_ %s ", DebugName()); | 737 f->Print("_ %s ", DebugName()); |
766 value()->PrintTo(f); | 738 value()->PrintTo(f); |
767 } | 739 } |
768 | 740 |
769 | 741 |
770 void ReturnInstr::PrintToVisualizer(BufferFormatter* f) const { | 742 void ReturnInstr::PrintToVisualizer(BufferFormatter* f) const { |
771 f->Print("_ %s:%d ", DebugName(), deopt_id()); | 743 f->Print("_ %s:%d ", DebugName(), deopt_id()); |
772 value()->PrintTo(f); | 744 value()->PrintTo(f); |
773 } | 745 } |
(...skipping 10 matching lines...) Expand all Loading... |
784 | 756 |
785 | 757 |
786 void GotoInstr::PrintToVisualizer(BufferFormatter* f) const { | 758 void GotoInstr::PrintToVisualizer(BufferFormatter* f) const { |
787 f->Print("_ goto B%d", successor()->block_id()); | 759 f->Print("_ goto B%d", successor()->block_id()); |
788 } | 760 } |
789 | 761 |
790 | 762 |
791 void BranchInstr::PrintToVisualizer(BufferFormatter* f) const { | 763 void BranchInstr::PrintToVisualizer(BufferFormatter* f) const { |
792 f->Print("_ %s ", DebugName()); | 764 f->Print("_ %s ", DebugName()); |
793 f->Print("if "); | 765 f->Print("if "); |
794 computation()->PrintTo(f); | 766 comparison()->PrintTo(f); |
795 f->Print(" goto (B%d, B%d)", | 767 f->Print(" goto (B%d, B%d)", |
796 true_successor()->block_id(), | 768 true_successor()->block_id(), |
797 false_successor()->block_id()); | 769 false_successor()->block_id()); |
798 } | 770 } |
799 | 771 |
800 | 772 |
801 void ParallelMoveInstr::PrintToVisualizer(BufferFormatter* f) const { | 773 void ParallelMoveInstr::PrintToVisualizer(BufferFormatter* f) const { |
802 UNIMPLEMENTED(); | 774 UNIMPLEMENTED(); |
803 } | 775 } |
804 | 776 |
805 | 777 |
806 void Environment::PrintTo(BufferFormatter* f) const { | 778 void Environment::PrintTo(BufferFormatter* f) const { |
807 f->Print(" env={ "); | 779 f->Print(" env={ "); |
808 for (intptr_t i = 0; i < values_.length(); ++i) { | 780 for (intptr_t i = 0; i < values_.length(); ++i) { |
809 if (i > 0) f->Print(", "); | 781 if (i > 0) f->Print(", "); |
810 values_[i]->PrintTo(f); | 782 values_[i]->PrintTo(f); |
811 if ((locations_ != NULL) && !locations_[i].IsInvalid()) { | 783 if ((locations_ != NULL) && !locations_[i].IsInvalid()) { |
812 f->Print(" ["); | 784 f->Print(" ["); |
813 locations_[i].PrintTo(f); | 785 locations_[i].PrintTo(f); |
814 f->Print("]"); | 786 f->Print("]"); |
815 } | 787 } |
816 } | 788 } |
817 f->Print(" }"); | 789 f->Print(" }"); |
818 } | 790 } |
819 | 791 |
820 } // namespace dart | 792 } // namespace dart |
OLD | NEW |