OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library dart2js.ir_tracer; | 5 library dart2js.ir_tracer; |
6 | 6 |
7 import 'dart:async' show EventSink; | 7 import 'dart:async' show EventSink; |
8 | 8 |
9 import 'cps_ir_nodes.dart' as cps_ir hide Function; | 9 import 'cps_ir_nodes.dart' as cps_ir hide Function; |
10 import '../tracer.dart'; | 10 import '../tracer.dart'; |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 } | 244 } |
245 | 245 |
246 visitContinuation(cps_ir.Continuation node) { | 246 visitContinuation(cps_ir.Continuation node) { |
247 return "Continuation ${names.name(node)}"; | 247 return "Continuation ${names.name(node)}"; |
248 } | 248 } |
249 | 249 |
250 visitIsTrue(cps_ir.IsTrue node) { | 250 visitIsTrue(cps_ir.IsTrue node) { |
251 return "IsTrue(${names.name(node.value.definition)})"; | 251 return "IsTrue(${names.name(node.value.definition)})"; |
252 } | 252 } |
253 | 253 |
| 254 visitSetField(cps_ir.SetField node) { |
| 255 String dummy = names.name(node); |
| 256 String object = formatReference(node.object); |
| 257 String field = node.field.name; |
| 258 String value = formatReference(node.value); |
| 259 printStmt(dummy, 'SetField $object.$field = $value'); |
| 260 visit(node.body); |
| 261 } |
| 262 |
| 263 visitGetField(cps_ir.GetField node) { |
| 264 String object = formatReference(node.object); |
| 265 String field = node.field.name; |
| 266 return 'GetField($object.$field)'; |
| 267 } |
| 268 |
| 269 visitCreateBox(cps_ir.CreateBox node) { |
| 270 return 'CreateBox'; |
| 271 } |
| 272 |
| 273 visitCreateClosureClass(cps_ir.CreateClosureClass node) { |
| 274 String className = node.classElement.name; |
| 275 String arguments = node.arguments.map(formatReference).join(', '); |
| 276 return 'CreateClosureClass $className ($arguments)'; |
| 277 } |
| 278 |
254 visitIdentical(cps_ir.Identical node) { | 279 visitIdentical(cps_ir.Identical node) { |
255 String left = formatReference(node.left); | 280 String left = formatReference(node.left); |
256 String right = formatReference(node.right); | 281 String right = formatReference(node.right); |
257 return "Identical($left, $right)"; | 282 return "Identical($left, $right)"; |
258 } | 283 } |
259 | 284 |
260 visitInterceptor(cps_ir.Interceptor node) { | 285 visitInterceptor(cps_ir.Interceptor node) { |
261 return "Interceptor(${node.input})"; | 286 return "Interceptor(${formatReference(node.input)})"; |
262 } | 287 } |
263 | 288 |
264 visitThis(cps_ir.This node) { | 289 visitThis(cps_ir.This node) { |
265 return "This"; | 290 return "This"; |
266 } | 291 } |
267 | 292 |
268 visitReifyTypeVar(cps_ir.ReifyTypeVar node) { | 293 visitReifyTypeVar(cps_ir.ReifyTypeVar node) { |
269 return "ReifyTypeVar ${node.typeVariable.name}"; | 294 return "ReifyTypeVar ${node.typeVariable.name}"; |
270 } | 295 } |
271 | 296 |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 } | 450 } |
426 | 451 |
427 visitInvokeContinuation(cps_ir.InvokeContinuation exp) { | 452 visitInvokeContinuation(cps_ir.InvokeContinuation exp) { |
428 addEdgeToContinuation(exp.continuation); | 453 addEdgeToContinuation(exp.continuation); |
429 } | 454 } |
430 | 455 |
431 visitSetClosureVariable(cps_ir.SetClosureVariable exp) { | 456 visitSetClosureVariable(cps_ir.SetClosureVariable exp) { |
432 visit(exp.body); | 457 visit(exp.body); |
433 } | 458 } |
434 | 459 |
| 460 visitSetField(cps_ir.SetField exp) { |
| 461 visit(exp.body); |
| 462 } |
| 463 |
435 visitDeclareFunction(cps_ir.DeclareFunction exp) { | 464 visitDeclareFunction(cps_ir.DeclareFunction exp) { |
436 visit(exp.body); | 465 visit(exp.body); |
437 } | 466 } |
438 | 467 |
439 visitBranch(cps_ir.Branch exp) { | 468 visitBranch(cps_ir.Branch exp) { |
440 cps_ir.Continuation trueTarget = exp.trueContinuation.definition; | 469 cps_ir.Continuation trueTarget = exp.trueContinuation.definition; |
441 if (!trueTarget.isReturnContinuation) { | 470 if (!trueTarget.isReturnContinuation) { |
442 current_block.addEdgeTo(getBlock(trueTarget)); | 471 current_block.addEdgeTo(getBlock(trueTarget)); |
443 } | 472 } |
444 cps_ir.Continuation falseTarget = exp.falseContinuation.definition; | 473 cps_ir.Continuation falseTarget = exp.falseContinuation.definition; |
445 if (!falseTarget.isReturnContinuation) { | 474 if (!falseTarget.isReturnContinuation) { |
446 current_block.addEdgeTo(getBlock(falseTarget)); | 475 current_block.addEdgeTo(getBlock(falseTarget)); |
447 } | 476 } |
448 } | 477 } |
449 | 478 |
450 visitContinuation(cps_ir.Continuation c) { | 479 visitContinuation(cps_ir.Continuation c) { |
451 var old_node = current_block; | 480 var old_node = current_block; |
452 current_block = getBlock(c); | 481 current_block = getBlock(c); |
453 visit(c.body); | 482 visit(c.body); |
454 current_block = old_node; | 483 current_block = old_node; |
455 } | 484 } |
456 } | 485 } |
OLD | NEW |