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

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

Issue 10855026: Don't rely on the existence of an element in field gets. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 80 chars. Created 8 years, 4 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
« no previous file with comments | « lib/compiler/implementation/ssa/codegen.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after
1202 HType type = HType.NUMBER.union(fieldType); 1202 HType type = HType.NUMBER.union(fieldType);
1203 if (type == HType.NUMBER) { 1203 if (type == HType.NUMBER) {
1204 handleFieldNumberOperation(field, fieldType); 1204 handleFieldNumberOperation(field, fieldType);
1205 } 1205 }
1206 } 1206 }
1207 } 1207 }
1208 1208
1209 void visitFieldGet(HFieldGet node) { 1209 void visitFieldGet(HFieldGet node) {
1210 if (!node.element.isInstanceMember()) return; 1210 if (!node.element.isInstanceMember()) return;
1211 Element field = node.element; 1211 Element field = node.element;
1212 HType type = backend.optimisticFieldTypeAfterConstruction(field); 1212 if (field != null) {
1213 if (!type.isUnknown()) { 1213 HType type = backend.optimisticFieldTypeAfterConstruction(field);
1214 // Allow handling even if we haven't seen any types for this 1214 if (!type.isUnknown()) {
1215 // field yet. There might still be only one setter in an 1215 // Allow handling even if we haven't seen any types for this
1216 // initializer list or constructor body and recompilation 1216 // field yet. There might still be only one setter in an
1217 // can therefore pay off. 1217 // initializer list or constructor body and recompilation
1218 handleFieldGet(node, type); 1218 // can therefore pay off.
1219 handleFieldGet(node, type);
1220 }
1219 } 1221 }
1220 } 1222 }
1221 1223
1222 HInstruction visitEquals(HEquals node) { 1224 HInstruction visitEquals(HEquals node) {
1223 checkFieldNumberOperation(node); 1225 checkFieldNumberOperation(node);
1224 } 1226 }
1225 1227
1226 HInstruction visitBinaryArithmetic(HBinaryArithmetic node) { 1228 HInstruction visitBinaryArithmetic(HBinaryArithmetic node) {
1227 checkFieldNumberOperation(node); 1229 checkFieldNumberOperation(node);
1228 } 1230 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1303 // this type for the field is still a strong signal 1305 // this type for the field is still a strong signal
1304 // indicating the expected type of the field. 1306 // indicating the expected type of the field.
1305 field.propagatedType = type; 1307 field.propagatedType = type;
1306 } else { 1308 } else {
1307 // If there are no invoked setters we know the type of 1309 // If there are no invoked setters we know the type of
1308 // this field for sure. 1310 // this field for sure.
1309 field.guaranteedType = type; 1311 field.guaranteedType = type;
1310 } 1312 }
1311 } 1313 }
1312 } 1314 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/ssa/codegen.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698