| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 V(Map, scope_info_map, ScopeInfoMap) \ | 71 V(Map, scope_info_map, ScopeInfoMap) \ |
| 72 V(Map, fixed_cow_array_map, FixedCOWArrayMap) \ | 72 V(Map, fixed_cow_array_map, FixedCOWArrayMap) \ |
| 73 V(Map, fixed_double_array_map, FixedDoubleArrayMap) \ | 73 V(Map, fixed_double_array_map, FixedDoubleArrayMap) \ |
| 74 V(Map, constant_pool_array_map, ConstantPoolArrayMap) \ | 74 V(Map, constant_pool_array_map, ConstantPoolArrayMap) \ |
| 75 V(Object, no_interceptor_result_sentinel, NoInterceptorResultSentinel) \ | 75 V(Object, no_interceptor_result_sentinel, NoInterceptorResultSentinel) \ |
| 76 V(Map, hash_table_map, HashTableMap) \ | 76 V(Map, hash_table_map, HashTableMap) \ |
| 77 V(FixedArray, empty_fixed_array, EmptyFixedArray) \ | 77 V(FixedArray, empty_fixed_array, EmptyFixedArray) \ |
| 78 V(ByteArray, empty_byte_array, EmptyByteArray) \ | 78 V(ByteArray, empty_byte_array, EmptyByteArray) \ |
| 79 V(DescriptorArray, empty_descriptor_array, EmptyDescriptorArray) \ | 79 V(DescriptorArray, empty_descriptor_array, EmptyDescriptorArray) \ |
| 80 V(ConstantPoolArray, empty_constant_pool_array, EmptyConstantPoolArray) \ | 80 V(ConstantPoolArray, empty_constant_pool_array, EmptyConstantPoolArray) \ |
| 81 V(Smi, stack_limit, StackLimit) \ |
| 81 V(Oddball, arguments_marker, ArgumentsMarker) \ | 82 V(Oddball, arguments_marker, ArgumentsMarker) \ |
| 82 /* The roots above this line should be boring from a GC point of view. */ \ | 83 /* The roots above this line should be boring from a GC point of view. */ \ |
| 83 /* This means they are never in new space and never on a page that is */ \ | 84 /* This means they are never in new space and never on a page that is */ \ |
| 84 /* being compacted. */ \ | 85 /* being compacted. */ \ |
| 85 V(FixedArray, number_string_cache, NumberStringCache) \ | 86 V(FixedArray, number_string_cache, NumberStringCache) \ |
| 86 V(Object, instanceof_cache_function, InstanceofCacheFunction) \ | 87 V(Object, instanceof_cache_function, InstanceofCacheFunction) \ |
| 87 V(Object, instanceof_cache_map, InstanceofCacheMap) \ | 88 V(Object, instanceof_cache_map, InstanceofCacheMap) \ |
| 88 V(Object, instanceof_cache_answer, InstanceofCacheAnswer) \ | 89 V(Object, instanceof_cache_answer, InstanceofCacheAnswer) \ |
| 89 V(FixedArray, single_character_string_cache, SingleCharacterStringCache) \ | 90 V(FixedArray, single_character_string_cache, SingleCharacterStringCache) \ |
| 90 V(FixedArray, string_split_cache, StringSplitCache) \ | 91 V(FixedArray, string_split_cache, StringSplitCache) \ |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 V(HeapNumber, infinity_value, InfinityValue) \ | 179 V(HeapNumber, infinity_value, InfinityValue) \ |
| 179 V(HeapNumber, minus_zero_value, MinusZeroValue) \ | 180 V(HeapNumber, minus_zero_value, MinusZeroValue) \ |
| 180 V(Map, neander_map, NeanderMap) \ | 181 V(Map, neander_map, NeanderMap) \ |
| 181 V(JSObject, message_listeners, MessageListeners) \ | 182 V(JSObject, message_listeners, MessageListeners) \ |
| 182 V(UnseededNumberDictionary, code_stubs, CodeStubs) \ | 183 V(UnseededNumberDictionary, code_stubs, CodeStubs) \ |
| 183 V(UnseededNumberDictionary, non_monomorphic_cache, NonMonomorphicCache) \ | 184 V(UnseededNumberDictionary, non_monomorphic_cache, NonMonomorphicCache) \ |
| 184 V(PolymorphicCodeCache, polymorphic_code_cache, PolymorphicCodeCache) \ | 185 V(PolymorphicCodeCache, polymorphic_code_cache, PolymorphicCodeCache) \ |
| 185 V(Code, js_entry_code, JsEntryCode) \ | 186 V(Code, js_entry_code, JsEntryCode) \ |
| 186 V(Code, js_construct_entry_code, JsConstructEntryCode) \ | 187 V(Code, js_construct_entry_code, JsConstructEntryCode) \ |
| 187 V(FixedArray, natives_source_cache, NativesSourceCache) \ | 188 V(FixedArray, natives_source_cache, NativesSourceCache) \ |
| 189 V(Smi, last_script_id, LastScriptId) \ |
| 188 V(Script, empty_script, EmptyScript) \ | 190 V(Script, empty_script, EmptyScript) \ |
| 191 V(Smi, real_stack_limit, RealStackLimit) \ |
| 189 V(NameDictionary, intrinsic_function_names, IntrinsicFunctionNames) \ | 192 V(NameDictionary, intrinsic_function_names, IntrinsicFunctionNames) \ |
| 193 V(Smi, arguments_adaptor_deopt_pc_offset, ArgumentsAdaptorDeoptPCOffset) \ |
| 194 V(Smi, construct_stub_deopt_pc_offset, ConstructStubDeoptPCOffset) \ |
| 195 V(Smi, getter_stub_deopt_pc_offset, GetterStubDeoptPCOffset) \ |
| 196 V(Smi, setter_stub_deopt_pc_offset, SetterStubDeoptPCOffset) \ |
| 190 V(Cell, undefined_cell, UndefineCell) \ | 197 V(Cell, undefined_cell, UndefineCell) \ |
| 191 V(JSObject, observation_state, ObservationState) \ | 198 V(JSObject, observation_state, ObservationState) \ |
| 192 V(Map, external_map, ExternalMap) \ | 199 V(Map, external_map, ExternalMap) \ |
| 193 V(Symbol, frozen_symbol, FrozenSymbol) \ | 200 V(Symbol, frozen_symbol, FrozenSymbol) \ |
| 194 V(Symbol, elements_transition_symbol, ElementsTransitionSymbol) \ | 201 V(Symbol, elements_transition_symbol, ElementsTransitionSymbol) \ |
| 195 V(SeededNumberDictionary, empty_slow_element_dictionary, \ | 202 V(SeededNumberDictionary, empty_slow_element_dictionary, \ |
| 196 EmptySlowElementDictionary) \ | 203 EmptySlowElementDictionary) \ |
| 197 V(Symbol, observed_symbol, ObservedSymbol) \ | 204 V(Symbol, observed_symbol, ObservedSymbol) \ |
| 198 V(FixedArray, materialized_objects, MaterializedObjects) \ | 205 V(FixedArray, materialized_objects, MaterializedObjects) \ |
| 199 V(FixedArray, allocation_sites_scratchpad, AllocationSitesScratchpad) \ | 206 V(FixedArray, allocation_sites_scratchpad, AllocationSitesScratchpad) |
| 200 V(JSObject, microtask_state, MicrotaskState) | |
| 201 | |
| 202 // Entries in this list are limited to Smis and are not visited during GC. | |
| 203 #define SMI_ROOT_LIST(V) \ | |
| 204 V(Smi, stack_limit, StackLimit) \ | |
| 205 V(Smi, real_stack_limit, RealStackLimit) \ | |
| 206 V(Smi, last_script_id, LastScriptId) \ | |
| 207 V(Smi, arguments_adaptor_deopt_pc_offset, ArgumentsAdaptorDeoptPCOffset) \ | |
| 208 V(Smi, construct_stub_deopt_pc_offset, ConstructStubDeoptPCOffset) \ | |
| 209 V(Smi, getter_stub_deopt_pc_offset, GetterStubDeoptPCOffset) \ | |
| 210 V(Smi, setter_stub_deopt_pc_offset, SetterStubDeoptPCOffset) | |
| 211 | 207 |
| 212 #define ROOT_LIST(V) \ | 208 #define ROOT_LIST(V) \ |
| 213 STRONG_ROOT_LIST(V) \ | 209 STRONG_ROOT_LIST(V) \ |
| 214 SMI_ROOT_LIST(V) \ | |
| 215 V(StringTable, string_table, StringTable) | 210 V(StringTable, string_table, StringTable) |
| 216 | 211 |
| 217 // Heap roots that are known to be immortal immovable, for which we can safely | 212 // Heap roots that are known to be immortal immovable, for which we can safely |
| 218 // skip write barriers. | 213 // skip write barriers. |
| 219 #define IMMORTAL_IMMOVABLE_ROOT_LIST(V) \ | 214 #define IMMORTAL_IMMOVABLE_ROOT_LIST(V) \ |
| 220 V(byte_array_map) \ | 215 V(byte_array_map) \ |
| 221 V(free_space_map) \ | 216 V(free_space_map) \ |
| 222 V(one_pointer_filler_map) \ | 217 V(one_pointer_filler_map) \ |
| 223 V(two_pointer_filler_map) \ | 218 V(two_pointer_filler_map) \ |
| 224 V(undefined_value) \ | 219 V(undefined_value) \ |
| (...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1132 // Allocates a new JSMessageObject object. | 1127 // Allocates a new JSMessageObject object. |
| 1133 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 1128 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
| 1134 // failed. | 1129 // failed. |
| 1135 // Please note that this does not perform a garbage collection. | 1130 // Please note that this does not perform a garbage collection. |
| 1136 MUST_USE_RESULT MaybeObject* AllocateJSMessageObject( | 1131 MUST_USE_RESULT MaybeObject* AllocateJSMessageObject( |
| 1137 String* type, | 1132 String* type, |
| 1138 JSArray* arguments, | 1133 JSArray* arguments, |
| 1139 int start_position, | 1134 int start_position, |
| 1140 int end_position, | 1135 int end_position, |
| 1141 Object* script, | 1136 Object* script, |
| 1137 Object* stack_trace, |
| 1142 Object* stack_frames); | 1138 Object* stack_frames); |
| 1143 | 1139 |
| 1144 // Allocate a new external string object, which is backed by a string | 1140 // Allocate a new external string object, which is backed by a string |
| 1145 // resource that resides outside the V8 heap. | 1141 // resource that resides outside the V8 heap. |
| 1146 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 1142 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
| 1147 // failed. | 1143 // failed. |
| 1148 // Please note this does not perform a garbage collection. | 1144 // Please note this does not perform a garbage collection. |
| 1149 MUST_USE_RESULT MaybeObject* AllocateExternalStringFromAscii( | 1145 MUST_USE_RESULT MaybeObject* AllocateExternalStringFromAscii( |
| 1150 const ExternalAsciiString::Resource* resource); | 1146 const ExternalAsciiString::Resource* resource); |
| 1151 MUST_USE_RESULT MaybeObject* AllocateExternalStringFromTwoByte( | 1147 MUST_USE_RESULT MaybeObject* AllocateExternalStringFromTwoByte( |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1252 // Check whether the heap is currently iterable. | 1248 // Check whether the heap is currently iterable. |
| 1253 bool IsHeapIterable(); | 1249 bool IsHeapIterable(); |
| 1254 | 1250 |
| 1255 // Ensure that we have swept all spaces in such a way that we can iterate | 1251 // Ensure that we have swept all spaces in such a way that we can iterate |
| 1256 // over all objects. May cause a GC. | 1252 // over all objects. May cause a GC. |
| 1257 void EnsureHeapIsIterable(); | 1253 void EnsureHeapIsIterable(); |
| 1258 | 1254 |
| 1259 // Notify the heap that a context has been disposed. | 1255 // Notify the heap that a context has been disposed. |
| 1260 int NotifyContextDisposed(); | 1256 int NotifyContextDisposed(); |
| 1261 | 1257 |
| 1258 // Utility to invoke the scavenger. This is needed in test code to |
| 1259 // ensure correct callback for weak global handles. |
| 1260 void PerformScavenge(); |
| 1261 |
| 1262 inline void increment_scan_on_scavenge_pages() { | 1262 inline void increment_scan_on_scavenge_pages() { |
| 1263 scan_on_scavenge_pages_++; | 1263 scan_on_scavenge_pages_++; |
| 1264 if (FLAG_gc_verbose) { | 1264 if (FLAG_gc_verbose) { |
| 1265 PrintF("Scan-on-scavenge pages: %d\n", scan_on_scavenge_pages_); | 1265 PrintF("Scan-on-scavenge pages: %d\n", scan_on_scavenge_pages_); |
| 1266 } | 1266 } |
| 1267 } | 1267 } |
| 1268 | 1268 |
| 1269 inline void decrement_scan_on_scavenge_pages() { | 1269 inline void decrement_scan_on_scavenge_pages() { |
| 1270 scan_on_scavenge_pages_--; | 1270 scan_on_scavenge_pages_--; |
| 1271 if (FLAG_gc_verbose) { | 1271 if (FLAG_gc_verbose) { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1340 | 1340 |
| 1341 Object* weak_object_to_code_table() { return weak_object_to_code_table_; } | 1341 Object* weak_object_to_code_table() { return weak_object_to_code_table_; } |
| 1342 | 1342 |
| 1343 // Number of mark-sweeps. | 1343 // Number of mark-sweeps. |
| 1344 unsigned int ms_count() { return ms_count_; } | 1344 unsigned int ms_count() { return ms_count_; } |
| 1345 | 1345 |
| 1346 // Iterates over all roots in the heap. | 1346 // Iterates over all roots in the heap. |
| 1347 void IterateRoots(ObjectVisitor* v, VisitMode mode); | 1347 void IterateRoots(ObjectVisitor* v, VisitMode mode); |
| 1348 // Iterates over all strong roots in the heap. | 1348 // Iterates over all strong roots in the heap. |
| 1349 void IterateStrongRoots(ObjectVisitor* v, VisitMode mode); | 1349 void IterateStrongRoots(ObjectVisitor* v, VisitMode mode); |
| 1350 // Iterates over entries in the smi roots list. Only interesting to the | |
| 1351 // serializer/deserializer, since GC does not care about smis. | |
| 1352 void IterateSmiRoots(ObjectVisitor* v); | |
| 1353 // Iterates over all the other roots in the heap. | 1350 // Iterates over all the other roots in the heap. |
| 1354 void IterateWeakRoots(ObjectVisitor* v, VisitMode mode); | 1351 void IterateWeakRoots(ObjectVisitor* v, VisitMode mode); |
| 1355 | 1352 |
| 1356 // Iterate pointers to from semispace of new space found in memory interval | 1353 // Iterate pointers to from semispace of new space found in memory interval |
| 1357 // from start to end. | 1354 // from start to end. |
| 1358 void IterateAndMarkPointersToFromSpace(Address start, | 1355 void IterateAndMarkPointersToFromSpace(Address start, |
| 1359 Address end, | 1356 Address end, |
| 1360 ObjectSlotCallback callback); | 1357 ObjectSlotCallback callback); |
| 1361 | 1358 |
| 1362 // Returns whether the object resides in new space. | 1359 // Returns whether the object resides in new space. |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1578 // Indicates whether inline bump-pointer allocation has been disabled. | 1575 // Indicates whether inline bump-pointer allocation has been disabled. |
| 1579 bool inline_allocation_disabled() { return inline_allocation_disabled_; } | 1576 bool inline_allocation_disabled() { return inline_allocation_disabled_; } |
| 1580 | 1577 |
| 1581 // Switch whether inline bump-pointer allocation should be used. | 1578 // Switch whether inline bump-pointer allocation should be used. |
| 1582 void EnableInlineAllocation(); | 1579 void EnableInlineAllocation(); |
| 1583 void DisableInlineAllocation(); | 1580 void DisableInlineAllocation(); |
| 1584 | 1581 |
| 1585 // Implements the corresponding V8 API function. | 1582 // Implements the corresponding V8 API function. |
| 1586 bool IdleNotification(int hint); | 1583 bool IdleNotification(int hint); |
| 1587 | 1584 |
| 1588 // Declare all the root indices. This defines the root list order. | 1585 // Declare all the root indices. |
| 1589 enum RootListIndex { | 1586 enum RootListIndex { |
| 1590 #define ROOT_INDEX_DECLARATION(type, name, camel_name) k##camel_name##RootIndex, | 1587 #define ROOT_INDEX_DECLARATION(type, name, camel_name) k##camel_name##RootIndex, |
| 1591 STRONG_ROOT_LIST(ROOT_INDEX_DECLARATION) | 1588 STRONG_ROOT_LIST(ROOT_INDEX_DECLARATION) |
| 1592 #undef ROOT_INDEX_DECLARATION | 1589 #undef ROOT_INDEX_DECLARATION |
| 1593 | 1590 |
| 1594 #define STRING_INDEX_DECLARATION(name, str) k##name##RootIndex, | 1591 #define STRING_INDEX_DECLARATION(name, str) k##name##RootIndex, |
| 1595 INTERNALIZED_STRING_LIST(STRING_INDEX_DECLARATION) | 1592 INTERNALIZED_STRING_LIST(STRING_INDEX_DECLARATION) |
| 1596 #undef STRING_DECLARATION | 1593 #undef STRING_DECLARATION |
| 1597 | 1594 |
| 1598 // Utility type maps | 1595 // Utility type maps |
| 1599 #define DECLARE_STRUCT_MAP(NAME, Name, name) k##Name##MapRootIndex, | 1596 #define DECLARE_STRUCT_MAP(NAME, Name, name) k##Name##MapRootIndex, |
| 1600 STRUCT_LIST(DECLARE_STRUCT_MAP) | 1597 STRUCT_LIST(DECLARE_STRUCT_MAP) |
| 1601 #undef DECLARE_STRUCT_MAP | 1598 #undef DECLARE_STRUCT_MAP |
| 1602 | 1599 |
| 1603 kStringTableRootIndex, | 1600 kStringTableRootIndex, |
| 1604 | |
| 1605 #define ROOT_INDEX_DECLARATION(type, name, camel_name) k##camel_name##RootIndex, | |
| 1606 SMI_ROOT_LIST(ROOT_INDEX_DECLARATION) | |
| 1607 #undef ROOT_INDEX_DECLARATION | |
| 1608 | |
| 1609 kRootListLength, | |
| 1610 kStrongRootListLength = kStringTableRootIndex, | 1601 kStrongRootListLength = kStringTableRootIndex, |
| 1611 kSmiRootsStart = kStringTableRootIndex + 1 | 1602 kRootListLength |
| 1612 }; | 1603 }; |
| 1613 | 1604 |
| 1614 STATIC_CHECK(kUndefinedValueRootIndex == Internals::kUndefinedValueRootIndex); | 1605 STATIC_CHECK(kUndefinedValueRootIndex == Internals::kUndefinedValueRootIndex); |
| 1615 STATIC_CHECK(kNullValueRootIndex == Internals::kNullValueRootIndex); | 1606 STATIC_CHECK(kNullValueRootIndex == Internals::kNullValueRootIndex); |
| 1616 STATIC_CHECK(kTrueValueRootIndex == Internals::kTrueValueRootIndex); | 1607 STATIC_CHECK(kTrueValueRootIndex == Internals::kTrueValueRootIndex); |
| 1617 STATIC_CHECK(kFalseValueRootIndex == Internals::kFalseValueRootIndex); | 1608 STATIC_CHECK(kFalseValueRootIndex == Internals::kFalseValueRootIndex); |
| 1618 STATIC_CHECK(kempty_stringRootIndex == Internals::kEmptyStringRootIndex); | 1609 STATIC_CHECK(kempty_stringRootIndex == Internals::kEmptyStringRootIndex); |
| 1619 | 1610 |
| 1620 // Generated code can embed direct references to non-writable roots if | 1611 // Generated code can embed direct references to non-writable roots if |
| 1621 // they are in new space. | 1612 // they are in new space. |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1836 void AgeInlineCaches() { | 1827 void AgeInlineCaches() { |
| 1837 global_ic_age_ = (global_ic_age_ + 1) & SharedFunctionInfo::ICAgeBits::kMax; | 1828 global_ic_age_ = (global_ic_age_ + 1) & SharedFunctionInfo::ICAgeBits::kMax; |
| 1838 } | 1829 } |
| 1839 | 1830 |
| 1840 bool flush_monomorphic_ics() { return flush_monomorphic_ics_; } | 1831 bool flush_monomorphic_ics() { return flush_monomorphic_ics_; } |
| 1841 | 1832 |
| 1842 int64_t amount_of_external_allocated_memory() { | 1833 int64_t amount_of_external_allocated_memory() { |
| 1843 return amount_of_external_allocated_memory_; | 1834 return amount_of_external_allocated_memory_; |
| 1844 } | 1835 } |
| 1845 | 1836 |
| 1846 void DeoptMarkedAllocationSites(); | |
| 1847 | |
| 1848 // ObjectStats are kept in two arrays, counts and sizes. Related stats are | 1837 // ObjectStats are kept in two arrays, counts and sizes. Related stats are |
| 1849 // stored in a contiguous linear buffer. Stats groups are stored one after | 1838 // stored in a contiguous linear buffer. Stats groups are stored one after |
| 1850 // another. | 1839 // another. |
| 1851 enum { | 1840 enum { |
| 1852 FIRST_CODE_KIND_SUB_TYPE = LAST_TYPE + 1, | 1841 FIRST_CODE_KIND_SUB_TYPE = LAST_TYPE + 1, |
| 1853 FIRST_FIXED_ARRAY_SUB_TYPE = | 1842 FIRST_FIXED_ARRAY_SUB_TYPE = |
| 1854 FIRST_CODE_KIND_SUB_TYPE + Code::NUMBER_OF_KINDS, | 1843 FIRST_CODE_KIND_SUB_TYPE + Code::NUMBER_OF_KINDS, |
| 1855 FIRST_CODE_AGE_SUB_TYPE = | 1844 FIRST_CODE_AGE_SUB_TYPE = |
| 1856 FIRST_FIXED_ARRAY_SUB_TYPE + LAST_FIXED_ARRAY_SUB_TYPE + 1, | 1845 FIRST_FIXED_ARRAY_SUB_TYPE + LAST_FIXED_ARRAY_SUB_TYPE + 1, |
| 1857 OBJECT_STATS_COUNT = FIRST_CODE_AGE_SUB_TYPE + Code::kCodeAgeCount + 1 | 1846 OBJECT_STATS_COUNT = FIRST_CODE_AGE_SUB_TYPE + Code::kCodeAgeCount + 1 |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2124 // Pretenuring decisions are made based on feedback collected during new | 2113 // Pretenuring decisions are made based on feedback collected during new |
| 2125 // space evacuation. Note that between feedback collection and calling this | 2114 // space evacuation. Note that between feedback collection and calling this |
| 2126 // method object in old space must not move. | 2115 // method object in old space must not move. |
| 2127 // Right now we only process pretenuring feedback in high promotion mode. | 2116 // Right now we only process pretenuring feedback in high promotion mode. |
| 2128 void ProcessPretenuringFeedback(); | 2117 void ProcessPretenuringFeedback(); |
| 2129 | 2118 |
| 2130 // Checks whether a global GC is necessary | 2119 // Checks whether a global GC is necessary |
| 2131 GarbageCollector SelectGarbageCollector(AllocationSpace space, | 2120 GarbageCollector SelectGarbageCollector(AllocationSpace space, |
| 2132 const char** reason); | 2121 const char** reason); |
| 2133 | 2122 |
| 2134 // Make sure there is a filler value behind the top of the new space | |
| 2135 // so that the GC does not confuse some unintialized/stale memory | |
| 2136 // with the allocation memento of the object at the top | |
| 2137 void EnsureFillerObjectAtTop(); | |
| 2138 | |
| 2139 // Performs garbage collection operation. | 2123 // Performs garbage collection operation. |
| 2140 // Returns whether there is a chance that another major GC could | 2124 // Returns whether there is a chance that another major GC could |
| 2141 // collect more garbage. | 2125 // collect more garbage. |
| 2142 bool CollectGarbage( | 2126 bool CollectGarbage( |
| 2143 GarbageCollector collector, | 2127 GarbageCollector collector, |
| 2144 const char* gc_reason, | 2128 const char* gc_reason, |
| 2145 const char* collector_reason, | 2129 const char* collector_reason, |
| 2146 const GCCallbackFlags gc_callback_flags = kNoGCCallbackFlags); | 2130 const GCCallbackFlags gc_callback_flags = kNoGCCallbackFlags); |
| 2147 | 2131 |
| 2148 // Performs garbage collection | 2132 // Performs garbage collection |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2598 // or care about intergenerational references. All heap object pointers have to | 2582 // or care about intergenerational references. All heap object pointers have to |
| 2599 // point into the heap to a location that has a map pointer at its first word. | 2583 // point into the heap to a location that has a map pointer at its first word. |
| 2600 // Caveat: Heap::Contains is an approximation because it can return true for | 2584 // Caveat: Heap::Contains is an approximation because it can return true for |
| 2601 // objects in a heap space but above the allocation pointer. | 2585 // objects in a heap space but above the allocation pointer. |
| 2602 class VerifyPointersVisitor: public ObjectVisitor { | 2586 class VerifyPointersVisitor: public ObjectVisitor { |
| 2603 public: | 2587 public: |
| 2604 inline void VisitPointers(Object** start, Object** end); | 2588 inline void VisitPointers(Object** start, Object** end); |
| 2605 }; | 2589 }; |
| 2606 | 2590 |
| 2607 | 2591 |
| 2608 // Verify that all objects are Smis. | |
| 2609 class VerifySmisVisitor: public ObjectVisitor { | |
| 2610 public: | |
| 2611 inline void VisitPointers(Object** start, Object** end); | |
| 2612 }; | |
| 2613 | |
| 2614 | |
| 2615 // Space iterator for iterating over all spaces of the heap. Returns each space | 2592 // Space iterator for iterating over all spaces of the heap. Returns each space |
| 2616 // in turn, and null when it is done. | 2593 // in turn, and null when it is done. |
| 2617 class AllSpaces BASE_EMBEDDED { | 2594 class AllSpaces BASE_EMBEDDED { |
| 2618 public: | 2595 public: |
| 2619 explicit AllSpaces(Heap* heap) : heap_(heap), counter_(FIRST_SPACE) {} | 2596 explicit AllSpaces(Heap* heap) : heap_(heap), counter_(FIRST_SPACE) {} |
| 2620 Space* next(); | 2597 Space* next(); |
| 2621 private: | 2598 private: |
| 2622 Heap* heap_; | 2599 Heap* heap_; |
| 2623 int counter_; | 2600 int counter_; |
| 2624 }; | 2601 }; |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3114 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 3091 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
| 3115 | 3092 |
| 3116 private: | 3093 private: |
| 3117 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 3094 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 3118 }; | 3095 }; |
| 3119 #endif // DEBUG | 3096 #endif // DEBUG |
| 3120 | 3097 |
| 3121 } } // namespace v8::internal | 3098 } } // namespace v8::internal |
| 3122 | 3099 |
| 3123 #endif // V8_HEAP_H_ | 3100 #endif // V8_HEAP_H_ |
| OLD | NEW |