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