Commit 7e8c7fa3 authored by ulan@chromium.org's avatar ulan@chromium.org

Ignore soft heap limit when reserving space.

R=mstarzinger@chromium.org

Review URL: https://chromiumcodereview.appspot.com/9605014

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10958 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 3ae794c4
......@@ -578,6 +578,17 @@ static void VerifySymbolTable() {
}
static bool AbortIncrementalMarkingAndCollectGarbage(
Heap* heap,
AllocationSpace space,
const char* gc_reason = NULL) {
heap->mark_compact_collector()->SetFlags(Heap::kMakeHeapIterableMask);
bool result = heap->CollectGarbage(space, gc_reason);
heap->mark_compact_collector()->SetFlags(Heap::kNoGCFlags);
return result;
}
void Heap::ReserveSpace(
int new_space_size,
int pointer_space_size,
......@@ -604,28 +615,28 @@ void Heap::ReserveSpace(
gc_performed = true;
}
if (!old_pointer_space->ReserveSpace(pointer_space_size)) {
Heap::CollectGarbage(OLD_POINTER_SPACE,
"failed to reserve space in the old pointer space");
AbortIncrementalMarkingAndCollectGarbage(this, OLD_POINTER_SPACE,
"failed to reserve space in the old pointer space");
gc_performed = true;
}
if (!(old_data_space->ReserveSpace(data_space_size))) {
Heap::CollectGarbage(OLD_DATA_SPACE,
"failed to reserve space in the old data space");
AbortIncrementalMarkingAndCollectGarbage(this, OLD_DATA_SPACE,
"failed to reserve space in the old data space");
gc_performed = true;
}
if (!(code_space->ReserveSpace(code_space_size))) {
Heap::CollectGarbage(CODE_SPACE,
"failed to reserve space in the code space");
AbortIncrementalMarkingAndCollectGarbage(this, CODE_SPACE,
"failed to reserve space in the code space");
gc_performed = true;
}
if (!(map_space->ReserveSpace(map_space_size))) {
Heap::CollectGarbage(MAP_SPACE,
"failed to reserve space in the map space");
AbortIncrementalMarkingAndCollectGarbage(this, MAP_SPACE,
"failed to reserve space in the map space");
gc_performed = true;
}
if (!(cell_space->ReserveSpace(cell_space_size))) {
Heap::CollectGarbage(CELL_SPACE,
"failed to reserve space in the cell space");
AbortIncrementalMarkingAndCollectGarbage(this, CELL_SPACE,
"failed to reserve space in the cell space");
gc_performed = true;
}
// We add a slack-factor of 2 in order to have space for a series of
......@@ -637,8 +648,8 @@ void Heap::ReserveSpace(
large_object_size += cell_space_size + map_space_size + code_space_size +
data_space_size + pointer_space_size;
if (!(lo_space->ReserveSpace(large_object_size))) {
Heap::CollectGarbage(LO_SPACE,
"failed to reserve space in the large object space");
AbortIncrementalMarkingAndCollectGarbage(this, LO_SPACE,
"failed to reserve space in the large object space");
gc_performed = true;
}
}
......
......@@ -1342,6 +1342,10 @@ class Heap {
return old_gen_allocation_limit_ - PromotedTotalSize();
}
inline intptr_t OldGenerationCapacityAvailable() {
return max_old_generation_size_ - PromotedTotalSize();
}
static const intptr_t kMinimumPromotionLimit = 5 * Page::kPageSize;
static const intptr_t kMinimumAllocationLimit =
8 * (Page::kPageSize > MB ? Page::kPageSize : MB);
......
......@@ -2217,7 +2217,9 @@ bool PagedSpace::ReserveSpace(int size_in_bytes) {
// You have to call this last, since the implementation from PagedSpace
// doesn't know that memory was 'promised' to large object space.
bool LargeObjectSpace::ReserveSpace(int bytes) {
return heap()->OldGenerationSpaceAvailable() >= bytes;
return heap()->OldGenerationCapacityAvailable() >= bytes &&
(!heap()->incremental_marking()->IsStopped() ||
heap()->OldGenerationSpaceAvailable() >= bytes);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment