Revision: 8662
Author: [email protected]
Date: Fri Jul 15 04:09:41 2011
Log: Reenable map collection.
Fix bug in in-object property slack tracking that was causing poor RayTrace
performance: initial maps should be reattached to SharedFunctionInfo object
at the end of GC even if map collection is not enabled.
Fix presubmit error in objects.cc
[email protected]
BUG=
TEST=
Review URL: http://codereview.chromium.org/7381003
http://code.google.com/p/v8/source/detail?r=8662
Modified:
/branches/experimental/gc/src/mark-compact.cc
/branches/experimental/gc/src/mark-compact.h
/branches/experimental/gc/src/objects.cc
=======================================
--- /branches/experimental/gc/src/mark-compact.cc Tue Jul 12 16:04:25 2011
+++ /branches/experimental/gc/src/mark-compact.cc Fri Jul 15 04:09:41 2011
@@ -59,6 +59,7 @@
#endif
sweep_precisely_(false),
compacting_(false),
+ collect_maps_(FLAG_collect_maps),
tracer_(NULL),
migration_slots_buffer_(NULL),
#ifdef DEBUG
@@ -254,7 +255,7 @@
MarkLiveObjects();
ASSERT(heap_->incremental_marking()->IsStopped());
- if (FLAG_collect_maps) ClearNonLiveTransitions();
+ if (collect_maps_) ClearNonLiveTransitions();
#ifdef DEBUG
if (FLAG_verify_heap) {
@@ -264,6 +265,8 @@
SweepSpaces();
+ if (!collect_maps_) ReattachInitialMaps();
+
heap_->isolate()->pc_to_code_cache()->Flush();
Finish();
@@ -402,7 +405,10 @@
// Disable collection of maps if incremental marking is enabled.
// TODO(gc) improve maps collection algorithm to work with incremental
// marking.
- if (FLAG_incremental_marking) FLAG_collect_maps = false;
+ // TODO(gc) consider oscillating collect_maps_ on and off when possible.
This
+ // will allow map transition trees to die from both root and leaves.
+ collect_maps_ = FLAG_collect_maps &&
+ !heap()->incremental_marking()->IsMarking();
// Rather than passing the tracer around we stash it in a static member
// variable.
@@ -414,7 +420,7 @@
#endif
ASSERT(!FLAG_always_compact || !FLAG_never_compact);
- if (FLAG_collect_maps) CreateBackPointers();
+ if (collect_maps_) CreateBackPointers();
#ifdef ENABLE_GDB_JIT_INTERFACE
if (FLAG_gdbjit) {
// If GDBJIT interface is active disable compaction.
@@ -1435,7 +1441,7 @@
// in a special way to make transition links weak.
// Only maps for subclasses of JSReceiver can have transitions.
STATIC_ASSERT(LAST_TYPE == LAST_JS_RECEIVER_TYPE);
- if (FLAG_collect_maps && map->instance_type() >=
FIRST_JS_RECEIVER_TYPE) {
+ if (collect_maps_ && map->instance_type() >= FIRST_JS_RECEIVER_TYPE) {
MarkMapContents(map);
} else {
marking_deque_.PushBlack(map);
@@ -2037,6 +2043,24 @@
#endif // DEBUG
+void MarkCompactCollector::ReattachInitialMaps() {
+ HeapObjectIterator map_iterator(heap()->map_space());
+ for (HeapObject* obj = map_iterator.Next();
+ obj != NULL;
+ obj = map_iterator.Next()) {
+ if (obj->IsFreeSpace()) continue;
+ Map* map = Map::cast(obj);
+
+ STATIC_ASSERT(LAST_TYPE == LAST_CALLABLE_SPEC_OBJECT_TYPE);
+ if (map->instance_type() < FIRST_JS_RECEIVER_TYPE) continue;
+
+ if (map->attached_to_shared_function_info()) {
+
JSFunction::cast(map->constructor())->shared()->AttachInitialMap(map);
+ }
+ }
+}
+
+
void MarkCompactCollector::ClearNonLiveTransitions() {
HeapObjectIterator map_iterator(heap()->map_space());
// Iterate over the map space, setting map transitions that go from
=======================================
--- /branches/experimental/gc/src/mark-compact.h Tue Jul 12 16:04:25 2011
+++ /branches/experimental/gc/src/mark-compact.h Fri Jul 15 04:09:41 2011
@@ -516,6 +516,8 @@
// candidates.
bool compacting_;
+ bool collect_maps_;
+
// A pointer to the current stack-allocated GC tracer object during a
full
// collection (NULL before and after).
GCTracer* tracer_;
@@ -617,6 +619,12 @@
// We replace them with a null descriptor, with the same key.
void ClearNonLiveTransitions();
+ // Marking detaches initial maps from SharedFunctionInfo objects
+ // to make this reference weak. We need to reattach initial maps
+ // back after collection. This is either done during
+ // ClearNonLiveTransitions pass or by calling this function.
+ void ReattachInitialMaps();
+
//
-----------------------------------------------------------------------
// Phase 2: Sweeping to clear mark bits and free non-live objects for
// a non-compacting collection.
=======================================
--- /branches/experimental/gc/src/objects.cc Tue Jul 12 16:04:25 2011
+++ /branches/experimental/gc/src/objects.cc Fri Jul 15 04:09:41 2011
@@ -2898,7 +2898,8 @@
set_elements(dictionary);
}
-
old_map->GetHeap()->isolate()->counters()->elements_to_dictionary()->Increment();
+ old_map->GetHeap()->isolate()->counters()->elements_to_dictionary()->
+ Increment();
#ifdef DEBUG
if (FLAG_trace_normalization) {
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev