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

R=yurys@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17605 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 20e99185
......@@ -217,6 +217,7 @@ MaybeObject* Heap::AllocateRaw(int size_in_bytes,
ASSERT(AllowHandleAllocation::IsAllowed());
ASSERT(AllowHeapAllocation::IsAllowed());
ASSERT(gc_state_ == NOT_IN_GC);
HeapProfiler* profiler = isolate_->heap_profiler();
#ifdef DEBUG
if (FLAG_gc_interval >= 0 &&
!disallow_allocation_failure_ &&
......@@ -226,12 +227,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() && retry_space != NEW_SPACE) {
space = retry_space;
} else {
if (profiler->is_tracking_allocations() && result->To(&object)) {
profiler->NewObjectEvent(object->address(), size_in_bytes);
}
return result;
}
}
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment