| 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 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 837 String* hidden_string() { return hidden_string_; } | 837 String* hidden_string() { return hidden_string_; } |
| 838 | 838 |
| 839 void set_native_contexts_list(Object* object) { | 839 void set_native_contexts_list(Object* object) { |
| 840 native_contexts_list_ = object; | 840 native_contexts_list_ = object; |
| 841 } | 841 } |
| 842 Object* native_contexts_list() const { return native_contexts_list_; } | 842 Object* native_contexts_list() const { return native_contexts_list_; } |
| 843 | 843 |
| 844 void set_array_buffers_list(Object* object) { array_buffers_list_ = object; } | 844 void set_array_buffers_list(Object* object) { array_buffers_list_ = object; } |
| 845 Object* array_buffers_list() const { return array_buffers_list_; } | 845 Object* array_buffers_list() const { return array_buffers_list_; } |
| 846 | 846 |
| 847 void set_new_array_buffer_views_list(Object* object) { |
| 848 new_array_buffer_views_list_ = object; |
| 849 } |
| 850 Object* new_array_buffer_views_list() const { |
| 851 return new_array_buffer_views_list_; |
| 852 } |
| 853 |
| 847 void set_allocation_sites_list(Object* object) { | 854 void set_allocation_sites_list(Object* object) { |
| 848 allocation_sites_list_ = object; | 855 allocation_sites_list_ = object; |
| 849 } | 856 } |
| 850 Object* allocation_sites_list() { return allocation_sites_list_; } | 857 Object* allocation_sites_list() { return allocation_sites_list_; } |
| 851 | 858 |
| 852 // Used in CreateAllocationSiteStub and the (de)serializer. | 859 // Used in CreateAllocationSiteStub and the (de)serializer. |
| 853 Object** allocation_sites_list_address() { return &allocation_sites_list_; } | 860 Object** allocation_sites_list_address() { return &allocation_sites_list_; } |
| 854 | 861 |
| 855 Object* weak_object_to_code_table() { return weak_object_to_code_table_; } | 862 Object* weak_object_to_code_table() { return weak_object_to_code_table_; } |
| 856 | 863 |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1437 // trigger the event. In order to track ALL allocations one must turn off | 1444 // trigger the event. In order to track ALL allocations one must turn off |
| 1438 // FLAG_inline_new and FLAG_use_allocation_folding. | 1445 // FLAG_inline_new and FLAG_use_allocation_folding. |
| 1439 inline void OnAllocationEvent(HeapObject* object, int size_in_bytes); | 1446 inline void OnAllocationEvent(HeapObject* object, int size_in_bytes); |
| 1440 | 1447 |
| 1441 // This event is triggered after object is moved to a new place. | 1448 // This event is triggered after object is moved to a new place. |
| 1442 inline void OnMoveEvent(HeapObject* target, HeapObject* source, | 1449 inline void OnMoveEvent(HeapObject* target, HeapObject* source, |
| 1443 int size_in_bytes); | 1450 int size_in_bytes); |
| 1444 | 1451 |
| 1445 bool deserialization_complete() const { return deserialization_complete_; } | 1452 bool deserialization_complete() const { return deserialization_complete_; } |
| 1446 | 1453 |
| 1454 bool promotion_failure() const { return promotion_failure_; } |
| 1455 void set_promotion_failure(bool promotion_failure) { |
| 1456 promotion_failure_ = promotion_failure; |
| 1457 } |
| 1458 |
| 1447 protected: | 1459 protected: |
| 1448 // Methods made available to tests. | 1460 // Methods made available to tests. |
| 1449 | 1461 |
| 1450 // Allocates a JS Map in the heap. | 1462 // Allocates a JS Map in the heap. |
| 1451 MUST_USE_RESULT AllocationResult | 1463 MUST_USE_RESULT AllocationResult |
| 1452 AllocateMap(InstanceType instance_type, int instance_size, | 1464 AllocateMap(InstanceType instance_type, int instance_size, |
| 1453 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND); | 1465 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND); |
| 1454 | 1466 |
| 1455 // Allocates and initializes a new JavaScript object based on a | 1467 // Allocates and initializes a new JavaScript object based on a |
| 1456 // constructor. | 1468 // constructor. |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1602 | 1614 |
| 1603 // Indicates that an allocation has failed in the old generation since the | 1615 // Indicates that an allocation has failed in the old generation since the |
| 1604 // last GC. | 1616 // last GC. |
| 1605 bool old_gen_exhausted_; | 1617 bool old_gen_exhausted_; |
| 1606 | 1618 |
| 1607 // Indicates that inline bump-pointer allocation has been globally disabled | 1619 // Indicates that inline bump-pointer allocation has been globally disabled |
| 1608 // for all spaces. This is used to disable allocations in generated code. | 1620 // for all spaces. This is used to disable allocations in generated code. |
| 1609 bool inline_allocation_disabled_; | 1621 bool inline_allocation_disabled_; |
| 1610 | 1622 |
| 1611 // Weak list heads, threaded through the objects. | 1623 // Weak list heads, threaded through the objects. |
| 1612 // List heads are initilized lazily and contain the undefined_value at start. | 1624 // List heads are initialized lazily and contain the undefined_value at start. |
| 1613 Object* native_contexts_list_; | 1625 Object* native_contexts_list_; |
| 1614 Object* array_buffers_list_; | 1626 Object* array_buffers_list_; |
| 1615 Object* allocation_sites_list_; | 1627 Object* allocation_sites_list_; |
| 1616 | 1628 |
| 1629 // This is a global list of array buffer views in new space. When the views |
| 1630 // get promoted, they are removed form the list and added to the corresponding |
| 1631 // array buffer. |
| 1632 Object* new_array_buffer_views_list_; |
| 1633 |
| 1617 // WeakHashTable that maps objects embedded in optimized code to dependent | 1634 // WeakHashTable that maps objects embedded in optimized code to dependent |
| 1618 // code list. It is initilized lazily and contains the undefined_value at | 1635 // code list. It is initialized lazily and contains the undefined_value at |
| 1619 // start. | 1636 // start. |
| 1620 Object* weak_object_to_code_table_; | 1637 Object* weak_object_to_code_table_; |
| 1621 | 1638 |
| 1622 // List of encountered weak collections (JSWeakMap and JSWeakSet) during | 1639 // List of encountered weak collections (JSWeakMap and JSWeakSet) during |
| 1623 // marking. It is initialized during marking, destroyed after marking and | 1640 // marking. It is initialized during marking, destroyed after marking and |
| 1624 // contains Smi(0) while marking is not active. | 1641 // contains Smi(0) while marking is not active. |
| 1625 Object* encountered_weak_collections_; | 1642 Object* encountered_weak_collections_; |
| 1626 | 1643 |
| 1627 Object* encountered_weak_cells_; | 1644 Object* encountered_weak_cells_; |
| 1628 | 1645 |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1944 StoreBufferEvent event); | 1961 StoreBufferEvent event); |
| 1945 | 1962 |
| 1946 // Performs a major collection in the whole heap. | 1963 // Performs a major collection in the whole heap. |
| 1947 void MarkCompact(); | 1964 void MarkCompact(); |
| 1948 | 1965 |
| 1949 // Code to be run before and after mark-compact. | 1966 // Code to be run before and after mark-compact. |
| 1950 void MarkCompactPrologue(); | 1967 void MarkCompactPrologue(); |
| 1951 void MarkCompactEpilogue(); | 1968 void MarkCompactEpilogue(); |
| 1952 | 1969 |
| 1953 void ProcessNativeContexts(WeakObjectRetainer* retainer); | 1970 void ProcessNativeContexts(WeakObjectRetainer* retainer); |
| 1954 void ProcessArrayBuffers(WeakObjectRetainer* retainer); | 1971 void ProcessArrayBuffers(WeakObjectRetainer* retainer, bool stop_after_young); |
| 1972 void ProcessNewArrayBufferViews(WeakObjectRetainer* retainer); |
| 1955 void ProcessAllocationSites(WeakObjectRetainer* retainer); | 1973 void ProcessAllocationSites(WeakObjectRetainer* retainer); |
| 1956 | 1974 |
| 1957 // Deopts all code that contains allocation instruction which are tenured or | 1975 // Deopts all code that contains allocation instruction which are tenured or |
| 1958 // not tenured. Moreover it clears the pretenuring allocation site statistics. | 1976 // not tenured. Moreover it clears the pretenuring allocation site statistics. |
| 1959 void ResetAllAllocationSitesDependentCode(PretenureFlag flag); | 1977 void ResetAllAllocationSitesDependentCode(PretenureFlag flag); |
| 1960 | 1978 |
| 1961 // Evaluates local pretenuring for the old space and calls | 1979 // Evaluates local pretenuring for the old space and calls |
| 1962 // ResetAllTenuredAllocationSitesDependentCode if too many objects died in | 1980 // ResetAllTenuredAllocationSitesDependentCode if too many objects died in |
| 1963 // the old space. | 1981 // the old space. |
| 1964 void EvaluateOldSpaceLocalPretenuring(uint64_t size_of_objects_before_gc); | 1982 void EvaluateOldSpaceLocalPretenuring(uint64_t size_of_objects_before_gc); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2117 VisitorDispatchTable<ScavengingCallback> scavenging_visitors_table_; | 2135 VisitorDispatchTable<ScavengingCallback> scavenging_visitors_table_; |
| 2118 | 2136 |
| 2119 MemoryChunk* chunks_queued_for_free_; | 2137 MemoryChunk* chunks_queued_for_free_; |
| 2120 | 2138 |
| 2121 base::Mutex relocation_mutex_; | 2139 base::Mutex relocation_mutex_; |
| 2122 | 2140 |
| 2123 int gc_callbacks_depth_; | 2141 int gc_callbacks_depth_; |
| 2124 | 2142 |
| 2125 bool deserialization_complete_; | 2143 bool deserialization_complete_; |
| 2126 | 2144 |
| 2145 // A promotion failure indicates that old space promotion failed during |
| 2146 // gc, i.e., some objects that should have gotten promoted had to stay in |
| 2147 // the new space (they were copied to the other semi-space). |
| 2148 bool promotion_failure_; |
| 2149 |
| 2127 friend class AlwaysAllocateScope; | 2150 friend class AlwaysAllocateScope; |
| 2128 friend class Deserializer; | 2151 friend class Deserializer; |
| 2129 friend class Factory; | 2152 friend class Factory; |
| 2130 friend class GCCallbacksScope; | 2153 friend class GCCallbacksScope; |
| 2131 friend class GCTracer; | 2154 friend class GCTracer; |
| 2132 friend class HeapIterator; | 2155 friend class HeapIterator; |
| 2133 friend class Isolate; | 2156 friend class Isolate; |
| 2134 friend class MarkCompactCollector; | 2157 friend class MarkCompactCollector; |
| 2135 friend class MarkCompactMarkingVisitor; | 2158 friend class MarkCompactMarkingVisitor; |
| 2136 friend class MapCompact; | 2159 friend class MapCompact; |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2585 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2608 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
| 2586 | 2609 |
| 2587 private: | 2610 private: |
| 2588 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2611 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2589 }; | 2612 }; |
| 2590 #endif // DEBUG | 2613 #endif // DEBUG |
| 2591 } | 2614 } |
| 2592 } // namespace v8::internal | 2615 } // namespace v8::internal |
| 2593 | 2616 |
| 2594 #endif // V8_HEAP_HEAP_H_ | 2617 #endif // V8_HEAP_HEAP_H_ |
| OLD | NEW |