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

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

Issue 1146813009: Introduce WorldImpact (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Rebased Created 5 years, 7 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/enqueue.dart ('k') | pkg/compiler/lib/src/js_backend/codegen/glue.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 3bc8c0f28a1957403ca1c30775e7036eedd30d82..0101ab0a7ef9cf44d125f099b0c16692ba980220 100644
--- a/pkg/compiler/lib/src/js_backend/backend.dart
+++ b/pkg/compiler/lib/src/js_backend/backend.dart
@@ -1181,15 +1181,17 @@ class JavaScriptBackend extends Backend {
}
void registerBoundClosure(Enqueuer enqueuer) {
- enqueuer.registerInstantiatedClass(
- boundClosureClass,
+ boundClosureClass.ensureResolved(compiler);
+ enqueuer.registerInstantiatedType(
+ boundClosureClass.rawType,
// Precise dependency is not important here.
compiler.globalDependencies);
}
void registerGetOfStaticFunction(Enqueuer enqueuer) {
- enqueuer.registerInstantiatedClass(closureClass,
- compiler.globalDependencies);
+ closureClass.ensureResolved(compiler);
+ enqueuer.registerInstantiatedType(
+ closureClass.rawType, compiler.globalDependencies);
}
void registerComputeSignature(Enqueuer enqueuer, Registry registry) {
@@ -1371,28 +1373,31 @@ class JavaScriptBackend extends Backend {
/// Register instantiation of [cls] in [enqueuer].
///
/// This method calls [registerBackendUse].
- void enqueueClass(Enqueuer enqueuer, Element cls, Registry registry) {
+ void enqueueClass(Enqueuer enqueuer, ClassElement cls, Registry registry) {
if (cls == null) return;
registerBackendUse(cls);
helpersUsed.add(cls.declaration);
if (cls.declaration != cls.implementation) {
helpersUsed.add(cls.implementation);
}
- enqueuer.registerInstantiatedClass(cls, registry);
+ cls.ensureResolved(compiler);
+ enqueuer.registerInstantiatedType(cls.rawType, registry);
}
- void codegen(CodegenWorkItem work) {
+ WorldImpact codegen(CodegenWorkItem work) {
Element element = work.element;
if (compiler.elementHasCompileTimeError(element)) {
generatedCode[element] = jsAst.js(
"function () { throw new Error('Compile time error in $element') }");
- return;
+ return const WorldImpact();
}
var kind = element.kind;
- if (kind == ElementKind.TYPEDEF) return;
+ if (kind == ElementKind.TYPEDEF) {
+ return const WorldImpact();
+ }
if (element.isConstructor && element.enclosingClass == jsNullClass) {
// Work around a problem compiling JSNull's constructor.
- return;
+ return const WorldImpact();
}
if (kind.category == ElementCategory.VARIABLE) {
ConstantExpression initialValue =
@@ -1403,7 +1408,9 @@ class JavaScriptBackend extends Backend {
// We don't need to generate code for static or top-level
// variables. For instance variables, we may need to generate
// the checked setter.
- if (Elements.isStaticOrTopLevel(element)) return;
+ if (Elements.isStaticOrTopLevel(element)) {
+ return const WorldImpact();
+ }
} else {
// If the constant-handler was not able to produce a result we have to
// go through the builder (below) to generate the lazy initializer for
@@ -1413,6 +1420,7 @@ class JavaScriptBackend extends Backend {
}
}
generatedCode[element] = functionCompiler.compile(work);
+ return const WorldImpact();
}
native.NativeEnqueuer nativeResolutionEnqueuer(Enqueuer world) {
@@ -2637,13 +2645,18 @@ class JavaScriptBackend extends Backend {
enqueue(enqueuer, getCompleterConstructor(), registry);
enqueue(enqueuer, getStreamIteratorConstructor(), registry);
} else if (element.asyncMarker == AsyncMarker.SYNC_STAR) {
- enqueuer.registerInstantiatedClass(getSyncStarIterable(), registry);
+ ClassElement clsSyncStarIterable = getSyncStarIterable();
+ clsSyncStarIterable.ensureResolved(compiler);
+ enqueuer.registerInstantiatedType(clsSyncStarIterable.rawType, registry);
enqueue(enqueuer, getSyncStarIterableConstructor(), registry);
enqueue(enqueuer, getEndOfIteration(), registry);
enqueue(enqueuer, getYieldStar(), registry);
enqueue(enqueuer, getSyncStarUncaughtError(), registry);
} else if (element.asyncMarker == AsyncMarker.ASYNC_STAR) {
- enqueuer.registerInstantiatedClass(getASyncStarController(), registry);
+ ClassElement clsASyncStarController = getASyncStarController();
+ clsASyncStarController.ensureResolved(compiler);
+ enqueuer.registerInstantiatedType(
+ clsASyncStarController.rawType, registry);
enqueue(enqueuer, getAsyncStarHelper(), registry);
enqueue(enqueuer, getStreamOfController(), registry);
enqueue(enqueuer, getYieldSingle(), registry);
« no previous file with comments | « pkg/compiler/lib/src/enqueue.dart ('k') | pkg/compiler/lib/src/js_backend/codegen/glue.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698