| 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 2163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2174 HInstruction receiver, | 2174 HInstruction receiver, |
| 2175 HInstruction value) { | 2175 HInstruction value) { |
| 2176 assert(Elements.isInstanceSend(send, elements)); | 2176 assert(Elements.isInstanceSend(send, elements)); |
| 2177 Selector selector = elements.getSelector(send); | 2177 Selector selector = elements.getSelector(send); |
| 2178 assert(selector.isSetter()); | 2178 assert(selector.isSetter()); |
| 2179 SourceString setterName = selector.name; | 2179 SourceString setterName = selector.name; |
| 2180 Element staticInterceptor = null; | 2180 Element staticInterceptor = null; |
| 2181 if (methodInterceptionEnabled) { | 2181 if (methodInterceptionEnabled) { |
| 2182 staticInterceptor = interceptors.getStaticSetInterceptor(setterName); | 2182 staticInterceptor = interceptors.getStaticSetInterceptor(setterName); |
| 2183 } | 2183 } |
| 2184 bool hasSetter = compiler.world.hasAnyUserDefinedSetter(selector); |
| 2184 if (staticInterceptor != null) { | 2185 if (staticInterceptor != null) { |
| 2185 HStatic target = new HStatic(staticInterceptor); | 2186 HStatic target = new HStatic(staticInterceptor); |
| 2186 add(target); | 2187 add(target); |
| 2187 List<HInstruction> inputs = <HInstruction>[target, receiver, value]; | 2188 List<HInstruction> inputs = <HInstruction>[target, receiver, value]; |
| 2188 addWithPosition(new HInvokeInterceptor(selector, inputs), send); | 2189 addWithPosition(new HInvokeInterceptor(selector, inputs), send); |
| 2189 } else { | 2190 } else { |
| 2190 addWithPosition(new HInvokeDynamicSetter(selector, null, receiver, value), | 2191 addWithPosition( |
| 2191 send); | 2192 new HInvokeDynamicSetter(selector, null, receiver, value, !hasSetter), |
| 2193 send); |
| 2192 } | 2194 } |
| 2193 stack.add(value); | 2195 stack.add(value); |
| 2194 } | 2196 } |
| 2195 | 2197 |
| 2196 void generateSetter(SendSet send, Element element, HInstruction value) { | 2198 void generateSetter(SendSet send, Element element, HInstruction value) { |
| 2197 if (Elements.isStaticOrTopLevelField(element)) { | 2199 if (Elements.isStaticOrTopLevelField(element)) { |
| 2198 if (element.isSetter()) { | 2200 if (element.isSetter()) { |
| 2199 HStatic target = new HStatic(element); | 2201 HStatic target = new HStatic(element); |
| 2200 add(target); | 2202 add(target); |
| 2201 addWithPosition(new HInvokeStatic(<HInstruction>[target, value]), send); | 2203 addWithPosition(new HInvokeStatic(<HInstruction>[target, value]), send); |
| (...skipping 2176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4378 new HSubGraphBlockInformation(elseBranch.graph)); | 4380 new HSubGraphBlockInformation(elseBranch.graph)); |
| 4379 | 4381 |
| 4380 HBasicBlock conditionStartBlock = conditionBranch.block; | 4382 HBasicBlock conditionStartBlock = conditionBranch.block; |
| 4381 conditionStartBlock.setBlockFlow(info, joinBlock); | 4383 conditionStartBlock.setBlockFlow(info, joinBlock); |
| 4382 SubGraph conditionGraph = conditionBranch.graph; | 4384 SubGraph conditionGraph = conditionBranch.graph; |
| 4383 HIf branch = conditionGraph.end.last; | 4385 HIf branch = conditionGraph.end.last; |
| 4384 assert(branch is HIf); | 4386 assert(branch is HIf); |
| 4385 branch.blockInformation = conditionStartBlock.blockFlow; | 4387 branch.blockInformation = conditionStartBlock.blockFlow; |
| 4386 } | 4388 } |
| 4387 } | 4389 } |
| OLD | NEW |