| 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 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 String* hidden_string() { return hidden_string_; } | 846 String* hidden_string() { return hidden_string_; } |
| 847 | 847 |
| 848 void set_native_contexts_list(Object* object) { | 848 void set_native_contexts_list(Object* object) { |
| 849 native_contexts_list_ = object; | 849 native_contexts_list_ = object; |
| 850 } | 850 } |
| 851 Object* native_contexts_list() const { return native_contexts_list_; } | 851 Object* native_contexts_list() const { return native_contexts_list_; } |
| 852 | 852 |
| 853 void set_array_buffers_list(Object* object) { array_buffers_list_ = object; } | 853 void set_array_buffers_list(Object* object) { array_buffers_list_ = object; } |
| 854 Object* array_buffers_list() const { return array_buffers_list_; } | 854 Object* array_buffers_list() const { return array_buffers_list_; } |
| 855 | 855 |
| 856 void set_new_array_buffer_views_list(Object* object) { | |
| 857 new_array_buffer_views_list_ = object; | |
| 858 } | |
| 859 Object* new_array_buffer_views_list() const { | |
| 860 return new_array_buffer_views_list_; | |
| 861 } | |
| 862 | |
| 863 void set_allocation_sites_list(Object* object) { | 856 void set_allocation_sites_list(Object* object) { |
| 864 allocation_sites_list_ = object; | 857 allocation_sites_list_ = object; |
| 865 } | 858 } |
| 866 Object* allocation_sites_list() { return allocation_sites_list_; } | 859 Object* allocation_sites_list() { return allocation_sites_list_; } |
| 867 | 860 |
| 868 // Used in CreateAllocationSiteStub and the (de)serializer. | 861 // Used in CreateAllocationSiteStub and the (de)serializer. |
| 869 Object** allocation_sites_list_address() { return &allocation_sites_list_; } | 862 Object** allocation_sites_list_address() { return &allocation_sites_list_; } |
| 870 | 863 |
| 871 Object* weak_object_to_code_table() { return weak_object_to_code_table_; } | 864 Object* weak_object_to_code_table() { return weak_object_to_code_table_; } |
| 872 | 865 |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1453 // trigger the event. In order to track ALL allocations one must turn off | 1446 // trigger the event. In order to track ALL allocations one must turn off |
| 1454 // FLAG_inline_new and FLAG_use_allocation_folding. | 1447 // FLAG_inline_new and FLAG_use_allocation_folding. |
| 1455 inline void OnAllocationEvent(HeapObject* object, int size_in_bytes); | 1448 inline void OnAllocationEvent(HeapObject* object, int size_in_bytes); |
| 1456 | 1449 |
| 1457 // This event is triggered after object is moved to a new place. | 1450 // This event is triggered after object is moved to a new place. |
| 1458 inline void OnMoveEvent(HeapObject* target, HeapObject* source, | 1451 inline void OnMoveEvent(HeapObject* target, HeapObject* source, |
| 1459 int size_in_bytes); | 1452 int size_in_bytes); |
| 1460 | 1453 |
| 1461 bool deserialization_complete() const { return deserialization_complete_; } | 1454 bool deserialization_complete() const { return deserialization_complete_; } |
| 1462 | 1455 |
| 1463 bool promotion_failure() const { return promotion_failure_; } | |
| 1464 void set_promotion_failure(bool promotion_failure) { | |
| 1465 promotion_failure_ = promotion_failure; | |
| 1466 } | |
| 1467 | |
| 1468 protected: | 1456 protected: |
| 1469 // Methods made available to tests. | 1457 // Methods made available to tests. |
| 1470 | 1458 |
| 1471 // Allocates a JS Map in the heap. | 1459 // Allocates a JS Map in the heap. |
| 1472 MUST_USE_RESULT AllocationResult | 1460 MUST_USE_RESULT AllocationResult |
| 1473 AllocateMap(InstanceType instance_type, int instance_size, | 1461 AllocateMap(InstanceType instance_type, int instance_size, |
| 1474 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND); | 1462 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND); |
| 1475 | 1463 |
| 1476 // Allocates and initializes a new JavaScript object based on a | 1464 // Allocates and initializes a new JavaScript object based on a |
| 1477 // constructor. | 1465 // constructor. |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1623 | 1611 |
| 1624 // Indicates that an allocation has failed in the old generation since the | 1612 // Indicates that an allocation has failed in the old generation since the |
| 1625 // last GC. | 1613 // last GC. |
| 1626 bool old_gen_exhausted_; | 1614 bool old_gen_exhausted_; |
| 1627 | 1615 |
| 1628 // Indicates that inline bump-pointer allocation has been globally disabled | 1616 // Indicates that inline bump-pointer allocation has been globally disabled |
| 1629 // for all spaces. This is used to disable allocations in generated code. | 1617 // for all spaces. This is used to disable allocations in generated code. |
| 1630 bool inline_allocation_disabled_; | 1618 bool inline_allocation_disabled_; |
| 1631 | 1619 |
| 1632 // Weak list heads, threaded through the objects. | 1620 // Weak list heads, threaded through the objects. |
| 1633 // List heads are initialized lazily and contain the undefined_value at start. | 1621 // List heads are initilized lazily and contain the undefined_value at start. |
| 1634 Object* native_contexts_list_; | 1622 Object* native_contexts_list_; |
| 1635 Object* array_buffers_list_; | 1623 Object* array_buffers_list_; |
| 1636 Object* allocation_sites_list_; | 1624 Object* allocation_sites_list_; |
| 1637 | 1625 |
| 1638 // This is a global list of array buffer views in new space. When the views | |
| 1639 // get promoted, they are removed form the list and added to the corresponding | |
| 1640 // array buffer. | |
| 1641 Object* new_array_buffer_views_list_; | |
| 1642 | |
| 1643 // WeakHashTable that maps objects embedded in optimized code to dependent | 1626 // WeakHashTable that maps objects embedded in optimized code to dependent |
| 1644 // code list. It is initialized lazily and contains the undefined_value at | 1627 // code list. It is initilized lazily and contains the undefined_value at |
| 1645 // start. | 1628 // start. |
| 1646 Object* weak_object_to_code_table_; | 1629 Object* weak_object_to_code_table_; |
| 1647 | 1630 |
| 1648 // List of encountered weak collections (JSWeakMap and JSWeakSet) during | 1631 // List of encountered weak collections (JSWeakMap and JSWeakSet) during |
| 1649 // marking. It is initialized during marking, destroyed after marking and | 1632 // marking. It is initialized during marking, destroyed after marking and |
| 1650 // contains Smi(0) while marking is not active. | 1633 // contains Smi(0) while marking is not active. |
| 1651 Object* encountered_weak_collections_; | 1634 Object* encountered_weak_collections_; |
| 1652 | 1635 |
| 1653 Object* encountered_weak_cells_; | 1636 Object* encountered_weak_cells_; |
| 1654 | 1637 |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1970 StoreBufferEvent event); | 1953 StoreBufferEvent event); |
| 1971 | 1954 |
| 1972 // Performs a major collection in the whole heap. | 1955 // Performs a major collection in the whole heap. |
| 1973 void MarkCompact(); | 1956 void MarkCompact(); |
| 1974 | 1957 |
| 1975 // Code to be run before and after mark-compact. | 1958 // Code to be run before and after mark-compact. |
| 1976 void MarkCompactPrologue(); | 1959 void MarkCompactPrologue(); |
| 1977 void MarkCompactEpilogue(); | 1960 void MarkCompactEpilogue(); |
| 1978 | 1961 |
| 1979 void ProcessNativeContexts(WeakObjectRetainer* retainer); | 1962 void ProcessNativeContexts(WeakObjectRetainer* retainer); |
| 1980 void ProcessArrayBuffers(WeakObjectRetainer* retainer, bool stop_after_young); | 1963 void ProcessArrayBuffers(WeakObjectRetainer* retainer); |
| 1981 void ProcessNewArrayBufferViews(WeakObjectRetainer* retainer); | |
| 1982 void ProcessAllocationSites(WeakObjectRetainer* retainer); | 1964 void ProcessAllocationSites(WeakObjectRetainer* retainer); |
| 1983 | 1965 |
| 1984 // Deopts all code that contains allocation instruction which are tenured or | 1966 // Deopts all code that contains allocation instruction which are tenured or |
| 1985 // not tenured. Moreover it clears the pretenuring allocation site statistics. | 1967 // not tenured. Moreover it clears the pretenuring allocation site statistics. |
| 1986 void ResetAllAllocationSitesDependentCode(PretenureFlag flag); | 1968 void ResetAllAllocationSitesDependentCode(PretenureFlag flag); |
| 1987 | 1969 |
| 1988 // Evaluates local pretenuring for the old space and calls | 1970 // Evaluates local pretenuring for the old space and calls |
| 1989 // ResetAllTenuredAllocationSitesDependentCode if too many objects died in | 1971 // ResetAllTenuredAllocationSitesDependentCode if too many objects died in |
| 1990 // the old space. | 1972 // the old space. |
| 1991 void EvaluateOldSpaceLocalPretenuring(uint64_t size_of_objects_before_gc); | 1973 void EvaluateOldSpaceLocalPretenuring(uint64_t size_of_objects_before_gc); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2144 VisitorDispatchTable<ScavengingCallback> scavenging_visitors_table_; | 2126 VisitorDispatchTable<ScavengingCallback> scavenging_visitors_table_; |
| 2145 | 2127 |
| 2146 MemoryChunk* chunks_queued_for_free_; | 2128 MemoryChunk* chunks_queued_for_free_; |
| 2147 | 2129 |
| 2148 base::Mutex relocation_mutex_; | 2130 base::Mutex relocation_mutex_; |
| 2149 | 2131 |
| 2150 int gc_callbacks_depth_; | 2132 int gc_callbacks_depth_; |
| 2151 | 2133 |
| 2152 bool deserialization_complete_; | 2134 bool deserialization_complete_; |
| 2153 | 2135 |
| 2154 // A promotion failure indicates that old space promotion failed during | |
| 2155 // gc, i.e., some objects that should have gotten promoted had to stay in | |
| 2156 // the new space (they were copied to the other semi-space). | |
| 2157 bool promotion_failure_; | |
| 2158 | |
| 2159 friend class AlwaysAllocateScope; | 2136 friend class AlwaysAllocateScope; |
| 2160 friend class Deserializer; | 2137 friend class Deserializer; |
| 2161 friend class Factory; | 2138 friend class Factory; |
| 2162 friend class GCCallbacksScope; | 2139 friend class GCCallbacksScope; |
| 2163 friend class GCTracer; | 2140 friend class GCTracer; |
| 2164 friend class HeapIterator; | 2141 friend class HeapIterator; |
| 2165 friend class Isolate; | 2142 friend class Isolate; |
| 2166 friend class MarkCompactCollector; | 2143 friend class MarkCompactCollector; |
| 2167 friend class MarkCompactMarkingVisitor; | 2144 friend class MarkCompactMarkingVisitor; |
| 2168 friend class MapCompact; | 2145 friend class MapCompact; |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2617 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2594 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
| 2618 | 2595 |
| 2619 private: | 2596 private: |
| 2620 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2597 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2621 }; | 2598 }; |
| 2622 #endif // DEBUG | 2599 #endif // DEBUG |
| 2623 } | 2600 } |
| 2624 } // namespace v8::internal | 2601 } // namespace v8::internal |
| 2625 | 2602 |
| 2626 #endif // V8_HEAP_HEAP_H_ | 2603 #endif // V8_HEAP_HEAP_H_ |
| OLD | NEW |