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