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

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

Issue 1859343004: dartfmt pkg/compiler (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « pkg/compiler/lib/src/apiimpl.dart ('k') | pkg/compiler/lib/src/closure.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 import 'dart:collection' show 5 import 'dart:collection' show HashMap, HashSet;
6 HashMap,
7 HashSet;
8 6
9 /** 7 /**
10 * Helper class for allocating sets and maps appropriate for caching objects 8 * Helper class for allocating sets and maps appropriate for caching objects
11 * that can be assumed to be canonicalized. 9 * that can be assumed to be canonicalized.
12 * 10 *
13 * When compiling dart2js to JavaScript, profiling reveals that identity maps 11 * When compiling dart2js to JavaScript, profiling reveals that identity maps
14 * and sets have superior performance. However, we know that [Object.hashCode] 12 * and sets have superior performance. However, we know that [Object.hashCode]
15 * is slow on the Dart VM. This class is meant to encapsulate the decision 13 * is slow on the Dart VM. This class is meant to encapsulate the decision
16 * about which data structure is best, and we anticipate specific subclasses 14 * about which data structure is best, and we anticipate specific subclasses
17 * for JavaScript and Dart VM in the future. 15 * for JavaScript and Dart VM in the future.
18 */ 16 */
19 class CacheStrategy { 17 class CacheStrategy {
20 final bool hasIncrementalSupport; 18 final bool hasIncrementalSupport;
21 19
22 CacheStrategy(this.hasIncrementalSupport); 20 CacheStrategy(this.hasIncrementalSupport);
23 21
24 Map newMap() => hasIncrementalSupport ? new HashMap.identity() : null; 22 Map newMap() => hasIncrementalSupport ? new HashMap.identity() : null;
25 23
26 Set newSet() => hasIncrementalSupport ? new HashSet.identity() : null; 24 Set newSet() => hasIncrementalSupport ? new HashSet.identity() : null;
27 } 25 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/apiimpl.dart ('k') | pkg/compiler/lib/src/closure.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698