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

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

Issue 2358333002: Revert of [heap] Concurrently free empty typed slot set chunks. (Closed)
Patch Set: Created 4 years, 3 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 3690099dc8621a82a562a44592758d4d1ca70cbe..6ba3174e3c42f71198bb851faa2de13cf1bd65ee 100644
--- a/src/heap/slot-set.h
+++ b/src/heap/slot-set.h
@@ -4,8 +4,6 @@
#ifndef V8_SLOT_SET_H
#define V8_SLOT_SET_H
-
-#include <stack>
#include "src/allocation.h"
#include "src/base/atomic-utils.h"
@@ -261,8 +259,6 @@
// typed slots contain V8 internal pointers that are not directly exposed to JS.
class TypedSlotSet {
public:
- enum IterationMode { PREFREE_EMPTY_CHUNKS, KEEP_EMPTY_CHUNKS };
-
typedef std::pair<SlotType, uint32_t> TypeAndOffset;
struct TypedSlot {
@@ -330,10 +326,6 @@
void Insert(SlotType type, uint32_t host_offset, uint32_t offset) {
TypedSlot slot(type, host_offset, offset);
Chunk* top_chunk = chunk_.Value();
- if (!top_chunk) {
- top_chunk = new Chunk(nullptr, kInitialBufferSize);
- chunk_.SetValue(top_chunk);
- }
if (!top_chunk->AddSlot(slot)) {
Chunk* new_top_chunk =
new Chunk(top_chunk, NextCapacity(top_chunk->capacity.Value()));
@@ -354,15 +346,13 @@
// else return REMOVE_SLOT;
// });
template <typename Callback>
- int Iterate(Callback callback, IterationMode mode) {
+ int Iterate(Callback callback) {
STATIC_ASSERT(CLEARED_SLOT < 8);
Chunk* chunk = chunk_.Value();
- Chunk* previous = nullptr;
int new_count = 0;
while (chunk != nullptr) {
TypedSlot* buffer = chunk->buffer.Value();
int count = chunk->count.Value();
- bool empty = true;
for (int i = 0; i < count; i++) {
// Order is important here. We have to read out the slot type last to
// observe the concurrent removal case consistently.
@@ -373,38 +363,14 @@
Address addr = page_start_ + type_and_offset.second;
if (callback(type, host_addr, addr) == KEEP_SLOT) {
new_count++;
- empty = false;
} else {
buffer[i].Clear();
}
}
}
-
- if (mode == PREFREE_EMPTY_CHUNKS && empty) {
- // We remove the chunk from the list but let it still point its next
- // chunk to allow concurrent iteration.
- if (previous) {
- previous->next.SetValue(chunk->next.Value());
- } else {
- chunk_.SetValue(chunk->next.Value());
- }
- base::LockGuard<base::Mutex> guard(&to_be_freed_chunks_mutex_);
- to_be_freed_chunks_.push(chunk);
- } else {
- previous = chunk;
- }
chunk = chunk->next.Value();
}
return new_count;
- }
-
- void FreeToBeFreedChunks() {
- base::LockGuard<base::Mutex> guard(&to_be_freed_chunks_mutex_);
- while (!to_be_freed_chunks_.empty()) {
- Chunk* top = to_be_freed_chunks_.top();
- to_be_freed_chunks_.pop();
- delete top;
- }
}
private:
@@ -445,8 +411,6 @@
Address page_start_;
base::AtomicValue<Chunk*> chunk_;
- base::Mutex to_be_freed_chunks_mutex_;
- std::stack<Chunk*> to_be_freed_chunks_;
};
} // namespace internal
« 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