Print out how many AllocationMementos were found during mark-sweep.

Moreover use the right memory boundary for AllocationMemento lookup during gc.

BUG=
R=mvstanton@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17069 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
hpayer@chromium.org 2013-10-02 11:04:54 +00:00
parent 72f93382bc
commit 9d732d6594
6 changed files with 35 additions and 16 deletions

View File

@ -525,11 +525,10 @@ void Heap::ScavengeObject(HeapObject** p, HeapObject* object) {
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_++;
if (FLAG_trace_track_allocation_sites && object->IsJSObject()) {
if (AllocationMemento::FindForJSObject(JSObject::cast(object), true) !=
NULL) {
object->GetIsolate()->heap()->allocation_mementos_found_++;
}
}

View File

@ -86,7 +86,7 @@ Heap::Heap()
contexts_disposed_(0),
global_ic_age_(0),
flush_monomorphic_ics_(false),
allocation_mementos_found_on_scavenge_(0),
allocation_mementos_found_(0),
scan_on_scavenge_pages_(0),
new_space_(this),
old_pointer_space_(NULL),
@ -1329,7 +1329,7 @@ class ScavengeWeakObjectRetainer : public WeakObjectRetainer {
void Heap::Scavenge() {
RelocationLock relocation_lock(this);
allocation_mementos_found_on_scavenge_ = 0;
allocation_mementos_found_ = 0;
#ifdef VERIFY_HEAP
if (FLAG_verify_heap) VerifyNonPointerSpacePointers(this);
@ -1479,10 +1479,9 @@ void Heap::Scavenge() {
scavenges_since_last_idle_round_++;
if (FLAG_trace_track_allocation_sites &&
allocation_mementos_found_on_scavenge_ > 0) {
if (FLAG_trace_track_allocation_sites && allocation_mementos_found_ > 0) {
PrintF("AllocationMementos found during scavenge = %d\n",
allocation_mementos_found_on_scavenge_);
allocation_mementos_found_);
}
}

View File

@ -1886,8 +1886,8 @@ class Heap {
bool flush_monomorphic_ics_;
// AllocationMementos found on scavenge.
int allocation_mementos_found_on_scavenge_;
// AllocationMementos found in new space.
int allocation_mementos_found_;
int scan_on_scavenge_pages_;

View File

@ -407,6 +407,8 @@ void MarkCompactCollector::CollectGarbage() {
ASSERT(state_ == PREPARE_GC);
ASSERT(encountered_weak_collections_ == Smi::FromInt(0));
heap()->allocation_mementos_found_ = 0;
MarkLiveObjects();
ASSERT(heap_->incremental_marking()->IsStopped());
@ -449,6 +451,11 @@ void MarkCompactCollector::CollectGarbage() {
marking_parity_ = EVEN_MARKING_PARITY;
}
if (FLAG_trace_track_allocation_sites &&
heap()->allocation_mementos_found_ > 0) {
PrintF("AllocationMementos found during mark-sweep = %d\n",
heap()->allocation_mementos_found_);
}
tracer_ = NULL;
}
@ -2002,6 +2009,13 @@ int MarkCompactCollector::DiscoverAndPromoteBlackObjectsOnPage(
int size = object->Size();
survivors_size += size;
if (FLAG_trace_track_allocation_sites && object->IsJSObject()) {
if (AllocationMemento::FindForJSObject(JSObject::cast(object), true)
!= NULL) {
heap()->allocation_mementos_found_++;
}
}
offset++;
current_cell >>= 1;
// Aggressively promote young survivors to the old space.

View File

@ -9049,7 +9049,8 @@ Handle<String> SeqString::Truncate(Handle<SeqString> string, int new_length) {
}
AllocationMemento* AllocationMemento::FindForJSObject(JSObject* object) {
AllocationMemento* AllocationMemento::FindForJSObject(JSObject* object,
bool in_GC) {
// Currently, AllocationMemento objects are only allocated immediately
// after JSArrays in NewSpace, and detecting whether a JSArray has one
// involves carefully checking the object immediately after the JSArray
@ -9057,8 +9058,13 @@ AllocationMemento* AllocationMemento::FindForJSObject(JSObject* object) {
if (FLAG_track_allocation_sites && object->GetHeap()->InNewSpace(object)) {
Address ptr_end = (reinterpret_cast<Address>(object) - kHeapObjectTag) +
object->Size();
if ((ptr_end + AllocationMemento::kSize) <=
object->GetHeap()->NewSpaceTop()) {
Address top;
if (in_GC) {
top = object->GetHeap()->new_space()->FromSpacePageHigh();
} else {
top = object->GetHeap()->NewSpaceTop();
}
if ((ptr_end + AllocationMemento::kSize) <= top) {
// There is room in newspace for allocation info. Do we have some?
Map** possible_allocation_memento_map =
reinterpret_cast<Map**>(ptr_end);

View File

@ -7889,7 +7889,8 @@ class AllocationMemento: public Struct {
DECLARE_VERIFIER(AllocationMemento)
// Returns NULL if no AllocationMemento is available for object.
static AllocationMemento* FindForJSObject(JSObject* object);
static AllocationMemento* FindForJSObject(JSObject* object,
bool in_GC = false);
static inline AllocationMemento* cast(Object* obj);
private: