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

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

Issue 1511383002: Revert "Canonical output ordering for constants." (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_emitter/constant_ordering.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) 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 * Names are generated through three stages: 10 * Names are generated through three stages:
(...skipping 1870 matching lines...) Expand 10 before | Expand all | Expand 10 after
1881 reporter.internalError( 1881 reporter.internalError(
1882 NO_LOCATION_SPANNABLE, 1882 NO_LOCATION_SPANNABLE,
1883 'SyntheticConstantValue should never be named and ' 1883 'SyntheticConstantValue should never be named and '
1884 'never be subconstant'); 1884 'never be subconstant');
1885 return 0; 1885 return 0;
1886 } 1886 }
1887 } 1887 }
1888 1888
1889 @override 1889 @override
1890 int visitDeferred(DeferredConstantValue constant, [_]) { 1890 int visitDeferred(DeferredConstantValue constant, [_]) {
1891 // TODO(sra): Investigate that the use of hashCode here is probably a source
1892 // of instability.
1893 int hash = constant.prefix.hashCode; 1891 int hash = constant.prefix.hashCode;
1894 return _combine(hash, _visit(constant.referenced)); 1892 return _combine(hash, _visit(constant.referenced));
1895 } 1893 }
1896 1894
1897 int _hashString(int hash, String s) { 1895 int _hashString(int hash, String s) {
1898 int length = s.length; 1896 int length = s.length;
1899 hash = _combine(hash, length); 1897 hash = _combine(hash, length);
1900 // Increasing stride is O(log N) on large strings which are unlikely to have 1898 // Increasing stride is O(log N) on large strings which are unlikely to have
1901 // many collisions. 1899 // many collisions.
1902 for (int i = 0; i < length; i += 1 + (i >> 2)) { 1900 for (int i = 0; i < length; i += 1 + (i >> 2)) {
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
2039 String suggestName(String original) => _suggestedNames[original]; 2037 String suggestName(String original) => _suggestedNames[original];
2040 void addSuggestion(String original, String suggestion) { 2038 void addSuggestion(String original, String suggestion) {
2041 assert(!_suggestedNames.containsKey(original)); 2039 assert(!_suggestedNames.containsKey(original));
2042 _suggestedNames[original] = suggestion; 2040 _suggestedNames[original] = suggestion;
2043 } 2041 }
2044 bool hasSuggestion(String original) => _suggestedNames.containsKey(original); 2042 bool hasSuggestion(String original) => _suggestedNames.containsKey(original);
2045 bool isSuggestion(String candidate) { 2043 bool isSuggestion(String candidate) {
2046 return _suggestedNames.containsValue(candidate); 2044 return _suggestedNames.containsValue(candidate);
2047 } 2045 }
2048 } 2046 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_emitter/constant_ordering.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698