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