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

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

Issue 2576453002: [heap] Create a thin wrapper around wrapper tracing in V8 to avoid misuse (Closed)
Patch Set: Use mocks Created 4 years 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
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
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 class AllocationObserver; 322 class AllocationObserver;
323 class ArrayBufferTracker; 323 class ArrayBufferTracker;
324 class GCIdleTimeAction; 324 class GCIdleTimeAction;
325 class GCIdleTimeHandler; 325 class GCIdleTimeHandler;
326 class GCIdleTimeHeapState; 326 class GCIdleTimeHeapState;
327 class GCTracer; 327 class GCTracer;
328 class HeapObjectsFilter; 328 class HeapObjectsFilter;
329 class HeapStats; 329 class HeapStats;
330 class HistogramTimer; 330 class HistogramTimer;
331 class Isolate; 331 class Isolate;
332 class LocalEmbedderHeapTracer;
332 class MemoryAllocator; 333 class MemoryAllocator;
333 class MemoryReducer; 334 class MemoryReducer;
334 class ObjectIterator; 335 class ObjectIterator;
335 class ObjectStats; 336 class ObjectStats;
336 class Page; 337 class Page;
337 class PagedSpace; 338 class PagedSpace;
338 class Scavenger; 339 class Scavenger;
339 class ScavengeJob; 340 class ScavengeJob;
340 class Space; 341 class Space;
341 class StoreBuffer; 342 class StoreBuffer;
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 GarbageCollectionReason gc_reason); 1202 GarbageCollectionReason gc_reason);
1202 1203
1203 void RegisterReservationsForBlackAllocation(Reservation* reservations); 1204 void RegisterReservationsForBlackAllocation(Reservation* reservations);
1204 1205
1205 IncrementalMarking* incremental_marking() { return incremental_marking_; } 1206 IncrementalMarking* incremental_marking() { return incremental_marking_; }
1206 1207
1207 // =========================================================================== 1208 // ===========================================================================
1208 // Embedder heap tracer support. ============================================= 1209 // Embedder heap tracer support. =============================================
1209 // =========================================================================== 1210 // ===========================================================================
1210 1211
1212 LocalEmbedderHeapTracer* local_embedder_heap_tracer() {
1213 return local_embedder_heap_tracer_;
1214 }
1211 void SetEmbedderHeapTracer(EmbedderHeapTracer* tracer); 1215 void SetEmbedderHeapTracer(EmbedderHeapTracer* tracer);
1212
1213 bool UsingEmbedderHeapTracer() { return embedder_heap_tracer() != nullptr; }
1214
1215 void TracePossibleWrapper(JSObject* js_object); 1216 void TracePossibleWrapper(JSObject* js_object);
1216
1217 void RegisterExternallyReferencedObject(Object** object); 1217 void RegisterExternallyReferencedObject(Object** object);
1218 1218
1219 void RegisterWrappersWithEmbedderHeapTracer();
1220
1221 // In order to avoid running out of memory we force tracing wrappers if there
1222 // are too many of them.
1223 bool RequiresImmediateWrapperProcessing();
1224
1225 EmbedderHeapTracer* embedder_heap_tracer() { return embedder_heap_tracer_; }
1226
1227 size_t wrappers_to_trace() { return wrappers_to_trace_.size(); }
1228 void clear_wrappers_to_trace() { wrappers_to_trace_.clear(); }
1229
1230 // =========================================================================== 1219 // ===========================================================================
1231 // External string table API. ================================================ 1220 // External string table API. ================================================
1232 // =========================================================================== 1221 // ===========================================================================
1233 1222
1234 // Registers an external string. 1223 // Registers an external string.
1235 inline void RegisterExternalString(String* string); 1224 inline void RegisterExternalString(String* string);
1236 1225
1237 // Finalizes an external string by deleting the associated external 1226 // Finalizes an external string by deleting the associated external
1238 // data and clearing the resource pointer. 1227 // data and clearing the resource pointer.
1239 inline void FinalizeExternalString(String* string); 1228 inline void FinalizeExternalString(String* string);
(...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after
2339 2328
2340 int gc_callbacks_depth_; 2329 int gc_callbacks_depth_;
2341 2330
2342 bool deserialization_complete_; 2331 bool deserialization_complete_;
2343 2332
2344 StrongRootsList* strong_roots_list_; 2333 StrongRootsList* strong_roots_list_;
2345 2334
2346 // The depth of HeapIterator nestings. 2335 // The depth of HeapIterator nestings.
2347 int heap_iterator_depth_; 2336 int heap_iterator_depth_;
2348 2337
2349 EmbedderHeapTracer* embedder_heap_tracer_; 2338 LocalEmbedderHeapTracer* local_embedder_heap_tracer_;
2350 std::vector<std::pair<void*, void*>> wrappers_to_trace_;
2351 2339
2352 // Used for testing purposes. 2340 // Used for testing purposes.
2353 bool force_oom_; 2341 bool force_oom_;
2354 bool delay_sweeper_tasks_for_testing_; 2342 bool delay_sweeper_tasks_for_testing_;
2355 2343
2356 // Classes in "heap" can be friends. 2344 // Classes in "heap" can be friends.
2357 friend class AlwaysAllocateScope; 2345 friend class AlwaysAllocateScope;
2358 friend class GCCallbacksScope; 2346 friend class GCCallbacksScope;
2359 friend class GCTracer; 2347 friend class GCTracer;
2360 friend class HeapIterator; 2348 friend class HeapIterator;
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
2666 friend class LargeObjectSpace; 2654 friend class LargeObjectSpace;
2667 friend class NewSpace; 2655 friend class NewSpace;
2668 friend class PagedSpace; 2656 friend class PagedSpace;
2669 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); 2657 DISALLOW_COPY_AND_ASSIGN(AllocationObserver);
2670 }; 2658 };
2671 2659
2672 } // namespace internal 2660 } // namespace internal
2673 } // namespace v8 2661 } // namespace v8
2674 2662
2675 #endif // V8_HEAP_HEAP_H_ 2663 #endif // V8_HEAP_HEAP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698