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

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

Issue 2702753003: Relanding: avoiding creating strings for canonicalization (Closed)
Patch Set: 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 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 * Get an [Uri] pointing to a patch for the dart: library with 460 * Get an [Uri] pointing to a patch for the dart: library with
461 * the given path. Returns null if there is no patch. 461 * the given path. Returns null if there is no patch.
462 */ 462 */
463 Uri resolvePatchUri(String dartLibraryPath); 463 Uri resolvePatchUri(String dartLibraryPath);
464 464
465 Future runInternal(Uri uri) { 465 Future runInternal(Uri uri) {
466 // TODO(ahe): This prevents memory leaks when invoking the compiler 466 // TODO(ahe): This prevents memory leaks when invoking the compiler
467 // multiple times. Implement a better mechanism where we can store 467 // multiple times. Implement a better mechanism where we can store
468 // such caches in the compiler and get access to them through a 468 // such caches in the compiler and get access to them through a
469 // suitably maintained static reference to the current compiler. 469 // suitably maintained static reference to the current compiler.
470 StringToken.canonicalizedSubstrings.clear(); 470 StringToken.canonicalizer.clear();
471 Selector.canonicalizedValues.clear(); 471 Selector.canonicalizedValues.clear();
472 472
473 // The selector objects held in static fields must remain canonical. 473 // The selector objects held in static fields must remain canonical.
474 for (Selector selector in Selectors.ALL) { 474 for (Selector selector in Selectors.ALL) {
475 Selector.canonicalizedValues 475 Selector.canonicalizedValues
476 .putIfAbsent(selector.hashCode, () => <Selector>[]) 476 .putIfAbsent(selector.hashCode, () => <Selector>[])
477 .add(selector); 477 .add(selector);
478 } 478 }
479 479
480 assert(uri != null || options.analyzeOnly); 480 assert(uri != null || options.analyzeOnly);
(...skipping 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after
2067 if (library != null && library.isSynthesized) { 2067 if (library != null && library.isSynthesized) {
2068 return null; 2068 return null;
2069 } 2069 }
2070 if (library == null && required) { 2070 if (library == null && required) {
2071 throw new SpannableAssertionFailure( 2071 throw new SpannableAssertionFailure(
2072 library, "The library '${uri}' was not found."); 2072 library, "The library '${uri}' was not found.");
2073 } 2073 }
2074 return library; 2074 return library;
2075 } 2075 }
2076 } 2076 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698