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