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