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

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

Issue 10807069: Split TypeGuard and BailoutTarget. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 prefix = 'r'; 197 prefix = 'r';
198 } else if (type == HType.NULL) { 198 } else if (type == HType.NULL) {
199 prefix = 'u'; 199 prefix = 'u';
200 } else { 200 } else {
201 prefix = 'x'; 201 prefix = 'x';
202 } 202 }
203 } 203 }
204 return "$prefix${instruction.id}"; 204 return "$prefix${instruction.id}";
205 } 205 }
206 206
207 String visitBailoutTarget(HBailoutTarget node) {
208 StringBuffer envBuffer = new StringBuffer();
209 List<HInstruction> inputs = node.inputs;
210 for (int i = 0; i < inputs.length; i++) {
211 envBuffer.add(" ${temporaryId(inputs[i])}");
212 }
213 String on = node.isEnabled ? "enabled" : "disabled";
214 return "BailoutTarget($on): id: ${node.state} env: $envBuffer";
215 }
216
207 String visitBoolify(HBoolify node) { 217 String visitBoolify(HBoolify node) {
208 return "Boolify: ${temporaryId(node.inputs[0])}"; 218 return "Boolify: ${temporaryId(node.inputs[0])}";
209 } 219 }
210 220
211 String visitAdd(HAdd node) => visitInvokeStatic(node); 221 String visitAdd(HAdd node) => visitInvokeStatic(node);
212 222
213 String visitBitAnd(HBitAnd node) => visitInvokeStatic(node); 223 String visitBitAnd(HBitAnd node) => visitInvokeStatic(node);
214 224
215 String visitBitNot(HBitNot node) => visitInvokeStatic(node); 225 String visitBitNot(HBitNot node) => visitInvokeStatic(node);
216 226
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 type = "number"; 482 type = "number";
473 } else if (guardedType == HType.STRING) { 483 } else if (guardedType == HType.STRING) {
474 type = "string"; 484 type = "string";
475 } else if (guardedType == HType.INDEXABLE_PRIMITIVE) { 485 } else if (guardedType == HType.INDEXABLE_PRIMITIVE) {
476 type = "string_or_array"; 486 type = "string_or_array";
477 } else if (guardedType == HType.UNKNOWN) { 487 } else if (guardedType == HType.UNKNOWN) {
478 type = 'unknown'; 488 type = 'unknown';
479 } else { 489 } else {
480 throw new CompilerCancelledException('Unexpected type guard: $type'); 490 throw new CompilerCancelledException('Unexpected type guard: $type');
481 } 491 }
492 HInstruction guarded = node.guarded;
493 HInstruction bailoutTarget = node.bailoutTarget;
482 StringBuffer envBuffer = new StringBuffer(); 494 StringBuffer envBuffer = new StringBuffer();
483 List<HInstruction> inputs = node.inputs; 495 List<HInstruction> inputs = node.inputs;
496 bool skippedFirstGuarded = false;
484 for (int i = 0; i < inputs.length; i++) { 497 for (int i = 0; i < inputs.length; i++) {
485 if (inputs[i] !== node.guarded) { 498 if (inputs[i] == guarded && !skippedFirstGuarded) {
486 envBuffer.add(" ${temporaryId(inputs[i])}"); 499 skippedFirstGuarded = true;
ricow1 2012/07/23 12:52:26 you should add a comment explaining why we can saf
floitsch 2012/07/23 13:27:48 refactored code.
500 continue;
487 } 501 }
502 if (inputs[i] != bailoutTarget) continue;
503 envBuffer.add(" ${temporaryId(inputs[i])}");
488 } 504 }
489 String on = node.isEnabled ? "enabled" : "disabled"; 505 String on = node.isEnabled ? "enabled" : "disabled";
490 String id = temporaryId(node.guarded); 506 String guardedId = temporaryId(node.guarded);
491 return "TypeGuard($on): $id is $type env: $envBuffer"; 507 String bailoutId = temporaryId(node.bailoutTarget);
508 return "TypeGuard($on): $guardedId is $type bailout: $bailoutId "
509 "env: $envBuffer";
492 } 510 }
493 511
494 String visitIs(HIs node) { 512 String visitIs(HIs node) {
495 String type = node.typeExpression.toString(); 513 String type = node.typeExpression.toString();
496 return "TypeTest: ${temporaryId(node.expression)} is $type"; 514 return "TypeTest: ${temporaryId(node.expression)} is $type";
497 } 515 }
498 516
499 String visitTypeConversion(HTypeConversion node) { 517 String visitTypeConversion(HTypeConversion node) {
500 String type = node.propagatedType.toString(); 518 String type = node.propagatedType.toString();
501 return "TypeConversion: ${temporaryId(node.inputs[0])} to $type"; 519 return "TypeConversion: ${temporaryId(node.inputs[0])} to $type";
502 } 520 }
503 } 521 }
OLDNEW
« lib/compiler/implementation/ssa/nodes.dart ('K') | « lib/compiler/implementation/ssa/nodes.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698