Revision: 17069
Author:   [email protected]
Date:     Wed Oct  2 11:04:54 2013 UTC
Log: Print out how many AllocationMementos were found during mark-sweep.

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

BUG=
[email protected]

Review URL: https://codereview.chromium.org/25655004
http://code.google.com/p/v8/source/detail?r=17069

Modified:
 /branches/bleeding_edge/src/heap-inl.h
 /branches/bleeding_edge/src/heap.cc
 /branches/bleeding_edge/src/heap.h
 /branches/bleeding_edge/src/mark-compact.cc
 /branches/bleeding_edge/src/objects.cc
 /branches/bleeding_edge/src/objects.h

=======================================
--- /branches/bleeding_edge/src/heap-inl.h      Tue Oct  1 08:14:38 2013 UTC
+++ /branches/bleeding_edge/src/heap-inl.h      Wed Oct  2 11:04:54 2013 UTC
@@ -525,11 +525,10 @@
     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_++;
     }
   }

=======================================
--- /branches/bleeding_edge/src/heap.cc Tue Oct  1 15:06:59 2013 UTC
+++ /branches/bleeding_edge/src/heap.cc Wed Oct  2 11:04:54 2013 UTC
@@ -86,7 +86,7 @@
       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 @@
 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 @@

   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_);
   }
 }

=======================================
--- /branches/bleeding_edge/src/heap.h  Tue Oct  1 08:14:38 2013 UTC
+++ /branches/bleeding_edge/src/heap.h  Wed Oct  2 11:04:54 2013 UTC
@@ -1886,8 +1886,8 @@

   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_;

=======================================
--- /branches/bleeding_edge/src/mark-compact.cc Tue Oct  1 15:06:59 2013 UTC
+++ /branches/bleeding_edge/src/mark-compact.cc Wed Oct  2 11:04:54 2013 UTC
@@ -407,6 +407,8 @@
   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 @@
     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 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.
=======================================
--- /branches/bleeding_edge/src/objects.cc      Wed Oct  2 08:27:33 2013 UTC
+++ /branches/bleeding_edge/src/objects.cc      Wed Oct  2 11:04:54 2013 UTC
@@ -9049,7 +9049,8 @@
 }


-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 @@
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);
=======================================
--- /branches/bleeding_edge/src/objects.h       Wed Oct  2 10:51:10 2013 UTC
+++ /branches/bleeding_edge/src/objects.h       Wed Oct  2 11:04:54 2013 UTC
@@ -7889,7 +7889,8 @@
   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.

Reply via email to