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

Unified Diff: runtime/vm/object.h

Issue 2983823002: Improve hashCode for closures (Closed)
Patch Set: Error handling Created 3 years, 5 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
Index: runtime/vm/object.h
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index 719af78f7a40113544473225756f22213f1bfee9..771e709391b379587ec8a74de90c957a95f59c73 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -2402,7 +2402,7 @@ class Function : public Object {
RawInstance* ImplicitInstanceClosure(const Instance& receiver) const;
- RawSmi* GetClosureHashCode() const;
+ intptr_t ComputeClosureHash() const;
// Redirection information for a redirecting factory.
bool IsRedirectingFactory() const;
@@ -3072,9 +3072,6 @@ class ClosureData : public Object {
RawInstance* implicit_static_closure() const { return raw_ptr()->closure_; }
void set_implicit_static_closure(const Instance& closure) const;
- RawObject* hash() const { return raw_ptr()->hash_; }
- void set_hash(intptr_t value) const;
-
static RawClosureData* New();
FINAL_HEAP_OBJECT_IMPLEMENTATION(ClosureData, Object);
@@ -5532,6 +5529,9 @@ class Instance : public Object {
// Equivalent to invoking hashCode on this instance.
virtual RawObject* HashCode() const;
+ // Equivalent to invoking identityHashCode with this instance.
+ RawObject* IdentityHashCode() const;
+
static intptr_t InstanceSize() {
return RoundedAllocationSize(sizeof(RawInstance));
}
@@ -8340,6 +8340,9 @@ class Closure : public Instance {
RawContext* context() const { return raw_ptr()->context_; }
static intptr_t context_offset() { return OFFSET_OF(RawClosure, context_); }
+ RawSmi* hash() const { return raw_ptr()->hash_; }
+ static intptr_t hash_offset() { return OFFSET_OF(RawClosure, hash_); }
+
static intptr_t InstanceSize() {
return RoundedAllocationSize(sizeof(RawClosure));
}
@@ -8351,6 +8354,8 @@ class Closure : public Instance {
return true;
}
+ int64_t ComputeHash() const;
+
static RawClosure* New(const TypeArguments& instantiator_type_arguments,
const TypeArguments& function_type_arguments,
const Function& function,
« no previous file with comments | « runtime/vm/dart_entry.cc ('k') | runtime/vm/object.cc » ('j') | runtime/vm/object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698