Refactor the functions related to collecting code statistics to a new class.
The functions related to code statistics are a part of spaces currently. This is not very intutive and hence refactored these functions to a new CodeStatistics class. BUG= LOG=N Review-Url: https://codereview.chromium.org/2082863003 Cr-Commit-Position: refs/heads/master@{#37440}
This commit is contained in:
parent
f0e65c9637
commit
b83dbf6502
2
BUILD.gn
2
BUILD.gn
@ -1178,6 +1178,8 @@ v8_source_set("v8_base") {
|
||||
"src/heap/array-buffer-tracker-inl.h",
|
||||
"src/heap/array-buffer-tracker.cc",
|
||||
"src/heap/array-buffer-tracker.h",
|
||||
"src/heap/code-stats.cc",
|
||||
"src/heap/code-stats.h",
|
||||
"src/heap/gc-idle-time-handler.cc",
|
||||
"src/heap/gc-idle-time-handler.h",
|
||||
"src/heap/gc-tracer.cc",
|
||||
|
220
src/heap/code-stats.cc
Normal file
220
src/heap/code-stats.cc
Normal file
@ -0,0 +1,220 @@
|
||||
// Copyright 2016 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "src/heap/code-stats.h"
|
||||
#include "src/objects-inl.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
// Record code statisitcs.
|
||||
void CodeStatistics::RecordCodeAndMetadataStatistics(HeapObject* object,
|
||||
Isolate* isolate) {
|
||||
if (!object->IsAbstractCode()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Record code+metadata statisitcs.
|
||||
AbstractCode* abstract_code = AbstractCode::cast(object);
|
||||
int size = abstract_code->SizeIncludingMetadata();
|
||||
if (abstract_code->IsCode()) {
|
||||
size += isolate->code_and_metadata_size();
|
||||
isolate->set_code_and_metadata_size(size);
|
||||
} else {
|
||||
size += isolate->bytecode_and_metadata_size();
|
||||
isolate->set_bytecode_and_metadata_size(size);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
// Record code kind and code comment statistics.
|
||||
isolate->code_kind_statistics()[abstract_code->kind()] +=
|
||||
abstract_code->Size();
|
||||
CodeStatistics::CollectCodeCommentStatistics(object, isolate);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CodeStatistics::ResetCodeAndMetadataStatistics(Isolate* isolate) {
|
||||
isolate->set_code_and_metadata_size(0);
|
||||
isolate->set_bytecode_and_metadata_size(0);
|
||||
#ifdef DEBUG
|
||||
ResetCodeStatistics(isolate);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Collects code size statistics:
|
||||
// - code and metadata size
|
||||
// - by code kind (only in debug mode)
|
||||
// - by code comment (only in debug mode)
|
||||
void CodeStatistics::CollectCodeStatistics(PagedSpace* space,
|
||||
Isolate* isolate) {
|
||||
HeapObjectIterator obj_it(space);
|
||||
for (HeapObject* obj = obj_it.Next(); obj != NULL; obj = obj_it.Next()) {
|
||||
RecordCodeAndMetadataStatistics(obj, isolate);
|
||||
}
|
||||
}
|
||||
|
||||
// Collects code size statistics in LargeObjectSpace:
|
||||
// - code and metadata size
|
||||
// - by code kind (only in debug mode)
|
||||
// - by code comment (only in debug mode)
|
||||
void CodeStatistics::CollectCodeStatistics(LargeObjectSpace* space,
|
||||
Isolate* isolate) {
|
||||
LargeObjectIterator obj_it(space);
|
||||
for (HeapObject* obj = obj_it.Next(); obj != NULL; obj = obj_it.Next()) {
|
||||
RecordCodeAndMetadataStatistics(obj, isolate);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void CodeStatistics::ReportCodeStatistics(Isolate* isolate) {
|
||||
// Report code kind statistics
|
||||
int* code_kind_statistics = isolate->code_kind_statistics();
|
||||
PrintF("\n Code kind histograms: \n");
|
||||
for (int i = 0; i < AbstractCode::NUMBER_OF_KINDS; i++) {
|
||||
if (code_kind_statistics[i] > 0) {
|
||||
PrintF(" %-20s: %10d bytes\n",
|
||||
AbstractCode::Kind2String(static_cast<AbstractCode::Kind>(i)),
|
||||
code_kind_statistics[i]);
|
||||
}
|
||||
}
|
||||
PrintF("\n");
|
||||
|
||||
// Report code and metadata statisitcs
|
||||
if (isolate->code_and_metadata_size() > 0) {
|
||||
PrintF("Code size including metadata : %10d bytes\n",
|
||||
isolate->code_and_metadata_size());
|
||||
}
|
||||
if (isolate->bytecode_and_metadata_size() > 0) {
|
||||
PrintF("Bytecode size including metadata: %10d bytes\n",
|
||||
isolate->bytecode_and_metadata_size());
|
||||
}
|
||||
|
||||
// Report code comment statistics
|
||||
CommentStatistic* comments_statistics =
|
||||
isolate->paged_space_comments_statistics();
|
||||
PrintF(
|
||||
"Code comment statistics (\" [ comment-txt : size/ "
|
||||
"count (average)\"):\n");
|
||||
for (int i = 0; i <= CommentStatistic::kMaxComments; i++) {
|
||||
const CommentStatistic& cs = comments_statistics[i];
|
||||
if (cs.size > 0) {
|
||||
PrintF(" %-30s: %10d/%6d (%d)\n", cs.comment, cs.size, cs.count,
|
||||
cs.size / cs.count);
|
||||
}
|
||||
}
|
||||
PrintF("\n");
|
||||
}
|
||||
|
||||
void CodeStatistics::ResetCodeStatistics(Isolate* isolate) {
|
||||
// Clear code kind statistics
|
||||
int* code_kind_statistics = isolate->code_kind_statistics();
|
||||
for (int i = 0; i < AbstractCode::NUMBER_OF_KINDS; i++) {
|
||||
code_kind_statistics[i] = 0;
|
||||
}
|
||||
|
||||
// Clear code comment statistics
|
||||
CommentStatistic* comments_statistics =
|
||||
isolate->paged_space_comments_statistics();
|
||||
for (int i = 0; i < CommentStatistic::kMaxComments; i++) {
|
||||
comments_statistics[i].Clear();
|
||||
}
|
||||
comments_statistics[CommentStatistic::kMaxComments].comment = "Unknown";
|
||||
comments_statistics[CommentStatistic::kMaxComments].size = 0;
|
||||
comments_statistics[CommentStatistic::kMaxComments].count = 0;
|
||||
}
|
||||
|
||||
// Adds comment to 'comment_statistics' table. Performance OK as long as
|
||||
// 'kMaxComments' is small
|
||||
void CodeStatistics::EnterComment(Isolate* isolate, const char* comment,
|
||||
int delta) {
|
||||
CommentStatistic* comments_statistics =
|
||||
isolate->paged_space_comments_statistics();
|
||||
// Do not count empty comments
|
||||
if (delta <= 0) return;
|
||||
CommentStatistic* cs = &comments_statistics[CommentStatistic::kMaxComments];
|
||||
// Search for a free or matching entry in 'comments_statistics': 'cs'
|
||||
// points to result.
|
||||
for (int i = 0; i < CommentStatistic::kMaxComments; i++) {
|
||||
if (comments_statistics[i].comment == NULL) {
|
||||
cs = &comments_statistics[i];
|
||||
cs->comment = comment;
|
||||
break;
|
||||
} else if (strcmp(comments_statistics[i].comment, comment) == 0) {
|
||||
cs = &comments_statistics[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Update entry for 'comment'
|
||||
cs->size += delta;
|
||||
cs->count += 1;
|
||||
}
|
||||
|
||||
// Call for each nested comment start (start marked with '[ xxx', end marked
|
||||
// with ']'. RelocIterator 'it' must point to a comment reloc info.
|
||||
void CodeStatistics::CollectCommentStatistics(Isolate* isolate,
|
||||
RelocIterator* it) {
|
||||
DCHECK(!it->done());
|
||||
DCHECK(it->rinfo()->rmode() == RelocInfo::COMMENT);
|
||||
const char* tmp = reinterpret_cast<const char*>(it->rinfo()->data());
|
||||
if (tmp[0] != '[') {
|
||||
// Not a nested comment; skip
|
||||
return;
|
||||
}
|
||||
|
||||
// Search for end of nested comment or a new nested comment
|
||||
const char* const comment_txt =
|
||||
reinterpret_cast<const char*>(it->rinfo()->data());
|
||||
const byte* prev_pc = it->rinfo()->pc();
|
||||
int flat_delta = 0;
|
||||
it->next();
|
||||
while (true) {
|
||||
// All nested comments must be terminated properly, and therefore exit
|
||||
// from loop.
|
||||
DCHECK(!it->done());
|
||||
if (it->rinfo()->rmode() == RelocInfo::COMMENT) {
|
||||
const char* const txt =
|
||||
reinterpret_cast<const char*>(it->rinfo()->data());
|
||||
flat_delta += static_cast<int>(it->rinfo()->pc() - prev_pc);
|
||||
if (txt[0] == ']') break; // End of nested comment
|
||||
// A new comment
|
||||
CollectCommentStatistics(isolate, it);
|
||||
// Skip code that was covered with previous comment
|
||||
prev_pc = it->rinfo()->pc();
|
||||
}
|
||||
it->next();
|
||||
}
|
||||
EnterComment(isolate, comment_txt, flat_delta);
|
||||
}
|
||||
|
||||
// Collects code comment statistics
|
||||
void CodeStatistics::CollectCodeCommentStatistics(HeapObject* obj,
|
||||
Isolate* isolate) {
|
||||
// Bytecode objects do not contain RelocInfo. Only process code objects
|
||||
// for code comment statistics.
|
||||
if (!obj->IsCode()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Code* code = Code::cast(obj);
|
||||
RelocIterator it(code);
|
||||
int delta = 0;
|
||||
const byte* prev_pc = code->instruction_start();
|
||||
while (!it.done()) {
|
||||
if (it.rinfo()->rmode() == RelocInfo::COMMENT) {
|
||||
delta += static_cast<int>(it.rinfo()->pc() - prev_pc);
|
||||
CollectCommentStatistics(isolate, &it);
|
||||
prev_pc = it.rinfo()->pc();
|
||||
}
|
||||
it.next();
|
||||
}
|
||||
|
||||
DCHECK(code->instruction_start() <= prev_pc &&
|
||||
prev_pc <= code->instruction_end());
|
||||
delta += static_cast<int>(code->instruction_end() - prev_pc);
|
||||
EnterComment(isolate, "NoComment", delta);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace internal
|
||||
} // namespace v8
|
42
src/heap/code-stats.h
Normal file
42
src/heap/code-stats.h
Normal file
@ -0,0 +1,42 @@
|
||||
// Copyright 2016 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "src/assembler.h"
|
||||
#include "src/heap/spaces.h"
|
||||
#include "src/isolate.h"
|
||||
#include "src/objects.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
class CodeStatistics {
|
||||
public:
|
||||
// Collect statistics related to code size.
|
||||
static void CollectCodeStatistics(PagedSpace* space, Isolate* isolate);
|
||||
|
||||
// Collect statistics related to code size from large object space.
|
||||
static void CollectCodeStatistics(LargeObjectSpace* space, Isolate* isolate);
|
||||
|
||||
// Reset code size related statistics
|
||||
static void ResetCodeAndMetadataStatistics(Isolate* isolate);
|
||||
|
||||
#ifdef DEBUG
|
||||
// Report statistics about code kind, code+metadata and code comments.
|
||||
static void ReportCodeStatistics(Isolate* isolate);
|
||||
#endif
|
||||
|
||||
private:
|
||||
static void RecordCodeAndMetadataStatistics(HeapObject* object,
|
||||
Isolate* isolate);
|
||||
|
||||
#ifdef DEBUG
|
||||
static void CollectCommentStatistics(Isolate* isolate, RelocIterator* it);
|
||||
static void CollectCodeCommentStatistics(HeapObject* obj, Isolate* isolate);
|
||||
static void EnterComment(Isolate* isolate, const char* comment, int delta);
|
||||
static void ResetCodeStatistics(Isolate* isolate);
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
} // namespace v8
|
@ -18,6 +18,7 @@
|
||||
#include "src/deoptimizer.h"
|
||||
#include "src/global-handles.h"
|
||||
#include "src/heap/array-buffer-tracker-inl.h"
|
||||
#include "src/heap/code-stats.h"
|
||||
#include "src/heap/gc-idle-time-handler.h"
|
||||
#include "src/heap/gc-tracer.h"
|
||||
#include "src/heap/incremental-marking.h"
|
||||
@ -4438,12 +4439,12 @@ void Heap::MemoryPressureNotification(MemoryPressureLevel level,
|
||||
}
|
||||
|
||||
void Heap::CollectCodeStatistics() {
|
||||
PagedSpace::ResetCodeAndMetadataStatistics(isolate());
|
||||
CodeStatistics::ResetCodeAndMetadataStatistics(isolate());
|
||||
// We do not look for code in new space, or map space. If code
|
||||
// somehow ends up in those spaces, we would miss it here.
|
||||
code_space_->CollectCodeStatistics();
|
||||
old_space_->CollectCodeStatistics();
|
||||
lo_space_->CollectCodeStatistics();
|
||||
CodeStatistics::CollectCodeStatistics(code_space_, isolate());
|
||||
CodeStatistics::CollectCodeStatistics(old_space_, isolate());
|
||||
CodeStatistics::CollectCodeStatistics(lo_space_, isolate());
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -4461,7 +4462,7 @@ void Heap::Print() {
|
||||
void Heap::ReportCodeStatistics(const char* title) {
|
||||
PrintF(">>>>>> Code Stats (%s) >>>>>>\n", title);
|
||||
CollectCodeStatistics();
|
||||
PagedSpace::ReportCodeStatistics(isolate());
|
||||
CodeStatistics::ReportCodeStatistics(isolate());
|
||||
}
|
||||
|
||||
|
||||
|
@ -2037,24 +2037,6 @@ static void ClearHistograms(Isolate* isolate) {
|
||||
isolate->js_spill_information()->Clear();
|
||||
}
|
||||
|
||||
|
||||
static void ClearCodeKindStatistics(int* code_kind_statistics) {
|
||||
for (int i = 0; i < AbstractCode::NUMBER_OF_KINDS; i++) {
|
||||
code_kind_statistics[i] = 0;
|
||||
}
|
||||
}
|
||||
static void ReportCodeKindStatistics(int* code_kind_statistics) {
|
||||
PrintF("\n Code kind histograms: \n");
|
||||
for (int i = 0; i < AbstractCode::NUMBER_OF_KINDS; i++) {
|
||||
if (code_kind_statistics[i] > 0) {
|
||||
PrintF(" %-20s: %10d bytes\n",
|
||||
AbstractCode::Kind2String(static_cast<AbstractCode::Kind>(i)),
|
||||
code_kind_statistics[i]);
|
||||
}
|
||||
}
|
||||
PrintF("\n");
|
||||
}
|
||||
|
||||
static int CollectHistogramInfo(HeapObject* obj) {
|
||||
Isolate* isolate = obj->GetIsolate();
|
||||
InstanceType type = obj->map()->instance_type();
|
||||
@ -2753,127 +2735,6 @@ HeapObject* PagedSpace::SlowAllocateRaw(int size_in_bytes) {
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void PagedSpace::ReportCodeStatistics(Isolate* isolate) {
|
||||
CommentStatistic* comments_statistics =
|
||||
isolate->paged_space_comments_statistics();
|
||||
ReportCodeKindStatistics(isolate->code_kind_statistics());
|
||||
PrintF("Code size including metadata : %10d bytes\n",
|
||||
isolate->code_and_metadata_size());
|
||||
PrintF("Bytecode size including metadata: %10d bytes\n",
|
||||
isolate->bytecode_and_metadata_size());
|
||||
PrintF(
|
||||
"Code comment statistics (\" [ comment-txt : size/ "
|
||||
"count (average)\"):\n");
|
||||
for (int i = 0; i <= CommentStatistic::kMaxComments; i++) {
|
||||
const CommentStatistic& cs = comments_statistics[i];
|
||||
if (cs.size > 0) {
|
||||
PrintF(" %-30s: %10d/%6d (%d)\n", cs.comment, cs.size, cs.count,
|
||||
cs.size / cs.count);
|
||||
}
|
||||
}
|
||||
PrintF("\n");
|
||||
}
|
||||
|
||||
void PagedSpace::ResetCodeStatistics(Isolate* isolate) {
|
||||
CommentStatistic* comments_statistics =
|
||||
isolate->paged_space_comments_statistics();
|
||||
ClearCodeKindStatistics(isolate->code_kind_statistics());
|
||||
for (int i = 0; i < CommentStatistic::kMaxComments; i++) {
|
||||
comments_statistics[i].Clear();
|
||||
}
|
||||
comments_statistics[CommentStatistic::kMaxComments].comment = "Unknown";
|
||||
comments_statistics[CommentStatistic::kMaxComments].size = 0;
|
||||
comments_statistics[CommentStatistic::kMaxComments].count = 0;
|
||||
}
|
||||
|
||||
|
||||
// Adds comment to 'comment_statistics' table. Performance OK as long as
|
||||
// 'kMaxComments' is small
|
||||
static void EnterComment(Isolate* isolate, const char* comment, int delta) {
|
||||
CommentStatistic* comments_statistics =
|
||||
isolate->paged_space_comments_statistics();
|
||||
// Do not count empty comments
|
||||
if (delta <= 0) return;
|
||||
CommentStatistic* cs = &comments_statistics[CommentStatistic::kMaxComments];
|
||||
// Search for a free or matching entry in 'comments_statistics': 'cs'
|
||||
// points to result.
|
||||
for (int i = 0; i < CommentStatistic::kMaxComments; i++) {
|
||||
if (comments_statistics[i].comment == NULL) {
|
||||
cs = &comments_statistics[i];
|
||||
cs->comment = comment;
|
||||
break;
|
||||
} else if (strcmp(comments_statistics[i].comment, comment) == 0) {
|
||||
cs = &comments_statistics[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Update entry for 'comment'
|
||||
cs->size += delta;
|
||||
cs->count += 1;
|
||||
}
|
||||
|
||||
|
||||
// Call for each nested comment start (start marked with '[ xxx', end marked
|
||||
// with ']'. RelocIterator 'it' must point to a comment reloc info.
|
||||
static void CollectCommentStatistics(Isolate* isolate, RelocIterator* it) {
|
||||
DCHECK(!it->done());
|
||||
DCHECK(it->rinfo()->rmode() == RelocInfo::COMMENT);
|
||||
const char* tmp = reinterpret_cast<const char*>(it->rinfo()->data());
|
||||
if (tmp[0] != '[') {
|
||||
// Not a nested comment; skip
|
||||
return;
|
||||
}
|
||||
|
||||
// Search for end of nested comment or a new nested comment
|
||||
const char* const comment_txt =
|
||||
reinterpret_cast<const char*>(it->rinfo()->data());
|
||||
const byte* prev_pc = it->rinfo()->pc();
|
||||
int flat_delta = 0;
|
||||
it->next();
|
||||
while (true) {
|
||||
// All nested comments must be terminated properly, and therefore exit
|
||||
// from loop.
|
||||
DCHECK(!it->done());
|
||||
if (it->rinfo()->rmode() == RelocInfo::COMMENT) {
|
||||
const char* const txt =
|
||||
reinterpret_cast<const char*>(it->rinfo()->data());
|
||||
flat_delta += static_cast<int>(it->rinfo()->pc() - prev_pc);
|
||||
if (txt[0] == ']') break; // End of nested comment
|
||||
// A new comment
|
||||
CollectCommentStatistics(isolate, it);
|
||||
// Skip code that was covered with previous comment
|
||||
prev_pc = it->rinfo()->pc();
|
||||
}
|
||||
it->next();
|
||||
}
|
||||
EnterComment(isolate, comment_txt, flat_delta);
|
||||
}
|
||||
|
||||
// Collects code comment statistics
|
||||
static void CollectCodeCommentStatistics(HeapObject* obj, Isolate* isolate) {
|
||||
if (!obj->IsCode()) {
|
||||
return;
|
||||
}
|
||||
Code* code = Code::cast(obj);
|
||||
RelocIterator it(code);
|
||||
int delta = 0;
|
||||
const byte* prev_pc = code->instruction_start();
|
||||
while (!it.done()) {
|
||||
if (it.rinfo()->rmode() == RelocInfo::COMMENT) {
|
||||
delta += static_cast<int>(it.rinfo()->pc() - prev_pc);
|
||||
CollectCommentStatistics(isolate, &it);
|
||||
prev_pc = it.rinfo()->pc();
|
||||
}
|
||||
it.next();
|
||||
}
|
||||
|
||||
DCHECK(code->instruction_start() <= prev_pc &&
|
||||
prev_pc <= code->instruction_end());
|
||||
delta += static_cast<int>(code->instruction_end() - prev_pc);
|
||||
EnterComment(isolate, "NoComment", delta);
|
||||
}
|
||||
|
||||
|
||||
void PagedSpace::ReportStatistics() {
|
||||
int pct = static_cast<int>(Available() * 100 / Capacity());
|
||||
PrintF(" capacity: %" V8PRIdPTR ", waste: %" V8PRIdPTR
|
||||
@ -2891,44 +2752,6 @@ void PagedSpace::ReportStatistics() {
|
||||
}
|
||||
#endif
|
||||
|
||||
static void RecordCodeSizeIncludingMetadata(AbstractCode* abstract_code,
|
||||
Isolate* isolate) {
|
||||
int size = abstract_code->SizeIncludingMetadata();
|
||||
if (abstract_code->IsCode()) {
|
||||
size += isolate->code_and_metadata_size();
|
||||
isolate->set_code_and_metadata_size(size);
|
||||
} else {
|
||||
size += isolate->bytecode_and_metadata_size();
|
||||
isolate->set_bytecode_and_metadata_size(size);
|
||||
}
|
||||
}
|
||||
|
||||
// Collects code size statistics:
|
||||
// - code and metadata size
|
||||
// - by code kind (only in debug mode)
|
||||
// - by code comment (only in debug mode)
|
||||
void PagedSpace::CollectCodeStatistics() {
|
||||
Isolate* isolate = heap()->isolate();
|
||||
HeapObjectIterator obj_it(this);
|
||||
for (HeapObject* obj = obj_it.Next(); obj != NULL; obj = obj_it.Next()) {
|
||||
if (obj->IsAbstractCode()) {
|
||||
AbstractCode* code = AbstractCode::cast(obj);
|
||||
RecordCodeSizeIncludingMetadata(code, isolate);
|
||||
#ifdef DEBUG
|
||||
isolate->code_kind_statistics()[code->kind()] += code->Size();
|
||||
CollectCodeCommentStatistics(obj, isolate);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PagedSpace::ResetCodeAndMetadataStatistics(Isolate* isolate) {
|
||||
isolate->set_code_and_metadata_size(0);
|
||||
isolate->set_bytecode_and_metadata_size(0);
|
||||
#ifdef DEBUG
|
||||
ResetCodeStatistics(isolate);
|
||||
#endif
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// MapSpace implementation
|
||||
@ -3231,21 +3054,6 @@ void LargeObjectSpace::Verify() {
|
||||
}
|
||||
#endif
|
||||
|
||||
void LargeObjectSpace::CollectCodeStatistics() {
|
||||
Isolate* isolate = heap()->isolate();
|
||||
LargeObjectIterator obj_it(this);
|
||||
for (HeapObject* obj = obj_it.Next(); obj != NULL; obj = obj_it.Next()) {
|
||||
if (obj->IsAbstractCode()) {
|
||||
AbstractCode* code = AbstractCode::cast(obj);
|
||||
RecordCodeSizeIncludingMetadata(code, isolate);
|
||||
#ifdef DEBUG
|
||||
isolate->code_kind_statistics()[code->kind()] += code->Size();
|
||||
CollectCodeCommentStatistics(obj, isolate);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void LargeObjectSpace::Print() {
|
||||
OFStream os(stdout);
|
||||
|
@ -2269,11 +2269,6 @@ class PagedSpace : public Space {
|
||||
// The dummy page that anchors the linked list of pages.
|
||||
Page* anchor() { return &anchor_; }
|
||||
|
||||
// Collect code size related statistics
|
||||
void CollectCodeStatistics();
|
||||
|
||||
// Reset code size related statistics
|
||||
static void ResetCodeAndMetadataStatistics(Isolate* isolate);
|
||||
|
||||
#ifdef VERIFY_HEAP
|
||||
// Verify integrity of this space.
|
||||
|
@ -839,6 +839,8 @@
|
||||
'heap/array-buffer-tracker-inl.h',
|
||||
'heap/array-buffer-tracker.cc',
|
||||
'heap/array-buffer-tracker.h',
|
||||
'heap/code-stats.cc',
|
||||
'heap/code-stats.h',
|
||||
'heap/memory-reducer.cc',
|
||||
'heap/memory-reducer.h',
|
||||
'heap/gc-idle-time-handler.cc',
|
||||
|
Loading…
Reference in New Issue
Block a user