summaryrefslogtreecommitdiff
path: root/deps/v8/src/heap/heap-inl.h
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/heap/heap-inl.h')
-rw-r--r--deps/v8/src/heap/heap-inl.h45
1 files changed, 37 insertions, 8 deletions
diff --git a/deps/v8/src/heap/heap-inl.h b/deps/v8/src/heap/heap-inl.h
index da803f3339..56f3590b8a 100644
--- a/deps/v8/src/heap/heap-inl.h
+++ b/deps/v8/src/heap/heap-inl.h
@@ -111,10 +111,6 @@ void Heap::SetRootStringTable(StringTable value) {
roots_table()[RootIndex::kStringTable] = value.ptr();
}
-void Heap::SetRootNoScriptSharedFunctionInfos(Object value) {
- roots_table()[RootIndex::kNoScriptSharedFunctionInfos] = value.ptr();
-}
-
void Heap::SetMessageListeners(TemplateList value) {
roots_table()[RootIndex::kMessageListeners] = value.ptr();
}
@@ -163,7 +159,7 @@ AllocationResult Heap::AllocateRaw(int size_in_bytes, AllocationType type,
AllocationAlignment alignment) {
DCHECK(AllowHandleAllocation::IsAllowed());
DCHECK(AllowHeapAllocation::IsAllowed());
- DCHECK(gc_state_ == NOT_IN_GC);
+ DCHECK_EQ(gc_state_, NOT_IN_GC);
#ifdef V8_ENABLE_ALLOCATION_TIMEOUT
if (FLAG_random_gc_interval > 0 || FLAG_gc_interval >= 0) {
if (!always_allocate() && Heap::allocation_timeout_-- <= 0) {
@@ -180,8 +176,9 @@ AllocationResult Heap::AllocateRaw(int size_in_bytes, AllocationType type,
HeapObject object;
AllocationResult allocation;
- if (FLAG_single_generation && type == AllocationType::kYoung)
+ if (FLAG_single_generation && type == AllocationType::kYoung) {
type = AllocationType::kOld;
+ }
if (AllocationType::kYoung == type) {
if (large_object) {
@@ -212,9 +209,7 @@ AllocationResult Heap::AllocateRaw(int size_in_bytes, AllocationType type,
} else if (AllocationType::kMap == type) {
allocation = map_space_->AllocateRawUnaligned(size_in_bytes);
} else if (AllocationType::kReadOnly == type) {
-#ifdef V8_USE_SNAPSHOT
DCHECK(isolate_->serializer_enabled());
-#endif
DCHECK(!large_object);
DCHECK(CanAllocateInReadOnlySpace());
DCHECK_EQ(AllocationOrigin::kRuntime, origin);
@@ -242,6 +237,40 @@ AllocationResult Heap::AllocateRaw(int size_in_bytes, AllocationType type,
return allocation;
}
+template <Heap::AllocationRetryMode mode>
+HeapObject Heap::AllocateRawWith(int size, AllocationType allocation,
+ AllocationOrigin origin,
+ AllocationAlignment alignment) {
+ DCHECK(AllowHandleAllocation::IsAllowed());
+ DCHECK(AllowHeapAllocation::IsAllowed());
+ DCHECK_EQ(gc_state_, NOT_IN_GC);
+ Heap* heap = isolate()->heap();
+ Address* top = heap->NewSpaceAllocationTopAddress();
+ Address* limit = heap->NewSpaceAllocationLimitAddress();
+ if (allocation == AllocationType::kYoung &&
+ alignment == AllocationAlignment::kWordAligned &&
+ size <= kMaxRegularHeapObjectSize &&
+ (*limit - *top >= static_cast<unsigned>(size)) &&
+ V8_LIKELY(!FLAG_single_generation && FLAG_inline_new &&
+ FLAG_gc_interval == 0)) {
+ DCHECK(IsAligned(size, kTaggedSize));
+ HeapObject obj = HeapObject::FromAddress(*top);
+ *top += size;
+ heap->CreateFillerObjectAt(obj.address(), size, ClearRecordedSlots::kNo);
+ MSAN_ALLOCATED_UNINITIALIZED_MEMORY(obj.address(), size);
+ return obj;
+ }
+ switch (mode) {
+ case kLightRetry:
+ return AllocateRawWithLightRetrySlowPath(size, allocation, origin,
+ alignment);
+ case kRetryOrFail:
+ return AllocateRawWithRetryOrFailSlowPath(size, allocation, origin,
+ alignment);
+ }
+ UNREACHABLE();
+}
+
void Heap::OnAllocationEvent(HeapObject object, int size_in_bytes) {
for (auto& tracker : allocation_trackers_) {
tracker->AllocationEvent(object.address(), size_in_bytes);