summaryrefslogtreecommitdiff
path: root/deps/v8/src/heap/concurrent-allocator.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/heap/concurrent-allocator.cc')
-rw-r--r--deps/v8/src/heap/concurrent-allocator.cc24
1 files changed, 16 insertions, 8 deletions
diff --git a/deps/v8/src/heap/concurrent-allocator.cc b/deps/v8/src/heap/concurrent-allocator.cc
index 6125d18f19..fac728b454 100644
--- a/deps/v8/src/heap/concurrent-allocator.cc
+++ b/deps/v8/src/heap/concurrent-allocator.cc
@@ -80,8 +80,13 @@ void StressConcurrentAllocatorTask::Schedule(Isolate* isolate) {
}
ConcurrentAllocator::ConcurrentAllocator(LocalHeap* local_heap,
- PagedSpace* space)
- : local_heap_(local_heap), space_(space), owning_heap_(space_->heap()) {}
+ PagedSpace* space, Context context)
+ : local_heap_(local_heap),
+ space_(space),
+ owning_heap_(space_->heap()),
+ context_(context) {
+ DCHECK_IMPLIES(!local_heap_, context_ == Context::kGC);
+}
void ConcurrentAllocator::FreeLinearAllocationArea() {
// The code page of the linear allocation area needs to be unprotected
@@ -90,8 +95,7 @@ void ConcurrentAllocator::FreeLinearAllocationArea() {
if (IsLabValid() && space_->identity() == CODE_SPACE) {
optional_scope.emplace(MemoryChunk::FromAddress(lab_.top()));
}
- if (lab_.top() != lab_.limit() &&
- owning_heap()->incremental_marking()->black_allocation()) {
+ if (lab_.top() != lab_.limit() && IsBlackAllocationEnabled()) {
Page::FromAddress(lab_.top())
->DestroyBlackAreaBackground(lab_.top(), lab_.limit());
}
@@ -118,7 +122,8 @@ void ConcurrentAllocator::MarkLinearAllocationAreaBlack() {
base::Optional<CodePageHeaderModificationScope> optional_rwx_write_scope;
if (space_->identity() == CODE_SPACE) {
optional_rwx_write_scope.emplace(
- "Marking Code objects requires write access to the Code page header");
+ "Marking InstructionStream objects requires write access to the "
+ "Code page header");
}
Page::FromAllocationAreaAddress(top)->CreateBlackAreaBackground(top, limit);
}
@@ -132,7 +137,8 @@ void ConcurrentAllocator::UnmarkLinearAllocationArea() {
base::Optional<CodePageHeaderModificationScope> optional_rwx_write_scope;
if (space_->identity() == CODE_SPACE) {
optional_rwx_write_scope.emplace(
- "Marking Code objects requires write access to the Code page header");
+ "Marking InstructionStream objects requires write access to the "
+ "Code page header");
}
Page::FromAllocationAreaAddress(top)->DestroyBlackAreaBackground(top,
limit);
@@ -225,7 +231,8 @@ ConcurrentAllocator::AllocateFromSpaceFreeList(size_t min_size_in_bytes,
}
}
- if (owning_heap()->ShouldExpandOldGenerationOnSlowAllocation(local_heap_) &&
+ if (owning_heap()->ShouldExpandOldGenerationOnSlowAllocation(local_heap_,
+ origin) &&
owning_heap()->CanExpandOldGenerationBackground(local_heap_,
space_->AreaSize())) {
result = space_->TryExpandBackground(max_size_in_bytes);
@@ -277,7 +284,8 @@ AllocationResult ConcurrentAllocator::AllocateOutsideLab(
}
bool ConcurrentAllocator::IsBlackAllocationEnabled() const {
- return owning_heap()->incremental_marking()->black_allocation();
+ return context_ == Context::kNotGC &&
+ owning_heap()->incremental_marking()->black_allocation();
}
void ConcurrentAllocator::MakeLabIterable() {