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

Side by Side Diff: pkg/compiler/lib/src/tree_ir/tree_ir_tracer.dart

Issue 1092023002: CPS implementation of throw and rethrow. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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 tree_ir_tracer; 5 library tree_ir_tracer;
6 6
7 import 'dart:async' show EventSink; 7 import 'dart:async' show EventSink;
8 import '../tracer.dart'; 8 import '../tracer.dart';
9 import 'tree_ir_nodes.dart'; 9 import 'tree_ir_nodes.dart';
10 10
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 breakTargets[node.label] = target; 73 breakTargets[node.label] = target;
74 visitStatement(node.body); 74 visitStatement(node.body);
75 _addBlock(target); 75 _addBlock(target);
76 visitStatement(node.next); 76 visitStatement(node.next);
77 } 77 }
78 78
79 visitReturn(Return node) { 79 visitReturn(Return node) {
80 _addStatement(node); 80 _addStatement(node);
81 } 81 }
82 82
83 visitThrow(Throw node) {
84 _addStatement(node);
85 }
86
87 visitRethrow(Rethrow node) {
88 _addStatement(node);
89 }
90
83 visitBreak(Break node) { 91 visitBreak(Break node) {
84 _addStatement(node); 92 _addStatement(node);
85 blocks.last.addEdgeTo(breakTargets[node.target]); 93 blocks.last.addEdgeTo(breakTargets[node.target]);
86 } 94 }
87 95
88 visitContinue(Continue node) { 96 visitContinue(Continue node) {
89 _addStatement(node); 97 _addStatement(node);
90 blocks.last.addEdgeTo(continueTargets[node.target]); 98 blocks.last.addEdgeTo(continueTargets[node.target]);
91 } 99 }
92 100
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 } 265 }
258 266
259 visitLabeledStatement(LabeledStatement node) { 267 visitLabeledStatement(LabeledStatement node) {
260 // These do not get added to a block's list of statements. 268 // These do not get added to a block's list of statements.
261 } 269 }
262 270
263 visitReturn(Return node) { 271 visitReturn(Return node) {
264 printStatement(null, "return ${expr(node.value)}"); 272 printStatement(null, "return ${expr(node.value)}");
265 } 273 }
266 274
275 visitThrow(Throw node) {
276 printStatement(null, "throw ${expr(node.value)}");
277 }
278
279 visitRethrow(Rethrow node) {
280 printStatement(null, "rethrow");
281 }
282
267 visitBreak(Break node) { 283 visitBreak(Break node) {
268 printStatement(null, "break ${collector.breakTargets[node.target].name}"); 284 printStatement(null, "break ${collector.breakTargets[node.target].name}");
269 } 285 }
270 286
271 visitContinue(Continue node) { 287 visitContinue(Continue node) {
272 printStatement(null, 288 printStatement(null,
273 "continue ${collector.continueTargets[node.target].name}"); 289 "continue ${collector.continueTargets[node.target].name}");
274 } 290 }
275 291
276 visitIf(If node) { 292 visitIf(If node) {
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 String prefix = v.element == null ? 'v' : '${v.element.name}_'; 555 String prefix = v.element == null ? 'v' : '${v.element.name}_';
540 while (name == null || _usedNames.contains(name)) { 556 while (name == null || _usedNames.contains(name)) {
541 name = "$prefix${_counter++}"; 557 name = "$prefix${_counter++}";
542 } 558 }
543 _names[v] = name; 559 _names[v] = name;
544 _usedNames.add(name); 560 _usedNames.add(name);
545 } 561 }
546 return name; 562 return name;
547 } 563 }
548 } 564 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698