Changeset 213231 in webkit
- Timestamp:
- Mar 1, 2017 10:51:02 AM (7 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 1 deleted
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r213229 r213231 1 2017-03-01 Mark Lam <mark.lam@apple.com> 2 3 REGRESSION (r213202?): Assertion failed: (!"initialized()"), function operator(). 4 https://bugs.webkit.org/show_bug.cgi?id=169042 5 6 Not reviewed. 7 8 Rolling out r213229 and r213202. 9 10 * JavaScriptCore.xcodeproj/project.pbxproj: 11 * heap/MachineStackMarker.cpp: 12 (JSC::getCurrentPlatformThread): 13 (JSC::MachineThreads::Thread::createForCurrentThread): 14 (JSC::MachineThreads::machineThreadForCurrentThread): 15 (JSC::MachineThreads::removeThread): 16 (JSC::MachineThreads::Thread::suspend): 17 (JSC::MachineThreads::tryCopyOtherThreadStacks): 18 * heap/MachineStackMarker.h: 19 * runtime/JSCellInlines.h: 20 (JSC::JSCell::classInfo): 21 * runtime/JSLock.cpp: 22 (JSC::JSLock::JSLock): 23 (JSC::JSLock::lock): 24 (JSC::JSLock::unlock): 25 (JSC::JSLock::currentThreadIsHoldingLock): 26 * runtime/JSLock.h: 27 (JSC::JSLock::ownerThread): 28 (JSC::JSLock::currentThreadIsHoldingLock): Deleted. 29 * runtime/PlatformThread.h: Removed. 30 * runtime/VM.cpp: 31 (JSC::VM::~VM): 32 * runtime/VM.h: 33 (JSC::VM::ownerThread): 34 * runtime/Watchdog.cpp: 35 (JSC::Watchdog::setTimeLimit): 36 (JSC::Watchdog::shouldTerminate): 37 (JSC::Watchdog::startTimer): 38 (JSC::Watchdog::stopTimer): 39 * tools/JSDollarVMPrototype.cpp: 40 (JSC::JSDollarVMPrototype::currentThreadOwnsJSLock): 41 * tools/VMInspector.cpp: 42 1 43 2017-03-01 Mark Lam <mark.lam@apple.com> 2 44 -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r213209 r213231 2424 2424 FED94F2E171E3E2300BE77A4 /* Watchdog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FED94F2B171E3E2300BE77A4 /* Watchdog.cpp */; }; 2425 2425 FED94F2F171E3E2300BE77A4 /* Watchdog.h in Headers */ = {isa = PBXBuildFile; fileRef = FED94F2C171E3E2300BE77A4 /* Watchdog.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2426 FEE43FCE1E6641710077D6D1 /* PlatformThread.h in Headers */ = {isa = PBXBuildFile; fileRef = FEE43FCD1E6641400077D6D1 /* PlatformThread.h */; settings = {ATTRIBUTES = (Private, ); }; };2427 2426 FEF040511AAE662D00BD28B0 /* CompareAndSwapTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEF040501AAE662D00BD28B0 /* CompareAndSwapTest.cpp */; }; 2428 2427 FEFD6FC61D5E7992008F2F0B /* JSStringInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = FEFD6FC51D5E7970008F2F0B /* JSStringInlines.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 5005 5004 FEDA50D41B97F442009A3B4F /* PingPongStackOverflowTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PingPongStackOverflowTest.cpp; path = API/tests/PingPongStackOverflowTest.cpp; sourceTree = "<group>"; }; 5006 5005 FEDA50D51B97F4D9009A3B4F /* PingPongStackOverflowTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PingPongStackOverflowTest.h; path = API/tests/PingPongStackOverflowTest.h; sourceTree = "<group>"; }; 5007 FEE43FCD1E6641400077D6D1 /* PlatformThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformThread.h; sourceTree = "<group>"; };5008 5006 FEF040501AAE662D00BD28B0 /* CompareAndSwapTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CompareAndSwapTest.cpp; path = API/tests/CompareAndSwapTest.cpp; sourceTree = "<group>"; }; 5009 5007 FEF040521AAEC4ED00BD28B0 /* CompareAndSwapTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CompareAndSwapTest.h; path = API/tests/CompareAndSwapTest.h; sourceTree = "<group>"; }; … … 6735 6733 0FE228EA1436AB2300196C48 /* Options.cpp */, 6736 6734 0FE228EB1436AB2300196C48 /* Options.h */, 6737 FEE43FCD1E6641400077D6D1 /* PlatformThread.h */,6738 6735 868916A9155F285400CB2B9A /* PrivateName.h */, 6739 6736 147341DF1DC2CE9600AA29BA /* ProgramExecutable.cpp */, … … 9178 9175 705B41AC1A6E501E00716757 /* Symbol.h in Headers */, 9179 9176 705B41AE1A6E501E00716757 /* SymbolConstructor.h in Headers */, 9180 FEE43FCE1E6641710077D6D1 /* PlatformThread.h in Headers */,9181 9177 996B73271BDA08EF00331B84 /* SymbolConstructor.lut.h in Headers */, 9182 9178 705B41B01A6E501E00716757 /* SymbolObject.h in Headers */, -
trunk/Source/JavaScriptCore/heap/MachineStackMarker.cpp
r213202 r213231 180 180 } 181 181 182 static inline PlatformThread getCurrentPlatformThread() 183 { 184 #if OS(DARWIN) 185 return pthread_mach_thread_np(pthread_self()); 186 #elif OS(WINDOWS) 187 return GetCurrentThreadId(); 188 #elif USE(PTHREADS) 189 return pthread_self(); 190 #endif 191 } 192 182 193 MachineThreads::MachineThreads() 183 194 : m_registeredThreads(0) … … 204 215 { 205 216 auto stackBounds = wtfThreadData().stack(); 206 return new Thread( currentPlatformThread(), stackBounds.origin(), stackBounds.end());217 return new Thread(getCurrentPlatformThread(), stackBounds.origin(), stackBounds.end()); 207 218 } 208 219 … … 240 251 { 241 252 LockHolder lock(m_registeredThreadsMutex); 242 PlatformThread platformThread = currentPlatformThread();253 PlatformThread platformThread = getCurrentPlatformThread(); 243 254 for (Thread* thread = m_registeredThreads; thread; thread = thread->next) { 244 255 if (*thread == platformThread) … … 272 283 #endif 273 284 274 machineThreads->removeThreadIfFound( currentPlatformThread());285 machineThreads->removeThreadIfFound(getCurrentPlatformThread()); 275 286 } 276 287 } … … 365 376 return threadIsSuspended; 366 377 #elif USE(PTHREADS) 367 ASSERT_WITH_MESSAGE( currentPlatformThread() != platformThread, "Currently we don't support suspend the current thread itself.");378 ASSERT_WITH_MESSAGE(getCurrentPlatformThread() != platformThread, "Currently we don't support suspend the current thread itself."); 368 379 { 369 380 // During suspend, suspend or resume should not be executed from the other threads. … … 938 949 *size = 0; 939 950 940 PlatformThread platformThread = currentPlatformThread();951 PlatformThread currentPlatformThread = getCurrentPlatformThread(); 941 952 int numberOfThreads = 0; // Using 0 to denote that we haven't counted the number of threads yet. 942 953 int index = 1; … … 945 956 Thread* previousThread = nullptr; 946 957 for (Thread* thread = m_registeredThreads; thread; index++) { 947 if (*thread != platformThread) {958 if (*thread != currentPlatformThread) { 948 959 bool success = thread->suspend(); 949 960 #if OS(DARWIN) … … 989 1000 990 1001 for (Thread* thread = m_registeredThreads; thread; thread = thread->next) { 991 if (*thread != platformThread)1002 if (*thread != currentPlatformThread) 992 1003 tryCopyOtherThreadStack(thread, buffer, capacity, size); 993 1004 } 994 1005 995 1006 for (Thread* thread = m_registeredThreads; thread; thread = thread->next) { 996 if (*thread != platformThread)1007 if (*thread != currentPlatformThread) 997 1008 thread->resume(); 998 1009 } -
trunk/Source/JavaScriptCore/heap/MachineStackMarker.h
r213202 r213231 22 22 #pragma once 23 23 24 #include "PlatformThread.h"25 24 #include "RegisterState.h" 26 25 #include <wtf/Lock.h> … … 28 27 #include <wtf/ScopedLambda.h> 29 28 #include <wtf/ThreadSpecific.h> 29 30 #if OS(DARWIN) 31 #include <mach/thread_act.h> 32 #endif 30 33 31 34 #if USE(PTHREADS) && !OS(WINDOWS) && !OS(DARWIN) … … 40 43 #endif 41 44 #endif 45 46 #if OS(DARWIN) 47 typedef mach_port_t PlatformThread; 48 #elif OS(WINDOWS) 49 typedef DWORD PlatformThread; 50 #elif USE(PTHREADS) 51 typedef pthread_t PlatformThread; 52 #endif // OS(DARWIN) 42 53 43 54 namespace JSC { -
trunk/Source/JavaScriptCore/runtime/JSCellInlines.h
r213202 r213231 279 279 // invalid). If mutatorState() == MutatorState::Running, then we're not currently sweeping, and therefore cannot be 280 280 // destructing the object. The GC thread or JIT threads, unlike the mutator thread, are able to access classInfo 281 // independent of whether the mutator thread is sweeping or not. Hence, we also check for !currentThreadIsHoldingAPILock()282 // to allow the GC thread or JIT threads to pass this assertion.283 ASSERT(vm.heap.mutatorState() != MutatorState::Sweeping || !vm.currentThreadIsHoldingAPILock());281 // independent of whether the mutator thread is sweeping or not. Hence, we also check for ownerThread() != 282 // std::this_thread::get_id() to allow the GC thread or JIT threads to pass this assertion. 283 ASSERT(vm.heap.mutatorState() != MutatorState::Sweeping || vm.apiLock().ownerThread() != std::this_thread::get_id()); 284 284 return structure(vm)->classInfo(); 285 285 } -
trunk/Source/JavaScriptCore/runtime/JSLock.cpp
r213202 r213231 76 76 77 77 JSLock::JSLock(VM* vm) 78 : m_lockCount(0) 78 : m_ownerThreadID(std::thread::id()) 79 , m_lockCount(0) 79 80 , m_lockDropDepth(0) 80 81 , m_vm(vm) … … 110 111 } 111 112 112 m_ownerThread = currentPlatformThread();113 m_ownerThreadID = std::this_thread::get_id(); 113 114 ASSERT(!m_lockCount); 114 115 m_lockCount = lockCount; … … 168 169 169 170 if (!m_lockCount) { 170 m_ownerThread = { };171 m_ownerThreadID = std::thread::id(); 171 172 m_lock.unlock(); 172 173 } … … 200 201 { 201 202 exec->vm().apiLock().unlock(); 203 } 204 205 bool JSLock::currentThreadIsHoldingLock() 206 { 207 return m_ownerThreadID == std::this_thread::get_id(); 202 208 } 203 209 -
trunk/Source/JavaScriptCore/runtime/JSLock.h
r213229 r213231 21 21 #pragma once 22 22 23 #include "PlatformThread.h"24 23 #include <mutex> 24 #include <thread> 25 25 #include <wtf/Assertions.h> 26 26 #include <wtf/Lock.h> … … 94 94 VM* vm() { return m_vm; } 95 95 96 std:: optional<PlatformThread> ownerThread() const { return m_ownerThread; }97 bool currentThreadIsHoldingLock() { return m_ownerThread && m_ownerThread == currentPlatformThread(); }96 std::thread::id ownerThread() const { return m_ownerThreadID; } 97 JS_EXPORT_PRIVATE bool currentThreadIsHoldingLock(); 98 98 99 99 void willDestroyVM(VM*); … … 127 127 128 128 Lock m_lock; 129 std:: optional<PlatformThread> m_ownerThread;129 std::thread::id m_ownerThreadID; 130 130 intptr_t m_lockCount; 131 131 unsigned m_lockDropDepth; -
trunk/Source/JavaScriptCore/runtime/VM.cpp
r213202 r213231 393 393 m_perBytecodeProfiler = nullptr; 394 394 395 ASSERT( currentThreadIsHoldingAPILock());395 ASSERT(m_apiLock->currentThreadIsHoldingLock()); 396 396 m_apiLock->willDestroyVM(this); 397 397 heap.lastChanceToFinalize(); -
trunk/Source/JavaScriptCore/runtime/VM.h
r213202 r213231 612 612 #endif 613 613 614 std::thread::id ownerThread() const { return m_apiLock->ownerThread(); } 615 614 616 JS_EXPORT_PRIVATE void resetDateCache(); 615 617 … … 723 725 bool isSafeToRecurseSoftCLoop() const; 724 726 #endif // !ENABLE(JIT) 725 726 std::optional<PlatformThread> ownerThread() const { return m_apiLock->ownerThread(); }727 727 728 728 JS_EXPORT_PRIVATE void throwException(ExecState*, Exception*); -
trunk/Source/JavaScriptCore/runtime/Watchdog.cpp
r213202 r213231 56 56 ShouldTerminateCallback callback, void* data1, void* data2) 57 57 { 58 ASSERT(m_vm-> currentThreadIsHoldingAPILock());58 ASSERT(m_vm->ownerThread() == std::this_thread::get_id()); 59 59 60 60 m_timeLimit = limit; … … 69 69 bool Watchdog::shouldTerminate(ExecState* exec) 70 70 { 71 ASSERT(m_vm-> currentThreadIsHoldingAPILock());71 ASSERT(m_vm->ownerThread() == std::this_thread::get_id()); 72 72 // FIXME: Will unindent the following before landing. Leaving indented for now to minimize the code diff. 73 73 { … … 139 139 { 140 140 ASSERT(m_hasEnteredVM); 141 ASSERT(m_vm-> currentThreadIsHoldingAPILock());141 ASSERT(m_vm->ownerThread() == std::this_thread::get_id()); 142 142 ASSERT(hasTimeLimit()); 143 143 ASSERT(timeLimit <= m_timeLimit); … … 169 169 { 170 170 ASSERT(m_hasEnteredVM); 171 ASSERT(m_vm-> currentThreadIsHoldingAPILock());171 ASSERT(m_vm->ownerThread() == std::this_thread::get_id()); 172 172 m_cpuDeadline = noTimeLimit; 173 173 } -
trunk/Source/JavaScriptCore/tools/JSDollarVMPrototype.cpp
r213202 r213231 45 45 bool JSDollarVMPrototype::currentThreadOwnsJSLock(ExecState* exec) 46 46 { 47 return exec->vm(). currentThreadIsHoldingAPILock();47 return exec->vm().apiLock().currentThreadIsHoldingLock(); 48 48 } 49 49 -
trunk/Source/JavaScriptCore/tools/VMInspector.cpp
r213202 r213231 140 140 bool hasTimeout = false; 141 141 iterate([&] (VM& vm) { 142 if (!vm. currentThreadIsHoldingAPILock())142 if (!vm.apiLock().currentThreadIsHoldingLock()) 143 143 return FunctorStatus::Continue; 144 144
Note: See TracChangeset
for help on using the changeset viewer.