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