Commit abe50f04 authored by ulan's avatar ulan Committed by Commit bot

[heap] User size_t in GcTracer

BUG=chromium:652721

Review-Url: https://codereview.chromium.org/2408093003
Cr-Commit-Position: refs/heads/master@{#40179}
parent 33629651
...@@ -11,11 +11,14 @@ ...@@ -11,11 +11,14 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
static intptr_t CountTotalHolesSize(Heap* heap) { static size_t CountTotalHolesSize(Heap* heap) {
intptr_t holes_size = 0; size_t holes_size = 0;
OldSpaces spaces(heap); OldSpaces spaces(heap);
for (OldSpace* space = spaces.next(); space != NULL; space = spaces.next()) { for (OldSpace* space = spaces.next(); space != NULL; space = spaces.next()) {
holes_size += space->Waste() + space->Available(); DCHECK_GE(space->Waste(), 0);
DCHECK_GE(space->Available(), 0);
DCHECK_GE(holes_size + space->Waste() + space->Available(), holes_size);
holes_size += static_cast<size_t>(space->Waste() + space->Available());
} }
return holes_size; return holes_size;
} }
...@@ -188,8 +191,8 @@ void GCTracer::Start(GarbageCollector collector, ...@@ -188,8 +191,8 @@ void GCTracer::Start(GarbageCollector collector,
current_.scopes[i] = 0; current_.scopes[i] = 0;
} }
int committed_memory = static_cast<int>(heap_->CommittedMemory() / KB); size_t committed_memory = heap_->CommittedMemory() / KB;
int used_memory = static_cast<int>(current_.start_object_size / KB); size_t used_memory = current_.start_object_size / KB;
Counters* counters = heap_->isolate()->counters(); Counters* counters = heap_->isolate()->counters();
...@@ -241,8 +244,8 @@ void GCTracer::Stop(GarbageCollector collector) { ...@@ -241,8 +244,8 @@ void GCTracer::Stop(GarbageCollector collector) {
AddAllocation(current_.end_time); AddAllocation(current_.end_time);
int committed_memory = static_cast<int>(heap_->CommittedMemory() / KB); size_t committed_memory = heap_->CommittedMemory() / KB;
int used_memory = static_cast<int>(current_.end_object_size / KB); size_t used_memory = current_.end_object_size / KB;
heap_->isolate()->counters()->aggregated_memory_heap_committed()->AddSample( heap_->isolate()->counters()->aggregated_memory_heap_committed()->AddSample(
current_.end_time, committed_memory); current_.end_time, committed_memory);
heap_->isolate()->counters()->aggregated_memory_heap_used()->AddSample( heap_->isolate()->counters()->aggregated_memory_heap_used()->AddSample(
...@@ -348,9 +351,8 @@ void GCTracer::AddContextDisposalTime(double time) { ...@@ -348,9 +351,8 @@ void GCTracer::AddContextDisposalTime(double time) {
recorded_context_disposal_times_.Push(time); recorded_context_disposal_times_.Push(time);
} }
void GCTracer::AddCompactionEvent(double duration, void GCTracer::AddCompactionEvent(double duration,
intptr_t live_bytes_compacted) { size_t live_bytes_compacted) {
recorded_compactions_.Push( recorded_compactions_.Push(
MakeBytesAndDuration(live_bytes_compacted, duration)); MakeBytesAndDuration(live_bytes_compacted, duration));
} }
...@@ -360,8 +362,7 @@ void GCTracer::AddSurvivalRatio(double promotion_ratio) { ...@@ -360,8 +362,7 @@ void GCTracer::AddSurvivalRatio(double promotion_ratio) {
recorded_survival_ratios_.Push(promotion_ratio); recorded_survival_ratios_.Push(promotion_ratio);
} }
void GCTracer::AddIncrementalMarkingStep(double duration, size_t bytes) {
void GCTracer::AddIncrementalMarkingStep(double duration, intptr_t bytes) {
if (bytes > 0) { if (bytes > 0) {
incremental_marking_bytes_ += bytes; incremental_marking_bytes_ += bytes;
incremental_marking_duration_ += duration; incremental_marking_duration_ += duration;
...@@ -426,7 +427,7 @@ void GCTracer::Print() const { ...@@ -426,7 +427,7 @@ void GCTracer::Print() const {
void GCTracer::PrintNVP() const { void GCTracer::PrintNVP() const {
double duration = current_.end_time - current_.start_time; double duration = current_.end_time - current_.start_time;
double spent_in_mutator = current_.start_time - previous_.end_time; double spent_in_mutator = current_.start_time - previous_.end_time;
intptr_t allocated_since_last_gc = size_t allocated_since_last_gc =
current_.start_object_size - previous_.end_object_size; current_.start_object_size - previous_.end_object_size;
double incremental_walltime_duration = 0; double incremental_walltime_duration = 0;
...@@ -697,7 +698,7 @@ double GCTracer::AverageSpeed(const RingBuffer<BytesAndDuration>& buffer) { ...@@ -697,7 +698,7 @@ double GCTracer::AverageSpeed(const RingBuffer<BytesAndDuration>& buffer) {
return AverageSpeed(buffer, MakeBytesAndDuration(0, 0), 0); return AverageSpeed(buffer, MakeBytesAndDuration(0, 0), 0);
} }
void GCTracer::RecordIncrementalMarkingSpeed(intptr_t bytes, double duration) { void GCTracer::RecordIncrementalMarkingSpeed(size_t bytes, double duration) {
if (duration == 0 || bytes == 0) return; if (duration == 0 || bytes == 0) return;
double current_speed = bytes / duration; double current_speed = bytes / duration;
if (recorded_incremental_marking_speed_ == 0) { if (recorded_incremental_marking_speed_ == 0) {
......
...@@ -215,10 +215,10 @@ class GCTracer { ...@@ -215,10 +215,10 @@ class GCTracer {
bool reduce_memory; bool reduce_memory;
// Size of objects in heap set in constructor. // Size of objects in heap set in constructor.
intptr_t start_object_size; size_t start_object_size;
// Size of objects in heap set in destructor. // Size of objects in heap set in destructor.
intptr_t end_object_size; size_t end_object_size;
// Size of memory allocated from OS set in constructor. // Size of memory allocated from OS set in constructor.
size_t start_memory_size; size_t start_memory_size;
...@@ -228,23 +228,20 @@ class GCTracer { ...@@ -228,23 +228,20 @@ class GCTracer {
// Total amount of space either wasted or contained in one of free lists // Total amount of space either wasted or contained in one of free lists
// before the current GC. // before the current GC.
intptr_t start_holes_size; size_t start_holes_size;
// Total amount of space either wasted or contained in one of free lists // Total amount of space either wasted or contained in one of free lists
// after the current GC. // after the current GC.
intptr_t end_holes_size; size_t end_holes_size;
// Size of new space objects in constructor. // Size of new space objects in constructor.
intptr_t new_space_object_size; size_t new_space_object_size;
// Size of survived new space objects in destructor. // Size of survived new space objects in destructor.
intptr_t survived_new_space_object_size; size_t survived_new_space_object_size;
// Bytes marked since creation of tracer (value at start of event).
intptr_t cumulative_incremental_marking_bytes;
// Bytes marked incrementally for INCREMENTAL_MARK_COMPACTOR // Bytes marked incrementally for INCREMENTAL_MARK_COMPACTOR
intptr_t incremental_marking_bytes; size_t incremental_marking_bytes;
// Duration of incremental marking steps for INCREMENTAL_MARK_COMPACTOR. // Duration of incremental marking steps for INCREMENTAL_MARK_COMPACTOR.
double incremental_marking_duration; double incremental_marking_duration;
...@@ -277,12 +274,12 @@ class GCTracer { ...@@ -277,12 +274,12 @@ class GCTracer {
void AddContextDisposalTime(double time); void AddContextDisposalTime(double time);
void AddCompactionEvent(double duration, intptr_t live_bytes_compacted); void AddCompactionEvent(double duration, size_t live_bytes_compacted);
void AddSurvivalRatio(double survival_ratio); void AddSurvivalRatio(double survival_ratio);
// Log an incremental marking step. // Log an incremental marking step.
void AddIncrementalMarkingStep(double duration, intptr_t bytes); void AddIncrementalMarkingStep(double duration, size_t bytes);
// Compute the average incremental marking speed in bytes/millisecond. // Compute the average incremental marking speed in bytes/millisecond.
// Returns 0 if no events have been recorded. // Returns 0 if no events have been recorded.
...@@ -386,7 +383,7 @@ class GCTracer { ...@@ -386,7 +383,7 @@ class GCTracer {
void ResetForTesting(); void ResetForTesting();
void ResetIncrementalMarkingCounters(); void ResetIncrementalMarkingCounters();
void RecordIncrementalMarkingSpeed(intptr_t bytes, double duration); void RecordIncrementalMarkingSpeed(size_t bytes, double duration);
// Print one detailed trace line in name=value format. // Print one detailed trace line in name=value format.
// TODO(ernstm): Move to Heap. // TODO(ernstm): Move to Heap.
...@@ -422,7 +419,7 @@ class GCTracer { ...@@ -422,7 +419,7 @@ class GCTracer {
// Size of incremental marking steps (in bytes) accumulated since the end of // Size of incremental marking steps (in bytes) accumulated since the end of
// the last mark compact GC. // the last mark compact GC.
intptr_t incremental_marking_bytes_; size_t incremental_marking_bytes_;
// Duration of incremental marking steps since the end of the last mark- // Duration of incremental marking steps since the end of the last mark-
// compact event. // compact event.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment