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

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

Issue 2910203002: [api] Add an API function to set the GetExternallyAllocatedMemoryInBytesCallback. (Closed)
Patch Set: comment Created 3 years, 6 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/api.cc ('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 <vector> 9 #include <vector>
10 10
(...skipping 1157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1168 int flags, GarbageCollectionReason gc_reason, 1168 int flags, GarbageCollectionReason gc_reason,
1169 const GCCallbackFlags gc_callback_flags = kNoGCCallbackFlags); 1169 const GCCallbackFlags gc_callback_flags = kNoGCCallbackFlags);
1170 1170
1171 // Last hope GC, should try to squeeze as much as possible. 1171 // Last hope GC, should try to squeeze as much as possible.
1172 void CollectAllAvailableGarbage(GarbageCollectionReason gc_reason); 1172 void CollectAllAvailableGarbage(GarbageCollectionReason gc_reason);
1173 1173
1174 // Reports and external memory pressure event, either performs a major GC or 1174 // Reports and external memory pressure event, either performs a major GC or
1175 // completes incremental marking in order to free external resources. 1175 // completes incremental marking in order to free external resources.
1176 void ReportExternalMemoryPressure(); 1176 void ReportExternalMemoryPressure();
1177 1177
1178 typedef v8::Isolate::GetExternallyAllocatedMemoryInBytesCallback
1179 GetExternallyAllocatedMemoryInBytesCallback;
1180
1181 void SetGetExternallyAllocatedMemoryInBytesCallback(
1182 GetExternallyAllocatedMemoryInBytesCallback callback) {
1183 external_memory_callback_ = callback;
1184 }
1185
1178 // Invoked when GC was requested via the stack guard. 1186 // Invoked when GC was requested via the stack guard.
1179 void HandleGCRequest(); 1187 void HandleGCRequest();
1180 1188
1181 // =========================================================================== 1189 // ===========================================================================
1182 // Iterators. ================================================================ 1190 // Iterators. ================================================================
1183 // =========================================================================== 1191 // ===========================================================================
1184 1192
1185 // Iterates over all roots in the heap. 1193 // Iterates over all roots in the heap.
1186 void IterateRoots(RootVisitor* v, VisitMode mode); 1194 void IterateRoots(RootVisitor* v, VisitMode mode);
1187 // Iterates over all strong roots in the heap. 1195 // Iterates over all strong roots in the heap.
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
1657 Heap(); 1665 Heap();
1658 1666
1659 static String* UpdateNewSpaceReferenceInExternalStringTableEntry( 1667 static String* UpdateNewSpaceReferenceInExternalStringTableEntry(
1660 Heap* heap, Object** pointer); 1668 Heap* heap, Object** pointer);
1661 1669
1662 // Selects the proper allocation space based on the pretenuring decision. 1670 // Selects the proper allocation space based on the pretenuring decision.
1663 static AllocationSpace SelectSpace(PretenureFlag pretenure) { 1671 static AllocationSpace SelectSpace(PretenureFlag pretenure) {
1664 return (pretenure == TENURED) ? OLD_SPACE : NEW_SPACE; 1672 return (pretenure == TENURED) ? OLD_SPACE : NEW_SPACE;
1665 } 1673 }
1666 1674
1675 static size_t DefaultGetExternallyAllocatedMemoryInBytesCallback() {
1676 return 0;
1677 }
1678
1667 #define ROOT_ACCESSOR(type, name, camel_name) \ 1679 #define ROOT_ACCESSOR(type, name, camel_name) \
1668 inline void set_##name(type* value); 1680 inline void set_##name(type* value);
1669 ROOT_LIST(ROOT_ACCESSOR) 1681 ROOT_LIST(ROOT_ACCESSOR)
1670 #undef ROOT_ACCESSOR 1682 #undef ROOT_ACCESSOR
1671 1683
1672 StoreBuffer* store_buffer() { return store_buffer_; } 1684 StoreBuffer* store_buffer() { return store_buffer_; }
1673 1685
1674 void set_current_gc_flags(int flags) { 1686 void set_current_gc_flags(int flags) {
1675 current_gc_flags_ = flags; 1687 current_gc_flags_ = flags;
1676 DCHECK(!ShouldFinalizeIncrementalMarking() || 1688 DCHECK(!ShouldFinalizeIncrementalMarking() ||
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
2275 // contains Smi(0) while marking is not active. 2287 // contains Smi(0) while marking is not active.
2276 Object* encountered_weak_collections_; 2288 Object* encountered_weak_collections_;
2277 2289
2278 Object* encountered_weak_cells_; 2290 Object* encountered_weak_cells_;
2279 2291
2280 Object* encountered_transition_arrays_; 2292 Object* encountered_transition_arrays_;
2281 2293
2282 List<GCCallbackPair> gc_epilogue_callbacks_; 2294 List<GCCallbackPair> gc_epilogue_callbacks_;
2283 List<GCCallbackPair> gc_prologue_callbacks_; 2295 List<GCCallbackPair> gc_prologue_callbacks_;
2284 2296
2297 GetExternallyAllocatedMemoryInBytesCallback external_memory_callback_;
2298
2285 int deferred_counters_[v8::Isolate::kUseCounterFeatureCount]; 2299 int deferred_counters_[v8::Isolate::kUseCounterFeatureCount];
2286 2300
2287 GCTracer* tracer_; 2301 GCTracer* tracer_;
2288 2302
2289 size_t promoted_objects_size_; 2303 size_t promoted_objects_size_;
2290 double promotion_ratio_; 2304 double promotion_ratio_;
2291 double promotion_rate_; 2305 double promotion_rate_;
2292 size_t semi_space_copied_object_size_; 2306 size_t semi_space_copied_object_size_;
2293 size_t previous_semi_space_copied_object_size_; 2307 size_t previous_semi_space_copied_object_size_;
2294 double semi_space_copied_rate_; 2308 double semi_space_copied_rate_;
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
2660 friend class PagedSpace; 2674 friend class PagedSpace;
2661 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); 2675 DISALLOW_COPY_AND_ASSIGN(AllocationObserver);
2662 }; 2676 };
2663 2677
2664 V8_EXPORT_PRIVATE const char* AllocationSpaceName(AllocationSpace space); 2678 V8_EXPORT_PRIVATE const char* AllocationSpaceName(AllocationSpace space);
2665 2679
2666 } // namespace internal 2680 } // namespace internal
2667 } // namespace v8 2681 } // namespace v8
2668 2682
2669 #endif // V8_HEAP_HEAP_H_ 2683 #endif // V8_HEAP_HEAP_H_
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/heap/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698