| OLD | NEW |
| 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 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 compiler.internalError('getName for unknown kind: ${element.kind}', | 728 compiler.internalError('getName for unknown kind: ${element.kind}', |
| 729 node: element.parseNode(compiler)); | 729 node: element.parseNode(compiler)); |
| 730 } | 730 } |
| 731 } | 731 } |
| 732 | 732 |
| 733 String getLazyInitializerName(Element element) { | 733 String getLazyInitializerName(Element element) { |
| 734 assert(Elements.isStaticOrTopLevelField(element)); | 734 assert(Elements.isStaticOrTopLevelField(element)); |
| 735 return getMappedGlobalName("$getterPrefix${getName(element)}"); | 735 return getMappedGlobalName("$getterPrefix${getName(element)}"); |
| 736 } | 736 } |
| 737 | 737 |
| 738 String getStaticTearOffClosureName(Element element) { |
| 739 assert(Elements.isStaticOrTopLevelFunction(element)); |
| 740 return getMappedGlobalName("${getName(element)}\$tearOff"); |
| 741 } |
| 742 |
| 738 String isolatePropertiesAccess(Element element) { | 743 String isolatePropertiesAccess(Element element) { |
| 739 return "$isolateName.$isolatePropertiesName.${getName(element)}"; | 744 return "$isolateName.$isolatePropertiesName.${getName(element)}"; |
| 740 } | 745 } |
| 741 | 746 |
| 742 String isolateAccess(Element element) { | 747 String isolateAccess(Element element) { |
| 743 return "$CURRENT_ISOLATE.${getName(element)}"; | 748 return "$CURRENT_ISOLATE.${getName(element)}"; |
| 744 } | 749 } |
| 745 | 750 |
| 746 String isolateBailoutAccess(Element element) { | 751 String isolateBailoutAccess(Element element) { |
| 747 String newName = getMappedGlobalName('${getName(element)}\$bailout'); | 752 String newName = getMappedGlobalName('${getName(element)}\$bailout'); |
| 748 return '$CURRENT_ISOLATE.$newName'; | 753 return '$CURRENT_ISOLATE.$newName'; |
| 749 } | 754 } |
| 750 | 755 |
| 751 String isolateLazyInitializerAccess(Element element) { | 756 String isolateLazyInitializerAccess(Element element) { |
| 752 return "$CURRENT_ISOLATE.${getLazyInitializerName(element)}"; | 757 return "$CURRENT_ISOLATE.${getLazyInitializerName(element)}"; |
| 753 } | 758 } |
| 754 | 759 |
| 760 String isolateStaticTearOffClosureAccess(Element element) { |
| 761 return "$CURRENT_ISOLATE.${getStaticTearOffClosureName(element)}"; |
| 762 } |
| 763 |
| 755 String operatorIsPrefix() => r'$is'; | 764 String operatorIsPrefix() => r'$is'; |
| 756 | 765 |
| 757 String operatorAsPrefix() => r'$as'; | 766 String operatorAsPrefix() => r'$as'; |
| 758 | 767 |
| 759 String operatorIs(Element element) { | 768 String operatorIs(Element element) { |
| 760 // TODO(erikcorry): Reduce from $isx to ix when we are minifying. | 769 // TODO(erikcorry): Reduce from $isx to ix when we are minifying. |
| 761 return '${operatorIsPrefix()}${getRuntimeTypeName(element)}'; | 770 return '${operatorIsPrefix()}${getRuntimeTypeName(element)}'; |
| 762 } | 771 } |
| 763 | 772 |
| 764 /* | 773 /* |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1144 hash = hash ^ (hash >> 6); | 1153 hash = hash ^ (hash >> 6); |
| 1145 return hash; | 1154 return hash; |
| 1146 } | 1155 } |
| 1147 | 1156 |
| 1148 static int _finish(int hash) { | 1157 static int _finish(int hash) { |
| 1149 hash = _MASK & (hash + (((_MASK >> 3) & hash) << 3)); | 1158 hash = _MASK & (hash + (((_MASK >> 3) & hash) << 3)); |
| 1150 hash = hash & (hash >> 11); | 1159 hash = hash & (hash >> 11); |
| 1151 return _MASK & (hash + (((_MASK >> 15) & hash) << 15)); | 1160 return _MASK & (hash + (((_MASK >> 15) & hash) << 15)); |
| 1152 } | 1161 } |
| 1153 } | 1162 } |
| OLD | NEW |