Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Side by Side Diff: lib/compiler/implementation/ssa/builder.dart

Issue 10911181: Collect getters in a FunctionSet while resolving. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « lib/compiler/implementation/enqueue.dart ('k') | lib/compiler/implementation/ssa/nodes.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/enqueue.dart ('k') | lib/compiler/implementation/ssa/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698