Chromium Code Reviews| Index: dart/sdk/lib/_internal/compiler/implementation/enqueue.dart |
| diff --git a/dart/sdk/lib/_internal/compiler/implementation/enqueue.dart b/dart/sdk/lib/_internal/compiler/implementation/enqueue.dart |
| index 615ffe8e2e10cc9b308168fa6887986d89af11b9..80782aa6d027126fe72544094eaf855b55330fc7 100644 |
| --- a/dart/sdk/lib/_internal/compiler/implementation/enqueue.dart |
| +++ b/dart/sdk/lib/_internal/compiler/implementation/enqueue.dart |
| @@ -67,7 +67,8 @@ abstract class Enqueuer { |
| // runtime type. |
| if (element.isGetter() && element.name == Compiler.RUNTIME_TYPE) { |
| compiler.enabledRuntimeType = true; |
| - compiler.backend.registerRuntimeType(); |
| + // TODO(ahe): Record precise dependency here. |
| + compiler.backend.registerRuntimeType(compiler.globalDependencies); |
| } else if (element == compiler.functionApplyMethod) { |
| compiler.enabledFunctionApply = true; |
| } else if (element == compiler.invokeOnMethod) { |
| @@ -86,18 +87,18 @@ abstract class Enqueuer { |
| // the work list'? |
| bool addElementToWorkList(Element element, [TreeElements elements]); |
| - void registerInstantiatedType(InterfaceType type) { |
| + void registerInstantiatedType(InterfaceType type, TreeElements elements) { |
| universe.instantiatedTypes.add(type); |
| - registerInstantiatedClass(type.element); |
| + registerInstantiatedClass(type.element, elements); |
| } |
| - void registerInstantiatedClass(ClassElement cls) { |
| + void registerInstantiatedClass(ClassElement cls, TreeElements elements) { |
| if (universe.instantiatedClasses.contains(cls)) return; |
| if (!cls.isAbstract(compiler)) { |
| universe.instantiatedClasses.add(cls); |
| } |
| onRegisterInstantiatedClass(cls); |
| - compiler.backend.registerInstantiatedClass(cls, this); |
| + compiler.backend.registerInstantiatedClass(cls, this, elements); |
| } |
| bool checkNoEnqueuedInvokedInstanceMethods() { |
| @@ -150,7 +151,9 @@ abstract class Enqueuer { |
| // We will emit a closure, so make sure the closure class is |
| // generated. |
| compiler.closureClass.ensureResolved(compiler); |
| - registerInstantiatedClass(compiler.closureClass); |
| + registerInstantiatedClass(compiler.closureClass, |
| + // Precise dependency is not important here. |
| + compiler.globalDependencies); |
| return addToWorkList(member); |
| } |
| } else if (member.kind == ElementKind.GETTER) { |
| @@ -355,19 +358,19 @@ abstract class Enqueuer { |
| universe.fieldSetters.add(element); |
| } |
| - void registerIsCheck(DartType type) { |
| + void registerIsCheck(DartType type, TreeElements elements) { |
| // Even in checked mode, type annotations for return type and argument |
| // types do not imply type checks, so there should never be a check |
| // against the type variable of a typedef. |
| assert(type.kind != TypeKind.TYPE_VARIABLE || |
| !type.element.enclosingElement.isTypedef()); |
| universe.isChecks.add(type); |
| - compiler.backend.registerIsCheck(type, this); |
| + compiler.backend.registerIsCheck(type, this, elements); |
| } |
| - void registerAsCheck(DartType type) { |
| - registerIsCheck(type); |
| - compiler.backend.registerAsCheck(type); |
| + void registerAsCheck(DartType type, TreeElements elements) { |
| + registerIsCheck(type, elements); |
| + compiler.backend.registerAsCheck(type, elements); |
| } |
| void forEach(f(WorkItem work)); |
| @@ -412,6 +415,9 @@ class ResolutionEnqueuer extends Enqueuer { |
| element = cls.methodElement; |
| } |
| Element owner = element.getOutermostEnclosingMemberOrTopLevel(); |
| + if (owner == null) { |
| + owner = element; |
| + } |
| return resolvedElements[owner.declaration]; |
| } |
| @@ -467,8 +473,11 @@ class ResolutionEnqueuer extends Enqueuer { |
| void enableIsolateSupport(LibraryElement element) { |
| compiler.isolateLibrary = element.patch; |
| - addToWorkList( |
| - compiler.isolateHelperLibrary.find(Compiler.START_ROOT_ISOLATE)); |
| + var startRootIsolate = |
| + compiler.isolateHelperLibrary.find(Compiler.START_ROOT_ISOLATE); |
| + addToWorkList(startRootIsolate); |
| + // TODO(ahe): This doesn't seem to be necessary. Why is that? |
|
ahe
2013/03/07 10:24:13
It is necessary, but right now the implementation
|
| + compiler.globalDependencies.registerBackendDependency(startRootIsolate); |
| addToWorkList(compiler.isolateHelperLibrary.find( |
| const SourceString('_currentIsolate'))); |
| addToWorkList(compiler.isolateHelperLibrary.find( |