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