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

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

Issue 11411147: Address review comments on issue 11412105. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 class SsaCodeGeneratorTask extends CompilerTask { 7 class SsaCodeGeneratorTask extends CompilerTask {
8 8
9 final JavaScriptBackend backend; 9 final JavaScriptBackend backend;
10 10
(...skipping 1706 matching lines...) Expand 10 before | Expand all | Expand 10 after
1717 new js.PropertyAccess.field(prototype, methodName); 1717 new js.PropertyAccess.field(prototype, methodName);
1718 push(jsPropertyCall(method, "call", visitArguments(node.inputs)), node); 1718 push(jsPropertyCall(method, "call", visitArguments(node.inputs)), node);
1719 } 1719 }
1720 world.registerStaticUse(superMethod); 1720 world.registerStaticUse(superMethod);
1721 } 1721 }
1722 1722
1723 visitFieldGet(HFieldGet node) { 1723 visitFieldGet(HFieldGet node) {
1724 use(node.receiver); 1724 use(node.receiver);
1725 if (node.element == backend.jsArrayLength 1725 if (node.element == backend.jsArrayLength
1726 || node.element == backend.jsStringLength) { 1726 || node.element == backend.jsStringLength) {
1727 // The 'length' name should not be mangled.
ahe 2012/11/23 13:05:03 But why? :-)
ngeoffray 2012/11/23 13:07:53 Done.
1727 push(new js.PropertyAccess.field(pop(), 'length'), node); 1728 push(new js.PropertyAccess.field(pop(), 'length'), node);
1728 } else { 1729 } else {
1729 String name = backend.namer.getName(node.element); 1730 String name = backend.namer.getName(node.element);
1730 push(new js.PropertyAccess.field(pop(), name), node); 1731 push(new js.PropertyAccess.field(pop(), name), node);
1731 HType receiverHType = types[node.receiver]; 1732 HType receiverHType = types[node.receiver];
1732 DartType type = receiverHType.computeType(compiler); 1733 DartType type = receiverHType.computeType(compiler);
1733 if (type != null) { 1734 if (type != null) {
1734 world.registerFieldGetter( 1735 world.registerFieldGetter(
1735 node.element.name, node.element.getLibrary(), type); 1736 node.element.name, node.element.getLibrary(), type);
1736 } 1737 }
1737 } 1738 }
1738 } 1739 }
1739 1740
1740 // Determine if an instruction is a simple number computation
1741 // involving only things with guaranteed number types and a given
1742 // field.
1743 bool isSimpleFieldNumberComputation(HInstruction value, HFieldSet node) {
1744 if (value.guaranteedType.union(HType.NUMBER, compiler) == HType.NUMBER) {
1745 return true;
1746 }
1747 if (value is HBinaryArithmetic) {
1748 return (isSimpleFieldNumberComputation(value.left, node) &&
1749 isSimpleFieldNumberComputation(value.right, node));
1750 }
1751 if (value is HFieldGet) return value.element == node.element;
1752 return false;
1753 }
1754
1755 visitFieldSet(HFieldSet node) { 1741 visitFieldSet(HFieldSet node) {
1756 String name = backend.namer.getName(node.element); 1742 String name = backend.namer.getName(node.element);
1757 DartType type = types[node.receiver].computeType(compiler); 1743 DartType type = types[node.receiver].computeType(compiler);
1758 if (type != null) { 1744 if (type != null) {
1759 // Field setters in the generative constructor body are handled in a 1745 // Field setters in the generative constructor body are handled in a
1760 // step "SsaConstructionFieldTypes" in the ssa optimizer. 1746 // step "SsaConstructionFieldTypes" in the ssa optimizer.
1761 if (!work.element.isGenerativeConstructorBody()) { 1747 if (!work.element.isGenerativeConstructorBody()) {
1762 world.registerFieldSetter( 1748 world.registerFieldSetter(
1763 node.element.name, node.element.getLibrary(), type); 1749 node.element.name, node.element.getLibrary(), type);
1764 backend.registerFieldSetter( 1750 backend.registerFieldSetter(
(...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after
3061 if (leftType.canBeNull() && rightType.canBeNull()) { 3047 if (leftType.canBeNull() && rightType.canBeNull()) {
3062 if (left.isConstantNull() || right.isConstantNull() || 3048 if (left.isConstantNull() || right.isConstantNull() ||
3063 (leftType.isPrimitive() && leftType == rightType)) { 3049 (leftType.isPrimitive() && leftType == rightType)) {
3064 return '=='; 3050 return '==';
3065 } 3051 }
3066 return null; 3052 return null;
3067 } else { 3053 } else {
3068 return '==='; 3054 return '===';
3069 } 3055 }
3070 } 3056 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/builder.dart ('k') | sdk/lib/_internal/compiler/implementation/ssa/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698