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

Unified Diff: runtime/lib/object.cc

Issue 2137673002: Sped up hashCode by removing megamorphic call to _identityHashCode. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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/lib/object.cc
diff --git a/runtime/lib/object.cc b/runtime/lib/object.cc
index b450038b0f5a832117a6b8c458eee5da46f28e3d..ac1e1725e4ea6cff86e964fd0d9e485058bdf70b 100644
--- a/runtime/lib/object.cc
+++ b/runtime/lib/object.cc
@@ -39,9 +39,11 @@ DEFINE_NATIVE_ENTRY(Object_equals, 1) {
DEFINE_NATIVE_ENTRY(Object_getHash, 1) {
- const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0));
+ // Please note that no handle is created for the argument.
+ // This is safe since the argument is only used in a tail call.
+ // The performance benefit is more than 5% when using hashCode.
siva 2016/07/08 22:12:10 Maybe add: ASSERT(arguments->NativeArgAt(0)->IsDa
bakster 2016/07/08 22:15:11 Done.
Heap* heap = isolate->heap();
- return Smi::New(heap->GetHash(instance.raw()));
+ return Smi::New(heap->GetHash(arguments->NativeArgAt(0)));
}

Powered by Google App Engine
This is Rietveld 408576698