Commit 8574179a authored by Mike Stanton's avatar Mike Stanton Committed by Commit Bot

[feedback] Only take read lock for data pairs on the background thread

Slight performance regression by adding locking around feedback
vector get/set. The lock isn't necessary for reads on the main thread,
since the main thread is the only source of change.

Bug: chromium:1144777
Change-Id: I7cc9898ad0d8e8c468ba150c0bc6bef3176fd256
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2516475Reviewed-by: 's avatarSantiago Aboy Solanes <solanes@chromium.org>
Commit-Queue: Michael Stanton <mvstanton@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70947}
parent 70a1de97
......@@ -500,11 +500,16 @@ void NexusConfig::SetFeedbackPair(FeedbackVector vector,
std::pair<MaybeObject, MaybeObject> NexusConfig::GetFeedbackPair(
FeedbackVector vector, FeedbackSlot slot) const {
base::SharedMutexGuard<base::kShared> shared_mutex_guard(
isolate()->feedback_vector_access());
if (mode() == BackgroundThread) {
isolate()->feedback_vector_access()->LockShared();
}
MaybeObject feedback = vector.Get(slot);
MaybeObject feedback_extra = vector.Get(slot.WithOffset(1));
return std::make_pair(feedback, feedback_extra);
auto return_value = std::make_pair(feedback, feedback_extra);
if (mode() == BackgroundThread) {
isolate()->feedback_vector_access()->UnlockShared();
}
return return_value;
}
FeedbackNexus::FeedbackNexus(Handle<FeedbackVector> vector, FeedbackSlot slot)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment