| 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 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 String* hidden_string() { return hidden_string_; } | 863 String* hidden_string() { return hidden_string_; } |
| 864 | 864 |
| 865 void set_native_contexts_list(Object* object) { | 865 void set_native_contexts_list(Object* object) { |
| 866 native_contexts_list_ = object; | 866 native_contexts_list_ = object; |
| 867 } | 867 } |
| 868 Object* native_contexts_list() const { return native_contexts_list_; } | 868 Object* native_contexts_list() const { return native_contexts_list_; } |
| 869 | 869 |
| 870 void set_array_buffers_list(Object* object) { array_buffers_list_ = object; } | 870 void set_array_buffers_list(Object* object) { array_buffers_list_ = object; } |
| 871 Object* array_buffers_list() const { return array_buffers_list_; } | 871 Object* array_buffers_list() const { return array_buffers_list_; } |
| 872 | 872 |
| 873 void set_new_array_buffer_views_list(Object* object) { |
| 874 new_array_buffer_views_list_ = object; |
| 875 } |
| 876 Object* new_array_buffer_views_list() const { |
| 877 return new_array_buffer_views_list_; |
| 878 } |
| 879 |
| 873 void set_allocation_sites_list(Object* object) { | 880 void set_allocation_sites_list(Object* object) { |
| 874 allocation_sites_list_ = object; | 881 allocation_sites_list_ = object; |
| 875 } | 882 } |
| 876 Object* allocation_sites_list() { return allocation_sites_list_; } | 883 Object* allocation_sites_list() { return allocation_sites_list_; } |
| 877 | 884 |
| 878 // Used in CreateAllocationSiteStub and the (de)serializer. | 885 // Used in CreateAllocationSiteStub and the (de)serializer. |
| 879 Object** allocation_sites_list_address() { return &allocation_sites_list_; } | 886 Object** allocation_sites_list_address() { return &allocation_sites_list_; } |
| 880 | 887 |
| 881 void set_encountered_weak_collections(Object* weak_collection) { | 888 void set_encountered_weak_collections(Object* weak_collection) { |
| 882 encountered_weak_collections_ = weak_collection; | 889 encountered_weak_collections_ = weak_collection; |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1462 // trigger the event. In order to track ALL allocations one must turn off | 1469 // trigger the event. In order to track ALL allocations one must turn off |
| 1463 // FLAG_inline_new and FLAG_use_allocation_folding. | 1470 // FLAG_inline_new and FLAG_use_allocation_folding. |
| 1464 inline void OnAllocationEvent(HeapObject* object, int size_in_bytes); | 1471 inline void OnAllocationEvent(HeapObject* object, int size_in_bytes); |
| 1465 | 1472 |
| 1466 // This event is triggered after object is moved to a new place. | 1473 // This event is triggered after object is moved to a new place. |
| 1467 inline void OnMoveEvent(HeapObject* target, HeapObject* source, | 1474 inline void OnMoveEvent(HeapObject* target, HeapObject* source, |
| 1468 int size_in_bytes); | 1475 int size_in_bytes); |
| 1469 | 1476 |
| 1470 bool deserialization_complete() const { return deserialization_complete_; } | 1477 bool deserialization_complete() const { return deserialization_complete_; } |
| 1471 | 1478 |
| 1479 bool migration_failure() const { return migration_failure_; } |
| 1480 void set_migration_failure(bool migration_failure) { |
| 1481 migration_failure_ = migration_failure; |
| 1482 } |
| 1483 |
| 1484 bool previous_migration_failure() const { |
| 1485 return previous_migration_failure_; |
| 1486 } |
| 1487 void set_previous_migration_failure(bool previous_migration_failure) { |
| 1488 previous_migration_failure_ = previous_migration_failure; |
| 1489 } |
| 1490 |
| 1472 protected: | 1491 protected: |
| 1473 // Methods made available to tests. | 1492 // Methods made available to tests. |
| 1474 | 1493 |
| 1475 // Allocates a JS Map in the heap. | 1494 // Allocates a JS Map in the heap. |
| 1476 MUST_USE_RESULT AllocationResult | 1495 MUST_USE_RESULT AllocationResult |
| 1477 AllocateMap(InstanceType instance_type, int instance_size, | 1496 AllocateMap(InstanceType instance_type, int instance_size, |
| 1478 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND); | 1497 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND); |
| 1479 | 1498 |
| 1480 // Allocates and initializes a new JavaScript object based on a | 1499 // Allocates and initializes a new JavaScript object based on a |
| 1481 // constructor. | 1500 // constructor. |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1629 | 1648 |
| 1630 // Indicates that an allocation has failed in the old generation since the | 1649 // Indicates that an allocation has failed in the old generation since the |
| 1631 // last GC. | 1650 // last GC. |
| 1632 bool old_gen_exhausted_; | 1651 bool old_gen_exhausted_; |
| 1633 | 1652 |
| 1634 // Indicates that inline bump-pointer allocation has been globally disabled | 1653 // Indicates that inline bump-pointer allocation has been globally disabled |
| 1635 // for all spaces. This is used to disable allocations in generated code. | 1654 // for all spaces. This is used to disable allocations in generated code. |
| 1636 bool inline_allocation_disabled_; | 1655 bool inline_allocation_disabled_; |
| 1637 | 1656 |
| 1638 // Weak list heads, threaded through the objects. | 1657 // Weak list heads, threaded through the objects. |
| 1639 // List heads are initilized lazily and contain the undefined_value at start. | 1658 // List heads are initialized lazily and contain the undefined_value at start. |
| 1640 Object* native_contexts_list_; | 1659 Object* native_contexts_list_; |
| 1641 Object* array_buffers_list_; | 1660 Object* array_buffers_list_; |
| 1642 Object* allocation_sites_list_; | 1661 Object* allocation_sites_list_; |
| 1643 | 1662 |
| 1663 // This is a global list of array buffer views in new space. When the views |
| 1664 // get promoted, they are removed form the list and added to the corresponding |
| 1665 // array buffer. |
| 1666 Object* new_array_buffer_views_list_; |
| 1667 |
| 1644 // List of encountered weak collections (JSWeakMap and JSWeakSet) during | 1668 // List of encountered weak collections (JSWeakMap and JSWeakSet) during |
| 1645 // marking. It is initialized during marking, destroyed after marking and | 1669 // marking. It is initialized during marking, destroyed after marking and |
| 1646 // contains Smi(0) while marking is not active. | 1670 // contains Smi(0) while marking is not active. |
| 1647 Object* encountered_weak_collections_; | 1671 Object* encountered_weak_collections_; |
| 1648 | 1672 |
| 1649 Object* encountered_weak_cells_; | 1673 Object* encountered_weak_cells_; |
| 1650 | 1674 |
| 1651 StoreBufferRebuilder store_buffer_rebuilder_; | 1675 StoreBufferRebuilder store_buffer_rebuilder_; |
| 1652 | 1676 |
| 1653 struct StringTypeTable { | 1677 struct StringTypeTable { |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1966 StoreBufferEvent event); | 1990 StoreBufferEvent event); |
| 1967 | 1991 |
| 1968 // Performs a major collection in the whole heap. | 1992 // Performs a major collection in the whole heap. |
| 1969 void MarkCompact(); | 1993 void MarkCompact(); |
| 1970 | 1994 |
| 1971 // Code to be run before and after mark-compact. | 1995 // Code to be run before and after mark-compact. |
| 1972 void MarkCompactPrologue(); | 1996 void MarkCompactPrologue(); |
| 1973 void MarkCompactEpilogue(); | 1997 void MarkCompactEpilogue(); |
| 1974 | 1998 |
| 1975 void ProcessNativeContexts(WeakObjectRetainer* retainer); | 1999 void ProcessNativeContexts(WeakObjectRetainer* retainer); |
| 1976 void ProcessArrayBuffers(WeakObjectRetainer* retainer); | 2000 void ProcessArrayBuffers(WeakObjectRetainer* retainer, bool stop_after_young); |
| 2001 void ProcessNewArrayBufferViews(WeakObjectRetainer* retainer); |
| 1977 void ProcessAllocationSites(WeakObjectRetainer* retainer); | 2002 void ProcessAllocationSites(WeakObjectRetainer* retainer); |
| 1978 | 2003 |
| 1979 // Deopts all code that contains allocation instruction which are tenured or | 2004 // Deopts all code that contains allocation instruction which are tenured or |
| 1980 // not tenured. Moreover it clears the pretenuring allocation site statistics. | 2005 // not tenured. Moreover it clears the pretenuring allocation site statistics. |
| 1981 void ResetAllAllocationSitesDependentCode(PretenureFlag flag); | 2006 void ResetAllAllocationSitesDependentCode(PretenureFlag flag); |
| 1982 | 2007 |
| 1983 // Evaluates local pretenuring for the old space and calls | 2008 // Evaluates local pretenuring for the old space and calls |
| 1984 // ResetAllTenuredAllocationSitesDependentCode if too many objects died in | 2009 // ResetAllTenuredAllocationSitesDependentCode if too many objects died in |
| 1985 // the old space. | 2010 // the old space. |
| 1986 void EvaluateOldSpaceLocalPretenuring(uint64_t size_of_objects_before_gc); | 2011 void EvaluateOldSpaceLocalPretenuring(uint64_t size_of_objects_before_gc); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2128 MemoryChunk* chunks_queued_for_free_; | 2153 MemoryChunk* chunks_queued_for_free_; |
| 2129 | 2154 |
| 2130 base::Mutex relocation_mutex_; | 2155 base::Mutex relocation_mutex_; |
| 2131 | 2156 |
| 2132 int gc_callbacks_depth_; | 2157 int gc_callbacks_depth_; |
| 2133 | 2158 |
| 2134 bool deserialization_complete_; | 2159 bool deserialization_complete_; |
| 2135 | 2160 |
| 2136 bool concurrent_sweeping_enabled_; | 2161 bool concurrent_sweeping_enabled_; |
| 2137 | 2162 |
| 2163 // A migration failure indicates that a semi-space copy of an object during |
| 2164 // a scavenge failed and the object got promoted instead. |
| 2165 bool migration_failure_; |
| 2166 |
| 2167 // A migration failure happened in the previous scavenge. |
| 2168 bool previous_migration_failure_; |
| 2169 |
| 2138 friend class AlwaysAllocateScope; | 2170 friend class AlwaysAllocateScope; |
| 2139 friend class Deserializer; | 2171 friend class Deserializer; |
| 2140 friend class Factory; | 2172 friend class Factory; |
| 2141 friend class GCCallbacksScope; | 2173 friend class GCCallbacksScope; |
| 2142 friend class GCTracer; | 2174 friend class GCTracer; |
| 2143 friend class HeapIterator; | 2175 friend class HeapIterator; |
| 2144 friend class Isolate; | 2176 friend class Isolate; |
| 2145 friend class MarkCompactCollector; | 2177 friend class MarkCompactCollector; |
| 2146 friend class MarkCompactMarkingVisitor; | 2178 friend class MarkCompactMarkingVisitor; |
| 2147 friend class MapCompact; | 2179 friend class MapCompact; |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2596 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2628 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
| 2597 | 2629 |
| 2598 private: | 2630 private: |
| 2599 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2631 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2600 }; | 2632 }; |
| 2601 #endif // DEBUG | 2633 #endif // DEBUG |
| 2602 } | 2634 } |
| 2603 } // namespace v8::internal | 2635 } // namespace v8::internal |
| 2604 | 2636 |
| 2605 #endif // V8_HEAP_HEAP_H_ | 2637 #endif // V8_HEAP_HEAP_H_ |
| OLD | NEW |