Index: src/spaces.cc |
=================================================================== |
--- src/spaces.cc (revision 9623) |
+++ src/spaces.cc (working copy) |
@@ -2278,8 +2278,11 @@ |
// ----------------------------------------------------------------------------- |
// LargeObjectSpace |
-LargeObjectSpace::LargeObjectSpace(Heap* heap, AllocationSpace id) |
+LargeObjectSpace::LargeObjectSpace(Heap* heap, |
+ intptr_t max_capacity, |
+ AllocationSpace id) |
: Space(heap, id, NOT_EXECUTABLE), // Managed on a per-allocation basis |
+ max_capacity_(max_capacity), |
first_page_(NULL), |
size_(0), |
page_count_(0), |
@@ -2319,6 +2322,10 @@ |
return Failure::RetryAfterGC(identity()); |
} |
+ if (Size() + object_size > max_capacity_) { |
+ return Failure::RetryAfterGC(identity()); |
+ } |
+ |
LargePage* page = heap()->isolate()->memory_allocator()-> |
AllocateLargePage(object_size, executable, this); |
if (page == NULL) return Failure::RetryAfterGC(identity()); |