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

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

Issue 1058253003: Adding V8 api to get memory statistics of spaces in V8::Heap. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixing jochen's comments. Created 5 years, 8 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/v8.h" 5 #include "src/v8.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/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/base/once.h" 10 #include "src/base/once.h"
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 intptr_t Heap::SizeOfObjects() { 445 intptr_t Heap::SizeOfObjects() {
446 intptr_t total = 0; 446 intptr_t total = 0;
447 AllSpaces spaces(this); 447 AllSpaces spaces(this);
448 for (Space* space = spaces.next(); space != NULL; space = spaces.next()) { 448 for (Space* space = spaces.next(); space != NULL; space = spaces.next()) {
449 total += space->SizeOfObjects(); 449 total += space->SizeOfObjects();
450 } 450 }
451 return total; 451 return total;
452 } 452 }
453 453
454 454
455 const char* Heap::GetSpaceName(int idx) {
456 switch (idx) {
457 case NEW_SPACE:
458 return "new_space";
459 case OLD_SPACE:
460 return "old_space";
461 case MAP_SPACE:
462 return "map_space";
463 case CODE_SPACE:
464 return "code_space";
465 case LO_SPACE:
466 return "large_object_space";
467 default:
468 UNREACHABLE();
469 }
470 return nullptr;
471 }
472
473
455 void Heap::ClearAllICsByKind(Code::Kind kind) { 474 void Heap::ClearAllICsByKind(Code::Kind kind) {
456 HeapObjectIterator it(code_space()); 475 HeapObjectIterator it(code_space());
457 476
458 for (Object* object = it.Next(); object != NULL; object = it.Next()) { 477 for (Object* object = it.Next(); object != NULL; object = it.Next()) {
459 Code* code = Code::cast(object); 478 Code* code = Code::cast(object);
460 Code::Kind current_kind = code->kind(); 479 Code::Kind current_kind = code->kind();
461 if (current_kind == Code::FUNCTION || 480 if (current_kind == Code::FUNCTION ||
462 current_kind == Code::OPTIMIZED_FUNCTION) { 481 current_kind == Code::OPTIMIZED_FUNCTION) {
463 code->ClearInlineCaches(kind); 482 code->ClearInlineCaches(kind);
464 } 483 }
(...skipping 5844 matching lines...) Expand 10 before | Expand all | Expand 10 after
6309 static_cast<int>(object_sizes_last_time_[index])); 6328 static_cast<int>(object_sizes_last_time_[index]));
6310 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6329 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6311 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6330 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6312 6331
6313 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6332 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6314 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6333 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6315 ClearObjectStats(); 6334 ClearObjectStats();
6316 } 6335 }
6317 } 6336 }
6318 } // namespace v8::internal 6337 } // namespace v8::internal
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