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

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

Issue 10638013: Improve tracking of the type of fields after object construction (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
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 1705 matching lines...) Expand 10 before | Expand all | Expand 10 after
1716 buffer.add('.'); 1716 buffer.add('.');
1717 buffer.add(name); 1717 buffer.add(name);
1718 beginExpression(JSPrecedence.MEMBER_PRECEDENCE); 1718 beginExpression(JSPrecedence.MEMBER_PRECEDENCE);
1719 Type type = node.receiver.propagatedType.computeType(compiler); 1719 Type type = node.receiver.propagatedType.computeType(compiler);
1720 if (type != null) { 1720 if (type != null) {
1721 world.registerFieldGetter(node.element.name, type); 1721 world.registerFieldGetter(node.element.name, type);
1722 } 1722 }
1723 } 1723 }
1724 1724
1725 visitFieldSet(HFieldSet node) { 1725 visitFieldSet(HFieldSet node) {
1726 if (work.element.isGenerativeConstructorBody() &&
1727 node.element.enclosingElement.isClass() &&
1728 node.value.hasGuaranteedType() &&
1729 node.block.dominates(currentGraph.exit)) {
ngeoffray 2012/07/09 21:17:41 We should probably have a helper method for this i
1730 backend.updateFieldConstructorSetters(node.element,
1731 node.value.guaranteedType);
1732 }
1726 String name = compiler.namer.getName(node.element); 1733 String name = compiler.namer.getName(node.element);
1727 beginExpression(JSPrecedence.ASSIGNMENT_PRECEDENCE); 1734 beginExpression(JSPrecedence.ASSIGNMENT_PRECEDENCE);
1728 use(node.receiver, JSPrecedence.MEMBER_PRECEDENCE); 1735 use(node.receiver, JSPrecedence.MEMBER_PRECEDENCE);
1729 buffer.add('.'); 1736 buffer.add('.');
1730 buffer.add(name); 1737 buffer.add(name);
1731 Type type = node.receiver.propagatedType.computeType(compiler); 1738 Type type = node.receiver.propagatedType.computeType(compiler);
1732 if (type != null) { 1739 if (type != null) {
1733 world.registerFieldSetter(node.element.name, type); 1740 world.registerFieldSetter(node.element.name, type);
1734 backend.updateFieldIntegerSetters(node.element, 1741 backend.updateFieldIntegerSetters(node.element,
1735 node.value.isInteger()); 1742 node.value.isInteger());
(...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after
2915 startBailoutSwitch(); 2922 startBailoutSwitch();
2916 } 2923 }
2917 } 2924 }
2918 2925
2919 void endLabeledBlock(HLabeledBlockInformation labeledBlockInfo) { 2926 void endLabeledBlock(HLabeledBlockInformation labeledBlockInfo) {
2920 if (labeledBlockInfo.body.start.hasGuards()) { 2927 if (labeledBlockInfo.body.start.hasGuards()) {
2921 endBailoutSwitch(); 2928 endBailoutSwitch();
2922 } 2929 }
2923 } 2930 }
2924 } 2931 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698