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

Unified Diff: sdk/lib/_internal/lib/js_mirrors.dart

Issue 25099003: Make the implementations of InstanceMirror.hashCode use dart:core's identityHashCode. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/bootstrap_natives.h ('k') | tests/corelib/hashcode_boxed_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/lib/js_mirrors.dart
diff --git a/sdk/lib/_internal/lib/js_mirrors.dart b/sdk/lib/_internal/lib/js_mirrors.dart
index 2887c43e96c54ee929b4c4cdeee517e96f7c0d8f..4d0fe517fc221b9a484387446e254ede35b54dcb 100644
--- a/sdk/lib/_internal/lib/js_mirrors.dart
+++ b/sdk/lib/_internal/lib/js_mirrors.dart
@@ -781,18 +781,9 @@ class JsInstanceMirror extends JsObjectMirror implements InstanceMirror {
}
int get hashCode {
- // If the reflectee is a built-in type, use the base-level hashCode to
- // preserve the illusion that, e.g. doubles, with the same value are
- // identical. Otherwise, use the primitive identity hash to maintain
- // correctness even if a user-defined hashCode returns different values for
- // successive invocations.
- var h = ((JS('bool', 'typeof # != "object"', reflectee)) ||
- (reflectee == null))
- ? reflectee.hashCode
- : Primitives.objectHashCode(reflectee);
// Avoid hash collisions with the reflectee. This constant is in Smi range
// and happens to be the inner padding from RFC 2104.
- return h ^ 0x36363636;
+ return identityHashCode(reflectee) ^ 0x36363636;
}
String toString() => 'InstanceMirror on ${Error.safeToString(reflectee)}';
« no previous file with comments | « runtime/vm/bootstrap_natives.h ('k') | tests/corelib/hashcode_boxed_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698