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

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

Issue 10908143: Support check mode for statics. (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 883 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 894
895 HGraph buildLazyInitializer(VariableElement variable) { 895 HGraph buildLazyInitializer(VariableElement variable) {
896 HBasicBlock block = graph.addNewBlock(); 896 HBasicBlock block = graph.addNewBlock();
897 open(graph.entry); 897 open(graph.entry);
898 close(new HGoto()).addSuccessor(block); 898 close(new HGoto()).addSuccessor(block);
899 open(block); 899 open(block);
900 SendSet node = variable.parseNode(compiler); 900 SendSet node = variable.parseNode(compiler);
901 Link<Node> link = node.arguments; 901 Link<Node> link = node.arguments;
902 assert(!link.isEmpty() && link.tail.isEmpty()); 902 assert(!link.isEmpty() && link.tail.isEmpty());
903 visit(link.head); 903 visit(link.head);
904 close(new HReturn(pop())).addSuccessor(graph.exit); 904 HInstruction value = pop();
905 value = potentiallyCheckType(value, variable);
906 close(new HReturn(value)).addSuccessor(graph.exit);
905 graph.finalize(); 907 graph.finalize();
906 return graph; 908 return graph;
907 } 909 }
908 910
909 /** 911 /**
910 * Returns the constructor body associated with the given constructor or 912 * Returns the constructor body associated with the given constructor or
911 * creates a new constructor body, if none can be found. 913 * creates a new constructor body, if none can be found.
912 * 914 *
913 * Returns [:null:] if the constructor does not have a body. 915 * Returns [:null:] if the constructor does not have a body.
914 */ 916 */
(...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after
2091 stack.add(value); 2093 stack.add(value);
2092 } 2094 }
2093 2095
2094 void generateSetter(SendSet send, Element element, HInstruction value) { 2096 void generateSetter(SendSet send, Element element, HInstruction value) {
2095 if (Elements.isStaticOrTopLevelField(element)) { 2097 if (Elements.isStaticOrTopLevelField(element)) {
2096 if (element.isSetter()) { 2098 if (element.isSetter()) {
2097 HStatic target = new HStatic(element); 2099 HStatic target = new HStatic(element);
2098 add(target); 2100 add(target);
2099 addWithPosition(new HInvokeStatic(<HInstruction>[target, value]), send); 2101 addWithPosition(new HInvokeStatic(<HInstruction>[target, value]), send);
2100 } else { 2102 } else {
2103 value = potentiallyCheckType(value, element);
2101 addWithPosition(new HStaticStore(element, value), send); 2104 addWithPosition(new HStaticStore(element, value), send);
2102 } 2105 }
2103 stack.add(value); 2106 stack.add(value);
2104 } else if (element === null || Elements.isInstanceField(element)) { 2107 } else if (element === null || Elements.isInstanceField(element)) {
2105 HInstruction receiver = generateInstanceSendReceiver(send); 2108 HInstruction receiver = generateInstanceSendReceiver(send);
2106 generateInstanceSetterWithCompiledReceiver(send, receiver, value); 2109 generateInstanceSetterWithCompiledReceiver(send, receiver, value);
2107 } else if (Elements.isErroneousElement(element)) { 2110 } else if (Elements.isErroneousElement(element)) {
2108 // An erroneous element indicates an unresolved static setter. 2111 // An erroneous element indicates an unresolved static setter.
2109 generateThrowNoSuchMethod(send, 2112 generateThrowNoSuchMethod(send,
2110 getTargetName(element, 'set '), 2113 getTargetName(element, 'set '),
(...skipping 1982 matching lines...) Expand 10 before | Expand all | Expand 10 after
4093 new HSubGraphBlockInformation(elseBranch.graph)); 4096 new HSubGraphBlockInformation(elseBranch.graph));
4094 4097
4095 HBasicBlock conditionStartBlock = conditionBranch.block; 4098 HBasicBlock conditionStartBlock = conditionBranch.block;
4096 conditionStartBlock.setBlockFlow(info, joinBlock); 4099 conditionStartBlock.setBlockFlow(info, joinBlock);
4097 SubGraph conditionGraph = conditionBranch.graph; 4100 SubGraph conditionGraph = conditionBranch.graph;
4098 HIf branch = conditionGraph.end.last; 4101 HIf branch = conditionGraph.end.last;
4099 assert(branch is HIf); 4102 assert(branch is HIf);
4100 branch.blockInformation = conditionStartBlock.blockFlow; 4103 branch.blockInformation = conditionStartBlock.blockFlow;
4101 } 4104 }
4102 } 4105 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/constants.dart ('k') | lib/compiler/implementation/typechecker.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698