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

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

Issue 2696803003: Avoiding creating strings for canonicalization (Closed)
Patch Set: Address review comments Created 3 years, 10 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 dart2js.compiler_base; 5 library dart2js.compiler_base;
6 6
7 import 'dart:async' show EventSink, Future; 7 import 'dart:async' show EventSink, Future;
8 8
9 import '../compiler_new.dart' as api; 9 import '../compiler_new.dart' as api;
10 import 'closure.dart' as closureMapping show ClosureTask; 10 import 'closure.dart' as closureMapping show ClosureTask;
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 * Get an [Uri] pointing to a patch for the dart: library with 467 * Get an [Uri] pointing to a patch for the dart: library with
468 * the given path. Returns null if there is no patch. 468 * the given path. Returns null if there is no patch.
469 */ 469 */
470 Uri resolvePatchUri(String dartLibraryPath); 470 Uri resolvePatchUri(String dartLibraryPath);
471 471
472 Future runInternal(Uri uri) { 472 Future runInternal(Uri uri) {
473 // TODO(ahe): This prevents memory leaks when invoking the compiler 473 // TODO(ahe): This prevents memory leaks when invoking the compiler
474 // multiple times. Implement a better mechanism where we can store 474 // multiple times. Implement a better mechanism where we can store
475 // such caches in the compiler and get access to them through a 475 // such caches in the compiler and get access to them through a
476 // suitably maintained static reference to the current compiler. 476 // suitably maintained static reference to the current compiler.
477 StringToken.canonicalizedSubstrings.clear(); 477 StringToken.canonicalizer.clear();
478 Selector.canonicalizedValues.clear(); 478 Selector.canonicalizedValues.clear();
479 479
480 // The selector objects held in static fields must remain canonical. 480 // The selector objects held in static fields must remain canonical.
481 for (Selector selector in Selectors.ALL) { 481 for (Selector selector in Selectors.ALL) {
482 Selector.canonicalizedValues 482 Selector.canonicalizedValues
483 .putIfAbsent(selector.hashCode, () => <Selector>[]) 483 .putIfAbsent(selector.hashCode, () => <Selector>[])
484 .add(selector); 484 .add(selector);
485 } 485 }
486 486
487 assert(uri != null || options.analyzeOnly); 487 assert(uri != null || options.analyzeOnly);
(...skipping 1473 matching lines...) Expand 10 before | Expand all | Expand 10 after
1961 _ElementScanner(this.scanner); 1961 _ElementScanner(this.scanner);
1962 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); 1962 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library);
1963 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); 1963 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit);
1964 } 1964 }
1965 1965
1966 class _EmptyEnvironment implements Environment { 1966 class _EmptyEnvironment implements Environment {
1967 const _EmptyEnvironment(); 1967 const _EmptyEnvironment();
1968 1968
1969 String valueOf(String key) => null; 1969 String valueOf(String key) => null;
1970 } 1970 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698