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

Side by Side Diff: lib/compiler/implementation/ssa/optimize.dart

Issue 10584009: Refactor the collection of initializer list types (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Minor fix 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 interface OptimizationPhase { 5 interface OptimizationPhase {
6 String get name(); 6 String get name();
7 void visitGraph(HGraph graph); 7 void visitGraph(HGraph graph);
8 } 8 }
9 9
10 class SsaOptimizerTask extends CompilerTask { 10 class SsaOptimizerTask extends CompilerTask {
(...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after
1193 // integer is compared with a constant integer literal. 1193 // integer is compared with a constant integer literal.
1194 if (node.left is HFieldGet && 1194 if (node.left is HFieldGet &&
1195 node.right is HConstant && 1195 node.right is HConstant &&
1196 node.right.isInteger()) { 1196 node.right.isInteger()) {
1197 HFieldGet left = node.left; 1197 HFieldGet left = node.left;
1198 HConstant right = node.right; 1198 HConstant right = node.right;
1199 if (left.element != null) { 1199 if (left.element != null) {
1200 Type type = left.receiver.propagatedType.computeType(compiler); 1200 Type type = left.receiver.propagatedType.computeType(compiler);
1201 switch (compiler.phase) { 1201 switch (compiler.phase) {
1202 case Compiler.PHASE_COMPILING: 1202 case Compiler.PHASE_COMPILING:
1203 if (compiler.codegenWorld.couldHaveFieldOnlyIntegerSetters( 1203 if (backend.couldHaveFieldOnlyIntegerSetters(
1204 type, left.element.name) && 1204 type, left.element) &&
karlklose 2012/06/20 11:26:32 Does this fit in in previous line now?
Søren Gjesse 2012/06/21 08:51:35 Done.
1205 compiler.codegenWorld.hasFieldOnlyIntegerInitializers( 1205 backend.couldHaveFieldSingleTypeInitializers(
1206 type, left.element.name)) { 1206 type, left.element, HType.INTEGER)) {
1207 compiler.enqueuer.codegen.registerRecompilationCandidate( 1207 compiler.enqueuer.codegen.registerRecompilationCandidate(
1208 work.element); 1208 work.element);
1209 } 1209 }
1210 break; 1210 break;
1211 case Compiler.PHASE_RECOMPILING: 1211 case Compiler.PHASE_RECOMPILING:
1212 if (compiler.codegenWorld.hasFieldOnlyIntegerSetters( 1212 if (backend.hasFieldOnlyIntegerSetters(
1213 type, left.element.name) && 1213 type, left.element) &&
karlklose 2012/06/20 11:26:32 ditto.
Søren Gjesse 2012/06/21 08:51:35 Done.
1214 compiler.codegenWorld.hasFieldOnlyIntegerInitializers( 1214 backend.hasFieldSingleTypeInitializers(
1215 type, left.element.name)) { 1215 type, left.element, HType.INTEGER)) {
1216 if (compiler.codegenWorld.hasInvokedSetter(left.element, 1216 if (compiler.codegenWorld.hasInvokedSetter(left.element,
1217 compiler)) { 1217 compiler)) {
1218 // If there are invoked setters we don't know for sure that the 1218 // If there are invoked setters we don't know for sure that the
1219 // field will hold an integer, but the fact that the class 1219 // field will hold an integer, but the fact that the class
1220 // itself always sets an integer in the fiels is still a strong 1220 // itself always sets an integer in the fiels is still a strong
1221 // signal to indiate the expected type of the field. 1221 // signal to indiate the expected type of the field.
1222 left.propagatedType = HType.INTEGER; 1222 left.propagatedType = HType.INTEGER;
1223 graph.highTypeLikelyhood = true; 1223 graph.highTypeLikelyhood = true;
1224 } else { 1224 } else {
1225 // If there are no invoked setters we know the type of this 1225 // If there are no invoked setters we know the type of this
1226 // field for sure. 1226 // field for sure.
1227 left.guaranteedType = HType.INTEGER; 1227 left.guaranteedType = HType.INTEGER;
1228 } 1228 }
1229 } 1229 }
1230 break; 1230 break;
1231 default: 1231 default:
1232 assert(false); 1232 assert(false);
1233 break; 1233 break;
1234 } 1234 }
1235 } 1235 }
1236 } 1236 }
1237 } 1237 }
1238 } 1238 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698