| 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 library js_backend.backend; | 5 library js_backend.backend; |
| 6 | 6 |
| 7 import 'dart:async' show Future; | 7 import 'dart:async' show Future; |
| 8 | 8 |
| 9 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; | 9 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; |
| 10 | 10 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 ImpactUseCase, | 61 ImpactUseCase, |
| 62 TransformedWorldImpact, | 62 TransformedWorldImpact, |
| 63 WorldImpact, | 63 WorldImpact, |
| 64 WorldImpactVisitor; | 64 WorldImpactVisitor; |
| 65 import '../util/util.dart'; | 65 import '../util/util.dart'; |
| 66 import '../world.dart' show ClassWorld; | 66 import '../world.dart' show ClassWorld; |
| 67 import 'backend_helpers.dart'; | 67 import 'backend_helpers.dart'; |
| 68 import 'backend_impact.dart'; | 68 import 'backend_impact.dart'; |
| 69 import 'backend_serialization.dart' show JavaScriptBackendSerialization; | 69 import 'backend_serialization.dart' show JavaScriptBackendSerialization; |
| 70 import 'checked_mode_helpers.dart'; | 70 import 'checked_mode_helpers.dart'; |
| 71 import 'codegen/task.dart'; | |
| 72 import 'constant_handler_javascript.dart'; | 71 import 'constant_handler_javascript.dart'; |
| 73 import 'custom_elements_analysis.dart'; | 72 import 'custom_elements_analysis.dart'; |
| 74 import 'js_interop_analysis.dart' show JsInteropAnalysis; | 73 import 'js_interop_analysis.dart' show JsInteropAnalysis; |
| 75 import 'lookup_map_analysis.dart' show LookupMapAnalysis; | 74 import 'lookup_map_analysis.dart' show LookupMapAnalysis; |
| 76 import 'namer.dart'; | 75 import 'namer.dart'; |
| 77 import 'native_data.dart' show NativeData; | 76 import 'native_data.dart' show NativeData; |
| 78 import 'no_such_method_registry.dart'; | 77 import 'no_such_method_registry.dart'; |
| 79 import 'patch_resolver.dart'; | 78 import 'patch_resolver.dart'; |
| 80 import 'type_variable_handler.dart'; | 79 import 'type_variable_handler.dart'; |
| 81 | 80 |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 compiler, namer, generateSourceMap, useStartupEmitter); | 621 compiler, namer, generateSourceMap, useStartupEmitter); |
| 623 typeVariableHandler = new TypeVariableHandler(compiler); | 622 typeVariableHandler = new TypeVariableHandler(compiler); |
| 624 customElementsAnalysis = new CustomElementsAnalysis(this); | 623 customElementsAnalysis = new CustomElementsAnalysis(this); |
| 625 lookupMapAnalysis = new LookupMapAnalysis(this, reporter); | 624 lookupMapAnalysis = new LookupMapAnalysis(this, reporter); |
| 626 jsInteropAnalysis = new JsInteropAnalysis(this); | 625 jsInteropAnalysis = new JsInteropAnalysis(this); |
| 627 | 626 |
| 628 noSuchMethodRegistry = new NoSuchMethodRegistry(this); | 627 noSuchMethodRegistry = new NoSuchMethodRegistry(this); |
| 629 constantCompilerTask = new JavaScriptConstantTask(compiler); | 628 constantCompilerTask = new JavaScriptConstantTask(compiler); |
| 630 impactTransformer = new JavaScriptImpactTransformer(this); | 629 impactTransformer = new JavaScriptImpactTransformer(this); |
| 631 patchResolverTask = new PatchResolverTask(compiler); | 630 patchResolverTask = new PatchResolverTask(compiler); |
| 632 functionCompiler = compiler.options.useCpsIr | 631 functionCompiler = new SsaFunctionCompiler(this, sourceInformationStrategy); |
| 633 ? new CpsFunctionCompiler(compiler, this, sourceInformationStrategy) | |
| 634 : new SsaFunctionCompiler(this, sourceInformationStrategy); | |
| 635 serialization = new JavaScriptBackendSerialization(this); | 632 serialization = new JavaScriptBackendSerialization(this); |
| 636 } | 633 } |
| 637 | 634 |
| 638 ConstantSystem get constantSystem => constants.constantSystem; | 635 ConstantSystem get constantSystem => constants.constantSystem; |
| 639 | 636 |
| 640 DiagnosticReporter get reporter => compiler.reporter; | 637 DiagnosticReporter get reporter => compiler.reporter; |
| 641 | 638 |
| 642 CoreClasses get coreClasses => compiler.coreClasses; | 639 CoreClasses get coreClasses => compiler.coreClasses; |
| 643 | 640 |
| 644 CoreTypes get coreTypes => compiler.coreTypes; | 641 CoreTypes get coreTypes => compiler.coreTypes; |
| (...skipping 1932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2577 return "${outName}_$name$extension"; | 2574 return "${outName}_$name$extension"; |
| 2578 } | 2575 } |
| 2579 | 2576 |
| 2580 @override | 2577 @override |
| 2581 bool enableDeferredLoadingIfSupported(Spannable node, Registry registry) { | 2578 bool enableDeferredLoadingIfSupported(Spannable node, Registry registry) { |
| 2582 registerCheckDeferredIsLoaded(registry); | 2579 registerCheckDeferredIsLoaded(registry); |
| 2583 return true; | 2580 return true; |
| 2584 } | 2581 } |
| 2585 | 2582 |
| 2586 @override | 2583 @override |
| 2587 bool enableCodegenWithErrorsIfSupported(Spannable node) { | 2584 bool enableCodegenWithErrorsIfSupported(Spannable node) => true; |
| 2588 if (compiler.options.useCpsIr) { | |
| 2589 // TODO(25747): Support code generation with compile-time errors. | |
| 2590 reporter.reportHintMessage(node, MessageKind.GENERIC, { | |
| 2591 'text': "Generation of code with compile time errors is currently " | |
| 2592 "not supported with the CPS IR." | |
| 2593 }); | |
| 2594 return false; | |
| 2595 } | |
| 2596 return true; | |
| 2597 } | |
| 2598 | 2585 |
| 2599 jsAst.Expression rewriteAsync( | 2586 jsAst.Expression rewriteAsync( |
| 2600 FunctionElement element, jsAst.Expression code) { | 2587 FunctionElement element, jsAst.Expression code) { |
| 2601 AsyncRewriterBase rewriter = null; | 2588 AsyncRewriterBase rewriter = null; |
| 2602 jsAst.Name name = namer.methodPropertyName(element); | 2589 jsAst.Name name = namer.methodPropertyName(element); |
| 2603 switch (element.asyncMarker) { | 2590 switch (element.asyncMarker) { |
| 2604 case AsyncMarker.ASYNC: | 2591 case AsyncMarker.ASYNC: |
| 2605 rewriter = new AsyncRewriter(reporter, element, | 2592 rewriter = new AsyncRewriter(reporter, element, |
| 2606 asyncHelper: emitter.staticFunctionAccess(helpers.asyncHelper), | 2593 asyncHelper: emitter.staticFunctionAccess(helpers.asyncHelper), |
| 2607 wrapBody: emitter.staticFunctionAccess(helpers.wrapBody), | 2594 wrapBody: emitter.staticFunctionAccess(helpers.wrapBody), |
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3209 | 3196 |
| 3210 @override | 3197 @override |
| 3211 void onImpactUsed(ImpactUseCase impactUse) { | 3198 void onImpactUsed(ImpactUseCase impactUse) { |
| 3212 if (impactUse == DeferredLoadTask.IMPACT_USE && !supportSerialization) { | 3199 if (impactUse == DeferredLoadTask.IMPACT_USE && !supportSerialization) { |
| 3213 // TODO(johnniwinther): Allow emptying when serialization has been | 3200 // TODO(johnniwinther): Allow emptying when serialization has been |
| 3214 // performed. | 3201 // performed. |
| 3215 resolution.emptyCache(); | 3202 resolution.emptyCache(); |
| 3216 } | 3203 } |
| 3217 } | 3204 } |
| 3218 } | 3205 } |
| OLD | NEW |