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