Review URL: http://codereview.chromium.org/507025
http://code.google.com/p/v8/source/detail?r=3497
Modified:
/branches/bleeding_edge/src/flag-definitions.h
/branches/bleeding_edge/src/heap.cc
/branches/bleeding_edge/src/heap.h
/branches/bleeding_edge/src/mark-compact.cc
/branches/bleeding_edge/src/spaces.cc
/branches/bleeding_edge/src/spaces.h
=======================================
--- /branches/bleeding_edge/src/flag-definitions.h Mon Nov 30 05:35:59 2009
+++ /branches/bleeding_edge/src/flag-definitions.h Fri Dec 18 05:38:09 2009
@@ -198,6 +198,9 @@
DEFINE_bool(canonicalize_object_literal_maps, true,
"Canonicalize maps for object literals.")
+DEFINE_bool(use_big_map_space, true,
+ "Use big map space, but don't compact if it grew too big.")
+
// mksnapshot.cc
DEFINE_bool(h, false, "print this message")
DEFINE_bool(new_snapshot, true, "use new snapshot implementation")
=======================================
--- /branches/bleeding_edge/src/heap.cc Thu Dec 17 07:35:15 2009
+++ /branches/bleeding_edge/src/heap.cc Fri Dec 18 05:38:09 2009
@@ -3437,7 +3437,10 @@
if (!code_space_->Setup(NULL, 0)) return false;
// Initialize map space.
- map_space_ = new MapSpace(kMaxMapSpaceSize, MAP_SPACE);
+ map_space_ = new MapSpace(FLAG_use_big_map_space
+ ? max_old_generation_size_
+ : (MapSpace::kMaxMapPageIndex + 1) * Page::kPageSize,
+ MAP_SPACE);
if (map_space_ == NULL) return false;
if (!map_space_->Setup(NULL, 0)) return false;
=======================================
--- /branches/bleeding_edge/src/heap.h Thu Dec 17 07:35:15 2009
+++ /branches/bleeding_edge/src/heap.h Fri Dec 18 05:38:09 2009
@@ -890,11 +890,6 @@
static int linear_allocation_scope_depth_;
static bool context_disposed_pending_;
- // The number of MapSpace pages is limited by the way we pack
- // Map pointers during GC.
- static const int kMaxMapSpaceSize =
- (1 << (MapWord::kMapPageIndexBits)) * Page::kPageSize;
-
#if defined(V8_TARGET_ARCH_X64)
static const int kMaxObjectSizeInNewSpace = 512*KB;
#else
=======================================
--- /branches/bleeding_edge/src/mark-compact.cc Thu Dec 17 00:53:18 2009
+++ /branches/bleeding_edge/src/mark-compact.cc Fri Dec 18 05:38:09 2009
@@ -116,6 +116,8 @@
compact_on_next_gc_ = false;
if (FLAG_never_compact) compacting_collection_ = false;
+ if (!Heap::map_space()->MapPointersEncodable())
+ compacting_collection_ = false;
if (FLAG_collect_maps) CreateBackPointers();
#ifdef DEBUG
=======================================
--- /branches/bleeding_edge/src/spaces.cc Thu Dec 17 00:53:18 2009
+++ /branches/bleeding_edge/src/spaces.cc Fri Dec 18 05:38:09 2009
@@ -1735,7 +1735,8 @@
Memory::Address_at(start + i) = kZapValue;
}
#endif
- ASSERT(!FLAG_always_compact); // We only use the freelists with
mark-sweep.
+ // We only use the freelists with mark-sweep.
+ ASSERT(!MarkCompactCollector::IsCompacting());
FreeListNode* node = FreeListNode::FromAddress(start);
node->set_size(object_size_);
node->set_next(head_);
=======================================
--- /branches/bleeding_edge/src/spaces.h Thu Dec 17 00:53:18 2009
+++ /branches/bleeding_edge/src/spaces.h Fri Dec 18 05:38:09 2009
@@ -993,6 +993,9 @@
HeapObject* SlowMCAllocateRaw(int size_in_bytes);
#ifdef DEBUG
+ // Returns the number of total pages in this space.
+ int CountTotalPages();
+
void DoPrintRSet(const char* space_name);
#endif
private:
@@ -1001,11 +1004,6 @@
// Returns a pointer to the page of the relocation pointer.
Page* MCRelocationTopPage() { return TopPageOf(mc_forwarding_info_); }
-
-#ifdef DEBUG
- // Returns the number of total pages in this space.
- int CountTotalPages();
-#endif
friend class PageIterator;
};
@@ -1739,6 +1737,17 @@
// Constants.
static const int kMaxMapPageIndex = (1 << MapWord::kMapPageIndexBits) -
1;
+
+ // Are map pointers encodable into map word?
+ bool MapPointersEncodable() {
+ if (!FLAG_use_big_map_space) {
+ ASSERT(CountTotalPages() <= kMaxMapPageIndex);
+ return true;
+ }
+ int n_of_pages = Capacity() / Page::kObjectAreaSize;
+ ASSERT(n_of_pages == CountTotalPages());
+ return n_of_pages <= kMaxMapPageIndex;
+ }
protected:
#ifdef DEBUG