Changeset 294632 in webkit for trunk/Source/JavaScriptCore/jsc.cpp
- Timestamp:
- May 23, 2022, 4:21:02 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/jsc.cpp
r294611 r294632 230 230 class Worker : public BasicRawSentinelNode<Worker> { 231 231 public: 232 Worker(Workers& );232 Worker(Workers&, bool isMain); 233 233 ~Worker(); 234 234 235 235 void enqueue(const AbstractLocker&, RefPtr<Message>); 236 236 RefPtr<Message> dequeue(); 237 237 bool isMain() const { return m_isMain; } 238 238 239 static Worker& current(); 239 240 … … 243 244 Workers& m_workers; 244 245 Deque<RefPtr<Message>> m_messages; 246 const bool m_isMain; 245 247 }; 246 248 … … 1130 1132 ShellSourceProvider(const String& source, const SourceOrigin& sourceOrigin, String&& sourceURL, const TextPosition& startPosition, SourceProviderSourceType sourceType) 1131 1133 : StringSourceProvider(source, sourceOrigin, WTFMove(sourceURL), startPosition, sourceType) 1132 { 1133 } 1134 1135 static bool cacheEnabled() 1136 { 1137 static bool enabled = !!Options::diskCachePath(); 1138 return enabled; 1139 } 1134 // Workers started via $.agent.start are not shut down in a synchronous manner, and it 1135 // is possible the main thread terminates the process while a worker is writing its 1136 // bytecode cache, which results in intermittent test failures. As $.agent.start is only 1137 // a rarely used testing facility, we simply do not cache bytecode on these threads. 1138 , m_cacheEnabled(Worker::current().isMain() && !!Options::diskCachePath()) 1139 1140 { 1141 } 1142 1143 bool cacheEnabled() const { return m_cacheEnabled; } 1140 1144 1141 1145 mutable RefPtr<CachedBytecode> m_cachedBytecode; 1146 const bool m_cacheEnabled; 1142 1147 }; 1143 1148 … … 1926 1931 } 1927 1932 1928 Worker::Worker(Workers& workers )1933 Worker::Worker(Workers& workers, bool isMain) 1929 1934 : m_workers(workers) 1935 , m_isMain(isMain) 1930 1936 { 1931 1937 Locker locker { m_workers.m_lock }; … … 3652 3658 int runJSC(const CommandLine& options, bool isWorker, const Func& func) 3653 3659 { 3654 Worker worker(Workers::singleton() );3660 Worker worker(Workers::singleton(), !isWorker); 3655 3661 3656 3662 VM& vm = VM::create(HeapType::Large).leakRef();
Note:
See TracChangeset
for help on using the changeset viewer.