Revision: 10958
Author: [email protected]
Date: Wed Mar 7 08:24:11 2012
Log: Ignore soft heap limit when reserving space.
[email protected]
Review URL: https://chromiumcodereview.appspot.com/9605014
http://code.google.com/p/v8/source/detail?r=10958
Modified:
/branches/bleeding_edge/src/heap.cc
/branches/bleeding_edge/src/heap.h
/branches/bleeding_edge/src/spaces.cc
=======================================
--- /branches/bleeding_edge/src/heap.cc Mon Mar 5 08:39:25 2012
+++ /branches/bleeding_edge/src/heap.cc Wed Mar 7 08:24:11 2012
@@ -576,6 +576,17 @@
HEAP->symbol_table()->IterateElements(&verifier);
#endif // DEBUG
}
+
+
+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(
@@ -604,28 +615,28 @@
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 @@
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;
}
}
=======================================
--- /branches/bleeding_edge/src/heap.h Tue Feb 28 01:05:55 2012
+++ /branches/bleeding_edge/src/heap.h Wed Mar 7 08:24:11 2012
@@ -1341,6 +1341,10 @@
inline intptr_t OldGenerationSpaceAvailable() {
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 =
=======================================
--- /branches/bleeding_edge/src/spaces.cc Fri Feb 24 01:45:27 2012
+++ /branches/bleeding_edge/src/spaces.cc Wed Mar 7 08:24:11 2012
@@ -2217,7 +2217,9 @@
// 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);
}
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev