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

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

Issue 10539156: Track fields which are known to be always set to integer constants (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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/optimize.dart
diff --git a/lib/compiler/implementation/ssa/optimize.dart b/lib/compiler/implementation/ssa/optimize.dart
index ab0b54f1d689146ea7508cf6ebb1c50005375343..a04db0410277d725b1658e4018df36cae586cfa7 100644
--- a/lib/compiler/implementation/ssa/optimize.dart
+++ b/lib/compiler/implementation/ssa/optimize.dart
@@ -474,6 +474,26 @@ class SsaConstantFolder extends HBaseVisitor implements OptimizationPhase {
}
}
ngeoffray 2012/06/14 13:01:21 Add a comment on why we're interested in recompili
Søren Gjesse 2012/06/15 13:19:59 Done.
+ if (node.left is HFieldGet && node.right is HConstant) {
ngeoffray 2012/06/14 13:01:21 check node.right.isInteger()
Søren Gjesse 2012/06/15 13:19:59 Done.
+ HFieldGet left = node.left;
+ HConstant right = node.right;
+ Type type = left.receiver.propagatedType.computeType(compiler);
+ if (left.element != null &&
+ compiler.codegenWorld.hasFieldOnlyIntegerSetters(
+ type, left.element.name)) {
+ switch (compiler.pass) {
+ case 1:
+ compiler.enqueuer.codegen.registerRecompilationCandidate(
+ work.element);
+ break;
+ case 2:
+ // Codegen will generate the faster code now.
+ break;
+ }
+ return node;
ngeoffray 2012/06/14 13:01:21 This code does not really belong here. I would cre
Søren Gjesse 2012/06/15 13:19:59 Moved all this to a new SSA pass.
+ }
+ }
+
// All other cases are dealt with by the [visitRelational] and
// [visitInvokeBinary], which are visited by invoking the [super]'s
// visit method.

Powered by Google App Engine
This is Rietveld 408576698