[WTF] Annotate Seconds' member functions and operators with constexpr
[WebKit-https.git] / Source / WTF / ChangeLog
1 2017-04-09  Yusuke Suzuki  <utatane.tea@gmail.com>
2
3         [WTF] Annotate Seconds' member functions and operators with constexpr
4         https://bugs.webkit.org/show_bug.cgi?id=170662
5
6         Reviewed by Daniel Bates.
7
8         Annotate Seconds' member functions and operators with constexpr.
9         It allows us to use Seconds calculation in compile time and use these
10         calculation for static const global variables.
11
12         operator% is an exception: it uses fmod and it is not offered as constexpr.
13
14         * wtf/MathExtras.h:
15         (defaultMinimumForClamp):
16         (defaultMaximumForClamp):
17         (clampToAccepting64):
18         Super unfortunate ugly code. This is because GCC 4.9 does not support C++14 relaxed constexpr.
19
20         * wtf/Seconds.h:
21         (WTF::Seconds::Seconds):
22         (WTF::Seconds::value):
23         (WTF::Seconds::minutes):
24         (WTF::Seconds::seconds):
25         (WTF::Seconds::milliseconds):
26         (WTF::Seconds::microseconds):
27         (WTF::Seconds::nanoseconds):
28         (WTF::Seconds::operator bool):
29         (WTF::Seconds::operator+):
30         (WTF::Seconds::operator-):
31         (WTF::Seconds::operator*):
32         (WTF::Seconds::operator/):
33         (WTF::Seconds::operator==):
34         (WTF::Seconds::operator!=):
35         (WTF::Seconds::operator<):
36         (WTF::Seconds::operator>):
37         (WTF::Seconds::operator<=):
38         (WTF::Seconds::operator>=):
39
40 2017-04-09  Chris Dumez  <cdumez@apple.com>
41
42         Start dropping Timer API dealing with double
43         https://bugs.webkit.org/show_bug.cgi?id=170649
44
45         Reviewed by Yusuke Suzuki.
46
47         Start dropping Timer API dealing with double as people should use Seconds now.
48
49         * wtf/RunLoopTimer.h:
50         * wtf/glib/MainThreadGLib.cpp:
51         (WTF::MainThreadDispatcher::schedule):
52
53 2017-04-07  Keith Miller  <keith_miller@apple.com>
54
55         Unreviewed, remove constexpr function since GTK didn't like it.
56
57         * wtf/PriorityQueue.h:
58         (WTF::PriorityQueue::parentOf):
59
60 2017-04-07  Chris Dumez  <cdumez@apple.com>
61
62         Start using MonotonicTime / Seconds in Timer class
63         https://bugs.webkit.org/show_bug.cgi?id=170625
64
65         Reviewed by Simon Fraser.
66
67         Add modulo operator to MonotonicTime.
68
69         * wtf/MonotonicTime.h:
70         (WTF::MonotonicTime::operator%):
71
72 2017-04-07  Keith Miller  <keith_miller@apple.com>
73
74         Add a PriorityQueue class
75         https://bugs.webkit.org/show_bug.cgi?id=170579
76
77         Reviewed by Saam Barati.
78
79         This patch adds a new PriorityQueue class that is backed by
80         WTF::Vector.  It also has a number of other niceties such as being
81         able to iterate the queue and increase or decrease keys.
82
83         One note is that increaseKey and decreaseKey are O(n) rather than
84         O(log(n)).  Traditionally, the lookup of the key is done with a
85         hash map but that's not feasible here.  This is because unless the
86         queue's element type is a pointer there is no good way maintain a
87         persistent reference to every entry in the queue while we sift.
88         The only way to update the location of an entry is to do a hash
89         table lookup with the entry's hash but this is probably more
90         expensive than just doing a linear search.
91
92         Also, add comparison operator functions, which can be passed to PriorityQueue.
93
94         * WTF.xcodeproj/project.pbxproj:
95         * wtf/MathExtras.h:
96         (isLessThan):
97         (isLessThanEqual):
98         (isGreaterThan):
99         (isGreaterThanEqual):
100         * wtf/PriorityQueue.h: Added.
101         (WTF::PriorityQueue::size):
102         (WTF::PriorityQueue::isEmpty):
103         (WTF::PriorityQueue::enqueue):
104         (WTF::PriorityQueue::peek):
105         (WTF::PriorityQueue::dequeue):
106         (WTF::PriorityQueue::decreaseKey):
107         (WTF::PriorityQueue::increaseKey):
108         (WTF::PriorityQueue::begin):
109         (WTF::PriorityQueue::end):
110         (WTF::PriorityQueue::isValidHeap):
111         (WTF::PriorityQueue::parentOf):
112         (WTF::PriorityQueue::leftChildOf):
113         (WTF::PriorityQueue::rightChildOf):
114         (WTF::PriorityQueue::siftUp):
115         (WTF::PriorityQueue::siftDown):
116
117 2017-04-07  Alex Christensen  <achristensen@webkit.org>
118
119         Use audit_token_t instead of pid_t for checking sandbox of other processes
120         https://bugs.webkit.org/show_bug.cgi?id=170616
121         <rdar://problem/31158189>
122
123         Reviewed by Daniel Bates.
124
125         * wtf/spi/darwin/SandboxSPI.h:
126         Declare more SPI.
127
128 2017-04-07  Ting-Wei Lan  <lantw44@gmail.com>
129
130         Include cstdio before using sscanf and stderr
131         https://bugs.webkit.org/show_bug.cgi?id=170098
132
133         Reviewed by Michael Catanzaro.
134
135         * wtf/NumberOfCores.cpp:
136
137 2017-04-07  Saam Barati  <sbarati@apple.com>
138
139         WebAssembly: Make to a compilation API that allows for multi-VM concurrent compilations of Wasm Modules
140         https://bugs.webkit.org/show_bug.cgi?id=170488
141
142         Reviewed by JF Bastien.
143
144         * wtf/SharedTask.h: Make SharedTaskFunctor forward its arguments.
145
146 2017-04-07  Carlos Garcia Campos  <cgarcia@igalia.com>
147
148         [GTK] Update the priorities used in glib main loop sources
149         https://bugs.webkit.org/show_bug.cgi?id=170457
150
151         Reviewed by Žan Doberšek.
152
153         Add an enum to define prirorities used in different GLib main sources. It allows to give them a better name
154         than high, low, medium, etc., but also to document them and other GLib based ports can define their own
155         values without changing all the places where they are used. The default values are based on the priorities
156         pre-defined by GLib.
157
158         * wtf/glib/MainThreadGLib.cpp:
159         (WTF::MainThreadDispatcher::MainThreadDispatcher):
160         * wtf/glib/RunLoopGLib.cpp:
161         (WTF::RunLoop::RunLoop):
162         (WTF::RunLoop::dispatchAfter):
163         (WTF::RunLoop::TimerBase::TimerBase):
164         * wtf/glib/RunLoopSourcePriority.h: Added.
165         * wtf/linux/MemoryPressureHandlerLinux.cpp:
166         (WTF::MemoryPressureHandler::EventFDPoller::EventFDPoller):
167
168 2017-04-06  Filip Pizlo  <fpizlo@apple.com>
169
170         Linear scan should run liveness only once
171         https://bugs.webkit.org/show_bug.cgi?id=170569
172
173         Reviewed by Keith Miller.
174         
175         Have Liveness<> call Adapter::prepareToCompute(), since this makes it a lot easier to implement
176         constraint generation, since the constraint generator now gets to run after the Adapter is fully
177         constructed.
178         
179         * wtf/IndexMap.h:
180         (WTF::IndexMap::append): Also make this a bit more versatile.
181         * wtf/Liveness.h:
182         (WTF::Liveness::LocalCalc::Iterable::contains):
183         (WTF::Liveness::Iterable::contains):
184         (WTF::Liveness::compute):
185
186 2017-04-06  Andreas Kling  <akling@apple.com>
187
188         Kill any WebContent process using over 16 GB of memory.
189         https://bugs.webkit.org/show_bug.cgi?id=170515
190         <rdar://problem/29930931>
191
192         Reviewed by Antti Koivisto.
193
194         Restructure the code since it was getting out of sync with the intended behavior.
195         Now there's a thresholdForMemoryKill() which returns the current memory limit based
196         on the process status.
197
198         The memory usage policy is separated from the killing, and now only drives the
199         asynchronous invocations of pressure relief that occur when we pass over one of
200         the policy edges (now 1GB for Conservative, 2GB for Strict.)
201
202         Removed the "Panic" policy and moved the memory kill logic to shrinkOrDie().
203
204         Behavior as of this patch:
205
206             - Everyone gets killed over 16 GB.
207             - Inactive processes get killed over 4 GB.
208             - Strict memory usage policy kicks in at 2 GB.
209             - Conservative memory usage policy at 1 GB.
210
211         Like before, we make a best-effort attempt to free up memory before killing the process.
212
213         * wtf/MemoryPressureHandler.cpp:
214         (WTF::toString):
215         (WTF::MemoryPressureHandler::thresholdForMemoryKill):
216         (WTF::thresholdForPolicy):
217         (WTF::policyForFootprint):
218         (WTF::MemoryPressureHandler::shrinkOrDie):
219         (WTF::MemoryPressureHandler::setMemoryUsagePolicyBasedOnFootprint):
220         (WTF::MemoryPressureHandler::measurementTimerFired):
221         * wtf/MemoryPressureHandler.h:
222
223 2017-04-05  Andreas Kling  <akling@apple.com>
224
225         Make inactive web processes behave as though under memory pressure.
226         https://bugs.webkit.org/show_bug.cgi?id=170042
227         <rdar://problem/31038445>
228
229         Reviewed by Antti Koivisto.
230
231         Once a web process becomes inactive, let's try to reduce its impact
232         on memory usage by treating it as if it's under memory pressure until
233         it becomes active.
234
235         * wtf/MemoryPressureHandler.cpp:
236         (WTF::MemoryPressureHandler::setProcessState):
237         (WTF::MemoryPressureHandler::isUnderMemoryPressure):
238         * wtf/MemoryPressureHandler.h:
239         (WTF::MemoryPressureHandler::isUnderMemoryPressure): Deleted.
240
241 2017-04-05  Yusuke Suzuki  <utatane.tea@gmail.com>
242
243         [JSC] Suppress warnings in GCC
244         https://bugs.webkit.org/show_bug.cgi?id=170501
245
246         Reviewed by Keith Miller.
247
248         Add a new macro UNUSED_FUNCTION to annotate unused static functions.
249         #pragma GCC diagnostic ignored "-Wunused-function" does not work.
250
251         * wtf/Compiler.h:
252
253 2017-04-04  Filip Pizlo  <fpizlo@apple.com>
254
255         Air::eliminateDeadCode() should not use a HashSet
256         https://bugs.webkit.org/show_bug.cgi?id=170487
257
258         Reviewed by Saam Barati.
259         
260         BitVector::iterator knows when it's at the end. Expose this functionality.
261
262         * wtf/BitVector.h:
263         (WTF::BitVector::iterator::isAtEnd):
264
265 2017-04-04  Keith Miller  <keith_miller@apple.com>
266
267         WebAssembly: ModuleInformation should be a ref counted thing that can be shared across threads.
268         https://bugs.webkit.org/show_bug.cgi?id=170478
269
270         Reviewed by Saam Barati.
271
272         This adds a new String::fromUTF8 that converts a vector of characters to
273         a string.
274
275         Also, it cleans up some style.
276
277         * wtf/text/WTFString.h:
278         (WTF::String::fromUTF8):
279         * wtf/unicode/UTF8.cpp:
280         (WTF::Unicode::convertLatin1ToUTF8):
281
282 2017-04-04  Filip Pizlo  <fpizlo@apple.com>
283
284         B3::fixSSA() needs a tune-up
285         https://bugs.webkit.org/show_bug.cgi?id=170485
286
287         Reviewed by Saam Barati.
288         
289         This makes IndexSparseSet capable of being used as a map if you instantiate it with
290         KeyValuePair<unsigned, ValueType>.
291
292         * wtf/HashTraits.h:
293         * wtf/IndexSparseSet.h:
294         (WTF::DefaultIndexSparseSetTraits::create):
295         (WTF::DefaultIndexSparseSetTraits::key):
296         (WTF::OverflowHandler>::IndexSparseSet):
297         (WTF::OverflowHandler>::add):
298         (WTF::OverflowHandler>::set):
299         (WTF::OverflowHandler>::remove):
300         (WTF::OverflowHandler>::clear):
301         (WTF::OverflowHandler>::size):
302         (WTF::OverflowHandler>::isEmpty):
303         (WTF::OverflowHandler>::contains):
304         (WTF::OverflowHandler>::sort):
305         (WTF::IndexSparseSet<OverflowHandler>::IndexSparseSet): Deleted.
306         (WTF::IndexSparseSet<OverflowHandler>::add): Deleted.
307         (WTF::IndexSparseSet<OverflowHandler>::remove): Deleted.
308         (WTF::IndexSparseSet<OverflowHandler>::clear): Deleted.
309         (WTF::IndexSparseSet<OverflowHandler>::size): Deleted.
310         (WTF::IndexSparseSet<OverflowHandler>::isEmpty): Deleted.
311         (WTF::IndexSparseSet<OverflowHandler>::contains): Deleted.
312         (WTF::IndexSparseSet<OverflowHandler>::sort): Deleted.
313         * wtf/Liveness.h:
314         (WTF::Liveness::LocalCalc::Iterable::iterator::iterator):
315         (WTF::Liveness::workset):
316
317 2017-04-04  Filip Pizlo  <fpizlo@apple.com>
318
319         Don't need to Air::reportUsedRegisters for wasm at -O1
320         https://bugs.webkit.org/show_bug.cgi?id=170459
321
322         Reviewed by Saam Barati.
323         
324         Just moved the liveness computation into a method, which enabled me to do the profiling
325         that I used to write this patch.
326
327         * wtf/Liveness.h:
328         (WTF::Liveness::Liveness):
329         (WTF::Liveness::compute):
330
331 2017-04-03  Filip Pizlo  <fpizlo@apple.com>
332
333         Air liveness should build constraints and solve them rather than repeatedly parsing IR
334         https://bugs.webkit.org/show_bug.cgi?id=170421
335
336         Reviewed by Saam Barati.
337
338         * wtf/Vector.h:
339         (WTF::minCapacity>::appendIfNotContains): Because sometimes Vector<> is the best kind of set.
340
341 2017-04-03  Yusuke Suzuki  <utatane.tea@gmail.com>
342
343         [WTF] Introduce WTF::RandomDevice which keeps /dev/urandom opened
344         https://bugs.webkit.org/show_bug.cgi?id=170095
345
346         Reviewed by Michael Catanzaro.
347
348         In this patch, we introduce RandomDevice, which keeps /dev/urandom opened
349         to avoid repeatedly open and close urandom file descriptor in Linux.
350
351         The purpose is similar to std::random_device, but WTF::RandomDevice explicitly
352         avoids using ARC4, which is recently attempted to be removed from the WebKit
353         tree[1].
354
355         [1]: https://trac.webkit.org/r214329
356
357         * WTF.xcodeproj/project.pbxproj:
358         * wtf/CMakeLists.txt:
359         * wtf/OSRandomSource.cpp:
360         (WTF::cryptographicallyRandomValuesFromOS):
361         (WTF::crashUnableToOpenURandom): Deleted.
362         (WTF::crashUnableToReadFromURandom): Deleted.
363         * wtf/RandomDevice.cpp: Copied from Source/WTF/wtf/OSRandomSource.cpp.
364         (WTF::crashUnableToOpenURandom):
365         (WTF::crashUnableToReadFromURandom):
366         (WTF::RandomDevice::RandomDevice):
367         (WTF::RandomDevice::~RandomDevice):
368         (WTF::RandomDevice::cryptographicallyRandomValues):
369         * wtf/RandomDevice.h: Added.
370
371 2017-04-03  Filip Pizlo  <fpizlo@apple.com>
372
373         WTF::Liveness should have an API that focuses on actions at instruction boundaries
374         https://bugs.webkit.org/show_bug.cgi?id=170407
375
376         Reviewed by Keith Miller.
377         
378         Change the Liveness<> API to handle early and late things in one lump inside forEachUse
379         and forEachDef functions. This reduces the amount of different functions that Liveness<>
380         expects from its adaptor. This makes it easier to implement optimizations that cache the
381         use/def behavior of each instruction boundary.
382
383         * wtf/Liveness.h:
384         (WTF::Liveness::Liveness):
385         (WTF::Liveness::LocalCalc::execute):
386
387 2017-04-01  Csaba Osztrogonác  <ossy@webkit.org>
388
389         Mac cmake buildfix after 214586.
390         https://bugs.webkit.org/show_bug.cgi?id=170381
391
392         Unreviewed.
393
394         * wtf/BlockPtr.h:
395
396 2017-03-30  Filip Pizlo  <fpizlo@apple.com>
397
398         Air should support linear scan for optLevel<2
399         https://bugs.webkit.org/show_bug.cgi?id=170161
400
401         Reviewed by Saam Barati.
402         
403         This change introduces a new low-latency register allocator. It can allocate registers very
404         quickly by doing a relatively poor job. Implementing this algorithm required beefing up some of
405         our core algorithms.
406
407         * WTF.xcodeproj/project.pbxproj:
408         * wtf/CMakeLists.txt:
409         * wtf/Deque.h: Make it possible to do some basic priority queueing with this data structure.
410         (WTF::inlineCapacity>::removeAllMatching):
411         (WTF::inlineCapacity>::appendAndBubble):
412         (WTF::inlineCapacity>::takeLast):
413         * 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.
414         (WTF::IndexKeyType::index):
415         * wtf/IndexMap.h: Adopt IndexKeyType.
416         (WTF::IndexMap::operator[]):
417         (WTF::IndexMap::append):
418         * wtf/IndexSet.h: Adopt IndexKeyType.
419         (WTF::IndexSet::add):
420         (WTF::IndexSet::addAll):
421         (WTF::IndexSet::remove):
422         (WTF::IndexSet::contains):
423         (WTF::IndexSet::Iterable::iterator::operator*):
424         * wtf/Range.h: Added. This used to be B3::HeapRange. This generalizes that data structure to any kind of range stuff.
425         (WTF::Range::Range):
426         (WTF::Range::top):
427         (WTF::Range::operator==):
428         (WTF::Range::operator!=):
429         (WTF::Range::operator bool):
430         (WTF::Range::operator|):
431         (WTF::Range::operator|=):
432         (WTF::Range::begin):
433         (WTF::Range::end):
434         (WTF::Range::overlaps):
435         (WTF::Range::dump):
436         * wtf/RangeSet.h:
437         (WTF::RangeSet::add):
438
439 2017-03-25  Yusuke Suzuki  <utatane.tea@gmail.com>
440
441         [JSC] Move platformThreadSignal to WTF
442         https://bugs.webkit.org/show_bug.cgi?id=170097
443
444         Reviewed by Mark Lam.
445
446         * wtf/Threading.h:
447         * wtf/ThreadingPthreads.cpp:
448         (WTF::signalThread):
449
450 2017-03-26  Filip Pizlo  <fpizlo@apple.com>
451
452         B3::fixSSA should do liveness pruning
453         https://bugs.webkit.org/show_bug.cgi?id=170111
454
455         Reviewed by Saam Barati.
456         
457         Move Air::Liveness<> to WTF::Liveness<>. This is pretty easy since Air::Liveness<> was
458         already fairly generic. It leverages the CFG concept so that it can understand many
459         different kinds of basic blocks. It doesn't try to understand the contents of basic
460         blocks; it just asks the adaptor for the block size and asks for the early/late
461         uses/defs of each thing in the block.
462         
463         This makes it easy to create a B3::VariableLiveness, which fixSSA then uses for
464         pruning. One of the new features is the Liveness::LiveAtHead nested class, which you
465         instantiate if you want to perform liveAtHead queries, which SSA construction wants to
466         do.
467         
468         This also fixes https://bugs.webkit.org/show_bug.cgi?id=170102#c12
469
470         * WTF.xcodeproj/project.pbxproj:
471         * wtf/CMakeLists.txt:
472         * wtf/Liveness.h: Added.
473         (WTF::Liveness::Liveness):
474         (WTF::Liveness::LocalCalc::LocalCalc):
475         (WTF::Liveness::LocalCalc::Iterable::Iterable):
476         (WTF::Liveness::LocalCalc::Iterable::iterator::iterator):
477         (WTF::Liveness::LocalCalc::Iterable::iterator::operator++):
478         (WTF::Liveness::LocalCalc::Iterable::iterator::operator*):
479         (WTF::Liveness::LocalCalc::Iterable::iterator::operator==):
480         (WTF::Liveness::LocalCalc::Iterable::iterator::operator!=):
481         (WTF::Liveness::LocalCalc::Iterable::begin):
482         (WTF::Liveness::LocalCalc::Iterable::end):
483         (WTF::Liveness::LocalCalc::Iterable::contains):
484         (WTF::Liveness::LocalCalc::live):
485         (WTF::Liveness::LocalCalc::isLive):
486         (WTF::Liveness::LocalCalc::execute):
487         (WTF::Liveness::rawLiveAtHead):
488         (WTF::Liveness::Iterable::Iterable):
489         (WTF::Liveness::Iterable::iterator::iterator):
490         (WTF::Liveness::Iterable::iterator::operator*):
491         (WTF::Liveness::Iterable::iterator::operator++):
492         (WTF::Liveness::Iterable::iterator::operator==):
493         (WTF::Liveness::Iterable::iterator::operator!=):
494         (WTF::Liveness::Iterable::begin):
495         (WTF::Liveness::Iterable::end):
496         (WTF::Liveness::Iterable::contains):
497         (WTF::Liveness::liveAtHead):
498         (WTF::Liveness::liveAtTail):
499         (WTF::Liveness::workset):
500         (WTF::Liveness::LiveAtHead::LiveAtHead):
501         (WTF::Liveness::LiveAtHead::isLiveAtHead):
502
503 2017-03-25  Filip Pizlo  <fpizlo@apple.com>
504
505         Air::Liveness shouldn't need HashSets
506         https://bugs.webkit.org/show_bug.cgi?id=170102
507
508         Reviewed by Yusuke Suzuki.
509
510         * wtf/IndexSparseSet.h: Add some helpers for a HashSet-free liveness analysis.
511         (WTF::IndexSparseSet::values):
512         (WTF::IndexSparseSet<OverflowHandler>::sort):
513         * wtf/StdLibExtras.h:
514         (WTF::mergeDeduplicatedSorted): Rapidly merge two sorted lists that don't have duplicates to produce a new sorted list that doesn't have duplicates.
515         * wtf/Vector.h:
516         (WTF::minCapacity>::uncheckedAppend): Inline this!
517         (WTF::removeRepeatedElements): This is a version of std::unique() that works naturally for Vectors.
518
519 2017-03-26  Filip Pizlo  <fpizlo@apple.com>
520
521         Air should use RegisterSet for RegLiveness
522         https://bugs.webkit.org/show_bug.cgi?id=170108
523
524         Reviewed by Yusuke Suzuki.
525
526         * wtf/Atomics.h:
527         (WTF::ensurePointer): This is a useful replacement for std::once, which requires less fencing.
528         * wtf/Bitmap.h: Add more utilities.
529         (WTF::Bitmap::iterator::iterator): An iterator for set bits.
530         (WTF::Bitmap::iterator::operator*):
531         (WTF::Bitmap::iterator::operator++):
532         (WTF::Bitmap::iterator::operator==):
533         (WTF::Bitmap::iterator::operator!=):
534         (WTF::Bitmap::begin):
535         (WTF::Bitmap::end):
536         (WTF::WordType>::subsumes): a.subsumes(b) if all of b's set bits are set in a.
537         (WTF::WordType>::findBit): find next set or clear bit.
538
539 2017-03-24  JF Bastien  <jfbastien@apple.com>
540
541         WebAssembly: store state in TLS instead of on VM
542         https://bugs.webkit.org/show_bug.cgi?id=169611
543
544         Reviewed by Filip Pizlo.
545
546         * wtf/FastTLS.h: reserve one key for WebAssembly, delete a bunch
547         of dead code which clang couldn't compile (it's valid GCC assembly
548         which LLVM dislikes).
549
550 2017-03-24  Ryan Haddad  <ryanhaddad@apple.com>
551
552         Unreviewed, rolling out r214351.
553
554         This change caused API test
555         WebKit1.DidCreateJavaScriptContextBackForwardCacheTest to
556         fail.
557
558         Reverted changeset:
559
560         "Make inactive web processes behave as though under memory
561         pressure."
562         https://bugs.webkit.org/show_bug.cgi?id=170042
563         http://trac.webkit.org/changeset/214351
564
565 2017-03-24  Chris Dumez  <cdumez@apple.com>
566
567         Unreviewed, rolling out r214329.
568
569         Significantly regressed Speedometer
570
571         Reverted changeset:
572
573         "window.crypto.getRandomValues() uses the insecure RC4 RNG"
574         https://bugs.webkit.org/show_bug.cgi?id=169623
575         http://trac.webkit.org/changeset/214329
576
577 2017-03-24  Andreas Kling  <akling@apple.com>
578
579         Make inactive web processes behave as though under memory pressure.
580         <https://webkit.org/b/170042>
581
582         Reviewed by Antti Koivisto.
583
584         Once a web process becomes inactive, let's try to reduce its impact
585         on memory usage by treating it as if it's under memory pressure until
586         it becomes active.
587
588         * wtf/MemoryPressureHandler.cpp:
589         (WTF::MemoryPressureHandler::setProcessState):
590         (WTF::MemoryPressureHandler::isUnderMemoryPressure):
591         * wtf/MemoryPressureHandler.h:
592         (WTF::MemoryPressureHandler::isUnderMemoryPressure): Deleted.
593
594 2017-03-23  Michael Catanzaro  <mcatanzaro@igalia.com>
595
596         window.crypto.getRandomValues() uses the insecure RC4 RNG
597         https://bugs.webkit.org/show_bug.cgi?id=169623
598
599         Reviewed by Alex Christensen.
600
601         Remove the RC4 random generator in favor of using OS randomness for now. This is basically
602         a merge of https://codereview.chromium.org/1431233002 from Blink, original author "eroman".
603
604         * wtf/CryptographicallyRandomNumber.cpp:
605         (WTF::cryptographicallyRandomNumber):
606         (WTF::cryptographicallyRandomValues):
607         (): Deleted.
608
609 2017-03-23  Tomas Popela  <tpopela@redhat.com>
610
611         Fix uninitialized public members in WTF
612         https://bugs.webkit.org/show_bug.cgi?id=169676
613
614         Reviewed by Michael Catanzaro.
615
616         Found by Coverity scan.
617
618         * wtf/Bag.h:
619         * wtf/HashTable.h:
620         * wtf/HashTraits.h:
621         * wtf/Insertion.h:
622         * wtf/OrderMaker.h:
623         * wtf/ParallelJobsGeneric.h:
624
625 2017-03-22  Andreas Kling  <akling@apple.com>
626
627         Let MemoryPressureHandler track whether the process is active or inactive.
628         <https://webkit.org/b/169990>
629
630         Reviewed by Antti Koivisto.
631
632         An active process is a process that meets any of these criteria:
633
634             - Has had a visible Page in an active window in the last hour
635             - Is playing audio
636
637         This replaces the old mechanism where MemoryPressureHandler would invoke
638         a callback to know whether the process was eligible for a memory kill.
639         Instead we now plumb the relevant information down from WebCore and kill
640         based on this activity state.
641
642         * wtf/MemoryPressureHandler.cpp:
643         (WTF::MemoryPressureHandler::measurementTimerFired):
644         (WTF::MemoryPressureHandler::setProcessState):
645         * wtf/MemoryPressureHandler.h:
646         (WTF::MemoryPressureHandler::setMemoryKillCallback):
647         (WTF::MemoryPressureHandler::processState):
648         (WTF::MemoryPressureHandler::setProcessIsEligibleForMemoryKillCallback): Deleted.
649
650 2017-03-20  Simon Fraser  <simon.fraser@apple.com>
651
652         Add a system trace point for memory warning handling
653         https://bugs.webkit.org/show_bug.cgi?id=169893
654
655         Reviewed by Zalan Bujtas.
656
657         Make it possible to pass data to the Begin trace point.
658
659         * wtf/SystemTracing.h:
660         (WTF::TraceScope::TraceScope):
661
662 2017-03-17  Said Abou-Hallawa  <sabouhallawa@apple.com>
663
664         Time channel attack on SVG Filters
665         https://bugs.webkit.org/show_bug.cgi?id=118689
666
667         Reviewed by Simon Fraser.
668
669         Performing arithmetic operations on subnormal floating-point numbers is
670         very expensive. Normalizing the floating-point number to the minimum normal
671         value should accelerate the calculations and there won't be a noticeable
672         difference in the result since all the subnormal values and the minimum
673         normal value are all very close to zero.
674
675         * wtf/MathExtras.h:
676         (normalizedFloat):
677
678 2017-03-11  Filip Pizlo  <fpizlo@apple.com>
679
680         Air should be powerful enough to support Tmp-splitting
681         https://bugs.webkit.org/show_bug.cgi?id=169515
682
683         Reviewed by Saam Barati.
684         
685         Teach IndexMap how to handle types that don't have a default constructor. This makes it
686         easy to create a IndexMap<BasicBlock, InsertionSet>, which is a super powerful
687         construct.
688
689         * wtf/IndexMap.h:
690         (WTF::IndexMap::IndexMap):
691         (WTF::IndexMap::resize):
692         (WTF::IndexMap::clear):
693
694 2017-03-16  Simon Fraser  <simon.fraser@apple.com>
695
696         Improve the system tracing points
697         https://bugs.webkit.org/show_bug.cgi?id=169790
698
699         Reviewed by Zalan Bujtas.
700
701         Use a more cohesive set of system trace points that give a good overview of what
702         WebKit is doing. Added points for resource loading, render tree building, sync messages
703         to the web process, async image decode, WASM and fetching cookies.
704
705         * wtf/SystemTracing.h:
706
707 2017-03-16  Carlos Garcia Campos  <cgarcia@igalia.com>
708
709         [UNIX] Implement currentSearchLocaleID() and currentTextBreakLocaleID()
710         https://bugs.webkit.org/show_bug.cgi?id=169745
711
712         Reviewed by Yusuke Suzuki.
713
714         Add a common implementation for Unix based ports using setlocale.
715
716         * wtf/PlatformGTK.cmake:
717         * wtf/PlatformJSCOnly.cmake:
718         * wtf/text/gtk/TextBreakIteratorInternalICUGtk.cpp: Removed.
719         * wtf/text/unix/TextBreakIteratorInternalICUUnix.cpp: Renamed from Source/WTF/wtf/text/jsconly/TextBreakIteratorInternalICUJSCOnly.cpp.
720         (WTF::currentSearchLocaleID):
721         (WTF::currentTextBreakLocaleID):
722
723 2017-03-16  Carlos Garcia Campos  <cgarcia@igalia.com>
724
725         [GLIB] MainThread implementation is not GTK+ specific
726         https://bugs.webkit.org/show_bug.cgi?id=169736
727
728         Reviewed by Yusuke Suzuki.
729
730         It's implemented in MainThreadGLib.cpp for glib based ports, so ifdefs in MainThread should not be
731         PLATFORM(GTK) but USE(GLIB).
732
733         * wtf/MainThread.cpp:
734         * wtf/MainThread.h:
735
736 2017-03-15  Carlos Alberto Lopez Perez  <clopez@igalia.com>
737
738         [CMake][JSCOnly] Fix build with GLib event loop
739         https://bugs.webkit.org/show_bug.cgi?id=169730
740
741         Reviewed by Michael Catanzaro.
742
743         * wtf/MainThread.cpp:
744         * wtf/PlatformJSCOnly.cmake: WorkQueueGLib was removed in r199713.
745
746 2017-03-15  Dean Jackson  <dino@apple.com>
747
748         Sort Xcode project files
749         https://bugs.webkit.org/show_bug.cgi?id=169669
750
751         Reviewed by Antoine Quint.
752
753         * WTF.xcodeproj/project.pbxproj:
754
755 2017-03-14  Filip Pizlo  <fpizlo@apple.com>
756
757         Fix some typos in this benchmark.
758
759         Rubber stamped by Saam Barati.
760
761         * benchmarks/HashSetDFGReplay.cpp:
762         (main):
763
764 2017-03-14  Filip Pizlo  <fpizlo@apple.com>
765
766         Record the HashSet/HashMap operations in DFG/FTL/B3 and replay them in a benchmark
767         https://bugs.webkit.org/show_bug.cgi?id=169590
768
769         Reviewed by Saam Barati.
770         
771         This adds LoggingHashSet and LoggingHashMap, which are drop-in replacements for HashSet and
772         HashMap that log everything that they do, so that you can replay it later.
773         
774         This also adds a benchmark (HashSetDFGReplay) based on doing a recording of some of the HashSets
775         in the DFG compiler.
776
777         * WTF.xcodeproj/project.pbxproj:
778         * benchmarks/HashSetDFGReplay.cpp: Added.
779         (benchmark):
780         (main):
781         * wtf/CMakeLists.txt:
782         * wtf/GlobalVersion.cpp: Added.
783         (WTF::newGlobalVersion):
784         * wtf/GlobalVersion.h: Added.
785         * wtf/HashMap.h:
786         (WTF::X>::swap):
787         * wtf/HashSet.h:
788         (WTF::V>::addVoid):
789         * wtf/LoggingHashID.h: Added.
790         (WTF::LoggingHashID::LoggingHashID):
791         (WTF::LoggingHashID::dump):
792         * wtf/LoggingHashMap.h: Added.
793         * wtf/LoggingHashSet.h: Added.
794         * wtf/LoggingHashTraits.h: Added.
795         (WTF::LoggingHashKeyTraits::print):
796         (WTF::LoggingHashValueTraits::print):
797
798 2017-03-13  Jer Noble  <jer.noble@apple.com>
799
800         Make classes used by Media Stream encode/decode friendly
801         https://bugs.webkit.org/show_bug.cgi?id=169567
802
803         Reviewed by Eric Carlson.
804
805         * wtf/MediaTime.h:
806         (WTF::MediaTime::encode):
807         (WTF::MediaTime::decode):
808
809 2017-03-14  Yusuke Suzuki  <utatane.tea@gmail.com>
810
811         Add secondsAs<T> methods to Seconds to convert it to integers with clamp
812         https://bugs.webkit.org/show_bug.cgi?id=169537
813
814         Reviewed by Carlos Garcia Campos.
815
816         When using the usual static_cast, infinity becomes 0 accidentally.
817         It is not intended value when using Seconds for timeout value.
818         Instead, we use clampToAccepting64 to convert Seconds to
819         integer values to pass them to the system functions.
820
821         * wtf/MathExtras.h:
822         (clampToAccepting64):
823         * wtf/Seconds.h:
824         (WTF::Seconds::minutesAs):
825         (WTF::Seconds::secondsAs):
826         (WTF::Seconds::millisecondsAs):
827         (WTF::Seconds::microsecondsAs):
828         (WTF::Seconds::nanosecondsAs):
829         * wtf/cocoa/WorkQueueCocoa.cpp:
830         (WTF::WorkQueue::dispatchAfter):
831         * wtf/glib/RunLoopGLib.cpp:
832         (WTF::RunLoop::dispatchAfter):
833         (WTF::RunLoop::TimerBase::updateReadyTime):
834
835 2017-03-13  Yusuke Suzuki  <utatane.tea@gmail.com>
836
837         [JSC][Linux] Implement VMTrap in Linux ports
838         https://bugs.webkit.org/show_bug.cgi?id=169436
839
840         Reviewed by Mark Lam.
841
842         Enable VMTrap mechanism for Linux and FreeBSD.
843
844         * wtf/Platform.h:
845
846 2017-03-13  Yusuke Suzuki  <utatane.tea@gmail.com>
847
848         [WTF] Clean up RunLoop and WorkQueue with Seconds and Function
849         https://bugs.webkit.org/show_bug.cgi?id=169537
850
851         Reviewed by Sam Weinig.
852
853         This patch modernizes RunLoop and WorkQueue.
854
855         1. Use Ref<> aggressively
856         2. Use Seconds instead of chrono times
857         3. Use Function<> instead of std::function
858
859         * wtf/MainThread.cpp:
860         (WTF::dispatchFunctionsFromMainThread):
861         * wtf/RunLoop.h:
862         * wtf/WorkQueue.h:
863         * wtf/cocoa/WorkQueueCocoa.cpp:
864         (WTF::WorkQueue::dispatch):
865         (WTF::WorkQueue::dispatchAfter):
866         (WTF::WorkQueue::concurrentApply):
867         * wtf/generic/MainThreadGeneric.cpp:
868         (WTF::scheduleDispatchFunctionsOnMainThread):
869         * wtf/generic/RunLoopGeneric.cpp:
870         (WTF::RunLoop::TimerBase::ScheduledTask::create):
871         (WTF::RunLoop::TimerBase::ScheduledTask::EarliestSchedule::operator()):
872         (WTF::RunLoop::populateTasks):
873         (WTF::RunLoop::runImpl):
874         (WTF::RunLoop::schedule):
875         (WTF::RunLoop::scheduleAndWakeUp):
876         (WTF::RunLoop::dispatchAfter):
877         (WTF::RunLoop::TimerBase::start):
878         * wtf/generic/WorkQueueGeneric.cpp:
879         (WorkQueue::dispatch):
880         (WorkQueue::dispatchAfter):
881         * wtf/glib/RunLoopGLib.cpp:
882         (WTF::DispatchAfterContext::DispatchAfterContext):
883         (WTF::RunLoop::dispatchAfter):
884         (WTF::RunLoop::TimerBase::updateReadyTime):
885         (WTF::RunLoop::TimerBase::start):
886         * wtf/win/WorkQueueWin.cpp:
887         (WTF::WorkQueue::performWorkOnRegisteredWorkThread):
888         (WTF::WorkQueue::dispatch):
889         (WTF::WorkQueue::dispatchAfter):
890
891 2017-03-13  Chris Dumez  <cdumez@apple.com>
892
893         [WK2] Only report background WebProcesses as unresponsive in the background after 90 seconds
894         https://bugs.webkit.org/show_bug.cgi?id=169425
895         <rdar://problem/30954003>
896
897         Reviewed by Andreas Kling.
898
899         * wtf/RunLoop.h:
900         (WTF::RunLoop::TimerBase::startRepeating):
901         (WTF::RunLoop::TimerBase::startOneShot):
902         Add overloads to RunLoop::Timer that take Seconds in parameter,
903         for convenience.
904
905         * wtf/Seconds.h:
906         (WTF::Seconds::fromHours):
907         (WTF::seconds_literals::operator _h):
908         Allow _h suffix for initializing Seconds type to hours.
909
910 2017-03-11  Csaba Osztrogonác  <ossy@webkit.org>
911
912         REGRESSION(r213645): It made JSC tests super slow and timeout on AArch64 Linux
913         https://bugs.webkit.org/show_bug.cgi?id=169510
914
915         Unreviewed, disable LL_SC on Linux to unbreak this platform.
916
917         * wtf/Atomics.h:
918         * wtf/Platform.h:
919
920 2017-03-10  Filip Pizlo  <fpizlo@apple.com>
921
922         The JITs should be able to emit fast TLS loads
923         https://bugs.webkit.org/show_bug.cgi?id=169483
924
925         Reviewed by Keith Miller.
926
927         Consolidated what we know about fast TLS in FastTLS.h.
928
929         * WTF.xcodeproj/project.pbxproj:
930         * wtf/CMakeLists.txt:
931         * wtf/FastTLS.h: Added.
932         (WTF::loadFastTLS):
933         (WTF::fastTLSOffsetForKey):
934         * wtf/Platform.h:
935         * wtf/WTFThreadData.cpp:
936         (WTF::WTFThreadData::createAndRegisterForGetspecificDirect):
937         * wtf/WTFThreadData.h:
938         (WTF::wtfThreadData):
939
940 2017-03-10  Mark Lam  <mark.lam@apple.com>
941
942         Turn ENABLE(MASM_PROBE) on by default for OS(DARWIN) release builds.
943         https://bugs.webkit.org/show_bug.cgi?id=169493
944
945         Reviewed by Saam Barati.
946
947         MASM_PROBE was already enabled for debug builds.  This change makes it so that we
948         don't have to rebuild the world every time we need to use it on a release build.
949
950         * wtf/Platform.h:
951
952 2017-03-10  Csaba Osztrogonác  <ossy@webkit.org>
953
954         Unreviewed AArch64 Linux buildfix after r213645.
955         https://bugs.webkit.org/show_bug.cgi?id=169300
956
957         * wtf/Atomics.h: intptr_t and int64_t are typedefs for long int on Linux.
958         They are different types only on Darwin platforms.
959
960 2017-03-09  Caio Lima  <ticaiolima@gmail.com>
961
962         [ESnext] Implement Object Rest - Implementing Object Rest Destructuring
963         https://bugs.webkit.org/show_bug.cgi?id=167962
964
965         Reviewed by Keith Miller.
966
967         * wtf/HashSet.h:
968         (WTF::=):
969
970 2017-03-09  Youenn Fablet  <youenn@apple.com>
971
972         Activate VideoToolbox when WebRTC is enabled on iOS
973         https://bugs.webkit.org/show_bug.cgi?id=169423
974
975         Reviewed by Jon Lee.
976
977         * wtf/Platform.h: Activate VIDEOTOOLBOX if WEBRTC is enabled.
978
979 2017-03-09  Filip Pizlo  <fpizlo@apple.com>
980
981         std::isnan/isinf/isfinite should work with WTF time classes
982         https://bugs.webkit.org/show_bug.cgi?id=164991
983
984         Reviewed by Darin Adler.
985         
986         The consensus view (see comments in https://bugs.webkit.org/show_bug.cgi?id=152045) of how
987         to check if something is NaN is to use std::isnan(). To be able to do that for time
988         classes, they need to provide their own isnan() overhload. This also provides isinf()
989         overloads.
990
991         * wtf/MonotonicTime.h:
992         (std::isnan):
993         (std::isinf):
994         * wtf/Seconds.h:
995         (std::isnan):
996         (std::isinf):
997         * wtf/TimeWithDynamicClockType.h:
998         (std::isnan):
999         (std::isinf):
1000         * wtf/WallTime.h:
1001         (std::isnan):
1002         (std::isinf):
1003
1004 2017-03-09  Mark Lam  <mark.lam@apple.com>
1005
1006         Use const AbstractLocker& (instead of const LockHolder&) in more places.
1007         https://bugs.webkit.org/show_bug.cgi?id=169424
1008
1009         Reviewed by Filip Pizlo.
1010
1011         * wtf/RunLoop.h:
1012         * wtf/generic/RunLoopGeneric.cpp:
1013         (WTF::RunLoop::wakeUp):
1014         (WTF::RunLoop::schedule):
1015
1016 2017-03-09  Mark Lam  <mark.lam@apple.com>
1017
1018         Make the VM Traps mechanism non-polling for the DFG and FTL.
1019         https://bugs.webkit.org/show_bug.cgi?id=168920
1020         <rdar://problem/30738588>
1021
1022         Reviewed by Filip Pizlo.
1023
1024         Make StackBounds more useful for checking if a pointer is within stack bounds.
1025
1026         * wtf/MetaAllocator.cpp:
1027         (WTF::MetaAllocator::isInAllocatedMemory):
1028         * wtf/MetaAllocator.h:
1029         * wtf/Platform.h:
1030         * wtf/StackBounds.h:
1031         (WTF::StackBounds::emptyBounds):
1032         (WTF::StackBounds::StackBounds):
1033         (WTF::StackBounds::isEmpty):
1034         (WTF::StackBounds::contains):
1035
1036 2017-03-07  Filip Pizlo  <fpizlo@apple.com>
1037
1038         WTF should make it super easy to do ARM concurrency tricks
1039         https://bugs.webkit.org/show_bug.cgi?id=169300
1040
1041         Reviewed by Mark Lam.
1042         
1043         This adds Atomic<>::loadLink and Atomic<>::storeCond, available only when HAVE(LL_SC).
1044         
1045         It abstracts loadLink/storeCond behind prepare/attempt. You can write prepare/attempt
1046         loops whenever your loop fits into the least common denominator of LL/SC and CAS.
1047         
1048         This modifies Atomic<>::transaction to use prepare/attempt. So, if you write your loop
1049         using Atomic<>::transaction, then you get LL/SC for free.
1050
1051         Depending on the kind of transaction you are doing, you may not want to perform an LL
1052         until you have a chance to just load the current value. Atomic<>::transaction() assumes
1053         that you do not care to have any ordering guarantees in that case. If you think that
1054         the transaction has a good chance of aborting this way, you want
1055         Atomic<>::transaction() to first do a plain load. But if you don't think that such an
1056         abort is likely, then you want to go straight to the LL. The API supports this concept
1057         via TransactionAbortLikelihood.
1058         
1059         Additionally, this redoes the depend/consume API to be dead simple. Dependency is
1060         unsigned. You get a dependency on a loaded value by just saying
1061         dependency(loadedValue). You consume the dependency by using it as a bonus index to
1062         some pointer dereference. This is made easy with the consume<T*>(ptr, dependency)
1063         helper. In those cases where you want to pass around both a computed value and a
1064         dependency, there's DependencyWith<T>. But you won't need it in most cases. The loaded
1065         value or any value computed from the loaded value is a fine input to dependency()!
1066         
1067         This change updates a bunch of hot paths to use the new APIs. Using transaction() gives
1068         us optimal LL/SC loops for object marking and lock acquisition.
1069         
1070         This change also updates a bunch of hot paths to use dependency()/consume().
1071         
1072         This is a significant Octane/splay speed-up on ARM.
1073
1074         * wtf/Atomics.h:
1075         (WTF::hasFence):
1076         (WTF::Atomic::prepare):
1077         (WTF::Atomic::attempt):
1078         (WTF::Atomic::transaction):
1079         (WTF::Atomic::transactionRelaxed):
1080         (WTF::nullDependency):
1081         (WTF::dependency):
1082         (WTF::DependencyWith::DependencyWith):
1083         (WTF::dependencyWith):
1084         (WTF::consume):
1085         (WTF::Atomic::tryTransactionRelaxed): Deleted.
1086         (WTF::Atomic::tryTransaction): Deleted.
1087         (WTF::zeroWithConsumeDependency): Deleted.
1088         (WTF::consumeLoad): Deleted.
1089         * wtf/Bitmap.h:
1090         (WTF::WordType>::get):
1091         (WTF::WordType>::concurrentTestAndSet):
1092         (WTF::WordType>::concurrentTestAndClear):
1093         * wtf/LockAlgorithm.h:
1094         (WTF::LockAlgorithm::lockFast):
1095         (WTF::LockAlgorithm::unlockFast):
1096         (WTF::LockAlgorithm::unlockSlow):
1097         * wtf/Platform.h:
1098
1099 2017-03-08  Anders Carlsson  <andersca@apple.com>
1100
1101         Simplify the PaymentCoordinator interface
1102         https://bugs.webkit.org/show_bug.cgi?id=169382
1103         Part of rdar://problem/28880714.
1104
1105         Reviewed by Tim Horton.
1106
1107         * wtf/EnumTraits.h:
1108         Fix a build warning.
1109
1110 2017-03-06  Andreas Kling  <akling@apple.com>
1111
1112         [iOS] Report domains crashing under memory pressure via enhanced privacy logging.
1113         <https://webkit.org/b/169133>
1114         <rdar://problem/29964017>
1115
1116         Reviewed by Antti Koivisto.
1117
1118         Add a mechanism for getting a callback when the memory pressure status changes.
1119
1120         * wtf/MemoryPressureHandler.cpp:
1121         (WTF::MemoryPressureHandler::measurementTimerFired):
1122         (WTF::MemoryPressureHandler::beginSimulatedMemoryPressure):
1123         (WTF::MemoryPressureHandler::endSimulatedMemoryPressure):
1124         (WTF::MemoryPressureHandler::setUnderMemoryPressure):
1125         (WTF::MemoryPressureHandler::memoryPressureStatusChanged):
1126         * wtf/MemoryPressureHandler.h:
1127         (WTF::MemoryPressureHandler::setMemoryPressureStatusChangedCallback):
1128         (WTF::MemoryPressureHandler::setUnderMemoryPressure): Deleted.
1129
1130 2017-03-03  Jer Noble  <jer.noble@apple.com>
1131
1132         [Win64] '__int128_t': undeclared identifier in MediaTime.cpp
1133         https://bugs.webkit.org/show_bug.cgi?id=169123
1134
1135         Reviewed by Alex Christensen.
1136
1137         Don't perform the 128-bit optimized path on Windows, where the __int128_t intrinsic isn't available.
1138
1139         * wtf/MediaTime.cpp:
1140         (WTF::MediaTime::setTimeScale):
1141
1142 2017-03-03  Keith Miller  <keith_miller@apple.com>
1143
1144         WASM should support faster loads.
1145         https://bugs.webkit.org/show_bug.cgi?id=162693
1146
1147         Reviewed by Saam Barati.
1148
1149         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:
1150
1151         dataLogIf(verbose, things, to, print);
1152
1153         instead of:
1154
1155         if (verbose)
1156             dataLog(things, to, print);
1157
1158         Also, add a operator! to Ref that has the same semantics as C++ refs.
1159
1160         * wtf/DataLog.h:
1161         (WTF::dataLogLn):
1162         (WTF::dataLogIf):
1163         (WTF::dataLogLnIf):
1164         * wtf/Ref.h:
1165         (WTF::Ref::operator!):
1166
1167 2017-03-02  Jer Noble  <jer.noble@apple.com>
1168
1169         Sufficently large timeValue and timeScale arguments to MediaTime will cause wrapping in toTimeScale().
1170         https://bugs.webkit.org/show_bug.cgi?id=169098
1171
1172         Reviewed by Keith Miller.
1173
1174         Use a non-standard but Clang & GCC supported __int128_t type extension to do the 128-bit math rather than
1175         rolling our own. Since this is only available in 64-bit builds, for 32-bit, just fix the underlying 128-bit
1176         math.
1177
1178         * wtf/MediaTime.cpp:
1179         (WTF::MediaTime::setTimeScale):
1180
1181 2017-03-01  Konstantin Tokarev  <annulen@yandex.ru>
1182
1183         Removed unused WTF_COMPILER_SUPPORTS_CXX_USER_LITERALS macro
1184         https://bugs.webkit.org/show_bug.cgi?id=168969
1185
1186         Reviewed by Darin Adler.
1187
1188         * wtf/Compiler.h:
1189
1190 2017-03-01  Tomas Popela  <tpopela@redhat.com>
1191
1192         [WTF] va_list is not ended in StringPrintStream
1193         https://bugs.webkit.org/show_bug.cgi?id=169035
1194
1195         Reviewed by Michael Saboff.
1196
1197         Also fix whitespace errors while touching this file.
1198
1199         * wtf/StringPrintStream.cpp:
1200         (WTF::StringPrintStream::vprintf):
1201         (WTF::StringPrintStream::increaseSize):
1202
1203 2017-03-01  Andreas Kling  <akling@apple.com>
1204
1205         Move MemoryPressureHandler to WTF
1206         <https://webkit.org/b/168908>
1207
1208         Reviewed by Sam Weinig.
1209
1210         Move MemoryPressureHandler down to WTF so it can be used from JavaScriptCore.
1211
1212         I had to do a blind rewrite of the Windows memory checking timer since it can
1213         no longer use WebCore::Timer. I also moved the Win32Handle helper class to WTF.
1214
1215         * WTF.xcodeproj/project.pbxproj:
1216         * wtf/CMakeLists.txt:
1217         * wtf/MemoryPressureHandler.cpp: Renamed from Source/WebCore/platform/MemoryPressureHandler.cpp.
1218         (WTF::MemoryPressureHandler::singleton):
1219         (WTF::MemoryPressureHandler::MemoryPressureHandler):
1220         (WTF::MemoryPressureHandler::setShouldUsePeriodicMemoryMonitor):
1221         (WTF::toString):
1222         (WTF::thresholdForPolicy):
1223         (WTF::policyForFootprint):
1224         (WTF::MemoryPressureHandler::measurementTimerFired):
1225         (WTF::MemoryPressureHandler::beginSimulatedMemoryPressure):
1226         (WTF::MemoryPressureHandler::endSimulatedMemoryPressure):
1227         (WTF::MemoryPressureHandler::releaseMemory):
1228         (WTF::MemoryPressureHandler::ReliefLogger::logMemoryUsageChange):
1229         (WTF::MemoryPressureHandler::install):
1230         (WTF::MemoryPressureHandler::uninstall):
1231         (WTF::MemoryPressureHandler::holdOff):
1232         (WTF::MemoryPressureHandler::respondToMemoryPressure):
1233         (WTF::MemoryPressureHandler::platformReleaseMemory):
1234         (WTF::MemoryPressureHandler::ReliefLogger::platformMemoryUsage):
1235         (WTF::MemoryPressureHandler::platformInitialize):
1236         * wtf/MemoryPressureHandler.h: Renamed from Source/WebCore/platform/MemoryPressureHandler.h.
1237         (WTF::MemoryPressureHandler::setMemoryKillCallback):
1238         (WTF::MemoryPressureHandler::setProcessIsEligibleForMemoryKillCallback):
1239         (WTF::MemoryPressureHandler::setLowMemoryHandler):
1240         (WTF::MemoryPressureHandler::isUnderMemoryPressure):
1241         (WTF::MemoryPressureHandler::setUnderMemoryPressure):
1242         (WTF::MemoryPressureHandler::ReliefLogger::ReliefLogger):
1243         (WTF::MemoryPressureHandler::ReliefLogger::~ReliefLogger):
1244         (WTF::MemoryPressureHandler::ReliefLogger::logString):
1245         (WTF::MemoryPressureHandler::ReliefLogger::setLoggingEnabled):
1246         (WTF::MemoryPressureHandler::ReliefLogger::loggingEnabled):
1247         (WTF::MemoryPressureHandler::ReliefLogger::MemoryUsage::MemoryUsage):
1248         * wtf/PlatformEfl.cmake:
1249         * wtf/PlatformGTK.cmake:
1250         * wtf/PlatformMac.cmake:
1251         * wtf/PlatformWin.cmake:
1252         * wtf/cocoa/MemoryPressureHandlerCocoa.mm: Renamed from Source/WebCore/platform/cocoa/MemoryPressureHandlerCocoa.mm.
1253         (WTF::MemoryPressureHandler::platformReleaseMemory):
1254         (WTF::MemoryPressureHandler::install):
1255         (WTF::MemoryPressureHandler::uninstall):
1256         (WTF::MemoryPressureHandler::holdOff):
1257         (WTF::MemoryPressureHandler::respondToMemoryPressure):
1258         (WTF::MemoryPressureHandler::ReliefLogger::platformMemoryUsage):
1259         * wtf/linux/CurrentProcessMemoryStatus.cpp: Renamed from Source/WebCore/platform/linux/CurrentProcessMemoryStatus.cpp.
1260         (WTF::systemPageSize):
1261         (WTF::currentProcessMemoryStatus):
1262         * wtf/linux/CurrentProcessMemoryStatus.h: Renamed from Source/WebCore/platform/linux/CurrentProcessMemoryStatus.h.
1263         * wtf/linux/MemoryPressureHandlerLinux.cpp: Renamed from Source/WebCore/platform/linux/MemoryPressureHandlerLinux.cpp.
1264         (WTF::MemoryPressureHandler::EventFDPoller::EventFDPoller):
1265         * wtf/win/MemoryPressureHandlerWin.cpp: Renamed from Source/WebCore/platform/win/MemoryPressureHandlerWin.cpp.
1266         (WTF::MemoryPressureHandler::platformInitialize):
1267         (WTF::MemoryPressureHandler::windowsMeasurementTimerFired):
1268         (WTF::MemoryPressureHandler::platformReleaseMemory):
1269         (WTF::MemoryPressureHandler::install):
1270         (WTF::MemoryPressureHandler::uninstall):
1271         (WTF::MemoryPressureHandler::holdOff):
1272         (WTF::MemoryPressureHandler::respondToMemoryPressure):
1273         (WTF::MemoryPressureHandler::ReliefLogger::platformMemoryUsage):
1274         * wtf/win/Win32Handle.h: Renamed from Source/WebCore/platform/win/Win32Handle.h.
1275         (WTF::Win32Handle::Win32Handle):
1276         (WTF::Win32Handle::~Win32Handle):
1277         (WTF::Win32Handle::clear):
1278         (WTF::Win32Handle::isValid):
1279         (WTF::Win32Handle::get):
1280         (WTF::Win32Handle::release):
1281         (WTF::Win32Handle::operator=):
1282
1283 2017-02-28  Chris Dumez  <cdumez@apple.com>
1284
1285         [iOS] Throttle requestAnimationFrame to 30fps in low power mode
1286         https://bugs.webkit.org/show_bug.cgi?id=168837
1287         <rdar://problem/30700929>
1288
1289         Reviewed by Simon Fraser.
1290
1291         Add support for operator -= on WTF::OptionSet for convenience:
1292             set -= Enum::A;
1293         looks much better than:
1294             set = set - Enum::A;
1295
1296         * wtf/OptionSet.h:
1297         (WTF::OptionSet::operator-=):
1298
1299 2017-02-28  Michael Saboff  <msaboff@apple.com>
1300
1301         Add ability to configure JSC options from a file
1302         https://bugs.webkit.org/show_bug.cgi?id=168914
1303
1304         Reviewed by Filip Pizlo.
1305
1306         Added the ability to set options and DataLog file location via a configuration file.
1307         The pathname can include the printf style "%pid", which will be replaced with the
1308         current process id.
1309
1310         * wtf/DataLog.cpp:
1311         (WTF::initializeLogFileOnce):
1312         (WTF::setDataFile):
1313         * wtf/DataLog.h:
1314
1315 2017-02-27  Andy Estes  <aestes@apple.com>
1316
1317         [iOS] Enable file replacement
1318         https://bugs.webkit.org/show_bug.cgi?id=168907
1319         <rdar://problem/22258242>
1320
1321         Reviewed by David Kilzer.
1322
1323         * wtf/FeatureDefines.h: Set ENABLE_FILE_REPLACEMENT to 1 on all Cocoa platforms.
1324
1325 2017-02-27  Myles C. Maxfield  <mmaxfield@apple.com>
1326
1327         Rename ICU cursor iterator to caret iterator
1328         https://bugs.webkit.org/show_bug.cgi?id=168206
1329
1330         Reviewed by Simon Fraser.
1331
1332         * wtf/text/TextBreakIterator.cpp:
1333         (WTF::mapModeToBackingIterator):
1334         * wtf/text/TextBreakIterator.h:
1335         * wtf/text/cf/TextBreakIteratorCF.h:
1336         (WTF::TextBreakIteratorCF::TextBreakIteratorCF):
1337         * wtf/text/icu/TextBreakIteratorICU.h:
1338         (WTF::caretRules):
1339         (WTF::TextBreakIteratorICU::TextBreakIteratorICU):
1340         (WTF::cursorRules): Deleted.
1341         * wtf/text/mac/TextBreakIteratorInternalICUMac.mm:
1342         (WTF::mapModeToBackingIterator):
1343
1344 2017-02-27  Myles C. Maxfield  <mmaxfield@apple.com>
1345
1346         Use RAII for ICU breaking iterators
1347         https://bugs.webkit.org/show_bug.cgi?id=168203
1348
1349         Reviewed by Simon Fraser.
1350
1351         * wtf/text/TextBreakIterator.h:
1352         (WTF::CachedTextBreakIterator::CachedTextBreakIterator):
1353         (WTF::CachedTextBreakIterator::~CachedTextBreakIterator):
1354         (WTF::CachedTextBreakIterator::preceding):
1355         (WTF::CachedTextBreakIterator::following):
1356         (WTF::CachedTextBreakIterator::isBoundary):
1357
1358 2017-02-24  Jer Noble  <jer.noble@apple.com>
1359
1360         Add public method to MediaTime for doing timeScale conversion.
1361         https://bugs.webkit.org/show_bug.cgi?id=168860
1362
1363         Reviewed by Eric Carlson.
1364
1365         The newly public method, modeled on CMTimeConvertScale, allows callers to specify what rounding technique
1366         will be used when converting to a new time scale.
1367
1368         * wtf/MediaTime.cpp:
1369         (WTF::MediaTime::toTimeScale):
1370         (WTF::MediaTime::setTimeScale):
1371         * wtf/MediaTime.h:
1372
1373 2017-02-26  Myles C. Maxfield  <mmaxfield@apple.com>
1374
1375         Stop compiling our own cursorMovementIterator()
1376         https://bugs.webkit.org/show_bug.cgi?id=168211
1377
1378         Reviewed by David Hyatt.
1379
1380         This patch creates a unified Text Breaking API, which can be backed by either ICU
1381         or CoreFoundation (for ports which can use it). Rather than using inheritance and
1382         virtual functions to implement this, because there are only two subclasses, the
1383         simpler option of just using a Variant is used instead. There is also a cache which
1384         allows you to reuse iterators without reconstructing them. This cache is better
1385         than the previous method of having a single static iterator because the cache
1386         lets you use two iterators simultaneously.
1387
1388         In the future, I will hook up all iterators to use this shared class. However, for
1389         this patch, I've only hooked up the caret position iterator (backed by CoreFoundation
1390         on Cocoa ports and UBRK_CHARACTER on other ports). 
1391
1392         * WTF.xcodeproj/project.pbxproj:
1393         * wtf/spi/cf/CFStringSPI.h: Added.
1394         * wtf/text/TextBreakIterator.cpp:
1395         (WTF::initializeIteratorWithRules): Deleted.
1396         (WTF::cursorMovementIterator): Deleted.
1397         * wtf/text/TextBreakIterator.h:
1398         (WTF::TextBreakIterator::preceding):
1399         (WTF::TextBreakIterator::following):
1400         (WTF::TextBreakIterator::isBoundary):
1401         (WTF::TextBreakIterator::setText):
1402         (WTF::TextBreakIterator::mode):
1403         (WTF::TextBreakIterator::locale):
1404         (WTF::TextBreakIteratorCache::singleton):
1405         (WTF::TextBreakIteratorCache::take):
1406         (WTF::TextBreakIteratorCache::put):
1407         (WTF::TextBreakIteratorCache::TextBreakIteratorCache):
1408         * wtf/text/cf/TextBreakIteratorCF.h: Added.
1409         (WTF::TextBreakIteratorCF::TextBreakIteratorCF):
1410         (WTF::TextBreakIteratorCF::setText):
1411         (WTF::TextBreakIteratorCF::preceding):
1412         (WTF::TextBreakIteratorCF::following):
1413         (WTF::TextBreakIteratorCF::isBoundary):
1414         * wtf/text/icu/TextBreakIteratorICU.h: Added.
1415         (WTF::TextBreakIteratorICU::set8BitText):
1416         (WTF::TextBreakIteratorICU::TextBreakIteratorICU):
1417         (WTF::TextBreakIteratorICU::operator=):
1418         (WTF::TextBreakIteratorICU::~TextBreakIteratorICU):
1419         (WTF::TextBreakIteratorICU::setText):
1420         (WTF::TextBreakIteratorICU::preceding):
1421         (WTF::TextBreakIteratorICU::following):
1422         (WTF::TextBreakIteratorICU::isBoundary):
1423         * wtf/text/icu/UTextProviderLatin1.h:
1424         * wtf/text/mac/TextBreakIteratorInternalICUMac.mm:
1425         (WTF::mapModeToBackingIterator):
1426         (WTF::TextBreakIterator::TextBreakIterator):
1427
1428 2017-02-24  Joseph Pecoraro  <pecoraro@apple.com>
1429
1430         [Resource Timing] Gather timing information with reliable responseEnd time
1431         https://bugs.webkit.org/show_bug.cgi?id=168351
1432
1433         Reviewed by Alex Christensen.
1434
1435         * wtf/persistence/Coders.h:
1436         (WTF::Persistence::Coder<Seconds>::encode):
1437         (WTF::Persistence::Coder<Seconds>::decode):
1438
1439 2017-02-24  Keith Miller  <keith_miller@apple.com>
1440
1441         Rubber-stamped by Chris Dumez.
1442
1443         Replace typename Bool with typename BoolType because X11 has
1444         #define Bool int for some unknown reason...
1445
1446         * wtf/HashFunctions.h:
1447         (WTF::TupleHash::allTrue):
1448         * wtf/HashTraits.h:
1449         (WTF::TupleHashTraits::allTrue):
1450
1451 2017-02-24  Chris Dumez  <cdumez@apple.com>
1452
1453         Unreviewed, rolling out r212944.
1454
1455         Caused a lot of failures on the debug bots
1456
1457         Reverted changeset:
1458
1459         "[Resource Timing] Gather timing information with reliable
1460         responseEnd time"
1461         https://bugs.webkit.org/show_bug.cgi?id=168351
1462         http://trac.webkit.org/changeset/212944
1463
1464 2017-02-24  Keith Miller  <keith_miller@apple.com>
1465
1466         We should be able to use std::tuples as keys in HashMap
1467         https://bugs.webkit.org/show_bug.cgi?id=168805
1468
1469         Reviewed by Filip Pizlo.
1470
1471         This patch adds support for using std::tupeles as the key
1472         type in HashMap. It is equivalent to doing a sequence of
1473         std::pairs but has a nicer syntax.
1474
1475         * wtf/HashFunctions.h:
1476         (WTF::TupleHash::hash):
1477         (WTF::TupleHash::equal):
1478         (WTF::TupleHash::allTrue):
1479         * wtf/HashTraits.h:
1480         (WTF::TupleHashTraits::allTrue):
1481         (WTF::TupleHashTraits::emptyValue):
1482         (WTF::TupleHashTraits::constructDeletedValue):
1483         (WTF::TupleHashTraits::isDeletedValue):
1484
1485 2017-02-24  Alex Christensen  <achristensen@webkit.org>
1486
1487         Prepare to enable WebRTC on iOS
1488         https://bugs.webkit.org/show_bug.cgi?id=168811
1489
1490         Reviewed by Youenn Fablet.
1491
1492         * wtf/Platform.h:
1493
1494 2017-02-23  Joseph Pecoraro  <pecoraro@apple.com>
1495
1496         [Resource Timing] Gather timing information with reliable responseEnd time
1497         https://bugs.webkit.org/show_bug.cgi?id=168351
1498
1499         Reviewed by Alex Christensen.
1500
1501         * wtf/persistence/Coders.h:
1502         (WTF::Persistence::Coder<Seconds>::encode):
1503         (WTF::Persistence::Coder<Seconds>::decode):
1504
1505 2017-02-22  Carlos Garcia Campos  <cgarcia@igalia.com>
1506
1507         Better handle Thread and RunLoop initialization
1508         https://bugs.webkit.org/show_bug.cgi?id=167828
1509
1510         Reviewed by Yusuke Suzuki.
1511
1512         Make initialization functions more independent so that they can run in different
1513         order. WTF::initializeMainThread initializes WTF threading, so that neither WTF nor JSC theading need to be
1514         initialized before. RunLoop::initializeMainRunLoop() requires main thread to be initialized in some
1515         ports, so it initializes main thread too. WebKit1 always calls WTF::initializeMainThreadToProcessMainThread()
1516         before RunLoop::initializeMainRunLoop() so there's no problem there. GC threads are initialized alwayas by the
1517         main thread. The rules should be simpler now:
1518
1519           - JSC::initializeThreading: should always be called when JSC is used.
1520           - WTF::initializeThreading: only needs to be explicitly called when JSC is not used and process doesn't
1521             initialize a main thread or main run loop.
1522           - WTF::initializeMainThread: only needs to be explicitly called if process initializes a main thread but not a
1523             main run loop.
1524           - WTF::initializeMainThreadToProcessMainThread(): should always be called in WebKit1 before
1525             RunLoop::initializeMainRunLoop().
1526           - RunLoop::initializeMainRunLoop(): to initialize the main run loop. The only requirement is JSC::initializeThreading()
1527             to be called before if JSC is used.
1528
1529         * wtf/MainThread.cpp:
1530         (WTF::initializeMainThreadOnce): Use pthread_once to initialize the main thread also in GTK+ port.
1531         (WTF::initializeMainThreadToProcessMainThreadOnce): Call initializeThreading() before the platform
1532         initialization and initializeGCThreads() after it.
1533         (WTF::initializeMainThread): Ditto.
1534         * wtf/RunLoop.cpp:
1535         (WTF::RunLoop::initializeMainRunLoop): Call initializeMainThread().
1536         * wtf/glib/MainThreadGLib.cpp:
1537         (WTF::initializeMainThreadPlatform):
1538         (WTF::isMainThread):
1539         * wtf/mac/MainThreadMac.mm:
1540         (WTF::initializeMainThreadPlatform): Remove call to initializeGCThreads().
1541         (WTF::initializeMainThreadToProcessMainThreadPlatform): Ditto.
1542
1543 2017-02-22  Myles C. Maxfield  <mmaxfield@apple.com>
1544
1545         [Cocoa] Remove Yosemite-specific font lookup code
1546         https://bugs.webkit.org/show_bug.cgi?id=168682
1547
1548         Reviewed by Zalan Bujtas.
1549
1550         * wtf/Platform.h:
1551
1552 2017-02-22  Keith Miller  <keith_miller@apple.com>
1553
1554         Remove the demand executable allocator
1555         https://bugs.webkit.org/show_bug.cgi?id=168754
1556
1557         Reviewed by Saam Barati.
1558
1559         * wtf/Platform.h:
1560
1561 2017-02-22  Alex Christensen  <achristensen@webkit.org>
1562
1563         Re-commit part of r212812 accidentally rolled out with r212841.
1564         https://bugs.webkit.org/show_bug.cgi?id=167293
1565
1566         * wtf/Platform.h:
1567         Use libwebrtc on Mac if webrtc is enabled.
1568
1569 2017-02-22  Alex Christensen  <achristensen@webkit.org>
1570
1571         Fix ASAN build after activating libwebrtc.
1572
1573         * wtf/Ref.h:
1574         __asan_address_is_poisoned returns an int, not a bool.
1575         This didn't cause a problem before because we didn't include the real definition anywhere,
1576         but libwebrtc includes <sanitizer/asan_interface.h> directly now so the return types need to be correct.
1577
1578 2017-02-22  Carlos Garcia Campos  <cgarcia@igalia.com>
1579
1580         [GTK] Test fast/events/message-port-postMessage-recursive.html times out
1581         https://bugs.webkit.org/show_bug.cgi?id=168570
1582
1583         Reviewed by Michael Catanzaro.
1584
1585         This has recently been added and the patch is good. It's just revealing a problem with our timers. The test is
1586         posting a message recursively, and also starts a timeout timer to finish the test. The timeout timer is never
1587         fired for us, because WebCore timers have lower priority than the one used by postMessage. ScriptExecutionContext
1588         uses Document::postTask, that uses scheduleOnMainThread, that uses RunLoop::dispatch(). We are not setting any
1589         priority for the timer used by RunLoop::dispatch, so it's using the default.
1590         Use a RunLoop::Timer to schedule tasks to the main thread instead of using RunLoop::dispatch(). This allows us
1591         to use a different priority, that is now set to G_PRIORITY_HIGH_IDLE + 20 to match WebCore timers. But it also
1592         avoids the double queue we had with RunLoop::dispatch(), because scheduleOnMainThread() also queues the tasks.
1593
1594         * wtf/glib/MainThreadGLib.cpp:
1595         (WTF::MainThreadDispatcher::MainThreadDispatcher):
1596         (WTF::MainThreadDispatcher::schedule):
1597         (WTF::MainThreadDispatcher::fired):
1598         (WTF::scheduleDispatchFunctionsOnMainThread):
1599
1600 2017-02-21  Youenn Fablet  <youenn@apple.com>
1601
1602         [WebRTC][Mac] Activate libwebrtc
1603         https://bugs.webkit.org/show_bug.cgi?id=167293
1604
1605         Reviewed by Alex Christensen.
1606
1607         * wtf/Platform.h:
1608
1609 2017-02-20  Filip Pizlo  <fpizlo@apple.com>
1610
1611         The collector thread should only start when the mutator doesn't have heap access
1612         https://bugs.webkit.org/show_bug.cgi?id=167737
1613
1614         Reviewed by Keith Miller.
1615         
1616         Extend the use of AbstractLocker so that we can use more locking idioms.
1617
1618         * wtf/AutomaticThread.cpp:
1619         (WTF::AutomaticThreadCondition::notifyOne):
1620         (WTF::AutomaticThreadCondition::notifyAll):
1621         (WTF::AutomaticThreadCondition::add):
1622         (WTF::AutomaticThreadCondition::remove):
1623         (WTF::AutomaticThreadCondition::contains):
1624         (WTF::AutomaticThread::AutomaticThread):
1625         (WTF::AutomaticThread::tryStop):
1626         (WTF::AutomaticThread::isWaiting):
1627         (WTF::AutomaticThread::notify):
1628         (WTF::AutomaticThread::start):
1629         (WTF::AutomaticThread::threadIsStopping):
1630         * wtf/AutomaticThread.h:
1631         * wtf/NumberOfCores.cpp:
1632         (WTF::numberOfProcessorCores):
1633         * wtf/ParallelHelperPool.cpp:
1634         (WTF::ParallelHelperClient::finish):
1635         (WTF::ParallelHelperClient::claimTask):
1636         (WTF::ParallelHelperPool::Thread::Thread):
1637         (WTF::ParallelHelperPool::didMakeWorkAvailable):
1638         (WTF::ParallelHelperPool::hasClientWithTask):
1639         (WTF::ParallelHelperPool::getClientWithTask):
1640         * wtf/ParallelHelperPool.h:
1641
1642 2017-02-21  Alex Christensen  <achristensen@webkit.org>
1643
1644         Unreviewed, rolling out r212699.
1645
1646         Internal build not ready
1647
1648         Reverted changeset:
1649
1650         "[WebRTC][Mac] Activate libwebrtc"
1651         https://bugs.webkit.org/show_bug.cgi?id=167293
1652         http://trac.webkit.org/changeset/212699
1653
1654 2017-02-20  Youenn Fablet  <youenn@apple.com>
1655
1656         [WebRTC][Mac] Activate libwebrtc
1657         https://bugs.webkit.org/show_bug.cgi?id=167293
1658
1659         Reviewed by Alex Christensen.
1660
1661         * wtf/Platform.h:
1662
1663 2017-02-20  Mark Lam  <mark.lam@apple.com>
1664
1665         [Re-landing] CachedCall should let GC know to keep its arguments alive.
1666         https://bugs.webkit.org/show_bug.cgi?id=168567
1667         <rdar://problem/30475767>
1668
1669         Reviewed by Saam Barati.
1670
1671         Added a WTF_FORBID_HEAP_ALLOCATION that will cause a compilation failure if
1672         a class declared with it is malloced.
1673
1674         While this doesn't prevent that class declared WTF_FORBID_HEAP_ALLOCATION from
1675         being embedded in another class that is heap allocated, it does at minimum
1676         document the intent and gives the users of this class a chance to do the
1677         right thing.
1678
1679         * WTF.xcodeproj/project.pbxproj:
1680         * wtf/ForbidHeapAllocation.h: Added.
1681
1682 2017-02-20  Ryan Haddad  <ryanhaddad@apple.com>
1683
1684         Unreviewed, rolling out r212685.
1685
1686         This change broke the 32-bit Sierra build.
1687
1688         Reverted changeset:
1689
1690         "Resource Load Statistics: Add alternate classification
1691         method"
1692         https://bugs.webkit.org/show_bug.cgi?id=168347
1693         http://trac.webkit.org/changeset/212685
1694
1695 2017-02-20  John Wilander  <wilander@apple.com>
1696
1697         Resource Load Statistics: Add alternate classification method
1698         https://bugs.webkit.org/show_bug.cgi?id=168347
1699         <rdar://problem/30352793>
1700
1701         Reviewed by Alex Christensen.
1702
1703         * wtf/Platform.h:
1704             Added support for HAVE(CORE_PREDICTION).
1705
1706 2017-02-20  Commit Queue  <commit-queue@webkit.org>
1707
1708         Unreviewed, rolling out r212618.
1709         https://bugs.webkit.org/show_bug.cgi?id=168609
1710
1711         "Appears to cause PLT regression" (Requested by mlam on
1712         #webkit).
1713
1714         Reverted changeset:
1715
1716         "CachedCall should let GC know to keep its arguments alive."
1717         https://bugs.webkit.org/show_bug.cgi?id=168567
1718         http://trac.webkit.org/changeset/212618
1719
1720 2017-02-20  Carlos Garcia Campos  <cgarcia@igalia.com>
1721
1722         Unreviewed, rolling out r212622.
1723
1724         Caused several test failures
1725
1726         Reverted changeset:
1727
1728         "[GTK] Test fast/events/message-port-postMessage-
1729         recursive.html times out"
1730         https://bugs.webkit.org/show_bug.cgi?id=168570
1731         http://trac.webkit.org/changeset/212622
1732
1733 2017-02-19  Carlos Garcia Campos  <cgarcia@igalia.com>
1734
1735         [GTK] Test fast/events/message-port-postMessage-recursive.html times out
1736         https://bugs.webkit.org/show_bug.cgi?id=168570
1737
1738         Reviewed by Michael Catanzaro.
1739
1740         This has recently been added and the patch is good. It's just revealing a problem with our timers. The test is
1741         posting a message recursively, and also starts a timeout timer to finish the test. The timeout timer is never
1742         fired for us, because WebCore timers have lower priority than the one used by
1743         postMessage. ScriptExecutionContext uses Document::postTask, that uses scheduleOnMainThread, that uses
1744         RunLoop::dispatch(). We are not setting any priority for the timer used by RunLoop::dispatch, so it's using the
1745         default. RunLoop::dispatch is normally used to schedule tasks between threads, or just to ensure something is
1746         run in a different run loop iteration, but in general nothing urgent as a graphics redraw or something like
1747         that. It's quite common to use g_idle_add to schedule tasks between threads, so I think it makes sense to use
1748         G_PRIORITY_DEFAULT_IDLE for the RunLoop timer.
1749
1750         * wtf/glib/RunLoopGLib.cpp:
1751         (WTF::RunLoop::RunLoop):
1752
1753 2017-02-19  Mark Lam  <mark.lam@apple.com>
1754
1755         CachedCall should let GC know to keep its arguments alive.
1756         https://bugs.webkit.org/show_bug.cgi?id=168567
1757         <rdar://problem/30475767>
1758
1759         Reviewed by Saam Barati.
1760
1761         Added a WTF_FORBID_HEAP_ALLOCATION that will cause a compilation failure if
1762         a class declared with it is malloced.
1763
1764         While this doesn't prevent that class declared WTF_FORBID_HEAP_ALLOCATION from
1765         being embedded in another class that is heap allocated, it does at minimum
1766         document the intent and gives the users of this class a chance to do the
1767         right thing.
1768
1769         * WTF.xcodeproj/project.pbxproj:
1770         * wtf/ForbidHeapAllocation.h: Added.
1771
1772 2017-02-19  Commit Queue  <commit-queue@webkit.org>
1773
1774         Unreviewed, rolling out r212466.
1775         https://bugs.webkit.org/show_bug.cgi?id=168577
1776
1777         causes crashes on AArch64 on linux, maybe it's causing crashes
1778         on iOS too (Requested by pizlo on #webkit).
1779
1780         Reverted changeset:
1781
1782         "The collector thread should only start when the mutator
1783         doesn't have heap access"
1784         https://bugs.webkit.org/show_bug.cgi?id=167737
1785         http://trac.webkit.org/changeset/212466
1786
1787 2017-02-18  Chris Dumez  <cdumez@apple.com>
1788
1789         Recursive MessagePort.postMessage() calls causes tab to become unresponsive
1790         https://bugs.webkit.org/show_bug.cgi?id=168548
1791         <rdar://problem/29808005>
1792
1793         Reviewed by Darin Adler.
1794
1795         Add API to retrieve all messages in the queue at once.
1796
1797         * wtf/MessageQueue.h:
1798
1799 2017-02-16  Alex Christensen  <achristensen@webkit.org>
1800
1801         Remove EFL-specific files in Source.
1802
1803         Rubber-stamped by Anders Carlsson.
1804
1805         * wtf/text/efl: Removed.
1806         * wtf/text/efl/TextBreakIteratorInternalICUEfl.cpp: Removed.
1807
1808 2017-02-10  Filip Pizlo  <fpizlo@apple.com>
1809
1810         The collector thread should only start when the mutator doesn't have heap access
1811         https://bugs.webkit.org/show_bug.cgi?id=167737
1812
1813         Reviewed by Keith Miller.
1814         
1815         Extend the use of AbstractLocker so that we can use more locking idioms.
1816
1817         * wtf/AutomaticThread.cpp:
1818         (WTF::AutomaticThreadCondition::notifyOne):
1819         (WTF::AutomaticThreadCondition::notifyAll):
1820         (WTF::AutomaticThreadCondition::add):
1821         (WTF::AutomaticThreadCondition::remove):
1822         (WTF::AutomaticThreadCondition::contains):
1823         (WTF::AutomaticThread::AutomaticThread):
1824         (WTF::AutomaticThread::tryStop):
1825         (WTF::AutomaticThread::isWaiting):
1826         (WTF::AutomaticThread::notify):
1827         (WTF::AutomaticThread::start):
1828         (WTF::AutomaticThread::threadIsStopping):
1829         * wtf/AutomaticThread.h:
1830         * wtf/NumberOfCores.cpp:
1831         (WTF::numberOfProcessorCores): Allow this to be overridden for testing.
1832         * wtf/ParallelHelperPool.cpp:
1833         (WTF::ParallelHelperClient::finish):
1834         (WTF::ParallelHelperClient::claimTask):
1835         (WTF::ParallelHelperPool::Thread::Thread):
1836         (WTF::ParallelHelperPool::didMakeWorkAvailable):
1837         (WTF::ParallelHelperPool::hasClientWithTask):
1838         (WTF::ParallelHelperPool::getClientWithTask):
1839         * wtf/ParallelHelperPool.h:
1840
1841 2017-02-16  Anders Carlsson  <andersca@apple.com>
1842
1843         Remove EFL from WTF
1844         https://bugs.webkit.org/show_bug.cgi?id=168452
1845
1846         Reviewed by Alex Christensen.
1847
1848         * wtf/CurrentTime.cpp:
1849         * wtf/DisallowCType.h:
1850         * wtf/FeatureDefines.h:
1851         * wtf/MainThread.cpp:
1852         * wtf/MainThread.h:
1853         * wtf/Platform.h:
1854         * wtf/RunLoop.h:
1855         * wtf/WorkQueue.h:
1856         * wtf/efl/DispatchQueueEfl.cpp: Removed.
1857         * wtf/efl/DispatchQueueEfl.h: Removed.
1858         * wtf/efl/DispatchQueueWorkItemEfl.h: Removed.
1859         * wtf/efl/EflTypedefs.h: Removed.
1860         * wtf/efl/MainThreadEfl.cpp: Removed.
1861         * wtf/efl/RunLoopEfl.cpp: Removed.
1862         * wtf/efl/UniquePtrEfl.h: Removed.
1863         * wtf/efl/WorkQueueEfl.cpp: Removed.
1864
1865 2017-02-13  Alex Christensen  <achristensen@webkit.org>
1866
1867         URLs with an invalid IPv4 address should be invalid
1868         https://bugs.webkit.org/show_bug.cgi?id=168260
1869
1870         Reviewed by Tim Horton.
1871
1872         * wtf/Expected.h:
1873         (WTF::Expected::value):
1874         Added missing WTFMove for rvalue Expected::value().
1875
1876 2017-02-13  Said Abou-Hallawa  <sabouhallawa@apple.com>
1877
1878         The current frame of an image should not deleted if another frame is asynchronously being decoded
1879         https://bugs.webkit.org/show_bug.cgi?id=167618
1880
1881         Reviewed by Simon Fraser.
1882
1883         Add ASSERT_IMPLIES() which should fire when a condition is true but the
1884         assertion is false.
1885
1886         * wtf/Assertions.h:
1887
1888 2017-02-13  Brady Eidson  <beidson@apple.com>
1889
1890         Followup to: Replace all WebKit Library Version checks in WK2 with SDK version checks.
1891         https://bugs.webkit.org/show_bug.cgi?id=168124
1892
1893         Reviewed by Geoffrey Garen.
1894
1895         * wtf/spi/darwin/dyldSPI.h:
1896
1897 2017-02-13  Myles C. Maxfield  <mmaxfield@apple.com>
1898
1899         Update custom line breaking iterators to the latest version of Unicode
1900         https://bugs.webkit.org/show_bug.cgi?id=168182
1901
1902         Reviewed by Zalan Bujtas.
1903
1904         ICU 55.1 supports loose / normal / strict line breaking rules. The oldest platform we ship
1905         on has a version of ICU >= that one. Therefore, we don't need to compile our own rules;
1906         we can just use ICU's rules.
1907
1908         * wtf/text/LineBreakIteratorPoolICU.h:
1909         (WTF::LineBreakIteratorPool::makeLocaleWithBreakKeyword):
1910         (WTF::LineBreakIteratorPool::take):
1911         * wtf/text/TextBreakIterator.cpp:
1912         (WTF::acquireLineBreakIterator):
1913         (WTF::openLineBreakIterator):
1914         (WTF::mapLineIteratorModeToRules): Deleted.
1915         (WTF::isCJKLocale): Deleted.
1916         * wtf/text/TextBreakIterator.h:
1917         (WTF::LazyLineBreakIterator::LazyLineBreakIterator):
1918         (WTF::LazyLineBreakIterator::mode):
1919         (WTF::LazyLineBreakIterator::get):
1920         (WTF::LazyLineBreakIterator::resetStringAndReleaseIterator):
1921         (WTF::LazyLineBreakIterator::isLooseCJKMode): Deleted.
1922
1923 2017-02-10  Dan Bernstein  <mitz@apple.com>
1924
1925         [Xcode] WTF installs extra copies of two headers outside /usr/local/include/wtf
1926         https://bugs.webkit.org/show_bug.cgi?id=168160
1927
1928         Reviewed by Sam Weinig.
1929
1930         * WTF.xcodeproj/project.pbxproj: Demoted OrdinalNumber.h MemoryFootprint.h from Private to
1931           Project.
1932
1933 2017-02-10  Commit Queue  <commit-queue@webkit.org>
1934
1935         Unreviewed, rolling out r212139.
1936         https://bugs.webkit.org/show_bug.cgi?id=168152
1937
1938         Caused some assertions (Requested by JoePeck on #webkit).
1939
1940         Reverted changeset:
1941
1942         "Fix misleading comment in RunLoop.h"
1943         https://bugs.webkit.org/show_bug.cgi?id=167832
1944         http://trac.webkit.org/changeset/212139
1945
1946 2017-02-10  Joseph Pecoraro  <pecoraro@apple.com>
1947
1948         Fix misleading comment in RunLoop.h
1949         https://bugs.webkit.org/show_bug.cgi?id=167832
1950
1951         Reviewed by Sam Weinig.
1952
1953         * wtf/RunLoop.h:
1954         Mac initialization used to force using CFRunLoopGetMain(). Now however it just
1955         uses RunLoop::current which uses CFRunLoopGetCurrent(). So this comment that
1956         it can be done on any thread is misleading and can lead to incorrect behavior
1957         if it is actually done on a non-main thread on Mac.
1958
1959 2017-02-09  Alex Christensen  <achristensen@webkit.org>
1960
1961         Unreviewed, rolling out r212040.
1962
1963         Broke build.  I'm not surprised
1964
1965         Reverted changeset:
1966
1967         "[WebRTC][Mac] Activate libwebrtc"
1968         https://bugs.webkit.org/show_bug.cgi?id=167293
1969         http://trac.webkit.org/changeset/212040
1970
1971 2017-02-09  Youenn Fablet  <youenn@apple.com>
1972
1973         [WebRTC][Mac] Activate libwebrtc
1974         https://bugs.webkit.org/show_bug.cgi?id=167293
1975
1976         Reviewed by Alex Christensen.
1977
1978         * wtf/Platform.h:
1979
1980 2017-02-09  Brady Eidson  <beidson@apple.com>
1981
1982         Transition "WebKit Library Version" checks to SDK version checks.
1983         <rdar://problem/30313696> and https://bugs.webkit.org/show_bug.cgi?id=168056
1984
1985         Reviewed by Geoffrey Garen.
1986
1987         * wtf/spi/darwin/dyldSPI.h: Add entries for the iOS 10.3, macOS 10.11, and macOS 10.12.4 SDKs.
1988
1989 2017-02-09  Commit Queue  <commit-queue@webkit.org>
1990
1991         Unreviewed, rolling out r211980 and r211987.
1992         https://bugs.webkit.org/show_bug.cgi?id=168072
1993
1994         Caused API test WebKit2.DuplicateCompletionHandlerCalls to
1995         fail (Requested by ryanhaddad on #webkit).
1996
1997         Reverted changesets:
1998
1999         "Transition "WebKit Library Version" checks to SDK version
2000         checks."
2001         https://bugs.webkit.org/show_bug.cgi?id=168056
2002         http://trac.webkit.org/changeset/211980
2003
2004         "Build fix for APPLE_INTERNAL_SDK builds after r211980."
2005         http://trac.webkit.org/changeset/211987
2006
2007 2017-02-09  Alexey Proskuryakov  <ap@apple.com>
2008
2009         Remove unused WebThreadRunSync
2010         https://bugs.webkit.org/show_bug.cgi?id=168024
2011
2012         Reviewed by Tim Horton.
2013
2014         * wtf/ios/WebCoreThread.cpp:
2015         * wtf/ios/WebCoreThread.h:
2016
2017 2017-02-09  Brady Eidson  <beidson@apple.com>
2018
2019         Build fix for APPLE_INTERNAL_SDK builds after r211980.
2020
2021         Unreviewed.
2022
2023         * wtf/spi/darwin/dyldSPI.h:
2024
2025 2017-02-09  Brady Eidson  <beidson@apple.com>
2026
2027         Transition "WebKit Library Version" checks to SDK version checks.
2028         <rdar://problem/30313696> and https://bugs.webkit.org/show_bug.cgi?id=168056
2029
2030         Reviewed by Geoffrey Garen.
2031
2032         * wtf/spi/darwin/dyldSPI.h: Add entries for the iOS 10.3, macOS 10.11, and macOS 10.12.4 SDKs.
2033
2034 2017-02-06  Jer Noble  <jer.noble@apple.com>
2035
2036         Playback stalls when a SourceBuffer append causes frame eviction
2037         https://bugs.webkit.org/show_bug.cgi?id=167834
2038
2039         Reviewed by Eric Carlson.
2040
2041         Optimize the MediaTime class; specifically the compare() method. The class only
2042         needs 6 bits to store the TimeFlags, so make that a uint8_t rather than uint32_t.
2043         The implementation is slightly simpler if the TimeScale is unsigned, so make that
2044         a uint32_t rather than int32_t. Inline the comparison operators. Optimize the equality
2045         comparison by bitwise-and'ing the flags together and masking the result. Optimize for
2046         common comparison scenarios (equal timeScales, equal timeValues(), etc.). Attempt the
2047         mathematically simpler simpler method for comparing ratios, and only fall back to the
2048         complex method if the results of multiplying the timeScale by the timeValue overflows.
2049
2050         * wtf/MediaTime.cpp:
2051         (WTF::greatestCommonDivisor):
2052         (WTF::leastCommonMultiple):
2053         (WTF::signum):
2054         (WTF::MediaTime::MediaTime):
2055         (WTF::MediaTime::createWithFloat):
2056         (WTF::MediaTime::createWithDouble):
2057         (WTF::MediaTime::operator+):
2058         (WTF::MediaTime::operator-):
2059         (WTF::MediaTime::operator!):
2060         (WTF::MediaTime::operator bool):
2061         (WTF::MediaTime::compare):
2062         (WTF::MediaTime::setTimeScale):
2063         (WTF::abs):
2064         (WTF::MediaTime::operator<): Deleted.
2065         (WTF::MediaTime::operator>): Deleted.
2066         (WTF::MediaTime::operator!=): Deleted.
2067         (WTF::MediaTime::operator==): Deleted.
2068         (WTF::MediaTime::operator>=): Deleted.
2069         (WTF::MediaTime::operator<=): Deleted.
2070         * wtf/MediaTime.h:
2071
2072 2017-02-04  Michael Catanzaro  <mcatanzaro@igalia.com>
2073
2074         [GTK] Fix huge ENABLE_RESOURCE_USAGE warning spam
2075
2076         Unreviewed. We shouldn't redefine ENABLE_RESOURCE_USAGE in Platform.h as
2077         it's already defined in cmakeconfig.h.
2078
2079         * wtf/Platform.h:
2080
2081 2017-02-03  Joseph Pecoraro  <pecoraro@apple.com>
2082
2083         Performance Timing: Convert WTF::MonotonicTime and WTF::Seconds
2084         https://bugs.webkit.org/show_bug.cgi?id=167768
2085
2086         Reviewed by Geoffrey Garen.
2087
2088         * wtf/Stopwatch.h:
2089         (WTF::Stopwatch::elapsedTimeSince):
2090         (WTF::Stopwatch::elapsedTimeSinceMonotonicTime): Deleted.
2091
2092 2017-02-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2093
2094         [GTK] Add initial implementation of resource usage overlay
2095         https://bugs.webkit.org/show_bug.cgi?id=167731
2096
2097         Reviewed by Michael Catanzaro.
2098
2099         Enable RESOURCE_USAGE for GTK+ port too.
2100
2101         * wtf/Platform.h:
2102
2103 2017-02-02  Andreas Kling  <akling@apple.com>
2104
2105         [Mac] In-process memory pressure monitor for WebContent processes AKA websam
2106         <https://webkit.org/b/167491>
2107         <rdar://problem/30116072>
2108
2109         Reviewed by Antti Koivisto.
2110
2111         Add a WTF helper function for getting the current process's memory footprint.
2112
2113         * WTF.xcodeproj/project.pbxproj:
2114         * wtf/CMakeLists.txt:
2115         * wtf/MemoryFootprint.cpp:
2116         (WTF::memoryFootprint):
2117         * wtf/MemoryFootprint.h:
2118
2119 2017-02-02  Mark Lam  <mark.lam@apple.com>
2120
2121         Add a SIGILL crash analyzer to make debugging SIGILLs easier.
2122         https://bugs.webkit.org/show_bug.cgi?id=167714
2123         <rdar://problem/30318237>
2124
2125         Reviewed by Filip Pizlo.
2126
2127         * wtf/StdLibExtras.h:
2128
2129 2017-02-02  Commit Queue  <commit-queue@webkit.org>
2130
2131         Unreviewed, rolling out r211571 and r211582.
2132         https://bugs.webkit.org/show_bug.cgi?id=167751
2133
2134         This change caused API test WebKit1.MemoryPressureHandler to
2135         fail with an assertion. (Requested by ryanhaddad on #webkit).
2136
2137         Reverted changesets:
2138
2139         "[Mac] In-process memory pressure monitor for WebContent
2140         processes."
2141         https://bugs.webkit.org/show_bug.cgi?id=167491
2142         http://trac.webkit.org/changeset/211571
2143
2144         "Unreviewed attempt to fix the Windows build after r211571."
2145         http://trac.webkit.org/changeset/211582
2146
2147 2017-02-02  Andreas Kling  <akling@apple.com>
2148
2149         [Mac] In-process memory pressure monitor for WebContent processes.
2150         <https://webkit.org/b/167491>
2151         <rdar://problem/30116072>
2152
2153         Reviewed by Antti Koivisto.
2154
2155         Add a WTF helper function for getting the current process's memory footprint.
2156
2157         * WTF.xcodeproj/project.pbxproj:
2158         * wtf/CMakeLists.txt:
2159         * wtf/MemoryFootprint.cpp:
2160         (WTF::memoryFootprint):
2161         * wtf/MemoryFootprint.h:
2162
2163 2017-02-01  Wenson Hsieh  <wenson_hsieh@apple.com>
2164
2165         Unreviewed, fix the WebKit nightly open source build
2166         <rdar://problem/30308635>
2167
2168         We cannot assume all internal SDKs have the latest WebKitAdditions, so we need an explicit header check here.
2169
2170         * wtf/Platform.h:
2171
2172 2017-02-01  Andreas Kling  <akling@apple.com>
2173
2174         Implement the alwaysRunsAtBackgroundPriority WK2 setting using thread QoS.
2175         <https://webkit.org/b/167387>
2176         <rdar://problem/29711409>
2177
2178         Reviewed by Antti Koivisto.
2179
2180         Add a new mechanism for overriding the max thread QoS level globally:
2181
2182             void setGlobalMaxQOSClass(qos_class_t)
2183             qos_class_t adjustedQOSClass(qos_class_t)
2184
2185         The QoS cap applies to all newly created threads, threads that try to override
2186         their QoS class manually, and also passed down to bmalloc.
2187
2188         * wtf/Threading.cpp:
2189         (WTF::setCurrentThreadIsUserInteractive):
2190         (WTF::setCurrentThreadIsUserInitiated):
2191         (WTF::setGlobalMaxQOSClass):
2192         (WTF::adjustedQOSClass):
2193         * wtf/Threading.h:
2194         * wtf/ThreadingPthreads.cpp:
2195         (WTF::createThreadInternal):
2196         * wtf/cocoa/WorkQueueCocoa.cpp:
2197         (WTF::dispatchQOSClass):
2198
2199 2017-01-31  Antti Koivisto  <antti@apple.com>
2200
2201         Teach cache coders to encode time_points
2202         https://bugs.webkit.org/show_bug.cgi?id=167670
2203
2204         Reviewed by Andreas Kling.
2205
2206         * wtf/persistence/Coders.h:
2207         (WTF::Persistence::Coder<std::chrono::system_clock::time_point>::encode):
2208         (WTF::Persistence::Coder<std::chrono::system_clock::time_point>::decode):
2209
2210 2017-01-31  Joseph Pecoraro  <pecoraro@apple.com>
2211
2212         Removed unused m_nestedCount from RunLoop
2213         https://bugs.webkit.org/show_bug.cgi?id=167674
2214
2215         Reviewed by Sam Weinig.
2216
2217         * wtf/RunLoop.h:
2218         * wtf/cf/RunLoopCF.cpp:
2219         (WTF::RunLoop::RunLoop):
2220         (WTF::RunLoop::run):
2221
2222 2017-01-31  Filip Pizlo  <fpizlo@apple.com>
2223
2224         The mutator should be able to perform increments of GC work
2225         https://bugs.webkit.org/show_bug.cgi?id=167528
2226
2227         Reviewed by Keith Miller and Geoffrey Garen.
2228
2229         We want dataLog to be locked even if you're not logging to a file!
2230
2231         * wtf/DataLog.cpp:
2232         (WTF::initializeLogFileOnce):
2233
2234 2017-01-28  Wenson Hsieh  <wenson_hsieh@apple.com>
2235
2236         Check USE(APPLE_INTERNAL_SDK) instead of specific headers when importing from WebKitAdditions
2237         https://bugs.webkit.org/show_bug.cgi?id=167555
2238
2239         Reviewed by Dan Bernstein.
2240
2241         Instead of guarding #import <WebKitAdditions/*> on the existence of the imported file, consult
2242         USE(APPLE_INTERNAL_SDK) instead.
2243
2244         * wtf/Platform.h:
2245
2246 2017-01-26  Saam Barati  <sbarati@apple.com>
2247
2248         Harden how the compiler references GC objects
2249         https://bugs.webkit.org/show_bug.cgi?id=167277
2250         <rdar://problem/30179506>
2251
2252         Reviewed by Filip Pizlo.
2253
2254         I made TinyPtrSet use bitwise_cast instead of static_cast
2255         for its singleEntry() function so that it can work on pointer-like
2256         types just as it can on actual pointer types.
2257         
2258         An example of where this matters is when you have TinyPtrSet<T>
2259         where T is defined to be a struct which wraps a pointer, e.g:
2260         
2261         struct T {
2262             void* m_pointer;
2263         }
2264
2265         * wtf/TinyPtrSet.h:
2266         (WTF::TinyPtrSet::singleEntry):
2267
2268 2017-01-25  Wenson Hsieh  <wenson_hsieh@apple.com>
2269
2270         Introduce an item-provider-based pasteboard wrapper
2271         https://bugs.webkit.org/show_bug.cgi?id=167410
2272
2273         Reviewed by Enrica Casucci.
2274
2275         Adds an additional feature flag.
2276
2277         * wtf/FeatureDefines.h:
2278
2279 2017-01-25  Konstantin Tokarev  <annulen@yandex.ru>
2280
2281         Removed leftovers of pre-2015 VisualStudio support
2282         https://bugs.webkit.org/show_bug.cgi?id=167434
2283
2284         Reviewed by Alex Christensen.
2285
2286         * wtf/Compiler.h:
2287         * wtf/Platform.h:
2288         * wtf/StringExtras.h:
2289
2290 2017-01-25  Chris Dumez  <cdumez@apple.com>
2291
2292         Disable Download attribute support on iOS
2293         https://bugs.webkit.org/show_bug.cgi?id=167337
2294         <rdar://problem/30154148>
2295
2296         Reviewed by Alexey Proskuryakov.
2297
2298         Disable Download attribute support on iOS as it currently does not work.
2299
2300         * wtf/FeatureDefines.h:
2301
2302 2017-01-25  Wenson Hsieh  <wenson_hsieh@apple.com>
2303
2304         Add a hook to include additional feature defines
2305         https://bugs.webkit.org/show_bug.cgi?id=167403
2306
2307         Reviewed by Enrica Casucci.
2308
2309         * wtf/Platform.h: Include AdditionalFeatureDefines.h, if it exists.
2310
2311 2017-01-24  Joseph Pecoraro  <pecoraro@apple.com>
2312
2313         Fold USER_TIMING into WEB_TIMING and make it a RuntimeEnabledFeature
2314         https://bugs.webkit.org/show_bug.cgi?id=167394
2315
2316         Reviewed by Ryosuke Niwa.
2317
2318         * wtf/FeatureDefines.h:
2319
2320 2017-01-24  Konstantin Tokarev  <annulen@yandex.ru>
2321
2322         VS2015 supports ref qualifiers
2323         https://bugs.webkit.org/show_bug.cgi?id=167368
2324
2325         Reviewed by Sam Weinig.
2326
2327         * wtf/Compiler.h: Enable
2328         WTF_COMPILER_SUPPORTS_CXX_REFERENCE_QUALIFIED_FUNCTIONS for VS2015
2329
2330 2017-01-24  Daniel Bates  <dabates@apple.com>
2331
2332         StringView.split() should use an iterator design pattern instead of allocating a Vector
2333         https://bugs.webkit.org/show_bug.cgi?id=163225
2334
2335         Reviewed by Darin Adler.
2336
2337         Implement StringView.split() using an iterator design.
2338
2339         Using an iterator design avoids the need to allocate a Vector of StringView objects,
2340         which is space-inefficient and error prone as the returned Vector may outlive the
2341         lifetime of the underlying string associated with the split (as StringView is a non-
2342         owning reference to a string).
2343
2344         StringView.split() now returns a StringView::SplitResult object that implements begin()/end()
2345         to support iterating over StringView substrings delimited by the specified separator
2346         character. For example, to iterate over the 'c'-separated substrings of a StringView v,
2347         you can write:
2348
2349         for (StringView substring : v.split('c'))
2350             // Do something with substring.
2351
2352         * wtf/text/StringView.cpp:
2353         (WTF::StringView::SplitResult::Iterator::findNextSubstring): Advances the iterator to point to the
2354         next substring.
2355         (WTF::StringView::split): Modified to return a SplitResult::Iterator object instead of a Vector<StringView>.
2356         * wtf/text/StringView.h:
2357         (WTF::StringView::SplitResult::SplitResult):
2358         (WTF::StringView::SplitResult::Iterator::Iterator):
2359         (WTF::StringView::SplitResult::Iterator::operator*):
2360         (WTF::StringView::SplitResult::Iterator::operator==):
2361         (WTF::StringView::SplitResult::Iterator::operator!=):
2362         Implements the iterator interface.
2363
2364 2017-01-20  Joseph Pecoraro  <pecoraro@apple.com>
2365
2366         Remove outdated ENABLE(CSP_NEXT) build flag
2367         https://bugs.webkit.org/show_bug.cgi?id=167252
2368
2369         Reviewed by Brent Fulgham.
2370
2371         * wtf/FeatureDefines.h:
2372
2373 2017-01-17  Andreas Kling  <akling@apple.com>
2374
2375         Annotate FastMalloc functions with returns_nonnull attribute.
2376         <https://webkit.org/b/167144>
2377
2378         Reviewed by Antti Koivisto.
2379
2380         Decorate fastMalloc() and friends with __attribute__((returns_nonnull)) for supporting
2381         compilers that can do useful things with that information.
2382
2383         * wtf/Compiler.h:
2384         * wtf/FastMalloc.h:
2385
2386 2017-01-17  Joseph Pecoraro  <pecoraro@apple.com>
2387
2388         ENABLE(USER_TIMING) Not Defined for Apple Windows or OS X Ports
2389         https://bugs.webkit.org/show_bug.cgi?id=116551
2390         <rdar://problem/13949830>
2391
2392         Reviewed by Alex Christensen.
2393
2394         * wtf/FeatureDefines.h:
2395
2396 2017-01-16  Joseph Pecoraro  <pecoraro@apple.com>
2397
2398         Remove the REQUEST_ANIMATION_FRAME flag
2399         https://bugs.webkit.org/show_bug.cgi?id=156980
2400         <rdar://problem/25906849>
2401
2402         Reviewed by Simon Fraser.
2403
2404         * wtf/FeatureDefines.h:
2405
2406 2017-01-15  Sam Weinig  <sam@webkit.org>
2407
2408         Add the ability to use numbers in makeString()
2409         https://bugs.webkit.org/show_bug.cgi?id=167087
2410
2411         Reviewed by Darin Adler.
2412
2413         Allow numbers to be easily used in makeString() and tryMakeString().
2414
2415         For instance, you can now write:
2416             int amount = 7;
2417             auto foo = makeString("There are ", amount, " apples in the cart");
2418
2419         * WTF.xcodeproj/project.pbxproj:
2420         Add new file.
2421
2422         * wtf/text/IntegerToStringConversion.h:
2423         (WTF::writeNumberToBufferImpl):
2424         (WTF::writeNumberToBufferSigned):
2425         (WTF::writeNumberToBufferUnsigned):
2426         (WTF::lengthOfNumberAsStringImpl):
2427         (WTF::lengthOfNumberAsStringSigned):
2428         (WTF::lengthOfNumberAsStringUnsigned):
2429         Add variants of integer writing code that compute the length of the string
2430         that would be produced and writes the string to an existing buffer.
2431
2432         (WTF::IntegerToStringConversionTrait<AtomicString>::flush): Deleted.
2433         (WTF::IntegerToStringConversionTrait<String>::flush): Deleted.
2434         (WTF::IntegerToStringConversionTrait<StringBuilder>::flush): Deleted.
2435         Move these traits to their respective classes.
2436
2437         * wtf/text/AtomicString.h:
2438         (WTF::IntegerToStringConversionTrait<AtomicString>::flush):
2439         * wtf/text/StringBuilder.h:
2440         (WTF::IntegerToStringConversionTrait<StringBuilder>::flush):
2441         * wtf/text/WTFString.h:
2442         (WTF::IntegerToStringConversionTrait<String>::flush):
2443         Traits moved here from IntegerToStringConversion.h
2444
2445         * wtf/text/StringConcatenateNumbers.h: Added.
2446         (WTF::StringTypeAdapter<int>::StringTypeAdapter<int>):
2447         (WTF::StringTypeAdapter<int>::length):
2448         (WTF::StringTypeAdapter<int>::is8Bit):
2449         (WTF::StringTypeAdapter<int>::writeTo):
2450         (WTF::StringTypeAdapter<int>::toString):
2451         (WTF::StringTypeAdapter<unsigned>::StringTypeAdapter<unsigned>):
2452         (WTF::StringTypeAdapter<unsigned>::length):
2453         (WTF::StringTypeAdapter<unsigned>::is8Bit):
2454         (WTF::StringTypeAdapter<unsigned>::writeTo):
2455         (WTF::StringTypeAdapter<unsigned>::toString):
2456         (WTF::StringTypeAdapter<float>::StringTypeAdapter<float>):
2457         (WTF::StringTypeAdapter<float>::length):
2458         (WTF::StringTypeAdapter<float>::is8Bit):
2459         (WTF::StringTypeAdapter<float>::writeTo):
2460         (WTF::StringTypeAdapter<float>::toString):
2461         (WTF::StringTypeAdapter<double>::StringTypeAdapter<double>):
2462         (WTF::StringTypeAdapter<double>::length):
2463         (WTF::StringTypeAdapter<double>::is8Bit):
2464         (WTF::StringTypeAdapter<double>::writeTo):
2465         (WTF::StringTypeAdapter<double>::toString):
2466         Add basic adaptors for int, unsigned, float, and double.
2467
2468         (WTF::FormattedNumber::fixedPrecision):
2469         (WTF::FormattedNumber::fixedWidth):
2470         (WTF::FormattedNumber::length):
2471         (WTF::FormattedNumber::buffer):
2472         (WTF::FormattedNumber::stringView):
2473         (WTF::StringTypeAdapter<FormattedNumber>::StringTypeAdapter<FormattedNumber>):
2474         (WTF::StringTypeAdapter<FormattedNumber>::length):
2475         (WTF::StringTypeAdapter<FormattedNumber>::is8Bit):
2476         (WTF::StringTypeAdapter<FormattedNumber>::writeTo):
2477         (WTF::StringTypeAdapter<FormattedNumber>::toString):
2478         Add a special class, FormattedNumber, and an adaptor for it, allowing for
2479         fixedPrecision and fixedWidth representation of doubles.
2480
2481 2017-01-14  Yusuke Suzuki  <utatane.tea@gmail.com>
2482
2483         WebAssembly: Suppress warnings & errors in GCC
2484         https://bugs.webkit.org/show_bug.cgi?id=167049
2485
2486         Reviewed by Sam Weinig.
2487
2488         * wtf/LEBDecoder.h:
2489         (WTF::LEBDecoder::decodeInt):
2490         If T = int, it performs `-1 << shift`. It causes
2491         warning in GCC. Instead, we first cast it to the
2492         UnsignedT, perform operation and re-cast to the
2493         T.
2494
2495 2017-01-13  Joseph Pecoraro  <pecoraro@apple.com>
2496
2497         Remove ENABLE(DETAILS_ELEMENT) guards
2498         https://bugs.webkit.org/show_bug.cgi?id=167042
2499
2500         Reviewed by Alex Christensen.
2501
2502         * wtf/FeatureDefines.h:
2503
2504 2017-01-11  Darin Adler  <darin@apple.com>
2505
2506         Remove PassRefPtr from more of "platform"
2507         https://bugs.webkit.org/show_bug.cgi?id=166809
2508
2509         Reviewed by Sam Weinig.
2510
2511         * wtf/Ref.h: Changed the template so that a const Ref<T> does not prohibit non-const
2512         use of T. We can still use const Ref<const T> to express that. The earlier design
2513         was intentional, but was not consistent with either actual references or with
2514         other smart pointer classes like RefPtr. One way to see how much better this is,
2515         is to see all the many, many cases where we have const_cast just to work around
2516         this. I searched for those and included fixes for many in this patch.
2517
2518 2017-01-12  Chris Dumez  <cdumez@apple.com>
2519
2520         [iOS] Implement support for KeyboardEvent.code
2521         https://bugs.webkit.org/show_bug.cgi?id=166932
2522         <rdar://problem/29972518>
2523
2524         Reviewed by Darin Adler.
2525
2526         Enable KEYBOARD_CODE_ATTRIBUTE feature on iOS.
2527
2528         * wtf/FeatureDefines.h:
2529
2530 2017-01-11  Andreas Kling  <akling@apple.com>
2531
2532         Crash when WebCore's GC heap grows way too large.
2533         <https://webkit.org/b/166875>
2534         <rdar://problem/27896585>
2535
2536         Reviewed by Mark Lam.
2537
2538         Publish the WTF::GB constant.
2539
2540         * wtf/StdLibExtras.h:
2541
2542 2017-01-11  Anders Carlsson  <andersca@apple.com>
2543
2544         navigator.plugins.refresh and WKContextRefreshPlugIns doesn't pick up changes to already-present plug-ins
2545         https://bugs.webkit.org/show_bug.cgi?id=166942
2546         rdar://problem/29839194
2547
2548         Reviewed by Sam Weinig.
2549
2550         * wtf/spi/cf/CFBundleSPI.h:
2551         Add SPI declaration.
2552
2553 2017-01-06  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
2554
2555         [GTK] Should support key and code properties on keyboard events
2556         https://bugs.webkit.org/show_bug.cgi?id=166759
2557
2558         Reviewed by Carlos Garcia Campos.
2559
2560         * wtf/FeatureDefines.h: enable key and code properties support for GTK.
2561
2562 2017-01-08  Antti Koivisto  <antti@apple.com>
2563
2564         Move cache coders to WTF
2565         https://bugs.webkit.org/show_bug.cgi?id=166825
2566
2567         Rubber-stamped by Sam Weinig.
2568
2569         Make it possible to use robust serialization of WTF types on the lower levels of the stack.
2570
2571         * WTF.xcodeproj/project.pbxproj:
2572         * wtf/persistence: Added.
2573         * wtf/persistence/Coder.h: Copied from Source/WebKit2/NetworkProcess/cache/NetworkCacheCoder.h.
2574         (WebKit::NetworkCache::Coder::encode): Deleted.
2575         (WebKit::NetworkCache::Coder::decode): Deleted.
2576         * wtf/persistence/Coders.cpp: Copied from Source/WebKit2/NetworkProcess/cache/NetworkCacheCoders.cpp.
2577         (WebKit::NetworkCache::Coder<AtomicString>::encode): Deleted.
2578         (WebKit::NetworkCache::Coder<AtomicString>::decode): Deleted.
2579         (WebKit::NetworkCache::Coder<CString>::encode): Deleted.
2580         (WebKit::NetworkCache::Coder<CString>::decode): Deleted.
2581         (WebKit::NetworkCache::Coder<String>::encode): Deleted.
2582         (WebKit::NetworkCache::decodeStringText): Deleted.
2583         (WebKit::NetworkCache::Coder<String>::decode): Deleted.
2584         (WebKit::NetworkCache::Coder<SHA1::Digest>::encode): Deleted.
2585         (WebKit::NetworkCache::Coder<SHA1::Digest>::decode): Deleted.
2586         (WebKit::NetworkCache::Coder<WebCore::HTTPHeaderMap>::encode): Deleted.
2587         (WebKit::NetworkCache::Coder<WebCore::HTTPHeaderMap>::decode): Deleted.
2588         * wtf/persistence/Coders.h: Copied from Source/WebKit2/NetworkProcess/cache/NetworkCacheCoders.h.
2589         (WebKit::NetworkCache::Coder<std::optional<T>>::encode): Deleted.
2590         (WebKit::NetworkCache::Coder<std::optional<T>>::decode): Deleted.
2591         * wtf/persistence/Decoder.cpp: Copied from Source/WebKit2/NetworkProcess/cache/NetworkCacheDecoder.cpp.
2592         (WebKit::NetworkCache::Decoder::Decoder): Deleted.
2593         (WebKit::NetworkCache::Decoder::~Decoder): Deleted.
2594         (WebKit::NetworkCache::Decoder::bufferIsLargeEnoughToContain): Deleted.
2595         (WebKit::NetworkCache::Decoder::decodeFixedLengthData): Deleted.
2596         (WebKit::NetworkCache::Decoder::decodeNumber): Deleted.
2597         (WebKit::NetworkCache::Decoder::decode): Deleted.
2598         (WebKit::NetworkCache::Decoder::verifyChecksum): Deleted.
2599         * wtf/persistence/Decoder.h: Copied from Source/WebKit2/NetworkProcess/cache/NetworkCacheDecoder.h.
2600         (WebKit::NetworkCache::Decoder::length): Deleted.
2601         (WebKit::NetworkCache::Decoder::currentOffset): Deleted.
2602         (WebKit::NetworkCache::Decoder::decodeEnum): Deleted.
2603         (WebKit::NetworkCache::Decoder::decode): Deleted.
2604         (WebKit::NetworkCache::Decoder::bufferIsLargeEnoughToContain): Deleted.
2605         * wtf/persistence/Encoder.cpp: Copied from Source/WebKit2/NetworkProcess/cache/NetworkCacheEncoder.cpp.
2606         (WebKit::NetworkCache::Encoder::Encoder): Deleted.
2607         (WebKit::NetworkCache::Encoder::~Encoder): Deleted.
2608         (WebKit::NetworkCache::Encoder::grow): Deleted.
2609         (WebKit::NetworkCache::Encoder::updateChecksumForData): Deleted.
2610         (WebKit::NetworkCache::Encoder::encodeFixedLengthData): Deleted.
2611         (WebKit::NetworkCache::Encoder::encodeNumber): Deleted.
2612         (WebKit::NetworkCache::Encoder::encode): Deleted.
2613         (WebKit::NetworkCache::Encoder::encodeChecksum): Deleted.
2614         * wtf/persistence/Encoder.h: Copied from Source/WebKit2/NetworkProcess/cache/NetworkCacheEncoder.h.
2615         (WebKit::NetworkCache::Encoder::encodeEnum): Deleted.
2616         (WebKit::NetworkCache::Encoder::encode): Deleted.
2617         (WebKit::NetworkCache::Encoder::operator<<): Deleted.
2618         (WebKit::NetworkCache::Encoder::buffer): Deleted.
2619         (WebKit::NetworkCache::Encoder::bufferSize): Deleted.
2620         (WebKit::NetworkCache::Encoder::updateChecksumForNumber): Deleted.
2621
2622 2017-01-08  Konstantin Tokarev  <annulen@yandex.ru>
2623
2624         Introduce CPU(X86_SSE2) instead of various SSE2 checks
2625         https://bugs.webkit.org/show_bug.cgi?id=166808
2626
2627         Reviewed by Michael Catanzaro.
2628
2629         Now copyLCharsFromUCharSource can use SSE2 implementation on non-Darwin
2630         OSes, and all SSE2 code paths are available for MSVC on x86 if /arch:SSE2
2631         or higher is enabled, and for MSVC on x86_64.
2632
2633         * wtf/Platform.h:
2634         * wtf/text/ASCIIFastPath.h:
2635         (WTF::copyLCharsFromUCharSource):
2636
2637 2017-01-05  Myles C. Maxfield  <mmaxfield@apple.com>
2638
2639         Carets can split up marriages and families
2640         https://bugs.webkit.org/show_bug.cgi?id=166711
2641         <rdar://problem/29019333>
2642
2643         Reviewed by Alex Christensen.
2644
2645         There are four code points which should be allowed to accept emoji modifiers:
2646         - U+1F46A FAMILY
2647         - U+1F46B MAN AND WOMAN HOLDING HANDS
2648         - U+1F46C TWO MEN HOLDING HANDS
2649         - U+1F46D TWO WOMEN HOLDING HANDS
2650
2651         Even though macOS's and iOS's emoji keyboard don't allow users to actually type
2652         these combinations, we may still receive them from other platforms. We should
2653         therefore treat these as joining sequences. Rendering isn't a problem because
2654         the fonts accept the emoji modifiers, but our caret placement code isn't educated
2655         about it. Currently, we treat these emoji groups as ligatures, allowing the caret
2656         to be placed between the two code points, which visually shows as being horizontally
2657         centered in the glyph. Instead, we should treat these code points as accepting
2658         emoji modifiers.
2659
2660         Tests: editing/caret/emoji.html
2661                editing/caret/ios/emoji.html
2662
2663         * wtf/text/TextBreakIterator.cpp:
2664         (WTF::cursorMovementIterator):
2665
2666 2017-01-05  Filip Pizlo  <fpizlo@apple.com>
2667
2668         AutomaticThread timeout shutdown leaves a small window where notify() would think that the thread is still running
2669         https://bugs.webkit.org/show_bug.cgi?id=166742
2670
2671         Reviewed by Geoffrey Garen.
2672         
2673         Remove the use of the RAII ThreadScope, since the use of RAII helped make this bug possible:
2674         we'd do ~ThreadScope after we had done ~LockHolder, so in between when we decided to shut
2675         down a thread and when it reported itself as being shut down, there was a window where a
2676         notify() call would get confused.
2677         
2678         Now, we run all thread shutdown stuff while the lock is held. We release the lock last. One
2679         API implication is that threadWillStop becomes threadIsStopping and it's called while the
2680         lock is held. This seems benign.
2681
2682         * wtf/AutomaticThread.cpp:
2683         (WTF::AutomaticThread::start):
2684         (WTF::AutomaticThread::threadIsStopping):
2685         (WTF::AutomaticThread::ThreadScope::ThreadScope): Deleted.
2686         (WTF::AutomaticThread::ThreadScope::~ThreadScope): Deleted.
2687         (WTF::AutomaticThread::threadWillStop): Deleted.
2688         * wtf/AutomaticThread.h:
2689
2690 2017-01-04  Darin Adler  <darin@apple.com>
2691
2692         Remove PassRefPtr use from the "html" directory, other improvements
2693         https://bugs.webkit.org/show_bug.cgi?id=166635
2694
2695         Reviewed by Alex Christensen.
2696
2697         * wtf/RefPtr.h:
2698         (WTF::makeRefPtr): Added.
2699
2700 2017-01-04  Yusuke Suzuki  <utatane.tea@gmail.com>
2701
2702         Unreviewed build fix after r210313
2703         https://bugs.webkit.org/show_bug.cgi?id=166676
2704
2705         Revert `#pragma once` to ifdefs due to build failure.
2706
2707         * wtf/text/StringView.h:
2708
2709 2017-01-04  Yusuke Suzuki  <utatane.tea@gmail.com>
2710
2711         Limit thread name appropriately
2712         https://bugs.webkit.org/show_bug.cgi?id=166676
2713
2714         Reviewed by Sam Weinig.
2715
2716         In some platform, the max length of thread names are limited.
2717         For example, the number of the max length is 32 in Windows and
2718         16 in Linux. But the specified thread name is typically long
2719         in WebKit like "com.apple.CoreIPC.ReceiveQueue"
2720
2721         We port the logic substring the thread name in
2722         generic/WorkQueueGeneric.cpp to Threading. It retrieves the name
2723         "ReceiveQueue" from "com.apple.CoreIPC.ReceiveQueue". And apply
2724         the appropriate the thread name limit and use it on Linux and
2725         Windows environment.
2726
2727         * wtf/Threading.cpp:
2728         (WTF::normalizeThreadName):
2729         (WTF::createThread):
2730         * wtf/Threading.h:
2731         * wtf/ThreadingPthreads.cpp:
2732         (WTF::initializeCurrentThreadInternal):
2733         * wtf/ThreadingWin.cpp:
2734         (WTF::initializeCurrentThreadInternal):
2735         * wtf/generic/WorkQueueGeneric.cpp:
2736         (WorkQueue::platformInitialize):
2737         * wtf/text/StringView.h:
2738         (WTF::StringView::left):
2739         (WTF::StringView::right):
2740         (WTF::StringView::reverseFind):
2741
2742 2017-01-04  Sam Weinig  <sam@webkit.org>
2743
2744         REGRESSION (r210257): com.apple.WebKit.WebContent.Development crashed in com.apple.WebCore: WebCore::ExceptionOr<WTF::Ref<WebCore::Database> >::operator= + 14
2745         <rdar://problem/29866398> 
2746
2747         * wtf/Expected.h:
2748         (WTF::Expected::swap):
2749         Add missing calls to destroy() when moving things over each other in a union.
2750
2751 2017-01-03  Yusuke Suzuki  <utatane.tea@gmail.com>
2752
2753         Use prctl to name thread on Linux
2754         https://bugs.webkit.org/show_bug.cgi?id=166663
2755
2756         Reviewed by Michael Catanzaro.
2757
2758         It is quite useful if we can name threads. This name will be shown in GDB.
2759         While macOS uses pthread_setname_np, we can use prctl on Linux.
2760
2761         * wtf/ThreadingPthreads.cpp:
2762         (WTF::initializeCurrentThreadInternal):
2763
2764 2017-01-03  Yusuke Suzuki  <utatane.tea@gmail.com>
2765
2766         WorkQueueGeneric's platformInvalidate() can deadlock when called on the RunLoop's thread
2767         https://bugs.webkit.org/show_bug.cgi?id=166645
2768
2769         Reviewed by Carlos Garcia Campos.
2770
2771         WorkQueue can be destroyed on its invoking thread itself.
2772         The scenario is the following.
2773
2774             1. Create WorkQueue (in thread A).
2775             2. Dispatch a task (in thread A, dispatching a task to thread B).
2776             3. Deref in thread A.
2777             4. The task is executed in thread B.
2778             5. Deref in thread B.
2779             6. The WorkQueue is destroyed, calling platformInvalidate in thread B.
2780
2781         In that case, if platformInvalidate waits thread B's termination, it causes deadlock.
2782         We do not need to wait the thread termination.
2783
2784         * wtf/WorkQueue.h:
2785         * wtf/generic/WorkQueueGeneric.cpp:
2786         (WorkQueue::platformInitialize):
2787         (WorkQueue::platformInvalidate):
2788
2789 2017-01-03  Sam Weinig  <sam@webkit.org>
2790
2791         Make WTF::Expected support Ref template parameters
2792         https://bugs.webkit.org/show_bug.cgi?id=166662
2793
2794         Reviewed by Alex Christensen.
2795
2796         Tests: Added to TestWebKitAPI/Expected.cpp
2797
2798         * wtf/Expected.h:
2799         (WTF::UnexpectedType::value):
2800         Add overloads based on this value type to allow getting at the value
2801         as an rvalue for moving the error into the Expected.
2802
2803         (WTF::Expected::Expected):
2804         Add overload that takes an ErrorType/UnexpectedType<ErrorType> as an rvalue.
2805
2806         (WTF::Expected::swap):
2807         Move the temporary value/error rather than copying.
2808
2809 2017-01-02  Julien Brianceau  <jbriance@cisco.com>
2810
2811         Remove sh4 specific code from JavaScriptCore
2812         https://bugs.webkit.org/show_bug.cgi?id=166640
2813
2814         Reviewed by Filip Pizlo.
2815
2816         * wtf/Platform.h:
2817
2818 2017-01-02  Yusuke Suzuki  <utatane.tea@gmail.com>
2819
2820         Leverage Substring to create new AtomicStringImpl for StaticStringImpl and SymbolImpl
2821         https://bugs.webkit.org/show_bug.cgi?id=166636
2822
2823         Reviewed by Darin Adler.
2824
2825         Previously we always create the full atomic string if we need to create the same string
2826         based on the given value. For example, when generating AtomicStringImpl from the SymbolImpl,
2827         we need to create a new AtomicStringImpl since SymbolImpl never becomes `isAtomic() == true`.
2828         But it is costly.
2829
2830         This patch leverages the substring system of StringImpl. Instead of allocating the completely
2831         duplicate string, we create a substring StringImpl that shares the same content with the
2832         base string.
2833
2834         * wtf/text/AtomicStringImpl.cpp:
2835         (WTF::stringTable):
2836         (WTF::addToStringTable):
2837         (WTF::addSubstring):
2838         (WTF::AtomicStringImpl::addSlowCase):
2839         (WTF::AtomicStringImpl::remove):
2840         (WTF::AtomicStringImpl::lookUpSlowCase):
2841         * wtf/text/StringImpl.h:
2842         (WTF::StringImpl::StaticStringImpl::operator StringImpl&):
2843
2844 2017-01-02  Yusuke Suzuki  <utatane.tea@gmail.com>
2845
2846         Use StaticStringImpl instead of StaticASCIILiteral
2847         https://bugs.webkit.org/show_bug.cgi?id=166586
2848
2849         Reviewed by Darin Adler.
2850
2851         It is more handy way to define static StringImpl. It calculates the length
2852         and hash value by using the constexpr constructor and function. So we do
2853         not need to calculate these things in Perl script.
2854         And it allows us to use StaticStringImpl in the hand written C++ code.
2855         Previously, we need to calculate the length and hash value by hand if we
2856         would like to use StaticASCIILiteral in the hand written C++ code, and it
2857         meant that we cannot use it at all in the hand written C++ code.
2858
2859         * wtf/text/AtomicStringImpl.cpp:
2860         (WTF::AtomicStringImpl::addSlowCase):
2861         (WTF::AtomicStringImpl::lookUpSlowCase):
2862         * wtf/text/AtomicStringImpl.h:
2863         * wtf/text/StringImpl.h:
2864         * wtf/text/SymbolImpl.h:
2865         * wtf/text/UniquedStringImpl.h:
2866
2867 2017-01-02  Andreas Kling  <akling@apple.com>
2868
2869         Discard media controls JS/CSS caches under memory pressure.
2870         <https://webkit.org/b/166639>
2871
2872         Reviewed by Antti Koivisto.
2873
2874         * wtf/text/WTFString.h:
2875         (WTF::String::clearImplIfNotShared): Add a helper for clearing a String if the underlying
2876         StringImpl is not referenced by anyone else.
2877
2878 2016-12-22  Mark Lam  <mark.lam@apple.com>
2879
2880         De-duplicate finally blocks.
2881         https://bugs.webkit.org/show_bug.cgi?id=160168
2882
2883         Reviewed by Saam Barati.
2884
2885         Added some methods to bring SegmentedVector closer to parity with Vector.
2886
2887         * wtf/SegmentedVector.h:
2888         (WTF::SegmentedVector::first):
2889         (WTF::SegmentedVector::last):
2890         (WTF::SegmentedVector::takeLast):
2891
2892 2016-12-19  Mark Lam  <mark.lam@apple.com>
2893
2894         Rolling out r209974 and r209952. They break some websites in mysterious ways. Step 2: Rollout r209952.
2895         https://bugs.webkit.org/show_bug.cgi?id=166049
2896
2897         Not reviewed.
2898
2899         * wtf/SegmentedVector.h:
2900         (WTF::SegmentedVector::last):
2901         (WTF::SegmentedVector::first): Deleted.
2902         (WTF::SegmentedVector::takeLast): Deleted.
2903
2904 2016-12-16  Mark Lam  <mark.lam@apple.com>
2905
2906         Add predecessor info to dumps from JSC_dumpBytecodeLivenessResults=true.
2907         https://bugs.webkit.org/show_bug.cgi?id=165958
2908
2909         Reviewed by Keith Miller.
2910
2911         Added some methods to bring SegmentedVector closer to parity with Vector.
2912
2913         * wtf/SegmentedVector.h:
2914         (WTF::SegmentedVector::first):
2915         (WTF::SegmentedVector::last):
2916         (WTF::SegmentedVector::takeLast):
2917
2918 2016-12-16  Michael Saboff  <msaboff@apple.com>
2919
2920         REGRESSION: HipChat and Mail sometimes hang beneath JSC::Heap::lastChanceToFinalize()
2921         https://bugs.webkit.org/show_bug.cgi?id=165962
2922
2923         Reviewed by Filip Pizlo.
2924
2925         There is an inherent race in Condition::waitFor() where the timeout can happen just before
2926         a notify from another thread.
2927
2928         Fixed this by adding a condition variable and flag to each AutomaticThread.  The flag
2929         is used to signify to a notifying thread that the thread is waiting.  That flag is set
2930         in the waiting thread before calling waitFor() and cleared by another thread when it
2931         notifies the thread.  The access to that flag happens when the lock is held.
2932         Now the waiting thread checks if the flag after a timeout to see that it in fact should
2933         proceed like a normal notification.
2934
2935         The added condition variable allows us to target a specific thread.  We used to keep a list
2936         of waiting threads, now we keep a list of all threads.  To notify one thread, we look for
2937         a waiting thread and notify it directly.  If we can't find a waiting thread, we start a
2938         sleeping thread.
2939
2940         We notify all threads by waking all waiting threads and starting all sleeping threads.
2941
2942         * wtf/AutomaticThread.cpp:
2943         (WTF::AutomaticThreadCondition::notifyOne):
2944         (WTF::AutomaticThreadCondition::notifyAll):
2945         (WTF::AutomaticThread::isWaiting):
2946         (WTF::AutomaticThread::notify):
2947         (WTF::AutomaticThread::start):
2948         * wtf/AutomaticThread.h:
2949
2950 2016-12-15  Myles C. Maxfield  <mmaxfield@apple.com>
2951
2952         Unreviewed build fix after r209910
2953
2954         Unreviewed.
2955
2956         * wtf/Platform.h:
2957
2958 2016-12-15  Myles C. Maxfield  <mmaxfield@apple.com>
2959
2960         Stop reinterpret_casting UBreakIterators to the undefined type TextBreakIterator
2961         https://bugs.webkit.org/show_bug.cgi?id=165931
2962
2963         We have a class declaration for TextBreakIterator but no definition for it. When we
2964         create an ICU UBreakIterator, we immediately reinterpret_cast it to this undefined
2965         type, and pass it around our code inside WebCore. Then, whenever we want to actually
2966         use this iterator, we reinterpret_cast it back to UBreakIterator. This is likely due
2967         to some ports historically implementing breaking interators on top of other libraries
2968         other than ICU; however, now, all ports use ICU. Because this internal type is not
2969         helpful and just adds confusion, we should just call our breaking iterators what
2970         they are: UBreakIterators.
2971
2972         This patch is a mechanical replacement of TextBreakIterator to UBreakIterator and
2973         removes the functions we were calling which pass through directly to ubrk_*().
2974
2975         Reviewed by Alex Christensen.
2976
2977         * wtf/text/LineBreakIteratorPoolICU.h:
2978         (WTF::LineBreakIteratorPool::take):
2979         (WTF::LineBreakIteratorPool::put):
2980         * wtf/text/StringView.cpp:
2981         (WTF::StringView::GraphemeClusters::Iterator::Impl::computeIndexEnd):
2982         * wtf/text/TextBreakIterator.cpp:
2983         (WTF::initializeIterator):
2984         (WTF::initializeIteratorWithRules):
2985         (WTF::setTextForIterator):
2986         (WTF::setContextAwareTextForIterator):
2987         (WTF::wordBreakIterator):
2988         (WTF::sentenceBreakIterator):
2989         (WTF::cursorMovementIterator):
2990         (WTF::acquireLineBreakIterator):
2991         (WTF::releaseLineBreakIterator):
2992         (WTF::openLineBreakIterator):
2993         (WTF::closeLineBreakIterator):
2994         (WTF::getNonSharedCharacterBreakIterator):
2995         (WTF::cacheNonSharedCharacterBreakIterator):
2996         (WTF::isWordTextBreak):
2997         (WTF::numGraphemeClusters):
2998         (WTF::numCharactersInGraphemeClusters):
2999         (WTF::textBreakFirst): Deleted.
3000         (WTF::textBreakLast): Deleted.
3001         (WTF::textBreakNext): Deleted.
3002         (WTF::textBreakPrevious): Deleted.
3003         (WTF::textBreakPreceding): Deleted.
3004         (WTF::textBreakFollowing): Deleted.
3005         (WTF::textBreakCurrent): Deleted.
3006         (WTF::isTextBreak): Deleted.
3007         * wtf/text/TextBreakIterator.h:
3008         (WTF::LazyLineBreakIterator::lastCharacter):
3009         (WTF::LazyLineBreakIterator::secondToLastCharacter):
3010         (WTF::LazyLineBreakIterator::setPriorContext):
3011         (WTF::LazyLineBreakIterator::updatePriorContext):
3012         (WTF::LazyLineBreakIterator::resetPriorContext):
3013         (WTF::LazyLineBreakIterator::priorContextLength):
3014         (WTF::LazyLineBreakIterator::get):
3015         (WTF::NonSharedCharacterBreakIterator::operator UBreakIterator*):
3016         (WTF::NonSharedCharacterBreakIterator::operator TextBreakIterator*): Deleted.
3017
3018 2016-12-15  Myles C. Maxfield  <mmaxfield@apple.com>
3019
3020         Sort Xcode project files
3021         https://bugs.webkit.org/show_bug.cgi?id=165937
3022
3023         Reviewed by Simon Fraser.
3024
3025         * WTF.xcodeproj/project.pbxproj:
3026
3027 2016-12-15  Konstantin Tokarev  <annulen@yandex.ru>
3028
3029         Added missing override and final specifiers
3030         https://bugs.webkit.org/show_bug.cgi?id=165903
3031
3032         Reviewed by Darin Adler.
3033
3034         * wtf/RunLoop.h:
3035
3036 2016-12-15  Yusuke Suzuki  <utatane.tea@gmail.com>
3037
3038         [JSC] Optimize Kraken stringify
3039         https://bugs.webkit.org/show_bug.cgi?id=165857
3040
3041         Reviewed by Darin Adler.
3042
3043         Kraken json-stringify-tinderbox performance heavily relies on StringBuilder::appendQuotedJSONString.
3044         According to the result produced by Linux `perf`, it occupies 28% of execution time.
3045
3046         We tighten the hottest loop in the above function. We create the super fast path for non escaping case.
3047         And add " and \ cases (since including " in the string is common). Then we fallback to the slow case.
3048
3049         It improves the performance 5.5% in Kraken json-stringify-tinderbox in MBP.
3050
3051             Performance result in my MBP (dandelion).
3052
3053                 Collected 100 samples per benchmark/VM, with 100 VM invocations per benchmark. Emitted a call to gc()
3054                 between sample measurements. Used 1 benchmark iteration per VM invocation for warm-up. Used the
3055                 jsc-specific preciseTime() function to get microsecond-level timing. Reporting benchmark execution times
3056                 with 95% confidence intervals in milliseconds.
3057
3058                                                    baseline                  patched
3059
3060                 json-stringify-tinderbox        29.243+-0.241      ^      27.701+-0.235         ^ definitely 1.0557x faster
3061
3062                 <arithmetic>                    29.243+-0.241      ^      27.701+-0.235         ^ definitely 1.0557x faster
3063
3064             Performance result in my Linux laptop (hanayamata).
3065
3066                 Collected 100 samples per benchmark/VM, with 100 VM invocations per benchmark. Emitted a call to gc()
3067                 between sample measurements. Used 1 benchmark iteration per VM invocation for warm-up. Used the
3068                 jsc-specific preciseTime() function to get microsecond-level timing. Reporting benchmark execution times
3069                 with 95% confidence intervals in milliseconds.
3070
3071                                                    baseline                  patched
3072
3073                 json-stringify-tinderbox        26.711+-0.475      ^      25.255+-0.034         ^ definitely 1.0577x faster
3074
3075                 <arithmetic>                    26.711+-0.475      ^      25.255+-0.034         ^ definitely 1.0577x faster
3076
3077         * wtf/text/StringBuilder.cpp:
3078         (WTF::appendQuotedJSONStringInternalSlow):
3079         (WTF::appendQuotedJSONStringInternal):
3080
3081 2016-12-14  Commit Queue  <commit-queue@webkit.org>
3082
3083         Unreviewed, rolling out r209795.
3084         https://bugs.webkit.org/show_bug.cgi?id=165853
3085
3086         rolled out the wrong revision (Requested by pizlo on #webkit).
3087
3088         Reverted changeset:
3089
3090         "MarkedBlock::marksConveyLivenessDuringMarking should take
3091         into account collection scope"
3092         https://bugs.webkit.org/show_bug.cgi?id=165741
3093         http://trac.webkit.org/changeset/209795
3094
3095 2016-12-14  Enrique Ocaña González  <eocanha@igalia.com>
3096
3097         REGRESSION(r207879-207891): [GStreamer] Introduced many layout test failures and crashes, bots exiting early
3098         https://bugs.webkit.org/show_bug.cgi?id=164022
3099
3100         Reviewed by Xabier Rodriguez-Calvar.
3101
3102         * wtf/glib/GLibUtilities.h:
3103         Added new macros to convert gulong to/from gpointer.
3104
3105 2016-12-14  Gavin Barraclough  <barraclough@apple.com>
3106
3107         MarkedBlock::marksConveyLivenessDuringMarking should take into account collection scope
3108         https://bugs.webkit.org/show_bug.cgi?id=165741
3109
3110         Unreviewed, re-landing this with fix (revert erroneous change to Options).
3111
3112         * WTF.xcodeproj/project.pbxproj:
3113         * wtf/CMakeLists.txt:
3114         * wtf/DataLog.cpp:
3115         (WTF::initializeLogFileOnce):
3116         (WTF::initializeLogFile):
3117         (WTF::dataFile):
3118         * wtf/DataLog.h:
3119         * wtf/LockedPrintStream.cpp: Added.
3120         (WTF::LockedPrintStream::LockedPrintStream):
3121         (WTF::LockedPrintStream::~LockedPrintStream):
3122         (WTF::LockedPrintStream::vprintf):
3123         (WTF::LockedPrintStream::flush):
3124         (WTF::LockedPrintStream::begin):
3125         (WTF::LockedPrintStream::end):
3126         * wtf/LockedPrintStream.h: Added.
3127         * wtf/PrintStream.cpp:
3128         (WTF::PrintStream::printfVariableFormat):
3129         (WTF::PrintStream::begin):
3130         (WTF::PrintStream::end):
3131         * wtf/PrintStream.h:
3132         (WTF::PrintStream::atomically):
3133         (WTF::PrintStream::print):
3134         (WTF::PrintStream::println):
3135         (WTF::PrintStream::printImpl):
3136         (WTF::>::unpack):
3137         (WTF::FormatImpl::FormatImpl):
3138         (WTF::FormatImpl::dump):
3139         (WTF::format):
3140         (WTF::printInternal):
3141         * wtf/RecursiveLockAdapter.h: Added.
3142         (WTF::RecursiveLockAdapter::RecursiveLockAdapter):
3143         (WTF::RecursiveLockAdapter::lock):
3144         (WTF::RecursiveLockAdapter::unlock):
3145         (WTF::RecursiveLockAdapter::tryLock):
3146         (WTF::RecursiveLockAdapter::isLocked):
3147         * wtf/WordLock.cpp:
3148         * wtf/WordLock.h:
3149
3150 2016-12-14  Gavin Barraclough  <barraclough@apple.com>
3151
3152         MarkedBlock::marksConveyLivenessDuringMarking should take into account collection scope
3153         https://bugs.webkit.org/show_bug.cgi?id=165741
3154
3155         Unreviewed rollout due to performance regression.
3156
3157         * WTF.xcodeproj/project.pbxproj:
3158         * wtf/CMakeLists.txt:
3159         * wtf/DataLog.cpp:
3160         (WTF::initializeLogFileOnce):
3161         (WTF::initializeLogFile):
3162         (WTF::dataFile):
3163         * wtf/DataLog.h:
3164         * wtf/LockedPrintStream.cpp: Removed.
3165         * wtf/LockedPrintStream.h: Removed.
3166         * wtf/PrintStream.cpp:
3167         (WTF::PrintStream::printfVariableFormat): Deleted.
3168         (WTF::PrintStream::begin): Deleted.
3169         (WTF::PrintStream::end): Deleted.
3170         * wtf/PrintStream.h:
3171         (WTF::PrintStream::print):
3172         (WTF::PrintStream::println):
3173         (WTF::PrintStream::atomically): Deleted.
3174         (WTF::PrintStream::printImpl): Deleted.
3175         (): Deleted.
3176         (WTF::>::unpack): Deleted.
3177         (WTF::FormatImpl::FormatImpl): Deleted.
3178         (WTF::FormatImpl::dump): Deleted.
3179         (WTF::format): Deleted.
3180         * wtf/RecursiveLockAdapter.h: Removed.
3181         * wtf/WordLock.cpp:
3182         * wtf/WordLock.h:
3183
3184 2016-12-13  JF Bastien  <jfbastien@apple.com>
3185
3186         std::expected: fix rvalue forwarding issues
3187         https://bugs.webkit.org/show_bug.cgi?id=165812
3188
3189         Reviewed by Mark Lam.
3190
3191         * wtf/Expected.h:
3192         (WTF::UnexpectedType::UnexpectedType):
3193         (WTF::ExpectedDetail::Base::Base):
3194         (WTF::Expected::Expected):
3195
3196 2016-12-13  Chris Dumez  <cdumez@apple.com>
3197
3198         Unreviewed, rolling out r209544.
3199
3200         Looks like r209489 did not cause the performance regression
3201         after all
3202
3203         Reverted changeset:
3204
3205         "Unreviewed, rolling out r209489."
3206         https://bugs.webkit.org/show_bug.cgi?id=165550
3207         http://trac.webkit.org/changeset/209544
3208
3209 2016-12-13  Commit Queue  <commit-queue@webkit.org>
3210
3211         Unreviewed, rolling out r209725.
3212         https://bugs.webkit.org/show_bug.cgi?id=165811
3213
3214         "Broke ARMv7 builds" (Requested by msaboff on #webkit).
3215
3216         Reverted changeset:
3217
3218         "REGRESSION(r209653): speedometer crashes making virtual slow
3219         path tailcalls"
3220         https://bugs.webkit.org/show_bug.cgi?id=165748
3221         http://trac.webkit.org/changeset/209725
3222
3223 2016-12-13  JF Bastien  <jfbastien@apple.com>
3224
3225         [WTF] Turn tryMakeString(), makeString() into variadic templates
3226         https://bugs.webkit.org/show_bug.cgi?id=147142
3227
3228         Reviewed by Mark Lam.
3229
3230         I wrote this patch while improving WebAssembly's error messages,
3231         and only found this bug afterwards. My implementation does the
3232         bare minimum to make this code variadic without changing
3233         behavior. I think it's better to go with this baby step first, and
3234         improve the code later.
3235
3236         Notable, for my WebAssembly patch I also taught the code to handle
3237         integers and other types (including WebAssembly types). A
3238         follow-up could rely on ADL magic to pretty-format these other
3239         types.
3240
3241         * wtf/text/StringConcatenate.h:
3242         (WTF::sumWithOverflow): This unconditionally does the sum for all
3243         inputs, which the compiler is more likely to appreciate (because
3244         it's the common case) compared to testing for overflow and bailing
3245         on each addition
3246         (WTF::are8Bit): are: the plural of is!
3247         (WTF::makeStringAccumulator): accumulate strings
3248         (WTF::tryMakeStringFromAdapters): a small helper which creates the string adapters
3249         (WTF::tryMakeString): expose out of WTF, since it's part of this file's used API
3250         (WTF::makeString): make it variadic
3251
3252 2016-12-13  Konstantin Tokarev  <annulen@yandex.ru>
3253
3254         Unreviewed, silence -Wsuggest-attribute for GCC with pragmas
3255
3256         * wtf/PrintStream.cpp:
3257         (WTF::PrintStream::printfVariableFormat):
3258
3259 2016-12-12  Michael Saboff  <msaboff@apple.com>
3260
3261         REGRESSION(r209653): speedometer crashes making virtual slow path tailcalls
3262         https://bugs.webkit.org/show_bug.cgi?id=165748
3263
3264         Reviewed by Filip Pizlo.
3265
3266         Rolling back in r209653, r209654, r209663, and r209673.
3267
3268         * wtf/Platform.h:
3269
3270 2016-12-12  Commit Queue  <commit-queue@webkit.org>
3271
3272         Unreviewed, rolling out r209703.
3273         https://bugs.webkit.org/show_bug.cgi?id=165749
3274
3275         Broke Apple builds (Requested by annulen|home on #webkit).
3276
3277         Reverted changeset:
3278
3279         "Unreviewed, use WTF_ATTRIBUTE_PRINTF instead of clang pragma"
3280         http://trac.webkit.org/changeset/209703
3281
3282 2016-12-12  Konstantin Tokarev  <annulen@yandex.ru>
3283
3284         Unreviewed, use WTF_ATTRIBUTE_PRINTF instead of clang pragma
3285
3286         * wtf/PrintStream.cpp:
3287         (WTF::PrintStream::printfVariableFormat):
3288         * wtf/PrintStream.h:
3289
3290 2016-12-11  Konstantin Tokarev  <annulen@yandex.ru>
3291
3292         Unreviewed, guarded clang pragma with COMPILER(CLANG) to fix -Werror
3293
3294         * wtf/PrintStream.cpp:
3295         (WTF::PrintStream::printfVariableFormat):
3296
3297 2016-12-11  Filip Pizlo  <fpizlo@apple.com>
3298
3299         Change to use #pragma once (requested by Darin Adler).
3300
3301         * wtf/RecursiveLockAdapter.h:
3302
3303 2016-12-11  Filip Pizlo  <fpizlo@apple.com>
3304
3305         Change to use #pragma once (requested by Darin Adler).
3306
3307         * wtf/LockedPrintStream.h:
3308
3309 2016-12-10  Filip Pizlo  <fpizlo@apple.com>
3310
3311         MarkedBlock::marksConveyLivenessDuringMarking should take into account collection scope
3312         https://bugs.webkit.org/show_bug.cgi?id=165741
3313
3314         Reviewed by Saam Barati.
3315         
3316         To find this bug, I needed to seriously beef up our logging infrastructure.
3317         
3318         It's now the case that:
3319         
3320             dataLog(...);
3321         
3322         will print its output atomically. This happens with some careful magic:
3323         
3324         - dataFile() is now a LockedPrintStream that locks around print().
3325         
3326         - The lock is a recursive lock via RecursiveLockAdapter<>, so if the dump methods end
3327           up calling back into dataLog() then it just works. This is important: say the dump()
3328           calls a getter that itself does logging, maybe because it's encountering badness and
3329           wants to report it before crashing).
3330         
3331         - The lock is a WordLock so that ParkingLot and Lock can keep using dataLog() for
3332           debugging. We probably won't need to debug WordLock anytime soon - the algorithm is
3333           so simple.
3334         
3335         - LockedPrintStream::print(...) causes the print callbacks of its arguments to run on
3336           the underlying PrintStream, so that you don't need to do recursive lock acquisition
3337           on each individual argument and whatever printing it does recursively.
3338
3339         * WTF.xcodeproj/project.pbxproj:
3340         * wtf/CMakeLists.txt:
3341         * wtf/DataLog.cpp:
3342         (WTF::initializeLogFileOnce):
3343         (WTF::initializeLogFile):
3344         (WTF::dataFile):
3345         * wtf/DataLog.h:
3346         * wtf/LockedPrintStream.cpp: Added.
3347         (WTF::LockedPrintStream::LockedPrintStream):
3348         (WTF::LockedPrintStream::~LockedPrintStream):
3349         (WTF::LockedPrintStream::vprintf):
3350         (WTF::LockedPrintStream::flush):
3351         (WTF::LockedPrintStream::begin):
3352         (WTF::LockedPrintStream::end):
3353         * wtf/LockedPrintStream.h: Added.
3354         * wtf/PrintStream.cpp:
3355         (WTF::PrintStream::printfVariableFormat):
3356         (WTF::PrintStream::begin):
3357         (WTF::PrintStream::end):
3358         * wtf/PrintStream.h:
3359         (WTF::PrintStream::atomically):
3360         (WTF::PrintStream::print):
3361         (WTF::PrintStream::println):
3362         (WTF::PrintStream::printImpl):
3363         (WTF::>::unpack):
3364         (WTF::FormatImpl::FormatImpl):
3365         (WTF::FormatImpl::dump):
3366         (WTF::format):
3367         (WTF::printInternal):
3368         * wtf/RecursiveLockAdapter.h: Added.
3369         (WTF::RecursiveLockAdapter::RecursiveLockAdapter):
3370         (WTF::RecursiveLockAdapter::lock):
3371         (WTF::RecursiveLockAdapter::unlock):
3372         (WTF::RecursiveLockAdapter::tryLock):
3373         (WTF::RecursiveLockAdapter::isLocked):
3374         * wtf/WordLock.cpp:
3375         * wtf/WordLock.h:
3376
3377 2016-12-11  Darin Adler  <darin@apple.com>
3378
3379         Use std::vsnprintf instead of vasprintf
3380         https://bugs.webkit.org/show_bug.cgi?id=165740
3381
3382         Reviewed by Sam Weinig.
3383
3384         * wtf/Platform.h: Remove HAVE_VASPRINTF.
3385         * wtf/StringExtras.h: Change the vsnprintf workaround to be used only
3386         in older versions of Visual Studio, since the problem it works around
3387         was resolved in Visual Studio 2015.
3388
3389 2016-12-10  Commit Queue  <commit-queue@webkit.org>
3390
3391         Unreviewed, rolling out r209653, r209654, r209663, and
3392         r209673.
3393         https://bugs.webkit.org/show_bug.cgi?id=165739
3394
3395         speedometer crashes (Requested by pizlo on #webkit).
3396
3397         Reverted changesets:
3398
3399         "JSVALUE64: Pass arguments in platform argument registers when
3400         making JavaScript calls"
3401         https://bugs.webkit.org/show_bug.cgi?id=160355
3402         http://trac.webkit.org/changeset/209653
3403
3404         "Unreviewed build fix for 32 bit builds."
3405         http://trac.webkit.org/changeset/209654
3406
3407         "Unreviewed build fix for the CLOOP after r209653"
3408         http://trac.webkit.org/changeset/209663
3409
3410         "REGRESSION(r209653) Crash in CallFrameShuffler::snapshot()"
3411         https://bugs.webkit.org/show_bug.cgi?id=165728
3412         http://trac.webkit.org/changeset/209673
3413
3414 2016-12-10  Chris Dumez  <cdumez@apple.com>
3415
3416         Avoid calling shrink() in the Vector destructor
3417         https://bugs.webkit.org/show_bug.cgi?id=165675
3418
3419         Reviewed by Daniel Bates.
3420
3421         Avoid calling shrink() in the Vector destructor to avoid function call
3422         overhead and unnecessarily reseting m_size to 0.
3423
3424         * wtf/Vector.h:
3425         (WTF::Vector::~Vector):
3426         (WTF::Vector::asanSetBufferSizeToFullCapacity):
3427         (WTF::minCapacity>::asanSetBufferSizeToFullCapacity):
3428
3429 2016-12-09  Michael Saboff  <msaboff@apple.com>
3430
3431         JSVALUE64: Pass arguments in platform argument registers when making JavaScript calls
3432         https://bugs.webkit.org/show_bug.cgi?id=160355
3433
3434         Reviewed by Filip Pizlo.
3435
3436         Added a new build option ENABLE_VM_COUNTERS to enable JIT'able counters.
3437         The default is for the option to be off.
3438
3439         * wtf/Platform.h:
3440         Added ENABLE_VM_COUNTERS
3441
3442 2016-12-09  Geoffrey Garen  <ggaren@apple.com>
3443
3444         Deploy OrdinalNumber in JSC::SourceCode
3445         https://bugs.webkit.org/show_bug.cgi?id=165687
3446
3447         Reviewed by Michael Saboff.
3448
3449         * wtf/text/OrdinalNumber.h:
3450         (WTF::OrdinalNumber::operator>): Added a >.
3451
3452 2016-12-09  Geoffrey Garen  <ggaren@apple.com>
3453
3454         TextPosition and OrdinalNumber should be more like idiomatic numbers
3455         https://bugs.webkit.org/show_bug.cgi?id=165678
3456
3457         Reviewed by Filip Pizlo.
3458
3459         * wtf/text/TextPosition.h:
3460         (WTF::TextPosition::minimumPosition): Deleted. Just use the default
3461         constructor. Other numbers use their default constructors to mean zero.
3462
3463         Any time you need a comment that says "used as a default value", that's
3464         a pretty good indicator that it should be the default constructor.
3465
3466 2016-12-09  Geoffrey Garen  <ggaren@apple.com>
3467
3468         Moved OrdinalNumber into its own file
3469         https://bugs.webkit.org/show_bug.cgi?id=165663
3470
3471         Reviewed by Saam Barati.
3472
3473         * WTF.xcodeproj/project.pbxproj:
3474         * wtf/text/OrdinalNumber.h: Copied from Source/WTF/wtf/text/TextPosition.h.
3475         (WTF::TextPosition::TextPosition): Deleted.
3476         (WTF::TextPosition::operator==): Deleted.
3477         (WTF::TextPosition::operator!=): Deleted.
3478         (WTF::TextPosition::minimumPosition): Deleted.
3479         (WTF::TextPosition::belowRangePosition): Deleted.
3480         * wtf/text/TextPosition.h:
3481         (WTF::OrdinalNumber::fromZeroBasedInt): Deleted.
3482         (WTF::OrdinalNumber::fromOneBasedInt): Deleted.
3483         (WTF::OrdinalNumber::OrdinalNumber): Deleted.
3484         (WTF::OrdinalNumber::zeroBasedInt): Deleted.
3485         (WTF::OrdinalNumber::oneBasedInt): Deleted.
3486         (WTF::OrdinalNumber::operator==): Deleted.
3487         (WTF::OrdinalNumber::operator!=): Deleted.
3488         (WTF::OrdinalNumber::first): Deleted.
3489         (WTF::OrdinalNumber::beforeFirst): Deleted.
3490
3491 2016-12-08  David Kilzer  <ddkilzer@apple.com>
3492
3493         Always check the return value of pthread_key_create()
3494         <https://webkit.org/b/165274>
3495
3496         Reviewed by Darin Adler.
3497
3498         * wtf/ThreadIdentifierDataPthreads.cpp:
3499         (WTF::ThreadIdentifierData::initializeOnce): Make the code more
3500         readable by assigning a variable to the result of
3501         pthread_key_create().  This matches the idiom used elsewhere.
3502
3503 2016-12-08  Keith Miller  <keith_miller@apple.com>
3504
3505         Add 64-bit signed LEB decode method
3506         https://bugs.webkit.org/show_bug.cgi?id=165630
3507
3508         Reviewed by Ryosuke Niwa.
3509
3510         Add int64 LEB decode and fix some 64-bit specific issues
3511         with the decoder. There is also a fix where we would allow
3512         LEBs with canonical length + 1 size that is fixed by this
3513         patch.
3514
3515         * wtf/LEBDecoder.h:
3516         (WTF::LEBDecoder::decodeUInt):
3517         (WTF::LEBDecoder::decodeInt):
3518         (WTF::LEBDecoder::decodeUInt32):
3519         (WTF::LEBDecoder::decodeUInt64):
3520         (WTF::LEBDecoder::decodeInt32):
3521         (WTF::LEBDecoder::decodeInt64):
3522
3523 2016-12-08  Anders Carlsson  <andersca@apple.com>
3524
3525         Defer sending Mach messages if the queue is full
3526         https://bugs.webkit.org/show_bug.cgi?id=165622
3527         rdar://problem/29518036
3528
3529         Reviewed by Brady Eidson.
3530
3531         Add new SPI.
3532
3533         * wtf/spi/darwin/XPCSPI.h:
3534
3535 2016-12-06  Filip Pizlo  <fpizlo@apple.com>
3536
3537         Concurrent GC should be stable enough to land enabled on X86_64
3538         https://bugs.webkit.org/show_bug.cgi?id=164990
3539
3540         Reviewed by Geoffrey Garen.
3541         
3542         Adds the ability to say:
3543         
3544         auto locker = holdLock(any type of lock)
3545         
3546         Instead of having to say:
3547         
3548         Locker<LockType> locker(locks of type LockType)
3549         
3550         I think that we should use "auto locker = holdLock(lock)" as the default way that we acquire
3551         locks unless we need to use a special locker type.
3552         
3553         This also adds the ability to safepoint a lock. Safepointing a lock is basically a super fast
3554         way of unlocking it fairly and then immediately relocking it - i.e. letting anyone who is
3555         waiting to run without losing steam of there is noone waiting.
3556
3557         * wtf/Lock.cpp:
3558         (WTF::LockBase::safepointSlow):
3559         * wtf/Lock.h:
3560         (WTF::LockBase::safepoint):
3561         * wtf/LockAlgorithm.h:
3562         (WTF::LockAlgorithm::safepointFast):
3563         (WTF::LockAlgorithm::safepoint):
3564         (WTF::LockAlgorithm::safepointSlow):
3565         * wtf/Locker.h:
3566         (WTF::AbstractLocker::AbstractLocker):
3567         (WTF::Locker::tryLock):
3568         (WTF::Locker::operator bool):
3569         (WTF::Locker::Locker):
3570         (WTF::Locker::operator=):
3571         (WTF::holdLock):
3572         (WTF::tryHoldLock):
3573
3574 2016-12-08  Chris Dumez  <cdumez@apple.com>
3575
3576         Unreviewed, rolling out r209489.
3577
3578         Likely caused large regressions on JetStream, Sunspider and
3579         Speedometer
3580
3581         Reverted changeset:
3582
3583         "Add system trace points for JavaScript VM entry/exit"
3584         https://bugs.webkit.org/show_bug.cgi?id=165550
3585         http://trac.webkit.org/changeset/209489
3586
3587 2016-12-07  Simon Fraser  <simon.fraser@apple.com>
3588
3589         Add system trace points for JavaScript VM entry/exit
3590         https://bugs.webkit.org/show_bug.cgi?id=165550
3591
3592         Reviewed by Tim Horton.
3593         
3594         Add trace points for entry/exit into/out of the JS VM.
3595
3596         * wtf/SystemTracing.h:
3597
3598 2016-12-06  Alexey Proskuryakov  <ap@apple.com>
3599
3600         Correct SDKROOT values in xcconfig files
3601         https://bugs.webkit.org/show_bug.cgi?id=165487</