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

Side by Side Diff: third_party/WebKit/Source/platform/heap/Heap.h

Issue 2694173002: Remove thread-local weak processing (Closed)
Patch Set: temp Created 3 years, 10 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 | « no previous file | third_party/WebKit/Source/platform/heap/Heap.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 29 matching lines...) Expand all
40 #include "platform/heap/Visitor.h" 40 #include "platform/heap/Visitor.h"
41 #include "wtf/AddressSanitizer.h" 41 #include "wtf/AddressSanitizer.h"
42 #include "wtf/Allocator.h" 42 #include "wtf/Allocator.h"
43 #include "wtf/Assertions.h" 43 #include "wtf/Assertions.h"
44 #include "wtf/Atomics.h" 44 #include "wtf/Atomics.h"
45 #include "wtf/Forward.h" 45 #include "wtf/Forward.h"
46 #include <memory> 46 #include <memory>
47 47
48 namespace blink { 48 namespace blink {
49 49
50 class CallbackStack;
50 class PagePool; 51 class PagePool;
51 52
52 class PLATFORM_EXPORT HeapAllocHooks { 53 class PLATFORM_EXPORT HeapAllocHooks {
53 public: 54 public:
54 // TODO(hajimehoshi): Pass a type name of the allocated object. 55 // TODO(hajimehoshi): Pass a type name of the allocated object.
55 typedef void AllocationHook(Address, size_t, const char*); 56 typedef void AllocationHook(Address, size_t, const char*);
56 typedef void FreeHook(Address); 57 typedef void FreeHook(Address);
57 58
58 static void setAllocationHook(AllocationHook* hook) { 59 static void setAllocationHook(AllocationHook* hook) {
59 m_allocationHook = hook; 60 m_allocationHook = hook;
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 void attach(ThreadState*); 287 void attach(ThreadState*);
287 void detach(ThreadState*); 288 void detach(ThreadState*);
288 void lockThreadAttachMutex(); 289 void lockThreadAttachMutex();
289 void unlockThreadAttachMutex(); 290 void unlockThreadAttachMutex();
290 291
291 void visitPersistentRoots(Visitor*); 292 void visitPersistentRoots(Visitor*);
292 void visitStackRoots(Visitor*); 293 void visitStackRoots(Visitor*);
293 void enterSafePoint(ThreadState*); 294 void enterSafePoint(ThreadState*);
294 void leaveSafePoint(); 295 void leaveSafePoint();
295 296
296 // Add a weak pointer callback to the weak callback work list. General
297 // object pointer callbacks are added to a thread local weak callback work
298 // list and the callback is called on the thread that owns the object, with
299 // the closure pointer as an argument. Most of the time, the closure and
300 // the containerObject can be the same thing, but the containerObject is
301 // constrained to be on the heap, since the heap is used to identify the
302 // correct thread.
303 void pushThreadLocalWeakCallback(void* closure,
304 void* containerObject,
305 WeakCallback);
306
307 static RecursiveMutex& allHeapsMutex(); 297 static RecursiveMutex& allHeapsMutex();
308 static HashSet<ThreadHeap*>& allHeaps(); 298 static HashSet<ThreadHeap*>& allHeaps();
309 299
310 // Is the finalizable GC object still alive, but slated for lazy sweeping? 300 // Is the finalizable GC object still alive, but slated for lazy sweeping?
311 // If a lazy sweep is in progress, returns true if the object was found 301 // If a lazy sweep is in progress, returns true if the object was found
312 // to be not reachable during the marking phase, but it has yet to be swept 302 // to be not reachable during the marking phase, but it has yet to be swept
313 // and finalized. The predicate returns false in all other cases. 303 // and finalized. The predicate returns false in all other cases.
314 // 304 //
315 // Holding a reference to an already-dead object is not a valid state 305 // Holding a reference to an already-dead object is not a valid state
316 // to be in; willObjectBeLazilySwept() has undefined behavior if passed 306 // to be in; willObjectBeLazilySwept() has undefined behavior if passed
(...skipping 24 matching lines...) Expand all
341 } 331 }
342 332
343 // Push a trace callback on the marking stack. 333 // Push a trace callback on the marking stack.
344 void pushTraceCallback(void* containerObject, TraceCallback); 334 void pushTraceCallback(void* containerObject, TraceCallback);
345 335
346 // Push a trace callback on the post-marking callback stack. These 336 // Push a trace callback on the post-marking callback stack. These
347 // callbacks are called after normal marking (including ephemeron 337 // callbacks are called after normal marking (including ephemeron
348 // iteration). 338 // iteration).
349 void pushPostMarkingCallback(void*, TraceCallback); 339 void pushPostMarkingCallback(void*, TraceCallback);
350 340
351 // Similar to the more general pushThreadLocalWeakCallback, but cell 341 // Push a weak callback. The weak callback is called when the object
352 // pointer callbacks are added to a static callback work list and the weak 342 // doesn't get marked in the current GC.
353 // callback is performed on the thread performing garbage collection. This 343 void pushWeakCallback(void*, WeakCallback);
354 // is OK because cells are just cleared and no deallocation can happen.
355 void pushGlobalWeakCallback(void** cell, WeakCallback);
356 344
357 // Pop the top of a marking stack and call the callback with the visitor 345 // Pop the top of a marking stack and call the callback with the visitor
358 // and the object. Returns false when there is nothing more to do. 346 // and the object. Returns false when there is nothing more to do.
359 bool popAndInvokeTraceCallback(Visitor*); 347 bool popAndInvokeTraceCallback(Visitor*);
360 348
361 // Remove an item from the post-marking callback stack and call 349 // Remove an item from the post-marking callback stack and call
362 // the callback with the visitor and the object pointer. Returns 350 // the callback with the visitor and the object pointer. Returns
363 // false when there is nothing more to do. 351 // false when there is nothing more to do.
364 bool popAndInvokePostMarkingCallback(Visitor*); 352 bool popAndInvokePostMarkingCallback(Visitor*);
365 353
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 T** cell = reinterpret_cast<T**>(object); 683 T** cell = reinterpret_cast<T**>(object);
696 if (*cell && !ObjectAliveTrait<T>::isHeapObjectAlive(*cell)) 684 if (*cell && !ObjectAliveTrait<T>::isHeapObjectAlive(*cell))
697 *cell = nullptr; 685 *cell = nullptr;
698 } 686 }
699 687
700 } // namespace blink 688 } // namespace blink
701 689
702 #include "platform/heap/VisitorImpl.h" 690 #include "platform/heap/VisitorImpl.h"
703 691
704 #endif // Heap_h 692 #endif // Heap_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/heap/Heap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698