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