| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/compiler.h" | 5 #include "src/compiler.h" |
| 6 #include "src/compiler/pipeline-statistics.h" | 6 #include "src/compiler/pipeline-statistics.h" |
| 7 #include "src/compiler/zone-pool.h" | 7 #include "src/compiler/zone-pool.h" |
| 8 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 namespace internal { | 10 namespace internal { |
| 11 namespace compiler { | 11 namespace compiler { |
| 12 | 12 |
| 13 void PipelineStatistics::CommonStats::Begin( | 13 void PipelineStatistics::CommonStats::Begin( |
| 14 PipelineStatistics* pipeline_stats) { | 14 PipelineStatistics* pipeline_stats) { |
| 15 DCHECK(scope_.is_empty()); | 15 DCHECK(scope_.is_empty()); |
| 16 scope_.Reset(new ZonePool::StatsScope(pipeline_stats->zone_pool_)); | 16 scope_.Reset(new ZonePool::StatsScope(pipeline_stats->zone_pool_)); |
| 17 timer_.Start(); | 17 timer_.Start(); |
| 18 outer_zone_initial_size_ = pipeline_stats->OuterZoneSize(); | 18 outer_zone_initial_size_ = pipeline_stats->OuterZoneSize(); |
| 19 allocated_bytes_at_start_ = |
| 20 outer_zone_initial_size_ - |
| 21 pipeline_stats->total_stats_.outer_zone_initial_size_ + |
| 22 pipeline_stats->zone_pool_->GetCurrentAllocatedBytes(); |
| 19 } | 23 } |
| 20 | 24 |
| 21 | 25 |
| 22 void PipelineStatistics::CommonStats::End( | 26 void PipelineStatistics::CommonStats::End( |
| 23 PipelineStatistics* pipeline_stats, | 27 PipelineStatistics* pipeline_stats, |
| 24 CompilationStatistics::BasicStats* diff) { | 28 CompilationStatistics::BasicStats* diff) { |
| 25 DCHECK(!scope_.is_empty()); | 29 DCHECK(!scope_.is_empty()); |
| 26 diff->function_name_ = pipeline_stats->function_name_; | 30 diff->function_name_ = pipeline_stats->function_name_; |
| 27 diff->delta_ = timer_.Elapsed(); | 31 diff->delta_ = timer_.Elapsed(); |
| 28 size_t outer_zone_diff = | 32 size_t outer_zone_diff = |
| 29 pipeline_stats->OuterZoneSize() - outer_zone_initial_size_; | 33 pipeline_stats->OuterZoneSize() - outer_zone_initial_size_; |
| 30 diff->max_allocated_bytes_ = outer_zone_diff + scope_->GetMaxAllocatedBytes(); | 34 diff->max_allocated_bytes_ = outer_zone_diff + scope_->GetMaxAllocatedBytes(); |
| 35 diff->absolute_max_allocated_bytes_ = |
| 36 diff->max_allocated_bytes_ + allocated_bytes_at_start_; |
| 31 diff->total_allocated_bytes_ = | 37 diff->total_allocated_bytes_ = |
| 32 outer_zone_diff + scope_->GetTotalAllocatedBytes(); | 38 outer_zone_diff + scope_->GetTotalAllocatedBytes(); |
| 33 scope_.Reset(NULL); | 39 scope_.Reset(NULL); |
| 34 timer_.Stop(); | 40 timer_.Stop(); |
| 35 } | 41 } |
| 36 | 42 |
| 37 | 43 |
| 38 PipelineStatistics::PipelineStatistics(CompilationInfo* info, | 44 PipelineStatistics::PipelineStatistics(CompilationInfo* info, |
| 39 ZonePool* zone_pool) | 45 ZonePool* zone_pool) |
| 40 : isolate_(info->zone()->isolate()), | 46 : isolate_(info->zone()->isolate()), |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 void PipelineStatistics::EndPhase() { | 94 void PipelineStatistics::EndPhase() { |
| 89 DCHECK(InPhaseKind()); | 95 DCHECK(InPhaseKind()); |
| 90 CompilationStatistics::BasicStats diff; | 96 CompilationStatistics::BasicStats diff; |
| 91 phase_stats_.End(this, &diff); | 97 phase_stats_.End(this, &diff); |
| 92 compilation_stats_->RecordPhaseStats(phase_kind_name_, phase_name_, diff); | 98 compilation_stats_->RecordPhaseStats(phase_kind_name_, phase_name_, diff); |
| 93 } | 99 } |
| 94 | 100 |
| 95 } // namespace compiler | 101 } // namespace compiler |
| 96 } // namespace internal | 102 } // namespace internal |
| 97 } // namespace v8 | 103 } // namespace v8 |
| OLD | NEW |