Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: pkg/compiler/lib/src/cps_ir/cps_ir_tracer.dart

Issue 923013002: dart2dart: Implementation of simple try/catch. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed break/continue, incorporated comments. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 if (IR_TRACE_LET_CONT) { 113 if (IR_TRACE_LET_CONT) {
114 String dummy = names.name(node); 114 String dummy = names.name(node);
115 for (cps_ir.Continuation continuation in node.continuations) { 115 for (cps_ir.Continuation continuation in node.continuations) {
116 String id = names.name(continuation); 116 String id = names.name(continuation);
117 printStmt(dummy, "LetCont $id = <$id>"); 117 printStmt(dummy, "LetCont $id = <$id>");
118 } 118 }
119 } 119 }
120 visit(node.body); 120 visit(node.body);
121 } 121 }
122 122
123 visitLetHandler(cps_ir.LetHandler node) {
124 if (IR_TRACE_LET_CONT) {
125 String dummy = names.name(node);
126 String id = names.name(node.handler);
127 printStmt(dummy, "LetHandler $id = <$id>");
128 }
129 visit(node.body);
130 }
131
123 visitLetMutable(cps_ir.LetMutable node) { 132 visitLetMutable(cps_ir.LetMutable node) {
124 String id = names.name(node.variable); 133 String id = names.name(node.variable);
125 printStmt(id, "${node.runtimeType} $id = ${formatReference(node.value)}"); 134 printStmt(id, "${node.runtimeType} $id = ${formatReference(node.value)}");
126 visit(node.body); 135 visit(node.body);
127 } 136 }
128 137
129 visitInvokeStatic(cps_ir.InvokeStatic node) { 138 visitInvokeStatic(cps_ir.InvokeStatic node) {
130 String dummy = names.name(node); 139 String dummy = names.name(node);
131 String callName = node.selector.name; 140 String callName = node.selector.name;
132 String args = node.arguments.map(formatReference).join(', '); 141 String args = node.arguments.map(formatReference).join(', ');
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 437
429 visitLetPrim(cps_ir.LetPrim exp) { 438 visitLetPrim(cps_ir.LetPrim exp) {
430 visit(exp.body); 439 visit(exp.body);
431 } 440 }
432 441
433 visitLetCont(cps_ir.LetCont exp) { 442 visitLetCont(cps_ir.LetCont exp) {
434 exp.continuations.forEach(visit); 443 exp.continuations.forEach(visit);
435 visit(exp.body); 444 visit(exp.body);
436 } 445 }
437 446
447 visitLetHandler(cps_ir.LetHandler exp) {
448 visit(exp.handler);
449 visit(exp.body);
450 }
451
452 visitLetMutable(cps_ir.LetMutable exp) {
453 visit(exp.body);
454 }
455
438 void addEdgeToContinuation(cps_ir.Reference continuation) { 456 void addEdgeToContinuation(cps_ir.Reference continuation) {
439 cps_ir.Definition target = continuation.definition; 457 cps_ir.Definition target = continuation.definition;
440 if (target is cps_ir.Continuation && !target.isReturnContinuation) { 458 if (target is cps_ir.Continuation && !target.isReturnContinuation) {
441 current_block.addEdgeTo(getBlock(target)); 459 current_block.addEdgeTo(getBlock(target));
442 } 460 }
443 } 461 }
444 462
445 visitInvokeStatic(cps_ir.InvokeStatic exp) { 463 visitInvokeStatic(cps_ir.InvokeStatic exp) {
446 addEdgeToContinuation(exp.continuation); 464 addEdgeToContinuation(exp.continuation);
447 } 465 }
(...skipping 11 matching lines...) Expand all
459 } 477 }
460 478
461 visitInvokeContinuation(cps_ir.InvokeContinuation exp) { 479 visitInvokeContinuation(cps_ir.InvokeContinuation exp) {
462 addEdgeToContinuation(exp.continuation); 480 addEdgeToContinuation(exp.continuation);
463 } 481 }
464 482
465 visitSetMutableVariable(cps_ir.SetMutableVariable exp) { 483 visitSetMutableVariable(cps_ir.SetMutableVariable exp) {
466 visit(exp.body); 484 visit(exp.body);
467 } 485 }
468 486
469 visitLetMutable(cps_ir.LetMutable exp) {
470 visit(exp.body);
471 }
472
473 visitSetField(cps_ir.SetField exp) { 487 visitSetField(cps_ir.SetField exp) {
474 visit(exp.body); 488 visit(exp.body);
475 } 489 }
476 490
477 visitDeclareFunction(cps_ir.DeclareFunction exp) { 491 visitDeclareFunction(cps_ir.DeclareFunction exp) {
478 visit(exp.body); 492 visit(exp.body);
479 } 493 }
480 494
481 visitBranch(cps_ir.Branch exp) { 495 visitBranch(cps_ir.Branch exp) {
482 cps_ir.Continuation trueTarget = exp.trueContinuation.definition; 496 cps_ir.Continuation trueTarget = exp.trueContinuation.definition;
483 if (!trueTarget.isReturnContinuation) { 497 if (!trueTarget.isReturnContinuation) {
484 current_block.addEdgeTo(getBlock(trueTarget)); 498 current_block.addEdgeTo(getBlock(trueTarget));
485 } 499 }
486 cps_ir.Continuation falseTarget = exp.falseContinuation.definition; 500 cps_ir.Continuation falseTarget = exp.falseContinuation.definition;
487 if (!falseTarget.isReturnContinuation) { 501 if (!falseTarget.isReturnContinuation) {
488 current_block.addEdgeTo(getBlock(falseTarget)); 502 current_block.addEdgeTo(getBlock(falseTarget));
489 } 503 }
490 } 504 }
491 505
492 visitContinuation(cps_ir.Continuation c) { 506 visitContinuation(cps_ir.Continuation c) {
493 var old_node = current_block; 507 var old_node = current_block;
494 current_block = getBlock(c); 508 current_block = getBlock(c);
495 visit(c.body); 509 visit(c.body);
496 current_block = old_node; 510 current_block = old_node;
497 } 511 }
498 } 512 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698