Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(353)

Side by Side Diff: src/heap/heap.cc

Issue 1997363002: Adds support for collecting statistics about code and its metadata. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments from Hannes. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/spaces.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/heap/heap.h" 5 #include "src/heap/heap.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/ast/scopeinfo.h" 9 #include "src/ast/scopeinfo.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 4430 matching lines...) Expand 10 before | Expand all | Expand 10 after
4441 } else { 4441 } else {
4442 ExecutionAccess access(isolate()); 4442 ExecutionAccess access(isolate());
4443 isolate()->stack_guard()->RequestGC(); 4443 isolate()->stack_guard()->RequestGC();
4444 V8::GetCurrentPlatform()->CallOnForegroundThread( 4444 V8::GetCurrentPlatform()->CallOnForegroundThread(
4445 reinterpret_cast<v8::Isolate*>(isolate()), 4445 reinterpret_cast<v8::Isolate*>(isolate()),
4446 new MemoryPressureInterruptTask(this)); 4446 new MemoryPressureInterruptTask(this));
4447 } 4447 }
4448 } 4448 }
4449 } 4449 }
4450 4450
4451 void Heap::CollectCodeStatistics() {
4452 PagedSpace::ResetCodeAndMetadataStatistics(isolate());
4453 // We do not look for code in new space, or map space. If code
4454 // somehow ends up in those spaces, we would miss it here.
4455 code_space_->CollectCodeStatistics();
4456 old_space_->CollectCodeStatistics();
4457 lo_space_->CollectCodeStatistics();
4458 }
4459
4451 #ifdef DEBUG 4460 #ifdef DEBUG
4452 4461
4453 void Heap::Print() { 4462 void Heap::Print() {
4454 if (!HasBeenSetUp()) return; 4463 if (!HasBeenSetUp()) return;
4455 isolate()->PrintStack(stdout); 4464 isolate()->PrintStack(stdout);
4456 AllSpaces spaces(this); 4465 AllSpaces spaces(this);
4457 for (Space* space = spaces.next(); space != NULL; space = spaces.next()) { 4466 for (Space* space = spaces.next(); space != NULL; space = spaces.next()) {
4458 space->Print(); 4467 space->Print();
4459 } 4468 }
4460 } 4469 }
4461 4470
4462 4471
4463 void Heap::ReportCodeStatistics(const char* title) { 4472 void Heap::ReportCodeStatistics(const char* title) {
4464 PrintF(">>>>>> Code Stats (%s) >>>>>>\n", title); 4473 PrintF(">>>>>> Code Stats (%s) >>>>>>\n", title);
4465 PagedSpace::ResetCodeStatistics(isolate()); 4474 CollectCodeStatistics();
4466 // We do not look for code in new space, map space, or old space. If code
4467 // somehow ends up in those spaces, we would miss it here.
4468 code_space_->CollectCodeStatistics();
4469 lo_space_->CollectCodeStatistics();
4470 PagedSpace::ReportCodeStatistics(isolate()); 4475 PagedSpace::ReportCodeStatistics(isolate());
4471 } 4476 }
4472 4477
4473 4478
4474 // This function expects that NewSpace's allocated objects histogram is 4479 // This function expects that NewSpace's allocated objects histogram is
4475 // populated (via a call to CollectStatistics or else as a side effect of a 4480 // populated (via a call to CollectStatistics or else as a side effect of a
4476 // just-completed scavenge collection). 4481 // just-completed scavenge collection).
4477 void Heap::ReportHeapStatistics(const char* title) { 4482 void Heap::ReportHeapStatistics(const char* title) {
4478 USE(title); 4483 USE(title);
4479 PrintF(">>>>>> =============== %s (%d) =============== >>>>>>\n", title, 4484 PrintF(">>>>>> =============== %s (%d) =============== >>>>>>\n", title,
(...skipping 1880 matching lines...) Expand 10 before | Expand all | Expand 10 after
6360 } 6365 }
6361 6366
6362 6367
6363 // static 6368 // static
6364 int Heap::GetStaticVisitorIdForMap(Map* map) { 6369 int Heap::GetStaticVisitorIdForMap(Map* map) {
6365 return StaticVisitorBase::GetVisitorId(map); 6370 return StaticVisitorBase::GetVisitorId(map);
6366 } 6371 }
6367 6372
6368 } // namespace internal 6373 } // namespace internal
6369 } // namespace v8 6374 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/spaces.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698