| 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 ASSERT(!state->isSweepInProgress()); | 191 ASSERT(!state->isSweepInProgress()); |
| 192 if (!acquireLoad(&m_canResume)) { | 192 if (!acquireLoad(&m_canResume)) { |
| 193 // If we are leaving the safepoint from a SafePointAwareMutexLocker | 193 // If we are leaving the safepoint from a SafePointAwareMutexLocker |
| 194 // call out to release the lock before going to sleep. This enables
the | 194 // call out to release the lock before going to sleep. This enables
the |
| 195 // lock to be acquired in the sweep phase, e.g. during weak processi
ng | 195 // lock to be acquired in the sweep phase, e.g. during weak processi
ng |
| 196 // or finalization. The SafePointAwareLocker will reenter the safepo
int | 196 // or finalization. The SafePointAwareLocker will reenter the safepo
int |
| 197 // and reacquire the lock after leaving this safepoint. | 197 // and reacquire the lock after leaving this safepoint. |
| 198 if (locker) | 198 if (locker) |
| 199 locker->reset(); | 199 locker->reset(); |
| 200 pushAllRegisters(this, state, parkAfterPushRegisters); | 200 pushAllRegisters(this, state, parkAfterPushRegisters); |
| 201 state->performPendingSweep(); | |
| 202 } | 201 } |
| 203 } | 202 } |
| 204 | 203 |
| 205 void enterSafePoint(ThreadState* state) | 204 void enterSafePoint(ThreadState* state) |
| 206 { | 205 { |
| 207 ASSERT(!state->isSweepInProgress()); | 206 ASSERT(!state->isSweepInProgress()); |
| 208 pushAllRegisters(this, state, enterSafePointAfterPushRegisters); | 207 pushAllRegisters(this, state, enterSafePointAfterPushRegisters); |
| 209 } | 208 } |
| 210 | 209 |
| 211 void leaveSafePoint(ThreadState* state, SafePointAwareMutexLocker* locker =
0) | 210 void leaveSafePoint(ThreadState* state, SafePointAwareMutexLocker* locker =
0) |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 void ThreadState::safePoint(StackState stackState) | 750 void ThreadState::safePoint(StackState stackState) |
| 752 { | 751 { |
| 753 checkThread(); | 752 checkThread(); |
| 754 performPendingGC(stackState); | 753 performPendingGC(stackState); |
| 755 ASSERT(!m_atSafePoint); | 754 ASSERT(!m_atSafePoint); |
| 756 m_stackState = stackState; | 755 m_stackState = stackState; |
| 757 m_atSafePoint = true; | 756 m_atSafePoint = true; |
| 758 s_safePointBarrier->checkAndPark(this); | 757 s_safePointBarrier->checkAndPark(this); |
| 759 m_atSafePoint = false; | 758 m_atSafePoint = false; |
| 760 m_stackState = HeapPointersOnStack; | 759 m_stackState = HeapPointersOnStack; |
| 760 performPendingSweep(); |
| 761 } | 761 } |
| 762 | 762 |
| 763 #ifdef ADDRESS_SANITIZER | 763 #ifdef ADDRESS_SANITIZER |
| 764 // When we are running under AddressSanitizer with detect_stack_use_after_return
=1 | 764 // When we are running under AddressSanitizer with detect_stack_use_after_return
=1 |
| 765 // then stack marker obtained from SafePointScope will point into a fake stack. | 765 // then stack marker obtained from SafePointScope will point into a fake stack. |
| 766 // Detect this case by checking if it falls in between current stack frame | 766 // Detect this case by checking if it falls in between current stack frame |
| 767 // and stack start and use an arbitrary high enough value for it. | 767 // and stack start and use an arbitrary high enough value for it. |
| 768 // Don't adjust stack marker in any other case to match behavior of code running | 768 // Don't adjust stack marker in any other case to match behavior of code running |
| 769 // without AddressSanitizer. | 769 // without AddressSanitizer. |
| 770 NO_SANITIZE_ADDRESS static void* adjustScopeMarkerForAdressSanitizer(void* scope
Marker) | 770 NO_SANITIZE_ADDRESS static void* adjustScopeMarkerForAdressSanitizer(void* scope
Marker) |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 threadAttachMutex().unlock(); | 915 threadAttachMutex().unlock(); |
| 916 return gcInfo; | 916 return gcInfo; |
| 917 } | 917 } |
| 918 } | 918 } |
| 919 if (needLockForIteration) | 919 if (needLockForIteration) |
| 920 threadAttachMutex().unlock(); | 920 threadAttachMutex().unlock(); |
| 921 return 0; | 921 return 0; |
| 922 } | 922 } |
| 923 #endif | 923 #endif |
| 924 } | 924 } |
| OLD | NEW |