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