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

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

Issue 1051223003: dartj2s: add constructor helpers for map literals with no type parameters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added comment. 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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/ssa/builder.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 Element jsStringToString; 304 Element jsStringToString;
305 Element jsStringOperatorAdd; 305 Element jsStringOperatorAdd;
306 Element objectEquals; 306 Element objectEquals;
307 307
308 ClassElement typeLiteralClass; 308 ClassElement typeLiteralClass;
309 ClassElement mapLiteralClass; 309 ClassElement mapLiteralClass;
310 ClassElement constMapLiteralClass; 310 ClassElement constMapLiteralClass;
311 ClassElement typeVariableClass; 311 ClassElement typeVariableClass;
312 ConstructorElement mapLiteralConstructor; 312 ConstructorElement mapLiteralConstructor;
313 ConstructorElement mapLiteralConstructorEmpty; 313 ConstructorElement mapLiteralConstructorEmpty;
314 Element mapLiteralUntypedMaker;
315 Element mapLiteralUntypedEmptyMaker;
314 316
315 ClassElement noSideEffectsClass; 317 ClassElement noSideEffectsClass;
316 ClassElement noThrowsClass; 318 ClassElement noThrowsClass;
317 ClassElement noInlineClass; 319 ClassElement noInlineClass;
318 ClassElement forceInlineClass; 320 ClassElement forceInlineClass;
319 ClassElement irRepresentationClass; 321 ClassElement irRepresentationClass;
320 322
321 Element getInterceptorMethod; 323 Element getInterceptorMethod;
322 324
323 ClassElement jsInvocationMirrorClass; 325 ClassElement jsInvocationMirrorClass;
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 if (ctor == null 1011 if (ctor == null
1010 || (isPrivateName(name) 1012 || (isPrivateName(name)
1011 && ctor.library != mapLiteralClass.library)) { 1013 && ctor.library != mapLiteralClass.library)) {
1012 compiler.internalError(mapLiteralClass, 1014 compiler.internalError(mapLiteralClass,
1013 "Map literal class $mapLiteralClass missing " 1015 "Map literal class $mapLiteralClass missing "
1014 "'$name' constructor" 1016 "'$name' constructor"
1015 " ${mapLiteralClass.constructors}"); 1017 " ${mapLiteralClass.constructors}");
1016 } 1018 }
1017 return ctor; 1019 return ctor;
1018 } 1020 }
1021 Element getMember(String name) {
1022 // The constructor is on the patch class, but dart2js unit tests don't
1023 // have a patch class.
1024 ClassElement implementation = cls.patch != null ? cls.patch : cls;
1025 Element element = implementation.lookupLocalMember(name);
1026 if (element == null || !element.isFunction || !element.isStatic) {
1027 compiler.internalError(mapLiteralClass,
1028 "Map literal class $mapLiteralClass missing "
1029 "'$name' static member function");
1030 }
1031 return element;
1032 }
1019 mapLiteralConstructor = getFactory('_literal', 1); 1033 mapLiteralConstructor = getFactory('_literal', 1);
1020 mapLiteralConstructorEmpty = getFactory('_empty', 0); 1034 mapLiteralConstructorEmpty = getFactory('_empty', 0);
1021 enqueueInResolution(mapLiteralConstructor, registry); 1035 enqueueInResolution(mapLiteralConstructor, registry);
1022 enqueueInResolution(mapLiteralConstructorEmpty, registry); 1036 enqueueInResolution(mapLiteralConstructorEmpty, registry);
1037
1038 mapLiteralUntypedMaker = getMember('_makeLiteral');
1039 mapLiteralUntypedEmptyMaker = getMember('_makeEmpty');
1040 enqueueInResolution(mapLiteralUntypedMaker, registry);
1041 enqueueInResolution(mapLiteralUntypedEmptyMaker, registry);
1023 } 1042 }
1024 } 1043 }
1025 if (cls == closureClass) { 1044 if (cls == closureClass) {
1026 enqueue(enqueuer, findHelper('closureFromTearOff'), registry); 1045 enqueue(enqueuer, findHelper('closureFromTearOff'), registry);
1027 } 1046 }
1028 ClassElement result = null; 1047 ClassElement result = null;
1029 if (cls == compiler.stringClass || cls == jsStringClass) { 1048 if (cls == compiler.stringClass || cls == jsStringClass) {
1030 addInterceptors(jsStringClass, enqueuer, registry); 1049 addInterceptors(jsStringClass, enqueuer, registry);
1031 } else if (cls == compiler.listClass || 1050 } else if (cls == compiler.listClass ||
1032 cls == jsArrayClass || 1051 cls == jsArrayClass ||
(...skipping 1836 matching lines...) Expand 10 before | Expand all | Expand 10 after
2869 } 2888 }
2870 } 2889 }
2871 2890
2872 /// Records that [constant] is used by the element behind [registry]. 2891 /// Records that [constant] is used by the element behind [registry].
2873 class Dependency { 2892 class Dependency {
2874 final ConstantValue constant; 2893 final ConstantValue constant;
2875 final Element annotatedElement; 2894 final Element annotatedElement;
2876 2895
2877 const Dependency(this.constant, this.annotatedElement); 2896 const Dependency(this.constant, this.annotatedElement);
2878 } 2897 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698