Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(671)

Unified Diff: src/spaces-inl.h

Issue 23039014: Hook-allocation on bleeding edge (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/spaces.h ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/spaces-inl.h
diff --git a/src/spaces-inl.h b/src/spaces-inl.h
index 77117b8a4e4a9d960ad605f197cd623e888c5e47..8a37e967ba1ee4169c53af8721a8face8619603b 100644
--- a/src/spaces-inl.h
+++ b/src/spaces-inl.h
@@ -29,6 +29,7 @@
#define V8_SPACES_INL_H_
#include "isolate.h"
+#include "heap-profiler.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,26 @@ MaybeObject* PagedSpace::AllocateRaw(int size_in_bytes) {
return object;
}
+ return NULL;
+}
+
+
+MaybeObject* PagedSpace::AllocateRaw(int size_in_bytes) {
+ HeapObject* object = AllocateRawHelper(size_in_bytes);
+ if (object != NULL) {
+ heap()->isolate()->heap_profiler()->RecordObjectAllocation(
+ object->address(), size_in_bytes);
+ return object;
+ }
+ return Failure::RetryAfterGC(identity());
+}
+
+
+MaybeObject* PagedSpace::AllocateRawSilently(int size_in_bytes) {
+ HeapObject* object = AllocateRawHelper(size_in_bytes);
+ if (object != NULL) {
+ return object;
+ }
return Failure::RetryAfterGC(identity());
}
@@ -332,10 +353,13 @@ 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_);
+ heap()->isolate()->heap_profiler()->RecordObjectAllocation(
+ obj->address(), size_in_bytes);
+
return obj;
}
« no previous file with comments | « src/spaces.h ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698