| 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 3322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3333 Send send = node.send; | 3333 Send send = node.send; |
| 3334 assert(invariant(send, | 3334 assert(invariant(send, |
| 3335 !compiler.enableTypeAssertions || !type.isMalformed, | 3335 !compiler.enableTypeAssertions || !type.isMalformed, |
| 3336 message: '$type is malformed in checked mode')); | 3336 message: '$type is malformed in checked mode')); |
| 3337 bool isListConstructor = false; | 3337 bool isListConstructor = false; |
| 3338 computeType(element) { | 3338 computeType(element) { |
| 3339 Element originalElement = elements[send]; | 3339 Element originalElement = elements[send]; |
| 3340 if (Elements.isFixedListConstructorCall( | 3340 if (Elements.isFixedListConstructorCall( |
| 3341 originalElement, send, compiler)) { | 3341 originalElement, send, compiler)) { |
| 3342 isListConstructor = true; | 3342 isListConstructor = true; |
| 3343 return backend.fixedArrayType; | 3343 HType inferred = |
| 3344 new HType.inferredForNode(currentElement, node, compiler); |
| 3345 return inferred.isUnknown() ? backend.fixedArrayType : inferred; |
| 3344 } else if (Elements.isGrowableListConstructorCall( | 3346 } else if (Elements.isGrowableListConstructorCall( |
| 3345 originalElement, send, compiler)) { | 3347 originalElement, send, compiler)) { |
| 3346 isListConstructor = true; | 3348 isListConstructor = true; |
| 3347 return backend.extendableArrayType; | 3349 HType inferred = |
| 3350 new HType.inferredForNode(currentElement, node, compiler); |
| 3351 return inferred.isUnknown() ? backend.extendableArrayType : inferred; |
| 3348 } else if (element.isGenerativeConstructor()) { | 3352 } else if (element.isGenerativeConstructor()) { |
| 3349 ClassElement cls = element.getEnclosingClass(); | 3353 ClassElement cls = element.getEnclosingClass(); |
| 3350 return new HType.nonNullExact(cls.thisType, compiler); | 3354 return new HType.nonNullExact(cls.thisType, compiler); |
| 3351 } else { | 3355 } else { |
| 3352 return new HType.inferredTypeForElement(originalElement, compiler); | 3356 return new HType.inferredTypeForElement(originalElement, compiler); |
| 3353 } | 3357 } |
| 3354 } | 3358 } |
| 3355 | 3359 |
| 3356 Element constructor = elements[send]; | 3360 Element constructor = elements[send]; |
| 3357 Selector selector = elements.getSelector(send); | 3361 Selector selector = elements.getSelector(send); |
| (...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4095 return; | 4099 return; |
| 4096 } | 4100 } |
| 4097 | 4101 |
| 4098 List<HInstruction> inputs = <HInstruction>[]; | 4102 List<HInstruction> inputs = <HInstruction>[]; |
| 4099 for (Link<Node> link = node.elements.nodes; | 4103 for (Link<Node> link = node.elements.nodes; |
| 4100 !link.isEmpty; | 4104 !link.isEmpty; |
| 4101 link = link.tail) { | 4105 link = link.tail) { |
| 4102 visit(link.head); | 4106 visit(link.head); |
| 4103 inputs.add(pop()); | 4107 inputs.add(pop()); |
| 4104 } | 4108 } |
| 4105 push(buildLiteralList(inputs)); | 4109 HInstruction instruction = buildLiteralList(inputs); |
| 4110 HType type = new HType.inferredForNode(currentElement, node, compiler); |
| 4111 if (!type.isUnknown()) instruction.instructionType = type; |
| 4112 push(instruction); |
| 4106 } | 4113 } |
| 4107 | 4114 |
| 4108 visitConditional(Conditional node) { | 4115 visitConditional(Conditional node) { |
| 4109 SsaBranchBuilder brancher = new SsaBranchBuilder(this, node); | 4116 SsaBranchBuilder brancher = new SsaBranchBuilder(this, node); |
| 4110 brancher.handleConditional(() => visit(node.condition), | 4117 brancher.handleConditional(() => visit(node.condition), |
| 4111 () => visit(node.thenExpression), | 4118 () => visit(node.thenExpression), |
| 4112 () => visit(node.elseExpression)); | 4119 () => visit(node.elseExpression)); |
| 4113 } | 4120 } |
| 4114 | 4121 |
| 4115 visitStringInterpolation(StringInterpolation node) { | 4122 visitStringInterpolation(StringInterpolation node) { |
| (...skipping 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5380 new HSubGraphBlockInformation(elseBranch.graph)); | 5387 new HSubGraphBlockInformation(elseBranch.graph)); |
| 5381 | 5388 |
| 5382 HBasicBlock conditionStartBlock = conditionBranch.block; | 5389 HBasicBlock conditionStartBlock = conditionBranch.block; |
| 5383 conditionStartBlock.setBlockFlow(info, joinBlock); | 5390 conditionStartBlock.setBlockFlow(info, joinBlock); |
| 5384 SubGraph conditionGraph = conditionBranch.graph; | 5391 SubGraph conditionGraph = conditionBranch.graph; |
| 5385 HIf branch = conditionGraph.end.last; | 5392 HIf branch = conditionGraph.end.last; |
| 5386 assert(branch is HIf); | 5393 assert(branch is HIf); |
| 5387 branch.blockInformation = conditionStartBlock.blockFlow; | 5394 branch.blockInformation = conditionStartBlock.blockFlow; |
| 5388 } | 5395 } |
| 5389 } | 5396 } |
| OLD | NEW |