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 3132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3143 Element element = elements[node]; | 3143 Element element = elements[node]; |
| 3144 if (Elements.isUnresolved(element)) { | 3144 if (Elements.isUnresolved(element)) { |
| 3145 List<HInstruction> arguments = <HInstruction>[]; | 3145 List<HInstruction> arguments = <HInstruction>[]; |
| 3146 if (!node.isPropertyAccess) { | 3146 if (!node.isPropertyAccess) { |
| 3147 addGenericSendArgumentsToList(node.arguments, arguments); | 3147 addGenericSendArgumentsToList(node.arguments, arguments); |
| 3148 } | 3148 } |
| 3149 return generateSuperNoSuchMethodSend(node, selector, arguments); | 3149 return generateSuperNoSuchMethodSend(node, selector, arguments); |
| 3150 } | 3150 } |
| 3151 List<HInstruction> inputs = buildSuperAccessorInputs(element); | 3151 List<HInstruction> inputs = buildSuperAccessorInputs(element); |
| 3152 if (node.isPropertyAccess) { | 3152 if (node.isPropertyAccess) { |
| 3153 push(new HInvokeSuper(inputs)); | 3153 HInstruction invokeSuper = new HInvokeSuper(inputs); |
| 3154 invokeSuper.instructionType = | |
| 3155 new HType.inferredTypeForElement(element, compiler); | |
| 3156 push(invokeSuper); | |
| 3154 } else if (element.isFunction() || element.isGenerativeConstructor()) { | 3157 } else if (element.isFunction() || element.isGenerativeConstructor()) { |
| 3155 // TODO(5347): Try to avoid the need for calling [implementation] before | 3158 // TODO(5347): Try to avoid the need for calling [implementation] before |
| 3156 // calling [addStaticSendArgumentsToList]. | 3159 // calling [addStaticSendArgumentsToList]. |
| 3157 FunctionElement function = element.implementation; | 3160 FunctionElement function = element.implementation; |
| 3158 bool succeeded = addStaticSendArgumentsToList(selector, node.arguments, | 3161 bool succeeded = addStaticSendArgumentsToList(selector, node.arguments, |
| 3159 function, inputs); | 3162 function, inputs); |
| 3160 if (!succeeded) { | 3163 if (!succeeded) { |
| 3161 generateWrongArgumentCountError(node, element, node.arguments); | 3164 generateWrongArgumentCountError(node, element, node.arguments); |
| 3162 } else { | 3165 } else { |
| 3163 push(new HInvokeSuper(inputs)); | 3166 HInstruction invokeSuper = new HInvokeSuper(inputs); |
| 3167 invokeSuper.instructionType = | |
| 3168 new HType.inferredReturnTypeForElement(element, compiler); | |
| 3169 push(invokeSuper); | |
| 3164 } | 3170 } |
| 3165 } else { | 3171 } else { |
| 3166 HInstruction target = new HInvokeSuper(inputs); | 3172 HInstruction target = new HInvokeSuper(inputs); |
| 3173 target.instructionType = | |
|
kasperl
2013/03/18 08:47:50
Maybe compute the inferredType outside just before
ngeoffray
2013/03/18 08:52:21
They're different depending on which branch we're
| |
| 3174 new HType.inferredTypeForElement(element, compiler); | |
| 3167 add(target); | 3175 add(target); |
| 3168 inputs = <HInstruction>[target]; | 3176 inputs = <HInstruction>[target]; |
| 3169 addDynamicSendArgumentsToList(node, inputs); | 3177 addDynamicSendArgumentsToList(node, inputs); |
| 3170 Selector closureSelector = new Selector.callClosureFrom(selector); | 3178 Selector closureSelector = new Selector.callClosureFrom(selector); |
| 3171 push(new HInvokeClosure(closureSelector, inputs)); | 3179 push(new HInvokeClosure(closureSelector, inputs)); |
| 3172 } | 3180 } |
| 3173 } | 3181 } |
| 3174 | 3182 |
| 3175 /** | 3183 /** |
| 3176 * Generate code to extract the type arguments from the object, substitute | 3184 * Generate code to extract the type arguments from the object, substitute |
| (...skipping 1950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5127 new HSubGraphBlockInformation(elseBranch.graph)); | 5135 new HSubGraphBlockInformation(elseBranch.graph)); |
| 5128 | 5136 |
| 5129 HBasicBlock conditionStartBlock = conditionBranch.block; | 5137 HBasicBlock conditionStartBlock = conditionBranch.block; |
| 5130 conditionStartBlock.setBlockFlow(info, joinBlock); | 5138 conditionStartBlock.setBlockFlow(info, joinBlock); |
| 5131 SubGraph conditionGraph = conditionBranch.graph; | 5139 SubGraph conditionGraph = conditionBranch.graph; |
| 5132 HIf branch = conditionGraph.end.last; | 5140 HIf branch = conditionGraph.end.last; |
| 5133 assert(branch is HIf); | 5141 assert(branch is HIf); |
| 5134 branch.blockInformation = conditionStartBlock.blockFlow; | 5142 branch.blockInformation = conditionStartBlock.blockFlow; |
| 5135 } | 5143 } |
| 5136 } | 5144 } |
| OLD | NEW |