| 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 3252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3263 * | 3263 * |
| 3264 * Invariant: [type] must not be malformed in checked mode. | 3264 * Invariant: [type] must not be malformed in checked mode. |
| 3265 */ | 3265 */ |
| 3266 visitNewSend(Send node, InterfaceType type) { | 3266 visitNewSend(Send node, InterfaceType type) { |
| 3267 assert(invariant(node, | 3267 assert(invariant(node, |
| 3268 !compiler.enableTypeAssertions || !type.isMalformed, | 3268 !compiler.enableTypeAssertions || !type.isMalformed, |
| 3269 message: '$type is malformed in checked mode')); | 3269 message: '$type is malformed in checked mode')); |
| 3270 bool isListConstructor = false; | 3270 bool isListConstructor = false; |
| 3271 computeType(element) { | 3271 computeType(element) { |
| 3272 Element originalElement = elements[node]; | 3272 Element originalElement = elements[node]; |
| 3273 if (identical(originalElement.getEnclosingClass(), compiler.listClass)) { | 3273 if (Elements.isFixedListConstructorCall( |
| 3274 originalElement, node, compiler)) { |
| 3274 isListConstructor = true; | 3275 isListConstructor = true; |
| 3275 if (node.arguments.isEmpty) { | 3276 return HType.FIXED_ARRAY; |
| 3276 return HType.EXTENDABLE_ARRAY; | 3277 } else if (Elements.isGrowableListConstructorCall( |
| 3277 } else { | 3278 originalElement, node, compiler)) { |
| 3278 return HType.MUTABLE_ARRAY; | 3279 isListConstructor = true; |
| 3279 } | 3280 return HType.EXTENDABLE_ARRAY; |
| 3280 } else if (element.isGenerativeConstructor()) { | 3281 } else if (element.isGenerativeConstructor()) { |
| 3281 ClassElement cls = element.getEnclosingClass(); | 3282 ClassElement cls = element.getEnclosingClass(); |
| 3282 return new HType.nonNullExact(cls.thisType, compiler); | 3283 return new HType.nonNullExact(cls.thisType, compiler); |
| 3283 } else { | 3284 } else { |
| 3284 return HType.UNKNOWN; | 3285 return HType.UNKNOWN; |
| 3285 } | 3286 } |
| 3286 } | 3287 } |
| 3287 | 3288 |
| 3288 Element constructor = elements[node]; | 3289 Element constructor = elements[node]; |
| 3289 Selector selector = elements.getSelector(node); | 3290 Selector selector = elements.getSelector(node); |
| (...skipping 1806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5096 new HSubGraphBlockInformation(elseBranch.graph)); | 5097 new HSubGraphBlockInformation(elseBranch.graph)); |
| 5097 | 5098 |
| 5098 HBasicBlock conditionStartBlock = conditionBranch.block; | 5099 HBasicBlock conditionStartBlock = conditionBranch.block; |
| 5099 conditionStartBlock.setBlockFlow(info, joinBlock); | 5100 conditionStartBlock.setBlockFlow(info, joinBlock); |
| 5100 SubGraph conditionGraph = conditionBranch.graph; | 5101 SubGraph conditionGraph = conditionBranch.graph; |
| 5101 HIf branch = conditionGraph.end.last; | 5102 HIf branch = conditionGraph.end.last; |
| 5102 assert(branch is HIf); | 5103 assert(branch is HIf); |
| 5103 branch.blockInformation = conditionStartBlock.blockFlow; | 5104 branch.blockInformation = conditionStartBlock.blockFlow; |
| 5104 } | 5105 } |
| 5105 } | 5106 } |
| OLD | NEW |