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