| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1560 static const intptr_t kMinimumPromotionLimit = 5 * Page::kPageSize; | 1560 static const intptr_t kMinimumPromotionLimit = 5 * Page::kPageSize; |
| 1561 static const intptr_t kMinimumAllocationLimit = | 1561 static const intptr_t kMinimumAllocationLimit = |
| 1562 8 * (Page::kPageSize > MB ? Page::kPageSize : MB); | 1562 8 * (Page::kPageSize > MB ? Page::kPageSize : MB); |
| 1563 | 1563 |
| 1564 intptr_t OldGenPromotionLimit(intptr_t old_gen_size) { | 1564 intptr_t OldGenPromotionLimit(intptr_t old_gen_size) { |
| 1565 const int divisor = FLAG_stress_compaction ? 10 : | 1565 const int divisor = FLAG_stress_compaction ? 10 : |
| 1566 new_space_high_promotion_mode_active_ ? 1 : 3; | 1566 new_space_high_promotion_mode_active_ ? 1 : 3; |
| 1567 intptr_t limit = | 1567 intptr_t limit = |
| 1568 Max(old_gen_size + old_gen_size / divisor, kMinimumPromotionLimit); | 1568 Max(old_gen_size + old_gen_size / divisor, kMinimumPromotionLimit); |
| 1569 limit += new_space_.Capacity(); | 1569 limit += new_space_.Capacity(); |
| 1570 limit *= old_gen_limit_factor_; | |
| 1571 intptr_t halfway_to_the_max = (old_gen_size + max_old_generation_size_) / 2; | 1570 intptr_t halfway_to_the_max = (old_gen_size + max_old_generation_size_) / 2; |
| 1572 return Min(limit, halfway_to_the_max); | 1571 return Min(limit, halfway_to_the_max); |
| 1573 } | 1572 } |
| 1574 | 1573 |
| 1575 intptr_t OldGenAllocationLimit(intptr_t old_gen_size) { | 1574 intptr_t OldGenAllocationLimit(intptr_t old_gen_size) { |
| 1576 const int divisor = FLAG_stress_compaction ? 8 : | 1575 const int divisor = FLAG_stress_compaction ? 8 : |
| 1577 new_space_high_promotion_mode_active_ ? 1 : 2; | 1576 new_space_high_promotion_mode_active_ ? 1 : 2; |
| 1578 intptr_t limit = | 1577 intptr_t limit = |
| 1579 Max(old_gen_size + old_gen_size / divisor, kMinimumAllocationLimit); | 1578 Max(old_gen_size + old_gen_size / divisor, kMinimumAllocationLimit); |
| 1580 limit += new_space_.Capacity(); | 1579 limit += new_space_.Capacity(); |
| 1581 limit *= old_gen_limit_factor_; | |
| 1582 intptr_t halfway_to_the_max = (old_gen_size + max_old_generation_size_) / 2; | 1580 intptr_t halfway_to_the_max = (old_gen_size + max_old_generation_size_) / 2; |
| 1583 return Min(limit, halfway_to_the_max); | 1581 return Min(limit, halfway_to_the_max); |
| 1584 } | 1582 } |
| 1585 | 1583 |
| 1586 // Implements the corresponding V8 API function. | 1584 // Implements the corresponding V8 API function. |
| 1587 bool IdleNotification(int hint); | 1585 bool IdleNotification(int hint); |
| 1588 | 1586 |
| 1589 // Declare all the root indices. | 1587 // Declare all the root indices. |
| 1590 enum RootListIndex { | 1588 enum RootListIndex { |
| 1591 #define ROOT_INDEX_DECLARATION(type, name, camel_name) k##camel_name##RootIndex, | 1589 #define ROOT_INDEX_DECLARATION(type, name, camel_name) k##camel_name##RootIndex, |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1991 // Limit that triggers a global GC on the next (normally caused) GC. This | 1989 // Limit that triggers a global GC on the next (normally caused) GC. This |
| 1992 // is checked when we have already decided to do a GC to help determine | 1990 // is checked when we have already decided to do a GC to help determine |
| 1993 // which collector to invoke. | 1991 // which collector to invoke. |
| 1994 intptr_t old_gen_promotion_limit_; | 1992 intptr_t old_gen_promotion_limit_; |
| 1995 | 1993 |
| 1996 // Limit that triggers a global GC as soon as is reasonable. This is | 1994 // Limit that triggers a global GC as soon as is reasonable. This is |
| 1997 // checked before expanding a paged space in the old generation and on | 1995 // checked before expanding a paged space in the old generation and on |
| 1998 // every allocation in large object space. | 1996 // every allocation in large object space. |
| 1999 intptr_t old_gen_allocation_limit_; | 1997 intptr_t old_gen_allocation_limit_; |
| 2000 | 1998 |
| 2001 // Sometimes the heuristics dictate that those limits are increased. This | |
| 2002 // variable records that fact. | |
| 2003 int old_gen_limit_factor_; | |
| 2004 | |
| 2005 // Used to adjust the limits that control the timing of the next GC. | 1999 // Used to adjust the limits that control the timing of the next GC. |
| 2006 intptr_t size_of_old_gen_at_last_old_space_gc_; | 2000 intptr_t size_of_old_gen_at_last_old_space_gc_; |
| 2007 | 2001 |
| 2008 // Limit on the amount of externally allocated memory allowed | 2002 // Limit on the amount of externally allocated memory allowed |
| 2009 // between global GCs. If reached a global GC is forced. | 2003 // between global GCs. If reached a global GC is forced. |
| 2010 intptr_t external_allocation_limit_; | 2004 intptr_t external_allocation_limit_; |
| 2011 | 2005 |
| 2012 // The amount of external memory registered through the API kept alive | 2006 // The amount of external memory registered through the API kept alive |
| 2013 // by global handles | 2007 // by global handles |
| 2014 intptr_t amount_of_external_allocated_memory_; | 2008 intptr_t amount_of_external_allocated_memory_; |
| (...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3078 AssertNoAllocation no_alloc; // i.e. no gc allowed. | 3072 AssertNoAllocation no_alloc; // i.e. no gc allowed. |
| 3079 | 3073 |
| 3080 private: | 3074 private: |
| 3081 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 3075 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 3082 }; | 3076 }; |
| 3083 #endif // DEBUG | 3077 #endif // DEBUG |
| 3084 | 3078 |
| 3085 } } // namespace v8::internal | 3079 } } // namespace v8::internal |
| 3086 | 3080 |
| 3087 #endif // V8_HEAP_H_ | 3081 #endif // V8_HEAP_H_ |
| OLD | NEW |