Changeset 163685 in webkit
- Timestamp:
- Feb 7, 2014 6:52:05 PM (10 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r163674 r163685 1 2014-02-07 Mark Lam <mark.lam@apple.com> 2 3 Unify JSLock implementation for iOS and non-iOS ports. 4 <https://webkit.org/b/128409> 5 6 Reviewed by Michael Saboff. 7 8 The iOS and non-iOS implementations of dropAllLocks(), 9 dropAllLocksUnconditionally(), and grabAllLocks() effectively do the 10 same work. The main difference is that the iOS implementation acquires 11 the JSLock spin lock in the DropAllLocks class while the other ports 12 acquire it when it calls JSLock::lock() and unlock(). 13 14 The other difference is that the iOS implementation will only increment 15 m_locksDropDepth if it actually drops locks, whereas other ports will 16 increment it unconditionally. Analogously, iOS decrements the depth only 17 when needed while other ports will decrement it unconditionally when 18 re-grabbing locks. 19 20 We can unify the 2 implementations by having both use the iOS 21 implementation for a start. 22 23 * runtime/JSLock.cpp: 24 (JSC::JSLock::dropAllLocks): 25 (JSC::JSLock::dropAllLocksUnconditionally): 26 (JSC::JSLock::grabAllLocks): 27 (JSC::JSLock::DropAllLocks::DropAllLocks): 28 (JSC::JSLock::DropAllLocks::~DropAllLocks): 29 1 30 2014-02-06 Filip Pizlo <fpizlo@apple.com> 2 31 -
trunk/Source/JavaScriptCore/runtime/JSLock.cpp
r163672 r163685 209 209 unsigned JSLock::dropAllLocks(SpinLock& spinLock) 210 210 { 211 #if PLATFORM(IOS)212 211 ASSERT_UNUSED(spinLock, spinLock.IsHeld()); 213 212 // Check if this thread is currently holding the lock. … … 232 231 m_lock.unlock(); 233 232 return lockCount; 234 #else235 if (m_lockDropDepth++)236 return 0;237 238 return dropAllLocksUnconditionally(spinLock);239 #endif240 233 } 241 234 242 235 unsigned JSLock::dropAllLocksUnconditionally(SpinLock& spinLock) 243 236 { 244 #if PLATFORM(IOS)245 237 ASSERT_UNUSED(spinLock, spinLock.IsHeld()); 246 238 // Check if this thread is currently holding the lock. … … 259 251 m_lock.unlock(); 260 252 return lockCount; 261 #else262 UNUSED_PARAM(spinLock);263 unsigned lockCount = m_lockCount;264 for (unsigned i = 0; i < lockCount; ++i)265 unlock();266 267 return lockCount;268 #endif269 253 } 270 254 271 255 void JSLock::grabAllLocks(unsigned lockCount, SpinLock& spinLock) 272 256 { 273 #if PLATFORM(IOS)274 257 ASSERT(spinLock.IsHeld()); 275 258 // If no locks were dropped, nothing to do! … … 294 277 m_lockCount = lockCount; 295 278 --m_lockDropDepth; 296 #else297 UNUSED_PARAM(spinLock);298 for (unsigned i = 0; i < lockCount; ++i)299 lock();300 301 --m_lockDropDepth;302 #endif303 279 } 304 280 … … 310 286 return; 311 287 SpinLock& spinLock = m_vm->apiLock().m_spinLock; 312 #if PLATFORM(IOS)313 288 SpinLockHolder holder(&spinLock); 314 #endif315 289 316 290 WTFThreadData& threadData = wtfThreadData(); … … 333 307 return; 334 308 SpinLock& spinLock = m_vm->apiLock().m_spinLock; 335 #if PLATFORM(IOS)336 309 SpinLockHolder holder(&spinLock); 337 #endif338 310 339 311 WTFThreadData& threadData = wtfThreadData(); … … 354 326 return; 355 327 SpinLock& spinLock = m_vm->apiLock().m_spinLock; 356 #if PLATFORM(IOS)357 328 SpinLockHolder holder(&spinLock); 358 #endif359 329 m_vm->apiLock().grabAllLocks(m_lockCount, spinLock); 360 330
Note: See TracChangeset
for help on using the changeset viewer.