| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 import '../common/backend_api.dart' show BackendClasses; | 5 import '../common/backend_api.dart' show BackendClasses; |
| 6 import '../compiler.dart' show Compiler; | 6 import '../compiler.dart' show Compiler; |
| 7 import '../constants/constant_system.dart'; | 7 import '../constants/constant_system.dart'; |
| 8 import '../constants/values.dart'; | 8 import '../constants/values.dart'; |
| 9 import '../elements/elements.dart'; | 9 import '../elements/elements.dart'; |
| 10 import '../js_backend/backend.dart'; | 10 import '../js_backend/backend.dart'; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 * the interceptor and then call the method. This saves code size and makes the | 30 * the interceptor and then call the method. This saves code size and makes the |
| 31 * receiver of an intercepted call a candidate for being generated at use site. | 31 * receiver of an intercepted call a candidate for being generated at use site. |
| 32 * | 32 * |
| 33 * 5) Some HIs operations on an interceptor are replaced with a HIs version that | 33 * 5) Some HIs operations on an interceptor are replaced with a HIs version that |
| 34 * uses 'instanceof' rather than testing a type flag. | 34 * uses 'instanceof' rather than testing a type flag. |
| 35 * | 35 * |
| 36 */ | 36 */ |
| 37 class SsaSimplifyInterceptors extends HBaseVisitor | 37 class SsaSimplifyInterceptors extends HBaseVisitor |
| 38 implements OptimizationPhase { | 38 implements OptimizationPhase { |
| 39 final String name = "SsaSimplifyInterceptors"; | 39 final String name = "SsaSimplifyInterceptors"; |
| 40 final ClosedWorld closedWorld; |
| 40 final ConstantSystem constantSystem; | 41 final ConstantSystem constantSystem; |
| 41 final Compiler compiler; | 42 final Compiler compiler; |
| 42 final Element element; | 43 final Element element; |
| 43 HGraph graph; | 44 HGraph graph; |
| 44 | 45 |
| 45 SsaSimplifyInterceptors(this.compiler, this.constantSystem, this.element); | 46 SsaSimplifyInterceptors( |
| 47 this.compiler, this.closedWorld, this.constantSystem, this.element); |
| 46 | 48 |
| 47 JavaScriptBackend get backend => compiler.backend; | 49 JavaScriptBackend get backend => compiler.backend; |
| 48 | 50 |
| 49 ClosedWorld get closedWorld => compiler.closedWorld; | |
| 50 | |
| 51 BackendClasses get backendClasses => closedWorld.backendClasses; | 51 BackendClasses get backendClasses => closedWorld.backendClasses; |
| 52 | 52 |
| 53 void visitGraph(HGraph graph) { | 53 void visitGraph(HGraph graph) { |
| 54 this.graph = graph; | 54 this.graph = graph; |
| 55 visitDominatorTree(graph); | 55 visitDominatorTree(graph); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void visitBasicBlock(HBasicBlock node) { | 58 void visitBasicBlock(HBasicBlock node) { |
| 59 currentBlock = node; | 59 currentBlock = node; |
| 60 | 60 |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 instruction = new HInvokeDynamicMethod( | 419 instruction = new HInvokeDynamicMethod( |
| 420 selector, mask, inputs, node.instructionType, true); | 420 selector, mask, inputs, node.instructionType, true); |
| 421 } | 421 } |
| 422 | 422 |
| 423 HBasicBlock block = node.block; | 423 HBasicBlock block = node.block; |
| 424 block.addAfter(node, instruction); | 424 block.addAfter(node, instruction); |
| 425 block.rewrite(node, instruction); | 425 block.rewrite(node, instruction); |
| 426 return true; | 426 return true; |
| 427 } | 427 } |
| 428 } | 428 } |
| OLD | NEW |