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

Side by Side Diff: dart/sdk/lib/_internal/compiler/implementation/js_backend/namer.dart

Issue 23452029: Address comments from CL 23304012. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: emitConvertToFastObjectFunction Created 7 years, 3 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 | « dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter_no_eval.dart ('k') | no next file » | 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 /** 7 /**
8 * Assigns JavaScript identifiers to Dart variables, class-names and members. 8 * Assigns JavaScript identifiers to Dart variables, class-names and members.
9 */ 9 */
10 class Namer implements ClosureNamer { 10 class Namer implements ClosureNamer {
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 String getNameOfClass(ClassElement cls) => getNameX(cls); 799 String getNameOfClass(ClassElement cls) => getNameX(cls);
800 800
801 String getNameOfField(VariableElement field) => getNameX(field); 801 String getNameOfField(VariableElement field) => getNameX(field);
802 802
803 String getNameOfInstanceMember(Element member) => getNameX(member); 803 String getNameOfInstanceMember(Element member) => getNameX(member);
804 804
805 String getNameOfGlobalField(VariableElement field) => getNameX(field); 805 String getNameOfGlobalField(VariableElement field) => getNameX(field);
806 806
807 String getNameOfGlobalFunction(FunctionElement element) => getNameX(element); 807 String getNameOfGlobalFunction(FunctionElement element) => getNameX(element);
808 808
809 /// Returns true if [element] is stored on CURRENT_ISOLATE ('$'). 809 /// Returns true if [element] is stored on CURRENT_ISOLATE ('$'). We intend
810 /// to store only mutable static state in [CURRENT_ISOLATE], constants are
811 /// stored in 'C', and functions, accessors, classes, etc. are stored in one
812 /// of the other objects in [reservedGlobalObjectNames].
810 bool isPropertyOfCurrentIsolate(Element element) { 813 bool isPropertyOfCurrentIsolate(Element element) {
814 // TODO(ahe): Make sure this method's documentation is always true and
815 // remove the word "intend".
811 return 816 return
817 // TODO(ahe): Re-write these tests to be positive (so it only returns
818 // true for static/top-level mutable fields). Right now, a number of
819 // other elements, such as bound closures also live in CURRENT_ISOLATE.
812 !element.isAccessor() && 820 !element.isAccessor() &&
813 !element.isClass() && 821 !element.isClass() &&
814 !element.isConstructor() && 822 !element.isConstructor() &&
815 !element.isFunction() && 823 !element.isFunction() &&
816 !element.isLibrary(); 824 !element.isLibrary();
817 } 825 }
818 826
819 /// Returns [CURRENT_ISOLATE] or one of [reservedGlobalObjectNames]. We 827 /// Returns [CURRENT_ISOLATE] or one of [reservedGlobalObjectNames].
820 /// intend to store only mutable static state in [CURRENT_ISOLATE], constants
821 /// are stored in 'C', and functions, accessors, classes, etc. are stored in
822 /// one of the other objects in [reservedGlobalObjectNames].
823 // TODO(ahe): Make sure the above is always true and remove the word "intend".
824 String globalObjectFor(Element element) { 828 String globalObjectFor(Element element) {
825 if (isPropertyOfCurrentIsolate(element)) return CURRENT_ISOLATE; 829 if (isPropertyOfCurrentIsolate(element)) return CURRENT_ISOLATE;
826 LibraryElement library = element.getLibrary(); 830 LibraryElement library = element.getLibrary();
827 if (library == compiler.interceptorsLibrary) return 'J'; 831 if (library == compiler.interceptorsLibrary) return 'J';
828 if (library.isInternalLibrary) return 'H'; 832 if (library.isInternalLibrary) return 'H';
829 if (library.isPlatformLibrary) { 833 if (library.isPlatformLibrary) {
830 if ('${library.canonicalUri}' == 'dart:html') return 'W'; 834 if ('${library.canonicalUri}' == 'dart:html') return 'W';
831 return 'P'; 835 return 'P';
832 } 836 }
833 return userGlobalObjects[ 837 return userGlobalObjects[
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
1369 if (!first) { 1373 if (!first) {
1370 sb.write('_'); 1374 sb.write('_');
1371 } 1375 }
1372 sb.write('_'); 1376 sb.write('_');
1373 visit(link.head); 1377 visit(link.head);
1374 first = true; 1378 first = true;
1375 } 1379 }
1376 } 1380 }
1377 } 1381 }
1378 } 1382 }
OLDNEW
« no previous file with comments | « dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter_no_eval.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698