| 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 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 LOG(ResourceEvent("scavenge", "begin")); | 654 LOG(ResourceEvent("scavenge", "begin")); |
| 655 | 655 |
| 656 // Clear descriptor cache. | 656 // Clear descriptor cache. |
| 657 DescriptorLookupCache::Clear(); | 657 DescriptorLookupCache::Clear(); |
| 658 | 658 |
| 659 // Used for updating survived_since_last_expansion_ at function end. | 659 // Used for updating survived_since_last_expansion_ at function end. |
| 660 int survived_watermark = PromotedSpaceSize(); | 660 int survived_watermark = PromotedSpaceSize(); |
| 661 | 661 |
| 662 if (new_space_.Capacity() < new_space_.MaximumCapacity() && | 662 if (new_space_.Capacity() < new_space_.MaximumCapacity() && |
| 663 survived_since_last_expansion_ > new_space_.Capacity()) { | 663 survived_since_last_expansion_ > new_space_.Capacity()) { |
| 664 // Double the size of new space if there is room to grow and enough | 664 // Grow the size of new space if there is room to grow and enough |
| 665 // data has survived scavenge since the last expansion. | 665 // data has survived scavenge since the last expansion. |
| 666 // TODO(1240712): NewSpace::Double has a return value which is | 666 // TODO(1240712): NewSpace::Grow has a return value which is |
| 667 // ignored here. | 667 // ignored here. |
| 668 new_space_.Double(); | 668 new_space_.Grow(); |
| 669 survived_since_last_expansion_ = 0; | 669 survived_since_last_expansion_ = 0; |
| 670 } | 670 } |
| 671 | 671 |
| 672 // Flip the semispaces. After flipping, to space is empty, from space has | 672 // Flip the semispaces. After flipping, to space is empty, from space has |
| 673 // live objects. | 673 // live objects. |
| 674 new_space_.Flip(); | 674 new_space_.Flip(); |
| 675 new_space_.ResetAllocationInfo(); | 675 new_space_.ResetAllocationInfo(); |
| 676 | 676 |
| 677 // We need to sweep newly copied objects which can be either in the | 677 // We need to sweep newly copied objects which can be either in the |
| 678 // to space or promoted to the old generation. For to-space | 678 // to space or promoted to the old generation. For to-space |
| (...skipping 3233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3912 #ifdef DEBUG | 3912 #ifdef DEBUG |
| 3913 bool Heap::GarbageCollectionGreedyCheck() { | 3913 bool Heap::GarbageCollectionGreedyCheck() { |
| 3914 ASSERT(FLAG_gc_greedy); | 3914 ASSERT(FLAG_gc_greedy); |
| 3915 if (Bootstrapper::IsActive()) return true; | 3915 if (Bootstrapper::IsActive()) return true; |
| 3916 if (disallow_allocation_failure()) return true; | 3916 if (disallow_allocation_failure()) return true; |
| 3917 return CollectGarbage(0, NEW_SPACE); | 3917 return CollectGarbage(0, NEW_SPACE); |
| 3918 } | 3918 } |
| 3919 #endif | 3919 #endif |
| 3920 | 3920 |
| 3921 } } // namespace v8::internal | 3921 } } // namespace v8::internal |
| OLD | NEW |