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 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 | 667 |
668 // Converts the given boolean condition to JavaScript boolean value. | 668 // Converts the given boolean condition to JavaScript boolean value. |
669 inline Object* ToBoolean(bool condition); | 669 inline Object* ToBoolean(bool condition); |
670 | 670 |
671 // Check whether the heap is currently iterable. | 671 // Check whether the heap is currently iterable. |
672 bool IsHeapIterable(); | 672 bool IsHeapIterable(); |
673 | 673 |
674 // Notify the heap that a context has been disposed. | 674 // Notify the heap that a context has been disposed. |
675 int NotifyContextDisposed(bool dependant_context); | 675 int NotifyContextDisposed(bool dependant_context); |
676 | 676 |
677 inline void increment_scan_on_scavenge_pages() { | |
678 scan_on_scavenge_pages_++; | |
679 if (FLAG_gc_verbose) { | |
680 PrintF("Scan-on-scavenge pages: %d\n", scan_on_scavenge_pages_); | |
681 } | |
682 } | |
683 | |
684 inline void decrement_scan_on_scavenge_pages() { | |
685 scan_on_scavenge_pages_--; | |
686 if (FLAG_gc_verbose) { | |
687 PrintF("Scan-on-scavenge pages: %d\n", scan_on_scavenge_pages_); | |
688 } | |
689 } | |
690 | |
691 void set_native_contexts_list(Object* object) { | 677 void set_native_contexts_list(Object* object) { |
692 native_contexts_list_ = object; | 678 native_contexts_list_ = object; |
693 } | 679 } |
694 Object* native_contexts_list() const { return native_contexts_list_; } | 680 Object* native_contexts_list() const { return native_contexts_list_; } |
695 | 681 |
696 void set_allocation_sites_list(Object* object) { | 682 void set_allocation_sites_list(Object* object) { |
697 allocation_sites_list_ = object; | 683 allocation_sites_list_ = object; |
698 } | 684 } |
699 Object* allocation_sites_list() { return allocation_sites_list_; } | 685 Object* allocation_sites_list() { return allocation_sites_list_; } |
700 | 686 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
780 // scavenge operation. | 766 // scavenge operation. |
781 inline bool ShouldBePromoted(Address old_address, int object_size); | 767 inline bool ShouldBePromoted(Address old_address, int object_size); |
782 | 768 |
783 void ClearNormalizedMapCaches(); | 769 void ClearNormalizedMapCaches(); |
784 | 770 |
785 void IncrementDeferredCount(v8::Isolate::UseCounterFeature feature); | 771 void IncrementDeferredCount(v8::Isolate::UseCounterFeature feature); |
786 | 772 |
787 inline bool OldGenerationAllocationLimitReached(); | 773 inline bool OldGenerationAllocationLimitReached(); |
788 | 774 |
789 void QueueMemoryChunkForFree(MemoryChunk* chunk); | 775 void QueueMemoryChunkForFree(MemoryChunk* chunk); |
790 void FilterStoreBufferEntriesOnAboutToBeFreedPages(); | |
791 void FreeQueuedChunks(MemoryChunk* list_head); | 776 void FreeQueuedChunks(MemoryChunk* list_head); |
792 void FreeQueuedChunks(); | 777 void FreeQueuedChunks(); |
793 void WaitUntilUnmappingOfFreeChunksCompleted(); | 778 void WaitUntilUnmappingOfFreeChunksCompleted(); |
794 | 779 |
795 // Completely clear the Instanceof cache (to stop it keeping objects alive | 780 // Completely clear the Instanceof cache (to stop it keeping objects alive |
796 // around a GC). | 781 // around a GC). |
797 inline void CompletelyClearInstanceofCache(); | 782 inline void CompletelyClearInstanceofCache(); |
798 | 783 |
799 inline uint32_t HashSeed(); | 784 inline uint32_t HashSeed(); |
800 | 785 |
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1491 static const int kMaxMarkCompactsInIdleRound = 7; | 1476 static const int kMaxMarkCompactsInIdleRound = 7; |
1492 static const int kIdleScavengeThreshold = 5; | 1477 static const int kIdleScavengeThreshold = 5; |
1493 | 1478 |
1494 static const int kInitialFeedbackCapacity = 256; | 1479 static const int kInitialFeedbackCapacity = 256; |
1495 | 1480 |
1496 Heap(); | 1481 Heap(); |
1497 | 1482 |
1498 static String* UpdateNewSpaceReferenceInExternalStringTableEntry( | 1483 static String* UpdateNewSpaceReferenceInExternalStringTableEntry( |
1499 Heap* heap, Object** pointer); | 1484 Heap* heap, Object** pointer); |
1500 | 1485 |
1501 static void ScavengeStoreBufferCallback(Heap* heap, MemoryChunk* page, | |
1502 StoreBufferEvent event); | |
1503 | |
1504 // Selects the proper allocation space based on the pretenuring decision. | 1486 // Selects the proper allocation space based on the pretenuring decision. |
1505 static AllocationSpace SelectSpace(PretenureFlag pretenure) { | 1487 static AllocationSpace SelectSpace(PretenureFlag pretenure) { |
1506 return (pretenure == TENURED) ? OLD_SPACE : NEW_SPACE; | 1488 return (pretenure == TENURED) ? OLD_SPACE : NEW_SPACE; |
1507 } | 1489 } |
1508 | 1490 |
1509 #define ROOT_ACCESSOR(type, name, camel_name) \ | 1491 #define ROOT_ACCESSOR(type, name, camel_name) \ |
1510 inline void set_##name(type* value); | 1492 inline void set_##name(type* value); |
1511 ROOT_LIST(ROOT_ACCESSOR) | 1493 ROOT_LIST(ROOT_ACCESSOR) |
1512 #undef ROOT_ACCESSOR | 1494 #undef ROOT_ACCESSOR |
1513 | 1495 |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2008 // For keeping track of context disposals. | 1990 // For keeping track of context disposals. |
2009 int contexts_disposed_; | 1991 int contexts_disposed_; |
2010 | 1992 |
2011 // The length of the retained_maps array at the time of context disposal. | 1993 // The length of the retained_maps array at the time of context disposal. |
2012 // This separates maps in the retained_maps array that were created before | 1994 // This separates maps in the retained_maps array that were created before |
2013 // and after context disposal. | 1995 // and after context disposal. |
2014 int number_of_disposed_maps_; | 1996 int number_of_disposed_maps_; |
2015 | 1997 |
2016 int global_ic_age_; | 1998 int global_ic_age_; |
2017 | 1999 |
2018 int scan_on_scavenge_pages_; | |
2019 | |
2020 NewSpace new_space_; | 2000 NewSpace new_space_; |
2021 OldSpace* old_space_; | 2001 OldSpace* old_space_; |
2022 OldSpace* code_space_; | 2002 OldSpace* code_space_; |
2023 MapSpace* map_space_; | 2003 MapSpace* map_space_; |
2024 LargeObjectSpace* lo_space_; | 2004 LargeObjectSpace* lo_space_; |
2025 HeapState gc_state_; | 2005 HeapState gc_state_; |
2026 int gc_post_processing_depth_; | 2006 int gc_post_processing_depth_; |
2027 Address new_space_top_after_last_gc_; | 2007 Address new_space_top_after_last_gc_; |
2028 | 2008 |
2029 // Returns the amount of external memory registered since last global gc. | 2009 // Returns the amount of external memory registered since last global gc. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2077 | 2057 |
2078 // List of encountered weak collections (JSWeakMap and JSWeakSet) during | 2058 // List of encountered weak collections (JSWeakMap and JSWeakSet) during |
2079 // marking. It is initialized during marking, destroyed after marking and | 2059 // marking. It is initialized during marking, destroyed after marking and |
2080 // contains Smi(0) while marking is not active. | 2060 // contains Smi(0) while marking is not active. |
2081 Object* encountered_weak_collections_; | 2061 Object* encountered_weak_collections_; |
2082 | 2062 |
2083 Object* encountered_weak_cells_; | 2063 Object* encountered_weak_cells_; |
2084 | 2064 |
2085 Object* encountered_transition_arrays_; | 2065 Object* encountered_transition_arrays_; |
2086 | 2066 |
2087 StoreBufferRebuilder store_buffer_rebuilder_; | |
2088 | |
2089 List<GCCallbackPair> gc_epilogue_callbacks_; | 2067 List<GCCallbackPair> gc_epilogue_callbacks_; |
2090 List<GCCallbackPair> gc_prologue_callbacks_; | 2068 List<GCCallbackPair> gc_prologue_callbacks_; |
2091 | 2069 |
2092 // Total RegExp code ever generated | 2070 // Total RegExp code ever generated |
2093 double total_regexp_code_generated_; | 2071 double total_regexp_code_generated_; |
2094 | 2072 |
2095 int deferred_counters_[v8::Isolate::kUseCounterFeatureCount]; | 2073 int deferred_counters_[v8::Isolate::kUseCounterFeatureCount]; |
2096 | 2074 |
2097 GCTracer* tracer_; | 2075 GCTracer* tracer_; |
2098 | 2076 |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2655 | 2633 |
2656 private: | 2634 private: |
2657 friend class NewSpace; | 2635 friend class NewSpace; |
2658 DISALLOW_COPY_AND_ASSIGN(InlineAllocationObserver); | 2636 DISALLOW_COPY_AND_ASSIGN(InlineAllocationObserver); |
2659 }; | 2637 }; |
2660 | 2638 |
2661 } // namespace internal | 2639 } // namespace internal |
2662 } // namespace v8 | 2640 } // namespace v8 |
2663 | 2641 |
2664 #endif // V8_HEAP_HEAP_H_ | 2642 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |