| 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 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 947 // TODO(ngeoffray): Should we have the resolver register those instead? | 947 // TODO(ngeoffray): Should we have the resolver register those instead? |
| 948 Element e = findHelper('boolConversionCheck'); | 948 Element e = findHelper('boolConversionCheck'); |
| 949 if (e != null) enqueue(world, e, registry); | 949 if (e != null) enqueue(world, e, registry); |
| 950 } | 950 } |
| 951 | 951 |
| 952 if (TRACE_CALLS) { | 952 if (TRACE_CALLS) { |
| 953 traceHelper = findHelper('traceHelper'); | 953 traceHelper = findHelper('traceHelper'); |
| 954 assert(traceHelper != null); | 954 assert(traceHelper != null); |
| 955 enqueueInResolution(traceHelper, registry); | 955 enqueueInResolution(traceHelper, registry); |
| 956 } | 956 } |
| 957 | |
| 958 // TODO(ahe): Don't know who uses this class, but it wasn't correctly | |
| 959 // enqueued after we stopped compiling the @proxy constant eagerly. | |
| 960 world.registerInstantiatedClass( | |
| 961 interceptorsLibrary.findLocal('JSUInt31'), registry); | |
| 962 | |
| 963 registerCheckedModeHelpers(registry); | 957 registerCheckedModeHelpers(registry); |
| 964 } | 958 } |
| 965 | 959 |
| 966 onResolutionComplete() { | 960 onResolutionComplete() { |
| 967 super.onResolutionComplete(); | 961 super.onResolutionComplete(); |
| 968 computeMembersNeededForReflection(); | 962 computeMembersNeededForReflection(); |
| 969 rti.computeClassesNeedingRti(); | 963 rti.computeClassesNeedingRti(); |
| 970 computeFunctionsToAlwaysInline(); | 964 computeFunctionsToAlwaysInline(); |
| 971 } | 965 } |
| 972 | 966 |
| (...skipping 1423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2396 return findHelper('mainHasTooManyParameters'); | 2390 return findHelper('mainHasTooManyParameters'); |
| 2397 } | 2391 } |
| 2398 | 2392 |
| 2399 void forgetElement(Element element) { | 2393 void forgetElement(Element element) { |
| 2400 constants.forgetElement(element); | 2394 constants.forgetElement(element); |
| 2401 constantCompilerTask.dartConstantCompiler.forgetElement(element); | 2395 constantCompilerTask.dartConstantCompiler.forgetElement(element); |
| 2402 aliasedSuperMembers.remove(element); | 2396 aliasedSuperMembers.remove(element); |
| 2403 } | 2397 } |
| 2404 | 2398 |
| 2405 void registerMainHasArguments(Enqueuer enqueuer) { | 2399 void registerMainHasArguments(Enqueuer enqueuer) { |
| 2406 // The first argument could be a list of strings. | |
| 2407 enqueuer.registerInstantiatedClass( | |
| 2408 listImplementation, compiler.globalDependencies); | |
| 2409 enqueuer.registerInstantiatedClass( | |
| 2410 stringImplementation, compiler.globalDependencies); | |
| 2411 | |
| 2412 // If the main method takes arguments, this compilation could be the target | 2400 // If the main method takes arguments, this compilation could be the target |
| 2413 // of Isolate.spawnUri. Strictly speaking, that can happen also if main | 2401 // of Isolate.spawnUri. Strictly speaking, that can happen also if main |
| 2414 // takes no arguments, but in this case the spawned isolate can't | 2402 // takes no arguments, but in this case the spawned isolate can't |
| 2415 // communicate with the spawning isolate. | 2403 // communicate with the spawning isolate. |
| 2416 enqueuer.enableIsolateSupport(); | 2404 enqueuer.enableIsolateSupport(); |
| 2417 } | 2405 } |
| 2418 | 2406 |
| 2419 /// Returns the filename for the output-unit named [name]. | 2407 /// Returns the filename for the output-unit named [name]. |
| 2420 /// | 2408 /// |
| 2421 /// The filename is of the form "<main output file>_<name>.part.js". | 2409 /// The filename is of the form "<main output file>_<name>.part.js". |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2573 // eagerly it doesn't matter. | 2561 // eagerly it doesn't matter. |
| 2574 if (type.isTypedef) { | 2562 if (type.isTypedef) { |
| 2575 backend.compiler.world.allTypedefs.add(type.element); | 2563 backend.compiler.world.allTypedefs.add(type.element); |
| 2576 } | 2564 } |
| 2577 backend.customElementsAnalysis.registerTypeLiteral(type, registry); | 2565 backend.customElementsAnalysis.registerTypeLiteral(type, registry); |
| 2578 } | 2566 } |
| 2579 | 2567 |
| 2580 void onStackTraceInCatch(Registry registry) { | 2568 void onStackTraceInCatch(Registry registry) { |
| 2581 assert(registry.isForResolution); | 2569 assert(registry.isForResolution); |
| 2582 registerBackendStaticInvocation(backend.getTraceFromException(), registry); | 2570 registerBackendStaticInvocation(backend.getTraceFromException(), registry); |
| 2583 backend.compiler.enqueuer.resolution.registerInstantiatedClass( | |
| 2584 backend.compiler.stackTraceClass, registry); | |
| 2585 } | 2571 } |
| 2586 | 2572 |
| 2573 |
| 2587 void onTypeVariableExpression(Registry registry) { | 2574 void onTypeVariableExpression(Registry registry) { |
| 2588 assert(registry.isForResolution); | 2575 assert(registry.isForResolution); |
| 2589 registerBackendStaticInvocation(backend.getSetRuntimeTypeInfo(), registry); | 2576 registerBackendStaticInvocation(backend.getSetRuntimeTypeInfo(), registry); |
| 2590 registerBackendStaticInvocation(backend.getGetRuntimeTypeInfo(), registry); | 2577 registerBackendStaticInvocation(backend.getGetRuntimeTypeInfo(), registry); |
| 2591 backend.registerGetRuntimeTypeArgument(registry); | 2578 backend.registerGetRuntimeTypeArgument(registry); |
| 2592 registerBackendInstantiation(backend.compiler.listClass, registry); | 2579 registerBackendInstantiation(backend.compiler.listClass, registry); |
| 2593 registerBackendStaticInvocation(backend.getRuntimeTypeToString(), registry); | 2580 registerBackendStaticInvocation(backend.getRuntimeTypeToString(), registry); |
| 2594 registerBackendStaticInvocation(backend.getCreateRuntimeType(), registry); | 2581 registerBackendStaticInvocation(backend.getCreateRuntimeType(), registry); |
| 2595 } | 2582 } |
| 2596 | 2583 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2704 } | 2691 } |
| 2705 | 2692 |
| 2706 /// Called when resolving the `Symbol` constructor. | 2693 /// Called when resolving the `Symbol` constructor. |
| 2707 void onSymbolConstructor(Registry registry) { | 2694 void onSymbolConstructor(Registry registry) { |
| 2708 assert(registry.isForResolution); | 2695 assert(registry.isForResolution); |
| 2709 // Make sure that _internals.Symbol.validated is registered. | 2696 // Make sure that _internals.Symbol.validated is registered. |
| 2710 assert(backend.compiler.symbolValidatedConstructor != null); | 2697 assert(backend.compiler.symbolValidatedConstructor != null); |
| 2711 registerBackendStaticInvocation( | 2698 registerBackendStaticInvocation( |
| 2712 backend.compiler.symbolValidatedConstructor, registry); | 2699 backend.compiler.symbolValidatedConstructor, registry); |
| 2713 } | 2700 } |
| 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 } | |
| 2753 } | 2701 } |
| 2754 | 2702 |
| 2755 /// Records that [constant] is used by the element behind [registry]. | 2703 /// Records that [constant] is used by the element behind [registry]. |
| 2756 class Dependency { | 2704 class Dependency { |
| 2757 final ConstantValue constant; | 2705 final ConstantValue constant; |
| 2758 final Element annotatedElement; | 2706 final Element annotatedElement; |
| 2759 | 2707 |
| 2760 const Dependency(this.constant, this.annotatedElement); | 2708 const Dependency(this.constant, this.annotatedElement); |
| 2761 } | 2709 } |
| OLD | NEW |