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

Side by Side Diff: lib/compiler/implementation/ssa/codegen.dart

Issue 10537118: Reapply "Collect field getters and setters in the universe"" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Removed un-needed check Created 8 years, 6 months 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
« no previous file with comments | « lib/compiler/implementation/enqueue.dart ('k') | lib/compiler/implementation/universe.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 class SsaCodeGeneratorTask extends CompilerTask { 5 class SsaCodeGeneratorTask extends CompilerTask {
6 final JavaScriptBackend backend; 6 final JavaScriptBackend backend;
7 SsaCodeGeneratorTask(JavaScriptBackend backend) 7 SsaCodeGeneratorTask(JavaScriptBackend backend)
8 : this.backend = backend, 8 : this.backend = backend,
9 super(backend.compiler); 9 super(backend.compiler);
10 String get name() => 'SSA code generator'; 10 String get name() => 'SSA code generator';
(...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after
1312 } 1312 }
1313 } 1313 }
1314 1314
1315 visitTry(HTry node) { 1315 visitTry(HTry node) {
1316 // We should never get here. Try/catch/finally is always handled using block 1316 // We should never get here. Try/catch/finally is always handled using block
1317 // information in [visitTryInfo], or not at all, in the case of the bailout 1317 // information in [visitTryInfo], or not at all, in the case of the bailout
1318 // generator. 1318 // generator.
1319 compiler.internalError('visitTry should not be called', instruction: node); 1319 compiler.internalError('visitTry should not be called', instruction: node);
1320 } 1320 }
1321 1321
1322 /** 1322 /**
1323 * Analyzes the given [graph] to know whether it is empty, or 1323 * Analyzes the given [graph] to know whether it is empty, or
1324 * contains one statement, one expression, or multiple statements. 1324 * contains one statement, one expression, or multiple statements.
1325 */ 1325 */
1326 int analyzeGraphForCodegen(HStatementInformation graph) { 1326 int analyzeGraphForCodegen(HStatementInformation graph) {
1327 HBasicBlock start = graph.start; 1327 HBasicBlock start = graph.start;
1328 HBasicBlock end = graph.end; 1328 HBasicBlock end = graph.end;
1329 // Only deal with single blocks for now. TODO(ngeoffray): analyze 1329 // Only deal with single blocks for now. TODO(ngeoffray): analyze
1330 // all blocks. 1330 // all blocks.
1331 if (start !== end) return MULTIPLE_STATEMENTS; 1331 if (start !== end) return MULTIPLE_STATEMENTS;
1332 1332
1333 int kind = EMPTY; 1333 int kind = EMPTY;
1334 bool updateKind(int newKind) { 1334 bool updateKind(int newKind) {
1335 if (kind != EMPTY) return false; 1335 if (kind != EMPTY) return false;
1336 kind = newKind; 1336 kind = newKind;
1337 return true; 1337 return true;
1338 } 1338 }
1339 1339
1340 for (HInstruction instruction = start.first; 1340 for (HInstruction instruction = start.first;
1341 instruction != start.last; 1341 instruction != start.last;
1342 instruction = instruction.next) { 1342 instruction = instruction.next) {
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
1681 } 1681 }
1682 1682
1683 visitFieldGet(HFieldGet node) { 1683 visitFieldGet(HFieldGet node) {
1684 if (!node.isFromActivation()) { 1684 if (!node.isFromActivation()) {
1685 String name = compiler.namer.getName(node.element); 1685 String name = compiler.namer.getName(node.element);
1686 beginExpression(JSPrecedence.MEMBER_PRECEDENCE); 1686 beginExpression(JSPrecedence.MEMBER_PRECEDENCE);
1687 use(node.receiver, JSPrecedence.MEMBER_PRECEDENCE); 1687 use(node.receiver, JSPrecedence.MEMBER_PRECEDENCE);
1688 buffer.add('.'); 1688 buffer.add('.');
1689 buffer.add(name); 1689 buffer.add(name);
1690 beginExpression(JSPrecedence.MEMBER_PRECEDENCE); 1690 beginExpression(JSPrecedence.MEMBER_PRECEDENCE);
1691 Type type = node.receiver.propagatedType.computeType(compiler);
1692 if (type != null) {
1693 world.registerFieldGetter(node.element.name, type);
1694 }
1691 } else { 1695 } else {
1692 use(node.receiver, JSPrecedence.EXPRESSION_PRECEDENCE); 1696 use(node.receiver, JSPrecedence.EXPRESSION_PRECEDENCE);
1693 } 1697 }
1694 } 1698 }
1695 1699
1696 visitFieldSet(HFieldSet node) { 1700 visitFieldSet(HFieldSet node) {
1697 String name; 1701 String name;
1698 if (!node.isFromActivation()) { 1702 if (!node.isFromActivation()) {
1699 name = compiler.namer.getName(node.element); 1703 name = compiler.namer.getName(node.element);
1700 beginExpression(JSPrecedence.ASSIGNMENT_PRECEDENCE); 1704 beginExpression(JSPrecedence.ASSIGNMENT_PRECEDENCE);
1701 use(node.receiver, JSPrecedence.MEMBER_PRECEDENCE); 1705 use(node.receiver, JSPrecedence.MEMBER_PRECEDENCE);
1702 buffer.add('.'); 1706 buffer.add('.');
1703 buffer.add(name); 1707 buffer.add(name);
1708 Type type = node.receiver.propagatedType.computeType(compiler);
1709 if (type != null) {
1710 world.registerFieldSetter(node.element.name, type);
1711 }
1704 } else { 1712 } else {
1705 declareInstruction(node.receiver); 1713 declareInstruction(node.receiver);
1706 } 1714 }
1707 buffer.add(' = '); 1715 buffer.add(' = ');
1708 use(node.value, JSPrecedence.ASSIGNMENT_PRECEDENCE); 1716 use(node.value, JSPrecedence.ASSIGNMENT_PRECEDENCE);
1709 if (node.receiver !== null) { 1717 if (node.receiver !== null) {
1710 endExpression(JSPrecedence.ASSIGNMENT_PRECEDENCE); 1718 endExpression(JSPrecedence.ASSIGNMENT_PRECEDENCE);
1711 } 1719 }
1712 } 1720 }
1713 1721
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after
2616 bool visitAndOrInfo(HAndOrBlockInformation info) => false; 2624 bool visitAndOrInfo(HAndOrBlockInformation info) => false;
2617 bool visitIfInfo(HIfBlockInformation info) => false; 2625 bool visitIfInfo(HIfBlockInformation info) => false;
2618 bool visitLoopInfo(HLoopBlockInformation info) => false; 2626 bool visitLoopInfo(HLoopBlockInformation info) => false;
2619 bool visitTryInfo(HTryBlockInformation info) => false; 2627 bool visitTryInfo(HTryBlockInformation info) => false;
2620 bool visitSequenceInfo(HStatementSequenceInformation info) => false; 2628 bool visitSequenceInfo(HStatementSequenceInformation info) => false;
2621 2629
2622 // If argument is a [HCheck] and it does not have a name, we try to 2630 // If argument is a [HCheck] and it does not have a name, we try to
2623 // find the name of its checked input. Note that there must be a 2631 // find the name of its checked input. Note that there must be a
2624 // name, otherwise the instruction would not be in the live 2632 // name, otherwise the instruction would not be in the live
2625 // environment. 2633 // environment.
2626 HInstruction unwrap(argument) {» 2634 HInstruction unwrap(argument) {
2627 while (argument is HCheck && !variableNames.hasName(argument)) { 2635 while (argument is HCheck && !variableNames.hasName(argument)) {
2628 argument = argument.checkedInput; 2636 argument = argument.checkedInput;
2629 } 2637 }
2630 assert(variableNames.hasName(argument)); 2638 assert(variableNames.hasName(argument));
2631 return argument;» 2639 return argument;
2632 } 2640 }
2633 2641
2634 void visitTypeGuard(HTypeGuard node) { 2642 void visitTypeGuard(HTypeGuard node) {
2635 indent--; 2643 indent--;
2636 addIndented('case ${node.state}:\n'); 2644 addIndented('case ${node.state}:\n');
2637 indent++; 2645 indent++;
2638 addIndented('state = 0;\n'); 2646 addIndented('state = 0;\n');
2639 2647
2640 setup.add(' case ${node.state}:\n'); 2648 setup.add(' case ${node.state}:\n');
2641 int i = 0; 2649 int i = 0;
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
2778 startBailoutSwitch(); 2786 startBailoutSwitch();
2779 } 2787 }
2780 } 2788 }
2781 2789
2782 void endLabeledBlock(HLabeledBlockInformation labeledBlockInfo) { 2790 void endLabeledBlock(HLabeledBlockInformation labeledBlockInfo) {
2783 if (labeledBlockInfo.body.start.hasGuards()) { 2791 if (labeledBlockInfo.body.start.hasGuards()) {
2784 endBailoutSwitch(); 2792 endBailoutSwitch();
2785 } 2793 }
2786 } 2794 }
2787 } 2795 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/enqueue.dart ('k') | lib/compiler/implementation/universe.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698