OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 int Heap::amount_of_external_allocated_memory_ = 0; | 67 int Heap::amount_of_external_allocated_memory_ = 0; |
68 int Heap::amount_of_external_allocated_memory_at_last_global_gc_ = 0; | 68 int Heap::amount_of_external_allocated_memory_at_last_global_gc_ = 0; |
69 | 69 |
70 // semispace_size_ should be a power of 2 and old_generation_size_ should be | 70 // semispace_size_ should be a power of 2 and old_generation_size_ should be |
71 // a multiple of Page::kPageSize. | 71 // a multiple of Page::kPageSize. |
72 #if defined(ANDROID) | 72 #if defined(ANDROID) |
73 int Heap::semispace_size_ = 512*KB; | 73 int Heap::semispace_size_ = 512*KB; |
74 int Heap::old_generation_size_ = 128*MB; | 74 int Heap::old_generation_size_ = 128*MB; |
75 int Heap::initial_semispace_size_ = 128*KB; | 75 int Heap::initial_semispace_size_ = 128*KB; |
76 #else | 76 #else |
77 int Heap::semispace_size_ = 8*MB; | 77 int Heap::semispace_size_ = 4*MB; |
78 int Heap::old_generation_size_ = 512*MB; | 78 int Heap::old_generation_size_ = 512*MB; |
79 int Heap::initial_semispace_size_ = 512*KB; | 79 int Heap::initial_semispace_size_ = 512*KB; |
80 #endif | 80 #endif |
81 | 81 |
82 GCCallback Heap::global_gc_prologue_callback_ = NULL; | 82 GCCallback Heap::global_gc_prologue_callback_ = NULL; |
83 GCCallback Heap::global_gc_epilogue_callback_ = NULL; | 83 GCCallback Heap::global_gc_epilogue_callback_ = NULL; |
84 | 84 |
85 // Variables set based on semispace_size_ and old_generation_size_ in | 85 // Variables set based on semispace_size_ and old_generation_size_ in |
86 // ConfigureHeap. | 86 // ConfigureHeap. |
87 int Heap::young_generation_size_ = 0; // Will be 2 * semispace_size_. | 87 int Heap::young_generation_size_ = 0; // Will be 2 * semispace_size_. |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 LOG(ResourceEvent("scavenge", "begin")); | 634 LOG(ResourceEvent("scavenge", "begin")); |
635 | 635 |
636 // Clear descriptor cache. | 636 // Clear descriptor cache. |
637 DescriptorLookupCache::Clear(); | 637 DescriptorLookupCache::Clear(); |
638 | 638 |
639 // Used for updating survived_since_last_expansion_ at function end. | 639 // Used for updating survived_since_last_expansion_ at function end. |
640 int survived_watermark = PromotedSpaceSize(); | 640 int survived_watermark = PromotedSpaceSize(); |
641 | 641 |
642 if (new_space_.Capacity() < new_space_.MaximumCapacity() && | 642 if (new_space_.Capacity() < new_space_.MaximumCapacity() && |
643 survived_since_last_expansion_ > new_space_.Capacity()) { | 643 survived_since_last_expansion_ > new_space_.Capacity()) { |
644 // Double the size of new space if there is room to grow and enough | 644 // Grow the size of new space if there is room to grow and enough |
645 // data has survived scavenge since the last expansion. | 645 // data has survived scavenge since the last expansion. |
646 // TODO(1240712): NewSpace::Double has a return value which is | 646 // TODO(1240712): NewSpace::Grow has a return value which is |
647 // ignored here. | 647 // ignored here. |
648 new_space_.Double(); | 648 new_space_.Grow(); |
649 survived_since_last_expansion_ = 0; | 649 survived_since_last_expansion_ = 0; |
650 } | 650 } |
651 | 651 |
652 // Flip the semispaces. After flipping, to space is empty, from space has | 652 // Flip the semispaces. After flipping, to space is empty, from space has |
653 // live objects. | 653 // live objects. |
654 new_space_.Flip(); | 654 new_space_.Flip(); |
655 new_space_.ResetAllocationInfo(); | 655 new_space_.ResetAllocationInfo(); |
656 | 656 |
657 // We need to sweep newly copied objects which can be either in the | 657 // We need to sweep newly copied objects which can be either in the |
658 // to space or promoted to the old generation. For to-space | 658 // to space or promoted to the old generation. For to-space |
(...skipping 3206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3865 #ifdef DEBUG | 3865 #ifdef DEBUG |
3866 bool Heap::GarbageCollectionGreedyCheck() { | 3866 bool Heap::GarbageCollectionGreedyCheck() { |
3867 ASSERT(FLAG_gc_greedy); | 3867 ASSERT(FLAG_gc_greedy); |
3868 if (Bootstrapper::IsActive()) return true; | 3868 if (Bootstrapper::IsActive()) return true; |
3869 if (disallow_allocation_failure()) return true; | 3869 if (disallow_allocation_failure()) return true; |
3870 return CollectGarbage(0, NEW_SPACE); | 3870 return CollectGarbage(0, NEW_SPACE); |
3871 } | 3871 } |
3872 #endif | 3872 #endif |
3873 | 3873 |
3874 } } // namespace v8::internal | 3874 } } // namespace v8::internal |
OLD | NEW |