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

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

Issue 10563002: Reapply change to GVN all HFieldGet instructions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Minor style fix. 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
OLDNEW
1 // Copyright (c) 2011, 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
11 final bool GENERATE_SSA_TRACE = false; 11 final bool GENERATE_SSA_TRACE = false;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } 65 }
66 } 66 }
67 67
68 void addInstructions(HInstructionStringifier stringifier, 68 void addInstructions(HInstructionStringifier stringifier,
69 HInstructionList list) { 69 HInstructionList list) {
70 for (HInstruction instruction = list.first; 70 for (HInstruction instruction = list.first;
71 instruction !== null; 71 instruction !== null;
72 instruction = instruction.next) { 72 instruction = instruction.next) {
73 int bci = 0; 73 int bci = 0;
74 int uses = instruction.usedBy.length; 74 int uses = instruction.usedBy.length;
75 String changes = instruction.hasSideEffects() ? '!' : ' ';
76 String depends = instruction.dependsOnSomething() ? '?' : '';
75 addIndent(); 77 addIndent();
76 String temporaryId = stringifier.temporaryId(instruction); 78 String temporaryId = stringifier.temporaryId(instruction);
77 String instructionString = stringifier.visit(instruction); 79 String instructionString = stringifier.visit(instruction);
78 add("$bci $uses $temporaryId $instructionString <|@\n"); 80 add("$bci $uses $temporaryId $instructionString $changes $depends <|@\n");
79 } 81 }
80 } 82 }
81 83
82 void visitBasicBlock(HBasicBlock block) { 84 void visitBasicBlock(HBasicBlock block) {
83 HInstructionStringifier stringifier = new HInstructionStringifier(block); 85 HInstructionStringifier stringifier = new HInstructionStringifier(block);
84 assert(block.id !== null); 86 assert(block.id !== null);
85 tag("block", () { 87 tag("block", () {
86 printProperty("name", "B${block.id}"); 88 printProperty("name", "B${block.id}");
87 printProperty("from_bci", -1); 89 printProperty("from_bci", -1);
88 printProperty("to_bci", -1); 90 printProperty("to_bci", -1);
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 case HType.INDEXABLE_PRIMITIVE: type = "string_or_array"; break; 446 case HType.INDEXABLE_PRIMITIVE: type = "string_or_array"; break;
445 case HType.UNKNOWN: type = 'unknown'; break; 447 case HType.UNKNOWN: type = 'unknown'; break;
446 default: 448 default:
447 // TODO(floitsch): Need a compiler object. 449 // TODO(floitsch): Need a compiler object.
448 compiler.internalError('Unexpected type guard.', 450 compiler.internalError('Unexpected type guard.',
449 instruction: node.guardedType); 451 instruction: node.guardedType);
450 break; 452 break;
451 } 453 }
452 StringBuffer envBuffer = new StringBuffer(); 454 StringBuffer envBuffer = new StringBuffer();
453 List<HInstruction> inputs = node.inputs; 455 List<HInstruction> inputs = node.inputs;
454 // The last input is the guarded expression. 456 for (int i = 0; i < inputs.length; i++) {
455 for (int i = 0; i < inputs.length - 1; i++) { 457 if (inputs[i] !== node.guarded) {
ngeoffray 2012/06/15 19:45:33 Thanks, good catch.
456 envBuffer.add(" ${temporaryId(inputs[i])}"); 458 envBuffer.add(" ${temporaryId(inputs[i])}");
459 }
457 } 460 }
458 String on = node.isOn ? "on" : "off"; 461 String on = node.isOn ? "on" : "off";
459 String id = temporaryId(node.guarded); 462 String id = temporaryId(node.guarded);
460 return "TypeGuard($on): $id is $type env: $envBuffer"; 463 return "TypeGuard($on): $id is $type env: $envBuffer";
461 } 464 }
462 465
463 String visitIs(HIs node) { 466 String visitIs(HIs node) {
464 String type = node.typeExpression.toString(); 467 String type = node.typeExpression.toString();
465 return "TypeTest: ${temporaryId(node.expression)} is $type"; 468 return "TypeTest: ${temporaryId(node.expression)} is $type";
466 } 469 }
467 470
468 String visitTypeConversion(HTypeConversion node) { 471 String visitTypeConversion(HTypeConversion node) {
469 String type = node.propagatedType.toString(); 472 String type = node.propagatedType.toString();
470 return "TypeConversion: ${temporaryId(node.inputs[0])} to $type"; 473 return "TypeConversion: ${temporaryId(node.inputs[0])} to $type";
471 } 474 }
472 } 475 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698