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

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

Issue 2694173002: Remove thread-local weak processing (Closed)
Patch Set: 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
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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 void attach(ThreadState*); 286 void attach(ThreadState*);
287 void detach(ThreadState*); 287 void detach(ThreadState*);
288 void lockThreadAttachMutex(); 288 void lockThreadAttachMutex();
289 void unlockThreadAttachMutex(); 289 void unlockThreadAttachMutex();
290 290
291 void visitPersistentRoots(Visitor*); 291 void visitPersistentRoots(Visitor*);
292 void visitStackRoots(Visitor*); 292 void visitStackRoots(Visitor*);
293 void enterSafePoint(ThreadState*); 293 void enterSafePoint(ThreadState*);
294 void leaveSafePoint(ThreadState*, SafePointAwareMutexLocker*); 294 void leaveSafePoint(ThreadState*, SafePointAwareMutexLocker*);
295 295
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(); 296 static RecursiveMutex& allHeapsMutex();
308 static HashSet<ThreadHeap*>& allHeaps(); 297 static HashSet<ThreadHeap*>& allHeaps();
309 298
310 // Is the finalizable GC object still alive, but slated for lazy sweeping? 299 // 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 300 // 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 301 // 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. 302 // and finalized. The predicate returns false in all other cases.
314 // 303 //
315 // Holding a reference to an already-dead object is not a valid state 304 // Holding a reference to an already-dead object is not a valid state
316 // to be in; willObjectBeLazilySwept() has undefined behavior if passed 305 // to be in; willObjectBeLazilySwept() has undefined behavior if passed
(...skipping 24 matching lines...) Expand all
341 } 330 }
342 331
343 // Push a trace callback on the marking stack. 332 // Push a trace callback on the marking stack.
344 void pushTraceCallback(void* containerObject, TraceCallback); 333 void pushTraceCallback(void* containerObject, TraceCallback);
345 334
346 // Push a trace callback on the post-marking callback stack. These 335 // Push a trace callback on the post-marking callback stack. These
347 // callbacks are called after normal marking (including ephemeron 336 // callbacks are called after normal marking (including ephemeron
348 // iteration). 337 // iteration).
349 void pushPostMarkingCallback(void*, TraceCallback); 338 void pushPostMarkingCallback(void*, TraceCallback);
350 339
351 // Similar to the more general pushThreadLocalWeakCallback, but cell 340 // 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 341 // doesn't get marked in the current GC.
353 // callback is performed on the thread performing garbage collection. This 342 void pushWeakCallback(void*, WeakCallback);
354 // is OK because cells are just cleared and no deallocation can happen.
355 void pushGlobalWeakCallback(void** cell, WeakCallback);
356 343
357 // Pop the top of a marking stack and call the callback with the visitor 344 // 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. 345 // and the object. Returns false when there is nothing more to do.
359 bool popAndInvokeTraceCallback(Visitor*); 346 bool popAndInvokeTraceCallback(Visitor*);
360 347
361 // Remove an item from the post-marking callback stack and call 348 // Remove an item from the post-marking callback stack and call
362 // the callback with the visitor and the object pointer. Returns 349 // the callback with the visitor and the object pointer. Returns
363 // false when there is nothing more to do. 350 // false when there is nothing more to do.
364 bool popAndInvokePostMarkingCallback(Visitor*); 351 bool popAndInvokePostMarkingCallback(Visitor*);
365 352
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 T** cell = reinterpret_cast<T**>(object); 682 T** cell = reinterpret_cast<T**>(object);
696 if (*cell && !ObjectAliveTrait<T>::isHeapObjectAlive(*cell)) 683 if (*cell && !ObjectAliveTrait<T>::isHeapObjectAlive(*cell))
697 *cell = nullptr; 684 *cell = nullptr;
698 } 685 }
699 686
700 } // namespace blink 687 } // namespace blink
701 688
702 #include "platform/heap/VisitorImpl.h" 689 #include "platform/heap/VisitorImpl.h"
703 690
704 #endif // Heap_h 691 #endif // Heap_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/heap/Heap.cpp » ('j') | third_party/WebKit/Source/platform/heap/Heap.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698