Commit 21f1dfe9 authored by mlippautz's avatar mlippautz Committed by Commit bot

[heap] Remove store buffer top from roots

Change x64 to use the external references like all other platforms.

BUG=chromium:581076
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#35160}
parent 731e53c7
...@@ -1099,7 +1099,6 @@ source_set("v8_base") { ...@@ -1099,7 +1099,6 @@ 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.cc",
"src/heap/store-buffer.h", "src/heap/store-buffer.h",
"src/i18n.cc", "src/i18n.cc",
......
...@@ -7278,11 +7278,11 @@ class Internals { ...@@ -7278,11 +7278,11 @@ class Internals {
static const int kIsolateRootsOffset = static const int kIsolateRootsOffset =
kAmountOfExternalAllocatedMemoryAtLastGlobalGCOffset + kApiInt64Size + kAmountOfExternalAllocatedMemoryAtLastGlobalGCOffset + kApiInt64Size +
kApiPointerSize; kApiPointerSize;
static const int kUndefinedValueRootIndex = 5; static const int kUndefinedValueRootIndex = 4;
static const int kNullValueRootIndex = 7; static const int kNullValueRootIndex = 6;
static const int kTrueValueRootIndex = 8; static const int kTrueValueRootIndex = 7;
static const int kFalseValueRootIndex = 9; static const int kFalseValueRootIndex = 8;
static const int kEmptyStringRootIndex = 10; static const int kEmptyStringRootIndex = 9;
// The external allocation limit should be below 256 MB on all architectures // The external allocation limit should be below 256 MB on all architectures
// to avoid that resource-constrained embedders run low on memory. // to avoid that resource-constrained embedders run low on memory.
......
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
#include "src/heap/heap.h" #include "src/heap/heap.h"
#include "src/heap/incremental-marking-inl.h" #include "src/heap/incremental-marking-inl.h"
#include "src/heap/mark-compact.h" #include "src/heap/mark-compact.h"
#include "src/heap/remembered-set.h"
#include "src/heap/spaces-inl.h" #include "src/heap/spaces-inl.h"
#include "src/heap/store-buffer.h" #include "src/heap/store-buffer.h"
#include "src/heap/store-buffer-inl.h"
#include "src/isolate.h" #include "src/isolate.h"
#include "src/list-inl.h" #include "src/list-inl.h"
#include "src/log.h" #include "src/log.h"
......
...@@ -2934,7 +2934,6 @@ void Heap::CreateInitialObjects() { ...@@ -2934,7 +2934,6 @@ void Heap::CreateInitialObjects() {
bool Heap::RootCanBeWrittenAfterInitialization(Heap::RootListIndex root_index) { bool Heap::RootCanBeWrittenAfterInitialization(Heap::RootListIndex root_index) {
switch (root_index) { switch (root_index) {
case kStoreBufferTopRootIndex:
case kNumberStringCacheRootIndex: case kNumberStringCacheRootIndex:
case kInstanceofCacheFunctionRootIndex: case kInstanceofCacheFunctionRootIndex:
case kInstanceofCacheMapRootIndex: case kInstanceofCacheMapRootIndex:
......
...@@ -33,7 +33,6 @@ using v8::MemoryPressureLevel; ...@@ -33,7 +33,6 @@ using v8::MemoryPressureLevel;
V(Map, one_pointer_filler_map, OnePointerFillerMap) \ V(Map, one_pointer_filler_map, OnePointerFillerMap) \
V(Map, two_pointer_filler_map, TwoPointerFillerMap) \ V(Map, two_pointer_filler_map, TwoPointerFillerMap) \
/* Cluster the most popular ones in a few cache lines here at the top. */ \ /* Cluster the most popular ones in a few cache lines here at the top. */ \
V(Smi, store_buffer_top, StoreBufferTop) \
V(Oddball, undefined_value, UndefinedValue) \ V(Oddball, undefined_value, UndefinedValue) \
V(Oddball, the_hole_value, TheHoleValue) \ V(Oddball, the_hole_value, TheHoleValue) \
V(Oddball, null_value, NullValue) \ V(Oddball, null_value, NullValue) \
...@@ -1076,9 +1075,7 @@ class Heap { ...@@ -1076,9 +1075,7 @@ class Heap {
// Write barrier support for object[offset] = o; // Write barrier support for object[offset] = o;
inline void RecordWrite(Object* object, int offset, Object* o); inline void RecordWrite(Object* object, int offset, Object* o);
Address* store_buffer_top_address() { Address* store_buffer_top_address() { return store_buffer()->top_address(); }
return reinterpret_cast<Address*>(&roots_[kStoreBufferTopRootIndex]);
}
void ClearRecordedSlot(HeapObject* object, Object** slot); void ClearRecordedSlot(HeapObject* object, Object** slot);
void ClearRecordedSlotRange(Address start, Address end); void ClearRecordedSlotRange(Address start, Address end);
......
// 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_STORE_BUFFER_INL_H_
#define V8_STORE_BUFFER_INL_H_
#include "src/heap/heap.h"
#include "src/heap/remembered-set.h"
#include "src/heap/spaces-inl.h"
#include "src/heap/store-buffer.h"
namespace v8 {
namespace internal {
} // namespace internal
} // namespace v8
#endif // V8_STORE_BUFFER_INL_H_
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include "src/counters.h" #include "src/counters.h"
#include "src/heap/incremental-marking.h" #include "src/heap/incremental-marking.h"
#include "src/heap/store-buffer-inl.h"
#include "src/isolate.h" #include "src/isolate.h"
#include "src/objects-inl.h" #include "src/objects-inl.h"
#include "src/v8.h" #include "src/v8.h"
...@@ -17,7 +16,11 @@ namespace v8 { ...@@ -17,7 +16,11 @@ namespace v8 {
namespace internal { namespace internal {
StoreBuffer::StoreBuffer(Heap* heap) StoreBuffer::StoreBuffer(Heap* heap)
: heap_(heap), start_(nullptr), limit_(nullptr), virtual_memory_(nullptr) {} : heap_(heap),
top_(nullptr),
start_(nullptr),
limit_(nullptr),
virtual_memory_(nullptr) {}
void StoreBuffer::SetUp() { void StoreBuffer::SetUp() {
// Allocate 3x the buffer size, so that we can start the new store buffer // Allocate 3x the buffer size, so that we can start the new store buffer
...@@ -47,14 +50,13 @@ void StoreBuffer::SetUp() { ...@@ -47,14 +50,13 @@ void StoreBuffer::SetUp() {
false)) { // Not executable. false)) { // Not executable.
V8::FatalProcessOutOfMemory("StoreBuffer::SetUp"); V8::FatalProcessOutOfMemory("StoreBuffer::SetUp");
} }
heap_->set_store_buffer_top(reinterpret_cast<Smi*>(start_)); top_ = start_;
} }
void StoreBuffer::TearDown() { void StoreBuffer::TearDown() {
delete virtual_memory_; delete virtual_memory_;
start_ = limit_ = NULL; top_ = start_ = limit_ = nullptr;
heap_->set_store_buffer_top(reinterpret_cast<Smi*>(start_));
} }
...@@ -64,16 +66,15 @@ void StoreBuffer::StoreBufferOverflow(Isolate* isolate) { ...@@ -64,16 +66,15 @@ void StoreBuffer::StoreBufferOverflow(Isolate* isolate) {
} }
void StoreBuffer::MoveEntriesToRememberedSet() { void StoreBuffer::MoveEntriesToRememberedSet() {
Address* top = reinterpret_cast<Address*>(heap_->store_buffer_top()); if (top_ == start_) return;
if (top == start_) return; DCHECK(top_ <= limit_);
DCHECK(top <= limit_); for (Address* current = start_; current < top_; current++) {
heap_->set_store_buffer_top(reinterpret_cast<Smi*>(start_));
for (Address* current = start_; current < top; current++) {
DCHECK(!heap_->code_space()->Contains(*current)); DCHECK(!heap_->code_space()->Contains(*current));
Address addr = *current; Address addr = *current;
Page* page = Page::FromAnyPointerAddress(heap_, addr); Page* page = Page::FromAnyPointerAddress(heap_, addr);
RememberedSet<OLD_TO_NEW>::Insert(page, addr); RememberedSet<OLD_TO_NEW>::Insert(page, addr);
} }
top_ = start_;
} }
} // namespace internal } // namespace internal
......
...@@ -18,20 +18,26 @@ namespace internal { ...@@ -18,20 +18,26 @@ namespace internal {
// code. On buffer overflow the slots are moved to the remembered set. // code. On buffer overflow the slots are moved to the remembered set.
class StoreBuffer { class StoreBuffer {
public: public:
explicit StoreBuffer(Heap* heap); static const int kStoreBufferOverflowBit = 1 << (14 + kPointerSizeLog2);
static const int kStoreBufferSize = kStoreBufferOverflowBit;
static const int kStoreBufferLength = kStoreBufferSize / sizeof(Address);
static void StoreBufferOverflow(Isolate* isolate); static void StoreBufferOverflow(Isolate* isolate);
explicit StoreBuffer(Heap* heap);
void SetUp(); void SetUp();
void TearDown(); void TearDown();
static const int kStoreBufferOverflowBit = 1 << (14 + kPointerSizeLog2); // Used to add entries from generated code.
static const int kStoreBufferSize = kStoreBufferOverflowBit; inline Address* top_address() { return reinterpret_cast<Address*>(&top_); }
static const int kStoreBufferLength = kStoreBufferSize / sizeof(Address);
void MoveEntriesToRememberedSet(); void MoveEntriesToRememberedSet();
private: private:
Heap* heap_; Heap* heap_;
Address* top_;
// The start and the limit of the buffer that contains store slots // The start and the limit of the buffer that contains store slots
// added from the generated code. // added from the generated code.
Address* start_; Address* start_;
......
...@@ -150,8 +150,7 @@ void StartupSerializer::VisitPointers(Object** start, Object** end) { ...@@ -150,8 +150,7 @@ void StartupSerializer::VisitPointers(Object** start, Object** end) {
} }
bool StartupSerializer::RootShouldBeSkipped(int root_index) { bool StartupSerializer::RootShouldBeSkipped(int root_index) {
if (root_index == Heap::kStoreBufferTopRootIndex || if (root_index == Heap::kStackLimitRootIndex ||
root_index == Heap::kStackLimitRootIndex ||
root_index == Heap::kRealStackLimitRootIndex) { root_index == Heap::kRealStackLimitRootIndex) {
return true; return true;
} }
......
...@@ -215,13 +215,15 @@ void MacroAssembler::RememberedSetHelper(Register object, // For debug tests. ...@@ -215,13 +215,15 @@ void MacroAssembler::RememberedSetHelper(Register object, // For debug tests.
bind(&ok); bind(&ok);
} }
// Load store buffer top. // Load store buffer top.
LoadRoot(scratch, Heap::kStoreBufferTopRootIndex); ExternalReference store_buffer =
ExternalReference::store_buffer_top(isolate());
movp(scratch, ExternalOperand(store_buffer));
// Store pointer to buffer. // Store pointer to buffer.
movp(Operand(scratch, 0), addr); movp(Operand(scratch, 0), addr);
// Increment buffer top. // Increment buffer top.
addp(scratch, Immediate(kPointerSize)); addp(scratch, Immediate(kPointerSize));
// Write back new top of buffer. // Write back new top of buffer.
StoreRoot(scratch, Heap::kStoreBufferTopRootIndex); movp(ExternalOperand(store_buffer), scratch);
// Call stub on end of buffer. // Call stub on end of buffer.
Label done; Label done;
// Check for end of buffer. // Check for end of buffer.
......
...@@ -915,7 +915,6 @@ ...@@ -915,7 +915,6 @@
'../../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.cc',
'../../src/heap/store-buffer.h', '../../src/heap/store-buffer.h',
'../../src/i18n.cc', '../../src/i18n.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