Chromium Code Reviews| Index: src/spaces-inl.h |
| diff --git a/src/spaces-inl.h b/src/spaces-inl.h |
| index be2ae2a57db248234ab9f92726beec0168a49709..357cc425df223fcd1c7afe6bc86bb1e9bcc3065f 100644 |
| --- a/src/spaces-inl.h |
| +++ b/src/spaces-inl.h |
| @@ -28,6 +28,7 @@ |
| #ifndef V8_SPACES_INL_H_ |
| #define V8_SPACES_INL_H_ |
| +#include "heap-profiler.h" |
| #include "isolate.h" |
| #include "spaces.h" |
| #include "v8memory.h" |
| @@ -273,7 +274,7 @@ HeapObject* PagedSpace::AllocateLinearly(int size_in_bytes) { |
| // Raw allocation. |
| -MaybeObject* PagedSpace::AllocateRaw(int size_in_bytes) { |
| +HeapObject* PagedSpace::AllocateRawHelper(int size_in_bytes) { |
| HeapObject* object = AllocateLinearly(size_in_bytes); |
| if (object != NULL) { |
| if (identity() == CODE_SPACE) { |
| @@ -302,6 +303,22 @@ MaybeObject* PagedSpace::AllocateRaw(int size_in_bytes) { |
| return object; |
| } |
| + return NULL; |
| +} |
| + |
| + |
| +MaybeObject* PagedSpace::AllocateRaw(int size_in_bytes, |
|
loislo
2013/09/26 09:11:33
I'd rewrite this the next way:
// Raw allocation.
Alexandra Mikhaylova
2013/09/26 13:23:41
Done.
|
| + AllocationType event) { |
| + HeapObject* object = AllocateRawHelper(size_in_bytes); |
| + if (object != NULL) { |
| + if (event == NEW_OBJECT) { |
| + HeapProfiler* profiler = heap()->isolate()->heap_profiler(); |
| + if (profiler->is_tracking_allocations()) { |
| + profiler->NewObjectEvent(object->address(), size_in_bytes); |
| + } |
| + } |
| + return object; |
| + } |
| return Failure::RetryAfterGC(identity()); |
| } |
| @@ -332,10 +349,15 @@ MaybeObject* NewSpace::AllocateRaw(int size_in_bytes) { |
| return SlowAllocateRaw(size_in_bytes); |
| } |
| - Object* obj = HeapObject::FromAddress(old_top); |
| + HeapObject* obj = HeapObject::FromAddress(old_top); |
| allocation_info_.top += size_in_bytes; |
| ASSERT_SEMISPACE_ALLOCATION_INFO(allocation_info_, to_space_); |
| + HeapProfiler* profiler = heap()->isolate()->heap_profiler(); |
| + if (profiler->is_tracking_allocations()) { |
|
loislo
2013/09/26 11:53:07
profiler is null here at test-spaces/NewSpace
yurys
2013/09/26 12:17:06
The profiler is created in Isolate::Init so it sho
|
| + profiler->NewObjectEvent(obj->address(), size_in_bytes); |
| + } |
| + |
| return obj; |
| } |