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

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

Issue 14018036: Remove holders for runtime type information. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase. Created 7 years, 7 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) 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 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 name = '$unminifiedName$level'; 629 name = '$unminifiedName$level';
630 } 630 }
631 name = getMappedInstanceName(name); 631 name = getMappedInstanceName(name);
632 } 632 }
633 bailoutNames[element] = name; 633 bailoutNames[element] = name;
634 return name; 634 return name;
635 } 635 }
636 636
637 /// Returns the runtime name for [element]. The result is not safe as an id. 637 /// Returns the runtime name for [element]. The result is not safe as an id.
638 String getRuntimeTypeName(Element element) { 638 String getRuntimeTypeName(Element element) {
639 if (element == compiler.intClass) { 639 JavaScriptBackend backend = compiler.backend;
640 element = backend.getImplementationClass(element);
641 String name = getNativeName(element);
642 return name != null ? name : getName(element);
643 }
644
645 String getNativeName(ClassElement cls) {
sra1 2013/04/29 19:04:12 What is 'native' about this - we tend to use 'nati
karlklose 2013/04/30 09:29:41 Changed to getPrimitiveInterceptorRuntimeName. I
646 JavaScriptBackend backend = compiler.backend;
647 if (cls == backend.jsIntClass) {
640 return 'int'; 648 return 'int';
641 } else if (element == compiler.doubleClass) { 649 } else if (cls == backend.jsNumberClass) {
650 return 'num';
651 } else if (cls == backend.jsBoolClass) {
652 return 'bool';
653 } else if (cls == backend.jsDoubleClass) {
642 return 'double'; 654 return 'double';
643 } else { 655 } else if (cls == backend.jsStringClass) {
644 return getName(element); 656 return 'String';
657 } else if (cls == backend.jsArrayClass) {
658 return 'List';
645 } 659 }
sra1 2013/04/29 19:04:12 If you intend to return null please be explicit, o
karlklose 2013/04/30 09:29:41 Done.
646 } 660 }
647 661
648 /** 662 /**
649 * Returns a preferred JS-id for the given element. The returned id is 663 * Returns a preferred JS-id for the given element. The returned id is
650 * guaranteed to be a valid JS-id. Globals and static fields are furthermore 664 * guaranteed to be a valid JS-id. Globals and static fields are furthermore
651 * guaranteed to be unique. 665 * guaranteed to be unique.
652 * 666 *
653 * For accessing statics consider calling 667 * For accessing statics consider calling
654 * [isolateAccess]/[isolateBailoutAccess] or [isolatePropertyAccess] instead. 668 * [isolateAccess]/[isolateBailoutAccess] or [isolatePropertyAccess] instead.
655 */ 669 */
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
1124 hash = hash ^ (hash >> 6); 1138 hash = hash ^ (hash >> 6);
1125 return hash; 1139 return hash;
1126 } 1140 }
1127 1141
1128 static int _finish(int hash) { 1142 static int _finish(int hash) {
1129 hash = _MASK & (hash + (((_MASK >> 3) & hash) << 3)); 1143 hash = _MASK & (hash + (((_MASK >> 3) & hash) << 3));
1130 hash = hash & (hash >> 11); 1144 hash = hash & (hash >> 11);
1131 return _MASK & (hash + (((_MASK >> 15) & hash) << 15)); 1145 return _MASK & (hash + (((_MASK >> 15) & hash) << 15));
1132 } 1146 }
1133 } 1147 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698