| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef SafePoint_h | 5 #ifndef SafePoint_h |
| 6 #define SafePoint_h | 6 #define SafePoint_h |
| 7 | 7 |
| 8 #include "platform/heap/ThreadState.h" | 8 #include "platform/heap/ThreadState.h" |
| 9 #include "wtf/ThreadingPrimitives.h" | 9 #include "wtf/ThreadingPrimitives.h" |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 ~SafePointScope() { | 26 ~SafePointScope() { |
| 27 if (m_state) | 27 if (m_state) |
| 28 m_state->leaveSafePoint(); | 28 m_state->leaveSafePoint(); |
| 29 } | 29 } |
| 30 | 30 |
| 31 private: | 31 private: |
| 32 ThreadState* m_state; | 32 ThreadState* m_state; |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 class SafePointBarrier final { | |
| 36 USING_FAST_MALLOC(SafePointBarrier); | |
| 37 WTF_MAKE_NONCOPYABLE(SafePointBarrier); | |
| 38 | |
| 39 public: | |
| 40 SafePointBarrier(); | |
| 41 ~SafePointBarrier(); | |
| 42 | |
| 43 void enterSafePoint(ThreadState*); | |
| 44 void leaveSafePoint(); | |
| 45 | |
| 46 private: | |
| 47 void doPark(ThreadState*, intptr_t* stackEnd); | |
| 48 void doEnterSafePoint(ThreadState*, intptr_t* stackEnd); | |
| 49 static void enterSafePointAfterPushRegisters(SafePointBarrier* barrier, | |
| 50 ThreadState* state, | |
| 51 intptr_t* stackEnd) { | |
| 52 barrier->doEnterSafePoint(state, stackEnd); | |
| 53 } | |
| 54 Mutex m_mutex; | |
| 55 }; | |
| 56 | |
| 57 } // namespace blink | 35 } // namespace blink |
| 58 | 36 |
| 59 #endif | 37 #endif |
| OLD | NEW |