| Index: dart/sdk/lib/_internal/compiler/implementation/cache_strategy.dart
|
| diff --git a/dart/sdk/lib/_internal/compiler/implementation/cache_strategy.dart b/dart/sdk/lib/_internal/compiler/implementation/cache_strategy.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..d27aad5fd9534f4083b576b5605739fcda914221
|
| --- /dev/null
|
| +++ b/dart/sdk/lib/_internal/compiler/implementation/cache_strategy.dart
|
| @@ -0,0 +1,23 @@
|
| +// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
|
| +// for details. All rights reserved. Use of this source code is governed by a
|
| +// BSD-style license that can be found in the LICENSE file.
|
| +
|
| +import 'dart:collection' show
|
| + HashMap,
|
| + HashSet;
|
| +
|
| +/**
|
| + * Helper class for allocating sets and maps appropriate for caching objects
|
| + * that can be assumed to be canonicalized.
|
| + *
|
| + * When compiling dart2js to JavaScript, profiling reveals that identity maps
|
| + * and sets have superior performance. However, we know that [Object.hashCode]
|
| + * is slow on the Dart VM. This class is meant to encapsulate the decision
|
| + * about which data structure is best, and we anticipate specific subclasses
|
| + * for JavaScript and Dart VM in the future.
|
| + */
|
| +class CacheStrategy {
|
| + Map newMap() => new HashMap.identity();
|
| +
|
| + Set newSet() => new HashSet.identity();
|
| +}
|
|
|