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

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

Issue 10660007: Don't transform interceptors into dynamic invocations for null. (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « lib/compiler/implementation/ssa/nodes.dart ('k') | tests/language/null_to_string2_test.dart » ('j') | 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 return graph.addConstantInt(constant.length); 189 return graph.addConstantInt(constant.length);
190 } 190 }
191 } 191 }
192 192
193 if (input.isString() 193 if (input.isString()
194 && node.name == const SourceString('toString')) { 194 && node.name == const SourceString('toString')) {
195 return node.inputs[1]; 195 return node.inputs[1];
196 } 196 }
197 197
198 if (!input.canBePrimitive() && !node.getter && !node.setter) { 198 if (!input.canBePrimitive() && !node.getter && !node.setter) {
199 return fromInterceptorToDynamicInvocation(node, node.name); 199 bool transformToDynamicInvocation = true;
200 if (input.canBeNull()) {
201 // Check if the method exists on Null. If yes we must not transform
202 // the static interceptor call to a dynamic invocation.
203 // TODO(floitsch): get a list of methods that exist on 'null' and only
204 // bail out on them.
205 transformToDynamicInvocation = false;
206 }
207 if (transformToDynamicInvocation) {
208 return fromInterceptorToDynamicInvocation(node, node.name);
209 }
200 } 210 }
201 211
202 return node; 212 return node;
203 } 213 }
204 214
205 HInstruction visitInvokeDynamic(HInvokeDynamic node) { 215 HInstruction visitInvokeDynamic(HInvokeDynamic node) {
206 HType receiverType = node.receiver.propagatedType; 216 HType receiverType = node.receiver.propagatedType;
207 if (receiverType.isExact()) { 217 if (receiverType.isExact()) {
208 HBoundedType type = receiverType; 218 HBoundedType type = receiverType;
209 Element element = type.lookupMember(node.name); 219 Element element = type.lookupMember(node.name);
(...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after
1262 break; 1272 break;
1263 default: 1273 default:
1264 assert(false); 1274 assert(false);
1265 break; 1275 break;
1266 } 1276 }
1267 } 1277 }
1268 } 1278 }
1269 } 1279 }
1270 1280
1271 } 1281 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/ssa/nodes.dart ('k') | tests/language/null_to_string2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698