| 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 class Interceptors { | 7 class Interceptors { |
| 8 Compiler compiler; | 8 Compiler compiler; |
| 9 Interceptors(Compiler this.compiler); | 9 Interceptors(Compiler this.compiler); |
| 10 | 10 |
| (...skipping 2265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2276 assert(Elements.isInstanceSend(send, elements)); | 2276 assert(Elements.isInstanceSend(send, elements)); |
| 2277 // TODO(kasperl): This is a convoluted way of checking if we're | 2277 // TODO(kasperl): This is a convoluted way of checking if we're |
| 2278 // generating code for a compound assignment. If we are, we need | 2278 // generating code for a compound assignment. If we are, we need |
| 2279 // to get the selector from the mapping for the AST selector node. | 2279 // to get the selector from the mapping for the AST selector node. |
| 2280 Selector selector = (send.asSendSet() == null) | 2280 Selector selector = (send.asSendSet() == null) |
| 2281 ? elements.getSelector(send) | 2281 ? elements.getSelector(send) |
| 2282 : elements.getSelector(send.selector); | 2282 : elements.getSelector(send.selector); |
| 2283 assert(selector.isGetter()); | 2283 assert(selector.isGetter()); |
| 2284 SourceString getterName = selector.name; | 2284 SourceString getterName = selector.name; |
| 2285 Element staticInterceptor = null; | 2285 Element staticInterceptor = null; |
| 2286 if (methodInterceptionEnabled) { | 2286 if (elements[send] == null && methodInterceptionEnabled) { |
| 2287 staticInterceptor = interceptors.getStaticGetInterceptor(getterName); | 2287 staticInterceptor = interceptors.getStaticGetInterceptor(getterName); |
| 2288 } | 2288 } |
| 2289 bool hasGetter = compiler.world.hasAnyUserDefinedGetter(selector); | 2289 bool hasGetter = compiler.world.hasAnyUserDefinedGetter(selector); |
| 2290 if (staticInterceptor != null) { | 2290 if (staticInterceptor != null) { |
| 2291 HStatic target = new HStatic(staticInterceptor); | 2291 HStatic target = new HStatic(staticInterceptor); |
| 2292 add(target); | 2292 add(target); |
| 2293 List<HInstruction> inputs = <HInstruction>[target, receiver]; | 2293 List<HInstruction> inputs = <HInstruction>[target, receiver]; |
| 2294 pushWithPosition(new HInvokeInterceptor(selector, inputs, !hasGetter), | 2294 pushWithPosition(new HInvokeInterceptor(selector, inputs, !hasGetter), |
| 2295 send); | 2295 send); |
| 2296 } else { | 2296 } else { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2339 } | 2339 } |
| 2340 | 2340 |
| 2341 void generateInstanceSetterWithCompiledReceiver(Send send, | 2341 void generateInstanceSetterWithCompiledReceiver(Send send, |
| 2342 HInstruction receiver, | 2342 HInstruction receiver, |
| 2343 HInstruction value) { | 2343 HInstruction value) { |
| 2344 assert(Elements.isInstanceSend(send, elements)); | 2344 assert(Elements.isInstanceSend(send, elements)); |
| 2345 Selector selector = elements.getSelector(send); | 2345 Selector selector = elements.getSelector(send); |
| 2346 assert(selector.isSetter()); | 2346 assert(selector.isSetter()); |
| 2347 SourceString setterName = selector.name; | 2347 SourceString setterName = selector.name; |
| 2348 Element staticInterceptor = null; | 2348 Element staticInterceptor = null; |
| 2349 if (methodInterceptionEnabled) { | 2349 if (elements[send] == null && methodInterceptionEnabled) { |
| 2350 staticInterceptor = interceptors.getStaticSetInterceptor(setterName); | 2350 staticInterceptor = interceptors.getStaticSetInterceptor(setterName); |
| 2351 } | 2351 } |
| 2352 bool hasSetter = compiler.world.hasAnyUserDefinedSetter(selector); | 2352 bool hasSetter = compiler.world.hasAnyUserDefinedSetter(selector); |
| 2353 if (staticInterceptor != null) { | 2353 if (staticInterceptor != null) { |
| 2354 HStatic target = new HStatic(staticInterceptor); | 2354 HStatic target = new HStatic(staticInterceptor); |
| 2355 add(target); | 2355 add(target); |
| 2356 List<HInstruction> inputs = <HInstruction>[target, receiver, value]; | 2356 List<HInstruction> inputs = <HInstruction>[target, receiver, value]; |
| 2357 addWithPosition(new HInvokeInterceptor(selector, inputs), send); | 2357 addWithPosition(new HInvokeInterceptor(selector, inputs), send); |
| 2358 } else { | 2358 } else { |
| 2359 addWithPosition( | 2359 addWithPosition( |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2609 } else if (node.selector.asOperator() != null) { | 2609 } else if (node.selector.asOperator() != null) { |
| 2610 SourceString name = node.selector.asIdentifier().source; | 2610 SourceString name = node.selector.asIdentifier().source; |
| 2611 isNotEquals = identical(name.stringValue, '!='); | 2611 isNotEquals = identical(name.stringValue, '!='); |
| 2612 dartMethodName = Elements.constructOperatorName( | 2612 dartMethodName = Elements.constructOperatorName( |
| 2613 name, node.argumentsNode is Prefix); | 2613 name, node.argumentsNode is Prefix); |
| 2614 } else { | 2614 } else { |
| 2615 dartMethodName = node.selector.asIdentifier().source; | 2615 dartMethodName = node.selector.asIdentifier().source; |
| 2616 } | 2616 } |
| 2617 | 2617 |
| 2618 Element interceptor = null; | 2618 Element interceptor = null; |
| 2619 if (methodInterceptionEnabled && node.receiver != null) { | 2619 if (methodInterceptionEnabled && elements[node] == null) { |
| 2620 interceptor = interceptors.getStaticInterceptor(dartMethodName, | 2620 interceptor = interceptors.getStaticInterceptor(dartMethodName, |
| 2621 node.argumentCount()); | 2621 node.argumentCount()); |
| 2622 } | 2622 } |
| 2623 if (interceptor != null) { | 2623 if (interceptor != null) { |
| 2624 HStatic target = new HStatic(interceptor); | 2624 HStatic target = new HStatic(interceptor); |
| 2625 add(target); | 2625 add(target); |
| 2626 inputs.add(target); | 2626 inputs.add(target); |
| 2627 visit(node.receiver); | 2627 visit(node.receiver); |
| 2628 inputs.add(pop()); | 2628 inputs.add(pop()); |
| 2629 addGenericSendArgumentsToList(node.arguments, inputs); | 2629 addGenericSendArgumentsToList(node.arguments, inputs); |
| (...skipping 2141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4771 new HSubGraphBlockInformation(elseBranch.graph)); | 4771 new HSubGraphBlockInformation(elseBranch.graph)); |
| 4772 | 4772 |
| 4773 HBasicBlock conditionStartBlock = conditionBranch.block; | 4773 HBasicBlock conditionStartBlock = conditionBranch.block; |
| 4774 conditionStartBlock.setBlockFlow(info, joinBlock); | 4774 conditionStartBlock.setBlockFlow(info, joinBlock); |
| 4775 SubGraph conditionGraph = conditionBranch.graph; | 4775 SubGraph conditionGraph = conditionBranch.graph; |
| 4776 HIf branch = conditionGraph.end.last; | 4776 HIf branch = conditionGraph.end.last; |
| 4777 assert(branch is HIf); | 4777 assert(branch is HIf); |
| 4778 branch.blockInformation = conditionStartBlock.blockFlow; | 4778 branch.blockInformation = conditionStartBlock.blockFlow; |
| 4779 } | 4779 } |
| 4780 } | 4780 } |
| OLD | NEW |