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

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

Issue 10383065: Start creating a MemberSet abstraction, and use it to fold getters/setters into field accesses. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 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
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 SsaCodeGeneratorTask(Compiler compiler) : super(compiler); 6 SsaCodeGeneratorTask(Compiler compiler) : super(compiler);
7 String get name() => 'SSA code generator'; 7 String get name() => 'SSA code generator';
8 8
9 9
10 String buildJavaScriptFunction(FunctionElement element, 10 String buildJavaScriptFunction(FunctionElement element,
(...skipping 1531 matching lines...) Expand 10 before | Expand all | Expand 10 after
1542 compiler.namer.getterName(currentLibrary, superMethod.name); 1542 compiler.namer.getterName(currentLibrary, superMethod.name);
1543 buffer.add('$className.prototype.$methodName.call()'); 1543 buffer.add('$className.prototype.$methodName.call()');
1544 } 1544 }
1545 endExpression(JSPrecedence.CALL_PRECEDENCE); 1545 endExpression(JSPrecedence.CALL_PRECEDENCE);
1546 compiler.registerStaticUse(superMethod); 1546 compiler.registerStaticUse(superMethod);
1547 } 1547 }
1548 1548
1549 visitFieldGet(HFieldGet node) { 1549 visitFieldGet(HFieldGet node) {
1550 if (node.receiver !== null) { 1550 if (node.receiver !== null) {
1551 String name = 1551 String name =
1552 compiler.namer.instanceFieldName(currentLibrary, node.element.name); 1552 compiler.namer.instanceFieldName(currentLibrary, node.name);
1553 beginExpression(JSPrecedence.MEMBER_PRECEDENCE); 1553 beginExpression(JSPrecedence.MEMBER_PRECEDENCE);
1554 use(node.receiver, JSPrecedence.MEMBER_PRECEDENCE); 1554 use(node.receiver, JSPrecedence.MEMBER_PRECEDENCE);
1555 buffer.add('.'); 1555 buffer.add('.');
1556 buffer.add(name); 1556 buffer.add(name);
1557 beginExpression(JSPrecedence.MEMBER_PRECEDENCE); 1557 beginExpression(JSPrecedence.MEMBER_PRECEDENCE);
1558 } else { 1558 } else {
1559 buffer.add(JsNames.getValid(node.element.name.slowToString())); 1559 buffer.add(JsNames.getValid(node.name.slowToString()));
1560 } 1560 }
1561 } 1561 }
1562 1562
1563 visitFieldSet(HFieldSet node) { 1563 visitFieldSet(HFieldSet node) {
1564 String name; 1564 String name;
1565 if (node.receiver !== null) { 1565 if (node.receiver !== null) {
1566 name = 1566 name =
1567 compiler.namer.instanceFieldName(currentLibrary, node.element.name); 1567 compiler.namer.instanceFieldName(currentLibrary, node.name);
1568 beginExpression(JSPrecedence.ASSIGNMENT_PRECEDENCE); 1568 beginExpression(JSPrecedence.ASSIGNMENT_PRECEDENCE);
1569 use(node.receiver, JSPrecedence.MEMBER_PRECEDENCE); 1569 use(node.receiver, JSPrecedence.MEMBER_PRECEDENCE);
1570 buffer.add('.'); 1570 buffer.add('.');
1571 buffer.add(name); 1571 buffer.add(name);
1572 } else { 1572 } else {
1573 // TODO(ngeoffray): Remove the 'var' once we don't globally box 1573 // TODO(ngeoffray): Remove the 'var' once we don't globally box
1574 // variables used in a try/catch. 1574 // variables used in a try/catch.
1575 name = JsNames.getValid(node.element.name.slowToString()); 1575 name = JsNames.getValid(node.name.slowToString());
1576 declareVariable(name); 1576 declareVariable(name);
1577 } 1577 }
1578 buffer.add(' = '); 1578 buffer.add(' = ');
1579 use(node.value, JSPrecedence.ASSIGNMENT_PRECEDENCE); 1579 use(node.value, JSPrecedence.ASSIGNMENT_PRECEDENCE);
1580 if (node.receiver !== null) { 1580 if (node.receiver !== null) {
1581 endExpression(JSPrecedence.ASSIGNMENT_PRECEDENCE); 1581 endExpression(JSPrecedence.ASSIGNMENT_PRECEDENCE);
1582 } 1582 }
1583 } 1583 }
1584 1584
1585 visitForeign(HForeign node) { 1585 visitForeign(HForeign node) {
(...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after
2594 startBailoutSwitch(); 2594 startBailoutSwitch();
2595 } 2595 }
2596 } 2596 }
2597 2597
2598 void endLabeledBlock(HLabeledBlockInformation labeledBlockInfo) { 2598 void endLabeledBlock(HLabeledBlockInformation labeledBlockInfo) {
2599 if (labeledBlockInfo.body.start.hasGuards()) { 2599 if (labeledBlockInfo.body.start.hasGuards()) {
2600 endBailoutSwitch(); 2600 endBailoutSwitch();
2601 } 2601 }
2602 } 2602 }
2603 } 2603 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/ssa/builder.dart ('k') | lib/compiler/implementation/ssa/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698