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

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

Issue 1701963003: Filter invalid slots after array trimming. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix compile Created 4 years, 10 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.h ('k') | test/cctest/heap/heap-tester.h » ('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 9b154e5cbcc3714521dc50458c8c2526e91275f0..6144706f71e3ed34d81693557b4fe87492499619 100644
--- a/src/heap/slot-set.h
+++ b/src/heap/slot-set.h
@@ -74,28 +74,40 @@ class SlotSet : public Malloced {
MaskCell(start_bucket, start_cell, start_mask | end_mask);
return;
}
- MaskCell(start_bucket, start_cell, start_mask);
- start_cell++;
- if (bucket[start_bucket] != nullptr && start_bucket < end_bucket) {
- while (start_cell < kCellsPerBucket) {
- bucket[start_bucket][start_cell] = 0;
- start_cell++;
+ int current_bucket = start_bucket;
+ int current_cell = start_cell;
+ MaskCell(current_bucket, current_cell, start_mask);
+ current_cell++;
+ if (current_bucket < end_bucket) {
+ if (bucket[current_bucket] != nullptr) {
+ while (current_cell < kCellsPerBucket) {
+ bucket[current_bucket][current_cell] = 0;
+ current_cell++;
+ }
}
+ // The rest of the current bucket is cleared.
+ // Move on to the next bucket.
+ current_bucket++;
+ current_cell = 0;
}
- while (start_bucket < end_bucket) {
- delete[] bucket[start_bucket];
- bucket[start_bucket] = nullptr;
- start_bucket++;
+ DCHECK(current_bucket == end_bucket ||
+ (current_bucket < end_bucket && current_cell == 0));
+ while (current_bucket < end_bucket) {
+ ReleaseBucket(current_bucket);
+ current_bucket++;
}
- if (start_bucket < kBuckets && bucket[start_bucket] != nullptr) {
- while (start_cell < end_cell) {
- bucket[start_bucket][start_cell] = 0;
- start_cell++;
- }
+ // All buckets between start_bucket and end_bucket are cleared.
+ DCHECK(current_bucket == end_bucket && current_cell <= end_cell);
+ if (current_bucket == kBuckets || bucket[current_bucket] == nullptr) {
+ return;
}
- if (end_bucket < kBuckets) {
- MaskCell(end_bucket, end_cell, end_mask);
+ while (current_cell < end_cell) {
+ bucket[current_bucket][current_cell] = 0;
+ current_cell++;
}
+ // All cells between start_cell and end_cell are cleared.
+ DCHECK(current_bucket == end_bucket && current_cell == end_cell);
+ MaskCell(end_bucket, end_cell, end_mask);
}
// The slot offset specifies a slot at address page_start_ + slot_offset.
« no previous file with comments | « src/heap/remembered-set.h ('k') | test/cctest/heap/heap-tester.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698