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

Unified Diff: pkg/compiler/lib/src/js_model/js_strategy.dart

Issue 2938203003: Compute KernelClosureRepresentationInfo.variableIsUsedInTryOrSync (Closed)
Patch Set: Merge KernelClosureConversionTask and KernelClosureDataLookup Created 3 years, 6 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
Index: pkg/compiler/lib/src/js_model/js_strategy.dart
diff --git a/pkg/compiler/lib/src/js_model/js_strategy.dart b/pkg/compiler/lib/src/js_model/js_strategy.dart
index 505ea3bbd6a1f6d15b78073150c66f8cc4423cbf..2bff5fdcc3d21dc453e62aadeac5fd0ee237d74f 100644
--- a/pkg/compiler/lib/src/js_model/js_strategy.dart
+++ b/pkg/compiler/lib/src/js_model/js_strategy.dart
@@ -20,6 +20,7 @@ import '../js_backend/backend_usage.dart';
import '../js_backend/constant_system_javascript.dart';
import '../js_backend/interceptor_data.dart';
import '../js_backend/native_data.dart';
+import '../kernel/closure.dart';
import '../kernel/element_map.dart';
import '../kernel/element_map_impl.dart';
import '../kernel/kernel_backend_strategy.dart';
@@ -36,9 +37,22 @@ class JsBackendStrategy implements BackendStrategy {
final JsToFrontendMap _map = new JsToFrontendMapImpl();
ElementEnvironment _elementEnvironment;
CommonElements _commonElements;
+ KernelToElementMap __elementMap;
Emily Fortuna 2017/06/19 17:44:41 not thrilled with the double underscore naming con
Johnni Winther 2017/06/20 10:33:12 Acknowledged.
+ ClosureConversionTask _closureDataLookup;
+ GlobalLocalsMap _globalLocalsMap = new GlobalLocalsMap();
JsBackendStrategy(this._compiler);
+ KernelToElementMap get _elementMap {
+ if (__elementMap == null) {
+ KernelFrontEndStrategy strategy = _compiler.frontendStrategy;
+ KernelToElementMap elementMap = strategy.elementMap;
+ __elementMap = new JsKernelToElementMap(
+ _map, _elementEnvironment, _commonElements, elementMap);
+ }
+ return __elementMap;
+ }
+
@override
ClosedWorldRefiner createClosedWorldRefiner(ClosedWorld closedWorld) {
_elementEnvironment =
@@ -116,8 +130,9 @@ class JsBackendStrategy implements BackendStrategy {
}
@override
- ClosureConversionTask createClosureConversionTask(Compiler compiler) =>
- new KernelClosureConversionTask(compiler.measurer);
+ ClosureConversionTask get closureDataLookup =>
+ _closureDataLookup ??= new KernelClosureConversionTask(
+ _compiler.measurer, _elementMap, _globalLocalsMap);
@override
SourceInformationStrategy get sourceInformationStrategy =>
@@ -126,11 +141,8 @@ class JsBackendStrategy implements BackendStrategy {
@override
SsaBuilder createSsaBuilder(CompilerTask task, JavaScriptBackend backend,
SourceInformationStrategy sourceInformationStrategy) {
- KernelFrontEndStrategy strategy = backend.compiler.frontendStrategy;
- KernelToElementMap elementMap = strategy.elementMap;
- JsKernelToElementMap jsElementMap = new JsKernelToElementMap(
- _map, _elementEnvironment, _commonElements, elementMap);
- return new KernelSsaBuilder(task, backend.compiler, jsElementMap);
+ return new KernelSsaBuilder(
+ task, backend.compiler, _elementMap, _globalLocalsMap);
}
@override
@@ -143,9 +155,8 @@ class JsBackendStrategy implements BackendStrategy {
NativeBasicData nativeBasicData,
ClosedWorld closedWorld,
SelectorConstraintsStrategy selectorConstraintsStrategy) {
- KernelFrontEndStrategy frontendStrategy = _compiler.frontendStrategy;
return new KernelCodegenWorldBuilder(
- frontendStrategy.elementMap,
+ _elementMap,
closedWorld.elementEnvironment,
nativeBasicData,
closedWorld,

Powered by Google App Engine
This is Rietveld 408576698