Reviewers: yurys,
Description:
Move old-space allocation tracking into Heap::AllocateRaw.
[email protected]
Please review this at https://codereview.chromium.org/68663002/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+10, -28 lines):
M src/heap-inl.h
M src/heap.cc
M src/mark-compact.cc
M src/spaces-inl.h
M src/spaces.h
Index: src/heap-inl.h
diff --git a/src/heap-inl.h b/src/heap-inl.h
index
f24c5828381ab8ba0065ba942c9b3d8a629f9f3d..168aa50b36e540b2467c9a2d63da90f0c3c7cbb2
100644
--- a/src/heap-inl.h
+++ b/src/heap-inl.h
@@ -259,6 +259,9 @@ MaybeObject* Heap::AllocateRaw(int size_in_bytes,
result = map_space_->AllocateRaw(size_in_bytes);
}
if (result->IsFailure()) old_gen_exhausted_ = true;
+ if (profiler->is_tracking_allocations() && result->To(&object)) {
+ profiler->NewObjectEvent(object->address(), size_in_bytes);
+ }
return result;
}
Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index
f11ad9671855e8c99ae743c638194945bf155a7c..8eb8ae24b2b01ca992b2182b93c8196eea117e6d
100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -4197,7 +4197,7 @@ MaybeObject* Heap::CreateCode(const CodeDesc& desc,
if (force_lo_space) {
maybe_result = lo_space_->AllocateRaw(obj_size, EXECUTABLE);
} else {
- maybe_result = code_space_->AllocateRaw(obj_size);
+ maybe_result = AllocateRaw(obj_size, CODE_SPACE, CODE_SPACE);
}
if (!maybe_result->To<HeapObject>(&result)) return maybe_result;
@@ -4268,7 +4268,7 @@ MaybeObject* Heap::CopyCode(Code* code) {
if (obj_size > code_space()->AreaSize()) {
maybe_result = lo_space_->AllocateRaw(obj_size, EXECUTABLE);
} else {
- maybe_result = code_space_->AllocateRaw(obj_size);
+ maybe_result = AllocateRaw(obj_size, CODE_SPACE, CODE_SPACE);
}
Object* result;
@@ -4311,7 +4311,7 @@ MaybeObject* Heap::CopyCode(Code* code, Vector<byte>
reloc_info) {
if (new_obj_size > code_space()->AreaSize()) {
maybe_result = lo_space_->AllocateRaw(new_obj_size, EXECUTABLE);
} else {
- maybe_result = code_space_->AllocateRaw(new_obj_size);
+ maybe_result = AllocateRaw(new_obj_size, CODE_SPACE, CODE_SPACE);
}
Object* result;
Index: src/mark-compact.cc
diff --git a/src/mark-compact.cc b/src/mark-compact.cc
index
8ef7c3c9909d27240ae10d0846924d1e45f9c96e..b82149e3a408c8c00908f5472ca6e774e1be117a
100644
--- a/src/mark-compact.cc
+++ b/src/mark-compact.cc
@@ -2939,9 +2939,7 @@ bool
MarkCompactCollector::TryPromoteObject(HeapObject* object,
ASSERT(target_space == heap()->old_pointer_space() ||
target_space == heap()->old_data_space());
Object* result;
- MaybeObject* maybe_result = target_space->AllocateRaw(
- object_size,
- PagedSpace::MOVE_OBJECT);
+ MaybeObject* maybe_result = target_space->AllocateRaw(object_size);
if (maybe_result->ToObject(&result)) {
HeapObject* target = HeapObject::cast(result);
MigrateObject(target->address(),
@@ -3014,7 +3012,7 @@ void
MarkCompactCollector::EvacuateLiveObjectsFromPage(Page* p) {
int size = object->Size();
- MaybeObject* target = space->AllocateRaw(size,
PagedSpace::MOVE_OBJECT);
+ MaybeObject* target = space->AllocateRaw(size);
if (target->IsFailure()) {
// OS refused to give us memory.
V8::FatalProcessOutOfMemory("Evacuation");
Index: src/spaces-inl.h
diff --git a/src/spaces-inl.h b/src/spaces-inl.h
index
ffa47cf6073d6209c1e102cfde44216db4d2d9b1..87de29c4a5d8d74dcf65b0fcd1f62b00f3883af5
100644
--- a/src/spaces-inl.h
+++ b/src/spaces-inl.h
@@ -274,18 +274,12 @@ HeapObject* PagedSpace::AllocateLinearly(int
size_in_bytes) {
// Raw allocation.
-MaybeObject* PagedSpace::AllocateRaw(int size_in_bytes,
- AllocationType event) {
- HeapProfiler* profiler = heap()->isolate()->heap_profiler();
-
+MaybeObject* PagedSpace::AllocateRaw(int size_in_bytes) {
HeapObject* object = AllocateLinearly(size_in_bytes);
if (object != NULL) {
if (identity() == CODE_SPACE) {
SkipList::Update(object->address(), size_in_bytes);
}
- if (event == NEW_OBJECT && profiler->is_tracking_allocations()) {
- profiler->NewObjectEvent(object->address(), size_in_bytes);
- }
return object;
}
@@ -298,9 +292,6 @@ MaybeObject* PagedSpace::AllocateRaw(int size_in_bytes,
if (identity() == CODE_SPACE) {
SkipList::Update(object->address(), size_in_bytes);
}
- if (event == NEW_OBJECT && profiler->is_tracking_allocations()) {
- profiler->NewObjectEvent(object->address(), size_in_bytes);
- }
return object;
}
@@ -309,9 +300,6 @@ MaybeObject* PagedSpace::AllocateRaw(int size_in_bytes,
if (identity() == CODE_SPACE) {
SkipList::Update(object->address(), size_in_bytes);
}
- if (event == NEW_OBJECT && profiler->is_tracking_allocations()) {
- profiler->NewObjectEvent(object->address(), size_in_bytes);
- }
return object;
}
Index: src/spaces.h
diff --git a/src/spaces.h b/src/spaces.h
index
db0415b7b7a8b30b4d0945b4bb00eea7bb861d20..06f444d1587346db0c0421a366e718ef61b63b31
100644
--- a/src/spaces.h
+++ b/src/spaces.h
@@ -1764,16 +1764,9 @@ class PagedSpace : public Space {
return allocation_info_.limit_address();
}
- enum AllocationType {
- NEW_OBJECT,
- MOVE_OBJECT
- };
-
// Allocate the requested number of bytes in the space if possible,
return a
// failure object if not.
- MUST_USE_RESULT inline MaybeObject* AllocateRaw(
- int size_in_bytes,
- AllocationType event = NEW_OBJECT);
+ MUST_USE_RESULT inline MaybeObject* AllocateRaw(int size_in_bytes);
virtual bool ReserveSpace(int bytes);
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.