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

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

Issue 1023673012: Emit diagnostics for bad NSM implementations (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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 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 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 } 1108 }
1109 registerCheckedModeHelpers(registry); 1109 registerCheckedModeHelpers(registry);
1110 } 1110 }
1111 1111
1112 onResolutionComplete() { 1112 onResolutionComplete() {
1113 super.onResolutionComplete(); 1113 super.onResolutionComplete();
1114 computeMembersNeededForReflection(); 1114 computeMembersNeededForReflection();
1115 rti.computeClassesNeedingRti(); 1115 rti.computeClassesNeedingRti();
1116 } 1116 }
1117 1117
1118 onTypeInferenceComplete() {
1119 super.onTypeInferenceComplete();
1120 noSuchMethodRegistry.onTypeInferenceComplete();
1121 }
1122
1118 void registerGetRuntimeTypeArgument(Registry registry) { 1123 void registerGetRuntimeTypeArgument(Registry registry) {
1119 enqueueInResolution(getGetRuntimeTypeArgument(), registry); 1124 enqueueInResolution(getGetRuntimeTypeArgument(), registry);
1120 enqueueInResolution(getGetTypeArgumentByIndex(), registry); 1125 enqueueInResolution(getGetTypeArgumentByIndex(), registry);
1121 enqueueInResolution(getCopyTypeArguments(), registry); 1126 enqueueInResolution(getCopyTypeArguments(), registry);
1122 } 1127 }
1123 1128
1124 void registerCallMethodWithFreeTypeVariables( 1129 void registerCallMethodWithFreeTypeVariables(
1125 Element callMethod, 1130 Element callMethod,
1126 Enqueuer enqueuer, 1131 Enqueuer enqueuer,
1127 Registry registry) { 1132 Registry registry) {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
1209 DartType bound) { 1214 DartType bound) {
1210 rti.registerTypeVariableBoundsSubtypeCheck(typeArgument, bound); 1215 rti.registerTypeVariableBoundsSubtypeCheck(typeArgument, bound);
1211 } 1216 }
1212 1217
1213 void registerCheckDeferredIsLoaded(Registry registry) { 1218 void registerCheckDeferredIsLoaded(Registry registry) {
1214 enqueueInResolution(getCheckDeferredIsLoaded(), registry); 1219 enqueueInResolution(getCheckDeferredIsLoaded(), registry);
1215 // Also register the types of the arguments passed to this method. 1220 // Also register the types of the arguments passed to this method.
1216 enqueueClass(compiler.enqueuer.resolution, compiler.stringClass, registry); 1221 enqueueClass(compiler.enqueuer.resolution, compiler.stringClass, registry);
1217 } 1222 }
1218 1223
1219 void registerNoSuchMethod(Element noSuchMethod) { 1224 void registerNoSuchMethod(FunctionElement noSuchMethod) {
1220 noSuchMethodRegistry.registerNoSuchMethod(noSuchMethod); 1225 noSuchMethodRegistry.registerNoSuchMethod(noSuchMethod);
1221 } 1226 }
1222 1227
1223 void enableNoSuchMethod(Enqueuer world) { 1228 void enableNoSuchMethod(Enqueuer world) {
1224 enqueue(world, getCreateInvocationMirror(), compiler.globalDependencies); 1229 enqueue(world, getCreateInvocationMirror(), compiler.globalDependencies);
1225 world.registerInvocation(compiler.noSuchMethodSelector); 1230 world.registerInvocation(compiler.noSuchMethodSelector);
1226 } 1231 }
1227 1232
1228 void enableIsolateSupport(Enqueuer enqueuer) { 1233 void enableIsolateSupport(Enqueuer enqueuer) {
1229 // TODO(floitsch): We should also ensure that the class IsolateMessage is 1234 // TODO(floitsch): We should also ensure that the class IsolateMessage is
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1392 * 1397 *
1393 * Invariant: [element] must be a declaration element. 1398 * Invariant: [element] must be a declaration element.
1394 */ 1399 */
1395 String assembleCode(Element element) { 1400 String assembleCode(Element element) {
1396 assert(invariant(element, element.isDeclaration)); 1401 assert(invariant(element, element.isDeclaration));
1397 return jsAst.prettyPrint(generatedCode[element], compiler).getText(); 1402 return jsAst.prettyPrint(generatedCode[element], compiler).getText();
1398 } 1403 }
1399 1404
1400 int assembleProgram() { 1405 int assembleProgram() {
1401 int programSize = emitter.assembleProgram(); 1406 int programSize = emitter.assembleProgram();
1407 noSuchMethodRegistry.emitDiagnostic();
1402 int totalMethodCount = generatedCode.length; 1408 int totalMethodCount = generatedCode.length;
1403 if (totalMethodCount != preMirrorsMethodCount) { 1409 if (totalMethodCount != preMirrorsMethodCount) {
1404 int mirrorCount = totalMethodCount - preMirrorsMethodCount; 1410 int mirrorCount = totalMethodCount - preMirrorsMethodCount;
1405 double percentage = (mirrorCount / totalMethodCount) * 100; 1411 double percentage = (mirrorCount / totalMethodCount) * 100;
1406 compiler.reportHint( 1412 compiler.reportHint(
1407 compiler.mainApp, MessageKind.MIRROR_BLOAT, 1413 compiler.mainApp, MessageKind.MIRROR_BLOAT,
1408 {'count': mirrorCount, 1414 {'count': mirrorCount,
1409 'total': totalMethodCount, 1415 'total': totalMethodCount,
1410 'percentage': percentage.round()}); 1416 'percentage': percentage.round()});
1411 for (LibraryElement library in compiler.libraryLoader.libraries) { 1417 for (LibraryElement library in compiler.libraryLoader.libraries) {
(...skipping 1446 matching lines...) Expand 10 before | Expand all | Expand 10 after
2858 } 2864 }
2859 } 2865 }
2860 2866
2861 /// Records that [constant] is used by the element behind [registry]. 2867 /// Records that [constant] is used by the element behind [registry].
2862 class Dependency { 2868 class Dependency {
2863 final ConstantValue constant; 2869 final ConstantValue constant;
2864 final Element annotatedElement; 2870 final Element annotatedElement;
2865 2871
2866 const Dependency(this.constant, this.annotatedElement); 2872 const Dependency(this.constant, this.annotatedElement);
2867 } 2873 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/compiler.dart ('k') | pkg/compiler/lib/src/js_backend/no_such_method_registry.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698