Avoid an unnecessary ComputeModifiedUtf8Hash().
The DescriptorHashPair already has the hash as the member
`second`, so avoid recalculating it in release mode.
Also split "HashEquals" classes into separate "Hash" and
"Equals" classes to disambiguate their operators in traces.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Bug: 175869411
Change-Id: I87cbe613778c7d310ba5c2bf437729244780472c
diff --git a/runtime/intern_table.cc b/runtime/intern_table.cc
index abcc217..b11de51 100644
--- a/runtime/intern_table.cc
+++ b/runtime/intern_table.cc
@@ -307,7 +307,7 @@
weak_interns_.SweepWeaks(visitor);
}
-std::size_t InternTable::StringHashEquals::operator()(const GcRoot<mirror::String>& root) const {
+std::size_t InternTable::StringHash::operator()(const GcRoot<mirror::String>& root) const {
if (kIsDebugBuild) {
Locks::mutator_lock_->AssertSharedHeld(Thread::Current());
}
@@ -316,16 +316,16 @@
static_cast<uint32_t>(root.Read<kWithoutReadBarrier>()->GetHashCode()));
}
-bool InternTable::StringHashEquals::operator()(const GcRoot<mirror::String>& a,
- const GcRoot<mirror::String>& b) const {
+bool InternTable::StringEquals::operator()(const GcRoot<mirror::String>& a,
+ const GcRoot<mirror::String>& b) const {
if (kIsDebugBuild) {
Locks::mutator_lock_->AssertSharedHeld(Thread::Current());
}
return a.Read<kWithoutReadBarrier>()->Equals(b.Read<kWithoutReadBarrier>());
}
-bool InternTable::StringHashEquals::operator()(const GcRoot<mirror::String>& a,
- const Utf8String& b) const {
+bool InternTable::StringEquals::operator()(const GcRoot<mirror::String>& a,
+ const Utf8String& b) const {
if (kIsDebugBuild) {
Locks::mutator_lock_->AssertSharedHeld(Thread::Current());
}