Reviewers: mvstanton,
Description:
Print out how many AllocationMementos were found during mark-sweep.
Moreover use the right memory boundary for AllocationMemento lookup during
gc.
BUG=
Please review this at https://codereview.chromium.org/25655004/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+36, -13 lines):
M src/heap-inl.h
M src/heap.h
M src/heap.cc
M src/mark-compact.cc
M src/objects.h
M src/objects.cc
Index: src/heap-inl.h
diff --git a/src/heap-inl.h b/src/heap-inl.h
index
13ac4a786a21bb48a6e09be6031a834e5013c807..50ba7f45938946958d238d77ff57f65f064e23aa
100644
--- a/src/heap-inl.h
+++ b/src/heap-inl.h
@@ -528,8 +528,9 @@ void Heap::ScavengeObject(HeapObject** p, HeapObject*
object) {
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 (AllocationMemento::FindForJSObject(JSObject::cast(object), true) !=
+ NULL) {
+ object->GetIsolate()->heap()->allocation_mementos_found_++;
}
}
Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index
2f1ba2ec8c29bc40a427b61ff7db4db1810915c1..c965efd2b7f62254ff4ec29a80579dc45fcea987
100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -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_);
}
}
Index: src/heap.h
diff --git a/src/heap.h b/src/heap.h
index
320b67681a9ac594ecf88e6229e9fb317925f1eb..3c92d4512320ca07b6cdb5bd853d922e896d2076
100644
--- a/src/heap.h
+++ b/src/heap.h
@@ -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_;
Index: src/mark-compact.cc
diff --git a/src/mark-compact.cc b/src/mark-compact.cc
index
31ad1bacfb0f6eb72b8688de5b488bef3f9bea03..cff5c4fd9e73fe4fee1694c4dca9a718a1222f52
100644
--- a/src/mark-compact.cc
+++ b/src/mark-compact.cc
@@ -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,15 @@ int
MarkCompactCollector::DiscoverAndPromoteBlackObjectsOnPage(
int size = object->Size();
survivors_size += size;
+ if (FLAG_trace_track_allocation_sites &&
+ AllocationSite::CanTrack(object->map()->instance_type()) &&
+ 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.
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index
001214c30cd92f255f4574670438c177cccdba3e..132a8222a9a6c959f8d1ff3e5c4c698d1dff6694
100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -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);
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index
cd651060dc83bab332ec64bc5dc2da299f09addd..6ee5b5788bf5837e213e7a01255381676ad214ad
100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -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:
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.