Generate artificial hashCode for often used classes.

By avoiding calling Object.hashCode we analyze about 1% faster.

R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org//934113002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43832 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
scheglov@google.com 2015-02-18 01:12:43 +00:00
parent 4d09e6a9dd
commit 4e34c0d247
3 changed files with 39 additions and 0 deletions

View file

@ -319,6 +319,16 @@ class Relationship {
*/
static Map<String, Relationship> _RELATIONSHIP_MAP = {};
/**
* The next artificial hash code.
*/
static int _NEXT_HASH_CODE = 0;
/**
* The artifitial hash code for this object.
*/
final int _hashCode = _NEXT_HASH_CODE++;
/**
* The unique identifier for this relationship.
*/
@ -329,6 +339,9 @@ class Relationship {
*/
Relationship(this.identifier);
@override
int get hashCode => _hashCode;
@override
String toString() => identifier;

View file

@ -8663,6 +8663,16 @@ class DartEntry extends SourceEntry {
* be stored in the cache.
*/
class DataDescriptor<E> {
/**
* The next artificial hash code.
*/
static int _NEXT_HASH_CODE = 0;
/**
* The artifitial hash code for this object.
*/
final int _hashCode = _NEXT_HASH_CODE++;
/**
* The name of the descriptor, used for debugging purposes.
*/
@ -8679,6 +8689,9 @@ class DataDescriptor<E> {
*/
DataDescriptor(this._name, [this.defaultValue = null]);
@override
int get hashCode => _hashCode;
@override
String toString() => _name;
}

View file

@ -10077,6 +10077,16 @@ class ResolvableLibrary {
*/
static List<ResolvableLibrary> _EMPTY_ARRAY = new List<ResolvableLibrary>(0);
/**
* The next artificial hash code.
*/
static int _NEXT_HASH_CODE = 0;
/**
* The artifitial hash code for this object.
*/
final int _hashCode = _NEXT_HASH_CODE++;
/**
* The source specifying the defining compilation unit of this library.
*/
@ -10197,6 +10207,9 @@ class ResolvableLibrary {
*/
List<ResolvableLibrary> get exports => _exportedLibraries;
@override
int get hashCode => _hashCode;
/**
* Set the libraries that are imported into this library to be those in the given array.
*