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