Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1268)

Unified Diff: pkg/compiler/lib/src/kernel/kernel_backend_strategy.dart

Issue 2964683003: Split implementation of KernelToElementMapImpl (Closed)
Patch Set: Updated cf. comments Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/kernel/kelements.dart ('k') | pkg/compiler/lib/src/kernel/kernel_strategy.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/kernel/kernel_backend_strategy.dart
diff --git a/pkg/compiler/lib/src/kernel/kernel_backend_strategy.dart b/pkg/compiler/lib/src/kernel/kernel_backend_strategy.dart
index 58be21caf77f6ab1642bea2fbfebff1930d50d9e..5c98628e374d4f1f1786f5d5be65d0419422ee42 100644
--- a/pkg/compiler/lib/src/kernel/kernel_backend_strategy.dart
+++ b/pkg/compiler/lib/src/kernel/kernel_backend_strategy.dart
@@ -20,6 +20,7 @@ import '../js_backend/backend.dart';
import '../js_backend/native_data.dart';
import '../js_emitter/sorter.dart';
import '../js_model/closure.dart';
+import '../js_model/js_strategy.dart';
import '../js_model/locals.dart';
import '../kernel/element_map.dart';
import '../kernel/element_map_impl.dart';
@@ -37,10 +38,19 @@ import '../world.dart';
import 'element_map_impl.dart';
import 'kernel_strategy.dart';
+/// If `true` the [JsStrategy] is used as the backend strategy.
+bool useJsStrategyForTesting = false;
+
/// A backend strategy based on Kernel IR nodes.
abstract class KernelBackendStrategy implements BackendStrategy {
KernelToElementMapForBuilding get elementMap;
GlobalLocalsMap get globalLocalsMapForTesting;
+
+ factory KernelBackendStrategy(Compiler compiler) {
+ return useJsStrategyForTesting
+ ? new JsBackendStrategy(compiler)
+ : new KernelBackendStrategyImpl(compiler);
+ }
}
/// Backend strategy that uses the kernel elements as the backend model.
@@ -56,7 +66,8 @@ class KernelBackendStrategyImpl implements KernelBackendStrategy {
KernelToElementMapForBuilding get elementMap {
KernelFrontEndStrategy frontendStrategy = _compiler.frontendStrategy;
- return frontendStrategy.elementMap;
+ KernelToElementMapImpl elementMap = frontendStrategy.elementMap;
+ return elementMap;
}
GlobalLocalsMap get globalLocalsMapForTesting => _globalLocalsMap;
@@ -267,7 +278,7 @@ class KernelToTypeInferenceMapImpl implements KernelToTypeInferenceMap {
}
class KernelSorter implements Sorter {
- final KernelToElementMapImpl elementMap;
+ final KernelToElementMapForBuilding elementMap;
KernelSorter(this.elementMap);
« no previous file with comments | « pkg/compiler/lib/src/kernel/kelements.dart ('k') | pkg/compiler/lib/src/kernel/kernel_strategy.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698