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

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

Issue 10221014: Reapply "Avoid "=== true" inside code by calling a function that does this for us." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Changes. Created 8 years, 8 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
« no previous file with comments | « lib/compiler/implementation/ssa/codegen.dart ('k') | lib/compiler/implementation/ssa/optimize.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/ssa/nodes.dart
diff --git a/lib/compiler/implementation/ssa/nodes.dart b/lib/compiler/implementation/ssa/nodes.dart
index f9fb69ef9bf4193fdf7527952956942a02297a04..acae04abbfff88bc6b27892e164e1e28d78cc7a8 100644
--- a/lib/compiler/implementation/ssa/nodes.dart
+++ b/lib/compiler/implementation/ssa/nodes.dart
@@ -590,6 +590,22 @@ class HBasicBlock extends HInstructionList implements Hashable {
}
}
+ static void removeUser(HInstruction instruction, HInstruction user) {
+ List<HInstruction> users = instruction.usedBy;
+ int length = users.length;
+ if (length == 1) {
+ users.clear();
+ } else {
+ for (int i = 0; i < length; i++) {
+ if (users[i] === user) {
+ users[i] = users[length - 1];
+ users.length = length - 1;
+ return;
+ }
+ }
+ }
+ }
+
bool isExitBlock() {
return first === last && first is HExit;
}
@@ -1824,6 +1840,7 @@ class HPhi extends HInstruction {
}
class HRelational extends HInvokeBinary {
+ bool usesBoolifiedInterceptor = false;
HRelational(HStatic target, HInstruction left, HInstruction right)
: super(target, left, right);
@@ -1840,7 +1857,12 @@ class HRelational extends HInvokeBinary {
}
HType computeTypeFromInputTypes() {
- if (left.isNumber()) return HType.BOOLEAN;
+ if (left.isNumber() || usesBoolifiedInterceptor) return HType.BOOLEAN;
+ return HType.UNKNOWN;
+ }
+
+ HType get guaranteedType() {
+ if (usesBoolifiedInterceptor) return HType.BOOLEAN;
return HType.UNKNOWN;
}
@@ -1876,7 +1898,7 @@ class HEquals extends HRelational {
}
HType computeTypeFromInputTypes() {
- if (builtin) return HType.BOOLEAN;
+ if (builtin || usesBoolifiedInterceptor) return HType.BOOLEAN;
return HType.UNKNOWN;
}
@@ -1987,8 +2009,8 @@ class HThrow extends HControlFlow {
}
class HStatic extends HInstruction {
- Element element;
- HStatic(this.element) : super(<HInstruction>[]);
+ final Element element;
+ HStatic(this.element) : super(<HInstruction>[]) { assert(element !== null); }
void prepareGvn() {
if (!element.isAssignable()) {
« no previous file with comments | « lib/compiler/implementation/ssa/codegen.dart ('k') | lib/compiler/implementation/ssa/optimize.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698