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

Side by Side Diff: lib/compiler/implementation/ssa/tracer.dart

Issue 10544024: Implement constant switch as JS switch. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments. Added to Tracer. Created 8 years, 6 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 | « lib/compiler/implementation/ssa/nodes.dart ('k') | tests/language/language_dart2js.status » ('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 #library('tracer'); 5 #library('tracer');
6 6
7 #import('dart:io'); 7 #import('dart:io');
8 #import('ssa.dart'); 8 #import('ssa.dart');
9 #import('../leg.dart'); 9 #import('../leg.dart');
10 10
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 376
377 String visitStatic(HStatic node) 377 String visitStatic(HStatic node)
378 => "Static ${node.element.name.slowToString()}"; 378 => "Static ${node.element.name.slowToString()}";
379 String visitStaticStore(HStaticStore node) { 379 String visitStaticStore(HStaticStore node) {
380 String lhs = node.element.name.slowToString(); 380 String lhs = node.element.name.slowToString();
381 return "Static $lhs = ${temporaryId(node.inputs[0])}"; 381 return "Static $lhs = ${temporaryId(node.inputs[0])}";
382 } 382 }
383 383
384 String visitSubtract(HSubtract node) => visitInvokeStatic(node); 384 String visitSubtract(HSubtract node) => visitInvokeStatic(node);
385 385
386 String visitSwitch(HSwitch node) {
387 StringBuffer buf = new StringBuffer();
388 buf.add("Switch: (");
389 buf.add(temporaryId(node.inputs[0]));
390 buf.add(") ");
391 for (int i = 1; i < node.inputs.length; i++) {
392 buf.add(temporaryId(node.inputs[i]));
393 buf.add(": B");
394 buf.add(node.block.successors[i - 1].id);
395 buf.add(", ");
396 }
397 buf.add("default: B");
398 buf.add(node.block.successors.last().id);
399 return buf.toString();
400 }
401
386 String visitThis(HThis node) => "this"; 402 String visitThis(HThis node) => "this";
387 403
388 String visitThrow(HThrow node) => "Throw ${temporaryId(node.inputs[0])}"; 404 String visitThrow(HThrow node) => "Throw ${temporaryId(node.inputs[0])}";
389 405
390 String visitTruncatingDivide(HTruncatingDivide node) { 406 String visitTruncatingDivide(HTruncatingDivide node) {
391 return visitInvokeStatic(node); 407 return visitInvokeStatic(node);
392 } 408 }
393 409
394 String visitTry(HTry node) { 410 String visitTry(HTry node) {
395 List<HBasicBlock> successors = currentBlock.successors; 411 List<HBasicBlock> successors = currentBlock.successors;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 String visitIs(HIs node) { 457 String visitIs(HIs node) {
442 String type = node.typeExpression.toString(); 458 String type = node.typeExpression.toString();
443 return "TypeTest: ${temporaryId(node.expression)} is $type"; 459 return "TypeTest: ${temporaryId(node.expression)} is $type";
444 } 460 }
445 461
446 String visitTypeConversion(HTypeConversion node) { 462 String visitTypeConversion(HTypeConversion node) {
447 String type = node.propagatedType.toString(); 463 String type = node.propagatedType.toString();
448 return "TypeConversion: ${temporaryId(node.inputs[0])} to $type"; 464 return "TypeConversion: ${temporaryId(node.inputs[0])} to $type";
449 } 465 }
450 } 466 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/ssa/nodes.dart ('k') | tests/language/language_dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698