Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1121 | 1121 |
| 1122 // Check new space expansion criteria and expand semispaces if it was hit. | 1122 // Check new space expansion criteria and expand semispaces if it was hit. |
| 1123 static void CheckNewSpaceExpansionCriteria(); | 1123 static void CheckNewSpaceExpansionCriteria(); |
| 1124 | 1124 |
| 1125 static inline void IncrementYoungSurvivorsCounter(int survived) { | 1125 static inline void IncrementYoungSurvivorsCounter(int survived) { |
| 1126 young_survivors_after_last_gc_ = survived; | 1126 young_survivors_after_last_gc_ = survived; |
| 1127 survived_since_last_expansion_ += survived; | 1127 survived_since_last_expansion_ += survived; |
| 1128 } | 1128 } |
| 1129 | 1129 |
| 1130 static inline bool NextGCIsLikelyToBeFull() { | 1130 static inline bool NextGCIsLikelyToBeFull() { |
| 1131 if (FLAG_gc_global) return true; | |
| 1132 | |
| 1131 intptr_t total_promoted = | 1133 intptr_t total_promoted = |
| 1132 PromotedSpaceSize() + PromotedExternalMemorySize(); | 1134 PromotedSpaceSize() + PromotedExternalMemorySize(); |
| 1133 | 1135 |
| 1134 intptr_t adjusted_promotion_limit = | 1136 intptr_t adjusted_promotion_limit = |
| 1135 old_gen_promotion_limit_ - new_space_.Capacity(); | 1137 old_gen_promotion_limit_ - new_space_.Capacity(); |
| 1136 | 1138 |
| 1137 if (total_promoted >= adjusted_promotion_limit) return true; | 1139 if (total_promoted >= adjusted_promotion_limit) return true; |
| 1138 | 1140 |
| 1139 intptr_t adjusted_allocation_limit = | 1141 intptr_t adjusted_allocation_limit = |
| 1140 old_gen_allocation_limit_ - new_space_.Capacity() / 5; | 1142 old_gen_allocation_limit_ - new_space_.Capacity() / 5; |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1764 bool is_empty() { return top_ <= low_; } | 1766 bool is_empty() { return top_ <= low_; } |
| 1765 | 1767 |
| 1766 bool overflowed() { return overflowed_; } | 1768 bool overflowed() { return overflowed_; } |
| 1767 | 1769 |
| 1768 void clear_overflowed() { overflowed_ = false; } | 1770 void clear_overflowed() { overflowed_ = false; } |
| 1769 | 1771 |
| 1770 // Push the (marked) object on the marking stack if there is room, | 1772 // Push the (marked) object on the marking stack if there is room, |
| 1771 // otherwise mark the object as overflowed and wait for a rescan of the | 1773 // otherwise mark the object as overflowed and wait for a rescan of the |
| 1772 // heap. | 1774 // heap. |
| 1773 void Push(HeapObject* object) { | 1775 void Push(HeapObject* object) { |
| 1774 CHECK(object->IsHeapObject()); | 1776 ASSERT(object->IsHeapObject()); |
| 1775 if (is_full()) { | 1777 if (is_full()) { |
| 1776 object->SetOverflow(); | 1778 object->SetOverflow(); |
| 1777 overflowed_ = true; | 1779 overflowed_ = true; |
| 1778 } else { | 1780 } else { |
| 1779 *(top_++) = object; | 1781 *(top_++) = object; |
| 1780 } | 1782 } |
| 1781 } | 1783 } |
| 1782 | 1784 |
| 1783 HeapObject* Pop() { | 1785 HeapObject* Pop() { |
| 1784 ASSERT(!is_empty()); | 1786 ASSERT(!is_empty()); |
| 1785 HeapObject* object = *(--top_); | 1787 HeapObject* object = *(--top_); |
| 1786 CHECK(object->IsHeapObject()); | 1788 ASSERT(object->IsHeapObject()); |
|
Vyacheslav Egorov (Chromium)
2011/03/21 16:54:23
Do we really want this?
Sometimes it's better to
Erik Corry
2011/03/21 20:48:53
This is inlined in some of our hottest GC function
| |
| 1787 return object; | 1789 return object; |
| 1788 } | 1790 } |
| 1789 | 1791 |
| 1790 private: | 1792 private: |
| 1791 HeapObject** low_; | 1793 HeapObject** low_; |
| 1792 HeapObject** top_; | 1794 HeapObject** top_; |
| 1793 HeapObject** high_; | 1795 HeapObject** high_; |
| 1794 bool overflowed_; | 1796 bool overflowed_; |
| 1795 }; | 1797 }; |
| 1796 | 1798 |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2235 | 2237 |
| 2236 AssertNoAllocation no_alloc; // i.e. no gc allowed. | 2238 AssertNoAllocation no_alloc; // i.e. no gc allowed. |
| 2237 | 2239 |
| 2238 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2240 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2239 }; | 2241 }; |
| 2240 #endif // DEBUG || LIVE_OBJECT_LIST | 2242 #endif // DEBUG || LIVE_OBJECT_LIST |
| 2241 | 2243 |
| 2242 } } // namespace v8::internal | 2244 } } // namespace v8::internal |
| 2243 | 2245 |
| 2244 #endif // V8_HEAP_H_ | 2246 #endif // V8_HEAP_H_ |
| OLD | NEW |