| 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; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 import '../native/native.dart' as native show NativeEnqueuer, maybeEnableNative; | 27 import '../native/native.dart' as native show NativeEnqueuer, maybeEnableNative; |
| 28 import '../patch_parser.dart' | 28 import '../patch_parser.dart' |
| 29 show checkNativeAnnotation, checkJsInteropAnnotation; | 29 show checkNativeAnnotation, checkJsInteropAnnotation; |
| 30 import '../serialization/serialization.dart' | 30 import '../serialization/serialization.dart' |
| 31 show DeserializerPlugin, SerializerPlugin; | 31 show DeserializerPlugin, SerializerPlugin; |
| 32 import '../tree/tree.dart' show Node; | 32 import '../tree/tree.dart' show Node; |
| 33 import '../universe/world_impact.dart' show ImpactStrategy, WorldImpact; | 33 import '../universe/world_impact.dart' show ImpactStrategy, WorldImpact; |
| 34 import 'codegen.dart' show CodegenWorkItem; | 34 import 'codegen.dart' show CodegenWorkItem; |
| 35 import 'registry.dart' show Registry; | 35 import 'registry.dart' show Registry; |
| 36 import 'tasks.dart' show CompilerTask; | 36 import 'tasks.dart' show CompilerTask; |
| 37 import 'work.dart' show ItemCompilationContext; | |
| 38 | 37 |
| 39 abstract class Backend extends Target { | 38 abstract class Backend extends Target { |
| 40 final Compiler compiler; | 39 final Compiler compiler; |
| 41 | 40 |
| 42 Backend(this.compiler); | 41 Backend(this.compiler); |
| 43 | 42 |
| 44 /// Returns true if the backend supports reflection. | 43 /// Returns true if the backend supports reflection. |
| 45 bool get supportsReflection; | 44 bool get supportsReflection; |
| 46 | 45 |
| 47 /// The [ConstantSystem] used to interpret compile-time constants for this | 46 /// The [ConstantSystem] used to interpret compile-time constants for this |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 } | 97 } |
| 99 | 98 |
| 100 /// Generates the output and returns the total size of the generated code. | 99 /// Generates the output and returns the total size of the generated code. |
| 101 int assembleProgram(); | 100 int assembleProgram(); |
| 102 | 101 |
| 103 List<CompilerTask> get tasks; | 102 List<CompilerTask> get tasks; |
| 104 | 103 |
| 105 void onResolutionComplete() {} | 104 void onResolutionComplete() {} |
| 106 void onTypeInferenceComplete() {} | 105 void onTypeInferenceComplete() {} |
| 107 | 106 |
| 108 ItemCompilationContext createItemCompilationContext() { | |
| 109 return new ItemCompilationContext(); | |
| 110 } | |
| 111 | |
| 112 bool classNeedsRti(ClassElement cls); | 107 bool classNeedsRti(ClassElement cls); |
| 113 bool methodNeedsRti(FunctionElement function); | 108 bool methodNeedsRti(FunctionElement function); |
| 114 | 109 |
| 115 /// Enable compilation of code with compile time errors. Returns `true` if | 110 /// Enable compilation of code with compile time errors. Returns `true` if |
| 116 /// supported by the backend. | 111 /// supported by the backend. |
| 117 bool enableCodegenWithErrorsIfSupported(Spannable node); | 112 bool enableCodegenWithErrorsIfSupported(Spannable node); |
| 118 | 113 |
| 119 /// Enable deferred loading. Returns `true` if the backend supports deferred | 114 /// Enable deferred loading. Returns `true` if the backend supports deferred |
| 120 /// loading. | 115 /// loading. |
| 121 bool enableDeferredLoadingIfSupported(Spannable node, Registry registry); | 116 bool enableDeferredLoadingIfSupported(Spannable node, Registry registry); |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 } | 404 } |
| 410 } | 405 } |
| 411 | 406 |
| 412 /// Interface for serialization of backend specific data. | 407 /// Interface for serialization of backend specific data. |
| 413 class BackendSerialization { | 408 class BackendSerialization { |
| 414 const BackendSerialization(); | 409 const BackendSerialization(); |
| 415 | 410 |
| 416 SerializerPlugin get serializer => const SerializerPlugin(); | 411 SerializerPlugin get serializer => const SerializerPlugin(); |
| 417 DeserializerPlugin get deserializer => const DeserializerPlugin(); | 412 DeserializerPlugin get deserializer => const DeserializerPlugin(); |
| 418 } | 413 } |
| OLD | NEW |