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

Unified Diff: src/heap/slot-set.h

Issue 2418053002: Revert of [heap] Move slot filtering logic into sweeper. (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « src/heap/remembered-set.cc ('k') | test/unittests/heap/slot-set-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/slot-set.h
diff --git a/src/heap/slot-set.h b/src/heap/slot-set.h
index eb2fbb9e5b2773df435a1a70993fd8954ed04bca..78688654367ec8dec536d34d2e6bac63bab152bc 100644
--- a/src/heap/slot-set.h
+++ b/src/heap/slot-set.h
@@ -80,6 +80,15 @@
}
}
+ void PreFreeEmptyBucket(int bucket_index) {
+ base::AtomicValue<uint32_t>* bucket_ptr = bucket[bucket_index].Value();
+ if (bucket_ptr != nullptr) {
+ base::LockGuard<base::Mutex> guard(&to_be_freed_buckets_mutex_);
+ to_be_freed_buckets_.push(bucket_ptr);
+ bucket[bucket_index].SetValue(nullptr);
+ }
+ }
+
// The slot offsets specify a range of slots at addresses:
// [page_start_ + start_offset ... page_start_ + end_offset).
void RemoveRange(int start_offset, int end_offset, EmptyBucketMode mode) {
@@ -99,10 +108,12 @@
int current_cell = start_cell;
ClearCell(current_bucket, current_cell, ~start_mask);
current_cell++;
- base::AtomicValue<uint32_t>* bucket_ptr = bucket[current_bucket].Value();
if (current_bucket < end_bucket) {
- if (bucket_ptr != nullptr) {
- ClearBucket(bucket_ptr, current_cell, kCellsPerBucket);
+ if (bucket[current_bucket].Value() != nullptr) {
+ while (current_cell < kCellsPerBucket) {
+ bucket[current_bucket].Value()[current_cell].SetValue(0);
+ current_cell++;
+ }
}
// The rest of the current bucket is cleared.
// Move on to the next bucket.
@@ -116,23 +127,17 @@
PreFreeEmptyBucket(current_bucket);
} else if (mode == FREE_EMPTY_BUCKETS) {
ReleaseBucket(current_bucket);
- } else {
- DCHECK(mode == KEEP_EMPTY_BUCKETS);
- bucket_ptr = bucket[current_bucket].Value();
- if (bucket_ptr) {
- ClearBucket(bucket_ptr, 0, kCellsPerBucket);
- }
}
current_bucket++;
}
// All buckets between start_bucket and end_bucket are cleared.
- bucket_ptr = bucket[current_bucket].Value();
DCHECK(current_bucket == end_bucket && current_cell <= end_cell);
- if (current_bucket == kBuckets || bucket_ptr == nullptr) {
+ if (current_bucket == kBuckets ||
+ bucket[current_bucket].Value() == nullptr) {
return;
}
while (current_cell < end_cell) {
- bucket_ptr[current_cell].SetValue(0);
+ bucket[current_bucket].Value()[current_cell].SetValue(0);
current_cell++;
}
// All cells between start_cell and end_cell are cleared.
@@ -237,26 +242,6 @@
return result;
}
- void ClearBucket(base::AtomicValue<uint32_t>* bucket, int start_cell,
- int end_cell) {
- DCHECK_GE(start_cell, 0);
- DCHECK_LE(end_cell, kCellsPerBucket);
- int current_cell = start_cell;
- while (current_cell < kCellsPerBucket) {
- bucket[current_cell].SetValue(0);
- current_cell++;
- }
- }
-
- void PreFreeEmptyBucket(int bucket_index) {
- base::AtomicValue<uint32_t>* bucket_ptr = bucket[bucket_index].Value();
- if (bucket_ptr != nullptr) {
- base::LockGuard<base::Mutex> guard(&to_be_freed_buckets_mutex_);
- to_be_freed_buckets_.push(bucket_ptr);
- bucket[bucket_index].SetValue(nullptr);
- }
- }
-
void ReleaseBucket(int bucket_index) {
DeleteArray<base::AtomicValue<uint32_t>>(bucket[bucket_index].Value());
bucket[bucket_index].SetValue(nullptr);
« no previous file with comments | « src/heap/remembered-set.cc ('k') | test/unittests/heap/slot-set-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698