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

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

Issue 2864363002: Remove DartString from constants. (Closed)
Patch Set: Remove toDartString Created 3 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
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 library js_backend.namer; 5 library js_backend.namer;
6 6
7 import 'dart:collection' show HashMap; 7 import 'dart:collection' show HashMap;
8 8
9 import 'package:js_runtime/shared/embedded_names.dart' show JsGetName; 9 import 'package:js_runtime/shared/embedded_names.dart' show JsGetName;
10 10
(...skipping 1792 matching lines...) Expand 10 before | Expand all | Expand 10 after
1803 } 1803 }
1804 1804
1805 @override 1805 @override
1806 void visitBool(BoolConstantValue constant, [_]) { 1806 void visitBool(BoolConstantValue constant, [_]) {
1807 add(constant.isTrue ? 'true' : 'false'); 1807 add(constant.isTrue ? 'true' : 'false');
1808 } 1808 }
1809 1809
1810 @override 1810 @override
1811 void visitString(StringConstantValue constant, [_]) { 1811 void visitString(StringConstantValue constant, [_]) {
1812 // No `addRoot` since string constants are always inlined. 1812 // No `addRoot` since string constants are always inlined.
1813 addIdentifier(constant.primitiveValue.slowToString()); 1813 addIdentifier(constant.primitiveValue);
1814 } 1814 }
1815 1815
1816 @override 1816 @override
1817 void visitList(ListConstantValue constant, [_]) { 1817 void visitList(ListConstantValue constant, [_]) {
1818 // TODO(9476): Incorporate type parameters into name. 1818 // TODO(9476): Incorporate type parameters into name.
1819 addRoot('List'); 1819 addRoot('List');
1820 int length = constant.length; 1820 int length = constant.length;
1821 if (constant.length == 0) { 1821 if (constant.length == 0) {
1822 add('empty'); 1822 add('empty');
1823 } else if (length >= MAX_FRAGMENTS) { 1823 } else if (length >= MAX_FRAGMENTS) {
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1973 return _hashInt(constant.primitiveValue); 1973 return _hashInt(constant.primitiveValue);
1974 } 1974 }
1975 1975
1976 @override 1976 @override
1977 int visitDouble(DoubleConstantValue constant, [_]) { 1977 int visitDouble(DoubleConstantValue constant, [_]) {
1978 return _hashDouble(constant.primitiveValue); 1978 return _hashDouble(constant.primitiveValue);
1979 } 1979 }
1980 1980
1981 @override 1981 @override
1982 int visitString(StringConstantValue constant, [_]) { 1982 int visitString(StringConstantValue constant, [_]) {
1983 return _hashString(2, constant.primitiveValue.slowToString()); 1983 return _hashString(2, constant.primitiveValue);
1984 } 1984 }
1985 1985
1986 @override 1986 @override
1987 int visitList(ListConstantValue constant, [_]) { 1987 int visitList(ListConstantValue constant, [_]) {
1988 return _hashList(constant.length, constant.entries); 1988 return _hashList(constant.length, constant.entries);
1989 } 1989 }
1990 1990
1991 @override 1991 @override
1992 int visitMap(MapConstantValue constant, [_]) { 1992 int visitMap(MapConstantValue constant, [_]) {
1993 int hash = _hashList(constant.length, constant.keys); 1993 int hash = _hashList(constant.length, constant.keys);
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
2186 void addSuggestion(String original, String suggestion) { 2186 void addSuggestion(String original, String suggestion) {
2187 assert(!_suggestedNames.containsKey(original)); 2187 assert(!_suggestedNames.containsKey(original));
2188 _suggestedNames[original] = suggestion; 2188 _suggestedNames[original] = suggestion;
2189 } 2189 }
2190 2190
2191 bool hasSuggestion(String original) => _suggestedNames.containsKey(original); 2191 bool hasSuggestion(String original) => _suggestedNames.containsKey(original);
2192 bool isSuggestion(String candidate) { 2192 bool isSuggestion(String candidate) {
2193 return _suggestedNames.containsValue(candidate); 2193 return _suggestedNames.containsValue(candidate);
2194 } 2194 }
2195 } 2195 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/lookup_map_analysis.dart ('k') | pkg/compiler/lib/src/js_emitter/constant_ordering.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698