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

Side by Side Diff: pkg/compiler/lib/src/js_backend/backend.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 js_backend; 5 part of js_backend;
6 6
7 const VERBOSE_OPTIMIZER_HINTS = false; 7 const VERBOSE_OPTIMIZER_HINTS = false;
8 8
9 class JavaScriptItemCompilationContext extends ItemCompilationContext { 9 class JavaScriptItemCompilationContext extends ItemCompilationContext {
10 final Set<HInstruction> boundsChecked = new Set<HInstruction>(); 10 final Set<HInstruction> boundsChecked = new Set<HInstruction>();
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 ClassElement jsUInt31Class; 295 ClassElement jsUInt31Class;
296 296
297 Element jsIndexableLength; 297 Element jsIndexableLength;
298 Element jsArrayTypedConstructor; 298 Element jsArrayTypedConstructor;
299 Element jsArrayRemoveLast; 299 Element jsArrayRemoveLast;
300 Element jsArrayAdd; 300 Element jsArrayAdd;
301 Element jsStringSplit; 301 Element jsStringSplit;
302 Element jsStringToString; 302 Element jsStringToString;
303 Element jsStringOperatorAdd; 303 Element jsStringOperatorAdd;
304 Element objectEquals; 304 Element objectEquals;
305 Element cachedCheckConcurrentModificationError;
305 306
306 ClassElement typeLiteralClass; 307 ClassElement typeLiteralClass;
307 ClassElement mapLiteralClass; 308 ClassElement mapLiteralClass;
308 ClassElement constMapLiteralClass; 309 ClassElement constMapLiteralClass;
309 ClassElement typeVariableClass; 310 ClassElement typeVariableClass;
310 ConstructorElement mapLiteralConstructor; 311 ConstructorElement mapLiteralConstructor;
311 ConstructorElement mapLiteralConstructorEmpty; 312 ConstructorElement mapLiteralConstructorEmpty;
312 Element mapLiteralUntypedMaker; 313 Element mapLiteralUntypedMaker;
313 Element mapLiteralUntypedEmptyMaker; 314 Element mapLiteralUntypedEmptyMaker;
314 315
(...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after
1654 } 1655 }
1655 1656
1656 Element getThrowTypeError() { 1657 Element getThrowTypeError() {
1657 return findHelper('throwTypeError'); 1658 return findHelper('throwTypeError');
1658 } 1659 }
1659 1660
1660 Element getThrowAbstractClassInstantiationError() { 1661 Element getThrowAbstractClassInstantiationError() {
1661 return findHelper('throwAbstractClassInstantiationError'); 1662 return findHelper('throwAbstractClassInstantiationError');
1662 } 1663 }
1663 1664
1665 Element getCheckConcurrentModificationError() {
1666 if (cachedCheckConcurrentModificationError == null) {
1667 cachedCheckConcurrentModificationError =
1668 findHelper('checkConcurrentModificationError');
1669 }
1670 return cachedCheckConcurrentModificationError;
1671 }
1672
1673 Element getThrowConcurrentModificationError() {
1674 return findHelper('throwConcurrentModificationError');
1675 }
1676
1664 Element getStringInterpolationHelper() { 1677 Element getStringInterpolationHelper() {
1665 return findHelper('S'); 1678 return findHelper('S');
1666 } 1679 }
1667 1680
1668 Element getWrapExceptionHelper() { 1681 Element getWrapExceptionHelper() {
1669 return findHelper(r'wrapException'); 1682 return findHelper(r'wrapException');
1670 } 1683 }
1671 1684
1672 Element getThrowExpressionHelper() { 1685 Element getThrowExpressionHelper() {
1673 return findHelper('throwExpression'); 1686 return findHelper('throwExpression');
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after
2743 backend.compiler.world.allTypedefs.add(type.element); 2756 backend.compiler.world.allTypedefs.add(type.element);
2744 } 2757 }
2745 backend.customElementsAnalysis.registerTypeLiteral(type, registry); 2758 backend.customElementsAnalysis.registerTypeLiteral(type, registry);
2746 } 2759 }
2747 2760
2748 void onStackTraceInCatch(Registry registry) { 2761 void onStackTraceInCatch(Registry registry) {
2749 assert(registry.isForResolution); 2762 assert(registry.isForResolution);
2750 registerBackendStaticInvocation(backend.getTraceFromException(), registry); 2763 registerBackendStaticInvocation(backend.getTraceFromException(), registry);
2751 } 2764 }
2752 2765
2766 void onSyncForIn(Registry registry) {
2767 assert(registry.isForResolution);
2768 // The SSA builder recognizes certain for-in loops and can generate calls to
2769 // throwConcurrentModificationError.
2770 registerBackendStaticInvocation(
2771 backend.getCheckConcurrentModificationError(), registry);
2772 }
2753 2773
2754 void onTypeVariableExpression(Registry registry) { 2774 void onTypeVariableExpression(Registry registry) {
2755 assert(registry.isForResolution); 2775 assert(registry.isForResolution);
2756 registerBackendStaticInvocation(backend.getSetRuntimeTypeInfo(), registry); 2776 registerBackendStaticInvocation(backend.getSetRuntimeTypeInfo(), registry);
2757 registerBackendStaticInvocation(backend.getGetRuntimeTypeInfo(), registry); 2777 registerBackendStaticInvocation(backend.getGetRuntimeTypeInfo(), registry);
2758 backend.registerGetRuntimeTypeArgument(registry); 2778 backend.registerGetRuntimeTypeArgument(registry);
2759 registerBackendInstantiation(backend.compiler.listClass, registry); 2779 registerBackendInstantiation(backend.compiler.listClass, registry);
2760 registerBackendStaticInvocation(backend.getRuntimeTypeToString(), registry); 2780 registerBackendStaticInvocation(backend.getRuntimeTypeToString(), registry);
2761 registerBackendStaticInvocation(backend.getCreateRuntimeType(), registry); 2781 registerBackendStaticInvocation(backend.getCreateRuntimeType(), registry);
2762 } 2782 }
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
2886 } 2906 }
2887 } 2907 }
2888 2908
2889 /// Records that [constant] is used by the element behind [registry]. 2909 /// Records that [constant] is used by the element behind [registry].
2890 class Dependency { 2910 class Dependency {
2891 final ConstantValue constant; 2911 final ConstantValue constant;
2892 final Element annotatedElement; 2912 final Element annotatedElement;
2893 2913
2894 const Dependency(this.constant, this.annotatedElement); 2914 const Dependency(this.constant, this.annotatedElement);
2895 } 2915 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698