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

Unified Diff: runtime/lib/isolate.cc

Issue 778983002: - Implement hashCode and == for Capability. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years 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 | « no previous file | runtime/lib/isolate_patch.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/isolate.cc
===================================================================
--- runtime/lib/isolate.cc (revision 42101)
+++ runtime/lib/isolate.cc (working copy)
@@ -35,6 +35,23 @@
}
+DEFINE_NATIVE_ENTRY(CapabilityImpl_equals, 2) {
+ GET_NON_NULL_NATIVE_ARGUMENT(Capability, recv, arguments->NativeArgAt(0));
+ GET_NON_NULL_NATIVE_ARGUMENT(Capability, other, arguments->NativeArgAt(1));
+ return (recv.Id() == other.Id()) ? Bool::True().raw() : Bool::False().raw();
+}
+
+
+DEFINE_NATIVE_ENTRY(CapabilityImpl_get_hashcode, 1) {
+ GET_NON_NULL_NATIVE_ARGUMENT(Capability, cap, arguments->NativeArgAt(0));
+ int64_t id = cap.Id();
+ int32_t hi = static_cast<int32_t>(id >> 32);
+ int32_t lo = static_cast<int32_t>(id);
+ int32_t hash = (hi ^ lo) & kSmiMax;
+ return Smi::New(hash);
+}
+
+
DEFINE_NATIVE_ENTRY(RawReceivePortImpl_factory, 1) {
ASSERT(TypeArguments::CheckedHandle(arguments->NativeArgAt(0)).IsNull());
Dart_Port port_id =
« no previous file with comments | « no previous file | runtime/lib/isolate_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698