| 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 void postSweep(); | 242 void postSweep(); |
| 243 // makeConsistentForMutator() drops marks from marked objects and rebuild | 243 // makeConsistentForMutator() drops marks from marked objects and rebuild |
| 244 // free lists. This is called after taking a snapshot and before resuming | 244 // free lists. This is called after taking a snapshot and before resuming |
| 245 // the executions of mutators. | 245 // the executions of mutators. |
| 246 void makeConsistentForMutator(); | 246 void makeConsistentForMutator(); |
| 247 | 247 |
| 248 void compact(); | 248 void compact(); |
| 249 | 249 |
| 250 // Support for disallowing allocation. Mainly used for sanity | 250 // Support for disallowing allocation. Mainly used for sanity |
| 251 // checks asserts. | 251 // checks asserts. |
| 252 bool isAllocationAllowed() const { | 252 bool isAllocationAllowed() const { return !m_noAllocationCount; } |
| 253 return !isAtSafePoint() && !m_noAllocationCount; | |
| 254 } | |
| 255 void enterNoAllocationScope() { m_noAllocationCount++; } | 253 void enterNoAllocationScope() { m_noAllocationCount++; } |
| 256 void leaveNoAllocationScope() { m_noAllocationCount--; } | 254 void leaveNoAllocationScope() { m_noAllocationCount--; } |
| 257 bool isWrapperTracingForbidden() { return isMixinInConstruction(); } | 255 bool isWrapperTracingForbidden() { return isMixinInConstruction(); } |
| 258 bool isGCForbidden() const { | 256 bool isGCForbidden() const { |
| 259 return m_gcForbiddenCount || isMixinInConstruction(); | 257 return m_gcForbiddenCount || isMixinInConstruction(); |
| 260 } | 258 } |
| 261 void enterGCForbiddenScope() { m_gcForbiddenCount++; } | 259 void enterGCForbiddenScope() { m_gcForbiddenCount++; } |
| 262 void leaveGCForbiddenScope() { | 260 void leaveGCForbiddenScope() { |
| 263 DCHECK_GE(m_gcForbiddenCount, 0u); | 261 DCHECK_GE(m_gcForbiddenCount, 0u); |
| 264 m_gcForbiddenCount--; | 262 m_gcForbiddenCount--; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 // (e.g. BlinkGCInterruptor for JavaScript code) | 324 // (e.g. BlinkGCInterruptor for JavaScript code) |
| 327 // | 325 // |
| 328 | 326 |
| 329 // Check if GC is requested by another thread and pause this thread if this is | 327 // Check if GC is requested by another thread and pause this thread if this is |
| 330 // the case. Can only be called when current thread is in a consistent state. | 328 // the case. Can only be called when current thread is in a consistent state. |
| 331 void safePoint(BlinkGC::StackState); | 329 void safePoint(BlinkGC::StackState); |
| 332 | 330 |
| 333 // Mark current thread as running inside safepoint. | 331 // Mark current thread as running inside safepoint. |
| 334 void enterSafePoint(BlinkGC::StackState, void*); | 332 void enterSafePoint(BlinkGC::StackState, void*); |
| 335 void leaveSafePoint(); | 333 void leaveSafePoint(); |
| 336 bool isAtSafePoint() const { return m_atSafePoint; } | |
| 337 | 334 |
| 338 void addInterruptor(std::unique_ptr<BlinkGCInterruptor>); | 335 void addInterruptor(std::unique_ptr<BlinkGCInterruptor>); |
| 339 | 336 |
| 340 void recordStackEnd(intptr_t* endOfStack) { m_endOfStack = endOfStack; } | 337 void recordStackEnd(intptr_t* endOfStack) { m_endOfStack = endOfStack; } |
| 341 | 338 |
| 342 // Get one of the heap structures for this thread. | 339 // Get one of the heap structures for this thread. |
| 343 // The thread heap is split into multiple heap parts based on object types | 340 // The thread heap is split into multiple heap parts based on object types |
| 344 // and object sizes. | 341 // and object sizes. |
| 345 BaseArena* arena(int arenaIndex) const { | 342 BaseArena* arena(int arenaIndex) const { |
| 346 ASSERT(0 <= arenaIndex); | 343 ASSERT(0 <= arenaIndex); |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 | 629 |
| 633 ThreadHeap* m_heap; | 630 ThreadHeap* m_heap; |
| 634 ThreadIdentifier m_thread; | 631 ThreadIdentifier m_thread; |
| 635 std::unique_ptr<PersistentRegion> m_persistentRegion; | 632 std::unique_ptr<PersistentRegion> m_persistentRegion; |
| 636 BlinkGC::StackState m_stackState; | 633 BlinkGC::StackState m_stackState; |
| 637 intptr_t* m_startOfStack; | 634 intptr_t* m_startOfStack; |
| 638 intptr_t* m_endOfStack; | 635 intptr_t* m_endOfStack; |
| 639 | 636 |
| 640 void* m_safePointScopeMarker; | 637 void* m_safePointScopeMarker; |
| 641 Vector<Address> m_safePointStackCopy; | 638 Vector<Address> m_safePointStackCopy; |
| 642 bool m_atSafePoint; | |
| 643 Vector<std::unique_ptr<BlinkGCInterruptor>> m_interruptors; | 639 Vector<std::unique_ptr<BlinkGCInterruptor>> m_interruptors; |
| 644 bool m_sweepForbidden; | 640 bool m_sweepForbidden; |
| 645 size_t m_noAllocationCount; | 641 size_t m_noAllocationCount; |
| 646 size_t m_gcForbiddenCount; | 642 size_t m_gcForbiddenCount; |
| 647 size_t m_mixinsBeingConstructedCount; | 643 size_t m_mixinsBeingConstructedCount; |
| 648 double m_accumulatedSweepingTime; | 644 double m_accumulatedSweepingTime; |
| 649 | 645 |
| 650 BaseArena* m_arenas[BlinkGC::NumberOfArenas]; | 646 BaseArena* m_arenas[BlinkGC::NumberOfArenas]; |
| 651 int m_vectorBackingArenaIndex; | 647 int m_vectorBackingArenaIndex; |
| 652 size_t m_arenaAges[BlinkGC::NumberOfArenas]; | 648 size_t m_arenaAges[BlinkGC::NumberOfArenas]; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 class ThreadStateFor<AnyThread> { | 715 class ThreadStateFor<AnyThread> { |
| 720 STATIC_ONLY(ThreadStateFor); | 716 STATIC_ONLY(ThreadStateFor); |
| 721 | 717 |
| 722 public: | 718 public: |
| 723 static ThreadState* state() { return ThreadState::current(); } | 719 static ThreadState* state() { return ThreadState::current(); } |
| 724 }; | 720 }; |
| 725 | 721 |
| 726 } // namespace blink | 722 } // namespace blink |
| 727 | 723 |
| 728 #endif // ThreadState_h | 724 #endif // ThreadState_h |
| OLD | NEW |