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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/ssa/builder.dart

Issue 201613006: Introduces the new syntax for deferred loading (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Ambigous elements are not top-level. Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of ssa; 5 part of ssa;
6 6
7 /** 7 /**
8 * A special element for the extra parameter taken by intercepted 8 * A special element for the extra parameter taken by intercepted
9 * methods. We need to implement [TypedElement.type] because our 9 * methods. We need to implement [TypedElement.type] because our
10 * optimizers may look at its declared type. 10 * optimizers may look at its declared type.
(...skipping 2950 matching lines...) Expand 10 before | Expand all | Expand 10 after
2961 element.declaration, 2961 element.declaration,
2962 TypeMaskFactory.inferredTypeForElement(element, compiler)); 2962 TypeMaskFactory.inferredTypeForElement(element, compiler));
2963 push(instruction); 2963 push(instruction);
2964 } 2964 }
2965 } 2965 }
2966 } else if (Elements.isInstanceSend(send, elements)) { 2966 } else if (Elements.isInstanceSend(send, elements)) {
2967 HInstruction receiver = generateInstanceSendReceiver(send); 2967 HInstruction receiver = generateInstanceSendReceiver(send);
2968 generateInstanceGetterWithCompiledReceiver( 2968 generateInstanceGetterWithCompiledReceiver(
2969 send, elements.getSelector(send), receiver); 2969 send, elements.getSelector(send), receiver);
2970 } else if (Elements.isStaticOrTopLevelFunction(element)) { 2970 } else if (Elements.isStaticOrTopLevelFunction(element)) {
2971 // TODO(5346): Try to avoid the need for calling [declaration] before 2971 if (element.isDeferredLoaderGetter()) {
floitsch 2014/03/19 21:04:51 Can't you handle this one like all the other forei
sigurdm 2014/03/20 12:26:33 Other foreigns are only handled as calls (not in a
2972 // creating an [HStatic]. 2972 FunctionElement deferredLoader = element;
2973 push(new HStatic(element.declaration, backend.nonNullType)); 2973 Element loadFunction = compiler.loadLibraryFunction;
2974 // TODO(ahe): This should be registered in codegen. 2974 PrefixElement prefixElement = deferredLoader.enclosingElement;
2975 String loadId =
2976 compiler.deferredLoadTask.importDeferName[prefixElement.import];
2977 var inputs = [graph.addConstantString(
2978 new ast.DartString.literal(loadId), compiler)];
2979 push(new HInvokeStatic(loadFunction, inputs, backend.nonNullType,
2980 targetCanThrow: false));
2981 } else {
2982 // TODO(5346): Try to avoid the need for calling [declaration] before
2983 // creating an [HStatic].
2984 push(new HStatic(element.declaration, backend.nonNullType));
2985 // TODO(ahe): This should be registered in codegen.
2986 }
2975 compiler.enqueuer.codegen.registerGetOfStaticFunction( 2987 compiler.enqueuer.codegen.registerGetOfStaticFunction(
2976 element.declaration); 2988 element.declaration);
2977 } else if (Elements.isErroneousElement(element)) { 2989 } else if (Elements.isErroneousElement(element)) {
2978 // An erroneous element indicates an unresolved static getter. 2990 // An erroneous element indicates an unresolved static getter.
2979 generateThrowNoSuchMethod(send, 2991 generateThrowNoSuchMethod(send,
2980 getTargetName(element, 'get'), 2992 getTargetName(element, 'get'),
2981 argumentNodes: const Link<ast.Node>()); 2993 argumentNodes: const Link<ast.Node>());
2982 } else { 2994 } else {
2983 stack.add(localsHandler.readLocal(element)); 2995 stack.add(localsHandler.readLocal(element));
2984 } 2996 }
(...skipping 3131 matching lines...) Expand 10 before | Expand all | Expand 10 after
6116 DartType unaliased = type.unalias(builder.compiler); 6128 DartType unaliased = type.unalias(builder.compiler);
6117 if (unaliased is TypedefType) throw 'unable to unalias $type'; 6129 if (unaliased is TypedefType) throw 'unable to unalias $type';
6118 unaliased.accept(this, builder); 6130 unaliased.accept(this, builder);
6119 } 6131 }
6120 6132
6121 void visitDynamicType(DynamicType type, SsaBuilder builder) { 6133 void visitDynamicType(DynamicType type, SsaBuilder builder) {
6122 ClassElement cls = builder.compiler.findHelper('DynamicRuntimeType'); 6134 ClassElement cls = builder.compiler.findHelper('DynamicRuntimeType');
6123 builder.push(new HDynamicType(type, new TypeMask.exact(cls))); 6135 builder.push(new HDynamicType(type, new TypeMask.exact(cls)));
6124 } 6136 }
6125 } 6137 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698