Index: src/heap/spaces.cc |
diff --git a/src/heap/spaces.cc b/src/heap/spaces.cc |
index f8d340f18278b3d5ded9deecfe24fe329634bdbe..6d8bff64d69f870fbc5719432805659c20adb4b4 100644 |
--- a/src/heap/spaces.cc |
+++ b/src/heap/spaces.cc |
@@ -2840,9 +2840,7 @@ AllocationResult LargeObjectSpace::AllocateRaw(int object_size, |
return AllocationResult::Retry(identity()); |
} |
- if (Size() + object_size > max_capacity_) { |
- return AllocationResult::Retry(identity()); |
- } |
+ if (!CanAllocateSize(object_size)) return AllocationResult::Retry(identity()); |
LargePage* page = heap()->isolate()->memory_allocator()->AllocateLargePage( |
object_size, this, executable); |
@@ -2887,6 +2885,13 @@ AllocationResult LargeObjectSpace::AllocateRaw(int object_size, |
} |
+void LargeObjectSpace::PrepareForDeserialization(int large_objects_total_size) { |
+ if (CanAllocateSize(large_objects_total_size)) return; |
+ heap()->CollectAllAvailableGarbage("prepare for deserialization"); |
+ if (!CanAllocateSize(large_objects_total_size)) FatalProcessOutOfMemory(); |
+} |
+ |
+ |
size_t LargeObjectSpace::CommittedPhysicalMemory() { |
if (!base::VirtualMemory::HasLazyCommits()) return CommittedMemory(); |
size_t size = 0; |