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