| 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_elements.dart' show CommonElements; | 5 import '../common_elements.dart' show CommonElements; |
| 6 import '../constants/constant_system.dart'; | 6 import '../constants/constant_system.dart'; |
| 7 import '../constants/values.dart'; | 7 import '../constants/values.dart'; |
| 8 import '../elements/entities.dart'; | 8 import '../elements/entities.dart'; |
| 9 import '../js_backend/interceptor_data.dart'; | 9 import '../js_backend/interceptor_data.dart'; |
| 10 import '../types/types.dart'; | 10 import '../types/types.dart'; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 * receiver of an intercepted call a candidate for being generated at use site. | 30 * receiver of an intercepted call a candidate for being generated at use site. |
| 31 * | 31 * |
| 32 * 5) Some HIs operations on an interceptor are replaced with a HIs version that | 32 * 5) Some HIs operations on an interceptor are replaced with a HIs version that |
| 33 * uses 'instanceof' rather than testing a type flag. | 33 * uses 'instanceof' rather than testing a type flag. |
| 34 * | 34 * |
| 35 */ | 35 */ |
| 36 class SsaSimplifyInterceptors extends HBaseVisitor | 36 class SsaSimplifyInterceptors extends HBaseVisitor |
| 37 implements OptimizationPhase { | 37 implements OptimizationPhase { |
| 38 final String name = "SsaSimplifyInterceptors"; | 38 final String name = "SsaSimplifyInterceptors"; |
| 39 final ClosedWorld closedWorld; | 39 final ClosedWorld closedWorld; |
| 40 final InterceptorData interceptorData; | |
| 41 final CommonElements _commonElements; | |
| 42 final ClassEntity enclosingClass; | 40 final ClassEntity enclosingClass; |
| 43 HGraph graph; | 41 HGraph graph; |
| 44 | 42 |
| 45 SsaSimplifyInterceptors(this.closedWorld, this._commonElements, | 43 SsaSimplifyInterceptors(this.closedWorld, this.enclosingClass); |
| 46 this.interceptorData, this.enclosingClass); | 44 |
| 45 CommonElements get _commonElements => closedWorld.commonElements; |
| 47 | 46 |
| 48 ConstantSystem get constantSystem => closedWorld.constantSystem; | 47 ConstantSystem get constantSystem => closedWorld.constantSystem; |
| 49 | 48 |
| 49 InterceptorData get interceptorData => closedWorld.interceptorData; |
| 50 |
| 50 void visitGraph(HGraph graph) { | 51 void visitGraph(HGraph graph) { |
| 51 this.graph = graph; | 52 this.graph = graph; |
| 52 visitDominatorTree(graph); | 53 visitDominatorTree(graph); |
| 53 } | 54 } |
| 54 | 55 |
| 55 void visitBasicBlock(HBasicBlock node) { | 56 void visitBasicBlock(HBasicBlock node) { |
| 56 currentBlock = node; | 57 currentBlock = node; |
| 57 | 58 |
| 58 HInstruction instruction = node.first; | 59 HInstruction instruction = node.first; |
| 59 while (instruction != null) { | 60 while (instruction != null) { |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 instruction = new HInvokeDynamicMethod( | 421 instruction = new HInvokeDynamicMethod( |
| 421 selector, mask, inputs, node.instructionType, true); | 422 selector, mask, inputs, node.instructionType, true); |
| 422 } | 423 } |
| 423 | 424 |
| 424 HBasicBlock block = node.block; | 425 HBasicBlock block = node.block; |
| 425 block.addAfter(node, instruction); | 426 block.addAfter(node, instruction); |
| 426 block.rewrite(node, instruction); | 427 block.rewrite(node, instruction); |
| 427 return true; | 428 return true; |
| 428 } | 429 } |
| 429 } | 430 } |
| OLD | NEW |