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