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

Side by Side Diff: pkg/compiler/lib/src/js_backend/backend.dart

Issue 804333002: Add CoreTypes interface. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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 js_backend; 5 part of js_backend;
6 6
7 const VERBOSE_OPTIMIZER_HINTS = false; 7 const VERBOSE_OPTIMIZER_HINTS = false;
8 8
9 const bool USE_CPS_IR = const bool.fromEnvironment("USE_CPS_IR"); 9 const bool USE_CPS_IR = const bool.fromEnvironment("USE_CPS_IR");
10 10
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 757
758 void registerCompileTimeConstant(ConstantValue constant, Registry registry) { 758 void registerCompileTimeConstant(ConstantValue constant, Registry registry) {
759 registerCompileTimeConstantInternal(constant, registry); 759 registerCompileTimeConstantInternal(constant, registry);
760 for (ConstantValue dependency in constant.getDependencies()) { 760 for (ConstantValue dependency in constant.getDependencies()) {
761 registerCompileTimeConstant(dependency, registry); 761 registerCompileTimeConstant(dependency, registry);
762 } 762 }
763 } 763 }
764 764
765 void registerCompileTimeConstantInternal(ConstantValue constant, 765 void registerCompileTimeConstantInternal(ConstantValue constant,
766 Registry registry) { 766 Registry registry) {
767 DartType type = constant.computeType(compiler); 767 DartType type = constant.getType(compiler.coreTypes);
768 registerInstantiatedConstantType(type, registry); 768 registerInstantiatedConstantType(type, registry);
769 769
770 if (constant.isFunction) { 770 if (constant.isFunction) {
771 FunctionConstantValue function = constant; 771 FunctionConstantValue function = constant;
772 registry.registerGetOfStaticFunction(function.element); 772 registry.registerGetOfStaticFunction(function.element);
773 } else if (constant.isInterceptor) { 773 } else if (constant.isInterceptor) {
774 // An interceptor constant references the class's prototype chain. 774 // An interceptor constant references the class's prototype chain.
775 InterceptorConstantValue interceptor = constant; 775 InterceptorConstantValue interceptor = constant;
776 registerInstantiatedConstantType(interceptor.dispatchedType, registry); 776 registerInstantiatedConstantType(interceptor.dispatchedType, registry);
777 } else if (constant.isType) { 777 } else if (constant.isType) {
(...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after
1944 bool matchesMirrorsMetaTarget(Element element) { 1944 bool matchesMirrorsMetaTarget(Element element) {
1945 if (metaTargetsUsed.isEmpty) return false; 1945 if (metaTargetsUsed.isEmpty) return false;
1946 for (Link link = element.metadata; !link.isEmpty; link = link.tail) { 1946 for (Link link = element.metadata; !link.isEmpty; link = link.tail) {
1947 MetadataAnnotation metadata = link.head; 1947 MetadataAnnotation metadata = link.head;
1948 // TODO(kasperl): It would be nice if we didn't have to resolve 1948 // TODO(kasperl): It would be nice if we didn't have to resolve
1949 // all metadata but only stuff that potentially would match one 1949 // all metadata but only stuff that potentially would match one
1950 // of the used meta targets. 1950 // of the used meta targets.
1951 metadata.ensureResolved(compiler); 1951 metadata.ensureResolved(compiler);
1952 ConstantValue value = metadata.constant.value; 1952 ConstantValue value = metadata.constant.value;
1953 if (value == null) continue; 1953 if (value == null) continue;
1954 DartType type = value.computeType(compiler); 1954 DartType type = value.getType(compiler.coreTypes);
1955 if (metaTargetsUsed.contains(type.element)) return true; 1955 if (metaTargetsUsed.contains(type.element)) return true;
1956 } 1956 }
1957 return false; 1957 return false;
1958 } 1958 }
1959 1959
1960 /** 1960 /**
1961 * Visits all classes and computes whether its members are needed for 1961 * Visits all classes and computes whether its members are needed for
1962 * reflection. 1962 * reflection.
1963 * 1963 *
1964 * We have to precompute this set as we cannot easily answer the need for 1964 * We have to precompute this set as we cannot easily answer the need for
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
2506 } 2506 }
2507 } 2507 }
2508 2508
2509 /// Records that [constant] is used by the element behind [registry]. 2509 /// Records that [constant] is used by the element behind [registry].
2510 class Dependency { 2510 class Dependency {
2511 final ConstantValue constant; 2511 final ConstantValue constant;
2512 final Element annotatedElement; 2512 final Element annotatedElement;
2513 2513
2514 const Dependency(this.constant, this.annotatedElement); 2514 const Dependency(this.constant, this.annotatedElement);
2515 } 2515 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698