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 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1589 // Global inline caching age: it is incremented on some GCs after context | 1589 // Global inline caching age: it is incremented on some GCs after context |
1590 // disposal. We use it to flush inline caches. | 1590 // disposal. We use it to flush inline caches. |
1591 int global_ic_age() { | 1591 int global_ic_age() { |
1592 return global_ic_age_; | 1592 return global_ic_age_; |
1593 } | 1593 } |
1594 | 1594 |
1595 void AgeInlineCaches() { | 1595 void AgeInlineCaches() { |
1596 global_ic_age_ = (global_ic_age_ + 1) & SharedFunctionInfo::ICAgeBits::kMax; | 1596 global_ic_age_ = (global_ic_age_ + 1) & SharedFunctionInfo::ICAgeBits::kMax; |
1597 } | 1597 } |
1598 | 1598 |
1599 void RecordObjectStats(InstanceType type, size_t size) { | 1599 // ObjectStats are kept in two arrays, counts and sizes. Related stats are |
| 1600 // stored in a contiguous linear buffer. Stats groups are stored one after |
| 1601 // another. |
| 1602 enum { |
| 1603 FIRST_CODE_KIND_SUB_TYPE = LAST_TYPE + 1, |
| 1604 OBJECT_STATS_COUNT = FIRST_CODE_KIND_SUB_TYPE + Code::LAST_CODE_KIND + 1 |
| 1605 }; |
| 1606 |
| 1607 void RecordObjectStats(InstanceType type, int sub_type, size_t size) { |
1600 ASSERT(type <= LAST_TYPE); | 1608 ASSERT(type <= LAST_TYPE); |
1601 object_counts_[type]++; | 1609 if (sub_type < 0) { |
1602 object_sizes_[type] += size; | 1610 object_counts_[type]++; |
| 1611 object_sizes_[type] += size; |
| 1612 } else { |
| 1613 if (type == CODE_TYPE) { |
| 1614 ASSERT(sub_type <= Code::LAST_CODE_KIND); |
| 1615 object_counts_[FIRST_CODE_KIND_SUB_TYPE + sub_type]++; |
| 1616 object_sizes_[FIRST_CODE_KIND_SUB_TYPE + sub_type] += size; |
| 1617 } |
| 1618 } |
1603 } | 1619 } |
1604 | 1620 |
1605 void CheckpointObjectStats(); | 1621 void CheckpointObjectStats(); |
1606 | 1622 |
1607 private: | 1623 private: |
1608 Heap(); | 1624 Heap(); |
1609 | 1625 |
1610 // This can be calculated directly from a pointer to the heap; however, it is | 1626 // This can be calculated directly from a pointer to the heap; however, it is |
1611 // more expedient to get at the isolate directly from within Heap methods. | 1627 // more expedient to get at the isolate directly from within Heap methods. |
1612 Isolate* isolate_; | 1628 Isolate* isolate_; |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1997 | 2013 |
1998 void AdvanceIdleIncrementalMarking(intptr_t step_size); | 2014 void AdvanceIdleIncrementalMarking(intptr_t step_size); |
1999 | 2015 |
2000 void ClearObjectStats(bool clear_last_time_stats = false); | 2016 void ClearObjectStats(bool clear_last_time_stats = false); |
2001 | 2017 |
2002 static const int kInitialSymbolTableSize = 2048; | 2018 static const int kInitialSymbolTableSize = 2048; |
2003 static const int kInitialEvalCacheSize = 64; | 2019 static const int kInitialEvalCacheSize = 64; |
2004 static const int kInitialNumberStringCacheSize = 256; | 2020 static const int kInitialNumberStringCacheSize = 256; |
2005 | 2021 |
2006 // Object counts and used memory by InstanceType | 2022 // Object counts and used memory by InstanceType |
2007 size_t object_counts_[LAST_TYPE + 1]; | 2023 size_t object_counts_[OBJECT_STATS_COUNT]; |
2008 size_t object_counts_last_time_[LAST_TYPE + 1]; | 2024 size_t object_counts_last_time_[OBJECT_STATS_COUNT]; |
2009 size_t object_sizes_[LAST_TYPE + 1]; | 2025 size_t object_sizes_[OBJECT_STATS_COUNT]; |
2010 size_t object_sizes_last_time_[LAST_TYPE + 1]; | 2026 size_t object_sizes_last_time_[OBJECT_STATS_COUNT]; |
2011 | 2027 |
2012 // Maximum GC pause. | 2028 // Maximum GC pause. |
2013 int max_gc_pause_; | 2029 int max_gc_pause_; |
2014 | 2030 |
2015 // Maximum size of objects alive after GC. | 2031 // Maximum size of objects alive after GC. |
2016 intptr_t max_alive_after_gc_; | 2032 intptr_t max_alive_after_gc_; |
2017 | 2033 |
2018 // Minimal interval between two subsequent collections. | 2034 // Minimal interval between two subsequent collections. |
2019 int min_in_mutator_; | 2035 int min_in_mutator_; |
2020 | 2036 |
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2712 AssertNoAllocation no_alloc; // i.e. no gc allowed. | 2728 AssertNoAllocation no_alloc; // i.e. no gc allowed. |
2713 | 2729 |
2714 private: | 2730 private: |
2715 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2731 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2716 }; | 2732 }; |
2717 #endif // DEBUG || LIVE_OBJECT_LIST | 2733 #endif // DEBUG || LIVE_OBJECT_LIST |
2718 | 2734 |
2719 } } // namespace v8::internal | 2735 } } // namespace v8::internal |
2720 | 2736 |
2721 #endif // V8_HEAP_H_ | 2737 #endif // V8_HEAP_H_ |
OLD | NEW |