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

Unified Diff: lib/compiler/implementation/ssa/codegen_helpers.dart

Issue 10827180: Move types out of the HInstructions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Simplifications. Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: lib/compiler/implementation/ssa/codegen_helpers.dart
diff --git a/lib/compiler/implementation/ssa/codegen_helpers.dart b/lib/compiler/implementation/ssa/codegen_helpers.dart
index e53d1f32d6af509e8dcf6ca94c233c52a1496597..c3dba499a12d0d8832854f8218d4804f3b9ac14b 100644
--- a/lib/compiler/implementation/ssa/codegen_helpers.dart
+++ b/lib/compiler/implementation/ssa/codegen_helpers.dart
@@ -13,15 +13,16 @@
* t2 = add(4, 3);
*/
class SsaInstructionMerger extends HBaseVisitor {
+ HTypeMap types;
List<HInstruction> expectedInputs;
Set<HInstruction> generateAtUseSite;
void markAsGenerateAtUseSite(HInstruction instruction) {
- assert(!instruction.isStatement);
+ assert(!instruction.isStatement(types));
generateAtUseSite.add(instruction);
}
- SsaInstructionMerger(this.generateAtUseSite);
+ SsaInstructionMerger(this.types, this.generateAtUseSite);
void visitGraph(HGraph graph) {
visitDominatorTree(graph);
@@ -56,8 +57,10 @@ class SsaInstructionMerger extends HBaseVisitor {
// at use site if it does not require an expression with repeated uses
// (because of null / undefined).
void visitEquals(HEquals instruction) {
- if (!instruction.builtin ||
- singleIdentityComparison(instruction.left, instruction.right) != null) {
+ HInstruction left = instruction.left;
+ HInstruction right = instruction.right;
+ if (!instruction.isBuiltin(types) ||
+ singleIdentityComparison(left, right, types) != null) {
super.visitEquals(instruction);
}
// Do nothing.
@@ -67,7 +70,9 @@ class SsaInstructionMerger extends HBaseVisitor {
// does not require an expression with multiple uses (because of null /
// undefined).
void visitIdentity(HIdentity instruction) {
- if (singleIdentityComparison(instruction.left, instruction.right) != null) {
+ HInstruction left = instruction.left;
+ HInstruction right = instruction.right;
+ if (singleIdentityComparison(left, right, types) != null) {
super.visitIdentity(instruction);
}
// Do nothing.
@@ -137,7 +142,7 @@ class SsaInstructionMerger extends HBaseVisitor {
markAsGenerateAtUseSite(instruction);
continue;
}
- if (instruction.isStatement) {
+ if (instruction.isStatement(types)) {
expectedInputs.clear();
}
// See if the current instruction is the next non-trivial
@@ -166,15 +171,18 @@ class SsaInstructionMerger extends HBaseVisitor {
* using these operators instead of nested ifs and boolean variables.
*/
class SsaConditionMerger extends HGraphVisitor {
+ final HTypeMap types;
Set<HInstruction> generateAtUseSite;
Set<HInstruction> controlFlowOperators;
void markAsGenerateAtUseSite(HInstruction instruction) {
- assert(!instruction.isStatement);
+ assert(!instruction.isStatement(types));
generateAtUseSite.add(instruction);
}
- SsaConditionMerger(this.generateAtUseSite, this.controlFlowOperators);
+ SsaConditionMerger(this.types,
+ this.generateAtUseSite,
+ this.controlFlowOperators);
void visitGraph(HGraph graph) {
visitPostDominatorTree(graph);
@@ -264,7 +272,7 @@ class SsaConditionMerger extends HGraphVisitor {
HPhi phi = end.phis.first;
HInstruction thenInput = phi.inputs[0];
HInstruction elseInput = phi.inputs[1];
- if (thenInput.isStatement || elseInput.isStatement) return;
+ if (thenInput.isStatement(types) || elseInput.isStatement(types)) return;
if (hasAnyStatement(elseBlock, elseInput)) return;
assert(elseBlock.successors.length == 1);

Powered by Google App Engine
This is Rietveld 408576698