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

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

Issue 10704108: Use computed field types to recompile methods containing binary (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/ssa/optimize.dart
diff --git a/lib/compiler/implementation/ssa/optimize.dart b/lib/compiler/implementation/ssa/optimize.dart
index 93ff1af2d086ae10a4dd663a9c4ce9d4937dccb5..4d97c66e09ef193b4040ae8f771c60651f12d25e 100644
--- a/lib/compiler/implementation/ssa/optimize.dart
+++ b/lib/compiler/implementation/ssa/optimize.dart
@@ -1254,4 +1254,59 @@ class SsaProcessRecompileCandidates
}
}
+ HInstruction visitBinaryArithmetic(HBinaryArithmetic node) {
+ // Determine if one of the operands is an HFieldGet.
+ HFieldGet field;
+ HInstruction other;
Søren Gjesse 2012/07/06 08:38:43 Maybe we can also do like this field/other stuff i
Mads Ager (google) 2012/07/06 08:42:18 Yes, let me do that as well. I will pull the confl
+ if (node.left is HFieldGet) {
+ field = node.left;
+ other = node.right;
+ } else if (node.right is HFieldGet) {
+ field = node.right;
+ other = node.left;
+ }
+ // Check that the other operand is a number and that we have type
+ // information for the field get.
+ if (other != null &&
+ other is HConstant &&
+ other.isNumber() &&
+ field.element != null &&
+ field.element.enclosingElement.isClass()) {
+ // If we have type information for the field and it contains
+ // NUMBER, we mark for recompilation.
+ Element fieldElement = field.element;
+ HType fieldSettersType = backend.fieldSettersTypeSoFar(fieldElement);
+ HType initializersType = backend.typeFromInitializersSoFar(fieldElement);
+ HType fieldType = fieldSettersType.union(initializersType);
+ HType type = HType.NUMBER.union(fieldType);
+ if (!type.isConflicting()) {
+ switch (compiler.phase) {
+ case Compiler.PHASE_COMPILING:
+ compiler.enqueuer.codegen.registerRecompilationCandidate(
+ work.element);
+ break;
+ case Compiler.PHASE_RECOMPILING:
+ if (compiler.codegenWorld.hasInvokedSetter(fieldElement,
+ compiler)) {
+ // If there are invoked setters we don't know for sure
+ // that the field will hold a value of the calculated
+ // type, but the fact that the class itself sticks to
+ // this type for the field is still a strong signal
+ // indicating the expected type of the field.
+ field.propagatedType = type;
+ graph.highTypeLikelyhood = true;
+ } else {
+ // If there are no invoked setters we know the type of
+ // this field for sure.
+ field.guaranteedType = type;
+ print(node);
+ }
+ break;
+ default:
+ assert(false);
+ break;
+ }
+ }
+ }
+ }
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698