OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |