Chromium Code Reviews| 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 part of ssa; | 5 part of ssa; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * A special element for the extra parameter taken by intercepted | 8 * A special element for the extra parameter taken by intercepted |
| 9 * methods. We need to override [Element.computeType] because our | 9 * methods. We need to override [Element.computeType] because our |
| 10 * optimizers may look at its declared type. | 10 * optimizers may look at its declared type. |
| (...skipping 3163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3174 Element member = currentElement; | 3174 Element member = currentElement; |
| 3175 if (member.enclosingElement.isClosure()) { | 3175 if (member.enclosingElement.isClosure()) { |
| 3176 ClosureClassElement closureClass = member.enclosingElement; | 3176 ClosureClassElement closureClass = member.enclosingElement; |
| 3177 member = closureClass.methodElement; | 3177 member = closureClass.methodElement; |
| 3178 member = member.getOutermostEnclosingMemberOrTopLevel(); | 3178 member = member.getOutermostEnclosingMemberOrTopLevel(); |
| 3179 } | 3179 } |
| 3180 if (member.isFactoryConstructor()) { | 3180 if (member.isFactoryConstructor()) { |
| 3181 // The type variable is stored in a parameter of the method. | 3181 // The type variable is stored in a parameter of the method. |
| 3182 inputs.add(localsHandler.readLocal(type.element)); | 3182 inputs.add(localsHandler.readLocal(type.element)); |
| 3183 } else if (member.isInstanceMember() || | 3183 } else if (member.isInstanceMember() || |
| 3184 member.isGenerativeConstructor()) { | 3184 member.isGenerativeConstructor()) { |
| 3185 // The type variable is stored in [this]. | 3185 // The type variable is stored on the object. |
|
kasperl
2013/02/12 12:14:10
Extend the comment with an example of the kind of
karlklose
2013/02/12 13:22:30
Done.
| |
| 3186 int index = RuntimeTypeInformation.getTypeVariableIndex(type); | 3186 int index = RuntimeTypeInformation.getTypeVariableIndex(type); |
| 3187 pushInvokeHelper2(backend.getGetRuntimeTypeArgument(), | 3187 HInstruction thisObject = localsHandler.readThis(); |
| 3188 localsHandler.readThis(), | 3188 String substituionNameString = |
|
kasperl
2013/02/12 12:14:10
substituion -> substitution
karlklose
2013/02/12 13:22:30
Done.
| |
| 3189 backend.namer.substitutionName(member.getEnclosingClass()); | |
| 3190 HInstruction substitutionName = graph.addConstantString( | |
| 3191 new LiteralDartString(substituionNameString), null, constantSystem); | |
| 3192 HInstruction substitution = createForeign('#[#]', HType.UNKNOWN, | |
| 3193 <HInstruction>[thisObject, substitutionName]); | |
| 3194 add(substitution); | |
| 3195 pushInvokeHelper3(backend.getGetRuntimeTypeArgument(), | |
| 3196 thisObject, | |
| 3197 substitution, | |
| 3189 graph.addConstantInt(index, constantSystem), | 3198 graph.addConstantInt(index, constantSystem), |
| 3190 HType.UNKNOWN); | 3199 HType.UNKNOWN); |
| 3191 inputs.add(pop()); | 3200 inputs.add(pop()); |
| 3192 } else { | 3201 } else { |
| 3193 // TODO(ngeoffray): Match the VM behavior and throw an | 3202 // TODO(ngeoffray): Match the VM behavior and throw an |
| 3194 // exception at runtime. | 3203 // exception at runtime. |
| 3195 compiler.cancel('Unimplemented unresolved type variable', | 3204 compiler.cancel('Unimplemented unresolved type variable', |
| 3196 node: currentNode); | 3205 node: currentNode); |
| 3197 } | 3206 } |
| 3198 } | 3207 } |
| (...skipping 1850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5049 new HSubGraphBlockInformation(elseBranch.graph)); | 5058 new HSubGraphBlockInformation(elseBranch.graph)); |
| 5050 | 5059 |
| 5051 HBasicBlock conditionStartBlock = conditionBranch.block; | 5060 HBasicBlock conditionStartBlock = conditionBranch.block; |
| 5052 conditionStartBlock.setBlockFlow(info, joinBlock); | 5061 conditionStartBlock.setBlockFlow(info, joinBlock); |
| 5053 SubGraph conditionGraph = conditionBranch.graph; | 5062 SubGraph conditionGraph = conditionBranch.graph; |
| 5054 HIf branch = conditionGraph.end.last; | 5063 HIf branch = conditionGraph.end.last; |
| 5055 assert(branch is HIf); | 5064 assert(branch is HIf); |
| 5056 branch.blockInformation = conditionStartBlock.blockFlow; | 5065 branch.blockInformation = conditionStartBlock.blockFlow; |
| 5057 } | 5066 } |
| 5058 } | 5067 } |
| OLD | NEW |