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