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

Unified Diff: sdk/lib/_internal/compiler/implementation/dart_backend/renamer.dart

Issue 23593002: Only emit members in mirror helper symbolsmap. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Changed comment. Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/compiler/implementation/dart_backend/renamer.dart
diff --git a/sdk/lib/_internal/compiler/implementation/dart_backend/renamer.dart b/sdk/lib/_internal/compiler/implementation/dart_backend/renamer.dart
index 73480bf01e2e008b890b53c465dea118233272b6..cb7c4a771d8501200110b39ec591550359b972fe 100644
--- a/sdk/lib/_internal/compiler/implementation/dart_backend/renamer.dart
+++ b/sdk/lib/_internal/compiler/implementation/dart_backend/renamer.dart
@@ -180,33 +180,24 @@ void renamePlaceholders(
renameElement = makeElementRenamer(rename, generateUniqueName);
List<Set<Node>> allLocals = new List<Set<Node>>();
- // If we are using the mirror_helper library we need all names to be
- // globally unique.
- if (uniqueGlobalNaming) {
- //TODO(zarah): Change this so that local variables don't get unique names.
- for (var functionScope in placeholderCollector.functionScopes.values) {
- functionScope.localPlaceholders.forEach(
- (ph) => allLocals.add(ph.nodes.toSet()));
+
+ // Build a list sorted by usage of local nodes that will be renamed to
+ // the same identifier. So the top-used local variables in all functions
+ // will be renamed first and will all share the same new identifier.
+ for (var functionScope in placeholderCollector.functionScopes.values) {
+ // Add current sorted local identifiers to the whole sorted list
+ // of all local identifiers for all functions.
+ List<LocalPlaceholder> currentSortedPlaceholders =
+ sorted(functionScope.localPlaceholders,
+ compareBy((LocalPlaceholder ph) => -ph.nodes.length));
+ List<Set<Node>> currentSortedNodes =
+ currentSortedPlaceholders.map((ph) => ph.nodes).toList();
+ // Make room in all sorted locals list for new stuff.
+ while (currentSortedNodes.length > allLocals.length) {
+ allLocals.add(new Set<Node>());
}
- } else {
- // Build a sorted (by usage) list of local nodes that will be renamed to
- // the same identifier. So the top-used local variables in all functions
- // will be renamed first and will all share the same new identifier.
- for (var functionScope in placeholderCollector.functionScopes.values) {
- // Add current sorted local identifiers to the whole sorted list
- // of all local identifiers for all functions.
- List<LocalPlaceholder> currentSortedPlaceholders =
- sorted(functionScope.localPlaceholders,
- compareBy((LocalPlaceholder ph) => -ph.nodes.length));
- List<Set<Node>> currentSortedNodes =
- currentSortedPlaceholders.map((ph) => ph.nodes).toList();
- // Make room in all sorted locals list for new stuff.
- while (currentSortedNodes.length > allLocals.length) {
- allLocals.add(new Set<Node>());
- }
- for (int i = 0; i < currentSortedNodes.length; i++) {
- allLocals[i].addAll(currentSortedNodes[i]);
- }
+ for (int i = 0; i < currentSortedNodes.length; i++) {
+ allLocals[i].addAll(currentSortedNodes[i]);
}
}

Powered by Google App Engine
This is Rietveld 408576698