| 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 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 graph = new HGraph(), | 846 graph = new HGraph(), |
| 847 stack = new List<HInstruction>(), | 847 stack = new List<HInstruction>(), |
| 848 activationVariables = new Map<Element, HLocalValue>(), | 848 activationVariables = new Map<Element, HLocalValue>(), |
| 849 jumpTargets = new Map<TargetElement, JumpHandler>(), | 849 jumpTargets = new Map<TargetElement, JumpHandler>(), |
| 850 parameters = new Map<Element, HParameterValue>(), | 850 parameters = new Map<Element, HParameterValue>(), |
| 851 inliningStack = <InliningState>[], | 851 inliningStack = <InliningState>[], |
| 852 super(work.resolutionTree) { | 852 super(work.resolutionTree) { |
| 853 localsHandler = new LocalsHandler(this); | 853 localsHandler = new LocalsHandler(this); |
| 854 } | 854 } |
| 855 | 855 |
| 856 static final MAX_INLINING_DEPTH = 3; | 856 static const MAX_INLINING_DEPTH = 3; |
| 857 static final MAX_INLINING_SOURCE_SIZE = 100; | 857 static const MAX_INLINING_SOURCE_SIZE = 100; |
| 858 List<InliningState> inliningStack; | 858 List<InliningState> inliningStack; |
| 859 Element returnElement = null; | 859 Element returnElement = null; |
| 860 | 860 |
| 861 void disableMethodInterception() { | 861 void disableMethodInterception() { |
| 862 assert(methodInterceptionEnabled); | 862 assert(methodInterceptionEnabled); |
| 863 methodInterceptionEnabled = false; | 863 methodInterceptionEnabled = false; |
| 864 } | 864 } |
| 865 | 865 |
| 866 void enableMethodInterception() { | 866 void enableMethodInterception() { |
| 867 assert(!methodInterceptionEnabled); | 867 assert(!methodInterceptionEnabled); |
| (...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1893 List<HInstruction> inputs = <HInstruction>[target, receiver]; | 1893 List<HInstruction> inputs = <HInstruction>[target, receiver]; |
| 1894 push(new HInvokeInterceptor(selector, inputs)); | 1894 push(new HInvokeInterceptor(selector, inputs)); |
| 1895 } else { | 1895 } else { |
| 1896 push(new HInvokeDynamicGetter(selector, null, receiver)); | 1896 push(new HInvokeDynamicGetter(selector, null, receiver)); |
| 1897 } | 1897 } |
| 1898 } | 1898 } |
| 1899 | 1899 |
| 1900 void generateGetter(Send send, Element element) { | 1900 void generateGetter(Send send, Element element) { |
| 1901 if (Elements.isStaticOrTopLevelField(element)) { | 1901 if (Elements.isStaticOrTopLevelField(element)) { |
| 1902 if (element.kind == ElementKind.FIELD && !element.isAssignable()) { | 1902 if (element.kind == ElementKind.FIELD && !element.isAssignable()) { |
| 1903 // A static final. Get its constant value and inline it. | 1903 // A static const. Get its constant value and inline it. |
| 1904 Constant value = compiler.constantHandler.compileVariable(element); | 1904 Constant value = compiler.constantHandler.compileVariable(element); |
| 1905 stack.add(graph.addConstant(value)); | 1905 stack.add(graph.addConstant(value)); |
| 1906 } else { | 1906 } else { |
| 1907 push(new HStatic(element)); | 1907 push(new HStatic(element)); |
| 1908 if (element.kind == ElementKind.GETTER) { | 1908 if (element.kind == ElementKind.GETTER) { |
| 1909 push(new HInvokeStatic(<HInstruction>[pop()])); | 1909 push(new HInvokeStatic(<HInstruction>[pop()])); |
| 1910 } | 1910 } |
| 1911 } | 1911 } |
| 1912 } else if (Elements.isInstanceSend(send, elements)) { | 1912 } else if (Elements.isInstanceSend(send, elements)) { |
| 1913 HInstruction receiver = generateInstanceSendReceiver(send); | 1913 HInstruction receiver = generateInstanceSendReceiver(send); |
| (...skipping 1971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3885 new HSubGraphBlockInformation(elseBranch.graph)); | 3885 new HSubGraphBlockInformation(elseBranch.graph)); |
| 3886 | 3886 |
| 3887 HBasicBlock conditionStartBlock = conditionBranch.block; | 3887 HBasicBlock conditionStartBlock = conditionBranch.block; |
| 3888 conditionStartBlock.setBlockFlow(info, joinBlock); | 3888 conditionStartBlock.setBlockFlow(info, joinBlock); |
| 3889 SubGraph conditionGraph = conditionBranch.graph; | 3889 SubGraph conditionGraph = conditionBranch.graph; |
| 3890 HIf branch = conditionGraph.end.last; | 3890 HIf branch = conditionGraph.end.last; |
| 3891 assert(branch is HIf); | 3891 assert(branch is HIf); |
| 3892 branch.blockInformation = conditionStartBlock.blockFlow; | 3892 branch.blockInformation = conditionStartBlock.blockFlow; |
| 3893 } | 3893 } |
| 3894 } | 3894 } |
| OLD | NEW |