| Index: dart/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
|
| diff --git a/dart/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart b/dart/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
|
| index 50433d40edc17a048f8de9a1e5f7ab83ea73abc7..7bfdff3ca282d46d1e9c47bb8ea965273d179f88 100644
|
| --- a/dart/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
|
| +++ b/dart/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
|
| @@ -852,7 +852,7 @@ class JavaScriptBackend extends Backend {
|
| },
|
| includeSuperMembers: true);
|
| }
|
| - enqueuer.registerInstantiatedClass(cls);
|
| + enqueuer.registerInstantiatedClass(cls, compiler.globalDependencies);
|
| }
|
|
|
| void registerSpecializedGetInterceptor(Set<ClassElement> classes) {
|
| @@ -877,7 +877,9 @@ class JavaScriptBackend extends Backend {
|
| argumentTypes.registerDynamicInvocation(types, new Selector.noSuchMethod());
|
| }
|
|
|
| - void registerInstantiatedClass(ClassElement cls, Enqueuer enqueuer) {
|
| + void registerInstantiatedClass(ClassElement cls,
|
| + Enqueuer enqueuer,
|
| + TreeElements elements) {
|
| if (!seenAnyClass) {
|
| initializeNoSuchMethod();
|
| seenAnyClass = true;
|
| @@ -901,13 +903,13 @@ class JavaScriptBackend extends Backend {
|
| enqueuer.registerStaticUse(
|
| compiler.findHelper(const SourceString('iae')));
|
| } else if (cls == compiler.functionClass) {
|
| - enqueuer.registerInstantiatedClass(compiler.closureClass);
|
| + enqueuer.registerInstantiatedClass(compiler.closureClass, elements);
|
| } else if (cls == compiler.mapClass) {
|
| // The backend will use a literal list to initialize the entries
|
| // of the map.
|
| - enqueuer.registerInstantiatedClass(compiler.listClass);
|
| - enqueuer.registerInstantiatedClass(compiler.mapLiteralClass);
|
| - enqueueInResolution(getMapMaker());
|
| + enqueuer.registerInstantiatedClass(compiler.listClass, elements);
|
| + enqueuer.registerInstantiatedClass(compiler.mapLiteralClass, elements);
|
| + enqueueInResolution(getMapMaker(), elements);
|
| }
|
| }
|
| ClassElement result = null;
|
| @@ -939,7 +941,7 @@ class JavaScriptBackend extends Backend {
|
| cls.forEachLocalMember((Element member) {
|
| if (!member.isInstanceMember() || !member.isField()) return;
|
| DartType type = member.computeType(compiler);
|
| - enqueuer.registerIsCheck(type);
|
| + enqueuer.registerIsCheck(type, compiler.globalDependencies);
|
| });
|
| }
|
| }
|
| @@ -958,7 +960,8 @@ class JavaScriptBackend extends Backend {
|
| jsIndexingBehaviorInterface =
|
| compiler.findHelper(const SourceString('JavaScriptIndexingBehavior'));
|
| if (jsIndexingBehaviorInterface != null) {
|
| - world.registerIsCheck(jsIndexingBehaviorInterface.computeType(compiler));
|
| + world.registerIsCheck(jsIndexingBehaviorInterface.computeType(compiler),
|
| + compiler.globalDependencies);
|
| }
|
|
|
| if (compiler.enableTypeAssertions) {
|
| @@ -971,54 +974,57 @@ class JavaScriptBackend extends Backend {
|
| }
|
| }
|
|
|
| - void registerStringInterpolation() {
|
| - enqueueInResolution(getStringInterpolationHelper());
|
| + void registerStringInterpolation(TreeElements elements) {
|
| + enqueueInResolution(getStringInterpolationHelper(), elements);
|
| }
|
|
|
| - void registerCatchStatement() {
|
| - enqueueInResolution(getExceptionUnwrapper());
|
| + void registerCatchStatement(TreeElements elements) {
|
| + enqueueInResolution(getExceptionUnwrapper(), elements);
|
| }
|
|
|
| - void registerThrow() {
|
| - enqueueInResolution(getThrowHelper());
|
| + void registerThrow(TreeElements elements) {
|
| + enqueueInResolution(getThrowHelper(), elements);
|
| }
|
|
|
| - void registerLazyField() {
|
| - enqueueInResolution(getCyclicThrowHelper());
|
| + void registerLazyField(TreeElements elements) {
|
| + enqueueInResolution(getCyclicThrowHelper(), elements);
|
| }
|
|
|
| - void registerTypeLiteral() {
|
| - enqueueInResolution(getCreateRuntimeType());
|
| + void registerTypeLiteral(TreeElements elements) {
|
| + enqueueInResolution(getCreateRuntimeType(), elements);
|
| }
|
|
|
| - void registerStackTraceInCatch() {
|
| - enqueueInResolution(getTraceFromException());
|
| + void registerStackTraceInCatch(TreeElements elements) {
|
| + enqueueInResolution(getTraceFromException(), elements);
|
| }
|
|
|
| - void registerSetRuntimeType() {
|
| - enqueueInResolution(getSetRuntimeTypeInfo());
|
| + void registerSetRuntimeType(TreeElements elements) {
|
| + enqueueInResolution(getSetRuntimeTypeInfo(), elements);
|
| }
|
|
|
| - void registerGetRuntimeTypeArgument() {
|
| - enqueueInResolution(getGetRuntimeTypeArgument());
|
| + void registerGetRuntimeTypeArgument(TreeElements elements) {
|
| + enqueueInResolution(getGetRuntimeTypeArgument(), elements);
|
| }
|
|
|
| - void registerRuntimeType() {
|
| - enqueueInResolution(getSetRuntimeTypeInfo());
|
| - enqueueInResolution(getGetRuntimeTypeInfo());
|
| - enqueueInResolution(getGetRuntimeTypeArgument());
|
| - compiler.enqueuer.resolution.registerInstantiatedClass(compiler.listClass);
|
| + void registerRuntimeType(TreeElements elements) {
|
| + enqueueInResolution(getSetRuntimeTypeInfo(), elements);
|
| + enqueueInResolution(getGetRuntimeTypeInfo(), elements);
|
| + enqueueInResolution(getGetRuntimeTypeArgument(), elements);
|
| + compiler.enqueuer.resolution.registerInstantiatedClass(
|
| + compiler.listClass, elements);
|
| }
|
|
|
| - void registerIsCheck(DartType type, Enqueuer world) {
|
| + void registerIsCheck(DartType type, Enqueuer world, TreeElements elements) {
|
| bool isTypeVariable = type.kind == TypeKind.TYPE_VARIABLE;
|
| if (!type.isRaw || isTypeVariable) {
|
| - enqueueInResolution(getSetRuntimeTypeInfo());
|
| - enqueueInResolution(getGetRuntimeTypeInfo());
|
| - enqueueInResolution(getGetRuntimeTypeArgument());
|
| - enqueueInResolution(getCheckArguments());
|
| - if (isTypeVariable) enqueueInResolution(getGetObjectIsSubtype());
|
| - world.registerInstantiatedClass(compiler.listClass);
|
| + enqueueInResolution(getSetRuntimeTypeInfo(), elements);
|
| + enqueueInResolution(getGetRuntimeTypeInfo(), elements);
|
| + enqueueInResolution(getGetRuntimeTypeArgument(), elements);
|
| + enqueueInResolution(getCheckArguments(), elements);
|
| + if (isTypeVariable) {
|
| + enqueueInResolution(getGetObjectIsSubtype(), elements);
|
| + }
|
| + world.registerInstantiatedClass(compiler.listClass, elements);
|
| }
|
| // [registerIsCheck] is also called for checked mode checks, so we
|
| // need to register checked mode helpers.
|
| @@ -1031,46 +1037,55 @@ class JavaScriptBackend extends Backend {
|
| }
|
| }
|
|
|
| - void registerAsCheck(DartType type) {
|
| + void registerAsCheck(DartType type, TreeElements elements) {
|
| Element e = getCheckedModeHelper(type, typeCast: true);
|
| - enqueueInResolution(e);
|
| + enqueueInResolution(e, elements);
|
| // We also need the native variant of the check (for DOM types).
|
| e = getNativeCheckedModeHelper(type, typeCast: true);
|
| - enqueueInResolution(e);
|
| + enqueueInResolution(e, elements);
|
| }
|
|
|
| - void registerThrowNoSuchMethod() {
|
| - enqueueInResolution(getThrowNoSuchMethod());
|
| + void registerThrowNoSuchMethod(TreeElements elements) {
|
| + enqueueInResolution(getThrowNoSuchMethod(), elements);
|
| }
|
|
|
| - void registerThrowRuntimeError() {
|
| - enqueueInResolution(getThrowRuntimeError());
|
| + void registerThrowRuntimeError(TreeElements elements) {
|
| + enqueueInResolution(getThrowRuntimeError(), elements);
|
| }
|
|
|
| - void registerAbstractClassInstantiation() {
|
| - enqueueInResolution(getThrowAbstractClassInstantiationError());
|
| + void registerAbstractClassInstantiation(TreeElements elements) {
|
| + enqueueInResolution(getThrowAbstractClassInstantiationError(), elements);
|
| }
|
|
|
| - void registerFallThroughError() {
|
| - enqueueInResolution(getFallThroughError());
|
| + void registerFallThroughError(TreeElements elements) {
|
| + enqueueInResolution(getFallThroughError(), elements);
|
| }
|
|
|
| - void registerSuperNoSuchMethod() {
|
| - enqueueInResolution(getCreateInvocationMirror());
|
| + void registerSuperNoSuchMethod(TreeElements elements) {
|
| + enqueueInResolution(getCreateInvocationMirror(), elements);
|
| enqueueInResolution(
|
| - compiler.objectClass.lookupLocalMember(Compiler.NO_SUCH_METHOD));
|
| - compiler.enqueuer.resolution.registerInstantiatedClass(compiler.listClass);
|
| + compiler.objectClass.lookupLocalMember(Compiler.NO_SUCH_METHOD),
|
| + elements);
|
| + compiler.enqueuer.resolution.registerInstantiatedClass(
|
| + compiler.listClass, elements);
|
| }
|
|
|
| - void enqueueInResolution(Element e) {
|
| - if (e != null) compiler.enqueuer.resolution.addToWorkList(e);
|
| + void enqueueInResolution(Element e, TreeElements elements) {
|
| + if (e == null) return;
|
| + ResolutionEnqueuer enqueuer = compiler.enqueuer.resolution;
|
| + enqueuer.addToWorkList(e);
|
| + elements.registerBackendDependency(e);
|
| }
|
|
|
| - void registerConstantMap() {
|
| + void registerConstantMap(TreeElements elements) {
|
| Element e = compiler.findHelper(const SourceString('ConstantMap'));
|
| - if (e != null) compiler.enqueuer.resolution.registerInstantiatedClass(e);
|
| + if (e != null) {
|
| + compiler.enqueuer.resolution.registerInstantiatedClass(e, elements);
|
| + }
|
| e = compiler.findHelper(const SourceString('ConstantProtoMap'));
|
| - if (e != null) compiler.enqueuer.resolution.registerInstantiatedClass(e);
|
| + if (e != null) {
|
| + compiler.enqueuer.resolution.registerInstantiatedClass(e, elements);
|
| + }
|
| }
|
|
|
| void codegen(CodegenWorkItem work) {
|
|
|