Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 part of ssa; | 5 part of ssa; |
| 6 | 6 |
| 7 abstract class OptimizationPhase { | 7 abstract class OptimizationPhase { |
| 8 String get name; | 8 String get name; |
| 9 void visitGraph(HGraph graph); | 9 void visitGraph(HGraph graph); |
| 10 } | 10 } |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 200 if (operand is HConstant) { | 200 if (operand is HConstant) { |
| 201 UnaryOperation operation = node.operation(constantSystem); | 201 UnaryOperation operation = node.operation(constantSystem); |
| 202 HConstant receiver = operand; | 202 HConstant receiver = operand; |
| 203 Constant folded = operation.fold(receiver.constant); | 203 Constant folded = operation.fold(receiver.constant); |
| 204 if (folded != null) return graph.addConstant(folded); | 204 if (folded != null) return graph.addConstant(folded); |
| 205 } | 205 } |
| 206 return node; | 206 return node; |
| 207 } | 207 } |
| 208 | 208 |
| 209 HInstruction handleInterceptorCall(HInvokeDynamic node) { | 209 HInstruction handleInterceptorCall(HInvokeDynamic node) { |
| 210 if (node is !HInvokeDynamicMethod) return; | 210 if (node is !HInvokeDynamicMethod) return null; |
|
karlklose
2012/12/06 11:39:23
@ngeoffray: Is this the intention?
ngeoffray
2012/12/06 23:05:05
Yes, thanks Karl.
| |
| 211 HInstruction input = node.inputs[1]; | 211 HInstruction input = node.inputs[1]; |
| 212 if (input.isString(types) | 212 if (input.isString(types) |
| 213 && node.selector.name == const SourceString('toString')) { | 213 && node.selector.name == const SourceString('toString')) { |
| 214 return node.inputs[1]; | 214 return node.inputs[1]; |
| 215 } | 215 } |
| 216 // Check if this call does not need to be intercepted. | 216 // Check if this call does not need to be intercepted. |
| 217 HType type = types[input]; | 217 HType type = types[input]; |
| 218 var interceptor = node.inputs[0]; | 218 var interceptor = node.inputs[0]; |
| 219 if (interceptor is !HThis && !type.canBePrimitive()) { | 219 if (interceptor is !HThis && !type.canBePrimitive()) { |
| 220 // If the type can be null, and the intercepted method can be in | 220 // If the type can be null, and the intercepted method can be in |
| (...skipping 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1477 HInstruction receiver = interceptor.receiver; | 1477 HInstruction receiver = interceptor.receiver; |
| 1478 for (var user in receiver.usedBy) { | 1478 for (var user in receiver.usedBy) { |
| 1479 if (user is HInterceptor && interceptor.dominates(user)) { | 1479 if (user is HInterceptor && interceptor.dominates(user)) { |
| 1480 user.interceptedClasses = interceptor.interceptedClasses; | 1480 user.interceptedClasses = interceptor.interceptedClasses; |
| 1481 } | 1481 } |
| 1482 } | 1482 } |
| 1483 } | 1483 } |
| 1484 | 1484 |
| 1485 // TODO(ngeoffray): Also implement it for non-intercepted calls. | 1485 // TODO(ngeoffray): Also implement it for non-intercepted calls. |
| 1486 } | 1486 } |
| OLD | NEW |