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

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 1606 matching lines...) Expand 10 before | Expand all | Expand 10 after
1617 backend.namer.invocationName(call), 1617 backend.namer.invocationName(call),
1618 visitArguments(node.inputs)), 1618 visitArguments(node.inputs)),
1619 node); 1619 node);
1620 registry.registerDynamicInvocation(call); 1620 registry.registerDynamicInvocation(call);
1621 } 1621 }
1622 1622
1623 visitInvokeStatic(HInvokeStatic node) { 1623 visitInvokeStatic(HInvokeStatic node) {
1624 Element element = node.element; 1624 Element element = node.element;
1625 List<DartType> instantiatedTypes = node.instantiatedTypes; 1625 List<DartType> instantiatedTypes = node.instantiatedTypes;
1626 1626
1627 registry.registerStaticInvocation(element);
1628
1629 if (instantiatedTypes != null && !instantiatedTypes.isEmpty) { 1627 if (instantiatedTypes != null && !instantiatedTypes.isEmpty) {
1630 instantiatedTypes.forEach((type) { 1628 instantiatedTypes.forEach((type) {
1631 registry.registerInstantiatedType(type); 1629 registry.registerInstantiatedType(type);
1632 }); 1630 });
1633 } 1631 }
1634 1632
1635 push(backend.emitter.staticFunctionAccess(node.element)); 1633 List<js.Expression> arguments = visitArguments(node.inputs, start: 0);
1636 push(new js.Call(pop(), visitArguments(node.inputs, start: 0)), node); 1634
1635 if (element == backend.getCheckConcurrentModificationError() &&
floitsch 2015/04/17 12:40:34 Add comments: We inline the checkConcurrentModific
sra1 2015/04/17 18:16:56 Done.
1636 arguments.length == 2) {
floitsch 2015/04/17 12:40:33 Is that check necessary? or should it be an assert
sra1 2015/04/17 18:16:56 Done.
1637 Element throwFunction = backend.getThrowConcurrentModificationError();
1638 registry.registerStaticInvocation(throwFunction);
1639 push(js.js('# || (0, #)(#)',[
floitsch 2015/04/17 12:40:33 add comment for the "(0, #)".
sra1 2015/04/17 18:16:56 Done.
1640 arguments[0],
1641 backend.emitter.staticFunctionAccess(throwFunction),
1642 arguments[1]]));
1643 } else {
1644 registry.registerStaticInvocation(element);
1645 push(backend.emitter.staticFunctionAccess(element));
1646 push(new js.Call(pop(), arguments), node);
1647 }
1648
1637 } 1649 }
1638 1650
1639 visitInvokeSuper(HInvokeSuper node) { 1651 visitInvokeSuper(HInvokeSuper node) {
1640 Element superMethod = node.element; 1652 Element superMethod = node.element;
1641 registry.registerSuperInvocation(superMethod); 1653 registry.registerSuperInvocation(superMethod);
1642 ClassElement superClass = superMethod.enclosingClass; 1654 ClassElement superClass = superMethod.enclosingClass;
1643 if (superMethod.kind == ElementKind.FIELD) { 1655 if (superMethod.kind == ElementKind.FIELD) {
1644 String fieldName = backend.namer.instanceFieldPropertyName(superMethod); 1656 String fieldName = backend.namer.instanceFieldPropertyName(superMethod);
1645 use(node.inputs[0]); 1657 use(node.inputs[0]);
1646 js.PropertyAccess access = 1658 js.PropertyAccess access =
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after
2678 js.PropertyAccess accessHelper(String name) { 2690 js.PropertyAccess accessHelper(String name) {
2679 Element helper = backend.findHelper(name); 2691 Element helper = backend.findHelper(name);
2680 if (helper == null) { 2692 if (helper == null) {
2681 // For mocked-up tests. 2693 // For mocked-up tests.
2682 return js.js('(void 0).$name'); 2694 return js.js('(void 0).$name');
2683 } 2695 }
2684 registry.registerStaticUse(helper); 2696 registry.registerStaticUse(helper);
2685 return backend.emitter.staticFunctionAccess(helper); 2697 return backend.emitter.staticFunctionAccess(helper);
2686 } 2698 }
2687 } 2699 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698