Don't allow large object space to grow over the max oldspace limit (fixes issue 1717)
Review URL: http://codereview.chromium.org/8345040 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9695 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
d0fe04447e
commit
1c21a9dc6a
@ -5450,7 +5450,7 @@ bool Heap::Setup(bool create_heap_objects) {
|
|||||||
// The large object code space may contain code or data. We set the memory
|
// The large object code space may contain code or data. We set the memory
|
||||||
// to be non-executable here for safety, but this means we need to enable it
|
// to be non-executable here for safety, but this means we need to enable it
|
||||||
// explicitly when allocating large code objects.
|
// explicitly when allocating large code objects.
|
||||||
lo_space_ = new LargeObjectSpace(this, LO_SPACE);
|
lo_space_ = new LargeObjectSpace(this, max_old_generation_size_, LO_SPACE);
|
||||||
if (lo_space_ == NULL) return false;
|
if (lo_space_ == NULL) return false;
|
||||||
if (!lo_space_->Setup()) return false;
|
if (!lo_space_->Setup()) return false;
|
||||||
if (create_heap_objects) {
|
if (create_heap_objects) {
|
||||||
|
@ -2291,8 +2291,11 @@ HeapObject* LargeObjectIterator::Next() {
|
|||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// LargeObjectSpace
|
// 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
|
: Space(heap, id, NOT_EXECUTABLE), // Managed on a per-allocation basis
|
||||||
|
max_capacity_(max_capacity),
|
||||||
first_page_(NULL),
|
first_page_(NULL),
|
||||||
size_(0),
|
size_(0),
|
||||||
page_count_(0),
|
page_count_(0),
|
||||||
@ -2332,6 +2335,10 @@ MaybeObject* LargeObjectSpace::AllocateRaw(int object_size,
|
|||||||
return Failure::RetryAfterGC(identity());
|
return Failure::RetryAfterGC(identity());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Size() + object_size > max_capacity_) {
|
||||||
|
return Failure::RetryAfterGC(identity());
|
||||||
|
}
|
||||||
|
|
||||||
LargePage* page = heap()->isolate()->memory_allocator()->
|
LargePage* page = heap()->isolate()->memory_allocator()->
|
||||||
AllocateLargePage(object_size, executable, this);
|
AllocateLargePage(object_size, executable, this);
|
||||||
if (page == NULL) return Failure::RetryAfterGC(identity());
|
if (page == NULL) return Failure::RetryAfterGC(identity());
|
||||||
|
@ -2442,7 +2442,7 @@ class CellSpace : public FixedSpace {
|
|||||||
|
|
||||||
class LargeObjectSpace : public Space {
|
class LargeObjectSpace : public Space {
|
||||||
public:
|
public:
|
||||||
LargeObjectSpace(Heap* heap, AllocationSpace id);
|
LargeObjectSpace(Heap* heap, intptr_t max_capacity, AllocationSpace id);
|
||||||
virtual ~LargeObjectSpace() {}
|
virtual ~LargeObjectSpace() {}
|
||||||
|
|
||||||
// Initializes internal data structures.
|
// Initializes internal data structures.
|
||||||
@ -2512,6 +2512,7 @@ class LargeObjectSpace : public Space {
|
|||||||
bool SlowContains(Address addr) { return !FindObject(addr)->IsFailure(); }
|
bool SlowContains(Address addr) { return !FindObject(addr)->IsFailure(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
intptr_t max_capacity_;
|
||||||
// The head of the linked list of large object chunks.
|
// The head of the linked list of large object chunks.
|
||||||
LargePage* first_page_;
|
LargePage* first_page_;
|
||||||
intptr_t size_; // allocated bytes
|
intptr_t size_; // allocated bytes
|
||||||
|
Loading…
Reference in New Issue
Block a user