| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_HEAP_HEAP_H_ | 5 #ifndef V8_HEAP_HEAP_H_ |
| 6 #define V8_HEAP_HEAP_H_ | 6 #define V8_HEAP_HEAP_H_ |
| 7 | 7 |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
| (...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 void set_array_buffers_list(Object* object) { array_buffers_list_ = object; } | 874 void set_array_buffers_list(Object* object) { array_buffers_list_ = object; } |
| 875 Object* array_buffers_list() const { return array_buffers_list_; } | 875 Object* array_buffers_list() const { return array_buffers_list_; } |
| 876 | 876 |
| 877 void set_last_array_buffer_in_list(Object* object) { | 877 void set_last_array_buffer_in_list(Object* object) { |
| 878 last_array_buffer_in_list_ = object; | 878 last_array_buffer_in_list_ = object; |
| 879 } | 879 } |
| 880 Object* last_array_buffer_in_list() const { | 880 Object* last_array_buffer_in_list() const { |
| 881 return last_array_buffer_in_list_; | 881 return last_array_buffer_in_list_; |
| 882 } | 882 } |
| 883 | 883 |
| 884 void set_new_array_buffer_views_list(Object* object) { |
| 885 new_array_buffer_views_list_ = object; |
| 886 } |
| 887 Object* new_array_buffer_views_list() const { |
| 888 return new_array_buffer_views_list_; |
| 889 } |
| 890 |
| 884 void set_allocation_sites_list(Object* object) { | 891 void set_allocation_sites_list(Object* object) { |
| 885 allocation_sites_list_ = object; | 892 allocation_sites_list_ = object; |
| 886 } | 893 } |
| 887 Object* allocation_sites_list() { return allocation_sites_list_; } | 894 Object* allocation_sites_list() { return allocation_sites_list_; } |
| 888 | 895 |
| 889 // Used in CreateAllocationSiteStub and the (de)serializer. | 896 // Used in CreateAllocationSiteStub and the (de)serializer. |
| 890 Object** allocation_sites_list_address() { return &allocation_sites_list_; } | 897 Object** allocation_sites_list_address() { return &allocation_sites_list_; } |
| 891 | 898 |
| 892 void set_encountered_weak_collections(Object* weak_collection) { | 899 void set_encountered_weak_collections(Object* weak_collection) { |
| 893 encountered_weak_collections_ = weak_collection; | 900 encountered_weak_collections_ = weak_collection; |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1480 // trigger the event. In order to track ALL allocations one must turn off | 1487 // trigger the event. In order to track ALL allocations one must turn off |
| 1481 // FLAG_inline_new and FLAG_use_allocation_folding. | 1488 // FLAG_inline_new and FLAG_use_allocation_folding. |
| 1482 inline void OnAllocationEvent(HeapObject* object, int size_in_bytes); | 1489 inline void OnAllocationEvent(HeapObject* object, int size_in_bytes); |
| 1483 | 1490 |
| 1484 // This event is triggered after object is moved to a new place. | 1491 // This event is triggered after object is moved to a new place. |
| 1485 inline void OnMoveEvent(HeapObject* target, HeapObject* source, | 1492 inline void OnMoveEvent(HeapObject* target, HeapObject* source, |
| 1486 int size_in_bytes); | 1493 int size_in_bytes); |
| 1487 | 1494 |
| 1488 bool deserialization_complete() const { return deserialization_complete_; } | 1495 bool deserialization_complete() const { return deserialization_complete_; } |
| 1489 | 1496 |
| 1497 bool migration_failure() const { return migration_failure_; } |
| 1498 void set_migration_failure(bool migration_failure) { |
| 1499 migration_failure_ = migration_failure; |
| 1500 } |
| 1501 |
| 1502 bool previous_migration_failure() const { |
| 1503 return previous_migration_failure_; |
| 1504 } |
| 1505 void set_previous_migration_failure(bool previous_migration_failure) { |
| 1506 previous_migration_failure_ = previous_migration_failure; |
| 1507 } |
| 1508 |
| 1490 protected: | 1509 protected: |
| 1491 // Methods made available to tests. | 1510 // Methods made available to tests. |
| 1492 | 1511 |
| 1493 // Allocates a JS Map in the heap. | 1512 // Allocates a JS Map in the heap. |
| 1494 MUST_USE_RESULT AllocationResult | 1513 MUST_USE_RESULT AllocationResult |
| 1495 AllocateMap(InstanceType instance_type, int instance_size, | 1514 AllocateMap(InstanceType instance_type, int instance_size, |
| 1496 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND); | 1515 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND); |
| 1497 | 1516 |
| 1498 // Allocates and initializes a new JavaScript object based on a | 1517 // Allocates and initializes a new JavaScript object based on a |
| 1499 // constructor. | 1518 // constructor. |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1654 // for all spaces. This is used to disable allocations in generated code. | 1673 // for all spaces. This is used to disable allocations in generated code. |
| 1655 bool inline_allocation_disabled_; | 1674 bool inline_allocation_disabled_; |
| 1656 | 1675 |
| 1657 // Weak list heads, threaded through the objects. | 1676 // Weak list heads, threaded through the objects. |
| 1658 // List heads are initialized lazily and contain the undefined_value at start. | 1677 // List heads are initialized lazily and contain the undefined_value at start. |
| 1659 Object* native_contexts_list_; | 1678 Object* native_contexts_list_; |
| 1660 Object* array_buffers_list_; | 1679 Object* array_buffers_list_; |
| 1661 Object* last_array_buffer_in_list_; | 1680 Object* last_array_buffer_in_list_; |
| 1662 Object* allocation_sites_list_; | 1681 Object* allocation_sites_list_; |
| 1663 | 1682 |
| 1683 // This is a global list of array buffer views in new space. When the views |
| 1684 // get promoted, they are removed form the list and added to the corresponding |
| 1685 // array buffer. |
| 1686 Object* new_array_buffer_views_list_; |
| 1687 |
| 1664 // List of encountered weak collections (JSWeakMap and JSWeakSet) during | 1688 // List of encountered weak collections (JSWeakMap and JSWeakSet) during |
| 1665 // marking. It is initialized during marking, destroyed after marking and | 1689 // marking. It is initialized during marking, destroyed after marking and |
| 1666 // contains Smi(0) while marking is not active. | 1690 // contains Smi(0) while marking is not active. |
| 1667 Object* encountered_weak_collections_; | 1691 Object* encountered_weak_collections_; |
| 1668 | 1692 |
| 1669 Object* encountered_weak_cells_; | 1693 Object* encountered_weak_cells_; |
| 1670 | 1694 |
| 1671 StoreBufferRebuilder store_buffer_rebuilder_; | 1695 StoreBufferRebuilder store_buffer_rebuilder_; |
| 1672 | 1696 |
| 1673 struct StringTypeTable { | 1697 struct StringTypeTable { |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1984 | 2008 |
| 1985 // Performs a major collection in the whole heap. | 2009 // Performs a major collection in the whole heap. |
| 1986 void MarkCompact(); | 2010 void MarkCompact(); |
| 1987 | 2011 |
| 1988 // Code to be run before and after mark-compact. | 2012 // Code to be run before and after mark-compact. |
| 1989 void MarkCompactPrologue(); | 2013 void MarkCompactPrologue(); |
| 1990 void MarkCompactEpilogue(); | 2014 void MarkCompactEpilogue(); |
| 1991 | 2015 |
| 1992 void ProcessNativeContexts(WeakObjectRetainer* retainer); | 2016 void ProcessNativeContexts(WeakObjectRetainer* retainer); |
| 1993 void ProcessArrayBuffers(WeakObjectRetainer* retainer, bool stop_after_young); | 2017 void ProcessArrayBuffers(WeakObjectRetainer* retainer, bool stop_after_young); |
| 2018 void ProcessNewArrayBufferViews(WeakObjectRetainer* retainer); |
| 1994 void ProcessAllocationSites(WeakObjectRetainer* retainer); | 2019 void ProcessAllocationSites(WeakObjectRetainer* retainer); |
| 1995 | 2020 |
| 1996 // Deopts all code that contains allocation instruction which are tenured or | 2021 // Deopts all code that contains allocation instruction which are tenured or |
| 1997 // not tenured. Moreover it clears the pretenuring allocation site statistics. | 2022 // not tenured. Moreover it clears the pretenuring allocation site statistics. |
| 1998 void ResetAllAllocationSitesDependentCode(PretenureFlag flag); | 2023 void ResetAllAllocationSitesDependentCode(PretenureFlag flag); |
| 1999 | 2024 |
| 2000 // Evaluates local pretenuring for the old space and calls | 2025 // Evaluates local pretenuring for the old space and calls |
| 2001 // ResetAllTenuredAllocationSitesDependentCode if too many objects died in | 2026 // ResetAllTenuredAllocationSitesDependentCode if too many objects died in |
| 2002 // the old space. | 2027 // the old space. |
| 2003 void EvaluateOldSpaceLocalPretenuring(uint64_t size_of_objects_before_gc); | 2028 void EvaluateOldSpaceLocalPretenuring(uint64_t size_of_objects_before_gc); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2143 MemoryChunk* chunks_queued_for_free_; | 2168 MemoryChunk* chunks_queued_for_free_; |
| 2144 | 2169 |
| 2145 base::Mutex relocation_mutex_; | 2170 base::Mutex relocation_mutex_; |
| 2146 | 2171 |
| 2147 int gc_callbacks_depth_; | 2172 int gc_callbacks_depth_; |
| 2148 | 2173 |
| 2149 bool deserialization_complete_; | 2174 bool deserialization_complete_; |
| 2150 | 2175 |
| 2151 bool concurrent_sweeping_enabled_; | 2176 bool concurrent_sweeping_enabled_; |
| 2152 | 2177 |
| 2178 // A migration failure indicates that a semi-space copy of an object during |
| 2179 // a scavenge failed and the object got promoted instead. |
| 2180 bool migration_failure_; |
| 2181 |
| 2182 // A migration failure happened in the previous scavenge. |
| 2183 bool previous_migration_failure_; |
| 2184 |
| 2153 friend class AlwaysAllocateScope; | 2185 friend class AlwaysAllocateScope; |
| 2154 friend class Deserializer; | 2186 friend class Deserializer; |
| 2155 friend class Factory; | 2187 friend class Factory; |
| 2156 friend class GCCallbacksScope; | 2188 friend class GCCallbacksScope; |
| 2157 friend class GCTracer; | 2189 friend class GCTracer; |
| 2158 friend class HeapIterator; | 2190 friend class HeapIterator; |
| 2159 friend class Isolate; | 2191 friend class Isolate; |
| 2160 friend class MarkCompactCollector; | 2192 friend class MarkCompactCollector; |
| 2161 friend class MarkCompactMarkingVisitor; | 2193 friend class MarkCompactMarkingVisitor; |
| 2162 friend class MapCompact; | 2194 friend class MapCompact; |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2604 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2636 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
| 2605 | 2637 |
| 2606 private: | 2638 private: |
| 2607 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2639 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2608 }; | 2640 }; |
| 2609 #endif // DEBUG | 2641 #endif // DEBUG |
| 2610 } | 2642 } |
| 2611 } // namespace v8::internal | 2643 } // namespace v8::internal |
| 2612 | 2644 |
| 2613 #endif // V8_HEAP_HEAP_H_ | 2645 #endif // V8_HEAP_HEAP_H_ |
| OLD | NEW |