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