88ff471897a78ee4b30bd8db97f97464a22c81f9
[WebKit-https.git] / Source / WTF / ChangeLog
1 2017-05-14  Chris Dumez  <cdumez@apple.com>
2
3         Drop PassRefPtr class from WTF
4         https://bugs.webkit.org/show_bug.cgi?id=172091
5
6         Reviewed by Alex Christensen.
7
8         Drop PassRefPtr class from WTF as it is no longer used or needed.
9         Also drop RefPtr::release() for the same reasons.
10
11         * WTF.xcodeproj/project.pbxproj:
12         * wtf/CMakeLists.txt:
13         * wtf/CrossThreadCopier.cpp:
14         * wtf/CrossThreadCopier.h:
15         * wtf/Forward.h:
16         * wtf/PassRefPtr.h: Removed.
17         * wtf/RefPtr.h:
18         (WTF::refIfNotNull):
19         (WTF::derefIfNotNull):
20         (WTF::RefPtr::RefPtr):
21         (WTF::RefPtr::release): Deleted.
22         * wtf/SizeLimits.cpp:
23         * wtf/Vector.h:
24
25 2017-05-13  Chris Dumez  <cdumez@apple.com>
26
27         Stop using RefPtr::release()
28         https://bugs.webkit.org/show_bug.cgi?id=172074
29
30         Reviewed by Geoffrey Garen.
31
32         * wtf/win/WorkQueueWin.cpp:
33         (WTF::WorkQueue::dispatchAfter):
34
35 2017-05-13  Commit Queue  <commit-queue@webkit.org>
36
37         Unreviewed, rolling out r216808.
38         https://bugs.webkit.org/show_bug.cgi?id=172075
39
40         caused lldb to hang when debugging (Requested by smfr on
41         #webkit).
42
43         Reverted changeset:
44
45         "Use Mach exceptions instead of signals where possible"
46         https://bugs.webkit.org/show_bug.cgi?id=171865
47         http://trac.webkit.org/changeset/216808
48
49 2017-05-12  Keith Miller  <keith_miller@apple.com>
50
51         Use Mach exceptions instead of signals where possible
52         https://bugs.webkit.org/show_bug.cgi?id=171865
53
54         Reviewed by Mark Lam.
55
56         This patch enables using mach exceptions on darwin. The way the
57         mach exception api works is that we create a mach port, which is
58         like a file descriptor.  We then wait for a message to arrive on
59         that port in a thread. When another thread raises an exception (say
60         due to a bad memory access) the OS sends our thread a message. The
61         payload of that message is the register file of the crashing
62         thread. We then call our custom handlers that change the state as
63         needed. In order to restart the thread we send a payload back to
64         the OS with an updated register file along with a success message
65         header.
66
67         This patch also makes thread messages work without signals by
68         simply suspending the thread, and then running the message at that
69         time.
70
71         You can read more about mach exceptions here:
72         http://www.cs.cmu.edu/afs/cs/project/mach/public/doc/unpublished/exception.ps
73         and the Mach interface Generator (MiG) here:
74         http://www.cs.cmu.edu/afs/cs/project/mach/public/doc/unpublished/mig.ps
75
76         * Configurations/WTF.xcconfig:
77         * WTF.xcodeproj/project.pbxproj:
78         * wtf/Platform.h:
79         * wtf/PlatformRegisters.h:
80         (WTF::registersFromUContext):
81         * wtf/StackBounds.h:
82         (WTF::StackBounds::StackBounds):
83         * wtf/ThreadHolder.cpp:
84         (WTF::ThreadHolder::~ThreadHolder):
85         * wtf/ThreadMessage.cpp:
86         (WTF::sendMessageUsingSignal):
87         (WTF::sendMessageUsingMach):
88         (WTF::deliverMessagesUsingMach):
89         (WTF::sendMessageScoped):
90         * wtf/ThreadMessage.h:
91         (WTF::sendMessage):
92         * wtf/Threading.h:
93         (WTF::Thread::machThread):
94         * wtf/mac/MachExceptions.defs: Copied from Source/WTF/wtf/ThreadMessage.h.
95         * wtf/threads/Signals.cpp:
96         (WTF::startMachExceptionHandlerThread):
97         (WTF::fromMachException):
98         (WTF::toMachMask):
99         (WTF::handleSignalsWithMach):
100         (WTF::setExceptionPorts):
101         (WTF::activeThreads):
102         (WTF::registerThreadForMachExceptionHandling):
103         (WTF::unregisterThreadForMachExceptionHandling):
104         (WTF::installSignalHandler):
105         (WTF::jscSignalHandler):
106         * wtf/threads/Signals.h:
107
108 2017-05-12  Ting-Wei Lan  <lantw44@gmail.com>
109
110         Include algorithm before using std::min
111         https://bugs.webkit.org/show_bug.cgi?id=171733
112
113         Reviewed by Chris Dumez.
114
115         * wtf/text/StringCommon.h:
116
117 2017-05-12  Andreas Kling  <akling@apple.com>
118
119         More aggressive memory kill limits.
120         https://bugs.webkit.org/show_bug.cgi?id=172037
121         <rdar://problem/31969082>
122
123         Reviewed by Michael Saboff.
124
125         Bring down the memory kill limits to 4GB for active processes, and 2GB for inactive.
126         Also make MemoryUsagePolicy::Strict kick in above 1.5GB.
127
128         * wtf/MemoryPressureHandler.cpp:
129         (WTF::MemoryPressureHandler::thresholdForMemoryKill):
130         (WTF::thresholdForPolicy):
131
132 2017-05-12  Michael Saboff  <msaboff@apple.com>
133
134         [iOS] Use memory footprint to dynamically adjust behavior of allocators
135         https://bugs.webkit.org/show_bug.cgi?id=171944
136
137         Reviewed by Filip Pizlo.
138
139         Moved the non-Windows implementation of RAMSize() to bmalloc/AvailableMemory.cpp and
140         called the function availableMemory().
141
142         * wtf/RAMSize.cpp:
143         (WTF::computeRAMSize):
144
145 2017-05-12  Claudio Saavedra  <csaavedra@igalia.com>
146
147         [WPE] Add MemoryFootprintLinux to build
148
149         Unreviewed build fix after r216731.
150
151         * wtf/PlatformWPE.cmake:
152
153 2017-05-12  Csaba Osztrogonác  <ossy@webkit.org>
154
155         Unreviewed trivial JSCOnly buildfix after r216731.
156         https://bugs.webkit.org/show_bug.cgi?id=171693
157
158         * wtf/PlatformJSCOnly.cmake:
159
160 2017-05-11  Yusuke Suzuki  <utatane.tea@gmail.com>
161
162         [Win] Implement memoryFootprint for Windows
163         https://bugs.webkit.org/show_bug.cgi?id=171693
164
165         Reviewed by Alex Christensen.
166
167         This patch implements memoryFootprint for Windows. In Windows, we calculate the size
168         of private working set. This can be done by enumerating private pages in working set.
169
170         And we also split MemoryFootprint.cpp to cocoa, linux, and win versions.
171
172         * WTF.xcodeproj/project.pbxproj:
173         * wtf/CMakeLists.txt:
174         * wtf/MallocPtr.h:
175         (WTF::MallocPtr::operator*):
176         (WTF::MallocPtr::operator->):
177         * wtf/PlatformGTK.cmake:
178         * wtf/PlatformJSCOnly.cmake:
179         * wtf/PlatformMac.cmake:
180         * wtf/PlatformWin.cmake:
181         * wtf/cocoa/MemoryFootprintCocoa.cpp: Copied from Source/WTF/wtf/MemoryFootprint.cpp.
182         (WTF::memoryFootprint):
183         * wtf/linux/MemoryFootprintLinux.cpp: Renamed from Source/WTF/wtf/MemoryFootprint.cpp.
184         (WTF::forEachLine):
185         (WTF::memoryFootprint):
186         * wtf/win/MemoryFootprintWin.cpp: Added.
187         (WTF::memoryFootprint):
188
189 2017-05-11  Don Olmstead  <don.olmstead@am.sony.com>
190
191         [CMake] Add HAVE check for regex.h
192         https://bugs.webkit.org/show_bug.cgi?id=171950
193
194         Reviewed by Michael Catanzaro.
195
196         * wtf/Platform.h:
197
198 2017-05-11  Chris Dumez  <cdumez@apple.com>
199
200         Annotate Ref::ptr() with RETURNS_NONNULL
201         https://bugs.webkit.org/show_bug.cgi?id=171996
202
203         Reviewed by Andreas Kling.
204
205         Annotate Ref::ptr() with RETURNS_NONNULL as it can never return null.
206
207         * wtf/Ref.h:
208         (WTF::Ref::ptr): Deleted.
209
210 2017-05-11  Joseph Pecoraro  <pecoraro@apple.com>
211
212         Remove Vibration API
213         https://bugs.webkit.org/show_bug.cgi?id=171766
214
215         Rubber-stamped by Alexey Proskuryakov.
216
217         * wtf/FeatureDefines.h:
218
219 2017-05-09  Sam Weinig  <sam@webkit.org>
220
221         Remove support for legacy Notifications
222         https://bugs.webkit.org/show_bug.cgi?id=171487
223
224         Reviewed by Jon Lee.
225
226         * wtf/FeatureDefines.h:
227         Remove definition of ENABLE_LEGACY_NOTIFICATIONS.
228
229 2017-05-10  Adrian Perez de Castro  <aperez@igalia.com>
230
231         Remove some last remnants of the EFL port
232         https://bugs.webkit.org/show_bug.cgi?id=171922
233
234         Reviewed by Antonio Gomes.
235
236         The EFL port is no more.
237
238         * wtf/PlatformEfl.cmake: Removed.
239
240 2017-05-10  Fujii Hironori  <Hironori.Fujii@sony.com>
241
242         [Win] StaticStringImpl in HTMLNames.cpp aren't constructed
243         https://bugs.webkit.org/show_bug.cgi?id=171800
244
245         Reviewed by Yusuke Suzuki.
246
247         Global variables of StaticStringImpl in HTMLNames.cpp aren't
248         constructed on Windows since Bug 171586. It seems that
249         reinterpret_cast prevents constexpr's compile time initialization
250         in VC++.
251
252         * wtf/text/StringImpl.h:
253         (WTF::StringImplShape::StringImplShape): Added const char* and
254         const char16_t* members in the union. Do not use reinterpret_cast
255         in constexpr constructors.
256
257 2017-05-09  Mark Lam  <mark.lam@apple.com>
258
259         Force StaticStringImpl constructor to use the constexpr versions of StringImplShape constructors.
260         https://bugs.webkit.org/show_bug.cgi?id=171861
261
262         Reviewed by Yusuke Suzuki.
263
264         This is strictly necessary for correctness of the StaticStringImpl implementation.
265         We force the constructor selection by adding an extra dummy argument to the
266         constexpr versions of the StringImplShape constructors to disambiguate them from
267         the non-constexpr versions.
268
269         * wtf/text/StringImpl.h:
270         (WTF::StringImplShape::StringImplShape):
271         (WTF::StringImpl::StaticStringImpl::StaticStringImpl):
272
273 2017-05-09  Zan Dobersek  <zdobersek@igalia.com>
274
275         Upstream the WPE port
276         https://bugs.webkit.org/show_bug.cgi?id=171110
277
278         Reviewed by Alex Christensen.
279
280         * wtf/Platform.h:
281         * wtf/PlatformWPE.cmake: Added.
282         * wtf/glib/RunLoopSourcePriority.h:
283
284 2017-05-08  Mark Lam  <mark.lam@apple.com>
285
286         Speculative Windows build fix after r216428.
287         https://bugs.webkit.org/show_bug.cgi?id=171776
288
289         Not reviewed.
290
291         * wtf/StackTrace.h:
292
293 2017-05-08  Mark Lam  <mark.lam@apple.com>
294
295         Introduce ExceptionScope::assertNoException() and releaseAssertNoException().
296         https://bugs.webkit.org/show_bug.cgi?id=171776
297
298         Reviewed by Keith Miller.
299
300         1. Add an option to skip some number of top frames when capturing the StackTrace.
301         2. Add an option to use an indentation string when dumping the StackTrace.
302
303         * wtf/StackTrace.cpp:
304         (WTF::StackTrace::captureStackTrace):
305         (WTF::StackTrace::dump):
306         * wtf/StackTrace.h:
307
308 2017-05-05  Yusuke Suzuki  <utatane.tea@gmail.com>
309
310         [WTF] Use memoryFootprint for MemoryUsage retrieval in Linux
311         https://bugs.webkit.org/show_bug.cgi?id=171757
312
313         Reviewed by Michael Catanzaro.
314
315         This patch leverages memoryFootprint() to retrieve physical footprint in Linux.
316
317         * wtf/linux/MemoryPressureHandlerLinux.cpp:
318         (WTF::MemoryPressureHandler::ReliefLogger::platformMemoryUsage):
319
320 2017-05-05  Don Olmstead  <don.olmstead@am.sony.com>
321
322         [WTF] Do not export deleted constructor in StringView
323         https://bugs.webkit.org/show_bug.cgi?id=171751
324
325         Reviewed by Alexey Proskuryakov.
326
327         * wtf/text/StringView.h:
328
329 2017-05-05  Yusuke Suzuki  <utatane.tea@gmail.com>
330
331         [GTK][JSCOnly] Merge MainThread implementations and use generic one
332         https://bugs.webkit.org/show_bug.cgi?id=171738
333
334         Reviewed by Michael Catanzaro.
335
336         GLib MainThread implementation is generic enough to be used in JSCOnly.
337         We move it to generic/ and GTK (GLib ports) and JSCOnly use it.
338         And we also drop GLib MainThread's isMainThread function because
339         generic thread ID one is enough.
340
341         This patch also cleans up initializing main thread code by using std::call_once.
342
343         * wtf/MainThread.cpp:
344         (WTF::initializeMainThread):
345         (WTF::isMainThread):
346         (WTF::initializeMainThreadToProcessMainThread):
347         (WTF::initializeWebThread):
348         (WTF::canAccessThreadLocalDataForThread):
349         (WTF::initializeMainThreadOnce): Deleted.
350         (WTF::initializeMainThreadToProcessMainThreadOnce): Deleted.
351         (WTF::initializeWebThreadOnce): Deleted.
352         * wtf/PlatformGTK.cmake:
353         * wtf/PlatformJSCOnly.cmake:
354         * wtf/generic/MainThreadGeneric.cpp:
355         (WTF::MainThreadDispatcher::MainThreadDispatcher):
356         (WTF::MainThreadDispatcher::schedule):
357         (WTF::MainThreadDispatcher::fired):
358         (WTF::scheduleDispatchFunctionsOnMainThread):
359         * wtf/glib/MainThreadGLib.cpp: Removed.
360
361 2017-05-04  Commit Queue  <commit-queue@webkit.org>
362
363         Unreviewed, rolling out r216206.
364         https://bugs.webkit.org/show_bug.cgi?id=171714
365
366         Multiple LayoutTests crashing in Document::page() (Requested
367         by ap on #webkit).
368
369         Reverted changeset:
370
371         "Remove support for legacy Notifications"
372         https://bugs.webkit.org/show_bug.cgi?id=171487
373         http://trac.webkit.org/changeset/216206
374
375 2017-05-04  Don Olmstead  <don.olmstead@am.sony.com>
376
377         [Win] Remove redundant macros that are set in the CMake config
378         https://bugs.webkit.org/show_bug.cgi?id=171571
379
380         Reviewed by Brent Fulgham.
381
382         * config.h:
383
384 2017-05-04  Mark Lam  <mark.lam@apple.com>
385
386         NeverDestroyed<String>(ASCIILiteral(...)) is not thread safe.
387         https://bugs.webkit.org/show_bug.cgi?id=171586
388         <rdar://problem/31873190>
389
390         Reviewed by Yusuke Suzuki.
391
392         StaticStringImpl is meant to be thread-safe.  However, it has a bug: it did not
393         set the s_hashFlagDidReportCost flag.  As a result, if cost() is called on it,
394         different threads may try to change its flags bits at the same time.  This patch
395         changes StaticStringImpl to always set the s_hashFlagDidReportCost flag.
396
397         Also factored out StringImplShape and made StringImpl and StaticStringImpl extend
398         it.  This makes it more clear that the 2 are intended to have the same shape.
399         Note: there is already a static_assert that the 2 have the same size.  This
400         change also ensures that they both have the same shape, which is a requirement in
401         order for StaticStringImpl to work.
402
403         Introduced the MAKE_STATIC_STRING_IMPL macro as a convenient way to instantiate
404         StaticStringImpls from literal strings.  This allows us to trivially change
405
406             NeverDestroyed<String> myString(ASCIILiteral("myString"));
407
408         to ...
409
410             NeverDestroyed<String> myString(MAKE_STATIC_STRING_IMPL("myString"));
411
412         and by so doing, make it thread-safe.
413
414         MAKE_STATIC_STRING_IMPL instantiates a lambda function to create the static
415         StaticStringImpls.
416
417         * wtf/text/StringImpl.h:
418         (WTF::StringImplShape::StringImplShape):
419         (WTF::StringImpl::StringImpl):
420         (WTF::StringImpl::cost):
421         (WTF::StringImpl::setHash):
422         (WTF::StringImpl::StaticStringImpl::StaticStringImpl):
423         (WTF::StringImpl::StaticStringImpl::operator StringImpl&):
424         * wtf/text/WTFString.h:
425         (WTF::String::String):
426         * wtf/text/icu/TextBreakIteratorICU.h:
427         (WTF::caretRules):
428
429 2017-05-04  Sam Weinig  <sam@webkit.org>
430
431         Remove support for legacy Notifications
432         https://bugs.webkit.org/show_bug.cgi?id=171487
433
434         Reviewed by Jon Lee.
435
436         * wtf/FeatureDefines.h:
437         Remove definition of ENABLE_LEGACY_NOTIFICATIONS.
438
439 2017-05-04  Yusuke Suzuki  <utatane.tea@gmail.com>
440
441         [GTK][JSCOnly] Implement memoryFootprint for Linux
442         https://bugs.webkit.org/show_bug.cgi?id=171680
443
444         Reviewed by Carlos Alberto Lopez Perez.
445
446         Darwin's phys_footprint returns the amount of dirty anonymous memory in the process.
447         This patch implements the same thing in Linux by reading /proc/self/smaps.
448         We sum sizes of private dirty pages in anonymous regions.
449
450         * wtf/MemoryFootprint.cpp:
451         (WTF::forEachLine):
452         (WTF::memoryFootprint):
453
454 2017-05-03  Mark Lam  <mark.lam@apple.com>
455
456         Use the CLoop for CPU(ARM64E).
457         https://bugs.webkit.org/show_bug.cgi?id=171620
458         <rdar://problem/31973027>
459
460         Reviewed by Geoffrey Garen.
461
462         * wtf/Platform.h:
463
464 2017-05-02  Daniel Bates  <dabates@apple.com>
465
466         Fix the build after <https://trac.webkit.org/changeset/216102>
467         (https://bugs.webkit.org/show_bug.cgi?id=170925)
468
469         Export into global scope ASCIICaseInsensitiveStringViewHashTranslator.
470
471         Also fix indentation of member functions of ASCIICaseInsensitiveStringViewHashTranslator.
472
473         * wtf/text/StringHash.h:
474
475 2017-05-02  Daniel Bates  <dabates@apple.com>
476
477         Using StringView.split() instead of String.split() in some places
478         https://bugs.webkit.org/show_bug.cgi?id=170925
479
480         Reviewed by Darin Adler and Sam Weinig.
481
482         * wtf/HashMap.h: Add HashMap::get() overload that takes a HashTranslator.
483         * wtf/text/StringHash.h:
484         (WebCore::ASCIICaseInsensitiveStringViewHashTranslator::hash): Added.
485         (WebCore::ASCIICaseInsensitiveStringViewHashTranslator::equal): Added.
486
487 2017-05-01  Dan Bernstein  <mitz@apple.com>
488
489         [Xcode] It’s easy to accidentally install a WTF header outside /usr/local/include/wtf
490         https://bugs.webkit.org/show_bug.cgi?id=171533
491
492         Reviewed by Andy Estes.
493
494         * WTF.xcodeproj/project.pbxproj: Removed the WTF target’s Headers build phase. Its existence
495           was making it easy to accidentally add a header to the target and make it Private, which
496           would have Xcode install a copy of it right under /usr/local/include, in addition to the
497           copy installed under /usr/local/include/wtf by the Copy WTF Headers target.
498           Also got rid of INSTALL_PATH_PREFIX in the script build phase in the Copy WTF Headers
499           target, because it is being never set anymore.
500
501 2017-05-01  Dan Bernstein  <mitz@apple.com>
502
503         WTF installs an extra copy of a header outside /usr/local/include/wtf
504
505         * WTF.xcodeproj/project.pbxproj: Demoted CPUTime.h from Private to Project.
506
507 2017-05-01  Daniel Bates  <dabates@apple.com>
508
509         Cleanup: Change ASCIICaseInsensitiveHash from a class to a struct
510         https://bugs.webkit.org/show_bug.cgi?id=171460
511
512         Reviewed by Sam Weinig.
513
514         All of the members of ASCIICaseInsensitiveHash have public visibility.
515         We are underutilizing the purpose of a class - defaults to private
516         visibility of members. We should change ASCIICaseInsensitiveHash from
517         a class to a struct, which by definition defaults to public visibility
518         for members.
519
520         * wtf/text/StringHash.h:
521
522 2017-04-29  Yusuke Suzuki  <utatane.tea@gmail.com>
523
524         Move WebCore CPUTime to WTF and implement it in all the platforms
525         https://bugs.webkit.org/show_bug.cgi?id=171477
526
527         Reviewed by Chris Dumez.
528
529         We move WebCore::CPUTime to WTF::CPUTime since it is useful even in JSC
530         and it does not depend on any external libraries.
531         And we additionally implement WTF::CPUTime in all the platforms: Windows and Unix.
532
533         In CPUTime, instead of holding int64_t, we hold MonotonicTime and Seconds.
534
535         * WTF.xcodeproj/project.pbxproj:
536         * wtf/CMakeLists.txt:
537         * wtf/CPUTime.cpp: Copied from Source/WebCore/platform/CPUTime.cpp.
538         (WTF::CPUTime::percentageCPUUsageSince):
539         * wtf/CPUTime.h: Renamed from Source/WebCore/platform/CPUTime.h.
540         * wtf/PlatformEfl.cmake:
541         * wtf/PlatformGTK.cmake:
542         * wtf/PlatformJSCOnly.cmake:
543         * wtf/PlatformMac.cmake:
544         * wtf/PlatformWin.cmake:
545         * wtf/cocoa/CPUTimeCocoa.mm: Renamed from Source/WebCore/platform/cocoa/CPUTimeCocoa.mm.
546         (WTF::timeValueToMicroseconds):
547         (WTF::CPUTime::get):
548         * wtf/unix/CPUTimeUnix.cpp: Renamed from Source/WebCore/platform/CPUTime.cpp.
549         (WTF::timevalToSeconds):
550         (WTF::CPUTime::get):
551         * wtf/win/CPUTimeWin.cpp: Added.
552         (WTF::fileTimeToSeconds):
553         (WTF::CPUTime::get):
554
555 2017-04-28  Simon Fraser  <simon.fraser@apple.com>
556
557         Add system trace points for Document::updateTouchEventRegions()
558         https://bugs.webkit.org/show_bug.cgi?id=171470
559         rdar://problem/31901239
560
561         Reviewed by Tim Horton.
562
563         Add trace markers for updateTouchEventRegions.
564
565         * wtf/SystemTracing.h:
566
567 2017-04-28  Daniel Bates  <dabates@apple.com>
568
569         Add StringView::toExistingAtomicString()
570         https://bugs.webkit.org/show_bug.cgi?id=171405
571
572         Reviewed by Andreas Kling.
573
574         Similar to the reasons for JSString::toExistingAtomicString() we should expose a way to
575         convert a StringView to an existing atomic string. Looking up an atomic string is more
576         efficient that creating one, which requires a lookup and memory allocation.
577
578         We are not making use of StringView::toExistingAtomicString() now, but will in the patch
579         for <https://bugs.webkit.org/show_bug.cgi?id=170925>.
580
581         * wtf/text/AtomicStringImpl.cpp:
582         (WTF::AtomicStringImpl::lookUp): Modified to take a const LChar*/UChar*.
583         (WTF::AtomicStringImpl::lookUpInternal): Renamed to AtomicStringImpl::lookup() to avoid
584         an extra function call.
585         * wtf/text/AtomicStringImpl.h:
586         * wtf/text/StringView.h:
587         (WTF::StringView::toExistingAtomicString): Added.
588
589 2017-04-28  Chris Dumez  <cdumez@apple.com>
590
591         Update DOMTokenList.replace() to match the latest DOM specification
592         https://bugs.webkit.org/show_bug.cgi?id=171388
593
594         Reviewed by Alex Christensen.
595
596         Add Vector::findMatching() API which takes in a lambda function for convenience.
597         Add optional startIndex parameter to Vector::removeFirstMatching() / removeAllMatching()
598         to remove items only after given index.
599
600         * wtf/Vector.h:
601         (WTF::minCapacity>::findMatching):
602         (WTF::minCapacity>::find):
603         (WTF::minCapacity>::removeFirstMatching):
604         (WTF::minCapacity>::removeAllMatching):
605
606 2017-04-27  Carlos Garcia Campos  <cgarcia@igalia.com>
607
608         Move UUID from WebCore/platform to WTF
609         https://bugs.webkit.org/show_bug.cgi?id=171372
610
611         Reviewed by Michael Catanzaro.
612
613         * WTF.xcodeproj/project.pbxproj:
614         * wtf/CMakeLists.txt:
615         * wtf/UUID.cpp: Renamed from Source/WebCore/platform/UUID.cpp.
616         * wtf/UUID.h: Renamed from Source/WebCore/platform/UUID.h.
617
618 2017-04-26  Keith Miller  <keith_miller@apple.com>
619
620         LocklessBag needs a destructor
621         https://bugs.webkit.org/show_bug.cgi?id=171334
622
623         Reviewed by Mark Lam.
624
625         Currently, if the bag is destructed any remaining nodes in the bag will
626         be leaked.
627
628         * wtf/LocklessBag.h:
629         (WTF::LocklessBag::consumeAll):
630         (WTF::LocklessBag::~LocklessBag):
631         * wtf/threads/Signals.cpp:
632         (WTF::jscSignalHandler):
633         (WTF::installSignalHandler):
634
635 2017-04-26  Don Olmstead  <don.olmstead@am.sony.com>
636
637         [ARM] Enable GCC visibility
638         https://bugs.webkit.org/show_bug.cgi?id=171296
639
640         Reviewed by Michael Catanzaro.
641
642         * wtf/Platform.h:
643
644 2017-04-26  Yusuke Suzuki  <utatane.tea@gmail.com>
645
646         sendMessageScoped's signal handler calls LocklessBag::consumeAll, which causes heap deallocation in signal handler and leads deadlock
647         https://bugs.webkit.org/show_bug.cgi?id=171319
648
649         Reviewed by Keith Miller.
650
651         In sendMessageScoped, we call LocklessBag<SignalHandler>::consumeAll `thread->threadMessages().consumeAll()`.
652         In LocklessBag::consumeAll, we call `delete` on Nodes.
653         The problem is that this is called under the context of signal handler. Thus, when calling this, the original
654         thread may hold the lock in bmalloc. In that case, this `delete` call attempts to lock the heap lock recursively,
655         and causes deadlock.
656
657         Instead, this patch transfers the LocklessBag's Node to the sender thread. And the sender thread deletes it instead.
658
659         * wtf/LocklessBag.h:
660         (WTF::LocklessBag::consumeAllWithNode):
661         * wtf/ThreadMessage.cpp:
662         (WTF::ThreadMessageData::ThreadMessageData):
663         (WTF::sendMessageScoped):
664
665 2017-04-25  Don Olmstead  <don.olmstead@am.sony.com>
666
667         [Win] Use Clang's __has_declspec_attribute for export macros
668         https://bugs.webkit.org/show_bug.cgi?id=171240
669
670         Reviewed by Alex Christensen.
671
672         * wtf/Compiler.h:
673         * wtf/ExportMacros.h:
674         * wtf/Platform.h:
675
676 2017-04-25  Keith Miller  <keith_miller@apple.com>
677
678         Our signal handler shouldn't print when sigaction succeeds
679         https://bugs.webkit.org/show_bug.cgi?id=171286
680
681         Reviewed by Michael Saboff.
682
683         It turns out !result is not the same as !!result.
684
685         * wtf/threads/Signals.cpp:
686         (WTF::jscSignalHandler):
687
688 2017-04-25  Myles C. Maxfield  <mmaxfield@apple.com>
689
690         Add performance test for FontCache::systemFallbackForCharacters()
691         https://bugs.webkit.org/show_bug.cgi?id=170842
692
693         Reviewed by Tim Horton.
694
695         * wtf/unicode/CharacterNames.h:
696
697 2017-04-24  Andy VanWagoner  <thetalecrafter@gmail.com>
698
699         Clean up ICU headers
700         https://bugs.webkit.org/show_bug.cgi?id=170997
701
702         Reviewed by JF Bastien.
703
704         Update all icu headers to 55.1
705
706         * icu/LICENSE: Update copyright
707         * icu/README: Explain ICU headers for OS X better
708         * icu/unicode/localpointer.h:
709         (LocalPointer::LocalPointer):
710         (LocalPointer::adoptInsteadAndCheckErrorCode):
711         * icu/unicode/platform.h:
712         * icu/unicode/putil.h:
713         * icu/unicode/std_string.h:
714         * icu/unicode/ubrk.h:
715         * icu/unicode/uchar.h:
716         * icu/unicode/ucnv.h:
717         * icu/unicode/ucol.h:
718         * icu/unicode/uconfig.h:
719         * icu/unicode/ucurr.h:
720         * icu/unicode/uloc.h:
721         * icu/unicode/umachine.h:
722         * icu/unicode/unistr.h:
723         (UnicodeString::getArrayStart):
724         (UnicodeString::UnicodeString):
725         (UnicodeString::hasShortLength):
726         (UnicodeString::getShortLength):
727         (UnicodeString::length):
728         (UnicodeString::getCapacity):
729         (UnicodeString::isBogus):
730         (UnicodeString::isWritable):
731         (UnicodeString::isBufferWritable):
732         (UnicodeString::getBuffer):
733         (UnicodeString::isEmpty):
734         (UnicodeString::setZeroLength):
735         (UnicodeString::setShortLength):
736         (UnicodeString::setLength):
737         (UnicodeString::setToEmpty):
738         (UnicodeString::remove):
739         * icu/unicode/urename.h:
740         * icu/unicode/uscript.h:
741         * icu/unicode/uset.h:
742         * icu/unicode/ustring.h:
743         * icu/unicode/utf8.h:
744         * icu/unicode/utypes.h:
745         * icu/unicode/uvernum.h:
746
747 2017-04-24  Yusuke Suzuki  <utatane.tea@gmail.com>
748
749         Unreviewed, fix Windows build after r215715
750         https://bugs.webkit.org/show_bug.cgi?id=171199
751
752         * wtf/StackTrace.h:
753
754 2017-04-24  Yusuke Suzuki  <utatane.tea@gmail.com>
755
756         [WTF] Move JSC tools/StackTrace to WTF and unify stack trace dump code
757         https://bugs.webkit.org/show_bug.cgi?id=171199
758
759         Reviewed by Mark Lam.
760
761         JSC tools/StackTrace's dump code is almost identical to WTF Assertions'
762         stack trace dump code. This patch moves tools/StackTrace to WTF and use
763         it in Assertions. It unifies the two duplicate implementations into one.
764
765         * WTF.xcodeproj/project.pbxproj:
766         * wtf/Assertions.cpp:
767         * wtf/CMakeLists.txt:
768         * wtf/Platform.h:
769         * wtf/StackTrace.cpp: Renamed from Source/JavaScriptCore/tools/StackTrace.cpp.
770         (WTF::StackTrace::captureStackTrace):
771         (WTF::StackTrace::dump):
772         * wtf/StackTrace.h: Copied from Source/JavaScriptCore/tools/StackTrace.h.
773         (WTF::StackTrace::StackTrace):
774         (WTF::StackTrace::stack):
775         (WTF::StackTrace::DemangleEntry::mangledName):
776         (WTF::StackTrace::DemangleEntry::demangledName):
777         (WTF::StackTrace::DemangleEntry::DemangleEntry):
778         * wtf/SystemFree.h: Renamed from Source/JavaScriptCore/tools/StackTrace.h.
779         (WTF::SystemFree::operator()):
780
781 2017-04-24  Yusuke Suzuki  <utatane.tea@gmail.com>
782
783         [AppleWin] The procedure entry point ?waitForThreadCompletion@WTF@@YAHI@Z could not be located in the dynamic link library WebKitQuartzCoreAdditions.dll
784         https://bugs.webkit.org/show_bug.cgi?id=171029
785
786         Reviewed by Brent Fulgham.
787
788         While WTF Threading APIs are updated, WebKitQuartzCoreAdditions.dll in Windows uses some of the old APIs,
789         waitForThreadCompletion and createThread. This patch implements both on top of the new APIs.
790         These APIs are only exposed in Windows for this compatibility problem and new code should not use it.
791
792         * wtf/ThreadHolder.cpp:
793         (WTF::ThreadHolder::initialize):
794         * wtf/ThreadHolder.h:
795         * wtf/ThreadHolderWin.cpp:
796         (WTF::ThreadHolder::get):
797         (WTF::ThreadHolder::platformInitialize):
798         (WTF::ThreadHolder::destruct):
799         * wtf/Threading.h:
800         * wtf/ThreadingWin.cpp:
801         (WTF::createThread):
802         (WTF::waitForThreadCompletion):
803
804 2017-04-24  Carlos Garcia Campos  <cgarcia@igalia.com>
805
806         [GTK] Switch to use ENABLE_REMOTE_INSPECTOR instead of ENABLE_INSPECTOR_SERVER for the remote inspector
807         https://bugs.webkit.org/show_bug.cgi?id=166680
808
809         Reviewed by Michael Catanzaro.
810
811         Add GRefPtr hash traits to allow using GRefPtr as a key of HashMaps.
812
813         * wtf/glib/GRefPtr.h:
814         (WTF::HashTraits<GRefPtr<P>>::emptyValue):
815         (WTF::HashTraits<GRefPtr<P>>::peek):
816         (WTF::HashTraits<GRefPtr<P>>::customDeleteBucket):
817
818 2017-04-22  Yusuke Suzuki  <utatane.tea@gmail.com>
819
820         [JSC] Get stack pointer without pthread attr
821         https://bugs.webkit.org/show_bug.cgi?id=171162
822
823         Reviewed by Mark Lam.
824
825         If HAVE(MACHINE_CONTEXT) is not enabled, we get stack base and boundary by using
826         pthread_attr functions. However, it is wrong since this function can be called
827         after the thread is suspended. In that case, we should not call any functions
828         that is not async signal safe. For example, pthread_getattr_np calls malloc.
829
830         Instead we use getApproximateStackPointer(), which returns approximate stack pointer.
831
832         * wtf/Threading.h:
833         * wtf/ThreadingPthreads.cpp:
834         (WTF::getApproximateStackPointer):
835         (WTF::isOnAlternativeSignalStack):
836         When gathering conservative roots, we should keep stack pointer pointing stack.
837         And if concurrent GC is enabled, we always need to keep the above invariant.
838         So, we do not support alternative signal stack.
839
840         (WTF::Thread::signalHandlerSuspendResume):
841         (WTF::Thread::getRegisters):
842
843 2017-04-22  Yusuke Suzuki  <utatane.tea@gmail.com>
844
845         REGRESSION(r215638): [Linux] Several worker tests are crashing in Thread::signalHandlerSuspendResume after r215638
846         https://bugs.webkit.org/show_bug.cgi?id=171159
847
848         Reviewed by Michael Catanzaro.
849
850         Now, SIGUSR2 is used by ThreadMessage. Instead SIGUSR1 becomes empty.
851         We should use some signal, that is not managed by WTF Signal mechanism
852         because the behaivor of this suspend and resume is a bit tricky.
853         For example, we set a bit tricky signal mask to sigaction to temporary
854         block SIGUSR2 in the handler to avoid nested SIGUSR2. And we cannot
855         use ThreadMessage to implement this mechanism because this suspend
856         and resume handler will stop in the middle of the handler by sigsuspend.
857         It is not the expected semantics by ThreadMessage.
858
859         So now, we use SIGUSR1 instead. And we note that SIGUSR1 is used for
860         pthread ports.
861
862         * wtf/ThreadingPthreads.cpp:
863         * wtf/threads/Signals.h:
864
865 2017-04-20  Sam Weinig  <sam@webkit.org>
866
867         Split cryptographic digest computation and parsing out of CSP code so it can be reused
868         https://bugs.webkit.org/show_bug.cgi?id=171076
869
870         Reviewed by Chris Dumez.
871
872         * wtf/text/Base64.cpp:
873         (WTF::base64Decode):
874         (WTF::base64URLDecode):
875         Add overloads for base64Decode and base64URLDecode that take a StringView, to avoid allocations
876         of Strings.
877
878         * wtf/text/Base64.h:
879         (WTF::isBase64OrBase64URLCharacter):
880         Move helper predicate used for parsing either type of Base64 encoded string from WebCore.
881
882 2017-04-21  Keith Miller  <keith_miller@apple.com>
883
884         Unreviewed, rolling out r215634.
885
886         underlying build issues should have been fixed
887
888         Reverted changeset:
889
890         "Unreviewed, rolling out r215620 and r215623."
891         https://bugs.webkit.org/show_bug.cgi?id=171139
892         http://trac.webkit.org/changeset/215634
893
894 2017-04-21  Keith Miller  <keith_miller@apple.com>
895
896         Remove LL/SC from Atomics
897         https://bugs.webkit.org/show_bug.cgi?id=171141
898
899         Reviewed by Saam Barati.
900
901         Adding load link and store conditionally was not an actual progression
902         and the existing code is causing problems for users of Atomics. So let's
903         get rid of it.
904
905         * wtf/Atomics.h:
906         (WTF::hasFence):
907         (WTF::Atomic::exchange):
908         (WTF::Atomic::transaction):
909         (WTF::Atomic::transactionRelaxed):
910         (WTF::Atomic::prepare): Deleted.
911         (WTF::Atomic::attempt): Deleted.
912         * wtf/Bitmap.h:
913         (WTF::WordType>::concurrentTestAndSet):
914         (WTF::WordType>::concurrentTestAndClear):
915         * wtf/LockAlgorithm.h:
916         (WTF::LockAlgorithm::lockFast):
917         (WTF::LockAlgorithm::unlockFast):
918
919 2017-04-21  Commit Queue  <commit-queue@webkit.org>
920
921         Unreviewed, rolling out r215620 and r215623.
922         https://bugs.webkit.org/show_bug.cgi?id=171139
923
924         broke arm64 build (Requested by keith_miller on #webkit).
925
926         Reverted changesets:
927
928         "Add signaling API"
929         https://bugs.webkit.org/show_bug.cgi?id=170976
930         http://trac.webkit.org/changeset/215620
931
932         "Unreviewed, fix Cloop build."
933         http://trac.webkit.org/changeset/215623
934
935 2017-04-20  Keith Miller  <keith_miller@apple.com>
936
937         Add signaling API
938         https://bugs.webkit.org/show_bug.cgi?id=170976
939
940         Reviewed by Filip Pizlo.
941
942         This patch adds a bunch of new functionality to WTF. First, it add
943         a new data structure of a lockless bag. The LocklessBag class can
944         be used as either a multi-writer multi-reader lockless bag or a
945         multi-writer single consumer lockless bag.
946
947         Next, this patch adds an abstraction around sigaction in WTF.
948         Basically, you can add a handler, which can be an arbitrary
949         lambda. Although it should still be safe for the signal you are
950         handling.  the signal handler manager will then do all the
951         appropriate handling of chaining:
952
953         In the SIGUSR case we always forward the signal to any other
954         non-default handler installed before us. We need to do this,
955         otherwise, since it's not possible to tell if a SIGUSR was
956         intended exlusively for our handlers. Signal handlers don't record
957         how many times they were sent only that there is at least one
958         unhandled signal.
959
960         In the faulting cases we require that every handle be able to
961         recognise a fault they installed, vs crashes. If none of our
962         handlers claim to have handled the fault we will forward the
963         fault. If a handler was installed before the first fault handler
964         we simply call that handler and rely on them to take the
965         appropriate action. If no handler was installed before our first
966         handler we restore the default handler and allow the fault to
967         happen again.
968
969         Finally, this patch adds a signal based messaging system.  This
970         system allows the user to run an arbitrary lambda from the SIGUSR2
971         signal handler of any target WTF::Thread. This is already in use
972         for the VMTraps API which allows us to kill rogue VMs by sending
973         the VM's running WTF::Thread a SIGUSR and requesting it jetison
974         all optimized code and throw an uncatchable exception from all
975         function entries/loop backedges.  In the future, we will also use
976         this API for Wasm to reset the instruction caches in currently
977         executing Wasm threads.
978
979         * WTF.xcodeproj/project.pbxproj:
980         * wtf/Atomics.h:
981         (WTF::Atomic::Atomic):
982         * wtf/LocklessBag.h: Added.
983         (WTF::LocklessBag::LocklessBag):
984         (WTF::LocklessBag::add):
985         (WTF::LocklessBag::iterate):
986         (WTF::LocklessBag::consumeAll):
987         * wtf/ThreadMessage.cpp: Added.
988         (WTF::ThreadMessageData::ThreadMessageData):
989         (WTF::initializeThreadMessages):
990         (WTF::sendMessageScoped):
991         * wtf/ThreadMessage.h: Added.
992         (WTF::sendMessage):
993         * wtf/Threading.cpp:
994         (WTF::initializeThreading):
995         * wtf/Threading.h:
996         (WTF::Thread::threadMessages):
997         * wtf/ThreadingPthreads.cpp:
998         (WTF::Thread::currentMayBeNull):
999         (WTF::Thread::current):
1000         (WTF::Thread::signal):
1001         * wtf/threads/Signals.cpp: Added.
1002         (WTF::jscSignalHandler):
1003         (WTF::installSignalHandler):
1004         * wtf/threads/Signals.h: Added.
1005         (WTF::toSystemSignal):
1006         (WTF::fromSystemSignal):
1007
1008 2017-04-21  Konstantin Tokarev  <annulen@yandex.ru>
1009
1010         [cmake] WTF target should not have wtf and subdirectries in public interface
1011         https://bugs.webkit.org/show_bug.cgi?id=171115
1012
1013         Reviewed by Michael Catanzaro.
1014
1015         In r209665 WEBCORE_FRAMEWORK macro started to export INCLUDE_DIRECTORIES of
1016         targets as their public interface, so that linked targets can use them
1017         implicitly without copying directory lists around. This matches existing
1018         practice for all targets except WTF, headers from which are always included
1019         with full path starting from "<wtf/...".
1020
1021         Since r209665 it became possible to include headers from wtf or its
1022         subdirectories in CMake builds without using "<wtf/..." path. It should
1023         not be allowed.
1024
1025         * wtf/CMakeLists.txt: WTF/wtf and its sudirectories should not be in
1026         public include paths of WTF target.
1027
1028 2017-04-20  Sam Weinig  <sam@webkit.org>
1029
1030         Move notFound into its own file
1031         https://bugs.webkit.org/show_bug.cgi?id=170972
1032
1033         Reviewed by Zalan Bujtas.
1034
1035         It is odd to require including <wtf/Vector.h> just to use WTF::notFound.
1036         This is not causing any current problems, but does in few changes I have
1037         queued up.
1038
1039         * WTF.xcodeproj/project.pbxproj:
1040         * wtf/NotFound.h: Added.
1041         * wtf/Vector.h:
1042         * wtf/text/StringCommon.h:
1043
1044 2017-04-20  Filip Pizlo  <fpizlo@apple.com>
1045
1046         Optimize SharedArrayBuffer in the DFG+FTL
1047         https://bugs.webkit.org/show_bug.cgi?id=164108
1048
1049         Reviewed by Saam Barati.
1050         
1051         Made small changes as part of benchmarking the JS versions of these locks.
1052
1053         * benchmarks/LockSpeedTest.cpp:
1054         * benchmarks/ToyLocks.h:
1055         * wtf/Range.h:
1056         (WTF::Range::dump):
1057
1058 2017-04-19  Youenn Fablet  <youenn@apple.com>
1059
1060         [Win] Activate streams API by default
1061         https://bugs.webkit.org/show_bug.cgi?id=171000
1062
1063         Reviewed by Brent Fulgham.
1064
1065         * wtf/FeatureDefines.h:
1066
1067 2017-04-19  David Kilzer  <ddkilzer@apple.com>
1068
1069         Vector.h: error: 'auto' not allowed in lambda parameter
1070         <https://webkit.org/b/171010>
1071         <rdar://problem/31716076>
1072
1073         Reviewed by Saam Barati.
1074
1075         * wtf/Vector.h:
1076         (WTF::removeRepeatedElements): Replace 'auto' with a specific
1077         type, 'T', based on a Vector<> template type.
1078
1079 2017-04-19  Ryan Haddad  <ryanhaddad@apple.com>
1080
1081         Unreviewed, rolling out r215518.
1082
1083         This change appears to have broken the Windows build.
1084
1085         Reverted changeset:
1086
1087         "Move notFound into its own file"
1088         https://bugs.webkit.org/show_bug.cgi?id=170972
1089         http://trac.webkit.org/changeset/215518
1090
1091 2017-04-19  Sam Weinig  <sam@webkit.org>
1092
1093         Move notFound into its own file
1094         https://bugs.webkit.org/show_bug.cgi?id=170972
1095
1096         Reviewed by Zalan Bujtas.
1097
1098         It is odd to require including <wtf/Vector.h> just to use WTF::notFound.
1099         This is not causing any current problems, but does in few changes I have
1100         queued up.
1101
1102         * WTF.xcodeproj/project.pbxproj:
1103         * wtf/NotFound.h: Added.
1104         * wtf/Vector.h:
1105         * wtf/text/StringCommon.h:
1106
1107 2017-04-18  Carlos Garcia Campos  <cgarcia@igalia.com>
1108
1109         [GLIB] Define priorities also for async network IO tasks
1110         https://bugs.webkit.org/show_bug.cgi?id=170905
1111
1112         Reviewed by Žan Doberšek.
1113
1114         Add AsyncIONetwork, DiskCacheRead and DiskCacheWrite priorities.
1115
1116         * wtf/glib/RunLoopSourcePriority.h:
1117
1118 2017-04-18  Yusuke Suzuki  <utatane.tea@gmail.com>
1119
1120         [JSC][GTK] glib RunLoop does not accept negative start interval
1121         https://bugs.webkit.org/show_bug.cgi?id=170775
1122
1123         Reviewed by Saam Barati.
1124
1125         RunLoop::Timer for glib does not accept negative start interval.
1126         We use 0_s if the given value is negative.
1127
1128         * wtf/glib/RunLoopGLib.cpp:
1129         (WTF::RunLoop::TimerBase::secondsUntilFire):
1130
1131 2017-04-17  Alex Christensen  <achristensen@webkit.org>
1132
1133         Allow Variants of RetainPtrs
1134         https://bugs.webkit.org/show_bug.cgi?id=170923
1135
1136         Reviewed by Tim Horton and Sam Weinig.
1137
1138         * wtf/RetainPtr.h:
1139         (WTF::RetainPtr::operator&): Deleted.
1140         Operator& was causing a compile error when making Variant<RetainPtr<T>, ...>
1141         and because it is strange and only used once, let's just remove it.
1142         * wtf/Variant.h:
1143         (WTF::get):
1144         (WTF::get_if):
1145         Use std::addressof instead of operator& which could be overloaded to return any type with any meaning.
1146
1147 2017-04-17  Youenn Fablet  <youenn@apple.com>
1148
1149         Disable outdated WritableStream API
1150         https://bugs.webkit.org/show_bug.cgi?id=170749
1151         <rdar://problem/31446233>
1152
1153         Reviewed by Alex Christensen.
1154
1155         Replacing READABLE_STREAM_API, READABLE_BYTE_STREAM_API and WRITABLE_STREAM_API compilation flag by:
1156         - A STREAMS_API compilation flag.
1157         - A ReadableByteStreamAPI and WritableStreamAPI runtime flags, turned off except for RWT and DRT.
1158
1159         * wtf/FeatureDefines.h:
1160
1161 2017-04-17  Dan Bernstein  <mitz@apple.com>
1162
1163         [Cocoa] Move isNullFunctionPointer down into WTF
1164         https://bugs.webkit.org/show_bug.cgi?id=170892
1165
1166         Reviewed by Sam Weinig.
1167
1168         Test: TestWebKitAPI/Tests/WTF/darwin/WeakLinking.cpp
1169
1170         * WTF.xcodeproj/project.pbxproj: Added reference to new file.
1171         * wtf/darwin: Added.
1172         * wtf/darwin/WeakLinking.h: Added.
1173         (WTF::isNullFunctionPointer): Copied from ResourceLoadStatisticsClassifierCocoa.cpp in
1174           WebKit2 and changed into a function template that works with any function pointer.
1175
1176 2017-04-17  Ryan Haddad  <ryanhaddad@apple.com>
1177
1178         Unreviewed, rolling out r215366.
1179
1180         This test is failing on performance bots.
1181
1182         Reverted changeset:
1183
1184         "Add performance test for asking the platform for a font for
1185         U+2060 WORD JOINER"
1186         https://bugs.webkit.org/show_bug.cgi?id=170842
1187         http://trac.webkit.org/changeset/215366
1188
1189 2017-04-17  Yusuke Suzuki  <utatane.tea@gmail.com>
1190
1191         [JSCOnly] Fix build failures in macOS
1192         https://bugs.webkit.org/show_bug.cgi?id=170887
1193
1194         Reviewed by Alex Christensen.
1195
1196         JSCOnly port does not use mac/MainThread.cpp.
1197         We change the ifdef gurard to use generic implementaion in JSCOnly on macOS.
1198
1199         * wtf/MainThread.cpp:
1200         * wtf/PlatformJSCOnly.cmake:
1201
1202 2017-04-17  JF Bastien  <jfbastien@apple.com>
1203
1204         B3: don't allow unsigned offsets in Value
1205         https://bugs.webkit.org/show_bug.cgi?id=170692
1206
1207         Reviewed by Filip Pizlo.
1208
1209         Add C++17's std::conjunction type trait, except for Microsoft VS
1210         2015 update 2 and later because it adds the logical operator type
1211         traits, event when C++ is pre-2017:
1212         https://blogs.msdn.microsoft.com/vcblog/2016/01/22/vs-2015-update-2s-stl-is-c17-so-far-feature-complete/
1213
1214         * wtf/StdLibExtras.h:
1215
1216 2017-04-14  Mark Lam  <mark.lam@apple.com>
1217
1218         Update architectures in xcconfig files.
1219         https://bugs.webkit.org/show_bug.cgi?id=170867
1220         <rdar://problem/31628104>
1221
1222         Reviewed by Joseph Pecoraro.
1223
1224         * Configurations/Base.xcconfig:
1225
1226 2017-04-14  Myles C. Maxfield  <mmaxfield@apple.com>
1227
1228         Add performance test for asking the platform for a font for U+2060 WORD JOINER
1229         https://bugs.webkit.org/show_bug.cgi?id=170842
1230
1231         Reviewed by Tim Horton.
1232
1233         * wtf/unicode/CharacterNames.h:
1234
1235 2017-04-13  Yusuke Suzuki  <utatane.tea@gmail.com>
1236
1237         [JSC] Date.parse should accept wider range of representation
1238         https://bugs.webkit.org/show_bug.cgi?id=170720
1239
1240         Reviewed by Darin Adler.
1241
1242         We would like to relax Date.parse to accept the representation "May 8".
1243         At that time, we choose `2000` as a default year. This is because of
1244         the following reason.
1245
1246         1. According to the V8, this default value is compatible to the old KJS. While current V8 uses 2001,
1247            SpiderMonkey does not have such a fallback path. So this reason is not big deal.
1248
1249         2. It is a leap year. When using `new Date("Feb 29")`, we assume that people want to save month and day.
1250            Leap year can save user inputs if they is valid. If we use the current year instead, the current year
1251            may not be a leap year. In that case, `new Date("Feb 29").getMonth()` becomes 2 (March).
1252
1253         * wtf/DateMath.cpp:
1254         (WTF::parseDateFromNullTerminatedCharacters):
1255
1256 2017-04-13  Dan Bernstein  <mitz@apple.com>
1257
1258         WTF installs an extra copy of a header outside /usr/local/include/wtf
1259
1260         * WTF.xcodeproj/project.pbxproj: Demoted PriorityQueue.h from Private to Project.
1261
1262 2017-04-13  Oliver Hunt  <oliver@apple.com>
1263
1264         allocationSize should use safe arithmetic by default
1265         https://bugs.webkit.org/show_bug.cgi?id=170804
1266
1267         Reviewed by JF Bastien.
1268
1269         Make all allocationSize() functions work in terms
1270         of Checked<size_t>
1271
1272         * wtf/text/StringImpl.h:
1273         (WTF::StringImpl::allocationSize):
1274         (WTF::StringImpl::tailOffset):
1275
1276 2017-04-13  JF Bastien  <jfbastien@apple.com>
1277
1278         WebAssembly: manage memory better
1279         https://bugs.webkit.org/show_bug.cgi?id=170628
1280
1281         Reviewed by Keith Miller, Michael Saboff.
1282
1283         Re-use a VM tag which was intended for JavaScript core, was then
1284         used by our GC, and is now unused. If I don't do this then
1285         WebAssembly fast memories will make vmmap look super weird because
1286         it'll look like multi-gigabyte of virtual memory are allocated as
1287         part of our process' regular memory!
1288
1289         Separately I need to update vmmap and other tools to print the
1290         right name. Right now this tag gets identified as "JS garbage
1291         collector".
1292
1293         * wtf/OSAllocator.h:
1294         * wtf/VMTags.h:
1295
1296 2017-04-13  Yusuke Suzuki  <utatane.tea@gmail.com>
1297
1298         [JSC] Use proper ifdef guard for code using MachineContext
1299         https://bugs.webkit.org/show_bug.cgi?id=170800
1300
1301         Reviewed by Carlos Alberto Lopez Perez.
1302
1303         SamplingProfiler and FastMemory rely on MachineContext feature.
1304
1305         * wtf/Platform.h:
1306
1307 2017-04-12  Dan Bernstein  <mitz@apple.com>
1308
1309         [Mac] Future-proof .xcconfig files
1310         https://bugs.webkit.org/show_bug.cgi?id=170802
1311
1312         Reviewed by Tim Horton.
1313
1314         * Configurations/Base.xcconfig:
1315         * Configurations/DebugRelease.xcconfig:
1316
1317 2017-04-12  Yusuke Suzuki  <utatane.tea@gmail.com>
1318
1319         Use HAVE(MACHINE_CONTEXT) instead of USE(MACHINE_CONTEXT)
1320         https://bugs.webkit.org/show_bug.cgi?id=170770
1321
1322         Rubber stamped by Mark Lam.
1323
1324         * wtf/Platform.h:
1325         * wtf/PlatformRegisters.h:
1326         * wtf/ThreadingPthreads.cpp:
1327         (WTF::Thread::getRegisters):
1328
1329 2017-04-12  Yusuke Suzuki  <utatane.tea@gmail.com>
1330
1331         [JSC] Clean up heap/MachineStackMarker by introducing USE(MACHINE_CONTEXT)
1332         https://bugs.webkit.org/show_bug.cgi?id=170770
1333
1334         Reviewed by Mark Lam.
1335
1336         We add a new define USE_MACHINE_CONTEXT, which becomes true if mcontext_t exists
1337         and we know the way to retrieve values from mcontext_t.
1338
1339         * wtf/Platform.h:
1340         * wtf/PlatformRegisters.h:
1341         * wtf/ThreadingPthreads.cpp:
1342         (WTF::Thread::getRegisters):
1343
1344 2017-04-12  Yusuke Suzuki  <utatane.tea@gmail.com>
1345
1346         [WTF] Introduce Thread class and use RefPtr<Thread> and align Windows Threading implementation semantics to Pthread one
1347         https://bugs.webkit.org/show_bug.cgi?id=170502
1348
1349         Reviewed by Mark Lam.
1350
1351         This patch is refactoring of WTF Threading mechanism to merge JavaScriptCore's threading extension to WTF Threading.
1352         Previously, JavaScriptCore requires richer threading features (such as suspending and resuming threads), and they
1353         are implemented for PlatformThread in JavaScriptCore. But these features should be implemented in WTF Threading side
1354         instead of maintaining JSC's own threading features too. This patch removes these features from JSC and move it to
1355         WTF Threading.
1356
1357         However, current WTF Threading has one problem: Windows version of WTF Threading has different semantics from Pthreads
1358         one. In Windows WTF Threading, we cannot perform any operation after the target thread is detached: WTF Threading stop
1359         tracking the state of the thread once the thread is detached. But this is not the same to Pthreads one. In Pthreads,
1360         pthread_detach just means that the resource of the thread will be destroyed automatically. While some operations like
1361         pthread_join will be rejected, some operations like pthread_kill will be accepted.
1362
1363         The problem is that detached thread can be suspended and resumed in JSC. For example, in jsc.cpp, we start the worker
1364         thread and detach it immediately. In worker thread, we will create VM and thus concurrent GC will suspend and resume
1365         the detached thread. However, in Windows WTF Threading, we have no reference to the detached thread. Thus we cannot
1366         perform suspend and resume operations onto the detached thread.
1367
1368         To solve the problem, we change Windows Threading mechanism drastically to align it to the Pthread semantics. In the
1369         new Threading, we have RefPtr<Thread> class. It holds a handle to a platform thread. We can perform threading operations
1370         with this class. For example, Thread::suspend is offered. And we use destructor of the thread local variable to release
1371         the resources held by RefPtr<Thread>. In Windows, Thread::detach does nothing because the resource will be destroyed
1372         automatically by RefPtr<Thread>.
1373
1374         To do so, we introduce ThreadHolder for Windows. This is similar to the previous ThreadIdentifierData for Pthreads.
1375         It holds RefPtr<Thread> in the thread local storage (technically, it is Fiber Local Storage in Windows). Thread::current()
1376         will return this reference.
1377
1378         The problematic situation is that the order of the deallocation of the thread local storage is not defined. So we should
1379         not touch thread local storage in the destructor of the thread local storage. To avoid such edge cases, we have
1380         currentThread() / Thread::currentID() APIs. They are safe to be called even in the destructor of the other thread local
1381         storage. And in Windows, in the FLS destructor, we will create the thread_local variable to defer the destruction of
1382         the ThreadHolder. We ensure that this destructor is called after the other FLS destructors are called in Windows 10.
1383
1384         This patch is performance neutral.
1385
1386         * WTF.xcodeproj/project.pbxproj:
1387         * benchmarks/ConditionSpeedTest.cpp:
1388         * benchmarks/LockFairnessTest.cpp:
1389         * benchmarks/LockSpeedTest.cpp:
1390         * wtf/AutomaticThread.cpp:
1391         (WTF::AutomaticThread::start):
1392         * wtf/CMakeLists.txt:
1393         * wtf/MainThread.h:
1394         * wtf/MemoryPressureHandler.h:
1395         * wtf/ParallelJobsGeneric.cpp:
1396         (WTF::ParallelEnvironment::ThreadPrivate::tryLockFor):
1397         (WTF::ParallelEnvironment::ThreadPrivate::workerThread):
1398         * wtf/ParallelJobsGeneric.h:
1399         (WTF::ParallelEnvironment::ThreadPrivate::ThreadPrivate): Deleted.
1400         * wtf/ParkingLot.cpp:
1401         (WTF::ParkingLot::forEachImpl):
1402         * wtf/ParkingLot.h:
1403         (WTF::ParkingLot::forEach):
1404         * wtf/PlatformRegisters.h: Renamed from Source/JavaScriptCore/runtime/PlatformThread.h.
1405         * wtf/RefPtr.h:
1406         (WTF::RefPtr::RefPtr):
1407         * wtf/ThreadFunctionInvocation.h:
1408         (WTF::ThreadFunctionInvocation::ThreadFunctionInvocation):
1409         * wtf/ThreadHolder.cpp: Added.
1410         (WTF::ThreadHolder::~ThreadHolder):
1411         (WTF::ThreadHolder::initialize):
1412         * wtf/ThreadHolder.h: Renamed from Source/WTF/wtf/ThreadIdentifierDataPthreads.h.
1413         (WTF::ThreadHolder::thread):
1414         (WTF::ThreadHolder::ThreadHolder):
1415         * wtf/ThreadHolderPthreads.cpp: Renamed from Source/WTF/wtf/ThreadIdentifierDataPthreads.cpp.
1416         (WTF::ThreadHolder::initializeOnce):
1417         (WTF::ThreadHolder::current):
1418         (WTF::ThreadHolder::destruct):
1419         * wtf/ThreadHolderWin.cpp: Added.
1420         (WTF::threadMapMutex):
1421         (WTF::threadMap):
1422         (WTF::ThreadHolder::initializeOnce):
1423         (WTF::ThreadHolder::current):
1424         (WTF::ThreadHolder::destruct):
1425         * wtf/ThreadSpecific.h:
1426         * wtf/Threading.cpp:
1427         (WTF::Thread::normalizeThreadName):
1428         (WTF::threadEntryPoint):
1429         (WTF::Thread::create):
1430         (WTF::Thread::setCurrentThreadIsUserInteractive):
1431         (WTF::Thread::setCurrentThreadIsUserInitiated):
1432         (WTF::Thread::setGlobalMaxQOSClass):
1433         (WTF::Thread::adjustedQOSClass):
1434         (WTF::Thread::dump):
1435         (WTF::initializeThreading):
1436         (WTF::normalizeThreadName): Deleted.
1437         (WTF::createThread): Deleted.
1438         (WTF::setCurrentThreadIsUserInteractive): Deleted.
1439         (WTF::setCurrentThreadIsUserInitiated): Deleted.
1440         (WTF::setGlobalMaxQOSClass): Deleted.
1441         (WTF::adjustedQOSClass): Deleted.
1442         * wtf/Threading.h:
1443         (WTF::Thread::id):
1444         (WTF::Thread::operator==):
1445         (WTF::Thread::operator!=):
1446         (WTF::Thread::joinableState):
1447         (WTF::Thread::didBecomeDetached):
1448         (WTF::Thread::didJoin):
1449         (WTF::Thread::hasExited):
1450         (WTF::currentThread):
1451         * wtf/ThreadingPthreads.cpp:
1452         (WTF::Thread::Thread):
1453         (WTF::Thread::~Thread):
1454         (WTF::Thread::signalHandlerSuspendResume):
1455         (WTF::Thread::initializePlatformThreading):
1456         (WTF::initializeCurrentThreadEvenIfNonWTFCreated):
1457         (WTF::wtfThreadEntryPoint):
1458         (WTF::Thread::createInternal):
1459         (WTF::Thread::initializeCurrentThreadInternal):
1460         (WTF::Thread::changePriority):
1461         (WTF::Thread::waitForCompletion):
1462         (WTF::Thread::detach):
1463         (WTF::Thread::current):
1464         (WTF::Thread::currentID):
1465         (WTF::Thread::signal):
1466         (WTF::Thread::resume):
1467         (WTF::Thread::getRegisters):
1468         (WTF::Thread::didExit):
1469         (WTF::Thread::establish):
1470         (WTF::PthreadState::PthreadState): Deleted.
1471         (WTF::PthreadState::joinableState): Deleted.
1472         (WTF::PthreadState::pthreadHandle): Deleted.
1473         (WTF::PthreadState::didBecomeDetached): Deleted.
1474         (WTF::PthreadState::didExit): Deleted.
1475         (WTF::PthreadState::didJoin): Deleted.
1476         (WTF::PthreadState::hasExited): Deleted.
1477         (WTF::threadMapMutex): Deleted.
1478         (WTF::initializeThreading): Deleted.
1479         (WTF::threadMap): Deleted.
1480         (WTF::identifierByPthreadHandle): Deleted.
1481         (WTF::establishIdentifierForPthreadHandle): Deleted.
1482         (WTF::pthreadHandleForIdentifierWithLockAlreadyHeld): Deleted.
1483         (WTF::createThreadInternal): Deleted.
1484         (WTF::initializeCurrentThreadInternal): Deleted.
1485         (WTF::changeThreadPriority): Deleted.
1486         (WTF::waitForThreadCompletion): Deleted.
1487         (WTF::detachThread): Deleted.
1488         (WTF::threadDidExit): Deleted.
1489         (WTF::currentThread): Deleted.
1490         (WTF::signalThread): Deleted.
1491         * wtf/ThreadingWin.cpp:
1492         (WTF::Thread::Thread):
1493         (WTF::Thread::~Thread):
1494         (WTF::Thread::initializeCurrentThreadInternal):
1495         (WTF::Thread::initializePlatformThreading):
1496         (WTF::wtfThreadEntryPoint):
1497         (WTF::Thread::createInternal):
1498         (WTF::Thread::changePriority):
1499         (WTF::Thread::waitForCompletion):
1500         (WTF::Thread::detach):
1501         (WTF::Thread::resume):
1502         (WTF::Thread::getRegisters):
1503         (WTF::Thread::current):
1504         (WTF::Thread::currentID):
1505         (WTF::Thread::didExit):
1506         (WTF::Thread::establish):
1507         (WTF::initializeCurrentThreadInternal): Deleted.
1508         (WTF::threadMapMutex): Deleted.
1509         (WTF::initializeThreading): Deleted.
1510         (WTF::threadMap): Deleted.
1511         (WTF::storeThreadHandleByIdentifier): Deleted.
1512         (WTF::threadHandleForIdentifier): Deleted.
1513         (WTF::clearThreadHandleForIdentifier): Deleted.
1514         (WTF::createThreadInternal): Deleted.
1515         (WTF::changeThreadPriority): Deleted.
1516         (WTF::waitForThreadCompletion): Deleted.
1517         (WTF::detachThread): Deleted.
1518         (WTF::currentThread): Deleted.
1519         * wtf/WorkQueue.cpp:
1520         (WTF::WorkQueue::concurrentApply):
1521         * wtf/WorkQueue.h:
1522         * wtf/cocoa/WorkQueueCocoa.cpp:
1523         (WTF::dispatchQOSClass):
1524         * wtf/generic/WorkQueueGeneric.cpp:
1525         (WorkQueue::platformInitialize):
1526         (WorkQueue::platformInvalidate):
1527         * wtf/linux/MemoryPressureHandlerLinux.cpp:
1528         (WTF::MemoryPressureHandler::EventFDPoller::EventFDPoller):
1529         (WTF::MemoryPressureHandler::EventFDPoller::~EventFDPoller):
1530         * wtf/win/MainThreadWin.cpp:
1531         (WTF::initializeMainThreadPlatform):
1532
1533 2017-04-11  Zan Dobersek  <zdobersek@igalia.com>
1534
1535         [GTK] Use the DisplayRefreshMonitor facilities
1536         https://bugs.webkit.org/show_bug.cgi?id=170599
1537
1538         Reviewed by Carlos Garcia Campos.
1539
1540         * wtf/Platform.h: Enable USE_REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR for the GTK+ port.
1541         * wtf/glib/RunLoopSourcePriority.h: Add the DisplayRefreshMonitorTimer entry that
1542         matches the value of LayerFlushTimer.
1543
1544 2017-04-11  Yusuke Suzuki  <utatane.tea@gmail.com>
1545
1546         [WebCore][JSC] ResourceUsageData.{timeOfNextEdenCollection,timeOfNextFullCollection} should be MonotonicTime
1547         https://bugs.webkit.org/show_bug.cgi?id=170725
1548
1549         Reviewed by Sam Weinig.
1550
1551         Make MonotonicTime more constexpr friendly mainly to annotate MonotonicTime::nan() as constexpr.
1552
1553         * wtf/MonotonicTime.h:
1554         (WTF::MonotonicTime::MonotonicTime):
1555         (WTF::MonotonicTime::fromRawSeconds):
1556         (WTF::MonotonicTime::infinity):
1557         (WTF::MonotonicTime::nan):
1558         (WTF::MonotonicTime::secondsSinceEpoch):
1559         (WTF::MonotonicTime::operator bool):
1560         (WTF::MonotonicTime::operator+):
1561         (WTF::MonotonicTime::operator-):
1562         (WTF::MonotonicTime::operator==):
1563         (WTF::MonotonicTime::operator!=):
1564         (WTF::MonotonicTime::operator<):
1565         (WTF::MonotonicTime::operator>):
1566         (WTF::MonotonicTime::operator<=):
1567         (WTF::MonotonicTime::operator>=):
1568
1569 2017-04-11  Yusuke Suzuki  <utatane.tea@gmail.com>
1570
1571         Unreviewed, build fix for Windows port after r215228
1572         https://bugs.webkit.org/show_bug.cgi?id=170723
1573
1574         * wtf/win/RunLoopWin.cpp:
1575         (WTF::RunLoop::TimerBase::timerFired):
1576
1577 2017-04-11  Yusuke Suzuki  <utatane.tea@gmail.com>
1578
1579         [JSC][GTK] Use RunLoop::Timer in GTK port
1580         https://bugs.webkit.org/show_bug.cgi?id=170723
1581
1582         Reviewed by Carlos Garcia Campos.
1583
1584         Add secondsUntilFire method. And add setName and setPriority
1585         for GTK RunLoop::Timer.
1586
1587         * wtf/RunLoop.h:
1588         * wtf/cf/RunLoopCF.cpp:
1589         (WTF::RunLoop::TimerBase::secondsUntilFire):
1590         * wtf/generic/RunLoopGeneric.cpp:
1591         (WTF::RunLoop::TimerBase::secondsUntilFire):
1592         * wtf/glib/RunLoopGLib.cpp:
1593         (WTF::RunLoop::TimerBase::setName):
1594         (WTF::RunLoop::TimerBase::secondsUntilFire):
1595         * wtf/win/RunLoopWin.cpp:
1596         (WTF::RunLoop::TimerBase::timerFired):
1597         (WTF::RunLoop::TimerBase::start):
1598         (WTF::RunLoop::TimerBase::isActive):
1599         (WTF::RunLoop::TimerBase::secondsUntilFire):
1600
1601 2017-04-11  Yusuke Suzuki  <utatane.tea@gmail.com>
1602
1603         [JSC] Enable JSRunLoopTimer for JSCOnly and Windows
1604         https://bugs.webkit.org/show_bug.cgi?id=170655
1605
1606         Reviewed by Carlos Garcia Campos.
1607
1608         This patch makes RunLoop::Timer in Generic and Windows thread-safe to use it
1609         in JSC's JSRunLoopTimer. Eventually, we would like to replace JSRunLoopTimer's
1610         platform-dependent implementation to WTF::RunLoop::Timer.
1611
1612         * wtf/RunLoop.h:
1613         * wtf/cf/RunLoopCF.cpp:
1614         (WTF::RunLoop::TimerBase::start):
1615         * wtf/generic/RunLoopGeneric.cpp:
1616         (WTF::RunLoop::TimerBase::ScheduledTask::EarliestSchedule::operator()):
1617         (WTF::RunLoop::populateTasks):
1618         (WTF::RunLoop::runImpl):
1619         (WTF::RunLoop::schedule):
1620         (WTF::RunLoop::scheduleAndWakeUp):
1621         (WTF::RunLoop::TimerBase::~TimerBase):
1622         (WTF::RunLoop::TimerBase::start):
1623         (WTF::RunLoop::TimerBase::stop):
1624         (WTF::RunLoop::TimerBase::isActive):
1625         * wtf/glib/RunLoopGLib.cpp:
1626         (WTF::RunLoop::TimerBase::TimerBase):
1627         * wtf/win/RunLoopWin.cpp:
1628         (WTF::RunLoop::TimerBase::timerFired):
1629         (WTF::RunLoop::TimerBase::start):
1630         (WTF::RunLoop::TimerBase::stop):
1631         (WTF::RunLoop::TimerBase::isActive):
1632
1633 2017-04-11  Zan Dobersek  <zdobersek@igalia.com>
1634
1635         REGRESSION(r213645): It made JSC tests super slow and timeout on AArch64 Linux
1636         https://bugs.webkit.org/show_bug.cgi?id=169510
1637
1638         Reviewed by Saam Barati.
1639
1640         Add the `volatile` qualifiers for ASM statements that set up ldxr and stxr
1641         instruction calls when HAVE(LL_SC) is enabled for aarch64 platforms.
1642
1643         This avoids indefinite execution when running GCC-compiled JSC on Linux.
1644         Specific bug or expected behavior that differs from Clang wasn't determined.
1645
1646         HAVE(LL_SC) is re-enabled on non-Darwin aarch64 platforms.
1647
1648         * wtf/Atomics.h:
1649         * wtf/Platform.h:
1650
1651 2017-04-10  Thorsten Glaser  <tg@mirbsd.de>
1652
1653         [GTK] Fix x32 build
1654         https://bugs.webkit.org/show_bug.cgi?id=170673
1655
1656         Reviewed by Carlos Alberto Lopez Perez.
1657
1658         * wtf/Platform.h:
1659
1660 2017-04-09  Yusuke Suzuki  <utatane.tea@gmail.com>
1661
1662         [WTF] Annotate Seconds' member functions and operators with constexpr
1663         https://bugs.webkit.org/show_bug.cgi?id=170662
1664
1665         Reviewed by Daniel Bates.
1666
1667         Annotate Seconds' member functions and operators with constexpr.
1668         It allows us to use Seconds calculation in compile time and use these
1669         calculation for static const global variables.
1670
1671         operator% is an exception: it uses fmod and it is not offered as constexpr.
1672
1673         * wtf/MathExtras.h:
1674         (defaultMinimumForClamp):
1675         (defaultMaximumForClamp):
1676         (clampToAccepting64):
1677         Super unfortunate ugly code. This is because GCC 4.9 does not support C++14 relaxed constexpr.
1678
1679         * wtf/Seconds.h:
1680         (WTF::Seconds::Seconds):
1681         (WTF::Seconds::value):
1682         (WTF::Seconds::minutes):
1683         (WTF::Seconds::seconds):
1684         (WTF::Seconds::milliseconds):
1685         (WTF::Seconds::microseconds):
1686         (WTF::Seconds::nanoseconds):
1687         (WTF::Seconds::operator bool):
1688         (WTF::Seconds::operator+):
1689         (WTF::Seconds::operator-):
1690         (WTF::Seconds::operator*):
1691         (WTF::Seconds::operator/):
1692         (WTF::Seconds::operator==):
1693         (WTF::Seconds::operator!=):
1694         (WTF::Seconds::operator<):
1695         (WTF::Seconds::operator>):
1696         (WTF::Seconds::operator<=):
1697         (WTF::Seconds::operator>=):
1698
1699 2017-04-09  Chris Dumez  <cdumez@apple.com>
1700
1701         Start dropping Timer API dealing with double
1702         https://bugs.webkit.org/show_bug.cgi?id=170649
1703
1704         Reviewed by Yusuke Suzuki.
1705
1706         Start dropping Timer API dealing with double as people should use Seconds now.
1707
1708         * wtf/RunLoopTimer.h:
1709         * wtf/glib/MainThreadGLib.cpp:
1710         (WTF::MainThreadDispatcher::schedule):
1711
1712 2017-04-07  Keith Miller  <keith_miller@apple.com>
1713
1714         Unreviewed, remove constexpr function since GTK didn't like it.
1715
1716         * wtf/PriorityQueue.h:
1717         (WTF::PriorityQueue::parentOf):
1718
1719 2017-04-07  Chris Dumez  <cdumez@apple.com>
1720
1721         Start using MonotonicTime / Seconds in Timer class
1722         https://bugs.webkit.org/show_bug.cgi?id=170625
1723
1724         Reviewed by Simon Fraser.
1725
1726         Add modulo operator to MonotonicTime.
1727
1728         * wtf/MonotonicTime.h:
1729         (WTF::MonotonicTime::operator%):
1730
1731 2017-04-07  Keith Miller  <keith_miller@apple.com>
1732
1733         Add a PriorityQueue class
1734         https://bugs.webkit.org/show_bug.cgi?id=170579
1735
1736         Reviewed by Saam Barati.
1737
1738         This patch adds a new PriorityQueue class that is backed by
1739         WTF::Vector.  It also has a number of other niceties such as being
1740         able to iterate the queue and increase or decrease keys.
1741
1742         One note is that increaseKey and decreaseKey are O(n) rather than
1743         O(log(n)).  Traditionally, the lookup of the key is done with a
1744         hash map but that's not feasible here.  This is because unless the
1745         queue's element type is a pointer there is no good way maintain a
1746         persistent reference to every entry in the queue while we sift.
1747         The only way to update the location of an entry is to do a hash
1748         table lookup with the entry's hash but this is probably more
1749         expensive than just doing a linear search.
1750
1751         Also, add comparison operator functions, which can be passed to PriorityQueue.
1752
1753         * WTF.xcodeproj/project.pbxproj:
1754         * wtf/MathExtras.h:
1755         (isLessThan):
1756         (isLessThanEqual):
1757         (isGreaterThan):
1758         (isGreaterThanEqual):
1759         * wtf/PriorityQueue.h: Added.
1760         (WTF::PriorityQueue::size):
1761         (WTF::PriorityQueue::isEmpty):
1762         (WTF::PriorityQueue::enqueue):
1763         (WTF::PriorityQueue::peek):
1764         (WTF::PriorityQueue::dequeue):
1765         (WTF::PriorityQueue::decreaseKey):
1766         (WTF::PriorityQueue::increaseKey):
1767         (WTF::PriorityQueue::begin):
1768         (WTF::PriorityQueue::end):
1769         (WTF::PriorityQueue::isValidHeap):
1770         (WTF::PriorityQueue::parentOf):
1771         (WTF::PriorityQueue::leftChildOf):
1772         (WTF::PriorityQueue::rightChildOf):
1773         (WTF::PriorityQueue::siftUp):
1774         (WTF::PriorityQueue::siftDown):
1775
1776 2017-04-07  Alex Christensen  <achristensen@webkit.org>
1777
1778         Use audit_token_t instead of pid_t for checking sandbox of other processes
1779         https://bugs.webkit.org/show_bug.cgi?id=170616
1780         <rdar://problem/31158189>
1781
1782         Reviewed by Daniel Bates.
1783
1784         * wtf/spi/darwin/SandboxSPI.h:
1785         Declare more SPI.
1786
1787 2017-04-07  Ting-Wei Lan  <lantw44@gmail.com>
1788
1789         Include cstdio before using sscanf and stderr
1790         https://bugs.webkit.org/show_bug.cgi?id=170098
1791
1792         Reviewed by Michael Catanzaro.
1793
1794         * wtf/NumberOfCores.cpp:
1795
1796 2017-04-07  Saam Barati  <sbarati@apple.com>
1797
1798         WebAssembly: Make to a compilation API that allows for multi-VM concurrent compilations of Wasm Modules
1799         https://bugs.webkit.org/show_bug.cgi?id=170488
1800
1801         Reviewed by JF Bastien.
1802
1803         * wtf/SharedTask.h: Make SharedTaskFunctor forward its arguments.
1804
1805 2017-04-07  Carlos Garcia Campos  <cgarcia@igalia.com>
1806
1807         [GTK] Update the priorities used in glib main loop sources
1808         https://bugs.webkit.org/show_bug.cgi?id=170457
1809
1810         Reviewed by Žan Doberšek.
1811
1812         Add an enum to define prirorities used in different GLib main sources. It allows to give them a better name
1813         than high, low, medium, etc., but also to document them and other GLib based ports can define their own
1814         values without changing all the places where they are used. The default values are based on the priorities
1815         pre-defined by GLib.
1816
1817         * wtf/glib/MainThreadGLib.cpp:
1818         (WTF::MainThreadDispatcher::MainThreadDispatcher):
1819         * wtf/glib/RunLoopGLib.cpp:
1820         (WTF::RunLoop::RunLoop):
1821         (WTF::RunLoop::dispatchAfter):
1822         (WTF::RunLoop::TimerBase::TimerBase):
1823         * wtf/glib/RunLoopSourcePriority.h: Added.
1824         * wtf/linux/MemoryPressureHandlerLinux.cpp:
1825         (WTF::MemoryPressureHandler::EventFDPoller::EventFDPoller):
1826
1827 2017-04-06  Filip Pizlo  <fpizlo@apple.com>
1828
1829         Linear scan should run liveness only once
1830         https://bugs.webkit.org/show_bug.cgi?id=170569
1831
1832         Reviewed by Keith Miller.
1833         
1834         Have Liveness<> call Adapter::prepareToCompute(), since this makes it a lot easier to implement
1835         constraint generation, since the constraint generator now gets to run after the Adapter is fully
1836         constructed.
1837         
1838         * wtf/IndexMap.h:
1839         (WTF::IndexMap::append): Also make this a bit more versatile.
1840         * wtf/Liveness.h:
1841         (WTF::Liveness::LocalCalc::Iterable::contains):
1842         (WTF::Liveness::Iterable::contains):
1843         (WTF::Liveness::compute):
1844
1845 2017-04-06  Andreas Kling  <akling@apple.com>
1846
1847         Kill any WebContent process using over 16 GB of memory.
1848         https://bugs.webkit.org/show_bug.cgi?id=170515
1849         <rdar://problem/29930931>
1850
1851         Reviewed by Antti Koivisto.
1852
1853         Restructure the code since it was getting out of sync with the intended behavior.
1854         Now there's a thresholdForMemoryKill() which returns the current memory limit based
1855         on the process status.
1856
1857         The memory usage policy is separated from the killing, and now only drives the
1858         asynchronous invocations of pressure relief that occur when we pass over one of
1859         the policy edges (now 1GB for Conservative, 2GB for Strict.)
1860
1861         Removed the "Panic" policy and moved the memory kill logic to shrinkOrDie().
1862
1863         Behavior as of this patch:
1864
1865             - Everyone gets killed over 16 GB.
1866             - Inactive processes get killed over 4 GB.
1867             - Strict memory usage policy kicks in at 2 GB.
1868             - Conservative memory usage policy at 1 GB.
1869
1870         Like before, we make a best-effort attempt to free up memory before killing the process.
1871
1872         * wtf/MemoryPressureHandler.cpp:
1873         (WTF::toString):
1874         (WTF::MemoryPressureHandler::thresholdForMemoryKill):
1875         (WTF::thresholdForPolicy):
1876         (WTF::policyForFootprint):
1877         (WTF::MemoryPressureHandler::shrinkOrDie):
1878         (WTF::MemoryPressureHandler::setMemoryUsagePolicyBasedOnFootprint):
1879         (WTF::MemoryPressureHandler::measurementTimerFired):
1880         * wtf/MemoryPressureHandler.h:
1881
1882 2017-04-05  Andreas Kling  <akling@apple.com>
1883
1884         Make inactive web processes behave as though under memory pressure.
1885         https://bugs.webkit.org/show_bug.cgi?id=170042
1886         <rdar://problem/31038445>
1887
1888         Reviewed by Antti Koivisto.
1889
1890         Once a web process becomes inactive, let's try to reduce its impact
1891         on memory usage by treating it as if it's under memory pressure until
1892         it becomes active.
1893
1894         * wtf/MemoryPressureHandler.cpp:
1895         (WTF::MemoryPressureHandler::setProcessState):
1896         (WTF::MemoryPressureHandler::isUnderMemoryPressure):
1897         * wtf/MemoryPressureHandler.h:
1898         (WTF::MemoryPressureHandler::isUnderMemoryPressure): Deleted.
1899
1900 2017-04-05  Yusuke Suzuki  <utatane.tea@gmail.com>
1901
1902         [JSC] Suppress warnings in GCC
1903         https://bugs.webkit.org/show_bug.cgi?id=170501
1904
1905         Reviewed by Keith Miller.
1906
1907         Add a new macro UNUSED_FUNCTION to annotate unused static functions.
1908         #pragma GCC diagnostic ignored "-Wunused-function" does not work.
1909
1910         * wtf/Compiler.h:
1911
1912 2017-04-04  Filip Pizlo  <fpizlo@apple.com>
1913
1914         Air::eliminateDeadCode() should not use a HashSet
1915         https://bugs.webkit.org/show_bug.cgi?id=170487
1916
1917         Reviewed by Saam Barati.
1918         
1919         BitVector::iterator knows when it's at the end. Expose this functionality.
1920
1921         * wtf/BitVector.h:
1922         (WTF::BitVector::iterator::isAtEnd):
1923
1924 2017-04-04  Keith Miller  <keith_miller@apple.com>
1925
1926         WebAssembly: ModuleInformation should be a ref counted thing that can be shared across threads.
1927         https://bugs.webkit.org/show_bug.cgi?id=170478
1928
1929         Reviewed by Saam Barati.
1930
1931         This adds a new String::fromUTF8 that converts a vector of characters to
1932         a string.
1933
1934         Also, it cleans up some style.
1935
1936         * wtf/text/WTFString.h:
1937         (WTF::String::fromUTF8):
1938         * wtf/unicode/UTF8.cpp:
1939         (WTF::Unicode::convertLatin1ToUTF8):
1940
1941 2017-04-04  Filip Pizlo  <fpizlo@apple.com>
1942
1943         B3::fixSSA() needs a tune-up
1944         https://bugs.webkit.org/show_bug.cgi?id=170485
1945
1946         Reviewed by Saam Barati.
1947         
1948         This makes IndexSparseSet capable of being used as a map if you instantiate it with
1949         KeyValuePair<unsigned, ValueType>.
1950
1951         * wtf/HashTraits.h:
1952         * wtf/IndexSparseSet.h:
1953         (WTF::DefaultIndexSparseSetTraits::create):
1954         (WTF::DefaultIndexSparseSetTraits::key):
1955         (WTF::OverflowHandler>::IndexSparseSet):
1956         (WTF::OverflowHandler>::add):
1957         (WTF::OverflowHandler>::set):
1958         (WTF::OverflowHandler>::remove):
1959         (WTF::OverflowHandler>::clear):
1960         (WTF::OverflowHandler>::size):
1961         (WTF::OverflowHandler>::isEmpty):
1962         (WTF::OverflowHandler>::contains):
1963         (WTF::OverflowHandler>::sort):
1964         (WTF::IndexSparseSet<OverflowHandler>::IndexSparseSet): Deleted.
1965         (WTF::IndexSparseSet<OverflowHandler>::add): Deleted.
1966         (WTF::IndexSparseSet<OverflowHandler>::remove): Deleted.
1967         (WTF::IndexSparseSet<OverflowHandler>::clear): Deleted.
1968         (WTF::IndexSparseSet<OverflowHandler>::size): Deleted.
1969         (WTF::IndexSparseSet<OverflowHandler>::isEmpty): Deleted.
1970         (WTF::IndexSparseSet<OverflowHandler>::contains): Deleted.
1971         (WTF::IndexSparseSet<OverflowHandler>::sort): Deleted.
1972         * wtf/Liveness.h:
1973         (WTF::Liveness::LocalCalc::Iterable::iterator::iterator):
1974         (WTF::Liveness::workset):
1975
1976 2017-04-04  Filip Pizlo  <fpizlo@apple.com>
1977
1978         Don't need to Air::reportUsedRegisters for wasm at -O1
1979         https://bugs.webkit.org/show_bug.cgi?id=170459
1980
1981         Reviewed by Saam Barati.
1982         
1983         Just moved the liveness computation into a method, which enabled me to do the profiling
1984         that I used to write this patch.
1985
1986         * wtf/Liveness.h:
1987         (WTF::Liveness::Liveness):
1988         (WTF::Liveness::compute):
1989
1990 2017-04-03  Filip Pizlo  <fpizlo@apple.com>
1991
1992         Air liveness should build constraints and solve them rather than repeatedly parsing IR
1993         https://bugs.webkit.org/show_bug.cgi?id=170421
1994
1995         Reviewed by Saam Barati.
1996
1997         * wtf/Vector.h:
1998         (WTF::minCapacity>::appendIfNotContains): Because sometimes Vector<> is the best kind of set.
1999
2000 2017-04-03  Yusuke Suzuki  <utatane.tea@gmail.com>
2001
2002         [WTF] Introduce WTF::RandomDevice which keeps /dev/urandom opened
2003         https://bugs.webkit.org/show_bug.cgi?id=170095
2004
2005         Reviewed by Michael Catanzaro.
2006
2007         In this patch, we introduce RandomDevice, which keeps /dev/urandom opened
2008         to avoid repeatedly open and close urandom file descriptor in Linux.
2009
2010         The purpose is similar to std::random_device, but WTF::RandomDevice explicitly
2011         avoids using ARC4, which is recently attempted to be removed from the WebKit
2012         tree[1].
2013
2014         [1]: https://trac.webkit.org/r214329
2015
2016         * WTF.xcodeproj/project.pbxproj:
2017         * wtf/CMakeLists.txt:
2018         * wtf/OSRandomSource.cpp:
2019         (WTF::cryptographicallyRandomValuesFromOS):
2020         (WTF::crashUnableToOpenURandom): Deleted.
2021         (WTF::crashUnableToReadFromURandom): Deleted.
2022         * wtf/RandomDevice.cpp: Copied from Source/WTF/wtf/OSRandomSource.cpp.
2023         (WTF::crashUnableToOpenURandom):
2024         (WTF::crashUnableToReadFromURandom):
2025         (WTF::RandomDevice::RandomDevice):
2026         (WTF::RandomDevice::~RandomDevice):
2027         (WTF::RandomDevice::cryptographicallyRandomValues):
2028         * wtf/RandomDevice.h: Added.
2029
2030 2017-04-03  Filip Pizlo  <fpizlo@apple.com>
2031
2032         WTF::Liveness should have an API that focuses on actions at instruction boundaries
2033         https://bugs.webkit.org/show_bug.cgi?id=170407
2034
2035         Reviewed by Keith Miller.
2036         
2037         Change the Liveness<> API to handle early and late things in one lump inside forEachUse
2038         and forEachDef functions. This reduces the amount of different functions that Liveness<>
2039         expects from its adaptor. This makes it easier to implement optimizations that cache the
2040         use/def behavior of each instruction boundary.
2041
2042         * wtf/Liveness.h:
2043         (WTF::Liveness::Liveness):
2044         (WTF::Liveness::LocalCalc::execute):
2045
2046 2017-04-01  Csaba Osztrogonác  <ossy@webkit.org>
2047
2048         Mac cmake buildfix after 214586.
2049         https://bugs.webkit.org/show_bug.cgi?id=170381
2050
2051         Unreviewed.
2052
2053         * wtf/BlockPtr.h:
2054
2055 2017-03-30  Filip Pizlo  <fpizlo@apple.com>
2056
2057         Air should support linear scan for optLevel<2
2058         https://bugs.webkit.org/show_bug.cgi?id=170161
2059
2060         Reviewed by Saam Barati.
2061         
2062         This change introduces a new low-latency register allocator. It can allocate registers very
2063         quickly by doing a relatively poor job. Implementing this algorithm required beefing up some of
2064         our core algorithms.
2065
2066         * WTF.xcodeproj/project.pbxproj:
2067         * wtf/CMakeLists.txt:
2068         * wtf/Deque.h: Make it possible to do some basic priority queueing with this data structure.
2069         (WTF::inlineCapacity>::removeAllMatching):
2070         (WTF::inlineCapacity>::appendAndBubble):
2071         (WTF::inlineCapacity>::takeLast):
2072         * wtf/IndexKeyType.h: Added. This makes it possible to use IndexMap and IndexSet with value or pointer types. Previously they just worked with pointer types.
2073         (WTF::IndexKeyType::index):
2074         * wtf/IndexMap.h: Adopt IndexKeyType.
2075         (WTF::IndexMap::operator[]):
2076         (WTF::IndexMap::append):
2077         * wtf/IndexSet.h: Adopt IndexKeyType.
2078         (WTF::IndexSet::add):
2079         (WTF::IndexSet::addAll):
2080         (WTF::IndexSet::remove):
2081         (WTF::IndexSet::contains):
2082         (WTF::IndexSet::Iterable::iterator::operator*):
2083         * wtf/Range.h: Added. This used to be B3::HeapRange. This generalizes that data structure to any kind of range stuff.
2084         (WTF::Range::Range):
2085         (WTF::Range::top):
2086         (WTF::Range::operator==):
2087         (WTF::Range::operator!=):
2088         (WTF::Range::operator bool):
2089         (WTF::Range::operator|):
2090         (WTF::Range::operator|=):
2091         (WTF::Range::begin):
2092         (WTF::Range::end):
2093         (WTF::Range::overlaps):
2094         (WTF::Range::dump):
2095         * wtf/RangeSet.h:
2096         (WTF::RangeSet::add):
2097
2098 2017-03-25  Yusuke Suzuki  <utatane.tea@gmail.com>
2099
2100         [JSC] Move platformThreadSignal to WTF
2101         https://bugs.webkit.org/show_bug.cgi?id=170097
2102
2103         Reviewed by Mark Lam.
2104
2105         * wtf/Threading.h:
2106         * wtf/ThreadingPthreads.cpp:
2107         (WTF::signalThread):
2108
2109 2017-03-26  Filip Pizlo  <fpizlo@apple.com>
2110
2111         B3::fixSSA should do liveness pruning
2112         https://bugs.webkit.org/show_bug.cgi?id=170111
2113
2114         Reviewed by Saam Barati.
2115         
2116         Move Air::Liveness<> to WTF::Liveness<>. This is pretty easy since Air::Liveness<> was
2117         already fairly generic. It leverages the CFG concept so that it can understand many
2118         different kinds of basic blocks. It doesn't try to understand the contents of basic
2119         blocks; it just asks the adaptor for the block size and asks for the early/late
2120         uses/defs of each thing in the block.
2121         
2122         This makes it easy to create a B3::VariableLiveness, which fixSSA then uses for
2123         pruning. One of the new features is the Liveness::LiveAtHead nested class, which you
2124         instantiate if you want to perform liveAtHead queries, which SSA construction wants to
2125         do.
2126         
2127         This also fixes https://bugs.webkit.org/show_bug.cgi?id=170102#c12
2128
2129         * WTF.xcodeproj/project.pbxproj:
2130         * wtf/CMakeLists.txt:
2131         * wtf/Liveness.h: Added.
2132         (WTF::Liveness::Liveness):
2133         (WTF::Liveness::LocalCalc::LocalCalc):
2134         (WTF::Liveness::LocalCalc::Iterable::Iterable):
2135         (WTF::Liveness::LocalCalc::Iterable::iterator::iterator):
2136         (WTF::Liveness::LocalCalc::Iterable::iterator::operator++):
2137         (WTF::Liveness::LocalCalc::Iterable::iterator::operator*):
2138         (WTF::Liveness::LocalCalc::Iterable::iterator::operator==):
2139         (WTF::Liveness::LocalCalc::Iterable::iterator::operator!=):
2140         (WTF::Liveness::LocalCalc::Iterable::begin):
2141         (WTF::Liveness::LocalCalc::Iterable::end):
2142         (WTF::Liveness::LocalCalc::Iterable::contains):
2143         (WTF::Liveness::LocalCalc::live):
2144         (WTF::Liveness::LocalCalc::isLive):
2145         (WTF::Liveness::LocalCalc::execute):
2146         (WTF::Liveness::rawLiveAtHead):
2147         (WTF::Liveness::Iterable::Iterable):
2148         (WTF::Liveness::Iterable::iterator::iterator):
2149         (WTF::Liveness::Iterable::iterator::operator*):
2150         (WTF::Liveness::Iterable::iterator::operator++):
2151         (WTF::Liveness::Iterable::iterator::operator==):
2152         (WTF::Liveness::Iterable::iterator::operator!=):
2153         (WTF::Liveness::Iterable::begin):
2154         (WTF::Liveness::Iterable::end):
2155         (WTF::Liveness::Iterable::contains):
2156         (WTF::Liveness::liveAtHead):
2157         (WTF::Liveness::liveAtTail):
2158         (WTF::Liveness::workset):
2159         (WTF::Liveness::LiveAtHead::LiveAtHead):
2160         (WTF::Liveness::LiveAtHead::isLiveAtHead):
2161
2162 2017-03-25  Filip Pizlo  <fpizlo@apple.com>
2163
2164         Air::Liveness shouldn't need HashSets
2165         https://bugs.webkit.org/show_bug.cgi?id=170102
2166
2167         Reviewed by Yusuke Suzuki.
2168
2169         * wtf/IndexSparseSet.h: Add some helpers for a HashSet-free liveness analysis.
2170         (WTF::IndexSparseSet::values):
2171         (WTF::IndexSparseSet<OverflowHandler>::sort):
2172         * wtf/StdLibExtras.h:
2173         (WTF::mergeDeduplicatedSorted): Rapidly merge two sorted lists that don't have duplicates to produce a new sorted list that doesn't have duplicates.
2174         * wtf/Vector.h:
2175         (WTF::minCapacity>::uncheckedAppend): Inline this!
2176         (WTF::removeRepeatedElements): This is a version of std::unique() that works naturally for Vectors.
2177
2178 2017-03-26  Filip Pizlo  <fpizlo@apple.com>
2179
2180         Air should use RegisterSet for RegLiveness
2181         https://bugs.webkit.org/show_bug.cgi?id=170108
2182
2183         Reviewed by Yusuke Suzuki.
2184
2185         * wtf/Atomics.h:
2186         (WTF::ensurePointer): This is a useful replacement for std::once, which requires less fencing.
2187         * wtf/Bitmap.h: Add more utilities.
2188         (WTF::Bitmap::iterator::iterator): An iterator for set bits.
2189         (WTF::Bitmap::iterator::operator*):
2190         (WTF::Bitmap::iterator::operator++):
2191         (WTF::Bitmap::iterator::operator==):
2192         (WTF::Bitmap::iterator::operator!=):
2193         (WTF::Bitmap::begin):
2194         (WTF::Bitmap::end):
2195         (WTF::WordType>::subsumes): a.subsumes(b) if all of b's set bits are set in a.
2196         (WTF::WordType>::findBit): find next set or clear bit.
2197
2198 2017-03-24  JF Bastien  <jfbastien@apple.com>
2199
2200         WebAssembly: store state in TLS instead of on VM
2201         https://bugs.webkit.org/show_bug.cgi?id=169611
2202
2203         Reviewed by Filip Pizlo.
2204
2205         * wtf/FastTLS.h: reserve one key for WebAssembly, delete a bunch
2206         of dead code which clang couldn't compile (it's valid GCC assembly
2207         which LLVM dislikes).
2208
2209 2017-03-24  Ryan Haddad  <ryanhaddad@apple.com>
2210
2211         Unreviewed, rolling out r214351.
2212
2213         This change caused API test
2214         WebKit1.DidCreateJavaScriptContextBackForwardCacheTest to
2215         fail.
2216
2217         Reverted changeset:
2218
2219         "Make inactive web processes behave as though under memory
2220         pressure."
2221         https://bugs.webkit.org/show_bug.cgi?id=170042
2222         http://trac.webkit.org/changeset/214351
2223
2224 2017-03-24  Chris Dumez  <cdumez@apple.com>
2225
2226         Unreviewed, rolling out r214329.
2227
2228         Significantly regressed Speedometer
2229
2230         Reverted changeset:
2231
2232         "window.crypto.getRandomValues() uses the insecure RC4 RNG"
2233         https://bugs.webkit.org/show_bug.cgi?id=169623
2234         http://trac.webkit.org/changeset/214329
2235
2236 2017-03-24  Andreas Kling  <akling@apple.com>
2237
2238         Make inactive web processes behave as though under memory pressure.
2239         <https://webkit.org/b/170042>
2240
2241         Reviewed by Antti Koivisto.
2242
2243         Once a web process becomes inactive, let's try to reduce its impact
2244         on memory usage by treating it as if it's under memory pressure until
2245         it becomes active.
2246
2247         * wtf/MemoryPressureHandler.cpp:
2248         (WTF::MemoryPressureHandler::setProcessState):
2249         (WTF::MemoryPressureHandler::isUnderMemoryPressure):
2250         * wtf/MemoryPressureHandler.h:
2251         (WTF::MemoryPressureHandler::isUnderMemoryPressure): Deleted.
2252
2253 2017-03-23  Michael Catanzaro  <mcatanzaro@igalia.com>
2254
2255         window.crypto.getRandomValues() uses the insecure RC4 RNG
2256         https://bugs.webkit.org/show_bug.cgi?id=169623
2257
2258         Reviewed by Alex Christensen.
2259
2260         Remove the RC4 random generator in favor of using OS randomness for now. This is basically
2261         a merge of https://codereview.chromium.org/1431233002 from Blink, original author "eroman".
2262
2263         * wtf/CryptographicallyRandomNumber.cpp:
2264         (WTF::cryptographicallyRandomNumber):
2265         (WTF::cryptographicallyRandomValues):
2266         (): Deleted.
2267
2268 2017-03-23  Tomas Popela  <tpopela@redhat.com>
2269
2270         Fix uninitialized public members in WTF
2271         https://bugs.webkit.org/show_bug.cgi?id=169676
2272
2273         Reviewed by Michael Catanzaro.
2274
2275         Found by Coverity scan.
2276
2277         * wtf/Bag.h:
2278         * wtf/HashTable.h:
2279         * wtf/HashTraits.h:
2280         * wtf/Insertion.h:
2281         * wtf/OrderMaker.h:
2282         * wtf/ParallelJobsGeneric.h:
2283
2284 2017-03-22  Andreas Kling  <akling@apple.com>
2285
2286         Let MemoryPressureHandler track whether the process is active or inactive.
2287         <https://webkit.org/b/169990>
2288
2289         Reviewed by Antti Koivisto.
2290
2291         An active process is a process that meets any of these criteria:
2292
2293             - Has had a visible Page in an active window in the last hour
2294             - Is playing audio
2295
2296         This replaces the old mechanism where MemoryPressureHandler would invoke
2297         a callback to know whether the process was eligible for a memory kill.
2298         Instead we now plumb the relevant information down from WebCore and kill
2299         based on this activity state.
2300
2301         * wtf/MemoryPressureHandler.cpp:
2302         (WTF::MemoryPressureHandler::measurementTimerFired):
2303         (WTF::MemoryPressureHandler::setProcessState):
2304         * wtf/MemoryPressureHandler.h:
2305         (WTF::MemoryPressureHandler::setMemoryKillCallback):
2306         (WTF::MemoryPressureHandler::processState):
2307         (WTF::MemoryPressureHandler::setProcessIsEligibleForMemoryKillCallback): Deleted.
2308
2309 2017-03-20  Simon Fraser  <simon.fraser@apple.com>
2310
2311         Add a system trace point for memory warning handling
2312         https://bugs.webkit.org/show_bug.cgi?id=169893
2313
2314         Reviewed by Zalan Bujtas.
2315
2316         Make it possible to pass data to the Begin trace point.
2317
2318         * wtf/SystemTracing.h:
2319         (WTF::TraceScope::TraceScope):
2320
2321 2017-03-17  Said Abou-Hallawa  <sabouhallawa@apple.com>
2322
2323         Time channel attack on SVG Filters
2324         https://bugs.webkit.org/show_bug.cgi?id=118689
2325
2326         Reviewed by Simon Fraser.
2327
2328         Performing arithmetic operations on subnormal floating-point numbers is
2329         very expensive. Normalizing the floating-point number to the minimum normal
2330         value should accelerate the calculations and there won't be a noticeable
2331         difference in the result since all the subnormal values and the minimum
2332         normal value are all very close to zero.
2333
2334         * wtf/MathExtras.h:
2335         (normalizedFloat):
2336
2337 2017-03-11  Filip Pizlo  <fpizlo@apple.com>
2338
2339         Air should be powerful enough to support Tmp-splitting
2340         https://bugs.webkit.org/show_bug.cgi?id=169515
2341
2342         Reviewed by Saam Barati.
2343         
2344         Teach IndexMap how to handle types that don't have a default constructor. This makes it
2345         easy to create a IndexMap<BasicBlock, InsertionSet>, which is a super powerful
2346         construct.
2347
2348         * wtf/IndexMap.h:
2349         (WTF::IndexMap::IndexMap):
2350         (WTF::IndexMap::resize):
2351         (WTF::IndexMap::clear):
2352
2353 2017-03-16  Simon Fraser  <simon.fraser@apple.com>
2354
2355         Improve the system tracing points
2356         https://bugs.webkit.org/show_bug.cgi?id=169790
2357
2358         Reviewed by Zalan Bujtas.
2359
2360         Use a more cohesive set of system trace points that give a good overview of what
2361         WebKit is doing. Added points for resource loading, render tree building, sync messages
2362         to the web process, async image decode, WASM and fetching cookies.
2363
2364         * wtf/SystemTracing.h:
2365
2366 2017-03-16  Carlos Garcia Campos  <cgarcia@igalia.com>
2367
2368         [UNIX] Implement currentSearchLocaleID() and currentTextBreakLocaleID()
2369         https://bugs.webkit.org/show_bug.cgi?id=169745
2370
2371         Reviewed by Yusuke Suzuki.
2372
2373         Add a common implementation for Unix based ports using setlocale.
2374
2375         * wtf/PlatformGTK.cmake:
2376         * wtf/PlatformJSCOnly.cmake:
2377         * wtf/text/gtk/TextBreakIteratorInternalICUGtk.cpp: Removed.
2378         * wtf/text/unix/TextBreakIteratorInternalICUUnix.cpp: Renamed from Source/WTF/wtf/text/jsconly/TextBreakIteratorInternalICUJSCOnly.cpp.
2379         (WTF::currentSearchLocaleID):
2380         (WTF::currentTextBreakLocaleID):
2381
2382 2017-03-16  Carlos Garcia Campos  <cgarcia@igalia.com>
2383
2384         [GLIB] MainThread implementation is not GTK+ specific
2385         https://bugs.webkit.org/show_bug.cgi?id=169736
2386
2387         Reviewed by Yusuke Suzuki.
2388
2389         It's implemented in MainThreadGLib.cpp for glib based ports, so ifdefs in MainThread should not be
2390         PLATFORM(GTK) but USE(GLIB).
2391
2392         * wtf/MainThread.cpp:
2393         * wtf/MainThread.h:
2394
2395 2017-03-15  Carlos Alberto Lopez Perez  <clopez@igalia.com>
2396
2397         [CMake][JSCOnly] Fix build with GLib event loop
2398         https://bugs.webkit.org/show_bug.cgi?id=169730
2399
2400         Reviewed by Michael Catanzaro.
2401
2402         * wtf/MainThread.cpp:
2403         * wtf/PlatformJSCOnly.cmake: WorkQueueGLib was removed in r199713.
2404
2405 2017-03-15  Dean Jackson  <dino@apple.com>
2406
2407         Sort Xcode project files
2408         https://bugs.webkit.org/show_bug.cgi?id=169669
2409
2410         Reviewed by Antoine Quint.
2411
2412         * WTF.xcodeproj/project.pbxproj:
2413
2414 2017-03-14  Filip Pizlo  <fpizlo@apple.com>
2415
2416         Fix some typos in this benchmark.
2417
2418         Rubber stamped by Saam Barati.
2419
2420         * benchmarks/HashSetDFGReplay.cpp:
2421         (main):
2422
2423 2017-03-14  Filip Pizlo  <fpizlo@apple.com>
2424
2425         Record the HashSet/HashMap operations in DFG/FTL/B3 and replay them in a benchmark
2426         https://bugs.webkit.org/show_bug.cgi?id=169590
2427
2428         Reviewed by Saam Barati.
2429         
2430         This adds LoggingHashSet and LoggingHashMap, which are drop-in replacements for HashSet and
2431         HashMap that log everything that they do, so that you can replay it later.
2432         
2433         This also adds a benchmark (HashSetDFGReplay) based on doing a recording of some of the HashSets
2434         in the DFG compiler.
2435
2436         * WTF.xcodeproj/project.pbxproj:
2437         * benchmarks/HashSetDFGReplay.cpp: Added.
2438         (benchmark):
2439         (main):
2440         * wtf/CMakeLists.txt:
2441         * wtf/GlobalVersion.cpp: Added.
2442         (WTF::newGlobalVersion):
2443         * wtf/GlobalVersion.h: Added.
2444         * wtf/HashMap.h:
2445         (WTF::X>::swap):
2446         * wtf/HashSet.h:
2447         (WTF::V>::addVoid):
2448         * wtf/LoggingHashID.h: Added.
2449         (WTF::LoggingHashID::LoggingHashID):
2450         (WTF::LoggingHashID::dump):
2451         * wtf/LoggingHashMap.h: Added.
2452         * wtf/LoggingHashSet.h: Added.
2453         * wtf/LoggingHashTraits.h: Added.
2454         (WTF::LoggingHashKeyTraits::print):
2455         (WTF::LoggingHashValueTraits::print):
2456
2457 2017-03-13  Jer Noble  <jer.noble@apple.com>
2458
2459         Make classes used by Media Stream encode/decode friendly
2460         https://bugs.webkit.org/show_bug.cgi?id=169567
2461
2462         Reviewed by Eric Carlson.
2463
2464         * wtf/MediaTime.h:
2465         (WTF::MediaTime::encode):
2466         (WTF::MediaTime::decode):
2467
2468 2017-03-14  Yusuke Suzuki  <utatane.tea@gmail.com>
2469
2470         Add secondsAs<T> methods to Seconds to convert it to integers with clamp
2471         https://bugs.webkit.org/show_bug.cgi?id=169537
2472
2473         Reviewed by Carlos Garcia Campos.
2474
2475         When using the usual static_cast, infinity becomes 0 accidentally.
2476         It is not intended value when using Seconds for timeout value.
2477         Instead, we use clampToAccepting64 to convert Seconds to
2478         integer values to pass them to the system functions.
2479
2480         * wtf/MathExtras.h:
2481         (clampToAccepting64):
2482         * wtf/Seconds.h:
2483         (WTF::Seconds::minutesAs):
2484         (WTF::Seconds::secondsAs):
2485         (WTF::Seconds::millisecondsAs):
2486         (WTF::Seconds::microsecondsAs):
2487         (WTF::Seconds::nanosecondsAs):
2488         * wtf/cocoa/WorkQueueCocoa.cpp:
2489         (WTF::WorkQueue::dispatchAfter):
2490         * wtf/glib/RunLoopGLib.cpp:
2491         (WTF::RunLoop::dispatchAfter):
2492         (WTF::RunLoop::TimerBase::updateReadyTime):
2493
2494 2017-03-13  Yusuke Suzuki  <utatane.tea@gmail.com>
2495
2496         [JSC][Linux] Implement VMTrap in Linux ports
2497         https://bugs.webkit.org/show_bug.cgi?id=169436
2498
2499         Reviewed by Mark Lam.
2500
2501         Enable VMTrap mechanism for Linux and FreeBSD.
2502
2503         * wtf/Platform.h:
2504
2505 2017-03-13  Yusuke Suzuki  <utatane.tea@gmail.com>
2506
2507         [WTF] Clean up RunLoop and WorkQueue with Seconds and Function
2508         https://bugs.webkit.org/show_bug.cgi?id=169537
2509
2510         Reviewed by Sam Weinig.
2511
2512         This patch modernizes RunLoop and WorkQueue.
2513
2514         1. Use Ref<> aggressively
2515         2. Use Seconds instead of chrono times
2516         3. Use Function<> instead of std::function
2517
2518         * wtf/MainThread.cpp:
2519         (WTF::dispatchFunctionsFromMainThread):
2520         * wtf/RunLoop.h:
2521         * wtf/WorkQueue.h:
2522         * wtf/cocoa/WorkQueueCocoa.cpp:
2523         (WTF::WorkQueue::dispatch):
2524         (WTF::WorkQueue::dispatchAfter):
2525         (WTF::WorkQueue::concurrentApply):
2526         * wtf/generic/MainThreadGeneric.cpp:
2527         (WTF::scheduleDispatchFunctionsOnMainThread):
2528         * wtf/generic/RunLoopGeneric.cpp:
2529         (WTF::RunLoop::TimerBase::ScheduledTask::create):
2530         (WTF::RunLoop::TimerBase::ScheduledTask::EarliestSchedule::operator()):
2531         (WTF::RunLoop::populateTasks):
2532         (WTF::RunLoop::runImpl):
2533         (WTF::RunLoop::schedule):
2534         (WTF::RunLoop::scheduleAndWakeUp):
2535         (WTF::RunLoop::dispatchAfter):
2536         (WTF::RunLoop::TimerBase::start):
2537         * wtf/generic/WorkQueueGeneric.cpp:
2538         (WorkQueue::dispatch):
2539         (WorkQueue::dispatchAfter):
2540         * wtf/glib/RunLoopGLib.cpp:
2541         (WTF::DispatchAfterContext::DispatchAfterContext):
2542         (WTF::RunLoop::dispatchAfter):
2543         (WTF::RunLoop::TimerBase::updateReadyTime):
2544         (WTF::RunLoop::TimerBase::start):
2545         * wtf/win/WorkQueueWin.cpp:
2546         (WTF::WorkQueue::performWorkOnRegisteredWorkThread):
2547         (WTF::WorkQueue::dispatch):
2548         (WTF::WorkQueue::dispatchAfter):
2549
2550 2017-03-13  Chris Dumez  <cdumez@apple.com>
2551
2552         [WK2] Only report background WebProcesses as unresponsive in the background after 90 seconds
2553         https://bugs.webkit.org/show_bug.cgi?id=169425
2554         <rdar://problem/30954003>
2555
2556         Reviewed by Andreas Kling.
2557
2558         * wtf/RunLoop.h:
2559         (WTF::RunLoop::TimerBase::startRepeating):
2560         (WTF::RunLoop::TimerBase::startOneShot):
2561         Add overloads to RunLoop::Timer that take Seconds in parameter,
2562         for convenience.
2563
2564         * wtf/Seconds.h:
2565         (WTF::Seconds::fromHours):
2566         (WTF::seconds_literals::operator _h):
2567         Allow _h suffix for initializing Seconds type to hours.
2568
2569 2017-03-11  Csaba Osztrogonác  <ossy@webkit.org>
2570
2571         REGRESSION(r213645): It made JSC tests super slow and timeout on AArch64 Linux
2572         https://bugs.webkit.org/show_bug.cgi?id=169510
2573
2574         Unreviewed, disable LL_SC on Linux to unbreak this platform.
2575
2576         * wtf/Atomics.h:
2577         * wtf/Platform.h:
2578
2579 2017-03-10  Filip Pizlo  <fpizlo@apple.com>
2580
2581         The JITs should be able to emit fast TLS loads
2582         https://bugs.webkit.org/show_bug.cgi?id=169483
2583
2584         Reviewed by Keith Miller.
2585
2586         Consolidated what we know about fast TLS in FastTLS.h.
2587
2588         * WTF.xcodeproj/project.pbxproj:
2589         * wtf/CMakeLists.txt:
2590         * wtf/FastTLS.h: Added.
2591         (WTF::loadFastTLS):
2592         (WTF::fastTLSOffsetForKey):
2593         * wtf/Platform.h:
2594         * wtf/WTFThreadData.cpp:
2595         (WTF::WTFThreadData::createAndRegisterForGetspecificDirect):
2596         * wtf/WTFThreadData.h:
2597         (WTF::wtfThreadData):
2598
2599 2017-03-10  Mark Lam  <mark.lam@apple.com>
2600
2601         Turn ENABLE(MASM_PROBE) on by default for OS(DARWIN) release builds.
2602         https://bugs.webkit.org/show_bug.cgi?id=169493
2603
2604         Reviewed by Saam Barati.
2605
2606         MASM_PROBE was already enabled for debug builds.  This change makes it so that we
2607         don't have to rebuild the world every time we need to use it on a release build.
2608
2609         * wtf/Platform.h:
2610
2611 2017-03-10  Csaba Osztrogonác  <ossy@webkit.org>
2612
2613         Unreviewed AArch64 Linux buildfix after r213645.
2614         https://bugs.webkit.org/show_bug.cgi?id=169300
2615
2616         * wtf/Atomics.h: intptr_t and int64_t are typedefs for long int on Linux.
2617         They are different types only on Darwin platforms.
2618
2619 2017-03-09  Caio Lima  <ticaiolima@gmail.com>
2620
2621         [ESnext] Implement Object Rest - Implementing Object Rest Destructuring
2622         https://bugs.webkit.org/show_bug.cgi?id=167962
2623
2624         Reviewed by Keith Miller.
2625
2626         * wtf/HashSet.h:
2627         (WTF::=):
2628
2629 2017-03-09  Youenn Fablet  <youenn@apple.com>
2630
2631         Activate VideoToolbox when WebRTC is enabled on iOS
2632         https://bugs.webkit.org/show_bug.cgi?id=169423
2633
2634         Reviewed by Jon Lee.
2635
2636         * wtf/Platform.h: Activate VIDEOTOOLBOX if WEBRTC is enabled.
2637
2638 2017-03-09  Filip Pizlo  <fpizlo@apple.com>
2639
2640         std::isnan/isinf/isfinite should work with WTF time classes
2641         https://bugs.webkit.org/show_bug.cgi?id=164991
2642
2643         Reviewed by Darin Adler.
2644         
2645         The consensus view (see comments in https://bugs.webkit.org/show_bug.cgi?id=152045) of how
2646         to check if something is NaN is to use std::isnan(). To be able to do that for time
2647         classes, they need to provide their own isnan() overhload. This also provides isinf()
2648         overloads.
2649
2650         * wtf/MonotonicTime.h:
2651         (std::isnan):
2652         (std::isinf):
2653         * wtf/Seconds.h:
2654         (std::isnan):
2655         (std::isinf):
2656         * wtf/TimeWithDynamicClockType.h:
2657         (std::isnan):
2658         (std::isinf):
2659         * wtf/WallTime.h:
2660         (std::isnan):
2661         (std::isinf):
2662
2663 2017-03-09  Mark Lam  <mark.lam@apple.com>
2664
2665         Use const AbstractLocker& (instead of const LockHolder&) in more places.
2666         https://bugs.webkit.org/show_bug.cgi?id=169424
2667
2668         Reviewed by Filip Pizlo.
2669
2670         * wtf/RunLoop.h:
2671         * wtf/generic/RunLoopGeneric.cpp:
2672         (WTF::RunLoop::wakeUp):
2673         (WTF::RunLoop::schedule):
2674
2675 2017-03-09  Mark Lam  <mark.lam@apple.com>
2676
2677         Make the VM Traps mechanism non-polling for the DFG and FTL.
2678         https://bugs.webkit.org/show_bug.cgi?id=168920
2679         <rdar://problem/30738588>
2680
2681         Reviewed by Filip Pizlo.
2682
2683         Make StackBounds more useful for checking if a pointer is within stack bounds.
2684
2685         * wtf/MetaAllocator.cpp:
2686         (WTF::MetaAllocator::isInAllocatedMemory):
2687         * wtf/MetaAllocator.h:
2688         * wtf/Platform.h:
2689         * wtf/StackBounds.h:
2690         (WTF::StackBounds::emptyBounds):
2691         (WTF::StackBounds::StackBounds):
2692         (WTF::StackBounds::isEmpty):
2693         (WTF::StackBounds::contains):
2694
2695 2017-03-07  Filip Pizlo  <fpizlo@apple.com>
2696
2697         WTF should make it super easy to do ARM concurrency tricks
2698         https://bugs.webkit.org/show_bug.cgi?id=169300
2699
2700         Reviewed by Mark Lam.
2701         
2702         This adds Atomic<>::loadLink and Atomic<>::storeCond, available only when HAVE(LL_SC).
2703         
2704         It abstracts loadLink/storeCond behind prepare/attempt. You can write prepare/attempt
2705         loops whenever your loop fits into the least common denominator of LL/SC and CAS.
2706         
2707         This modifies Atomic<>::transaction to use prepare/attempt. So, if you write your loop
2708         using Atomic<>::transaction, then you get LL/SC for free.
2709
2710         Depending on the kind of transaction you are doing, you may not want to perform an LL
2711         until you have a chance to just load the current value. Atomic<>::transaction() assumes
2712         that you do not care to have any ordering guarantees in that case. If you think that
2713         the transaction has a good chance of aborting this way, you want
2714         Atomic<>::transaction() to first do a plain load. But if you don't think that such an
2715         abort is likely, then you want to go straight to the LL. The API supports this concept
2716         via TransactionAbortLikelihood.
2717         
2718         Additionally, this redoes the depend/consume API to be dead simple. Dependency is
2719         unsigned. You get a dependency on a loaded value by just saying
2720         dependency(loadedValue). You consume the dependency by using it as a bonus index to
2721         some pointer dereference. This is made easy with the consume<T*>(ptr, dependency)
2722         helper. In those cases where you want to pass around both a computed value and a
2723         dependency, there's DependencyWith<T>. But you won't need it in most cases. The loaded
2724         value or any value computed from the loaded value is a fine input to dependency()!
2725         
2726         This change updates a bunch of hot paths to use the new APIs. Using transaction() gives
2727         us optimal LL/SC loops for object marking and lock acquisition.
2728         
2729         This change also updates a bunch of hot paths to use dependency()/consume().
2730         
2731         This is a significant Octane/splay speed-up on ARM.
2732
2733         * wtf/Atomics.h:
2734         (WTF::hasFence):
2735         (WTF::Atomic::prepare):
2736         (WTF::Atomic::attempt):
2737         (WTF::Atomic::transaction):
2738         (WTF::Atomic::transactionRelaxed):
2739         (WTF::nullDependency):
2740         (WTF::dependency):
2741         (WTF::DependencyWith::DependencyWith):
2742         (WTF::dependencyWith):
2743         (WTF::consume):
2744         (WTF::Atomic::tryTransactionRelaxed): Deleted.
2745         (WTF::Atomic::tryTransaction): Deleted.
2746         (WTF::zeroWithConsumeDependency): Deleted.
2747         (WTF::consumeLoad): Deleted.
2748         * wtf/Bitmap.h:
2749         (WTF::WordType>::get):
2750         (WTF::WordType>::concurrentTestAndSet):
2751         (WTF::WordType>::concurrentTestAndClear):
2752         * wtf/LockAlgorithm.h:
2753         (WTF::LockAlgorithm::lockFast):
2754         (WTF::LockAlgorithm::unlockFast):
2755         (WTF::LockAlgorithm::unlockSlow):
2756         * wtf/Platform.h:
2757
2758 2017-03-08  Anders Carlsson  <andersca@apple.com>
2759
2760         Simplify the PaymentCoordinator interface
2761         https://bugs.webkit.org/show_bug.cgi?id=169382
2762         Part of rdar://problem/28880714.
2763
2764         Reviewed by Tim Horton.
2765
2766         * wtf/EnumTraits.h:
2767         Fix a build warning.
2768
2769 2017-03-06  Andreas Kling  <akling@apple.com>
2770
2771         [iOS] Report domains crashing under memory pressure via enhanced privacy logging.
2772         <https://webkit.org/b/169133>
2773         <rdar://problem/29964017>
2774
2775         Reviewed by Antti Koivisto.
2776
2777         Add a mechanism for getting a callback when the memory pressure status changes.
2778
2779         * wtf/MemoryPressureHandler.cpp:
2780         (WTF::MemoryPressureHandler::measurementTimerFired):
2781         (WTF::MemoryPressureHandler::beginSimulatedMemoryPressure):
2782         (WTF::MemoryPressureHandler::endSimulatedMemoryPressure):
2783         (WTF::MemoryPressureHandler::setUnderMemoryPressure):
2784         (WTF::MemoryPressureHandler::memoryPressureStatusChanged):
2785         * wtf/MemoryPressureHandler.h:
2786         (WTF::MemoryPressureHandler::setMemoryPressureStatusChangedCallback):
2787         (WTF::MemoryPressureHandler::setUnderMemoryPressure): Deleted.
2788
2789 2017-03-03  Jer Noble  <jer.noble@apple.com>
2790
2791         [Win64] '__int128_t': undeclared identifier in MediaTime.cpp
2792         https://bugs.webkit.org/show_bug.cgi?id=169123
2793
2794         Reviewed by Alex Christensen.
2795
2796         Don't perform the 128-bit optimized path on Windows, where the __int128_t intrinsic isn't available.
2797
2798         * wtf/MediaTime.cpp:
2799         (WTF::MediaTime::setTimeScale):
2800
2801 2017-03-03  Keith Miller  <keith_miller@apple.com>
2802
2803         WASM should support faster loads.
2804         https://bugs.webkit.org/show_bug.cgi?id=162693
2805
2806         Reviewed by Saam Barati.
2807
2808         Add new forms of dataLog that take a boolean which describes if the log should happen. This makes cases where we have a static const bool for printing nicer since you can do:
2809
2810         dataLogIf(verbose, things, to, print);
2811
2812         instead of:
2813
2814         if (verbose)
2815             dataLog(things, to, print);
2816
2817         Also, add a operator! to Ref that has the same semantics as C++ refs.
2818
2819         * wtf/DataLog.h:
2820         (WTF::dataLogLn):
2821         (WTF::dataLogIf):
2822         (WTF::dataLogLnIf):
2823         * wtf/Ref.h:
2824         (WTF::Ref::operator!):
2825
2826 2017-03-02  Jer Noble  <jer.noble@apple.com>
2827
2828         Sufficently large timeValue and timeScale arguments to MediaTime will cause wrapping in toTimeScale().
2829         https://bugs.webkit.org/show_bug.cgi?id=169098
2830
2831         Reviewed by Keith Miller.
2832
2833         Use a non-standard but Clang & GCC supported __int128_t type extension to do the 128-bit math rather than
2834         rolling our own. Since this is only available in 64-bit builds, for 32-bit, just fix the underlying 128-bit
2835         math.
2836
2837         * wtf/MediaTime.cpp:
2838         (WTF::MediaTime::setTimeScale):
2839
2840 2017-03-01  Konstantin Tokarev  <annulen@yandex.ru>
2841
2842         Removed unused WTF_COMPILER_SUPPORTS_CXX_USER_LITERALS macro
2843         https://bugs.webkit.org/show_bug.cgi?id=168969
2844
2845         Reviewed by Darin Adler.
2846
2847         * wtf/Compiler.h:
2848
2849 2017-03-01  Tomas Popela  <tpopela@redhat.com>
2850
2851         [WTF] va_list is not ended in StringPrintStream
2852         https://bugs.webkit.org/show_bug.cgi?id=169035
2853
2854         Reviewed by Michael Saboff.
2855
2856         Also fix whitespace errors while touching this file.
2857
2858         * wtf/StringPrintStream.cpp:
2859         (WTF::StringPrintStream::vprintf):
2860         (WTF::StringPrintStream::increaseSize):
2861
2862 2017-03-01  Andreas Kling  <akling@apple.com>
2863
2864         Move MemoryPressureHandler to WTF
2865         <https://webkit.org/b/168908>
2866
2867         Reviewed by Sam Weinig.
2868
2869         Move MemoryPressureHandler down to WTF so it can be used from JavaScriptCore.
2870
2871         I had to do a blind rewrite of the Windows memory checking timer since it can
2872         no longer use WebCore::Timer. I also moved the Win32Handle helper class to WTF.
2873
2874         * WTF.xcodeproj/project.pbxproj:
2875         * wtf/CMakeLists.txt:
2876         * wtf/MemoryPressureHandler.cpp: Renamed from Source/WebCore/platform/MemoryPressureHandler.cpp.
2877         (WTF::MemoryPressureHandler::singleton):
2878         (WTF::MemoryPressureHandler::MemoryPressureHandler):
2879         (WTF::MemoryPressureHandler::setShouldUsePeriodicMemoryMonitor):
2880         (WTF::toString):
2881         (WTF::thresholdForPolicy):
2882         (WTF::policyForFootprint):
2883         (WTF::MemoryPressureHandler::measurementTimerFired):
2884         (WTF::MemoryPressureHandler::beginSimulatedMemoryPressure):
2885         (WTF::MemoryPressureHandler::endSimulatedMemoryPressure):
2886         (WTF::MemoryPressureHandler::releaseMemory):
2887         (WTF::MemoryPressureHandler::ReliefLogger::logMemoryUsageChange):
2888         (WTF::MemoryPressureHandler::install):
2889         (WTF::MemoryPressureHandler::uninstall):
2890         (WTF::MemoryPressureHandler::holdOff):
2891         (WTF::MemoryPressureHandler::respondToMemoryPressure):
2892         (WTF::MemoryPressureHandler::platformReleaseMemory):
2893         (WTF::MemoryPressureHandler::ReliefLogger::platformMemoryUsage):
2894         (WTF::MemoryPressureHandler::platformInitialize):
2895         * wtf/MemoryPressureHandler.h: Renamed from Source/WebCore/platform/MemoryPressureHandler.h.
2896         (WTF::MemoryPressureHandler::setMemoryKillCallback):
2897         (WTF::MemoryPressureHandler::setProcessIsEligibleForMemoryKillCallback):
2898         (WTF::MemoryPressureHandler::setLowMemoryHandler):
2899         (WTF::MemoryPressureHandler::isUnderMemoryPressure):
2900         (WTF::MemoryPressureHandler::setUnderMemoryPressure):
2901         (WTF::MemoryPressureHandler::ReliefLogger::ReliefLogger):
2902         (WTF::MemoryPressureHandler::ReliefLogger::~ReliefLogger):
2903         (WTF::MemoryPressureHandler::ReliefLogger::logString):
2904         (WTF::MemoryPressureHandler::ReliefLogger::setLoggingEnabled):
2905         (WTF::MemoryPressureHandler::ReliefLogger::loggingEnabled):
2906         (WTF::MemoryPressureHandler::ReliefLogger::MemoryUsage::MemoryUsage):
2907         * wtf/PlatformEfl.cmake:
2908         * wtf/PlatformGTK.cmake:
2909         * wtf/PlatformMac.cmake:
2910         * wtf/PlatformWin.cmake:
2911         * wtf/cocoa/MemoryPressureHandlerCocoa.mm: Renamed from Source/WebCore/platform/cocoa/MemoryPressureHandlerCocoa.mm.
2912         (WTF::MemoryPressureHandler::platformReleaseMemory):
2913         (WTF::MemoryPressureHandler::install):
2914         (WTF::MemoryPressureHandler::uninstall):
2915         (WTF::MemoryPressureHandler::holdOff):
2916         (WTF::MemoryPressureHandler::respondToMemoryPressure):
2917         (WTF::MemoryPressureHandler::ReliefLogger::platformMemoryUsage):
2918         * wtf/linux/CurrentProcessMemoryStatus.cpp: Renamed from Source/WebCore/platform/linux/CurrentProcessMemoryStatus.cpp.
2919         (WTF::systemPageSize):
2920         (WTF::currentProcessMemoryStatus):
2921         * wtf/linux/CurrentProcessMemoryStatus.h: Renamed from Source/WebCore/platform/linux/CurrentProcessMemoryStatus.h.
2922         * wtf/linux/MemoryPressureHandlerLinux.cpp: Renamed from Source/WebCore/platform/linux/MemoryPressureHandlerLinux.cpp.
2923         (WTF::MemoryPressureHandler::EventFDPoller::EventFDPoller):
2924         * wtf/win/MemoryPressureHandlerWin.cpp: Renamed from Source/WebCore/platform/win/MemoryPressureHandlerWin.cpp.
2925         (WTF::MemoryPressureHandler::platformInitialize):
2926         (WTF::MemoryPressureHandler::windowsMeasurementTimerFired):
2927         (WTF::MemoryPressureHandler::platformReleaseMemory):
2928         (WTF::MemoryPressureHandler::install):
2929         (WTF::MemoryPressureHandler::uninstall):
2930         (WTF::MemoryPressureHandler::holdOff):
2931         (WTF::MemoryPressureHandler::respondToMemoryPressure):
2932         (WTF::MemoryPressureHandler::ReliefLogger::platformMemoryUsage):
2933         * wtf/win/Win32Handle.h: Renamed from Source/WebCore/platform/win/Win32Handle.h.
2934         (WTF::Win32Handle::Win32Handle):
2935         (WTF::Win32Handle::~Win32Handle):
2936         (WTF::Win32Handle::clear):
2937         (WTF::Win32Handle::isValid):
2938         (WTF::Win32Handle::get):
2939         (WTF::Win32Handle::release):
2940         (WTF::Win32Handle::operator=):
2941
2942 2017-02-28  Chris Dumez  <cdumez@apple.com>
2943
2944         [iOS] Throttle requestAnimationFrame to 30fps in low power mode
2945         https://bugs.webkit.org/show_bug.cgi?id=168837
2946         <rdar://problem/30700929>
2947
2948         Reviewed by Simon Fraser.
2949
2950         Add support for operator -= on WTF::OptionSet for convenience:
2951             set -= Enum::A;
2952         looks much better than:
2953             set = set - Enum::A;
2954
2955         * wtf/OptionSet.h:
2956         (WTF::OptionSet::operator-=):
2957
2958 2017-02-28  Michael Saboff  <msaboff@apple.com>
2959
2960         Add ability to configure JSC options from a file
2961         https://bugs.webkit.org/show_bug.cgi?id=168914
2962
2963         Reviewed by Filip Pizlo.
2964
2965         Added the ability to set options and DataLog file location via a configuration file.
2966         The pathname can include the printf style "%pid", which will be replaced with the
2967         current process id.
2968
2969         * wtf/DataLog.cpp:
2970         (WTF::initializeLogFileOnce):
2971         (WTF::setDataFile):
2972         * wtf/DataLog.h:
2973
2974 2017-02-27  Andy Estes  <aestes@apple.com>
2975
2976         [iOS] Enable file replacement
2977         https://bugs.webkit.org/show_bug.cgi?id=168907
2978         <rdar://problem/22258242>
2979
2980         Reviewed by David Kilzer.
2981
2982         * wtf/FeatureDefines.h: Set ENABLE_FILE_REPLACEMENT to 1 on all Cocoa platforms.
2983
2984 2017-02-27  Myles C. Maxfield  <mmaxfield@apple.com>
2985
2986         Rename ICU cursor iterator to caret iterator
2987         https://bugs.webkit.org/show_bug.cgi?id=168206
2988
2989         Reviewed by Simon Fraser.
2990
2991         * wtf/text/TextBreakIterator.cpp:
2992         (WTF::mapModeToBackingIterator):
2993         * wtf/text/TextBreakIterator.h:
2994         * wtf/text/cf/TextBreakIteratorCF.h:
2995         (WTF::TextBreakIteratorCF::TextBreakIteratorCF):
2996         * wtf/text/icu/TextBreakIteratorICU.h:
2997         (WTF::caretRules):
2998         (WTF::TextBreakIteratorICU::TextBreakIteratorICU):
2999         (WTF::cursorRules): Deleted.
3000         * wtf/text/mac/TextBreakIteratorInternalICUMac.mm:
3001         (WTF::mapModeToBackingIterator):
3002
3003 2017-02-27  Myles C. Maxfield  <mmaxfield@apple.com>
3004
3005         Use RAII for ICU breaking iterators
3006         https://bugs.webkit.org/show_bug.cgi?id=168203
3007
3008         Reviewed by Simon Fraser.
3009
3010         * wtf/text/TextBreakIterator.h:
3011         (WTF::CachedTextBreakIterator::CachedTextBreakIterator):
3012         (WTF::CachedTextBreakIterator::~CachedTextBreakIterator):
3013         (WTF::CachedTextBreakIterator::preceding):
3014         (WTF::CachedTextBreakIterator::following):
3015         (WTF::CachedTextBreakIterator::isBoundary):
3016
3017 2017-02-24  Jer Noble  <jer.noble@apple.com>
3018
3019         Add public method to MediaTime for doing timeScale conversion.
3020         https://bugs.webkit.org/show_bug.cgi?id=168860
3021
3022         Reviewed by Eric Carlson.
3023
3024         The newly public method, modeled on CMTimeConvertScale, allows callers to specify what rounding technique
3025         will be used when converting to a new time scale.
3026
3027         * wtf/MediaTime.cpp:
3028         (WTF::MediaTime::toTimeScale):
3029         (WTF::MediaTime::setTimeScale):
3030         * wtf/MediaTime.h:
3031
3032 2017-02-26  Myles C. Maxfield  <mmaxfield@apple.com>
3033
3034         Stop compiling our own cursorMovementIterator()
3035         https://bugs.webkit.org/show_bug.cgi?id=168211
3036
3037         Reviewed by David Hyatt.
3038
3039         This patch creates a unified Text Breaking API, which can be backed by either ICU
3040         or CoreFoundation (for ports which can use it). Rather than using inheritance and
3041         virtual functions to implement this, because there are only two subclasses, the
3042         simpler option of just using a Variant is used instead. There is also a cache which
3043         allows you to reuse iterators without reconstructing them. This cache is better
3044         than the previous method of having a single static iterator because the cache
3045         lets you use two iterators simultaneously.
3046
3047         In the future, I will hook up all iterators to use this shared class. However, for
3048         this patch, I've only hooked up the caret position iterator (backed by CoreFoundation
3049         on Cocoa ports and UBRK_CHARACTER on other ports). 
3050
3051         * WTF.xcodeproj/project.pbxproj:
3052         * wtf/spi/cf/CFStringSPI.h: Added.
3053         * wtf/text/TextBreakIterator.cpp:
3054         (WTF::initializeIteratorWithRules): Deleted.
3055         (WTF::cursorMovementIterator): Deleted.
3056         * wtf/text/TextBreakIterator.h:
3057         (WTF::TextBreakIterator::preceding):
3058         (WTF::TextBreakIterator::following):
3059         (WTF::TextBreakIterator::isBoundary):
3060         (WTF::TextBreakIterator::setText):
3061         (WTF::TextBreakIterator::mode):
3062         (WTF::TextBreakIterator::locale):
3063         (WTF::TextBreakIteratorCache::singleton):
3064         (WTF::TextBreakIteratorCache::take):
3065         (WTF::TextBreakIteratorCache::put):
3066         (WTF::TextBreakIteratorCache::TextBreakIteratorCache):
3067         * wtf/text/cf/TextBreakIteratorCF.h: Added.
3068         (WTF::TextBreakIteratorCF::TextBreakIteratorCF):
3069         (WTF::TextBreakIteratorCF::setText):
3070         (WTF::TextBreakIteratorCF::preceding):
3071         (WTF::TextBreakIteratorCF::following):
3072         (WTF::TextBreakIteratorCF::isBoundary):
3073         * wtf/text/icu/TextBreakIteratorICU.h: Added.
3074         (WTF::TextBreakIteratorICU::set8BitText):
3075         (WTF::TextBreakIteratorICU::TextBreakIteratorICU):
3076         (WTF::TextBreakIteratorICU::operator=):
3077         (WTF::TextBreakIteratorICU::~TextBreakIteratorICU):
3078         (WTF::TextBreakIteratorICU::setText):
3079         (WTF::TextBreakIteratorICU::preceding):
3080         (WTF::TextBreakIteratorICU::following):
3081         (WTF::TextBreakIteratorICU::isBoundary):
3082         * wtf/text/icu/UTextProviderLatin1.h:
3083         * wtf/text/mac/TextBreakIteratorInternalICUMac.mm:
3084         (WTF::mapModeToBackingIterator):
3085         (WTF::TextBreakIterator::TextBreakIterator):
3086
3087 2017-02-24  Joseph Pecoraro  <pecoraro@apple.com>
3088
3089         [Resource Timing] Gather timing information with reliable responseEnd time
3090         https://bugs.webkit.org/show_bug.cgi?id=168351
3091
3092         Reviewed by Alex Christensen.
3093
3094         * wtf/persistence/Coders.h:
3095         (WTF::Persistence::Coder<Seconds>::encode):
3096         (WTF::Persistence::Coder<Seconds>::decode):
3097
3098 2017-02-24  Keith Miller  <keith_miller@apple.com>
3099
3100         Rubber-stamped by Chris Dumez.
3101
3102         Replace typename Bool with typename BoolType because X11 has
3103         #define Bool int for some unknown reason...
3104
3105         * wtf/HashFunctions.h:
3106         (WTF::TupleHash::allTrue):
3107         * wtf/HashTraits.h:
3108         (WTF::TupleHashTraits::allTrue):
3109
3110 2017-02-24  Chris Dumez  <cdumez@apple.com>
3111
3112         Unreviewed, rolling out r212944.
3113
3114         Caused a lot of failures on the debug bots
3115
3116         Reverted changeset:
3117
3118         "[Resource Timing] Gather timing information with reliable
3119         responseEnd time"
3120         https://bugs.webkit.org/show_bug.cgi?id=168351
3121         http://trac.webkit.org/changeset/212944
3122
3123 2017-02-24  Keith Miller  <keith_miller@apple.com>
3124
3125         We should be able to use std::tuples as keys in HashMap
3126         https://bugs.webkit.org/show_bug.cgi?id=168805
3127
3128         Reviewed by Filip Pizlo.
3129
3130         This patch adds support for using std::tupeles as the key
3131         type in HashMap. It is equivalent to doing a sequence of
3132         std::pairs but has a nicer syntax.
3133
3134         * wtf/HashFunctions.h:
3135         (WTF::TupleHash::hash):
3136         (WTF::TupleHash::equal):
3137         (WTF::TupleHash::allTrue):
3138         * wtf/HashTraits.h:
3139         (WTF::TupleHashTraits::allTrue):
3140         (WTF::TupleHashTraits::emptyValue):
3141         (WTF::TupleHashTraits::constructDeletedValue):
3142         (WTF::TupleHashTraits::isDeletedValue):
3143
3144 2017-02-24  Alex Christensen  <achristensen@webkit.org>
3145
3146         Prepare to enable WebRTC on iOS
3147         https://bugs.webkit.org/show_bug.cgi?id=168811
3148
3149         Reviewed by Youenn Fablet.
3150
3151         * wtf/Platform.h:
3152
3153 2017-02-23  Joseph Pecoraro  <pecoraro@apple.com>
3154
3155         [Resource Timing] Gather timing information with reliable responseEnd time
3156         https://bugs.webkit.org/show_bug.cgi?id=168351
3157
3158         Reviewed by Alex Christensen.
3159
3160         * wtf/persistence/Coders.h:
3161         (WTF::Persistence::Coder<Seconds>::encode):
3162         (WTF::Persistence::Coder<Seconds>::decode):
3163
3164 2017-02-22  Carlos Garcia Campos  <cgarcia@igalia.com>
3165
3166         Better handle Thread and RunLoop initialization
3167         https://bugs.webkit.org/show_bug.cgi?id=167828
3168
3169         Reviewed by Yusuke Suzuki.
3170
3171         Make initialization functions more independent so that they can run in different
3172         order. WTF::initializeMainThread initializes WTF threading, so that neither WTF nor JSC theading need to be
3173         initialized before. RunLoop::initializeMainRunLoop() requires main thread to be initialized in some
3174         ports, so it initializes main thread too. WebKit1 always calls WTF::initializeMainThreadToProcessMainThread()
3175         before RunLoop::initializeMainRunLoop() so there's no problem there. GC threads are initialized alwayas by the
3176         main thread. The rules should be simpler now:
3177
3178           - JSC::initializeThreading: should always be called when JSC is used.
3179           - WTF::initializeThreading: only needs to be explicitly called when JSC is not used and process doesn't
3180             initialize a main thread or main run loop.
3181           - WTF::initializeMainThread: only needs to be explicitly called if process initializes a main thread but not a
3182             main run loop.
3183           - WTF::initializeMainThreadToProcessMainThread(): should always be called in WebKit1 before
3184             RunLoop::initializeMainRunLoop().
3185           - RunLoop::initializeMainRunLoop(): to initialize the main run loop. The only requirement is JSC::initializeThreading()
3186             to be called before if JSC is used.
3187
3188         * wtf/MainThread.cpp:
3189         (WTF::initializeMainThreadOnce): Use pthread_once to initialize the main thread also in GTK+ port.
3190         (WTF::initializeMainThreadToProcessMainThreadOnce): Call initializeThreading() before the platform
3191         initialization and initializeGCThreads() after it.
3192         (WTF::initializeMainThread): Ditto.
3193         * wtf/RunLoop.cpp:
3194         (WTF::RunLoop::initializeMainRunLoop): Call initializeMainThread().
3195         * wtf/glib/MainThreadGLib.cpp:
3196         (WTF::initializeMainThreadPlatform):
3197         (WTF::isMainThread):
3198         * wtf/mac/MainThreadMac.mm:
3199         (WTF::initializeMainThreadPlatform): Remove call to initializeGCThreads().
3200         (WTF::initializeMainThreadToProcessMainThreadPlatform): Ditto.
3201
3202 2017-02-22  Myles C. Maxfield  <mmaxfield@apple.com>
3203
3204         [Cocoa] Remove Yosemite-specific font lookup code
3205         https://bugs.webkit.org/show_bug.cgi?id=168682
3206
3207         Reviewed by Zalan Bujtas.
3208
3209         * wtf/Platform.h:
3210
3211 2017-02-22  Keith Miller  <keith_miller@apple.com>
3212
3213         Remove the demand executable allocator
3214         https://bugs.webkit.org/show_bug.cgi?id=168754
3215
3216         Reviewed by Saam Barati.
3217
3218         * wtf/Platform.h:
3219
3220 2017-02-22  Alex Christensen  <achristensen@webkit.org>
3221
3222         Re-commit part of r212812 accidentally rolled out with r212841.
3223         https://bugs.webkit.org/show_bug.cgi?id=167293
3224
3225         * wtf/Platform.h:
3226         Use libwebrtc on Mac if webrtc is enabled.
3227
3228 2017-02-22  Alex Christensen  <achristensen@webkit.org>
3229
3230         Fix ASAN build after activating libwebrtc.
3231
3232         * wtf/Ref.h:
3233         __asan_address_is_poisoned returns an int, not a bool.
3234         This didn't cause a problem before because we didn't include the real definition anywhere,
3235         but libwebrtc includes <sanitizer/asan_interface.h> directly now so the return types need to be correct.
3236
3237 2017-02-22  Carlos Garcia Campos  <cgarcia@igalia.com>
3238
3239         [GTK] Test fast/events/message-port-postMessage-recursive.html times out
3240         https://bugs.webkit.org/show_bug.cgi?id=168570
3241
3242         Reviewed by Michael Catanzaro.
3243
3244         This has recently been added and the patch is good. It's just revealing a problem with our timers. The test is
3245         posting a message recursively, and also starts a timeout timer to finish the test. The timeout timer is never
3246         fired for us, because WebCore timers have lower priority than the one used by postMessage. ScriptExecutionContext
3247         uses Document::postTask, that uses scheduleOnMainThread, that uses RunLoop::dispatch(). We are not setting any
3248         priority for the timer used by RunLoop::dispatch, so it's using the default.
3249         Use a RunLoop::Timer to schedule tasks to the main thread instead of using RunLoop::dispatch(). This allows us
3250         to use a different priority, that is now set to G_PRIORITY_HIGH_IDLE + 20 to match WebCore timers. But it also
3251         avoids the double queue we had with RunLoop::dispatch(), because scheduleOnMainThread() also queues the tasks.
3252
3253         * wtf/glib/MainThreadGLib.cpp:
3254         (WTF::MainThreadDispatcher::MainThreadDispatcher):
3255         (WTF::MainThreadDispatcher::schedule):
3256         (WTF::MainThreadDispatcher::fired):
3257         (WTF::scheduleDispatchFunctionsOnMainThread):
3258
3259 2017-02-21  Youenn Fablet  <youenn@apple.com>
3260
3261         [WebRTC][Mac] Activate libwebrtc
3262         https://bugs.webkit.org/show_bug.cgi?id=167293
3263
3264         Reviewed by Alex Christensen.
3265
3266         * wtf/Platform.h:
3267
3268 2017-02-20  Filip Pizlo  <fpizlo@apple.com>
3269
3270         The collector thread should only start when the mutator doesn't have heap access
3271         https://bugs.webkit.org/show_bug.cgi?id=167737
3272
3273         Reviewed by Keith Miller.
3274         
3275         Extend the use of AbstractLocker so that we can use more locking idioms.
3276
3277         * wtf/AutomaticThread.cpp:
3278         (WTF::AutomaticThreadCondition::notifyOne):
3279         (WTF::AutomaticThreadCondition::notifyAll):
3280         (WTF::AutomaticThreadCondition::add):
3281         (WTF::AutomaticThreadCondition::remove):
3282         (WTF::AutomaticThreadCondition::contains):
3283         (WTF::AutomaticThread::AutomaticThread):
3284         (WTF::AutomaticThread::tryStop):
3285         (WTF::AutomaticThread::isWaiting):
3286         (WTF::AutomaticThread::notify):
3287         (WTF::AutomaticThread::start):
3288         (WTF::AutomaticThread::threadIsStopping):
3289         * wtf/AutomaticThread.h:
3290         * wtf/NumberOfCores.cpp:
3291         (WTF::numberOfProcessorCores):
3292         * wtf/ParallelHelperPool.cpp:
3293         (WTF::ParallelHelperClient::finish):
3294         (WTF::ParallelHelperClient::claimTask):
3295         (WTF::ParallelHelperPool::Thread::Thread):
3296         (WTF::ParallelHelperPool::didMakeWorkAvailable):
3297         (WTF::ParallelHelperPool::hasClientWithTask):
3298         (WTF::ParallelHelperPool::getClientWithTask):
3299         * wtf/ParallelHelperPool.h:
3300
3301 2017-02-21  Alex Christensen  <achristensen@webkit.org>
3302
3303         Unreviewed, rolling out r212699.
3304
3305         Internal build not ready
3306
3307         Reverted changeset:
3308
3309         "[WebRTC][Mac] Activate libwebrtc"
3310         https://bugs.webkit.org/show_bug.cgi?id=167293
3311         http://trac.webkit.org/changeset/212699
3312
3313 2017-02-20  Youenn Fablet  <youenn@apple.com>
3314
3315         [WebRTC][Mac] Activate libwebrtc
3316         https://bugs.webkit.org/show_bug.cgi?id=167293
3317
3318         Reviewed by Alex Christensen.
3319
3320         * wtf/Platform.h:
3321
3322 2017-02-20  Mark Lam  <mark.lam@apple.com>
3323
3324         [Re-landing] CachedCall should let GC know to keep its arguments alive.
3325         https://bugs.webkit.org/show_bug.cgi?id=168567
3326         <rdar://problem/30475767>
3327
3328         Reviewed by Saam Barati.
3329
3330         Added a WTF_FORBID_HEAP_ALLOCATION that will cause a compilation failure if
3331         a class declared with it is malloced.
3332
3333         While this doesn't prevent that class declared WTF_FORBID_HEAP_ALLOCATION from
3334         being embedded in another class that is heap allocated, it does at minimum
3335         document the intent and gives the users of this class a chance to do the
3336         right thing.
3337
3338         * WTF.xcodeproj/project.pbxproj:
3339         * wtf/ForbidHeapAllocation.h: Added.
3340
3341 2017-02-20  Ryan Haddad  <ryanhaddad@apple.com>
3342
3343         Unreviewed, rolling out r212685.
3344
3345         This change broke the 32-bit Sierra build.
3346
3347         Reverted changeset:
3348
3349         "Resource Load Statistics: Add alternate classification
3350         method"
3351         https://bugs.webkit.org/show_bug.cgi?id=168347
3352         http://trac.webkit.org/changeset/212685
3353
3354 2017-02-20  John Wilander  <wilander@apple.com>
3355
3356         Resource Load Statistics: Add alternate classification method
3357         https://bugs.webkit.org/show_bug.cgi?id=168347
3358         <rdar://problem/30352793>
3359
3360         Reviewed by Alex Christensen.
3361
3362         * wtf/Platform.h:
3363             Added support for HAVE(CORE_PREDICTION).
3364
3365 2017-02-20  Commit Queue  <commit-queue@webkit.org>
3366
3367         Unreviewed, rolling out r212618.
3368         https://bugs.webkit.org/show_bug.cgi?id=168609
3369
3370         "Appears to cause PLT regression" (Requested by mlam on
3371         #webkit).
3372
3373         Reverted changeset:
3374
3375         "CachedCall should let GC know to keep its arguments alive."
3376         https://bugs.webkit.org/show_bug.cgi?id=168567
3377         http://trac.webkit.org/changeset/212618
3378
3379 2017-02-20  Carlos Garcia Campos  <cgarcia@igalia.com>
3380
3381         Unreviewed, rolling out r212622.
3382
3383         Caused several test failures
3384
3385         Reverted changeset:
3386
3387         "[GTK] Test fast/events/message-port-postMessage-
3388         recursive.html times out"
3389         https://bugs.webkit.org/show_bug.cgi?id=168570
3390         http://trac.webkit.org/changeset/212622
3391
3392 2017-02-19  Carlos Garcia Campos  <cgarcia@igalia.com>
3393
3394         [GTK] Test fast/events/message-port-postMessage-recursive.html times out
3395         https://bugs.webkit.org/show_bug.cgi?id=168570
3396
3397         Reviewed by Michael Catanzaro.
3398
3399         This has recently been added and the patch is good. It's just revealing a problem with our timers. The test is
3400         posting a message recursively, and also starts a timeout timer to finish the test. The timeout timer is never
3401         fired for us, because WebCore timers have lower priority than the one used by
3402         postMessage. ScriptExecutionContext uses Document::postTask, that uses scheduleOnMainThread, that uses
3403         RunLoop::dispatch(). We are not setting any priority for the timer used by RunLoop::dispatch, so it's using the
3404         default. RunLoop::dispatch is normally used to schedule tasks between threads, or just to ensure something is
3405         run in a different run loop iteration, but in general nothing urgent as a graphics redraw or something like
3406         that. It's quite common to use g_idle_add to schedule tasks between threads, so I think it makes sense to use
3407         G_PRIORITY_DEFAULT_IDLE for the RunLoop timer.
3408
3409         * wtf/glib/RunLoopGLib.cpp:
3410         (WTF::RunLoop::RunLoop):
3411
3412 2017-02-19  Mark Lam  <mark.lam@apple.com>
3413
3414         CachedCall should let GC know to keep its arguments alive.
3415         https://bugs.webkit.org/show_bug.cgi?id=168567
3416         <rdar://problem/30475767>
3417
3418         Reviewed by Saam Barati.
3419
3420         Added a WTF_FORBID_HEAP_ALLOCATION that will cause a compilation failure if
3421         a class declared with it is malloced.
3422
3423         While this doesn't prevent that class declared WTF_FORBID_HEAP_ALLOCATION from
3424         being embedded in another class that is heap allocated, it does at minimum
3425         document the intent and gives the users of this class a chance to do the
3426         right thing.
3427
3428         * WTF.xcodeproj/project.pbxproj:
3429         * wtf/ForbidHeapAllocation.h: Added.
3430
3431 2017-02-19  Commit Queue  <commit-queue@webkit.org>
3432
3433         Unreviewed, rolling out r212466.
3434         https://bugs.webkit.org/show_bug.cgi?id=168577
3435
3436         causes crashes on AArch64 on linux, maybe it's causing crashes
3437         on iOS too (Requested by pizlo on #webkit).
3438
3439         Reverted changeset:
3440
3441         "The collector thread should only start when the mutator
3442         doesn't have heap access"
3443         https://bugs.webkit.org/show_bug.cgi?id=167737
3444         http://trac.webkit.org/changeset/212466
3445
3446 2017-02-18  Chris Dumez  <cdumez@apple.com>
3447
3448         Recursive MessagePort.postMessage() calls causes tab to become unresponsive
3449         https://bugs.webkit.org/show_bug.cgi?id=168548
3450         <rdar://problem/29808005>
3451
3452         Reviewed by Darin Adler.
3453
3454         Add API to retrieve all messages in the queue at once.
3455
3456         * wtf/MessageQueue.h:
3457
3458 2017-02-16  Alex Christensen  <achristensen@webkit.org>
3459
3460         Remove EFL-specific files in Source.
3461
3462         Rubber-stamped by Anders Carlsson.
3463
3464         * wtf/text/efl: Removed.
3465         * wtf/text/efl/TextBreakIteratorInternalICUEfl.cpp: Removed.
3466
3467 2017-02-10  Filip Pizlo  <fpizlo@apple.com>
3468
3469         The collector thread should only start when the mutator doesn't have heap access
3470         https://bugs.webkit.org/show_bug.cgi?id=167737
3471
3472         Reviewed by Keith Miller.
3473         
3474         Extend the use of AbstractLocker so that we can use more locking idioms.
3475
3476         * wtf/AutomaticThread.cpp:
3477         (WTF::AutomaticThreadCondition::notifyOne):
3478         (WTF::AutomaticThreadCondition::notifyAll):
3479         (WTF::AutomaticThreadCondition::add):
3480         (WTF::AutomaticThreadCondition::remove):
3481         (WTF::AutomaticThreadCondition::contains):
3482         (WTF::AutomaticThread::AutomaticThread):
3483         (WTF::AutomaticThread::tryStop):
3484         (WTF::AutomaticThread::isWaiting):
3485         (WTF::AutomaticThread::notify):
3486         (WTF::AutomaticThread::start):
3487         (WTF::AutomaticThread::threadIsStopping):
3488         * wtf/AutomaticThread.h:
3489         * wtf/NumberOfCores.cpp:
3490         (WTF::numberOfProcessorCores): Allow this to be overridden for testing.
3491         * wtf/ParallelHelperPool.cpp:
3492         (WTF::ParallelHelperClient::finish):
3493         (WTF::ParallelHelperClient::claimTask):
3494         (WTF::ParallelHelperPool::Thread::Thread):
3495         (WTF::ParallelHelperPool::didMakeWorkAvailable):
3496         (WTF::ParallelHelperPool::hasClientWithTask):
3497         (WTF::ParallelHelperPool::getClientWithTask):
3498         * wtf/ParallelHelperPool.h:
3499
3500 2017-02-16  Anders Carlsson  <andersca@apple.com>
3501
3502         Remove EFL from WTF
3503         https://bugs.webkit.org/show_bug.cgi?id=168452
3504
3505         Reviewed by Alex Christensen.
3506
3507         * wtf/CurrentTime.cpp:
3508         * wtf/DisallowCType.h:
3509         * wtf/FeatureDefines.h:
3510         * wtf/MainThread.cpp:
3511         * wtf/MainThread.h:
3512         * wtf/Platform.h:
3513         * wtf/RunLoop.h:
3514         * wtf/WorkQueue.h:
3515         * wtf/efl/DispatchQueueEfl.cpp: Removed.
3516         * wtf/efl/DispatchQueueEfl.h: Removed.
3517         * wtf/efl/DispatchQueueWorkItemEfl.h: Removed.
3518         * wtf/efl/EflTypedefs.h: Removed.
3519         * wtf/efl/MainThreadEfl.cpp: Removed.
3520         * wtf/efl/RunLoopEfl.cpp: Removed.
3521         * wtf/efl/UniquePtrEfl.h: Removed.
3522         * wtf/efl/WorkQueueEfl.cpp: Removed.
3523
3524 2017-02-13  Alex Christensen  <achristensen@webkit.org>
3525
3526         URLs with an invalid IPv4 address should be invalid
3527         https://bugs.webkit.org/show_bug.cgi?id=168260
3528
3529         Reviewed by Tim Horton.
3530
3531         * wtf/Expected.h:
3532         (WTF::Expected::value):
3533         Added missing WTFMove for rvalue Expected::value().
3534
3535 2017-02-13  Said Abou-Hallawa  <sabouhallawa@apple.com>
3536
3537         The current frame of an image should not deleted if another frame is asynchronously being decoded
3538         https://bugs.webkit.org/show_bug.cgi?id=167618
3539
3540         Reviewed by Simon Fraser.
3541
3542         Add ASSERT_IMPLIES() which should fire when a condition is true but the
3543         assertion is false.
3544
3545         * wtf/Assertions.h:
3546
3547 2017-02-13  Brady Eidson  <beidson@apple.com>
3548
3549         Followup to: Replace all WebKit Library Version checks in WK2 with SDK version checks.
3550         https://bugs.webkit.org/show_bug.cgi?id=168124
3551
3552         Reviewed by Geoffrey Garen.
3553
3554         * wtf/spi/darwin/dyldSPI.h:
3555
3556 2017-02-13  Myles C. Maxfield  <mmaxfield@apple.com>
3557
3558         Update custom line breaking iterators to the latest version of Unicode
3559         https://bugs.webkit.org/show_bug.cgi?id=168182
3560
3561         Reviewed by Zalan Bujtas.
3562
3563         ICU 55.1 supports loose / normal / strict line breaking rules. The oldest platform we ship
3564         on has a version of ICU >= that one. Therefore, we don't need to compile our own rules;
3565         we can just use ICU's rules.
3566
3567         * wtf/text/LineBreakIteratorPoolICU.h:
3568         (WTF::LineBreakIteratorPool::makeLocaleWithBreakKeyword):
3569         (WTF::LineBreakIteratorPool::take):
3570         * wtf/text/TextBreakIterator.cpp:
3571         (WTF::acquireLineBreakIterator):
3572         (WTF::openLineBreakIterator):
3573         (WTF::mapLineIteratorModeToRules): Deleted.
3574         (WTF::isCJKLocale): Deleted.
3575         * wtf/text/TextBreakIterator.h:
3576         (WTF::LazyLineBreakIterator::LazyLineBreakIterator):
3577         (WTF::LazyLineBreakIterator::mode):
3578         (WTF::LazyLineBreakIterator::get):
3579         (WTF::LazyLineBreakIterator::resetStringAndReleaseIterator):
3580         (WTF::LazyLineBreakIterator::isLooseCJKMode): Deleted.
3581
3582 2017-02-10  Dan Bernstein  <mitz@apple.com>
3583
3584         [Xcode] WTF installs extra copies of two headers outside /usr/local/include/wtf
3585         https://bugs.webkit.org/show_bug.cgi?id=168160
3586
3587         Reviewed by Sam Weinig.
3588
3589         * WTF.xcodeproj/project.pbxproj: Demoted OrdinalNumber.h MemoryFootprint.h from Private to
3590           Project.
3591
3592 2017-02-10  Commit Queue  <commit-queue@webkit.org>
3593
3594         Unreviewed, rolling out r212139.
3595         https://bugs.webkit.org/show_bug.cgi?id=168152
3596
3597         Caused some assertions (Requested by JoePeck on #webkit).
3598
3599         Reverted changeset:
3600
3601         "Fix misleading comment in RunLoop.h"
3602         https://bugs.webkit.org/show_bug.cgi?id=167832
3603         http://trac.webkit.org/changeset/212139
3604
3605 2017-02-10  Joseph Pecoraro  <pecoraro@apple.com>
3606
3607         Fix misleading comment in RunLoop.h
3608         https://bugs.webkit.org/show_bug.cgi?id=167832
3609
3610         Reviewed by Sam Weinig.
3611
3612         * wtf/RunLoop.h:
3613         Mac initialization used to force using CFRunLoopGetMain(). Now however it just
3614         uses RunLoop::current which uses CFRunLoopGetCurrent(). So this comment that
3615         it can be done on any thread is misleading and can lead to incorrect behavior
3616         if it is actually done on a non-main thread on Mac.
3617
3618 2017-02-09  Alex Christensen  <achristensen@webkit.org>
3619
3620         Unreviewed, rolling out r212040.
3621
3622         Broke build.  I'm not surprised
3623
3624         Reverted changeset:
3625
3626         "[WebRTC][Mac] Activate libwebrtc"
3627         https://bugs.webkit.org/show_bug.cgi?id=167293
3628         http://trac.webkit.org/changeset/212040
3629
3630 2017-02-09  Youenn Fablet  <youenn@apple.com>
3631
3632         [WebRTC][Mac] Activate libwebrtc
3633         https://bugs.webkit.org/show_bug.cgi?id=167293
3634
3635         Reviewed by Alex Christensen.
3636
3637         * wtf/Platform.h:
3638
3639 2017-02-09  Brady Eidson  <beidson@apple.com>
3640
3641         Transition "WebKit Library Version" checks to SDK version checks.
3642         <rdar://problem/30313696> and https://bugs.webkit.org/show_bug.cgi?id=168056
3643
3644         Reviewed by Geoffrey Garen.
3645
3646         * wtf/spi/darwin/dyldSPI.h: Add entries for the iOS 10.3, macOS 10.11, and macOS 10.12.4 SDKs.
3647
3648 2017-02-09  Commit Queue  <commit-queue@webkit.org>
3649
3650         Unreviewed, rolling out r211980 and r211987.
3651         https://bugs.webkit.org/show_bug.cgi?id=168072
3652
3653         Caused API test WebKit2.DuplicateCompletionHandlerCalls to
3654         fail (Requested by ryanhaddad on #webkit).
3655
3656         Reverted changesets:
3657
3658         "Transition "WebKit Library Version" checks to SDK version
3659         checks."
3660         https://bugs.webkit.org/show_bug.cgi?id=168056
3661         http://trac.webkit.org/changeset/211980
3662
3663         "Build fix for APPLE_INTERNAL_SDK builds after r211980."
3664         http://trac.webkit.org/changeset/211987
3665
3666 2017-02-09  Alexey Proskuryakov  <ap@apple.com>
3667
3668         Remove unused WebThreadRunSync
3669         https://bugs.webkit.org/show_bug.cgi?id=168024
3670
3671         Reviewed by Tim Horton.
3672
3673         * wtf/ios/WebCoreThread.cpp:
3674         * wtf/ios/WebCoreThread.h:
3675
3676 2017-02-09  Brady Eidson  <beidson@apple.com>
3677
3678         Build fix for APPLE_INTERNAL_SDK builds after r211980.
3679
3680         Unreviewed.
3681
3682         * wtf/spi/darwin/dyldSPI.h:
3683
3684 2017-02-09  Brady Eidson  <beidson@apple.com>
3685
3686         Transition "WebKit Library Version" checks to SDK version checks.
3687         <rdar://problem/30313696> and https://bugs.webkit.org/show_bug.cgi?id=168056
3688
3689         Reviewed by Geoffrey Garen.
3690
3691         * wtf/spi/darwin/dyldSPI.h: Add entries for the iOS 10.3, macOS 10.11, and macOS 10.12.4 SDKs.
3692
3693 2017-02-06  Jer Noble  <jer.noble@apple.com>
3694
3695         Playback stalls when a SourceBuffer append causes frame eviction
3696         https://bugs.webkit.org/show_bug.cgi?id=167834
3697
3698         Reviewed by Eric Carlson.
3699
3700         Optimize the MediaTime class; specifically the compare() method. The class only
3701         needs 6 bits to store the TimeFlags, so make that a uint8_t rather than uint32_t.
3702         The implementation is slightly simpler if the TimeScale is unsigned, so make that
3703         a uint32_t rather than int32_t. Inline the comparison operators. Optimize the equality
3704         comparison by bitwise-and'ing the flags together and masking the result. Optimize for
3705         common comparison scenarios (equal timeScales, equal timeValues(), etc.). Attempt the
3706         mathematically simpler simpler method for comparing ratios, and only fall back to the
3707         complex method if the results of multiplying the timeScale by the timeValue overflows.
3708
3709         * wtf/MediaTime.cpp:
3710         (WTF::greatestCommonDivisor):
3711         (WTF::leastCommonMultiple):
3712         (WTF::signum):
3713         (WTF::MediaTime::MediaTime):
3714         (WTF::MediaTime::createWithFloat):
3715         (WTF::MediaTime::createWithDouble):
3716         (WTF::MediaTime::operator+):
3717         (WTF::MediaTime::operator-):
3718         (WTF::MediaTime::operator!):
3719         (WTF::MediaTime::operator bool):
3720         (WTF::MediaTime::compare):
3721         (WTF::MediaTime::setTimeScale):
3722         (WTF::abs):
3723         (WTF::MediaTime::operator<): Deleted.
3724         (WTF::MediaTime::operator>): Deleted.
3725         (WTF::MediaTime::operator!=): Deleted.
3726         (WTF::MediaTime::operator==): Deleted.
3727         (WTF::MediaTime::operator>=): Deleted.
3728         (WTF::MediaTime::operator<=): Deleted.
3729         * wtf/MediaTime.h:
3730
3731 2017-02-04  Michael Catanzaro  <mcatanzaro@igalia.com>
3732
3733         [GTK] Fix huge ENABLE_RESOURCE_USAGE warning spam
3734
3735         Unreviewed. We shouldn't redefine ENABLE_RESOURCE_USAGE in Platform.h as
3736         it's already defined in cmakeconfig.h.
3737
3738         * wtf/Platform.h:
3739
3740 2017-02-03  Joseph Pecoraro  <pecoraro@apple.com>
3741
3742         Performance Timing: Convert WTF::MonotonicTime and WTF::Seconds
3743         https://bugs.webkit.org/show_bug.cgi?id=167768
3744
3745         Reviewed by Geoffrey Garen.
3746
3747         * wtf/Stopwatch.h:
3748         (WTF::Stopwatch::elapsedTimeSince):
3749         (WTF::Stopwatch::elapsedTimeSinceMonotonicTime): Deleted.
3750
3751 2017-02-03  Carlos Garcia Campos  <cgarcia@igalia.com>
3752
3753         [GTK] Add initial implementation of resource usage overlay
3754         https://bugs.webkit.org/show_bug.cgi?id=167731
3755
3756         Reviewed by Michael Catanzaro.
3757
3758         Enable RESOURCE_USAGE for GTK+ port too.
3759
3760         * wtf/Platform.h:
3761
3762 2017-02-02  Andreas Kling  <akling@apple.com>
3763
3764         [Mac] In-process memory pressure monitor for WebContent processes AKA websam
3765         <https://webkit.org/b/167491>
3766         <rdar://problem/30116072>
3767
3768         Reviewed by Antti Koivisto.
3769
3770         Add a WTF helper function for getting the current process's memory footprint.
3771
3772         * WTF.xcodeproj/project.pbxproj:
3773         * wtf/CMakeLists.txt:
3774         * wtf/MemoryFootprint.cpp:
3775         (WTF::memoryFootprint):
3776         * wtf/MemoryFootprint.h:
3777
3778 2017-02-02  Mark Lam  <mark.lam@apple.com>
3779
3780         Add a SIGILL crash analyzer to make debugging SIGILLs easier.
3781         https://bugs.webkit.org/show_bug.cgi?id=167714
3782         <rdar://problem/30318237>
3783
3784         Reviewed by Filip Pizlo.
3785
3786         * wtf/StdLibExtras.h:
3787
3788 2017-02-02  Commit Queue  <commit-queue@webkit.org>
3789
3790         Unreviewed, rolling out r211571 and r211582.
3791         https://bugs.webkit.org/show_bug.cgi?id=167751
3792
3793         This change caused API test WebKit1.MemoryPressureHandler to
3794         fail with an assertion. (Requested by ryanhaddad on #webkit).
3795
3796         Reverted changesets:
3797
3798         "[Mac] In-process memory pressure monitor for WebContent
3799         processes."
3800         https://bugs.webkit.org/show_bug.cgi?id=167491
3801         http://trac.webkit.org/changeset/211571
3802
3803         "Unreviewed attempt to fix the Windows build after r211571."
3804         http://trac.webkit.org/changeset/211582
3805
3806 2017-02-02  Andreas Kling  <akling@apple.com>
3807
3808         [Mac] In-process memory pressure monitor for WebContent processes.
3809         <https://webkit.org/b/167491>
3810         <rdar://problem/30116072>
3811
3812         Reviewed by Antti Koivisto.
3813
3814         Add a WTF helper function for getting the current process's memory footprint.
3815
3816         * WTF.xcodeproj/project.pbxproj:
3817         * wtf/CMakeLists.txt:
3818         * wtf/MemoryFootprint.cpp:
3819         (WTF::memoryFootprint):
3820         * wtf/MemoryFootprint.h:
3821
3822 2017-02-01  Wenson Hsieh  <wenson_hsieh@apple.com>
3823
3824         Unreviewed, fix the WebKit nightly open source build
3825         <rdar://problem/30308635>
3826
3827         We cannot assume all internal SDKs have the latest WebKitAdditions, so we need an explicit header check here.
3828
3829         * wtf/Platform.h:
3830
3831 2017-02-01  Andreas Kling  <akling@apple.com>
3832
3833         Implement the alwaysRunsAtBackgroundPriority WK2 setting using thread QoS.
3834         <https://webkit.org/b/167387>
3835         <rdar://problem/29711409>
3836
3837         Reviewed by Antti Koivisto.
3838
3839         Add a new mechanism for overriding the max thread QoS level globally:
3840
3841             void setGlobalMaxQOSClass(qos_class_t)
3842             qos_class_t adjustedQOSClass(qos_class_t)
3843
3844         The QoS cap applies to all newly created threads, threads that try to override
3845         their QoS class manually, and also passed down to bmalloc.
3846
3847         * wtf/Threading.cpp:
3848         (WTF::setCurrentThreadIsUserInteractive):
3849         (WTF::setCurrentThreadIsUserInitiated):
3850         (WTF::setGlobalMaxQOSClass):
3851         (WTF::adjustedQOSClass):
3852         * wtf/Threading.h:
3853         * wtf/ThreadingPthreads.cpp:
3854         (WTF::createThreadInternal):
3855         * wtf/cocoa/WorkQueueCocoa.cpp:
3856         (WTF::dispatchQOSClass):
3857
3858 2017-01-31  Antti Koivisto  <antti@apple.com>
3859
3860         Teach cache coders to encode time_points
3861         https://bugs.webkit.org/show_bug.cgi?id=167670
3862
3863         Reviewed by Andreas Kling.
3864
3865         * wtf/persistence/Coders.h:
3866         (WTF::Persistence::Coder<std::chrono::system_clock::time_point>::encode):
3867         (WTF::Persistence::Coder<std::chrono::system_clock::time_point>::decode):
3868
3869 2017-01-31  Joseph Pecoraro  <pecoraro@apple.com>
3870
3871         Removed unused m_nestedCount from RunLoop
3872         https://bugs.webkit.org/show_bug.cgi?id=167674
3873
3874         Reviewed by Sam Weinig.
3875
3876         * wtf/RunLoop.h:
3877         * wtf/cf/RunLoopCF.cpp:
3878         (WTF::RunLoop::RunLoop):
3879         (WTF::RunLoop::run):
3880
3881 2017-01-31  Filip Pizlo  <fpizlo@apple.com>
3882
3883         The mutator should be able to perform increments of GC work
3884         https://bugs.webkit.org/show_bug.cgi?id=167528
3885
3886         Reviewed by Keith Miller and Geoffrey Garen.
3887
3888         We want dataLog to be locked even if you're not logging to a file!
3889
3890         * wtf/DataLog.cpp:
3891         (WTF::initializeLogFileOnce):
3892
3893 2017-01-28  Wenson Hsieh  <wenson_hsieh@apple.com>
3894
3895         Check USE(APPLE_INTERNAL_SDK) instead of specific headers when importing from WebKitAdditions
3896         https://bugs.webkit.org/show_bug.cgi?id=167555
3897
3898         Reviewed by Dan Bernstein.
3899
3900         Instead of guarding #import <WebKitAdditions/*> on the existence of the imported file, consult
3901         USE(APPLE_INTERNAL_SDK) instead.
3902
3903         * wtf/Platform.h:
3904
3905 2017-01-26  Saam Barati  <sbarati@apple.com>
3906
3907         Harden how the compiler references GC objects
3908         https://bugs.webkit.org/show_bug.cgi?id=167277
3909         <rdar://problem/30179506>
3910
3911         Reviewed by Filip Pizlo.
3912
3913         I made TinyPtrSet use bitwise_cast instead of static_cast
3914         for its singleEntry() function so that it can work on pointer-like
3915         types just as it can on actual pointer types.
3916         
3917         An example of where this matters is when you have TinyPtrSet<T>
3918         where T is defined to be a struct which wraps a pointer, e.g:
3919         
3920         struct T {
3921             void* m_pointer;
3922         }
3923
3924         * wtf/TinyPtrSet.h:
3925         (WTF::TinyPtrSet::singleEntry):
3926
3927 2017-01-25  Wenson Hsieh  <wenson_hsieh@apple.com>
3928
3929         Introduce an item-provider-based pasteboard wrapper
3930         https://bugs.webkit.org/show_bug.cgi?id=167410
3931
3932         Reviewed by Enrica Casucci.
3933
3934         Adds an additional feature flag.
3935
3936         * wtf/FeatureDefines.h:
3937
3938 2017-01-25  Konstantin Tokarev  <annulen@yandex.ru>
3939
3940         Removed leftovers of pre-2015 VisualStudio support
3941         https://bugs.webkit.org/show_bug.cgi?id=167434
3942
3943         Reviewed by Alex Christensen.
3944
3945         * wtf/Compiler.h:
3946         * wtf/Platform.h:
3947         * wtf/StringExtras.h:
3948
3949 2017-01-25  Chris Dumez  <cdumez@apple.com>
3950
3951         Disable Download attribute support on iOS
3952         https://bugs.webkit.org/show_bug.cgi?id=167337
3953         <rdar://problem/30154148>
3954
3955         Reviewed by Alexey Proskuryakov.
3956
3957         Disable Download attribute support on iOS as it currently does not work.
3958
3959         * wtf/FeatureDefines.h:
3960
3961 2017-01-25  Wenson Hsieh  <wenson_hsieh@apple.com>
3962
3963         Add a hook to include additional feature defines
3964         https://bugs.webkit.org/show_bug.cgi?id=167403
3965
3966         Reviewed by Enrica Casucci.
3967
3968         * wtf/Platform.h: Include AdditionalFeatureDefines.h, if it exists.
3969
3970 2017-01-24  Joseph Pecoraro  <pecoraro@apple.com>
3971
3972         Fold USER_TIMING into WEB_TIMING and make it a RuntimeEnabledFeature
3973         https://bugs.webkit.org/show_bug.cgi?id=167394
3974
3975         Reviewed by Ryosuke Niwa.
3976
3977         * wtf/FeatureDefines.h:
3978
3979 2017-01-24  Konstantin Tokarev  <annulen@yandex.ru>
3980
3981         VS2015 supports ref qualifiers
3982         https://bugs.webkit.org/show_bug.cgi?id=167368
3983
3984         Reviewed by Sam Weinig.
3985
3986         * wtf/Compiler.h: Enable
3987         WTF_COMPILER_SUPPORTS_CXX_REFERENCE_QUALIFIED_FUNCTIONS for VS2015
3988
3989 2017-01-24  Daniel Bates  <dabates@apple.com>
3990
3991         StringView.split() should use an iterator design pattern instead of allocating a Vector
3992         https://bugs.webkit.org/show_bug.cgi?id=163225
3993
3994         Reviewed by Darin Adler.
3995
3996         Implement StringView.split() using an iterator design.
3997
3998         Using an iterator design avoids the need to allocate a Vector of StringView objects,
3999         which is space-inefficient and error prone as the returned Vector may outlive the
4000         lifetime of the underlying string associated with the split (as StringView is a non-
4001         owning reference to a string).
4002
4003         StringView.split() now returns a StringView::SplitResult object that implements begin()/end()
4004         to support iterating over StringView substrings delimited by the specified separator
4005         character. For example, to iterate over the 'c'-separated substrings of a StringView v,
4006         you can write:
4007
4008         for (StringView substring : v.split('c'))
4009             // Do something with substring.
4010
4011         * wtf/text/StringView.cpp:
4012         (WTF::StringView::SplitResult::Iterator::findNextSubstring): Advances the iterator to point to the
4013         next substring.
4014         (WTF::StringView::split): Modified to return a SplitResult::Iterator object instead of a Vector<StringView>.
4015         * wtf/text/StringView.h:
4016         (WTF::StringView::SplitResult::SplitResult):
4017         (WTF::StringView::SplitResult::Iterator::Iterator):
4018         (WTF::StringView::SplitResult::Iterator::operator*):
4019         (WTF::StringView::SplitResult::Iterator::operator==):
4020         (WTF::StringView::SplitResult::Iterator::operator!=):
4021         Implements the iterator interface.
4022
4023 2017-01-20  Joseph Pecoraro  <pecoraro@apple.com>
4024
4025         Remove outdated ENABLE(CSP_NEXT) build flag
4026         https://bugs.webkit.org/show_bug.cgi?id=167252
4027
4028         Reviewed by Brent Fulgham.
4029
4030         * wtf/FeatureDefines.h:
4031
4032 2017-01-17  Andreas Kling  <akling@apple.com>
4033
4034         Annotate FastMalloc functions with returns_nonnull attribute.
4035         <https://webkit.org/b/167144>
4036
4037         Reviewed by Antti Koivisto.
4038
4039         Decorate fastMalloc() and friends with __attribute__((returns_nonnull)) for supporting
4040         compilers that can do useful things with that information.
4041
4042         * wtf/Compiler.h:
4043         * wtf/FastMalloc.h:
4044
4045 2017-01-17  Joseph Pecoraro  <pecoraro@apple.com>
4046
4047         ENABLE(USER_TIMING) Not Defined for Apple Windows or OS X Ports
4048         https://bugs.webkit.org/show_bug.cgi?id=116551
4049         <rdar://problem/13949830>
4050
4051         Reviewed by Alex Christensen.
4052
4053         * wtf/FeatureDefines.h:
4054
4055 2017-01-16  Joseph Pecoraro  <pecoraro@apple.com>
4056
4057         Remove the REQUEST_ANIMATION_FRAME flag
4058         https://bugs.webkit.org/show_bug.cgi?id=156980
4059         <rdar://problem/25906849>
4060
4061         Reviewed by Simon Fraser.
4062
4063         * wtf/FeatureDefines.h:
4064
4065 2017-01-15  Sam Weinig  <sam@webkit.org>
4066
4067         Add the ability to use numbers in makeString()
4068         https://bugs.webkit.org/show_bug.cgi?id=167087
4069
4070         Reviewed by Darin Adler.
4071
4072         Allow numbers to be easily used in makeString() and tryMakeString().
4073
4074         For instance, you can now write:
4075             int amount = 7;
4076             auto foo = makeString("There are ", amount, " apples in the cart");
4077
4078         * WTF.xcodeproj/project.pbxproj:
4079         Add new file.
4080
4081         * wtf/text/IntegerToStringConversion.h:
4082         (WTF::writeNumberToBufferImpl):
4083         (WTF::writeNumberToBufferSigned):
4084         (WTF::writeNumberToBufferUnsigned):
4085         (WTF::lengthOfNumberAsStringImpl):
4086         (WTF::lengthOfNumberAsStringSigned):
4087         (WTF::lengthOfNumberAsStringUnsigned):
4088         Add variants of integer writing code that compute the length of the string
4089         that would be produced and writes the string to an existing buffer.
4090
4091         (WTF::IntegerToStringConversionTrait<AtomicString>::flush): Deleted.
4092         (WTF::IntegerToStringConversionTrait<String>::flush): Deleted.
4093         (WTF::IntegerToStringConversionTrait<StringBuilder>::flush): Deleted.
4094         Move these traits to their respective classes.
4095
4096         * wtf/text/AtomicString.h:
4097         (WTF::IntegerToStringConversionTrait<AtomicString>::flush):
4098         * wtf/text/StringBuilder.h:
4099         (WTF::IntegerToStringConversionTrait<StringBuilder>::flush):
4100         * wtf/text/WTFString.h:
4101         (WTF::IntegerToStringConversionTrait<String>::flush):
4102         Traits moved here from IntegerToStringConversion.h
4103
4104         * wtf/text/StringConcatenateNumbers.h: Added.
4105         (WTF::StringTypeAdapter<int>::StringTypeAdapter<int>):
4106         (WTF::StringTypeAdapter<int>::length):
4107         (WTF::StringTypeAdapter<int>::is8Bit):
4108         (WTF::StringTypeAdapter<int>::writeTo):
4109         (WTF::StringTypeAdapter<int>::toString):
4110         (WTF::StringTypeAdapter<unsigned>::StringTypeAdapter<unsigned>):
4111         (WTF::StringTypeAdapter<unsigned>::length):
4112         (WTF::StringTypeAdapter<unsigned>::is8Bit):
4113         (WTF::StringTypeAdapter<unsigned>::writeTo):
4114         (WTF::StringTypeAdapter<unsigned>::toString):
4115         (WTF::StringTypeAdapter<float>::StringTypeAdapter<float>):
4116         (WTF::StringTypeAdapter<float>::length):
4117         (WTF::StringTypeAdapter<float>::is8Bit):
4118         (WTF::StringTypeAdapter<float>::writeTo):
4119         (WTF::StringTypeAdapter<float>::toString):
4120         (WTF::StringTypeAdapter<double>::StringTypeAdapter<double>):
4121         (WTF::StringTypeAdapter<double>::length):
4122         (WTF::StringTypeAdapter<double>::is8Bit):
4123         (WTF::StringTypeAdapter<double>::writeTo):
4124         (WTF::StringTypeAdapter<double>::toString):
4125         Add basic adaptors for int, unsigned, float, and double.
4126
4127         (WTF::FormattedNumber::fixedPrecision):
4128         (WTF::FormattedNumber::fixedWidth):
4129         (WTF::FormattedNumber::length):
4130         (WTF::FormattedNumber::buffer):
4131         (WTF::FormattedNumber::stringView):
4132         (WTF::StringTypeAdapter<FormattedNumber>::StringTypeAdapter<FormattedNumber>):
4133         (WTF::StringTypeAdapter<FormattedNumber>::length):
4134         (WTF::StringTypeAdapter<FormattedNumber>::is8Bit):
4135         (WTF::StringTypeAdapter<FormattedNumber>::writeTo):
4136         (WTF::StringTypeAdapter<FormattedNumber>::toString):
4137         Add a special class, FormattedNumber, and an adaptor for it, allowing for
4138         fixedPrecision and fixedWidth representation of doubles.
4139
4140 2017-01-14  Yusuke Suzuki  <utatane.tea@gmail.com>
4141
4142         WebAssembly: Suppress warnings & errors in GCC
4143         https://bugs.webkit.org/show_bug.cgi?id=167049
4144
4145         Reviewed by Sam Weinig.
4146
4147         * wtf/LEBDecoder.h:
4148         (WTF::LEBDecoder::decodeInt):
4149         If T = int, it performs `-1 << shift`. It causes
4150         warning in GCC. Instead, we first cast it to the
4151         UnsignedT, perform operation and re-cast to the
4152         T.
4153
4154 2017-01-13  Joseph Pecoraro  <pecoraro@apple.com>
4155
4156         Remove ENABLE(DETAILS_ELEMENT) guards
4157         https://bugs.webkit.org/show_bug.cgi?id=167042
4158
4159         Reviewed by Alex Christensen.
4160
4161         * wtf/FeatureDefines.h:
4162
4163 2017-01-11  Darin Adler  <darin@apple.com>
4164
4165         Remove PassRefPtr from more of "platform"
4166         https://bugs.webkit.org/show_bug.cgi?id=166809
4167
4168         Reviewed by Sam Weinig.
4169
4170         * wtf/Ref.h: Changed the template so that a const Ref<T> does not prohibit non-const
4171         use of T. We can still use const Ref<const T> to express that. The earlier design
4172         was intentional, but was not consistent with either actual references or with
4173         other smart pointer classes like RefPtr. One way to see how much better this is,
4174         is to see all the many, many cases where we have const_cast just to work around
4175         this. I searched for those and included fixes for many in this patch.
4176
4177 2017-01-12  Chris Dumez  <cdumez@apple.com>
4178
4179         [iOS] Implement support for KeyboardEvent.code
4180         https://bugs.webkit.org/show_bug.cgi?id=166932
4181         <rdar://problem/29972518>
4182
4183         Reviewed by Darin Adler.
4184
4185         Enable KEYBOARD_CODE_ATTRIBUTE feature on iOS.
4186
4187         * wtf/FeatureDefines.h:
4188
4189 2017-01-11  Andreas Kling  <akling@apple.com>
4190
4191         Crash when WebCore's GC heap grows way too large.
4192         <https://webkit.org/b/166875>
4193         <rdar://problem/27896585>
4194
4195         Reviewed by Mark Lam.
4196
4197         Publish the WTF::GB constant.
4198
4199         * wtf/StdLibExtras.h:
4200
4201 2017-01-11  Anders Carlsson  <andersca@apple.com>
4202
4203         navigator.plugins.refresh and WKContextRefreshPlugIns doesn't pick up changes to already-present plug-ins
4204         https://bugs.webkit.org/show_bug.cgi?id=166942
4205         rdar://problem/29839194
4206
4207         Reviewed by Sam Weinig.
4208
4209         * wtf/spi/cf/CFBundleSPI.h:
4210         Add SPI declaration.
4211
4212 2017-01-06  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
4213
4214         [GTK] Should support key and code properties on keyboard events
4215         https://bugs.webkit.org/show_bug.cgi?id=166759
4216
4217         Reviewed by Carlos Garcia Campos.
4218
4219         * wtf/FeatureDefines.h: enable key and code properties support for GTK.
4220
4221 2017-01-08  Antti Koivisto  <antti@apple.com>
4222
4223         Move cache coders to WTF
4224         https://bugs.webkit.org/show_bug.cgi?id=166825
4225
4226         Rubber-stamped by Sam Weinig.
4227
4228         Make it possible to use robust serialization of WTF types on the lower levels of the stack.
4229
4230         * WTF.xcodeproj/project.pbxproj:
4231         * wtf/persistence: Added.
4232         * wtf/persistence/Coder.h: Copied from Source/WebKit2/NetworkProcess/cache/NetworkCacheCoder.h.
4233         (WebKit::NetworkCache::Coder::encode): Deleted.
4234         (WebKit::NetworkCache::Coder::decode): Deleted.
4235         * wtf/persistence/Coders.cpp: Copied from Source/WebKit2/NetworkProcess/cache/NetworkCacheCoders.cpp.
4236         (WebKit::NetworkCache::Coder<AtomicString>::encode): Deleted.
4237         (WebKit::NetworkCache::Coder<AtomicString>::decode): Deleted.
4238         (WebKit::NetworkCache::Coder<CString>::encode): Deleted.
4239         (WebKit::NetworkCache::Coder<CString>::decode): Deleted.
4240         (WebKit::NetworkCache::Coder<String>::encode): Deleted.
4241         (WebKit::NetworkCache::decodeStringText): Deleted.
4242         (WebKit::NetworkCache::Coder<String>::decode): Deleted.
4243         (WebKit::NetworkCache::Coder<SHA1::Digest>::encode): Deleted.
4244         (WebKit::NetworkCache::Coder<SHA1::Digest>::decode): Deleted.
4245         (WebKit::NetworkCache::Coder<WebCore::HTTPHeaderMap>::encode): Deleted.
4246         (WebKit::NetworkCache::Coder<WebCore::HTTPHeaderMap>::decode): Deleted.
4247         * wtf/persistence/Coders.h: Copied from Source/WebKit2/NetworkProcess/cache/NetworkCacheCoders.h.
4248         (WebKit::NetworkCache::Coder<std::optional<T>>::encode): Deleted.
4249         (WebKit::NetworkCache::Coder<std::optional<T>>::decode): Deleted.
4250         * wtf/persistence/Decoder.cpp: Copied from Source/WebKit2/NetworkProcess/cache/NetworkCacheDecoder.cpp.
4251         (WebKit::NetworkCache::Decoder::Decoder): Deleted.
4252         (WebKit::NetworkCache::Decoder::~Decoder): Deleted.
4253         (WebKit::NetworkCache::Decoder::bufferIsLargeEnoughToContain): Deleted.
4254         (WebKit::NetworkCache::Decoder::decodeFixedLengthData): Deleted.
4255         (WebKit::NetworkCache::Decoder::decodeNumber): Deleted.
4256         (WebKit::NetworkCache::Decoder::decode): Deleted.
4257         (WebKit::NetworkCache::Decoder::verifyChecksum): Deleted.
4258         * wtf/persistence/Decoder.h: Copied from Source/WebKit2/NetworkProcess/cache/NetworkCacheDecoder.h.
4259         (WebKit::NetworkCache::Decoder::length): Deleted.
4260         (WebKit::NetworkCache::Decoder::currentOffset): Deleted.
4261         (WebKit::NetworkCache::Decoder::decodeEnum): Deleted.
4262         (WebKit::NetworkCache::Decoder::decode): Deleted.
4263         (WebKit::NetworkCache::Decoder::bufferIsLargeEnoughToContain): Deleted.