Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/heap/heap.h

Issue 2621873003: [heap, debugger] Introduce out-of-memory listener for debugger. (Closed)
Patch Set: remove isolate parameter of the callback Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/debug/debug-interface.h ('k') | src/heap/heap.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 // Clients of this interface shouldn't depend on lots of heap internals. 11 // Clients of this interface shouldn't depend on lots of heap internals.
12 // Do not include anything from src/heap here! 12 // Do not include anything from src/heap here!
13 #include "include/v8.h" 13 #include "include/v8.h"
14 #include "src/allocation.h" 14 #include "src/allocation.h"
15 #include "src/assert-scope.h" 15 #include "src/assert-scope.h"
16 #include "src/base/atomic-utils.h" 16 #include "src/base/atomic-utils.h"
17 #include "src/debug/debug-interface.h"
17 #include "src/globals.h" 18 #include "src/globals.h"
18 #include "src/heap-symbols.h" 19 #include "src/heap-symbols.h"
19 #include "src/list.h" 20 #include "src/list.h"
20 #include "src/objects.h" 21 #include "src/objects.h"
21 22
22 namespace v8 { 23 namespace v8 {
23 namespace internal { 24 namespace internal {
24 25
25 using v8::MemoryPressureLevel; 26 using v8::MemoryPressureLevel;
26 27
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 void CreateApiObjects(); 840 void CreateApiObjects();
840 841
841 // Implements the corresponding V8 API function. 842 // Implements the corresponding V8 API function.
842 bool IdleNotification(double deadline_in_seconds); 843 bool IdleNotification(double deadline_in_seconds);
843 bool IdleNotification(int idle_time_in_ms); 844 bool IdleNotification(int idle_time_in_ms);
844 845
845 void MemoryPressureNotification(MemoryPressureLevel level, 846 void MemoryPressureNotification(MemoryPressureLevel level,
846 bool is_isolate_locked); 847 bool is_isolate_locked);
847 void CheckMemoryPressure(); 848 void CheckMemoryPressure();
848 849
850 void SetOutOfMemoryCallback(v8::debug::OutOfMemoryCallback callback,
851 void* data);
852
849 double MonotonicallyIncreasingTimeInMs(); 853 double MonotonicallyIncreasingTimeInMs();
850 854
851 void RecordStats(HeapStats* stats, bool take_snapshot = false); 855 void RecordStats(HeapStats* stats, bool take_snapshot = false);
852 856
853 // Check new space expansion criteria and expand semispaces if it was hit. 857 // Check new space expansion criteria and expand semispaces if it was hit.
854 void CheckNewSpaceExpansionCriteria(); 858 void CheckNewSpaceExpansionCriteria();
855 859
856 void VisitExternalResources(v8::ExternalResourceVisitor* visitor); 860 void VisitExternalResources(v8::ExternalResourceVisitor* visitor);
857 861
858 // An object should be promoted if the object has survived a 862 // An object should be promoted if the object has survived a
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
1752 inline void UpdateAllocationsHash(uint32_t value); 1756 inline void UpdateAllocationsHash(uint32_t value);
1753 void PrintAlloctionsHash(); 1757 void PrintAlloctionsHash();
1754 1758
1755 void AddToRingBuffer(const char* string); 1759 void AddToRingBuffer(const char* string);
1756 void GetFromRingBuffer(char* buffer); 1760 void GetFromRingBuffer(char* buffer);
1757 1761
1758 void CompactRetainedMaps(ArrayList* retained_maps); 1762 void CompactRetainedMaps(ArrayList* retained_maps);
1759 1763
1760 void CollectGarbageOnMemoryPressure(); 1764 void CollectGarbageOnMemoryPressure();
1761 1765
1766 void InvokeOutOfMemoryCallback();
1767
1762 // Attempt to over-approximate the weak closure by marking object groups and 1768 // Attempt to over-approximate the weak closure by marking object groups and
1763 // implicit references from global handles, but don't atomically complete 1769 // implicit references from global handles, but don't atomically complete
1764 // marking. If we continue to mark incrementally, we might have marked 1770 // marking. If we continue to mark incrementally, we might have marked
1765 // objects that die later. 1771 // objects that die later.
1766 void FinalizeIncrementalMarking(GarbageCollectionReason gc_reason); 1772 void FinalizeIncrementalMarking(GarbageCollectionReason gc_reason);
1767 1773
1768 // Returns the timer used for a given GC type. 1774 // Returns the timer used for a given GC type.
1769 // - GCScavenger: young generation GC 1775 // - GCScavenger: young generation GC
1770 // - GCCompactor: full GC 1776 // - GCCompactor: full GC
1771 // - GCFinalzeMC: finalization of incremental full GC 1777 // - GCFinalzeMC: finalization of incremental full GC
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
2162 size_t survived_last_scavenge_; 2168 size_t survived_last_scavenge_;
2163 2169
2164 // This is not the depth of nested AlwaysAllocateScope's but rather a single 2170 // This is not the depth of nested AlwaysAllocateScope's but rather a single
2165 // count, as scopes can be acquired from multiple tasks (read: threads). 2171 // count, as scopes can be acquired from multiple tasks (read: threads).
2166 base::AtomicNumber<size_t> always_allocate_scope_count_; 2172 base::AtomicNumber<size_t> always_allocate_scope_count_;
2167 2173
2168 // Stores the memory pressure level that set by MemoryPressureNotification 2174 // Stores the memory pressure level that set by MemoryPressureNotification
2169 // and reset by a mark-compact garbage collection. 2175 // and reset by a mark-compact garbage collection.
2170 base::AtomicValue<MemoryPressureLevel> memory_pressure_level_; 2176 base::AtomicValue<MemoryPressureLevel> memory_pressure_level_;
2171 2177
2178 v8::debug::OutOfMemoryCallback out_of_memory_callback_;
2179 void* out_of_memory_callback_data_;
2180
2172 // For keeping track of context disposals. 2181 // For keeping track of context disposals.
2173 int contexts_disposed_; 2182 int contexts_disposed_;
2174 2183
2175 // The length of the retained_maps array at the time of context disposal. 2184 // The length of the retained_maps array at the time of context disposal.
2176 // This separates maps in the retained_maps array that were created before 2185 // This separates maps in the retained_maps array that were created before
2177 // and after context disposal. 2186 // and after context disposal.
2178 int number_of_disposed_maps_; 2187 int number_of_disposed_maps_;
2179 2188
2180 int global_ic_age_; 2189 int global_ic_age_;
2181 2190
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
2678 friend class LargeObjectSpace; 2687 friend class LargeObjectSpace;
2679 friend class NewSpace; 2688 friend class NewSpace;
2680 friend class PagedSpace; 2689 friend class PagedSpace;
2681 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); 2690 DISALLOW_COPY_AND_ASSIGN(AllocationObserver);
2682 }; 2691 };
2683 2692
2684 } // namespace internal 2693 } // namespace internal
2685 } // namespace v8 2694 } // namespace v8
2686 2695
2687 #endif // V8_HEAP_HEAP_H_ 2696 #endif // V8_HEAP_HEAP_H_
OLDNEW
« no previous file with comments | « src/debug/debug-interface.h ('k') | src/heap/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698