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

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
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 =
2027 compiler.world.getters.hasOneElementMatchingSelector(selector);
ahe 2012/09/10 17:24:20 Too many dots.
ahe 2012/09/10 17:24:20 I assume you mean "exactly one"? If so, perhaps ad
ngeoffray 2012/09/11 08:51:08 Done.
ngeoffray 2012/09/11 08:51:08 Done.
2026 if (staticInterceptor != null) { 2028 if (staticInterceptor != null) {
2027 HStatic target = new HStatic(staticInterceptor); 2029 HStatic target = new HStatic(staticInterceptor);
2028 add(target); 2030 add(target);
2029 List<HInstruction> inputs = <HInstruction>[target, receiver]; 2031 List<HInstruction> inputs = <HInstruction>[target, receiver];
2030 push(new HInvokeInterceptor(selector, inputs)); 2032 push(new HInvokeInterceptor(selector, inputs, hasGetter));
2031 } else { 2033 } else {
2032 push(new HInvokeDynamicGetter(selector, null, receiver)); 2034 push(new HInvokeDynamicGetter(selector, null, receiver, !hasGetter));
2033 } 2035 }
2034 } 2036 }
2035 2037
2036 void generateGetter(Send send, Element element) { 2038 void generateGetter(Send send, Element element) {
2037 if (Elements.isStaticOrTopLevelField(element)) { 2039 if (Elements.isStaticOrTopLevelField(element)) {
2038 Constant value; 2040 Constant value;
2039 if (element.isField() && !element.isAssignable()) { 2041 if (element.isField() && !element.isAssignable()) {
2040 // A static final or const. Get its constant value and inline it if 2042 // A static final or const. Get its constant value and inline it if
2041 // the value can be compiled eagerly. 2043 // the value can be compiled eagerly.
2042 value = compiler.compileVariable(element); 2044 value = compiler.compileVariable(element);
(...skipping 2050 matching lines...) Expand 10 before | Expand all | Expand 10 after
4093 new HSubGraphBlockInformation(elseBranch.graph)); 4095 new HSubGraphBlockInformation(elseBranch.graph));
4094 4096
4095 HBasicBlock conditionStartBlock = conditionBranch.block; 4097 HBasicBlock conditionStartBlock = conditionBranch.block;
4096 conditionStartBlock.setBlockFlow(info, joinBlock); 4098 conditionStartBlock.setBlockFlow(info, joinBlock);
4097 SubGraph conditionGraph = conditionBranch.graph; 4099 SubGraph conditionGraph = conditionBranch.graph;
4098 HIf branch = conditionGraph.end.last; 4100 HIf branch = conditionGraph.end.last;
4099 assert(branch is HIf); 4101 assert(branch is HIf);
4100 branch.blockInformation = conditionStartBlock.blockFlow; 4102 branch.blockInformation = conditionStartBlock.blockFlow;
4101 } 4103 }
4102 } 4104 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698