| 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 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 compiler, namer, generateSourceMap, useStartupEmitter); | 531 compiler, namer, generateSourceMap, useStartupEmitter); |
| 532 typeVariableHandler = new TypeVariableHandler(compiler); | 532 typeVariableHandler = new TypeVariableHandler(compiler); |
| 533 customElementsAnalysis = new CustomElementsAnalysis(this); | 533 customElementsAnalysis = new CustomElementsAnalysis(this); |
| 534 lookupMapAnalysis = new LookupMapAnalysis(this, reporter); | 534 lookupMapAnalysis = new LookupMapAnalysis(this, reporter); |
| 535 jsInteropAnalysis = new JsInteropAnalysis(this); | 535 jsInteropAnalysis = new JsInteropAnalysis(this); |
| 536 | 536 |
| 537 noSuchMethodRegistry = new NoSuchMethodRegistry(this); | 537 noSuchMethodRegistry = new NoSuchMethodRegistry(this); |
| 538 constantCompilerTask = new JavaScriptConstantTask(compiler); | 538 constantCompilerTask = new JavaScriptConstantTask(compiler); |
| 539 impactTransformer = new JavaScriptImpactTransformer(this); | 539 impactTransformer = new JavaScriptImpactTransformer(this); |
| 540 patchResolverTask = new PatchResolverTask(compiler); | 540 patchResolverTask = new PatchResolverTask(compiler); |
| 541 functionCompiler = compiler.useCpsIr | 541 functionCompiler = compiler.options.useCpsIr |
| 542 ? new CpsFunctionCompiler( | 542 ? new CpsFunctionCompiler( |
| 543 compiler, this, sourceInformationStrategy) | 543 compiler, this, sourceInformationStrategy) |
| 544 : new SsaFunctionCompiler(this, sourceInformationStrategy); | 544 : new SsaFunctionCompiler(this, sourceInformationStrategy); |
| 545 } | 545 } |
| 546 | 546 |
| 547 ConstantSystem get constantSystem => constants.constantSystem; | 547 ConstantSystem get constantSystem => constants.constantSystem; |
| 548 | 548 |
| 549 DiagnosticReporter get reporter => compiler.reporter; | 549 DiagnosticReporter get reporter => compiler.reporter; |
| 550 | 550 |
| 551 CoreClasses get coreClasses => compiler.coreClasses; | 551 CoreClasses get coreClasses => compiler.coreClasses; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 578 } | 578 } |
| 579 | 579 |
| 580 bool isForeign(Element element) => element.library == helpers.foreignLibrary; | 580 bool isForeign(Element element) => element.library == helpers.foreignLibrary; |
| 581 | 581 |
| 582 bool isBackendLibrary(LibraryElement library) { | 582 bool isBackendLibrary(LibraryElement library) { |
| 583 return library == helpers.interceptorsLibrary || | 583 return library == helpers.interceptorsLibrary || |
| 584 library == helpers.jsHelperLibrary; | 584 library == helpers.jsHelperLibrary; |
| 585 } | 585 } |
| 586 | 586 |
| 587 static Namer determineNamer(Compiler compiler) { | 587 static Namer determineNamer(Compiler compiler) { |
| 588 return compiler.enableMinification ? | 588 return compiler.options.enableMinification ? |
| 589 compiler.useFrequencyNamer ? | 589 compiler.options.useFrequencyNamer ? |
| 590 new FrequencyBasedNamer(compiler) : | 590 new FrequencyBasedNamer(compiler) : |
| 591 new MinifyNamer(compiler) : | 591 new MinifyNamer(compiler) : |
| 592 new Namer(compiler); | 592 new Namer(compiler); |
| 593 } | 593 } |
| 594 | 594 |
| 595 /// The backend must *always* call this method when enqueuing an | 595 /// The backend must *always* call this method when enqueuing an |
| 596 /// element. Calls done by the backend are not seen by global | 596 /// element. Calls done by the backend are not seen by global |
| 597 /// optimizations, so they would make these optimizations unsound. | 597 /// optimizations, so they would make these optimizations unsound. |
| 598 /// Therefore we need to collect the list of helpers the backend may | 598 /// Therefore we need to collect the list of helpers the backend may |
| 599 /// use. | 599 /// use. |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 // We also turn off this optimization in incremental compilation, to | 695 // We also turn off this optimization in incremental compilation, to |
| 696 // avoid having to regenerate a method just because someone started | 696 // avoid having to regenerate a method just because someone started |
| 697 // calling it through super. | 697 // calling it through super. |
| 698 return false; | 698 return false; |
| 699 } | 699 } |
| 700 aliasedSuperMembers.add(member); | 700 aliasedSuperMembers.add(member); |
| 701 return true; | 701 return true; |
| 702 } | 702 } |
| 703 | 703 |
| 704 bool canUseAliasedSuperMember(Element member, Selector selector) { | 704 bool canUseAliasedSuperMember(Element member, Selector selector) { |
| 705 return !selector.isGetter && !compiler.hasIncrementalSupport; | 705 return !selector.isGetter && !compiler.options.hasIncrementalSupport; |
| 706 } | 706 } |
| 707 | 707 |
| 708 /** | 708 /** |
| 709 * Returns `true` if [member] is called from a subclass via `super`. | 709 * Returns `true` if [member] is called from a subclass via `super`. |
| 710 */ | 710 */ |
| 711 bool isAliasedSuperMember(FunctionElement member) { | 711 bool isAliasedSuperMember(FunctionElement member) { |
| 712 return aliasedSuperMembers.contains(member); | 712 return aliasedSuperMembers.contains(member); |
| 713 } | 713 } |
| 714 | 714 |
| 715 /// The JavaScript names for elements implemented via typed JavaScript | 715 /// The JavaScript names for elements implemented via typed JavaScript |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1338 return new JavaScriptItemCompilationContext(); | 1338 return new JavaScriptItemCompilationContext(); |
| 1339 } | 1339 } |
| 1340 | 1340 |
| 1341 void enqueueHelpers(ResolutionEnqueuer world, Registry registry) { | 1341 void enqueueHelpers(ResolutionEnqueuer world, Registry registry) { |
| 1342 assert(helpers.interceptorsLibrary != null); | 1342 assert(helpers.interceptorsLibrary != null); |
| 1343 // TODO(ngeoffray): Not enqueuing those two classes currently make | 1343 // TODO(ngeoffray): Not enqueuing those two classes currently make |
| 1344 // the compiler potentially crash. However, any reasonable program | 1344 // the compiler potentially crash. However, any reasonable program |
| 1345 // will instantiate those two classes. | 1345 // will instantiate those two classes. |
| 1346 addInterceptors(helpers.jsBoolClass, world, registry); | 1346 addInterceptors(helpers.jsBoolClass, world, registry); |
| 1347 addInterceptors(helpers.jsNullClass, world, registry); | 1347 addInterceptors(helpers.jsNullClass, world, registry); |
| 1348 if (compiler.enableTypeAssertions) { | 1348 if (compiler.options.enableTypeAssertions) { |
| 1349 // Unconditionally register the helper that checks if the | 1349 // Unconditionally register the helper that checks if the |
| 1350 // expression in an if/while/for is a boolean. | 1350 // expression in an if/while/for is a boolean. |
| 1351 // TODO(ngeoffray): Should we have the resolver register those instead? | 1351 // TODO(ngeoffray): Should we have the resolver register those instead? |
| 1352 Element e = helpers.boolConversionCheck; | 1352 Element e = helpers.boolConversionCheck; |
| 1353 if (e != null) enqueue(world, e, registry); | 1353 if (e != null) enqueue(world, e, registry); |
| 1354 } | 1354 } |
| 1355 | 1355 |
| 1356 if (TRACE_CALLS) { | 1356 if (TRACE_CALLS) { |
| 1357 traceHelper = TRACE_METHOD == 'console' | 1357 traceHelper = TRACE_METHOD == 'console' |
| 1358 ? helpers.consoleTraceHelper : helpers.postTraceHelper; | 1358 ? helpers.consoleTraceHelper : helpers.postTraceHelper; |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1937 ClassElement get constMapImplementation => helpers.constMapLiteralClass; | 1937 ClassElement get constMapImplementation => helpers.constMapLiteralClass; |
| 1938 ClassElement get typeImplementation => helpers.typeLiteralClass; | 1938 ClassElement get typeImplementation => helpers.typeLiteralClass; |
| 1939 ClassElement get boolImplementation => helpers.jsBoolClass; | 1939 ClassElement get boolImplementation => helpers.jsBoolClass; |
| 1940 ClassElement get nullImplementation => helpers.jsNullClass; | 1940 ClassElement get nullImplementation => helpers.jsNullClass; |
| 1941 ClassElement get syncStarIterableImplementation => helpers.syncStarIterable; | 1941 ClassElement get syncStarIterableImplementation => helpers.syncStarIterable; |
| 1942 ClassElement get asyncFutureImplementation => helpers.futureImplementation; | 1942 ClassElement get asyncFutureImplementation => helpers.futureImplementation; |
| 1943 ClassElement get asyncStarStreamImplementation => helpers.controllerStream; | 1943 ClassElement get asyncStarStreamImplementation => helpers.controllerStream; |
| 1944 | 1944 |
| 1945 void registerStaticUse(Element element, Enqueuer enqueuer) { | 1945 void registerStaticUse(Element element, Enqueuer enqueuer) { |
| 1946 if (element == helpers.disableTreeShakingMarker) { | 1946 if (element == helpers.disableTreeShakingMarker) { |
| 1947 compiler.disableTypeInferenceForMirrors = true; | |
| 1948 isTreeShakingDisabled = true; | 1947 isTreeShakingDisabled = true; |
| 1949 } else if (element == helpers.preserveNamesMarker) { | 1948 } else if (element == helpers.preserveNamesMarker) { |
| 1950 mustPreserveNames = true; | 1949 mustPreserveNames = true; |
| 1951 } else if (element == helpers.preserveMetadataMarker) { | 1950 } else if (element == helpers.preserveMetadataMarker) { |
| 1952 mustRetainMetadata = true; | 1951 mustRetainMetadata = true; |
| 1953 } else if (element == helpers.preserveUrisMarker) { | 1952 } else if (element == helpers.preserveUrisMarker) { |
| 1954 if (compiler.preserveUris) mustPreserveUris = true; | 1953 if (compiler.options.preserveUris) mustPreserveUris = true; |
| 1955 } else if (element == helpers.preserveLibraryNamesMarker) { | 1954 } else if (element == helpers.preserveLibraryNamesMarker) { |
| 1956 mustRetainLibraryNames = true; | 1955 mustRetainLibraryNames = true; |
| 1957 } else if (element == helpers.getIsolateAffinityTagMarker) { | 1956 } else if (element == helpers.getIsolateAffinityTagMarker) { |
| 1958 needToInitializeIsolateAffinityTag = true; | 1957 needToInitializeIsolateAffinityTag = true; |
| 1959 } else if (element.isDeferredLoaderGetter) { | 1958 } else if (element.isDeferredLoaderGetter) { |
| 1960 // TODO(sigurdm): Create a function registerLoadLibraryAccess. | 1959 // TODO(sigurdm): Create a function registerLoadLibraryAccess. |
| 1961 if (compiler.loadLibraryFunction == null) { | 1960 if (compiler.loadLibraryFunction == null) { |
| 1962 compiler.loadLibraryFunction = helpers.loadLibraryWrapper; | 1961 compiler.loadLibraryFunction = helpers.loadLibraryWrapper; |
| 1963 enqueueInResolution(compiler.loadLibraryFunction, | 1962 enqueueInResolution(compiler.loadLibraryFunction, |
| 1964 compiler.globalDependencies); | 1963 compiler.globalDependencies); |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2387 if (!enqueuer.queueIsEmpty) return false; | 2386 if (!enqueuer.queueIsEmpty) return false; |
| 2388 | 2387 |
| 2389 noSuchMethodRegistry.onQueueEmpty(); | 2388 noSuchMethodRegistry.onQueueEmpty(); |
| 2390 if (!enabledNoSuchMethod && | 2389 if (!enabledNoSuchMethod && |
| 2391 (noSuchMethodRegistry.hasThrowingNoSuchMethod || | 2390 (noSuchMethodRegistry.hasThrowingNoSuchMethod || |
| 2392 noSuchMethodRegistry.hasComplexNoSuchMethod)) { | 2391 noSuchMethodRegistry.hasComplexNoSuchMethod)) { |
| 2393 enableNoSuchMethod(enqueuer); | 2392 enableNoSuchMethod(enqueuer); |
| 2394 enabledNoSuchMethod = true; | 2393 enabledNoSuchMethod = true; |
| 2395 } | 2394 } |
| 2396 | 2395 |
| 2397 if (compiler.hasIncrementalSupport) { | 2396 if (compiler.options.hasIncrementalSupport) { |
| 2398 // Always enable tear-off closures during incremental compilation. | 2397 // Always enable tear-off closures during incremental compilation. |
| 2399 Element e = helpers.closureFromTearOff; | 2398 Element e = helpers.closureFromTearOff; |
| 2400 if (e != null && !enqueuer.isProcessed(e)) { | 2399 if (e != null && !enqueuer.isProcessed(e)) { |
| 2401 registerBackendUse(e); | 2400 registerBackendUse(e); |
| 2402 enqueuer.addToWorkList(e); | 2401 enqueuer.addToWorkList(e); |
| 2403 } | 2402 } |
| 2404 } | 2403 } |
| 2405 | 2404 |
| 2406 if (!enqueuer.isResolutionQueue && preMirrorsMethodCount == 0) { | 2405 if (!enqueuer.isResolutionQueue && preMirrorsMethodCount == 0) { |
| 2407 preMirrorsMethodCount = generatedCode.length; | 2406 preMirrorsMethodCount = generatedCode.length; |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2554 // communicate with the spawning isolate. | 2553 // communicate with the spawning isolate. |
| 2555 enqueuer.enableIsolateSupport(); | 2554 enqueuer.enableIsolateSupport(); |
| 2556 } | 2555 } |
| 2557 | 2556 |
| 2558 /// Returns the filename for the output-unit named [name]. | 2557 /// Returns the filename for the output-unit named [name]. |
| 2559 /// | 2558 /// |
| 2560 /// The filename is of the form "<main output file>_<name>.part.js". | 2559 /// The filename is of the form "<main output file>_<name>.part.js". |
| 2561 /// If [addExtension] is false, the ".part.js" suffix is left out. | 2560 /// If [addExtension] is false, the ".part.js" suffix is left out. |
| 2562 String deferredPartFileName(String name, {bool addExtension: true}) { | 2561 String deferredPartFileName(String name, {bool addExtension: true}) { |
| 2563 assert(name != ""); | 2562 assert(name != ""); |
| 2564 String outPath = compiler.outputUri != null | 2563 String outPath = compiler.options.outputUri != null |
| 2565 ? compiler.outputUri.path | 2564 ? compiler.options.outputUri.path |
| 2566 : "out"; | 2565 : "out"; |
| 2567 String outName = outPath.substring(outPath.lastIndexOf('/') + 1); | 2566 String outName = outPath.substring(outPath.lastIndexOf('/') + 1); |
| 2568 String extension = addExtension ? ".part.js" : ""; | 2567 String extension = addExtension ? ".part.js" : ""; |
| 2569 return "${outName}_$name$extension"; | 2568 return "${outName}_$name$extension"; |
| 2570 } | 2569 } |
| 2571 | 2570 |
| 2572 @override | 2571 @override |
| 2573 bool enableDeferredLoadingIfSupported(Spannable node, Registry registry) { | 2572 bool enableDeferredLoadingIfSupported(Spannable node, Registry registry) { |
| 2574 registerCheckDeferredIsLoaded(registry); | 2573 registerCheckDeferredIsLoaded(registry); |
| 2575 return true; | 2574 return true; |
| 2576 } | 2575 } |
| 2577 | 2576 |
| 2578 @override | 2577 @override |
| 2579 bool enableCodegenWithErrorsIfSupported(Spannable node) { | 2578 bool enableCodegenWithErrorsIfSupported(Spannable node) { |
| 2580 if (compiler.useCpsIr) { | 2579 if (compiler.options.useCpsIr) { |
| 2581 // TODO(25747): Support code generation with compile-time errors. | 2580 // TODO(25747): Support code generation with compile-time errors. |
| 2582 reporter.reportHintMessage( | 2581 reporter.reportHintMessage( |
| 2583 node, | 2582 node, |
| 2584 MessageKind.GENERIC, | 2583 MessageKind.GENERIC, |
| 2585 {'text': "Generation of code with compile time errors is currently " | 2584 {'text': "Generation of code with compile time errors is currently " |
| 2586 "not supported with the CPS IR."}); | 2585 "not supported with the CPS IR."}); |
| 2587 return false; | 2586 return false; |
| 2588 } | 2587 } |
| 2589 return true; | 2588 return true; |
| 2590 } | 2589 } |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2785 case Feature.ASYNC_FOR_IN: | 2784 case Feature.ASYNC_FOR_IN: |
| 2786 registerBackendImpact(transformed, impacts.asyncForIn); | 2785 registerBackendImpact(transformed, impacts.asyncForIn); |
| 2787 break; | 2786 break; |
| 2788 case Feature.ASYNC_STAR: | 2787 case Feature.ASYNC_STAR: |
| 2789 registerBackendImpact(transformed, impacts.asyncStarBody); | 2788 registerBackendImpact(transformed, impacts.asyncStarBody); |
| 2790 break; | 2789 break; |
| 2791 case Feature.CATCH_STATEMENT: | 2790 case Feature.CATCH_STATEMENT: |
| 2792 registerBackendImpact(transformed, impacts.catchStatement); | 2791 registerBackendImpact(transformed, impacts.catchStatement); |
| 2793 break; | 2792 break; |
| 2794 case Feature.COMPILE_TIME_ERROR: | 2793 case Feature.COMPILE_TIME_ERROR: |
| 2795 if (backend.compiler.generateCodeWithCompileTimeErrors) { | 2794 if (backend.compiler.options.generateCodeWithCompileTimeErrors) { |
| 2796 // TODO(johnniwinther): This should have its own uncatchable error. | 2795 // TODO(johnniwinther): This should have its own uncatchable error. |
| 2797 registerBackendImpact(transformed, impacts.throwRuntimeError); | 2796 registerBackendImpact(transformed, impacts.throwRuntimeError); |
| 2798 } | 2797 } |
| 2799 break; | 2798 break; |
| 2800 case Feature.FALL_THROUGH_ERROR: | 2799 case Feature.FALL_THROUGH_ERROR: |
| 2801 registerBackendImpact(transformed, impacts.fallThroughError); | 2800 registerBackendImpact(transformed, impacts.fallThroughError); |
| 2802 break; | 2801 break; |
| 2803 case Feature.INC_DEC_OPERATION: | 2802 case Feature.INC_DEC_OPERATION: |
| 2804 registerBackendImpact(transformed, impacts.incDecOperation); | 2803 registerBackendImpact(transformed, impacts.incDecOperation); |
| 2805 break; | 2804 break; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2851 registerRequiredType(type); | 2850 registerRequiredType(type); |
| 2852 break; | 2851 break; |
| 2853 case TypeUseKind.IS_CHECK: | 2852 case TypeUseKind.IS_CHECK: |
| 2854 onIsCheck(type, transformed); | 2853 onIsCheck(type, transformed); |
| 2855 break; | 2854 break; |
| 2856 case TypeUseKind.AS_CAST: | 2855 case TypeUseKind.AS_CAST: |
| 2857 onIsCheck(type, transformed); | 2856 onIsCheck(type, transformed); |
| 2858 hasAsCast = true; | 2857 hasAsCast = true; |
| 2859 break; | 2858 break; |
| 2860 case TypeUseKind.CHECKED_MODE_CHECK: | 2859 case TypeUseKind.CHECKED_MODE_CHECK: |
| 2861 if (backend.compiler.enableTypeAssertions) { | 2860 if (backend.compiler.options.enableTypeAssertions) { |
| 2862 onIsCheck(type, transformed); | 2861 onIsCheck(type, transformed); |
| 2863 } | 2862 } |
| 2864 break; | 2863 break; |
| 2865 case TypeUseKind.CATCH_TYPE: | 2864 case TypeUseKind.CATCH_TYPE: |
| 2866 onIsCheck(type, transformed); | 2865 onIsCheck(type, transformed); |
| 2867 break; | 2866 break; |
| 2868 case TypeUseKind.TYPE_LITERAL: | 2867 case TypeUseKind.TYPE_LITERAL: |
| 2869 backend.customElementsAnalysis.registerTypeLiteral(type); | 2868 backend.customElementsAnalysis.registerTypeLiteral(type); |
| 2870 if (type.isTypedef) { | 2869 if (type.isTypedef) { |
| 2871 backend.compiler.world.allTypedefs.add(type.element); | 2870 backend.compiler.world.allTypedefs.add(type.element); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2993 } | 2992 } |
| 2994 } | 2993 } |
| 2995 | 2994 |
| 2996 // TODO(johnniwinther): Maybe split this into [onAssertType] and [onTestType]. | 2995 // TODO(johnniwinther): Maybe split this into [onAssertType] and [onTestType]. |
| 2997 void onIsCheck(DartType type, TransformedWorldImpact transformed) { | 2996 void onIsCheck(DartType type, TransformedWorldImpact transformed) { |
| 2998 registerRequiredType(type); | 2997 registerRequiredType(type); |
| 2999 type.computeUnaliased(backend.resolution); | 2998 type.computeUnaliased(backend.resolution); |
| 3000 type = type.unaliased; | 2999 type = type.unaliased; |
| 3001 registerBackendImpact(transformed, impacts.typeCheck); | 3000 registerBackendImpact(transformed, impacts.typeCheck); |
| 3002 | 3001 |
| 3003 bool inCheckedMode = backend.compiler.enableTypeAssertions; | 3002 bool inCheckedMode = backend.compiler.options.enableTypeAssertions; |
| 3004 if (inCheckedMode) { | 3003 if (inCheckedMode) { |
| 3005 registerBackendImpact(transformed, impacts.checkedModeTypeCheck); | 3004 registerBackendImpact(transformed, impacts.checkedModeTypeCheck); |
| 3006 } | 3005 } |
| 3007 if (type.isMalformed) { | 3006 if (type.isMalformed) { |
| 3008 registerBackendImpact(transformed, impacts.malformedTypeCheck); | 3007 registerBackendImpact(transformed, impacts.malformedTypeCheck); |
| 3009 } | 3008 } |
| 3010 if (!type.treatAsRaw || type.containsTypeVariables || type.isFunctionType) { | 3009 if (!type.treatAsRaw || type.containsTypeVariables || type.isFunctionType) { |
| 3011 registerBackendImpact(transformed, impacts.genericTypeCheck); | 3010 registerBackendImpact(transformed, impacts.genericTypeCheck); |
| 3012 if (inCheckedMode) { | 3011 if (inCheckedMode) { |
| 3013 registerBackendImpact(transformed, impacts.genericCheckedModeTypeCheck); | 3012 registerBackendImpact(transformed, impacts.genericCheckedModeTypeCheck); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 3025 } | 3024 } |
| 3026 if (type.element != null && backend.isNative(type.element)) { | 3025 if (type.element != null && backend.isNative(type.element)) { |
| 3027 registerBackendImpact(transformed, impacts.nativeTypeCheck); | 3026 registerBackendImpact(transformed, impacts.nativeTypeCheck); |
| 3028 } | 3027 } |
| 3029 } | 3028 } |
| 3030 | 3029 |
| 3031 void onIsCheckForCodegen(DartType type, TransformedWorldImpact transformed) { | 3030 void onIsCheckForCodegen(DartType type, TransformedWorldImpact transformed) { |
| 3032 type = type.unaliased; | 3031 type = type.unaliased; |
| 3033 registerBackendImpact(transformed, impacts.typeCheck); | 3032 registerBackendImpact(transformed, impacts.typeCheck); |
| 3034 | 3033 |
| 3035 bool inCheckedMode = backend.compiler.enableTypeAssertions; | 3034 bool inCheckedMode = backend.compiler.options.enableTypeAssertions; |
| 3036 // [registerIsCheck] is also called for checked mode checks, so we | 3035 // [registerIsCheck] is also called for checked mode checks, so we |
| 3037 // need to register checked mode helpers. | 3036 // need to register checked mode helpers. |
| 3038 if (inCheckedMode) { | 3037 if (inCheckedMode) { |
| 3039 // All helpers are added to resolution queue in enqueueHelpers. These | 3038 // All helpers are added to resolution queue in enqueueHelpers. These |
| 3040 // calls to enqueueInResolution serve as assertions that the helper was | 3039 // calls to enqueueInResolution serve as assertions that the helper was |
| 3041 // in fact added. | 3040 // in fact added. |
| 3042 // TODO(13155): Find a way to enqueue helpers lazily. | 3041 // TODO(13155): Find a way to enqueue helpers lazily. |
| 3043 CheckedModeHelper helper = | 3042 CheckedModeHelper helper = |
| 3044 backend.getCheckedModeHelper(type, typeCast: false); | 3043 backend.getCheckedModeHelper(type, typeCast: false); |
| 3045 if (helper != null) { | 3044 if (helper != null) { |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3184 } | 3183 } |
| 3185 } | 3184 } |
| 3186 | 3185 |
| 3187 @override | 3186 @override |
| 3188 void onImpactUsed(ImpactUseCase impactUse) { | 3187 void onImpactUsed(ImpactUseCase impactUse) { |
| 3189 if (impactUse == DeferredLoadTask.IMPACT_USE) { | 3188 if (impactUse == DeferredLoadTask.IMPACT_USE) { |
| 3190 resolution.emptyCache(); | 3189 resolution.emptyCache(); |
| 3191 } | 3190 } |
| 3192 } | 3191 } |
| 3193 } | 3192 } |
| OLD | NEW |