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