Reviewers: yurys,

Message:
By now all allocations in new-space done by the runtime (not the generated code)
go through Heap::AllocateRaw. This CL moves the allocation tracking into the
same choke-point.

The same should be done for old-space as well, once the three remaining
call-sites in Heap::CreateCode and Heap::CopyCode are taken care of.

Let me know if I missed any call-sites that the heap profiler was tracking
before but is not tracking now. Also note that this CL depends on
https://codereview.chromium.org/66723003/ to be landed first.

Description:
Move new-space allocation tracking into Heap::AllocateRaw.

[email protected]

Please review this at https://codereview.chromium.org/66683004/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+6, -5 lines):
  M src/heap-inl.h
  M src/spaces-inl.h


Index: src/heap-inl.h
diff --git a/src/heap-inl.h b/src/heap-inl.h
index 9bd764e47e2ad9dd11f7b91aaa22f1d42e30c2c4..b8321a34cb6ef3299d135830e4f491e8a3df0d79 100644
--- a/src/heap-inl.h
+++ b/src/heap-inl.h
@@ -221,6 +221,7 @@ MaybeObject* Heap::AllocateRaw(int size_in_bytes,
          retry_space == OLD_POINTER_SPACE ||
          retry_space == OLD_DATA_SPACE ||
          retry_space == LO_SPACE);
+  HeapProfiler* profiler = isolate_->heap_profiler();
 #ifdef DEBUG
   if (FLAG_gc_interval >= 0 &&
       !disallow_allocation_failure_ &&
@@ -230,12 +231,17 @@ MaybeObject* Heap::AllocateRaw(int size_in_bytes,
   isolate_->counters()->objs_since_last_full()->Increment();
   isolate_->counters()->objs_since_last_young()->Increment();
 #endif
+
+  HeapObject* object;
   MaybeObject* result;
   if (NEW_SPACE == space) {
     result = new_space_.AllocateRaw(size_in_bytes);
     if (always_allocate() && result->IsFailure()) {
       space = retry_space;
     } else {
+      if (profiler->is_tracking_allocations() && result->To(&object)) {
+        profiler->NewObjectEvent(object->address(), size_in_bytes);
+      }
       return result;
     }
   }
Index: src/spaces-inl.h
diff --git a/src/spaces-inl.h b/src/spaces-inl.h
index d5c114c5b051d9791452a929ef823f9e77e41ef5..ffa47cf6073d6209c1e102cfde44216db4d2d9b1 100644
--- a/src/spaces-inl.h
+++ b/src/spaces-inl.h
@@ -349,11 +349,6 @@ MaybeObject* NewSpace::AllocateRaw(int size_in_bytes) {
   allocation_info_.set_top(allocation_info_.top() + size_in_bytes);
   ASSERT_SEMISPACE_ALLOCATION_INFO(allocation_info_, to_space_);

-  HeapProfiler* profiler = heap()->isolate()->heap_profiler();
-  if (profiler != NULL && profiler->is_tracking_allocations()) {
-    profiler->NewObjectEvent(obj->address(), size_in_bytes);
-  }
-
   return obj;
 }



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