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