| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 #include "src/mips/regexp-macro-assembler-mips.h" // NOLINT | 47 #include "src/mips/regexp-macro-assembler-mips.h" // NOLINT |
| 48 #endif | 48 #endif |
| 49 #if V8_TARGET_ARCH_MIPS64 && !V8_INTERPRETED_REGEXP | 49 #if V8_TARGET_ARCH_MIPS64 && !V8_INTERPRETED_REGEXP |
| 50 #include "src/regexp-macro-assembler.h" | 50 #include "src/regexp-macro-assembler.h" |
| 51 #include "src/mips64/regexp-macro-assembler-mips64.h" | 51 #include "src/mips64/regexp-macro-assembler-mips64.h" |
| 52 #endif | 52 #endif |
| 53 | 53 |
| 54 namespace v8 { | 54 namespace v8 { |
| 55 namespace internal { | 55 namespace internal { |
| 56 | 56 |
| 57 namespace { |
| 58 const char* kNewSpaceName = "new_space"; |
| 59 const char* kOldSpaceName = "old_space"; |
| 60 const char* kCodeSpaceName = "code_space"; |
| 61 const char* kMapSpaceName = "map_space"; |
| 62 const char* kLoSpaceName = "large_object_space"; |
| 63 } // namespace |
| 64 |
| 57 | 65 |
| 58 Heap::Heap() | 66 Heap::Heap() |
| 59 : amount_of_external_allocated_memory_(0), | 67 : amount_of_external_allocated_memory_(0), |
| 60 amount_of_external_allocated_memory_at_last_global_gc_(0), | 68 amount_of_external_allocated_memory_at_last_global_gc_(0), |
| 61 isolate_(NULL), | 69 isolate_(NULL), |
| 62 code_range_size_(0), | 70 code_range_size_(0), |
| 63 // semispace_size_ should be a power of 2 and old_generation_size_ should | 71 // semispace_size_ should be a power of 2 and old_generation_size_ should |
| 64 // be a multiple of Page::kPageSize. | 72 // be a multiple of Page::kPageSize. |
| 65 reserved_semispace_size_(8 * (kPointerSize / 4) * MB), | 73 reserved_semispace_size_(8 * (kPointerSize / 4) * MB), |
| 66 max_semi_space_size_(8 * (kPointerSize / 4) * MB), | 74 max_semi_space_size_(8 * (kPointerSize / 4) * MB), |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 intptr_t Heap::SizeOfObjects() { | 452 intptr_t Heap::SizeOfObjects() { |
| 445 intptr_t total = 0; | 453 intptr_t total = 0; |
| 446 AllSpaces spaces(this); | 454 AllSpaces spaces(this); |
| 447 for (Space* space = spaces.next(); space != NULL; space = spaces.next()) { | 455 for (Space* space = spaces.next(); space != NULL; space = spaces.next()) { |
| 448 total += space->SizeOfObjects(); | 456 total += space->SizeOfObjects(); |
| 449 } | 457 } |
| 450 return total; | 458 return total; |
| 451 } | 459 } |
| 452 | 460 |
| 453 | 461 |
| 462 const char* Heap::GetSpaceName(int idx) { |
| 463 switch (idx) { |
| 464 case NEW_SPACE: |
| 465 return kNewSpaceName; |
| 466 case OLD_SPACE: |
| 467 return kOldSpaceName; |
| 468 case MAP_SPACE: |
| 469 return kMapSpaceName; |
| 470 case CODE_SPACE: |
| 471 return kCodeSpaceName; |
| 472 case LO_SPACE: |
| 473 return kLoSpaceName; |
| 474 } |
| 475 return nullptr; |
| 476 } |
| 477 |
| 478 |
| 454 void Heap::ClearAllICsByKind(Code::Kind kind) { | 479 void Heap::ClearAllICsByKind(Code::Kind kind) { |
| 455 HeapObjectIterator it(code_space()); | 480 HeapObjectIterator it(code_space()); |
| 456 | 481 |
| 457 for (Object* object = it.Next(); object != NULL; object = it.Next()) { | 482 for (Object* object = it.Next(); object != NULL; object = it.Next()) { |
| 458 Code* code = Code::cast(object); | 483 Code* code = Code::cast(object); |
| 459 Code::Kind current_kind = code->kind(); | 484 Code::Kind current_kind = code->kind(); |
| 460 if (current_kind == Code::FUNCTION || | 485 if (current_kind == Code::FUNCTION || |
| 461 current_kind == Code::OPTIMIZED_FUNCTION) { | 486 current_kind == Code::OPTIMIZED_FUNCTION) { |
| 462 code->ClearInlineCaches(kind); | 487 code->ClearInlineCaches(kind); |
| 463 } | 488 } |
| (...skipping 5837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6301 static_cast<int>(object_sizes_last_time_[index])); | 6326 static_cast<int>(object_sizes_last_time_[index])); |
| 6302 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6327 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
| 6303 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6328 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
| 6304 | 6329 |
| 6305 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6330 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
| 6306 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6331 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
| 6307 ClearObjectStats(); | 6332 ClearObjectStats(); |
| 6308 } | 6333 } |
| 6309 } | 6334 } |
| 6310 } // namespace v8::internal | 6335 } // namespace v8::internal |
| OLD | NEW |