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