Index: src/heap/spaces-inl.h |
diff --git a/src/heap/spaces-inl.h b/src/heap/spaces-inl.h |
index 3023fbf51ead410fba6a14aaab99dff05e5acf61..55eed7dbb9eadaba463c27ed5bdb45fe6cb1c3ae 100644 |
--- a/src/heap/spaces-inl.h |
+++ b/src/heap/spaces-inl.h |
@@ -425,12 +425,24 @@ AllocationResult PagedSpace::AllocateRawAligned(int size_in_bytes, |
AllocationResult PagedSpace::AllocateRaw(int size_in_bytes, |
AllocationAlignment alignment) { |
#ifdef V8_HOST_ARCH_32_BIT |
- return alignment == kDoubleAligned |
- ? AllocateRawAligned(size_in_bytes, kDoubleAligned) |
- : AllocateRawUnaligned(size_in_bytes); |
+ AllocationResult result = |
+ alignment == kDoubleAligned |
+ ? AllocateRawAligned(size_in_bytes, kDoubleAligned) |
+ : AllocateRawUnaligned(size_in_bytes); |
#else |
- return AllocateRawUnaligned(size_in_bytes); |
+ AllocationResult result = AllocateRawUnaligned(size_in_bytes); |
#endif |
+ if (!result.IsRetry()) { |
+ Object* obj = result.ToObjectChecked(); |
+ if (obj->IsHeapObject()) { |
ofrobots
2016/01/23 16:16:31
Why is this check necessary here?
ofrobots
2016/01/26 00:38:25
*bump*
mattloring
2016/01/26 00:42:48
An Object can be an Smi or a HeapObject so I check
ofrobots
2016/01/26 15:47:15
We just allocated an object on the heap; so this c
|
+ HeapObject* heap_obj = static_cast<HeapObject*>(obj); |
+ for (int i = 0; i < allocation_observers_.length(); ++i) { |
+ AllocationObserver* o = allocation_observers_[i]; |
+ o->AllocationStep(size_in_bytes, heap_obj->address(), size_in_bytes); |
+ } |
+ } |
+ } |
+ return result; |
} |