Remove STREAMS_API compilation guard
[WebKit.git] / Source / WTF / ChangeLog
1 2017-08-04  Youenn Fablet  <youenn@apple.com>
2
3         Remove STREAMS_API compilation guard
4         https://bugs.webkit.org/show_bug.cgi?id=175165
5
6         Reviewed by Darin Adler.
7
8         * wtf/FeatureDefines.h:
9
10 2017-08-03  Brian Burg  <bburg@apple.com>
11
12         Remove ENABLE(WEB_SOCKET) guards
13         https://bugs.webkit.org/show_bug.cgi?id=167044
14
15         Reviewed by Joseph Pecoraro.
16
17         * wtf/FeatureDefines.h:
18
19 2017-08-03  Youenn Fablet  <youenn@apple.com>
20
21         Remove FETCH_API compilation guard
22         https://bugs.webkit.org/show_bug.cgi?id=175154
23
24         Reviewed by Chris Dumez.
25
26         * wtf/FeatureDefines.h:
27
28 2017-08-03  Brady Eidson  <beidson@apple.com>
29
30         Add SW IDLs and stub out basic functionality.
31         https://bugs.webkit.org/show_bug.cgi?id=175115
32
33         Reviewed by Chris Dumez.
34
35         * wtf/FeatureDefines.h:
36
37 2017-08-03  Yusuke Suzuki  <utatane.tea@gmail.com>
38
39         Unreviewed, build fix for Windows port
40         https://bugs.webkit.org/show_bug.cgi?id=175013
41
42         * wtf/Threading.h:
43
44 2017-08-03  Yusuke Suzuki  <utatane.tea@gmail.com>
45
46         Merge ThreadHolder to WTF::Thread itself
47         https://bugs.webkit.org/show_bug.cgi?id=175013
48
49         Reviewed by Mark Lam.
50
51         Currently, we store ThreadHolder* to the TLS, and ThreadHolder* holds Ref<Thread>.
52         When we get Thread& from the current thread TLS, we need to dereference the ThreadHolder*.
53         However, ideally, we can store Thread* directly to the current thread TLS.
54         While the ThreadHolder design is beautiful, it's worth optimizing by storing Thread* directly
55         since Thread::current() is so frequently executed.
56
57         This patch merges ThreadHolder to Thread. And we now store Thread* directly in the TLS.
58         When storing it to TLS, we call leakRef() to keep Thread ref count incremented by the TLS.
59         And when destroying the TLS, we call `deref()` to ensure that Thread* is dereferenced from
60         the TLS.
61
62         * WTF.xcodeproj/project.pbxproj:
63         * wtf/CMakeLists.txt:
64         * wtf/ThreadHolder.cpp: Removed.
65         * wtf/ThreadHolder.h: Removed.
66         * wtf/ThreadHolderPthreads.cpp: Removed.
67         * wtf/ThreadHolderWin.cpp: Removed.
68         * wtf/Threading.cpp:
69         (WTF::Thread::entryPoint):
70         (WTF::initializeThreading):
71         * wtf/Threading.h:
72         (WTF::Thread::currentMayBeNull):
73         (WTF::Thread::current):
74         * wtf/ThreadingPthreads.cpp:
75         (WTF::Thread::waitForCompletion):
76         (WTF::Thread::initializeCurrentTLS):
77         (WTF::Thread::initializeTLSKey):
78         (WTF::Thread::initializeTLS):
79         (WTF::Thread::destructTLS):
80         (WTF::Thread::createCurrentThread): Deleted.
81         * wtf/ThreadingWin.cpp:
82         (WTF::Thread::initializeCurrentTLS):
83         (WTF::threadMapMutex):
84         (WTF::Thread::initializeTLSKey):
85         (WTF::Thread::currentDying):
86         (WTF::Thread::get):
87         (WTF::Thread::initializeTLS):
88         (WTF::Thread::destructTLS):
89         (WTF::waitForThreadCompletion):
90         (WTF::Thread::createCurrentThread): Deleted.
91
92 2017-08-03  Yusuke Suzuki  <utatane.tea@gmail.com>
93
94         [Linux][WTF] Use one global semaphore to notify thread suspend and resume completion
95         https://bugs.webkit.org/show_bug.cgi?id=175124
96
97         Reviewed by Carlos Garcia Campos.
98
99         POSIX sem_t is used to notify thread suspend and resume completion in Linux ports
100         since sem_post is async-signal-safe function. Since we guard suspend() and resume()
101         with one global lock, this semaphore is also guarded by this lock. So we do not need
102         to have semaphore per WTF::Thread.
103
104         This patch introduces one global Semaphore. And drop per thread semaphore.
105
106         * wtf/Threading.h:
107         * wtf/ThreadingPthreads.cpp:
108         (WTF::Thread::~Thread):
109         (WTF::Semaphore::Semaphore):
110         (WTF::Semaphore::~Semaphore):
111         (WTF::Semaphore::wait):
112         (WTF::Semaphore::post):
113         (WTF::Thread::signalHandlerSuspendResume):
114         (WTF::Thread::initializePlatformThreading):
115         (WTF::Thread::suspend):
116         (WTF::Thread::resume):
117         (WTF::Thread::Thread): Deleted.
118         * wtf/ThreadingWin.cpp:
119         (WTF::Thread::Thread): Deleted.
120
121 2017-08-03  Yusuke Suzuki  <utatane.tea@gmail.com>
122
123         [Linux][WTF] Reduce sizeof(WTF::Thread) by using a pointer to PlatformRegisters
124         https://bugs.webkit.org/show_bug.cgi?id=175119
125
126         Reviewed by Carlos Garcia Campos.
127
128         sizeof(PlatformRegisters) is so large. In my Linux box, it is 256. It enlarges the sizeof(WTF::Thread).
129         However, it is not necessary to hold it in WTF::Thread member. Thread's ucontext data and its stack is
130         effective while suspending the thread. So, we can just use the pointer to the PlatformRegister instead
131         of copying it to the member of the WTF::Thread.
132
133         * wtf/Threading.h:
134         * wtf/ThreadingPthreads.cpp:
135         (WTF::Thread::signalHandlerSuspendResume):
136         (WTF::Thread::getRegisters):
137
138 2017-08-02  Yusuke Suzuki  <utatane.tea@gmail.com>
139
140         Unreviewed, build fix for Windows port
141         https://bugs.webkit.org/show_bug.cgi?id=174716
142
143         This ugliness will be fixed in https://bugs.webkit.org/show_bug.cgi?id=175013.
144
145         * wtf/ThreadHolder.h:
146         * wtf/Threading.h:
147
148 2017-08-02  Yusuke Suzuki  <utatane.tea@gmail.com>
149
150         Merge WTFThreadData to Thread::current
151         https://bugs.webkit.org/show_bug.cgi?id=174716
152
153         Reviewed by Mark Lam.
154
155         We placed thread specific data in WTFThreadData previously. But now, we have a new good place
156         to put thread specific data: WTF::Thread. Before this patch, WTFThreadData and WTF::Thread
157         sometimes have the completely same fields (m_stack etc.) due to initialization order limitations.
158         This patch merges WTFThreadData to WTF::Thread. We apply WTFThreadData's initialization style
159         to WTF::Thread. So, WTF::Thread's holder now uses fast TLS for darwin environment. Thus,
160         Thread::current() access is now accelerated. And WTF::Thread::current() can be accessed even
161         before calling WTF::initializeThreading.
162
163         * WTF.xcodeproj/project.pbxproj:
164         * wtf/CMakeLists.txt:
165         * wtf/LockAlgorithm.h:
166         * wtf/LockAlgorithmInlines.h:
167         * wtf/MainThread.h:
168         * wtf/ParkingLot.cpp:
169         * wtf/StackStats.cpp:
170         (WTF::StackStats::PerThreadStats::PerThreadStats):
171         (WTF::StackStats::CheckPoint::CheckPoint):
172         (WTF::StackStats::CheckPoint::~CheckPoint):
173         (WTF::StackStats::probe):
174         (WTF::StackStats::LayoutCheckPoint::LayoutCheckPoint):
175         * wtf/ThreadHolder.cpp:
176         (WTF::ThreadHolder::initializeCurrent):
177         * wtf/ThreadHolder.h:
178         (WTF::ThreadHolder::ThreadHolder):
179         (WTF::ThreadHolder::currentMayBeNull):
180         (WTF::ThreadHolder::current):
181         * wtf/ThreadHolderPthreads.cpp:
182         (WTF::ThreadHolder::initializeKey):
183         (WTF::ThreadHolder::initialize):
184         (WTF::ThreadHolder::destruct):
185         (WTF::ThreadHolder::initializeOnce): Deleted.
186         (WTF::ThreadHolder::current): Deleted.
187         * wtf/ThreadHolderWin.cpp:
188         (WTF::ThreadHolder::initializeKey):
189         (WTF::ThreadHolder::currentDying):
190         (WTF::ThreadHolder::initialize):
191         (WTF::ThreadHolder::initializeOnce): Deleted.
192         (WTF::ThreadHolder::current): Deleted.
193         * wtf/Threading.cpp:
194         (WTF::Thread::initializeInThread):
195         (WTF::Thread::entryPoint):
196         (WTF::Thread::create):
197         (WTF::Thread::didExit):
198         (WTF::initializeThreading):
199         (WTF::Thread::currentMayBeNull): Deleted.
200         * wtf/Threading.h:
201         (WTF::Thread::current):
202         (WTF::Thread::atomicStringTable):
203         (WTF::Thread::setCurrentAtomicStringTable):
204         (WTF::Thread::stackStats):
205         (WTF::Thread::savedStackPointerAtVMEntry):
206         (WTF::Thread::setSavedStackPointerAtVMEntry):
207         (WTF::Thread::savedLastStackTop):
208         (WTF::Thread::setSavedLastStackTop):
209         * wtf/ThreadingPrimitives.h:
210         * wtf/ThreadingPthreads.cpp:
211         (WTF::Thread::createCurrentThread):
212         (WTF::Thread::current): Deleted.
213         * wtf/ThreadingWin.cpp:
214         (WTF::Thread::createCurrentThread):
215         (WTF::Thread::current): Deleted.
216         * wtf/WTFThreadData.cpp: Removed.
217         * wtf/WTFThreadData.h: Removed.
218         * wtf/text/AtomicString.cpp:
219         * wtf/text/AtomicStringImpl.cpp:
220         (WTF::stringTable):
221         * wtf/text/AtomicStringTable.cpp:
222         (WTF::AtomicStringTable::create):
223         * wtf/text/AtomicStringTable.h:
224
225 2017-08-02  Joseph Pecoraro  <pecoraro@apple.com>
226
227         NeverDestroyed related leaks seen on bots
228         https://bugs.webkit.org/show_bug.cgi?id=175113
229
230         Reviewed by Yusuke Suzuki.
231
232         * wtf/NeverDestroyed.h:
233         (WTF::NeverDestroyed::NeverDestroyed):
234         Previously the result of makeNeverDestroyed was not always moving into
235         the `static NeverDestroyed` static local variable. In some cases it would
236         re-invoke the constructor, creating a new NeverDestroyed object. In the
237         case of a Vector it was causing leaks.
238
239         Adding a move constructor convinces the compiler to move the result
240         of makeNeverDestroyed into the NeverDestroyed static. It doesn't actually
241         invoke the move constructor here, which I believe means it is deciding
242         to perform optional copy elision optimization.
243         'http://en.cppreference.com/w/cpp/language/copy_elision
244
245 2017-08-02  Filip Pizlo  <fpizlo@apple.com>
246
247         All C++ accesses to JSObject::m_butterfly should do caging
248         https://bugs.webkit.org/show_bug.cgi?id=175039
249
250         Reviewed by Keith Miller.
251         
252         Adds a smart pointer class that does various kinds of caging for you.
253
254         * WTF.xcodeproj/project.pbxproj:
255         * wtf/CMakeLists.txt:
256         * wtf/CagedPtr.h: Added.
257         (WTF::CagedPtr::CagedPtr):
258         (WTF::CagedPtr::get const):
259         (WTF::CagedPtr::getMayBeNull const):
260         (WTF::CagedPtr::operator== const):
261         (WTF::CagedPtr::operator!= const):
262         (WTF::CagedPtr::operator bool const):
263         (WTF::CagedPtr::operator* const):
264         (WTF::CagedPtr::operator-> const):
265
266 2017-08-02  Filip Pizlo  <fpizlo@apple.com>
267
268         We should be OK with the gigacage being disabled on gmalloc
269         https://bugs.webkit.org/show_bug.cgi?id=175082
270
271         Reviewed by Michael Saboff.
272
273         * wtf/Gigacage.h:
274         (Gigacage::shouldBeEnabled):
275
276 2017-08-01  Filip Pizlo  <fpizlo@apple.com>
277
278         Bmalloc and GC should put auxiliaries (butterflies, typed array backing stores) in a gigacage (separate multi-GB VM region)
279         https://bugs.webkit.org/show_bug.cgi?id=174727
280
281         Reviewed by Mark Lam.
282         
283         For the Gigacage project to have minimal impact, we need to have some abstraction that allows code to
284         avoid having to guard itself with #if's. This adds a Gigacage abstraction that overlays the Gigacage
285         namespace from bmalloc, which always lets you call things like Gigacage::caged and Gigacage::tryMalloc.
286         
287         Because of how many places need to possibly allocate in a gigacage, or possibly perform caged accesses,
288         it's better to hide the question of whether or not it's enabled inside this API.
289
290         * WTF.xcodeproj/project.pbxproj:
291         * wtf/CMakeLists.txt:
292         * wtf/FastMalloc.cpp:
293         * wtf/Gigacage.cpp: Added.
294         (Gigacage::tryMalloc):
295         (Gigacage::tryAllocateVirtualPages):
296         (Gigacage::freeVirtualPages):
297         (Gigacage::tryAlignedMalloc):
298         (Gigacage::alignedFree):
299         (Gigacage::free):
300         * wtf/Gigacage.h: Added.
301         (Gigacage::ensureGigacage):
302         (Gigacage::disableGigacage):
303         (Gigacage::addDisableCallback):
304         (Gigacage::removeDisableCallback):
305         (Gigacage::caged):
306         (Gigacage::isCaged):
307         (Gigacage::tryAlignedMalloc):
308         (Gigacage::alignedFree):
309         (Gigacage::free):
310
311 2017-07-31  Matt Lewis  <jlewis3@apple.com>
312
313         Unreviewed, rolling out r220060.
314
315         This broke our internal builds. Contact reviewer of patch for
316         more information.
317
318         Reverted changeset:
319
320         "Merge WTFThreadData to Thread::current"
321         https://bugs.webkit.org/show_bug.cgi?id=174716
322         http://trac.webkit.org/changeset/220060
323
324 2017-07-31  Yusuke Suzuki  <utatane.tea@gmail.com>
325
326         Merge WTFThreadData to Thread::current
327         https://bugs.webkit.org/show_bug.cgi?id=174716
328
329         Reviewed by Sam Weinig.
330
331         We placed thread specific data in WTFThreadData previously. But now, we have a new good place
332         to put thread specific data: WTF::Thread. Before this patch, WTFThreadData and WTF::Thread
333         sometimes have the completely same fields (m_stack etc.) due to initialization order limitations.
334         This patch merges WTFThreadData to WTF::Thread. We apply WTFThreadData's initialization style
335         to WTF::Thread. So, WTF::Thread's holder now uses fast TLS for darwin environment. Thus,
336         Thread::current() access is now accelerated. And WTF::Thread::current() can be accessed even
337         before calling WTF::initializeThreading.
338
339         * WTF.xcodeproj/project.pbxproj:
340         * wtf/CMakeLists.txt:
341         * wtf/LockAlgorithm.h:
342         * wtf/LockAlgorithmInlines.h:
343         * wtf/MainThread.h:
344         * wtf/ParkingLot.cpp:
345         * wtf/StackStats.cpp:
346         (WTF::StackStats::PerThreadStats::PerThreadStats):
347         (WTF::StackStats::CheckPoint::CheckPoint):
348         (WTF::StackStats::CheckPoint::~CheckPoint):
349         (WTF::StackStats::probe):
350         (WTF::StackStats::LayoutCheckPoint::LayoutCheckPoint):
351         * wtf/ThreadHolder.cpp:
352         (WTF::ThreadHolder::initializeCurrent):
353         * wtf/ThreadHolder.h:
354         (WTF::ThreadHolder::ThreadHolder):
355         (WTF::ThreadHolder::currentMayBeNull):
356         (WTF::ThreadHolder::current):
357         * wtf/ThreadHolderPthreads.cpp:
358         (WTF::ThreadHolder::initialize):
359         (WTF::ThreadHolder::destruct):
360         (WTF::ThreadHolder::current): Deleted.
361         * wtf/ThreadHolderWin.cpp:
362         (WTF::ThreadHolder::currentDying):
363         (WTF::ThreadHolder::initialize):
364         (WTF::ThreadHolder::current): Deleted.
365         * wtf/Threading.cpp:
366         (WTF::Thread::initializeInThread):
367         (WTF::Thread::entryPoint):
368         (WTF::Thread::didExit):
369         (WTF::initializeThreading):
370         (WTF::Thread::currentMayBeNull): Deleted.
371         * wtf/Threading.h:
372         (WTF::Thread::atomicStringTable):
373         (WTF::Thread::setCurrentAtomicStringTable):
374         (WTF::Thread::stackStats):
375         (WTF::Thread::savedStackPointerAtVMEntry):
376         (WTF::Thread::setSavedStackPointerAtVMEntry):
377         (WTF::Thread::savedLastStackTop):
378         (WTF::Thread::setSavedLastStackTop):
379         (WTF::Thread::current):
380         * wtf/ThreadingPrimitives.h:
381         * wtf/ThreadingPthreads.cpp:
382         (WTF::Thread::createCurrentThread):
383         (WTF::Thread::current): Deleted.
384         * wtf/ThreadingWin.cpp:
385         (WTF::Thread::createCurrentThread):
386         (WTF::Thread::current): Deleted.
387         * wtf/WTFThreadData.cpp: Removed.
388         * wtf/WTFThreadData.h: Removed.
389         * wtf/text/AtomicString.cpp:
390         * wtf/text/AtomicStringImpl.cpp:
391         (WTF::stringTable):
392         * wtf/text/AtomicStringTable.cpp:
393         (WTF::AtomicStringTable::create):
394         * wtf/text/AtomicStringTable.h:
395
396 2017-07-31  Xabier Rodriguez Calvar  <calvaris@igalia.com>
397
398         Created a bool pretty printer at WTF for debugging purposes
399         https://bugs.webkit.org/show_bug.cgi?id=174893
400
401         Reviewed by Darin Adler.
402
403         * wtf/PrintStream.cpp:
404         (WTF::printInternal): The overload taking bool uses boolForPrinting
405         * wtf/PrintStream.h:
406         (WTF::boolForPrinting): Converts a bool in "true" or "false".
407
408 2017-07-30  Yusuke Suzuki  <utatane.tea@gmail.com>
409
410         [WTF] Introduce Private Symbols
411         https://bugs.webkit.org/show_bug.cgi?id=174935
412
413         Reviewed by Darin Adler.
414
415         Upcoming proposal of class fields[1] requires private fields.
416         The simple way to implement it is adding a property with a private symbol.
417         Currently, we have private symbols for internal properties. They are usual
418         Symbols managed by the hash table. So basically private symbols are statically
419         created in BuiltinNames. However this new proposal encourages users to create
420         such private symbols more and more.
421
422         So, this patch introduces notion of "Private" into WTF SymbolImpl. This patch
423         adds PrivateSymbolImpl. This is SymbolImpl with "Private" flag. We do not need
424         to look up the symbol from the hash table to check whether the given symbol
425         is a private one.
426
427         [1]: https://github.com/tc39/proposal-class-fields
428
429         * wtf/text/StringImpl.h:
430         * wtf/text/SymbolImpl.cpp:
431         (WTF::PrivateSymbolImpl::create):
432         (WTF::PrivateSymbolImpl::createNullSymbol):
433         * wtf/text/SymbolImpl.h:
434         (WTF::SymbolImpl::isPrivate):
435         (WTF::SymbolImpl::StaticSymbolImpl::StaticSymbolImpl):
436         (WTF::SymbolImpl::SymbolImpl):
437         (WTF::PrivateSymbolImpl::PrivateSymbolImpl):
438
439 2017-07-30  Brady Eidson  <beidson@apple.com>
440
441         Add URLSchemeHandler API tests that verify the lack of URLSchemeTask object leaks.
442         https://bugs.webkit.org/show_bug.cgi?id=174958
443
444         Reviewed by Darin Adler.
445
446         This patch adds a new template class "InstanceCounted<T>".
447         
448         For each specialization, "InstanceCounted" will keep track of the total number of
449         instances in existence.
450         
451         This makes explicate leak checking in API tests possible.
452         
453         Since this adds some runtime and storage overhead the code that actually does anything
454         is only compiled in debug builds.
455         
456         * WTF.xcodeproj/project.pbxproj:
457         * wtf/InstanceCounted.h: Added.
458         (WTF::InstanceCounted::InstanceCounted):
459         (WTF::InstanceCounted::instanceCount):
460         (WTF::InstanceCounted::~InstanceCounted):
461
462 2017-07-27  Yusuke Suzuki  <utatane.tea@gmail.com>
463
464         [WTF] Drop Thread initialization wait in some platforms by introducing StackBounds::newThreadStackBounds(PlatformThreadHandle&)
465         https://bugs.webkit.org/show_bug.cgi?id=174303
466
467         Reviewed by Mark Lam.
468
469         Currently, the caller thread of Thread::create() need to wait for completion of the initialization of the target thread.
470         This is because we need to initialize Thread::m_stack in the target thread. Before this patch, a target thread's
471         StackBounds can only be retrieved by the target thread itself. However, this potentially causes context-switching between
472         the caller and the target threads and hurts efficiency of creating threads.
473
474         Fortunately, in some platforms (including major platforms except for Windows), we can get StackBounds of a target
475         thread from a caller thread. This allows us to avoid waiting for completion of thread initialization.
476
477         In this patch, we introduce HAVE_STACK_BOUNDS_FOR_NEW_THREAD and StackBounds::newThreadStackBounds. When creating
478         a new thread, we will use StackBounds::newThreadStackBounds to get StackBounds if possible. As a result, we
479         do not need to wait for completion of thread initialization to ensure m_stack field of Thread is initialized.
480
481         While some documents claim that it is possible on Windows to get the StackBounds of another thread[1], the method relies on
482         undocumented Windows NT APIs (NtQueryInformationThread, NtReadVirtualMemory etc.). So in this patch, we just
483         use the conservative approach simply waiting for completion of thread initialization.
484
485         [1]: https://stackoverflow.com/questions/3918375/how-to-get-thread-stack-information-on-windows
486
487         * wtf/Platform.h:
488         * wtf/StackBounds.cpp:
489         (WTF::StackBounds::newThreadStackBounds):
490         (WTF::StackBounds::currentThreadStackBoundsInternal):
491         (WTF::StackBounds::initialize): Deleted.
492         * wtf/StackBounds.h:
493         (WTF::StackBounds::currentThreadStackBounds):
494         (WTF::StackBounds::StackBounds):
495         * wtf/Threading.cpp:
496         (WTF::Thread::NewThreadContext::NewThreadContext):
497         (WTF::Thread::entryPoint):
498         (WTF::Thread::create):
499         (WTF::Thread::initialize): Deleted.
500         * wtf/Threading.h:
501         * wtf/ThreadingPrimitives.h:
502         * wtf/ThreadingPthreads.cpp:
503         (WTF::Thread::initializeCurrentThreadEvenIfNonWTFCreated):
504         (WTF::wtfThreadEntryPoint):
505         (WTF::Thread::establishHandle):
506         (WTF::Thread::initializeCurrentThreadInternal):
507         (WTF::Thread::current):
508         * wtf/ThreadingWin.cpp:
509         (WTF::Thread::initializeCurrentThreadEvenIfNonWTFCreated):
510         (WTF::Thread::initializeCurrentThreadInternal):
511         (WTF::Thread::current):
512         * wtf/win/MainThreadWin.cpp:
513         (WTF::initializeMainThreadPlatform):
514
515 2017-07-27  JF Bastien  <jfbastien@apple.com>
516
517         Update lock benchmarks
518         https://bugs.webkit.org/show_bug.cgi?id=174907
519
520         Reviewed by Filip Pizlo.
521
522         * benchmarks/ConditionSpeedTest.cpp:
523         (main):
524         * benchmarks/LockFairnessTest.cpp:
525         * benchmarks/LockSpeedTest.cpp:
526         * benchmarks/ToyLocks.h:
527
528 2017-07-26  Brian Burg  <bburg@apple.com>
529
530         Remove WEB_TIMING feature flag
531         https://bugs.webkit.org/show_bug.cgi?id=174795
532
533         Reviewed by Alex Christensen.
534
535         * wtf/FeatureDefines.h:
536
537 2017-07-26  Claudio Saavedra  <csaavedra@igalia.com>
538
539         [WPE] Enable KeyboardEvent key and code attributes
540         https://bugs.webkit.org/show_bug.cgi?id=174822
541
542         Reviewed by Žan Doberšek.
543
544         There is no reason for this to be disabled from what I see.
545
546         * wtf/FeatureDefines.h: Enable KeyboardEvent key and code attributes.
547
548 2017-07-23  Filip Pizlo  <fpizlo@apple.com>
549
550         B3 should do LICM
551         https://bugs.webkit.org/show_bug.cgi?id=174750
552
553         Reviewed by Keith Miller and Saam Barati.
554         
555         Moved DFG::NaturalLoops to WTF. The new templatized NaturalLoops<> uses the same Graph abstraction as
556         Dominators<>. This allows us to add a B3::NaturalLoops for free.
557         
558         Also made small tweaks to RangeSet, which the LICM uses.
559
560         * WTF.xcodeproj/project.pbxproj:
561         * wtf/CMakeLists.txt:
562         * wtf/Dominators.h:
563         * wtf/NaturalLoops.h: Added.
564         (WTF::NaturalLoop::NaturalLoop):
565         (WTF::NaturalLoop::graph):
566         (WTF::NaturalLoop::header):
567         (WTF::NaturalLoop::size):
568         (WTF::NaturalLoop::at):
569         (WTF::NaturalLoop::operator[]):
570         (WTF::NaturalLoop::contains):
571         (WTF::NaturalLoop::index):
572         (WTF::NaturalLoop::isOuterMostLoop):
573         (WTF::NaturalLoop::dump):
574         (WTF::NaturalLoop::addBlock):
575         (WTF::NaturalLoops::NaturalLoops):
576         (WTF::NaturalLoops::graph):
577         (WTF::NaturalLoops::numLoops):
578         (WTF::NaturalLoops::loop):
579         (WTF::NaturalLoops::headerOf):
580         (WTF::NaturalLoops::innerMostLoopOf):
581         (WTF::NaturalLoops::innerMostOuterLoop):
582         (WTF::NaturalLoops::belongsTo):
583         (WTF::NaturalLoops::loopDepth):
584         (WTF::NaturalLoops::loopsOf):
585         (WTF::NaturalLoops::dump):
586         * wtf/RangeSet.h:
587         (WTF::RangeSet::begin):
588         (WTF::RangeSet::end):
589         (WTF::RangeSet::addAll):
590
591 2017-07-23  Michael Catanzaro  <mcatanzaro@igalia.com>
592
593         Implement FALLTHROUGH attribute for C with GCC
594         https://bugs.webkit.org/show_bug.cgi?id=174555
595
596         Reviewed by Darin Adler.
597
598         My previous attempt to silence the JSC -Wimplicit-fallthrough warnings failed because they
599         are coming from a C file, and our FALLTHROUGH macro is only implemented for C++. So
600         implement it for C as well, using C attribute syntax.
601  
602         Note this is only possible to do for GCC, because Clang only supports this attribute using
603         the [[C++ attribute syntax]].
604
605         * wtf/Compiler.h:
606
607 2017-07-14  Filip Pizlo  <fpizlo@apple.com>
608
609         It should be easy to decide how WebKit yields
610         https://bugs.webkit.org/show_bug.cgi?id=174298
611
612         Reviewed by Saam Barati.
613         
614         Created a Thread::yield() abstraction for sched_yield(), and made WTF use it everywhere that it
615         had previously used std::this_thread::yield().
616         
617         To make it less annoying to experiment with changes to the lock algorithm in the future, this also
618         moves the meat of the algorithm into LockAlgorithmInlines.h. Only two files include that header.
619         Since LockAlgorithm.h no longer includes ParkingLot.h, a bunch of files in WK now need to include
620         timing headers (Seconds, MonotonicTime, etc) manually.
621
622         * WTF.xcodeproj/project.pbxproj:
623         * benchmarks/ToyLocks.h:
624         * wtf/CMakeLists.txt:
625         * wtf/Lock.cpp:
626         * wtf/LockAlgorithm.h:
627         (WTF::LockAlgorithm::lockSlow): Deleted.
628         (WTF::LockAlgorithm::unlockSlow): Deleted.
629         * wtf/LockAlgorithmInlines.h: Added.
630         (WTF::hasParkedBit>::lockSlow):
631         (WTF::hasParkedBit>::unlockSlow):
632         * wtf/MainThread.cpp:
633         * wtf/RunLoopTimer.h:
634         * wtf/Threading.cpp:
635         * wtf/Threading.h:
636         * wtf/ThreadingPthreads.cpp:
637         (WTF::Thread::yield):
638         * wtf/ThreadingWin.cpp:
639         (WTF::Thread::yield):
640         * wtf/WordLock.cpp:
641         (WTF::WordLockBase::lockSlow):
642         (WTF::WordLockBase::unlockSlow):
643
644 2017-07-22  Yusuke Suzuki  <utatane.tea@gmail.com>
645
646         [WTF] Extend ThreadGroup::add results from bool to ThreadGroupAddResult
647         https://bugs.webkit.org/show_bug.cgi?id=174705
648
649         Reviewed by Mark Lam.
650
651         After starting using ThreadGroup to bookkeep active threads for Signals,
652         we would like to know tristate of ThreadGroup::add result, NewlyAdded, AlreadyAdded, NotAdded.
653         This patch extends the result of ThreadGroup::add from bool to ThreadGroupAddResult tristate.
654         Note that NotAdded is returned if the target thread is dying.
655
656         * wtf/ThreadGroup.cpp:
657         (WTF::ThreadGroup::add):
658         (WTF::ThreadGroup::addCurrentThread):
659         * wtf/ThreadGroup.h:
660         * wtf/Threading.cpp:
661         (WTF::Thread::addToThreadGroup):
662         * wtf/Threading.h:
663         * wtf/threads/Signals.cpp:
664         (WTF::registerThreadForMachExceptionHandling):
665
666 2017-07-21  Commit Queue  <commit-queue@webkit.org>
667
668         Unreviewed, rolling out r219732.
669         https://bugs.webkit.org/show_bug.cgi?id=174748
670
671         static is not threadsafe in WebKit tree (Requested by
672         yusukesuzuki on #webkit).
673
674         Reverted changeset:
675
676         "[WTF] Drop initializeDate"
677         https://bugs.webkit.org/show_bug.cgi?id=174714
678         http://trac.webkit.org/changeset/219732
679
680 2017-07-21  Yusuke Suzuki  <utatane.tea@gmail.com>
681
682         [WTF] Drop initializeDate
683         https://bugs.webkit.org/show_bug.cgi?id=174714
684
685         Reviewed by Darin Adler.
686
687         minYear static variable will be initialized in an exclusive manner, which is ensured by C++ "static" semantics.
688         Thus, we do not need to call initializeDate() explicitly.
689
690         * wtf/DateMath.cpp:
691         (WTF::equivalentYearForDST):
692         (WTF::initializeDates): Deleted.
693         * wtf/Threading.cpp:
694         (WTF::initializeThreading):
695
696 2017-07-21  Yusuke Suzuki  <utatane.tea@gmail.com>
697
698         [JSC] Introduce static symbols
699         https://bugs.webkit.org/show_bug.cgi?id=158863
700
701         Reviewed by Darin Adler.
702
703         We add a new class StaticSymbolImpl. StaticSymbolImpl can offer
704         the way to create static SymbolImpl. It can be shared between
705         multiple VMs and multiple threads.
706
707         * wtf/text/SymbolImpl.h:
708         (WTF::SymbolImpl::StaticSymbolImpl::StaticSymbolImpl):
709         (WTF::SymbolImpl::StaticSymbolImpl::operator SymbolImpl&):
710         For StaticSymbolImpl's hashForSymbol, we use usual string hash value.
711         Since all the SymbolImpls are unique, basically, any value is OK here.
712         Non-confilicting to the other SymbolImpls is ideal.
713
714 2017-07-21  Yusuke Suzuki  <utatane.tea@gmail.com>
715
716         [WTF] Newly added AtomicStringImpl should use BufferInternal static string if StringImpl is static
717         https://bugs.webkit.org/show_bug.cgi?id=174501
718
719         Reviewed by Darin Adler.
720
721         When creating AtomicStringImpl from static StringImpl, we can just use createWithoutCopying
722         to create a BufferInternal AtomicStringImpl which m_data{8,16} is static string's one.
723
724         * wtf/text/AtomicStringImpl.cpp:
725         (WTF::CStringTranslator::hash):
726         (WTF::CStringTranslator::equal):
727         (WTF::CStringTranslator::translate):
728         (WTF::AtomicStringImpl::add):
729         (WTF::HashTranslatorCharBuffer::HashTranslatorCharBuffer):
730         (WTF::UCharBufferTranslator::hash):
731         (WTF::UCharBufferTranslator::equal):
732         (WTF::UCharBufferTranslator::translate):
733         (WTF::LCharBufferTranslator::hash):
734         (WTF::LCharBufferTranslator::equal):
735         (WTF::LCharBufferTranslator::translate):
736         (WTF::BufferFromStaticDataTranslator::hash):
737         (WTF::BufferFromStaticDataTranslator::equal):
738         (WTF::BufferFromStaticDataTranslator::translate):
739         (WTF::AtomicStringImpl::addLiteral):
740         (WTF::addSymbol):
741         (WTF::addStatic):
742         (WTF::AtomicStringImpl::addSlowCase):
743         (WTF::AtomicStringImpl::lookUp):
744         (WTF::CharBufferFromLiteralDataTranslator::hash): Deleted.
745         (WTF::CharBufferFromLiteralDataTranslator::equal): Deleted.
746         (WTF::CharBufferFromLiteralDataTranslator::translate): Deleted.
747         (WTF::addSubstring): Deleted.
748         * wtf/text/StringImpl.h:
749
750 2017-07-21  Konstantin Tokarev  <annulen@yandex.ru>
751
752        [cmake] Unreviewed, add definitions necessary to use ICU shipped with macOS
753
754        macOS system ICU libraries are built with U_DISABLE_RENAMING=1 and
755        U_SHOW_CPLUSPLUS_API=0. After r219155 we have to pass this definitons
756        explicitly, because ICU headers in the tree are not modified anymore.
757
758         * wtf/PlatformMac.cmake: Rely on ICU_LIBRARIES instead of passing ICU
759         library name explicitly in WTF_LIBRARIES.
760
761 2017-07-20  Chris Dumez  <cdumez@apple.com>
762
763         Replace calls to Vector::resize() with calls to more efficient shrink() / grow() when applicable
764         https://bugs.webkit.org/show_bug.cgi?id=174660
765
766         Reviewed by Geoffrey Garen.
767
768         Replace calls to Vector::resize() with calls to more efficient shrink() / grow() when applicable.
769         This essentially replaces a branch to figure out if the new size is less or greater than the
770         current size by an assertion.
771
772         * wtf/IndexSparseSet.h:
773         (WTF::OverflowHandler>::IndexSparseSet):
774         (WTF::OverflowHandler>::clear):
775         * wtf/Insertion.h:
776         (WTF::executeInsertions):
777         * wtf/RangeSet.h:
778         (WTF::RangeSet::compact):
779         * wtf/Vector.h:
780         (WTF::removeRepeatedElements):
781         * wtf/persistence/Coders.h:
782
783 2017-07-20  Yusuke Suzuki  <utatane.tea@gmail.com>
784
785         [WTF] Use ThreadGroup to bookkeep active threads for Mach exception
786         https://bugs.webkit.org/show_bug.cgi?id=174678
787
788         Reviewed by Mark Lam.
789
790         We can use ThreadGroup to bookkeep active threads for Mach exceptions.
791         When the thread dies, it is automatically removed from the thread groups.
792         So we do not need to call unregisterThreadForMachExceptionHandling.
793
794         * wtf/ThreadGroup.cpp:
795         (WTF::ThreadGroup::~ThreadGroup):
796         (WTF::ThreadGroup::add):
797         * wtf/ThreadGroup.h:
798         * wtf/ThreadHolder.cpp:
799         (WTF::ThreadHolder::~ThreadHolder):
800         * wtf/Threading.cpp:
801         (WTF::Thread::addToThreadGroup):
802         (WTF::Thread::removeFromThreadGroup):
803         * wtf/Threading.h:
804         * wtf/threads/Signals.cpp:
805         (WTF::setExceptionPorts):
806         (WTF::activeThreads):
807         (WTF::registerThreadForMachExceptionHandling):
808         (WTF::installSignalHandler):
809         (WTF::unregisterThreadForMachExceptionHandling): Deleted.
810         * wtf/threads/Signals.h:
811
812 2017-07-19  Yusuke Suzuki  <utatane.tea@gmail.com>
813
814         [WTF] Remove unnecessary indirection of WTF::Thread entry point
815         https://bugs.webkit.org/show_bug.cgi?id=174291
816
817         Reviewed by Mark Lam.
818
819         Now wtfThreadEntryPoint is almost the same. Only the difference is function signature due to platform APIs.
820         We remove ThreadFunctionInvocation indirection in ThreadingPthread.cpp and ThreadingWin.cpp.
821
822         Also, ThreadFunctionInvocation keeps a RefPtr to the Thread object. This was previously needed to keep the
823         Thread object alive until the thread itself could install the ThreadHolder into its thread local storage.
824         The ThreadHolder has a Ref that keeps the Thread object alive for the lifetime of the thread. Since
825         Thread::create() now waits for the thread to be initialized before returning and Thread::create() hold a Ref
826         to the Thread object, we are guaranteed that the Thread object will be alive long enough for it to be installed
827         in the thread's ThreadHolder, and we no longer need ThreadFunctionInvocation.
828
829         And we also simplify ThreadHolder::initialize a bit. Now Thread::create waits for the completion of Thread
830         initialization. So, after establishing thread handle, we can call ThreadHolder::initialize before completing
831         Thread initialization.
832
833         Also we drop errno.h ifdefs in ThreadingWin.cpp. This is introduced to support WinCE. But now WinCE port is removed.
834
835         * WTF.xcodeproj/project.pbxproj:
836         * wtf/ThreadFunctionInvocation.h: Removed.
837         * wtf/ThreadHolder.h:
838         * wtf/ThreadHolderWin.cpp:
839         (WTF::ThreadHolder::initialize):
840         * wtf/Threading.cpp:
841         (WTF::Thread::entryPoint):
842         (WTF::Thread::create):
843         (WTF::threadEntryPoint): Deleted.
844         * wtf/Threading.h:
845         * wtf/ThreadingPthreads.cpp:
846         (WTF::Thread::initializeCurrentThreadEvenIfNonWTFCreated):
847         (WTF::wtfThreadEntryPoint):
848         (WTF::Thread::establishHandle):
849         (WTF::Thread::initializeCurrentThreadInternal):
850         (WTF::Thread::current):
851         (WTF::Thread::establishPlatformSpecificHandle):
852         (WTF::Thread::createInternal): Deleted.
853         (WTF::Thread::establish): Deleted.
854         * wtf/ThreadingWin.cpp:
855         (WTF::Thread::initializeCurrentThreadEvenIfNonWTFCreated):
856         (WTF::Thread::initializeCurrentThreadInternal):
857         (WTF::wtfThreadEntryPoint):
858         (WTF::Thread::establishHandle):
859         (WTF::Thread::current):
860         (WTF::Thread::establishPlatformSpecificHandle):
861         (WTF::Thread::createInternal): Deleted.
862         (WTF::Thread::establish): Deleted.
863         * wtf/win/MainThreadWin.cpp:
864         (WTF::initializeMainThreadPlatform):
865
866 2017-07-19  Yusuke Suzuki  <utatane.tea@gmail.com>
867
868         [WTF] Implement WTF::ThreadGroup
869         https://bugs.webkit.org/show_bug.cgi?id=174081
870
871         Reviewed by Mark Lam.
872
873         This patch implements WTF::ThreadGroup. It implements core of JSC::MachineThreads with more reliable way.
874         JSC::MachineThreads was complicated because of managing dead threads. Each JSC::MachineThreads has its
875         own TLS with a registered destructor. And everytime a thread dies, the registered TLS destructor is called.
876         And this destructor will remove the current dying thread from JSC::MachineThreads.
877
878         However the above implementation is tricky. And each JSC::MachineThreads requires own TLS space, which is
879         not considered in WTF's Windows ThreadSpecific implementation. Current design works well since we only
880         have small number of MachineThreads right now.
881
882         Instead, we use more reliable way. After introducing WTF::Thread, WTF::Thread has WTF::Thread::didExit,
883         which is called when associated TLS (with WTF::Thread) is destroyed. We leverage this mechanism to remove
884         WTF::Thread from MachineThreads.
885
886         This patch introduces WTF::ThreadGroup. It is tightly integrated with WTF::Thread: WTF::Thread knows
887         ThreadGroups which includes this thread. And WTF::ThreadGroup of course knows WTF::Threads added to it.
888         WTF::Thread::didExit carefully remove itself from WTF::ThreadGroups.
889
890         The most important part of this patch is locking. WTF::Thread can die. And WTF::ThreadGroup can die.
891         If we take a design using two fine grain locks in WTF::Thread and WTF::ThreadGroup, we easily encounter
892         dead lock. Consider the following case.
893
894         1. When adding WTF::Thread (TH) to WTF::ThreadGroup (THG), we first hold a lock of THG, and hold a lock of TH (locking order is THG -> TH).
895         2. When TH dies, TH need to hold a lock of TH to iterate THGs. And we hold a lock of THG to unregister TH from it (locking order is TH -> THG).
896         3. When suspending and resuming THs in THG, we first hold a lock of THG. And then, we hold a lock of TH to suspend and resume it (locking order is THG -> TH).
897         4. When destroying THG, we need to hold a lock of TH to unregister THG from TH. We can hold a lock of THG before that (locking order is THG -> TH).
898
899         Then, it easily causes dead lock. We cannot swap the locking order of (2) since iterating THG requires a lock of TH.
900         To solve this problem, we use std::shared_ptr and std::weak_ptr.
901
902         1. When adding WTF::Thread (TH) to WTF::ThreadGroup (THG), we first hold THG, and hold a lock of TH. (THG -> TH)
903         2. When TH dies, TH first hold lock of TH. And we use std::weak_ptr<>::lock() to retain non-destructed ThreadGroups.
904         If some of ThreadGroups are dying, we just ignore them. It is ok because such a ThreadGroup will be destructed. So we do not need to unregister this thread from
905         such a ThreadGroup. Then, we have Vector<std::shared_ptr<ThreadGroup>>. So we unlock a lock of TH. To unregister a thread from thread group, we first hold a
906         lock of THG and then hold a lock of TH. Both lifetime is ensured: THG is retained by std::shared_ptr. And TH is itself. (TH), (THG -> TH).
907         3. When suspending and resuming THs in THG, we first hold a lock of THG. And then, we hold a lock of TH to suspend and resume it (THG -> TH).
908         4. When destroying THG, we hold a lock of THG. And hold a lock of TH. During holding THG's lock, registered thread never dies because (2) holds THG lock. (THG -> TH).
909
910         We also fix suspend and resume locking mechanism to avoid dead lock. We should hold the global lock when suspending and resuming.
911         If we use per-thread lock, the suspended thread can hold the lock of the other threads. It causes dead lock.
912
913         * WTF.xcodeproj/project.pbxproj:
914         * wtf/AutomaticThread.cpp:
915         * wtf/CMakeLists.txt:
916         * wtf/CrossThreadCopier.h:
917         * wtf/ParkingLot.h:
918         * wtf/ThreadGroup.cpp: Copied from Source/JavaScriptCore/wasm/WasmMachineThreads.cpp.
919         (WTF::ThreadGroup::~ThreadGroup):
920         (WTF::ThreadGroup::add):
921         (WTF::ThreadGroup::addCurrentThread):
922         * wtf/ThreadGroup.h: Copied from Source/JavaScriptCore/wasm/WasmMachineThreads.cpp.
923         (WTF::ThreadGroup::create):
924         (WTF::ThreadGroup::threads):
925         (WTF::ThreadGroup::getLock):
926         (WTF::ThreadGroup::weakFromThis):
927         * wtf/Threading.cpp:
928         (WTF::shouldRemoveThreadFromThreadGroup):
929         (WTF::Thread::didExit):
930         (WTF::Thread::addToThreadGroup):
931         (WTF::Thread::removeFromThreadGroup):
932         * wtf/Threading.h:
933         * wtf/ThreadingPthreads.cpp:
934         (WTF::Thread::resume):
935         (WTF::Thread::getRegisters):
936         * wtf/ThreadingWin.cpp:
937         (WTF::Thread::resume):
938         (WTF::Thread::getRegisters):
939
940 2017-07-18  Andy Estes  <aestes@apple.com>
941
942         [Xcode] Enable CLANG_WARN_RANGE_LOOP_ANALYSIS
943         https://bugs.webkit.org/show_bug.cgi?id=174631
944
945         Reviewed by Tim Horton.
946
947         * Configurations/Base.xcconfig:
948
949 2017-07-18  Yusuke Suzuki  <utatane.tea@gmail.com>
950
951         WTF::Thread should have the threads stack bounds.
952         https://bugs.webkit.org/show_bug.cgi?id=173975
953
954         Reviewed by Mark Lam.
955
956         We move StackBounds from WTFThreadData to WTF::Thread.
957         One important thing is that we should make valid StackBounds
958         visible to Thread::create() caller. When the caller get
959         WTF::Thread from Thread::create(), this WTF::Thread should
960         have a valid StackBounds. But StackBounds information can be
961         retrived only in the WTF::Thread's thread itself.
962
963         We also clean up WTF::initializeThreading. StringImpl::empty()
964         is now statically initialized by using constexpr constructor.
965         Thus we do not need to call StringImpl::empty() explicitly here.
966         And WTF::initializeThreading() does not have any main thread
967         affinity right now in all the platforms. So we fix the comment
968         in Threading.h. Then, now, WTF::initializeThreading() is called
969         in UI thread when using Web thread in iOS.
970
971         * wtf/StackBounds.h:
972         (WTF::StackBounds::emptyBounds):
973         (WTF::StackBounds::StackBounds):
974         * wtf/Threading.cpp:
975         (WTF::threadEntryPoint):
976         (WTF::Thread::create):
977         (WTF::Thread::currentMayBeNull):
978         (WTF::Thread::initialize):
979         (WTF::initializeThreading):
980         * wtf/Threading.h:
981         (WTF::Thread::stack):
982         * wtf/ThreadingPthreads.cpp:
983         (WTF::Thread::initializeCurrentThreadEvenIfNonWTFCreated):
984         (WTF::Thread::current):
985         (WTF::initializeCurrentThreadEvenIfNonWTFCreated): Deleted.
986         (WTF::Thread::currentMayBeNull): Deleted.
987         * wtf/ThreadingWin.cpp:
988         (WTF::Thread::initializeCurrentThreadEvenIfNonWTFCreated):
989         (WTF::Thread::initializeCurrentThreadInternal):
990         (WTF::Thread::current):
991         * wtf/WTFThreadData.cpp:
992         (WTF::WTFThreadData::WTFThreadData):
993         * wtf/WTFThreadData.h:
994         (WTF::WTFThreadData::stack):
995
996 2017-07-18  Andy Estes  <aestes@apple.com>
997
998         [Xcode] Enable CLANG_WARN_OBJC_LITERAL_CONVERSION
999         https://bugs.webkit.org/show_bug.cgi?id=174631
1000
1001         Reviewed by Sam Weinig.
1002
1003         * Configurations/Base.xcconfig:
1004
1005 2017-07-18  Andy Estes  <aestes@apple.com>
1006
1007         [Xcode] Enable CLANG_WARN_NON_LITERAL_NULL_CONVERSION
1008         https://bugs.webkit.org/show_bug.cgi?id=174631
1009
1010         Reviewed by Dan Bernstein.
1011
1012         * Configurations/Base.xcconfig:
1013
1014 2017-07-18  Andy Estes  <aestes@apple.com>
1015
1016         [Xcode] Enable CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING
1017         https://bugs.webkit.org/show_bug.cgi?id=174631
1018
1019         Reviewed by Darin Adler.
1020
1021         * Configurations/Base.xcconfig:
1022
1023 2017-07-17  Konstantin Tokarev  <annulen@yandex.ru>
1024
1025         [cmake] Set library types before their targets are created
1026         https://bugs.webkit.org/show_bug.cgi?id=174600
1027
1028         Reviewed by Michael Catanzaro.
1029
1030         Since r219560 library targets are created before PlatformXXX.cmake
1031         files are processed, however library type must be passed in
1032         add_library() call and cannot be changed afterwards. Set these
1033         variables in OptionsXXX.cmake.
1034
1035         * wtf/PlatformGTK.cmake:
1036         * wtf/PlatformMac.cmake:
1037
1038 2017-07-17  Yoshiaki Jitsukawa  <Yoshiaki.Jitsukawa@sony.com>
1039
1040         Move USE_AVFOUNDATION definition on Windows to wtf/Platform.h
1041         https://bugs.webkit.org/show_bug.cgi?id=174356
1042
1043         Reviewed by Brent Fulgham.
1044
1045         Move the definition of USE_AVFOUNDATION on Windows to wtf/platform.h
1046
1047         Add a custom command to generate AVFoundationHeaderDetection.h, which
1048         is renamed from WebCoreHeaderDetection.h
1049
1050         * AVFoundationSupport.py: Moved from Source/WebCore/AVFoundationSupport.py.
1051         * wtf/Platform.h:
1052         * wtf/PlatformWin.cmake:
1053
1054 2017-07-17  Darin Adler  <darin@apple.com>
1055
1056         Improve use of NeverDestroyed
1057         https://bugs.webkit.org/show_bug.cgi?id=174348
1058
1059         Reviewed by Sam Weinig.
1060
1061         * wtf/HashSet.h: Added an overload of HashSet::add that takes an initializer list of
1062         const references. This is handy to add a bunch of values all at once. Later we can
1063         consider optimizing to grow the hash table only once instead of deciding whether to
1064         grow repeatedly as we add each value.
1065         (WTF::copyToVector): Changed to use std::copy, removing 4 of the 6 lines of code here.
1066
1067         * wtf/MemoryPressureHandler.cpp: Include NeverDestroyed.h here ...
1068         * wtf/MemoryPressureHandler.h: ... not here.
1069
1070         * wtf/NeverDestroyed.h: Added the ability to have a const NeverDestroyed.
1071         Added a makeNeverDestroyed function that deduces the type from the argument.
1072         With auto, this can be used to avoid writing out a long type twice.
1073
1074         * wtf/ThreadingPthreads.cpp: Removed unneeded include of NeverDestroyed.h.
1075         * wtf/text/AtomicString.cpp: Ditto.
1076
1077 2017-07-17  Konstantin Tokarev  <annulen@yandex.ru>
1078
1079         [CMake] Create targets before WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS is called
1080         https://bugs.webkit.org/show_bug.cgi?id=174557
1081
1082         Reviewed by Michael Catanzaro.
1083
1084         * wtf/CMakeLists.txt:
1085
1086 2017-07-14  Jonathan Bedard  <jbedard@apple.com>
1087
1088         Add iOS 11 SPI
1089         https://bugs.webkit.org/show_bug.cgi?id=174430
1090         <rdar://problem/33269288>
1091
1092         Reviewed by Tim Horton.
1093
1094         * Configurations/WTF.xcconfig: Exclude MachExceptions.def when building iOS 11 for
1095         the iOS simulator.
1096
1097 2017-07-14  Commit Queue  <commit-queue@webkit.org>
1098
1099         Unreviewed, rolling out r219510.
1100         https://bugs.webkit.org/show_bug.cgi?id=174525
1101
1102         Need to revert length() == 0 check for null string (Requested
1103         by yusukesuzuki on #webkit).
1104
1105         Reverted changeset:
1106
1107         "[WTF] Newly added AtomicStringImpl should use BufferInternal
1108         static string if StringImpl is static"
1109         https://bugs.webkit.org/show_bug.cgi?id=174501
1110         http://trac.webkit.org/changeset/219510
1111
1112 2017-07-14  Yusuke Suzuki  <utatane.tea@gmail.com>
1113
1114         [WTF] Newly added AtomicStringImpl should use BufferInternal static string if StringImpl is static
1115         https://bugs.webkit.org/show_bug.cgi?id=174501
1116
1117         Reviewed by Darin Adler.
1118
1119         When creating AtomicStringImpl from static StringImpl, we can just use createWithoutCopying
1120         to create a BufferInternal AtomicStringImpl which m_data{8,16} is static string's one.
1121
1122         * wtf/text/AtomicStringImpl.cpp:
1123         (WTF::CStringTranslator::hash):
1124         (WTF::CStringTranslator::equal):
1125         (WTF::CStringTranslator::translate):
1126         (WTF::AtomicStringImpl::add):
1127         (WTF::HashTranslatorCharBuffer::HashTranslatorCharBuffer):
1128         (WTF::UCharBufferTranslator::hash):
1129         (WTF::UCharBufferTranslator::equal):
1130         (WTF::UCharBufferTranslator::translate):
1131         (WTF::LCharBufferTranslator::hash):
1132         (WTF::LCharBufferTranslator::equal):
1133         (WTF::LCharBufferTranslator::translate):
1134         (WTF::BufferFromStaticDataTranslator::hash):
1135         (WTF::BufferFromStaticDataTranslator::equal):
1136         (WTF::BufferFromStaticDataTranslator::translate):
1137         (WTF::AtomicStringImpl::addLiteral):
1138         (WTF::addSymbol):
1139         (WTF::addStatic):
1140         (WTF::AtomicStringImpl::addSlowCase):
1141         (WTF::AtomicStringImpl::lookUp):
1142         (WTF::CharBufferFromLiteralDataTranslator::hash): Deleted.
1143         (WTF::CharBufferFromLiteralDataTranslator::equal): Deleted.
1144         (WTF::CharBufferFromLiteralDataTranslator::translate): Deleted.
1145         (WTF::addSubstring): Deleted.
1146         * wtf/text/StringImpl.h:
1147
1148 2017-07-14  Yusuke Suzuki  <utatane.tea@gmail.com>
1149
1150         [WTF] Use std::unique_ptr for StackTrace
1151         https://bugs.webkit.org/show_bug.cgi?id=174495
1152
1153         Reviewed by Alex Christensen.
1154
1155         Instead of returning pointer to heap allocated StackTrace,
1156         we should return std::unique_ptr<StackTrace>.
1157         And we also move WTFGetBackTrace from Assertions.cpp to
1158         StackTrace.cpp to consolidate stack trace related operations
1159         into StackTrace.cpp.
1160
1161         * wtf/Assertions.cpp:
1162         * wtf/StackTrace.cpp:
1163         (WTFGetBacktrace):
1164         (WTF::StackTrace::captureStackTrace):
1165         * wtf/StackTrace.h:
1166
1167 2017-07-13  Yusuke Suzuki  <utatane.tea@gmail.com>
1168
1169         Unreviewed, annotate inline for operator==/!= for FastAllocator
1170         https://bugs.webkit.org/show_bug.cgi?id=174366
1171
1172         * wtf/FastMalloc.h:
1173         (WTF::operator==):
1174         (WTF::operator!=):
1175
1176 2017-07-12  Commit Queue  <commit-queue@webkit.org>
1177
1178         Unreviewed, rolling out r219176.
1179         https://bugs.webkit.org/show_bug.cgi?id=174436
1180
1181         "Can cause infinite recursion on iOS" (Requested by mlam on
1182         #webkit).
1183
1184         Reverted changeset:
1185
1186         "WTF::Thread should have the threads stack bounds."
1187         https://bugs.webkit.org/show_bug.cgi?id=173975
1188         http://trac.webkit.org/changeset/219176
1189
1190 2017-07-12  Adrian Perez de Castro  <aperez@igalia.com>
1191
1192         [WTF] Failure to build when the compiler specifically targets ARMv8-A / defines __ARM_ARCH_8A__
1193         https://bugs.webkit.org/show_bug.cgi?id=174425
1194
1195         Reviewed by Michael Catanzaro.
1196
1197         * wtf/Platform.h: Also check for __ARCH_ARM_8A__ to detect ARMv8.
1198
1199 2017-07-12  Michael Saboff  <msaboff@apple.com>
1200
1201         Unreviewed build fix when both DATA_LOG_TO_FILE and DATA_LOG_FILENAME are defined.
1202
1203         * wtf/DataLog.cpp:
1204         (WTF::initializeLogFileOnce): Changed declaration of logBasename from
1205         char* logBasename to const char* logBasename.
1206
1207 2017-07-12  Matt Lewis  <jlewis3@apple.com>
1208
1209         Unreviewed, rolling out r219401.
1210
1211         This revision rolled out the previous patch, but after talking
1212         with reviewer, a rebaseline is what was needed.Rolling back in
1213         before rebaseline.
1214
1215         Reverted changeset:
1216
1217         "Unreviewed, rolling out r219379."
1218         https://bugs.webkit.org/show_bug.cgi?id=174400
1219         http://trac.webkit.org/changeset/219401
1220
1221 2017-07-12  Matt Lewis  <jlewis3@apple.com>
1222
1223         Unreviewed, rolling out r219379.
1224
1225         This revision caused a consistent failure in the test
1226         fast/dom/Window/property-access-on-cached-window-after-frame-
1227         removed.html.
1228
1229         Reverted changeset:
1230
1231         "Remove NAVIGATOR_HWCONCURRENCY"
1232         https://bugs.webkit.org/show_bug.cgi?id=174400
1233         http://trac.webkit.org/changeset/219379
1234
1235 2017-07-12  Yusuke Suzuki  <utatane.tea@gmail.com>
1236
1237         Unreviewed, attempt to fix Windows build
1238         https://bugs.webkit.org/show_bug.cgi?id=174366
1239
1240         * wtf/FastMalloc.h:
1241         (WTF::operator==):
1242         (WTF::operator!=):
1243         (WTF::FastAllocator::operator==): Deleted.
1244         (WTF::FastAllocator::operator!=): Deleted.
1245
1246 2017-07-11  Carlos Garcia Campos  <cgarcia@igalia.com>
1247
1248         [GTK][WPE] Enable FILE_LOCK and implement lockFile and unlockFile
1249         https://bugs.webkit.org/show_bug.cgi?id=174357
1250
1251         Reviewed by Michael Catanzaro.
1252
1253         * wtf/Platform.h: Enable FILE_LOCK in GTK and WPE ports.
1254
1255 2017-07-11  Dean Jackson  <dino@apple.com>
1256
1257         Remove NAVIGATOR_HWCONCURRENCY
1258         https://bugs.webkit.org/show_bug.cgi?id=174400
1259
1260         Reviewed by Sam Weinig.
1261
1262         * wtf/FeatureDefines.h:
1263
1264 2017-07-11  Dean Jackson  <dino@apple.com>
1265
1266         Rolling out r219372.
1267
1268         * wtf/FeatureDefines.h:
1269
1270 2017-07-11  Dean Jackson  <dino@apple.com>
1271
1272         Remove NAVIGATOR_HWCONCURRENCY
1273         https://bugs.webkit.org/show_bug.cgi?id=174400
1274
1275         Reviewed by Sam Weinig.
1276
1277         * wtf/FeatureDefines.h:
1278
1279 2017-07-11  Yusuke Suzuki  <utatane.tea@gmail.com>
1280
1281         [WTF] Drop unnecessary AtomicString constructor since we have constexpr hash function
1282         https://bugs.webkit.org/show_bug.cgi?id=174347
1283
1284         Reviewed by Alex Christensen.
1285
1286         Previously, we calculate hash value in perl script and generate source code with that value.
1287         This AtomicString constructor takes this pre-calculated hash value to efficiently construct
1288         itself. But now, we have constexpr hash function, then we do not need to specify hash value
1289         directly in this way. Thus we drop this functionality.
1290
1291         * wtf/text/AtomicString.h:
1292         * wtf/text/AtomicStringImpl.cpp:
1293         (WTF::HashAndCharactersTranslator::hash): Deleted.
1294         (WTF::HashAndCharactersTranslator::equal): Deleted.
1295         (WTF::HashAndCharactersTranslator::translate): Deleted.
1296         * wtf/text/AtomicStringImpl.h:
1297         (WTF::AtomicStringImpl::add):
1298
1299 2017-07-10  Per Arne Vollan  <pvollan@apple.com>
1300
1301         [Win] Link error when building WTF from WTF.proj project file.
1302         https://bugs.webkit.org/show_bug.cgi?id=174316
1303         <rdar://problem/33178200>
1304
1305         Reviewed by Brent Fulgham.
1306
1307         WTF_CPU_X86 cmake variable needs to be set for link libraries directories to be correct.
1308
1309         * WTF.vcxproj/WTF.proj:
1310
1311 2017-07-03  Brian Burg  <bburg@apple.com>
1312
1313         Web Replay: remove some unused code
1314         https://bugs.webkit.org/show_bug.cgi?id=173903
1315
1316         Rubber-stamped by Joseph Pecoraro.
1317
1318         * wtf/FeatureDefines.h:
1319
1320 2017-07-10  Brady Eidson  <beidson@apple.com>
1321
1322         Cleanup lifetime issues of UniqueIDBDatabase and IDBBackingStore.
1323         <rdar://problem/32908525> and https://bugs.webkit.org/show_bug.cgi?id=174244
1324
1325         Reviewed by David Kilzer and Alex Christensen. 
1326
1327         Add proper "kill" support to CrossThreadQueue, as well as isEmpty() support.
1328
1329         * wtf/CrossThreadQueue.h:
1330         (WTF::CrossThreadQueue<DataType>::append):
1331         (WTF::CrossThreadQueue<DataType>::kill):
1332         (WTF::CrossThreadQueue<DataType>::isKilled):
1333         (WTF::CrossThreadQueue<DataType>::isEmpty):
1334         (WTF::CrossThreadQueue::isKilled): Deleted.
1335
1336 2017-07-09  Yusuke Suzuki  <utatane.tea@gmail.com>
1337
1338         [JSC] Use fastMalloc / fastFree for STL containers
1339         https://bugs.webkit.org/show_bug.cgi?id=174297
1340
1341         Reviewed by Sam Weinig.
1342
1343         * wtf/FastMalloc.h:
1344         (WTF::FastAllocator::FastAllocator):
1345         (WTF::FastAllocator::allocate):
1346         (WTF::FastAllocator::deallocate):
1347         (WTF::FastAllocator::operator==):
1348         (WTF::FastAllocator::operator!=):
1349
1350 2017-07-07  Brent Fulgham  <bfulgham@apple.com>
1351
1352         [WK2] Use a rolling 30-day uptime for processing statistics
1353         https://bugs.webkit.org/show_bug.cgi?id=174235
1354         <rdar://problem/33164381>
1355
1356         Reviewed by Chris Dumez.
1357
1358         Modify Deque to allow it to be used in a template specialization in KeyedDecoder.
1359
1360         * wtf/Deque.h:
1361
1362 2017-07-07  Commit Queue  <commit-queue@webkit.org>
1363
1364         Unreviewed, rolling out r219238, r219239, and r219241.
1365         https://bugs.webkit.org/show_bug.cgi?id=174265
1366
1367         "fast/workers/dedicated-worker-lifecycle.html is flaky"
1368         (Requested by yusukesuzuki on #webkit).
1369
1370         Reverted changesets:
1371
1372         "[WTF] Implement WTF::ThreadGroup"
1373         https://bugs.webkit.org/show_bug.cgi?id=174081
1374         http://trac.webkit.org/changeset/219238
1375
1376         "Unreviewed, build fix after r219238"
1377         https://bugs.webkit.org/show_bug.cgi?id=174081
1378         http://trac.webkit.org/changeset/219239
1379
1380         "Unreviewed, CLoop build fix after r219238"
1381         https://bugs.webkit.org/show_bug.cgi?id=174081
1382         http://trac.webkit.org/changeset/219241
1383
1384 2017-07-07  Yusuke Suzuki  <utatane.tea@gmail.com>
1385
1386         Unreviewed, Windows build fix after r219233 part 4
1387         https://bugs.webkit.org/show_bug.cgi?id=174231
1388
1389         * wtf/Assertions.h:
1390
1391 2017-07-06  Yusuke Suzuki  <utatane.tea@gmail.com>
1392
1393         Unreviewed, Windows build fix after r219233 part 3
1394         https://bugs.webkit.org/show_bug.cgi?id=174231
1395
1396         * wtf/Assertions.h:
1397         (compilerFenceForCrash):
1398
1399 2017-07-06  Yusuke Suzuki  <utatane.tea@gmail.com>
1400
1401         Unreviewed, Windows build fix after r219233 part 2
1402         https://bugs.webkit.org/show_bug.cgi?id=174231
1403
1404         * wtf/Assertions.h:
1405
1406 2017-07-06  Yusuke Suzuki  <utatane.tea@gmail.com>
1407
1408         Unreviewed, Windows build fix after r219233
1409         https://bugs.webkit.org/show_bug.cgi?id=174231
1410
1411         * wtf/Compiler.h:
1412
1413 2017-07-06  Yusuke Suzuki  <utatane.tea@gmail.com>
1414
1415         Unreviewed, build fix after r219238
1416         https://bugs.webkit.org/show_bug.cgi?id=174081
1417
1418         * wtf/Threading.cpp:
1419         (WTF::Thread::addToThreadGroup):
1420
1421 2017-07-05  Yusuke Suzuki  <utatane.tea@gmail.com>
1422
1423         [WTF] Implement WTF::ThreadGroup
1424         https://bugs.webkit.org/show_bug.cgi?id=174081
1425
1426         Reviewed by Mark Lam.
1427
1428         This patch implements WTF::ThreadGroup. It implements core of JSC::MachineThreads with more reliable way.
1429         JSC::MachineThreads was complicated because of managing dead threads. Each JSC::MachineThreads has its
1430         own TLS with a registered destructor. And everytime a thread dies, the registered TLS destructor is called.
1431         And this destructor will remove the current dying thread from JSC::MachineThreads.
1432
1433         However the above implementation is tricky. And each JSC::MachineThreads requires own TLS space, which is
1434         not considered in WTF's Windows ThreadSpecific implementation. Current design works well since we only
1435         have small number of MachineThreads right now.
1436
1437         Instead, we use more reliable way. After introducing WTF::Thread, WTF::Thread has WTF::Thread::didExit,
1438         which is called when associated TLS (with WTF::Thread) is destroyed. We leverage this mechanism to remove
1439         WTF::Thread from MachineThreads.
1440
1441         This patch introduces WTF::ThreadGroup. It is tightly integrated with WTF::Thread: WTF::Thread knows
1442         ThreadGroups which includes this thread. And WTF::ThreadGroup of course knows WTF::Threads added to it.
1443         WTF::Thread::didExit carefully remove itself from WTF::ThreadGroups.
1444
1445         The most important part of this patch is locking. WTF::Thread can die. And WTF::ThreadGroup can die.
1446         If we take a design using two fine grain locks in WTF::Thread and WTF::ThreadGroup, we easily encounter
1447         dead lock. Consider the following case.
1448
1449         1. When adding WTF::Thread (TH) to WTF::ThreadGroup (THG), we first hold a lock of THG, and hold a lock of TH (locking order is THG -> TH).
1450         2. When TH dies, TH need to hold a lock of TH to iterate THGs. And we hold a lock of THG to unregister TH from it (locking order is TH -> THG).
1451         3. When suspending and resuming THs in THG, we first hold a lock of THG. And then, we hold a lock of TH to suspend and resume it (locking order is THG -> TH).
1452         4. When destroying THG, we need to hold a lock of TH to unregister THG from TH. We can hold a lock of THG before that (locking order is THG -> TH).
1453
1454         Then, it easily causes dead lock. We cannot swap the locking order of (2) since iterating THG requires a lock of TH.
1455         To solve this problem, we introduce one global lock ThreadGroup::destructionMutex (GL).
1456
1457         1. When adding WTF::Thread (TH) to WTF::ThreadGroup (THG), we first hold GL, and hold a lock of THG. Do not hold a
1458         lock of TH. TH's thread groups information is guarded by GL instead of a lock of TH (locking order is GL -> THG).
1459         2. When TH dies, TH need to hold GL to iterate THGs. And we hold a lock of THG to unregister TH from it (locking order is GL -> THG).
1460         3. When suspending and resuming THs in THG, we first hold a lock of THG. And then, we hold a lock of TH to suspend and resume it (locking order is THG -> TH).
1461         4. When destroying THG, we need to hold GL to unregister THG from TH. We can hold a lock of THG after that (locking order is GL -> THG).
1462
1463         We still have a lock of THG. By separating GL and THG's lock, we can hold a lock of THG while completely unrelated TH is destructed which takes a lock of GL and unrelated THG.
1464
1465         * WTF.xcodeproj/project.pbxproj:
1466         * wtf/AutomaticThread.cpp:
1467         * wtf/CMakeLists.txt:
1468         * wtf/CrossThreadCopier.h:
1469         * wtf/ParkingLot.h:
1470         * wtf/ThreadGroup.cpp: Copied from Source/JavaScriptCore/wasm/WasmMachineThreads.cpp.
1471         (WTF::ThreadGroup::destructionMutex):
1472         (WTF::ThreadGroup::~ThreadGroup):
1473         (WTF::ThreadGroup::add):
1474         (WTF::ThreadGroup::addCurrentThread):
1475         (WTF::ThreadGroup::removeCurrentThread):
1476         * wtf/ThreadGroup.h: Copied from Source/JavaScriptCore/wasm/WasmMachineThreads.cpp.
1477         (WTF::ThreadGroup::create):
1478         (WTF::ThreadGroup::threads):
1479         (WTF::ThreadGroup::getLock):
1480         * wtf/Threading.cpp:
1481         (WTF::Thread::didExit):
1482         (WTF::Thread::addToThreadGroup):
1483         (WTF::Thread::removeFromThreadGroup):
1484         * wtf/Threading.h:
1485         (WTF::Thread::canAddToThreadGroup):
1486
1487 2017-07-06  Yusuke Suzuki  <utatane.tea@gmail.com>
1488
1489         [WTF] Clean up StringStatics.cpp by using LazyNeverDestroyed<> for Atoms
1490         https://bugs.webkit.org/show_bug.cgi?id=174150
1491
1492         Reviewed by Mark Lam.
1493
1494         This patch cleans up StringStatics.cpp and remove it from the tree.
1495
1496         1. Move StringImpl methods to appropriate place, "StringImpl.cpp".
1497
1498         StringImpl::hashSlowCase() and StringImpl::concurrentHash() are defined in
1499         StringStatics.cpp. But they should be defined in StringImpl.cpp.
1500         This patch just moves them to StringImpl.cpp.
1501
1502         2. Use LazyNeverDestroyed to initialize AtomicString atoms like emptyAtom.
1503
1504         Previously, we initialized AtomicString atoms like emptyAtom in a hacky way.
1505         We first define them as extern global variables. However, AtomicString has
1506         a non-trivial constructor. Thus, we cannot do this because it requires global
1507         constructor calls. This is why we have StringStatics.cpp. In this file, we
1508         include "StaticConstructors.h". After including this file, all the global
1509         constructor call disabled in Windows. And in GCC environment, we allocate
1510         void* storage for that variable. And we use placement new in AtomicString::init()
1511         to initialize these storage.
1512         However, we already have better way for that: LazyNeverDestroyed. It just allocates
1513         storage like the above. And it does not have any global constructors. Thus
1514         we can just declare it as a global variable. And we initialize them lazily in
1515         AtomicString::init(). This way effectively avoids "StaticConstructors.h" hacky way.
1516         And it makes "StringStatics.cpp" unnecessary.
1517         Then, we just move these variables and AtomicString::init() to AtomicString.cpp.
1518
1519         And we also change emptyAtom to emptyAtom() to get the value from LazyNeverDestroyed<>.
1520
1521         * WTF.xcodeproj/project.pbxproj:
1522         * wtf/CMakeLists.txt:
1523         * wtf/text/AtomicString.cpp:
1524         (WTF::AtomicString::convertASCIICase):
1525         (WTF::AtomicString::fromUTF8Internal):
1526         (WTF::AtomicString::init):
1527         * wtf/text/AtomicString.h:
1528         (WTF::nullAtom):
1529         (WTF::emptyAtom):
1530         (WTF::starAtom):
1531         (WTF::xmlAtom):
1532         (WTF::xmlnsAtom):
1533         (WTF::AtomicString::fromUTF8):
1534         * wtf/text/StringBuilder.h:
1535         (WTF::StringBuilder::toAtomicString):
1536         * wtf/text/StringImpl.cpp:
1537         (WTF::StringImpl::hashSlowCase):
1538         (WTF::StringImpl::concurrentHash):
1539         * wtf/text/StringStatics.cpp: Removed.
1540
1541 2017-07-06  Keith Miller  <keith_miller@apple.com>
1542
1543         Add extra insurance to prevent clang from making crash traces sad
1544         https://bugs.webkit.org/show_bug.cgi?id=174231
1545
1546         Reviewed by Saam Barati.
1547
1548         This patch makes it slightly harder for Clang to coalesce our crash calls.
1549         Additionally, it also makes Clang never tail call the WTFCrashWithInfo so
1550         our stack trace should always be "reasonable".
1551
1552         * wtf/Assertions.h:
1553         * wtf/Compiler.h:
1554
1555 2017-07-06  Matt Lewis  <jlewis3@apple.com>
1556
1557         Unreviewed, rolling out r219178.
1558
1559         This caused a consistent failure with the API test
1560         StringBuilderTest.ToAtomicStringOnEmpty on all Debug testers.
1561
1562         Reverted changeset:
1563
1564         "[WTF] Clean up StringStatics.cpp by using
1565         LazyNeverDestroyed<> for Atoms"
1566         https://bugs.webkit.org/show_bug.cgi?id=174150
1567         http://trac.webkit.org/changeset/219178
1568
1569 2017-07-05  Don Olmstead  <don.olmstead@sony.com>
1570
1571         [WTF] Move SoftLinking.h into WTF
1572         https://bugs.webkit.org/show_bug.cgi?id=174000
1573
1574         Reviewed by Alex Christensen.
1575
1576         * WTF.xcodeproj/project.pbxproj:
1577         * wtf/SoftLinking.h: Copied from Source/WebCore/platform/ios/QuickLookSoftLink.mm.
1578         * wtf/cocoa/SoftLinking.h: Renamed from Source/WebCore/platform/cocoa/SoftLinking.h.
1579         * wtf/win/SoftLinking.h: Renamed from Source/WebCore/platform/win/SoftLinking.h.
1580
1581 2017-07-05  Yusuke Suzuki  <utatane.tea@gmail.com>
1582
1583         Upgrade GCC baseline
1584         https://bugs.webkit.org/show_bug.cgi?id=174155
1585
1586         Reviewed by Michael Catanzaro.
1587
1588         * wtf/Compiler.h:
1589
1590 2017-07-05  Yusuke Suzuki  <utatane.tea@gmail.com>
1591
1592         WTF::StringImpl::copyChars segfaults when built with GCC 7
1593         https://bugs.webkit.org/show_bug.cgi?id=173407
1594
1595         Reviewed by Andreas Kling.
1596
1597         With GCC 7, StringImpl::copyChars() behaves as unexpected.
1598         This function violates strict aliasing rule.
1599
1600         This optimization is originally introduced to improve performance
1601         in SunSpider's string tests in 2008. When running it in my Linux
1602         box, it no longer causes any observable difference. So, we just
1603         remove this optimization.
1604
1605                                         baseline                  patched
1606
1607         string-base64                7.7544+-0.1761            7.6138+-0.2071          might be 1.0185x faster
1608         string-fasta                10.5429+-0.2746     ?     10.7500+-0.2669        ? might be 1.0196x slower
1609         string-tagcloud             14.8588+-0.2828           14.8039+-0.3039
1610         string-unpack-code          36.1769+-0.4251           35.3397+-0.5398          might be 1.0237x faster
1611         string-validate-input        8.5182+-0.2206            8.3514+-0.2179          might be 1.0200x faster
1612
1613         * wtf/text/StringImpl.h:
1614         (WTF::StringImpl::copyChars):
1615
1616 2017-07-05  Yusuke Suzuki  <utatane.tea@gmail.com>
1617
1618         Use std::lock_guard instead of std::unique_lock if move semantics and try_lock is not necessary
1619         https://bugs.webkit.org/show_bug.cgi?id=174148
1620
1621         Reviewed by Mark Lam.
1622
1623         It is not necessary to use std::unique_lock if we do not use additional features compared to std::lock_guard.
1624
1625         (WTF::ThreadHolder::get):
1626         (WTF::ThreadHolder::initialize):
1627         (WTF::ThreadHolder::destruct):
1628         * wtf/Threading.cpp:
1629         (WTF::Thread::didExit):
1630         * wtf/ThreadingPthreads.cpp:
1631         (WTF::Thread::changePriority):
1632         (WTF::Thread::waitForCompletion):
1633         (WTF::Thread::detach):
1634         (WTF::Thread::signal):
1635         (WTF::Thread::resume):
1636         (WTF::Thread::getRegisters):
1637         (WTF::Thread::establish):
1638         * wtf/ThreadingWin.cpp:
1639         (WTF::Thread::changePriority):
1640         (WTF::Thread::waitForCompletion):
1641         (WTF::Thread::detach):
1642         (WTF::Thread::resume):
1643         (WTF::Thread::getRegisters):
1644         (WTF::Thread::establish):
1645         * wtf/WordLock.cpp:
1646         (WTF::WordLockBase::unlockSlow):
1647
1648 2017-07-05  Yusuke Suzuki  <utatane.tea@gmail.com>
1649
1650         [WTF] Clean up StringStatics.cpp by using LazyNeverDestroyed<> for Atoms
1651         https://bugs.webkit.org/show_bug.cgi?id=174150
1652
1653         Reviewed by Mark Lam.
1654
1655         This patch cleans up StringStatics.cpp and remove it from the tree.
1656
1657         1. Move StringImpl methods to appropriate place, "StringImpl.cpp".
1658
1659         StringImpl::hashSlowCase() and StringImpl::concurrentHash() are defined in
1660         StringStatics.cpp. But they should be defined in StringImpl.cpp.
1661         This patch just moves them to StringImpl.cpp.
1662
1663         2. Use LazyNeverDestroyed to initialize AtomicString atoms like emptyAtom.
1664
1665         Previously, we initialized AtomicString atoms like emptyAtom in a hacky way.
1666         We first define them as extern global variables. However, AtomicString has
1667         a non-trivial constructor. Thus, we cannot do this because it requires global
1668         constructor calls. This is why we have StringStatics.cpp. In this file, we
1669         include "StaticConstructors.h". After including this file, all the global
1670         constructor call disabled in Windows. And in GCC environment, we allocate
1671         void* storage for that variable. And we use placement new in AtomicString::init()
1672         to initialize these storage.
1673         However, we already have better way for that: LazyNeverDestroyed. It just allocates
1674         storage like the above. And it does not have any global constructors. Thus
1675         we can just declare it as a global variable. And we initialize them lazily in
1676         AtomicString::init(). This way effectively avoids "StaticConstructors.h" hacky way.
1677         And it makes "StringStatics.cpp" unnecessary.
1678         Then, we just move these variables and AtomicString::init() to AtomicString.cpp.
1679
1680         And we also change emptyAtom to emptyAtom() to get the value from LazyNeverDestroyed<>.
1681
1682         * WTF.xcodeproj/project.pbxproj:
1683         * wtf/CMakeLists.txt:
1684         * wtf/text/AtomicString.cpp:
1685         (WTF::AtomicString::convertASCIICase):
1686         (WTF::AtomicString::fromUTF8Internal):
1687         (WTF::AtomicString::init):
1688         * wtf/text/AtomicString.h:
1689         (WTF::nullAtom):
1690         (WTF::emptyAtom):
1691         (WTF::starAtom):
1692         (WTF::xmlAtom):
1693         (WTF::xmlnsAtom):
1694         (WTF::AtomicString::fromUTF8):
1695         * wtf/text/StringBuilder.h:
1696         (WTF::StringBuilder::toAtomicString):
1697         * wtf/text/StringImpl.cpp:
1698         (WTF::StringImpl::hashSlowCase):
1699         (WTF::StringImpl::concurrentHash):
1700         * wtf/text/StringStatics.cpp: Removed.
1701
1702 2017-07-05  Yusuke Suzuki  <utatane.tea@gmail.com>
1703
1704         WTF::Thread should have the threads stack bounds.
1705         https://bugs.webkit.org/show_bug.cgi?id=173975
1706
1707         Reviewed by Keith Miller.
1708
1709         We move StackBounds from WTFThreadData to WTF::Thread.
1710         One important thing is that we should make valid StackBounds
1711         visible to Thread::create() caller. When the caller get
1712         WTF::Thread from Thread::create(), this WTF::Thread should
1713         have a valid StackBounds. But StackBounds information can be
1714         retrived only in the WTF::Thread's thread itself.
1715
1716         We also clean up WTF::initializeThreading. StringImpl::empty()
1717         is now statically initialized by using constexpr constructor.
1718         Thus we do not need to call StringImpl::empty() explicitly here.
1719         And WTF::initializeThreading() does not have any main thread
1720         affinity right now in all the platforms. So we fix the comment
1721         in Threading.h. Then, now, WTF::initializeThreading() is called
1722         in UI thread when using Web thread in iOS.
1723
1724         * wtf/StackBounds.h:
1725         (WTF::StackBounds::emptyBounds):
1726         (WTF::StackBounds::StackBounds):
1727         * wtf/StackStats.cpp:
1728         (WTF::StackStats::PerThreadStats::PerThreadStats):
1729         * wtf/Threading.cpp:
1730         (WTF::threadEntryPoint):
1731         (WTF::Thread::create):
1732         (WTF::Thread::currentMayBeNull):
1733         (WTF::Thread::initialize):
1734         (WTF::initializeThreading):
1735         * wtf/Threading.h:
1736         (WTF::Thread::stack):
1737         * wtf/ThreadingPthreads.cpp:
1738         (WTF::Thread::initializeCurrentThreadEvenIfNonWTFCreated):
1739         (WTF::Thread::current):
1740         (WTF::initializeCurrentThreadEvenIfNonWTFCreated): Deleted.
1741         (WTF::Thread::currentMayBeNull): Deleted.
1742         * wtf/ThreadingWin.cpp:
1743         (WTF::Thread::initializeCurrentThreadEvenIfNonWTFCreated):
1744         (WTF::Thread::initializeCurrentThreadInternal):
1745         (WTF::Thread::current):
1746         * wtf/WTFThreadData.cpp:
1747         (WTF::WTFThreadData::WTFThreadData):
1748         * wtf/WTFThreadData.h:
1749         (WTF::WTFThreadData::stack): Deleted.
1750
1751 2017-07-05  Keith Miller  <keith_miller@apple.com>
1752
1753         Crashing with information should have an abort reason
1754         https://bugs.webkit.org/show_bug.cgi?id=174185
1755
1756         Reviewed by Saam Barati.
1757
1758         Fix an ifdef to actually work with X86_64. It turns out X64_64 is
1759         not an architecture... Whoops.
1760
1761         * wtf/Assertions.cpp:
1762
1763 2017-07-03  Myles C. Maxfield  <mmaxfield@apple.com>
1764
1765         Remove copy of ICU headers from WebKit
1766         https://bugs.webkit.org/show_bug.cgi?id=116407
1767
1768         Reviewed by Alex Christensen.
1769
1770         Add an extra rsync command to CopyWTFHeaders which copies the ICU headers
1771         to DSTROOT/usr/local/include/. These headers already live inside a
1772         "unicode" folder, so an example path of a header is
1773         DSTROOT/usr/local/include/unicode/uchar.h. This is already in the search
1774         path of the other WebKit projects, so those other projects can remove
1775         their explicit listing of the old place these headers lived.
1776
1777         Also add the remaining ICU 55.1 headers which the other projects (like
1778         WebCore) need. Revert any local changes to these headers in favor of
1779         using the GCC_PREPROCESSOR_DEFINITIONS build setting. This is so we can
1780         compile the same way against unmodified headers.
1781
1782         * Configurations/Base.xcconfig:
1783         * Configurations/CopyWTFHeaders.xcconfig:
1784         * WTF.xcodeproj/project.pbxproj:
1785         * icu/unicode/alphaindex.h: Added.
1786         * icu/unicode/appendable.h: Added.
1787         * icu/unicode/basictz.h: Added.
1788         * icu/unicode/brkiter.h: Added.
1789         (BreakIterator::isBufferClone):
1790         * icu/unicode/bytestrie.h: Added.
1791         * icu/unicode/bytestriebuilder.h: Added.
1792         * icu/unicode/calendar.h: Added.
1793         (Calendar::createInstance):
1794         (Calendar::roll):
1795         (Calendar::internalSet):
1796         (Calendar::weekNumber):
1797         * icu/unicode/caniter.h: Added.
1798         * icu/unicode/chariter.h: Renamed from Source/WebCore/icu/unicode/chariter.h.
1799         * icu/unicode/choicfmt.h: Added.
1800         * icu/unicode/coleitr.h: Added.
1801         (CollationElementIterator::primaryOrder):
1802         (CollationElementIterator::secondaryOrder):
1803         (CollationElementIterator::tertiaryOrder):
1804         (CollationElementIterator::isIgnorable):
1805         * icu/unicode/coll.h: Added.
1806         * icu/unicode/compactdecimalformat.h: Added.
1807         * icu/unicode/curramt.h: Added.
1808         (CurrencyAmount::getCurrency):
1809         (CurrencyAmount::getISOCurrency):
1810         * icu/unicode/currpinf.h: Added.
1811         (CurrencyPluralInfo::operator!=):
1812         * icu/unicode/currunit.h: Added.
1813         (CurrencyUnit::getISOCurrency):
1814         * icu/unicode/datefmt.h: Added.
1815         * icu/unicode/dbbi.h: Added.
1816         * icu/unicode/dcfmtsym.h: Added.
1817         (DecimalFormatSymbols::getSymbol):
1818         (DecimalFormatSymbols::getConstSymbol):
1819         (DecimalFormatSymbols::setSymbol):
1820         (DecimalFormatSymbols::getLocale):
1821         (DecimalFormatSymbols::getCurrencyPattern):
1822         * icu/unicode/decimfmt.h: Added.
1823         (DecimalFormat::getConstSymbol):
1824         * icu/unicode/docmain.h: Added.
1825         * icu/unicode/dtfmtsym.h: Added.
1826         * icu/unicode/dtintrv.h: Added.
1827         (DateInterval::getFromDate):
1828         (DateInterval::getToDate):
1829         (DateInterval::operator!=):
1830         * icu/unicode/dtitvfmt.h: Added.
1831         (DateIntervalFormat::operator!=):
1832         * icu/unicode/dtitvinf.h: Added.
1833         (DateIntervalInfo::operator!=):
1834         * icu/unicode/dtptngen.h: Added.
1835         * icu/unicode/dtrule.h: Added.
1836         * icu/unicode/enumset.h: Added.
1837         (EnumSet::EnumSet):
1838         (EnumSet::~EnumSet):
1839         (EnumSet::clear):
1840         (EnumSet::add):
1841         (EnumSet::remove):
1842         (EnumSet::contains):
1843         (EnumSet::set):
1844         (EnumSet::get):
1845         (EnumSet::isValidEnum):
1846         (EnumSet::isValidValue):
1847         (EnumSet::operator=):
1848         (EnumSet::getAll):
1849         (EnumSet::flag):
1850         * icu/unicode/errorcode.h: Added.
1851         * icu/unicode/fieldpos.h: Added.
1852         (FieldPosition::operator=):
1853         (FieldPosition::operator==):
1854         (FieldPosition::operator!=):
1855         * icu/unicode/filteredbrk.h: Added.
1856         * icu/unicode/fmtable.h: Added.
1857         (Formattable::getDate):
1858         (Formattable::getString):
1859         (Formattable::getLong):
1860         (Formattable::toUFormattable):
1861         (Formattable::fromUFormattable):
1862         * icu/unicode/format.h: Added.
1863         * icu/unicode/fpositer.h: Added.
1864         * icu/unicode/gender.h: Added.
1865         * icu/unicode/gregocal.h: Added.
1866         * icu/unicode/icudataver.h: Added.
1867         * icu/unicode/icuplug.h: Added.
1868         * icu/unicode/idna.h: Added.
1869         * icu/unicode/listformatter.h: Added.
1870         (ListFormatData::ListFormatData):
1871         * icu/unicode/locdspnm.h: Added.
1872         (LocaleDisplayNames::createInstance):
1873         * icu/unicode/locid.h: Added.
1874         (Locale::operator!=):
1875         (Locale::getCountry):
1876         (Locale::getLanguage):
1877         (Locale::getScript):
1878         (Locale::getVariant):
1879         (Locale::getName):
1880         (Locale::isBogus):
1881         * icu/unicode/measfmt.h: Added.
1882         * icu/unicode/measunit.h: Added.
1883         * icu/unicode/measure.h: Added.
1884         (Measure::getNumber):
1885         (Measure::getUnit):
1886         * icu/unicode/messagepattern.h: Added.
1887         * icu/unicode/msgfmt.h: Added.
1888         * icu/unicode/normalizer2.h: Added.
1889         * icu/unicode/normlzr.h: Added.
1890         (Normalizer::operator!= ):
1891         (Normalizer::quickCheck):
1892         (Normalizer::isNormalized):
1893         (Normalizer::compare):
1894         * icu/unicode/numfmt.h: Added.
1895         (NumberFormat::isParseIntegerOnly):
1896         (NumberFormat::isLenient):
1897         * icu/unicode/numsys.h: Added.
1898         * icu/unicode/parsepos.h: Added.
1899         (ParsePosition::operator=):
1900         (ParsePosition::operator==):
1901         (ParsePosition::operator!=):
1902         (ParsePosition::getIndex):
1903         (ParsePosition::setIndex):
1904         (ParsePosition::getErrorIndex):
1905         (ParsePosition::setErrorIndex):
1906         * icu/unicode/plurfmt.h: Added.
1907         * icu/unicode/plurrule.h: Added.
1908         * icu/unicode/rbbi.h: Added.
1909         (RuleBasedBreakIterator::operator!=):
1910         * icu/unicode/rbnf.h: Added.
1911         (RuleBasedNumberFormat::isLenient):
1912         (RuleBasedNumberFormat::getDefaultRuleSet):
1913         * icu/unicode/rbtz.h: Added.
1914         * icu/unicode/regex.h: Added.
1915         * icu/unicode/region.h: Added.
1916         * icu/unicode/reldatefmt.h: Added.
1917         * icu/unicode/resbund.h: Added.
1918         * icu/unicode/schriter.h: Added.
1919         * icu/unicode/scientificnumberformatter.h: Added.
1920         * icu/unicode/search.h: Added.
1921         (SearchIterator::operator!=):
1922         * icu/unicode/selfmt.h: Added.
1923         * icu/unicode/simpletz.h: Added.
1924         (SimpleTimeZone::setStartRule):
1925         (SimpleTimeZone::setEndRule):
1926         (SimpleTimeZone::getOffset):
1927         * icu/unicode/smpdtfmt.h: Added.
1928         (SimpleDateFormat::get2DigitYearStart):
1929         * icu/unicode/sortkey.h: Added.
1930         (CollationKey::operator!=):
1931         (CollationKey::isBogus):
1932         (CollationKey::getByteArray):
1933         * icu/unicode/stringtriebuilder.h: Added.
1934         * icu/unicode/stsearch.h: Added.
1935         * icu/unicode/symtable.h: Added.
1936         * icu/unicode/tblcoll.h: Added.
1937         * icu/unicode/timezone.h: Added.
1938         (TimeZone::getID):
1939         (TimeZone::setID):
1940         * icu/unicode/tmunit.h: Added.
1941         * icu/unicode/tmutamt.h: Added.
1942         (TimeUnitAmount::operator!=):
1943         * icu/unicode/tmutfmt.h: Added.
1944         (TimeUnitFormat::operator!=):
1945         * icu/unicode/translit.h: Added.
1946         (Transliterator::getMaximumContextLength):
1947         (Transliterator::setID):
1948         (Transliterator::integerToken):
1949         (Transliterator::pointerToken):
1950         * icu/unicode/tzfmt.h: Added.
1951         * icu/unicode/tznames.h: Added.
1952         * icu/unicode/tzrule.h: Added.
1953         * icu/unicode/tztrans.h: Added.
1954         * icu/unicode/ubidi.h: Added.
1955         * icu/unicode/ucal.h: Renamed from Source/JavaScriptCore/icu/unicode/ucal.h.
1956         * icu/unicode/ucasemap.h: Added.
1957         * icu/unicode/ucat.h: Added.
1958         * icu/unicode/ucharstrie.h: Added.
1959         * icu/unicode/ucharstriebuilder.h: Added.
1960         * icu/unicode/uchriter.h: Added.
1961         * icu/unicode/uclean.h: Added.
1962         * icu/unicode/ucnv_cb.h: Renamed from Source/WebCore/icu/unicode/ucnv_cb.h.
1963         * icu/unicode/ucnvsel.h: Added.
1964         * icu/unicode/ucoleitr.h: Renamed from Source/WebCore/icu/unicode/ucoleitr.h.
1965         * icu/unicode/uconfig.h:
1966         * icu/unicode/ucsdet.h: Renamed from Source/WebCore/icu/unicode/ucsdet.h.
1967         * icu/unicode/udat.h: Renamed from Source/JavaScriptCore/icu/unicode/udat.h.
1968         * icu/unicode/udata.h: Added.
1969         * icu/unicode/udateintervalformat.h: Added.
1970         * icu/unicode/udatpg.h: Renamed from Source/JavaScriptCore/icu/unicode/udatpg.h.
1971         * icu/unicode/udisplaycontext.h: Renamed from Source/JavaScriptCore/icu/unicode/udisplaycontext.h.
1972         * icu/unicode/ufieldpositer.h: Renamed from Source/JavaScriptCore/icu/unicode/ufieldpositer.h.
1973         * icu/unicode/uformattable.h: Renamed from Source/JavaScriptCore/icu/unicode/uformattable.h.
1974         * icu/unicode/ugender.h: Added.
1975         * icu/unicode/uidna.h: Renamed from Source/WebCore/icu/unicode/uidna.h.
1976         * icu/unicode/uldnames.h: Added.
1977         * icu/unicode/ulistformatter.h: Added.
1978         * icu/unicode/ulocdata.h: Added.
1979         * icu/unicode/umisc.h: Renamed from Source/JavaScriptCore/icu/unicode/umisc.h.
1980         * icu/unicode/umsg.h: Added.
1981         * icu/unicode/unifilt.h: Added.
1982         * icu/unicode/unifunct.h: Added.
1983         * icu/unicode/unimatch.h: Added.
1984         * icu/unicode/unirepl.h: Added.
1985         * icu/unicode/uniset.h: Added.
1986         (UnicodeSet::operator!=):
1987         (UnicodeSet::isFrozen):
1988         (UnicodeSet::containsSome):
1989         (UnicodeSet::isBogus):
1990         (UnicodeSet::fromUSet):
1991         (UnicodeSet::toUSet):
1992         (UnicodeSet::span):
1993         (UnicodeSet::spanBack):
1994         * icu/unicode/unum.h: Renamed from Source/JavaScriptCore/icu/unicode/unum.h.
1995         * icu/unicode/unumsys.h: Renamed from Source/JavaScriptCore/icu/unicode/unumsys.h.
1996         * icu/unicode/upluralrules.h: Added.
1997         * icu/unicode/uregex.h: Added.
1998         * icu/unicode/uregion.h: Added.
1999         * icu/unicode/urep.h: Added.
2000         * icu/unicode/ures.h: Added.
2001         (ures_getUnicodeString):
2002         (ures_getNextUnicodeString):
2003         (ures_getUnicodeStringByIndex):
2004         (ures_getUnicodeStringByKey):
2005         * icu/unicode/usearch.h: Renamed from Source/WebCore/icu/unicode/usearch.h.
2006         * icu/unicode/usetiter.h: Added.
2007         (UnicodeSetIterator::isString):
2008         (UnicodeSetIterator::getCodepoint):
2009         (UnicodeSetIterator::getCodepointEnd):
2010         * icu/unicode/ushape.h: Renamed from Source/WebCore/icu/unicode/ushape.h.
2011         * icu/unicode/uspoof.h: Added.
2012         * icu/unicode/usprep.h: Added.
2013         * icu/unicode/ustdio.h: Added.
2014         * icu/unicode/ustream.h: Added.
2015         * icu/unicode/ustringtrie.h: Added.
2016         * icu/unicode/utf32.h: Added.
2017         * icu/unicode/utmscale.h: Added.
2018         * icu/unicode/utrace.h: Added.
2019         * icu/unicode/utrans.h: Added.
2020         * icu/unicode/utypes.h:
2021         * icu/unicode/vtzone.h: Added.
2022
2023 2017-07-04  Yusuke Suzuki  <utatane.tea@gmail.com>
2024
2025         [WTF] Make double-conversion's cache data constant and drop double_conversion::initialize()
2026         https://bugs.webkit.org/show_bug.cgi?id=174124
2027
2028         Reviewed by Saam Barati.
2029
2030         We annotate double-conversion's cache data as const and constexpr. And move it out of function.
2031         Since they are not involving global constructors, they are compiled as rodata and initialized
2032         without calling double_conversion::initialize().
2033
2034         And we drop double_conversion::initialize() function since it is no longer necessary.
2035
2036         * wtf/Threading.cpp:
2037         (WTF::initializeThreading):
2038         * wtf/dtoa/cached-powers.cc:
2039         * wtf/dtoa/cached-powers.h:
2040
2041 2017-07-04  Yusuke Suzuki  <utatane.tea@gmail.com>
2042
2043         [WTF] Initialize srandom and srand with cryptographically random number
2044         https://bugs.webkit.org/show_bug.cgi?id=174123
2045
2046         Reviewed by Mark Lam.
2047
2048         Use cryptographically random number instead of current time as a seed.
2049
2050         * wtf/RandomNumberSeed.h:
2051         (WTF::initializeRandomNumberGenerator):
2052
2053 2017-07-04  Joseph Pecoraro  <pecoraro@apple.com>
2054
2055         Xcode duplicate UUID for DisallowCType.h and DispatchPtr.h
2056         https://bugs.webkit.org/show_bug.cgi?id=174117
2057
2058         Reviewed by Alexey Proskuryakov.
2059
2060         * WTF.xcodeproj/project.pbxproj:
2061         Give DisallowCType.h and DispatchPtr.h different UUIDs.
2062
2063 2017-07-03  Saam Barati  <sbarati@apple.com>
2064
2065         LayoutTest workers/bomb.html is a Crash
2066         https://bugs.webkit.org/show_bug.cgi?id=167757
2067         <rdar://problem/33086462>
2068
2069         Reviewed by Keith Miller.
2070
2071         * wtf/AutomaticThread.cpp:
2072         (WTF::AutomaticThreadCondition::waitFor):
2073         * wtf/AutomaticThread.h:
2074
2075 2017-07-03  Commit Queue  <commit-queue@webkit.org>
2076
2077         Unreviewed, rolling out r219060.
2078         https://bugs.webkit.org/show_bug.cgi?id=174108
2079
2080         crashing constantly when initializing UIWebView (Requested by
2081         thorton on #webkit).
2082
2083         Reverted changeset:
2084
2085         "WTF::Thread should have the threads stack bounds."
2086         https://bugs.webkit.org/show_bug.cgi?id=173975
2087         http://trac.webkit.org/changeset/219060
2088
2089 2017-07-03  Matt Lewis  <jlewis3@apple.com>
2090
2091         Unreviewed, rolling out r219103.
2092
2093         Caused multiple build failures.
2094
2095         Reverted changeset:
2096
2097         "Remove copy of ICU headers from WebKit"
2098         https://bugs.webkit.org/show_bug.cgi?id=116407
2099         http://trac.webkit.org/changeset/219103
2100
2101 2017-07-03  Myles C. Maxfield  <mmaxfield@apple.com>
2102
2103         Remove copy of ICU headers from WebKit
2104         https://bugs.webkit.org/show_bug.cgi?id=116407
2105
2106         Reviewed by Alex Christensen.
2107
2108         Add an extra rsync command to CopyWTFHeaders which copies the ICU headers
2109         to DSTROOT/usr/local/include/. These headers already live inside a
2110         "unicode" folder, so an example path of a header is
2111         DSTROOT/usr/local/include/unicode/uchar.h. This is already in the search
2112         path of the other WebKit projects, so those other projects can remove
2113         their explicit listing of the old place these headers lived.
2114
2115         Also add the remaining ICU 55.1 headers which the other projects (like
2116         WebCore) need. Revert any local changes to these headers in favor of
2117         using the GCC_PREPROCESSOR_DEFINITIONS build setting. This is so we can
2118         compile the same way against unmodified headers.
2119
2120         * Configurations/Base.xcconfig:
2121         * Configurations/CopyWTFHeaders.xcconfig:
2122         * WTF.xcodeproj/project.pbxproj:
2123         * icu/unicode/alphaindex.h: Added.
2124         * icu/unicode/appendable.h: Added.
2125         * icu/unicode/basictz.h: Added.
2126         * icu/unicode/brkiter.h: Added.
2127         (BreakIterator::isBufferClone):
2128         * icu/unicode/bytestrie.h: Added.
2129         * icu/unicode/bytestriebuilder.h: Added.
2130         * icu/unicode/calendar.h: Added.
2131         (Calendar::createInstance):
2132         (Calendar::roll):
2133         (Calendar::internalSet):
2134         (Calendar::weekNumber):
2135         * icu/unicode/caniter.h: Added.
2136         * icu/unicode/chariter.h: Renamed from Source/WebCore/icu/unicode/chariter.h.
2137         * icu/unicode/choicfmt.h: Added.
2138         * icu/unicode/coleitr.h: Added.
2139         (CollationElementIterator::primaryOrder):
2140         (CollationElementIterator::secondaryOrder):
2141         (CollationElementIterator::tertiaryOrder):
2142         (CollationElementIterator::isIgnorable):
2143         * icu/unicode/coll.h: Added.
2144         * icu/unicode/compactdecimalformat.h: Added.
2145         * icu/unicode/curramt.h: Added.
2146         (CurrencyAmount::getCurrency):
2147         (CurrencyAmount::getISOCurrency):
2148         * icu/unicode/currpinf.h: Added.
2149         (CurrencyPluralInfo::operator!=):
2150         * icu/unicode/currunit.h: Added.
2151         (CurrencyUnit::getISOCurrency):
2152         * icu/unicode/datefmt.h: Added.
2153         * icu/unicode/dbbi.h: Added.
2154         * icu/unicode/dcfmtsym.h: Added.
2155         (DecimalFormatSymbols::getSymbol):
2156         (DecimalFormatSymbols::getConstSymbol):
2157         (DecimalFormatSymbols::setSymbol):
2158         (DecimalFormatSymbols::getLocale):
2159         (DecimalFormatSymbols::getCurrencyPattern):
2160         * icu/unicode/decimfmt.h: Added.
2161         (DecimalFormat::getConstSymbol):
2162         * icu/unicode/docmain.h: Added.
2163         * icu/unicode/dtfmtsym.h: Added.
2164         * icu/unicode/dtintrv.h: Added.
2165         (DateInterval::getFromDate):
2166         (DateInterval::getToDate):
2167         (DateInterval::operator!=):
2168         * icu/unicode/dtitvfmt.h: Added.
2169         (DateIntervalFormat::operator!=):
2170         * icu/unicode/dtitvinf.h: Added.
2171         (DateIntervalInfo::operator!=):
2172         * icu/unicode/dtptngen.h: Added.
2173         * icu/unicode/dtrule.h: Added.
2174         * icu/unicode/enumset.h: Added.
2175         (EnumSet::EnumSet):
2176         (EnumSet::~EnumSet):
2177         (EnumSet::clear):
2178         (EnumSet::add):
2179         (EnumSet::remove):
2180         (EnumSet::contains):
2181         (EnumSet::set):
2182         (EnumSet::get):
2183         (EnumSet::isValidEnum):
2184         (EnumSet::isValidValue):
2185         (EnumSet::operator=):
2186         (EnumSet::getAll):
2187         (EnumSet::flag):
2188         * icu/unicode/errorcode.h: Added.
2189         * icu/unicode/fieldpos.h: Added.
2190         (FieldPosition::operator=):
2191         (FieldPosition::operator==):
2192         (FieldPosition::operator!=):
2193         * icu/unicode/filteredbrk.h: Added.
2194         * icu/unicode/fmtable.h: Added.
2195         (Formattable::getDate):
2196         (Formattable::getString):
2197         (Formattable::getLong):
2198         (Formattable::toUFormattable):
2199         (Formattable::fromUFormattable):
2200         * icu/unicode/format.h: Added.
2201         * icu/unicode/fpositer.h: Added.
2202         * icu/unicode/gender.h: Added.
2203         * icu/unicode/gregocal.h: Added.
2204         * icu/unicode/icudataver.h: Added.
2205         * icu/unicode/icuplug.h: Added.
2206         * icu/unicode/idna.h: Added.
2207         * icu/unicode/listformatter.h: Added.
2208         (ListFormatData::ListFormatData):
2209         * icu/unicode/locdspnm.h: Added.
2210         (LocaleDisplayNames::createInstance):
2211         * icu/unicode/locid.h: Added.
2212         (Locale::operator!=):
2213         (Locale::getCountry):
2214         (Locale::getLanguage):
2215         (Locale::getScript):
2216         (Locale::getVariant):
2217         (Locale::getName):
2218         (Locale::isBogus):
2219         * icu/unicode/measfmt.h: Added.
2220         * icu/unicode/measunit.h: Added.
2221         * icu/unicode/measure.h: Added.
2222         (Measure::getNumber):
2223         (Measure::getUnit):
2224         * icu/unicode/messagepattern.h: Added.
2225         * icu/unicode/msgfmt.h: Added.
2226         * icu/unicode/normalizer2.h: Added.
2227         * icu/unicode/normlzr.h: Added.
2228         (Normalizer::operator!= ):
2229         (Normalizer::quickCheck):
2230         (Normalizer::isNormalized):
2231         (Normalizer::compare):
2232         * icu/unicode/numfmt.h: Added.
2233         (NumberFormat::isParseIntegerOnly):
2234         (NumberFormat::isLenient):
2235         * icu/unicode/numsys.h: Added.
2236         * icu/unicode/parsepos.h: Added.
2237         (ParsePosition::operator=):
2238         (ParsePosition::operator==):
2239         (ParsePosition::operator!=):
2240         (ParsePosition::getIndex):
2241         (ParsePosition::setIndex):
2242         (ParsePosition::getErrorIndex):
2243         (ParsePosition::setErrorIndex):
2244         * icu/unicode/plurfmt.h: Added.
2245         * icu/unicode/plurrule.h: Added.
2246         * icu/unicode/rbbi.h: Added.
2247         (RuleBasedBreakIterator::operator!=):
2248         * icu/unicode/rbnf.h: Added.
2249         (RuleBasedNumberFormat::isLenient):
2250         (RuleBasedNumberFormat::getDefaultRuleSet):
2251         * icu/unicode/rbtz.h: Added.
2252         * icu/unicode/regex.h: Added.
2253         * icu/unicode/region.h: Added.
2254         * icu/unicode/reldatefmt.h: Added.
2255         * icu/unicode/resbund.h: Added.
2256         * icu/unicode/schriter.h: Added.
2257         * icu/unicode/scientificnumberformatter.h: Added.
2258         * icu/unicode/search.h: Added.
2259         (SearchIterator::operator!=):
2260         * icu/unicode/selfmt.h: Added.
2261         * icu/unicode/simpletz.h: Added.
2262         (SimpleTimeZone::setStartRule):
2263         (SimpleTimeZone::setEndRule):
2264         (SimpleTimeZone::getOffset):
2265         * icu/unicode/smpdtfmt.h: Added.
2266         (SimpleDateFormat::get2DigitYearStart):
2267         * icu/unicode/sortkey.h: Added.
2268         (CollationKey::operator!=):
2269         (CollationKey::isBogus):
2270         (CollationKey::getByteArray):
2271         * icu/unicode/stringtriebuilder.h: Added.
2272         * icu/unicode/stsearch.h: Added.
2273         * icu/unicode/symtable.h: Added.
2274         * icu/unicode/tblcoll.h: Added.
2275         * icu/unicode/timezone.h: Added.
2276         (TimeZone::getID):
2277         (TimeZone::setID):
2278         * icu/unicode/tmunit.h: Added.
2279         * icu/unicode/tmutamt.h: Added.
2280         (TimeUnitAmount::operator!=):
2281         * icu/unicode/tmutfmt.h: Added.
2282         (TimeUnitFormat::operator!=):
2283         * icu/unicode/translit.h: Added.
2284         (Transliterator::getMaximumContextLength):
2285         (Transliterator::setID):
2286         (Transliterator::integerToken):
2287         (Transliterator::pointerToken):
2288         * icu/unicode/tzfmt.h: Added.
2289         * icu/unicode/tznames.h: Added.
2290         * icu/unicode/tzrule.h: Added.
2291         * icu/unicode/tztrans.h: Added.
2292         * icu/unicode/ubidi.h: Added.
2293         * icu/unicode/ucal.h: Renamed from Source/JavaScriptCore/icu/unicode/ucal.h.
2294         * icu/unicode/ucasemap.h: Added.
2295         * icu/unicode/ucat.h: Added.
2296         * icu/unicode/ucharstrie.h: Added.
2297         * icu/unicode/ucharstriebuilder.h: Added.
2298         * icu/unicode/uchriter.h: Added.
2299         * icu/unicode/uclean.h: Added.
2300         * icu/unicode/ucnv_cb.h: Renamed from Source/WebCore/icu/unicode/ucnv_cb.h.
2301         * icu/unicode/ucnvsel.h: Added.
2302         * icu/unicode/ucoleitr.h: Renamed from Source/WebCore/icu/unicode/ucoleitr.h.
2303         * icu/unicode/uconfig.h:
2304         * icu/unicode/ucsdet.h: Renamed from Source/WebCore/icu/unicode/ucsdet.h.
2305         * icu/unicode/udat.h: Renamed from Source/JavaScriptCore/icu/unicode/udat.h.
2306         * icu/unicode/udata.h: Added.
2307         * icu/unicode/udateintervalformat.h: Added.
2308         * icu/unicode/udatpg.h: Renamed from Source/JavaScriptCore/icu/unicode/udatpg.h.
2309         * icu/unicode/udisplaycontext.h: Renamed from Source/JavaScriptCore/icu/unicode/udisplaycontext.h.
2310         * icu/unicode/ufieldpositer.h: Renamed from Source/JavaScriptCore/icu/unicode/ufieldpositer.h.
2311         * icu/unicode/uformattable.h: Renamed from Source/JavaScriptCore/icu/unicode/uformattable.h.
2312         * icu/unicode/ugender.h: Added.
2313         * icu/unicode/uidna.h: Renamed from Source/WebCore/icu/unicode/uidna.h.
2314         * icu/unicode/uldnames.h: Added.
2315         * icu/unicode/ulistformatter.h: Added.
2316         * icu/unicode/ulocdata.h: Added.
2317         * icu/unicode/umisc.h: Renamed from Source/JavaScriptCore/icu/unicode/umisc.h.
2318         * icu/unicode/umsg.h: Added.
2319         * icu/unicode/unifilt.h: Added.
2320         * icu/unicode/unifunct.h: Added.
2321         * icu/unicode/unimatch.h: Added.
2322         * icu/unicode/unirepl.h: Added.
2323         * icu/unicode/uniset.h: Added.
2324         (UnicodeSet::operator!=):
2325         (UnicodeSet::isFrozen):
2326         (UnicodeSet::containsSome):
2327         (UnicodeSet::isBogus):
2328         (UnicodeSet::fromUSet):
2329         (UnicodeSet::toUSet):
2330         (UnicodeSet::span):
2331         (UnicodeSet::spanBack):
2332         * icu/unicode/unum.h: Renamed from Source/JavaScriptCore/icu/unicode/unum.h.
2333         * icu/unicode/unumsys.h: Renamed from Source/JavaScriptCore/icu/unicode/unumsys.h.
2334         * icu/unicode/upluralrules.h: Added.
2335         * icu/unicode/uregex.h: Added.
2336         * icu/unicode/uregion.h: Added.
2337         * icu/unicode/urep.h: Added.
2338         * icu/unicode/ures.h: Added.
2339         (ures_getUnicodeString):
2340         (ures_getNextUnicodeString):
2341         (ures_getUnicodeStringByIndex):
2342         (ures_getUnicodeStringByKey):
2343         * icu/unicode/usearch.h: Renamed from Source/WebCore/icu/unicode/usearch.h.
2344         * icu/unicode/usetiter.h: Added.
2345         (UnicodeSetIterator::isString):
2346         (UnicodeSetIterator::getCodepoint):
2347         (UnicodeSetIterator::getCodepointEnd):
2348         * icu/unicode/ushape.h: Renamed from Source/WebCore/icu/unicode/ushape.h.
2349         * icu/unicode/usprep.h: Added.
2350         * icu/unicode/ustdio.h: Added.
2351         * icu/unicode/ustream.h: Added.
2352         * icu/unicode/ustringtrie.h: Added.
2353         * icu/unicode/utf32.h: Added.
2354         * icu/unicode/utmscale.h: Added.
2355         * icu/unicode/utrace.h: Added.
2356         * icu/unicode/utrans.h: Added.
2357         * icu/unicode/utypes.h:
2358         * icu/unicode/vtzone.h: Added.
2359
2360 2017-07-03  Keith Miller  <keith_miller@apple.com>
2361
2362         Fix ifndef in Assertions.h
2363         https://bugs.webkit.org/show_bug.cgi?id=174104
2364
2365         Reviewed by Saam Barati.
2366
2367         The ifndef should have been checking for
2368         CRASH_WITH_SECURITY_IMPLICATION_AND_INFO since that is what the
2369         ifndef defines.
2370
2371         * wtf/Assertions.h:
2372
2373 2017-07-03  Andy Estes  <aestes@apple.com>
2374
2375         [Xcode] Add an experimental setting to build with ccache
2376         https://bugs.webkit.org/show_bug.cgi?id=173875
2377
2378         Reviewed by Tim Horton.
2379
2380         * Configurations/DebugRelease.xcconfig: Included ccache.xcconfig.
2381
2382 2017-07-03  Daewoong Jang  <daewoong.jang@navercorp.com>
2383
2384         Remove an unused function export
2385         https://bugs.webkit.org/show_bug.cgi?id=174084
2386
2387         Reviewed by Yusuke Suzuki.
2388
2389         * wtf/Threading.h:
2390
2391 2017-07-02  Yusuke Suzuki  <utatane.tea@gmail.com>
2392
2393         WTF::Thread should have the threads stack bounds.
2394         https://bugs.webkit.org/show_bug.cgi?id=173975
2395
2396         Reviewed by Mark Lam.
2397
2398         We move StackBounds from WTFThreadData to WTF::Thread.
2399         One important thing is that we should make valid StackBounds
2400         visible to Thread::create() caller. When the caller get
2401         WTF::Thread from Thread::create(), this WTF::Thread should
2402         have a valid StackBounds. But StackBounds information can be
2403         retrived only in the WTF::Thread's thread itself.
2404
2405         * wtf/StackBounds.h:
2406         (WTF::StackBounds::emptyBounds):
2407         (WTF::StackBounds::StackBounds):
2408         * wtf/StackStats.cpp:
2409         (WTF::StackStats::PerThreadStats::PerThreadStats):
2410         * wtf/Threading.cpp:
2411         (WTF::threadEntryPoint):
2412         (WTF::Thread::create):
2413         (WTF::Thread::currentMayBeNull):
2414         (WTF::Thread::initialize):
2415         * wtf/Threading.h:
2416         (WTF::Thread::stack):
2417         * wtf/ThreadingPthreads.cpp:
2418         (WTF::Thread::initializeCurrentThreadEvenIfNonWTFCreated):
2419         (WTF::Thread::current):
2420         (WTF::initializeCurrentThreadEvenIfNonWTFCreated): Deleted.
2421         (WTF::Thread::currentMayBeNull): Deleted.
2422         * wtf/ThreadingWin.cpp:
2423         (WTF::Thread::initializeCurrentThreadEvenIfNonWTFCreated):
2424         (WTF::Thread::initializeCurrentThreadInternal):
2425         (WTF::Thread::current):
2426         * wtf/WTFThreadData.cpp:
2427         (WTF::WTFThreadData::WTFThreadData):
2428         * wtf/WTFThreadData.h:
2429         (WTF::WTFThreadData::stack): Deleted.
2430
2431 2017-07-01  Dan Bernstein  <mitz@apple.com>
2432
2433         [iOS] Remove code only needed when building for iOS 9.x
2434         https://bugs.webkit.org/show_bug.cgi?id=174068
2435
2436         Reviewed by Tim Horton.
2437
2438         * wtf/Platform.h:
2439         * wtf/mac/DeprecatedSymbolsUsedBySafari.mm:
2440         * wtf/spi/darwin/dyldSPI.h:
2441
2442 2017-07-01  Caio Lima  <ticaiolima@gmail.com>
2443
2444         [JSC] WTFGetBacktrace can return numberOfFrames == 0 in some architectures
2445         https://bugs.webkit.org/show_bug.cgi?id=172768
2446
2447         Reviewed by Mark Lam.
2448
2449         In some architectures, like ARMv6 running on a Raspberry pi, the
2450         backtrace function from "execinfo.h" is returning 0. In
2451         that case, the RELEASE_ASSERT in StackTrace::captureStackTrace
2452         fails causing a runtime crash.
2453         This patch is adding a guard for the case described above to
2454         avoid a runtime crash in such case.
2455
2456         * wtf/StackTrace.cpp:
2457         (WTF::StackTrace::captureStackTrace):
2458
2459 2017-07-01  Dan Bernstein  <mitz@apple.com>
2460
2461         [macOS] Remove code only needed when building for OS X Yosemite
2462         https://bugs.webkit.org/show_bug.cgi?id=174067
2463
2464         Reviewed by Tim Horton.
2465
2466         * Configurations/Base.xcconfig:
2467         * Configurations/DebugRelease.xcconfig:
2468         * wtf/Platform.h:
2469         * wtf/mac/AppKitCompatibilityDeclarations.h:
2470         * wtf/spi/cocoa/SecuritySPI.h:
2471         * wtf/text/TextBreakIterator.cpp:
2472
2473 2017-07-01  Joseph Pecoraro  <pecoraro@apple.com>
2474
2475         Add a warning if WEBGL2 is enabled without WEBGL
2476         https://bugs.webkit.org/show_bug.cgi?id=174054
2477
2478         Reviewed by Sam Weinig.
2479
2480         * wtf/FeatureDefines.h:
2481
2482 2017-06-30  Keith Miller  <keith_miller@apple.com>
2483
2484         Force crashWithInfo to be out of line.
2485         https://bugs.webkit.org/show_bug.cgi?id=174028
2486
2487         Reviewed by Filip Pizlo.
2488
2489         The first pass at making crashes hold information about why they
2490         were crashing had the problem that it would inline the assertion.
2491         This meant that clang could coalesce DFG_ASSERTS with other
2492         assertion failures in the same function. This patch moves it out
2493         of line to help fix that issue.
2494
2495         * wtf/Assertions.cpp:
2496         (WTFCrashWithInfo):
2497         * wtf/Assertions.h:
2498         (WTF::isIntegralType):
2499
2500 2017-06-30  Yusuke Suzuki  <utatane.tea@gmail.com>
2501
2502         [WTF] Drop SymbolRegistry::keyForSymbol
2503         https://bugs.webkit.org/show_bug.cgi?id=174052
2504
2505         Reviewed by Sam Weinig.
2506
2507         Since we can know whether a given symbol is registered by checking RegisteredSymbolImpl,
2508         we do not need to query key string for a given symbol by using SymbolRegistry::keyForSymbol.
2509
2510         * wtf/text/SymbolImpl.h:
2511         (WTF::SymbolImpl::extractFoldedString): Deleted.
2512         * wtf/text/SymbolRegistry.cpp:
2513         (WTF::SymbolRegistry::keyForSymbol): Deleted.
2514         * wtf/text/SymbolRegistry.h:
2515
2516 2017-06-29  Jer Noble  <jer.noble@apple.com>
2517
2518         Make Legacy EME API controlled by RuntimeEnabled setting.
2519         https://bugs.webkit.org/show_bug.cgi?id=173994
2520
2521         Reviewed by Sam Weinig.
2522
2523         * wtf/FeatureDefines.h:
2524
2525 2017-06-30  Ryosuke Niwa  <rniwa@webkit.org>
2526
2527         Ran sort-Xcode-project-file.
2528
2529         * WTF.xcodeproj/project.pbxproj:
2530
2531 2017-06-30  Matt Lewis  <jlewis3@apple.com>
2532
2533         Unreviewed, rolling out r218992.
2534
2535         The patch broke the iOS device builds.
2536
2537         Reverted changeset:
2538
2539         "DFG_ASSERT should allow stuffing registers before trapping."
2540         https://bugs.webkit.org/show_bug.cgi?id=174005
2541         http://trac.webkit.org/changeset/218992
2542
2543 2017-06-30  Keith Miller  <keith_miller@apple.com>
2544
2545         DFG_ASSERT should allow stuffing registers before trapping.
2546         https://bugs.webkit.org/show_bug.cgi?id=174005
2547
2548         Reviewed by Mark Lam.
2549
2550         Add new template functions that enable stuffing up to five values
2551         into registers before crashing.
2552
2553         * wtf/Assertions.h:
2554         (CRASH_WITH_INFO):
2555
2556 2017-06-28  Brent Fulgham  <bfulgham@apple.com>
2557
2558         Teach ResourceLoadStatistics to recognize changes in the file system
2559         https://bugs.webkit.org/show_bug.cgi?id=173800
2560         <rdar://problem/32937842>
2561
2562         Reviewed by Chris Dumez.
2563
2564         * wtf/DispatchPtr.h: Added (moved from WebKit2)
2565         * wtf/Platform.h: Make sure USE_FILE_LOCK is enabled.
2566
2567 2017-06-28  David Kilzer  <ddkilzer@apple.com>
2568
2569         Fix typo in comment: WordResult => WorkResult
2570
2571         * wtf/AutomaticThread.h:
2572
2573 2017-06-27  Caio Lima  <ticaiolima@gmail.com>
2574
2575         [ESnext] Implement Object Rest - Implementing Object Rest Destructuring
2576         https://bugs.webkit.org/show_bug.cgi?id=167962
2577
2578         Reviewed by Saam Barati.
2579
2580         * wtf/HashSet.h:
2581         (WTF::=):
2582
2583 2017-06-26  Yusuke Suzuki  <utatane.tea@gmail.com>
2584
2585         [WTF] Drop Thread::create(obsolete things) API since we can use lambda
2586         https://bugs.webkit.org/show_bug.cgi?id=173825
2587
2588         Reviewed by Saam Barati.
2589
2590         Thread::create(ThreadFunction, void* data, const char* name) is a bit old API.
2591         Since we have C++ lambda, the above API is simply unnecessary. And C++ lambda
2592         based one is better since the above API needs casting data to and from void*.
2593
2594         * wtf/Function.h:
2595         Avoid ambiguity.
2596         * wtf/ParallelJobsGeneric.cpp:
2597         (WTF::ParallelEnvironment::ThreadPrivate::tryLockFor):
2598         (WTF::ParallelEnvironment::ThreadPrivate::workerThread): Deleted.
2599         * wtf/ParallelJobsGeneric.h:
2600         * wtf/Threading.cpp:
2601         * wtf/ThreadingWin.cpp:
2602         (WTF::createThread):
2603
2604 2017-06-25  Yusuke Suzuki  <utatane.tea@gmail.com>
2605
2606         initializeThreading() [first] causes WTFCrash due to maxSingleAllocationSize not being initialized
2607         https://bugs.webkit.org/show_bug.cgi?id=173720
2608
2609         Reviewed by Mark Lam.
2610
2611         When using std::numeric_limits<size_t>::max() for global variable's initialization,
2612         it seems that it invokes static constructor to initialize this in VC++.
2613         We avoid this edge case by introducing a workaround using SIZE_MAX here.
2614
2615         When I perform git-grep, there is only one site (this) using std::numeric_limits<>::xxx()
2616         to initialize global variable.
2617
2618         * wtf/FastMalloc.cpp:
2619
2620 2017-06-25  Konstantin Tokarev  <annulen@yandex.ru>
2621
2622         Remove excessive headers from JavaScriptCore
2623         https://bugs.webkit.org/show_bug.cgi?id=173812
2624
2625         Reviewed by Darin Adler.
2626
2627         * wtf/Bag.h:
2628
2629 2017-06-23  Keith Miller  <keith_miller@apple.com>
2630
2631         Switch VMTraps to use halt instructions rather than breakpoint instructions
2632         https://bugs.webkit.org/show_bug.cgi?id=173677
2633         <rdar://problem/32178892>
2634
2635         Reviewed by JF Bastien.
2636
2637         Remove the Trap signal handler code since it plays badly with lldb and combine
2638         SIGBUS with SIGSEGV since distiguishing them is generally non-portable.
2639
2640         Also, update the platform code to only use signaling VMTraps
2641         on where we have an appropriate instruction (x86 and ARM64).
2642
2643         * wtf/Platform.h:
2644         * wtf/threads/Signals.cpp:
2645         (WTF::fromMachException):
2646         (WTF::toMachMask):
2647         (WTF::installSignalHandler):
2648         (WTF::jscSignalHandler):
2649         * wtf/threads/Signals.h:
2650         (WTF::toSystemSignal):
2651         (WTF::fromSystemSignal):
2652
2653 2017-06-23  Antti Koivisto  <antti@apple.com>
2654
2655         Add notifyutil registrations for going in and out of simulated low memory state
2656         https://bugs.webkit.org/show_bug.cgi?id=173797
2657
2658         Reviewed by Andreas Kling.
2659
2660         Add
2661
2662         notifyutil -p org.WebKit.lowMemory.begin
2663         notifyutil -p org.WebKit.lowMemory.end
2664
2665         for debugging.
2666
2667         * wtf/cocoa/MemoryPressureHandlerCocoa.mm:
2668         (WTF::MemoryPressureHandler::install):
2669
2670 2017-06-23  Konstantin Tokarev  <annulen@yandex.ru>
2671
2672         Remove more unused headers from WTF
2673         https://bugs.webkit.org/show_bug.cgi?id=173761
2674
2675         Reviewed by Yusuke Suzuki.
2676
2677         * wtf/Liveness.h:
2678         * wtf/PageAllocation.h:
2679         * wtf/ParallelJobs.h:
2680
2681 2017-06-22  Andreas Kling  <akling@apple.com>
2682
2683         Rename MemoryPressureHandler::setTabCount to setPageCount
2684         https://bugs.webkit.org/show_bug.cgi?id=173750
2685
2686         Reviewed by Daniel Bates.
2687
2688         This function is counting WebCore::Page objects (excluding utility Pages used
2689         by SVG-as-image and the web inspector) so let's name it appropriately.
2690         Not all WebKit clients have tabs.
2691
2692         * wtf/MemoryPressureHandler.cpp:
2693         (WTF::MemoryPressureHandler::setPageCount):
2694         (WTF::MemoryPressureHandler::thresholdForMemoryKill):
2695         (WTF::MemoryPressureHandler::measurementTimerFired):
2696         (WTF::MemoryPressureHandler::setTabCount): Deleted.
2697         * wtf/MemoryPressureHandler.h:
2698
2699 2017-06-21  Andreas Kling  <akling@apple.com>
2700
2701         Increase memory kill limits for WebContent processes that manage multiple tabs.
2702         https://bugs.webkit.org/show_bug.cgi?id=173674
2703
2704         Reviewed by Geoffrey Garen.
2705
2706         When opening <a target=_blank> links, we currently have to use the same WebContent
2707         process for the new tab, to support scripting the window.opener object.
2708         This means that some WebContent processes end up hosting multiple tabs, making it
2709         more likely that those processes will hit the memory limits.
2710
2711         Address this by adding some additional allowance for multi-tab processes:
2712
2713             For each additional tab, up to 4 tabs, add 1GB to the memory kill limit.
2714
2715         * wtf/MemoryPressureHandler.cpp:
2716         (WTF::thresholdForMemoryKillWithProcessState):
2717         (WTF::MemoryPressureHandler::setTabCount):
2718         (WTF::MemoryPressureHandler::thresholdForMemoryKill):
2719         (WTF::MemoryPressureHandler::measurementTimerFired):
2720         * wtf/MemoryPressureHandler.h:
2721
2722 2017-06-21  Chris Dumez  <cdumez@apple.com>
2723
2724         Allow constructing a WTF:Function from a function pointer
2725         https://bugs.webkit.org/show_bug.cgi?id=173660
2726
2727         Reviewed by Alex Christensen.
2728
2729         Allow constructing a WTF:Function from a function pointer and
2730         assigning a function pointer to a WTF:Function.
2731
2732         * wtf/Function.h:
2733
2734 2017-06-20  Simon Fraser  <simon.fraser@apple.com>
2735
2736         Remove WILL_REVEAL_EDGE_EVENTS code
2737         https://bugs.webkit.org/show_bug.cgi?id=173632
2738
2739         Reviewed by Sam Weinig, Beth Dakin.
2740
2741         Remove will-reveal-edge events, which never took off.
2742
2743         * wtf/FeatureDefines.h:
2744
2745 2017-06-20  Konstantin Tokarev  <annulen@yandex.ru>
2746
2747         Remove excessive include directives from WTF
2748         https://bugs.webkit.org/show_bug.cgi?id=173553
2749
2750         Reviewed by Saam Barati.
2751
2752         * wtf/AutomaticThread.h:
2753         * wtf/BagToHashMap.h:
2754         * wtf/CrossThreadCopier.h:
2755         * wtf/CrossThreadQueue.h:
2756         * wtf/DateMath.h:
2757         * wtf/Expected.h:
2758         * wtf/HashMap.h:
2759         * wtf/Indenter.h:
2760         * wtf/MessageQueue.h:
2761         * wtf/MetaAllocator.h:
2762         * wtf/MetaAllocatorHandle.h:
2763         * wtf/RandomNumberSeed.h:
2764         * wtf/Ref.h:
2765         * wtf/RefPtr.h:
2766         * wtf/RunLoop.h:
2767         * wtf/SchedulePair.h:
2768         * wtf/StackStats.h:
2769         * wtf/SynchronizedFixedQueue.h:
2770         * wtf/ThreadMessage.h:
2771         * wtf/Threading.cpp:
2772         * wtf/Threading.h:
2773         * wtf/ThreadingPthreads.cpp:
2774         * wtf/ThreadingWin.cpp:
2775         * wtf/WTFThreadData.h:
2776         * wtf/WorkQueue.h:
2777         * wtf/glib/GRefPtr.h:
2778         * wtf/text/AtomicStringTable.h:
2779         * wtf/text/LineBreakIteratorPoolICU.h:
2780
2781 2017-06-20  Yusuke Suzuki  <utatane.tea@gmail.com>
2782
2783         [WTF] Enable WTF::Signals only when HAVE(MACHINE_CONTEXT) is true
2784         https://bugs.webkit.org/show_bug.cgi?id=173590
2785
2786         Reviewed by Carlos Garcia Campos.
2787
2788         WTF::Signals require a feature rewriting a value of a machine context.
2789         This is only available under HAVE(MACHINE_CONTEXT).
2790         This patch disables WTF::Signals on !HAVE(MACHINE_CONTEXT) environments.
2791
2792         * wtf/threads/Signals.cpp:
2793         * wtf/threads/Signals.h:
2794
2795 2017-06-20  Yusuke Suzuki  <utatane.tea@gmail.com>
2796
2797         [WTF] Rebaseline std::optional
2798         https://bugs.webkit.org/show_bug.cgi?id=173582
2799
2800         Reviewed by JF Bastien.
2801
2802         Update the copy of our std::optional to the latest version.
2803         It adds std::optional::has_value() and std::optional::reset().
2804
2805         * wtf/Optional.h:
2806
2807 2017-06-18  Yusuke Suzuki  <utatane.tea@gmail.com>
2808
2809         [WTF] Include execinfo.h and dlfcn.h based on platform defines
2810         https://bugs.webkit.org/show_bug.cgi?id=173531
2811
2812         Reviewed by Alex Christensen.
2813
2814         execinfo.h and dlfcn.h can be missing in some libc libraries.
2815         When including it, we should honor platform defines like HAVE(DLADDR).
2816
2817         * wtf/StackTrace.cpp:
2818
2819 2017-06-18  Darin Adler  <darin@apple.com>
2820
2821         Fix Ref to deref before assignment, add tests for this to RefPtr, Ref, Function
2822         https://bugs.webkit.org/show_bug.cgi?id=173526
2823
2824         Reviewed by Sam Weinig.
2825
2826         * wtf/Ref.h: Changed operator= to not be defined inside the class definition.
2827         Added swap functions. Changed operator= implementations to use swap in the
2828         conventional manner, the same way that RefPtr does.
2829
2830 2017-06-18  Chris Dumez  <cdumez@apple.com>
2831
2832         Use WTF::Function instead of std::function in WTF/
2833         https://bugs.webkit.org/show_bug.cgi?id=173519
2834
2835         Reviewed by Sam Weinig.
2836
2837         Use WTF::Function instead of std::function in WTF/ to avoid
2838         copying.
2839
2840         * wtf/Brigand.h:
2841         * wtf/Condition.h:
2842         * wtf/Expected.h:
2843         * wtf/FunctionDispatcher.h:
2844         * wtf/MainThread.h:
2845         * wtf/MemoryPressureHandler.h:
2846         (WTF::MemoryPressureHandler::setMemoryKillCallback):
2847         (WTF::MemoryPressureHandler::setMemoryPressureStatusChangedCallback):
2848         (WTF::MemoryPressureHandler::setDidExceedInactiveLimitWhileActiveCallback):
2849         * wtf/Optional.h:
2850         * wtf/ParkingLot.h:
2851         * wtf/RefCounter.h:
2852         (WTF::RefCounter<T>::RefCounter):
2853         * wtf/WorkQueue.h:
2854         * wtf/linux/MemoryPressureHandlerLinux.cpp:
2855         (WTF::MemoryPressureHandler::EventFDPoller::EventFDPoller):
2856         * wtf/text/WTFString.cpp:
2857         (WTF::String::split):
2858         * wtf/text/WTFString.h:
2859
2860 2017-06-16  Alex Christensen  <achristensen@webkit.org>
2861
2862         Fix Mac CMake build.
2863
2864         * wtf/PlatformMac.cmake:
2865         Generate MachExceptionsServer.h
2866
2867 2017-06-16  Wenson Hsieh  <wenson_hsieh@apple.com>
2868
2869         [iOS DnD] Upstream iOS drag and drop implementation into OpenSource WebKit
2870         https://bugs.webkit.org/show_bug.cgi?id=173366
2871         <rdar://problem/32767014>
2872
2873         Reviewed by Tim Horton.
2874
2875         Define ENABLE_DRAG_SUPPORT as 1 by default and 0 for iOS, and define ENABLE_DATA_INTERACTION as 0 by default.
2876         These are overridden to both be 1 for iOS 11+ in the FeatureDefines.xcconfig within each individual project.
2877
2878         * wtf/Platform.h:
2879
2880 2017-06-15  Chris Dumez  <cdumez@apple.com>
2881
2882         Fix typo in XPCSPI.h
2883         https://bugs.webkit.org/show_bug.cgi?id=173426
2884
2885         Reviewed by Alex Christensen.
2886
2887         We should check if xpc_release is defined before defining it,
2888         not xpc_retain.
2889
2890         * wtf/spi/darwin/XPCSPI.h:
2891
2892 2017-06-15  Konstantin Tokarev  <annulen@yandex.ru>
2893
2894         Implement FALLTHROUGH macro for compilers other than Clang
2895         https://bugs.webkit.org/show_bug.cgi?id=173385
2896
2897         Reviewed by Alex Christensen.
2898
2899         FALLTHROUGH should be able to use [[gnu::fallthrough]] attribute of
2900         GCC, and [[fallthrough]] from C++17, whichever is available.
2901
2902         * wtf/Compiler.h:
2903
2904 2017-06-14  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
2905
2906         MediaSource duration attribute should not be equal to Infinity when set to a value greater than 2^64
2907         https://bugs.webkit.org/show_bug.cgi?id=171668
2908
2909         Reviewed by Jer Noble.
2910
2911         MediaSource duration attribute is a double represented in MediaSource by a MediaTime instance created with
2912         MediaTime::CreateWithDouble(). This method implements an overflow control mechanism which sets MediaTime to
2913         Infinity when the double value passed as argument is greater than 2^64.
2914
2915         This patch removes the overflow control mechanism when time value is represented as a double. This patch also
2916         modifies the behavior of mathematical operations between a double MediaTime and rational MediaTime: the rational
2917         MediaTime is converted to a double before applying the operation. Double MediaTime precision is the same as for
2918         double. Overflow mechanisms still apply to the conversion of a double MediaTime to rational with setTimescale()
2919         method. No behavior change for rational MediaTime.
2920
2921         * wtf/MediaTime.cpp:
2922         (WTF::MediaTime::createWithFloat):
2923         (WTF::MediaTime::createWithDouble):
2924         (WTF::MediaTime::operator+):
2925         (WTF::MediaTime::operator-):
2926
2927 2017-06-13  Zan Dobersek  <zdobersek@igalia.com>
2928
2929         [GTK][WPE] Use CMAKE_THREAD_LIBS_INIT in WTF platform CMake files
2930         https://bugs.webkit.org/show_bug.cgi?id=173310
2931
2932         Reviewed by Xabier Rodriguez-Calvar.
2933
2934         In the WTF platform CMake files for the GTK+ and WPE ports, use the
2935         CMAKE_THREAD_LIBS_INIT variable to specify the threading library we
2936         should be linking against. On some platforms this variable will be
2937         empty because the given compiler will automatically handle the -pthread
2938         compiler flag and sort out linking on its own.
2939
2940         The same approach is already used for the JSCOnly configuration.
2941
2942         * wtf/PlatformGTK.cmake:
2943         * wtf/PlatformWPE.cmake:
2944
2945 2017-06-13  Youenn Fablet  <youenn@apple.com>
2946
2947         Filter SDP from ICE candidates in case of local ICE candidate filtering
2948         https://bugs.webkit.org/show_bug.cgi?id=173120
2949
2950         Reviewed by Eric Carlson.
2951
2952         Adding split helper routine with functor parameter.
2953
2954         * wtf/text/WTFString.cpp:
2955         (WTF::String::split):
2956         * wtf/text/WTFString.h:
2957         (WTF::String::contains):
2958
2959 2017-06-13  Don Olmstead  <don.olmstead@sony.com>
2960
2961         [WTF] Remove redundant includes in config.h
2962         https://bugs.webkit.org/show_bug.cgi?id=173292
2963
2964         Reviewed by Alex Christensen.
2965
2966         * config.h:
2967         * wtf/ExportMacros.h:
2968
2969 2017-06-12  Jer Noble  <jer.noble@apple.com>
2970
2971         Screen sleeps while doing WebRTC video
2972         https://bugs.webkit.org/show_bug.cgi?id=173278
2973
2974         Reviewed by Eric Carlson.
2975
2976         Drive-by fix: add some generic methods for iterating over collections.
2977
2978         * WTF.xcodeproj/project.pbxproj:
2979         * wtf/Algorithms.h: Added.
2980         (WTF::forEach):
2981         (WTF::anyOf):
2982         (WTF::allOf):
2983
2984 2017-06-12  Carlos Garcia Campos  <cgarcia@igalia.com>
2985
2986         [GTK] Move WebKit GType macros to WTF
2987         https://bugs.webkit.org/show_bug.cgi?id=173249
2988
2989         Reviewed by Žan Doberšek.
2990
2991         They can be used by glib-based ports and eventually by JavaScriptCore glib bindings too.
2992
2993         * wtf/glib/WTFGType.h: Copied from Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h.
2994
2995 2017-06-11  Yusuke Suzuki  <utatane.tea@gmail.com>
2996
2997         [WTF] Make ThreadMessage portable
2998         https://bugs.webkit.org/show_bug.cgi?id=172073
2999
3000         Reviewed by Keith Miller.
3001
3002         Recently, we change ThreadMessage semantics: message handler
3003         can be executed in the sender thread.
3004         This allows ThreadMessage to be implemented in a portable way.
3005
3006         This patch implements ThreadMessage for all the platforms.
3007         We use platform-independent Thread APIs, suspend(), resume(),
3008         and getRegisters().
3009
3010         * wtf/PlatformRegisters.h:
3011         (WTF::registersFromUContext):
3012         * wtf/ThreadMessage.cpp:
3013         (WTF::sendMessageScoped):
3014         (WTF::ThreadMessageData::ThreadMessageData): Deleted.
3015         (): Deleted.
3016         (WTF::initializeThreadMessages): Deleted.
3017         (WTF::sendMessageUsingSignal): Deleted.
3018         (WTF::sendMessageUsingMach): Deleted.
3019         (WTF::deliverMessagesUsingMach): Deleted.
3020         * wtf/ThreadMessage.h:
3021         * wtf/Threading.cpp:
3022         (WTF::initializeThreading):
3023         * wtf/Threading.h:
3024         (WTF::Thread::threadMessages): Deleted.
3025         * wtf/ThreadingPthreads.cpp:
3026         (WTF::Thread::signalHandlerSuspendResume):
3027         (WTF::threadStateMetadata):
3028         (WTF::Thread::getRegisters):
3029         * wtf/threads/Signals.cpp:
3030         (WTF::handleSignalsWithMach):
3031
3032 2017-06-11  Yusuke Suzuki  <utatane.tea@gmail.com>
3033
3034         [WTF] Drop unnecessary includes in Threading.h
3035         https://bugs.webkit.org/show_bug.cgi?id=173167
3036
3037         Reviewed by Darin Adler.
3038
3039         Threading.h includes bunch of headers. But some of them are not necessary.
3040         This patch cleans up it a bit.
3041
3042         * wtf/Assertions.cpp:
3043         * wtf/LocklessBag.h:
3044         * wtf/Threading.h:
3045         * wtf/ThreadingPrimitives.h:
3046
3047 2017-06-10  Yusuke Suzuki  <utatane.tea@gmail.com>
3048
3049         [WTF] Add RegisteredSymbolImpl
3050         https://bugs.webkit.org/show_bug.cgi?id=173230
3051
3052         Reviewed by Mark Lam.
3053
3054         Most symbols are not registered in SymbolRegistry. However, we currently always
3055         allocate a pointer member to point to a SymbolRegistry, and this pointer is always null.
3056         SymbolImpl is immutable, and it will never be registered with a SymbolRegistry
3057         after it is created. Hence, this member is wasteful.
3058
3059         Instead, we add a new derived class RegisteredSymbolImpl, which will set a flag in
3060         SymbolImpl to indicate that it is registered with a SymbolRegistry. The only way to
3061         create a RegisteredSymbolImpl is via a factory method provided by the SymbolRegistry.
3062         The factory method will pass the SymbolRegistry this pointer to the RegisteredSymbolImpl's
3063         constructor for initializing the RegisteredSymbolImpl's m_symbolRegistry field.
3064         By doing so,
3065
3066         1. We do not need to set m_symbolRegistry after creating a Symbol. It is clean.
3067         2. We reduce the size of SymbolImpls that do not need to be registered.
3068
3069         * wtf/text/StringImpl.cpp:
3070         (WTF::StringImpl::~StringImpl):
3071         * wtf/text/StringImpl.h:
3072         * wtf/text/SymbolImpl.cpp:
3073         (WTF::SymbolImpl::create):
3074         (WTF::RegisteredSymbolImpl::create):
3075         * wtf/text/SymbolImpl.h:
3076         (WTF::SymbolImpl::hashForSymbol):
3077         (WTF::SymbolImpl::isRegistered):
3078         (WTF::SymbolImpl::SymbolImpl):
3079         (WTF::RegisteredSymbolImpl::symbolRegistry):
3080         (WTF::RegisteredSymbolImpl::clearSymbolRegistry):
3081         (WTF::RegisteredSymbolImpl::RegisteredSymbolImpl):
3082         (WTF::SymbolImpl::symbolRegistry):
3083         * wtf/text/SymbolRegistry.cpp:
3084         (WTF::SymbolRegistry::~SymbolRegistry):
3085         (WTF::SymbolRegistry::symbolForKey):
3086         (WTF::SymbolRegistry::keyForSymbol):
3087         (WTF::SymbolRegistry::remove):
3088         * wtf/text/SymbolRegistry.h:
3089
3090 2017-06-10  Dan Bernstein  <mitz@apple.com>
3091
3092         Reverted r218056 because it made the IDE reindex constantly.
3093
3094         * Configurations/DebugRelease.xcconfig:
3095
3096 2017-06-10  Dan Bernstein  <mitz@apple.com>
3097
3098         [Xcode] With Xcode 9 developer beta, everything rebuilds when switching between command-line and IDE
3099         https://bugs.webkit.org/show_bug.cgi?id=173223
3100
3101         Reviewed by Sam Weinig.
3102
3103         The rebuilds were happening due to a difference in the compiler options that the IDE and
3104         xcodebuild were specifying. Only the IDE was passing the -index-store-path option. To make
3105         xcodebuild pass that option, too, set CLANG_INDEX_STORE_ENABLE to YES if it is unset, and
3106         specify an appropriate path in CLANG_INDEX_STORE_PATH.
3107
3108         * Configurations/DebugRelease.xcconfig:
3109
3110 2017-06-09  Chris Dumez  <cdumez@apple.com>
3111
3112         Update Thread::create() to take in a WTF::Function instead of a std::function
3113         https://bugs.webkit.org/show_bug.cgi?id=173175
3114
3115         Reviewed by Mark Lam.
3116
3117         Update Thread::create() to take in a WTF::Function instead of a std::function. Unlike
3118         std::function, WTF:Function is not copyable and does not make implicit copies of captured
3119         variables. Doing captures such as [string = string.isolatedCopy()] when passing an
3120         std::function to another thread has lead to bugs in the past due to implicit copying of
3121         the captured string.
3122
3123         * wtf/Threading.cpp:
3124         (WTF::Thread::create):
3125         * wtf/Threading.h:
3126
3127 2017-06-09  Chris Dumez  <cdumez@apple.com>
3128
3129         Update WorkQueue::concurrentApply() to take a WTF::Function instead of an std::function
3130         https://bugs.webkit.org/show_bug.cgi?id=173165
3131
3132         Reviewed by Saam Barati.
3133
3134         Update WorkQueue::concurrentApply() to take a WTF::Function instead of an std::function
3135         as std::function has issues with regards to thread safety.
3136
3137         * wtf/WorkQueue.h:
3138         * wtf/cocoa/WorkQueueCocoa.cpp:
3139         (WTF::WorkQueue::concurrentApply):
3140
3141 2017-06-08  Xabier Rodriguez Calvar  <calvaris@igalia.com>
3142
3143         MediaTime class has rounding issues in different platforms
3144         https://bugs.webkit.org/show_bug.cgi?id=172640
3145
3146         Reviewed by Jer Noble.
3147
3148         The way a timescale is set when creating a MediaTime from a double
3149         can create rounding issues in different platforms because in some
3150         rounding is made and in others, it truncates. This way we ensure a
3151         common behavior.
3152
3153         Dumping MediaTimes is also confusing and by the output you don't
3154         know if it's containing a double or a fraction. Now, if it
3155         contains a double, it only prints the double because printing the
3156         fraction is misleading (it currently prints the double read as an
3157         integer) and if it contains a fraction it shows the fraction and
3158         its double representation separated by an = instead of a ,.
3159
3160         * wtf/MediaTime.cpp:
3161         (WTF::MediaTime::createWithDouble): When creating MediaTime from
3162         double, we round instead of leaving it to the cast operation.
3163         (WTF::MediaTime::dump):
3164
3165 2017-06-07  Jer Noble  <jer.noble@apple.com>
3166
3167         Refactoring: MediaEngineSupportParameters should take a ContentType rather than separate type & codecs strings
3168         https://bugs.webkit.org/show_bug.cgi?id=173038
3169
3170         Reviewed by Eric Carlson.
3171
3172         Drive by fix: add a version of split that takes a UChar and returns a Vector<String>.
3173
3174         * wtf/text/WTFString.h:
3175         (WTF::String::split):
3176
3177 2017-06-07  Zan Dobersek  <zdobersek@igalia.com>
3178
3179         [GCrypt] RSA-PSS support
3180         https://bugs.webkit.org/show_bug.cgi?id=172856
3181
3182         Reviewed by Jiewen Tan.
3183
3184         * wtf/Platform.h: Define HAVE_RSA_PSS to 1 for USE(GCRYPT). Support for RSA-PSS
3185         is provided by default through the libgcrypt library.
3186
3187 2017-06-06  Chris Dumez  <cdumez@apple.com>
3188
3189         Unreviewed, rolling out r214974.
3190
3191         Causes some tabs to start using a huge amount of CPU after 8
3192         minutes in the background
3193
3194         Reverted changeset:
3195
3196         "Make inactive web processes behave as though under memory
3197         pressure."
3198         https://bugs.webkit.org/show_bug.cgi?id=170042
3199         http://trac.webkit.org/changeset/214974
3200
3201 2017-06-06  Don Olmstead  <don.olmstead@am.sony.com>
3202
3203         [WebCore] Enable REQUEST_ANIMATION_FRAME_TIMER for all ports
3204         https://bugs.webkit.org/show_bug.cgi?id=172780
3205
3206         Reviewed by Alex Christensen.
3207
3208         * wtf/Platform.h:
3209
3210 2017-06-06  Darin Adler  <darin@apple.com>
3211
3212         Cut down use of WTF_ARRAY_LENGTH
3213         https://bugs.webkit.org/show_bug.cgi?id=172997
3214
3215         Reviewed by Chris Dumez.
3216
3217         * wtf/DateMath.cpp:
3218         (WTF::equalLettersIgnoringASCIICase): Added helper function template.
3219         (WTF::parseDateFromNullTerminatedCharacters): Use a modern for loop instead of
3220         WTF_ARRAY_LENGTH. Use startsWithLettersIgnoringASCIICase and
3221         equalLettersIgnoringASCIICase instead of strncasecmp.
3222
3223         * wtf/text/IntegerToStringConversion.h:
3224         (WTF::numberToStringImpl): Use std::end instead of WTF_ARRAY_LENGTH.
3225         (WTF::writeNumberToBufferImpl): Ditto.
3226
3227 2017-06-06  Filip Pizlo  <fpizlo@apple.com>
3228
3229         index out of bound in bytecodebasicblock
3230         https://bugs.webkit.org/show_bug.cgi?id=172963
3231
3232         Reviewed by Saam Barati and Mark Lam.
3233
3234         * wtf/Assertions.h:
3235         (UNREACHABLE_FOR_PLATFORM):
3236
3237 2017-06-05  Jer Noble  <jer.noble@apple.com>
3238
3239         Allow clients to specify a list of codecs which should require hardware decode support.
3240         https://bugs.webkit.org/show_bug.cgi?id=172787
3241
3242         Reviewed by Alex Christensen.
3243
3244         Add a couple of convenience methods:
3245         - a String::split() that returns a vector (rather than taking an out-reference to a vector).
3246         - A Vector::map() template which takes a Callable and returns a Vector of a different type.
3247
3248         * wtf/Vector.h:
3249         (WTF::Vector::map):
3250         * wtf/text/WTFString.h:
3251         (WTF::String::split):
3252
3253 2017-06-04  Konstantin Tokarev  <annulen@yandex.ru>
3254
3255         Fix build of Windows-specific code with ICU 59.1
3256         https://bugs.webkit.org/show_bug.cgi?id=172729
3257
3258         Reviewed by Darin Adler.
3259
3260         * wtf/text/win/WCharStringExtras.h: Added new header file wuth helper
3261         functions for conversion between WTF::String and wchart_t*.
3262         (WTF::stringToNullTerminatedWChar):
3263         (WTF::wcharToString):
3264         (WTF::nullTerminatedWCharToString):
3265
3266 2017-06-02  Stephan Szabo  <stephan.szabo@am.sony.com>
3267
3268         [JSCOnly] Build static jsc.exe on Windows
3269         https://bugs.webkit.org/show_bug.cgi?id=172833
3270
3271         Reviewed by Konstantin Tokarev.
3272
3273         * wtf/PlatformJSCOnly.cmake:
3274
3275 2017-06-02  Simon Fraser  <simon.fraser@apple.com>
3276
3277         Get <chrono> out of StdLibExtras.h
3278         https://bugs.webkit.org/show_bug.cgi?id=172744
3279
3280         Reviewed by Zalan Bujtas.
3281
3282         We hates std::chrono. Don't include it everywhere to discourage use.
3283
3284         * wtf/StdLibExtras.h:
3285
3286 2017-06-02  Filip Pizlo  <fpizlo@apple.com>
3287
3288         Atomics.load and Atomics.store need to be fully fenced
3289         https://bugs.webkit.org/show_bug.cgi?id=172844
3290
3291         Reviewed by Keith Miller.
3292         
3293         Add loadFullyFenced and storeFullyFenced to Atomic<>.
3294
3295         * wtf/Atomics.h:
3296         (WTF::Atomic::loadFullyFenced):
3297         (WTF::Atomic::storeRelaxed):
3298         (WTF::Atomic::storeFullyFenced):
3299         (WTF::atomicLoadFullyFenced):
3300         (WTF::atomicStoreFullyFenced):
3301
3302 2017-06-01  Keith Miller  <keith_miller@apple.com>
3303
3304         Undo rollout in r217638 with bug fix
3305         https://bugs.webkit.org/show_bug.cgi?id=172824
3306
3307         Unreviewed, reland patch with unused set_state code removed.
3308
3309         * Configurations/WTF.xcconfig:
3310         * WTF.xcodeproj/project.pbxproj:
3311         * wtf/Platform.h:
3312         * wtf/PlatformRegisters.h:
3313         (WTF::registersFromUContext):
3314         * wtf/StackBounds.h:
3315         (WTF::StackBounds::StackBounds):
3316         * wtf/ThreadHolder.cpp:
3317         (WTF::ThreadHolder::~ThreadHolder):
3318         * wtf/ThreadMessage.cpp:
3319         (WTF::sendMessageUsingSignal):
3320         (WTF::sendMessageUsingMach):
3321         (WTF::deliverMessagesUsingMach):
3322         (WTF::sendMessageScoped):
3323         * wtf/ThreadMessage.h:
3324         (WTF::sendMessage):
3325         * wtf/Threading.h:
3326         (WTF::Thread::machThread):
3327         * wtf/mac/MachExceptions.defs: Copied from Source/WTF/wtf/ThreadMessage.h.
3328         * wtf/threads/Signals.cpp:
3329         (WTF::startMachExceptionHandlerThread):
3330         (WTF::fromMachException):
3331         (WTF::toMachMask):
3332         (WTF::handleSignalsWithMach):
3333         (WTF::setExceptionPorts):
3334         (WTF::activeThreads):
3335         (WTF::registerThreadForMachExceptionHandling):
3336         (WTF::unregisterThreadForMachExceptionHandling):
3337         (WTF::installSignalHandler):
3338         (WTF::jscSignalHandler):
3339         * wtf/threads/Signals.h:
3340
3341 2017-05-31  Commit Queue  <commit-queue@webkit.org>
3342
3343         Unreviewed, rolling out r217611 and r217631.
3344         https://bugs.webkit.org/show_bug.cgi?id=172785
3345
3346         "caused wasm-hashset-many.html to become flaky." (Requested by
3347         keith_miller on #webkit).
3348
3349         Reverted changesets:
3350
3351         "Reland r216808, underlying lldb bug has been fixed."
3352         https://bugs.webkit.org/show_bug.cgi?id=172759
3353         http://trac.webkit.org/changeset/217611
3354
3355         "Use dispatch queues for mach exceptions"
3356         https://bugs.webkit.org/show_bug.cgi?id=172775
3357         http://trac.webkit.org/changeset/217631
3358
3359 2017-05-31  Keith Miller  <keith_miller@apple.com>
3360
3361         Use dispatch queues for mach exceptions
3362         https://bugs.webkit.org/show_bug.cgi?id=172775
3363
3364         Reviewed by Geoffrey Garen.
3365
3366         This patch adds support for using a dispatch queue to handle our
3367         mach exceptions. We use a high priority concurrent dispatch queue
3368         to handle our mach exceptions. We don't know the priority of the
3369         thread whose exception we are handling so the most conservative
3370         answer is to respond with a high priority. These events are both
3371         rare and usually quite fast so it is likely not a significant cost
3372         when the thread with an exception has a low priority.
3373
3374         * wtf/threads/Signals.cpp:
3375         (WTF::startMachExceptionHandlerThread):
3376
3377 2017-05-31  Keith Miller  <keith_miller@apple.com>
3378
3379         Reland r216808, underlying lldb bug has been fixed.
3380         https://bugs.webkit.org/show_bug.cgi?id=172759
3381
3382         Unreviewed, relanding old patch. See: rdar://problem/31183352
3383
3384         * Configurations/WTF.xcconfig:
3385         * WTF.xcodeproj/project.pbxproj:
3386         * wtf/Platform.h:
3387         * wtf/PlatformRegisters.h:
3388         (WTF::registersFromUContext):
3389         * wtf/StackBounds.h:
3390         (WTF::StackBounds::StackBounds):
3391         * wtf/ThreadHolder.cpp:
3392         (WTF::ThreadHolder::~ThreadHolder):
3393         * wtf/ThreadMessage.cpp:
3394         (WTF::sendMessageUsingSignal):
3395         (WTF::sendMessageUsingMach):
3396         (WTF::deliverMessagesUsingMach):
3397         (WTF::sendMessageScoped):
3398         * wtf/ThreadMessage.h:
3399         (WTF::sendMessage):
3400         * wtf/Threading.h:
3401         (WTF::Thread::machThread):
3402         * wtf/mac/MachExceptions.defs: Copied from Source/WTF/wtf/ThreadMessage.h.
3403         * wtf/threads/Signals.cpp:
3404         (WTF::startMachExceptionHandlerThread):
3405         (WTF::fromMachException):
3406         (WTF::toMachMask):
3407         (WTF::handleSignalsWithMach):
3408         (WTF::setExceptionPorts):
3409         (WTF::activeThreads):
3410         (WTF::registerThreadForMachExceptionHandling):
3411         (WTF::unregisterThreadForMachExceptionHandling):
3412         (WTF::installSignalHandler):
3413         (WTF::jscSignalHandler):
3414         * wtf/threads/Signals.h:
3415
3416 2017-05-31  Matt Lewis  <jlewis3@apple.com>
3417
3418         Unreviewed, rolling out r217603.
3419
3420         This patch broke the internal builds.
3421
3422         Reverted changeset:
3423
3424         "Get <chrono> out of StdLibExtras.h"
3425         https://bugs.webkit.org/show_bug.cgi?id=172744
3426         http://trac.webkit.org/changeset/217603
3427
3428 2017-05-31  Simon Fraser  <simon.fraser@apple.com>
3429
3430         Get <chrono> out of StdLibExtras.h
3431         https://bugs.webkit.org/show_bug.cgi?id=172744
3432
3433         Reviewed by Saam Barati.
3434
3435         We hates std::chrono. Don't include it everywhere to discourage use.
3436
3437         * wtf/StdLibExtras.h:
3438
3439 2017-05-30  Ryosuke Niwa  <rniwa@webkit.org>
3440
3441         Only include DataDetectorsUI headers in iOS
3442         https://bugs.webkit.org/show_bug.cgi?id=172633
3443
3444         Reviewed by David Kilzer.
3445
3446         Enable data detectors only on iOS and not other variants of iOS.
3447
3448         * wtf/FeatureDefines.h:
3449         * wtf/Platform.h:
3450
3451 2017-05-29  Yusuke Suzuki  <utatane.tea@gmail.com>
3452
3453         Unreviewed, disable faster Interpreter::getOpcodeID for ARM_THUMB2 with non-Darwin OSes
3454         https://bugs.webkit.org/show_bug.cgi?id=172686
3455
3456         Because of test failures.
3457
3458         * wtf/Platform.h:
3459
3460 2017-05-28  Dan Bernstein  <mitz@apple.com>
3461
3462         [Xcode] ALWAYS_SEARCH_USER_PATHS is set to YES
3463         https://bugs.webkit.org/show_bug.cgi?id=172691
3464
3465         Reviewed by Tim Horton.
3466
3467         * Configurations/Base.xcconfig: Set ALWAYS_SEARCH_USER_PATHS to NO.
3468
3469 2017-05-28  Yusuke Suzuki  <utatane.tea@gmail.com>
3470
3471         [JSC][Linux][FreeBSD] Use faster Interpreter::getOpcodeID()
3472         https://bugs.webkit.org/show_bug.cgi?id=172686
3473
3474         Reviewed by Mark Lam.
3475
3476         As of r217526, JSC gets faster Interpreter::getOpcodeID() by
3477         embedding OpcodeID value just before the LLInt machine code
3478         handler pointer. By doing so, we can retrieve OpcodeID from
3479         the LLInt machine code handler by dereferencing the code
3480         pointer. `*((int*)ptr - 1)`.
3481
3482         This patch allows Linux and FreeBSD environments to use this
3483         optimization.
3484
3485         * wtf/Platform.h:
3486
3487 2017-05-28  Mark Lam  <mark.lam@apple.com>
3488
3489         Implement a faster Interpreter::getOpcodeID().
3490         https://bugs.webkit.org/show_bug.cgi?id=172669
3491
3492         Reviewed by Saam Barati.
3493
3494         Added the USE(LLINT_EMBEDDED_OPCODE_ID) configuration.
3495
3496         * wtf/Platform.h:
3497
3498 2017-05-26  Brent Fulgham  <bfulgham@apple.com>
3499
3500         [WK2] Address thread safety issues with ResourceLoadStatistics
3501         https://bugs.webkit.org/show_bug.cgi?id=172519
3502         <rdar://problem/31707642>
3503
3504         Reviewed by Chris Dumez.
3505
3506         Add a new specialization for HashSet.
3507
3508         * wtf/CrossThreadCopier.h:
3509
3510 2017-05-26  Ryan Haddad  <ryanhaddad@apple.com>
3511
3512         Unreviewed, rolling out r217458.
3513
3514         This change caused 55 JSC test failures.
3515
3516         Reverted changeset:
3517
3518         "Date should use historical data if it's available."
3519         https://bugs.webkit.org/show_bug.cgi?id=172592
3520         http://trac.webkit.org/changeset/217458
3521
3522 2017-05-25  Keith Miller  <keith_miller@apple.com>
3523
3524         Date should use historical data if it's available.
3525         https://bugs.webkit.org/show_bug.cgi?id=172592
3526
3527         Reviewed by Mark Lam.
3528
3529         The spec previously disallowed using historical data for Dates.
3530         This is no longer the case. Additionally, not using historical
3531         data, when available, seems unfortunate for users. This patch
3532         removes the code dropping historical data.
3533
3534         * wtf/DateMath.cpp:
3535         (WTF::calculateLocalTimeOffset):
3536         (WTF::msToMilliseconds): Deleted.
3537
3538 2017-05-25  Yusuke Suzuki  <utatane.tea@gmail.com>
3539
3540         [Win] ASSERTION FAILED: !HashTranslator::equal(KeyTraits::emptyValue(), key)
3541         https://bugs.webkit.org/show_bug.cgi?id=172586
3542
3543         Reviewed by Brent Fulgham.
3544
3545         In ThreadHolder for Windows, we need to construct HashMap<ThreadIdentifier, ThreadHolder*>.
3546         The problem is that ThreadHolder::platformInitialize touches Thread::id() even before Thread
3547         is not established. In that case, id() returns incorrect value.
3548
3549         But, calling ThreadHolder::initialize() after waiting for completion of Thread::establish() is
3550         not a good idea. Since we already have NewThreadContext->creationMutex, we can wait for completion
3551         of Thread::establish() easily. However, if we do so, Thread::create() returns RefPtr<Thread> that
3552         may not call ThreadHolder::initialize() in its thread yet. In that case, ThreadHolder::get() fails.
3553         Thus, Windows WTF::waitForThreadCompletion implementation becomes broken. We can add a new mutex
3554         to wait for completion of ThreadHolder::initialize in the creator of the thread (like a ping-pong!).
3555         But it overly complicates the implementation.
3556
3557         The following is overly complicated initialization phase.
3558
3559         Creator -> AC mutex(1) -------> establishment -> RL mutex(1) ----------------------> AC mutex(2) ->
3560
3561                                Thread -----------------> AC mutex(1) -> ThreadHolder init -> RL mutex(2) ->
3562
3563         So, instead, in this patch, we just use Thread::currentID(). When calling ThreadHolder::initialize(),
3564         we pass ThreadIdentifier by using Thread::currentID(). This implementation works great because,
3565
3566         1. ThreadHolder::initialize requires ThreadIdentifier only in Windows environment because Pthread
3567            ThreadHolder does not create HashMap<>. And this is used for obsolete Threading APIs. Thus this
3568            hack will be removed in the near future.
3569
3570         2. In Windows, Thread::currentID() can return a valid value without using ThreadHolder. And it does
3571            not require Thread establishment. So, calling currentID() to initialize ThreadHolder is ok in
3572            Windows.
3573
3574         * wtf/ThreadHolder.cpp:
3575         (WTF::ThreadHolder::initialize): Deleted.
3576         * wtf/ThreadHolder.h:
3577         * wtf/ThreadHolderPthreads.cpp:
3578         (WTF::ThreadHolder::initialize):
3579         * wtf/ThreadHolderWin.cpp:
3580         (WTF::ThreadHolder::initialize):
3581         (WTF::ThreadHolder::platformInitialize): Deleted.
3582         * wtf/ThreadingWin.cpp:
3583         (WTF::wtfThreadEntryPoint):
3584
3585 2017-05-25  Adrian Perez de Castro  <aperez@igalia.com>
3586
3587         Clang warns about (intended) returning pointer to stack location in WTF/wtf/ThreadingPthreads.cpp
3588         https://bugs.webkit.org/show_bug.cgi?id=172595
3589
3590         Reviewed by Mark Lam.
3591
3592         * wtf/ThreadingPthreads.cpp: Use a #pragma to silence Clang warning about returning a
3593         pointer to the stack (which is intended)
3594
3595 2017-05-25  David Kilzer  <ddkilzer@apple.com>
3596
3597         REGRESSION (r217416): Using #pragma once in WTFString.h broke the build
3598
3599         * wtf/text/WTFString.h: Switch back to #ifndef/#define/#endif.
3600
3601 2017-05-25  David Kilzer  <ddkilzer@apple.com>
3602
3603         Make a change to force a build on the Apple bots
3604
3605         * wtf/text/WTFString.h: Use #pragma once.
3606
3607 2017-05-24  Andreas Kling  <akling@apple.com>
3608
3609         Disable memory kill mechanisms when running with FastMalloc disabled.
3610         https://bugs.webkit.org/show_bug.cgi?id=172550
3611         <rdar://problem/32181908>
3612
3613         Reviewed by Antti Koivisto.
3614
3615         If someone is using WebKit with a non-standard allocator, they are likely trying to debug
3616         or test something, and suddenly getting killed is not gonna help with that.
3617
3618         * wtf/MemoryPressureHandler.cpp:
3619         (WTF::MemoryPressureHandler::setShouldUsePeriodicMemoryMonitor):
3620
3621 2017-05-22  Jiewen Tan  <jiewen_tan@apple.com>
3622
3623         [WebCrypto] Support RSA-PSS
3624         https://bugs.webkit.org/show_bug.cgi?id=170869
3625         <rdar://problem/31640672>
3626
3627         Reviewed by Brent Fulgham.
3628
3629         * wtf/Platform.h:
3630         Add a flag to enable RSA-PSS in the future.
3631
3632 2017-05-23  Myles C. Maxfield  <mmaxfield@apple.com>
3633
3634         Remove dead ENABLE(FONT_LOAD_EVENTS) code
3635         https://bugs.webkit.org/show_bug.cgi?id=172517
3636
3637         Rubber-stamped by Simon Fraser.
3638
3639         * wtf/FeatureDefines.h:
3640
3641 2017-05-23  Don Olmstead  <don.olmstead@am.sony.com>
3642
3643         [WTF] Export additional symbols in threading
3644         https://bugs.webkit.org/show_bug.cgi?id=171952
3645
3646         Reviewed by Konstantin Tokarev.
3647
3648         * wtf/ThreadMessage.h:
3649         * wtf/threads/Signals.h:
3650
3651 2017-05-23  Tomas Popela  <tpopela@redhat.com>
3652
3653         [WTF] Compilation fails with system malloc
3654         https://bugs.webkit.org/show_bug.cgi?id=172445
3655
3656         Reviewed by Michael Catanzaro.
3657
3658         We are using the bmalloc even if the system malloc should be used.
3659         Don't use bmalloc if the system malloc is requested and add the
3660         missing implementation for computeRAMSize() on UNIX that's utilizing
3661         the sysinfo() call.
3662
3663         * wtf/RAMSize.cpp:
3664         (WTF::computeRAMSize):
3665
3666 2017-05-22  Brian Burg  <bburg@apple.com>
3667
3668         Add a debugging macro that sleeps a thread until a debugger attaches
3669         https://bugs.webkit.org/show_bug.cgi?id=171575
3670
3671         Reviewed by Mark Lam.
3672
3673         This is really useful for debugging early errors if for some reason you can't
3674         launch a process directly from the debugger easily, such as Web Content processes.
3675
3676         * WTF.xcodeproj/project.pbxproj:
3677         * wtf/Assertions.h:
3678         Always define the WTFBreakpointTrap() macro. Still make it an error if the CPU
3679         type isn't supported for OS(DARWIN); if used on other platforms, cause a WTFCrash()
3680         with a comment that indicates this is not implemented.
3681
3682         * wtf/DebugUtilities.h: Added.
3683
3684 2017-05-19  Don Olmstead  <don.olmstead@am.sony.com>
3685
3686         [WTF] Remove PLATFORM(WIN) references
3687         https://bugs.webkit.org/show_bug.cgi?id=172301
3688
3689         Reviewed by Yusuke Suzuki.
3690
3691         * wtf/MemoryPressureHandler.cpp:
3692         * wtf/MemoryPressureHandler.h:
3693         * wtf/Platform.h:
3694
3695 2017-05-19  Don Olmstead  <don.olmstead@am.sony.com>
3696
3697         [CMake] Add HAVE check for __int128_t
3698         https://bugs.webkit.org/show_bug.cgi?id=172317
3699
3700         Reviewed by Yusuke Suzuki.
3701
3702         * wtf/MediaTime.cpp:
3703         (WTF::MediaTime::setTimeScale):
3704         * wtf/Platform.h:
3705
3706 2017-05-18  Andreas Kling  <akling@apple.com>
3707
3708         [WK2] Notify WebPageProxy client when an active process goes over the inactive memory limit
3709         https://bugs.webkit.org/show_bug.cgi?id=172244
3710         <rdar://problem/31800943>
3711
3712         Reviewed by Geoffrey Garen.
3713
3714         Add an installable callback to MemoryPressureHandler that gets invoked when an active process
3715         exceeds the kill limit for an inactive process.
3716
3717         This allows a UI client to become aware that backgrounding a tab may cause it to get killed.
3718
3719         * wtf/MemoryPressureHandler.cpp:
3720         (WTF::thresholdForMemoryKillWithProcessState):
3721         (WTF::MemoryPressureHandler::thresholdForMemoryKill):
3722         (WTF::MemoryPressureHandler::measurementTimerFired):
3723         (WTF::MemoryPressureHandler::doesExceedInactiveLimitWhileActive):
3724         (WTF::MemoryPressureHandler::doesNotExceedInactiveLimitWhileActive):
3725         * wtf/MemoryPressureHandler.h:
3726         (WTF::MemoryPressureHandler::setDidExceedInactiveLimitWhileActiveCallback):
3727
3728 2017-05-18  Geoffrey Garen  <ggaren@apple.com>
3729
3730         AutomaticThread should wait longer before timing out
3731         https://bugs.webkit.org/show_bug.cgi?id=172292
3732
3733         Reviewed by Filip Pizlo.
3734
3735         Increased the idle timeout from 1s => 10s.
3736
3737         This reduces the number of thread restarts on JetStream from
3738         ~150 => ~0. It also matches other thread pool APIs on Darwin.
3739
3740         Intuitively, it seems wrong for helper threads to idle exit during
3741         hardcore benchmarking.
3742
3743         This patch in combination with a bmalloc fix seems to be a 1%-2% JetStream
3744         speedup on my Mac Pro.
3745
3746         A nice side-benefit is that per-thread traces are easier to read.
3747
3748         * wtf/AutomaticThread.cpp:
3749         (WTF::AutomaticThread::start):
3750         * wtf/AutomaticThread.h:
3751
3752 2017-05-18  Don Olmstead  <don.olmstead@am.sony.com>
3753
3754         [Win] Remove usage of _snprintf
3755         https://bugs.webkit.org/show_bug.cgi?id=172251
3756
3757         Reviewed by Per Arne Vollan.
3758
3759         * wtf/DataLog.cpp:
3760         (WTF::initializeLogFileOnce):
3761         (WTF::setDataFile):
3762
3763 2017-05-15  Mark Lam  <mark.lam@apple.com>
3764
3765         Rolling out r214038 and r213697: Crashes when using computed properties with rest destructuring and object spread.
3766         https://bugs.webkit.org/show_bug.cgi?id=172147
3767
3768         Rubber-stamped by Saam Barati.
3769
3770         * wtf/HashSet.h:
3771         (WTF::=):
3772
3773 2017-05-14  Chris Dumez  <cdumez@apple.com>
3774
3775         Drop PassRefPtr class from WTF
3776         https://bugs.webkit.org/show_bug.cgi?id=172091
3777
3778         Reviewed by Alex Christensen.
3779
3780         Drop PassRefPtr class from WTF as it is no longer used or needed.
3781         Also drop RefPtr::release() for the same reasons.
3782
3783         * WTF.xcodeproj/project.pbxproj:
3784         * wtf/CMakeLists.txt:
3785         * wtf/CrossThreadCopier.cpp:
3786         * wtf/CrossThreadCopier.h:
3787         * wtf/Forward.h:
3788         * wtf/PassRefPtr.h: Removed.
3789         * wtf/RefPtr.h:
3790         (WTF::refIfNotNull):
3791         (WTF::derefIfNotNull):
3792         (WTF::RefPtr::RefPtr):
3793         (WTF::RefPtr::release): Deleted.
3794         * wtf/SizeLimits.cpp:
3795         * wtf/Vector.h:
3796
3797 2017-05-13  Chris Dumez  <cdumez@apple.com>
3798
3799         Stop using RefPtr::release()
3800         https://bugs.webkit.org/show_bug.cgi?id=172074
3801
3802         Reviewed by Geoffrey Garen.
3803
3804         * wtf/win/WorkQueueWin.cpp:
3805         (WTF::WorkQueue::dispatchAfter):
3806
3807 2017-05-13  Commit Queue  <commit-queue@webkit.org>
3808
3809         Unreviewed, rolling out r216808.
3810         https://bugs.webkit.org/show_bug.cgi?id=172075
3811
3812         caused lldb to hang when debugging (Requested by smfr on
3813         #webkit).
3814
3815         Reverted changeset:
3816
3817         "Use Mach exceptions instead of signals where possible"
3818         https://bugs.webkit.org/show_bug.cgi?id=171865
3819         http://trac.webkit.org/changeset/216808
3820
3821 2017-05-12  Keith Miller  <keith_miller@apple.com>
3822
3823         Use Mach exceptions instead of signals where possible
3824         https://bugs.webkit.org/show_bug.cgi?id=171865
3825
3826         Reviewed by Mark Lam.
3827
3828         This patch enables using mach exceptions on darwin. The way the
3829         mach exception api works is that we create a mach port, which is
3830         like a file descriptor.  We then wait for a message to arrive on
3831         that port in a thread. When another thread raises an exception (say
3832         due to a bad memory access) the OS sends our thread a message. The
3833         payload of that message is the register file of the crashing
3834         thread. We then call our custom handlers that change the state as
3835         needed. In order to restart the thread we send a payload back to
3836         the OS with an updated register file along with a success message
3837         header.
3838
3839         This patch also makes thread messages work without signals by
3840         simply suspending the thread, and then running the message at that
3841         time.
3842
3843         You can read more about mach exceptions here:
3844         http://www.cs.cmu.edu/afs/cs/project/mach/public/doc/unpublished/exception.ps
3845         and the Mach interface Generator (MiG) here:
3846         http://www.cs.cmu.edu/afs/cs/project/mach/public/doc/unpublished/mig.ps
3847
3848         * Configurations/WTF.xcconfig:
3849         * WTF.xcodeproj/project.pbxproj:
3850         * wtf/Platform.h:
3851         * wtf/PlatformRegisters.h:
3852         (WTF::registersFromUContext):
3853         * wtf/StackBounds.h:
3854         (WTF::StackBounds::StackBounds):
3855         * wtf/ThreadHolder.cpp:
3856         (WTF::ThreadHolder::~ThreadHolder):
3857         * wtf/ThreadMessage.cpp:
3858         (WTF::sendMessageUsingSignal):
3859         (WTF::sendMessageUsingMach):
3860         (WTF::deliverMessagesUsingMach):
3861         (WTF::sendMessageScoped):
3862         * wtf/ThreadMessage.h:
3863         (WTF::sendMessage):
3864         * wtf/Threading.h:
3865         (WTF::Thread::machThread):
3866         * wtf/mac/MachExceptions.defs: Copied from Source/WTF/wtf/ThreadMessage.h.
3867         * wtf/threads/Signals.cpp:
3868         (WTF::startMachExceptionHandlerThread):
3869         (WTF::fromMachException):
3870         (WTF::toMachMask):
3871         (WTF::handleSignalsWithMach):
3872         (WTF::setExceptionPorts):
3873         (WTF::activeThreads):
3874         (WTF::registerThreadForMachExceptionHandling):
3875         (WTF::unregisterThreadForMachExceptionHandling):
3876         (WTF::installSignalHandler):
3877         (WTF::jscSignalHandler):
3878         * wtf/threads/Signals.h:
3879
3880 2017-05-12  Ting-Wei Lan  <lantw44@gmail.com>
3881
3882         Include algorithm before using std::min
3883         https://bugs.webkit.org/show_bug.cgi?id=171733
3884
3885         Reviewed by Chris Dumez.
3886
3887         * wtf/text/StringCommon.h:
3888
3889 2017-05-12  Andreas Kling  <akling@apple.com>
3890
3891         More aggressive memory kill limits.
3892         https://bugs.webkit.org/show_bug.cgi?id=172037
3893         <rdar://problem/31969082>
3894
3895         Reviewed by Michael Saboff.
3896
3897         Bring down the memory kill limits to 4GB for active processes, and 2GB for inactive.
3898         Also make MemoryUsagePolicy::Strict kick in above 1.5GB.
3899
3900         * wtf/MemoryPressureHandler.cpp:
3901         (WTF::MemoryPressureHandler::thresholdForMemoryKill):
3902         (WTF::thresholdForPolicy):
3903
3904 2017-05-12  Michael Saboff  <msaboff@apple.com>
3905
3906         [iOS] Use memory footprint to dynamically adjust behavior of allocators
3907         https://bugs.webkit.org/show_bug.cgi?id=171944
3908
3909         Reviewed by Filip Pizlo.
3910
3911         Moved the non-Windows implementation of RAMSize() to bmalloc/AvailableMemory.cpp and
3912         called the function availableMemory().
3913
3914         * wtf/RAMSize.cpp:
3915         (WTF::computeRAMSize):
3916
3917 2017-05-12  Claudio Saavedra  <csaavedra@igalia.com>
3918
3919         [WPE] Add MemoryFootprintLinux to build
3920
3921         Unreviewed build fix after r216731.
3922
3923         * wtf/PlatformWPE.cmake:
3924
3925 2017-05-12  Csaba Osztrogonác  <ossy@webkit.org>
3926
3927         Unreviewed trivial JSCOnly buildfix after r216731.
3928         https://bugs.webkit.org/show_bug.cgi?id=171693
3929
3930         * wtf/PlatformJSCOnly.cmake:
3931
3932 2017-05-11  Yusuke Suzuki  <utatane.tea@gmail.com>
3933
3934         [Win] Implement memoryFootprint for Windows
3935         https://bugs.webkit.org/show_bug.cgi?id=171693
3936
3937         Reviewed by Alex Christensen.
3938
3939         This patch implements memoryFootprint for Windows. In Windows, we calculate the size
3940         of private working set. This can be done by enumerating private pages in working set.
3941
3942         And we also split MemoryFootprint.cpp to cocoa, linux, and win versions.
3943
3944         * WTF.xcodeproj/project.pbxproj:
3945         * wtf/CMakeLists.txt:
3946         * wtf/MallocPtr.h:
3947         (WTF::MallocPtr::operator*):
3948         (WTF::MallocPtr::operator->):
3949         * wtf/PlatformGTK.cmake:
3950         * wtf/PlatformJSCOnly.cmake:
3951         * wtf/PlatformMac.cmake:
3952         * wtf/PlatformWin.cmake:
3953         * wtf/cocoa/MemoryFootprintCocoa.cpp: Copied from Source/WTF/wtf/MemoryFootprint.cpp.
3954         (WTF::memoryFootprint):
3955         * wtf/linux/MemoryFootprintLinux.cpp: Renamed from Source/WTF/wtf/MemoryFootprint.cpp.
3956         (WTF::forEachLine):
3957         (WTF::memoryFootprint):
3958         * wtf/win/MemoryFootprintWin.cpp: Added.
3959         (WTF::memoryFootprint):
3960
3961 2017-05-11  Don Olmstead  <don.olmstead@am.sony.com>
3962
3963         [CMake] Add HAVE check for regex.h
3964         https://bugs.webkit.org/show_bug.cgi?id=171950
3965
3966         Reviewed by Michael Catanzaro.
3967
3968         * wtf/Platform.h:
3969
3970 2017-05-11  Chris Dumez  <cdumez@apple.com>
3971
3972         Annotate Ref::ptr() with RETURNS_NONNULL
3973         https://bugs.webkit.org/show_bug.cgi?id=171996
3974
3975         Reviewed by Andreas Kling.
3976
3977         Annotate Ref::ptr() with RETURNS_NONNULL as it can never return null.
3978
3979         * wtf/Ref.h:
3980         (WTF::Ref::ptr): Deleted.
3981
3982 2017-05-11  Joseph Pecoraro  <pecoraro@apple.com>
3983
3984         Remove Vibration API
3985         https://bugs.webkit.org/show_bug.cgi?id=171766
3986
3987         Rubber-stamped by Alexey Proskuryakov.
3988
3989         * wtf/FeatureDefines.h:
3990
3991 2017-05-09  Sam Weinig  <sam@webkit.org>
3992
3993         Remove support for legacy Notifications
3994         https://bugs.webkit.org/show_bug.cgi?id=171487
3995
3996         Reviewed by Jon Lee.
3997
3998         * wtf/FeatureDefines.h:
3999         Remove definition of ENABLE_LEGACY_NOTIFICATIONS.
4000
4001 2017-05-10  Adrian Perez de Castro  <aperez@igalia.com>
4002
4003         Remove some last remnants of the EFL port
4004         https://bugs.webkit.org/show_bug.cgi?id=171922
4005
4006         Reviewed by Antonio Gomes.
4007
4008         The EFL port is no more.
4009
4010         * wtf/PlatformEfl.cmake: Removed.
4011
4012 2017-05-10  Fujii Hironori  <Hironori.Fujii@sony.com>
4013
4014         [Win] StaticStringImpl in HTMLNames.cpp aren't constructed
4015         https://bugs.webkit.org/show_bug.cgi?id=171800
4016
4017         Reviewed by Yusuke Suzuki.
4018
4019         Global variables of StaticStringImpl in HTMLNames.cpp aren't
4020         constructed on Windows since Bug 171586. It seems that
4021         reinterpret_cast prevents constexpr's compile time initialization
4022         in VC++.
4023
4024         * wtf/text/StringImpl.h:
4025         (WTF::StringImplShape::StringImplShape): Added const char* and
4026         const char16_t* members in the union. Do not use reinterpret_cast
4027         in constexpr constructors.
4028
4029 2017-05-09  Mark Lam  <mark.lam@apple.com>
4030
4031         Force StaticStringImpl constructor to use the constexpr versions of StringImplShape constructors.
4032         https://bugs.webkit.org/show_bug.cgi?id=171861
4033
4034         Reviewed by Yusuke Suzuki.
4035
4036         This is strictly necessary for correctness of the StaticStringImpl implementation.
4037         We force the constructor selection by adding an extra dummy argument to the
4038         constexpr versions of the StringImplShape constructors to disambiguate them from
4039         the non-constexpr versions.
4040
4041         * wtf/text/StringImpl.h:
4042         (WTF::StringImplShape::StringImplShape):
4043         (WTF::StringImpl::StaticStringImpl::StaticStringImpl):
4044
4045 2017-05-09  Zan Dobersek  <zdobersek@igalia.com>
4046
4047         Upstream the WPE port
4048         https://bugs.webkit.org/show_bug.cgi?id=171110
4049
4050         Reviewed by Alex Christensen.
4051
4052         * wtf/Platform.h:
4053         * wtf/PlatformWPE.cmake: Added.
4054         * wtf/glib/RunLoopSourcePriority.h:
4055
4056 2017-05-08  Mark Lam  <mark.lam@apple.com>
4057
4058         Speculative Windows build fix after r216428.
4059         https://bugs.webkit.org/show_bug.cgi?id=171776
4060
4061         Not reviewed.
4062
4063         * wtf/StackTrace.h:
4064
4065 2017-05-08  Mark Lam  <mark.lam@apple.com>
4066
4067         Introduce ExceptionScope::assertNoException() and releaseAssertNoException().
4068         https://bugs.webkit.org/show_bug.cgi?id=171776
4069
4070         Reviewed by Keith Miller.
4071
4072         1. Add an option to skip some number of top frames when capturing the StackTrace.
4073         2. Add an option to use an indentation string when dumping the StackTrace.
4074
4075         * wtf/StackTrace.cpp:
4076         (WTF::StackTrace::captureStackTrace):
4077         (WTF::StackTrace::dump):
4078         * wtf/StackTrace.h:
4079
4080 2017-05-05  Yusuke Suzuki  <utatane.tea@gmail.com>
4081
4082         [WTF] Use memoryFootprint for MemoryUsage retrieval in Linux
4083         https://bugs.webkit.org/show_bug.cgi?id=171757
4084
4085         Reviewed by Michael Catanzaro.
4086
4087         This patch leverages memoryFootprint() to retrieve physical footprint in Linux.
4088
4089         * wtf/linux/MemoryPressureHandlerLinux.cpp:
4090         (WTF::MemoryPressureHandler::ReliefLogger::platformMemoryUsage):
4091
4092 2017-05-05  Don Olmstead  <don.olmstead@am.sony.com>
4093
4094         [WTF] Do not export deleted constructor in StringView
4095         https://bugs.webkit.org/show_bug.cgi?id=171751
4096
4097         Reviewed by Alexey Proskuryakov.
4098
4099         * wtf/text/StringView.h:
4100
4101 2017-05-05  Yusuke Suzuki  <utatane.tea@gmail.com>
4102
4103         [GTK][JSCOnly] Merge MainThread implementations and use generic one
4104         https://bugs.webkit.org/show_bug.cgi?id=171738
4105
4106         Reviewed by Michael Catanzaro.
4107
4108         GLib MainThread implementation is generic enough to be used in JSCOnly.
4109         We move it to generic/ and GTK (GLib ports) and JSCOnly use it.
4110         And we also drop GLib MainThread's isMainThread function because
4111         generic thread ID one is enough.
4112
4113         This patch also cleans up initializing main thread code by using std::call_once.
4114
4115         * wtf/MainThread.cpp:
4116         (WTF::initializeMainThread):
4117         (WTF::isMainThread):
4118         (WTF::initializeMainThreadToProcessMainThread):
4119         (WTF::initializeWebThread):
4120         (WTF::canAccessThreadLocalDataForThread):
4121         (WTF::initializeMainThreadOnce): Deleted.
4122         (WTF::initializeMainThreadToProcessMainThreadOnce): Deleted.
4123         (WTF::initializeWebThreadOnce): Deleted.
4124         * wtf/PlatformGTK.cmake:
4125         * wtf/PlatformJSCOnly.cmake:
4126         * wtf/generic/MainThreadGeneric.cpp:
4127         (WTF::MainThreadDispatcher::MainThreadDispatcher):
4128         (WTF::MainThreadDispatcher::schedule):
4129         (WTF::MainThreadDispatcher::fired):
4130         (WTF::scheduleDispatchFunctionsOnMainThread):
4131         * wtf/glib/MainThreadGLib.cpp: Removed.
4132
4133 2017-05-04  Commit Queue  <commit-queue@webkit.org>
4134
4135         Unreviewed, rolling out r216206.
4136         https://bugs.webkit.org/show_bug.cgi?id=171714
4137
4138         Multiple LayoutTests crashing in Document::page() (Requested
4139         by ap on #webkit).
4140
4141         Reverted changeset:
4142
4143         "Remove support for legacy Notifications"
4144         https://bugs.webkit.org/show_bug.cgi?id=171487
4145         http://trac.webkit.org/changeset/216206
4146
4147 2017-05-04  Don Olmstead  <don.olmstead@am.sony.com>
4148
4149         [Win] Remove redundant macros that are set in the CMake config
4150         https://bugs.webkit.org/show_bug.cgi?id=171571
4151
4152         Reviewed by Brent Fulgham.
4153
4154         * config.h:
4155
4156 2017-05-04  Mark Lam  <mark.lam@apple.com>
4157
4158         NeverDestroyed<String>(ASCIILiteral(...)) is not thread safe.
4159         https://bugs.webkit.org/show_bug.cgi?id=171586
4160         <rdar://problem/31873190>
4161
4162         Reviewed by Yusuke Suzuki.
4163
4164         StaticStringImpl is meant to be thread-safe.  However, it has a bug: it did not
4165         set the s_hashFlagDidReportCost flag.  As a result, if cost() is called on it,
4166         different threads may try to change its flags bits at the same time.  This patch
4167         changes StaticStringImpl to always set the s_hashFlagDidReportCost flag.
4168
4169         Also factored out StringImplShape and made StringImpl and StaticStringImpl extend
4170         it.  This makes it more clear that the 2 are intended to have the same shape.
4171         Note: there is already a static_assert that the 2 have the same size.  This
4172         change also ensures that they both have the same shape, which is a requirement in
4173         order for StaticStringImpl to work.
4174
4175         Introduced the MAKE_STATIC_STRING_IMPL macro as a convenient way to instantiate
4176         StaticStringImpls from literal strings.  This allows us to trivially change
4177
4178             NeverDestroyed<String> myString(ASCIILiteral("myString"));
4179
4180         to ...
4181
4182             NeverDestroyed<String> myString(MAKE_STATIC_STRING_IMPL("myString"));
4183
4184         and by so doing, make it thread-safe.
4185
4186         MAKE_STATIC_STRING_IMPL instantiates a lambda function to create the static
4187         StaticStringImpls.
4188
4189         * wtf/text/StringImpl.h:
4190         (WTF::StringImplShape::StringImplShape):
4191         (WTF::StringImpl::StringImpl):
4192         (WTF::StringImpl::cost):
4193         (WTF::StringImpl::setHash):
4194         (WTF::StringImpl::StaticStringImpl::StaticStringImpl):
4195         (WTF::StringImpl::StaticStringImpl::operator StringImpl&):
4196         * wtf/text/WTFString.h:
4197         (WTF::String::String):
4198         * wtf/text/icu/TextBreakIteratorICU.h:
4199         (WTF::caretRules):
4200
4201 2017-05-04  Sam Weinig  <sam@webkit.org>
4202
4203         Remove support for legacy Notifications
4204         https://bugs.webkit.org/show_bug.cgi?id=171487
4205
4206         Reviewed by Jon Lee.
4207
4208         * wtf/FeatureDefines.h:
4209         Remove definition of ENABLE_LEGACY_NOTIFICATIONS.
4210
4211 2017-05-04  Yusuke Suzuki  <utatane.tea@gmail.com>
4212
4213         [GTK][JSCOnly] Implement memoryFootprint for Linux
4214         https://bugs.webkit.org/show_bug.cgi?id=171680
4215
4216         Reviewed by Carlos Alberto Lopez Perez.
4217
4218         Darwin's phys_footprint returns the amount of dirty anonymous memory in the process.
4219         This patch implements the same thing in Linux by reading /proc/self/smaps.
4220         We sum sizes of private dirty pages in anonymous regions.
4221
4222         * wtf/MemoryFootprint.cpp:
4223         (WTF::forEachLine):
4224         (WTF::memoryFootprint):
4225
4226 2017-05-03  Mark Lam  <mark.lam@apple.com>
4227
4228         Use the CLoop for CPU(ARM64E).
4229         https://bugs.webkit.org/show_bug.cgi?id=171620
4230         <rdar://problem/31973027>
4231
4232         Reviewed by Geoffrey Garen.
4233
4234         * wtf/Platform.h:
4235
4236 2017-05-02  Daniel Bates  <dabates@apple.com>
4237
4238         Fix the build after <https://trac.webkit.org/changeset/216102>
4239         (https://bugs.webkit.org/show_bug.cgi?id=170925)
4240
4241         Export into global scope ASCIICaseInsensitiveStringViewHashTranslator.
4242
4243         Also fix indentation of member functions of ASCIICaseInsensitiveStringViewHashTranslator.
4244
4245         * wtf/text/StringHash.h:
4246
4247 2017-05-02  Daniel Bates  <dabates@apple.com>
4248
4249         Using StringView.split() instead of String.split() in some places
4250         https://bugs.webkit.org/show_bug.cgi?id=170925
4251
4252         Reviewed by Darin Adler and Sam Weinig.
4253
4254         * wtf/HashMap.h: Add HashMap::get() overload that takes a HashTranslator.
4255         * wtf/text/StringHash.h:
4256         (WebCore::ASCIICaseInsensitiveStringViewHashTranslator::hash): Added.
4257         (WebCore::ASCIICaseInsensitiveStringViewHashTranslator::equal): Added.
4258
4259 2017-05-01  Dan Bernstein  <mitz@apple.com>
4260
4261         [Xcode] It’s easy to accidentally install a WTF header outside /usr/local/include/wtf
4262         https://bugs.webkit.org/show_bug.cgi?id=171533
4263
4264         Reviewed by Andy Estes.
4265
4266         * WTF.xcodeproj/project.pbxproj: Removed the WTF target’s Headers build phase. Its existence
4267           was making it easy to accidentally add a header to the target and make it Private, which
4268           would have Xcode install a copy of it right under /usr/local/include, in addition to the
4269           copy installed under /usr/local/include/wtf by the Copy WTF Headers target.
4270           Also got rid of INSTALL_PATH_PREFIX in the script build phase in the Copy WTF Headers
4271           target, because it is being never set anymore.
4272
4273 2017-05-01  Dan Bernstein  <mitz@apple.com>
4274
4275         WTF installs an extra copy of a header outside /usr/local/include/wtf
4276
4277         * WTF.xcodeproj/project.pbxproj: Demoted CPUTime.h from Private to Project.
4278
4279 2017-05-01  Daniel Bates  <dabates@apple.com>
4280
4281         Cleanup: Change ASCIICaseInsensitiveHash from a class to a struct
4282         https://bugs.webkit.org/show_bug.cgi?id=171460
4283
4284         Reviewed by Sam Weinig.
4285
4286         All of the members of ASCIICaseInsensitiveHash have public visibility.
4287         We are underutilizing the purpose of a class - defaults to private
4288         visibility of members. We should change ASCIICaseInsensitiveHash from
4289         a class to a struct, which by definition defaults to public visibility
4290         for members.
4291
4292         * wtf/text/StringHash.h:
4293
4294 2017-04-29  Yusuke Suzuki  <utatane.tea@gmail.com>
4295
4296         Move WebCore CPUTime to WTF and implement it in all the platforms
4297         https://bugs.webkit.org/show_bug.cgi?id=171477
4298
4299         Reviewed by Chris Dumez.
4300
4301         We move WebCore::CPUTime to WTF::CPUTime since it is useful even in JSC
4302         and it does not depend on any external libraries.
4303         And we additionally implement WTF::CPUTime in all the platforms: Windows and Unix.
4304
4305         In CPUTime, instead of holding int64_t, we hold MonotonicTime and Seconds.
4306
4307         * WTF.xcodeproj/project.pbxproj:
4308         *