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