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

Unified Diff: pkg/compiler/lib/src/js_backend/backend.dart

Issue 1424923004: Add StaticUse for more precise registration of statically known element use. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 years, 1 month 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/enqueue.dart ('k') | pkg/compiler/lib/src/js_backend/checked_mode_helpers.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_backend/backend.dart
diff --git a/pkg/compiler/lib/src/js_backend/backend.dart b/pkg/compiler/lib/src/js_backend/backend.dart
index 6236ed0202a5544865e68d60a9f540e73236b377..ff9380bd4b7a5f0d0f89a05940cc9103a2221468 100644
--- a/pkg/compiler/lib/src/js_backend/backend.dart
+++ b/pkg/compiler/lib/src/js_backend/backend.dart
@@ -1048,7 +1048,7 @@ class JavaScriptBackend extends Backend {
if (constant.isFunction) {
FunctionConstantValue function = constant;
- registry.registerGetOfStaticFunction(function.element);
+ registry.registerStaticUse(new StaticUse.staticTearOff(function.element));
} else if (constant.isInterceptor) {
// An interceptor constant references the class's prototype chain.
InterceptorConstantValue interceptor = constant;
@@ -1066,13 +1066,20 @@ class JavaScriptBackend extends Backend {
if (type is InterfaceType) {
registry.registerInstantiation(instantiatedType);
if (!type.treatAsRaw && classNeedsRti(type.element)) {
- registry.registerStaticInvocation(helpers.setRuntimeTypeInfo);
+ registry.registerStaticUse(
+ new StaticUse.staticInvoke(
+ // TODO(johnniwinther): Find the right [CallStructure].
+ helpers.setRuntimeTypeInfo, null));
}
if (type.element == typeImplementation) {
// If we use a type literal in a constant, the compile time
// constant emitter will generate a call to the createRuntimeType
// helper so we register a use of that.
- registry.registerStaticInvocation(helpers.createRuntimeType);
+ registry.registerStaticUse(
+ new StaticUse.staticInvoke(
+ // TODO(johnniwinther): Find the right [CallStructure].
+
+ helpers.createRuntimeType, null));
}
}
}
@@ -1417,7 +1424,7 @@ class JavaScriptBackend extends Backend {
void enableNoSuchMethod(Enqueuer world) {
enqueue(world, helpers.createInvocationMirror, compiler.globalDependencies);
- world.registerInvocation(
+ world.registerDynamicUse(
new UniverseSelector(Selectors.noSuchMethod_, null));
}
@@ -1432,7 +1439,8 @@ class JavaScriptBackend extends Backend {
// The JavaScript backend of [Isolate.spawnUri] uses the same internal
// implementation as [Isolate.spawn], and fails if it cannot look main up
// by name.
- enqueuer.registerGetOfStaticFunction(compiler.mainFunction);
+ enqueuer.registerStaticUse(
+ new StaticUse.staticTearOff(compiler.mainFunction));
}
if (enqueuer.isResolutionQueue) {
@@ -1588,7 +1596,8 @@ class JavaScriptBackend extends Backend {
// the static variable.
// We also need to register the use of the cyclic-error helper.
compiler.enqueuer.codegen.registerStaticUse(
- helpers.cyclicThrowHelper);
+ new StaticUse.staticInvoke(
+ helpers.cyclicThrowHelper, CallStructure.ONE_ARG));
}
}
@@ -1826,7 +1835,7 @@ class JavaScriptBackend extends Backend {
// We register all the helpers in the resolution queue.
// TODO(13155): Find a way to register fewer helpers.
for (CheckedModeHelper helper in checkedModeHelpers) {
- enqueueInResolution(helper.getElement(compiler), registry);
+ enqueueInResolution(helper.getStaticUse(compiler).element, registry);
}
}
@@ -2821,7 +2830,9 @@ class JavaScriptImpactTransformer extends ImpactTransformer {
for (Element staticUse in backendImpact.staticUses) {
assert(staticUse != null);
backend.registerBackendUse(staticUse);
- worldImpact.registerStaticUse(staticUse);
+ worldImpact.registerStaticUse(
+ // TODO(johnniwinther): Store the correct use in impacts.
+ new StaticUse.foreignUse(staticUse));
}
for (InterfaceType instantiatedType in backendImpact.instantiatedTypes) {
backend.registerBackendUse(instantiatedType.element);
@@ -2900,16 +2911,16 @@ class JavaScriptImpactTransformer extends ImpactTransformer {
CheckedModeHelper helper =
backend.getCheckedModeHelper(type, typeCast: false);
if (helper != null) {
- Element helperElement = helper.getElement(backend.compiler);
- transformed.registerStaticUse(helperElement);
- backend.registerBackendUse(helperElement);
+ StaticUse staticUse = helper.getStaticUse(backend.compiler);
+ transformed.registerStaticUse(staticUse);
+ backend.registerBackendUse(staticUse.element);
}
// We also need the native variant of the check (for DOM types).
helper = backend.getNativeCheckedModeHelper(type, typeCast: false);
if (helper != null) {
- Element helperElement = helper.getElement(backend.compiler);
- transformed.registerStaticUse(helperElement);
- backend.registerBackendUse(helperElement);
+ StaticUse staticUse = helper.getStaticUse(backend.compiler);
+ transformed.registerStaticUse(staticUse);
+ backend.registerBackendUse(staticUse.element);
}
}
if (!type.treatAsRaw || type.containsTypeVariables) {
@@ -2933,18 +2944,6 @@ class JavaScriptImpactTransformer extends ImpactTransformer {
backend.lookupMapAnalysis.registerInstantiatedType(type, registry);
}
- for (Element element in impact.getterForSuperElements) {
- world.registerGetterForSuperMethod(element);
- }
-
- for (Element element in impact.fieldGetters) {
- world.registerFieldGetter(element);
- }
-
- for (Element element in impact.fieldSetters) {
- world.registerFieldSetter(element);
- }
-
for (DartType type in impact.isChecks) {
onIsCheckForCodegen(type, transformed);
}
« no previous file with comments | « pkg/compiler/lib/src/enqueue.dart ('k') | pkg/compiler/lib/src/js_backend/checked_mode_helpers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698