Skip to content

Commit

Permalink
[heap][cleanup] Avoid exposing store-buffer internals.
Browse files Browse the repository at this point in the history
[email protected]
BUG=v8:7490

Change-Id: Ifb4b41db3ca34567d735203667978451815c60d4
Reviewed-on: https://chromium-review.googlesource.com/1181056
Reviewed-by: Michael Lippautz <[email protected]>
Commit-Queue: Michael Starzinger <[email protected]>
Cr-Commit-Position: refs/heads/master@{#55221}
  • Loading branch information
Michael Starzinger authored and Commit Bot committed Aug 20, 2018
1 parent 2af2d88 commit 60408d9
Show file tree
Hide file tree
Showing 13 changed files with 32 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/builtins/builtins-internal-gen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ class RecordWriteCodeStubAssembler : public CodeStubAssembler {
store_buffer_top_addr, new_store_buffer_top);

Node* test = WordAnd(new_store_buffer_top,
IntPtrConstant(StoreBuffer::kStoreBufferMask));
IntPtrConstant(Heap::store_buffer_mask_constant()));

Label overflow(this);
Branch(WordEqual(test, IntPtrConstant(0)), &overflow, next);
Expand Down
2 changes: 1 addition & 1 deletion src/external-reference.cc
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ ExternalReference::incremental_marking_record_write_function() {

ExternalReference ExternalReference::store_buffer_overflow_function() {
return ExternalReference(
Redirect(FUNCTION_ADDR(StoreBuffer::StoreBufferOverflow)));
Redirect(Heap::store_buffer_overflow_function_address()));
}

ExternalReference ExternalReference::delete_handle_scope_extensions() {
Expand Down
1 change: 1 addition & 0 deletions src/heap/array-buffer-collector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "src/base/template-utils.h"
#include "src/heap/array-buffer-tracker.h"
#include "src/heap/gc-tracer.h"
#include "src/heap/heap-inl.h"

namespace v8 {
Expand Down
2 changes: 2 additions & 0 deletions src/heap/code-stats.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
// found in the LICENSE file.

#include "src/heap/code-stats.h"

#include "src/objects-inl.h"
#include "src/reloc-info.h"

namespace v8 {
namespace internal {
Expand Down
2 changes: 2 additions & 0 deletions src/heap/factory-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#include "src/heap/factory.h"

// Clients of this interface shouldn't depend on lots of heap internals.
// Do not include anything from src/heap here!
#include "src/handles-inl.h"
#include "src/objects-inl.h"
#include "src/string-hasher.h"
Expand Down
2 changes: 2 additions & 0 deletions src/heap/factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#ifndef V8_HEAP_FACTORY_H_
#define V8_HEAP_FACTORY_H_

// Clients of this interface shouldn't depend on lots of heap internals.
// Do not include anything from src/heap here!
#include "src/builtins/builtins.h"
#include "src/globals.h"
#include "src/handles.h"
Expand Down
8 changes: 1 addition & 7 deletions src/heap/heap-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@
#include "src/counters-inl.h"
#include "src/feedback-vector.h"

// TODO(mstarzinger): There are 3 more includes to remove in order to no longer
// TODO(mstarzinger): There is one more include to remove in order to no longer
// 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-inl.h"
#include "src/isolate.h"
#include "src/log.h"
#include "src/msan.h"
Expand Down Expand Up @@ -429,10 +427,6 @@ bool Heap::ShouldBePromoted(Address old_address) {
(!page->ContainsLimit(age_mark) || old_address < age_mark);
}

Address* Heap::store_buffer_top_address() {
return store_buffer()->top_address();
}

void Heap::CopyBlock(Address dst, Address src, int byte_size) {
CopyWords(reinterpret_cast<Object**>(dst), reinterpret_cast<Object**>(src),
static_cast<size_t>(byte_size / kPointerSize));
Expand Down
14 changes: 14 additions & 0 deletions src/heap/heap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5246,6 +5246,20 @@ void Heap::CheckHandleCount() {
isolate_->handle_scope_implementer()->Iterate(&v);
}

Address* Heap::store_buffer_top_address() {
return store_buffer()->top_address();
}

// static
intptr_t Heap::store_buffer_mask_constant() {
return StoreBuffer::kStoreBufferMask;
}

// static
Address Heap::store_buffer_overflow_function_address() {
return FUNCTION_ADDR(StoreBuffer::StoreBufferOverflow);
}

void Heap::ClearRecordedSlot(HeapObject* object, Object** slot) {
Address slot_addr = reinterpret_cast<Address>(slot);
Page* page = Page::FromAddress(slot_addr);
Expand Down
4 changes: 3 additions & 1 deletion src/heap/heap.h
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,9 @@ class Heap {

void SetIsMarkingFlag(uint8_t flag) { is_marking_flag_ = flag; }

inline Address* store_buffer_top_address();
Address* store_buffer_top_address();
static intptr_t store_buffer_mask_constant();
static Address store_buffer_overflow_function_address();

void ClearRecordedSlot(HeapObject* object, Object** slot);
void ClearRecordedSlotRange(Address start, Address end);
Expand Down
1 change: 1 addition & 0 deletions src/heap/incremental-marking.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "src/heap/gc-idle-time-handler.h"
#include "src/heap/gc-tracer.h"
#include "src/heap/heap-inl.h"
#include "src/heap/incremental-marking-inl.h"
#include "src/heap/mark-compact-inl.h"
#include "src/heap/object-stats.h"
#include "src/heap/objects-visiting-inl.h"
Expand Down
1 change: 1 addition & 0 deletions src/heap/spaces.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "src/heap/heap-controller.h"
#include "src/heap/incremental-marking.h"
#include "src/heap/mark-compact.h"
#include "src/heap/remembered-set.h"
#include "src/heap/slot-set.h"
#include "src/heap/sweeper.h"
#include "src/msan.h"
Expand Down
3 changes: 2 additions & 1 deletion src/objects/maybe-object-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
#ifndef V8_OBJECTS_MAYBE_OBJECT_INL_H_
#define V8_OBJECTS_MAYBE_OBJECT_INL_H_

#include "src/objects-inl.h"
#include "src/objects/maybe-object.h"

#include "src/objects-inl.h"

namespace v8 {
namespace internal {

Expand Down
1 change: 1 addition & 0 deletions test/cctest/heap/test-heap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include "src/heap/incremental-marking.h"
#include "src/heap/mark-compact.h"
#include "src/heap/memory-reducer.h"
#include "src/heap/remembered-set.h"
#include "src/ic/ic.h"
#include "src/macro-assembler-inl.h"
#include "src/objects-inl.h"
Expand Down

0 comments on commit 60408d9

Please sign in to comment.