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