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