Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: dart/sdk/lib/_internal/compiler/implementation/ssa/builder.dart

Issue 59073003: Version 0.8.10.4 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
2027 HInstruction pop() { 2029 HInstruction pop() {
2028 return stack.removeLast(); 2030 return stack.removeLast();
2029 } 2031 }
2030 2032
2031 void dup() { 2033 void dup() {
2032 stack.add(stack.last); 2034 stack.add(stack.last);
2033 } 2035 }
2034 2036
2035 HInstruction popBoolified() { 2037 HInstruction popBoolified() {
2036 HInstruction value = pop(); 2038 HInstruction value = pop();
(...skipping 2475 matching lines...) Expand 10 before | Expand all | Expand 10 after
4512 HInstruction initialValue = graph.addConstantNull(compiler); 4514 HInstruction initialValue = graph.addConstantNull(compiler);
4513 localsHandler.updateLocal(elements[definition], initialValue); 4515 localsHandler.updateLocal(elements[definition], initialValue);
4514 } else { 4516 } else {
4515 assert(definition is SendSet); 4517 assert(definition is SendSet);
4516 visitSendSet(definition); 4518 visitSendSet(definition);
4517 pop(); // Discard value. 4519 pop(); // Discard value.
4518 } 4520 }
4519 } 4521 }
4520 } 4522 }
4521 4523
4524 void setRtiIfNeeded(HInstruction object, Node node) {
4525 InterfaceType type = elements.getType(node);
4526 if (!backend.classNeedsRti(type.element) || type.treatAsRaw) 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 compiler.enqueuer.codegen.registerInstantiatedType(type, elements);
4533 }
4534
4522 visitLiteralList(LiteralList node) { 4535 visitLiteralList(LiteralList node) {
4523 HInstruction instruction; 4536 HInstruction instruction;
4524 4537
4525 if (node.isConst()) { 4538 if (node.isConst()) {
4526 instruction = addConstant(node); 4539 instruction = addConstant(node);
4527 } else { 4540 } else {
4528 List<HInstruction> inputs = <HInstruction>[]; 4541 List<HInstruction> inputs = <HInstruction>[];
4529 for (Link<Node> link = node.elements.nodes; 4542 for (Link<Node> link = node.elements.nodes;
4530 !link.isEmpty; 4543 !link.isEmpty;
4531 link = link.tail) { 4544 link = link.tail) {
4532 visit(link.head); 4545 visit(link.head);
4533 inputs.add(pop()); 4546 inputs.add(pop());
4534 } 4547 }
4535 instruction = buildLiteralList(inputs); 4548 instruction = buildLiteralList(inputs);
4536 add(instruction); 4549 add(instruction);
4550 setRtiIfNeeded(instruction, node);
4537 } 4551 }
4538 4552
4539 TypeMask type = 4553 TypeMask type =
4540 TypeMaskFactory.inferredForNode(currentElement, node, compiler); 4554 TypeMaskFactory.inferredForNode(currentElement, node, compiler);
4541 if (!type.containsAll(compiler)) instruction.instructionType = type; 4555 if (!type.containsAll(compiler)) instruction.instructionType = type;
4542 stack.add(instruction); 4556 stack.add(instruction);
4543 } 4557 }
4544 4558
4545 visitConditional(Conditional node) { 4559 visitConditional(Conditional node) {
4546 SsaBranchBuilder brancher = new SsaBranchBuilder(this, node); 4560 SsaBranchBuilder brancher = new SsaBranchBuilder(this, node);
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
4729 !link.isEmpty; 4743 !link.isEmpty;
4730 link = link.tail) { 4744 link = link.tail) {
4731 visit(link.head); 4745 visit(link.head);
4732 inputs.add(pop()); 4746 inputs.add(pop());
4733 inputs.add(pop()); 4747 inputs.add(pop());
4734 } 4748 }
4735 HLiteralList keyValuePairs = buildLiteralList(inputs); 4749 HLiteralList keyValuePairs = buildLiteralList(inputs);
4736 add(keyValuePairs); 4750 add(keyValuePairs);
4737 TypeMask mapType = new TypeMask.nonNullSubtype(backend.mapLiteralClass); 4751 TypeMask mapType = new TypeMask.nonNullSubtype(backend.mapLiteralClass);
4738 pushInvokeStatic(node, backend.getMapMaker(), [keyValuePairs], mapType); 4752 pushInvokeStatic(node, backend.getMapMaker(), [keyValuePairs], mapType);
4753 setRtiIfNeeded(peek(), node);
4739 } 4754 }
4740 4755
4741 visitLiteralMapEntry(LiteralMapEntry node) { 4756 visitLiteralMapEntry(LiteralMapEntry node) {
4742 visit(node.value); 4757 visit(node.value);
4743 visit(node.key); 4758 visit(node.key);
4744 } 4759 }
4745 4760
4746 visitNamedArgument(NamedArgument node) { 4761 visitNamedArgument(NamedArgument node) {
4747 visit(node.expression); 4762 visit(node.expression);
4748 } 4763 }
(...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after
5745 new HSubGraphBlockInformation(elseBranch.graph)); 5760 new HSubGraphBlockInformation(elseBranch.graph));
5746 5761
5747 HBasicBlock conditionStartBlock = conditionBranch.block; 5762 HBasicBlock conditionStartBlock = conditionBranch.block;
5748 conditionStartBlock.setBlockFlow(info, joinBlock); 5763 conditionStartBlock.setBlockFlow(info, joinBlock);
5749 SubGraph conditionGraph = conditionBranch.graph; 5764 SubGraph conditionGraph = conditionBranch.graph;
5750 HIf branch = conditionGraph.end.last; 5765 HIf branch = conditionGraph.end.last;
5751 assert(branch is HIf); 5766 assert(branch is HIf);
5752 branch.blockInformation = conditionStartBlock.blockFlow; 5767 branch.blockInformation = conditionStartBlock.blockFlow;
5753 } 5768 }
5754 } 5769 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698