Print out how many AllocationMementos were found on a scavenge of new

space. This is useful because the unrooted mementos affect heap
decisions like pretenuring mode, and helps to gauge the effectiveness
of allocation-site feedback.

R=hpayer@chromium.org

Review URL: https://codereview.chromium.org/25273002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17027 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 8b8a9bc3
...@@ -525,6 +525,14 @@ void Heap::ScavengeObject(HeapObject** p, HeapObject* object) { ...@@ -525,6 +525,14 @@ void Heap::ScavengeObject(HeapObject** p, HeapObject* object) {
return; return;
} }
if (FLAG_trace_track_allocation_sites &&
AllocationSite::CanTrack(object->map()->instance_type()) &&
object->IsJSObject()) {
if (AllocationMemento::FindForJSObject(JSObject::cast(object)) != NULL) {
object->GetIsolate()->heap()->allocation_mementos_found_on_scavenge_++;
}
}
// AllocationMementos are unrooted and shouldn't survive a scavenge // AllocationMementos are unrooted and shouldn't survive a scavenge
ASSERT(object->map() != object->GetHeap()->allocation_memento_map()); ASSERT(object->map() != object->GetHeap()->allocation_memento_map());
// Call the slow part of scavenge object. // Call the slow part of scavenge object.
......
...@@ -86,6 +86,7 @@ Heap::Heap() ...@@ -86,6 +86,7 @@ Heap::Heap()
contexts_disposed_(0), contexts_disposed_(0),
global_ic_age_(0), global_ic_age_(0),
flush_monomorphic_ics_(false), flush_monomorphic_ics_(false),
allocation_mementos_found_on_scavenge_(0),
scan_on_scavenge_pages_(0), scan_on_scavenge_pages_(0),
new_space_(this), new_space_(this),
old_pointer_space_(NULL), old_pointer_space_(NULL),
...@@ -1328,6 +1329,8 @@ class ScavengeWeakObjectRetainer : public WeakObjectRetainer { ...@@ -1328,6 +1329,8 @@ class ScavengeWeakObjectRetainer : public WeakObjectRetainer {
void Heap::Scavenge() { void Heap::Scavenge() {
RelocationLock relocation_lock(this); RelocationLock relocation_lock(this);
allocation_mementos_found_on_scavenge_ = 0;
#ifdef VERIFY_HEAP #ifdef VERIFY_HEAP
if (FLAG_verify_heap) VerifyNonPointerSpacePointers(this); if (FLAG_verify_heap) VerifyNonPointerSpacePointers(this);
#endif #endif
...@@ -1475,6 +1478,12 @@ void Heap::Scavenge() { ...@@ -1475,6 +1478,12 @@ void Heap::Scavenge() {
gc_state_ = NOT_IN_GC; gc_state_ = NOT_IN_GC;
scavenges_since_last_idle_round_++; scavenges_since_last_idle_round_++;
if (FLAG_trace_track_allocation_sites &&
allocation_mementos_found_on_scavenge_ > 0) {
PrintF("AllocationMementos found during scavenge = %d\n",
allocation_mementos_found_on_scavenge_);
}
} }
......
...@@ -1886,6 +1886,9 @@ class Heap { ...@@ -1886,6 +1886,9 @@ class Heap {
bool flush_monomorphic_ics_; bool flush_monomorphic_ics_;
// AllocationMementos found on scavenge.
int allocation_mementos_found_on_scavenge_;
int scan_on_scavenge_pages_; int scan_on_scavenge_pages_;
NewSpace new_space_; NewSpace new_space_;
......
...@@ -9057,7 +9057,6 @@ AllocationMemento* AllocationMemento::FindForJSObject(JSObject* object) { ...@@ -9057,7 +9057,6 @@ AllocationMemento* AllocationMemento::FindForJSObject(JSObject* object) {
// involves carefully checking the object immediately after the JSArray // involves carefully checking the object immediately after the JSArray
// (if there is one) to see if it's an AllocationMemento. // (if there is one) to see if it's an AllocationMemento.
if (FLAG_track_allocation_sites && object->GetHeap()->InNewSpace(object)) { if (FLAG_track_allocation_sites && object->GetHeap()->InNewSpace(object)) {
ASSERT(object->GetHeap()->InToSpace(object));
Address ptr_end = (reinterpret_cast<Address>(object) - kHeapObjectTag) + Address ptr_end = (reinterpret_cast<Address>(object) - kHeapObjectTag) +
object->Size(); object->Size();
if ((ptr_end + AllocationMemento::kSize) <= if ((ptr_end + AllocationMemento::kSize) <=
......
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