Commit 80e85caa authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

[iwyu] Cleanup more heap/ files

Bug: v8:7490
Change-Id: I6bed10a6389d83b1941ba894f06b2d9540e84139
Reviewed-on: https://chromium-review.googlesource.com/1152733Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54781}
parent a61c16b0
......@@ -2008,6 +2008,7 @@ v8_source_set("v8_base") {
"src/heap/spaces-inl.h",
"src/heap/spaces.cc",
"src/heap/spaces.h",
"src/heap/store-buffer-inl.h",
"src/heap/store-buffer.cc",
"src/heap/store-buffer.h",
"src/heap/stress-marking-observer.cc",
......
......@@ -21,7 +21,7 @@
// leak heap internals to users of this interface!
#include "src/heap/incremental-marking-inl.h"
#include "src/heap/spaces-inl.h"
#include "src/heap/store-buffer.h"
#include "src/heap/store-buffer-inl.h"
#include "src/isolate.h"
#include "src/log.h"
#include "src/msan.h"
......
......@@ -7,6 +7,7 @@
#include "src/heap/incremental-marking.h"
#include "src/isolate.h"
#include "src/objects-inl.h"
#include "src/objects/maybe-object.h"
namespace v8 {
......
// Copyright 2011 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_HEAP_STORE_BUFFER_INL_H_
#define V8_HEAP_STORE_BUFFER_INL_H_
#include "src/heap/store-buffer.h"
#include "src/heap/heap-inl.h"
namespace v8 {
namespace internal {
void StoreBuffer::InsertDeletionIntoStoreBuffer(Address start, Address end) {
if (top_ + sizeof(Address) * 2 > limit_[current_]) {
StoreBufferOverflow(heap_->isolate());
}
*top_ = MarkDeletionAddress(start);
top_++;
*top_ = end;
top_++;
}
void StoreBuffer::InsertIntoStoreBuffer(Address slot) {
if (top_ + sizeof(Address) > limit_[current_]) {
StoreBufferOverflow(heap_->isolate());
}
*top_ = slot;
top_++;
}
} // namespace internal
} // namespace v8
#endif // V8_HEAP_STORE_BUFFER_INL_H_
......@@ -10,6 +10,7 @@
#include "src/base/template-utils.h"
#include "src/counters.h"
#include "src/heap/incremental-marking.h"
#include "src/heap/store-buffer-inl.h"
#include "src/isolate.h"
#include "src/objects-inl.h"
#include "src/v8.h"
......@@ -76,6 +77,48 @@ void StoreBuffer::TearDown() {
}
}
void StoreBuffer::DeleteDuringRuntime(StoreBuffer* store_buffer, Address start,
Address end) {
DCHECK(store_buffer->mode() == StoreBuffer::NOT_IN_GC);
store_buffer->InsertDeletionIntoStoreBuffer(start, end);
}
void StoreBuffer::InsertDuringRuntime(StoreBuffer* store_buffer, Address slot) {
DCHECK(store_buffer->mode() == StoreBuffer::NOT_IN_GC);
store_buffer->InsertIntoStoreBuffer(slot);
}
void StoreBuffer::DeleteDuringGarbageCollection(StoreBuffer* store_buffer,
Address start, Address end) {
// In GC the store buffer has to be empty at any time.
DCHECK(store_buffer->Empty());
DCHECK(store_buffer->mode() != StoreBuffer::NOT_IN_GC);
Page* page = Page::FromAddress(start);
if (end) {
RememberedSet<OLD_TO_NEW>::RemoveRange(page, start, end,
SlotSet::PREFREE_EMPTY_BUCKETS);
} else {
RememberedSet<OLD_TO_NEW>::Remove(page, start);
}
}
void StoreBuffer::InsertDuringGarbageCollection(StoreBuffer* store_buffer,
Address slot) {
DCHECK(store_buffer->mode() != StoreBuffer::NOT_IN_GC);
RememberedSet<OLD_TO_NEW>::Insert(Page::FromAddress(slot), slot);
}
void StoreBuffer::SetMode(StoreBufferMode mode) {
mode_ = mode;
if (mode == NOT_IN_GC) {
insertion_callback = &InsertDuringRuntime;
deletion_callback = &DeleteDuringRuntime;
} else {
insertion_callback = &InsertDuringGarbageCollection;
deletion_callback = &DeleteDuringGarbageCollection;
}
}
int StoreBuffer::StoreBufferOverflow(Isolate* isolate) {
isolate->heap()->store_buffer()->FlipStoreBuffers();
isolate->counters()->store_buffer_overflows()->Increment();
......
......@@ -34,6 +34,15 @@ class StoreBuffer {
V8_EXPORT_PRIVATE static int StoreBufferOverflow(Isolate* isolate);
static void DeleteDuringGarbageCollection(StoreBuffer* store_buffer,
Address start, Address end);
static void InsertDuringGarbageCollection(StoreBuffer* store_buffer,
Address slot);
static void DeleteDuringRuntime(StoreBuffer* store_buffer, Address start,
Address end);
static void InsertDuringRuntime(StoreBuffer* store_buffer, Address slot);
explicit StoreBuffer(Heap* heap);
void SetUp();
void TearDown();
......@@ -61,6 +70,16 @@ class StoreBuffer {
return address & ~kDeletionTag;
}
inline void InsertDeletionIntoStoreBuffer(Address start, Address end);
inline void InsertIntoStoreBuffer(Address slot);
void InsertEntry(Address slot) {
// Insertions coming from the GC are directly inserted into the remembered
// set. Insertions coming from the runtime are added to the store buffer to
// allow concurrent processing.
insertion_callback(this, slot);
}
// If we only want to delete a single slot, end should be set to null which
// will be written into the second field. When processing the store buffer
// the more efficient Remove method will be called in this case.
......@@ -71,72 +90,7 @@ class StoreBuffer {
deletion_callback(this, start, end);
}
static void DeleteDuringGarbageCollection(StoreBuffer* store_buffer,
Address start, Address end) {
// In GC the store buffer has to be empty at any time.
DCHECK(store_buffer->Empty());
DCHECK(store_buffer->mode() != StoreBuffer::NOT_IN_GC);
Page* page = Page::FromAddress(start);
if (end) {
RememberedSet<OLD_TO_NEW>::RemoveRange(page, start, end,
SlotSet::PREFREE_EMPTY_BUCKETS);
} else {
RememberedSet<OLD_TO_NEW>::Remove(page, start);
}
}
static void DeleteDuringRuntime(StoreBuffer* store_buffer, Address start,
Address end) {
DCHECK(store_buffer->mode() == StoreBuffer::NOT_IN_GC);
store_buffer->InsertDeletionIntoStoreBuffer(start, end);
}
void InsertDeletionIntoStoreBuffer(Address start, Address end) {
if (top_ + sizeof(Address) * 2 > limit_[current_]) {
StoreBufferOverflow(heap_->isolate());
}
*top_ = MarkDeletionAddress(start);
top_++;
*top_ = end;
top_++;
}
static void InsertDuringGarbageCollection(StoreBuffer* store_buffer,
Address slot) {
DCHECK(store_buffer->mode() != StoreBuffer::NOT_IN_GC);
RememberedSet<OLD_TO_NEW>::Insert(Page::FromAddress(slot), slot);
}
static void InsertDuringRuntime(StoreBuffer* store_buffer, Address slot) {
DCHECK(store_buffer->mode() == StoreBuffer::NOT_IN_GC);
store_buffer->InsertIntoStoreBuffer(slot);
}
void InsertIntoStoreBuffer(Address slot) {
if (top_ + sizeof(Address) > limit_[current_]) {
StoreBufferOverflow(heap_->isolate());
}
*top_ = slot;
top_++;
}
void InsertEntry(Address slot) {
// Insertions coming from the GC are directly inserted into the remembered
// set. Insertions coming from the runtime are added to the store buffer to
// allow concurrent processing.
insertion_callback(this, slot);
}
void SetMode(StoreBufferMode mode) {
mode_ = mode;
if (mode == NOT_IN_GC) {
insertion_callback = &InsertDuringRuntime;
deletion_callback = &DeleteDuringRuntime;
} else {
insertion_callback = &InsertDuringGarbageCollection;
deletion_callback = &DeleteDuringGarbageCollection;
}
}
void SetMode(StoreBufferMode mode);
// Used by the concurrent processing thread to transfer entries from the
// store buffer to the remembered set.
......
......@@ -48,11 +48,9 @@ AUTO_EXCLUDE = [
'src/elements-inl.h',
'src/field-type.h',
'src/heap/incremental-marking.h',
'src/heap/incremental-marking-inl.h',
'src/heap/mark-compact.h',
'src/heap/objects-visiting.h',
'src/heap/scavenger.h',
'src/heap/store-buffer.h',
'src/ic/ic.h',
'src/json-stringifier.h',
'src/keys.h',
......
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