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