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