Commit 24fceeea authored by hpayer@chromium.org's avatar hpayer@chromium.org

Move store-buffer to heap and remove some unnecessary includes.

BUG=
R=jochen@chromium.org

Review URL: https://codereview.chromium.org/463523002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23046 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent d5980902
...@@ -646,6 +646,9 @@ source_set("v8_base") { ...@@ -646,6 +646,9 @@ source_set("v8_base") {
"src/heap/spaces-inl.h", "src/heap/spaces-inl.h",
"src/heap/spaces.cc", "src/heap/spaces.cc",
"src/heap/spaces.h", "src/heap/spaces.h",
"src/heap/store-buffer-inl.h",
"src/heap/store-buffer.cc",
"src/heap/store-buffer.h",
"src/heap/sweeper-thread.h", "src/heap/sweeper-thread.h",
"src/heap/sweeper-thread.cc", "src/heap/sweeper-thread.cc",
"src/hydrogen-alias-analysis.h", "src/hydrogen-alias-analysis.h",
...@@ -803,9 +806,6 @@ source_set("v8_base") { ...@@ -803,9 +806,6 @@ source_set("v8_base") {
"src/snapshot-source-sink.cc", "src/snapshot-source-sink.cc",
"src/snapshot-source-sink.h", "src/snapshot-source-sink.h",
"src/snapshot.h", "src/snapshot.h",
"src/store-buffer-inl.h",
"src/store-buffer.cc",
"src/store-buffer.h",
"src/string-search.cc", "src/string-search.cc",
"src/string-search.h", "src/string-search.h",
"src/string-stream.cc", "src/string-stream.cc",
......
...@@ -52,7 +52,6 @@ ...@@ -52,7 +52,6 @@
#include "src/regexp-stack.h" #include "src/regexp-stack.h"
#include "src/runtime.h" #include "src/runtime.h"
#include "src/serialize.h" #include "src/serialize.h"
#include "src/store-buffer-inl.h"
#include "src/stub-cache.h" #include "src/stub-cache.h"
#include "src/token.h" #include "src/token.h"
......
...@@ -10,12 +10,12 @@ ...@@ -10,12 +10,12 @@
#include "src/base/platform/platform.h" #include "src/base/platform/platform.h"
#include "src/cpu-profiler.h" #include "src/cpu-profiler.h"
#include "src/heap/heap.h" #include "src/heap/heap.h"
#include "src/heap/store-buffer.h"
#include "src/heap/store-buffer-inl.h"
#include "src/heap-profiler.h" #include "src/heap-profiler.h"
#include "src/isolate.h" #include "src/isolate.h"
#include "src/list-inl.h" #include "src/list-inl.h"
#include "src/objects.h" #include "src/objects.h"
#include "src/store-buffer.h"
#include "src/store-buffer-inl.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
......
...@@ -20,13 +20,13 @@ ...@@ -20,13 +20,13 @@
#include "src/heap/mark-compact.h" #include "src/heap/mark-compact.h"
#include "src/heap/objects-visiting-inl.h" #include "src/heap/objects-visiting-inl.h"
#include "src/heap/objects-visiting.h" #include "src/heap/objects-visiting.h"
#include "src/heap/store-buffer.h"
#include "src/heap-profiler.h" #include "src/heap-profiler.h"
#include "src/isolate-inl.h" #include "src/isolate-inl.h"
#include "src/natives.h" #include "src/natives.h"
#include "src/runtime-profiler.h" #include "src/runtime-profiler.h"
#include "src/scopeinfo.h" #include "src/scopeinfo.h"
#include "src/snapshot.h" #include "src/snapshot.h"
#include "src/store-buffer.h"
#include "src/utils.h" #include "src/utils.h"
#include "src/v8threads.h" #include "src/v8threads.h"
#include "src/vm-state-inl.h" #include "src/vm-state-inl.h"
......
...@@ -16,9 +16,9 @@ ...@@ -16,9 +16,9 @@
#include "src/heap/mark-compact.h" #include "src/heap/mark-compact.h"
#include "src/heap/objects-visiting.h" #include "src/heap/objects-visiting.h"
#include "src/heap/spaces.h" #include "src/heap/spaces.h"
#include "src/heap/store-buffer.h"
#include "src/list.h" #include "src/list.h"
#include "src/splay-tree-inl.h" #include "src/splay-tree-inl.h"
#include "src/store-buffer.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
......
...@@ -38,7 +38,7 @@ class Isolate; ...@@ -38,7 +38,7 @@ class Isolate;
// may be larger than the page size. // may be larger than the page size.
// //
// A store-buffer based write barrier is used to keep track of intergenerational // A store-buffer based write barrier is used to keep track of intergenerational
// references. See store-buffer.h. // references. See heap/store-buffer.h.
// //
// During scavenges and mark-sweep collections we sometimes (after a store // During scavenges and mark-sweep collections we sometimes (after a store
// buffer overflow) iterate intergenerational pointers without decoding heap // buffer overflow) iterate intergenerational pointers without decoding heap
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#ifndef V8_STORE_BUFFER_INL_H_ #ifndef V8_STORE_BUFFER_INL_H_
#define V8_STORE_BUFFER_INL_H_ #define V8_STORE_BUFFER_INL_H_
#include "src/store-buffer.h" #include "src/heap/store-buffer.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
...@@ -44,8 +44,7 @@ void StoreBuffer::EnterDirectlyIntoStoreBuffer(Address addr) { ...@@ -44,8 +44,7 @@ void StoreBuffer::EnterDirectlyIntoStoreBuffer(Address addr) {
old_buffer_is_filtered_ = false; old_buffer_is_filtered_ = false;
if (top >= old_limit_) { if (top >= old_limit_) {
DCHECK(callback_ != NULL); DCHECK(callback_ != NULL);
(*callback_)(heap_, (*callback_)(heap_, MemoryChunk::FromAnyPointerAddress(heap_, addr),
MemoryChunk::FromAnyPointerAddress(heap_, addr),
kStoreBufferFullEvent); kStoreBufferFullEvent);
} }
} }
...@@ -58,8 +57,7 @@ void StoreBuffer::ClearDeadObject(HeapObject* object) { ...@@ -58,8 +57,7 @@ void StoreBuffer::ClearDeadObject(HeapObject* object) {
map_field = NULL; map_field = NULL;
} }
} }
}
} // namespace v8::internal
} } // namespace v8::internal
#endif // V8_STORE_BUFFER_INL_H_ #endif // V8_STORE_BUFFER_INL_H_
...@@ -2,15 +2,13 @@ ...@@ -2,15 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "src/store-buffer.h"
#include <algorithm> #include <algorithm>
#include "src/v8.h" #include "src/v8.h"
#include "src/base/atomicops.h" #include "src/base/atomicops.h"
#include "src/counters.h" #include "src/counters.h"
#include "src/store-buffer-inl.h" #include "src/heap/store-buffer-inl.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
...@@ -32,8 +30,7 @@ StoreBuffer::StoreBuffer(Heap* heap) ...@@ -32,8 +30,7 @@ StoreBuffer::StoreBuffer(Heap* heap)
virtual_memory_(NULL), virtual_memory_(NULL),
hash_set_1_(NULL), hash_set_1_(NULL),
hash_set_2_(NULL), hash_set_2_(NULL),
hash_sets_are_empty_(true) { hash_sets_are_empty_(true) {}
}
void StoreBuffer::SetUp() { void StoreBuffer::SetUp() {
...@@ -58,16 +55,15 @@ void StoreBuffer::SetUp() { ...@@ -58,16 +55,15 @@ void StoreBuffer::SetUp() {
old_limit_ = old_start_ + initial_length; old_limit_ = old_start_ + initial_length;
old_reserved_limit_ = old_start_ + kOldStoreBufferLength; old_reserved_limit_ = old_start_ + kOldStoreBufferLength;
CHECK(old_virtual_memory_->Commit( CHECK(old_virtual_memory_->Commit(reinterpret_cast<void*>(old_start_),
reinterpret_cast<void*>(old_start_), (old_limit_ - old_start_) * kPointerSize,
(old_limit_ - old_start_) * kPointerSize, false));
false));
DCHECK(reinterpret_cast<Address>(start_) >= virtual_memory_->address()); DCHECK(reinterpret_cast<Address>(start_) >= virtual_memory_->address());
DCHECK(reinterpret_cast<Address>(limit_) >= virtual_memory_->address()); DCHECK(reinterpret_cast<Address>(limit_) >= virtual_memory_->address());
Address* vm_limit = reinterpret_cast<Address*>( Address* vm_limit = reinterpret_cast<Address*>(
reinterpret_cast<char*>(virtual_memory_->address()) + reinterpret_cast<char*>(virtual_memory_->address()) +
virtual_memory_->size()); virtual_memory_->size());
DCHECK(start_ <= vm_limit); DCHECK(start_ <= vm_limit);
DCHECK(limit_ <= vm_limit); DCHECK(limit_ <= vm_limit);
USE(vm_limit); USE(vm_limit);
...@@ -133,8 +129,7 @@ void StoreBuffer::EnsureSpace(intptr_t space_needed) { ...@@ -133,8 +129,7 @@ void StoreBuffer::EnsureSpace(intptr_t space_needed) {
old_limit_ < old_reserved_limit_) { old_limit_ < old_reserved_limit_) {
size_t grow = old_limit_ - old_start_; // Double size. size_t grow = old_limit_ - old_start_; // Double size.
CHECK(old_virtual_memory_->Commit(reinterpret_cast<void*>(old_limit_), CHECK(old_virtual_memory_->Commit(reinterpret_cast<void*>(old_limit_),
grow * kPointerSize, grow * kPointerSize, false));
false));
old_limit_ += grow; old_limit_ += grow;
} }
...@@ -168,13 +163,12 @@ void StoreBuffer::EnsureSpace(intptr_t space_needed) { ...@@ -168,13 +163,12 @@ void StoreBuffer::EnsureSpace(intptr_t space_needed) {
static const struct Samples { static const struct Samples {
int prime_sample_step; int prime_sample_step;
int threshold; int threshold;
} samples[kSampleFinenesses] = { } samples[kSampleFinenesses] = {
{ 97, ((Page::kPageSize / kPointerSize) / 97) / 8 }, {97, ((Page::kPageSize / kPointerSize) / 97) / 8},
{ 23, ((Page::kPageSize / kPointerSize) / 23) / 16 }, {23, ((Page::kPageSize / kPointerSize) / 23) / 16},
{ 7, ((Page::kPageSize / kPointerSize) / 7) / 32 }, {7, ((Page::kPageSize / kPointerSize) / 7) / 32},
{ 3, ((Page::kPageSize / kPointerSize) / 3) / 256 }, {3, ((Page::kPageSize / kPointerSize) / 3) / 256},
{ 1, 0} {1, 0}};
};
for (int i = 0; i < kSampleFinenesses; i++) { for (int i = 0; i < kSampleFinenesses; i++) {
ExemptPopularPages(samples[i].prime_sample_step, samples[i].threshold); ExemptPopularPages(samples[i].prime_sample_step, samples[i].threshold);
// As a last resort we mark all pages as being exempt from the store buffer. // As a last resort we mark all pages as being exempt from the store buffer.
...@@ -317,11 +311,9 @@ bool StoreBuffer::CellIsInStoreBuffer(Address cell_address) { ...@@ -317,11 +311,9 @@ bool StoreBuffer::CellIsInStoreBuffer(Address cell_address) {
void StoreBuffer::ClearFilteringHashSets() { void StoreBuffer::ClearFilteringHashSets() {
if (!hash_sets_are_empty_) { if (!hash_sets_are_empty_) {
memset(reinterpret_cast<void*>(hash_set_1_), memset(reinterpret_cast<void*>(hash_set_1_), 0,
0,
sizeof(uintptr_t) * kHashSetLength); sizeof(uintptr_t) * kHashSetLength);
memset(reinterpret_cast<void*>(hash_set_2_), memset(reinterpret_cast<void*>(hash_set_2_), 0,
0,
sizeof(uintptr_t) * kHashSetLength); sizeof(uintptr_t) * kHashSetLength);
hash_sets_are_empty_ = true; hash_sets_are_empty_ = true;
} }
...@@ -376,12 +368,9 @@ void StoreBuffer::GCEpilogue() { ...@@ -376,12 +368,9 @@ void StoreBuffer::GCEpilogue() {
void StoreBuffer::FindPointersToNewSpaceInRegion( void StoreBuffer::FindPointersToNewSpaceInRegion(
Address start, Address start, Address end, ObjectSlotCallback slot_callback,
Address end,
ObjectSlotCallback slot_callback,
bool clear_maps) { bool clear_maps) {
for (Address slot_address = start; for (Address slot_address = start; slot_address < end;
slot_address < end;
slot_address += kPointerSize) { slot_address += kPointerSize) {
Object** slot = reinterpret_cast<Object**>(slot_address); Object** slot = reinterpret_cast<Object**>(slot_address);
Object* object = reinterpret_cast<Object*>( Object* object = reinterpret_cast<Object*>(
...@@ -403,9 +392,8 @@ void StoreBuffer::FindPointersToNewSpaceInRegion( ...@@ -403,9 +392,8 @@ void StoreBuffer::FindPointersToNewSpaceInRegion(
} }
void StoreBuffer::IteratePointersInStoreBuffer( void StoreBuffer::IteratePointersInStoreBuffer(ObjectSlotCallback slot_callback,
ObjectSlotCallback slot_callback, bool clear_maps) {
bool clear_maps) {
Address* limit = old_top_; Address* limit = old_top_;
old_top_ = old_start_; old_top_ = old_start_;
{ {
...@@ -597,5 +585,5 @@ void StoreBuffer::Compact() { ...@@ -597,5 +585,5 @@ void StoreBuffer::Compact() {
} }
heap_->isolate()->counters()->store_buffer_compactions()->Increment(); heap_->isolate()->counters()->store_buffer_compactions()->Increment();
} }
}
} } // namespace v8::internal } // namespace v8::internal
...@@ -19,8 +19,7 @@ class StoreBuffer; ...@@ -19,8 +19,7 @@ class StoreBuffer;
typedef void (*ObjectSlotCallback)(HeapObject** from, HeapObject* to); typedef void (*ObjectSlotCallback)(HeapObject** from, HeapObject* to);
typedef void (StoreBuffer::*RegionCallback)(Address start, typedef void (StoreBuffer::*RegionCallback)(Address start, Address end,
Address end,
ObjectSlotCallback slot_callback, ObjectSlotCallback slot_callback,
bool clear_maps); bool clear_maps);
...@@ -147,12 +146,11 @@ class StoreBuffer { ...@@ -147,12 +146,11 @@ class StoreBuffer {
void ExemptPopularPages(int prime_sample_step, int threshold); void ExemptPopularPages(int prime_sample_step, int threshold);
// Set the map field of the object to NULL if contains a map. // Set the map field of the object to NULL if contains a map.
inline void ClearDeadObject(HeapObject *object); inline void ClearDeadObject(HeapObject* object);
void IteratePointersToNewSpace(ObjectSlotCallback callback, bool clear_maps); void IteratePointersToNewSpace(ObjectSlotCallback callback, bool clear_maps);
void FindPointersToNewSpaceInRegion(Address start, void FindPointersToNewSpaceInRegion(Address start, Address end,
Address end,
ObjectSlotCallback slot_callback, ObjectSlotCallback slot_callback,
bool clear_maps); bool clear_maps);
...@@ -161,11 +159,9 @@ class StoreBuffer { ...@@ -161,11 +159,9 @@ class StoreBuffer {
// If either visit_pointer_region or callback can cause an allocation // If either visit_pointer_region or callback can cause an allocation
// in old space and changes in allocation watermark then // in old space and changes in allocation watermark then
// can_preallocate_during_iteration should be set to true. // can_preallocate_during_iteration should be set to true.
void IteratePointersOnPage( void IteratePointersOnPage(PagedSpace* space, Page* page,
PagedSpace* space, RegionCallback region_callback,
Page* page, ObjectSlotCallback slot_callback);
RegionCallback region_callback,
ObjectSlotCallback slot_callback);
void IteratePointersInStoreBuffer(ObjectSlotCallback slot_callback, void IteratePointersInStoreBuffer(ObjectSlotCallback slot_callback,
bool clear_maps); bool clear_maps);
...@@ -181,8 +177,7 @@ class StoreBuffer { ...@@ -181,8 +177,7 @@ class StoreBuffer {
class StoreBufferRebuildScope { class StoreBufferRebuildScope {
public: public:
explicit StoreBufferRebuildScope(Heap* heap, explicit StoreBufferRebuildScope(Heap* heap, StoreBuffer* store_buffer,
StoreBuffer* store_buffer,
StoreBufferCallback callback) StoreBufferCallback callback)
: store_buffer_(store_buffer), : store_buffer_(store_buffer),
stored_state_(store_buffer->store_buffer_rebuilding_enabled_), stored_state_(store_buffer->store_buffer_rebuilding_enabled_),
...@@ -220,7 +215,7 @@ class DontMoveStoreBufferEntriesScope { ...@@ -220,7 +215,7 @@ class DontMoveStoreBufferEntriesScope {
StoreBuffer* store_buffer_; StoreBuffer* store_buffer_;
bool stored_state_; bool stored_state_;
}; };
}
} } // namespace v8::internal } // namespace v8::internal
#endif // V8_STORE_BUFFER_H_ #endif // V8_STORE_BUFFER_H_
...@@ -23,12 +23,12 @@ ...@@ -23,12 +23,12 @@
#include "src/heap/incremental-marking.h" #include "src/heap/incremental-marking.h"
#include "src/heap/objects-visiting.h" #include "src/heap/objects-visiting.h"
#include "src/heap/spaces.h" #include "src/heap/spaces.h"
#include "src/heap/store-buffer.h"
#include "src/isolate.h" #include "src/isolate.h"
#include "src/lookup.h" #include "src/lookup.h"
#include "src/objects.h" #include "src/objects.h"
#include "src/property.h" #include "src/property.h"
#include "src/prototype.h" #include "src/prototype.h"
#include "src/store-buffer.h"
#include "src/transitions-inl.h" #include "src/transitions-inl.h"
#include "src/v8memory.h" #include "src/v8memory.h"
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "src/deoptimizer.h" #include "src/deoptimizer.h"
#include "src/elements.h" #include "src/elements.h"
#include "src/frames.h" #include "src/frames.h"
#include "src/heap/store-buffer.h"
#include "src/heap-profiler.h" #include "src/heap-profiler.h"
#include "src/hydrogen.h" #include "src/hydrogen.h"
#include "src/isolate.h" #include "src/isolate.h"
...@@ -21,7 +22,6 @@ ...@@ -21,7 +22,6 @@
#include "src/runtime-profiler.h" #include "src/runtime-profiler.h"
#include "src/sampler.h" #include "src/sampler.h"
#include "src/serialize.h" #include "src/serialize.h"
#include "src/store-buffer.h"
namespace v8 { namespace v8 {
......
...@@ -530,6 +530,9 @@ ...@@ -530,6 +530,9 @@
'../../src/heap/spaces-inl.h', '../../src/heap/spaces-inl.h',
'../../src/heap/spaces.cc', '../../src/heap/spaces.cc',
'../../src/heap/spaces.h', '../../src/heap/spaces.h',
'../../src/heap/store-buffer-inl.h',
'../../src/heap/store-buffer.cc',
'../../src/heap/store-buffer.h',
'../../src/heap/sweeper-thread.h', '../../src/heap/sweeper-thread.h',
'../../src/heap/sweeper-thread.cc', '../../src/heap/sweeper-thread.cc',
'../../src/hydrogen-alias-analysis.h', '../../src/hydrogen-alias-analysis.h',
...@@ -688,9 +691,6 @@ ...@@ -688,9 +691,6 @@
'../../src/snapshot.h', '../../src/snapshot.h',
'../../src/snapshot-source-sink.cc', '../../src/snapshot-source-sink.cc',
'../../src/snapshot-source-sink.h', '../../src/snapshot-source-sink.h',
'../../src/store-buffer-inl.h',
'../../src/store-buffer.cc',
'../../src/store-buffer.h',
'../../src/string-search.cc', '../../src/string-search.cc',
'../../src/string-search.h', '../../src/string-search.h',
'../../src/string-stream.cc', '../../src/string-stream.cc',
......
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