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