| 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 2006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2017 | 2017 |
| 2018 void push(HInstruction instruction) { | 2018 void push(HInstruction instruction) { |
| 2019 add(instruction); | 2019 add(instruction); |
| 2020 stack.add(instruction); | 2020 stack.add(instruction); |
| 2021 } | 2021 } |
| 2022 | 2022 |
| 2023 void pushWithPosition(HInstruction instruction, Node node) { | 2023 void pushWithPosition(HInstruction instruction, Node node) { |
| 2024 push(attachPosition(instruction, node)); | 2024 push(attachPosition(instruction, node)); |
| 2025 } | 2025 } |
| 2026 | 2026 |
| 2027 HInstruction peek() => stack.last; | |
| 2028 | |
| 2029 HInstruction pop() { | 2027 HInstruction pop() { |
| 2030 return stack.removeLast(); | 2028 return stack.removeLast(); |
| 2031 } | 2029 } |
| 2032 | 2030 |
| 2033 void dup() { | 2031 void dup() { |
| 2034 stack.add(stack.last); | 2032 stack.add(stack.last); |
| 2035 } | 2033 } |
| 2036 | 2034 |
| 2037 HInstruction popBoolified() { | 2035 HInstruction popBoolified() { |
| 2038 HInstruction value = pop(); | 2036 HInstruction value = pop(); |
| (...skipping 2475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4514 HInstruction initialValue = graph.addConstantNull(compiler); | 4512 HInstruction initialValue = graph.addConstantNull(compiler); |
| 4515 localsHandler.updateLocal(elements[definition], initialValue); | 4513 localsHandler.updateLocal(elements[definition], initialValue); |
| 4516 } else { | 4514 } else { |
| 4517 assert(definition is SendSet); | 4515 assert(definition is SendSet); |
| 4518 visitSendSet(definition); | 4516 visitSendSet(definition); |
| 4519 pop(); // Discard value. | 4517 pop(); // Discard value. |
| 4520 } | 4518 } |
| 4521 } | 4519 } |
| 4522 } | 4520 } |
| 4523 | 4521 |
| 4524 void setRtiIfNeeded(HInstruction object, Node node) { | |
| 4525 InterfaceType type = elements.getType(node); | |
| 4526 if (!backend.classNeedsRti(type.element)) return; | |
| 4527 List<HInstruction> arguments = <HInstruction>[]; | |
| 4528 for (DartType argument in type.typeArguments) { | |
| 4529 arguments.add(analyzeTypeArgument(argument)); | |
| 4530 } | |
| 4531 callSetRuntimeTypeInfo(type.element, arguments, object); | |
| 4532 } | |
| 4533 | |
| 4534 visitLiteralList(LiteralList node) { | 4522 visitLiteralList(LiteralList node) { |
| 4535 HInstruction instruction; | 4523 HInstruction instruction; |
| 4536 | 4524 |
| 4537 if (node.isConst()) { | 4525 if (node.isConst()) { |
| 4538 instruction = addConstant(node); | 4526 instruction = addConstant(node); |
| 4539 } else { | 4527 } else { |
| 4540 List<HInstruction> inputs = <HInstruction>[]; | 4528 List<HInstruction> inputs = <HInstruction>[]; |
| 4541 for (Link<Node> link = node.elements.nodes; | 4529 for (Link<Node> link = node.elements.nodes; |
| 4542 !link.isEmpty; | 4530 !link.isEmpty; |
| 4543 link = link.tail) { | 4531 link = link.tail) { |
| 4544 visit(link.head); | 4532 visit(link.head); |
| 4545 inputs.add(pop()); | 4533 inputs.add(pop()); |
| 4546 } | 4534 } |
| 4547 instruction = buildLiteralList(inputs); | 4535 instruction = buildLiteralList(inputs); |
| 4548 add(instruction); | 4536 add(instruction); |
| 4549 setRtiIfNeeded(instruction, node); | |
| 4550 } | 4537 } |
| 4551 | 4538 |
| 4552 TypeMask type = | 4539 TypeMask type = |
| 4553 TypeMaskFactory.inferredForNode(currentElement, node, compiler); | 4540 TypeMaskFactory.inferredForNode(currentElement, node, compiler); |
| 4554 if (!type.containsAll(compiler)) instruction.instructionType = type; | 4541 if (!type.containsAll(compiler)) instruction.instructionType = type; |
| 4555 stack.add(instruction); | 4542 stack.add(instruction); |
| 4556 } | 4543 } |
| 4557 | 4544 |
| 4558 visitConditional(Conditional node) { | 4545 visitConditional(Conditional node) { |
| 4559 SsaBranchBuilder brancher = new SsaBranchBuilder(this, node); | 4546 SsaBranchBuilder brancher = new SsaBranchBuilder(this, node); |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4742 !link.isEmpty; | 4729 !link.isEmpty; |
| 4743 link = link.tail) { | 4730 link = link.tail) { |
| 4744 visit(link.head); | 4731 visit(link.head); |
| 4745 inputs.add(pop()); | 4732 inputs.add(pop()); |
| 4746 inputs.add(pop()); | 4733 inputs.add(pop()); |
| 4747 } | 4734 } |
| 4748 HLiteralList keyValuePairs = buildLiteralList(inputs); | 4735 HLiteralList keyValuePairs = buildLiteralList(inputs); |
| 4749 add(keyValuePairs); | 4736 add(keyValuePairs); |
| 4750 TypeMask mapType = new TypeMask.nonNullSubtype(backend.mapLiteralClass); | 4737 TypeMask mapType = new TypeMask.nonNullSubtype(backend.mapLiteralClass); |
| 4751 pushInvokeStatic(node, backend.getMapMaker(), [keyValuePairs], mapType); | 4738 pushInvokeStatic(node, backend.getMapMaker(), [keyValuePairs], mapType); |
| 4752 setRtiIfNeeded(peek(), node); | |
| 4753 } | 4739 } |
| 4754 | 4740 |
| 4755 visitLiteralMapEntry(LiteralMapEntry node) { | 4741 visitLiteralMapEntry(LiteralMapEntry node) { |
| 4756 visit(node.value); | 4742 visit(node.value); |
| 4757 visit(node.key); | 4743 visit(node.key); |
| 4758 } | 4744 } |
| 4759 | 4745 |
| 4760 visitNamedArgument(NamedArgument node) { | 4746 visitNamedArgument(NamedArgument node) { |
| 4761 visit(node.expression); | 4747 visit(node.expression); |
| 4762 } | 4748 } |
| (...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5759 new HSubGraphBlockInformation(elseBranch.graph)); | 5745 new HSubGraphBlockInformation(elseBranch.graph)); |
| 5760 | 5746 |
| 5761 HBasicBlock conditionStartBlock = conditionBranch.block; | 5747 HBasicBlock conditionStartBlock = conditionBranch.block; |
| 5762 conditionStartBlock.setBlockFlow(info, joinBlock); | 5748 conditionStartBlock.setBlockFlow(info, joinBlock); |
| 5763 SubGraph conditionGraph = conditionBranch.graph; | 5749 SubGraph conditionGraph = conditionBranch.graph; |
| 5764 HIf branch = conditionGraph.end.last; | 5750 HIf branch = conditionGraph.end.last; |
| 5765 assert(branch is HIf); | 5751 assert(branch is HIf); |
| 5766 branch.blockInformation = conditionStartBlock.blockFlow; | 5752 branch.blockInformation = conditionStartBlock.blockFlow; |
| 5767 } | 5753 } |
| 5768 } | 5754 } |
| OLD | NEW |