a75e46dc7826d72d5cd8e8ed5c7700f31227eca1
[WebKit-https.git] / Source / WTF / ChangeLog
1 2018-02-02  Mark Lam  <mark.lam@apple.com>
2
3         More ARM64_32 fixes.
4         https://bugs.webkit.org/show_bug.cgi?id=182441
5         <rdar://problem/37162310>
6
7         Reviewed by Dan Bernstein.
8
9         My previous speculative ARM64_32 build fix in copyLCharsFromUCharSource() was wrong.
10         I've now fixed it to choose the default implementation case instead of the ARM64
11         case if the target is ARM64_32.
12
13         * wtf/text/ASCIIFastPath.h:
14         (WTF::copyLCharsFromUCharSource):
15
16 2018-02-02  Konstantin Tokarev  <annulen@yandex.ru>
17
18         Unreviewed build fix for JSCOnly on macOS after r227845.
19         https://bugs.webkit.org/show_bug.cgi?id=182274
20
21         Reverted part of r227845 that moved CommonCryptoSPI.h
22         handling into PlatformMac, because it is needed for all
23         ports which can be built on macOS.
24
25         * wtf/CMakeLists.txt:
26         * wtf/PlatformMac.cmake:
27
28 2018-02-02  Fujii Hironori  <Hironori.Fujii@sony.com>
29
30         [GTK] fast/events/message-channel-gc-4.html is flaky
31         https://bugs.webkit.org/show_bug.cgi?id=182104
32
33         Reviewed by Carlos Garcia Campos.
34
35         RELEASE_ASSERT of ThreadSpecific::set fails because
36         RunLoop::current is called even in GC thread since r227275.
37
38         * wtf/RunLoop.cpp:
39         (WTF::RunLoop::current):
40         Let the second template argument of ThreadSpecific CanBeGCThread::True.
41
42 2018-02-01  Michael Catanzaro  <mcatanzaro@igalia.com>
43
44         [WPE][GTK] Make RunLoop::TimerBase robust to its own deletion inside its source callback
45         https://bugs.webkit.org/show_bug.cgi?id=182271
46
47         Reviewed by Carlos Garcia Campos.
48
49         RunLoopTimer::fired executes the user's callback, which could delete the RunLoopTimer
50         itself. But the source callback is not prepared to handle this case. We can detect it
51         easily, because TimerBase's destructor will call g_source_destroy(), which confusingly
52         removes the GSource from its GMainContext without actually destroying the GSource. Then we
53         can check if the GSource is still attached using g_source_is_destroyed().
54
55         * wtf/glib/RunLoopGLib.cpp:
56         (WTF::RunLoop::TimerBase::TimerBase):
57
58 2018-01-31  Saam Barati  <sbarati@apple.com>
59
60         Replace tryLargeMemalignVirtual with tryLargeZeroedMemalignVirtual and use it to allocate large zeroed memory in Wasm
61         https://bugs.webkit.org/show_bug.cgi?id=182064
62         <rdar://problem/36840132>
63
64         Reviewed by Geoffrey Garen.
65
66         * wtf/Gigacage.cpp:
67         (Gigacage::tryAllocateZeroedVirtualPages):
68         (Gigacage::freeVirtualPages):
69         (Gigacage::tryAllocateVirtualPages): Deleted.
70         * wtf/Gigacage.h:
71         * wtf/OSAllocator.h:
72
73 2018-01-31  Mark Lam  <mark.lam@apple.com>
74
75         Fix some ARM64_32 build failures.
76         https://bugs.webkit.org/show_bug.cgi?id=182356
77         <rdar://problem/37057690>
78
79         Reviewed by Michael Saboff.
80
81         * wtf/MathExtras.h:
82         (WTF::dynamicPoison):
83         * wtf/text/ASCIIFastPath.h:
84         (WTF::copyLCharsFromUCharSource):
85
86 2018-01-30  Mark Lam  <mark.lam@apple.com>
87
88         Apply poisoning to TypedArray vector pointers.
89         https://bugs.webkit.org/show_bug.cgi?id=182155
90         <rdar://problem/36286266>
91
92         Reviewed by JF Bastien.
93
94         1. Added the ability to poison a CagedPtr.
95
96         2. Prevent CagedPtr from being implicitly instantiated, and add operator= methods
97            instead.  This is because implicitly instantiated CagedPtrs with a poisoned
98            trait may silently use a wrong poison value.
99
100         * wtf/CagedPtr.h:
101         (WTF::CagedPtr::CagedPtr):
102         (WTF::CagedPtr::get const):
103         (WTF::CagedPtr::operator=):
104
105 2018-01-30  Fujii Hironori  <Hironori.Fujii@sony.com>
106
107         [Win] Warning fix.
108         https://bugs.webkit.org/show_bug.cgi?id=177007
109
110         Reviewed by Yusuke Suzuki.
111
112         A 32 bit integer should not be casted to a pointer directly in 64
113         bit Windows. It should be casted to a uintptr_t beforehand.
114
115         Rules for Using Pointers (Windows)
116         https://msdn.microsoft.com/library/windows/desktop/aa384242
117
118         * wtf/ThreadingWin.cpp (InvalidThread): Casted 0xbbadbeef to uintptr_t.
119
120 2018-01-30  Don Olmstead  <don.olmstead@sony.com>
121
122         Unreviewed build fix for JSCOnly after r227845.
123         https://bugs.webkit.org/show_bug.cgi?id=182274
124
125         * wtf/PlatformJSCOnly.cmake:
126
127 2018-01-30  Don Olmstead  <don.olmstead@sony.com>
128
129         [CMake] Make WTF headers copies
130         https://bugs.webkit.org/show_bug.cgi?id=182274
131
132         Reviewed by Alex Christensen.
133
134         * wtf/CMakeLists.txt:
135         * wtf/PlatformGTK.cmake:
136         * wtf/PlatformJSCOnly.cmake:
137         * wtf/PlatformMac.cmake:
138         * wtf/PlatformWPE.cmake:
139         * wtf/PlatformWin.cmake:
140
141 2018-01-30  Mark Lam  <mark.lam@apple.com>
142
143         Move ENABLE_POISON to Platform.h.
144         https://bugs.webkit.org/show_bug.cgi?id=182298
145         <rdar://problem/37032686>
146
147         Reviewed by Michael Saboff and JF Bastien.
148
149         ENABLE_POISON belongs in Platform.h to ensure that all places that depend on
150         ENABLE(POISON) will see it properly defined.
151
152         * wtf/Platform.h:
153         * wtf/Poisoned.h:
154
155 2018-01-26  Mark Lam  <mark.lam@apple.com>
156
157         Add infrastructure for pointer preparation.
158         https://bugs.webkit.org/show_bug.cgi?id=182191
159         <rdar://problem/36889194>
160
161         Reviewed by JF Bastien.
162
163         * WTF.xcodeproj/project.pbxproj:
164         * wtf/CMakeLists.txt:
165         * wtf/PointerPreparations.h: Added.
166
167 2018-01-26  Chris Nardi  <cnardi@chromium.org>
168
169         Addressing post-review comments after r226614
170         https://bugs.webkit.org/show_bug.cgi?id=182151
171
172         Reviewed by Myles C. Maxfield.
173
174         * wtf/text/StringImpl.h:
175         (WTF::isSpaceOrNewline):
176         * wtf/text/TextBreakIterator.cpp:
177         (WTF::numCodeUnitsInGraphemeClusters):
178         * wtf/text/TextBreakIterator.h:
179
180 2018-01-26  Filip Pizlo  <fpizlo@apple.com>
181
182         Fix style - need to use C comments.
183
184         * wtf/Platform.h:
185
186 2018-01-26  Filip Pizlo  <fpizlo@apple.com>
187
188         Disable TLS-based TLCs
189         https://bugs.webkit.org/show_bug.cgi?id=182175
190
191         Reviewed by Saam Barati.
192
193         Add a flag for TLS-based TLCs and set it to 0. We can re-enable this feature when we need to use TLCs for
194         actual thread-local allocation and when we fix the fact that WebCore context switches JSC VMs without telling
195         us.
196
197         * wtf/Platform.h:
198
199 2018-01-25  Filip Pizlo  <fpizlo@apple.com>
200
201         Unreviewed, fix windows build.
202
203         * wtf/MathExtras.h:
204         (WTF::opaque):
205
206 2018-01-24  Filip Pizlo  <fpizlo@apple.com>
207
208         DirectArguments should protect itself using dynamic poisoning and precise index masking
209         https://bugs.webkit.org/show_bug.cgi?id=182086
210
211         Reviewed by Saam Barati.
212         
213         Add helpers for:
214         
215         Dynamic poisoning: this means arranging to have the pointer you will dereference become an
216         invalid pointer if the type check you were relying on would have failed.
217         
218         Precise index masking: a variant of index masking that does not depend on distancing. I figured
219         I'd just try this first for DirectArguments, since I didn't think that arguments[i] was ever
220         hot enough to warrant anything better. Turns out that in all of the benchmarks that care about
221         arguments performance, we optimize things to the point that the index masking isn't on a hot
222         path anymore. Turns out, it's neutral!
223
224         * wtf/MathExtras.h:
225         (WTF::preciseIndexMask):
226         (WTF::dynamicPoison):
227
228 2018-01-25  Jer Noble  <jer.noble@apple.com>
229
230         Unreviewed build fix after r227631; make USE_VIDEOTOOLBOX universally enabled on iOS.
231
232         * wtf/Platform.h:
233
234 2018-01-25  Jer Noble  <jer.noble@apple.com>
235
236         Move ImageDecoderAVFObjC from using AVSampleBufferGenerator to AVAssetReaderOutput for parsing
237         https://bugs.webkit.org/show_bug.cgi?id=182091
238
239         Reviewed by Eric Carlson.
240
241         * wtf/Platform.h:
242
243 2018-01-25  Mark Lam  <mark.lam@apple.com>
244
245         Rename the Poisoned::isPoisoned constant to Poisoned::isPoisonedType.
246         https://bugs.webkit.org/show_bug.cgi?id=182143
247         <rdar://problem/36880970>
248
249         Reviewed by JF Bastien.
250
251         This is so that it doesn't conflict with the isPoisoned() debugging methods that
252         are normally not built.  Also renamed PoisonedUniquePtr::isPoisonedUniquePtr to
253         PoisonedUniquePtr::isPoisonedUniquePtrType to be consistent.
254
255         * wtf/Poisoned.h:
256         * wtf/PoisonedUniquePtr.h:
257
258 2018-01-25  Filip Pizlo  <fpizlo@apple.com>
259
260         JSC GC should support TLCs (thread local caches)
261         https://bugs.webkit.org/show_bug.cgi?id=181559
262
263         Reviewed by Mark Lam and Saam Barati.
264
265         * wtf/Bitmap.h: Just fixing a compile error.
266
267 2018-01-25  Commit Queue  <commit-queue@webkit.org>
268
269         Unreviewed, rolling out r227592.
270         https://bugs.webkit.org/show_bug.cgi?id=182110
271
272         it made ARM64 (Linux and iOS) crash (Requested by pizlo-mbp on
273         #webkit).
274
275         Reverted changeset:
276
277         "JSC GC should support TLCs (thread local caches)"
278         https://bugs.webkit.org/show_bug.cgi?id=181559
279         https://trac.webkit.org/changeset/227592
280
281 2018-01-20  Filip Pizlo  <fpizlo@apple.com>
282
283         JSC GC should support TLCs (thread local caches)
284         https://bugs.webkit.org/show_bug.cgi?id=181559
285
286         Reviewed by Mark Lam and Saam Barati.
287
288         * wtf/Bitmap.h: Just fixing a compile error.
289
290 2018-01-23  Mark Lam  <mark.lam@apple.com>
291
292         Update Poisoned pointers to take a Poison class instead of a uintptr_t&.
293         https://bugs.webkit.org/show_bug.cgi?id=182017
294         <rdar://problem/36795513>
295
296         Reviewed by Filip Pizlo and JF Bastien.
297
298         This paves the way for custom poison values which we'll need for use in
299         TypedArrays later.
300
301         * wtf/Bag.h:
302         * wtf/DumbPtrTraits.h:
303         (WTF::DumbPtrTraits::poison): Deleted.
304         * wtf/DumbValueTraits.h:
305         (WTF::DumbValueTraits::poison): Deleted.
306         * wtf/Poisoned.h:
307         (WTF::Poison::key):
308         (WTF::Poisoned::swap):
309         (WTF::Poisoned::poison const):
310         (WTF::Poisoned::unpoison const):
311         (WTF::Poisoned::poison):
312         (WTF::Poisoned::unpoison):
313         (WTF::PoisonedPtrTraits::swap):
314         (WTF::PoisonedValueTraits::swap):
315         (WTF::PoisonedPtrTraits::poison): Deleted.
316         (WTF::PoisonedValueTraits::poison): Deleted.
317         * wtf/PoisonedUniquePtr.h:
318         * wtf/Ref.h:
319         * wtf/RefCountedArray.h:
320         * wtf/RefPtr.h:
321         * wtf/WTFAssertions.cpp:
322
323 2018-01-23  Alex Christensen  <achristensen@webkit.org>
324
325         Remove pre-Sierra-OS-specific code in WTF and JavaScriptCore
326         https://bugs.webkit.org/show_bug.cgi?id=182028
327
328         Reviewed by Keith Miller.
329
330         * wtf/Platform.h:
331         * wtf/mac/AppKitCompatibilityDeclarations.h:
332         * wtf/mac/DeprecatedSymbolsUsedBySafari.mm:
333         (WTF::MainThreadFunctionTracker::singleton): Deleted.
334         (WTF::MainThreadFunctionTracker::callOnMainThread): Deleted.
335         (WTF::MainThreadFunctionTracker::cancelCallOnMainThread): Deleted.
336         (WTF::MainThreadFunctionTracker::addFunction): Deleted.
337         (WTF::MainThreadFunctionTracker::removeIdentifier): Deleted.
338         (WTF::MainThreadFunctionTracker::removeFunctions): Deleted.
339         (WTF::callOnMainThread): Deleted.
340         (WTF::cancelCallOnMainThread): Deleted.
341         * wtf/spi/cocoa/SecuritySPI.h:
342         * wtf/spi/darwin/dyldSPI.h:
343         * wtf/text/icu/TextBreakIteratorICU.h:
344         (WTF::TextBreakIteratorICU::TextBreakIteratorICU):
345         (WTF::caretRules): Deleted.
346
347 2018-01-23  Filip Pizlo  <fpizlo@apple.com>
348
349         JSC should use a speculation fence on VM entry/exit
350         https://bugs.webkit.org/show_bug.cgi?id=181991
351
352         Reviewed by JF Bastien and Mark Lam.
353         
354         Implement speculationFence as lfence on x86 and isb on ARM64. I'm not sure if isb is
355         appropriate for all ARM64's.
356
357         * wtf/Atomics.h:
358         (WTF::speculationFence):
359         (WTF::x86_lfence):
360
361 2018-01-22  Alex Christensen  <achristensen@webkit.org>
362
363         Begin removing QTKit code
364         https://bugs.webkit.org/show_bug.cgi?id=181951
365
366         Reviewed by Jer Noble.
367
368         * wtf/Platform.h:
369
370 2018-01-21  Wenson Hsieh  <wenson_hsieh@apple.com>
371
372         Add a new feature flag for EXTRA_ZOOM_MODE and reintroduce AdditionalFeatureDefines.h
373         https://bugs.webkit.org/show_bug.cgi?id=181918
374
375         Reviewed by Tim Horton.
376
377         Include AdditionalFeatureDefines.h, if possible. This allows WebKitAdditions to override
378         the value of certain feature flags in the OpenSource WebKit repository.
379
380         * wtf/Platform.h:
381
382 2018-01-19  Alex Christensen  <achristensen@webkit.org>
383
384         Fix jsc-only build
385         https://bugs.webkit.org/show_bug.cgi?id=181874
386
387         Reviewed by JF Bastien.
388
389         This makes "build-webkit --jsc-only" work on Mac!
390
391         * wtf/PlatformJSCOnly.cmake:
392
393 2018-01-19  Keith Miller  <keith_miller@apple.com>
394
395         HaveInternalSDK includes should be "#include?"
396         https://bugs.webkit.org/show_bug.cgi?id=179670
397
398         Reviewed by Dan Bernstein.
399
400         * Configurations/Base.xcconfig:
401
402 2018-01-19  Alexey Proskuryakov  <ap@apple.com>
403
404         Update XPCSPI.h
405         https://bugs.webkit.org/show_bug.cgi?id=181827
406         rdar://problem/36393031
407
408         Reviewed by Daniel Bates.
409
410         * wtf/spi/darwin/XPCSPI.h:
411
412 2018-01-18  Chris Dumez  <cdumez@apple.com>
413
414         We should be able to terminate service workers that are unresponsive
415         https://bugs.webkit.org/show_bug.cgi?id=181563
416         <rdar://problem/35280031>
417
418         Reviewed by Alex Christensen.
419
420         * wtf/ObjectIdentifier.h:
421         (WTF::ObjectIdentifier::loggingString const):
422         Allow using loggingString() from RELEASE_LOG().
423
424 2018-01-18  Dan Bernstein  <mitz@apple.com>
425
426         [Xcode] Streamline and future-proof target-macOS-version-dependent build setting definitions
427         https://bugs.webkit.org/show_bug.cgi?id=181803
428
429         Reviewed by Tim Horton.
430
431         * Configurations/Base.xcconfig: Updated.
432         * Configurations/DebugRelease.xcconfig: Updated.
433
434 2018-01-17  Daniel Bates  <dabates@apple.com>
435
436         REGRESSION (r222795): Cardiogram never signs in
437         https://bugs.webkit.org/show_bug.cgi?id=181693
438         <rdar://problem/36286293>
439
440         Reviewed by Ryosuke Niwa.
441
442         Add macro define for future iOS.
443
444         * wtf/spi/darwin/dyldSPI.h:
445
446 2018-01-17  Per Arne Vollan  <pvollan@apple.com>
447
448         [Win] Compile error: 'wtf/text/icu/TextBreakIteratorICU.h' not found.
449         https://bugs.webkit.org/show_bug.cgi?id=181744
450         <rdar://problem/36582562>
451
452         Reviewed by Alex Christensen.
453
454         Add WTF folders to forwarding headers directories.
455
456         * wtf/PlatformWin.cmake:
457
458 2018-01-16  Per Arne Vollan  <pvollan@apple.com>
459
460         [Win] JSC compile error in runtime/DateConversion.cpp.
461         https://bugs.webkit.org/show_bug.cgi?id=181690
462         <rdar://problem/36480409>
463  
464         Reviewed by Brent Fulgham.
465
466         Add 'text/win' folder to list of forwarding headers directories.
467  
468         * wtf/PlatformWin.cmake:
469
470 2018-01-15  Michael Catanzaro  <mcatanzaro@igalia.com>
471
472         Improve use of ExportMacros
473         https://bugs.webkit.org/show_bug.cgi?id=181652
474
475         Reviewed by Konstantin Tokarev.
476
477         * wtf/ExportMacros.h: Simplify the #defines in this file.
478         * wtf/Platform.h: Remove unneeded define. Remove comment that expects all ports to
479           eventually enable the export macros. WPE will never want these. We don't currently want
480           them for GTK either, though how we link GTK has been in flux recently.
481
482 2018-01-15  JF Bastien  <jfbastien@apple.com>
483
484         Remove makePoisonedUnique
485         https://bugs.webkit.org/show_bug.cgi?id=181630
486         <rdar://problem/36498623>
487
488         Reviewed by Mark Lam.
489
490         I added a conversion from std::unique_ptr, so we can just use
491         std::make_unique and it'll auto-poison when converted.
492
493         * wtf/PoisonedUniquePtr.h:
494         (WTF::makePoisonedUnique): Deleted.
495
496 2018-01-13  Mark Lam  <mark.lam@apple.com>
497
498         Replace all use of ConstExprPoisoned with Poisoned.
499         https://bugs.webkit.org/show_bug.cgi?id=181542
500         <rdar://problem/36442138>
501
502         Reviewed by JF Bastien.
503
504         1. Removed ConstExprPoisoned and its artifacts.
505
506         2. Consolidated Poisoned into PoisonedImpl.  PoisonedImpl is not more.
507
508         3. Changed all clients of ConstExprPoisoned to use Poisoned instead.
509
510         4. Worked around the GCC and Clang compiler bug that confuses an intptr_t&
511            template arg with intptr_t.
512            See use of std::enable_if_t<Other::isPoisoned> in Poisoned.h.
513
514         5. Removed ENABLE(MIXED_POISON) since we now have a workaround (3) that makes it
515            possible to use the mixed poison code.
516
517         6. Also fixed broken implementation of comparison operators in Poisoned.
518
519         * wtf/Bag.h:
520         * wtf/DumbPtrTraits.h:
521         (WTF::DumbPtrTraits::poison):
522         * wtf/DumbValueTraits.h:
523         (WTF::DumbValueTraits::poison):
524         * wtf/Poisoned.h:
525         (WTF::Poisoned::Poisoned):
526         (WTF::Poisoned::operator== const):
527         (WTF::Poisoned::operator!= const):
528         (WTF::Poisoned::operator< const):
529         (WTF::Poisoned::operator<= const):
530         (WTF::Poisoned::operator> const):
531         (WTF::Poisoned::operator>= const):
532         (WTF::Poisoned::operator=):
533         (WTF::Poisoned::swap):
534         (WTF::swap):
535         (WTF::PoisonedPtrTraits::poison):
536         (WTF::PoisonedPtrTraits::swap):
537         (WTF::PoisonedValueTraits::poison):
538         (WTF::PoisonedValueTraits::swap):
539         (WTF::PoisonedImpl::PoisonedImpl): Deleted.
540         (WTF::PoisonedImpl::assertIsPoisoned const): Deleted.
541         (WTF::PoisonedImpl::assertIsNotPoisoned const): Deleted.
542         (WTF::PoisonedImpl::unpoisoned const): Deleted.
543         (WTF::PoisonedImpl::clear): Deleted.
544         (WTF::PoisonedImpl::operator* const): Deleted.
545         (WTF::PoisonedImpl::operator-> const): Deleted.
546         (WTF::PoisonedImpl::bits const): Deleted.
547         (WTF::PoisonedImpl::operator! const): Deleted.
548         (WTF::PoisonedImpl::operator bool const): Deleted.
549         (WTF::PoisonedImpl::operator== const): Deleted.
550         (WTF::PoisonedImpl::operator!= const): Deleted.
551         (WTF::PoisonedImpl::operator< const): Deleted.
552         (WTF::PoisonedImpl::operator<= const): Deleted.
553         (WTF::PoisonedImpl::operator> const): Deleted.
554         (WTF::PoisonedImpl::operator>= const): Deleted.
555         (WTF::PoisonedImpl::operator=): Deleted.
556         (WTF::PoisonedImpl::swap): Deleted.
557         (WTF::PoisonedImpl::exchange): Deleted.
558         (WTF::PoisonedImpl::poison): Deleted.
559         (WTF::PoisonedImpl::unpoison): Deleted.
560         (WTF::constExprPoisonRandom): Deleted.
561         (WTF::makeConstExprPoison): Deleted.
562         (WTF::ConstExprPoisonedPtrTraits::exchange): Deleted.
563         (WTF::ConstExprPoisonedPtrTraits::swap): Deleted.
564         (WTF::ConstExprPoisonedPtrTraits::unwrap): Deleted.
565         (WTF::ConstExprPoisonedValueTraits::exchange): Deleted.
566         (WTF::ConstExprPoisonedValueTraits::swap): Deleted.
567         (WTF::ConstExprPoisonedValueTraits::unwrap): Deleted.
568         * wtf/PoisonedUniquePtr.h:
569         (WTF::PoisonedUniquePtr::PoisonedUniquePtr):
570         (WTF::PoisonedUniquePtr::operator=):
571         * wtf/Ref.h:
572         * wtf/RefCountedArray.h:
573         (WTF::RefCountedArray::RefCountedArray):
574         * wtf/RefPtr.h:
575         * wtf/WTFAssertions.cpp:
576
577 2018-01-12  JF Bastien  <jfbastien@apple.com>
578
579         PoisonedWriteBarrier
580         https://bugs.webkit.org/show_bug.cgi?id=181599
581         <rdar://problem/36474351>
582
583         Reviewed by Mark Lam.
584
585         Supporting changes needed to allow poisoning of WriteBarrier
586         objects.
587
588         * WTF.xcodeproj/project.pbxproj:
589         * wtf/DumbPtrTraits.h:
590         * wtf/DumbValueTraits.h: Copied from Source/WTF/wtf/DumbPtrTraits.h.
591         (WTF::DumbValueTraits::exchange):
592         (WTF::DumbValueTraits::swap):
593         (WTF::DumbValueTraits::unwrap):
594         * wtf/Forward.h:
595         * wtf/Poisoned.h:
596         (WTF::ConstExprPoisonedValueTraits::exchange):
597         (WTF::ConstExprPoisonedValueTraits::swap):
598         (WTF::ConstExprPoisonedValueTraits::unwrap):
599
600 2018-01-11  Basuke Suzuki  <Basuke.Suzuki@sony.com>
601
602         Remove noexcept from definition of std::tie()
603         https://bugs.webkit.org/show_bug.cgi?id=181577
604
605         Reviewed by Yusuke Suzuki.
606
607         * wtf/StdLibExtras.h:
608         (WTF::tie):
609
610 2018-01-11  Filip Pizlo  <fpizlo@apple.com>
611
612         Reserve a fast TLS key for GC TLC
613         https://bugs.webkit.org/show_bug.cgi?id=181539
614
615         Reviewed by Alexey Proskuryakov.
616         
617         Who knew that thread-local caches would be a mitigation for timing attacks. Here's how it
618         works: if we have TLCs then we can "context switch" them when we "context switch" origins. 
619         This allows us to put some minimal distance between objects from different origins, which
620         gives us the ability to allow small overflows when doing certain bounds checks without
621         creating a useful Spectre information leak.
622         
623         So I think that means we have to implement thread-local caches (also known as thread-local
624         allocation buffers, but I prefer the TLC terminology).
625
626         * wtf/FastTLS.h:
627
628 2018-01-04  Filip Pizlo  <fpizlo@apple.com>
629
630         CodeBlocks should be in IsoSubspaces
631         https://bugs.webkit.org/show_bug.cgi?id=180884
632
633         Reviewed by Saam Barati.
634         
635         Deque<>::contains() is helpful for a debug ASSERT.
636
637         * wtf/Deque.h:
638         (WTF::inlineCapacity>::contains):
639
640 2018-01-11  JF Bastien  <jfbastien@apple.com>
641
642         NFC reorder headers
643         https://bugs.webkit.org/show_bug.cgi?id=181521
644
645         Reviewed by Darin Adler.
646
647         Follow-up on r226752. I misunderstood the header include order
648         style. No functional change.
649
650         * wtf/Poisoned.h:
651         * wtf/PoisonedUniquePtr.h:
652
653 2018-01-10  JF Bastien  <jfbastien@apple.com>
654
655         Poison small JSObject derivatives which only contain pointers
656         https://bugs.webkit.org/show_bug.cgi?id=181483
657         <rdar://problem/36407127>
658
659         Reviewed by Mark Lam.
660
661         The associated JSC poisoning change requires some template
662         "improvements" to our poisoning machinery. Worth noting is that
663         I'm making PoisonedUniquePtr move-assignable and
664         move-constructible from unique_ptr, which makes it a better
665         drop-in replacement because we don't need to use
666         makePoisonedUniquePtr. This means function-locals can be
667         unique_ptr and get the nice RAII pattern, and once the function is
668         done you can just move to the class' PoisonedUniquePtr without
669         worrying.
670
671         * wtf/Poisoned.h:
672         (WTF::PoisonedImpl::PoisonedImpl):
673         * wtf/PoisonedUniquePtr.h:
674         (WTF::PoisonedUniquePtr::PoisonedUniquePtr):
675         (WTF::PoisonedUniquePtr::operator=):
676
677 2018-01-10  Don Olmstead  <don.olmstead@sony.com>
678
679         Add nullptr_t specialization of poison
680         https://bugs.webkit.org/show_bug.cgi?id=181469
681
682         Reviewed by JF Bastien.
683
684         * wtf/Poisoned.h:
685         (WTF::PoisonedImpl::poison):
686
687 2018-01-10  Commit Queue  <commit-queue@webkit.org>
688
689         Unreviewed, rolling out r226667 and r226673.
690         https://bugs.webkit.org/show_bug.cgi?id=181488
691
692         This caused a flaky crash. (Requested by mlewis13 on #webkit).
693
694         Reverted changesets:
695
696         "CodeBlocks should be in IsoSubspaces"
697         https://bugs.webkit.org/show_bug.cgi?id=180884
698         https://trac.webkit.org/changeset/226667
699
700         "REGRESSION (r226667): CodeBlocks should be in IsoSubspaces"
701         https://bugs.webkit.org/show_bug.cgi?id=180884
702         https://trac.webkit.org/changeset/226673
703
704 2018-01-04  Filip Pizlo  <fpizlo@apple.com>
705
706         CodeBlocks should be in IsoSubspaces
707         https://bugs.webkit.org/show_bug.cgi?id=180884
708
709         Reviewed by Saam Barati.
710         
711         Deque<>::contains() is helpful for a debug ASSERT.
712
713         * wtf/Deque.h:
714         (WTF::inlineCapacity>::contains):
715
716 2018-01-08  Don Olmstead  <don.olmstead@sony.com>
717
718         Add WTF_EXPORTs to UniStdExtras
719         https://bugs.webkit.org/show_bug.cgi?id=181415
720
721         Reviewed by Alex Christensen.
722
723         * wtf/UniStdExtras.h:
724
725 2018-01-07  Mark Lam  <mark.lam@apple.com>
726
727         Apply poisoning to more pointers in JSC.
728         https://bugs.webkit.org/show_bug.cgi?id=181096
729         <rdar://problem/36182970>
730
731         Reviewed by JF Bastien.
732
733         Added support for PoisonedBag and PoisonedRefCountedArray.
734
735         * wtf/Bag.h:
736         (WTF::Private::BagNode::BagNode):
737         (WTF::Bag::Bag):
738         (WTF::Bag::operator=):
739         (WTF::Bag::clear):
740         (WTF::Bag::add):
741         (WTF::Bag::begin):
742         (WTF::Bag::unwrappedHead):
743         (WTF::Bag::Node::Node): Deleted.
744         * wtf/BagToHashMap.h:
745         (WTF::toHashMap):
746         * wtf/Poisoned.h:
747         (WTF::constExprPoisonRandom):
748         (WTF::makeConstExprPoison):
749         * wtf/RefCountedArray.h:
750         (WTF::RefCountedArray::RefCountedArray):
751         (WTF::RefCountedArray::clone const):
752         (WTF::RefCountedArray::operator=):
753         (WTF::RefCountedArray::~RefCountedArray):
754         (WTF::RefCountedArray::refCount const):
755         (WTF::RefCountedArray::size const):
756         (WTF::RefCountedArray::data):
757         (WTF::RefCountedArray::begin):
758         (WTF::RefCountedArray::end):
759         (WTF::RefCountedArray::data const):
760         (WTF::RefCountedArray::begin const):
761         (WTF::RefCountedArray::operator== const):
762         (WTF::RefCountedArray::Header::fromPayload):
763         * wtf/WTFAssertions.cpp:
764
765 2018-01-05  JF Bastien  <jfbastien@apple.com>
766
767         WebAssembly: poison JS object's secrets
768         https://bugs.webkit.org/show_bug.cgi?id=181339
769         <rdar://problem/36325001>
770
771         Reviewed by Mark Lam.
772
773         swapping a poisoned pointer with a non-poisoned one (as is done in
774         JSWebAssembyMemory::adopt) was missing.
775
776         * wtf/Poisoned.h:
777         (WTF::PoisonedImpl::swap):
778         (WTF::ConstExprPoisonedPtrTraits::swap):
779
780 2018-01-05  David Kilzer  <ddkilzer@apple.com>
781
782         Re-enable -Wcast-qual in WebCore for Apple ports
783         <https://webkit.org/b/177895>
784         <rdar://problem/34960830>
785
786         Reviewed by Joseph Pecoraro.
787
788         * wtf/RetainPtr.h:
789         (WTF::RetainPtr::fromStorageTypeHelper const): Add const_cast<>
790         operator here since some CFTypes are not defined as const
791         pointers, which triggers a warning in C++ source with
792         -Wcast-qual when casting from CFTypeRef back to the original
793         type.  Note that we use const_cast<CF_BRIDGED_TYPE(id) void*>()
794         here (and in TypeCastsCF.h below) since this is what CFTypeRef
795         is defined as in CFBase.h, but without the 'const' modifier.
796         (WTF::RetainPtr::fromStorageType const): Ditto.
797
798         * wtf/cf/TypeCastsCF.h: Use #pragma once.
799         (WTF_DECLARE_CF_TYPE_TRAIT): Rename from DECLARE_CF_TYPE_TRAIT.
800         Don't #undef it so that it can be used in other source files.
801         (WTF_DECLARE_CF_MUTABLE_TYPE_TRAIT): Add new macro that is used
802         for declaring CFMutable types.  The CFTypeID for CF_Foo_ and
803         CFMutable_Foo_ are the same, so we have to use a different macro
804         to declare type traits for those types.
805         (WTF::dynamic_cf_cast): Add assertion to catch issues in Debug
806         builds.
807         (WTF::checked_cf_cast): Inline code from WTF::dynamic_cf_cast
808         and change behavior to be more consistent between Debug and
809         Release builds, as well as other "checked" functions.
810         Previously this function would return nullptr in Release builds
811         if nullptr or the wrong type of object was passed in, but crash
812         in both cases on Debug builds.  The new behavior always returns
813         nullptr if nullptr was passed in (but never crashes), and always
814         crashes if the wrong type of object is passed in.
815
816 2018-01-04  Keith Miller  <keith_miller@apple.com>
817
818         TypedArrays and Wasm should use index masking.
819         https://bugs.webkit.org/show_bug.cgi?id=181313
820
821         Reviewed by Michael Saboff.
822
823         * wtf/MathExtras.h:
824         (WTF::computeIndexingMask):
825
826 2018-01-03  Michael Saboff  <msaboff@apple.com>
827
828         Disable SharedArrayBuffers from Web API
829         https://bugs.webkit.org/show_bug.cgi?id=181266
830
831         Reviewed by Saam Barati.
832
833         Turn off SharedArrayBuffers using a compile time flag ENABLE_SHARED_ARRAY_BUFFER.
834
835         * wtf/Platform.h:
836
837 2017-12-28  Yusuke Suzuki  <utatane.tea@gmail.com>
838
839         Remove std::chrono completely
840         https://bugs.webkit.org/show_bug.cgi?id=181186
841
842         Reviewed by Alex Christensen.
843
844         std::chrono's overflow unaware design is dangerous[1]. Even small code like
845         `condition.wait_for(std::chrono::seconds::max())` is broken in some platforms
846         due to overflow of std::chrono::time_point. So we intentionally avoid using
847         std::chrono, and use WallTime, MonotonicTime, Seconds instead.
848
849         This patch removes all the remaining use of std::chrono from WebKit tree.
850
851         [1]: https://lists.webkit.org/pipermail/webkit-dev/2016-May/028242.html
852
853         * wtf/CrossThreadCopier.h:
854         Remove std::chrono support from cross thread copiers.
855         * wtf/Forward.h:
856         * wtf/MonotonicTime.h:
857         (WTF::MonotonicTime::isolatedCopy const):
858         Add isolatedCopy function.
859         * wtf/RunLoop.h:
860         (WTF::RunLoop::TimerBase::startRepeating):
861         (WTF::RunLoop::TimerBase::startOneShot):
862         Just remove these helpers.
863         * wtf/Seconds.h:
864         (WTF::Seconds::isolatedCopy const):
865         Add isolatedCopy function.
866         * wtf/WallTime.h:
867         (WTF::WallTime::isolatedCopy const):
868         Add isolatedCopy function.
869         * wtf/persistence/PersistentCoders.h:
870         (WTF::Persistence::Coder<Seconds>::encode):
871         (WTF::Persistence::Coder<Seconds>::decode):
872         (WTF::Persistence::Coder<WallTime>::encode):
873         (WTF::Persistence::Coder<WallTime>::decode):
874         Add persistent coder support for Seconds and WallTime.
875         (WTF::Persistence::Coder<std::chrono::system_clock::time_point>::encode): Deleted.
876         (WTF::Persistence::Coder<std::chrono::system_clock::time_point>::decode): Deleted.
877         Remove std::chrono support from persistent coders.
878
879 2018-01-02  Mark Lam  <mark.lam@apple.com>
880
881         Refactoring: Rename DummyClass to DummyStruct because it's a struct.
882         https://bugs.webkit.org/show_bug.cgi?id=181230
883
884         Reviewed by JF Bastien.
885
886         * wtf/WTFAssertions.cpp:
887
888 2018-01-02  Mark Lam  <mark.lam@apple.com>
889
890         Ensure that poisoned pointers do not look like double or int32 JSValues.
891         https://bugs.webkit.org/show_bug.cgi?id=181221
892         <rdar://problem/36248638>
893
894         Reviewed by JF Bastien.
895
896         Changed poison values to ensure that poisoned bits (i.e. pointer ^ poison)
897         satisfies the following conditions:
898         1. bits 48-63 are 0: this ensures that poisoned bits look like a pointer and
899            not a double or int32 JSValue.
900         2. bits 32-47 are not completely 0.
901         3. bit 2 is never 0: this ensures that the poisoned value of a non-null pointer
902            will never be null.
903         4. bit 0-1 is always 0: this ensures that clients can still use the 2 bottom
904            bits of the poisoned value as flag bits (just like they were able to do with
905            pointer values).  The only difference is that bit 2 can no longer be used for
906            flag bits because poisoned values need it to always be set.
907
908         * WTF.xcodeproj/project.pbxproj:
909         * wtf/CMakeLists.txt:
910         * wtf/PointerAsserts.cpp: Removed.
911
912         * wtf/Poisoned.cpp:
913         (WTF::makePoison):
914         - Updated to satisfy the above requirements.
915         
916         * wtf/Poisoned.h:
917         (WTF::makeConstExprPoison):
918         (WTF::makePoison): Deleted.
919
920         * wtf/WTFAssertions.cpp: Copied from Source/WTF/wtf/PointerAsserts.cpp.
921         - Renamed from PointerAsserts.cpp because we assert more things than just
922           pointers here.
923         - Added some assertions to test makeConstExprPoison() to ensure that it satisfies
924           the above requirements.
925
926 2017-12-28  Yusuke Suzuki  <utatane.tea@gmail.com>
927
928         Remove std::chrono if it is not used for ArgumentCoder or PersistentCoder
929         https://bugs.webkit.org/show_bug.cgi?id=181174
930
931         Reviewed by Konstantin Tokarev.
932
933         Make WallTime more constexpr friendly. This change is already applied to MonoTonicTime.
934
935         We would like to move std::{isfinite,isinf,isnan} overloadings from std:: to each class scope in a separate patch[1].
936
937         [1]: https://bugs.webkit.org/show_bug.cgi?id=181183
938
939         * wtf/WallTime.h:
940         (WTF::WallTime::WallTime):
941         (WTF::WallTime::fromRawSeconds):
942         (WTF::WallTime::infinity):
943         (WTF::WallTime::secondsSinceEpoch const):
944         (WTF::WallTime::operator bool const):
945         (WTF::WallTime::operator+ const):
946         (WTF::WallTime::operator- const):
947         (WTF::WallTime::operator== const):
948         (WTF::WallTime::operator!= const):
949         (WTF::WallTime::operator< const):
950         (WTF::WallTime::operator> const):
951         (WTF::WallTime::operator<= const):
952         (WTF::WallTime::operator>= const):
953
954 2017-12-28  Fujii Hironori  <Hironori.Fujii@sony.com>
955
956         [Win][CMake] Use add_custom_command to copy each forwarding header files
957         https://bugs.webkit.org/show_bug.cgi?id=180921
958
959         Reviewed by Brent Fulgham.
960
961         * wtf/PlatformWin.cmake: Use WEBKIT_MAKE_FORWARDING_HEADERS.
962
963 2017-12-27  Yusuke Suzuki  <utatane.tea@gmail.com>
964
965         [WTF] Add clock_gettime based monotonicallyIncreasingTime implementation for Linux and BSDs
966         https://bugs.webkit.org/show_bug.cgi?id=181175
967
968         Reviewed by Michael Catanzaro.
969
970         Use platform-provided POSIX APIs to get monotonic time.
971
972         * wtf/CurrentTime.cpp:
973         (WTF::monotonicallyIncreasingTime):
974
975 2017-12-26  Carlos Alberto Lopez Perez  <clopez@igalia.com>
976
977         REGRESSION(r225769): Build error with constexpr std::max // std::min in libdstdc++4
978         https://bugs.webkit.org/show_bug.cgi?id=181160
979
980         Reviewed by Myles C. Maxfield.
981
982         In libstdc++-4 std::max and std::min are not annotated with constexpr.
983         This patch adds a WTF::min and WTF::max for using where a constexpr result is expected.
984         Related: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60271
985
986         * wtf/StdLibExtras.h:
987         (WTF::min):
988         (WTF::max):
989
990 2017-12-26  Yusuke Suzuki  <utatane.tea@gmail.com>
991
992         [JSC] Remove std::chrono completely
993         https://bugs.webkit.org/show_bug.cgi?id=181165
994
995         Reviewed by Konstantin Tokarev.
996
997         WTF::currentCPUTime now returns WTF::Seconds.
998         We also add the implementaiton for Linux and FreeBSD.
999
1000         * wtf/CurrentTime.cpp:
1001         (WTF::currentCPUTime):
1002         * wtf/CurrentTime.h:
1003
1004 2017-12-22  Wenson Hsieh  <wenson_hsieh@apple.com>
1005
1006         Unreviewed, try to fix the Sierra build after r226277.
1007
1008         The macOS 10.12 SDK does not know about NSControlStateValue and some types of NSLevelIndicatorStyles, so these
1009         need to be declared in a separate section in AppKitCompatibilityDeclarations.h (rather than in the < macOS 10.12
1010         SDK #ifdef).
1011
1012         * wtf/mac/AppKitCompatibilityDeclarations.h:
1013
1014 2017-12-22  Wenson Hsieh  <wenson_hsieh@apple.com>
1015
1016         Fix build failures due to using deprecated AppKit symbols
1017         https://bugs.webkit.org/show_bug.cgi?id=181110
1018         <rdar://problem/36162865>
1019
1020         Reviewed by Dan Bernstein and Tim Horton.
1021
1022         When building with older macOS SDKs where some AppKit constants don't exist, define the modern constants to be
1023         equal to their deprecated counterparts. This allows us to just have the modern types in WebKit sources while
1024         avoiding breakage on old SDKs.
1025
1026         This, along with many other symbols in the compability header, can be removed once WebKit stops supporting macOS
1027         10.11.
1028
1029         * wtf/mac/AppKitCompatibilityDeclarations.h:
1030
1031 2017-12-21  Mark Lam  <mark.lam@apple.com>
1032
1033         Add WTF::PoisonedUniquePtr to replace std::unique_ptr when poisoning is desired.
1034         https://bugs.webkit.org/show_bug.cgi?id=181062
1035         <rdar://problem/36167040>
1036
1037         Reviewed by Chris Dumez.
1038
1039         * WTF.xcodeproj/project.pbxproj:
1040         * wtf/CMakeLists.txt:
1041         * wtf/PointerAsserts.cpp: Copied from Source/WTF/wtf/RefPtr.cpp.
1042         - renamed file because we asserts all kinds of pointers in here, not just RefPtr.
1043         
1044         * wtf/Poisoned.h:
1045         - added a missing #include.
1046         - make constexpr poison values more scrambled.
1047         (WTF::makePoison):
1048
1049         * wtf/PoisonedUniquePtr.h: Added.
1050         (WTF::PoisonedUniquePtr::PoisonedUniquePtr):
1051         (WTF::PoisonedUniquePtr::~PoisonedUniquePtr):
1052         (WTF::PoisonedUniquePtr::create):
1053         (WTF::PoisonedUniquePtr::operator=):
1054         (WTF::PoisonedUniquePtr::get const):
1055         (WTF::PoisonedUniquePtr::operator[] const):
1056         (WTF::PoisonedUniquePtr::clear):
1057         (WTF::PoisonedUniquePtr::destroy):
1058         (WTF::PoisonedUniquePtr::clearWithoutDestroy):
1059         (WTF::makePoisonedUnique):
1060         * wtf/RefPtr.cpp: Removed.
1061
1062 2017-12-21  Jeremy Jones  <jeremyj@apple.com>
1063
1064         Element fullscreen interface should display the location
1065         https://bugs.webkit.org/show_bug.cgi?id=181006
1066         rdar://problem/36143176
1067
1068         Reviewed by Simon Fraser.
1069
1070         Add SecTrustCopyInfo SPI.
1071
1072         * wtf/spi/cocoa/SecuritySPI.h:
1073
1074 2017-12-20  Fujii Hironori  <Hironori.Fujii@sony.com>
1075
1076         [CMake][WTF] Lowercase ForwardingHeaders directory name of WTF
1077         https://bugs.webkit.org/show_bug.cgi?id=181022
1078
1079         Reviewed by Konstantin Tokarev.
1080
1081         * wtf/CMakeLists.txt: Renamed ForwardingHeaders directory name WTF to wtf.
1082         * wtf/PlatformWin.cmake: Ditto.
1083
1084 2017-12-19  Brian Burg  <bburg@apple.com>
1085
1086         SLEEP_THREAD_FOR_DEBUGGER() macro should try to print out the PID of the affected process
1087         https://bugs.webkit.org/show_bug.cgi?id=180947
1088
1089         Reviewed by Joseph Pecoraro.
1090
1091         * wtf/DebugUtilities.h:
1092         - Use sleep() from CurrentTime.h as it is more cross-platform.
1093         - Print a message with the process PID to simplify attaching to sleeping thread.
1094         - Include source location in case multiple such macros are being used.
1095
1096 2017-12-18  Daniel Bates  <dabates@apple.com>
1097
1098         Conditionally forward declare NSMapTable SPI
1099         https://bugs.webkit.org/show_bug.cgi?id=180936
1100         <rdar://problem/35037796>
1101
1102         Reviewed by Dan Bernstein.
1103
1104         * wtf/spi/cocoa/NSMapTableSPI.h:
1105
1106 2017-12-16  Filip Pizlo  <fpizlo@apple.com>
1107
1108         Vector index masking
1109         https://bugs.webkit.org/show_bug.cgi?id=180909
1110
1111         Reviewed by Keith Miller.
1112         
1113         Adds index masking to StringImpl and Vector.
1114         
1115         Perf:
1116         
1117         - 0.4% slower on microbenchmarks.
1118         - Octane totally even.
1119         - Kraken may be 0.8% slower.
1120         - Speedometer is 0.8% slower with p = 0.008.
1121         - membuster is even:
1122             - snap2pre: 0.7% bigger w/ p = 0.26,
1123             - snap2post: 0.3% smaller w/ p = 0.81,
1124             - snap3pre: 1.2% bigger w/ p = 0.63,
1125             - snap3post: 0.4% smaller w/ p = 0.76.
1126
1127         * wtf/MathExtras.h:
1128         (WTF::roundUpToPowerOfTwo):
1129         (WTF::maskForSize):
1130         * wtf/SizeLimits.cpp:
1131         * wtf/Vector.h:
1132         (WTF::VectorBufferBase::allocateBuffer):
1133         (WTF::VectorBufferBase::tryAllocateBuffer):
1134         (WTF::VectorBufferBase::reallocateBuffer):
1135         (WTF::VectorBufferBase::deallocateBuffer):
1136         (WTF::VectorBufferBase::releaseBuffer):
1137         (WTF::VectorBufferBase::VectorBufferBase):
1138         (WTF::VectorBufferBase::updateMask):
1139         (WTF::VectorBuffer::allocateBuffer):
1140         (WTF::VectorBuffer::tryAllocateBuffer):
1141         (WTF::VectorBuffer::swap):
1142         (WTF::VectorBuffer::restoreInlineBufferIfNeeded):
1143         (WTF::Vector::at):
1144         (WTF::Vector::at const):
1145         * wtf/text/StringImpl.h:
1146         (WTF::StringImpl::maskOffset):
1147         (WTF::StringImpl::mask const):
1148         (WTF::StringImplShape::StringImplShape):
1149         (WTF::StringImpl::at const):
1150         (WTF::StringImpl::tailOffset):
1151         * wtf/text/StringView.h:
1152         (WTF::StringView::StringView):
1153         (WTF::StringView::operator=):
1154         (WTF::StringView::initialize):
1155         (WTF::StringView::clear):
1156         (WTF::StringView::operator[] const):
1157         * wtf/text/WTFString.h:
1158         (WTF::String::mask const):
1159
1160 2017-12-18  Claudio Saavedra  <csaavedra@igalia.com>
1161
1162         [GTK][Darwin] Do not define mach exceptions for GTK+
1163
1164         Rubber-stamped by Michael Catanzaro.
1165         * wtf/Platform.h:
1166
1167 2017-12-17  Yusuke Suzuki  <utatane.tea@gmail.com>
1168
1169         [FTL] NewArrayBuffer should be sinked if it is only used for spreading
1170         https://bugs.webkit.org/show_bug.cgi?id=179762
1171
1172         Reviewed by Saam Barati.
1173
1174         We add RecursableLambda<>. This can take a lambda and offer a way
1175         to call this lambda recursively without introducing additional allocations.
1176
1177         C++ lambda is super useful in particular when we need to capture many
1178         variables as references. Passing many arguments to a usual function is not
1179         a good way. But C++ lambda does not allow us to easily call itself recursively.
1180
1181         Our recursableLambda offers `self` function as a first argument of the
1182         given lambda. We can call this `self` recursively.
1183
1184         auto targetFunction = recursableLambda([] (auto self, ...) -> resultType {
1185             self(...);
1186         });
1187
1188         While `std::function<> func = [&func] { ... }` allows recursion, it causes
1189         heap allocation for std::function<>. `auto func = [&func] { ... }` causes
1190         a compile error since we need to deduce an actual type when capturing `func`.
1191
1192         * WTF.xcodeproj/project.pbxproj:
1193         * wtf/RecursableLambda.h: Added.
1194         (WTF::RecursableLambda::RecursableLambda):
1195         (WTF::RecursableLambda::operator() const):
1196         (WTF::recursableLambda):
1197
1198 2017-12-17  Mark Lam  <mark.lam@apple.com>
1199
1200         Enhance Ref and RefPtr to be able to work with smart pointers.
1201         https://bugs.webkit.org/show_bug.cgi?id=180762
1202         <rdar://problem/36027122>
1203
1204         Reviewed by JF Bastien and Darin Adler.
1205
1206         This is so we can use them with ConstExprPoisoned pointers to make PoisonedRef
1207         and PoisonedRefPtr.
1208
1209         * WTF.xcodeproj/project.pbxproj:
1210         * wtf/CMakeLists.txt:
1211         * wtf/DumbPtrTraits.h: Added.
1212         (WTF::DumbPtrTraits::exchange):
1213         (WTF::DumbPtrTraits::swap):
1214         (WTF::DumbPtrTraits::unwrap):
1215         * wtf/Forward.h:
1216         * wtf/Poisoned.h:
1217         (WTF::ConstExprPoisonedPtrTraits::exchange):
1218         (WTF::ConstExprPoisonedPtrTraits::swap):
1219         (WTF::ConstExprPoisonedPtrTraits::unwrap):
1220         * wtf/Ref.h:
1221         (WTF::Ref::~Ref):
1222         (WTF::Ref::Ref):
1223         (WTF::Ref::ptrAllowingHashTableEmptyValue const):
1224         (WTF::Ref::ptrAllowingHashTableEmptyValue):
1225         (WTF::Ref::operator-> const):
1226         (WTF::Ref::get const):
1227         (WTF::Ref::operator T& const):
1228         (WTF::=):
1229         (WTF::U>::swap):
1230         (WTF::swap):
1231         (WTF::U>::replace):
1232         (WTF::static_reference_cast):
1233         (WTF::adoptRef):
1234         (WTF::is):
1235         (WTF::Ref<T>::swap): Deleted.
1236         (WTF::Ref<T>::replace): Deleted.
1237         (WTF::GetPtrHelper<Ref<T>>::getPtr): Deleted.
1238         * wtf/RefPtr.cpp: Added.
1239         * wtf/RefPtr.h:
1240         (WTF::RefPtr::RefPtr):
1241         (WTF::RefPtr::~RefPtr):
1242         (WTF::RefPtr::get const):
1243         (WTF::RefPtr::operator* const):
1244         (WTF::RefPtr::operator-> const):
1245         (WTF::U>::RefPtr):
1246         (WTF::U>::leakRef):
1247         (WTF::=):
1248         (WTF::U>::swap):
1249         (WTF::swap):
1250         (WTF::operator==):
1251         (WTF::operator!=):
1252         (WTF::static_pointer_cast):
1253         (WTF::adoptRef):
1254         (WTF::is):
1255         (WTF::RefPtr<T>::RefPtr): Deleted.
1256         (WTF::RefPtr<T>::leakRef): Deleted.
1257         (WTF::RefPtr<T>::swap): Deleted.
1258
1259 2017-12-16  Yusuke Suzuki  <utatane.tea@gmail.com>
1260
1261         Remove unnecessary boolean result of start() functions
1262         https://bugs.webkit.org/show_bug.cgi?id=180856
1263
1264         Reviewed by Darin Adler.
1265
1266         CrossThreadTaskHandler's Thread is just released without calling
1267         either `waitForCompletion` or `detach`. It means that this resource
1268         of the thread is not released.
1269
1270         * benchmarks/ConditionSpeedTest.cpp:
1271         * wtf/CrossThreadTaskHandler.cpp:
1272         (WTF::CrossThreadTaskHandler::CrossThreadTaskHandler):
1273         * wtf/CrossThreadTaskHandler.h:
1274
1275 2017-12-14  David Kilzer  <ddkilzer@apple.com>
1276
1277         Enable -Wstrict-prototypes for WebKit
1278         <https://webkit.org/b/180757>
1279         <rdar://problem/36024132>
1280
1281         Rubber-stamped by Joseph Pecoraro.
1282
1283         * Configurations/Base.xcconfig:
1284         (CLANG_WARN_STRICT_PROTOTYPES): Add. Set to YES.
1285         * wtf/Assertions.h:
1286         (WTFReportBacktrace): Add 'void' to C function declaration.
1287         (WTFCrashHookFunction): Add 'void' to C function pointer declaration.
1288         (WTFInstallReportBacktraceOnCrashHook): Add 'void' to C function declaration.
1289         (WTFIsDebuggerAttached): Ditto.
1290         (WTFCrash): Ditto.
1291         (WTFCrashWithSecurityImplication): Ditto.
1292
1293 2017-12-14  Yusuke Suzuki  <utatane.tea@gmail.com>
1294
1295         Drop Thread::tryCreate
1296         https://bugs.webkit.org/show_bug.cgi?id=180808
1297
1298         Reviewed by Darin Adler.
1299
1300         We remove Thread::tryCreate. When thread creation fails, we have no way to keep WebKit working.
1301         Compared to tryMalloc, Thread::create always consumes fixed size of resource. If it fails,
1302         this is not due to arbitrary large user request. It is not reasonable that some thread creations
1303         are handled gracefully while the other thread creations are not.
1304
1305         If we would like to have the limit of number of users' thread creation (like, calling `new Worker`
1306         so many times), we should have a soft limit instead of relying on system's hard limit.
1307
1308         * wtf/ParallelJobsGeneric.cpp:
1309         (WTF::ParallelEnvironment::ThreadPrivate::tryLockFor):
1310         * wtf/Threading.cpp:
1311         (WTF::Thread::create):
1312         (WTF::Thread::tryCreate): Deleted.
1313         * wtf/Threading.h:
1314         (WTF::Thread::create): Deleted.
1315
1316 2017-12-13  Keith Miller  <keith_miller@apple.com>
1317
1318         JSObjects should have a mask for loading indexed properties
1319         https://bugs.webkit.org/show_bug.cgi?id=180768
1320
1321         Reviewed by Mark Lam.
1322
1323         Add a clz that wraps the builtin clz intrinisics provided by
1324         various compilers. The clz function by default assumes that
1325         the input may be zero. On X86 this makes a difference because not
1326         all CPUs have LZCNT and BSR has undefined behavior on zero. On ARM,
1327         the zero check gets optimized away, regardless.
1328
1329         * wtf/StdLibExtras.h:
1330         (std::clz):
1331
1332 2017-12-12  Yusuke Suzuki  <utatane.tea@gmail.com>
1333
1334         REGRESSION(r225769): Build errors with constexpr std::tie on older gcc
1335         https://bugs.webkit.org/show_bug.cgi?id=180692
1336
1337         Reviewed by Carlos Garcia Campos.
1338
1339         Due to libstdc++'s bug[1], std::tie is not annotated with constexpr in libstdc++ 5.
1340         This patch adds WTF::tie for a work around. Since we do not want to
1341         include <tuple> in StdLibExtras.h, we define this function for all
1342         the compilers.
1343
1344         [1]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65978
1345
1346         * wtf/StdLibExtras.h:
1347
1348 2017-12-13  Mark Lam  <mark.lam@apple.com>
1349
1350         Fill out some Poisoned APIs, fix some bugs, and add some tests.
1351         https://bugs.webkit.org/show_bug.cgi?id=180724
1352         <rdar://problem/36006884>
1353
1354         Reviewed by JF Bastien.
1355
1356         Also rename Int32Poisoned to ConstExprPoisoned.  The key it takes is actually a
1357         uint32_t.  So, Int32 is really a misnomer.  In addition, the key needs to be a
1358         constexpr.  So, ConstExprPoisoned is a better name for it.
1359
1360         * wtf/Poisoned.cpp:
1361         (WTF::makePoison):
1362         * wtf/Poisoned.h:
1363         (WTF::PoisonedImplHelper::asReference):
1364         (WTF::PoisonedImpl::PoisonedImpl):
1365         (WTF::PoisonedImpl::clear):
1366         (WTF::PoisonedImpl::operator* const):
1367         (WTF::PoisonedImpl::operator-> const):
1368         (WTF::PoisonedImpl::operator== const):
1369         (WTF::PoisonedImpl::operator!= const):
1370         (WTF::PoisonedImpl::operator< const):
1371         (WTF::PoisonedImpl::operator<= const):
1372         (WTF::PoisonedImpl::operator> const):
1373         (WTF::PoisonedImpl::operator>= const):
1374         (WTF::PoisonedImpl::operator=):
1375         (WTF::PoisonedImpl::swap):
1376         (WTF::PoisonedImpl::exchange):
1377         (WTF::swap):
1378         (WTF::makePoison):
1379         (WTF::PoisonedImpl::operator==): Deleted.
1380
1381 2017-12-12  Yusuke Suzuki  <utatane.tea@gmail.com>
1382
1383         [JSC] Implement optimized WeakMap and WeakSet
1384         https://bugs.webkit.org/show_bug.cgi?id=179929
1385
1386         Reviewed by Saam Barati.
1387
1388         We introduce JSValueMalloc, which is specialized malloc scheme with Gigacage::JSValue.
1389         This is used for WeakMapImpl's buffer.
1390
1391         * WTF.xcodeproj/project.pbxproj:
1392         * wtf/CMakeLists.txt:
1393         * wtf/JSValueMalloc.cpp: Added.
1394         (WTF::tryJSValueMalloc):
1395         (WTF::jsValueMalloc):
1396         (WTF::jsValueRealloc):
1397         (WTF::jsValueFree):
1398         * wtf/JSValueMalloc.h: Added.
1399         (WTF::JSValueMalloc::malloc):
1400         (WTF::JSValueMalloc::tryMalloc):
1401         (WTF::JSValueMalloc::realloc):
1402         (WTF::JSValueMalloc::free):
1403         * wtf/MallocPtr.h:
1404         (WTF::MallocPtr::~MallocPtr):
1405         (WTF::MallocPtr::malloc):
1406         (WTF::MallocPtr::tryMalloc):
1407         (WTF::MallocPtr::realloc):
1408         We extend MallocPtr to adopt malloc scheme as its template parameter.
1409
1410 2017-12-11  Filip Pizlo  <fpizlo@apple.com>
1411
1412         It should be possible to flag a cell for unconditional finalization
1413         https://bugs.webkit.org/show_bug.cgi?id=180636
1414
1415         Reviewed by Saam Barati.
1416         
1417         This adds ConcurrentVector, which is like SegmentedVector, but wastes some space to allow
1418         resizing to proceed concurrently to access. It's not possible to resize concurrently to
1419         resizing, concurrent read/writes aren't protected from racing if they access the same element,
1420         and who knows what you'll get if you iterate up to size() while someone else append()s. The
1421         key insight is to stash all prior copies of the spine, so that nobody crashes trying to access
1422         a stale spine.
1423         
1424         I'm going to want to do the same thing for FastBitVector, by creating a segmented WordOwner
1425         class. That would require repeating the dance of having a spine that can resize while stashing
1426         old versions. So, the spine resizing logic is abstracted behind ConcurrentBuffer. You could
1427         use that as a kind of "concurrent vector" for immutable data. That's how ConcurrentVector uses
1428         it: it's an immutable array of segment pointers.
1429
1430         * WTF.xcodeproj/project.pbxproj:
1431         * wtf/ConcurrentBuffer.h: Added.
1432         (WTF::ConcurrentBuffer::ConcurrentBuffer):
1433         (WTF::ConcurrentBuffer::~ConcurrentBuffer):
1434         (WTF::ConcurrentBuffer::growExact):
1435         (WTF::ConcurrentBuffer::grow):
1436         (WTF::ConcurrentBuffer::array const):
1437         (WTF::ConcurrentBuffer::operator[]):
1438         (WTF::ConcurrentBuffer::operator[] const):
1439         (WTF::ConcurrentBuffer::createArray):
1440         * wtf/ConcurrentVector.h: Added.
1441         (WTF::ConcurrentVectorIterator::~ConcurrentVectorIterator):
1442         (WTF::ConcurrentVectorIterator::operator* const):
1443         (WTF::ConcurrentVectorIterator::operator-> const):
1444         (WTF::ConcurrentVectorIterator::operator++):
1445         (WTF::ConcurrentVectorIterator::operator== const):
1446         (WTF::ConcurrentVectorIterator::operator!= const):
1447         (WTF::ConcurrentVectorIterator::operator=):
1448         (WTF::ConcurrentVectorIterator::ConcurrentVectorIterator):
1449         (WTF::ConcurrentVector::~ConcurrentVector):
1450         (WTF::ConcurrentVector::size const):
1451         (WTF::ConcurrentVector::isEmpty const):
1452         (WTF::ConcurrentVector::at):
1453         (WTF::ConcurrentVector::at const):
1454         (WTF::ConcurrentVector::operator[]):
1455         (WTF::ConcurrentVector::operator[] const):
1456         (WTF::ConcurrentVector::first):
1457         (WTF::ConcurrentVector::first const):
1458         (WTF::ConcurrentVector::last):
1459         (WTF::ConcurrentVector::last const):
1460         (WTF::ConcurrentVector::takeLast):
1461         (WTF::ConcurrentVector::append):
1462         (WTF::ConcurrentVector::alloc):
1463         (WTF::ConcurrentVector::removeLast):
1464         (WTF::ConcurrentVector::grow):
1465         (WTF::ConcurrentVector::begin):
1466         (WTF::ConcurrentVector::end):
1467         (WTF::ConcurrentVector::segmentExistsFor):
1468         (WTF::ConcurrentVector::segmentFor):
1469         (WTF::ConcurrentVector::subscriptFor):
1470         (WTF::ConcurrentVector::ensureSegmentsFor):
1471         (WTF::ConcurrentVector::ensureSegment):
1472         (WTF::ConcurrentVector::allocateSegment):
1473
1474 2017-12-12  JF Bastien  <jfbastien@apple.com>
1475
1476         makeString: support more integral types
1477         https://bugs.webkit.org/show_bug.cgi?id=180720
1478
1479         Reviewed by Sam Weinig.
1480
1481         Only some integral types worked. Add more types by using template
1482         magic. While we're here, also use the same magic for
1483         floating-point types in the theoretical future where short float
1484         or long double matter.
1485
1486         The core of the magic is a second, defaulted, template
1487         parameter. It's declared in Forward.h (as void), and then in
1488         classes where we want to enable_if we use it (in C++ speak we
1489         create a partial class template specialization), otherwise we
1490         leave it as void.
1491
1492         Also clean up some constructors which were being way too verbose
1493         in stating that they were declarations for this template
1494         specialization right here, when really we already knew that.
1495
1496         * wtf/Forward.h:
1497         * wtf/text/StringConcatenate.h:
1498         (WTF::StringTypeAdapter<char>::StringTypeAdapter<char>): Deleted.
1499         (WTF::StringTypeAdapter<char>::length): Deleted.
1500         (WTF::StringTypeAdapter<char>::is8Bit): Deleted.
1501         (WTF::StringTypeAdapter<char>::writeTo const): Deleted.
1502         (WTF::StringTypeAdapter<char>::toString const): Deleted.
1503         (WTF::StringTypeAdapter<UChar>::StringTypeAdapter<UChar>): Deleted.
1504         (WTF::StringTypeAdapter<UChar>::length const): Deleted.
1505         (WTF::StringTypeAdapter<UChar>::is8Bit const): Deleted.
1506         (WTF::StringTypeAdapter<UChar>::writeTo const): Deleted.
1507         (WTF::StringTypeAdapter<UChar>::toString const): Deleted.
1508         (WTF::StringTypeAdapter<char::StringTypeAdapter): Deleted.
1509         (WTF::StringTypeAdapter<ASCIILiteral>::StringTypeAdapter): Deleted.
1510         (WTF::StringTypeAdapter<Vector<char>>::StringTypeAdapter): Deleted.
1511         (WTF::StringTypeAdapter<Vector<char>>::length const): Deleted.
1512         (WTF::StringTypeAdapter<Vector<char>>::is8Bit const): Deleted.
1513         (WTF::StringTypeAdapter<Vector<char>>::writeTo const): Deleted.
1514         (WTF::StringTypeAdapter<Vector<char>>::toString const): Deleted.
1515         (WTF::StringTypeAdapter<String>::StringTypeAdapter<String>): Deleted.
1516         (WTF::StringTypeAdapter<String>::length const): Deleted.
1517         (WTF::StringTypeAdapter<String>::is8Bit const): Deleted.
1518         (WTF::StringTypeAdapter<String>::writeTo const): Deleted.
1519         (WTF::StringTypeAdapter<String>::toString const): Deleted.
1520         (WTF::StringTypeAdapter<AtomicString>::StringTypeAdapter): Deleted.
1521         * wtf/text/StringConcatenateNumbers.h:
1522         (WTF::StringTypeAdapter<FormattedNumber>::StringTypeAdapter):
1523         (WTF::StringTypeAdapter<int>::StringTypeAdapter<int>): Deleted.
1524         (WTF::StringTypeAdapter<int>::length const): Deleted.
1525         (WTF::StringTypeAdapter<int>::is8Bit const): Deleted.
1526         (WTF::StringTypeAdapter<int>::writeTo const): Deleted.
1527         (WTF::StringTypeAdapter<int>::toString const): Deleted.
1528         (WTF::StringTypeAdapter<unsigned>::StringTypeAdapter<unsigned>): Deleted.
1529         (WTF::StringTypeAdapter<unsigned>::length const): Deleted.
1530         (WTF::StringTypeAdapter<unsigned>::is8Bit const): Deleted.
1531         (WTF::StringTypeAdapter<unsigned>::writeTo const): Deleted.
1532         (WTF::StringTypeAdapter<unsigned>::toString const): Deleted.
1533         (WTF::StringTypeAdapter<double>::StringTypeAdapter<double>): Deleted.
1534         (WTF::StringTypeAdapter<double>::length const): Deleted.
1535         (WTF::StringTypeAdapter<double>::is8Bit const): Deleted.
1536         (WTF::StringTypeAdapter<double>::writeTo const): Deleted.
1537         (WTF::StringTypeAdapter<double>::toString const): Deleted.
1538         (WTF::StringTypeAdapter<float>::StringTypeAdapter<float>): Deleted.
1539         (WTF::StringTypeAdapter<FormattedNumber>::StringTypeAdapter<FormattedNumber>): Deleted.
1540         * wtf/text/StringView.h:
1541         (WTF::StringTypeAdapter<StringView>::StringTypeAdapter<StringView>): Deleted.
1542         (WTF::StringTypeAdapter<StringView>::length): Deleted.
1543         (WTF::StringTypeAdapter<StringView>::is8Bit): Deleted.
1544         (WTF::StringTypeAdapter<StringView>::writeTo): Deleted.
1545         (WTF::StringTypeAdapter<StringView>::toString const): Deleted.
1546
1547 2017-12-12  Caio Lima  <ticaiolima@gmail.com>
1548
1549         [ESNext][BigInt] Implement BigInt literals and JSBigInt
1550         https://bugs.webkit.org/show_bug.cgi?id=179000
1551
1552         Reviewed by Darin Adler and Yusuke Suzuki.
1553
1554         * wtf/HashFunctions.h:
1555
1556 2017-12-12  Joseph Pecoraro  <pecoraro@apple.com>
1557
1558         Symbol not found: __ZN3WTF8LockBase10unlockSlowEv
1559         https://bugs.webkit.org/show_bug.cgi?id=180691
1560
1561         Reviewed by Yusuke Suzuki.
1562
1563         * wtf/mac/DeprecatedSymbolsUsedBySafari.mm:
1564         (WTF::LockBase::lockSlow):
1565         (WTF::LockBase::unlockSlow):
1566         Add back LockBase Symbols used by System Safari on 10.13.
1567
1568 2017-12-12  Yusuke Suzuki  <utatane.tea@gmail.com>
1569
1570         [WTF] Thread::create should have Thread::tryCreate
1571         https://bugs.webkit.org/show_bug.cgi?id=180333
1572
1573         Reviewed by Darin Adler.
1574
1575         Many callers of Thread::create assume that it returns non-nullptr Thread.
1576         But if the number of threads hits the limit in the system, creating Thread
1577         would fail. In that case, it is really difficult to keep WebKit working.
1578
1579         We introduce Thread::tryCreate, and change the returned value from Thread::create
1580         from RefPtr<Thread> to Ref<Thread>. In Thread::create, we ensure thread creation
1581         succeeds by RELEASE_ASSERT. And we use Thread::create intentionally if the
1582         caller assumes that thread should be created.
1583
1584         * wtf/AutomaticThread.cpp:
1585         (WTF::AutomaticThread::start):
1586         * wtf/ParallelJobsGeneric.cpp:
1587         (WTF::ParallelEnvironment::ThreadPrivate::tryLockFor):
1588         * wtf/Threading.cpp:
1589         (WTF::Thread::tryCreate):
1590         (WTF::Thread::create): Deleted.
1591         * wtf/Threading.h:
1592         (WTF::Thread::create):
1593         * wtf/WorkQueue.cpp:
1594         (WTF::WorkQueue::concurrentApply):
1595
1596 2017-12-11  Eric Carlson  <eric.carlson@apple.com>
1597
1598         Web Inspector: Optionally log WebKit log parameters as JSON
1599         https://bugs.webkit.org/show_bug.cgi?id=180529
1600         <rdar://problem/35909462>
1601
1602         Reviewed by Joseph Pecoraro.
1603
1604         * wtf/Logger.h:
1605         (WTF::Logger::log):
1606         (WTF::LogArgument<Logger::LogSiteIdentifier>::toString):
1607
1608         * wtf/MediaTime.cpp:
1609         (WTF::MediaTime::toJSONString const): Serialize to JSON string.
1610         * wtf/MediaTime.h:
1611
1612 2017-12-11  Tim Horton  <timothy_horton@apple.com>
1613
1614         Stop using deprecated target conditional for simulator builds
1615         https://bugs.webkit.org/show_bug.cgi?id=180662
1616         <rdar://problem/35136156>
1617
1618         Reviewed by Simon Fraser.
1619
1620         * wtf/Platform.h:
1621
1622 2017-12-11  Yusuke Suzuki  <utatane.tea@gmail.com>
1623
1624         [WTF] Add Converter traits to StringHasher instead of function pointer
1625         https://bugs.webkit.org/show_bug.cgi?id=180656
1626
1627         Reviewed by JF Bastien.
1628
1629         In the latest ICU, UChar is char16_t. So defining defaultConverter(UChar)
1630         and defaultConverter(char16_t) causes duplicate definitions.
1631         Instead of passing a funtion pointer, we pass a trait class DefaultConveter
1632         which has `convert` static function. And we make this `convert` function
1633         generic. This avoids defining convert function for UChar and char16_t.
1634
1635         * wtf/text/StringHash.h:
1636         (WTF::ASCIICaseInsensitiveHash::FoldCase::convert):
1637         (WTF::ASCIICaseInsensitiveHash::hash):
1638         (WTF::ASCIICaseInsensitiveHash::foldCase): Deleted.
1639         * wtf/text/StringHasher.h:
1640         (WTF::StringHasher::DefaultConverter::convert):
1641         (WTF::StringHasher::addCharactersAssumingAligned):
1642         (WTF::StringHasher::addCharacters):
1643         (WTF::StringHasher::computeHashAndMaskTop8Bits):
1644         (WTF::StringHasher::computeHash):
1645         (WTF::StringHasher::computeLiteralHash):
1646         (WTF::StringHasher::computeLiteralHashAndMaskTop8Bits):
1647         (WTF::StringHasher::computeHashImpl):
1648         (WTF::StringHasher::Converter): Deleted.
1649         (WTF::StringHasher::defaultConverter): Deleted.
1650
1651 2017-12-10  Yusuke Suzuki  <utatane.tea@gmail.com>
1652
1653         [WTF] Reduce sizeof(Thread) by adjusting alignment
1654         https://bugs.webkit.org/show_bug.cgi?id=180630
1655
1656         Reviewed by Saam Barati.
1657
1658         Reduce sizeof(Thread) slightly by adjusting alignment.
1659
1660         * wtf/Threading.h:
1661
1662 2017-12-10  Yusuke Suzuki  <utatane.tea@gmail.com>
1663
1664         Unreviewed, follow-up patch after r225726
1665         https://bugs.webkit.org/show_bug.cgi?id=180622
1666
1667         Suggested by Darin. We should take care of signed-extension of `char`.
1668
1669         * wtf/text/StringHasher.h:
1670         (WTF::StringHasher::defaultConverter):
1671
1672 2017-12-09  Yusuke Suzuki  <utatane.tea@gmail.com>
1673
1674         [WTF] Remove RELAXED_CONSTEXPR
1675         https://bugs.webkit.org/show_bug.cgi?id=180624
1676
1677         Reviewed by JF Bastien.
1678
1679         All of our required compilers support relaxed constexpr in C++14.
1680         We can drop RELAXED_CONSTEXPR macro in our tree.
1681
1682         * wtf/Compiler.h:
1683         * wtf/Expected.h:
1684         (std::experimental::fundamentals_v3::expected::operator*):
1685         (std::experimental::fundamentals_v3::expected::value):
1686         (std::experimental::fundamentals_v3::expected::error):
1687         * wtf/Unexpected.h:
1688         (std::experimental::fundamentals_v3::unexpected::value):
1689         (std::experimental::fundamentals_v3::unexpected::value const):
1690
1691 2017-12-09  Yusuke Suzuki  <utatane.tea@gmail.com>
1692
1693         Fix WTF::Hasher tuple expansion with variadic args
1694         https://bugs.webkit.org/show_bug.cgi?id=180623
1695
1696         Reviewed by JF Bastien.
1697
1698         We expand a tuple with `...`, and use this in a function's argument list.
1699         And in this argument list, we call `add()` for each value. This will be
1700         expanded as follows.
1701
1702             [] (...) { }((add(hasher, std::get<i>(values)), 0)...);
1703
1704         will become,
1705
1706             [] (...) { }((add(hasher, std::get<0>(values)), 0), (add(hasher, std::get<1>(values)), 0), ...);
1707
1708         However, the evaluation order of the C++ argument is unspecified. Actually,
1709         in GCC environment, this `add()` is not called in our expected order. As a
1710         result, currently we have test failures in TestWTF.
1711
1712         This patch just uses variadic templates to expand tuples, and call add() in
1713         our expected order. This patch fixes an existing failure of TestWTF in GCC environment.
1714
1715         * wtf/Hasher.h:
1716         (WTF::Hasher::computeHash):
1717         (WTF::addArgs):
1718         (WTF::addTupleHelper):
1719         (WTF::add):
1720
1721 2017-12-09  Yusuke Suzuki  <utatane.tea@gmail.com>
1722
1723         Use relaxed constexpr for StringHasher
1724         https://bugs.webkit.org/show_bug.cgi?id=180622
1725
1726         Reviewed by JF Bastien.
1727
1728         Now VC++ is updated and all the WebKit compilers support C++14 relaxed constexpr.
1729         This patch uses relaxed constexpr for StringHasher constexpr implementation
1730
1731         * wtf/text/StringHasher.h:
1732         (WTF::StringHasher::addCharactersAssumingAligned):
1733         (WTF::StringHasher::Converter):
1734         (WTF::StringHasher::computeHashAndMaskTop8Bits):
1735         (WTF::StringHasher::computeHash):
1736         (WTF::StringHasher::computeLiteralHash):
1737         (WTF::StringHasher::computeLiteralHashAndMaskTop8Bits):
1738         (WTF::StringHasher::defaultConverter):
1739         (WTF::StringHasher::avalancheBits):
1740         (WTF::StringHasher::finalize):
1741         (WTF::StringHasher::finalizeAndMaskTop8Bits):
1742         (WTF::StringHasher::avoidZero):
1743         (WTF::StringHasher::calculateWithRemainingLastCharacter):
1744         (WTF::StringHasher::calculateWithTwoCharacters):
1745         (WTF::StringHasher::processPendingCharacter const):
1746         (WTF::StringHasher::StringHasher): Deleted.
1747         (WTF::StringHasher::avalancheBits3): Deleted.
1748         (WTF::StringHasher::avalancheBits2): Deleted.
1749         (WTF::StringHasher::avalancheBits1): Deleted.
1750         (WTF::StringHasher::avalancheBits0): Deleted.
1751         (WTF::StringHasher::calculateWithRemainingLastCharacter1): Deleted.
1752         (WTF::StringHasher::calculateWithRemainingLastCharacter0): Deleted.
1753         (WTF::StringHasher::calculate1): Deleted.
1754         (WTF::StringHasher::calculate0): Deleted.
1755         (WTF::StringHasher::calculate): Deleted.
1756         (WTF::StringHasher::computeLiteralHashImpl): Deleted.
1757
1758 2017-12-08  Eric Carlson  <eric.carlson@apple.com>
1759
1760         Move Logger from PAL to WTF so it can be used outside of WebCore
1761         https://bugs.webkit.org/show_bug.cgi?id=180561
1762
1763         Reviewed by Alex Christensen.
1764
1765         * WTF.xcodeproj/project.pbxproj:
1766         * wtf/Logger.h: Copied from Source/WebCore/PAL/pal/Logger.h.
1767         (PAL::LogArgument::toString): Deleted.
1768         (PAL::Logger::create): Deleted.
1769         (PAL::Logger::logAlways const): Deleted.
1770         (PAL::Logger::error const): Deleted.
1771         (PAL::Logger::warning const): Deleted.
1772         (PAL::Logger::info const): Deleted.
1773         (PAL::Logger::debug const): Deleted.
1774         (PAL::Logger::willLog const): Deleted.
1775         (PAL::Logger::enabled const): Deleted.
1776         (PAL::Logger::setEnabled): Deleted.
1777         (PAL::Logger::LogSiteIdentifier::LogSiteIdentifier): Deleted.
1778         (PAL::Logger::addObserver): Deleted.
1779         (PAL::Logger::removeObserver): Deleted.
1780         (PAL::Logger::Logger): Deleted.
1781         (PAL::Logger::log): Deleted.
1782         (PAL::Logger::observers): Deleted.
1783         (PAL::LogArgument<Logger::LogSiteIdentifier>::toString): Deleted.
1784         * wtf/LoggerHelper.h: Copied from Source/WebCore/PAL/pal/LoggerHelper.h.
1785
1786 2017-12-08  Yusuke Suzuki  <utatane.tea@gmail.com>
1787
1788         Remove pthread_once in favor of dispatch_once
1789         https://bugs.webkit.org/show_bug.cgi?id=180591
1790
1791         Reviewed by Saam Barati.
1792
1793         Fix the comment.
1794
1795         * wtf/Threading.h:
1796         (WTF::Thread::current):
1797
1798 2017-12-08  Yusuke Suzuki  <utatane.tea@gmail.com>
1799
1800         [WTF][Linux][GTK] Fix a minor bug in generic/WorkQueue when WorkQueue is immediately destroyed
1801         https://bugs.webkit.org/show_bug.cgi?id=180586
1802
1803         Reviewed by Darin Adler.
1804
1805         If WorkQueue is created and destroyed immediately, RunLoop::stop can be called
1806         befire calling RunLoop::run(). At that time WorkQueue thread is not stopped.
1807
1808         This patch dispatches a task stopping its own RunLoop to ensure stop is done.
1809         We also clean up WorkQueue implementation not to include unnecessary fields,
1810         lock, condition, and thread.
1811
1812         * wtf/WorkQueue.h:
1813         * wtf/generic/WorkQueueGeneric.cpp:
1814         (WorkQueue::platformInitialize):
1815         (WorkQueue::platformInvalidate):
1816
1817 2017-12-08  Yusuke Suzuki  <utatane.tea@gmail.com>
1818
1819         [WTF] Remove remaining use of Mutex
1820         https://bugs.webkit.org/show_bug.cgi?id=180579
1821
1822         Reviewed by Alex Christensen.
1823
1824         Mutex should be only used in low-level Locking and Threading.
1825         Other ones should use WTF::Lock and WTF::Condition instead.
1826         This patch replaces WTF::Mutex with WTF::Lock in WTF if it
1827         is not related to threading or locking implementation.
1828
1829         And we also use WTF::Lock and WTF::Condition in WTF::BinarySemaphore.
1830
1831         * wtf/RunLoop.cpp:
1832         (WTF::RunLoop::performWork):
1833         (WTF::RunLoop::dispatch):
1834         * wtf/RunLoop.h:
1835         * wtf/WorkQueue.cpp:
1836         * wtf/WorkQueue.h:
1837         * wtf/threads/BinarySemaphore.cpp:
1838         (WTF::BinarySemaphore::signal):
1839         (WTF::BinarySemaphore::wait):
1840         (WTF::BinarySemaphore::BinarySemaphore): Deleted.
1841         (WTF::BinarySemaphore::~BinarySemaphore): Deleted.
1842         * wtf/threads/BinarySemaphore.h:
1843         * wtf/win/WorkQueueWin.cpp:
1844         (WTF::WorkQueue::registerHandle):
1845         (WTF::WorkQueue::unregisterAndCloseHandle):
1846         (WTF::WorkQueue::dispatch):
1847         (WTF::WorkQueue::timerCallback):
1848         (WTF::WorkQueue::dispatchAfter):
1849         (WTF::TimerContext::TimerContext): Deleted.
1850
1851 2017-12-08  Yusuke Suzuki  <utatane.tea@gmail.com>
1852
1853         Use StaticLock and Lock instead of Mutex in Windows WebKitLegacy
1854         https://bugs.webkit.org/show_bug.cgi?id=180572
1855
1856         Reviewed by Mark Lam.
1857
1858         Remove DEPRECATED_DEFINE_STATIC_LOCAL since it's no longer used.
1859
1860         * wtf/StdLibExtras.h:
1861
1862 2017-12-07  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1863
1864         [Win] [64-bit] Resolve Microsoft warning C4319 on BitVector.cpp
1865         https://bugs.webkit.org/show_bug.cgi?id=180490
1866
1867         Reviewed by Alex Christensen.
1868
1869         bitsInPointer() returns unsigned which is smaller than size_t.
1870         "~"(negate) operator is applied before extending its size which result filled with zero.
1871         This may be potentially a bug if numBits is greater than max value of unsigned long
1872         (which is not practical).
1873
1874         * wtf/BitVector.cpp:
1875         (WTF::BitVector::OutOfLineBits::create):
1876
1877 2017-12-07  Yusuke Suzuki  <utatane.tea@gmail.com>
1878
1879         Use WTF Locking primitives in WebThread and drop pthread_xxx use
1880         https://bugs.webkit.org/show_bug.cgi?id=180445
1881
1882         Reviewed by Saam Barati.
1883
1884         Add initializer form to fill struct with zero if struct does not have any default initializers.
1885
1886         * wtf/ThreadSpecific.h:
1887         (WTF::ThreadSpecific::Data::Data):
1888
1889 2017-12-07  Mark Lam  <mark.lam@apple.com>
1890
1891         Apply poisoning to some native code pointers.
1892         https://bugs.webkit.org/show_bug.cgi?id=180541
1893         <rdar://problem/35916875>
1894
1895         Reviewed by Filip Pizlo.
1896
1897         Ensure that the resultant poisoned bits still looks like a pointer in that its
1898         bottom bits are 0, just like the alignment bits of a pointer.  This allows the
1899         client to use the bottom bits of the poisoned bits as flag bits just like the
1900         client was previously able to do with pointer values.
1901
1902         Note: we only ensure that the bottom alignment bits of the generated poison
1903         value is 0.  We're not masking out the poisoned bits.  This means that the bottom
1904         bits of the poisoned bits will only be null if the original pointer is aligned.
1905         Hence, if the client applies the poison to an unaligned pointer, we do not lose
1906         any information on the low bits.
1907
1908         Also removed 2 wrong assertions in PoisonedImpl's constructors.  We were
1909         asserting that Poisoned will never be used with a null value, but that's invalid.
1910         We do want to allow a null value so that we don't have to constantly do null
1911         checks in the clients.  This was uncovered by some layout tests.
1912
1913         * wtf/Poisoned.cpp:
1914         (WTF::makePoison):
1915         * wtf/Poisoned.h:
1916         (WTF::PoisonedImpl::PoisonedImpl):
1917
1918 2017-12-07  Mark Lam  <mark.lam@apple.com>
1919
1920         [Re-landing r225620] Refactoring: Rename ScrambledPtr to Poisoned.
1921         https://bugs.webkit.org/show_bug.cgi?id=180514
1922
1923         Reviewed by Saam Barati and JF Bastien.
1924
1925         Re-landing r225620 with speculative build fix for GCC 7.
1926
1927         * WTF.xcodeproj/project.pbxproj:
1928         * wtf/CMakeLists.txt:
1929         * wtf/Poisoned.cpp: Copied from Source/WTF/wtf/ScrambledPtr.cpp.
1930         (WTF::makePoison):
1931         (WTF::makeScrambledPtrKey): Deleted.
1932         * wtf/Poisoned.h: Copied from Source/WTF/wtf/ScrambledPtr.h.
1933         (WTF::PoisonedImpl::PoisonedImpl):
1934         (WTF::PoisonedImpl::assertIsPoisoned const):
1935         (WTF::PoisonedImpl::assertIsNotPoisoned const):
1936         (WTF::PoisonedImpl::unpoisoned const):
1937         (WTF::PoisonedImpl::operator-> const):
1938         (WTF::PoisonedImpl::bits const):
1939         (WTF::PoisonedImpl::operator! const):
1940         (WTF::PoisonedImpl::operator bool const):
1941         (WTF::PoisonedImpl::operator== const):
1942         (WTF::PoisonedImpl::operator==):
1943         (WTF::PoisonedImpl::operator=):
1944         (WTF::PoisonedImpl::poison):
1945         (WTF::PoisonedImpl::unpoison):
1946         (WTF::ScrambledPtr::ScrambledPtr): Deleted.
1947         (WTF::ScrambledPtr::assertIsScrambled const): Deleted.
1948         (WTF::ScrambledPtr::assertIsNotScrambled const): Deleted.
1949         (WTF::ScrambledPtr::descrambled const): Deleted.
1950         (WTF::ScrambledPtr::operator-> const): Deleted.
1951         (WTF::ScrambledPtr::bits const): Deleted.
1952         (WTF::ScrambledPtr::operator! const): Deleted.
1953         (WTF::ScrambledPtr::operator bool const): Deleted.
1954         (WTF::ScrambledPtr::operator== const): Deleted.
1955         (WTF::ScrambledPtr::operator==): Deleted.
1956         (WTF::ScrambledPtr::operator=): Deleted.
1957         (WTF::ScrambledPtr::scramble): Deleted.
1958         (WTF::ScrambledPtr::descramble): Deleted.
1959         * wtf/ScrambledPtr.cpp: Removed.
1960         * wtf/ScrambledPtr.h: Removed.
1961
1962 2017-12-07  Michael Catanzaro  <mcatanzaro@igalia.com>
1963
1964         Unreviewed, rolling out r225620
1965         https://bugs.webkit.org/show_bug.cgi?id=180514
1966         <rdar://problem/35901694>
1967
1968         It broke the build with GCC 7, and I don't know how to fix it.
1969
1970         * WTF.xcodeproj/project.pbxproj:
1971         * wtf/CMakeLists.txt:
1972         * wtf/Poisoned.h: Removed.
1973         * wtf/ScrambledPtr.cpp: Renamed from Source/WTF/wtf/Poisoned.cpp.
1974         (WTF::makeScrambledPtrKey):
1975         * wtf/ScrambledPtr.h: Added.
1976         (WTF::ScrambledPtr::ScrambledPtr):
1977         (WTF::ScrambledPtr::assertIsScrambled const):
1978         (WTF::ScrambledPtr::assertIsNotScrambled const):
1979         (WTF::ScrambledPtr::descrambled const):
1980         (WTF::ScrambledPtr::operator-> const):
1981         (WTF::ScrambledPtr::bits const):
1982         (WTF::ScrambledPtr::operator! const):
1983         (WTF::ScrambledPtr::operator bool const):
1984         (WTF::ScrambledPtr::operator== const):
1985         (WTF::ScrambledPtr::operator==):
1986         (WTF::ScrambledPtr::operator=):
1987         (WTF::ScrambledPtr::scramble):
1988         (WTF::ScrambledPtr::descramble):
1989
1990 2017-12-06  Mark Lam  <mark.lam@apple.com>
1991
1992         Refactoring: Rename ScrambledPtr to Poisoned.
1993         https://bugs.webkit.org/show_bug.cgi?id=180514
1994
1995         Reviewed by Saam Barati.
1996
1997         We're switching our nomenclature to "poisoning" instead of "scrambling" pointers.
1998         This allows us to use shorter names.
1999
2000         This patch is almost purely refactoring, except for one change: the PoisonedImpl
2001         template class (previously ScrambledPtr) has been modified to allow usage of
2002         a constexpr uint32_t poison value (see Int32Poisoned) in addition to a runtime
2003         determined uintptr_t poison value (see Poisoned).
2004
2005         * WTF.xcodeproj/project.pbxproj:
2006         * wtf/CMakeLists.txt:
2007         * wtf/Poisoned.cpp: Copied from Source/WTF/wtf/ScrambledPtr.cpp.
2008         (WTF::makePoison):
2009         (WTF::makeScrambledPtrKey): Deleted.
2010         * wtf/Poisoned.h: Copied from Source/WTF/wtf/ScrambledPtr.h.
2011         (WTF::PoisonedImpl::PoisonedImpl):
2012         (WTF::PoisonedImpl::assertIsPoisoned const):
2013         (WTF::PoisonedImpl::assertIsNotPoisoned const):
2014         (WTF::PoisonedImpl::unpoisoned const):
2015         (WTF::PoisonedImpl::operator-> const):
2016         (WTF::PoisonedImpl::bits const):
2017         (WTF::PoisonedImpl::operator! const):
2018         (WTF::PoisonedImpl::operator bool const):
2019         (WTF::PoisonedImpl::operator== const):
2020         (WTF::PoisonedImpl::operator==):
2021         (WTF::PoisonedImpl::operator=):
2022         (WTF::PoisonedImpl::poison):
2023         (WTF::PoisonedImpl::unpoison):
2024         (WTF::ScrambledPtr::ScrambledPtr): Deleted.
2025         (WTF::ScrambledPtr::assertIsScrambled const): Deleted.
2026         (WTF::ScrambledPtr::assertIsNotScrambled const): Deleted.
2027         (WTF::ScrambledPtr::descrambled const): Deleted.
2028         (WTF::ScrambledPtr::operator-> const): Deleted.
2029         (WTF::ScrambledPtr::bits const): Deleted.
2030         (WTF::ScrambledPtr::operator! const): Deleted.
2031         (WTF::ScrambledPtr::operator bool const): Deleted.
2032         (WTF::ScrambledPtr::operator== const): Deleted.
2033         (WTF::ScrambledPtr::operator==): Deleted.
2034         (WTF::ScrambledPtr::operator=): Deleted.
2035         (WTF::ScrambledPtr::scramble): Deleted.
2036         (WTF::ScrambledPtr::descramble): Deleted.
2037         * wtf/ScrambledPtr.cpp: Removed.
2038         * wtf/ScrambledPtr.h: Removed.
2039
2040 2017-12-02  Darin Adler  <darin@apple.com>
2041
2042         Modernize some aspects of text codecs, eliminate WebKit use of strcasecmp
2043         https://bugs.webkit.org/show_bug.cgi?id=180009
2044
2045         Reviewed by Alex Christensen.
2046
2047         * wtf/Assertions.cpp: Removed include of StringExtras.h.
2048         (WTFLogChannelByName): Use equalIgnoringASCIICase instead of strcasecmp.
2049         * wtf/DateMath.cpp: Removed include of StringExtras.h.
2050         * wtf/MD5.cpp: Ditto. Also removed include of CString.h.
2051         * wtf/SHA1.cpp: Ditto.
2052
2053         * wtf/StringExtras.h:
2054         (strncasecmp): Deleted.
2055         (strcasecmp): Deleted.
2056
2057         * wtf/StringPrintStream.cpp: Removed include of StringExtras.h.
2058         * wtf/text/Base64.cpp: Ditto.
2059
2060         * wtf/text/LineEnding.cpp:
2061         (WTF::normalizeLineEndingsToLF): Replaced old more general purpose function with
2062         this. Changed argument type to vector and used an rvalue reference and return value.
2063         Also fixed some small logic errors.
2064         (WTF::normalizeLineEndingsToCRLF): Ditto.
2065         (WTF::normalizeLineEndingsToNative): Updated for above changes.
2066         * wtf/text/LineEnding.h: Updated for above changes.
2067
2068         * wtf/text/StringCommon.h:
2069         (WTF::equalIgnoringASCIICase): Added overload for const char*.
2070         (WTF::equalLettersIgnoringASCIICase): Ditto.
2071
2072         * wtf/text/TextStream.cpp: Removed include of StringExtras.h.
2073         * wtf/text/WTFString.cpp: Ditto.
2074         * wtf/unicode/icu/CollatorICU.cpp: Ditto.
2075
2076 2017-12-06  Yusuke Suzuki  <utatane.tea@gmail.com>
2077
2078         [WTF] Remove XXXLockBase since constexpr constructor can initialize static variables without calling global constructors
2079         https://bugs.webkit.org/show_bug.cgi?id=180495
2080
2081         Reviewed by Mark Lam.
2082
2083         Very nice feature of C++11 is that constexpr constructor can initialize static global variables
2084         without calling global constructors. We do not need to have XXXLockBase with derived XXXLock
2085         class since StaticXXXLock can have constructors as long as it is constexpr.
2086         We remove bunch of these classes, and set `XXXLock() = default;` explicitly for readability.
2087         C++11's default constructor is constexpr as long as its member's default constructor / default
2088         initializer is constexpr.
2089
2090         * wtf/Condition.h:
2091         (WTF::ConditionBase::construct): Deleted.
2092         (WTF::ConditionBase::waitUntil): Deleted.
2093         (WTF::ConditionBase::waitFor): Deleted.
2094         (WTF::ConditionBase::wait): Deleted.
2095         (WTF::ConditionBase::notifyOne): Deleted.
2096         (WTF::ConditionBase::notifyAll): Deleted.
2097         (WTF::Condition::Condition): Deleted.
2098         * wtf/CountingLock.h:
2099         (WTF::CountingLock::CountingLock): Deleted.
2100         (WTF::CountingLock::~CountingLock): Deleted.
2101         * wtf/Lock.cpp:
2102         (WTF::Lock::lockSlow):
2103         (WTF::Lock::unlockSlow):
2104         (WTF::Lock::unlockFairlySlow):
2105         (WTF::Lock::safepointSlow):
2106         (WTF::LockBase::lockSlow): Deleted.
2107         (WTF::LockBase::unlockSlow): Deleted.
2108         (WTF::LockBase::unlockFairlySlow): Deleted.
2109         (WTF::LockBase::safepointSlow): Deleted.
2110         * wtf/Lock.h:
2111         (WTF::LockBase::construct): Deleted.
2112         (WTF::LockBase::lock): Deleted.
2113         (WTF::LockBase::tryLock): Deleted.
2114         (WTF::LockBase::try_lock): Deleted.
2115         (WTF::LockBase::unlock): Deleted.
2116         (WTF::LockBase::unlockFairly): Deleted.
2117         (WTF::LockBase::safepoint): Deleted.
2118         (WTF::LockBase::isHeld const): Deleted.
2119         (WTF::LockBase::isLocked const): Deleted.
2120         (WTF::LockBase::isFullyReset const): Deleted.
2121         (WTF::Lock::Lock): Deleted.
2122         * wtf/ReadWriteLock.cpp:
2123         (WTF::ReadWriteLock::readLock):
2124         (WTF::ReadWriteLock::readUnlock):
2125         (WTF::ReadWriteLock::writeLock):
2126         (WTF::ReadWriteLock::writeUnlock):
2127         (WTF::ReadWriteLockBase::construct): Deleted.
2128         (WTF::ReadWriteLockBase::readLock): Deleted.
2129         (WTF::ReadWriteLockBase::readUnlock): Deleted.
2130         (WTF::ReadWriteLockBase::writeLock): Deleted.
2131         (WTF::ReadWriteLockBase::writeUnlock): Deleted.
2132         * wtf/ReadWriteLock.h:
2133         (WTF::ReadWriteLock::read):
2134         (WTF::ReadWriteLock::write):
2135         (WTF::ReadWriteLockBase::ReadLock::tryLock): Deleted.
2136         (WTF::ReadWriteLockBase::ReadLock::lock): Deleted.
2137         (WTF::ReadWriteLockBase::ReadLock::unlock): Deleted.
2138         (WTF::ReadWriteLockBase::WriteLock::tryLock): Deleted.
2139         (WTF::ReadWriteLockBase::WriteLock::lock): Deleted.
2140         (WTF::ReadWriteLockBase::WriteLock::unlock): Deleted.
2141         (WTF::ReadWriteLockBase::read): Deleted.
2142         (WTF::ReadWriteLockBase::write): Deleted.
2143         (WTF::ReadWriteLock::ReadWriteLock): Deleted.
2144         * wtf/RecursiveLockAdapter.h:
2145         (WTF::RecursiveLockAdapter::RecursiveLockAdapter): Deleted.
2146         * wtf/WordLock.cpp:
2147         (WTF::WordLock::lockSlow):
2148         (WTF::WordLock::unlockSlow):
2149         (WTF::WordLockBase::lockSlow): Deleted.
2150         (WTF::WordLockBase::unlockSlow): Deleted.
2151         * wtf/WordLock.h:
2152         (WTF::WordLockBase::lock): Deleted.
2153         (WTF::WordLockBase::unlock): Deleted.
2154         (WTF::WordLockBase::isHeld const): Deleted.
2155         (WTF::WordLockBase::isLocked const): Deleted.
2156         (WTF::WordLockBase::isFullyReset const): Deleted.
2157         (WTF::WordLock::WordLock): Deleted.
2158         * wtf/WorkQueue.cpp:
2159
2160 2017-12-05  Stephan Szabo  <stephan.szabo@sony.com>
2161
2162         Switch windows build to Visual Studio 2017
2163         https://bugs.webkit.org/show_bug.cgi?id=172412
2164
2165         Reviewed by Per Arne Vollan.
2166
2167         * WTF.vcxproj/WTF.proj:
2168         * wtf/Compiler.h:
2169
2170 2017-12-05  Andy Estes  <aestes@apple.com>
2171
2172         [Darwin] Simplify use of TargetConditionals
2173         https://bugs.webkit.org/show_bug.cgi?id=180455
2174         <rdar://problem/35142971>
2175
2176         Reviewed by Tim Horton.
2177
2178         There's no need to check if TARGET_* macros are defined on Darwin platforms, since
2179         TargetConditionals.h always defines them. Also, we can simplify
2180         (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR) to TARGET_OS_IPHONE.
2181
2182         * wtf/Platform.h:
2183
2184 2017-12-05  Matt Lewis  <jlewis3@apple.com>
2185
2186         Unreviewed, rolling out r225430.
2187
2188         This caused an API failure on release.
2189
2190         Reverted changeset:
2191
2192         "Move DateComponents into WTF"
2193         https://bugs.webkit.org/show_bug.cgi?id=180211
2194         https://trac.webkit.org/changeset/225430
2195
2196 2017-12-05  Michael Saboff  <msaboff@apple.com>
2197
2198         Make WebKit build for ARM64_32
2199         https://bugs.webkit.org/show_bug.cgi?id=180447
2200
2201         Reviewed by Mark Lam.
2202
2203         Add the 'w' (32bit) pointer qualifier for ARM64_32 pointers in inline assembly.
2204
2205         * wtf/darwin/WeakLinking.h:
2206         (WTF::isNullFunctionPointer):
2207
2208 2017-12-05  Filip Pizlo  <fpizlo@apple.com>
2209
2210         bmalloc IsoHeap needs to allow a thread to deallocate some size for the first time
2211         https://bugs.webkit.org/show_bug.cgi?id=180443
2212
2213         Reviewed by Saam Barati.
2214         
2215         With this change it's possible to reenable isoheaps on iOS.
2216
2217         * wtf/IsoMalloc.h:
2218         * wtf/IsoMallocInlines.h:
2219
2220 2017-12-05  Yusuke Suzuki  <utatane.tea@gmail.com>
2221
2222         [WTF] Remove m_atomicStringTableDestructor in Thread by querying the condition at thread destruction
2223         https://bugs.webkit.org/show_bug.cgi?id=180429
2224
2225         Reviewed by Alex Christensen.
2226
2227         We now have a pointer to the AtomicStringTable::destroy in Thread.
2228         This pointer becomes nullptr only when the thread is the web thread not to destroy AtomicStringTable
2229         twice in the UI thread and the web thread.
2230
2231         Instead of having a pointer in each Thread, we query whether the current thread is the web thread at
2232         Thread destruction. And use this information to call AtomicStringTable::destroy. Then, we can drop
2233         m_atomicStringTableDestructor field in Thread.
2234
2235         * wtf/Threading.cpp:
2236         (WTF::Thread::didExit):
2237         * wtf/Threading.h:
2238         * wtf/mac/MainThreadMac.mm:
2239         * wtf/text/AtomicStringTable.cpp:
2240         (WTF::AtomicStringTable::create):
2241         (WTF::AtomicStringTable::destroy):
2242         * wtf/text/AtomicStringTable.h:
2243
2244 2017-12-01  Filip Pizlo  <fpizlo@apple.com>
2245
2246         GC constraint solving should be parallel
2247         https://bugs.webkit.org/show_bug.cgi?id=179934
2248
2249         Reviewed by JF Bastien.
2250         
2251         This does some changes to make it easier to do parallel constraint solving:
2252         
2253         - I finally removed dependencyWith. This was a silly construct whose only purpose is to confuse
2254           people about what it means to have a dependency chain. I took that as an opportunity to grealy
2255           simplify the GC's use of dependency chaining.
2256         
2257         - Added more logic to Deque<>, since I use it for part of the load balancer.
2258         
2259         - Made it possible to profile lock contention. See
2260           https://bugs.webkit.org/show_bug.cgi?id=180250#c0 for some preliminary measurements.
2261         
2262         - Introduced holdLockIf, which makes it easy to perform predicated lock acquisition. We use that
2263           to pick a lock in WebCore.
2264         
2265         - Introduced CountingLock. It's like WTF::Lock except it also enables optimistic read transactions
2266           sorta like Java's StampedLock.
2267
2268         * WTF.xcodeproj/project.pbxproj:
2269         * wtf/Atomics.h:
2270         (WTF::dependency):
2271         (WTF::DependencyWith::DependencyWith): Deleted.
2272         (WTF::dependencyWith): Deleted.
2273         * wtf/BitVector.h:
2274         (WTF::BitVector::iterator::operator++):
2275         * wtf/CMakeLists.txt:
2276         * wtf/ConcurrentPtrHashSet.cpp: Added.
2277         (WTF::ConcurrentPtrHashSet::ConcurrentPtrHashSet):
2278         (WTF::ConcurrentPtrHashSet::~ConcurrentPtrHashSet):
2279         (WTF::ConcurrentPtrHashSet::deleteOldTables):
2280         (WTF::ConcurrentPtrHashSet::clear):
2281         (WTF::ConcurrentPtrHashSet::initialize):
2282         (WTF::ConcurrentPtrHashSet::addSlow):
2283         (WTF::ConcurrentPtrHashSet::resizeIfNecessary):
2284         (WTF::ConcurrentPtrHashSet::resizeAndAdd):
2285         (WTF::ConcurrentPtrHashSet::Table::create):
2286         * wtf/ConcurrentPtrHashSet.h: Added.
2287         (WTF::ConcurrentPtrHashSet::contains):
2288         (WTF::ConcurrentPtrHashSet::add):
2289         (WTF::ConcurrentPtrHashSet::size const):
2290         (WTF::ConcurrentPtrHashSet::Table::maxLoad const):
2291         (WTF::ConcurrentPtrHashSet::hash):
2292         (WTF::ConcurrentPtrHashSet::cast):
2293         (WTF::ConcurrentPtrHashSet::containsImpl const):
2294         (WTF::ConcurrentPtrHashSet::addImpl):
2295         * wtf/Deque.h:
2296         (WTF::inlineCapacity>::takeFirst):
2297         * wtf/FastMalloc.h:
2298         * wtf/Lock.cpp:
2299         (WTF::LockBase::lockSlow):
2300         * wtf/Locker.h:
2301         (WTF::holdLockIf):
2302         * wtf/ScopedLambda.h:
2303         * wtf/SharedTask.h:
2304         (WTF::SharedTask<PassedResultType):
2305         (WTF::SharedTask<ResultType): Deleted.
2306         * wtf/StackShot.h: Added.
2307         (WTF::StackShot::StackShot):
2308         (WTF::StackShot::operator=):
2309         (WTF::StackShot::array const):
2310         (WTF::StackShot::size const):
2311         (WTF::StackShot::operator bool const):
2312         (WTF::StackShot::operator== const):
2313         (WTF::StackShot::hash const):
2314         (WTF::StackShot::isHashTableDeletedValue const):
2315         (WTF::StackShot::operator> const):
2316         (WTF::StackShot::deletedValueArray):
2317         (WTF::StackShotHash::hash):
2318         (WTF::StackShotHash::equal):
2319         * wtf/StackShotProfiler.h: Added.
2320         (WTF::StackShotProfiler::StackShotProfiler):
2321         (WTF::StackShotProfiler::profile):
2322         (WTF::StackShotProfiler::run):
2323
2324 2017-12-05  Yusuke Suzuki  <utatane.tea@gmail.com>
2325
2326         [WTF] Use m_suspendCount instead of m_suspended flag in Thread
2327         https://bugs.webkit.org/show_bug.cgi?id=180427
2328
2329         Reviewed by Carlos Garcia Campos.
2330
2331         When resuming the thread, signal handler is reinvoked once before `sigsuspend` is resumed.
2332         But this handler should not do anything since it is just a signal for `sigsuspend`.
2333         Previously, we use m_suspenedd flag to distinguish between suspending and resuming signal
2334         handler invocations.
2335
2336         But this additional m_suspended flag is not necessary since we can use m_suspendCount instead.
2337         This patch drops m_suspended and use m_suspendCount. Since semaphore operations emit full memory
2338         barrier, m_suspendCount is loaded and stored as we expect.
2339
2340         * wtf/Threading.h:
2341         * wtf/ThreadingPthreads.cpp:
2342         (WTF::Thread::signalHandlerSuspendResume):
2343         (WTF::Thread::suspend):
2344         (WTF::Thread::resume):
2345
2346 2017-12-04  Simon Fraser  <simon.fraser@apple.com>
2347
2348         Minor DisplayRefreshMonitor-related cleanup
2349         https://bugs.webkit.org/show_bug.cgi?id=179802
2350
2351         Reviewed by Sam Weinig.
2352
2353         New trace point for when the CVDisplayLink fires on its own thread.
2354
2355         * wtf/SystemTracing.h:
2356
2357 2017-12-04  JF Bastien  <jfbastien@apple.com>
2358
2359         Update std::expected to match libc++ coding style
2360         https://bugs.webkit.org/show_bug.cgi?id=180264
2361
2362         Reviewed by Alex Christensen.
2363
2364         As of https://wg21.link/p0323r4 std::expected is on its way to the
2365         Library Fundamentals v3 TS (LEWG and EWG voted for this, but LWG
2366         hasn't done wording review yet, hence "on its way"). The API is
2367         therefore pretty close to what will be in the TS, and I've gotten
2368         requests for an easily usable implementation of std::expected. I
2369         talked to our clang team and they'll help me migrate our
2370         implementation to libc++, but our implementation has to look more
2371         like libc++ than it does now. Once in libc++ I'll maintain changes
2372         on both sides to make sure neither is out-of-date for too long.
2373
2374         - Fork std::unexpected into its own header.
2375         - Add mild support for an exception-based implementation, but
2376           don't do noexcept yet.
2377         - Rename everything to follow STL style, and keep a global using
2378           or variable alias where possible to reduce WebKit code churn.
2379         - Minor API updates to remove things that aren't in the proposal
2380           anymore.
2381
2382         * wtf/Expected.h:
2383         (std::experimental::fundamentals_v3::bad_expected_access<void>::bad_expected_access):
2384         (std::experimental::fundamentals_v3::bad_expected_access::bad_expected_access):
2385         (std::experimental::fundamentals_v3::bad_expected_access::error):
2386         (std::experimental::fundamentals_v3::bad_expected_access::error const):
2387         (std::experimental::fundamentals_v3::__expected_detail::constexpr_base::constexpr_base):
2388         (std::experimental::fundamentals_v3::__expected_detail::base::base):
2389         (std::experimental::fundamentals_v3::__expected_detail::base::~base):
2390         (std::experimental::fundamentals_v3::expected::expected):
2391         (std::experimental::fundamentals_v3::expected::operator=):
2392         (std::experimental::fundamentals_v3::expected::swap):
2393         (std::experimental::fundamentals_v3::expected::operator-> const):
2394         (std::experimental::fundamentals_v3::expected::operator->):
2395         (std::experimental::fundamentals_v3::expected::operator* const):
2396         (std::experimental::fundamentals_v3::expected::operator*):
2397         (std::experimental::fundamentals_v3::expected::has_value const):
2398         (std::experimental::fundamentals_v3::expected::value const):
2399         (std::experimental::fundamentals_v3::expected::value):
2400         (std::experimental::fundamentals_v3::expected::error const):
2401         (std::experimental::fundamentals_v3::expected::error):
2402         (std::experimental::fundamentals_v3::expected::value_or const):
2403         (std::experimental::fundamentals_v3::expected::value_or):
2404         (std::experimental::fundamentals_v3::operator==):
2405         (std::experimental::fundamentals_v3::operator!=):
2406         (std::experimental::fundamentals_v3::swap):
2407         (WTF::Unexpected::Unexpected): Deleted.
2408         (WTF::Unexpected::value const): Deleted.
2409         (WTF::Unexpected::value): Deleted.
2410         (WTF::operator==): Deleted.
2411         (WTF::operator!=): Deleted.
2412         (WTF::makeUnexpected): Deleted.
2413         (WTF::ExpectedDetail::Throw): Deleted.
2414         (WTF::ExpectedDetail::destroy): Deleted.
2415         (WTF::ExpectedDetail::std::is_trivially_destructible<T>::value): Deleted.
2416         (WTF::ExpectedDetail::ConstexprBase::ConstexprBase): Deleted.
2417         (WTF::ExpectedDetail::Base::Base): Deleted.
2418         (WTF::ExpectedDetail::Base::~Base): Deleted.
2419         (WTF::Expected::Expected): Deleted.
2420         (WTF::Expected::operator=): Deleted.
2421         (WTF::Expected::swap): Deleted.
2422         (WTF::Expected::operator-> const): Deleted.
2423         (WTF::Expected::operator->): Deleted.
2424         (WTF::Expected::operator* const): Deleted.
2425         (WTF::Expected::operator*): Deleted.
2426         (WTF::Expected::operator bool const): Deleted.
2427         (WTF::Expected::hasValue const): Deleted.
2428         (WTF::Expected::value const): Deleted.
2429         (WTF::Expected::value): Deleted.
2430         (WTF::Expected::error const): Deleted.
2431         (WTF::Expected::error): Deleted.
2432         (WTF::Expected::getUnexpected const): Deleted.
2433         (WTF::Expected::valueOr const): Deleted.
2434         (WTF::Expected::valueOr): Deleted.
2435         (WTF::swap): Deleted.
2436         (WTF::makeExpected): Deleted.
2437         (WTF::makeExpectedFromError): Deleted.
2438         * wtf/Forward.h:
2439         * wtf/Optional.h:
2440         * wtf/StdLibExtras.h:
2441         * wtf/Unexpected.h: Added.
2442         (std::experimental::fundamentals_v3::unexpected::unexpected):
2443         (std::experimental::fundamentals_v3::unexpected::value const):
2444         (std::experimental::fundamentals_v3::unexpected::value):
2445         (std::experimental::fundamentals_v3::operator==):
2446         (std::experimental::fundamentals_v3::operator!=):
2447         (makeUnexpected):
2448
2449 2017-12-03  Tomas Popela  <tpopela@redhat.com>
2450
2451         Build fails on x86_64 and arm64 with BMalloc disabled
2452         https://bugs.webkit.org/show_bug.cgi?id=180188
2453
2454         Reviewed by Carlos Garcia Campos.
2455
2456         Add missing methods in WTF's Gigacage.h and fix g_gigacageBasePtr
2457         definition.
2458
2459         * wtf/Gigacage.cpp:
2460         * wtf/Gigacage.h:
2461         (Gigacage::basePtr):
2462         (Gigacage::isEnabled):
2463
2464 2017-12-03  Yusuke Suzuki  <utatane.tea@gmail.com>
2465
2466         WTF shouldn't have both Thread and ThreadIdentifier
2467         https://bugs.webkit.org/show_bug.cgi?id=180308
2468
2469         Reviewed by Darin Adler.
2470
2471         We should use a pointer of WTF::Thread instead of ThreadIdentifier.
2472
2473         One problem is that Windows support library uses WTF::createThread,
2474         which returns ThreadIdentifier. So we cannot drop ThreadIdentifier
2475         in Windows environment. This patch keeps ThreadIdentifier in Windows.
2476
2477         * wtf/MainThread.cpp:
2478         (WTF::initializeMainThread):
2479         (WTF::isMainThread):
2480         (WTF::canAccessThreadLocalDataForThread):
2481         * wtf/MainThread.h:
2482         * wtf/ParkingLot.cpp:
2483         (WTF::ParkingLot::parkConditionallyImpl):
2484         (WTF::ParkingLot::unparkOne):
2485         (WTF::ParkingLot::unparkOneImpl):
2486         (WTF::ParkingLot::unparkCount):
2487         * wtf/RecursiveLockAdapter.h:
2488         (WTF::RecursiveLockAdapter::lock):
2489         (WTF::RecursiveLockAdapter::unlock):
2490         (WTF::RecursiveLockAdapter::tryLock):
2491         * wtf/Threading.cpp:
2492         (WTF::Thread::dump const):
2493         * wtf/Threading.h:
2494         (WTF::Thread::id const):
2495         (WTF::Thread::operator==): Deleted.
2496         (WTF::Thread::operator!=): Deleted.
2497         (WTF::currentThread): Deleted.
2498         * wtf/ThreadingPrimitives.h:
2499         * wtf/ThreadingPthreads.cpp:
2500         (WTF::Thread::waitForCompletion):
2501         (WTF::Thread::detach):
2502         (WTF::Thread::initializeCurrentTLS):
2503         (WTF::Thread::suspend):
2504         (WTF::Thread::establishPlatformSpecificHandle):
2505         (WTF::Thread::currentID): Deleted.
2506         * wtf/ThreadingWin.cpp:
2507         (WTF::Thread::waitForCompletion):
2508         (WTF::Thread::suspend):
2509         (WTF::Thread::currentDying):
2510         * wtf/mac/MainThreadMac.mm:
2511         (WTF::initializeApplicationUIThread):
2512         (WTF::initializeWebThreadPlatform):
2513         (WTF::canAccessThreadLocalDataForThread):
2514         (WTF::initializeApplicationUIThreadIdentifier): Deleted.
2515         (WTF::initializeWebThreadIdentifier): Deleted.
2516
2517 2017-12-03  Darin Adler  <darin@apple.com>
2518
2519         Add WTF::Hasher, an easier to use replacement for WTF::IntegerHasher
2520         https://bugs.webkit.org/show_bug.cgi?id=180318
2521
2522         Reviewed by JF Bastien.
2523
2524         * WTF.xcodeproj/project.pbxproj: Added Hasher.h.
2525         * wtf/CMakeLists.txt: Ditto.
2526
2527         * wtf/Forward.h: Added Hasher and TextStream.
2528
2529         * wtf/Hasher.h: Moved StringHasher into a separate header. Added Hasher.
2530         Marked IntegerHasher deprecated.
2531
2532         * wtf/text/CString.cpp: Include StringHasher.h instead of Hasher.h.
2533         * wtf/text/StringHash.h: Ditto.
2534
2535         * wtf/text/StringHasher.h: Added. Moved StringHasher here from Hasher.h.
2536
2537         * wtf/text/StringImpl.h: Include StringHasher.h instead of Hasher.h.
2538
2539         * wtf/text/WTFString.h: Added a hash function. This was useful in some
2540         adoption I was doing in WebCore, not included in this patch.
2541
2542         * wtf/unicode/UTF8.cpp: Include StringHasher.h instead of Hasher.h.
2543
2544 2017-12-02  Brady Eidson  <beidson@apple.com>
2545
2546         Factor out the "databaseTaskQueue" parts of IDBServer into something reusable.
2547         https://bugs.webkit.org/show_bug.cgi?id=180298
2548
2549         Reviewed by Chris Dumez.
2550
2551         * WTF.xcodeproj/project.pbxproj:
2552         * wtf/CMakeLists.txt:
2553
2554         * wtf/CrossThreadTaskHandler.cpp: Added.
2555         (WTF::CrossThreadTaskHandler::CrossThreadTaskHandler):
2556         (WTF::CrossThreadTaskHandler::~CrossThreadTaskHandler):
2557         (WTF::CrossThreadTaskHandler::postTask):
2558         (WTF::CrossThreadTaskHandler::postTaskReply):
2559         (WTF::CrossThreadTaskHandler::taskRunLoop):
2560         (WTF::CrossThreadTaskHandler::handleTaskRepliesOnMainThread):
2561         * wtf/CrossThreadTaskHandler.h: Added.
2562
2563 2017-12-01  Mark Lam  <mark.lam@apple.com>
2564
2565         Let's scramble ClassInfo pointers in cells.
2566         https://bugs.webkit.org/show_bug.cgi?id=180291
2567         <rdar://problem/35807620>
2568
2569         Reviewed by JF Bastien.
2570
2571         * wtf/ScrambledPtr.h:
2572         (WTF::ScrambledPtr::descrambled const):
2573         (WTF::ScrambledPtr::bits const):
2574         (WTF::ScrambledPtr::operator==):
2575         (WTF::ScrambledPtr::operator=):
2576         (WTF::ScrambledPtr::scramble):
2577         (WTF::ScrambledPtr::descramble):
2578         (WTF::ScrambledPtr:: const): Deleted.
2579         (WTF::ScrambledPtr::scrambledBits const): Deleted.
2580
2581 2017-12-01  Christopher Reid  <chris.reid@sony.com>
2582
2583         Move DateComponents into WTF
2584         https://bugs.webkit.org/show_bug.cgi?id=180211
2585
2586         Reviewed by Myles C. Maxfield.
2587
2588         Moved DateComponents from WebCore/platform into WTF.
2589         Removed isLeapYear from DateComponents as DateMath already has that function.
2590
2591         * WTF.xcodeproj/project.pbxproj:
2592         * wtf/CMakeLists.txt:
2593         * wtf/DateComponents.cpp: Renamed from Source\WebCore\platform\DateComponents.cpp.
2594         * wtf/DateComponents.h: Renamed from Source\WebCore\platform\DateComponents.h.
2595
2596 2017-12-01  Youenn Fablet  <youenn@apple.com>
2597
2598         Implement https://w3c.github.io/ServiceWorker/#clients-get
2599         https://bugs.webkit.org/show_bug.cgi?id=180167
2600
2601         Reviewed by Chris Dumez.
2602
2603         * wtf/text/StringView.h:
2604         (WTF::StringView::toUInt64Strict const):
2605         * wtf/text/WTFString.h:
2606
2607 2017-12-01  Brian Burg  <bburg@apple.com>
2608
2609         Web Inspector: move Inspector::Protocol::Array<T> to JSON namespace
2610         https://bugs.webkit.org/show_bug.cgi?id=173662
2611
2612         Reviewed by Joseph Pecoraro.
2613
2614         Move Inspector::Protocol::Array<T> to JSON::ArrayOf<T>.
2615
2616         * wtf/JSONValues.h:
2617         (WTF::JSONImpl::ArrayOf::ArrayOf):
2618         (WTF::JSONImpl::ArrayOf::openAccessors):
2619         (WTF::JSONImpl::ArrayOf::addItem):
2620         (WTF::JSONImpl::ArrayOf::create):
2621
2622 2017-12-01  Brady Eidson  <beidson@apple.com>
2623
2624         Add Internals.terminateServiceWorker, and the ability to restart service workers for postMessage.
2625         https://bugs.webkit.org/show_bug.cgi?id=180170
2626
2627         Reviewed by Chris Dumez.
2628
2629         * wtf/CompletionHandler.h:
2630         (WTF::CompletionHandler<Out):
2631
2632 2017-11-30  Yusuke Suzuki  <utatane.tea@gmail.com>
2633
2634         [JSC] Remove easy toRemove & map.remove() use in OAS phase
2635         https://bugs.webkit.org/show_bug.cgi?id=180208
2636
2637         Reviewed by Mark Lam.
2638
2639         * wtf/HashMap.h:
2640         (WTF::X>::removeIf):
2641         * wtf/HashSet.h:
2642         (WTF::V>::removeIf):
2643         * wtf/HashTable.h:
2644         (WTF::KeyTraits>::removeIf):
2645
2646 2017-11-30  Commit Queue  <commit-queue@webkit.org>
2647
2648         Unreviewed, rolling out r225362.
2649         https://bugs.webkit.org/show_bug.cgi?id=180225
2650
2651         removeIf predicate function can touch remove target set
2652         (Requested by yusukesuzuki on #webkit).
2653
2654         Reverted changeset:
2655
2656         "[JSC] Remove easy toRemove & map.remove() use"
2657         https://bugs.webkit.org/show_bug.cgi?id=180208
2658         https://trac.webkit.org/changeset/225362
2659
2660 2017-11-30  Mark Lam  <mark.lam@apple.com>
2661
2662         Let's scramble MacroAssemblerCodePtr values.
2663         https://bugs.webkit.org/show_bug.cgi?id=180169
2664         <rdar://problem/35758340>
2665
2666         Reviewed by Filip Pizlo, Saam Barati, and JF Bastien.
2667
2668         Introduce a ScrambledPtr class to facilitate scrambling.
2669
2670         * WTF.xcodeproj/project.pbxproj:
2671         * wtf/CMakeLists.txt:
2672         * wtf/ScrambledPtr.cpp: Added.
2673         (WTF::makeScrambledPtrKey):
2674         * wtf/ScrambledPtr.h: Added.
2675         (WTF::ScrambledPtr::ScrambledPtr):
2676         (WTF::ScrambledPtr::paranoidAssertIsScrambled const):
2677         (WTF::ScrambledPtr::paranoidAssertIsNotScrambled const):
2678         (WTF::ScrambledPtr:: const):
2679         (WTF::ScrambledPtr::operator-> const):
2680         (WTF::ScrambledPtr::scrambledBits const):
2681         (WTF::ScrambledPtr::operator! const):
2682         (WTF::ScrambledPtr::operator bool const):
2683         (WTF::ScrambledPtr::operator== const):
2684         (WTF::ScrambledPtr::operator==):
2685         (WTF::ScrambledPtr::scramble):
2686         (WTF::ScrambledPtr::descramble):
2687
2688 2017-11-30  Yusuke Suzuki  <utatane.tea@gmail.com>
2689
2690         [JSC] Remove easy toRemove & map.remove() use
2691         https://bugs.webkit.org/show_bug.cgi?id=180208
2692
2693         Reviewed by Mark Lam.
2694
2695         Return bool from removeIf. It is true if removeIf removes at least one entry.
2696         This interface is similar to existing HashSet::remove, which returns true
2697         if it actually removes entry.
2698
2699         * wtf/HashMap.h:
2700         (WTF::X>::removeIf):
2701         * wtf/HashSet.h:
2702         (WTF::V>::removeIf):
2703         * wtf/HashTable.h:
2704         (WTF::KeyTraits>::removeIf):
2705
2706 2017-11-30  Chris Dumez  <cdumez@apple.com>
2707
2708         Populate self.registration.installing/waiting/active inside service workers
2709         https://bugs.webkit.org/show_bug.cgi?id=180168
2710
2711         Reviewed by Brady Eidson.
2712
2713         Add CrossThreadCopier support for std::optional<>.
2714
2715         * wtf/CrossThreadCopier.h:
2716
2717 2017-11-29  JF Bastien  <jfbastien@apple.com>
2718
2719         WTF / bmalloc: don't write to 0xbbadbeef when ASAN is looking
2720         https://bugs.webkit.org/show_bug.cgi?id=180175
2721
2722         Reviewed by Mark Lam.
2723
2724         ASAN knows that 0xbbadbeef is a bbad aaddress, and tells us so
2725         when we write to it, say in an assert. That creates bbad error
2726         reports where ASAN thinks we write to an invalid address, instead
2727         of thinking that we hit an assertion. In some cases, tooling that
2728         use fuzzers aggregate similar issues, and think that we just have
2729         the one bug and not a bunch of different asserts.
2730
2731         * wtf/Assertions.cpp:
2732         * wtf/Assertions.h:
2733
2734 2017-11-29  Filip Pizlo  <fpizlo@apple.com>
2735
2736         GC should support isoheaps
2737         https://bugs.webkit.org/show_bug.cgi?id=179288
2738
2739         Reviewed by Saam Barati.
2740         
2741         One of my favorite data structures in the GC is a singly-linked list that knows its tail, so that
2742         things get added to it at the end rather that at the beginning. In this patch, I use this to put
2743         the same node on multiple lists, which our existing linked list templates also don't support.
2744         
2745         This adds a new linked list that does those things:
2746         
2747         - It supports append(). It could also support prepend(), but currently there is no need for it.
2748         
2749         - It supports nodes that are on multiple lists. The GC uses std::mem_fn() to create a lambda that the
2750           list uses to set next.
2751
2752         * WTF.xcodeproj/project.pbxproj:
2753         * wtf/SinglyLinkedListWithTail.h: Added.
2754         (WTF::SinglyLinkedListWithTail::isEmpty const):
2755         (WTF::SinglyLinkedListWithTail::append):
2756         (WTF::SinglyLinkedListWithTail::first const):
2757         (WTF::SinglyLinkedListWithTail::last const):
2758
2759 2017-11-29  Stanislav Ocovaj  <stanislav.ocovaj@rt-rk.com>
2760
2761         [DFG][MIPS] Enable DFG JIT on MIPS.
2762         https://bugs.webkit.org/show_bug.cgi?id=175447
2763
2764         Reviewed by Carlos Alberto Lopez Perez.
2765
2766         * wtf/Platform.h:
2767
2768 2017-11-29  Matt Lewis  <jlewis3@apple.com>
2769
2770         Unreviewed, rolling out r225286.
2771
2772         The source files within this patch have been marked as
2773         executable.
2774
2775         Reverted changeset:
2776
2777         "[MIPS][JSC] Implement MacroAssembler::probe support on MIPS"
2778         https://bugs.webkit.org/show_bug.cgi?id=175447
2779         https://trac.webkit.org/changeset/225286
2780
2781 2017-11-29  Stanislav Ocovaj  <stanislav.ocovaj@rt-rk.com>
2782
2783         [DFG][MIPS] Enable DFG JIT on MIPS.
2784         https://bugs.webkit.org/show_bug.cgi?id=175447
2785
2786         Reviewed by Carlos Alberto Lopez Perez.
2787
2788         * wtf/Platform.h:
2789
2790 2017-11-14  Carlos Garcia Campos  <cgarcia@igalia.com>
2791
2792         Move JSONValues to WTF and convert uses of InspectorValues.h to JSONValues.h
2793         https://bugs.webkit.org/show_bug.cgi?id=173793
2794
2795         Reviewed by Joseph Pecoraro.
2796
2797         Based on patch by Brian Burg.
2798
2799         Move the implementation into WTF. Put the actual implementation inside
2800         namespace WTF::JSONImpl so that the symbols in libwtf start with the WTF prefix.
2801         Also provide a top-level JSON namespace so that clients can write JSON::Value.
2802         This is essentially a typedef for the entire WTF::JSONImpl namespace.
2803
2804         * WTF.xcodeproj/project.pbxproj:
2805         * wtf/CMakeLists.txt:
2806         * wtf/JSONValues.cpp: Renamed from Source/JavaScriptCore/inspector/InspectorValues.cpp.
2807         (JSON::Value::null):
2808         (JSON::Value::create):
2809         (JSON::Value::asValue):
2810         (JSON::Value::asObject):
2811         (JSON::Value::asArray):
2812         (JSON::Value::parseJSON):
2813         (JSON::Value::toJSONString const):
2814         (JSON::Value::asBoolean const):
2815         (JSON::Value::asDouble const):
2816         (JSON::Value::asInteger const):
2817         (JSON::Value::asString const):
2818         (JSON::Value::writeJSON const):
2819         (JSON::Value::memoryCost const):
2820         (JSON::ObjectBase::~ObjectBase):
2821         (JSON::ObjectBase::asObject):
2822         (JSON::ObjectBase::openAccessors):
2823         (JSON::ObjectBase::memoryCost const):
2824         (JSON::ObjectBase::getBoolean const):
2825         (JSON::ObjectBase::getString const):
2826         (JSON::ObjectBase::getObject const):
2827         (JSON::ObjectBase::getArray const):
2828         (JSON::ObjectBase::getValue const):
2829         (JSON::ObjectBase::remove):
2830         (JSON::ObjectBase::writeJSON const):
2831         (JSON::ObjectBase::ObjectBase):
2832         (JSON::ArrayBase::~ArrayBase):
2833         (JSON::ArrayBase::asArray):
2834         (JSON::ArrayBase::writeJSON const):
2835         (JSON::ArrayBase::ArrayBase):
2836         (JSON::ArrayBase::get const):
2837         (JSON::Object::create):
2838         (JSON::Array::create):
2839         (JSON::ArrayBase::memoryCost const):
2840         * wtf/JSONValues.h: Renamed from Source/JavaScriptCore/inspector/InspectorValues.h.
2841         (JSON::ObjectBase::find):
2842         (JSON::ObjectBase::find const):
2843         (JSON::ObjectBase::setBoolean):
2844         (JSON::ObjectBase::setInteger):
2845         (JSON::ObjectBase::setDouble):
2846         (JSON::ObjectBase::setString):
2847         (JSON::ObjectBase::setValue):
2848         (JSON::ObjectBase::setObject):
2849         (JSON::ObjectBase::setArray):
2850         (JSON::ArrayBase::pushBoolean):
2851         (JSON::ArrayBase::pushInteger):
2852         (JSON::ArrayBase::pushDouble):
2853         (JSON::ArrayBase::pushString):
2854         (JSON::ArrayBase::pushValue):
2855         (JSON::ArrayBase::pushObject):
2856         (JSON::ArrayBase::pushArray):
2857
2858 2017-11-28  Simon Fraser  <simon.fraser@apple.com>
2859
2860         Modernize GraphicsLayer dumping
2861         https://bugs.webkit.org/show_bug.cgi?id=180067
2862
2863         Reviewed by Sam Weinig.
2864         
2865         Expose the current indent.
2866
2867         * wtf/text/TextStream.h:
2868         (WTF::TextStream::indent const):
2869
2870 2017-11-27  Chris Dumez  <cdumez@apple.com>
2871
2872         Move callOnMainThreadAndWait() from SocketStreamHandleImplCFNet.cpp to MainThread.h
2873         https://bugs.webkit.org/show_bug.cgi?id=180060
2874
2875         Reviewed by Alex Christensen.
2876
2877         Move callOnMainThreadAndWait() from SocketStreamHandleImplCFNet.cpp to MainThread.h so that it can be reused.
2878
2879         * wtf/MainThread.cpp:
2880         (WTF::callOnMainThreadAndWait):
2881         * wtf/MainThread.h:
2882
2883 2017-11-27  Simon Fraser  <simon.fraser@apple.com>
2884
2885         Use TextStream's indent tracking, rather than passing indent to all the externalRepresentation() functions
2886         https://bugs.webkit.org/show_bug.cgi?id=180027
2887
2888         Reviewed by Jon Lee.
2889
2890         Remove all the indent arguments, and make use of TextStream::IndentScope to control
2891         output indentation.
2892
2893         Add an indent stream manipulator so you can say
2894           ts << indent << "text"
2895         to write the indent.
2896
2897         * wtf/text/TextStream.h:
2898         (WTF::TextStream::IndentScope::IndentScope):
2899         (WTF::TextStream::IndentScope::~IndentScope):
2900
2901 2016-08-05  Darin Adler  <darin@apple.com>
2902
2903         Fix some minor problems in the StringImpl header
2904         https://bugs.webkit.org/show_bug.cgi?id=160630
2905
2906         Reviewed by Brent Fulgham.
2907
2908         * wtf/text/AtomicString.h: Update since CharacterMatchFunctionPtr is now
2909         CodeUnitMatchFunction.
2910
2911         * wtf/text/StringCommon.h: Added CodeUnitMatchFunction, which replaces
2912         CharacterMatchFunctionPtr.
2913
2914         * wtf/text/StringImpl.cpp:
2915         (WTF::StringImpl::stripMatchedCharacters): Changed template argument name
2916         to CodeUnitPredicate to help make it clear this works on code units, not
2917         code points.
2918         (WTF::UCharPredicate): Deleted.
2919         (WTF::SpaceOrNewlinePredicate): Deleted.
2920         (WTF::StringImpl::stripWhiteSpace): Removed unneeded use of predicate class to
2921         turn a function into a functor; functions already work fine as functors without
2922         a class wrapping them.
2923         (WTF::StringImpl::stripLeadingAndTrailingCharacters): Ditto. Also renamed
2924         from stripWhiteSpace, since it strips arbitrary characters.
2925         (WTF::StringImpl::removeCharacters): Fixed various minor style issues and
2926         updated to new type name.
2927         (WTF::StringImpl::simplifyMatchedCharactersToSpace): Ditto.
2928         (WTF::StringImpl::simplifyWhiteSpace): More of the same.
2929         (WTF::StringImpl::find): Ditto.
2930
2931         * wtf/text/StringImpl.h: Removed unneeded include of uchar.h, since it's
2932         included by StringCommon.h. Removed =CharacterMatchFunctionPtr and
2933         IsWhiteSpaceFunctionPtr, both replaced by CodeUnitMatchFunction. Fixed
2934         a mistake recently introduced in isSpaceOrNewline, which was unnecessarily,
2935         inefficiently using ICU for non-ASCII Latin-1 characters.
2936
2937         * wtf/text/StringView.h: Use CodeUnitMatchFunction instead of CharacterMatchFunction.
2938
2939         * wtf/text/WTFString.cpp:
2940         (WTF::String::stripLeadingAndTrailingCharacters): Updated function name and type.
2941         (WTF::String::simplifyWhiteSpace): Updated type.
2942         (WTF::String::removeCharacters): Updated type.
2943         * wtf/text/WTFString.h: Ditto.
2944
2945 2017-11-23  Darin Adler  <darin@apple.com>
2946
2947         Fix dictionary leak in lookup, convert FindOptions to OptionSet, tweak code style nearby
2948         https://bugs.webkit.org/show_bug.cgi?id=179981
2949
2950         Reviewed by Sam Weinig.
2951
2952         * wtf/OptionSet.h: Added some operators so it's easier to use | and - with individual
2953         options from the set.
2954
2955 2017-11-23  Darin Adler  <darin@apple.com>
2956
2957         Reduce WTF::String operations that do unnecessary Unicode operations instead of ASCII
2958         https://bugs.webkit.org/show_bug.cgi?id=179907
2959
2960         Reviewed by Sam Weinig.
2961
2962         * wtf/text/ASCIIFastPath.h: Moved the using for charactersAreAllASCII here since
2963         the function is defined here.
2964
2965         * wtf/text/AtomicString.h: Removed overloads of contains, find, startsWith, and
2966         endsWith that take a boolean indicating whether they should be "case sensitive".
2967         When false, this was doing Unicode case folding, and no callers needed that.
2968         Also tweaked formatting and argument names.
2969
2970         * wtf/text/IntegerToStringConversion.h: Added an include of LChar.h since this file
2971         uses that. Also tweaked formatting a bit.
2972
2973         * wtf/text/StringImpl.cpp:
2974         (WTF::StringImpl::containsOnlyWhitespace): Deleted. Despite its name sounding like
2975         it used the full Unicode whitespace definition, this actually checked isASCIISpace.
2976         Callers now all use isAllSpecialCharacters instead with the whitespace definition
2977         that is appropriate to each call site.
2978         (WTF::latin1CaseFoldTable): Deleted.
2979         (WTF::equalCompatibilityCaseless): Deleted.
2980         (WTF::StringImpl::findIgnoringCase): Deleted.
2981         (WTF::findIgnoringCaseInner): Deleted.
2982         (WTF::reverseFindIgnoringCaseInner): Deleted.
2983         (WTF::StringImpl::reverseFindIgnoringCase): Deleted.
2984         (WTF::equalInner): Removed boolean caseSensitive argument.
2985         (WTF::StringImpl::startsWith): Ditto.
2986         (WTF::StringImpl::endsWith): Ditto.
2987
2988         * wtf/text/StringImpl.h: Moved TextCaseSensitivity out into a different header.
2989         Moved ASCIIFastPath.h include here from WTFString.h. Moved isAllSpecialCharacters
2990         free function here from WTFString.h. Moved lots of function bodies out of class
2991         definitions to make the class definitions easier to read. Sorted things a bit.
2992         Tweaked formatting. Marked constructor that takes one argument explicit. Added
2993         an isEmpty function like the one in String. Renamed copyChars to copyCharacters.
2994         Added isAllASCII, isAllLatin1 and isAllSpecialCharacters functions. Removed
2995         boolean caseSensitive arguments from various functions. Removed findIgnoringCase
2996         and reverseFindIgnoringCase. Added a FIXME to codePointCompare about the way it
2997         treats null and empty strings as equal. Changed length argument in remove to
2998         unsigned to match other lengths.
2999
3000         * wtf/text/WTFString.cpp:
3001         (WTF::String::removeInternal): Changed length argument to be unsigned.
3002         (WTF::createWithFormatAndArguments): Use emptyString.
3003         (WTF::String::isSafeToSendToAnotherThread const): Rewrote to be easier to read.
3004
3005         * wtf/text/WTFString.h: Moved ASCIIFastPath.h to StringImpl.h. Moved lots of
3006         function bodies out of class definitions to make the class definitions easier
3007         to read, made others one-liners. Removed the String::at function but kept the
3008         String::characterAt function; the two were identical. Removed boolean
3009         caseSensitive arguments from various functions. Removed findIgnoringCase and
3010         reverseFindIgnoringCase. Renamed containsOnlyASCII to isAllASCII and
3011         containsOnlyLatin1 to isAllLatin1 to match the naming of isAllSpecialCharacters.
3012         Moved the inline implementations of functions that are defined above further
3013         down, after things like the ASCIILiteral class and various functions.
3014
3015         * wtf/text/icu/UTextProviderLatin1.cpp: Updated name of copyChars.
3016
3017 2017-11-22  Stephan Szabo  <stephan.szabo@sony.com>
3018
3019         tuple related items are used in WTF without including tuple
3020         https://bugs.webkit.org/show_bug.cgi?id=179926
3021
3022         Reviewed by Darin Adler.
3023
3024         * wtf/HashFunctions.h:
3025         * wtf/PrintStream.h:
3026         * wtf/threads/Signals.h:
3027
3028 2017-11-21  Zan Dobersek  <zdobersek@igalia.com>
3029
3030         Drop ENABLE_IMAGE_DECODER_DOWN_SAMPLING code
3031         https://bugs.webkit.org/show_bug.cgi?id=179921
3032
3033         Reviewed by Carlos Garcia Campos.
3034
3035         * wtf/FeatureDefines.h: Remove the ENABLE_IMAGE_DECODER_DOWN_SAMPLING
3036         definition.
3037
3038 2017-11-19  Tim Horton  <timothy_horton@apple.com>
3039
3040         Remove unused TOUCH_ICON_LOADING feature flag
3041         https://bugs.webkit.org/show_bug.cgi?id=179873
3042
3043         Reviewed by Simon Fraser.
3044
3045         * wtf/FeatureDefines.h:
3046
3047 2017-11-19  Yusuke Suzuki  <utatane.tea@gmail.com>
3048
3049         Add CPU(UNKNOWN) to cover all the unknown CPU types
3050         https://bugs.webkit.org/show_bug.cgi?id=179243
3051
3052         Reviewed by JF Bastien.
3053
3054         This patch adds a new CPU type, `CPU(UNKNOWN)` to cover all the unknown CPUs.
3055         This CPU architecture tells conservative assumption to make JSC work on all
3056         the unknown generic CPUs. And we make several CPUs (ALPHA, SH4, S390, S390X, IA64, IA64_32)
3057         UNKNOWN.
3058
3059         We also make InlineASM available only for !CPU(UNKNOWN). In an unknown CPU, inline asm is not useful.
3060
3061         And we also introduce a generic way to detect 64bit pointer environment by using
3062         __SIZEOF_POINTER__ predefined macro, or `UINTPTR_MAX > UINT32_MAX`.
3063
3064         * wtf/InlineASM.h:
3065         * wtf/Platform.h:
3066         * wtf/dtoa/utils.h:
3067
3068 2017-11-19  Tim Horton  <timothy_horton@apple.com>
3069
3070         Remove unused LEGACY_VENDOR_PREFIXES feature flag
3071         https://bugs.webkit.org/show_bug.cgi?id=179872
3072
3073         Reviewed by Darin Adler.
3074
3075         * wtf/FeatureDefines.h:
3076
3077 2017-11-19  Chris Dumez  <cdumez@apple.com>
3078
3079         Fix potential thread safety issue in ThreadSafeIdentified
3080         https://bugs.webkit.org/show_bug.cgi?id=179879
3081
3082         Reviewed by Darin Adler.
3083
3084         Fix potential thread safety issue in ThreadSafeIdentified. Protect static std::atomic
3085         initialization with an std::call_once() given that we build with
3086         --fno-threadsafe-statics.
3087
3088         * wtf/Identified.h:
3089         (WTF::Identified::Identified):
3090         (WTF::Identified::generateIdentifier):
3091         (WTF::ThreadSafeIdentified::ThreadSafeIdentified):
3092         (WTF::ThreadSafeIdentified::generateIdentifier):
3093
3094 2017-11-18  Darin Adler  <darin@apple.com>
3095
3096         Eliminate some cases of double hashing, other related refactoring
3097         https://bugs.webkit.org/show_bug.cgi?id=179867
3098
3099         Reviewed by Sam Weinig.
3100
3101         * wtf/text/StringImpl.cpp:
3102         (WTF::StringImpl::containsOnlyWhitespace): Added FIXME.
3103
3104 2017-11-19  Chris Dumez  <cdumez@apple.com>
3105
3106         Fix potential thread safety issue in generateThreadSafeObjectIdentifier()
3107         https://bugs.webkit.org/show_bug.cgi?id=179877
3108
3109         Reviewed by Sam Weinig.
3110
3111         Fix potential thread safety issue in generateThreadSafeObjectIdentifier().
3112         Protect std::atomic initialization with an std::call_once() given that we
3113         build with --fno-threadsafe-statics.
3114
3115         * wtf/ObjectIdentifier.h:
3116         (WTF::generateThreadSafeObjectIdentifier):
3117
3118 2017-11-18  Yusuke Suzuki  <utatane.tea@gmail.com>
3119
3120         [WTF] Use system endianess information instead of relying CPU information
3121         https://bugs.webkit.org/show_bug.cgi?id=179861
3122
3123         Reviewed by JF Bastien.
3124
3125         Currently, we use known CPU information to determine endianess of the current
3126         architecture. But this means that unknown CPU does not work well in WebKit
3127         withou modifying code. Instead, we use compiler or system's macro to determine
3128         endianess. This paves the way to dropping many CPUs in Platform.h by replacing
3129         them with CPU(UNKNOWN)[1].
3130
3131         [1]: https://bugs.webkit.org/show_bug.cgi?id=179243
3132
3133         * wtf/Platform.h:
3134
3135 2017-11-18  Chris Dumez  <cdumez@apple.com>
3136
3137         ASSERTION FAILED: registration in WebCore::SWServerJobQueue::scriptContextStarted(ServiceWorkerIdentifier)
3138         https://bugs.webkit.org/show_bug.cgi?id=179846
3139
3140         Reviewed by Darin Adler.
3141
3142         Add a generateThreadSafeObjectIdentifier() for generating an ObjectIdentifier
3143         in a thread-safe manner, using std::atomic.
3144
3145         * wtf/ObjectIdentifier.h:
3146         (WTF::generateObjectIdentifier):
3147         (WTF::generateThreadSafeObjectIdentifier):
3148
3149 2017-11-18  Yusuke Suzuki  <utatane.tea@gmail.com>
3150
3151         [WTF] Remove CPU(HPPA) in StackBounds by using runtime stack direction test
3152         https://bugs.webkit.org/show_bug.cgi?id=179859
3153
3154         Reviewed by JF Bastien.
3155
3156         Currently, we know that CPU(HPPA)'s stack direction is upward! But listing
3157         CPU architectures here is not a scalable way.
3158
3159         Instead, we use runtime stack direction test. By doing so, we can handle
3160         such a strange architecture without listing the CPU to Platform.h. This paves
3161         the way to dropping many CPUs in Platform.h by replacing them with CPU(UNKNOWN)[1].
3162
3163         We also fix StackBounds::isGrowingDownward().
3164
3165         [1]: https://bugs.webkit.org/show_bug.cgi?id=179243
3166
3167         * wtf/StackBounds.cpp:
3168         (WTF::StackBounds::stackDirection):
3169         (WTF::testStackDirection2):
3170         (WTF::testStackDirection):
3171         (WTF::StackBounds::newThreadStackBounds):
3172         (WTF::StackBounds::currentThreadStackBoundsInternal):
3173         * wtf/StackBounds.h:
3174         (WTF::StackBounds::isGrowingDownward const):
3175
3176 2017-11-17  Chris Dumez  <cdumez@apple.com>
3177
3178         Use a strongly typed identifier for SWServer::Connection
3179         https://bugs.webkit.org/show_bug.cgi?id=179848
3180
3181         Reviewed by Brady Eidson.
3182
3183         Make ObjectIdentifier a little more flexible to support more use cases.
3184
3185         * wtf/ObjectIdentifier.h:
3186         (WTF::ObjectIdentifier::toUInt64 const):
3187         (WTF::makeObjectIdentifier):
3188
3189 2017-11-17  Simon Fraser  <simon.fraser@apple.com>
3190
3191         Add a TimingScope class for microbenchmarking sections of code
3192         https://bugs.webkit.org/show_bug.cgi?id=179825
3193
3194         Reviewed by Zalan Bujtas.
3195         
3196         Add a class, similar to B3TimingScope, which makes it easy to microbenchmark
3197         sections of code. Use looks like:
3198         
3199         TimingScope scope("some label", 100);
3200         
3201         where this will print mean scope duration every 100 calls. Sample output:
3202         
3203             FETurbulence::platformApplySoftware: 100 calls, mean duration: 3.073181ms
3204             FETurbulence::platformApplySoftware: 200 calls, mean duration: 3.074612ms
3205             FETurbulence::platformApplySoftware: 300 calls, mean duration: 3.065722ms
3206         
3207         Because TimingScope needs to store state beween invocations, and there may be
3208         multiple TimingScopes in use at the same time, data is stored in a global
3209         hash map with atomic access.
3210
3211         * WTF.xcodeproj/project.pbxproj:
3212         * wtf/CMakeLists.txt:
3213         * wtf/TimingScope.cpp: Added.
3214         (WTF::TimingScope::scopeDidEnd):
3215         * wtf/TimingScope.h: Added.
3216         (WTF::TimingScope::TimingScope):
3217         (WTF::TimingScope::~TimingScope):
3218
3219 2017-11-17  Alex Christensen  <achristensen@webkit.org>
3220
3221         Clean up after r224952
3222         https://bugs.webkit.org/show_bug.cgi?id=179809
3223
3224         Reviewed by Brady Eidson.
3225
3226         * wtf/MainThread.cpp:
3227         (WTF::dispatchFunctionsFromMainThread):
3228         (WTF::callOnMainThread):
3229         * wtf/MainThread.h:
3230         * wtf/generic/MainThreadGeneric.cpp:
3231         (WTF::scheduleDispatchFunctionsOnMainThread):
3232         (WTF::currentRunLoopInCommonMode): Deleted.
3233         * wtf/mac/MainThreadMac.mm:
3234         (WTF::scheduleDispatchFunctionsOnMainThread):
3235         (WTF::currentRunLoopInCommonMode): Deleted.
3236         * wtf/win/MainThreadWin.cpp:
3237         (WTF::scheduleDispatchFunctionsOnMainThread):
3238         (WTF::currentRunLoopInCommonMode): Deleted.
3239
3240 2017-11-15  Alex Christensen  <achristensen@webkit.org>
3241
3242         Fix fast/events/message-port-postMessage-recursive.html after r224896
3243         https://bugs.webkit.org/show_bug.cgi?id=179749
3244
3245         Reviewed by Jer Noble.
3246
3247         * wtf/mac/MainThreadMac.mm:
3248         (WTF::currentRunLoopInCommonMode):
3249         We sometimes run the runloop in kCFRunLoopDefaultMode, which should also have the responsiveness optimization.
3250         This allows the runloop to continue to iterate when we are doing lots of things on the main thread.
3251         CFRunLoop.h has a special definition of these two constants.
3252
3253 2017-11-15  Alex Christensen  <achristensen@webkit.org>
3254
3255         WebViews scheduled in custom run loop modes should be able to do more than 50ms of work at a time
3256         https://bugs.webkit.org/show_bug.cgi?id=179742
3257         <rdar://problem/35519421>
3258
3259         Reviewed by Jer Noble.
3260         
3261         In r224687 I fixed loading from scheduled WebViews with custom run loop modes, but in 
3262         dispatchFunctionsFromMainThread we have an optimization to yield the run loop if we have already
3263         done more than 50ms of work on the main thread in this run loop iteration.  When this happens
3264         and we are running in a custom run loop mode, we disable this responsiveness optimization.
3265         We are calling CFRunLoopRunInMode or [NSRunLoop acceptInputForMode:beforeDate:] in a while loop anyways,
3266         so we would not benefit from a responsiveness optimization.  We definitely don't want to reschedule
3267         on the main thread in the common run loop mode in this case.
3268
3269         * wtf/MainThread.cpp:
3270         (WTF::dispatchFunctionsFromMainThread):
3271         * wtf/MainThread.h:
3272         * wtf/generic/MainThreadGeneric.cpp:
3273         (WTF::currentRunLoopInCommonMode):
3274         * wtf/mac/MainThreadMac.mm:
3275         (WTF::currentRunLoopInCommonMode):
3276         * wtf/win/MainThreadWin.cpp:
3277         (WTF::currentRunLoopInCommonMode):
3278
3279 2017-11-15  Ryan Haddad  <ryanhaddad@apple.com>
3280
3281         Unreviewed, rolling out r224863.
3282
3283         Introduced LayoutTest crashes on iOS Simulator.
3284
3285         Reverted changeset:
3286
3287         "Move JSONValues to WTF and convert uses of InspectorValues.h
3288         to JSONValues.h"
3289         https://bugs.webkit.org/show_bug.cgi?id=173793
3290         https://trac.webkit.org/changeset/224863
3291
3292 2017-11-14  Carlos Garcia Campos  <cgarcia@igalia.com>
3293
3294         Move JSONValues to WTF and convert uses of InspectorValues.h to JSONValues.h
3295         https://bugs.webkit.org/show_bug.cgi?id=173793
3296
3297         Reviewed by Brian Burg.
3298
3299         * WTF.xcodeproj/project.pbxproj:
3300         * wtf/CMakeLists.txt:
3301         * wtf/JSONValues.cpp: Renamed from Source/JavaScriptCore/inspector/InspectorValues.cpp.
3302         (JSON::Value::null):
3303         (JSON::Value::create):
3304         (JSON::Value::asValue):
3305         (JSON::Value::asObject):
3306         (JSON::Value::asArray):
3307         (JSON::Value::parseJSON):
3308         (JSON::Value::toJSONString const):
3309         (JSON::Value::asBoolean const):
3310         (JSON::Value::asDouble const):
3311         (JSON::Value::asInteger const):
3312         (JSON::Value::asString const):
3313         (JSON::Value::writeJSON const):
3314         (JSON::Value::memoryCost const):
3315         (JSON::ObjectBase::~ObjectBase):
3316         (JSON::ObjectBase::asObject):
3317         (JSON::ObjectBase::openAccessors):
3318         (JSON::ObjectBase::memoryCost const):
3319         (JSON::ObjectBase::getBoolean const):
3320         (JSON::ObjectBase::getString const):
3321         (JSON::ObjectBase::getObject const):
3322         (JSON::ObjectBase::getArray const):
3323         (JSON::ObjectBase::getValue const):
3324         (JSON::ObjectBase::remove):
3325         (JSON::ObjectBase::writeJSON const):
3326         (JSON::ObjectBase::ObjectBase):
3327         (JSON::ArrayBase::~ArrayBase):
3328         (JSON::ArrayBase::asArray):
3329         (JSON::ArrayBase::writeJSON const):
3330         (JSON::ArrayBase::ArrayBase):
3331         (JSON::ArrayBase::get const):
3332         (JSON::Object::create):
3333         (JSON::Array::create):
3334         (JSON::ArrayBase::memoryCost const):
3335         * wtf/JSONValues.h: Renamed from Source/JavaScriptCore/inspector/InspectorValues.h.
3336         (JSON::ObjectBase::find):
3337         (JSON::ObjectBase::find const):
3338         (JSON::ObjectBase::setBoolean):
3339         (JSON::ObjectBase::setInteger):
3340         (JSON::ObjectBase::setDouble):
3341         (JSON::ObjectBase::setString):
3342         (JSON::ObjectBase::setValue):
3343         (JSON::ObjectBase::setObject):
3344         (JSON::ObjectBase::setArray):
3345         (JSON::ArrayBase::pushBoolean):
3346         (JSON::ArrayBase::pushInteger):
3347         (JSON::ArrayBase::pushDouble):
3348         (JSON::ArrayBase::pushString):
3349         (JSON::ArrayBase::pushValue):
3350         (JSON::ArrayBase::pushObject):
3351         (JSON::ArrayBase::pushArray):
3352
3353 2017-11-14  Alex Christensen  <achristensen@webkit.org>
3354
3355         Remove Cocoa CFURLConnection loading code
3356         https://bugs.webkit.org/show_bug.cgi?id=179688
3357
3358         Reviewed by Antti Koivisto.
3359
3360         * wtf/SchedulePair.h:
3361         * wtf/SchedulePairMac.mm:
3362
3363 2017-11-13  Brady Eidson  <beidson@apple.com>
3364
3365         Massive "Server-process-to-context-process" connection overhaul.
3366         https://bugs.webkit.org/show_bug.cgi?id=179554
3367
3368         Reviewed by Chris Dumez.
3369
3370         * wtf/ObjectIdentifier.h:
3371         (WTF::generateObjectIdentifier):
3372         (WTF::makeObjectIdentifier): Deleted.
3373
3374 2017-11-13  JF Bastien  <jfbastien@apple.com>
3375
3376         std::expected: fix and test move
3377         https://bugs.webkit.org/show_bug.cgi?id=179617
3378
3379         Reviewed by Alex Christensen.
3380
3381         Non-copyable move types should be able to be in an expected
3382         properly.
3383
3384         * wtf/Expected.h:
3385         (WTF::Expected::value const):
3386         (WTF::Expected::error):
3387         (WTF::Expected::error const):
3388
3389 2017-11-10  Jer Noble  <jer.noble@apple.com>
3390
3391         Add a FairPlay Streaming based CDM for Modern EME
3392         https://bugs.webkit.org/show_bug.cgi?id=179499
3393         <rdar://problem/35445033>
3394
3395         Reviewed by Eric Carlson.
3396
3397         * wtf/Platform.h:
3398
3399 2017-11-10  Alex Christensen  <achristensen@webkit.org>
3400
3401         REGRESSION(r224267): WebViews scheduled with custom run loop modes don't load
3402         https://bugs.webkit.org/show_bug.cgi?id=179515
3403         <rdar://problem/35445245>
3404
3405         Reviewed by Andy Estes.
3406
3407         * wtf/MainThread.cpp:
3408         (WTF::callOnMainThread):
3409         * wtf/MainThread.h:
3410         (WTF::callOnMainThread):
3411         (WTF::scheduleDispatchFunctionsOnMainThread):
3412         * wtf/generic/MainThreadGeneric.cpp:
3413         (WTF::scheduleDispatchFunctionsOnMainThread):
3414         * wtf/mac/MainThreadMac.mm:
3415         (WTF::scheduleDispatchFunctionsOnMainThread):
3416         * wtf/win/MainThreadWin.cpp:
3417         (WTF::scheduleDispatchFunctionsOnMainThread):
3418         Add an optional parameter which is an array of run loop mode names to pass to performSelectorOnMainThread.
3419
3420 2017-11-10  Ms2ger  <Ms2ger@igalia.com>
3421
3422         Export tryFastZeroedMalloc.
3423         https://bugs.webkit.org/show_bug.cgi?id=179051
3424
3425         Reviewed by Michael Catanzaro.
3426
3427         The other functions were exported in bug 72855. There does not seem to be a
3428         reason not to export this one.
3429
3430         * wtf/FastMalloc.h:
3431
3432 2017-11-09  Chris Dumez  <cdumez@apple.com>
3433
3434         Unreviewed, rolling out r224661.
3435
3436         Broke build on several internal Mac/iOS bots
3437
3438         Reverted changeset:
3439
3440         "Ignore HSTS for partitioned, cross-origin subresource
3441         requests"
3442         https://bugs.webkit.org/show_bug.cgi?id=178993
3443         https://trac.webkit.org/changeset/224661
3444
3445 2017-11-09  John Wilander  <wilander@apple.com>
3446
3447         Ignore HSTS for partitioned, cross-origin subresource requests
3448         https://bugs.webkit.org/show_bug.cgi?id=178993
3449         <rdar://problem/34962462>
3450
3451         Reviewed by Brent Fulgham.
3452
3453         * wtf/Platform.h:
3454             Added HAVE_CFNETWORK_IGNORE_HSTS.
3455
3456 2017-11-08  Tim Horton  <timothy_horton@apple.com>
3457
3458         [ios-simulator] API test WebKit.BundleParameters is a flaky failure
3459         https://bugs.webkit.org/show_bug.cgi?id=178363
3460         <rdar://problem/35043144>
3461
3462         Reviewed by Brent Fulgham.
3463
3464         * wtf/RefCounter.h:
3465         (WTF::RefCounter<T>::Count::deref):
3466         (WTF::RefCounter<T>::Count::refCounterWasDeleted):
3467         (WTF::RefCounter<T>::~RefCounter):
3468         If a RefCounter::Count is deref()'d and drops its RefCounter's value to
3469         zero, and the RefCounter is deleted in that valueDidChangeCallback, it
3470         will delete the Counter that is in the middle of deref(). Keep track
3471         of whether we're inside the callback and defer the deletion until
3472         the end of deref().
3473
3474 2017-11-07  Maciej Stachowiak  <mjs@apple.com>
3475
3476         Get rid of unsightly hex numbers from unified build object files
3477         https://bugs.webkit.org/show_bug.cgi?id=179410
3478
3479         Reviewed by Saam Barati.
3480
3481         * Scripts/generate-unified-source-bundles.rb: For extensions other than "cpp", also include 
3482         the extension in the base name of the file, to avoid ugly Xcode-generated object file names.
3483
3484 2017-11-07  Filip Pizlo  <fpizlo@apple.com>
3485
3486         Disable isoheaps on iOS
3487
3488         Reviewed by Ryosuke Niwa.
3489
3490         * wtf/IsoMalloc.h:
3491
3492 2017-11-07  Brady Eidson  <beidson@apple.com>
3493
3494         Implement "UpdateWorkerState" and use it
3495         https://bugs.webkit.org/show_bug.cgi?id=179318
3496
3497         Reviewed by Chris Dumez.
3498
3499         * wtf/ObjectIdentifier.h:
3500         (WTF::ObjectIdentifier::loggingString const):
3501
3502 2017-11-07  Michael Saboff  <msaboff@apple.com>
3503
3504         Add SPI function pointers qualifiers for CPU(ARM64E)
3505         https://bugs.webkit.org/show_bug.cgi?id=179383
3506
3507         Reviewed by Mark Lam.
3508
3509         For ARM64E, use the appropriate SPI qualifiers for helper function pointers.
3510
3511         * wtf/BlockPtr.h:
3512         (WTF::BlockPtr<R):
3513
3514 2017-10-31  Filip Pizlo  <fpizlo@apple.com>
3515
3516         bmalloc should support strictly type-segregated isolated heaps
3517         https://bugs.webkit.org/show_bug.cgi?id=178108
3518
3519         Reviewed by Saam Barati, Simon Fraser, and Ryosuke Niwa.
3520         
3521         This just adds an easy way of using the bmalloc IsoHeap API in WebKit. If bmalloc is not
3522         enabled, these macros will just make the object FastMalloced.
3523
3524         * WTF.xcodeproj/project.pbxproj:
3525         * wtf/FastTLS.h:
3526         * wtf/IsoMalloc.h: Added.
3527         * wtf/IsoMallocInlines.h: Added.
3528
3529 2017-11-06  Christopher Reid  <chris.reid@sony.com>
3530
3531         Use enum classes within FileSystem
3532         https://bugs.webkit.org/show_bug.cgi?id=175172
3533
3534         Reviewed by Myles C. Maxfield.
3535
3536         Adding a helper function for converting enum classes to their underlying type when necessary.
3537
3538         * wtf/EnumTraits.h:
3539
3540 2017-11-06  Michael Catanzaro  <mcatanzaro@igalia.com>
3541
3542         [WPE][GTK] Always use SET_AND_EXPOSE_TO_BUILD to set build variables
3543         https://bugs.webkit.org/show_bug.cgi?id=179038
3544
3545         Reviewed by Žan Doberšek.
3546
3547         * wtf/Platform.h:
3548
3549 2017-11-03  Chris Dumez  <cdumez@apple.com>
3550
3551         Use a single identifier type to identify Service Workers
3552         https://bugs.webkit.org/show_bug.cgi?id=179192
3553
3554         Reviewed by Brady Eidson.
3555
3556         Introduce class for strongly typed identifiers. This avoids mixing up
3557         different types of identifiers.
3558
3559         * WTF.xcodeproj/project.pbxproj:
3560         * wtf/ObjectIdentifier.h: Added.
3561         (WTF::ObjectIdentifier::encode const):
3562         (WTF::ObjectIdentifier::decode):
3563         (WTF::ObjectIdentifier::operator== const):
3564         (WTF::ObjectIdentifier::operator!= const):
3565         (WTF::ObjectIdentifier::ObjectIdentifier):
3566         (WTF::makeObjectIdentifier):
3567         (WTF::ObjectIdentifierHash::hash):
3568         (WTF::ObjectIdentifierHash::equal):
3569         (WTF::HashTraits<ObjectIdentifier<T>>::emptyValue):
3570         (WTF::HashTraits<ObjectIdentifier<T>>::constructDeletedValue):
3571         (WTF::HashTraits<ObjectIdentifier<T>>::isDeletedValue):
3572
3573 2017-11-02  Ryan Haddad  <ryanhaddad@apple.com>
3574
3575         Unreviewed, rolling out r224353.
3576
3577         Breaks internal builds.
3578
3579         Reverted changeset:
3580
3581         "Ignore HSTS for partitioned, cross-origin subresource
3582         requests"
3583         https://bugs.webkit.org/show_bug.cgi?id=178993
3584         https://trac.webkit.org/changeset/224353
3585
3586 2017-11-02  John Wilander  <wilander@apple.com>
3587
3588         Ignore HSTS for partitioned, cross-origin subresource requests
3589         https://bugs.webkit.org/show_bug.cgi?id=178993
3590         <rdar://problem/34962462>
3591
3592         Reviewed by Brent Fulgham and Alex Christensen.
3593
3594         * wtf/Platform.h:
3595             Added HAVE_CFNETWORK_IGNORE_HSTS.
3596
3597 2017-11-02  Frederic Wang  <fwang@igalia.com>
3598
3599         Add references to bug 179167 in FIXME comments
3600         https://bugs.webkit.org/show_bug.cgi?id=179168
3601
3602         Reviewed by Daniel Bates.
3603
3604         * wtf/FeatureDefines.h:
3605
3606 2017-11-01  Jiewen Tan  <jiewen_tan@apple.com>
3607
3608         Let is<T>() accept RefPtrs
3609         https://bugs.webkit.org/show_bug.cgi?id=178612
3610         <rdar://problem/35102004>
3611
3612         Reviewed by Ryosuke Niwa.
3613
3614         Add support for is<T>() for RefPtrs.
3615
3616         * wtf/RefPtr.h:
3617         (WTF::is):
3618
3619 2017-11-01  Simon Fraser  <simon.fraser@apple.com>
3620
3621         Misc display list and other cleanup
3622         https://bugs.webkit.org/show_bug.cgi?id=179150
3623
3624         Reviewed by Tim Horton.
3625
3626         Add system trace points for display list recording.
3627
3628         * wtf/SystemTracing.h:
3629
3630 2017-11-01  Fujii Hironori  <Hironori.Fujii@sony.com>
3631
3632         Use LazyNeverDestroyed instead of DEFINE_GLOBAL
3633         https://bugs.webkit.org/show_bug.cgi?id=174979
3634
3635         Reviewed by Yusuke Suzuki.
3636
3637         DEFINE_GLOBAL is not used anymore. Remove it.
3638
3639         * WTF.xcodeproj/project.pbxproj: Removed StaticConstructors.h
3640         * config.h: Removed definitions of SKIP_STATIC_CONSTRUCTORS_ON_MSVC and SKIP_STATIC_CONSTRUCTORS_ON_GCC.
3641         * wtf/CMakeLists.txt: Removed StaticConstructors.h
3642         * wtf/StaticConstructors.h: Removed.
3643
3644 2017-10-30  Michael Catanzaro  <mcatanzaro@igalia.com>
3645
3646         [WPE] Fix build warnings
3647         https://bugs.webkit.org/show_bug.cgi?id=178899
3648
3649         Reviewed by Carlos Alberto Lopez Perez.
3650
3651         * wtf/PlatformWPE.cmake:
3652
3653 2017-10-27  Yousuke Kimoto  <yousuke.kimoto@sony.com>
3654
3655         [WinCairo] Add WTF files for wincairo webkit
3656         https://bugs.webkit.org/show_bug.cgi?id=176894
3657
3658         Reviewed by Alex Christensen.
3659
3660         * wtf/PlatformWin.cmake:
3661         * wtf/WorkQueue.cpp:
3662         * wtf/WorkQueue.h:
3663         * wtf/win/Win32Handle.h:
3664         * wtf/win/WorkItemContext.cpp: Added.
3665         (WTF::WorkItemContext::WorkItemContext):
3666         (WTF::WorkItemContext::create):
3667         (WTF::WorkItemContext::~WorkItemContext):
3668         * wtf/win/WorkItemContext.h: Added.
3669         (WTF::WorkItemContext::handle):
3670         (WTF::WorkItemContext::waitHandle):
3671         (WTF::WorkItemContext::Function<void):
3672         (WTF::WorkItemContext::queue const):
3673         * wtf/win/WorkQueueWin.cpp:
3674         (WTF::WorkQueue::handleCallback):
3675         (WTF::WorkQueue::registerHandle):
3676         (WTF::WorkQueue::unregisterAndCloseHandle):
3677         (WTF::WorkQueue::unregisterWaitAndDestroyItemSoon):
3678         (WTF::WorkQueue::unregisterWaitAndDestroyItemCallback):
3679
3680 2017-10-27  Keith Miller  <keith_miller@apple.com>
3681
3682         Add unified source list files and build scripts to Xcode project navigator
3683         https://bugs.webkit.org/show_bug.cgi?id=178959
3684
3685         Reviewed by Andy Estes.
3686
3687         * WTF.xcodeproj/project.pbxproj:
3688
3689 2017-10-26  Mark Lam  <mark.lam@apple.com>
3690
3691         JSRopeString::RopeBuilder::append() should check for overflows.
3692         https://bugs.webkit.org/show_bug.cgi?id=178385
3693         <rdar://problem/35027468>
3694
3695         Reviewed by Saam Barati.
3696
3697         * wtf/CheckedArithmetic.h:
3698
3699 2017-10-25  Commit Queue  <commit-queue@webkit.org>
3700
3701         Unreviewed, rolling out r222945.
3702         https://bugs.webkit.org/show_bug.cgi?id=178818
3703
3704         "It made WasmBench crash" (Requested by saamyjoon on #webkit).
3705
3706         Reverted changeset:
3707
3708         "bmalloc mutex should be adaptive"
3709         https://bugs.webkit.org/show_bug.cgi?id=177839
3710         https://trac.webkit.org/changeset/222945
3711
3712 2017-10-25  Zan Dobersek  <zdobersek@igalia.com>
3713
3714         Make SERVICE_WORKER feature buildable on GTK, WPE
3715         https://bugs.webkit.org/show_bug.cgi?id=178574
3716
3717         Reviewed by Carlos Garcia Campos.
3718
3719         * wtf/Identified.h: Explicitly include the <atomic> header since
3720         std::atomic<> is used in the ThreadSafeIdentified definition.
3721
3722 2017-10-24  Michael Saboff  <msaboff@apple.com>
3723
3724         WTF: Eliminated PLATFORM checks for HAVE_MACH_EXCEPTIONS
3725         https://bugs.webkit.org/show_bug.cgi?id=178747
3726
3727         Reviewed by Saam Barati.
3728
3729         Removed unnecessary PLATFORM checks as they can cause build failures
3730         when the include file is present.
3731
3732         * wtf/Platform.h:
3733
3734 2017-10-23  Yusuke Suzuki  <utatane.tea@gmail.com>
3735
3736         [JSC] Use fastJoin in Array#toString
3737         https://bugs.webkit.org/show_bug.cgi?id=178062
3738
3739         Reviewed by Darin Adler.
3740
3741         A bit cleaning up to use StringImpl::copyChars instead of
3742         using for-loop directly.
3743
3744         * wtf/text/StringView.h:
3745         (WTF::StringView::getCharactersWithUpconvert const):
3746
3747 2017-10-20  Antoine Quint  <graouts@apple.com>
3748
3749         [Web Animations] Provide basic timeline and animation interfaces
3750         https://bugs.webkit.org/show_bug.cgi?id=178526
3751
3752         Reviewed by Dean Jackson.
3753
3754         Remove the WEB_ANIMATIONS compile-time flag.
3755
3756         * wtf/FeatureDefines.h:
3757
3758 2017-10-19  Keith Miller  <keith_miller@apple.com>
3759
3760         REGRESSION (r223476): WebCore exports symbols with names belonging to other frameworks
3761         https://bugs.webkit.org/show_bug.cgi?id=178424
3762
3763         Reviewed by David Kilzer.
3764
3765         This patch moves the wrapper function sharing the name of the externed function
3766         to the source file and marks it as always inline. Marking it as inline prevents
3767         the framework from exporting it.
3768
3769         * wtf/cocoa/SoftLinking.h:
3770
3771 2017-10-18  Keith Miller  <keith_miller@apple.com>
3772
3773         Setup WebCore build to start using unified sources.
3774         https://bugs.webkit.org/show_bug.cgi?id=178362
3775
3776         Reviewed by Tim Horton.
3777
3778         There are a number of changes to the bundler script. First, it is
3779         now possible to enable or disable building files based on if the
3780         associated feature flag is enabled or not. The syntax for this is
3781         similar to how we do #ifs in C++ code. e.g.
3782
3783         #if ENABLE_APPLE_PAY
3784             myApplePayFile.cpp
3785         #endif
3786
3787         would enable myApplePayFile.cpp if and only if the APPLE_PAY
3788         feature define is set.
3789
3790         I also changed comments from # to // to make it less likely they
3791         would be confused with a #if.
3792
3793         Finally, this patch enables bundling files in the same relative
3794         directory across source list files. Previously, if
3795         SourcesCocoa.txt had platform/cf/foo.cpp and SourcesMac.txt had
3796         platform/cf/bar.cpp those files would not be put in the same
3797         unified source bundle. Now, those files will be put into the same
3798         bundle but bar.cpp will always follow foo.cpp. The idea is that by
3799         putting more specific files after more general files we can avoid
3800         random build failures.
3801
3802         * Scripts/generate-unified-source-bundles.rb:
3803
3804 2017-10-18  Konstantin Tokarev  <annulen@yandex.ru>
3805
3806         REGRESSION(r217771): nullTerminatedWCharToString loses last character of input string
3807         https://bugs.webkit.org/show_bug.cgi?id=178444
3808
3809         Reviewed by Per Arne Vollan.
3810
3811         * wtf/text/win/WCharStringExtras.h:
3812         (WTF::nullTerminatedWCharToString):
3813
3814 2017-10-17  Keith Miller  <keith_miller@apple.com>
3815
3816         Change WebCore sources to work with unified source builds
3817         https://bugs.webkit.org/show_bug.cgi?id=178229
3818
3819         Rubber stamped by Tim Horton.
3820
3821         * wtf/Platform.h:
3822         * wtf/cocoa/SoftLinking.h:
3823
3824 2017-10-16  David Kilzer  <ddkilzer@apple.com>
3825
3826         Add RELEASE_ASSERT_WITH_SECURITY_IMPLICATION() macro
3827         <https://webkit.org/b/178269>
3828
3829         Reviewed by Alex Christensen.
3830
3831         * wtf/Assertions.h:
3832         (RELEASE_ASSERT_WITH_SECURITY_IMPLICATION): Add macro.
3833
3834 2017-10-14  Sam Weinig  <sam@webkit.org>
3835
3836         Remove HashCountedSet's copyToVector functions
3837         https://bugs.webkit.org/show_bug.cgi?id=178215
3838
3839         Reviewed by Daniel Bates.
3840
3841         * wtf/HashCountedSet.h:
3842         (WTF::copyToVector): Deleted.
3843         
3844             They are replaced by either copyToVector(hashCountedSet) or copyToVector(hashCountedSet.values())
3845
3846 2017-10-13  Sam Weinig  <sam@webkit.org>
3847
3848         Adopt type trait template aliases everywhere in WTF
3849         https://bugs.webkit.org/show_bug.cgi?id=178299
3850
3851         Reviewed by Yusuke Suzuki.
3852
3853         Adopt type trait template aliases (e.g. replace 'typename std::make_unsigned<Source>::type'
3854         with 'std::make_unsigned_t<Source>'). Also adopt using over typedef consistently.
3855
3856         * wtf/Atomics.h:
3857         * wtf/CagedUniquePtr.h:
3858         * wtf/CheckedArithmetic.h:
3859         * wtf/CompletionHandler.h:
3860         * wtf/Function.h:
3861         * wtf/HashCountedSet.h:
3862         * wtf/HashFunctions.h:
3863         * wtf/HashMap.h:
3864         * wtf/HashSet.h:
3865         * wtf/HashTable.h:
3866         * wtf/HashTraits.h:
3867         * wtf/IndexedContainerIterator.h:
3868         * wtf/IteratorAdaptors.h:
3869         * wtf/KeyValuePair.h:
3870         * wtf/LEBDecoder.h:
3871         * wtf/ListHashSet.h:
3872         * wtf/MathExtras.h:
3873         * wtf/NeverDestroyed.h:
3874         * wtf/OptionSet.h:
3875         * wtf/RetainPtr.h:
3876         * wtf/SizeLimits.cpp:
3877         * wtf/StdLibExtras.h:
3878         * wtf/SystemFree.h:
3879         * wtf/ThreadSpecific.h:
3880         * wtf/TypeCasts.h:
3881         * wtf/Vector.h:
3882         * wtf/text/IntegerToStringConversion.h:
3883
3884 2017-10-13  Jer Noble  <jer.noble@apple.com>
3885
3886         Performance: Skip texture upload if source image and destination texture haven't changed
3887         https://bugs.webkit.org/show_bug.cgi?id=178254
3888         <rdar://problem/34968181>
3889
3890         Reviewed by Dean Jackson.
3891
3892         Add a new class, UnsafePointer, for safely holding pointers to objects with uncontrolled lifetimes.
3893
3894         * WTF.xcodeproj/project.pbxproj:
3895         * wtf/UnsafePointer.h: Added.
3896         (WTF::UnsafePointer::UnsafePointer):
3897         (WTF::UnsafePointer::operator== const):
3898         (WTF::UnsafePointer::operator!= const):
3899         (WTF::UnsafePointer::operator bool const):
3900         (WTF::operator==):
3901         (WTF::operator!=):
3902
3903 2017-10-13  Per Arne Vollan  <pvollan@apple.com>
3904
3905         [Win] When built with VS2017, MiniBrowser crashes on startup.
3906         https://bugs.webkit.org/show_bug.cgi?id=175209
3907
3908         Reviewed by Daniel Bates.
3909
3910         Add AtomicString(const StaticStringImpl*) constructor. This is needed since
3911         this patch adds constexpr to the static, global StaticStringImpl objects
3912         generated in WebCore/bindings/scripts/StaticString.pm.
3913
3914         * wtf/text/AtomicString.h:
3915         (WTF::AtomicString::AtomicString):
3916         * wtf/text/AtomicStringImpl.cpp:
3917         (WTF::addStatic):
3918         (WTF::AtomicStringImpl::add):
3919         * wtf/text/AtomicStringImpl.h:
3920         * wtf/text/StringImpl.h:
3921         (WTF::StringImpl::assertHashIsCorrect const):
3922         (WTF::StringImpl::assertHashIsCorrect): Deleted.
3923
3924 2017-10-12  Alex Christensen  <achristensen@webkit.org>
3925
3926         Add Expected, HashMap, HashSet, and SHA1 to wtf/Forward.h
3927         https://bugs.webkit.org/show_bug.cgi?id=178243
3928
3929         Reviewed by Tim Horton.
3930
3931         * wtf/Forward.h:
3932         * wtf/HashMap.h:
3933         Move default parameters to Forward.h like we did with Vector.
3934         * wtf/HashSet.h:
3935         Also fix indentation.
3936
3937 2017-10-12  Alex Christensen  <achristensen@webkit.org>
3938
3939         Add CompletionHandler and HashCountedSet to wtf/Forward.h
3940         https://bugs.webkit.org/show_bug.cgi?id=178231
3941
3942         Reviewed by Tim Horton.
3943
3944         * wtf/Forward.h:
3945         * wtf/HashCountedSet.h:
3946
3947 2017-10-11  Sam Weinig  <sam@webkit.org>
3948
3949         Remove out-parameter variants of copyToVector
3950         https://bugs.webkit.org/show_bug.cgi?id=178155
3951
3952         Reviewed by Tim Horton.
3953
3954         * wtf/HashMap.h:
3955         (WTF::copyToVector): Deleted.
3956         * wtf/HashSet.h:
3957         (WTF::copyToVector): Deleted.
3958         
3959             Remove copyToVector.
3960         
3961         * wtf/Vector.h:
3962         (WTF::copyToVectorSpecialization):
3963         
3964             Add another version of copyToVector, called copyToVectorSpecialization, that allows
3965             you to specify the entire specialization for the Vector you want to copy to. This
3966             can be useful if you want your resulting Vector to have an inline capacity. 
3967
3968 2017-10-12  Sam Weinig  <sam@webkit.org>
3969
3970         It should be possible to iterate just the values (and not the counts) of a HashCountedSet
3971         https://bugs.webkit.org/show_bug.cgi?id=178169
3972
3973         Reviewed by Daniel Bates.
3974
3975         Cleanup (fix indentation, simplify type names, adopt using), and add a values() range to
3976         HashCountedSet. This will allow getting a Vector of all the values (and not the counts)
3977         using the new copyToVector. 
3978
3979         * wtf/HashCountedSet.h:
3980
3981 2017-10-11  Michael Saboff  <msaboff@apple.com>
3982
3983         [JSC] Add ability to build with ARMV8 ILP32 ABI
3984         https://bugs.webkit.org/show_bug.cgi?id=178194
3985
3986         Reviewed by Saam Barati.
3987
3988         For ARMV8 32 bit ABI, use JSVALUE32_64 and the CLOOP.
3989
3990         * wtf/Platform.h:
3991
3992 2017-10-11  Youenn Fablet  <youenn@apple.com>
3993
3994         Add API to clean CacheStorage data
3995         https://bugs.webkit.org/show_bug.cgi?id=178034
3996
3997         Reviewed by Chris Dumez.
3998
3999         Moving CallbackAggregator pattern into its own class for easier reuse.
4000
4001         * WTF.xcodeproj/project.pbxproj:
4002         * wtf/CallbackAggregator.h: Added.
4003         (WTF::CallbackAggregator::create):
4004         (WTF::CallbackAggregator::~CallbackAggregator):
4005         (WTF::CallbackAggregator::CallbackAggregator):
4006
4007 2017-10-10  Sam Weinig  <sam@webkit.org>
4008
4009         Replace copyKeysToVector/copyValuesToVector with copyToVector(map.keys())/copyToVector(map.values())
4010         https://bugs.webkit.org/show_bug.cgi?id=178102
4011
4012         Reviewed by Tim Horton.
4013
4014         * wtf/HashMap.h:
4015         (WTF::copyKeysToVector): Deleted.
4016         (WTF::copyValuesToVector): Deleted.
4017         
4018             Remove copyKeysToVector and copyValuesToVector which are no longer used.
4019
4020 2017-10-09  Youenn Fablet  <youenn@apple.com>
4021
4022         Vector should be able to easily create from a list of movable only items
4023         https://bugs.webkit.org/show_bug.cgi?id=176432
4024
4025         Reviewed by Darin Adler.
4026
4027         Adding static from method to construct a Vector from movable-only items.
4028         This may also be used instead of initializer list constructor for types that would benefit of being moved.
4029
4030         * wtf/Vector.h:
4031         (WTF::Vector::Vector):
4032         (WTF::Vector::from):
4033         (WTF::Vector::uncheckedInitialize): Introduced as an optimization to set the vector size once.
4034         (WTF::Malloc>::reserveInitialCapacity):
4035
4036 2017-10-09  Tim Horton  <timothy_horton@apple.com>
4037
4038         Disable INPUT_TYPE_COLOR in FeatureDefines.h
4039         https://bugs.webkit.org/show_bug.cgi?id=178103
4040         <rdar://problem/34872127>
4041
4042         Reviewed by Simon Fraser.
4043
4044         * wtf/FeatureDefines.h:
4045         Because FeatureDefines.h overrides features that are not enabled in
4046         FeatureDefines.xcconfig, you currently have to turn INPUT_TYPE_COLOR
4047         off in two places. Since we only ever want it on for Mac, it's OK
4048         to depend on the xcconfig defining it.
4049
4050 2017-10-09  Sam Weinig  <sam@webkit.org>
4051
4052         Make HashMap::keys() and HashMap::values() work with WTF::map/WTF::copyToVector
4053         https://bugs.webkit.org/show_bug.cgi?id=178072
4054
4055         Reviewed by Darin Adler.
4056
4057         Introduce SizedIteratorRange, a variant of IteratorRange that includes
4058         a reference to a backing container in order to get the size of container.
4059         This is useful for algorithms like WTF::map and WTF::copyToVector, that
4060         can use the size to efficiently allocate things of the correct size.
4061
4062         The main beneficiary are HashMap's keys() and values() functions which
4063         used to return IteratorRanges and now return SizedIteratorRange. This
4064         allows us to remove (in a future change) copyKeysToVector() and
4065         copyValuesToVector() by replacing them with copyToVector(map.keys()) and
4066         copyToVector(map.values()) respectively.
4067
4068         * wtf/HashMap.h:
4069         * wtf/IteratorRange.h:
4070         (WTF::SizedIteratorRange::SizedIteratorRange):
4071         (WTF::SizedIteratorRange::size const):
4072         (WTF::SizedIteratorRange::begin const):
4073         (WTF::SizedIteratorRange::end const):
4074         (WTF::makeSizedIteratorRange):
4075
4076 2017-10-08  Sam Weinig  <sam@webkit.org>
4077
4078         It should be possible to create a ListHashSet with a std::initializer_list.
4079         https://bugs.webkit.org/show_bug.cgi?id=178070
4080
4081         Reviewed by Darin Adler.
4082
4083         * wtf/ListHashSet.h:
4084         (WTF::U>::ListHashSet):
4085         Add a constructor that takes a std::initializer_list.
4086
4087 2017-10-08  Sam Weinig  <sam@webkit.org>
4088
4089         Address additional feedback from Darin for r223039 and sort the using declarations.
4090
4091         * wtf/Vector.h:
4092
4093 2017-10-08  Sam Weinig  <sam@webkit.org>
4094
4095         There should be a version of copyToVector that returns a Vector, rather than using an out parameter
4096         https://bugs.webkit.org/show_bug.cgi?id=177732
4097
4098         Reviewed by Saam Barati.
4099
4100         Add two new helper functions, copyToVector and copyToVectorOf, which will be able to
4101         replace the existing out parameter taking copyToVector. Like it's ancestral namesake,
4102         copyToVector takes an object that is both iterable (supports begin() and end()) and
4103         has a size, and returns a Vector with a copy of all the items iterated. The copyToVectorOf
4104         variant allow the user to specify a type to convert to, so if you have a HashSet<int>
4105         but want those as floats in a Vector, you can do:
4106         
4107             auto floatVector = copyToVectorOf<float>(intSet);
4108
4109         * wtf/Vector.h:
4110         (WTF::copyToVector):
4111         (WTF::copyToVectorOf):
4112
4113 2017-10-08  Darin Adler  <darin@apple.com>
4114
4115         Fix bugs related to setting reflected floating point DOM attributes
4116         https://bugs.webkit.org/show_bug.cgi?id=178061
4117
4118         Reviewed by Sam Weinig.
4119
4120         * wtf/dtoa.cpp:
4121         (WTF::formatStringTruncatingTrailingZerosIfNeeded): Fix a bug where
4122         this function would remove trailing zeroes from the exponent if
4123         present instead of from the mantissa. This meant that it would
4124         format 1e10 as "1.00000e+1" instead of "1e+10". Added regression
4125         tests for this to TestWebKitAPI.
4126
4127         * wtf/dtoa/utils.h:
4128         (WTF::double_conversion::StringBuilder::RemoveCharacters): Added.
4129         Used by the fix above.
4130
4131         * wtf/text/AtomicString.cpp:
4132         (WTF::AtomicString::number): Note: This function is used by code
4133         that sets the values of reflected floating point DOM attributes.
4134         Changed the function to use the rules from numberToString rather
4135         ones from numberToFixedPrecisionString. This is analogous to
4136         String::numberToStringECMAScript, and in the future we should change
4137         String and StringBuilder so this "ECMAScript" semantic is the default
4138         way to convert a floating point number to a string, and rename the fixed
4139         precision version that is currently called String::number. I audited
4140         the small number of sites calling AtomicString::number, by temporarily
4141         renaming it, and discovered that this is the correct behavior for all;
4142         none needed fixed precision. Also, fixed a mistake where this explicitly
4143         converted to String. That was defeating the purpose of having these
4144         functions in AtomicString: It would allocate a new String and then
4145         destroy it in the case where an equal string was already in the
4146         AtomicString table.
4147
4148 2017-10-06  Commit Queue  <commit-queue@webkit.org>
4149
4150         Unreviewed, rolling out r222791 and r222873.
4151         https://bugs.webkit.org/show_bug.cgi?id=178031
4152
4153         Caused crashes with workers/wasm LayoutTests (Requested by
4154         ryanhaddad on #webkit).
4155
4156         Reverted changesets:
4157
4158         "WebAssembly: no VM / JS version of everything but Instance"
4159         https://bugs.webkit.org/show_bug.cgi?id=177473
4160         http://trac.webkit.org/changeset/222791
4161
4162         "WebAssembly: address no VM / JS follow-ups"
4163         https://bugs.webkit.org/show_bug.cgi?id=177887
4164         http://trac.webkit.org/changeset/222873
4165
4166 2017-10-06  Antti Koivisto  <antti@apple.com>
4167
4168         Minor WeakPtr improvements
4169         https://bugs.webkit.org/show_bug.cgi?id=177958
4170
4171         Reviewed by Sam Weinig.
4172
4173         * wtf/WeakPtr.h:
4174         (WTF::WeakPtr::operator bool const):
4175
4176             Make explicit.
4177
4178         (WTF::WeakPtrFactory::createWeakPtr const):
4179         (WTF::makeWeakPtr):
4180
4181             Remove templating from createWeakPtr, makeWeakPtr() is now the
4182             canonical way to make derived-type WeakPtrs.
4183
4184 2017-10-04  Filip Pizlo  <fpizlo@apple.com>
4185
4186         bmalloc mutex should be adaptive
4187         https://bugs.webkit.org/show_bug.cgi?id=177839
4188
4189         Reviewed by Michael Saboff.
4190         
4191         Add some comments that I thought of while copy-pasting this code.
4192
4193         Reland after fixing ancient WordLock bug: the notify_one has to happen with the lock held
4194         to ensure it doesn't run after that thread has died.
4195
4196         * wtf/LockAlgorithmInlines.h:
4197         * wtf/WordLock.cpp:
4198
4199 2017-10-05  Carlos Alberto Lopez Perez  <clopez@igalia.com>
4200
4201         Generate a compile error if release is built without compiler optimizations
4202         https://bugs.webkit.org/show_bug.cgi?id=177665
4203
4204         Reviewed by Brian Burg.
4205
4206         For GCC and Clang, generate an error at build time that will alert
4207         the developer that she is trying to build Release without any compiler
4208         optimization. A build time error is much better than an unexpected
4209         "oh, WebKit is really slow ..."  situation later.
4210
4211         If this was intended, then we tell the developer that she can continue
4212         by just setting -DRELEASE_WITHOUT_OPTIMIZATIONS in the list of build
4213         flags.
4214
4215         The intention of this patch is to ensure that nobody builds Release
4216         without enabling compiler optimization by mistake.
4217
4218         * wtf/Compiler.h:
4219
4220 2017-10-05  David Kilzer  <ddkilzer@apple.com>
4221
4222         Bug 177893: Disable -Wcast-qual for new clang compiler in Apple ports
4223         <https://webkit.org/b/177893>
4224         <rdar://problem/33667497>
4225
4226         Reviewed by Tim Horton.
4227
4228         * wtf/RetainPtr.h:
4229         (WTF::RetainPtr::fromStorageType const): Disable warnings for
4230         -Wcast-qual until we can provide a safe cast function that lets
4231         us re-enable the warning.
4232
4233 2017-10-05  Matt Lewis  <jlewis3@apple.com>
4234
4235         Unreviewed, rolling out r222893.
4236
4237         This caused multiple API failures.
4238
4239         Reverted changeset:
4240
4241         "bmalloc mutex should be adaptive"
4242         https://bugs.webkit.org/show_bug.cgi?id=177839
4243         http://trac.webkit.org/changeset/222893
4244
4245 2017-10-04  Filip Pizlo  <fpizlo@apple.com>
4246
4247         bmalloc mutex should be adaptive
4248         https://bugs.webkit.org/show_bug.cgi?id=177839
4249
4250         Reviewed by Michael Saboff.