Revision: 18366
Author:   [email protected]
Date:     Wed Dec 18 20:08:54 2013 UTC
Log: Generalize AllocationMemento::FindForHeapObject and remove corresponding new space check.

BUG=
[email protected]

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

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

=======================================
--- /branches/bleeding_edge/src/heap-inl.h      Wed Dec 18 10:40:26 2013 UTC
+++ /branches/bleeding_edge/src/heap-inl.h      Wed Dec 18 20:08:54 2013 UTC
@@ -484,9 +484,10 @@


 void Heap::UpdateAllocationSiteFeedback(HeapObject* object) {
-  if (FLAG_allocation_site_pretenuring && object->IsJSObject()) {
-    AllocationMemento* memento = AllocationMemento::FindForJSObject(
-        JSObject::cast(object), true);
+  if (FLAG_allocation_site_pretenuring &&
+      AllocationSite::CanTrack(object->map()->instance_type())) {
+    AllocationMemento* memento = AllocationMemento::FindForHeapObject(
+        object, true);
     if (memento != NULL) {
       ASSERT(memento->IsValid());
       memento->GetAllocationSite()->IncrementMementoFoundCount();
=======================================
--- /branches/bleeding_edge/src/objects.cc      Thu Dec 12 14:57:00 2013 UTC
+++ /branches/bleeding_edge/src/objects.cc      Wed Dec 18 20:08:54 2013 UTC
@@ -9184,14 +9184,14 @@
 }


-AllocationMemento* AllocationMemento::FindForJSObject(JSObject* object,
-                                                      bool in_GC) {
-  // Currently, AllocationMemento objects are only allocated immediately
-  // after JSArrays and some JSObjects in NewSpace. Detecting whether a
-  // memento is present involves carefully checking the object immediately
-  // after the current object (if there is one) to see if it's an
-  // AllocationMemento.
- if (FLAG_track_allocation_sites && object->GetHeap()->InNewSpace(object)) {
+AllocationMemento* AllocationMemento::FindForHeapObject(HeapObject* object,
+                                                        bool in_GC) {
+ // AllocationMemento objects are only allocated immediately after objects in
+  // NewSpace. Detecting whether a memento is present involves carefully
+ // checking the object immediately after the current object (if there is one)
+  // to see if it's an AllocationMemento.
+  ASSERT(object->GetHeap()->InNewSpace(object));
+  if (FLAG_track_allocation_sites) {
Address ptr_end = (reinterpret_cast<Address>(object) - kHeapObjectTag) +
         object->Size();
     Address top;
@@ -12899,7 +12899,9 @@
     return this;
   }

-  AllocationMemento* memento = AllocationMemento::FindForJSObject(this);
+  if (!GetHeap()->InNewSpace(this)) return this;
+
+  AllocationMemento* memento = AllocationMemento::FindForHeapObject(this);
   if (memento == NULL || !memento->IsValid()) {
     return this;
   }
=======================================
--- /branches/bleeding_edge/src/objects.h       Wed Dec 18 10:30:31 2013 UTC
+++ /branches/bleeding_edge/src/objects.h       Wed Dec 18 20:08:54 2013 UTC
@@ -8259,8 +8259,8 @@
   DECLARE_VERIFIER(AllocationMemento)

   // Returns NULL if no AllocationMemento is available for object.
-  static AllocationMemento* FindForJSObject(JSObject* object,
-                                            bool in_GC = false);
+  static AllocationMemento* FindForHeapObject(HeapObject* 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