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"; | |
Hannes Payer (out of office)
2015/04/17 09:07:25
The constants are only used in GetSpaceName(int id
rmcilroy
2015/04/17 09:25:53
+1
| |
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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
445 intptr_t Heap::SizeOfObjects() { | 453 intptr_t Heap::SizeOfObjects() { |
446 intptr_t total = 0; | 454 intptr_t total = 0; |
447 AllSpaces spaces(this); | 455 AllSpaces spaces(this); |
448 for (Space* space = spaces.next(); space != NULL; space = spaces.next()) { | 456 for (Space* space = spaces.next(); space != NULL; space = spaces.next()) { |
449 total += space->SizeOfObjects(); | 457 total += space->SizeOfObjects(); |
450 } | 458 } |
451 return total; | 459 return total; |
452 } | 460 } |
453 | 461 |
454 | 462 |
463 const char* Heap::GetSpaceName(int idx) { | |
464 switch (idx) { | |
465 case NEW_SPACE: | |
466 return kNewSpaceName; | |
467 case OLD_SPACE: | |
468 return kOldSpaceName; | |
469 case MAP_SPACE: | |
470 return kMapSpaceName; | |
471 case CODE_SPACE: | |
472 return kCodeSpaceName; | |
473 case LO_SPACE: | |
474 return kLoSpaceName; | |
475 default: | |
476 UNREACHABLE(); | |
477 } | |
478 return nullptr; | |
479 } | |
480 | |
481 | |
455 void Heap::ClearAllICsByKind(Code::Kind kind) { | 482 void Heap::ClearAllICsByKind(Code::Kind kind) { |
456 HeapObjectIterator it(code_space()); | 483 HeapObjectIterator it(code_space()); |
457 | 484 |
458 for (Object* object = it.Next(); object != NULL; object = it.Next()) { | 485 for (Object* object = it.Next(); object != NULL; object = it.Next()) { |
459 Code* code = Code::cast(object); | 486 Code* code = Code::cast(object); |
460 Code::Kind current_kind = code->kind(); | 487 Code::Kind current_kind = code->kind(); |
461 if (current_kind == Code::FUNCTION || | 488 if (current_kind == Code::FUNCTION || |
462 current_kind == Code::OPTIMIZED_FUNCTION) { | 489 current_kind == Code::OPTIMIZED_FUNCTION) { |
463 code->ClearInlineCaches(kind); | 490 code->ClearInlineCaches(kind); |
464 } | 491 } |
(...skipping 5924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6389 static_cast<int>(object_sizes_last_time_[index])); | 6416 static_cast<int>(object_sizes_last_time_[index])); |
6390 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6417 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6391 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6418 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6392 | 6419 |
6393 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6420 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6394 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6421 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6395 ClearObjectStats(); | 6422 ClearObjectStats(); |
6396 } | 6423 } |
6397 } | 6424 } |
6398 } // namespace v8::internal | 6425 } // namespace v8::internal |
OLD | NEW |