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