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

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

Issue 14253008: Optimize length access on all JSIndexable things. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 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 1630 matching lines...) Expand 10 before | Expand all | Expand 10 after
1641 js.PropertyAccess method = 1641 js.PropertyAccess method =
1642 new js.PropertyAccess.field(prototype, methodName); 1642 new js.PropertyAccess.field(prototype, methodName);
1643 push(jsPropertyCall(method, "call", visitArguments(node.inputs)), node); 1643 push(jsPropertyCall(method, "call", visitArguments(node.inputs)), node);
1644 } 1644 }
1645 world.registerStaticUse(superMethod); 1645 world.registerStaticUse(superMethod);
1646 } 1646 }
1647 1647
1648 visitFieldGet(HFieldGet node) { 1648 visitFieldGet(HFieldGet node) {
1649 use(node.receiver); 1649 use(node.receiver);
1650 Element element = node.element; 1650 Element element = node.element;
1651 if (element == backend.jsArrayLength || element == backend.jsStringLength) { 1651 if (element == backend.jsIndexableLength) {
1652 // We're accessing a native JavaScript property called 'length' 1652 // We're accessing a native JavaScript property called 'length'
1653 // on a JS String or a JS array. Therefore, the name of that 1653 // on a JS String or a JS array. Therefore, the name of that
1654 // property should not be mangled. 1654 // property should not be mangled.
1655 push(new js.PropertyAccess.field(pop(), 'length'), node); 1655 push(new js.PropertyAccess.field(pop(), 'length'), node);
1656 } else { 1656 } else {
1657 String name = _fieldPropertyName(element); 1657 String name = _fieldPropertyName(element);
1658 push(new js.PropertyAccess.field(pop(), name), node); 1658 push(new js.PropertyAccess.field(pop(), name), node);
1659 world.registerFieldGetter(element); 1659 world.registerFieldGetter(element);
1660 } 1660 }
1661 } 1661 }
(...skipping 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after
2990 if (leftType.canBeNull() && rightType.canBeNull()) { 2990 if (leftType.canBeNull() && rightType.canBeNull()) {
2991 if (left.isConstantNull() || right.isConstantNull() || 2991 if (left.isConstantNull() || right.isConstantNull() ||
2992 (leftType.isPrimitive() && leftType == rightType)) { 2992 (leftType.isPrimitive() && leftType == rightType)) {
2993 return '=='; 2993 return '==';
2994 } 2994 }
2995 return null; 2995 return null;
2996 } else { 2996 } else {
2997 return '==='; 2997 return '===';
2998 } 2998 }
2999 } 2999 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698