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