OLD | NEW |
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 Loading... |
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 1340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1655 } | 1656 } |
1656 | 1657 |
1657 Element getThrowTypeError() { | 1658 Element getThrowTypeError() { |
1658 return findHelper('throwTypeError'); | 1659 return findHelper('throwTypeError'); |
1659 } | 1660 } |
1660 | 1661 |
1661 Element getThrowAbstractClassInstantiationError() { | 1662 Element getThrowAbstractClassInstantiationError() { |
1662 return findHelper('throwAbstractClassInstantiationError'); | 1663 return findHelper('throwAbstractClassInstantiationError'); |
1663 } | 1664 } |
1664 | 1665 |
| 1666 Element getCheckConcurrentModificationError() { |
| 1667 if (cachedCheckConcurrentModificationError == null) { |
| 1668 cachedCheckConcurrentModificationError = |
| 1669 findHelper('checkConcurrentModificationError'); |
| 1670 } |
| 1671 return cachedCheckConcurrentModificationError; |
| 1672 } |
| 1673 |
| 1674 Element getThrowConcurrentModificationError() { |
| 1675 return findHelper('throwConcurrentModificationError'); |
| 1676 } |
| 1677 |
1665 Element getStringInterpolationHelper() { | 1678 Element getStringInterpolationHelper() { |
1666 return findHelper('S'); | 1679 return findHelper('S'); |
1667 } | 1680 } |
1668 | 1681 |
1669 Element getWrapExceptionHelper() { | 1682 Element getWrapExceptionHelper() { |
1670 return findHelper(r'wrapException'); | 1683 return findHelper(r'wrapException'); |
1671 } | 1684 } |
1672 | 1685 |
1673 Element getThrowExpressionHelper() { | 1686 Element getThrowExpressionHelper() { |
1674 return findHelper('throwExpression'); | 1687 return findHelper('throwExpression'); |
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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 } |
OLD | NEW |