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