| 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 2005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2016 // to get the selector from the mapping for the AST selector node. | 2016 // to get the selector from the mapping for the AST selector node. |
| 2017 Selector selector = (send.asSendSet() === null) | 2017 Selector selector = (send.asSendSet() === null) |
| 2018 ? elements.getSelector(send) | 2018 ? elements.getSelector(send) |
| 2019 : elements.getSelector(send.selector); | 2019 : elements.getSelector(send.selector); |
| 2020 assert(selector.isGetter()); | 2020 assert(selector.isGetter()); |
| 2021 SourceString getterName = selector.name; | 2021 SourceString getterName = selector.name; |
| 2022 Element staticInterceptor = null; | 2022 Element staticInterceptor = null; |
| 2023 if (methodInterceptionEnabled) { | 2023 if (methodInterceptionEnabled) { |
| 2024 staticInterceptor = interceptors.getStaticGetInterceptor(getterName); | 2024 staticInterceptor = interceptors.getStaticGetInterceptor(getterName); |
| 2025 } | 2025 } |
| 2026 bool hasGetter = compiler.world.hasAnyUserDefinedGetter(selector); |
| 2026 if (staticInterceptor != null) { | 2027 if (staticInterceptor != null) { |
| 2027 HStatic target = new HStatic(staticInterceptor); | 2028 HStatic target = new HStatic(staticInterceptor); |
| 2028 add(target); | 2029 add(target); |
| 2029 List<HInstruction> inputs = <HInstruction>[target, receiver]; | 2030 List<HInstruction> inputs = <HInstruction>[target, receiver]; |
| 2030 push(new HInvokeInterceptor(selector, inputs)); | 2031 push(new HInvokeInterceptor(selector, inputs, !hasGetter)); |
| 2031 } else { | 2032 } else { |
| 2032 push(new HInvokeDynamicGetter(selector, null, receiver)); | 2033 push(new HInvokeDynamicGetter(selector, null, receiver, !hasGetter)); |
| 2033 } | 2034 } |
| 2034 } | 2035 } |
| 2035 | 2036 |
| 2036 void generateGetter(Send send, Element element) { | 2037 void generateGetter(Send send, Element element) { |
| 2037 if (Elements.isStaticOrTopLevelField(element)) { | 2038 if (Elements.isStaticOrTopLevelField(element)) { |
| 2038 Constant value; | 2039 Constant value; |
| 2039 if (element.isField() && !element.isAssignable()) { | 2040 if (element.isField() && !element.isAssignable()) { |
| 2040 // A static final or const. Get its constant value and inline it if | 2041 // A static final or const. Get its constant value and inline it if |
| 2041 // the value can be compiled eagerly. | 2042 // the value can be compiled eagerly. |
| 2042 value = compiler.compileVariable(element); | 2043 value = compiler.compileVariable(element); |
| (...skipping 2050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4093 new HSubGraphBlockInformation(elseBranch.graph)); | 4094 new HSubGraphBlockInformation(elseBranch.graph)); |
| 4094 | 4095 |
| 4095 HBasicBlock conditionStartBlock = conditionBranch.block; | 4096 HBasicBlock conditionStartBlock = conditionBranch.block; |
| 4096 conditionStartBlock.setBlockFlow(info, joinBlock); | 4097 conditionStartBlock.setBlockFlow(info, joinBlock); |
| 4097 SubGraph conditionGraph = conditionBranch.graph; | 4098 SubGraph conditionGraph = conditionBranch.graph; |
| 4098 HIf branch = conditionGraph.end.last; | 4099 HIf branch = conditionGraph.end.last; |
| 4099 assert(branch is HIf); | 4100 assert(branch is HIf); |
| 4100 branch.blockInformation = conditionStartBlock.blockFlow; | 4101 branch.blockInformation = conditionStartBlock.blockFlow; |
| 4101 } | 4102 } |
| 4102 } | 4103 } |
| OLD | NEW |