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

Side by Side Diff: pkg/compiler/lib/src/ssa/codegen.dart

Issue 1087973002: Rewrite for-in loop as indexing loop for JavaScript indexable arrays (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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 1614 matching lines...) Expand 10 before | Expand all | Expand 10 after
1625 List<DartType> instantiatedTypes = node.instantiatedTypes; 1625 List<DartType> instantiatedTypes = node.instantiatedTypes;
1626 1626
1627 registry.registerStaticInvocation(element); 1627 registry.registerStaticInvocation(element);
1628 1628
1629 if (instantiatedTypes != null && !instantiatedTypes.isEmpty) { 1629 if (instantiatedTypes != null && !instantiatedTypes.isEmpty) {
1630 instantiatedTypes.forEach((type) { 1630 instantiatedTypes.forEach((type) {
1631 registry.registerInstantiatedType(type); 1631 registry.registerInstantiatedType(type);
1632 }); 1632 });
1633 } 1633 }
1634 1634
1635 push(backend.emitter.staticFunctionAccess(node.element)); 1635
1636 push(new js.Call(pop(), visitArguments(node.inputs, start: 0)), node); 1636 List<js.Expression> arguments = visitArguments(node.inputs, start: 0);
1637 Element target = node.element;
1638 js.Expression test = null;
1639 if (target == backend.getThrowConcurrentModificationError() &&
1640 arguments.length == 2) {
1641 push(js.js('# || (0, #)(#)',[
1642 arguments[0],
1643 backend.emitter.staticFunctionAccess(node.element),
1644 arguments[1]]));
1645 } else {
1646 push(backend.emitter.staticFunctionAccess(node.element));
1647 push(new js.Call(pop(), arguments), node);
1648 }
1649
1637 } 1650 }
1638 1651
1639 visitInvokeSuper(HInvokeSuper node) { 1652 visitInvokeSuper(HInvokeSuper node) {
1640 Element superMethod = node.element; 1653 Element superMethod = node.element;
1641 registry.registerSuperInvocation(superMethod); 1654 registry.registerSuperInvocation(superMethod);
1642 ClassElement superClass = superMethod.enclosingClass; 1655 ClassElement superClass = superMethod.enclosingClass;
1643 if (superMethod.kind == ElementKind.FIELD) { 1656 if (superMethod.kind == ElementKind.FIELD) {
1644 String fieldName = backend.namer.instanceFieldPropertyName(superMethod); 1657 String fieldName = backend.namer.instanceFieldPropertyName(superMethod);
1645 use(node.inputs[0]); 1658 use(node.inputs[0]);
1646 js.PropertyAccess access = 1659 js.PropertyAccess access =
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after
2678 js.PropertyAccess accessHelper(String name) { 2691 js.PropertyAccess accessHelper(String name) {
2679 Element helper = backend.findHelper(name); 2692 Element helper = backend.findHelper(name);
2680 if (helper == null) { 2693 if (helper == null) {
2681 // For mocked-up tests. 2694 // For mocked-up tests.
2682 return js.js('(void 0).$name'); 2695 return js.js('(void 0).$name');
2683 } 2696 }
2684 registry.registerStaticUse(helper); 2697 registry.registerStaticUse(helper);
2685 return backend.emitter.staticFunctionAccess(helper); 2698 return backend.emitter.staticFunctionAccess(helper);
2686 } 2699 }
2687 } 2700 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698