[heap] Remove --heap-stats.

Bug: 
Change-Id: I53b68e8a4200a87d9f14b9540b52cab316678b2d
Reviewed-on: https://chromium-review.googlesource.com/836593
Commit-Queue: Hannes Payer <hpayer@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50233}
This commit is contained in:
Hannes Payer 2017-12-20 12:57:03 +01:00 committed by Commit Bot
parent 8d2ea1c06f
commit 3b914b2bf5
10 changed files with 3 additions and 119 deletions

View File

@ -1065,7 +1065,6 @@ DEFINE_BOOL(trace_contexts, false, "trace contexts operations")
// heap.cc
DEFINE_BOOL(gc_verbose, false, "print stuff during garbage collection")
DEFINE_BOOL(heap_stats, false, "report heap statistics before and after GC")
DEFINE_BOOL(code_stats, false, "report code statistics after GC")
DEFINE_BOOL(print_handles, false, "report handles after GC")
DEFINE_BOOL(check_handle_count, false,

View File

@ -363,17 +363,6 @@ void Heap::SetGCState(HeapState state) {
gc_state_ = state;
}
void Heap::ReportStatisticsBeforeGC() {
#ifdef DEBUG
if (FLAG_heap_stats) {
new_space_->CollectStatistics();
ReportHeapStatistics("Before GC");
new_space_->ClearHistograms();
}
#endif // DEBUG
}
void Heap::PrintShortHeapStatistics() {
if (!FLAG_trace_gc_verbose) return;
PrintIsolate(isolate_, "Memory allocator, used: %6" PRIuS
@ -432,12 +421,6 @@ void Heap::PrintShortHeapStatistics() {
}
void Heap::ReportStatisticsAfterGC() {
#if defined(DEBUG)
if (FLAG_heap_stats) {
new_space_->CollectStatistics();
ReportHeapStatistics("After GC");
}
#endif // DEBUG
for (int i = 0; i < static_cast<int>(v8::Isolate::kUseCounterFeatureCount);
++i) {
int count = deferred_counters_[i];
@ -616,8 +599,6 @@ void Heap::GarbageCollectionPrologue() {
DCHECK(!AllowHeapAllocation::IsAllowed() && gc_state_ == NOT_IN_GC);
if (FLAG_gc_verbose) Print();
ReportStatisticsBeforeGC();
#endif // DEBUG
if (new_space_->IsAtMaximumCapacity()) {
@ -4575,37 +4556,6 @@ void Heap::ReportCodeStatistics(const char* title) {
CodeStatistics::ReportCodeStatistics(isolate());
}
// This function expects that NewSpace's allocated objects histogram is
// populated (via a call to CollectStatistics or else as a side effect of a
// just-completed scavenge collection).
void Heap::ReportHeapStatistics(const char* title) {
USE(title);
PrintF(">>>>>> =============== %s (%d) =============== >>>>>>\n", title,
gc_count_);
PrintF("old_generation_allocation_limit_ %" PRIuS "\n",
old_generation_allocation_limit_);
PrintF("\n");
PrintF("Number of handles : %d\n", HandleScope::NumberOfHandles(isolate_));
isolate_->global_handles()->PrintStats();
PrintF("\n");
PrintF("Heap statistics : ");
memory_allocator()->ReportStatistics();
PrintF("To space : ");
new_space_->ReportStatistics();
PrintF("Old space : ");
old_space_->ReportStatistics();
PrintF("Code space : ");
code_space_->ReportStatistics();
PrintF("Map space : ");
map_space_->ReportStatistics();
PrintF("Large object space : ");
lo_space_->ReportStatistics();
PrintF(">>>>>> ========================================= >>>>>>\n");
}
#endif // DEBUG
const char* Heap::GarbageCollectionReasonToString(

View File

@ -1641,8 +1641,7 @@ class Heap {
void Print();
void PrintHandles();
// Report heap statistics.
void ReportHeapStatistics(const char* title);
// Report code statistics.
void ReportCodeStatistics(const char* title);
#endif
void* GetRandomMmapAddr() {
@ -1871,8 +1870,7 @@ class Heap {
// the old space.
void EvaluateOldSpaceLocalPretenuring(uint64_t size_of_objects_before_gc);
// Record statistics before and after garbage collection.
void ReportStatisticsBeforeGC();
// Record statistics after garbage collection.
void ReportStatisticsAfterGC();
// Creates and installs the full-sized number string cache.

View File

@ -58,8 +58,6 @@ bool Scavenger::MigrateObject(Map* map, HeapObject* source, HeapObject* target,
}
if (V8_UNLIKELY(is_logging_)) {
// Update NewSpace stats if necessary.
RecordCopiedObject(target);
heap()->OnMoveEvent(target, source, size);
}

View File

@ -153,18 +153,6 @@ void Scavenger::Process(OneshotBarrier* barrier) {
} while (!done);
}
void Scavenger::RecordCopiedObject(HeapObject* obj) {
#ifdef DEBUG
if (FLAG_heap_stats) {
if (heap()->new_space()->Contains(obj)) {
heap()->new_space()->RecordAllocation(obj);
} else {
heap()->new_space()->RecordPromotion(obj);
}
}
#endif
}
void Scavenger::Finalize() {
heap()->MergeAllocationSitePretenuringFeedback(local_pretenuring_feedback_);
heap()->IncrementSemiSpaceCopiedObjectSize(copied_size_);

View File

@ -92,8 +92,6 @@ class Scavenger {
void IterateAndScavengePromotedObject(HeapObject* target, int size);
void RecordCopiedObject(HeapObject* obj);
static inline bool ContainsOnlyData(VisitorId visitor_id);
Heap* const heap_;

View File

@ -2638,44 +2638,6 @@ static void ReportHistogram(Isolate* isolate, bool print_spill) {
}
#endif // DEBUG
// Support for statistics gathering for --heap-stats.
void NewSpace::ClearHistograms() {
for (int i = 0; i <= LAST_TYPE; i++) {
allocated_histogram_[i].clear();
promoted_histogram_[i].clear();
}
}
// Because the copying collector does not touch garbage objects, we iterate
// the new space before a collection to get a histogram of allocated objects.
void NewSpace::CollectStatistics() {
ClearHistograms();
SemiSpaceIterator it(this);
for (HeapObject* obj = it.Next(); obj != nullptr; obj = it.Next())
RecordAllocation(obj);
}
void NewSpace::ReportStatistics() {
#ifdef DEBUG
if (FLAG_heap_stats) {
float pct = static_cast<float>(Available()) / TotalCapacity();
PrintF(" capacity: %" PRIuS ", available: %" PRIuS ", %%%d\n",
TotalCapacity(), Available(), static_cast<int>(pct * 100));
PrintF("\n Object Histogram:\n");
for (int i = 0; i <= LAST_TYPE; i++) {
if (allocated_histogram_[i].number() > 0) {
PrintF(" %-34s%10d (%10d bytes)\n", allocated_histogram_[i].name(),
allocated_histogram_[i].number(),
allocated_histogram_[i].bytes());
}
}
PrintF("\n");
}
#endif // DEBUG
}
void NewSpace::RecordAllocation(HeapObject* obj) {
InstanceType type = obj->map()->instance_type();
DCHECK(0 <= type && type <= LAST_TYPE);

View File

@ -2716,13 +2716,6 @@ class NewSpace : public SpaceWithLinearArea {
void Print() override { to_space_.Print(); }
#endif
// Iterates the active semispace to collect statistics.
void CollectStatistics();
// Reports previously collected statistics of the active semispace.
void ReportStatistics();
// Clears previously collected statistics.
void ClearHistograms();
// Record the allocation or promotion of a heap object. Note that we don't
// record every single allocation, but only those that happen in the
// to space during a scavenge GC.

View File

@ -25,8 +25,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --heap-stats
var expectedItemsCount = 10000,
itemSize = 5,
heap = new ArrayBuffer(expectedItemsCount * itemSize * 8),

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax --expose-gc --heap-stats
// Flags: --allow-natives-syntax --expose-gc
function g(dummy, x) {
var start = "";