| 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 class Interceptors { | 5 class Interceptors { |
| 6 Compiler compiler; | 6 Compiler compiler; |
| 7 Interceptors(Compiler this.compiler); | 7 Interceptors(Compiler this.compiler); |
| 8 | 8 |
| 9 SourceString mapOperatorToMethodName(Operator op) { | 9 SourceString mapOperatorToMethodName(Operator op) { |
| 10 String name = op.source.stringValue; | 10 String name = op.source.stringValue; |
| (...skipping 2181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2192 HInstruction receiver, | 2192 HInstruction receiver, |
| 2193 HInstruction value) { | 2193 HInstruction value) { |
| 2194 assert(Elements.isInstanceSend(send, elements)); | 2194 assert(Elements.isInstanceSend(send, elements)); |
| 2195 Selector selector = elements.getSelector(send); | 2195 Selector selector = elements.getSelector(send); |
| 2196 assert(selector.isSetter()); | 2196 assert(selector.isSetter()); |
| 2197 SourceString setterName = selector.name; | 2197 SourceString setterName = selector.name; |
| 2198 Element staticInterceptor = null; | 2198 Element staticInterceptor = null; |
| 2199 if (methodInterceptionEnabled) { | 2199 if (methodInterceptionEnabled) { |
| 2200 staticInterceptor = interceptors.getStaticSetInterceptor(setterName); | 2200 staticInterceptor = interceptors.getStaticSetInterceptor(setterName); |
| 2201 } | 2201 } |
| 2202 bool hasSetter = compiler.world.hasAnyUserDefinedSetter(selector); |
| 2202 if (staticInterceptor != null) { | 2203 if (staticInterceptor != null) { |
| 2203 HStatic target = new HStatic(staticInterceptor); | 2204 HStatic target = new HStatic(staticInterceptor); |
| 2204 add(target); | 2205 add(target); |
| 2205 List<HInstruction> inputs = <HInstruction>[target, receiver, value]; | 2206 List<HInstruction> inputs = <HInstruction>[target, receiver, value]; |
| 2206 addWithPosition(new HInvokeInterceptor(selector, inputs), send); | 2207 addWithPosition(new HInvokeInterceptor(selector, inputs), send); |
| 2207 } else { | 2208 } else { |
| 2208 addWithPosition(new HInvokeDynamicSetter(selector, null, receiver, value), | 2209 addWithPosition( |
| 2209 send); | 2210 new HInvokeDynamicSetter(selector, null, receiver, value, !hasSetter), |
| 2211 send); |
| 2210 } | 2212 } |
| 2211 stack.add(value); | 2213 stack.add(value); |
| 2212 } | 2214 } |
| 2213 | 2215 |
| 2214 void generateSetter(SendSet send, Element element, HInstruction value) { | 2216 void generateSetter(SendSet send, Element element, HInstruction value) { |
| 2215 if (Elements.isStaticOrTopLevelField(element)) { | 2217 if (Elements.isStaticOrTopLevelField(element)) { |
| 2216 if (element.isSetter()) { | 2218 if (element.isSetter()) { |
| 2217 HStatic target = new HStatic(element); | 2219 HStatic target = new HStatic(element); |
| 2218 add(target); | 2220 add(target); |
| 2219 addWithPosition(new HInvokeStatic(<HInstruction>[target, value]), send); | 2221 addWithPosition(new HInvokeStatic(<HInstruction>[target, value]), send); |
| (...skipping 2176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4396 new HSubGraphBlockInformation(elseBranch.graph)); | 4398 new HSubGraphBlockInformation(elseBranch.graph)); |
| 4397 | 4399 |
| 4398 HBasicBlock conditionStartBlock = conditionBranch.block; | 4400 HBasicBlock conditionStartBlock = conditionBranch.block; |
| 4399 conditionStartBlock.setBlockFlow(info, joinBlock); | 4401 conditionStartBlock.setBlockFlow(info, joinBlock); |
| 4400 SubGraph conditionGraph = conditionBranch.graph; | 4402 SubGraph conditionGraph = conditionBranch.graph; |
| 4401 HIf branch = conditionGraph.end.last; | 4403 HIf branch = conditionGraph.end.last; |
| 4402 assert(branch is HIf); | 4404 assert(branch is HIf); |
| 4403 branch.blockInformation = conditionStartBlock.blockFlow; | 4405 branch.blockInformation = conditionStartBlock.blockFlow; |
| 4404 } | 4406 } |
| 4405 } | 4407 } |
| OLD | NEW |