| 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 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 891 | 891 |
| 892 HGraph buildLazyInitializer(VariableElement variable) { | 892 HGraph buildLazyInitializer(VariableElement variable) { |
| 893 HBasicBlock block = graph.addNewBlock(); | 893 HBasicBlock block = graph.addNewBlock(); |
| 894 open(graph.entry); | 894 open(graph.entry); |
| 895 close(new HGoto()).addSuccessor(block); | 895 close(new HGoto()).addSuccessor(block); |
| 896 open(block); | 896 open(block); |
| 897 SendSet node = variable.parseNode(compiler); | 897 SendSet node = variable.parseNode(compiler); |
| 898 Link<Node> link = node.arguments; | 898 Link<Node> link = node.arguments; |
| 899 assert(!link.isEmpty() && link.tail.isEmpty()); | 899 assert(!link.isEmpty() && link.tail.isEmpty()); |
| 900 visit(link.head); | 900 visit(link.head); |
| 901 close(new HReturn(pop())).addSuccessor(graph.exit); | 901 HInstruction value = pop(); |
| 902 value = potentiallyCheckType(value, variable); |
| 903 close(new HReturn(value)).addSuccessor(graph.exit); |
| 902 graph.finalize(); | 904 graph.finalize(); |
| 903 return graph; | 905 return graph; |
| 904 } | 906 } |
| 905 | 907 |
| 906 /** | 908 /** |
| 907 * Returns the constructor body associated with the given constructor or | 909 * Returns the constructor body associated with the given constructor or |
| 908 * creates a new constructor body, if none can be found. | 910 * creates a new constructor body, if none can be found. |
| 909 * | 911 * |
| 910 * Returns [:null:] if the constructor does not have a body. | 912 * Returns [:null:] if the constructor does not have a body. |
| 911 */ | 913 */ |
| (...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2070 stack.add(value); | 2072 stack.add(value); |
| 2071 } | 2073 } |
| 2072 | 2074 |
| 2073 void generateSetter(SendSet send, Element element, HInstruction value) { | 2075 void generateSetter(SendSet send, Element element, HInstruction value) { |
| 2074 if (Elements.isStaticOrTopLevelField(element)) { | 2076 if (Elements.isStaticOrTopLevelField(element)) { |
| 2075 if (element.isSetter()) { | 2077 if (element.isSetter()) { |
| 2076 HStatic target = new HStatic(element); | 2078 HStatic target = new HStatic(element); |
| 2077 add(target); | 2079 add(target); |
| 2078 addWithPosition(new HInvokeStatic(<HInstruction>[target, value]), send); | 2080 addWithPosition(new HInvokeStatic(<HInstruction>[target, value]), send); |
| 2079 } else { | 2081 } else { |
| 2082 value = potentiallyCheckType(value, element); |
| 2080 addWithPosition(new HStaticStore(element, value), send); | 2083 addWithPosition(new HStaticStore(element, value), send); |
| 2081 } | 2084 } |
| 2082 stack.add(value); | 2085 stack.add(value); |
| 2083 } else if (element === null || Elements.isInstanceField(element)) { | 2086 } else if (element === null || Elements.isInstanceField(element)) { |
| 2084 HInstruction receiver = generateInstanceSendReceiver(send); | 2087 HInstruction receiver = generateInstanceSendReceiver(send); |
| 2085 generateInstanceSetterWithCompiledReceiver(send, receiver, value); | 2088 generateInstanceSetterWithCompiledReceiver(send, receiver, value); |
| 2086 } else if (Elements.isErroneousElement(element)) { | 2089 } else if (Elements.isErroneousElement(element)) { |
| 2087 // An erroneous element indicates an unresolved static setter. | 2090 // An erroneous element indicates an unresolved static setter. |
| 2088 generateThrowNoSuchMethod(send, | 2091 generateThrowNoSuchMethod(send, |
| 2089 getTargetName(element, 'set '), | 2092 getTargetName(element, 'set '), |
| (...skipping 1982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4072 new HSubGraphBlockInformation(elseBranch.graph)); | 4075 new HSubGraphBlockInformation(elseBranch.graph)); |
| 4073 | 4076 |
| 4074 HBasicBlock conditionStartBlock = conditionBranch.block; | 4077 HBasicBlock conditionStartBlock = conditionBranch.block; |
| 4075 conditionStartBlock.setBlockFlow(info, joinBlock); | 4078 conditionStartBlock.setBlockFlow(info, joinBlock); |
| 4076 SubGraph conditionGraph = conditionBranch.graph; | 4079 SubGraph conditionGraph = conditionBranch.graph; |
| 4077 HIf branch = conditionGraph.end.last; | 4080 HIf branch = conditionGraph.end.last; |
| 4078 assert(branch is HIf); | 4081 assert(branch is HIf); |
| 4079 branch.blockInformation = conditionStartBlock.blockFlow; | 4082 branch.blockInformation = conditionStartBlock.blockFlow; |
| 4080 } | 4083 } |
| 4081 } | 4084 } |
| OLD | NEW |