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