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 @@
namespace v8 {
namespace internal {
static intptr_t CountTotalHolesSize(Heap* heap) {
intptr_t holes_size = 0;
static size_t CountTotalHolesSize(Heap* heap) {
size_t holes_size = 0;
OldSpaces spaces(heap);
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;
}
......@@ -188,8 +191,8 @@ void GCTracer::Start(GarbageCollector collector,
current_.scopes[i] = 0;
}
int committed_memory = static_cast<int>(heap_->CommittedMemory() / KB);
int used_memory = static_cast<int>(current_.start_object_size / KB);
size_t committed_memory = heap_->CommittedMemory() / KB;
size_t used_memory = current_.start_object_size / KB;
Counters* counters = heap_->isolate()->counters();
......@@ -241,8 +244,8 @@ void GCTracer::Stop(GarbageCollector collector) {
AddAllocation(current_.end_time);
int committed_memory = static_cast<int>(heap_->CommittedMemory() / KB);
int used_memory = static_cast<int>(current_.end_object_size / KB);
size_t committed_memory = heap_->CommittedMemory() / KB;
size_t used_memory = current_.end_object_size / KB;
heap_->isolate()->counters()->aggregated_memory_heap_committed()->AddSample(
current_.end_time, committed_memory);
heap_->isolate()->counters()->aggregated_memory_heap_used()->AddSample(
......@@ -348,9 +351,8 @@ void GCTracer::AddContextDisposalTime(double time) {
recorded_context_disposal_times_.Push(time);
}
void GCTracer::AddCompactionEvent(double duration,
intptr_t live_bytes_compacted) {
size_t live_bytes_compacted) {
recorded_compactions_.Push(
MakeBytesAndDuration(live_bytes_compacted, duration));
}
......@@ -360,8 +362,7 @@ void GCTracer::AddSurvivalRatio(double promotion_ratio) {
recorded_survival_ratios_.Push(promotion_ratio);
}
void GCTracer::AddIncrementalMarkingStep(double duration, intptr_t bytes) {
void GCTracer::AddIncrementalMarkingStep(double duration, size_t bytes) {
if (bytes > 0) {
incremental_marking_bytes_ += bytes;
incremental_marking_duration_ += duration;
......@@ -426,7 +427,7 @@ void GCTracer::Print() const {
void GCTracer::PrintNVP() const {
double duration = current_.end_time - current_.start_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;
double incremental_walltime_duration = 0;
......@@ -697,7 +698,7 @@ double GCTracer::AverageSpeed(const RingBuffer<BytesAndDuration>& buffer) {
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;
double current_speed = bytes / duration;
if (recorded_incremental_marking_speed_ == 0) {
......
......@@ -215,10 +215,10 @@ class GCTracer {
bool reduce_memory;
// 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.
intptr_t end_object_size;
size_t end_object_size;
// Size of memory allocated from OS set in constructor.
size_t start_memory_size;
......@@ -228,23 +228,20 @@ class GCTracer {
// Total amount of space either wasted or contained in one of free lists
// 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
// after the current GC.
intptr_t end_holes_size;
size_t end_holes_size;
// 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.
intptr_t survived_new_space_object_size;
// Bytes marked since creation of tracer (value at start of event).
intptr_t cumulative_incremental_marking_bytes;
size_t survived_new_space_object_size;
// 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.
double incremental_marking_duration;
......@@ -277,12 +274,12 @@ class GCTracer {
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);
// 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.
// Returns 0 if no events have been recorded.
......@@ -386,7 +383,7 @@ class GCTracer {
void ResetForTesting();
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.
// TODO(ernstm): Move to Heap.
......@@ -422,7 +419,7 @@ class GCTracer {
// Size of incremental marking steps (in bytes) accumulated since the end of
// 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-
// 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