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

Unified Diff: pkg/compiler/lib/src/io/source_map_builder.dart

Issue 2864573002: dart2js allocation tweaks (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/io/source_map_builder.dart
diff --git a/pkg/compiler/lib/src/io/source_map_builder.dart b/pkg/compiler/lib/src/io/source_map_builder.dart
index df5866daa7e9f0fa05454bbaaad85937f63eb615..95f6c001c413c177fd8ac8e4c665d9ae4d77802c 100644
--- a/pkg/compiler/lib/src/io/source_map_builder.dart
+++ b/pkg/compiler/lib/src/io/source_map_builder.dart
@@ -277,11 +277,13 @@ class SourceMapEntry {
/// Map from line/column pairs to lists of [T] elements.
class LineColumnMap<T> {
Map<int, Map<int, List<T>>> _map = <int, Map<int, List<T>>>{};
+ var _makeLineMap = () => <int, List<T>>{};
+ var _makeList = () => <T>[];
/// Returns the list of elements associated with ([line],[column]).
List<T> _getList(int line, int column) {
- Map<int, List<T>> lineMap = _map.putIfAbsent(line, () => <int, List<T>>{});
- return lineMap.putIfAbsent(column, () => <T>[]);
+ Map<int, List<T>> lineMap = _map.putIfAbsent(line, _makeLineMap);
+ return lineMap.putIfAbsent(column, _makeList);
}
/// Adds [element] to the end of the list of elements associated with

Powered by Google App Engine
This is Rietveld 408576698