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