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