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

Side by Side Diff: frog/leg/ssa/tracer.dart

Issue 9351020: Implement try/catch without finally, and without type checks. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 10 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
« no previous file with comments | « frog/leg/ssa/optimize.dart ('k') | frog/leg/typechecker.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 class HTracer extends HGraphVisitor { 5 class HTracer extends HGraphVisitor {
6 int indent = 0; 6 int indent = 0;
7 final StringBuffer output; 7 final StringBuffer output;
8 8
9 factory HTracer.singleton() { 9 factory HTracer.singleton() {
10 if (_singleton === null) _singleton = new HTracer._internal(); 10 if (_singleton === null) _singleton = new HTracer._internal();
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 String visitSubtract(HSubtract node) => visitInvokeStatic(node); 375 String visitSubtract(HSubtract node) => visitInvokeStatic(node);
376 376
377 String visitThis(HThis node) => "this"; 377 String visitThis(HThis node) => "this";
378 378
379 String visitThrow(HThrow node) => "Throw ${temporaryId(node.inputs[0])}"; 379 String visitThrow(HThrow node) => "Throw ${temporaryId(node.inputs[0])}";
380 380
381 String visitTruncatingDivide(HTruncatingDivide node) { 381 String visitTruncatingDivide(HTruncatingDivide node) {
382 return visitInvokeStatic(node); 382 return visitInvokeStatic(node);
383 } 383 }
384 384
385 String visitTry(HTry node) {
386 List<HBasicBlock> successors = currentBlock.successors;
387 String tryBlock = 'B${successors[0].id}';
388 StringBuffer catchBlocks = new StringBuffer();
389 for (int i = 1; i < successors.length - 1; i++) {
390 catchBlocks.add('B${successors[i].id}, ');
391 }
392
393 String finallyBlock;
394 if (node.finallyBlock != null) {
395 finallyBlock = 'B${node.finallyBlock.id}';
396 } else {
397 catchBlocks.add('B${successors[successors.length - 1].id}');
398 finallyBlock = 'none';
399 }
400 return "Try: $tryBlock, Catch: $catchBlocks, Finally: $finallyBlock";
401 }
402
385 String visitTypeGuard(HTypeGuard node) { 403 String visitTypeGuard(HTypeGuard node) {
386 String type; 404 String type;
387 switch (node.type) { 405 switch (node.type) {
388 case HType.ARRAY: type = "array"; break; 406 case HType.ARRAY: type = "array"; break;
389 case HType.BOOLEAN: type = "bool"; break; 407 case HType.BOOLEAN: type = "bool"; break;
390 case HType.INTEGER: type = "integer"; break; 408 case HType.INTEGER: type = "integer"; break;
391 case HType.DOUBLE: type = "double"; break; 409 case HType.DOUBLE: type = "double"; break;
392 case HType.NUMBER: type = "number"; break; 410 case HType.NUMBER: type = "number"; break;
393 case HType.STRING: type = "string"; break; 411 case HType.STRING: type = "string"; break;
394 case HType.STRING_OR_ARRAY: type = "string_or_array"; break; 412 case HType.STRING_OR_ARRAY: type = "string_or_array"; break;
395 default: unreachable(); 413 default: unreachable();
396 } 414 }
397 return "TypeGuard: ${temporaryId(node.inputs[0])} is $type"; 415 return "TypeGuard: ${temporaryId(node.inputs[0])} is $type";
398 } 416 }
399 417
400 String visitIs(HIs node) { 418 String visitIs(HIs node) {
401 String type = node.typeExpression.toString(); 419 String type = node.typeExpression.toString();
402 return "TypeTest: ${temporaryId(node.expression)} is $type"; 420 return "TypeTest: ${temporaryId(node.expression)} is $type";
403 } 421 }
404 } 422 }
OLDNEW
« no previous file with comments | « frog/leg/ssa/optimize.dart ('k') | frog/leg/typechecker.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698