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

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

Issue 10533151: Make undefined and null equivalent. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase 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 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 cdc2864ed9a3f2926fa1da084adc26b781e34ad9..830712d35cb0448abaaf02d989e6bfa5495fd50a 100644
--- a/lib/compiler/implementation/ssa/codegen_helpers.dart
+++ b/lib/compiler/implementation/ssa/codegen_helpers.dart
@@ -39,7 +39,7 @@ class SsaInstructionMerger extends HBaseVisitor {
// set generate at use site.
void visitIs(HIs instruction) {}
- // A check method must not have its input generate at use site,
+ // A check method must not have its input generated at use site,
// because it's using it multiple times.
void visitCheck(HCheck instruction) {}
@@ -47,6 +47,17 @@ class SsaInstructionMerger extends HBaseVisitor {
// they would not be alive.
void visitTypeGuard(HTypeGuard instruction) {}
+ // If an equality operation is builtin it must not have its input generated at
+ // use site, because it's using it multiple times (because of null/undefined).
+ void visitEquals(HEquals instruction) {
+ if (!instruction.builtin) super.visitEquals(instruction);
+ // Otherwise do nothing.
+ }
+
+ // Identity operations must not have its input generated at use site, because
+ // it's using it multiple times (because of null/undefined).
+ void visitIdentity(HIdentity instruction) {}
+
void visitTypeConversion(HTypeConversion instruction) {
if (!instruction.isChecked()) {
generateAtUseSite.add(instruction);
@@ -221,7 +232,7 @@ class SsaConditionMerger extends HGraphVisitor {
while (thenBlock.successors[0] != end && thenBlock.first is HGoto) {
thenBlock = thenBlock.successors[0];
}
-
+
// If the [thenBlock] is already a control flow operation, and does not
// have any statement and its join block is [end], we can emit a
// sequence of control flow operation.
@@ -234,7 +245,7 @@ class SsaConditionMerger extends HGraphVisitor {
if (hasAnyStatement(thenBlock, thenInput)) return;
assert(thenBlock.successors.length == 1);
}
-
+
// From now on, we have recognized a control flow operation built from
// the builder. Mark the if instruction as such.
controlFlowOperators.add(startIf);

Powered by Google App Engine
This is Rietveld 408576698