| 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 using AttachedThreadStateSet = HashSet<ThreadState*>; | 253 using AttachedThreadStateSet = HashSet<ThreadState*>; |
| 254 static AttachedThreadStateSet& attachedThreads(); | 254 static AttachedThreadStateSet& attachedThreads(); |
| 255 | 255 |
| 256 // Initialize threading infrastructure. Should be called from the main | 256 // Initialize threading infrastructure. Should be called from the main |
| 257 // thread. | 257 // thread. |
| 258 static void init(); | 258 static void init(); |
| 259 static void shutdown(); | 259 static void shutdown(); |
| 260 static void shutdownHeapIfNecessary(); | 260 static void shutdownHeapIfNecessary(); |
| 261 bool isTerminating() { return m_isTerminating; } | 261 bool isTerminating() { return m_isTerminating; } |
| 262 | 262 |
| 263 bool lazySweepToken() { return m_lazySweepToggle; } |
| 264 |
| 263 static void attachMainThread(); | 265 static void attachMainThread(); |
| 264 static void detachMainThread(); | 266 static void detachMainThread(); |
| 265 | 267 |
| 266 // Trace all persistent roots, called when marking the managed heap objects. | 268 // Trace all persistent roots, called when marking the managed heap objects. |
| 267 static void visitPersistentRoots(Visitor*); | 269 static void visitPersistentRoots(Visitor*); |
| 268 | 270 |
| 269 // Trace all objects found on the stack, used when doing conservative GCs. | 271 // Trace all objects found on the stack, used when doing conservative GCs. |
| 270 static void visitStackRoots(Visitor*); | 272 static void visitStackRoots(Visitor*); |
| 271 | 273 |
| 272 // Associate ThreadState object with the current thread. After this | 274 // Associate ThreadState object with the current thread. After this |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 Vector<Interruptor*> m_interruptors; | 635 Vector<Interruptor*> m_interruptors; |
| 634 bool m_didV8GCAfterLastGC; | 636 bool m_didV8GCAfterLastGC; |
| 635 bool m_sweepForbidden; | 637 bool m_sweepForbidden; |
| 636 size_t m_noAllocationCount; | 638 size_t m_noAllocationCount; |
| 637 size_t m_allocatedObjectSizeBeforeGC; | 639 size_t m_allocatedObjectSizeBeforeGC; |
| 638 ThreadHeap* m_heaps[NumberOfHeaps]; | 640 ThreadHeap* m_heaps[NumberOfHeaps]; |
| 639 | 641 |
| 640 Vector<OwnPtr<CleanupTask>> m_cleanupTasks; | 642 Vector<OwnPtr<CleanupTask>> m_cleanupTasks; |
| 641 bool m_isTerminating; | 643 bool m_isTerminating; |
| 642 | 644 |
| 645 // Lazy sweeping will mark pages as having been swept as the |
| 646 // operation progresses. This is done by encoding the current |
| 647 // lazy sweep state of their ThreadState on the page. Just a |
| 648 // single bit is required, which is toggled when a new sweep |
| 649 // is initiated. |
| 650 bool m_lazySweepToggle; |
| 651 |
| 643 bool m_shouldFlushHeapDoesNotContainCache; | 652 bool m_shouldFlushHeapDoesNotContainCache; |
| 644 double m_collectionRate; | 653 double m_collectionRate; |
| 645 GCState m_gcState; | 654 GCState m_gcState; |
| 646 | 655 |
| 647 CallbackStack* m_weakCallbackStack; | 656 CallbackStack* m_weakCallbackStack; |
| 648 HashMap<void*, bool (*)(void*, Visitor&)> m_preFinalizers; | 657 HashMap<void*, bool (*)(void*, Visitor&)> m_preFinalizers; |
| 649 | 658 |
| 650 v8::Isolate* m_isolate; | 659 v8::Isolate* m_isolate; |
| 651 void (*m_traceDOMWrappers)(v8::Isolate*, Visitor*); | 660 void (*m_traceDOMWrappers)(v8::Isolate*, Visitor*); |
| 652 | 661 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 m_locked = false; | 734 m_locked = false; |
| 726 } | 735 } |
| 727 | 736 |
| 728 MutexBase& m_mutex; | 737 MutexBase& m_mutex; |
| 729 bool m_locked; | 738 bool m_locked; |
| 730 }; | 739 }; |
| 731 | 740 |
| 732 } // namespace blink | 741 } // namespace blink |
| 733 | 742 |
| 734 #endif // ThreadState_h | 743 #endif // ThreadState_h |
| OLD | NEW |