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