Changeset 187020 in webkit
- Timestamp:
- Jul 20, 2015 2:14:10 AM (9 years ago)
- Location:
- trunk/Source
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r187017 r187020 1 2015-07-20 Per Arne Vollan <peavo@outlook.com> 2 3 JavaScriptCore performance is very bad on Windows 4 https://bugs.webkit.org/show_bug.cgi?id=146448 5 6 Reviewed by Mark Lam. 7 8 Profiling shows that std::this_thread::get_id() is slow on Windows. 9 Use WTF::currentThread() instead, which calls GetCurrentThreadId(). 10 This is faster on Windows. The issue has been reported to Microsoft, 11 https://connect.microsoft.com/VisualStudio/feedback/details/1558211. 12 13 * runtime/JSLock.cpp: 14 (JSC::JSLockHolder::~JSLockHolder): 15 (JSC::JSLock::JSLock): 16 (JSC::JSLock::willDestroyVM): 17 (JSC::JSLock::setExclusiveThread): 18 (JSC::JSLock::lock): 19 (JSC::JSLock::unlock): 20 (JSC::JSLock::currentThreadIsHoldingLock): 21 * runtime/JSLock.h: 22 (JSC::JSLock::vm): 23 (JSC::JSLock::hasExclusiveThread): 24 (JSC::JSLock::exclusiveThread): 25 * runtime/VM.h: 26 (JSC::VM::hasExclusiveThread): 27 (JSC::VM::exclusiveThread): 28 (JSC::VM::setExclusiveThread): 29 1 30 2015-07-19 Yusuke Suzuki <utatane.tea@gmail.com> 2 31 -
trunk/Source/JavaScriptCore/runtime/JSLock.cpp
r186966 r187020 27 27 #include "JSObject.h" 28 28 #include "JSCInlines.h" 29 #include <thread>30 29 31 30 namespace JSC { … … 79 78 80 79 JSLock::JSLock(VM* vm) 81 : m_ownerThreadID( std::thread::id())80 : m_ownerThreadID(0) 82 81 , m_lockCount(0) 83 82 , m_lockDropDepth(0) … … 98 97 } 99 98 100 void JSLock::setExclusiveThread( std::thread::idthreadId)101 { 102 RELEASE_ASSERT(!m_lockCount && m_ownerThreadID == std::thread::id());103 m_hasExclusiveThread = (threadId != std::thread::id());99 void JSLock::setExclusiveThread(ThreadIdentifier threadId) 100 { 101 RELEASE_ASSERT(!m_lockCount && !m_ownerThreadID); 102 m_hasExclusiveThread = !!threadId; 104 103 m_ownerThreadID = threadId; 105 104 } … … 120 119 if (!m_hasExclusiveThread) { 121 120 m_lock.lock(); 122 m_ownerThreadID = std::this_thread::get_id();121 m_ownerThreadID = currentThread(); 123 122 } 124 123 ASSERT(!m_lockCount); … … 168 167 169 168 if (!m_hasExclusiveThread) { 170 m_ownerThreadID = std::thread::id();169 m_ownerThreadID = 0; 171 170 m_lock.unlock(); 172 171 } … … 201 200 bool JSLock::currentThreadIsHoldingLock() 202 201 { 203 ASSERT(!m_hasExclusiveThread || (exclusiveThread() == std::this_thread::get_id()));202 ASSERT(!m_hasExclusiveThread || (exclusiveThread() == currentThread())); 204 203 if (m_hasExclusiveThread) 205 204 return !!m_lockCount; 206 return m_ownerThreadID == std::this_thread::get_id();205 return m_ownerThreadID == currentThread(); 207 206 } 208 207 … … 211 210 { 212 211 if (m_hasExclusiveThread) { 213 ASSERT(exclusiveThread() == std::this_thread::get_id());212 ASSERT(exclusiveThread() == currentThread()); 214 213 return 0; 215 214 } -
trunk/Source/JavaScriptCore/runtime/JSLock.h
r173269 r187020 23 23 24 24 #include <mutex> 25 #include <thread>26 25 #include <wtf/Assertions.h> 27 26 #include <wtf/Noncopyable.h> 28 27 #include <wtf/RefPtr.h> 29 28 #include <wtf/ThreadSafeRefCounted.h> 29 #include <wtf/Threading.h> 30 30 #include <wtf/WTFThreadData.h> 31 31 … … 97 97 98 98 bool hasExclusiveThread() const { return m_hasExclusiveThread; } 99 std::thread::idexclusiveThread() const99 ThreadIdentifier exclusiveThread() const 100 100 { 101 101 ASSERT(m_hasExclusiveThread); 102 102 return m_ownerThreadID; 103 103 } 104 JS_EXPORT_PRIVATE void setExclusiveThread( std::thread::id);104 JS_EXPORT_PRIVATE void setExclusiveThread(ThreadIdentifier); 105 105 JS_EXPORT_PRIVATE bool currentThreadIsHoldingLock(); 106 106 … … 135 135 136 136 std::mutex m_lock; 137 std::thread::idm_ownerThreadID;137 ThreadIdentifier m_ownerThreadID; 138 138 intptr_t m_lockCount; 139 139 unsigned m_lockDropDepth; -
trunk/Source/JavaScriptCore/runtime/VM.h
r186966 r187020 500 500 501 501 bool hasExclusiveThread() const { return m_apiLock->hasExclusiveThread(); } 502 std::thread::idexclusiveThread() const { return m_apiLock->exclusiveThread(); }503 void setExclusiveThread( std::thread::idthreadId) { m_apiLock->setExclusiveThread(threadId); }502 ThreadIdentifier exclusiveThread() const { return m_apiLock->exclusiveThread(); } 503 void setExclusiveThread(ThreadIdentifier threadId) { m_apiLock->setExclusiveThread(threadId); } 504 504 505 505 JS_EXPORT_PRIVATE void resetDateCache(); -
trunk/Source/WTF/ChangeLog
r187019 r187020 1 2015-07-20 Per Arne Vollan <peavo@outlook.com> 2 3 JavaScriptCore performance is very bad on Windows 4 https://bugs.webkit.org/show_bug.cgi?id=146448 5 6 Reviewed by Mark Lam. 7 8 Updating the stack bounds is time consuming. 9 Only update the stack bounds when a new fiber is running. 10 11 * wtf/WTFThreadData.cpp: 12 (WTF::WTFThreadData::WTFThreadData): 13 * wtf/WTFThreadData.h: 14 (WTF::WTFThreadData::stack): 15 1 16 2015-07-20 Julien Brianceau <julien.brianceau@gmail.com> 2 17 -
trunk/Source/WTF/wtf/WTFThreadData.cpp
r165982 r187020 51 51 , m_savedStackPointerAtVMEntry(0) 52 52 , m_savedLastStackTop(stack().origin()) 53 #if OS(WINDOWS) 54 , m_lastFiber(nullptr) 55 #endif 53 56 { 54 57 AtomicStringTable::create(*this); -
trunk/Source/WTF/wtf/WTFThreadData.h
r183697 r187020 84 84 // See https://bugs.webkit.org/show_bug.cgi?id=102411 85 85 #if OS(WINDOWS) 86 m_stackBounds = StackBounds::currentThreadStackBounds(); 86 void* currentFiber = GetCurrentFiber(); 87 if (currentFiber != m_lastFiber) { 88 m_stackBounds = StackBounds::currentThreadStackBounds(); 89 m_lastFiber = currentFiber; 90 } 87 91 #endif 88 92 return m_stackBounds; … … 129 133 void* m_savedStackPointerAtVMEntry; 130 134 void* m_savedLastStackTop; 135 #if OS(WINDOWS) 136 void* m_lastFiber; 137 #endif 131 138 132 139 #if USE(PTHREAD_GETSPECIFIC_DIRECT) -
trunk/Source/WebCore/ChangeLog
r187018 r187020 1 2015-07-20 Per Arne Vollan <peavo@outlook.com> 2 3 JavaScriptCore performance is very bad on Windows 4 https://bugs.webkit.org/show_bug.cgi?id=146448 5 6 Reviewed by Mark Lam. 7 8 * bindings/js/JSDOMWindowBase.cpp: 9 (WebCore::JSDOMWindowBase::commonVM): Compile fix. 10 1 11 2015-07-19 Tim Horton <timothy_horton@apple.com> 2 12 -
trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp
r185721 r187020 204 204 vm = &VM::createLeaked(LargeHeap).leakRef(); 205 205 #if !PLATFORM(IOS) 206 vm->setExclusiveThread( std::this_thread::get_id());206 vm->setExclusiveThread(currentThread()); 207 207 #else 208 208 vm->heap.setFullActivityCallback(WebSafeFullGCActivityCallback::create(&vm->heap));
Note: See TracChangeset
for help on using the changeset viewer.