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