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