| 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 dart2js.backend_api; | 5 library dart2js.backend_api; |
| 6 | 6 |
| 7 import 'dart:async' show Future; | 7 import 'dart:async' show Future; |
| 8 | 8 |
| 9 import '../common.dart'; | 9 import '../common.dart'; |
| 10 import '../common/codegen.dart' show CodegenImpact; | 10 import '../common/codegen.dart' show CodegenImpact; |
| 11 import '../common/resolution.dart' show ResolutionImpact, Frontend; | 11 import '../common/resolution.dart' show ResolutionImpact, Frontend; |
| 12 import '../compile_time_constants.dart' | 12 import '../compile_time_constants.dart' |
| 13 show BackendConstantEnvironment, ConstantCompilerTask; | 13 show BackendConstantEnvironment, ConstantCompilerTask; |
| 14 import '../compiler.dart' show Compiler; | 14 import '../compiler.dart' show Compiler; |
| 15 import '../constants/constant_system.dart' show ConstantSystem; | 15 import '../constants/constant_system.dart' show ConstantSystem; |
| 16 import '../constants/expressions.dart' show ConstantExpression; | 16 import '../constants/expressions.dart' show ConstantExpression; |
| 17 import '../constants/values.dart' show ConstantValue; | 17 import '../constants/values.dart' show ConstantValue; |
| 18 import '../dart_types.dart' show DartType, InterfaceType; | 18 import '../dart_types.dart' show DartType, InterfaceType; |
| 19 import '../elements/elements.dart' | 19 import '../elements/elements.dart' |
| 20 show | 20 show |
| 21 ClassElement, | 21 ClassElement, |
| 22 Element, | 22 Element, |
| 23 FunctionElement, | 23 FunctionElement, |
| 24 LibraryElement, | 24 LibraryElement, |
| 25 MetadataAnnotation, | 25 MetadataAnnotation, |
| 26 MethodElement; | 26 MethodElement; |
| 27 import '../enqueue.dart' show Enqueuer, ResolutionEnqueuer; | 27 import '../enqueue.dart' show Enqueuer, EnqueueTask, CodegenEnqueuer, Resolution
Enqueuer; |
| 28 import '../io/code_output.dart' show CodeBuffer; | 28 import '../io/code_output.dart' show CodeBuffer; |
| 29 import '../io/source_information.dart' show SourceInformationStrategy; | 29 import '../io/source_information.dart' show SourceInformationStrategy; |
| 30 import '../js_backend/backend_helpers.dart' as js_backend show BackendHelpers; | 30 import '../js_backend/backend_helpers.dart' as js_backend show BackendHelpers; |
| 31 import '../js_backend/js_backend.dart' as js_backend; | 31 import '../js_backend/js_backend.dart' as js_backend; |
| 32 import '../library_loader.dart' show LibraryLoader, LoadedLibraries; | 32 import '../library_loader.dart' show LibraryLoader, LoadedLibraries; |
| 33 import '../native/native.dart' as native show NativeEnqueuer, maybeEnableNative; | 33 import '../native/native.dart' as native show NativeEnqueuer, maybeEnableNative; |
| 34 import '../patch_parser.dart' | 34 import '../patch_parser.dart' |
| 35 show checkNativeAnnotation, checkJsInteropAnnotation; | 35 show checkNativeAnnotation, checkJsInteropAnnotation; |
| 36 import '../serialization/serialization.dart' | 36 import '../serialization/serialization.dart' |
| 37 show DeserializerPlugin, SerializerPlugin; | 37 show DeserializerPlugin, SerializerPlugin; |
| 38 import '../tree/tree.dart' show Node, Send; | 38 import '../tree/tree.dart' show Node, Send; |
| 39 import '../universe/call_structure.dart' show CallStructure; | 39 import '../universe/call_structure.dart' show CallStructure; |
| 40 import '../universe/world_impact.dart' show ImpactStrategy, WorldImpact; | 40 import '../universe/world_impact.dart' show ImpactStrategy, WorldImpact; |
| 41 import 'codegen.dart' show CodegenWorkItem; | 41 import 'codegen.dart' show |
| 42 import 'registry.dart' show Registry; | 42 CodegenWorkItem; |
| 43 import 'tasks.dart' show CompilerTask; | 43 import 'registry.dart' show |
| 44 import 'work.dart' show ItemCompilationContext; | 44 Registry; |
| 45 import 'tasks.dart' show |
| 46 CompilerTask; |
| 47 import 'work.dart' show |
| 48 ItemCompilationContext; |
| 45 | 49 |
| 46 abstract class Backend { | 50 abstract class Backend { |
| 47 final Compiler compiler; | 51 final Compiler compiler; |
| 48 | 52 |
| 49 Backend(this.compiler); | 53 Backend(this.compiler); |
| 50 | 54 |
| 51 /// Returns true if the backend supports reflection. | 55 /// Returns true if the backend supports reflection. |
| 52 bool get supportsReflection; | 56 bool get supportsReflection; |
| 53 | 57 |
| 54 /// The [ConstantSystem] used to interpret compile-time constants for this | 58 /// The [ConstantSystem] used to interpret compile-time constants for this |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 /// Creates an impact strategy to use for compilation. | 395 /// Creates an impact strategy to use for compilation. |
| 392 ImpactStrategy createImpactStrategy( | 396 ImpactStrategy createImpactStrategy( |
| 393 {bool supportDeferredLoad: true, | 397 {bool supportDeferredLoad: true, |
| 394 bool supportDumpInfo: true, | 398 bool supportDumpInfo: true, |
| 395 bool supportSerialization: true}) { | 399 bool supportSerialization: true}) { |
| 396 return const ImpactStrategy(); | 400 return const ImpactStrategy(); |
| 397 } | 401 } |
| 398 | 402 |
| 399 /// Backend access to the front-end. | 403 /// Backend access to the front-end. |
| 400 Frontend get frontend => compiler.resolution; | 404 Frontend get frontend => compiler.resolution; |
| 405 |
| 406 EnqueueTask makeEnqueuer() => new EnqueueTask(compiler); |
| 401 } | 407 } |
| 402 | 408 |
| 403 /// Interface for resolving calls to foreign functions. | 409 /// Interface for resolving calls to foreign functions. |
| 404 abstract class ForeignResolver { | 410 abstract class ForeignResolver { |
| 405 /// Returns the constant expression of [node], or `null` if [node] is not | 411 /// Returns the constant expression of [node], or `null` if [node] is not |
| 406 /// a constant expression. | 412 /// a constant expression. |
| 407 ConstantExpression getConstant(Node node); | 413 ConstantExpression getConstant(Node node); |
| 408 | 414 |
| 409 /// Registers [type] as instantiated. | 415 /// Registers [type] as instantiated. |
| 410 void registerInstantiatedType(InterfaceType type); | 416 void registerInstantiatedType(InterfaceType type); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 428 } | 434 } |
| 429 } | 435 } |
| 430 | 436 |
| 431 /// Interface for serialization of backend specific data. | 437 /// Interface for serialization of backend specific data. |
| 432 class BackendSerialization { | 438 class BackendSerialization { |
| 433 const BackendSerialization(); | 439 const BackendSerialization(); |
| 434 | 440 |
| 435 SerializerPlugin get serializer => const SerializerPlugin(); | 441 SerializerPlugin get serializer => const SerializerPlugin(); |
| 436 DeserializerPlugin get deserializer => const DeserializerPlugin(); | 442 DeserializerPlugin get deserializer => const DeserializerPlugin(); |
| 437 } | 443 } |
| OLD | NEW |