| OLD | NEW |
| 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 return isHeapObjectAlive(member.get()); | 266 return isHeapObjectAlive(member.get()); |
| 267 } | 267 } |
| 268 | 268 |
| 269 StackFrameDepth& stackFrameDepth() { return m_stackFrameDepth; } | 269 StackFrameDepth& stackFrameDepth() { return m_stackFrameDepth; } |
| 270 | 270 |
| 271 ThreadHeapStats& heapStats() { return m_stats; } | 271 ThreadHeapStats& heapStats() { return m_stats; } |
| 272 CallbackStack* markingStack() const { return m_markingStack.get(); } | 272 CallbackStack* markingStack() const { return m_markingStack.get(); } |
| 273 CallbackStack* postMarkingCallbackStack() const { | 273 CallbackStack* postMarkingCallbackStack() const { |
| 274 return m_postMarkingCallbackStack.get(); | 274 return m_postMarkingCallbackStack.get(); |
| 275 } | 275 } |
| 276 CallbackStack* globalWeakCallbackStack() const { | 276 CallbackStack* weakCallbackStack() const { return m_weakCallbackStack.get(); } |
| 277 return m_globalWeakCallbackStack.get(); | |
| 278 } | |
| 279 CallbackStack* ephemeronStack() const { return m_ephemeronStack.get(); } | 277 CallbackStack* ephemeronStack() const { return m_ephemeronStack.get(); } |
| 280 | 278 |
| 281 void visitPersistentRoots(Visitor*); | 279 void visitPersistentRoots(Visitor*); |
| 282 void visitStackRoots(Visitor*); | 280 void visitStackRoots(Visitor*); |
| 283 void enterSafePoint(ThreadState*); | 281 void enterSafePoint(ThreadState*); |
| 284 void leaveSafePoint(); | 282 void leaveSafePoint(); |
| 285 | 283 |
| 286 // Is the finalizable GC object still alive, but slated for lazy sweeping? | 284 // Is the finalizable GC object still alive, but slated for lazy sweeping? |
| 287 // If a lazy sweep is in progress, returns true if the object was found | 285 // If a lazy sweep is in progress, returns true if the object was found |
| 288 // to be not reachable during the marking phase, but it has yet to be swept | 286 // to be not reachable during the marking phase, but it has yet to be swept |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 bool popAndInvokeTraceCallback(Visitor*); | 331 bool popAndInvokeTraceCallback(Visitor*); |
| 334 | 332 |
| 335 // Remove an item from the post-marking callback stack and call | 333 // Remove an item from the post-marking callback stack and call |
| 336 // the callback with the visitor and the object pointer. Returns | 334 // the callback with the visitor and the object pointer. Returns |
| 337 // false when there is nothing more to do. | 335 // false when there is nothing more to do. |
| 338 bool popAndInvokePostMarkingCallback(Visitor*); | 336 bool popAndInvokePostMarkingCallback(Visitor*); |
| 339 | 337 |
| 340 // Remove an item from the weak callback work list and call the callback | 338 // Remove an item from the weak callback work list and call the callback |
| 341 // with the visitor and the closure pointer. Returns false when there is | 339 // with the visitor and the closure pointer. Returns false when there is |
| 342 // nothing more to do. | 340 // nothing more to do. |
| 343 bool popAndInvokeGlobalWeakCallback(Visitor*); | 341 bool popAndInvokeWeakCallback(Visitor*); |
| 344 | 342 |
| 345 // Register an ephemeron table for fixed-point iteration. | 343 // Register an ephemeron table for fixed-point iteration. |
| 346 void registerWeakTable(void* containerObject, | 344 void registerWeakTable(void* containerObject, |
| 347 EphemeronCallback, | 345 EphemeronCallback, |
| 348 EphemeronCallback); | 346 EphemeronCallback); |
| 349 #if DCHECK_IS_ON() | 347 #if DCHECK_IS_ON() |
| 350 bool weakTableRegistered(const void*); | 348 bool weakTableRegistered(const void*); |
| 351 #endif | 349 #endif |
| 352 | 350 |
| 353 // Heap compaction registration methods: | 351 // Heap compaction registration methods: |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 int arenaIndex, | 386 int arenaIndex, |
| 389 size_t gcInfoIndex, | 387 size_t gcInfoIndex, |
| 390 const char* typeName); | 388 const char* typeName); |
| 391 template <typename T> | 389 template <typename T> |
| 392 static Address allocate(size_t, bool eagerlySweep = false); | 390 static Address allocate(size_t, bool eagerlySweep = false); |
| 393 template <typename T> | 391 template <typename T> |
| 394 static Address reallocate(void* previous, size_t); | 392 static Address reallocate(void* previous, size_t); |
| 395 | 393 |
| 396 void processMarkingStack(Visitor*); | 394 void processMarkingStack(Visitor*); |
| 397 void postMarkingProcessing(Visitor*); | 395 void postMarkingProcessing(Visitor*); |
| 398 void globalWeakProcessing(Visitor*); | 396 void weakProcessing(Visitor*); |
| 399 | 397 |
| 400 void preGC(); | 398 void preGC(); |
| 401 void postGC(BlinkGC::GCType); | 399 void postGC(BlinkGC::GCType); |
| 402 void preSweep(BlinkGC::GCType); | 400 void preSweep(BlinkGC::GCType); |
| 403 | 401 |
| 404 // Conservatively checks whether an address is a pointer in any of the | 402 // Conservatively checks whether an address is a pointer in any of the |
| 405 // thread heaps. If so marks the object pointed to as live. | 403 // thread heaps. If so marks the object pointed to as live. |
| 406 Address checkAndMarkPointer(Visitor*, Address); | 404 Address checkAndMarkPointer(Visitor*, Address); |
| 407 #if DCHECK_IS_ON() | 405 #if DCHECK_IS_ON() |
| 408 Address checkAndMarkPointer(Visitor*, | 406 Address checkAndMarkPointer(Visitor*, |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 void commitCallbackStacks(); | 443 void commitCallbackStacks(); |
| 446 void decommitCallbackStacks(); | 444 void decommitCallbackStacks(); |
| 447 | 445 |
| 448 ThreadState* m_threadState; | 446 ThreadState* m_threadState; |
| 449 ThreadHeapStats m_stats; | 447 ThreadHeapStats m_stats; |
| 450 std::unique_ptr<RegionTree> m_regionTree; | 448 std::unique_ptr<RegionTree> m_regionTree; |
| 451 std::unique_ptr<HeapDoesNotContainCache> m_heapDoesNotContainCache; | 449 std::unique_ptr<HeapDoesNotContainCache> m_heapDoesNotContainCache; |
| 452 std::unique_ptr<PagePool> m_freePagePool; | 450 std::unique_ptr<PagePool> m_freePagePool; |
| 453 std::unique_ptr<CallbackStack> m_markingStack; | 451 std::unique_ptr<CallbackStack> m_markingStack; |
| 454 std::unique_ptr<CallbackStack> m_postMarkingCallbackStack; | 452 std::unique_ptr<CallbackStack> m_postMarkingCallbackStack; |
| 455 std::unique_ptr<CallbackStack> m_globalWeakCallbackStack; | 453 std::unique_ptr<CallbackStack> m_weakCallbackStack; |
| 456 std::unique_ptr<CallbackStack> m_ephemeronStack; | 454 std::unique_ptr<CallbackStack> m_ephemeronStack; |
| 457 BlinkGC::GCReason m_lastGCReason; | 455 BlinkGC::GCReason m_lastGCReason; |
| 458 StackFrameDepth m_stackFrameDepth; | 456 StackFrameDepth m_stackFrameDepth; |
| 459 | 457 |
| 460 std::unique_ptr<HeapCompact> m_compaction; | 458 std::unique_ptr<HeapCompact> m_compaction; |
| 461 | 459 |
| 462 static ThreadHeap* s_mainThreadHeap; | 460 static ThreadHeap* s_mainThreadHeap; |
| 463 | 461 |
| 464 friend class ThreadState; | 462 friend class ThreadState; |
| 465 }; | 463 }; |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 T** cell = reinterpret_cast<T**>(object); | 665 T** cell = reinterpret_cast<T**>(object); |
| 668 if (*cell && !ObjectAliveTrait<T>::isHeapObjectAlive(*cell)) | 666 if (*cell && !ObjectAliveTrait<T>::isHeapObjectAlive(*cell)) |
| 669 *cell = nullptr; | 667 *cell = nullptr; |
| 670 } | 668 } |
| 671 | 669 |
| 672 } // namespace blink | 670 } // namespace blink |
| 673 | 671 |
| 674 #include "platform/heap/VisitorImpl.h" | 672 #include "platform/heap/VisitorImpl.h" |
| 675 | 673 |
| 676 #endif // Heap_h | 674 #endif // Heap_h |
| OLD | NEW |