Index: runtime/lib/object_patch.dart |
diff --git a/runtime/lib/object_patch.dart b/runtime/lib/object_patch.dart |
index 7c4f5f54f629029e3f120ac9cbc7f0eb33071990..69723b38039f46b3eec4b1f5770768a6eea5b6eb 100644 |
--- a/runtime/lib/object_patch.dart |
+++ b/runtime/lib/object_patch.dart |
@@ -15,21 +15,23 @@ patch class Object { |
static _getHash(obj) native "Object_getHash"; |
static _setHash(obj, hash) native "Object_setHash"; |
- /* patch */ int get hashCode => _identityHashCode; |
- |
- int get _identityHashCode { |
- var result = _getHash(this); |
+ // Shared static implentation for hashCode and _identityHashCode. |
+ static int _objectHashCode(obj) { |
+ var result = _getHash(obj); |
if (result == 0) { |
// We want the hash to be a Smi value greater than 0. |
result = _hashCodeRnd.nextInt(0x40000000); |
while (result == 0) { |
result = _hashCodeRnd.nextInt(0x40000000); |
} |
- _setHash(this, result); |
+ _setHash(obj, result); |
} |
return result; |
} |
+ /* patch */ int get hashCode => _objectHashCode(this); |
+ int get _identityHashCode => _objectHashCode(this); |
+ |
/* patch */ String toString() native "Object_toString"; |
// A statically dispatched version of Object.toString. |
static String _toString(obj) native "Object_toString"; |