Index: src/heap.cc |
diff --git a/src/heap.cc b/src/heap.cc |
index 2271ae875585b7d4c1493cc66cb463013a3ad5a1..663cae6daf66004bcd49680d953729089663a509 100644 |
--- a/src/heap.cc |
+++ b/src/heap.cc |
@@ -79,6 +79,9 @@ Heap::Heap() |
lo_space_(NULL), |
gc_state_(NOT_IN_GC), |
gc_post_processing_depth_(0), |
+ allocations_count_(0), |
+ raw_allocations_hash_(0), |
+ dump_allocations_hash_countdown_(FLAG_dump_allocations_digest_at_alloc), |
ms_count_(0), |
gc_count_(0), |
remembered_unmapped_pages_index_(0), |
@@ -1957,19 +1960,7 @@ class ScavengingVisitor : public StaticVisitorBase { |
if (logging_and_profiling_mode == LOGGING_AND_PROFILING_ENABLED) { |
// Update NewSpace stats if necessary. |
RecordCopiedObject(heap, target); |
- Isolate* isolate = heap->isolate(); |
- HeapProfiler* heap_profiler = isolate->heap_profiler(); |
- if (heap_profiler->is_tracking_object_moves()) { |
- heap_profiler->ObjectMoveEvent(source->address(), target->address(), |
- size); |
- } |
- if (isolate->logger()->is_logging_code_events() || |
- isolate->cpu_profiler()->is_profiling()) { |
- if (target->IsSharedFunctionInfo()) { |
- PROFILE(isolate, SharedFunctionInfoMoveEvent( |
- source->address(), target->address())); |
- } |
- } |
+ heap->OnMoveEvent(target, source, size); |
} |
if (marks_handling == TRANSFER_MARKS) { |
@@ -2224,6 +2215,7 @@ static void InitializeScavengingVisitorsTables() { |
void Heap::SelectScavengingVisitorsTable() { |
bool logging_and_profiling = |
+ FLAG_verify_predictable || |
isolate()->logger()->is_logging() || |
isolate()->cpu_profiler()->is_profiling() || |
(isolate()->heap_profiler() != NULL && |
@@ -3338,8 +3330,7 @@ AllocationResult Heap::AllocateFixedTypedArray(int length, |
} |
-AllocationResult Heap::AllocateCode(int object_size, |
- bool immovable) { |
+AllocationResult Heap::AllocateCode(int object_size, bool immovable) { |
ASSERT(IsAligned(static_cast<intptr_t>(object_size), kCodeAlignment)); |
AllocationResult allocation; |
// Large code objects and code objects which should stay at a fixed address |
@@ -3348,10 +3339,12 @@ AllocationResult Heap::AllocateCode(int object_size, |
bool force_lo_space = object_size > code_space()->AreaSize(); |
if (force_lo_space) { |
allocation = lo_space_->AllocateRaw(object_size, EXECUTABLE); |
+ if (!allocation.To(&result)) return allocation; |
+ OnAllocationEvent(result, object_size); |
Hannes Payer (out of office)
2014/06/17 12:54:49
As discussed, offline: let's refactor large object
Igor Sheludko
2014/06/17 14:08:10
Done.
|
} else { |
allocation = AllocateRaw(object_size, CODE_SPACE, CODE_SPACE); |
+ if (!allocation.To(&result)) return allocation; |
} |
- if (!allocation.To(&result)) return allocation; |
if (immovable && !force_lo_space && |
// Objects on the first page of each space are never moved. |
@@ -3361,6 +3354,7 @@ AllocationResult Heap::AllocateCode(int object_size, |
CreateFillerObjectAt(result->address(), object_size); |
allocation = lo_space_->AllocateRaw(object_size, EXECUTABLE); |
if (!allocation.To(&result)) return allocation; |
+ OnAllocationEvent(result, object_size); |
} |
result->set_map_no_write_barrier(code_map()); |
@@ -3386,17 +3380,18 @@ AllocationResult Heap::CopyCode(Code* code) { |
new_constant_pool = empty_constant_pool_array(); |
} |
+ HeapObject* result; |
// Allocate an object the same size as the code object. |
int obj_size = code->Size(); |
if (obj_size > code_space()->AreaSize()) { |
allocation = lo_space_->AllocateRaw(obj_size, EXECUTABLE); |
+ if (!allocation.To(&result)) return allocation; |
+ OnAllocationEvent(result, obj_size); |
} else { |
allocation = AllocateRaw(obj_size, CODE_SPACE, CODE_SPACE); |
+ if (!allocation.To(&result)) return allocation; |
} |
- HeapObject* result; |
- if (!allocation.To(&result)) return allocation; |
- |
// Copy code object. |
Address old_addr = code->address(); |
Address new_addr = result->address(); |
@@ -3443,16 +3438,17 @@ AllocationResult Heap::CopyCode(Code* code, Vector<byte> reloc_info) { |
size_t relocation_offset = |
static_cast<size_t>(code->instruction_end() - old_addr); |
+ HeapObject* result; |
AllocationResult allocation; |
if (new_obj_size > code_space()->AreaSize()) { |
allocation = lo_space_->AllocateRaw(new_obj_size, EXECUTABLE); |
+ if (!allocation.To(&result)) return allocation; |
+ OnAllocationEvent(result, new_obj_size); |
} else { |
allocation = AllocateRaw(new_obj_size, CODE_SPACE, CODE_SPACE); |
+ if (!allocation.To(&result)) return allocation; |
} |
- HeapObject* result; |
- if (!allocation.To(&result)) return allocation; |
- |
// Copy code object. |
Address new_addr = result->address(); |
@@ -5317,6 +5313,10 @@ void Heap::TearDown() { |
PrintF("\n\n"); |
} |
+ if (FLAG_verify_predictable) { |
+ PrintAlloctionsHash(); |
+ } |
+ |
TearDownArrayBuffers(); |
isolate_->global_handles()->TearDown(); |