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

Unified Diff: runtime/lib/function.cc

Issue 2598623002: Cache hash code for closures. (Closed)
Patch Set: remove redundant assertion Created 4 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/vm/clustered_snapshot.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/function.cc
diff --git a/runtime/lib/function.cc b/runtime/lib/function.cc
index 2abdde715b7bd39bad4c78dcfd2ade0fe193a418..5b2343ff8ff8aa12c93d559535554ddbf6be1931 100644
--- a/runtime/lib/function.cc
+++ b/runtime/lib/function.cc
@@ -69,17 +69,7 @@ DEFINE_NATIVE_ENTRY(Closure_hashCode, 1) {
const Closure& receiver =
Closure::CheckedHandle(zone, arguments->NativeArgAt(0));
const Function& func = Function::Handle(receiver.function());
- // Hash together name, class name and signature.
- const Class& cls = Class::Handle(func.Owner());
- intptr_t result = String::Handle(func.name()).Hash();
- result += String::Handle(func.Signature()).Hash();
- result += String::Handle(cls.Name()).Hash();
- // Finalize hash value like for strings so that it fits into a smi.
- result += result << 3;
- result ^= result >> 11;
- result += result << 15;
- result &= ((static_cast<intptr_t>(1) << String::kHashBits) - 1);
- return Smi::New(result);
+ return func.GetClosureHashCode();
}
« no previous file with comments | « no previous file | runtime/vm/clustered_snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698