Commit 426bba70 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[wasm] Fix names of struct members

In contrast to (private) class fields, struct fields are public and
accessed directly, and do not end in an underscore.
This CL fixes naming in struct fields in the recently introduces
{CompilationUnitQueues} class.

R=ahaas@chromium.org

Bug: v8:9183
Change-Id: I87d80650dc4a1c58cf8067ebb4ecfadf929545ab
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1621936Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61687}
parent 2aa0f934
...@@ -148,7 +148,7 @@ class CompilationUnitQueues { ...@@ -148,7 +148,7 @@ class CompilationUnitQueues {
explicit CompilationUnitQueues(int max_tasks) : queues_(max_tasks) { explicit CompilationUnitQueues(int max_tasks) : queues_(max_tasks) {
DCHECK_LT(0, max_tasks); DCHECK_LT(0, max_tasks);
for (int task_id = 0; task_id < max_tasks; ++task_id) { for (int task_id = 0; task_id < max_tasks; ++task_id) {
queues_[task_id].next_steal_task_id_ = next_task_id(task_id); queues_[task_id].next_steal_task_id = next_task_id(task_id);
} }
for (auto& atomic_counter : num_units_) { for (auto& atomic_counter : num_units_) {
std::atomic_init(&atomic_counter, size_t{0}); std::atomic_init(&atomic_counter, size_t{0});
...@@ -169,14 +169,14 @@ class CompilationUnitQueues { ...@@ -169,14 +169,14 @@ class CompilationUnitQueues {
// so, return it, otherwise get the task id to steal from. // so, return it, otherwise get the task id to steal from.
int steal_task_id; int steal_task_id;
{ {
base::MutexGuard mutex_guard(&queue->mutex_); base::MutexGuard mutex_guard(&queue->mutex);
if (!queue->units_[tier].empty()) { if (!queue->units[tier].empty()) {
auto unit = queue->units_[tier].back(); auto unit = queue->units[tier].back();
queue->units_[tier].pop_back(); queue->units[tier].pop_back();
DecrementUnitCount(tier); DecrementUnitCount(tier);
return unit; return unit;
} }
steal_task_id = queue->next_steal_task_id_; steal_task_id = queue->next_steal_task_id;
} }
// Try to steal from all other queues. If none of this succeeds, the outer // Try to steal from all other queues. If none of this succeeds, the outer
...@@ -207,18 +207,18 @@ class CompilationUnitQueues { ...@@ -207,18 +207,18 @@ class CompilationUnitQueues {
} }
Queue* queue = &queues_[queue_to_add]; Queue* queue = &queues_[queue_to_add];
base::MutexGuard guard(&queue->mutex_); base::MutexGuard guard(&queue->mutex);
if (!baseline_units.empty()) { if (!baseline_units.empty()) {
queue->units_[kBaseline].insert(queue->units_[kBaseline].end(), queue->units[kBaseline].insert(queue->units[kBaseline].end(),
baseline_units.begin(), baseline_units.begin(),
baseline_units.end()); baseline_units.end());
num_units_[kBaseline].fetch_add(baseline_units.size(), num_units_[kBaseline].fetch_add(baseline_units.size(),
std::memory_order_relaxed); std::memory_order_relaxed);
} }
if (!top_tier_units.empty()) { if (!top_tier_units.empty()) {
queue->units_[kTopTier].insert(queue->units_[kTopTier].end(), queue->units[kTopTier].insert(queue->units[kTopTier].end(),
top_tier_units.begin(), top_tier_units.begin(),
top_tier_units.end()); top_tier_units.end());
num_units_[kTopTier].fetch_add(top_tier_units.size(), num_units_[kTopTier].fetch_add(top_tier_units.size(),
std::memory_order_relaxed); std::memory_order_relaxed);
} }
...@@ -242,12 +242,12 @@ class CompilationUnitQueues { ...@@ -242,12 +242,12 @@ class CompilationUnitQueues {
static constexpr int kNumTiers = kTopTier + 1; static constexpr int kNumTiers = kTopTier + 1;
struct Queue { struct Queue {
base::Mutex mutex_; base::Mutex mutex;
// Protected by {mutex_}: // Protected by {mutex}:
std::vector<WasmCompilationUnit> units_[kNumTiers]; std::vector<WasmCompilationUnit> units[kNumTiers];
int next_steal_task_id_; int next_steal_task_id;
// End of fields protected by {mutex_}. // End of fields protected by {mutex}.
}; };
std::vector<Queue> queues_; std::vector<Queue> queues_;
...@@ -283,8 +283,8 @@ class CompilationUnitQueues { ...@@ -283,8 +283,8 @@ class CompilationUnitQueues {
base::Optional<WasmCompilationUnit> returned_unit; base::Optional<WasmCompilationUnit> returned_unit;
{ {
Queue* steal_queue = &queues_[steal_from_task_id]; Queue* steal_queue = &queues_[steal_from_task_id];
base::MutexGuard guard(&steal_queue->mutex_); base::MutexGuard guard(&steal_queue->mutex);
auto* steal_from_vector = &steal_queue->units_[wanted_tier]; auto* steal_from_vector = &steal_queue->units[wanted_tier];
if (steal_from_vector->empty()) return {}; if (steal_from_vector->empty()) return {};
size_t remaining = steal_from_vector->size() / 2; size_t remaining = steal_from_vector->size() / 2;
auto steal_begin = steal_from_vector->begin() + remaining; auto steal_begin = steal_from_vector->begin() + remaining;
...@@ -293,10 +293,10 @@ class CompilationUnitQueues { ...@@ -293,10 +293,10 @@ class CompilationUnitQueues {
steal_from_vector->erase(steal_begin, steal_from_vector->end()); steal_from_vector->erase(steal_begin, steal_from_vector->end());
} }
Queue* queue = &queues_[task_id]; Queue* queue = &queues_[task_id];
base::MutexGuard guard(&queue->mutex_); base::MutexGuard guard(&queue->mutex);
auto* target_queue = &queue->units_[wanted_tier]; auto* target_queue = &queue->units[wanted_tier];
target_queue->insert(target_queue->end(), stolen.begin(), stolen.end()); target_queue->insert(target_queue->end(), stolen.begin(), stolen.end());
queue->next_steal_task_id_ = next_task_id(steal_from_task_id); queue->next_steal_task_id = next_task_id(steal_from_task_id);
return returned_unit; return returned_unit;
} }
}; };
......
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