| 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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 } | 317 } |
| 318 } | 318 } |
| 319 | 319 |
| 320 // If the intercepted call is through a constant interceptor, we | 320 // If the intercepted call is through a constant interceptor, we |
| 321 // know which element to call. | 321 // know which element to call. |
| 322 if (node is !HOneShotInterceptor | 322 if (node is !HOneShotInterceptor |
| 323 && interceptor.isConstant() | 323 && interceptor.isConstant() |
| 324 && selector.isCall()) { | 324 && selector.isCall()) { |
| 325 DartType type = interceptor.instructionType.computeType(compiler); | 325 DartType type = interceptor.instructionType.computeType(compiler); |
| 326 ClassElement cls = type.element; | 326 ClassElement cls = type.element; |
| 327 node.element = cls.lookupSelector(selector); | 327 Element target = cls.lookupSelector(selector); |
| 328 if (selector.applies(target, compiler)) { |
| 329 node.element = target; |
| 330 } |
| 328 } | 331 } |
| 329 return node; | 332 return node; |
| 330 } | 333 } |
| 331 | 334 |
| 332 bool isFixedSizeListConstructor(HInvokeStatic node) { | 335 bool isFixedSizeListConstructor(HInvokeStatic node) { |
| 333 Element element = node.target.element; | 336 Element element = node.target.element; |
| 334 if (backend.fixedLengthListConstructor == null) { | 337 if (backend.fixedLengthListConstructor == null) { |
| 335 backend.fixedLengthListConstructor = | 338 backend.fixedLengthListConstructor = |
| 336 compiler.listClass.lookupConstructor( | 339 compiler.listClass.lookupConstructor( |
| 337 new Selector.callConstructor(const SourceString(""), | 340 new Selector.callConstructor(const SourceString(""), |
| (...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1536 HBasicBlock block = user.block; | 1539 HBasicBlock block = user.block; |
| 1537 block.addAfter(user, interceptor); | 1540 block.addAfter(user, interceptor); |
| 1538 block.rewrite(user, interceptor); | 1541 block.rewrite(user, interceptor); |
| 1539 block.remove(user); | 1542 block.remove(user); |
| 1540 | 1543 |
| 1541 // The interceptor will be removed in the dead code elimination | 1544 // The interceptor will be removed in the dead code elimination |
| 1542 // phase. Note that removing it here would not work because of how | 1545 // phase. Note that removing it here would not work because of how |
| 1543 // the [visitBasicBlock] is implemented. | 1546 // the [visitBasicBlock] is implemented. |
| 1544 } | 1547 } |
| 1545 } | 1548 } |
| OLD | NEW |