| 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 const bool USE_CPS_IR = const bool.fromEnvironment("USE_CPS_IR"); | 9 const bool USE_CPS_IR = const bool.fromEnvironment("USE_CPS_IR"); |
| 10 | 10 |
| (...skipping 2562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2573 // eagerly it doesn't matter. | 2573 // eagerly it doesn't matter. |
| 2574 if (type.isTypedef) { | 2574 if (type.isTypedef) { |
| 2575 backend.compiler.world.allTypedefs.add(type.element); | 2575 backend.compiler.world.allTypedefs.add(type.element); |
| 2576 } | 2576 } |
| 2577 backend.customElementsAnalysis.registerTypeLiteral(type, registry); | 2577 backend.customElementsAnalysis.registerTypeLiteral(type, registry); |
| 2578 } | 2578 } |
| 2579 | 2579 |
| 2580 void onStackTraceInCatch(Registry registry) { | 2580 void onStackTraceInCatch(Registry registry) { |
| 2581 assert(registry.isForResolution); | 2581 assert(registry.isForResolution); |
| 2582 registerBackendStaticInvocation(backend.getTraceFromException(), registry); | 2582 registerBackendStaticInvocation(backend.getTraceFromException(), registry); |
| 2583 backend.compiler.enqueuer.resolution.registerInstantiatedClass( |
| 2584 backend.compiler.stackTraceClass, registry); |
| 2583 } | 2585 } |
| 2584 | 2586 |
| 2585 | |
| 2586 void onTypeVariableExpression(Registry registry) { | 2587 void onTypeVariableExpression(Registry registry) { |
| 2587 assert(registry.isForResolution); | 2588 assert(registry.isForResolution); |
| 2588 registerBackendStaticInvocation(backend.getSetRuntimeTypeInfo(), registry); | 2589 registerBackendStaticInvocation(backend.getSetRuntimeTypeInfo(), registry); |
| 2589 registerBackendStaticInvocation(backend.getGetRuntimeTypeInfo(), registry); | 2590 registerBackendStaticInvocation(backend.getGetRuntimeTypeInfo(), registry); |
| 2590 backend.registerGetRuntimeTypeArgument(registry); | 2591 backend.registerGetRuntimeTypeArgument(registry); |
| 2591 registerBackendInstantiation(backend.compiler.listClass, registry); | 2592 registerBackendInstantiation(backend.compiler.listClass, registry); |
| 2592 registerBackendStaticInvocation(backend.getRuntimeTypeToString(), registry); | 2593 registerBackendStaticInvocation(backend.getRuntimeTypeToString(), registry); |
| 2593 registerBackendStaticInvocation(backend.getCreateRuntimeType(), registry); | 2594 registerBackendStaticInvocation(backend.getCreateRuntimeType(), registry); |
| 2594 } | 2595 } |
| 2595 | 2596 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2703 } | 2704 } |
| 2704 | 2705 |
| 2705 /// Called when resolving the `Symbol` constructor. | 2706 /// Called when resolving the `Symbol` constructor. |
| 2706 void onSymbolConstructor(Registry registry) { | 2707 void onSymbolConstructor(Registry registry) { |
| 2707 assert(registry.isForResolution); | 2708 assert(registry.isForResolution); |
| 2708 // Make sure that _internals.Symbol.validated is registered. | 2709 // Make sure that _internals.Symbol.validated is registered. |
| 2709 assert(backend.compiler.symbolValidatedConstructor != null); | 2710 assert(backend.compiler.symbolValidatedConstructor != null); |
| 2710 registerBackendStaticInvocation( | 2711 registerBackendStaticInvocation( |
| 2711 backend.compiler.symbolValidatedConstructor, registry); | 2712 backend.compiler.symbolValidatedConstructor, registry); |
| 2712 } | 2713 } |
| 2714 |
| 2715 void onLiteralInt(Registry registry) { |
| 2716 backend.compiler.enqueuer.resolution.registerInstantiatedClass( |
| 2717 backend.intImplementation, registry); |
| 2718 } |
| 2719 |
| 2720 void onLiteralDouble(Registry registry) { |
| 2721 backend.compiler.enqueuer.resolution.registerInstantiatedClass( |
| 2722 backend.doubleImplementation, registry); |
| 2723 } |
| 2724 |
| 2725 void onLiteralBool(Registry registry) { |
| 2726 backend.compiler.enqueuer.resolution.registerInstantiatedClass( |
| 2727 backend.boolImplementation, registry); |
| 2728 } |
| 2729 |
| 2730 void onLiteralString(Registry registry) { |
| 2731 backend.compiler.enqueuer.resolution.registerInstantiatedClass( |
| 2732 // TODO(ahe): For some reason using [backend.stringImplementation] here |
| 2733 // confuses dart2js during override checks. |
| 2734 backend.compiler.stringClass, registry); |
| 2735 } |
| 2736 |
| 2737 void onLiteralNull(Registry registry) { |
| 2738 backend.compiler.enqueuer.resolution.registerInstantiatedClass( |
| 2739 backend.nullImplementation, registry); |
| 2740 } |
| 2741 |
| 2742 void onLiteralSymbol(Registry registry) { |
| 2743 backend.compiler.enqueuer.resolution.registerInstantiatedClass( |
| 2744 backend.compiler.symbolClass, registry); |
| 2745 backend.compiler.enqueuer.resolution.registerStaticUse( |
| 2746 backend.compiler.symbolConstructor.declaration); |
| 2747 } |
| 2748 |
| 2749 void onLiteralFunction(Registry registry) { |
| 2750 backend.compiler.enqueuer.resolution.registerInstantiatedClass( |
| 2751 backend.functionImplementation, registry); |
| 2752 } |
| 2713 } | 2753 } |
| 2714 | 2754 |
| 2715 /// Records that [constant] is used by the element behind [registry]. | 2755 /// Records that [constant] is used by the element behind [registry]. |
| 2716 class Dependency { | 2756 class Dependency { |
| 2717 final ConstantValue constant; | 2757 final ConstantValue constant; |
| 2718 final Element annotatedElement; | 2758 final Element annotatedElement; |
| 2719 | 2759 |
| 2720 const Dependency(this.constant, this.annotatedElement); | 2760 const Dependency(this.constant, this.annotatedElement); |
| 2721 } | 2761 } |
| OLD | NEW |