b888d81a9c1e2b65f875734f59d0e236fe8206df
[WebKit-https.git] / Source / WTF / ChangeLog
1 2018-03-08  Zan Dobersek  <zdobersek@igalia.com>
2
3         [GLib] RunLoop::wakeUp(): use a zero value instead of the monotonic time
4         https://bugs.webkit.org/show_bug.cgi?id=183447
5
6         Reviewed by Carlos Garcia Campos.
7
8         * wtf/glib/RunLoopGLib.cpp:
9         (WTF::RunLoop::wakeUp): Micro-optimize the wake-up schedule by using
10         a zero value as the GSource ready time, instead of retrieving and using
11         the current monotonic time.
12
13 2018-03-08  Tim Horton  <timothy_horton@apple.com>
14
15         Don't have Celestial in minimal simulator configuration
16         https://bugs.webkit.org/show_bug.cgi?id=183432
17         <rdar://problem/38252985>
18
19         Reviewed by Dan Bernstein.
20
21         * wtf/Platform.h:
22
23 2018-03-06  Yusuke Suzuki  <utatane.tea@gmail.com>
24
25         [WTF] Set canInitializeWithMemset = true if T is an integral type
26         https://bugs.webkit.org/show_bug.cgi?id=183357
27
28         Reviewed by Darin Adler.
29
30         This patch set `canInitializeWithMemset = true` if T is an integral type.
31         This can offer a chance to use memset if we use UniqueArray<T> where T is
32         an integral type. We also rename VectorTypeOperations::initialize to
33         VectorTypeOperations::initializeIfNonPOD, VectorTypeOperations::forceInitialize
34         to VectorTypeOperations::initialize respectively.
35
36         * wtf/RefCountedArray.h:
37         (WTF::RefCountedArray::RefCountedArray):
38         * wtf/UniqueArray.h:
39         * wtf/Vector.h:
40         (WTF::VectorTypeOperations::initializeIfNonPOD):
41         (WTF::VectorTypeOperations::initialize):
42         (WTF::Vector::Vector):
43         (WTF::Malloc>::resize):
44         (WTF::Malloc>::grow):
45         (WTF::VectorTypeOperations::forceInitialize): Deleted.
46         * wtf/VectorTraits.h:
47
48 2018-03-07  Keith Miller  <keith_miller@apple.com>
49
50         Meta-program setupArguments and callOperation
51         https://bugs.webkit.org/show_bug.cgi?id=183263
52
53         Rubber-stamped by Filip Pizlo.
54
55         Add a new function traits struct that provides interesting
56         information about the provided function pointer. Right now it only
57         provides information for function pointers, in theory we could
58         also get it to work for other types.
59
60         * WTF.xcodeproj/project.pbxproj:
61         * wtf/Bitmap.h:
62         (WTF::WordType>::Bitmap):
63         * wtf/CMakeLists.txt:
64         * wtf/FunctionTraits.h: Added.
65         (WTF::slotsForCCallArgument):
66         (WTF::computeCCallSlots):
67         (WTF::FunctionTraits<Result):
68
69 2018-03-07  Tim Horton  <timothy_horton@apple.com>
70
71         Shuffle around some feature flags for minimal simulator mode
72         https://bugs.webkit.org/show_bug.cgi?id=183419
73         <rdar://problem/37694987>
74
75         Reviewed by Beth Dakin.
76
77         * wtf/FeatureDefines.h:
78         * wtf/Platform.h:
79
80 2018-03-06  Mark Lam  <mark.lam@apple.com>
81
82         Prepare LLInt code to support pointer profiling.
83         https://bugs.webkit.org/show_bug.cgi?id=183387
84         <rdar://problem/38199678>
85
86         Reviewed by JF Bastien.
87
88         * wtf/Platform.h:
89
90 2018-03-06  Commit Queue  <commit-queue@webkit.org>
91
92         Unreviewed, rolling out r229330.
93         https://bugs.webkit.org/show_bug.cgi?id=183379
94
95         Broke some Apple internal code (Requested by ap on #webkit).
96
97         Reverted changeset:
98
99         "Remove unused crash hook functionality"
100         https://bugs.webkit.org/show_bug.cgi?id=183369
101         https://trac.webkit.org/changeset/229330
102
103 2018-03-06  Michael Catanzaro  <mcatanzaro@igalia.com>
104
105         Remove unused crash hook functionality
106         https://bugs.webkit.org/show_bug.cgi?id=183369
107
108         Reviewed by Alexey Proskuryakov.
109
110         WTFSetCrashHook and WTFInstallReportBacktraceOnCrashHook are not used on any platforms and
111         can be removed.
112
113         * wtf/Assertions.cpp:
114         * wtf/Assertions.h:
115
116 2018-03-05  Yusuke Suzuki  <utatane.tea@gmail.com>
117
118         Fix std::make_unique / new[] using system malloc
119         https://bugs.webkit.org/show_bug.cgi?id=182975
120
121         Reviewed by JF Bastien.
122
123         If we use `make_unique<char[]>(num)` or `new char[num]`, allocation is
124         done by the system malloc instead of bmalloc. This patch fixes this issue
125         by following three changes.
126
127         1. Introduce UniqueArray<T>. It allocates memory from FastMalloc. While C++
128         array with `new` need to hold the size to call destructor correctly, our
129         UniqueArray only supports type T which does not have a non trivial destructor.
130         It reduces the allocation size since we do not need to track the size of the
131         array compared to standard `new T[]`. This is basically usable if we want to
132         have raw array which pointer won't be changed even if the container is moved.
133         In addition, we also extend UniqueArray<T> for types which have non trivial
134         destructors.
135
136         2. Use Vector<T> instead.
137
138         3. Annotate allocated types with MAKE_FAST_ALLOCATED. Since it introduces
139         new[] and delete[] operators, make_unique<T[]>(num) will allocate memory
140         from FastMalloc.
141
142         * WTF.xcodeproj/project.pbxproj:
143         * wtf/Assertions.cpp:
144         * wtf/CMakeLists.txt:
145         * wtf/FastMalloc.h:
146         (WTF::FastFree::operator() const):
147         (WTF::FastFree<T::operator() const):
148         * wtf/MallocPtr.h:
149         (WTF::MallocPtr::operator bool const):
150         * wtf/StackShot.h:
151         (WTF::StackShot::StackShot):
152         (WTF::StackShot::operator=):
153         * wtf/SystemFree.h:
154         (WTF::SystemFree<T::operator() const):
155         * wtf/UniqueArray.h: Copied from Source/WebKit/Platform/win/LoggingWin.cpp.
156         (WTF::makeUniqueArray):
157         * wtf/Vector.h:
158         (WTF::VectorTypeOperations::forceInitialize):
159
160 2018-03-05  Michael Saboff  <msaboff@apple.com>
161
162         Start using MAP_JIT for macOS
163         https://bugs.webkit.org/show_bug.cgi?id=183353
164
165         Reviewed by Filip Pizlo.
166
167         Unify setting this flag for both iOS and macOS.
168
169         * wtf/OSAllocatorPosix.cpp:
170         (WTF::OSAllocator::reserveAndCommit):
171
172 2018-03-05  Yusuke Suzuki  <utatane.tea@gmail.com>
173
174         Unreviewed, follow-up after r229209
175         https://bugs.webkit.org/show_bug.cgi?id=183312
176
177         Add RELEASE_ASSERT to ensure success.
178
179         * wtf/cocoa/CPUTimeCocoa.mm:
180         (WTF::CPUTime::forCurrentThread):
181         * wtf/unix/CPUTimeUnix.cpp:
182         (WTF::CPUTime::forCurrentThread):
183         * wtf/win/CPUTimeWin.cpp:
184         (WTF::CPUTime::forCurrentThread):
185
186 2018-03-05  Yusuke Suzuki  <utatane.tea@gmail.com>
187
188         Unreviewed, fix MediaTime test
189         https://bugs.webkit.org/show_bug.cgi?id=183319
190
191         __builtin_xxx_overflow writes overflowed data into ResultType value even if overflow happens.
192         This is different from the original CheckedArithmetic semantics.
193
194         * wtf/CheckedArithmetic.h:
195
196 2018-03-04  Yusuke Suzuki  <utatane.tea@gmail.com>
197
198         [WTF] Move currentCPUTime and sleep(Seconds) to CPUTime.h and Seconds.h respectively
199         https://bugs.webkit.org/show_bug.cgi?id=183312
200
201         Reviewed by Mark Lam.
202
203         1. currentCPUTime to CPUTime.h. It is now defined as CPUTime::forCurrentThread.
204         We also removes fallback implementation for currentCPUTime since (1) that implementation
205         is wrong and (2) no environments we support needs this.
206
207         2. sleep(Seconds) to Seconds.h. Since sleep(MonotonicTime) and sleep(WallTime) are defined
208         in MonotonicTime.h and WallTime.h, this code move is natural.
209
210         3. Remove wtf/CurrentTime.h since nothing is defined now. But we keep CurrentTime.cpp to
211         consolidate various time-source implementations in one place.
212
213         * WTF.xcodeproj/project.pbxproj:
214         * benchmarks/ConditionSpeedTest.cpp:
215         * benchmarks/LockFairnessTest.cpp:
216         * benchmarks/LockSpeedTest.cpp:
217         * wtf/CMakeLists.txt:
218         * wtf/CPUTime.h:
219         * wtf/CurrentTime.cpp:
220         (WTF::currentCPUTime): Deleted.
221         (WTF::sleep): Deleted.
222         * wtf/CurrentTime.h: Removed.
223         * wtf/DateMath.cpp:
224         * wtf/DebugUtilities.h:
225         * wtf/FastMalloc.cpp:
226         * wtf/MainThread.cpp:
227         * wtf/MonotonicTime.cpp:
228         * wtf/ParkingLot.cpp:
229         * wtf/Seconds.cpp:
230         (WTF::sleep):
231         * wtf/Seconds.h:
232         * wtf/StackShotProfiler.h:
233         * wtf/Stopwatch.h:
234         * wtf/ThreadingPthreads.cpp:
235         * wtf/ThreadingWin.cpp:
236         * wtf/cocoa/CPUTimeCocoa.mm:
237         (WTF::CPUTime::forCurrentThread):
238         * wtf/cocoa/MemoryPressureHandlerCocoa.mm:
239         * wtf/linux/MemoryPressureHandlerLinux.cpp:
240         * wtf/unix/CPUTimeUnix.cpp:
241         (WTF::CPUTime::forCurrentThread):
242         * wtf/win/CPUTimeWin.cpp:
243         (WTF::CPUTime::forCurrentThread):
244         * wtf/win/RunLoopWin.cpp:
245
246 2018-03-04  Yusuke Suzuki  <utatane.tea@gmail.com>
247
248         [WTF] Use __builtin_xxx_overflow for CheckedArithmetic
249         https://bugs.webkit.org/show_bug.cgi?id=183319
250
251         Reviewed by Darin Adler.
252
253         GCC and Clang has the builtins for arithmetic operations with overflow flags.
254         CheckedArithmetic operations can be done with this builtins. Since the compiler
255         can use overflow flags, potentially this is more efficient. CheckedArithmetic
256         already has TestWebKitAPI tests and we ensured the tests pass.
257
258         * wtf/CheckedArithmetic.h:
259
260 2018-03-02  Yusuke Suzuki  <utatane.tea@gmail.com>
261
262         [WTF] Remove RunLoop and RunLoop::Timer's interface using double as seconds
263         https://bugs.webkit.org/show_bug.cgi?id=183293
264
265         Reviewed by Alex Christensen.
266
267         This patch mainly drops startRepeating(double) and startOneShot(double) interfaces.
268         Use startRepeating(Seconds) and startOneShot(Seconds) instead.
269
270         * wtf/MemoryPressureHandler.cpp:
271         (WTF::MemoryPressureHandler::setShouldUsePeriodicMemoryMonitor):
272         * wtf/RunLoop.h:
273         (WTF::RunLoop::TimerBase::startRepeating):
274         (WTF::RunLoop::TimerBase::startOneShot):
275         (WTF::RunLoop::TimerBase::startInternal):
276         * wtf/RunLoopTimer.h:
277         * wtf/RunLoopTimerCF.cpp:
278         (WTF::RunLoopTimerBase::start):
279         * wtf/cf/RunLoopCF.cpp:
280         (WTF::RunLoop::runForDuration):
281         (WTF::RunLoop::TimerBase::start):
282         * wtf/generic/RunLoopGeneric.cpp:
283         (WTF::RunLoop::TimerBase::start):
284         * wtf/glib/RunLoopGLib.cpp:
285         (WTF::RunLoop::TimerBase::start):
286         * wtf/win/MemoryPressureHandlerWin.cpp:
287         (WTF::MemoryPressureHandler::install):
288         * wtf/win/RunLoopWin.cpp:
289         (WTF::RunLoop::TimerBase::start):
290
291 2018-03-02  Christopher Reid  <chris.reid@sony.com>
292
293         Build fix after r229174
294         https://bugs.webkit.org/show_bug.cgi?id=183301
295
296         Reviewed by Alex Christensen.
297
298         Updating MemoryPressureHandler::holdOff to use Seconds instead of unsigned.
299
300         * wtf/MemoryPressureHandler.cpp:
301
302 2018-03-02  Tim Horton  <timothy_horton@apple.com>
303
304         Make it possible to build for iOS without Celestial
305         https://bugs.webkit.org/show_bug.cgi?id=183295
306         <rdar://problem/38074468>
307
308         Reviewed by Dan Bernstein.
309
310         * wtf/Platform.h:
311
312 2018-03-02  Tim Horton  <timothy_horton@apple.com>
313
314         Make it possible to disable WKPDFView
315         https://bugs.webkit.org/show_bug.cgi?id=183281
316         <rdar://problem/38060815>
317
318         Reviewed by Dan Bates.
319
320         * wtf/FeatureDefines.h:
321
322 2018-03-02  Yusuke Suzuki  <utatane.tea@gmail.com>
323
324         [JSC] Annotate more classes with WTF_MAKE_FAST_ALLOCATED
325         https://bugs.webkit.org/show_bug.cgi?id=183279
326
327         Reviewed by JF Bastien.
328
329         * wtf/SimpleStats.h:
330         * wtf/ThreadGroup.h:
331
332 2018-03-01  Yusuke Suzuki  <utatane.tea@gmail.com>
333
334         Remove monotonicallyIncreasingTime
335         https://bugs.webkit.org/show_bug.cgi?id=182911
336
337         Reviewed by Michael Catanzaro.
338
339         This patch drops monotonicallyIncreasingTime and monotonicallyIncreasingTimeMS.
340         We have MonotonicTime API instead. This offers strongly typed MonotonicTime,
341         Seconds etc. This reduces the chance of bugs mixing doubles which represent milliseconds
342         and seconds.
343
344         Large part of this patch is mechanical one: replacing monotonicallyIncreasingTime with
345         MonotonicTime, using MonotonicTime and Seconds instead of raw doubles.
346
347         But this patch actually finds some bugs (but it is a bit difficult to show it as a test).
348         One is mixing media time (CACurrentMediaTime()) and MonotonicTime. Basically they are
349         super close because both uses mach_absolute_time(). But they would be slightly different.
350         So we should not mix them.
351
352         The second bug is GraphicsLayer::suspendAnimations(double). While CA ports (Apple, AppleWin,
353         iOS etc.) use this double as MonotonicTime, GTK and WPE use this double as Seconds (timeOffset).
354         This patch fixes it and now the signature becomes GraphicsLayer::suspendAnimations(MonotonicTime).
355
356         In this patch, we still uses bunch of double for Seconds. But fixing them at this patch increases
357         the size of this larger and larger. So some of them remains double. This should be fixed in
358         subsequent patches.
359
360         * benchmarks/ConditionSpeedTest.cpp:
361         * benchmarks/LockSpeedTest.cpp:
362         * wtf/CurrentTime.cpp:
363         (WTF::MonotonicTime::now):
364         (WTF::monotonicallyIncreasingTime): Deleted.
365         * wtf/CurrentTime.h:
366         (WTF::monotonicallyIncreasingTimeMS): Deleted.
367         * wtf/MemoryPressureHandler.h:
368         * wtf/MonotonicTime.cpp:
369         (WTF::MonotonicTime::now): Deleted.
370         * wtf/MonotonicTime.h:
371         * wtf/ParkingLot.cpp:
372         * wtf/Seconds.h:
373         (WTF::Seconds::nan):
374         * wtf/Stopwatch.h:
375         (WTF::Stopwatch::reset):
376         (WTF::Stopwatch::start):
377         (WTF::Stopwatch::stop):
378         (WTF::Stopwatch::elapsedTime):
379         (WTF::Stopwatch::elapsedTimeSince):
380         * wtf/cocoa/MemoryPressureHandlerCocoa.mm:
381         (WTF::MemoryPressureHandler::holdOff):
382         (WTF::MemoryPressureHandler::respondToMemoryPressure):
383         * wtf/linux/MemoryPressureHandlerLinux.cpp:
384         (WTF::MemoryPressureHandler::EventFDPoller::EventFDPoller):
385         (WTF::MemoryPressureHandler::holdOff):
386         (WTF::MemoryPressureHandler::respondToMemoryPressure):
387         * wtf/win/MemoryPressureHandlerWin.cpp:
388         (WTF::MemoryPressureHandler::holdOff):
389
390 2018-03-02  Dan Bernstein  <mitz@apple.com>
391
392         Safari uses WebContent.Development when loading injected bundle embedded in its app bundle
393         https://bugs.webkit.org/show_bug.cgi?id=183275
394
395         Reviewed by Tim Horton.
396
397         * wtf/spi/cocoa/SecuritySPI.h: Declared SecTaskGetCodeSignStatus.
398
399 2018-02-27  Karlen Simonyan  <szkarlen@gmail.com>
400
401         [Win64] JSCOnly compile error using VS2017 and cmake
402         https://bugs.webkit.org/show_bug.cgi?id=183176
403
404         Reviewed by Alex Christensen.
405
406         * wtf/PlatformJSCOnly.cmake:
407
408 2018-02-26  Carlos Garcia Campos  <cgarcia@igalia.com>
409
410         [GStreamer] User current executable name instead of g_get_prgname() for gst_init
411         https://bugs.webkit.org/show_bug.cgi?id=183119
412
413         Reviewed by Philippe Normand.
414
415         Add getCurrentExecutableName() helper function to get the name of the current executable.
416
417         * wtf/glib/GLibUtilities.cpp:
418         (getCurrentExecutableName): Get the basename of getCurrentExecutablePath() falling back to g_get_prgname().
419         * wtf/glib/GLibUtilities.h:
420
421 2018-02-23  John Wilander  <wilander@apple.com>
422
423         Introduce ITP debug logging as an opt-in developer feature
424         https://bugs.webkit.org/show_bug.cgi?id=183065
425         <rdar://problem/37803761>
426
427         Reviewed by Brent Fulgham.
428
429         * wtf/Assertions.h:
430             Introduces RELEASE_LOG_INFO() and RELEASE_LOG_INFO_IF().
431
432 2018-02-23  Fujii Hironori  <Hironori.Fujii@sony.com>
433
434         warning: unused variable 'InitialBufferSize' in Assertions.cpp
435         https://bugs.webkit.org/show_bug.cgi?id=183076
436
437         Reviewed by Yusuke Suzuki.
438
439         * wtf/Assertions.cpp: Moved the definition of InitialBufferSize to inside #if.
440
441 2018-02-22  Yusuke Suzuki  <utatane.tea@gmail.com>
442
443         Remove currentTime() / currentTimeMS()
444         https://bugs.webkit.org/show_bug.cgi?id=183052
445
446         Reviewed by Mark Lam.
447
448         This patch removes WTF::currentTime() and WTF::currentTimeMS().
449         We have fancy WallTime APIs. It has strong types like WallTime and Seconds,
450         and this reduces the chance of bugs mixing doubles which represent milliseconds
451         and seconds.
452
453         * wtf/Condition.h:
454         * wtf/CurrentTime.cpp:
455         (WTF::currentTime):
456         (WTF::WallTime::now):
457         * wtf/CurrentTime.h:
458         (WTF::currentTimeMS): Deleted.
459         * wtf/DateMath.h:
460         (WTF::jsCurrentTime):
461         * wtf/ParkingLot.cpp:
462         (WTF::ParkingLot::parkConditionallyImpl):
463         * wtf/ThreadingPrimitives.h:
464         * wtf/ThreadingPthreads.cpp:
465         (WTF::ThreadCondition::timedWait):
466         * wtf/ThreadingWin.cpp:
467         (WTF::ThreadCondition::timedWait):
468         (WTF::absoluteTimeToWaitTimeoutInterval):
469         * wtf/WallTime.cpp:
470         (WTF::WallTime::now): Deleted.
471         * wtf/WallTime.h:
472
473 2018-02-22  Yusuke Suzuki  <utatane.tea@gmail.com>
474
475         Remove sleep(double) and sleepMS(double) interfaces
476         https://bugs.webkit.org/show_bug.cgi?id=183038
477
478         Reviewed by Mark Lam.
479
480         This patch removes sleep(double) and sleepMS(double) interfaces.
481         We can just use sleep(Seconds) instead.
482
483         * benchmarks/LockFairnessTest.cpp:
484         * benchmarks/LockSpeedTest.cpp:
485         * wtf/CurrentTime.cpp:
486         (WTF::sleep):
487         * wtf/CurrentTime.h:
488         (WTF::sleepMS): Deleted.
489         * wtf/DebugUtilities.h:
490         * wtf/Seconds.cpp:
491         (WTF::sleep): Deleted.
492         * wtf/Seconds.h:
493         * wtf/StackShotProfiler.h:
494
495 2018-02-21  Don Olmstead  <don.olmstead@sony.com>
496
497         [CMake][Win] Use cmakeconfig.h rather than config.h and Platform.h
498         https://bugs.webkit.org/show_bug.cgi?id=182883
499
500         Reviewed by Per Arne Vollan.
501
502         * wtf/Platform.h:
503
504 2018-02-14  Brian Burg  <bburg@apple.com>
505
506         Web Automation: combine session commands to resize and move top-level browsing contexts
507         https://bugs.webkit.org/show_bug.cgi?id=182749
508         <rdar://problem/37515170>
509
510         Reviewed by Andy Estes.
511
512         * wtf/JSONValues.h: add a getDouble() implementation that returns a std::optional<T>
513         rather than using an out-parameter. I'd like to move more code to this style.
514
515 2018-02-20  Tim Horton  <timothy_horton@apple.com>
516
517         Introduce HAVE(IOSURFACE_ACCELERATOR)
518         https://bugs.webkit.org/show_bug.cgi?id=182955
519         <rdar://problem/37699510>
520
521         Reviewed by Sam Weinig.
522
523         * wtf/Platform.h:
524
525 2018-02-20  Chris Dumez  <cdumez@apple.com>
526
527         Provisional load may get committed before receiving the decidePolicyForNavigationResponse response
528         https://bugs.webkit.org/show_bug.cgi?id=182720
529         <rdar://problem/37515204>
530
531         Reviewed by Alex Christensen.
532
533         Add convenience CompletionHandlerCallingScope class which calls its CompletionHandler
534         when destroyed, and provides a release() methods to manually call the completionHandler.
535
536         * wtf/CompletionHandler.h:
537         (WTF::CompletionHandlerCallingScope::CompletionHandlerCallingScope):
538         (WTF::CompletionHandlerCallingScope::~CompletionHandlerCallingScope):
539         (WTF::CompletionHandlerCallingScope::CompletionHandler<void):
540
541 2018-02-20  Tim Horton  <timothy_horton@apple.com>
542
543         Always inline soft linking functions to work around a clang bug
544         https://bugs.webkit.org/show_bug.cgi?id=182985
545         <rdar://problem/37587017>
546
547         Reviewed by Dan Bernstein.
548
549         * wtf/cocoa/SoftLinking.h:
550         In some cases, clang will emit a weak extern symbol for a re-declared
551         symbol that has availability attributes on it. To avoid this, always
552         inline to avoid emitting a second symbol.
553
554 2018-02-16  Dean Jackson  <dino@apple.com>
555
556         Use OPENGL macros to be more clear about which OpenGL/ES WebGL uses on Cocoa
557         https://bugs.webkit.org/show_bug.cgi?id=182894
558
559         Reviewed by Tim Horton.
560
561         If we're on a Cocoa platform, define USE_OPENGL/USE_OPENGL_ES
562         depending on what we're actually going to use. In this case,
563         they are exclusive, but it doesn't appear that other platforms
564         use this approach. Ultimately the idea is to be more concerned
565         with the type of OpenGL we're using, rather than the platform.
566
567         * wtf/Platform.h: Define USE_OPENGL(_ES) for PLATFORM(COCOA).
568
569 2018-02-16  Filip Pizlo  <fpizlo@apple.com>
570
571         Unreviewed, roll out r228306 (custom memcpy/memset) because the bots say that it was not a
572         progression.
573
574         * WTF.xcodeproj/project.pbxproj:
575         * wtf/BitVector.cpp:
576         (WTF::BitVector::setSlow):
577         (WTF::BitVector::clearAll):
578         (WTF::BitVector::resizeOutOfLine):
579         * wtf/BitVector.h:
580         (WTF::BitVector::OutOfLineBits::numWords const):
581         (WTF::BitVector::wordCount): Deleted.
582         * wtf/CMakeLists.txt:
583         * wtf/ConcurrentBuffer.h:
584         (WTF::ConcurrentBuffer::growExact):
585         * wtf/FastBitVector.h:
586         (WTF::FastBitVectorWordOwner::operator=):
587         (WTF::FastBitVectorWordOwner::clearAll):
588         (WTF::FastBitVectorWordOwner::set):
589         * wtf/FastCopy.h: Removed.
590         * wtf/FastMalloc.cpp:
591         (WTF::fastZeroedMalloc):
592         (WTF::fastStrDup):
593         (WTF::tryFastZeroedMalloc):
594         * wtf/FastZeroFill.h: Removed.
595         * wtf/OSAllocator.h:
596         (WTF::OSAllocator::reallocateCommitted):
597         * wtf/StringPrintStream.cpp:
598         (WTF::StringPrintStream::increaseSize):
599         * wtf/Vector.h:
600         * wtf/persistence/PersistentDecoder.cpp:
601         (WTF::Persistence::Decoder::decodeFixedLengthData):
602         * wtf/persistence/PersistentEncoder.cpp:
603         (WTF::Persistence::Encoder::encodeFixedLengthData):
604         * wtf/text/CString.cpp:
605         (WTF::CString::init):
606         (WTF::CString::copyBufferIfNeeded):
607         * wtf/text/LineBreakIteratorPoolICU.h:
608         (WTF::LineBreakIteratorPool::makeLocaleWithBreakKeyword):
609         * wtf/text/StringBuilder.cpp:
610         (WTF::StringBuilder::allocateBuffer):
611         (WTF::StringBuilder::append):
612         * wtf/text/StringConcatenate.h:
613         * wtf/text/StringImpl.h:
614         (WTF::StringImpl::copyCharacters):
615         * wtf/text/icu/UTextProvider.cpp:
616         (WTF::uTextCloneImpl):
617         * wtf/text/icu/UTextProviderLatin1.cpp:
618         (WTF::uTextLatin1Clone):
619         (WTF::openLatin1UTextProvider):
620         * wtf/threads/Signals.cpp:
621
622 2018-02-16  Keith Miller  <keith_miller@apple.com>
623
624         Remove unused line from Platform.h
625         https://bugs.webkit.org/show_bug.cgi?id=182871
626
627         Reviewed by Mark Lam.
628
629         * wtf/Platform.h:
630
631 2018-02-14  Michael Saboff  <msaboff@apple.com>
632
633         REGRESSION(225695) : com.apple.WebKit.WebContent at com.apple.JavaScriptCore: JSC::RegExp::match + 630 :: stack overflow
634         https://bugs.webkit.org/show_bug.cgi?id=182705
635
636         Reviewed by Mark Lam.
637
638         Moved the setting of ENABLE_YARR_JIT_ALL_PARENS_EXPRESSIONS to Platform.h since more than just the YARR
639         code needs to know if that feature is enabled.
640
641         * wtf/Platform.h:
642
643 2018-02-12  Mark Lam  <mark.lam@apple.com>
644
645         Add more support for pointer preparations.
646         https://bugs.webkit.org/show_bug.cgi?id=182703
647         <rdar://problem/37469451>
648
649         Reviewed by Saam Barati.
650
651         * wtf/PointerPreparations.h:
652
653 2018-02-09  Ross Kirsling  <ross.kirsling@sony.com>
654
655         Use REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR on any non-Windows port.
656         https://bugs.webkit.org/show_bug.cgi?id=182623
657
658         Reviewed by Alex Christensen.
659
660         * wtf/Platform.h:
661         Simplify #if.
662
663 2018-02-08  Filip Pizlo  <fpizlo@apple.com>
664
665         Experiment with alternative implementation of memcpy/memset
666         https://bugs.webkit.org/show_bug.cgi?id=182563
667
668         Reviewed by Michael Saboff and Mark Lam.
669         
670         Adds a faster x86_64-specific implementation of memcpy and memset. These versions go by
671         different names than memcpy/memset and have a different API:
672         
673         WTF::fastCopy<T>(T* dst, T* src, size_t N): copies N values of type T from src to dst.
674         WTF::fastZeroFill(T* dst, size_T N): writes N * sizeof(T) zeroes to dst.
675         
676         There are also *Bytes variants that take void* for dst and src and size_t numBytes. Those are
677         most appropriate in places where the code is already computing bytes.
678         
679         These will just call memcpy/memset on platforms where the optimized versions are not supported.
680         
681         These new functions are not known to the compiler to be memcpy/memset. This has the effect that
682         the compiler will not try to replace them with anything else. This could be good or bad:
683         
684         - It's *good* if the size is *not known* at compile time. In that case, by my benchmarks, these
685           versions are faster than either the memcpy/memset call or whatever else the compiler could
686           emit. This is because of a combination of inlining and the algorithm itself (see below).
687         
688         - It's *bad* if the size is *known* at compile time. In that case, the compiler could
689           potentially emit a fully unrolled memcpy/memset. That might not happen if the size is large
690           (even if it's known), but in this patch I avoid replacing any memcpy/memset calls when the
691           size is a constant. In particular, this totally avoids the call overhead -- if the size is
692           small, then the compiler will emit a nice inlined copy or set. If the size is large, then the
693           most optimal thing to do is emit the shortest piece of code possible, and that's a call to
694           memcpy/memset.
695         
696         It's unfortunate that you have to choose between them on your own. One way to avoid that might
697         have been to override the memcpy/memset symbols, so that the compiler can still do its
698         reasoning. But that's not quite right, since then we would lose inlining in the unknonw-size
699         case. Also, it's possible that for some unknown-size cases, the compiler could choose to emit
700         something on its own because it might think that some property of aliasing or alignment could
701         help it. I think it's a bit better to use our own copy/set implementations even in those cases.
702         Another way that I tried avoiding this is to detect inside fastCopy/fastZeroFill if the size is
703         constant. But there is no good way to do that in C++. There is a builtin for doing that inside a
704         macro, but that feels janky, so I didn't want to do it in this patch.
705         
706         The reason why these new fastCopy/fastZeroFill functions are faster is that:
707         
708         - They can be inlined. There is no function call. Only a few registers get clobbered. So, the
709           impact on the quality of the code surrounding the memcpy/memset is smaller.
710         
711         - They use type information to select the implementation. For sizes that are multiples of 2, 4,
712           or 8, the resulting code performs dramatically better on small arrays than memcpy because it
713           uses fewer cycles. The difference is greatest for 2 and 4 byte types, since memcpy usually
714           handles small arrays by tiering from a 8-byte word copy loop to a byte copy loop. So, for 2
715           or 4 byte arrays, we use an algorithm that tiers from 8-byte word down to a 2-byte or 4-byte
716           (depending on type) copy loop. So, for example, when copying a 16-bit string that has 1, 2, or
717           3 characters, this means doing 1, 2, or 3 word copies rather than 2, 4, or 6 byte copies. For
718           8-byte types, the resulting savings are mainly that there is no check to see if a tier-down to
719           the byte-copy loop is needed -- so really that means reducing code size. 1-byte types don't
720           get this inherent advantage over memcpy/memset, but they still benefit from all of the other
721           advantages of these functions. Of course, this advantage isn't inherent to our approach. The
722           compiler could also notice that the arguments to memcpy/memset have some alignment properties.
723           It could do it even more generally than we do - for example a copy over bytes where the size
724           is a multiple of 4 can use the 4-byte word algorithm. But based on my tests, the compiler does
725           not do this (even though it does other things, like turn a memset call with a zero value
726           argument into a bzero call).
727         
728         - They use a very nicely written word copy/set loop for small arrays. I spent a lot of time
729           getting the assembly just right. When we use memcpy/memset, sometimes we would optimize the
730           call by having a fast path word copy loop for small sizes. That's not necessary with this
731           implementation, since the assembly copy loop gets inlined.
732         
733         - They use `rep movs` or `rep stos` for copies of 200 bytes or more. This decision benchmarks
734           poorly on every synthetic memcpy/memset benchmark I have built, and so unsurprisingly, it's
735           not what system memcpy/memset does. Most system memcpy/memset implementations end up doing
736           some SSE for medium-sized copies,. However, I previously found that this decision is bad for
737           one of the memset calls in GC (see clearArray() and friends in ArrayConventions.h|cpp) - I was
738           able to make the overhead of that call virtually disappear by doing `rep stos` more
739           aggressively. The theory behind this change is that it's not just the GC that prefers smaller
740           `rep` threshold and no SSE. I am betting that `rep`ing more is better when the heap gets
741           chaotic and the data being copied is used in interesting ways -- hence, synthetic
742           memcpy/memset benchmarks think it's bad (they don't do enough chaotic memory accesses) while
743           it's good for real-world uses. Also, when I previously worked on JVMs, I had found that the
744           best memcpy/memset heuristics when dealing with GC'd objects in a crazy heap were different
745           than any memcpy/memset in any system library.
746         
747         This appears to be a 0.9% speed-up on PLT. I'm not sure if it's more because of the inlining or
748         the `rep`. I think it's both. I'll leave figuring out the exact tuning for future patches.
749
750         * wtf/BitVector.cpp:
751         (WTF::BitVector::setSlow):
752         (WTF::BitVector::clearAll):
753         (WTF::BitVector::resizeOutOfLine):
754         * wtf/BitVector.h:
755         (WTF::BitVector::wordCount):
756         (WTF::BitVector::OutOfLineBits::numWords const):
757         * wtf/ConcurrentBuffer.h:
758         (WTF::ConcurrentBuffer::growExact):
759         * wtf/FastBitVector.h:
760         (WTF::FastBitVectorWordOwner::operator=):
761         (WTF::FastBitVectorWordOwner::clearAll):
762         (WTF::FastBitVectorWordOwner::set):
763         * wtf/FastCopy.h: Added.
764         (WTF::fastCopy):
765         (WTF::fastCopyBytes):
766         * wtf/FastMalloc.cpp:
767         (WTF::fastZeroedMalloc):
768         (WTF::fastStrDup):
769         (WTF::tryFastZeroedMalloc):
770         * wtf/FastZeroFill.h: Added.
771         (WTF::fastZeroFill):
772         (WTF::fastZeroFillBytes):
773         * wtf/MD5.cpp:
774         * wtf/OSAllocator.h:
775         (WTF::OSAllocator::reallocateCommitted):
776         * wtf/StringPrintStream.cpp:
777         (WTF::StringPrintStream::increaseSize):
778         * wtf/Vector.h:
779         * wtf/persistence/PersistentDecoder.cpp:
780         (WTF::Persistence::Decoder::decodeFixedLengthData):
781         * wtf/persistence/PersistentEncoder.cpp:
782         (WTF::Persistence::Encoder::encodeFixedLengthData):
783         * wtf/text/CString.cpp:
784         (WTF::CString::init):
785         (WTF::CString::copyBufferIfNeeded):
786         * wtf/text/LineBreakIteratorPoolICU.h:
787         (WTF::LineBreakIteratorPool::makeLocaleWithBreakKeyword):
788         * wtf/text/StringBuilder.cpp:
789         (WTF::StringBuilder::allocateBuffer):
790         (WTF::StringBuilder::append):
791         * wtf/text/StringConcatenate.h:
792         * wtf/text/StringImpl.h:
793         (WTF::StringImpl::copyCharacters):
794         * wtf/text/icu/UTextProvider.cpp:
795         (WTF::uTextCloneImpl):
796         * wtf/text/icu/UTextProviderLatin1.cpp:
797         (WTF::uTextLatin1Clone):
798         (WTF::openLatin1UTextProvider):
799         * wtf/threads/Signals.cpp:
800
801 2018-02-06  Darin Adler  <darin@apple.com>
802
803         Event improvements
804         https://bugs.webkit.org/show_bug.cgi?id=179591
805
806         Reviewed by Chris Dumez.
807
808         * wtf/text/OrdinalNumber.h: Added som missing const.
809         * wtf/text/TextPosition.h: Ditto.
810
811 2018-02-06  Fujii Hironori  <Hironori.Fujii@sony.com>
812
813         [GTK] fast/events/message-channel-gc-4.html is flaky
814         https://bugs.webkit.org/show_bug.cgi?id=182104
815
816         Reviewed by Carlos Garcia Campos.
817
818         Revert r228001 because RunLoop::current isn't called in GC thread
819         anymore since r228152.
820
821         * wtf/RunLoop.cpp:
822         (WTF::RunLoop::current): Removed a template argument
823         CanBeGCThread::True of ThreadSpecific.
824
825 2018-02-05  Konstantin Tokarev  <annulen@yandex.ru>
826
827         [cmake] Fix build with ICU configured without collation support
828         https://bugs.webkit.org/show_bug.cgi?id=182498
829
830         Reviewed by Alex Christensen.
831
832         WebKit has CollatorDefault.cpp providing necessary stubs when
833         UCONFIG_NO_COLLATION is defined, however it is not included in cmake
834         file list.
835
836         * wtf/CMakeLists.txt:
837
838 2018-02-05  Alicia Boya GarcĂ­a  <aboya@igalia.com>
839
840         Fix bug in MediaTime comparison for negative values with different scale.
841         https://bugs.webkit.org/show_bug.cgi?id=182433
842
843         Reviewed by Xabier Rodriguez-Calvar.
844
845         * wtf/MediaTime.cpp:
846         (WTF::MediaTime::compare const):
847
848 2018-02-02  Mark Lam  <mark.lam@apple.com>
849
850         More ARM64_32 fixes.
851         https://bugs.webkit.org/show_bug.cgi?id=182441
852         <rdar://problem/37162310>
853
854         Reviewed by Dan Bernstein.
855
856         My previous speculative ARM64_32 build fix in copyLCharsFromUCharSource() was wrong.
857         I've now fixed it to choose the default implementation case instead of the ARM64
858         case if the target is ARM64_32.
859
860         * wtf/text/ASCIIFastPath.h:
861         (WTF::copyLCharsFromUCharSource):
862
863 2018-02-02  Konstantin Tokarev  <annulen@yandex.ru>
864
865         Unreviewed build fix for JSCOnly on macOS after r227845.
866         https://bugs.webkit.org/show_bug.cgi?id=182274
867
868         Reverted part of r227845 that moved CommonCryptoSPI.h
869         handling into PlatformMac, because it is needed for all
870         ports which can be built on macOS.
871
872         * wtf/CMakeLists.txt:
873         * wtf/PlatformMac.cmake:
874
875 2018-02-02  Fujii Hironori  <Hironori.Fujii@sony.com>
876
877         [GTK] fast/events/message-channel-gc-4.html is flaky
878         https://bugs.webkit.org/show_bug.cgi?id=182104
879
880         Reviewed by Carlos Garcia Campos.
881
882         RELEASE_ASSERT of ThreadSpecific::set fails because
883         RunLoop::current is called even in GC thread since r227275.
884
885         * wtf/RunLoop.cpp:
886         (WTF::RunLoop::current):
887         Let the second template argument of ThreadSpecific CanBeGCThread::True.
888
889 2018-02-01  Michael Catanzaro  <mcatanzaro@igalia.com>
890
891         [WPE][GTK] Make RunLoop::TimerBase robust to its own deletion inside its source callback
892         https://bugs.webkit.org/show_bug.cgi?id=182271
893
894         Reviewed by Carlos Garcia Campos.
895
896         RunLoopTimer::fired executes the user's callback, which could delete the RunLoopTimer
897         itself. But the source callback is not prepared to handle this case. We can detect it
898         easily, because TimerBase's destructor will call g_source_destroy(), which confusingly
899         removes the GSource from its GMainContext without actually destroying the GSource. Then we
900         can check if the GSource is still attached using g_source_is_destroyed().
901
902         * wtf/glib/RunLoopGLib.cpp:
903         (WTF::RunLoop::TimerBase::TimerBase):
904
905 2018-01-31  Saam Barati  <sbarati@apple.com>
906
907         Replace tryLargeMemalignVirtual with tryLargeZeroedMemalignVirtual and use it to allocate large zeroed memory in Wasm
908         https://bugs.webkit.org/show_bug.cgi?id=182064
909         <rdar://problem/36840132>
910
911         Reviewed by Geoffrey Garen.
912
913         * wtf/Gigacage.cpp:
914         (Gigacage::tryAllocateZeroedVirtualPages):
915         (Gigacage::freeVirtualPages):
916         (Gigacage::tryAllocateVirtualPages): Deleted.
917         * wtf/Gigacage.h:
918         * wtf/OSAllocator.h:
919
920 2018-01-31  Mark Lam  <mark.lam@apple.com>
921
922         Fix some ARM64_32 build failures.
923         https://bugs.webkit.org/show_bug.cgi?id=182356
924         <rdar://problem/37057690>
925
926         Reviewed by Michael Saboff.
927
928         * wtf/MathExtras.h:
929         (WTF::dynamicPoison):
930         * wtf/text/ASCIIFastPath.h:
931         (WTF::copyLCharsFromUCharSource):
932
933 2018-01-30  Mark Lam  <mark.lam@apple.com>
934
935         Apply poisoning to TypedArray vector pointers.
936         https://bugs.webkit.org/show_bug.cgi?id=182155
937         <rdar://problem/36286266>
938
939         Reviewed by JF Bastien.
940
941         1. Added the ability to poison a CagedPtr.
942
943         2. Prevent CagedPtr from being implicitly instantiated, and add operator= methods
944            instead.  This is because implicitly instantiated CagedPtrs with a poisoned
945            trait may silently use a wrong poison value.
946
947         * wtf/CagedPtr.h:
948         (WTF::CagedPtr::CagedPtr):
949         (WTF::CagedPtr::get const):
950         (WTF::CagedPtr::operator=):
951
952 2018-01-30  Fujii Hironori  <Hironori.Fujii@sony.com>
953
954         [Win] Warning fix.
955         https://bugs.webkit.org/show_bug.cgi?id=177007
956
957         Reviewed by Yusuke Suzuki.
958
959         A 32 bit integer should not be casted to a pointer directly in 64
960         bit Windows. It should be casted to a uintptr_t beforehand.
961
962         Rules for Using Pointers (Windows)
963         https://msdn.microsoft.com/library/windows/desktop/aa384242
964
965         * wtf/ThreadingWin.cpp (InvalidThread): Casted 0xbbadbeef to uintptr_t.
966
967 2018-01-30  Don Olmstead  <don.olmstead@sony.com>
968
969         Unreviewed build fix for JSCOnly after r227845.
970         https://bugs.webkit.org/show_bug.cgi?id=182274
971
972         * wtf/PlatformJSCOnly.cmake:
973
974 2018-01-30  Don Olmstead  <don.olmstead@sony.com>
975
976         [CMake] Make WTF headers copies
977         https://bugs.webkit.org/show_bug.cgi?id=182274
978
979         Reviewed by Alex Christensen.
980
981         * wtf/CMakeLists.txt:
982         * wtf/PlatformGTK.cmake:
983         * wtf/PlatformJSCOnly.cmake:
984         * wtf/PlatformMac.cmake:
985         * wtf/PlatformWPE.cmake:
986         * wtf/PlatformWin.cmake:
987
988 2018-01-30  Mark Lam  <mark.lam@apple.com>
989
990         Move ENABLE_POISON to Platform.h.
991         https://bugs.webkit.org/show_bug.cgi?id=182298
992         <rdar://problem/37032686>
993
994         Reviewed by Michael Saboff and JF Bastien.
995
996         ENABLE_POISON belongs in Platform.h to ensure that all places that depend on
997         ENABLE(POISON) will see it properly defined.
998
999         * wtf/Platform.h:
1000         * wtf/Poisoned.h:
1001
1002 2018-01-26  Mark Lam  <mark.lam@apple.com>
1003
1004         Add infrastructure for pointer preparation.
1005         https://bugs.webkit.org/show_bug.cgi?id=182191
1006         <rdar://problem/36889194>
1007
1008         Reviewed by JF Bastien.
1009
1010         * WTF.xcodeproj/project.pbxproj:
1011         * wtf/CMakeLists.txt:
1012         * wtf/PointerPreparations.h: Added.
1013
1014 2018-01-26  Chris Nardi  <cnardi@chromium.org>
1015
1016         Addressing post-review comments after r226614
1017         https://bugs.webkit.org/show_bug.cgi?id=182151
1018
1019         Reviewed by Myles C. Maxfield.
1020
1021         * wtf/text/StringImpl.h:
1022         (WTF::isSpaceOrNewline):
1023         * wtf/text/TextBreakIterator.cpp:
1024         (WTF::numCodeUnitsInGraphemeClusters):
1025         * wtf/text/TextBreakIterator.h:
1026
1027 2018-01-26  Filip Pizlo  <fpizlo@apple.com>
1028
1029         Fix style - need to use C comments.
1030
1031         * wtf/Platform.h:
1032
1033 2018-01-26  Filip Pizlo  <fpizlo@apple.com>
1034
1035         Disable TLS-based TLCs
1036         https://bugs.webkit.org/show_bug.cgi?id=182175
1037
1038         Reviewed by Saam Barati.
1039
1040         Add a flag for TLS-based TLCs and set it to 0. We can re-enable this feature when we need to use TLCs for
1041         actual thread-local allocation and when we fix the fact that WebCore context switches JSC VMs without telling
1042         us.
1043
1044         * wtf/Platform.h:
1045
1046 2018-01-25  Filip Pizlo  <fpizlo@apple.com>
1047
1048         Unreviewed, fix windows build.
1049
1050         * wtf/MathExtras.h:
1051         (WTF::opaque):
1052
1053 2018-01-24  Filip Pizlo  <fpizlo@apple.com>
1054
1055         DirectArguments should protect itself using dynamic poisoning and precise index masking
1056         https://bugs.webkit.org/show_bug.cgi?id=182086
1057
1058         Reviewed by Saam Barati.
1059         
1060         Add helpers for:
1061         
1062         Dynamic poisoning: this means arranging to have the pointer you will dereference become an
1063         invalid pointer if the type check you were relying on would have failed.
1064         
1065         Precise index masking: a variant of index masking that does not depend on distancing. I figured
1066         I'd just try this first for DirectArguments, since I didn't think that arguments[i] was ever
1067         hot enough to warrant anything better. Turns out that in all of the benchmarks that care about
1068         arguments performance, we optimize things to the point that the index masking isn't on a hot
1069         path anymore. Turns out, it's neutral!
1070
1071         * wtf/MathExtras.h:
1072         (WTF::preciseIndexMask):
1073         (WTF::dynamicPoison):
1074
1075 2018-01-25  Jer Noble  <jer.noble@apple.com>
1076
1077         Unreviewed build fix after r227631; make USE_VIDEOTOOLBOX universally enabled on iOS.
1078
1079         * wtf/Platform.h:
1080
1081 2018-01-25  Jer Noble  <jer.noble@apple.com>
1082
1083         Move ImageDecoderAVFObjC from using AVSampleBufferGenerator to AVAssetReaderOutput for parsing
1084         https://bugs.webkit.org/show_bug.cgi?id=182091
1085
1086         Reviewed by Eric Carlson.
1087
1088         * wtf/Platform.h:
1089
1090 2018-01-25  Mark Lam  <mark.lam@apple.com>
1091
1092         Rename the Poisoned::isPoisoned constant to Poisoned::isPoisonedType.
1093         https://bugs.webkit.org/show_bug.cgi?id=182143
1094         <rdar://problem/36880970>
1095
1096         Reviewed by JF Bastien.
1097
1098         This is so that it doesn't conflict with the isPoisoned() debugging methods that
1099         are normally not built.  Also renamed PoisonedUniquePtr::isPoisonedUniquePtr to
1100         PoisonedUniquePtr::isPoisonedUniquePtrType to be consistent.
1101
1102         * wtf/Poisoned.h:
1103         * wtf/PoisonedUniquePtr.h:
1104
1105 2018-01-25  Filip Pizlo  <fpizlo@apple.com>
1106
1107         JSC GC should support TLCs (thread local caches)
1108         https://bugs.webkit.org/show_bug.cgi?id=181559
1109
1110         Reviewed by Mark Lam and Saam Barati.
1111
1112         * wtf/Bitmap.h: Just fixing a compile error.
1113
1114 2018-01-25  Commit Queue  <commit-queue@webkit.org>
1115
1116         Unreviewed, rolling out r227592.
1117         https://bugs.webkit.org/show_bug.cgi?id=182110
1118
1119         it made ARM64 (Linux and iOS) crash (Requested by pizlo-mbp on
1120         #webkit).
1121
1122         Reverted changeset:
1123
1124         "JSC GC should support TLCs (thread local caches)"
1125         https://bugs.webkit.org/show_bug.cgi?id=181559
1126         https://trac.webkit.org/changeset/227592
1127
1128 2018-01-20  Filip Pizlo  <fpizlo@apple.com>
1129
1130         JSC GC should support TLCs (thread local caches)
1131         https://bugs.webkit.org/show_bug.cgi?id=181559
1132
1133         Reviewed by Mark Lam and Saam Barati.
1134
1135         * wtf/Bitmap.h: Just fixing a compile error.
1136
1137 2018-01-23  Mark Lam  <mark.lam@apple.com>
1138
1139         Update Poisoned pointers to take a Poison class instead of a uintptr_t&.
1140         https://bugs.webkit.org/show_bug.cgi?id=182017
1141         <rdar://problem/36795513>
1142
1143         Reviewed by Filip Pizlo and JF Bastien.
1144
1145         This paves the way for custom poison values which we'll need for use in
1146         TypedArrays later.
1147
1148         * wtf/Bag.h:
1149         * wtf/DumbPtrTraits.h:
1150         (WTF::DumbPtrTraits::poison): Deleted.
1151         * wtf/DumbValueTraits.h:
1152         (WTF::DumbValueTraits::poison): Deleted.
1153         * wtf/Poisoned.h:
1154         (WTF::Poison::key):
1155         (WTF::Poisoned::swap):
1156         (WTF::Poisoned::poison const):
1157         (WTF::Poisoned::unpoison const):
1158         (WTF::Poisoned::poison):
1159         (WTF::Poisoned::unpoison):
1160         (WTF::PoisonedPtrTraits::swap):
1161         (WTF::PoisonedValueTraits::swap):
1162         (WTF::PoisonedPtrTraits::poison): Deleted.
1163         (WTF::PoisonedValueTraits::poison): Deleted.
1164         * wtf/PoisonedUniquePtr.h:
1165         * wtf/Ref.h:
1166         * wtf/RefCountedArray.h:
1167         * wtf/RefPtr.h:
1168         * wtf/WTFAssertions.cpp:
1169
1170 2018-01-23  Alex Christensen  <achristensen@webkit.org>
1171
1172         Remove pre-Sierra-OS-specific code in WTF and JavaScriptCore
1173         https://bugs.webkit.org/show_bug.cgi?id=182028
1174
1175         Reviewed by Keith Miller.
1176
1177         * wtf/Platform.h:
1178         * wtf/mac/AppKitCompatibilityDeclarations.h:
1179         * wtf/mac/DeprecatedSymbolsUsedBySafari.mm:
1180         (WTF::MainThreadFunctionTracker::singleton): Deleted.
1181         (WTF::MainThreadFunctionTracker::callOnMainThread): Deleted.
1182         (WTF::MainThreadFunctionTracker::cancelCallOnMainThread): Deleted.
1183         (WTF::MainThreadFunctionTracker::addFunction): Deleted.
1184         (WTF::MainThreadFunctionTracker::removeIdentifier): Deleted.
1185         (WTF::MainThreadFunctionTracker::removeFunctions): Deleted.
1186         (WTF::callOnMainThread): Deleted.
1187         (WTF::cancelCallOnMainThread): Deleted.
1188         * wtf/spi/cocoa/SecuritySPI.h:
1189         * wtf/spi/darwin/dyldSPI.h:
1190         * wtf/text/icu/TextBreakIteratorICU.h:
1191         (WTF::TextBreakIteratorICU::TextBreakIteratorICU):
1192         (WTF::caretRules): Deleted.
1193
1194 2018-01-23  Filip Pizlo  <fpizlo@apple.com>
1195
1196         JSC should use a speculation fence on VM entry/exit
1197         https://bugs.webkit.org/show_bug.cgi?id=181991
1198
1199         Reviewed by JF Bastien and Mark Lam.
1200         
1201         Implement speculationFence as lfence on x86 and isb on ARM64. I'm not sure if isb is
1202         appropriate for all ARM64's.
1203
1204         * wtf/Atomics.h:
1205         (WTF::speculationFence):
1206         (WTF::x86_lfence):
1207
1208 2018-01-22  Alex Christensen  <achristensen@webkit.org>
1209
1210         Begin removing QTKit code
1211         https://bugs.webkit.org/show_bug.cgi?id=181951
1212
1213         Reviewed by Jer Noble.
1214
1215         * wtf/Platform.h:
1216
1217 2018-01-21  Wenson Hsieh  <wenson_hsieh@apple.com>
1218
1219         Add a new feature flag for EXTRA_ZOOM_MODE and reintroduce AdditionalFeatureDefines.h
1220         https://bugs.webkit.org/show_bug.cgi?id=181918
1221
1222         Reviewed by Tim Horton.
1223
1224         Include AdditionalFeatureDefines.h, if possible. This allows WebKitAdditions to override
1225         the value of certain feature flags in the OpenSource WebKit repository.
1226
1227         * wtf/Platform.h:
1228
1229 2018-01-19  Alex Christensen  <achristensen@webkit.org>
1230
1231         Fix jsc-only build
1232         https://bugs.webkit.org/show_bug.cgi?id=181874
1233
1234         Reviewed by JF Bastien.
1235
1236         This makes "build-webkit --jsc-only" work on Mac!
1237
1238         * wtf/PlatformJSCOnly.cmake:
1239
1240 2018-01-19  Keith Miller  <keith_miller@apple.com>
1241
1242         HaveInternalSDK includes should be "#include?"
1243         https://bugs.webkit.org/show_bug.cgi?id=179670
1244
1245         Reviewed by Dan Bernstein.
1246
1247         * Configurations/Base.xcconfig:
1248
1249 2018-01-19  Alexey Proskuryakov  <ap@apple.com>
1250
1251         Update XPCSPI.h
1252         https://bugs.webkit.org/show_bug.cgi?id=181827
1253         rdar://problem/36393031
1254
1255         Reviewed by Daniel Bates.
1256
1257         * wtf/spi/darwin/XPCSPI.h:
1258
1259 2018-01-18  Chris Dumez  <cdumez@apple.com>
1260
1261         We should be able to terminate service workers that are unresponsive
1262         https://bugs.webkit.org/show_bug.cgi?id=181563
1263         <rdar://problem/35280031>
1264
1265         Reviewed by Alex Christensen.
1266
1267         * wtf/ObjectIdentifier.h:
1268         (WTF::ObjectIdentifier::loggingString const):
1269         Allow using loggingString() from RELEASE_LOG().
1270
1271 2018-01-18  Dan Bernstein  <mitz@apple.com>
1272
1273         [Xcode] Streamline and future-proof target-macOS-version-dependent build setting definitions
1274         https://bugs.webkit.org/show_bug.cgi?id=181803
1275
1276         Reviewed by Tim Horton.
1277
1278         * Configurations/Base.xcconfig: Updated.
1279         * Configurations/DebugRelease.xcconfig: Updated.
1280
1281 2018-01-17  Daniel Bates  <dabates@apple.com>
1282
1283         REGRESSION (r222795): Cardiogram never signs in
1284         https://bugs.webkit.org/show_bug.cgi?id=181693
1285         <rdar://problem/36286293>
1286
1287         Reviewed by Ryosuke Niwa.
1288
1289         Add macro define for future iOS.
1290
1291         * wtf/spi/darwin/dyldSPI.h:
1292
1293 2018-01-17  Per Arne Vollan  <pvollan@apple.com>
1294
1295         [Win] Compile error: 'wtf/text/icu/TextBreakIteratorICU.h' not found.
1296         https://bugs.webkit.org/show_bug.cgi?id=181744
1297         <rdar://problem/36582562>
1298
1299         Reviewed by Alex Christensen.
1300
1301         Add WTF folders to forwarding headers directories.
1302
1303         * wtf/PlatformWin.cmake:
1304
1305 2018-01-16  Per Arne Vollan  <pvollan@apple.com>
1306
1307         [Win] JSC compile error in runtime/DateConversion.cpp.
1308         https://bugs.webkit.org/show_bug.cgi?id=181690
1309         <rdar://problem/36480409>
1310  
1311         Reviewed by Brent Fulgham.
1312
1313         Add 'text/win' folder to list of forwarding headers directories.
1314  
1315         * wtf/PlatformWin.cmake:
1316
1317 2018-01-15  Michael Catanzaro  <mcatanzaro@igalia.com>
1318
1319         Improve use of ExportMacros
1320         https://bugs.webkit.org/show_bug.cgi?id=181652
1321
1322         Reviewed by Konstantin Tokarev.
1323
1324         * wtf/ExportMacros.h: Simplify the #defines in this file.
1325         * wtf/Platform.h: Remove unneeded define. Remove comment that expects all ports to
1326           eventually enable the export macros. WPE will never want these. We don't currently want
1327           them for GTK either, though how we link GTK has been in flux recently.
1328
1329 2018-01-15  JF Bastien  <jfbastien@apple.com>
1330
1331         Remove makePoisonedUnique
1332         https://bugs.webkit.org/show_bug.cgi?id=181630
1333         <rdar://problem/36498623>
1334
1335         Reviewed by Mark Lam.
1336
1337         I added a conversion from std::unique_ptr, so we can just use
1338         std::make_unique and it'll auto-poison when converted.
1339
1340         * wtf/PoisonedUniquePtr.h:
1341         (WTF::makePoisonedUnique): Deleted.
1342
1343 2018-01-13  Mark Lam  <mark.lam@apple.com>
1344
1345         Replace all use of ConstExprPoisoned with Poisoned.
1346         https://bugs.webkit.org/show_bug.cgi?id=181542
1347         <rdar://problem/36442138>
1348
1349         Reviewed by JF Bastien.
1350
1351         1. Removed ConstExprPoisoned and its artifacts.
1352
1353         2. Consolidated Poisoned into PoisonedImpl.  PoisonedImpl is not more.
1354
1355         3. Changed all clients of ConstExprPoisoned to use Poisoned instead.
1356
1357         4. Worked around the GCC and Clang compiler bug that confuses an intptr_t&
1358            template arg with intptr_t.
1359            See use of std::enable_if_t<Other::isPoisoned> in Poisoned.h.
1360
1361         5. Removed ENABLE(MIXED_POISON) since we now have a workaround (3) that makes it
1362            possible to use the mixed poison code.
1363
1364         6. Also fixed broken implementation of comparison operators in Poisoned.
1365
1366         * wtf/Bag.h:
1367         * wtf/DumbPtrTraits.h:
1368         (WTF::DumbPtrTraits::poison):
1369         * wtf/DumbValueTraits.h:
1370         (WTF::DumbValueTraits::poison):
1371         * wtf/Poisoned.h:
1372         (WTF::Poisoned::Poisoned):
1373         (WTF::Poisoned::operator== const):
1374         (WTF::Poisoned::operator!= const):
1375         (WTF::Poisoned::operator< const):
1376         (WTF::Poisoned::operator<= const):
1377         (WTF::Poisoned::operator> const):
1378         (WTF::Poisoned::operator>= const):
1379         (WTF::Poisoned::operator=):
1380         (WTF::Poisoned::swap):
1381         (WTF::swap):
1382         (WTF::PoisonedPtrTraits::poison):
1383         (WTF::PoisonedPtrTraits::swap):
1384         (WTF::PoisonedValueTraits::poison):
1385         (WTF::PoisonedValueTraits::swap):
1386         (WTF::PoisonedImpl::PoisonedImpl): Deleted.
1387         (WTF::PoisonedImpl::assertIsPoisoned const): Deleted.
1388         (WTF::PoisonedImpl::assertIsNotPoisoned const): Deleted.
1389         (WTF::PoisonedImpl::unpoisoned const): Deleted.
1390         (WTF::PoisonedImpl::clear): Deleted.
1391         (WTF::PoisonedImpl::operator* const): Deleted.
1392         (WTF::PoisonedImpl::operator-> const): Deleted.
1393         (WTF::PoisonedImpl::bits const): Deleted.
1394         (WTF::PoisonedImpl::operator! const): Deleted.
1395         (WTF::PoisonedImpl::operator bool const): Deleted.
1396         (WTF::PoisonedImpl::operator== const): Deleted.
1397         (WTF::PoisonedImpl::operator!= const): Deleted.
1398         (WTF::PoisonedImpl::operator< const): Deleted.
1399         (WTF::PoisonedImpl::operator<= const): Deleted.
1400         (WTF::PoisonedImpl::operator> const): Deleted.
1401         (WTF::PoisonedImpl::operator>= const): Deleted.
1402         (WTF::PoisonedImpl::operator=): Deleted.
1403         (WTF::PoisonedImpl::swap): Deleted.
1404         (WTF::PoisonedImpl::exchange): Deleted.
1405         (WTF::PoisonedImpl::poison): Deleted.
1406         (WTF::PoisonedImpl::unpoison): Deleted.
1407         (WTF::constExprPoisonRandom): Deleted.
1408         (WTF::makeConstExprPoison): Deleted.
1409         (WTF::ConstExprPoisonedPtrTraits::exchange): Deleted.
1410         (WTF::ConstExprPoisonedPtrTraits::swap): Deleted.
1411         (WTF::ConstExprPoisonedPtrTraits::unwrap): Deleted.
1412         (WTF::ConstExprPoisonedValueTraits::exchange): Deleted.
1413         (WTF::ConstExprPoisonedValueTraits::swap): Deleted.
1414         (WTF::ConstExprPoisonedValueTraits::unwrap): Deleted.
1415         * wtf/PoisonedUniquePtr.h:
1416         (WTF::PoisonedUniquePtr::PoisonedUniquePtr):
1417         (WTF::PoisonedUniquePtr::operator=):
1418         * wtf/Ref.h:
1419         * wtf/RefCountedArray.h:
1420         (WTF::RefCountedArray::RefCountedArray):
1421         * wtf/RefPtr.h:
1422         * wtf/WTFAssertions.cpp:
1423
1424 2018-01-12  JF Bastien  <jfbastien@apple.com>
1425
1426         PoisonedWriteBarrier
1427         https://bugs.webkit.org/show_bug.cgi?id=181599
1428         <rdar://problem/36474351>
1429
1430         Reviewed by Mark Lam.
1431
1432         Supporting changes needed to allow poisoning of WriteBarrier
1433         objects.
1434
1435         * WTF.xcodeproj/project.pbxproj:
1436         * wtf/DumbPtrTraits.h:
1437         * wtf/DumbValueTraits.h: Copied from Source/WTF/wtf/DumbPtrTraits.h.
1438         (WTF::DumbValueTraits::exchange):
1439         (WTF::DumbValueTraits::swap):
1440         (WTF::DumbValueTraits::unwrap):
1441         * wtf/Forward.h:
1442         * wtf/Poisoned.h:
1443         (WTF::ConstExprPoisonedValueTraits::exchange):
1444         (WTF::ConstExprPoisonedValueTraits::swap):
1445         (WTF::ConstExprPoisonedValueTraits::unwrap):
1446
1447 2018-01-11  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1448
1449         Remove noexcept from definition of std::tie()
1450         https://bugs.webkit.org/show_bug.cgi?id=181577
1451
1452         Reviewed by Yusuke Suzuki.
1453
1454         * wtf/StdLibExtras.h:
1455         (WTF::tie):
1456
1457 2018-01-11  Filip Pizlo  <fpizlo@apple.com>
1458
1459         Reserve a fast TLS key for GC TLC
1460         https://bugs.webkit.org/show_bug.cgi?id=181539
1461
1462         Reviewed by Alexey Proskuryakov.
1463         
1464         Who knew that thread-local caches would be a mitigation for timing attacks. Here's how it
1465         works: if we have TLCs then we can "context switch" them when we "context switch" origins. 
1466         This allows us to put some minimal distance between objects from different origins, which
1467         gives us the ability to allow small overflows when doing certain bounds checks without
1468         creating a useful Spectre information leak.
1469         
1470         So I think that means we have to implement thread-local caches (also known as thread-local
1471         allocation buffers, but I prefer the TLC terminology).
1472
1473         * wtf/FastTLS.h:
1474
1475 2018-01-04  Filip Pizlo  <fpizlo@apple.com>
1476
1477         CodeBlocks should be in IsoSubspaces
1478         https://bugs.webkit.org/show_bug.cgi?id=180884
1479
1480         Reviewed by Saam Barati.
1481         
1482         Deque<>::contains() is helpful for a debug ASSERT.
1483
1484         * wtf/Deque.h:
1485         (WTF::inlineCapacity>::contains):
1486
1487 2018-01-11  JF Bastien  <jfbastien@apple.com>
1488
1489         NFC reorder headers
1490         https://bugs.webkit.org/show_bug.cgi?id=181521
1491
1492         Reviewed by Darin Adler.
1493
1494         Follow-up on r226752. I misunderstood the header include order
1495         style. No functional change.
1496
1497         * wtf/Poisoned.h:
1498         * wtf/PoisonedUniquePtr.h:
1499
1500 2018-01-10  JF Bastien  <jfbastien@apple.com>
1501
1502         Poison small JSObject derivatives which only contain pointers
1503         https://bugs.webkit.org/show_bug.cgi?id=181483
1504         <rdar://problem/36407127>
1505
1506         Reviewed by Mark Lam.
1507
1508         The associated JSC poisoning change requires some template
1509         "improvements" to our poisoning machinery. Worth noting is that
1510         I'm making PoisonedUniquePtr move-assignable and
1511         move-constructible from unique_ptr, which makes it a better
1512         drop-in replacement because we don't need to use
1513         makePoisonedUniquePtr. This means function-locals can be
1514         unique_ptr and get the nice RAII pattern, and once the function is
1515         done you can just move to the class' PoisonedUniquePtr without
1516         worrying.
1517
1518         * wtf/Poisoned.h:
1519         (WTF::PoisonedImpl::PoisonedImpl):
1520         * wtf/PoisonedUniquePtr.h:
1521         (WTF::PoisonedUniquePtr::PoisonedUniquePtr):
1522         (WTF::PoisonedUniquePtr::operator=):
1523
1524 2018-01-10  Don Olmstead  <don.olmstead@sony.com>
1525
1526         Add nullptr_t specialization of poison
1527         https://bugs.webkit.org/show_bug.cgi?id=181469
1528
1529         Reviewed by JF Bastien.
1530
1531         * wtf/Poisoned.h:
1532         (WTF::PoisonedImpl::poison):
1533
1534 2018-01-10  Commit Queue  <commit-queue@webkit.org>
1535
1536         Unreviewed, rolling out r226667 and r226673.
1537         https://bugs.webkit.org/show_bug.cgi?id=181488
1538
1539         This caused a flaky crash. (Requested by mlewis13 on #webkit).
1540
1541         Reverted changesets:
1542
1543         "CodeBlocks should be in IsoSubspaces"
1544         https://bugs.webkit.org/show_bug.cgi?id=180884
1545         https://trac.webkit.org/changeset/226667
1546
1547         "REGRESSION (r226667): CodeBlocks should be in IsoSubspaces"
1548         https://bugs.webkit.org/show_bug.cgi?id=180884
1549         https://trac.webkit.org/changeset/226673
1550
1551 2018-01-04  Filip Pizlo  <fpizlo@apple.com>
1552
1553         CodeBlocks should be in IsoSubspaces
1554         https://bugs.webkit.org/show_bug.cgi?id=180884
1555
1556         Reviewed by Saam Barati.
1557         
1558         Deque<>::contains() is helpful for a debug ASSERT.
1559
1560         * wtf/Deque.h:
1561         (WTF::inlineCapacity>::contains):
1562
1563 2018-01-08  Don Olmstead  <don.olmstead@sony.com>
1564
1565         Add WTF_EXPORTs to UniStdExtras
1566         https://bugs.webkit.org/show_bug.cgi?id=181415
1567
1568         Reviewed by Alex Christensen.
1569
1570         * wtf/UniStdExtras.h:
1571
1572 2018-01-07  Mark Lam  <mark.lam@apple.com>
1573
1574         Apply poisoning to more pointers in JSC.
1575         https://bugs.webkit.org/show_bug.cgi?id=181096
1576         <rdar://problem/36182970>
1577
1578         Reviewed by JF Bastien.
1579
1580         Added support for PoisonedBag and PoisonedRefCountedArray.
1581
1582         * wtf/Bag.h:
1583         (WTF::Private::BagNode::BagNode):
1584         (WTF::Bag::Bag):
1585         (WTF::Bag::operator=):
1586         (WTF::Bag::clear):
1587         (WTF::Bag::add):
1588         (WTF::Bag::begin):
1589         (WTF::Bag::unwrappedHead):
1590         (WTF::Bag::Node::Node): Deleted.
1591         * wtf/BagToHashMap.h:
1592         (WTF::toHashMap):
1593         * wtf/Poisoned.h:
1594         (WTF::constExprPoisonRandom):
1595         (WTF::makeConstExprPoison):
1596         * wtf/RefCountedArray.h:
1597         (WTF::RefCountedArray::RefCountedArray):
1598         (WTF::RefCountedArray::clone const):
1599         (WTF::RefCountedArray::operator=):
1600         (WTF::RefCountedArray::~RefCountedArray):
1601         (WTF::RefCountedArray::refCount const):
1602         (WTF::RefCountedArray::size const):
1603         (WTF::RefCountedArray::data):
1604         (WTF::RefCountedArray::begin):
1605         (WTF::RefCountedArray::end):
1606         (WTF::RefCountedArray::data const):
1607         (WTF::RefCountedArray::begin const):
1608         (WTF::RefCountedArray::operator== const):
1609         (WTF::RefCountedArray::Header::fromPayload):
1610         * wtf/WTFAssertions.cpp:
1611
1612 2018-01-05  JF Bastien  <jfbastien@apple.com>
1613
1614         WebAssembly: poison JS object's secrets
1615         https://bugs.webkit.org/show_bug.cgi?id=181339
1616         <rdar://problem/36325001>
1617
1618         Reviewed by Mark Lam.
1619
1620         swapping a poisoned pointer with a non-poisoned one (as is done in
1621         JSWebAssembyMemory::adopt) was missing.
1622
1623         * wtf/Poisoned.h:
1624         (WTF::PoisonedImpl::swap):
1625         (WTF::ConstExprPoisonedPtrTraits::swap):
1626
1627 2018-01-05  David Kilzer  <ddkilzer@apple.com>
1628
1629         Re-enable -Wcast-qual in WebCore for Apple ports
1630         <https://webkit.org/b/177895>
1631         <rdar://problem/34960830>
1632
1633         Reviewed by Joseph Pecoraro.
1634
1635         * wtf/RetainPtr.h:
1636         (WTF::RetainPtr::fromStorageTypeHelper const): Add const_cast<>
1637         operator here since some CFTypes are not defined as const
1638         pointers, which triggers a warning in C++ source with
1639         -Wcast-qual when casting from CFTypeRef back to the original
1640         type.  Note that we use const_cast<CF_BRIDGED_TYPE(id) void*>()
1641         here (and in TypeCastsCF.h below) since this is what CFTypeRef
1642         is defined as in CFBase.h, but without the 'const' modifier.
1643         (WTF::RetainPtr::fromStorageType const): Ditto.
1644
1645         * wtf/cf/TypeCastsCF.h: Use #pragma once.
1646         (WTF_DECLARE_CF_TYPE_TRAIT): Rename from DECLARE_CF_TYPE_TRAIT.
1647         Don't #undef it so that it can be used in other source files.
1648         (WTF_DECLARE_CF_MUTABLE_TYPE_TRAIT): Add new macro that is used
1649         for declaring CFMutable types.  The CFTypeID for CF_Foo_ and
1650         CFMutable_Foo_ are the same, so we have to use a different macro
1651         to declare type traits for those types.
1652         (WTF::dynamic_cf_cast): Add assertion to catch issues in Debug
1653         builds.
1654         (WTF::checked_cf_cast): Inline code from WTF::dynamic_cf_cast
1655         and change behavior to be more consistent between Debug and
1656         Release builds, as well as other "checked" functions.
1657         Previously this function would return nullptr in Release builds
1658         if nullptr or the wrong type of object was passed in, but crash
1659         in both cases on Debug builds.  The new behavior always returns
1660         nullptr if nullptr was passed in (but never crashes), and always
1661         crashes if the wrong type of object is passed in.
1662
1663 2018-01-04  Keith Miller  <keith_miller@apple.com>
1664
1665         TypedArrays and Wasm should use index masking.
1666         https://bugs.webkit.org/show_bug.cgi?id=181313
1667
1668         Reviewed by Michael Saboff.
1669
1670         * wtf/MathExtras.h:
1671         (WTF::computeIndexingMask):
1672
1673 2018-01-03  Michael Saboff  <msaboff@apple.com>
1674
1675         Disable SharedArrayBuffers from Web API
1676         https://bugs.webkit.org/show_bug.cgi?id=181266
1677
1678         Reviewed by Saam Barati.
1679
1680         Turn off SharedArrayBuffers using a compile time flag ENABLE_SHARED_ARRAY_BUFFER.
1681
1682         * wtf/Platform.h:
1683
1684 2017-12-28  Yusuke Suzuki  <utatane.tea@gmail.com>
1685
1686         Remove std::chrono completely
1687         https://bugs.webkit.org/show_bug.cgi?id=181186
1688
1689         Reviewed by Alex Christensen.
1690
1691         std::chrono's overflow unaware design is dangerous[1]. Even small code like
1692         `condition.wait_for(std::chrono::seconds::max())` is broken in some platforms
1693         due to overflow of std::chrono::time_point. So we intentionally avoid using
1694         std::chrono, and use WallTime, MonotonicTime, Seconds instead.
1695
1696         This patch removes all the remaining use of std::chrono from WebKit tree.
1697
1698         [1]: https://lists.webkit.org/pipermail/webkit-dev/2016-May/028242.html
1699
1700         * wtf/CrossThreadCopier.h:
1701         Remove std::chrono support from cross thread copiers.
1702         * wtf/Forward.h:
1703         * wtf/MonotonicTime.h:
1704         (WTF::MonotonicTime::isolatedCopy const):
1705         Add isolatedCopy function.
1706         * wtf/RunLoop.h:
1707         (WTF::RunLoop::TimerBase::startRepeating):
1708         (WTF::RunLoop::TimerBase::startOneShot):
1709         Just remove these helpers.
1710         * wtf/Seconds.h:
1711         (WTF::Seconds::isolatedCopy const):
1712         Add isolatedCopy function.
1713         * wtf/WallTime.h:
1714         (WTF::WallTime::isolatedCopy const):
1715         Add isolatedCopy function.
1716         * wtf/persistence/PersistentCoders.h:
1717         (WTF::Persistence::Coder<Seconds>::encode):
1718         (WTF::Persistence::Coder<Seconds>::decode):
1719         (WTF::Persistence::Coder<WallTime>::encode):
1720         (WTF::Persistence::Coder<WallTime>::decode):
1721         Add persistent coder support for Seconds and WallTime.
1722         (WTF::Persistence::Coder<std::chrono::system_clock::time_point>::encode): Deleted.
1723         (WTF::Persistence::Coder<std::chrono::system_clock::time_point>::decode): Deleted.
1724         Remove std::chrono support from persistent coders.
1725
1726 2018-01-02  Mark Lam  <mark.lam@apple.com>
1727
1728         Refactoring: Rename DummyClass to DummyStruct because it's a struct.
1729         https://bugs.webkit.org/show_bug.cgi?id=181230
1730
1731         Reviewed by JF Bastien.
1732
1733         * wtf/WTFAssertions.cpp:
1734
1735 2018-01-02  Mark Lam  <mark.lam@apple.com>
1736
1737         Ensure that poisoned pointers do not look like double or int32 JSValues.
1738         https://bugs.webkit.org/show_bug.cgi?id=181221
1739         <rdar://problem/36248638>
1740
1741         Reviewed by JF Bastien.
1742
1743         Changed poison values to ensure that poisoned bits (i.e. pointer ^ poison)
1744         satisfies the following conditions:
1745         1. bits 48-63 are 0: this ensures that poisoned bits look like a pointer and
1746            not a double or int32 JSValue.
1747         2. bits 32-47 are not completely 0.
1748         3. bit 2 is never 0: this ensures that the poisoned value of a non-null pointer
1749            will never be null.
1750         4. bit 0-1 is always 0: this ensures that clients can still use the 2 bottom
1751            bits of the poisoned value as flag bits (just like they were able to do with
1752            pointer values).  The only difference is that bit 2 can no longer be used for
1753            flag bits because poisoned values need it to always be set.
1754
1755         * WTF.xcodeproj/project.pbxproj:
1756         * wtf/CMakeLists.txt:
1757         * wtf/PointerAsserts.cpp: Removed.
1758
1759         * wtf/Poisoned.cpp:
1760         (WTF::makePoison):
1761         - Updated to satisfy the above requirements.
1762         
1763         * wtf/Poisoned.h:
1764         (WTF::makeConstExprPoison):
1765         (WTF::makePoison): Deleted.
1766
1767         * wtf/WTFAssertions.cpp: Copied from Source/WTF/wtf/PointerAsserts.cpp.
1768         - Renamed from PointerAsserts.cpp because we assert more things than just
1769           pointers here.
1770         - Added some assertions to test makeConstExprPoison() to ensure that it satisfies
1771           the above requirements.
1772
1773 2017-12-28  Yusuke Suzuki  <utatane.tea@gmail.com>
1774
1775         Remove std::chrono if it is not used for ArgumentCoder or PersistentCoder
1776         https://bugs.webkit.org/show_bug.cgi?id=181174
1777
1778         Reviewed by Konstantin Tokarev.
1779
1780         Make WallTime more constexpr friendly. This change is already applied to MonoTonicTime.
1781
1782         We would like to move std::{isfinite,isinf,isnan} overloadings from std:: to each class scope in a separate patch[1].
1783
1784         [1]: https://bugs.webkit.org/show_bug.cgi?id=181183
1785
1786         * wtf/WallTime.h:
1787         (WTF::WallTime::WallTime):
1788         (WTF::WallTime::fromRawSeconds):
1789         (WTF::WallTime::infinity):
1790         (WTF::WallTime::secondsSinceEpoch const):
1791         (WTF::WallTime::operator bool const):
1792         (WTF::WallTime::operator+ const):
1793         (WTF::WallTime::operator- const):
1794         (WTF::WallTime::operator== const):
1795         (WTF::WallTime::operator!= const):
1796         (WTF::WallTime::operator< const):
1797         (WTF::WallTime::operator> const):
1798         (WTF::WallTime::operator<= const):
1799         (WTF::WallTime::operator>= const):
1800
1801 2017-12-28  Fujii Hironori  <Hironori.Fujii@sony.com>
1802
1803         [Win][CMake] Use add_custom_command to copy each forwarding header files
1804         https://bugs.webkit.org/show_bug.cgi?id=180921
1805
1806         Reviewed by Brent Fulgham.
1807
1808         * wtf/PlatformWin.cmake: Use WEBKIT_MAKE_FORWARDING_HEADERS.
1809
1810 2017-12-27  Yusuke Suzuki  <utatane.tea@gmail.com>
1811
1812         [WTF] Add clock_gettime based monotonicallyIncreasingTime implementation for Linux and BSDs
1813         https://bugs.webkit.org/show_bug.cgi?id=181175
1814
1815         Reviewed by Michael Catanzaro.
1816
1817         Use platform-provided POSIX APIs to get monotonic time.
1818
1819         * wtf/CurrentTime.cpp:
1820         (WTF::monotonicallyIncreasingTime):
1821
1822 2017-12-26  Carlos Alberto Lopez Perez  <clopez@igalia.com>
1823
1824         REGRESSION(r225769): Build error with constexpr std::max // std::min in libdstdc++4
1825         https://bugs.webkit.org/show_bug.cgi?id=181160
1826
1827         Reviewed by Myles C. Maxfield.
1828
1829         In libstdc++-4 std::max and std::min are not annotated with constexpr.
1830         This patch adds a WTF::min and WTF::max for using where a constexpr result is expected.
1831         Related: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60271
1832
1833         * wtf/StdLibExtras.h:
1834         (WTF::min):
1835         (WTF::max):
1836
1837 2017-12-26  Yusuke Suzuki  <utatane.tea@gmail.com>
1838
1839         [JSC] Remove std::chrono completely
1840         https://bugs.webkit.org/show_bug.cgi?id=181165
1841
1842         Reviewed by Konstantin Tokarev.
1843
1844         WTF::currentCPUTime now returns WTF::Seconds.
1845         We also add the implementaiton for Linux and FreeBSD.
1846
1847         * wtf/CurrentTime.cpp:
1848         (WTF::currentCPUTime):
1849         * wtf/CurrentTime.h:
1850
1851 2017-12-22  Wenson Hsieh  <wenson_hsieh@apple.com>
1852
1853         Unreviewed, try to fix the Sierra build after r226277.
1854
1855         The macOS 10.12 SDK does not know about NSControlStateValue and some types of NSLevelIndicatorStyles, so these
1856         need to be declared in a separate section in AppKitCompatibilityDeclarations.h (rather than in the < macOS 10.12
1857         SDK #ifdef).
1858
1859         * wtf/mac/AppKitCompatibilityDeclarations.h:
1860
1861 2017-12-22  Wenson Hsieh  <wenson_hsieh@apple.com>
1862
1863         Fix build failures due to using deprecated AppKit symbols
1864         https://bugs.webkit.org/show_bug.cgi?id=181110
1865         <rdar://problem/36162865>
1866
1867         Reviewed by Dan Bernstein and Tim Horton.
1868
1869         When building with older macOS SDKs where some AppKit constants don't exist, define the modern constants to be
1870         equal to their deprecated counterparts. This allows us to just have the modern types in WebKit sources while
1871         avoiding breakage on old SDKs.
1872
1873         This, along with many other symbols in the compability header, can be removed once WebKit stops supporting macOS
1874         10.11.
1875
1876         * wtf/mac/AppKitCompatibilityDeclarations.h:
1877
1878 2017-12-21  Mark Lam  <mark.lam@apple.com>
1879
1880         Add WTF::PoisonedUniquePtr to replace std::unique_ptr when poisoning is desired.
1881         https://bugs.webkit.org/show_bug.cgi?id=181062
1882         <rdar://problem/36167040>
1883
1884         Reviewed by Chris Dumez.
1885
1886         * WTF.xcodeproj/project.pbxproj:
1887         * wtf/CMakeLists.txt:
1888         * wtf/PointerAsserts.cpp: Copied from Source/WTF/wtf/RefPtr.cpp.
1889         - renamed file because we asserts all kinds of pointers in here, not just RefPtr.
1890         
1891         * wtf/Poisoned.h:
1892         - added a missing #include.
1893         - make constexpr poison values more scrambled.
1894         (WTF::makePoison):
1895
1896         * wtf/PoisonedUniquePtr.h: Added.
1897         (WTF::PoisonedUniquePtr::PoisonedUniquePtr):
1898         (WTF::PoisonedUniquePtr::~PoisonedUniquePtr):
1899         (WTF::PoisonedUniquePtr::create):
1900         (WTF::PoisonedUniquePtr::operator=):
1901         (WTF::PoisonedUniquePtr::get const):
1902         (WTF::PoisonedUniquePtr::operator[] const):
1903         (WTF::PoisonedUniquePtr::clear):
1904         (WTF::PoisonedUniquePtr::destroy):
1905         (WTF::PoisonedUniquePtr::clearWithoutDestroy):
1906         (WTF::makePoisonedUnique):
1907         * wtf/RefPtr.cpp: Removed.
1908
1909 2017-12-21  Jeremy Jones  <jeremyj@apple.com>
1910
1911         Element fullscreen interface should display the location
1912         https://bugs.webkit.org/show_bug.cgi?id=181006
1913         rdar://problem/36143176
1914
1915         Reviewed by Simon Fraser.
1916
1917         Add SecTrustCopyInfo SPI.
1918
1919         * wtf/spi/cocoa/SecuritySPI.h:
1920
1921 2017-12-20  Fujii Hironori  <Hironori.Fujii@sony.com>
1922
1923         [CMake][WTF] Lowercase ForwardingHeaders directory name of WTF
1924         https://bugs.webkit.org/show_bug.cgi?id=181022
1925
1926         Reviewed by Konstantin Tokarev.
1927
1928         * wtf/CMakeLists.txt: Renamed ForwardingHeaders directory name WTF to wtf.
1929         * wtf/PlatformWin.cmake: Ditto.
1930
1931 2017-12-19  Brian Burg  <bburg@apple.com>
1932
1933         SLEEP_THREAD_FOR_DEBUGGER() macro should try to print out the PID of the affected process
1934         https://bugs.webkit.org/show_bug.cgi?id=180947
1935
1936         Reviewed by Joseph Pecoraro.
1937
1938         * wtf/DebugUtilities.h:
1939         - Use sleep() from CurrentTime.h as it is more cross-platform.
1940         - Print a message with the process PID to simplify attaching to sleeping thread.
1941         - Include source location in case multiple such macros are being used.
1942
1943 2017-12-18  Daniel Bates  <dabates@apple.com>
1944
1945         Conditionally forward declare NSMapTable SPI
1946         https://bugs.webkit.org/show_bug.cgi?id=180936
1947         <rdar://problem/35037796>
1948
1949         Reviewed by Dan Bernstein.
1950
1951         * wtf/spi/cocoa/NSMapTableSPI.h:
1952
1953 2017-12-16  Filip Pizlo  <fpizlo@apple.com>
1954
1955         Vector index masking
1956         https://bugs.webkit.org/show_bug.cgi?id=180909
1957
1958         Reviewed by Keith Miller.
1959         
1960         Adds index masking to StringImpl and Vector.
1961         
1962         Perf:
1963         
1964         - 0.4% slower on microbenchmarks.
1965         - Octane totally even.
1966         - Kraken may be 0.8% slower.
1967         - Speedometer is 0.8% slower with p = 0.008.
1968         - membuster is even:
1969             - snap2pre: 0.7% bigger w/ p = 0.26,
1970             - snap2post: 0.3% smaller w/ p = 0.81,
1971             - snap3pre: 1.2% bigger w/ p = 0.63,
1972             - snap3post: 0.4% smaller w/ p = 0.76.
1973
1974         * wtf/MathExtras.h:
1975         (WTF::roundUpToPowerOfTwo):
1976         (WTF::maskForSize):
1977         * wtf/SizeLimits.cpp:
1978         * wtf/Vector.h:
1979         (WTF::VectorBufferBase::allocateBuffer):
1980         (WTF::VectorBufferBase::tryAllocateBuffer):
1981         (WTF::VectorBufferBase::reallocateBuffer):
1982         (WTF::VectorBufferBase::deallocateBuffer):
1983         (WTF::VectorBufferBase::releaseBuffer):
1984         (WTF::VectorBufferBase::VectorBufferBase):
1985         (WTF::VectorBufferBase::updateMask):
1986         (WTF::VectorBuffer::allocateBuffer):
1987         (WTF::VectorBuffer::tryAllocateBuffer):
1988         (WTF::VectorBuffer::swap):
1989         (WTF::VectorBuffer::restoreInlineBufferIfNeeded):
1990         (WTF::Vector::at):
1991         (WTF::Vector::at const):
1992         * wtf/text/StringImpl.h:
1993         (WTF::StringImpl::maskOffset):
1994         (WTF::StringImpl::mask const):
1995         (WTF::StringImplShape::StringImplShape):
1996         (WTF::StringImpl::at const):
1997         (WTF::StringImpl::tailOffset):
1998         * wtf/text/StringView.h:
1999         (WTF::StringView::StringView):
2000         (WTF::StringView::operator=):
2001         (WTF::StringView::initialize):
2002         (WTF::StringView::clear):
2003         (WTF::StringView::operator[] const):
2004         * wtf/text/WTFString.h:
2005         (WTF::String::mask const):
2006
2007 2017-12-18  Claudio Saavedra  <csaavedra@igalia.com>
2008
2009         [GTK][Darwin] Do not define mach exceptions for GTK+
2010
2011         Rubber-stamped by Michael Catanzaro.
2012         * wtf/Platform.h:
2013
2014 2017-12-17  Yusuke Suzuki  <utatane.tea@gmail.com>
2015
2016         [FTL] NewArrayBuffer should be sinked if it is only used for spreading
2017         https://bugs.webkit.org/show_bug.cgi?id=179762
2018
2019         Reviewed by Saam Barati.
2020
2021         We add RecursableLambda<>. This can take a lambda and offer a way
2022         to call this lambda recursively without introducing additional allocations.
2023
2024         C++ lambda is super useful in particular when we need to capture many
2025         variables as references. Passing many arguments to a usual function is not
2026         a good way. But C++ lambda does not allow us to easily call itself recursively.
2027
2028         Our recursableLambda offers `self` function as a first argument of the
2029         given lambda. We can call this `self` recursively.
2030
2031         auto targetFunction = recursableLambda([] (auto self, ...) -> resultType {
2032             self(...);
2033         });
2034
2035         While `std::function<> func = [&func] { ... }` allows recursion, it causes
2036         heap allocation for std::function<>. `auto func = [&func] { ... }` causes
2037         a compile error since we need to deduce an actual type when capturing `func`.
2038
2039         * WTF.xcodeproj/project.pbxproj:
2040         * wtf/RecursableLambda.h: Added.
2041         (WTF::RecursableLambda::RecursableLambda):
2042         (WTF::RecursableLambda::operator() const):
2043         (WTF::recursableLambda):
2044
2045 2017-12-17  Mark Lam  <mark.lam@apple.com>
2046
2047         Enhance Ref and RefPtr to be able to work with smart pointers.
2048         https://bugs.webkit.org/show_bug.cgi?id=180762
2049         <rdar://problem/36027122>
2050
2051         Reviewed by JF Bastien and Darin Adler.
2052
2053         This is so we can use them with ConstExprPoisoned pointers to make PoisonedRef
2054         and PoisonedRefPtr.
2055
2056         * WTF.xcodeproj/project.pbxproj:
2057         * wtf/CMakeLists.txt:
2058         * wtf/DumbPtrTraits.h: Added.
2059         (WTF::DumbPtrTraits::exchange):
2060         (WTF::DumbPtrTraits::swap):
2061         (WTF::DumbPtrTraits::unwrap):
2062         * wtf/Forward.h:
2063         * wtf/Poisoned.h:
2064         (WTF::ConstExprPoisonedPtrTraits::exchange):
2065         (WTF::ConstExprPoisonedPtrTraits::swap):
2066         (WTF::ConstExprPoisonedPtrTraits::unwrap):
2067         * wtf/Ref.h:
2068         (WTF::Ref::~Ref):
2069         (WTF::Ref::Ref):
2070         (WTF::Ref::ptrAllowingHashTableEmptyValue const):
2071         (WTF::Ref::ptrAllowingHashTableEmptyValue):
2072         (WTF::Ref::operator-> const):
2073         (WTF::Ref::get const):
2074         (WTF::Ref::operator T& const):
2075         (WTF::=):
2076         (WTF::U>::swap):
2077         (WTF::swap):
2078         (WTF::U>::replace):
2079         (WTF::static_reference_cast):
2080         (WTF::adoptRef):
2081         (WTF::is):
2082         (WTF::Ref<T>::swap): Deleted.
2083         (WTF::Ref<T>::replace): Deleted.
2084         (WTF::GetPtrHelper<Ref<T>>::getPtr): Deleted.
2085         * wtf/RefPtr.cpp: Added.
2086         * wtf/RefPtr.h:
2087         (WTF::RefPtr::RefPtr):
2088         (WTF::RefPtr::~RefPtr):
2089         (WTF::RefPtr::get const):
2090         (WTF::RefPtr::operator* const):
2091         (WTF::RefPtr::operator-> const):
2092         (WTF::U>::RefPtr):
2093         (WTF::U>::leakRef):
2094         (WTF::=):
2095         (WTF::U>::swap):
2096         (WTF::swap):
2097         (WTF::operator==):
2098         (WTF::operator!=):
2099         (WTF::static_pointer_cast):
2100         (WTF::adoptRef):
2101         (WTF::is):
2102         (WTF::RefPtr<T>::RefPtr): Deleted.
2103         (WTF::RefPtr<T>::leakRef): Deleted.
2104         (WTF::RefPtr<T>::swap): Deleted.
2105
2106 2017-12-16  Yusuke Suzuki  <utatane.tea@gmail.com>
2107
2108         Remove unnecessary boolean result of start() functions
2109         https://bugs.webkit.org/show_bug.cgi?id=180856
2110
2111         Reviewed by Darin Adler.
2112
2113         CrossThreadTaskHandler's Thread is just released without calling
2114         either `waitForCompletion` or `detach`. It means that this resource
2115         of the thread is not released.
2116
2117         * benchmarks/ConditionSpeedTest.cpp:
2118         * wtf/CrossThreadTaskHandler.cpp:
2119         (WTF::CrossThreadTaskHandler::CrossThreadTaskHandler):
2120         * wtf/CrossThreadTaskHandler.h:
2121
2122 2017-12-14  David Kilzer  <ddkilzer@apple.com>
2123
2124         Enable -Wstrict-prototypes for WebKit
2125         <https://webkit.org/b/180757>
2126         <rdar://problem/36024132>
2127
2128         Rubber-stamped by Joseph Pecoraro.
2129
2130         * Configurations/Base.xcconfig:
2131         (CLANG_WARN_STRICT_PROTOTYPES): Add. Set to YES.
2132         * wtf/Assertions.h:
2133         (WTFReportBacktrace): Add 'void' to C function declaration.
2134         (WTFCrashHookFunction): Add 'void' to C function pointer declaration.
2135         (WTFInstallReportBacktraceOnCrashHook): Add 'void' to C function declaration.
2136         (WTFIsDebuggerAttached): Ditto.
2137         (WTFCrash): Ditto.
2138         (WTFCrashWithSecurityImplication): Ditto.
2139
2140 2017-12-14  Yusuke Suzuki  <utatane.tea@gmail.com>
2141
2142         Drop Thread::tryCreate
2143         https://bugs.webkit.org/show_bug.cgi?id=180808
2144
2145         Reviewed by Darin Adler.
2146
2147         We remove Thread::tryCreate. When thread creation fails, we have no way to keep WebKit working.
2148         Compared to tryMalloc, Thread::create always consumes fixed size of resource. If it fails,
2149         this is not due to arbitrary large user request. It is not reasonable that some thread creations
2150         are handled gracefully while the other thread creations are not.
2151
2152         If we would like to have the limit of number of users' thread creation (like, calling `new Worker`
2153         so many times), we should have a soft limit instead of relying on system's hard limit.
2154
2155         * wtf/ParallelJobsGeneric.cpp:
2156         (WTF::ParallelEnvironment::ThreadPrivate::tryLockFor):
2157         * wtf/Threading.cpp:
2158         (WTF::Thread::create):
2159         (WTF::Thread::tryCreate): Deleted.
2160         * wtf/Threading.h:
2161         (WTF::Thread::create): Deleted.
2162
2163 2017-12-13  Keith Miller  <keith_miller@apple.com>
2164
2165         JSObjects should have a mask for loading indexed properties
2166         https://bugs.webkit.org/show_bug.cgi?id=180768
2167
2168         Reviewed by Mark Lam.
2169
2170         Add a clz that wraps the builtin clz intrinisics provided by
2171         various compilers. The clz function by default assumes that
2172         the input may be zero. On X86 this makes a difference because not
2173         all CPUs have LZCNT and BSR has undefined behavior on zero. On ARM,
2174         the zero check gets optimized away, regardless.
2175
2176         * wtf/StdLibExtras.h:
2177         (std::clz):
2178
2179 2017-12-12  Yusuke Suzuki  <utatane.tea@gmail.com>
2180
2181         REGRESSION(r225769): Build errors with constexpr std::tie on older gcc
2182         https://bugs.webkit.org/show_bug.cgi?id=180692
2183
2184         Reviewed by Carlos Garcia Campos.
2185
2186         Due to libstdc++'s bug[1], std::tie is not annotated with constexpr in libstdc++ 5.
2187         This patch adds WTF::tie for a work around. Since we do not want to
2188         include <tuple> in StdLibExtras.h, we define this function for all
2189         the compilers.
2190
2191         [1]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65978
2192
2193         * wtf/StdLibExtras.h:
2194
2195 2017-12-13  Mark Lam  <mark.lam@apple.com>
2196
2197         Fill out some Poisoned APIs, fix some bugs, and add some tests.
2198         https://bugs.webkit.org/show_bug.cgi?id=180724
2199         <rdar://problem/36006884>
2200
2201         Reviewed by JF Bastien.
2202
2203         Also rename Int32Poisoned to ConstExprPoisoned.  The key it takes is actually a
2204         uint32_t.  So, Int32 is really a misnomer.  In addition, the key needs to be a
2205         constexpr.  So, ConstExprPoisoned is a better name for it.
2206
2207         * wtf/Poisoned.cpp:
2208         (WTF::makePoison):
2209         * wtf/Poisoned.h:
2210         (WTF::PoisonedImplHelper::asReference):
2211         (WTF::PoisonedImpl::PoisonedImpl):
2212         (WTF::PoisonedImpl::clear):
2213         (WTF::PoisonedImpl::operator* const):
2214         (WTF::PoisonedImpl::operator-> const):
2215         (WTF::PoisonedImpl::operator== const):
2216         (WTF::PoisonedImpl::operator!= const):
2217         (WTF::PoisonedImpl::operator< const):
2218         (WTF::PoisonedImpl::operator<= const):
2219         (WTF::PoisonedImpl::operator> const):
2220         (WTF::PoisonedImpl::operator>= const):
2221         (WTF::PoisonedImpl::operator=):
2222         (WTF::PoisonedImpl::swap):
2223         (WTF::PoisonedImpl::exchange):
2224         (WTF::swap):
2225         (WTF::makePoison):
2226         (WTF::PoisonedImpl::operator==): Deleted.
2227
2228 2017-12-12  Yusuke Suzuki  <utatane.tea@gmail.com>
2229
2230         [JSC] Implement optimized WeakMap and WeakSet
2231         https://bugs.webkit.org/show_bug.cgi?id=179929
2232
2233         Reviewed by Saam Barati.
2234
2235         We introduce JSValueMalloc, which is specialized malloc scheme with Gigacage::JSValue.
2236         This is used for WeakMapImpl's buffer.
2237
2238         * WTF.xcodeproj/project.pbxproj:
2239         * wtf/CMakeLists.txt:
2240         * wtf/JSValueMalloc.cpp: Added.
2241         (WTF::tryJSValueMalloc):
2242         (WTF::jsValueMalloc):
2243         (WTF::jsValueRealloc):
2244         (WTF::jsValueFree):
2245         * wtf/JSValueMalloc.h: Added.
2246         (WTF::JSValueMalloc::malloc):
2247         (WTF::JSValueMalloc::tryMalloc):
2248         (WTF::JSValueMalloc::realloc):
2249         (WTF::JSValueMalloc::free):
2250         * wtf/MallocPtr.h:
2251         (WTF::MallocPtr::~MallocPtr):
2252         (WTF::MallocPtr::malloc):
2253         (WTF::MallocPtr::tryMalloc):
2254         (WTF::MallocPtr::realloc):
2255         We extend MallocPtr to adopt malloc scheme as its template parameter.
2256
2257 2017-12-11  Filip Pizlo  <fpizlo@apple.com>
2258
2259         It should be possible to flag a cell for unconditional finalization
2260         https://bugs.webkit.org/show_bug.cgi?id=180636
2261
2262         Reviewed by Saam Barati.
2263         
2264         This adds ConcurrentVector, which is like SegmentedVector, but wastes some space to allow
2265         resizing to proceed concurrently to access. It's not possible to resize concurrently to
2266         resizing, concurrent read/writes aren't protected from racing if they access the same element,
2267         and who knows what you'll get if you iterate up to size() while someone else append()s. The
2268         key insight is to stash all prior copies of the spine, so that nobody crashes trying to access
2269         a stale spine.
2270         
2271         I'm going to want to do the same thing for FastBitVector, by creating a segmented WordOwner
2272         class. That would require repeating the dance of having a spine that can resize while stashing
2273         old versions. So, the spine resizing logic is abstracted behind ConcurrentBuffer. You could
2274         use that as a kind of "concurrent vector" for immutable data. That's how ConcurrentVector uses
2275         it: it's an immutable array of segment pointers.
2276
2277         * WTF.xcodeproj/project.pbxproj:
2278         * wtf/ConcurrentBuffer.h: Added.
2279         (WTF::ConcurrentBuffer::ConcurrentBuffer):
2280         (WTF::ConcurrentBuffer::~ConcurrentBuffer):
2281         (WTF::ConcurrentBuffer::growExact):
2282         (WTF::ConcurrentBuffer::grow):
2283         (WTF::ConcurrentBuffer::array const):
2284         (WTF::ConcurrentBuffer::operator[]):
2285         (WTF::ConcurrentBuffer::operator[] const):
2286         (WTF::ConcurrentBuffer::createArray):
2287         * wtf/ConcurrentVector.h: Added.
2288         (WTF::ConcurrentVectorIterator::~ConcurrentVectorIterator):
2289         (WTF::ConcurrentVectorIterator::operator* const):
2290         (WTF::ConcurrentVectorIterator::operator-> const):
2291         (WTF::ConcurrentVectorIterator::operator++):
2292         (WTF::ConcurrentVectorIterator::operator== const):
2293         (WTF::ConcurrentVectorIterator::operator!= const):
2294         (WTF::ConcurrentVectorIterator::operator=):
2295         (WTF::ConcurrentVectorIterator::ConcurrentVectorIterator):
2296         (WTF::ConcurrentVector::~ConcurrentVector):
2297         (WTF::ConcurrentVector::size const):
2298         (WTF::ConcurrentVector::isEmpty const):
2299         (WTF::ConcurrentVector::at):
2300         (WTF::ConcurrentVector::at const):
2301         (WTF::ConcurrentVector::operator[]):
2302         (WTF::ConcurrentVector::operator[] const):
2303         (WTF::ConcurrentVector::first):
2304         (WTF::ConcurrentVector::first const):
2305         (WTF::ConcurrentVector::last):
2306         (WTF::ConcurrentVector::last const):
2307         (WTF::ConcurrentVector::takeLast):
2308         (WTF::ConcurrentVector::append):
2309         (WTF::ConcurrentVector::alloc):
2310         (WTF::ConcurrentVector::removeLast):
2311         (WTF::ConcurrentVector::grow):
2312         (WTF::ConcurrentVector::begin):
2313         (WTF::ConcurrentVector::end):
2314         (WTF::ConcurrentVector::segmentExistsFor):
2315         (WTF::ConcurrentVector::segmentFor):
2316         (WTF::ConcurrentVector::subscriptFor):
2317         (WTF::ConcurrentVector::ensureSegmentsFor):
2318         (WTF::ConcurrentVector::ensureSegment):
2319         (WTF::ConcurrentVector::allocateSegment):
2320
2321 2017-12-12  JF Bastien  <jfbastien@apple.com>
2322
2323         makeString: support more integral types
2324         https://bugs.webkit.org/show_bug.cgi?id=180720
2325
2326         Reviewed by Sam Weinig.
2327
2328         Only some integral types worked. Add more types by using template
2329         magic. While we're here, also use the same magic for
2330         floating-point types in the theoretical future where short float
2331         or long double matter.
2332
2333         The core of the magic is a second, defaulted, template
2334         parameter. It's declared in Forward.h (as void), and then in
2335         classes where we want to enable_if we use it (in C++ speak we
2336         create a partial class template specialization), otherwise we
2337         leave it as void.
2338
2339         Also clean up some constructors which were being way too verbose
2340         in stating that they were declarations for this template
2341         specialization right here, when really we already knew that.
2342
2343         * wtf/Forward.h:
2344         * wtf/text/StringConcatenate.h:
2345         (WTF::StringTypeAdapter<char>::StringTypeAdapter<char>): Deleted.
2346         (WTF::StringTypeAdapter<char>::length): Deleted.
2347         (WTF::StringTypeAdapter<char>::is8Bit): Deleted.
2348         (WTF::StringTypeAdapter<char>::writeTo const): Deleted.
2349         (WTF::StringTypeAdapter<char>::toString const): Deleted.
2350         (WTF::StringTypeAdapter<UChar>::StringTypeAdapter<UChar>): Deleted.
2351         (WTF::StringTypeAdapter<UChar>::length const): Deleted.
2352         (WTF::StringTypeAdapter<UChar>::is8Bit const): Deleted.
2353         (WTF::StringTypeAdapter<UChar>::writeTo const): Deleted.
2354         (WTF::StringTypeAdapter<UChar>::toString const): Deleted.
2355         (WTF::StringTypeAdapter<char::StringTypeAdapter): Deleted.
2356         (WTF::StringTypeAdapter<ASCIILiteral>::StringTypeAdapter): Deleted.
2357         (WTF::StringTypeAdapter<Vector<char>>::StringTypeAdapter): Deleted.
2358         (WTF::StringTypeAdapter<Vector<char>>::length const): Deleted.
2359         (WTF::StringTypeAdapter<Vector<char>>::is8Bit const): Deleted.
2360         (WTF::StringTypeAdapter<Vector<char>>::writeTo const): Deleted.
2361         (WTF::StringTypeAdapter<Vector<char>>::toString const): Deleted.
2362         (WTF::StringTypeAdapter<String>::StringTypeAdapter<String>): Deleted.
2363         (WTF::StringTypeAdapter<String>::length const): Deleted.
2364         (WTF::StringTypeAdapter<String>::is8Bit const): Deleted.
2365         (WTF::StringTypeAdapter<String>::writeTo const): Deleted.
2366         (WTF::StringTypeAdapter<String>::toString const): Deleted.
2367         (WTF::StringTypeAdapter<AtomicString>::StringTypeAdapter): Deleted.
2368         * wtf/text/StringConcatenateNumbers.h:
2369         (WTF::StringTypeAdapter<FormattedNumber>::StringTypeAdapter):
2370         (WTF::StringTypeAdapter<int>::StringTypeAdapter<int>): Deleted.
2371         (WTF::StringTypeAdapter<int>::length const): Deleted.
2372         (WTF::StringTypeAdapter<int>::is8Bit const): Deleted.
2373         (WTF::StringTypeAdapter<int>::writeTo const): Deleted.
2374         (WTF::StringTypeAdapter<int>::toString const): Deleted.
2375         (WTF::StringTypeAdapter<unsigned>::StringTypeAdapter<unsigned>): Deleted.
2376         (WTF::StringTypeAdapter<unsigned>::length const): Deleted.
2377         (WTF::StringTypeAdapter<unsigned>::is8Bit const): Deleted.
2378         (WTF::StringTypeAdapter<unsigned>::writeTo const): Deleted.
2379         (WTF::StringTypeAdapter<unsigned>::toString const): Deleted.
2380         (WTF::StringTypeAdapter<double>::StringTypeAdapter<double>): Deleted.
2381         (WTF::StringTypeAdapter<double>::length const): Deleted.
2382         (WTF::StringTypeAdapter<double>::is8Bit const): Deleted.
2383         (WTF::StringTypeAdapter<double>::writeTo const): Deleted.
2384         (WTF::StringTypeAdapter<double>::toString const): Deleted.
2385         (WTF::StringTypeAdapter<float>::StringTypeAdapter<float>): Deleted.
2386         (WTF::StringTypeAdapter<FormattedNumber>::StringTypeAdapter<FormattedNumber>): Deleted.
2387         * wtf/text/StringView.h:
2388         (WTF::StringTypeAdapter<StringView>::StringTypeAdapter<StringView>): Deleted.
2389         (WTF::StringTypeAdapter<StringView>::length): Deleted.
2390         (WTF::StringTypeAdapter<StringView>::is8Bit): Deleted.
2391         (WTF::StringTypeAdapter<StringView>::writeTo): Deleted.
2392         (WTF::StringTypeAdapter<StringView>::toString const): Deleted.
2393
2394 2017-12-12  Caio Lima  <ticaiolima@gmail.com>
2395
2396         [ESNext][BigInt] Implement BigInt literals and JSBigInt
2397         https://bugs.webkit.org/show_bug.cgi?id=179000
2398
2399         Reviewed by Darin Adler and Yusuke Suzuki.
2400
2401         * wtf/HashFunctions.h:
2402
2403 2017-12-12  Joseph Pecoraro  <pecoraro@apple.com>
2404
2405         Symbol not found: __ZN3WTF8LockBase10unlockSlowEv
2406         https://bugs.webkit.org/show_bug.cgi?id=180691
2407
2408         Reviewed by Yusuke Suzuki.
2409
2410         * wtf/mac/DeprecatedSymbolsUsedBySafari.mm:
2411         (WTF::LockBase::lockSlow):
2412         (WTF::LockBase::unlockSlow):
2413         Add back LockBase Symbols used by System Safari on 10.13.
2414
2415 2017-12-12  Yusuke Suzuki  <utatane.tea@gmail.com>
2416
2417         [WTF] Thread::create should have Thread::tryCreate
2418         https://bugs.webkit.org/show_bug.cgi?id=180333
2419
2420         Reviewed by Darin Adler.
2421
2422         Many callers of Thread::create assume that it returns non-nullptr Thread.
2423         But if the number of threads hits the limit in the system, creating Thread
2424         would fail. In that case, it is really difficult to keep WebKit working.
2425
2426         We introduce Thread::tryCreate, and change the returned value from Thread::create
2427         from RefPtr<Thread> to Ref<Thread>. In Thread::create, we ensure thread creation
2428         succeeds by RELEASE_ASSERT. And we use Thread::create intentionally if the
2429         caller assumes that thread should be created.
2430
2431         * wtf/AutomaticThread.cpp:
2432         (WTF::AutomaticThread::start):
2433         * wtf/ParallelJobsGeneric.cpp:
2434         (WTF::ParallelEnvironment::ThreadPrivate::tryLockFor):
2435         * wtf/Threading.cpp:
2436         (WTF::Thread::tryCreate):
2437         (WTF::Thread::create): Deleted.
2438         * wtf/Threading.h:
2439         (WTF::Thread::create):
2440         * wtf/WorkQueue.cpp:
2441         (WTF::WorkQueue::concurrentApply):
2442
2443 2017-12-11  Eric Carlson  <eric.carlson@apple.com>
2444
2445         Web Inspector: Optionally log WebKit log parameters as JSON
2446         https://bugs.webkit.org/show_bug.cgi?id=180529
2447         <rdar://problem/35909462>
2448
2449         Reviewed by Joseph Pecoraro.
2450
2451         * wtf/Logger.h:
2452         (WTF::Logger::log):
2453         (WTF::LogArgument<Logger::LogSiteIdentifier>::toString):
2454
2455         * wtf/MediaTime.cpp:
2456         (WTF::MediaTime::toJSONString const): Serialize to JSON string.
2457         * wtf/MediaTime.h:
2458
2459 2017-12-11  Tim Horton  <timothy_horton@apple.com>
2460
2461         Stop using deprecated target conditional for simulator builds
2462         https://bugs.webkit.org/show_bug.cgi?id=180662
2463         <rdar://problem/35136156>
2464
2465         Reviewed by Simon Fraser.
2466
2467         * wtf/Platform.h:
2468
2469 2017-12-11  Yusuke Suzuki  <utatane.tea@gmail.com>
2470
2471         [WTF] Add Converter traits to StringHasher instead of function pointer
2472         https://bugs.webkit.org/show_bug.cgi?id=180656
2473
2474         Reviewed by JF Bastien.
2475
2476         In the latest ICU, UChar is char16_t. So defining defaultConverter(UChar)
2477         and defaultConverter(char16_t) causes duplicate definitions.
2478         Instead of passing a funtion pointer, we pass a trait class DefaultConveter
2479         which has `convert` static function. And we make this `convert` function
2480         generic. This avoids defining convert function for UChar and char16_t.
2481
2482         * wtf/text/StringHash.h:
2483         (WTF::ASCIICaseInsensitiveHash::FoldCase::convert):
2484         (WTF::ASCIICaseInsensitiveHash::hash):
2485         (WTF::ASCIICaseInsensitiveHash::foldCase): Deleted.
2486         * wtf/text/StringHasher.h:
2487         (WTF::StringHasher::DefaultConverter::convert):
2488         (WTF::StringHasher::addCharactersAssumingAligned):
2489         (WTF::StringHasher::addCharacters):
2490         (WTF::StringHasher::computeHashAndMaskTop8Bits):
2491         (WTF::StringHasher::computeHash):
2492         (WTF::StringHasher::computeLiteralHash):
2493         (WTF::StringHasher::computeLiteralHashAndMaskTop8Bits):
2494         (WTF::StringHasher::computeHashImpl):
2495         (WTF::StringHasher::Converter): Deleted.
2496         (WTF::StringHasher::defaultConverter): Deleted.
2497
2498 2017-12-10  Yusuke Suzuki  <utatane.tea@gmail.com>
2499
2500         [WTF] Reduce sizeof(Thread) by adjusting alignment
2501         https://bugs.webkit.org/show_bug.cgi?id=180630
2502
2503         Reviewed by Saam Barati.
2504
2505         Reduce sizeof(Thread) slightly by adjusting alignment.
2506
2507         * wtf/Threading.h:
2508
2509 2017-12-10  Yusuke Suzuki  <utatane.tea@gmail.com>
2510
2511         Unreviewed, follow-up patch after r225726
2512         https://bugs.webkit.org/show_bug.cgi?id=180622
2513
2514         Suggested by Darin. We should take care of signed-extension of `char`.
2515
2516         * wtf/text/StringHasher.h:
2517         (WTF::StringHasher::defaultConverter):
2518
2519 2017-12-09  Yusuke Suzuki  <utatane.tea@gmail.com>
2520
2521         [WTF] Remove RELAXED_CONSTEXPR
2522         https://bugs.webkit.org/show_bug.cgi?id=180624
2523
2524         Reviewed by JF Bastien.
2525
2526         All of our required compilers support relaxed constexpr in C++14.
2527         We can drop RELAXED_CONSTEXPR macro in our tree.
2528
2529         * wtf/Compiler.h:
2530         * wtf/Expected.h:
2531         (std::experimental::fundamentals_v3::expected::operator*):
2532         (std::experimental::fundamentals_v3::expected::value):
2533         (std::experimental::fundamentals_v3::expected::error):
2534         * wtf/Unexpected.h:
2535         (std::experimental::fundamentals_v3::unexpected::value):
2536         (std::experimental::fundamentals_v3::unexpected::value const):
2537
2538 2017-12-09  Yusuke Suzuki  <utatane.tea@gmail.com>
2539
2540         Fix WTF::Hasher tuple expansion with variadic args
2541         https://bugs.webkit.org/show_bug.cgi?id=180623
2542
2543         Reviewed by JF Bastien.
2544
2545         We expand a tuple with `...`, and use this in a function's argument list.
2546         And in this argument list, we call `add()` for each value. This will be
2547         expanded as follows.
2548
2549             [] (...) { }((add(hasher, std::get<i>(values)), 0)...);
2550
2551         will become,
2552
2553             [] (...) { }((add(hasher, std::get<0>(values)), 0), (add(hasher, std::get<1>(values)), 0), ...);
2554
2555         However, the evaluation order of the C++ argument is unspecified. Actually,
2556         in GCC environment, this `add()` is not called in our expected order. As a
2557         result, currently we have test failures in TestWTF.
2558
2559         This patch just uses variadic templates to expand tuples, and call add() in
2560         our expected order. This patch fixes an existing failure of TestWTF in GCC environment.
2561
2562         * wtf/Hasher.h:
2563         (WTF::Hasher::computeHash):
2564         (WTF::addArgs):
2565         (WTF::addTupleHelper):
2566         (WTF::add):
2567
2568 2017-12-09  Yusuke Suzuki  <utatane.tea@gmail.com>
2569
2570         Use relaxed constexpr for StringHasher
2571         https://bugs.webkit.org/show_bug.cgi?id=180622
2572
2573         Reviewed by JF Bastien.
2574
2575         Now VC++ is updated and all the WebKit compilers support C++14 relaxed constexpr.
2576         This patch uses relaxed constexpr for StringHasher constexpr implementation
2577
2578         * wtf/text/StringHasher.h:
2579         (WTF::StringHasher::addCharactersAssumingAligned):
2580         (WTF::StringHasher::Converter):
2581         (WTF::StringHasher::computeHashAndMaskTop8Bits):
2582         (WTF::StringHasher::computeHash):
2583         (WTF::StringHasher::computeLiteralHash):
2584         (WTF::StringHasher::computeLiteralHashAndMaskTop8Bits):
2585         (WTF::StringHasher::defaultConverter):
2586         (WTF::StringHasher::avalancheBits):
2587         (WTF::StringHasher::finalize):
2588         (WTF::StringHasher::finalizeAndMaskTop8Bits):
2589         (WTF::StringHasher::avoidZero):
2590         (WTF::StringHasher::calculateWithRemainingLastCharacter):
2591         (WTF::StringHasher::calculateWithTwoCharacters):
2592         (WTF::StringHasher::processPendingCharacter const):
2593         (WTF::StringHasher::StringHasher): Deleted.
2594         (WTF::StringHasher::avalancheBits3): Deleted.
2595         (WTF::StringHasher::avalancheBits2): Deleted.
2596         (WTF::StringHasher::avalancheBits1): Deleted.
2597         (WTF::StringHasher::avalancheBits0): Deleted.
2598         (WTF::StringHasher::calculateWithRemainingLastCharacter1): Deleted.
2599         (WTF::StringHasher::calculateWithRemainingLastCharacter0): Deleted.
2600         (WTF::StringHasher::calculate1): Deleted.
2601         (WTF::StringHasher::calculate0): Deleted.
2602         (WTF::StringHasher::calculate): Deleted.
2603         (WTF::StringHasher::computeLiteralHashImpl): Deleted.
2604
2605 2017-12-08  Eric Carlson  <eric.carlson@apple.com>
2606
2607         Move Logger from PAL to WTF so it can be used outside of WebCore
2608         https://bugs.webkit.org/show_bug.cgi?id=180561
2609
2610         Reviewed by Alex Christensen.
2611
2612         * WTF.xcodeproj/project.pbxproj:
2613         * wtf/Logger.h: Copied from Source/WebCore/PAL/pal/Logger.h.
2614         (PAL::LogArgument::toString): Deleted.
2615         (PAL::Logger::create): Deleted.
2616         (PAL::Logger::logAlways const): Deleted.
2617         (PAL::Logger::error const): Deleted.
2618         (PAL::Logger::warning const): Deleted.
2619         (PAL::Logger::info const): Deleted.
2620         (PAL::Logger::debug const): Deleted.
2621         (PAL::Logger::willLog const): Deleted.
2622         (PAL::Logger::enabled const): Deleted.
2623         (PAL::Logger::setEnabled): Deleted.
2624         (PAL::Logger::LogSiteIdentifier::LogSiteIdentifier): Deleted.
2625         (PAL::Logger::addObserver): Deleted.
2626         (PAL::Logger::removeObserver): Deleted.
2627         (PAL::Logger::Logger): Deleted.
2628         (PAL::Logger::log): Deleted.
2629         (PAL::Logger::observers): Deleted.
2630         (PAL::LogArgument<Logger::LogSiteIdentifier>::toString): Deleted.
2631         * wtf/LoggerHelper.h: Copied from Source/WebCore/PAL/pal/LoggerHelper.h.
2632
2633 2017-12-08  Yusuke Suzuki  <utatane.tea@gmail.com>
2634
2635         Remove pthread_once in favor of dispatch_once
2636         https://bugs.webkit.org/show_bug.cgi?id=180591
2637
2638         Reviewed by Saam Barati.
2639
2640         Fix the comment.
2641
2642         * wtf/Threading.h:
2643         (WTF::Thread::current):
2644
2645 2017-12-08  Yusuke Suzuki  <utatane.tea@gmail.com>
2646
2647         [WTF][Linux][GTK] Fix a minor bug in generic/WorkQueue when WorkQueue is immediately destroyed
2648         https://bugs.webkit.org/show_bug.cgi?id=180586
2649
2650         Reviewed by Darin Adler.
2651
2652         If WorkQueue is created and destroyed immediately, RunLoop::stop can be called
2653         befire calling RunLoop::run(). At that time WorkQueue thread is not stopped.
2654
2655         This patch dispatches a task stopping its own RunLoop to ensure stop is done.
2656         We also clean up WorkQueue implementation not to include unnecessary fields,
2657         lock, condition, and thread.
2658
2659         * wtf/WorkQueue.h:
2660         * wtf/generic/WorkQueueGeneric.cpp:
2661         (WorkQueue::platformInitialize):
2662         (WorkQueue::platformInvalidate):
2663
2664 2017-12-08  Yusuke Suzuki  <utatane.tea@gmail.com>
2665
2666         [WTF] Remove remaining use of Mutex
2667         https://bugs.webkit.org/show_bug.cgi?id=180579
2668
2669         Reviewed by Alex Christensen.
2670
2671         Mutex should be only used in low-level Locking and Threading.
2672         Other ones should use WTF::Lock and WTF::Condition instead.
2673         This patch replaces WTF::Mutex with WTF::Lock in WTF if it
2674         is not related to threading or locking implementation.
2675
2676         And we also use WTF::Lock and WTF::Condition in WTF::BinarySemaphore.
2677
2678         * wtf/RunLoop.cpp:
2679         (WTF::RunLoop::performWork):
2680         (WTF::RunLoop::dispatch):
2681         * wtf/RunLoop.h:
2682         * wtf/WorkQueue.cpp:
2683         * wtf/WorkQueue.h:
2684         * wtf/threads/BinarySemaphore.cpp:
2685         (WTF::BinarySemaphore::signal):
2686         (WTF::BinarySemaphore::wait):
2687         (WTF::BinarySemaphore::BinarySemaphore): Deleted.
2688         (WTF::BinarySemaphore::~BinarySemaphore): Deleted.
2689         * wtf/threads/BinarySemaphore.h:
2690         * wtf/win/WorkQueueWin.cpp:
2691         (WTF::WorkQueue::registerHandle):
2692         (WTF::WorkQueue::unregisterAndCloseHandle):
2693         (WTF::WorkQueue::dispatch):
2694         (WTF::WorkQueue::timerCallback):
2695         (WTF::WorkQueue::dispatchAfter):
2696         (WTF::TimerContext::TimerContext): Deleted.
2697
2698 2017-12-08  Yusuke Suzuki  <utatane.tea@gmail.com>
2699
2700         Use StaticLock and Lock instead of Mutex in Windows WebKitLegacy
2701         https://bugs.webkit.org/show_bug.cgi?id=180572
2702
2703         Reviewed by Mark Lam.
2704
2705         Remove DEPRECATED_DEFINE_STATIC_LOCAL since it's no longer used.
2706
2707         * wtf/StdLibExtras.h:
2708
2709 2017-12-07  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2710
2711         [Win] [64-bit] Resolve Microsoft warning C4319 on BitVector.cpp
2712         https://bugs.webkit.org/show_bug.cgi?id=180490
2713
2714         Reviewed by Alex Christensen.
2715
2716         bitsInPointer() returns unsigned which is smaller than size_t.
2717         "~"(negate) operator is applied before extending its size which result filled with zero.
2718         This may be potentially a bug if numBits is greater than max value of unsigned long
2719         (which is not practical).
2720
2721         * wtf/BitVector.cpp:
2722         (WTF::BitVector::OutOfLineBits::create):
2723
2724 2017-12-07  Yusuke Suzuki  <utatane.tea@gmail.com>
2725
2726         Use WTF Locking primitives in WebThread and drop pthread_xxx use
2727         https://bugs.webkit.org/show_bug.cgi?id=180445
2728
2729         Reviewed by Saam Barati.
2730
2731         Add initializer form to fill struct with zero if struct does not have any default initializers.
2732
2733         * wtf/ThreadSpecific.h:
2734         (WTF::ThreadSpecific::Data::Data):
2735
2736 2017-12-07  Mark Lam  <mark.lam@apple.com>
2737
2738         Apply poisoning to some native code pointers.
2739         https://bugs.webkit.org/show_bug.cgi?id=180541
2740         <rdar://problem/35916875>
2741
2742         Reviewed by Filip Pizlo.
2743
2744         Ensure that the resultant poisoned bits still looks like a pointer in that its
2745         bottom bits are 0, just like the alignment bits of a pointer.  This allows the
2746         client to use the bottom bits of the poisoned bits as flag bits just like the
2747         client was previously able to do with pointer values.
2748
2749         Note: we only ensure that the bottom alignment bits of the generated poison
2750         value is 0.  We're not masking out the poisoned bits.  This means that the bottom
2751         bits of the poisoned bits will only be null if the original pointer is aligned.
2752         Hence, if the client applies the poison to an unaligned pointer, we do not lose
2753         any information on the low bits.
2754
2755         Also removed 2 wrong assertions in PoisonedImpl's constructors.  We were
2756         asserting that Poisoned will never be used with a null value, but that's invalid.
2757         We do want to allow a null value so that we don't have to constantly do null
2758         checks in the clients.  This was uncovered by some layout tests.
2759
2760         * wtf/Poisoned.cpp:
2761         (WTF::makePoison):
2762         * wtf/Poisoned.h:
2763         (WTF::PoisonedImpl::PoisonedImpl):
2764
2765 2017-12-07  Mark Lam  <mark.lam@apple.com>
2766
2767         [Re-landing r225620] Refactoring: Rename ScrambledPtr to Poisoned.
2768         https://bugs.webkit.org/show_bug.cgi?id=180514
2769
2770         Reviewed by Saam Barati and JF Bastien.
2771
2772         Re-landing r225620 with speculative build fix for GCC 7.
2773
2774         * WTF.xcodeproj/project.pbxproj:
2775         * wtf/CMakeLists.txt:
2776         * wtf/Poisoned.cpp: Copied from Source/WTF/wtf/ScrambledPtr.cpp.
2777         (WTF::makePoison):
2778         (WTF::makeScrambledPtrKey): Deleted.
2779         * wtf/Poisoned.h: Copied from Source/WTF/wtf/ScrambledPtr.h.
2780         (WTF::PoisonedImpl::PoisonedImpl):
2781         (WTF::PoisonedImpl::assertIsPoisoned const):
2782         (WTF::PoisonedImpl::assertIsNotPoisoned const):
2783         (WTF::PoisonedImpl::unpoisoned const):
2784         (WTF::PoisonedImpl::operator-> const):
2785         (WTF::PoisonedImpl::bits const):
2786         (WTF::PoisonedImpl::operator! const):
2787         (WTF::PoisonedImpl::operator bool const):
2788         (WTF::PoisonedImpl::operator== const):
2789         (WTF::PoisonedImpl::operator==):
2790         (WTF::PoisonedImpl::operator=):
2791         (WTF::PoisonedImpl::poison):
2792         (WTF::PoisonedImpl::unpoison):
2793         (WTF::ScrambledPtr::ScrambledPtr): Deleted.
2794         (WTF::ScrambledPtr::assertIsScrambled const): Deleted.
2795         (WTF::ScrambledPtr::assertIsNotScrambled const): Deleted.
2796         (WTF::ScrambledPtr::descrambled const): Deleted.
2797         (WTF::ScrambledPtr::operator-> const): Deleted.
2798         (WTF::ScrambledPtr::bits const): Deleted.
2799         (WTF::ScrambledPtr::operator! const): Deleted.
2800         (WTF::ScrambledPtr::operator bool const): Deleted.
2801         (WTF::ScrambledPtr::operator== const): Deleted.
2802         (WTF::ScrambledPtr::operator==): Deleted.
2803         (WTF::ScrambledPtr::operator=): Deleted.
2804         (WTF::ScrambledPtr::scramble): Deleted.
2805         (WTF::ScrambledPtr::descramble): Deleted.
2806         * wtf/ScrambledPtr.cpp: Removed.
2807         * wtf/ScrambledPtr.h: Removed.
2808
2809 2017-12-07  Michael Catanzaro  <mcatanzaro@igalia.com>
2810
2811         Unreviewed, rolling out r225620
2812         https://bugs.webkit.org/show_bug.cgi?id=180514
2813         <rdar://problem/35901694>
2814
2815         It broke the build with GCC 7, and I don't know how to fix it.
2816
2817         * WTF.xcodeproj/project.pbxproj:
2818         * wtf/CMakeLists.txt:
2819         * wtf/Poisoned.h: Removed.
2820         * wtf/ScrambledPtr.cpp: Renamed from Source/WTF/wtf/Poisoned.cpp.
2821         (WTF::makeScrambledPtrKey):
2822         * wtf/ScrambledPtr.h: Added.
2823         (WTF::ScrambledPtr::ScrambledPtr):
2824         (WTF::ScrambledPtr::assertIsScrambled const):
2825         (WTF::ScrambledPtr::assertIsNotScrambled const):
2826         (WTF::ScrambledPtr::descrambled const):
2827         (WTF::ScrambledPtr::operator-> const):
2828         (WTF::ScrambledPtr::bits const):
2829         (WTF::ScrambledPtr::operator! const):
2830         (WTF::ScrambledPtr::operator bool const):
2831         (WTF::ScrambledPtr::operator== const):
2832         (WTF::ScrambledPtr::operator==):
2833         (WTF::ScrambledPtr::operator=):
2834         (WTF::ScrambledPtr::scramble):
2835         (WTF::ScrambledPtr::descramble):
2836
2837 2017-12-06  Mark Lam  <mark.lam@apple.com>
2838
2839         Refactoring: Rename ScrambledPtr to Poisoned.
2840         https://bugs.webkit.org/show_bug.cgi?id=180514
2841
2842         Reviewed by Saam Barati.
2843
2844         We're switching our nomenclature to "poisoning" instead of "scrambling" pointers.
2845         This allows us to use shorter names.
2846
2847         This patch is almost purely refactoring, except for one change: the PoisonedImpl
2848         template class (previously ScrambledPtr) has been modified to allow usage of
2849         a constexpr uint32_t poison value (see Int32Poisoned) in addition to a runtime
2850         determined uintptr_t poison value (see Poisoned).
2851
2852         * WTF.xcodeproj/project.pbxproj:
2853         * wtf/CMakeLists.txt:
2854         * wtf/Poisoned.cpp: Copied from Source/WTF/wtf/ScrambledPtr.cpp.
2855         (WTF::makePoison):
2856         (WTF::makeScrambledPtrKey): Deleted.
2857         * wtf/Poisoned.h: Copied from Source/WTF/wtf/ScrambledPtr.h.
2858         (WTF::PoisonedImpl::PoisonedImpl):
2859         (WTF::PoisonedImpl::assertIsPoisoned const):
2860         (WTF::PoisonedImpl::assertIsNotPoisoned const):
2861         (WTF::PoisonedImpl::unpoisoned const):
2862         (WTF::PoisonedImpl::operator-> const):
2863         (WTF::PoisonedImpl::bits const):
2864         (WTF::PoisonedImpl::operator! const):
2865         (WTF::PoisonedImpl::operator bool const):
2866         (WTF::PoisonedImpl::operator== const):
2867         (WTF::PoisonedImpl::operator==):
2868         (WTF::PoisonedImpl::operator=):
2869         (WTF::PoisonedImpl::poison):
2870         (WTF::PoisonedImpl::unpoison):
2871         (WTF::ScrambledPtr::ScrambledPtr): Deleted.
2872         (WTF::ScrambledPtr::assertIsScrambled const): Deleted.
2873         (WTF::ScrambledPtr::assertIsNotScrambled const): Deleted.
2874         (WTF::ScrambledPtr::descrambled const): Deleted.
2875         (WTF::ScrambledPtr::operator-> const): Deleted.
2876         (WTF::ScrambledPtr::bits const): Deleted.
2877         (WTF::ScrambledPtr::operator! const): Deleted.
2878         (WTF::ScrambledPtr::operator bool const): Deleted.
2879         (WTF::ScrambledPtr::operator== const): Deleted.
2880         (WTF::ScrambledPtr::operator==): Deleted.
2881         (WTF::ScrambledPtr::operator=): Deleted.
2882         (WTF::ScrambledPtr::scramble): Deleted.
2883         (WTF::ScrambledPtr::descramble): Deleted.
2884         * wtf/ScrambledPtr.cpp: Removed.
2885         * wtf/ScrambledPtr.h: Removed.
2886
2887 2017-12-02  Darin Adler  <darin@apple.com>
2888
2889         Modernize some aspects of text codecs, eliminate WebKit use of strcasecmp
2890         https://bugs.webkit.org/show_bug.cgi?id=180009
2891
2892         Reviewed by Alex Christensen.
2893
2894         * wtf/Assertions.cpp: Removed include of StringExtras.h.
2895         (WTFLogChannelByName): Use equalIgnoringASCIICase instead of strcasecmp.
2896         * wtf/DateMath.cpp: Removed include of StringExtras.h.
2897         * wtf/MD5.cpp: Ditto. Also removed include of CString.h.
2898         * wtf/SHA1.cpp: Ditto.
2899
2900         * wtf/StringExtras.h:
2901         (strncasecmp): Deleted.
2902         (strcasecmp): Deleted.
2903
2904         * wtf/StringPrintStream.cpp: Removed include of StringExtras.h.
2905         * wtf/text/Base64.cpp: Ditto.
2906
2907         * wtf/text/LineEnding.cpp:
2908         (WTF::normalizeLineEndingsToLF): Replaced old more general purpose function with
2909         this. Changed argument type to vector and used an rvalue reference and return value.
2910         Also fixed some small logic errors.
2911         (WTF::normalizeLineEndingsToCRLF): Ditto.
2912         (WTF::normalizeLineEndingsToNative): Updated for above changes.
2913         * wtf/text/LineEnding.h: Updated for above changes.
2914
2915         * wtf/text/StringCommon.h:
2916         (WTF::equalIgnoringASCIICase): Added overload for const char*.
2917         (WTF::equalLettersIgnoringASCIICase): Ditto.
2918
2919         * wtf/text/TextStream.cpp: Removed include of StringExtras.h.
2920         * wtf/text/WTFString.cpp: Ditto.
2921         * wtf/unicode/icu/CollatorICU.cpp: Ditto.
2922
2923 2017-12-06  Yusuke Suzuki  <utatane.tea@gmail.com>
2924
2925         [WTF] Remove XXXLockBase since constexpr constructor can initialize static variables without calling global constructors
2926         https://bugs.webkit.org/show_bug.cgi?id=180495
2927
2928         Reviewed by Mark Lam.
2929
2930         Very nice feature of C++11 is that constexpr constructor can initialize static global variables
2931         without calling global constructors. We do not need to have XXXLockBase with derived XXXLock
2932         class since StaticXXXLock can have constructors as long as it is constexpr.
2933         We remove bunch of these classes, and set `XXXLock() = default;` explicitly for readability.
2934         C++11's default constructor is constexpr as long as its member's default constructor / default
2935         initializer is constexpr.
2936
2937         * wtf/Condition.h:
2938         (WTF::ConditionBase::construct): Deleted.
2939         (WTF::ConditionBase::waitUntil): Deleted.
2940         (WTF::ConditionBase::waitFor): Deleted.
2941         (WTF::ConditionBase::wait): Deleted.
2942         (WTF::ConditionBase::notifyOne): Deleted.
2943         (WTF::ConditionBase::notifyAll): Deleted.
2944         (WTF::Condition::Condition): Deleted.
2945         * wtf/CountingLock.h:
2946         (WTF::CountingLock::CountingLock): Deleted.
2947         (WTF::CountingLock::~CountingLock): Deleted.
2948         * wtf/Lock.cpp:
2949         (WTF::Lock::lockSlow):
2950         (WTF::Lock::unlockSlow):
2951         (WTF::Lock::unlockFairlySlow):
2952         (WTF::Lock::safepointSlow):
2953         (WTF::LockBase::lockSlow): Deleted.
2954         (WTF::LockBase::unlockSlow): Deleted.
2955         (WTF::LockBase::unlockFairlySlow): Deleted.
2956         (WTF::LockBase::safepointSlow): Deleted.
2957         * wtf/Lock.h:
2958         (WTF::LockBase::construct): Deleted.
2959         (WTF::LockBase::lock): Deleted.
2960         (WTF::LockBase::tryLock): Deleted.
2961         (WTF::LockBase::try_lock): Deleted.
2962         (WTF::LockBase::unlock): Deleted.
2963         (WTF::LockBase::unlockFairly): Deleted.
2964         (WTF::LockBase::safepoint): Deleted.
2965         (WTF::LockBase::isHeld const): Deleted.
2966         (WTF::LockBase::isLocked const): Deleted.
2967         (WTF::LockBase::isFullyReset const): Deleted.
2968         (WTF::Lock::Lock): Deleted.
2969         * wtf/ReadWriteLock.cpp:
2970         (WTF::ReadWriteLock::readLock):
2971         (WTF::ReadWriteLock::readUnlock):
2972         (WTF::ReadWriteLock::writeLock):
2973         (WTF::ReadWriteLock::writeUnlock):
2974         (WTF::ReadWriteLockBase::construct): Deleted.
2975         (WTF::ReadWriteLockBase::readLock): Deleted.
2976         (WTF::ReadWriteLockBase::readUnlock): Deleted.
2977         (WTF::ReadWriteLockBase::writeLock): Deleted.
2978         (WTF::ReadWriteLockBase::writeUnlock): Deleted.
2979         * wtf/ReadWriteLock.h:
2980         (WTF::ReadWriteLock::read):
2981         (WTF::ReadWriteLock::write):
2982         (WTF::ReadWriteLockBase::ReadLock::tryLock): Deleted.
2983         (WTF::ReadWriteLockBase::ReadLock::lock): Deleted.
2984         (WTF::ReadWriteLockBase::ReadLock::unlock): Deleted.
2985         (WTF::ReadWriteLockBase::WriteLock::tryLock): Deleted.
2986         (WTF::ReadWriteLockBase::WriteLock::lock): Deleted.
2987         (WTF::ReadWriteLockBase::WriteLock::unlock): Deleted.
2988         (WTF::ReadWriteLockBase::read): Deleted.
2989         (WTF::ReadWriteLockBase::write): Deleted.
2990         (WTF::ReadWriteLock::ReadWriteLock): Deleted.
2991         * wtf/RecursiveLockAdapter.h:
2992         (WTF::RecursiveLockAdapter::RecursiveLockAdapter): Deleted.
2993         * wtf/WordLock.cpp:
2994         (WTF::WordLock::lockSlow):
2995         (WTF::WordLock::unlockSlow):
2996         (WTF::WordLockBase::lockSlow): Deleted.
2997         (WTF::WordLockBase::unlockSlow): Deleted.
2998         * wtf/WordLock.h:
2999         (WTF::WordLockBase::lock): Deleted.
3000         (WTF::WordLockBase::unlock): Deleted.
3001         (WTF::WordLockBase::isHeld const): Deleted.
3002         (WTF::WordLockBase::isLocked const): Deleted.
3003         (WTF::WordLockBase::isFullyReset const): Deleted.
3004         (WTF::WordLock::WordLock): Deleted.
3005         * wtf/WorkQueue.cpp:
3006
3007 2017-12-05  Stephan Szabo  <stephan.szabo@sony.com>
3008
3009         Switch windows build to Visual Studio 2017
3010         https://bugs.webkit.org/show_bug.cgi?id=172412
3011
3012         Reviewed by Per Arne Vollan.
3013
3014         * WTF.vcxproj/WTF.proj:
3015         * wtf/Compiler.h:
3016
3017 2017-12-05  Andy Estes  <aestes@apple.com>
3018
3019         [Darwin] Simplify use of TargetConditionals
3020         https://bugs.webkit.org/show_bug.cgi?id=180455
3021         <rdar://problem/35142971>
3022
3023         Reviewed by Tim Horton.
3024
3025         There's no need to check if TARGET_* macros are defined on Darwin platforms, since
3026         TargetConditionals.h always defines them. Also, we can simplify
3027         (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR) to TARGET_OS_IPHONE.
3028
3029         * wtf/Platform.h:
3030
3031 2017-12-05  Matt Lewis  <jlewis3@apple.com>
3032
3033         Unreviewed, rolling out r225430.
3034
3035         This caused an API failure on release.
3036
3037         Reverted changeset:
3038
3039         "Move DateComponents into WTF"
3040         https://bugs.webkit.org/show_bug.cgi?id=180211
3041         https://trac.webkit.org/changeset/225430
3042
3043 2017-12-05  Michael Saboff  <msaboff@apple.com>
3044
3045         Make WebKit build for ARM64_32
3046         https://bugs.webkit.org/show_bug.cgi?id=180447
3047
3048         Reviewed by Mark Lam.
3049
3050         Add the 'w' (32bit) pointer qualifier for ARM64_32 pointers in inline assembly.
3051
3052         * wtf/darwin/WeakLinking.h:
3053         (WTF::isNullFunctionPointer):
3054
3055 2017-12-05  Filip Pizlo  <fpizlo@apple.com>
3056
3057         bmalloc IsoHeap needs to allow a thread to deallocate some size for the first time
3058         https://bugs.webkit.org/show_bug.cgi?id=180443
3059
3060         Reviewed by Saam Barati.
3061         
3062         With this change it's possible to reenable isoheaps on iOS.
3063
3064         * wtf/IsoMalloc.h:
3065         * wtf/IsoMallocInlines.h:
3066
3067 2017-12-05  Yusuke Suzuki  <utatane.tea@gmail.com>
3068
3069         [WTF] Remove m_atomicStringTableDestructor in Thread by querying the condition at thread destruction
3070         https://bugs.webkit.org/show_bug.cgi?id=180429
3071
3072         Reviewed by Alex Christensen.
3073
3074         We now have a pointer to the AtomicStringTable::destroy in Thread.
3075         This pointer becomes nullptr only when the thread is the web thread not to destroy AtomicStringTable
3076         twice in the UI thread and the web thread.
3077
3078         Instead of having a pointer in each Thread, we query whether the current thread is the web thread at
3079         Thread destruction. And use this information to call AtomicStringTable::destroy. Then, we can drop
3080         m_atomicStringTableDestructor field in Thread.
3081
3082         * wtf/Threading.cpp:
3083         (WTF::Thread::didExit):
3084         * wtf/Threading.h:
3085         * wtf/mac/MainThreadMac.mm:
3086         * wtf/text/AtomicStringTable.cpp:
3087         (WTF::AtomicStringTable::create):
3088         (WTF::AtomicStringTable::destroy):
3089         * wtf/text/AtomicStringTable.h:
3090
3091 2017-12-01  Filip Pizlo  <fpizlo@apple.com>
3092
3093         GC constraint solving should be parallel
3094         https://bugs.webkit.org/show_bug.cgi?id=179934
3095
3096         Reviewed by JF Bastien.
3097         
3098         This does some changes to make it easier to do parallel constraint solving:
3099         
3100         - I finally removed dependencyWith. This was a silly construct whose only purpose is to confuse
3101           people about what it means to have a dependency chain. I took that as an opportunity to grealy
3102           simplify the GC's use of dependency chaining.
3103         
3104         - Added more logic to Deque<>, since I use it for part of the load balancer.
3105         
3106         - Made it possible to profile lock contention. See
3107           https://bugs.webkit.org/show_bug.cgi?id=180250#c0 for some preliminary measurements.
3108         
3109         - Introduced holdLockIf, which makes it easy to perform predicated lock acquisition. We use that
3110           to pick a lock in WebCore.
3111         
3112         - Introduced CountingLock. It's like WTF::Lock except it also enables optimistic read transactions
3113           sorta like Java's StampedLock.
3114
3115         * WTF.xcodeproj/project.pbxproj:
3116         * wtf/Atomics.h:
3117         (WTF::dependency):
3118         (WTF::DependencyWith::DependencyWith): Deleted.
3119         (WTF::dependencyWith): Deleted.
3120         * wtf/BitVector.h:
3121         (WTF::BitVector::iterator::operator++):
3122         * wtf/CMakeLists.txt:
3123         * wtf/ConcurrentPtrHashSet.cpp: Added.
3124         (WTF::ConcurrentPtrHashSet::ConcurrentPtrHashSet):
3125         (WTF::ConcurrentPtrHashSet::~ConcurrentPtrHashSet):
3126         (WTF::ConcurrentPtrHashSet::deleteOldTables):
3127         (WTF::ConcurrentPtrHashSet::clear):
3128         (WTF::ConcurrentPtrHashSet::initialize):
3129         (WTF::ConcurrentPtrHashSet::addSlow):
3130         (WTF::ConcurrentPtrHashSet::resizeIfNecessary):
3131         (WTF::ConcurrentPtrHashSet::resizeAndAdd):
3132         (WTF::ConcurrentPtrHashSet::Table::create):
3133         * wtf/ConcurrentPtrHashSet.h: Added.
3134         (WTF::ConcurrentPtrHashSet::contains):
3135         (WTF::ConcurrentPtrHashSet::add):
3136         (WTF::ConcurrentPtrHashSet::size const):
3137         (WTF::ConcurrentPtrHashSet::Table::maxLoad const):
3138         (WTF::ConcurrentPtrHashSet::hash):
3139         (WTF::ConcurrentPtrHashSet::cast):
3140         (WTF::ConcurrentPtrHashSet::containsImpl const):
3141         (WTF::ConcurrentPtrHashSet::addImpl):
3142         * wtf/Deque.h:
3143         (WTF::inlineCapacity>::takeFirst):
3144         * wtf/FastMalloc.h:
3145         * wtf/Lock.cpp:
3146         (WTF::LockBase::lockSlow):
3147         * wtf/Locker.h:
3148         (WTF::holdLockIf):
3149         * wtf/ScopedLambda.h:
3150         * wtf/SharedTask.h:
3151         (WTF::SharedTask<PassedResultType):
3152         (WTF::SharedTask<ResultType): Deleted.
3153         * wtf/StackShot.h: Added.
3154         (WTF::StackShot::StackShot):
3155         (WTF::StackShot::operator=):
3156         (WTF::StackShot::array const):
3157         (WTF::StackShot::size const):
3158         (WTF::StackShot::operator bool const):
3159         (WTF::StackShot::operator== const):
3160         (WTF::StackShot::hash const):
3161         (WTF::StackShot::isHashTableDeletedValue const):
3162         (WTF::StackShot::operator> const):
3163         (WTF::StackShot::deletedValueArray):
3164         (WTF::StackShotHash::hash):
3165         (WTF::StackShotHash::equal):
3166         * wtf/StackShotProfiler.h: Added.
3167         (WTF::StackShotProfiler::StackShotProfiler):
3168         (WTF::StackShotProfiler::profile):
3169         (WTF::StackShotProfiler::run):
3170
3171 2017-12-05  Yusuke Suzuki  <utatane.tea@gmail.com>
3172
3173         [WTF] Use m_suspendCount instead of m_suspended flag in Thread
3174         https://bugs.webkit.org/show_bug.cgi?id=180427
3175
3176         Reviewed by Carlos Garcia Campos.
3177
3178         When resuming the thread, signal handler is reinvoked once before `sigsuspend` is resumed.
3179         But this handler should not do anything since it is just a signal for `sigsuspend`.
3180         Previously, we use m_suspenedd flag to distinguish between suspending and resuming signal
3181         handler invocations.
3182
3183         But this additional m_suspended flag is not necessary since we can use m_suspendCount instead.
3184         This patch drops m_suspended and use m_suspendCount. Since semaphore operations emit full memory
3185         barrier, m_suspendCount is loaded and stored as we expect.
3186
3187         * wtf/Threading.h:
3188         * wtf/ThreadingPthreads.cpp:
3189         (WTF::Thread::signalHandlerSuspendResume):
3190         (WTF::Thread::suspend):
3191         (WTF::Thread::resume):
3192
3193 2017-12-04  Simon Fraser  <simon.fraser@apple.com>
3194
3195         Minor DisplayRefreshMonitor-related cleanup
3196         https://bugs.webkit.org/show_bug.cgi?id=179802
3197
3198         Reviewed by Sam Weinig.
3199
3200         New trace point for when the CVDisplayLink fires on its own thread.
3201
3202         * wtf/SystemTracing.h:
3203
3204 2017-12-04  JF Bastien  <jfbastien@apple.com>
3205
3206         Update std::expected to match libc++ coding style
3207         https://bugs.webkit.org/show_bug.cgi?id=180264
3208
3209         Reviewed by Alex Christensen.
3210
3211         As of https://wg21.link/p0323r4 std::expected is on its way to the
3212         Library Fundamentals v3 TS (LEWG and EWG voted for this, but LWG
3213         hasn't done wording review yet, hence "on its way"). The API is
3214         therefore pretty close to what will be in the TS, and I've gotten
3215         requests for an easily usable implementation of std::expected. I
3216         talked to our clang team and they'll help me migrate our
3217         implementation to libc++, but our implementation has to look more
3218         like libc++ than it does now. Once in libc++ I'll maintain changes
3219         on both sides to make sure neither is out-of-date for too long.
3220
3221         - Fork std::unexpected into its own header.
3222         - Add mild support for an exception-based implementation, but
3223           don't do noexcept yet.
3224         - Rename everything to follow STL style, and keep a global using
3225           or variable alias where possible to reduce WebKit code churn.
3226         - Minor API updates to remove things that aren't in the proposal
3227           anymore.
3228
3229         * wtf/Expected.h:
3230         (std::experimental::fundamentals_v3::bad_expected_access<void>::bad_expected_access):
3231         (std::experimental::fundamentals_v3::bad_expected_access::bad_expected_access):
3232         (std::experimental::fundamentals_v3::bad_expected_access::error):
3233         (std::experimental::fundamentals_v3::bad_expected_access::error const):
3234         (std::experimental::fundamentals_v3::__expected_detail::constexpr_base::constexpr_base):
3235         (std::experimental::fundamentals_v3::__expected_detail::base::base):
3236         (std::experimental::fundamentals_v3::__expected_detail::base::~base):
3237         (std::experimental::fundamentals_v3::expected::expected):
3238         (std::experimental::fundamentals_v3::expected::operator=):
3239         (std::experimental::fundamentals_v3::expected::swap):
3240         (std::experimental::fundamentals_v3::expected::operator-> const):
3241         (std::experimental::fundamentals_v3::expected::operator->):
3242         (std::experimental::fundamentals_v3::expected::operator* const):
3243         (std::experimental::fundamentals_v3::expected::operator*):
3244         (std::experimental::fundamentals_v3::expected::has_value const):
3245         (std::experimental::fundamentals_v3::expected::value const):
3246         (std::experimental::fundamentals_v3::expected::value):
3247         (std::experimental::fundamentals_v3::expected::error const):
3248         (std::experimental::fundamentals_v3::expected::error):
3249         (std::experimental::fundamentals_v3::expected::value_or const):
3250         (std::experimental::fundamentals_v3::expected::value_or):
3251         (std::experimental::fundamentals_v3::operator==):
3252         (std::experimental::fundamentals_v3::operator!=):
3253         (std::experimental::fundamentals_v3::swap):
3254         (WTF::Unexpected::Unexpected): Deleted.
3255         (WTF::Unexpected::value const): Deleted.
3256         (WTF::Unexpected::value): Deleted.
3257         (WTF::operator==): Deleted.
3258         (WTF::operator!=): Deleted.
3259         (WTF::makeUnexpected): Deleted.
3260         (WTF::ExpectedDetail::Throw): Deleted.
3261         (WTF::ExpectedDetail::destroy): Deleted.
3262         (WTF::ExpectedDetail::std::is_trivially_destructible<T>::value): Deleted.
3263         (WTF::ExpectedDetail::ConstexprBase::ConstexprBase): Deleted.
3264         (WTF::ExpectedDetail::Base::Base): Deleted.
3265         (WTF::ExpectedDetail::Base::~Base): Deleted.
3266         (WTF::Expected::Expected): Deleted.
3267         (WTF::Expected::operator=): Deleted.
3268         (WTF::Expected::swap): Deleted.
3269         (WTF::Expected::operator-> const): Deleted.
3270         (WTF::Expected::operator->): Deleted.
3271         (WTF::Expected::operator* const): Deleted.
3272         (WTF::Expected::operator*): Deleted.
3273         (WTF::Expected::operator bool const): Deleted.
3274         (WTF::Expected::hasValue const): Deleted.
3275         (WTF::Expected::value const): Deleted.
3276         (WTF::Expected::value): Deleted.
3277         (WTF::Expected::error const): Deleted.
3278         (WTF::Expected::error): Deleted.
3279         (WTF::Expected::getUnexpected const): Deleted.
3280         (WTF::Expected::valueOr const): Deleted.
3281         (WTF::Expected::valueOr): Deleted.
3282         (WTF::swap): Deleted.
3283         (WTF::makeExpected): Deleted.
3284         (WTF::makeExpectedFromError): Deleted.
3285         * wtf/Forward.h:
3286         * wtf/Optional.h:
3287         * wtf/StdLibExtras.h:
3288         * wtf/Unexpected.h: Added.
3289         (std::experimental::fundamentals_v3::unexpected::unexpected):
3290         (std::experimental::fundamentals_v3::unexpected::value const):
3291         (std::experimental::fundamentals_v3::unexpected::value):
3292         (std::experimental::fundamentals_v3::operator==):
3293         (std::experimental::fundamentals_v3::operator!=):
3294         (makeUnexpected):
3295
3296 2017-12-03  Tomas Popela  <tpopela@redhat.com>
3297
3298         Build fails on x86_64 and arm64 with BMalloc disabled
3299         https://bugs.webkit.org/show_bug.cgi?id=180188
3300
3301         Reviewed by Carlos Garcia Campos.
3302
3303         Add missing methods in WTF's Gigacage.h and fix g_gigacageBasePtr
3304         definition.
3305
3306         * wtf/Gigacage.cpp:
3307         * wtf/Gigacage.h:
3308         (Gigacage::basePtr):
3309         (Gigacage::isEnabled):
3310
3311 2017-12-03  Yusuke Suzuki  <utatane.tea@gmail.com>
3312
3313         WTF shouldn't have both Thread and ThreadIdentifier
3314         https://bugs.webkit.org/show_bug.cgi?id=180308
3315
3316         Reviewed by Darin Adler.
3317
3318         We should use a pointer of WTF::Thread instead of ThreadIdentifier.
3319
3320         One problem is that Windows support library uses WTF::createThread,
3321         which returns ThreadIdentifier. So we cannot drop ThreadIdentifier
3322         in Windows environment. This patch keeps ThreadIdentifier in Windows.
3323
3324         * wtf/MainThread.cpp:
3325         (WTF::initializeMainThread):
3326         (WTF::isMainThread):
3327         (WTF::canAccessThreadLocalDataForThread):
3328         * wtf/MainThread.h:
3329         * wtf/ParkingLot.cpp:
3330         (WTF::ParkingLot::parkConditionallyImpl):
3331         (WTF::ParkingLot::unparkOne):
3332         (WTF::ParkingLot::unparkOneImpl):
3333         (WTF::ParkingLot::unparkCount):
3334         * wtf/RecursiveLockAdapter.h:
3335         (WTF::RecursiveLockAdapter::lock):
3336         (WTF::RecursiveLockAdapter::unlock):
3337         (WTF::RecursiveLockAdapter::tryLock):
3338         * wtf/Threading.cpp:
3339         (WTF::Thread::dump const):
3340         * wtf/Threading.h:
3341         (WTF::Thread::id const):
3342         (WTF::Thread::operator==): Deleted.
3343         (WTF::Thread::operator!=): Deleted.
3344         (WTF::currentThread): Deleted.
3345         * wtf/ThreadingPrimitives.h:
3346         * wtf/ThreadingPthreads.cpp:
3347         (WTF::Thread::waitForCompletion):
3348         (WTF::Thread::detach):
3349         (WTF::Thread::initializeCurrentTLS):
3350         (WTF::Thread::suspend):
3351         (WTF::Thread::establishPlatformSpecificHandle):
3352         (WTF::Thread::currentID): Deleted.
3353         * wtf/ThreadingWin.cpp:
3354         (WTF::Thread::waitForCompletion):
3355         (WTF::Thread::suspend):
3356         (WTF::Thread::currentDying):
3357         * wtf/mac/MainThreadMac.mm:
3358         (WTF::initializeApplicationUIThread):
3359         (WTF::initializeWebThreadPlatform):
3360         (WTF::canAccessThreadLocalDataForThread):
3361         (WTF::initializeApplicationUIThreadIdentifier): Deleted.
3362         (WTF::initializeWebThreadIdentifier): Deleted.
3363
3364 2017-12-03  Darin Adler  <darin@apple.com>
3365
3366         Add WTF::Hasher, an easier to use replacement for WTF::IntegerHasher
3367         https://bugs.webkit.org/show_bug.cgi?id=180318
3368
3369         Reviewed by JF Bastien.
3370
3371         * WTF.xcodeproj/project.pbxproj: Added Hasher.h.
3372         * wtf/CMakeLists.txt: Ditto.
3373
3374         * wtf/Forward.h: Added Hasher and TextStream.
3375
3376         * wtf/Hasher.h: Moved StringHasher into a separate header. Added Hasher.
3377         Marked IntegerHasher deprecated.
3378
3379         * wtf/text/CString.cpp: Include StringHasher.h instead of Hasher.h.
3380         * wtf/text/StringHash.h: Ditto.
3381
3382         * wtf/text/StringHasher.h: Added. Moved StringHasher here from Hasher.h.
3383
3384         * wtf/text/StringImpl.h: Include StringHasher.h instead of Hasher.h.
3385
3386         * wtf/text/WTFString.h: Added a hash function. This was useful in some
3387         adoption I was doing in WebCore, not included in this patch.
3388
3389         * wtf/unicode/UTF8.cpp: Include StringHasher.h instead of Hasher.h.
3390
3391 2017-12-02  Brady Eidson  <beidson@apple.com>
3392
3393         Factor out the "databaseTaskQueue" parts of IDBServer into something reusable.
3394         https://bugs.webkit.org/show_bug.cgi?id=180298
3395
3396         Reviewed by Chris Dumez.
3397
3398         * WTF.xcodeproj/project.pbxproj:
3399         * wtf/CMakeLists.txt:
3400
3401         * wtf/CrossThreadTaskHandler.cpp: Added.
3402         (WTF::CrossThreadTaskHandler::CrossThreadTaskHandler):
3403         (WTF::CrossThreadTaskHandler::~CrossThreadTaskHandler):
3404         (WTF::CrossThreadTaskHandler::postTask):
3405         (WTF::CrossThreadTaskHandler::postTaskReply):
3406         (WTF::CrossThreadTaskHandler::taskRunLoop):
3407         (WTF::CrossThreadTaskHandler::handleTaskRepliesOnMainThread):
3408         * wtf/CrossThreadTaskHandler.h: Added.
3409
3410 2017-12-01  Mark Lam  <mark.lam@apple.com>
3411
3412         Let's scramble ClassInfo pointers in cells.
3413         https://bugs.webkit.org/show_bug.cgi?id=180291
3414         <rdar://problem/35807620>
3415
3416         Reviewed by JF Bastien.
3417
3418         * wtf/ScrambledPtr.h:
3419         (WTF::ScrambledPtr::descrambled const):
3420         (WTF::ScrambledPtr::bits const):
3421         (WTF::ScrambledPtr::operator==):
3422         (WTF::ScrambledPtr::operator=):
3423         (WTF::ScrambledPtr::scramble):
3424         (WTF::ScrambledPtr::descramble):
3425         (WTF::ScrambledPtr:: const): Deleted.
3426         (WTF::ScrambledPtr::scrambledBits const): Deleted.
3427
3428 2017-12-01  Christopher Reid  <chris.reid@sony.com>
3429
3430         Move DateComponents into WTF
3431         https://bugs.webkit.org/show_bug.cgi?id=180211
3432
3433         Reviewed by Myles C. Maxfield.
3434
3435         Moved DateComponents from WebCore/platform into WTF.
3436         Removed isLeapYear from DateComponents as DateMath already has that function.
3437
3438         * WTF.xcodeproj/project.pbxproj:
3439         * wtf/CMakeLists.txt:
3440         * wtf/DateComponents.cpp: Renamed from Source\WebCore\platform\DateComponents.cpp.
3441         * wtf/DateComponents.h: Renamed from Source\WebCore\platform\DateComponents.h.
3442
3443 2017-12-01  Youenn Fablet  <youenn@apple.com>
3444
3445         Implement https://w3c.github.io/ServiceWorker/#clients-get
3446         https://bugs.webkit.org/show_bug.cgi?id=180167
3447
3448         Reviewed by Chris Dumez.
3449
3450         * wtf/text/StringView.h:
3451         (WTF::StringView::toUInt64Strict const):
3452         * wtf/text/WTFString.h:
3453
3454 2017-12-01  Brian Burg  <bburg@apple.com>
3455
3456         Web Inspector: move Inspector::Protocol::Array<T> to JSON namespace
3457         https://bugs.webkit.org/show_bug.cgi?id=173662
3458
3459         Reviewed by Joseph Pecoraro.
3460
3461         Move Inspector::Protocol::Array<T> to JSON::ArrayOf<T>.
3462
3463         * wtf/JSONValues.h:
3464         (WTF::JSONImpl::ArrayOf::ArrayOf):
3465         (WTF::JSONImpl::ArrayOf::openAccessors):
3466         (WTF::JSONImpl::ArrayOf::addItem):
3467         (WTF::JSONImpl::ArrayOf::create):
3468
3469 2017-12-01  Brady Eidson  <beidson@apple.com>
3470
3471         Add Internals.terminateServiceWorker, and the ability to restart service workers for postMessage.
3472         https://bugs.webkit.org/show_bug.cgi?id=180170
3473
3474         Reviewed by Chris Dumez.
3475
3476         * wtf/CompletionHandler.h:
3477         (WTF::CompletionHandler<Out):
3478
3479 2017-11-30  Yusuke Suzuki  <utatane.tea@gmail.com>
3480
3481         [JSC] Remove easy toRemove & map.remove() use in OAS phase
3482         https://bugs.webkit.org/show_bug.cgi?id=180208
3483
3484         Reviewed by Mark Lam.
3485
3486         * wtf/HashMap.h:
3487         (WTF::X>::removeIf):
3488         * wtf/HashSet.h:
3489         (WTF::V>::removeIf):
3490         * wtf/HashTable.h:
3491         (WTF::KeyTraits>::removeIf):
3492
3493 2017-11-30  Commit Queue  <commit-queue@webkit.org>
3494
3495         Unreviewed, rolling out r225362.
3496         https://bugs.webkit.org/show_bug.cgi?id=180225
3497
3498         removeIf predicate function can touch remove target set
3499         (Requested by yusukesuzuki on #webkit).
3500
3501         Reverted changeset:
3502
3503         "[JSC] Remove easy toRemove & map.remove() use"
3504         https://bugs.webkit.org/show_bug.cgi?id=180208
3505         https://trac.webkit.org/changeset/225362
3506
3507 2017-11-30  Mark Lam  <mark.lam@apple.com>
3508
3509         Let's scramble MacroAssemblerCodePtr values.
3510         https://bugs.webkit.org/show_bug.cgi?id=180169
3511         <rdar://problem/35758340>
3512
3513         Reviewed by Filip Pizlo, Saam Barati, and JF Bastien.
3514
3515         Introduce a ScrambledPtr class to facilitate scrambling.
3516
3517         * WTF.xcodeproj/project.pbxproj:
3518         * wtf/CMakeLists.txt:
3519         * wtf/ScrambledPtr.cpp: Added.
3520         (WTF::makeScrambledPtrKey):
3521         * wtf/ScrambledPtr.h: Added.
3522         (WTF::ScrambledPtr::ScrambledPtr):
3523         (WTF::ScrambledPtr::paranoidAssertIsScrambled const):
3524         (WTF::ScrambledPtr::paranoidAssertIsNotScrambled const):
3525         (WTF::ScrambledPtr:: const):
3526         (WTF::ScrambledPtr::operator-> const):
3527         (WTF::ScrambledPtr::scrambledBits const):
3528         (WTF::ScrambledPtr::operator! const):
3529         (WTF::ScrambledPtr::operator bool const):
3530         (WTF::ScrambledPtr::operator== const):
3531         (WTF::ScrambledPtr::operator==):
3532         (WTF::ScrambledPtr::scramble):
3533         (WTF::ScrambledPtr::descramble):
3534
3535 2017-11-30  Yusuke Suzuki  <utatane.tea@gmail.com>
3536
3537         [JSC] Remove easy toRemove & map.remove() use
3538         https://bugs.webkit.org/show_bug.cgi?id=180208
3539
3540         Reviewed by Mark Lam.
3541
3542         Return bool from removeIf. It is true if removeIf removes at least one entry.
3543         This interface is similar to existing HashSet::remove, which returns true
3544         if it actually removes entry.
3545
3546         * wtf/HashMap.h:
3547         (WTF::X>::removeIf):
3548         * wtf/HashSet.h:
3549         (WTF::V>::removeIf):
3550         * wtf/HashTable.h:
3551         (WTF::KeyTraits>::removeIf):
3552
3553 2017-11-30  Chris Dumez  <cdumez@apple.com>
3554
3555         Populate self.registration.installing/waiting/active inside service workers
3556         https://bugs.webkit.org/show_bug.cgi?id=180168
3557
3558         Reviewed by Brady Eidson.
3559
3560         Add CrossThreadCopier support for std::optional<>.
3561
3562         * wtf/CrossThreadCopier.h:
3563
3564 2017-11-29  JF Bastien  <jfbastien@apple.com>
3565
3566         WTF / bmalloc: don't write to 0xbbadbeef when ASAN is looking
3567         https://bugs.webkit.org/show_bug.cgi?id=180175
3568
3569         Reviewed by Mark Lam.
3570
3571         ASAN knows that 0xbbadbeef is a bbad aaddress, and tells us so
3572         when we write to it, say in an assert. That creates bbad error
3573         reports where ASAN thinks we write to an invalid address, instead
3574         of thinking that we hit an assertion. In some cases, tooling that
3575         use fuzzers aggregate similar issues, and think that we just have
3576         the one bug and not a bunch of different asserts.
3577
3578         * wtf/Assertions.cpp:
3579         * wtf/Assertions.h:
3580
3581 2017-11-29  Filip Pizlo  <fpizlo@apple.com>
3582
3583         GC should support isoheaps
3584         https://bugs.webkit.org/show_bug.cgi?id=179288
3585
3586         Reviewed by Saam Barati.
3587         
3588         One of my favorite data structures in the GC is a singly-linked list that knows its tail, so that
3589         things get added to it at the end rather that at the beginning. In this patch, I use this to put
3590         the same node on multiple lists, which our existing linked list templates also don't support.
3591         
3592         This adds a new linked list that does those things:
3593         
3594         - It supports append(). It could also support prepend(), but currently there is no need for it.
3595         
3596         - It supports nodes that are on multiple lists. The GC uses std::mem_fn() to create a lambda that the
3597           list uses to set next.
3598
3599         * WTF.xcodeproj/project.pbxproj:
3600         * wtf/SinglyLinkedListWithTail.h: Added.
3601         (WTF::SinglyLinkedListWithTail::isEmpty const):
3602         (WTF::SinglyLinkedListWithTail::append):
3603         (WTF::SinglyLinkedListWithTail::first const):
3604         (WTF::SinglyLinkedListWithTail::last const):
3605
3606 2017-11-29  Stanislav Ocovaj  <stanislav.ocovaj@rt-rk.com>
3607
3608         [DFG][MIPS] Enable DFG JIT on MIPS.
3609         https://bugs.webkit.org/show_bug.cgi?id=175447
3610
3611         Reviewed by Carlos Alberto Lopez Perez.
3612
3613         * wtf/Platform.h:
3614
3615 2017-11-29  Matt Lewis  <jlewis3@apple.com>
3616
3617         Unreviewed, rolling out r225286.
3618
3619         The source files within this patch have been marked as
3620         executable.
3621
3622         Reverted changeset:
3623
3624         "[MIPS][JSC] Implement MacroAssembler::probe support on MIPS"
3625         https://bugs.webkit.org/show_bug.cgi?id=175447
3626         https://trac.webkit.org/changeset/225286
3627
3628 2017-11-29  Stanislav Ocovaj  <stanislav.ocovaj@rt-rk.com>
3629
3630         [DFG][MIPS] Enable DFG JIT on MIPS.
3631         https://bugs.webkit.org/show_bug.cgi?id=175447
3632
3633         Reviewed by Carlos Alberto Lopez Perez.
3634
3635         * wtf/Platform.h:
3636
3637 2017-11-14  Carlos Garcia Campos  <cgarcia@igalia.com>
3638
3639         Move JSONValues to WTF and convert uses of InspectorValues.h to JSONValues.h
3640         https://bugs.webkit.org/show_bug.cgi?id=173793
3641
3642         Reviewed by Joseph Pecoraro.
3643
3644         Based on patch by Brian Burg.
3645
3646         Move the implementation into WTF. Put the actual implementation inside
3647         namespace WTF::JSONImpl so that the symbols in libwtf start with the WTF prefix.
3648         Also provide a top-level JSON namespace so that clients can write JSON::Value.
3649         This is essentially a typedef for the entire WTF::JSONImpl namespace.
3650
3651         * WTF.xcodeproj/project.pbxproj:
3652         * wtf/CMakeLists.txt:
3653         * wtf/JSONValues.cpp: Renamed from Source/JavaScriptCore/inspector/InspectorValues.cpp.
3654         (JSON::Value::null):
3655         (JSON::Value::create):
3656         (JSON::Value::asValue):
3657         (JSON::Value::asObject):
3658         (JSON::Value::asArray):
3659         (JSON::Value::parseJSON):
3660         (JSON::Value::toJSONString const):
3661         (JSON::Value::asBoolean const):
3662         (JSON::Value::asDouble const):
3663         (JSON::Value::asInteger const):
3664         (JSON::Value::asString const):
3665         (JSON::Value::writeJSON const):
3666         (JSON::Value::memoryCost const):
3667         (JSON::ObjectBase::~ObjectBase):
3668         (JSON::ObjectBase::asObject):
3669         (JSON::ObjectBase::openAccessors):
3670         (JSON::ObjectBase::memoryCost const):
3671         (JSON::ObjectBase::getBoolean const):
3672         (JSON::ObjectBase::getString const):
3673         (JSON::ObjectBase::getObject const):
3674         (JSON::ObjectBase::getArray const):
3675         (JSON::ObjectBase::getValue const):
3676         (JSON::ObjectBase::remove):
3677         (JSON::ObjectBase::writeJSON const):
3678         (JSON::ObjectBase::ObjectBase):
3679         (JSON::ArrayBase::~ArrayBase):
3680         (JSON::ArrayBase::asArray):
3681         (JSON::ArrayBase::writeJSON const):
3682         (JSON::ArrayBase::ArrayBase):
3683         (JSON::ArrayBase::get const):
3684         (JSON::Object::create):
3685         (JSON::Array::create):
3686         (JSON::ArrayBase::memoryCost const):
3687         * wtf/JSONValues.h: Renamed from Source/JavaScriptCore/inspector/InspectorValues.h.
3688         (JSON::ObjectBase::find):
3689         (JSON::ObjectBase::find const):
3690         (JSON::ObjectBase::setBoolean):
3691         (JSON::ObjectBase::setInteger):
3692         (JSON::ObjectBase::setDouble):
3693         (JSON::ObjectBase::setString):
3694         (JSON::ObjectBase::setValue):
3695         (JSON::ObjectBase::setObject):
3696         (JSON::ObjectBase::setArray):
3697         (JSON::ArrayBase::pushBoolean):
3698         (JSON::ArrayBase::pushInteger):
3699         (JSON::ArrayBase::pushDouble):
3700         (JSON::ArrayBase::pushString):
3701         (JSON::ArrayBase::pushValue):
3702         (JSON::ArrayBase::pushObject):
3703         (JSON::ArrayBase::pushArray):
3704
3705 2017-11-28  Simon Fraser  <simon.fraser@apple.com>
3706
3707         Modernize GraphicsLayer dumping
3708         https://bugs.webkit.org/show_bug.cgi?id=180067
3709
3710         Reviewed by Sam Weinig.
3711         
3712         Expose the current indent.
3713
3714         * wtf/text/TextStream.h:
3715         (WTF::TextStream::indent const):
3716
3717 2017-11-27  Chris Dumez  <cdumez@apple.com>
3718
3719         Move callOnMainThreadAndWait() from SocketStreamHandleImplCFNet.cpp to MainThread.h
3720         https://bugs.webkit.org/show_bug.cgi?id=180060
3721
3722         Reviewed by Alex Christensen.
3723
3724         Move callOnMainThreadAndWait() from SocketStreamHandleImplCFNet.cpp to MainThread.h so that it can be reused.
3725
3726         * wtf/MainThread.cpp:
3727         (WTF::callOnMainThreadAndWait):
3728         * wtf/MainThread.h:
3729
3730 2017-11-27  Simon Fraser  <simon.fraser@apple.com>
3731
3732         Use TextStream's indent tracking, rather than passing indent to all the externalRepresentation() functions
3733         https://bugs.webkit.org/show_bug.cgi?id=180027
3734
3735         Reviewed by Jon Lee.
3736
3737         Remove all the indent arguments, and make use of TextStream::IndentScope to control
3738         output indentation.
3739
3740         Add an indent stream manipulator so you can say
3741           ts << indent << "text"
3742         to write the indent.
3743
3744         * wtf/text/TextStream.h:
3745         (WTF::TextStream::IndentScope::IndentScope):
3746         (WTF::TextStream::IndentScope::~IndentScope):
3747
3748 2016-08-05  Darin Adler  <darin@apple.com>
3749
3750         Fix some minor problems in the StringImpl header
3751         https://bugs.webkit.org/show_bug.cgi?id=160630
3752
3753         Reviewed by Brent Fulgham.
3754
3755         * wtf/text/AtomicString.h: Update since CharacterMatchFunctionPtr is now
3756         CodeUnitMatchFunction.
3757
3758         * wtf/text/StringCommon.h: Added CodeUnitMatchFunction, which replaces
3759         CharacterMatchFunctionPtr.
3760
3761         * wtf/text/StringImpl.cpp:
3762         (WTF::StringImpl::stripMatchedCharacters): Changed template argument name
3763         to CodeUnitPredicate to help make it clear this works on code units, not
3764         code points.
3765         (WTF::UCharPredicate): Deleted.
3766         (WTF::SpaceOrNewlinePredicate): Deleted.
3767         (WTF::StringImpl::stripWhiteSpace): Removed unneeded use of predicate class to
3768         turn a function into a functor; functions already work fine as functors without
3769         a class wrapping them.
3770         (WTF::StringImpl::stripLeadingAndTrailingCharacters): Ditto. Also renamed
3771         from stripWhiteSpace, since it strips arbitrary characters.
3772         (WTF::StringImpl::removeCharacters): Fixed various minor style issues and
3773         updated to new type name.
3774         (WTF::StringImpl::simplifyMatchedCharactersToSpace): Ditto.
3775         (WTF::StringImpl::simplifyWhiteSpace): More of the same.
3776         (WTF::StringImpl::find): Ditto.
3777
3778         * wtf/text/StringImpl.h: Removed unneeded include of uchar.h, since it's
3779         included by StringCommon.h. Removed =CharacterMatchFunctionPtr and
3780         IsWhiteSpaceFunctionPtr, both replaced by CodeUnitMatchFunction. Fixed
3781         a mistake recently introduced in isSpaceOrNewline, which was unnecessarily,
3782         inefficiently using ICU for non-ASCII Latin-1 characters.
3783
3784         * wtf/text/StringView.h: Use CodeUnitMatchFunction instead of CharacterMatchFunction.
3785
3786         * wtf/text/WTFString.cpp:
3787         (WTF::String::stripLeadingAndTrailingCharacters): Updated function name and type.
3788         (WTF::String::simplifyWhiteSpace): Updated type.
3789         (WTF::String::removeCharacters): Updated type.
3790         * wtf/text/WTFString.h: Ditto.
3791
3792 2017-11-23  Darin Adler  <darin@apple.com>
3793
3794         Fix dictionary leak in lookup, convert FindOptions to OptionSet, tweak code style nearby
3795         https://bugs.webkit.org/show_bug.cgi?id=179981
3796
3797         Reviewed by Sam Weinig.
3798
3799         * wtf/OptionSet.h: Added some operators so it's easier to use | and - with individual
3800         options from the set.
3801
3802 2017-11-23  Darin Adler  <darin@apple.com>
3803
3804         Reduce WTF::String operations that do unnecessary Unicode operations instead of ASCII
3805         https://bugs.webkit.org/show_bug.cgi?id=179907
3806
3807         Reviewed by Sam Weinig.
3808
3809         * wtf/text/ASCIIFastPath.h: Moved the using for charactersAreAllASCII here since
3810         the function is defined here.
3811
3812         * wtf/text/AtomicString.h: Removed overloads of contains, find, startsWith, and
3813         endsWith that take a boolean indicating whether they should be "case sensitive".
3814         When false, this was doing Unicode case folding, and no callers needed that.
3815         Also tweaked formatting and argument names.
3816
3817         * wtf/text/IntegerToStringConversion.h: Added an include of LChar.h since this file
3818         uses that. Also tweaked formatting a bit.
3819
3820         * wtf/text/StringImpl.cpp:
3821         (WTF::StringImpl::containsOnlyWhitespace): Deleted. Despite its name sounding like
3822         it used the full Unicode whitespace definition, this actually checked isASCIISpace.
3823         Callers now all use isAllSpecialCharacters instead with the whitespace definition
3824         that is appropriate to each call site.
3825         (WTF::latin1CaseFoldTable): Deleted.
3826         (WTF::equalCompatibilityCaseless): Deleted.
3827         (WTF::StringImpl::findIgnoringCase): Deleted.
3828         (WTF::findIgnoringCaseInner): Deleted.
3829         (WTF::reverseFindIgnoringCaseInner): Deleted.
3830         (WTF::StringImpl::reverseFindIgnoringCase): Deleted.
3831         (WTF::equalInner): Removed boolean caseSensitive argument.
3832         (WTF::StringImpl::startsWith): Ditto.
3833         (WTF::StringImpl::endsWith): Ditto.
3834
3835         * wtf/text/StringImpl.h: Moved TextCaseSensitivity out into a different header.
3836         Moved ASCIIFastPath.h include here from WTFString.h. Moved isAllSpecialCharacters
3837         free function here from WTFString.h. Moved lots of function bodies out of class
3838         definitions to make the class definitions easier to read. Sorted things a bit.
3839         Tweaked formatting. Marked constructor that takes one argument explicit. Added
3840         an isEmpty function like the one in String. Renamed copyChars to copyCharacters.
3841         Added isAllASCII, isAllLatin1 and isAllSpecialCharacters functions. Removed
3842         boolean caseSensitive arguments from various functions. Removed findIgnoringCase
3843         and reverseFindIgnoringCase. Added a FIXME to codePointCompare about the way it
3844         treats null and empty strings as equal. Changed length argument in remove to
3845         unsigned to match other lengths.
3846
3847         * wtf/text/WTFString.cpp:
3848         (WTF::String::removeInternal): Changed length argument to be unsigned.
3849         (WTF::createWithFormatAndArguments): Use emptyString.
3850         (WTF::String::isSafeToSendToAnotherThread const): Rewrote to be easier to read.
3851
3852         * wtf/text/WTFString.h: Moved ASCIIFastPath.h to StringImpl.h. Moved lots of
3853         function bodies out of class definitions to make the class definitions easier
3854         to read, made others one-liners. Removed the String::at function but kept the
3855         String::characterAt function; the two were identical. Removed boolean
3856         caseSensitive arguments from various functions. Removed findIgnoringCase and
3857         reverseFindIgnoringCase. Renamed containsOnlyASCII to isAllASCII and
3858         containsOnlyLatin1 to isAllLatin1 to match the naming of isAllSpecialCharacters.
3859         Moved the inline implementations of functions that are defined above further
3860         down, after things like the ASCIILiteral class and various functions.
3861
3862         * wtf/text/icu/UTextProviderLatin1.cpp: Updated name of copyChars.
3863
3864 2017-11-22  Stephan Szabo  <stephan.szabo@sony.com>
3865
3866         tuple related items are used in WTF without including tuple
3867         https://bugs.webkit.org/show_bug.cgi?id=179926
3868
3869         Reviewed by Darin Adler.
3870
3871         * wtf/HashFunctions.h:
3872         * wtf/PrintStream.h:
3873         * wtf/threads/Signals.h:
3874
3875 2017-11-21  Zan Dobersek  <zdobersek@igalia.com>
3876
3877         Drop ENABLE_IMAGE_DECODER_DOWN_SAMPLING code
3878         https://bugs.webkit.org/show_bug.cgi?id=179921
3879
3880         Reviewed by Carlos Garcia Campos.
3881
3882         * wtf/FeatureDefines.h: Remove the ENABLE_IMAGE_DECODER_DOWN_SAMPLING
3883         definition.
3884
3885 2017-11-19  Tim Horton  <timothy_horton@apple.com>
3886
3887         Remove unused TOUCH_ICON_LOADING feature flag
3888         https://bugs.webkit.org/show_bug.cgi?id=179873
3889
3890         Reviewed by Simon Fraser.
3891
3892         * wtf/FeatureDefines.h:
3893
3894 2017-11-19  Yusuke Suzuki  <utatane.tea@gmail.com>
3895
3896         Add CPU(UNKNOWN) to cover all the unknown CPU types
3897         https://bugs.webkit.org/show_bug.cgi?id=179243
3898
3899         Reviewed by JF Bastien.
3900
3901         This patch adds a new CPU type, `CPU(UNKNOWN)` to cover all the unknown CPUs.
3902         This CPU architecture tells conservative assumption to make JSC work on all
3903         the unknown generic CPUs. And we make several CPUs (ALPHA, SH4, S390, S390X, IA64, IA64_32)
3904         UNKNOWN.
3905
3906         We also make InlineASM available only for !CPU(UNKNOWN). In an unknown CPU, inline asm is not useful.
3907
3908         And we also introduce a generic way to detect 64bit pointer environment by using
3909         __SIZEOF_POINTER__ predefined macro, or `UINTPTR_MAX > UINT32_MAX`.
3910
3911         * wtf/InlineASM.h:
3912         * wtf/Platform.h:
3913         * wtf/dtoa/utils.h:
3914
3915 2017-11-19  Tim Horton  <timothy_horton@apple.com>
3916
3917         Remove unused LEGACY_VENDOR_PREFIXES feature flag
3918         https://bugs.webkit.org/show_bug.cgi?id=179872
3919
3920         Reviewed by Darin Adler.
3921
3922         * wtf/FeatureDefines.h:
3923
3924 2017-11-19  Chris Dumez  <cdumez@apple.com>
3925
3926         Fix potential thread safety issue in ThreadSafeIdentified
3927         https://bugs.webkit.org/show_bug.cgi?id=179879
3928
3929         Reviewed by Darin Adler.
3930
3931         Fix potential thread safety issue in ThreadSafeIdentified. Protect static std::atomic
3932         initialization with an std::call_once() given that we build with
3933         --fno-threadsafe-statics.
3934
3935         * wtf/Identified.h:
3936         (WTF::Identified::Identified):
3937         (WTF::Identified::generateIdentifier):
3938         (WTF::ThreadSafeIdentified::ThreadSafeIdentified):
3939         (WTF::ThreadSafeIdentified::generateIdentifier):
3940
3941 2017-11-18  Darin Adler  <darin@apple.com>
3942
3943         Eliminate some cases of double hashing, other related refactoring
3944         https://bugs.webkit.org/show_bug.cgi?id=179867
3945
3946         Reviewed by Sam Weinig.
3947
3948         * wtf/text/StringImpl.cpp:
3949         (WTF::StringImpl::containsOnlyWhitespace): Added FIXME.
3950
3951 2017-11-19  Chris Dumez  <cdumez@apple.com>
3952
3953         Fix potential thread safety issue in generateThreadSafeObjectIdentifier()
3954         https://bugs.webkit.org/show_bug.cgi?id=179877
3955
3956         Reviewed by Sam Weinig.
3957
3958         Fix potential thread safety issue in generateThreadSafeObjectIdentifier().
3959         Protect std::atomic initialization with an std::call_once() given that we
3960         build with --fno-threadsafe-statics.
3961
3962         * wtf/ObjectIdentifier.h:
3963         (WTF::generateThreadSafeObjectIdentifier):
3964
3965 2017-11-18  Yusuke Suzuki  <utatane.tea@gmail.com>
3966
3967         [WTF] Use system endianess information instead of relying CPU information
3968         https://bugs.webkit.org/show_bug.cgi?id=179861
3969
3970         Reviewed by JF Bastien.
3971
3972         Currently, we use known CPU information to determine endianess of the current
3973         architecture. But this means that unknown CPU does not work well in WebKit
3974         withou modifying code. Instead, we use compiler or system's macro to determine
3975         endianess. This paves the way to dropping many CPUs in Platform.h by replacing
3976         them with CPU(UNKNOWN)[1].
3977
3978         [1]: https://bugs.webkit.org/show_bug.cgi?id=179243
3979
3980         * wtf/Platform.h:
3981
3982 2017-11-18  Chris Dumez  <cdumez@apple.com>
3983
3984         ASSERTION FAILED: registration in WebCore::SWServerJobQueue::scriptContextStarted(ServiceWorkerIdentifier)
3985         https://bugs.webkit.org/show_bug.cgi?id=179846
3986
3987         Reviewed by Darin Adler.
3988
3989         Add a generateThreadSafeObjectIdentifier() for generating an ObjectIdentifier
3990         in a thread-safe manner, using std::atomic.
3991
3992         * wtf/ObjectIdentifier.h:
3993         (WTF::generateObjectIdentifier):
3994         (WTF::generateThreadSafeObjectIdentifier):
3995
3996 2017-11-18  Yusuke Suzuki  <utatane.tea@gmail.com>
3997
3998         [WTF] Remove CPU(HPPA) in StackBounds by using runtime stack direction test
3999         https://bugs.webkit.org/show_bug.cgi?id=179859
4000
4001         Reviewed by JF Bastien.
4002
4003         Currently, we know that CPU(HPPA)'s stack direction is upward! But listing
4004         CPU architectures here is not a scalable way.
4005
4006         Instead, we use runtime stack direction test. By doing so, we can handle
4007         such a strange architecture without listing the CPU to Platform.h. This paves
4008         the way to dropping many CPUs in Platform.h by replacing them with CPU(UNKNOWN)[1].
4009
4010         We also fix StackBounds::isGrowingDownward().
4011
4012         [1]: https://bugs.webkit.org/show_bug.cgi?id=179243
4013
4014         * wtf/StackBounds.cpp:
4015         (WTF::StackBounds::stackDirection):
4016         (WTF::testStackDirection2):
4017         (WTF::testStackDirection):
4018         (WTF::StackBounds::newThreadStackBounds):
4019         (WTF::StackBounds::currentThreadStackBoundsInternal):
4020         * wtf/StackBounds.h:
4021         (WTF::StackBounds::isGrowingDownward const):
4022
4023 2017-11-17  Chris Dumez  <cdumez@apple.com>
4024
4025         Use a strongly typed identifier for SWServer::Connection
4026         https://bugs.webkit.org/show_bug.cgi?id=179848
4027
4028         Reviewed by Brady Eidson.
4029
4030         Make ObjectIdentifier a little more flexible to support more use cases.
4031
4032         * wtf/ObjectIdentifier.h:
4033         (WTF::ObjectIdentifier::toUInt64 const):
4034         (WTF::makeObjectIdentifier):
4035
4036 2017-11-17  Simon Fraser  <simon.fraser@apple.com>
4037
4038         Add a TimingScope class for microbenchmarking sections of code
4039         https://bugs.webkit.org/show_bug.cgi?id=179825
4040
4041         Reviewed by Zalan Bujtas.
4042         
4043         Add a class, similar to B3TimingScope, which makes it easy to microbenchmark
4044         sections of code. Use looks like:
4045         
4046         TimingScope scope("some label", 100);
4047         
4048         where this will print mean scope duration every 100 calls. Sample output:
4049         
4050             FETurbulence::platformApplySoftware: 100 calls, mean duration: 3.073181ms
4051             FETurbulence::platformApplySoftware: 200 calls, mean duration: 3.074612ms
4052             FETurbulence::platformApplySoftware: 300 calls, mean duration: 3.065722ms
4053         
4054         Because TimingScope needs to store state beween invocations, and there may be
4055         multiple TimingScopes in use at the same time, data is stored in a global
4056         hash map with atomic access.
4057
4058         * WTF.xcodeproj/project.pbxproj:
4059         * wtf/CMakeLists.txt:
4060         * wtf/TimingScope.cpp: Added.
4061         (WTF::TimingScope::scopeDidEnd):
4062         * wtf/TimingScope.h: Added.
4063         (WTF::TimingScope::TimingScope):
4064         (WTF::TimingScope::~TimingScope):
4065
4066 2017-11-17  Alex Christensen  <achristensen@webkit.org>
4067
4068         Clean up after r224952
4069         https://bugs.webkit.org/show_bug.cgi?id=179809
4070
4071         Reviewed by Brady Eidson.
4072
4073         * wtf/MainThread.cpp:
4074         (WTF::dispatchFunctionsFromMainThread):
4075         (WTF::callOnMainThread):
4076         * wtf/MainThread.h:
4077         * wtf/generic/MainThreadGeneric.cpp:
4078         (WTF::scheduleDispatchFunctionsOnMainThread):
4079         (WTF::currentRunLoopInCommonMode): Deleted.
4080         * wtf/mac/MainThreadMac.mm:
4081         (WTF::scheduleDispatchFunctionsOnMainThread):
4082         (WTF::currentRunLoopInCommonMode): Deleted.
4083         * wtf/win/MainThreadWin.cpp:
4084         (WTF::scheduleDispatchFunctionsOnMainThread):
4085         (WTF::currentRunLoopInCommonMode): Deleted.
4086
4087 2017-11-15  Alex Christensen  <achristensen@webkit.org>
4088
4089         Fix fast/events/message-port-postMessage-recursive.html after r224896
4090         https://bugs.webkit.org/show_bug.cgi?id=179749
4091
4092         Reviewed by Jer Noble.
4093
4094         * wtf/mac/MainThreadMac.mm:
4095         (WTF::currentRunLoopInCommonMode):
4096         We sometimes run the runloop in kCFRunLoopDefaultMode, which should also have the responsiveness optimization.
4097         This allows the runloop to continue to iterate when we are doing lots of things on the main thread.
4098         CFRunLoop.h has a special definition of these two constants.
4099
4100 2017-11-15  Alex Christensen  <achristensen@webkit.org>
4101
4102         WebViews scheduled in custom run loop modes should be able to do more than 50ms of work at a time
4103         https://bugs.webkit.org/show_bug.cgi?id=179742
4104         <rdar://problem/35519421>
4105
4106         Reviewed by Jer Noble.
4107         
4108         In r224687 I fixed loading from scheduled WebViews with custom run loop modes, but in 
4109         dispatchFunctionsFromMainThread we have an optimization to yield the run loop if we have already
4110         done more than 50ms of work on the main thread in this run loop iteration.  When this happens
4111         and we are running in a custom run loop mode, we disable this responsiveness optimization.
4112         We are calling CFRunLoopRunInMode or [NSRunLoop acceptInputForMode:beforeDate:] in a while loop anyways,
4113         so we would not benefit from a responsiveness optimization.  We definitely don't want to reschedule
4114         on the main thread in the common run loop mode in this case.
4115
4116         * wtf/MainThread.cpp:
4117         (WTF::dispatchFunctionsFromMainThread):
4118         * wtf/MainThread.h:
4119         * wtf/generic/MainThreadGeneric.cpp:
4120         (WTF::currentRunLoopInCommonMode):
4121         * wtf/mac/MainThreadMac.mm:
4122         (WTF::currentRunLoopInCommonMode):
4123         * wtf/win/MainThreadWin.cpp:
4124         (WTF::currentRunLoopInCommonMode):
4125
4126 2017-11-15  Ryan Haddad  <ryanhaddad@apple.com>
4127
4128         Unreviewed, rolling out r224863.
4129
4130         Introduced LayoutTest crashes on iOS Simulator.
4131
4132         Reverted changeset:
4133
4134         "Move JSONValues to WTF and convert uses of InspectorValues.h
4135         to JSONValues.h"
4136         https://bugs.webkit.org/show_bug.cgi?id=173793
4137         https://trac.webkit.org/changeset/224863
4138
4139 2017-11-14  Carlos Garcia Campos  <cgarcia@igalia.com>
4140
4141         Move JSONValues to WTF and convert uses of InspectorValues.h to JSONValues.h
4142         https://bugs.webkit.org/show_bug.cgi?id=173793
4143
4144         Reviewed by Brian Burg.
4145
4146         * WTF.xcodeproj/project.pbxproj:
4147         * wtf/CMakeLists.txt:
4148         * wtf/JSONValues.cpp: Renamed from Source/JavaScriptCore/inspector/InspectorValues.cpp.
4149         (JSON::Value::null):
4150         (JSON::Value::create):
4151         (JSON::Value::asValue):
4152         (JSON::Value::asObject):
4153         (JSON::Value::asArray):
4154         (JSON::Value::parseJSON):
4155         (JSON::Value::toJSONString const):
4156         (JSON::Value::asBoolean const):
4157         (JSON::Value::asDouble const):
4158         (JSON::Value::asInteger const):
4159         (JSON::Value::asString const):
4160         (JSON::Value::writeJSON const):
4161         (JSON::Value::memoryCost const):
4162         (JSON::ObjectBase::~ObjectBase):
4163         (JSON::ObjectBase::asObject):
4164         (JSON::ObjectBase::openAccessors):
4165         (JSON::ObjectBase::memoryCost const):
4166         (JSON::ObjectBase::getBoolean const):
4167         (JSON::ObjectBase::getString const):
4168         (JSON::ObjectBase::getObject const):
4169         (JSON::ObjectBase::getArray const):
4170         (JSON::ObjectBase::getValue const):
4171         (JSON::ObjectBase::remove):
4172         (JSON::ObjectBase::writeJSON const):
4173         (JSON::ObjectBase::ObjectBase):
4174         (JSON::ArrayBase::~ArrayBase):
4175         (JSON::ArrayBase::asArray):
4176         (JSON::ArrayBase::writeJSON const):
4177         (JSON::ArrayBase::ArrayBase):
4178         (JSON::ArrayBase::get const):
4179         (JSON::Object::create):
4180         (JSON::Array::create):
4181         (JSON::ArrayBase::memoryCost const):
4182         * wtf/JSONValues.h: Renamed from Source/JavaScriptCore/inspector/InspectorValues.h.
4183         (JSON::ObjectBase::find):
4184         (JSON::ObjectBase::find const):
4185         (JSON::ObjectBase::setBoolean):
4186         (JSON::ObjectBase::setInteger):
4187         (JSON::ObjectBase::setDouble):
4188         (JSON::ObjectBase::setString):
4189         (JSON::ObjectBase::setValue):
4190         (JSON::ObjectBase::setObject):
4191         (JSON::ObjectBase::setArray):
4192         (JSON::ArrayBase::pushBoolean):
4193         (JSON::ArrayBase::pushInteger):
4194         (JSON::ArrayBase::pushDouble):
4195         (JSON::ArrayBase::pushString):
4196         (JSON::ArrayBase::pushValue):
4197         (JSON::ArrayBase::pushObject):
4198         (JSON::ArrayBase::pushArray):
4199
4200 2017-11-14  Alex Christensen  <achristensen@webkit.org>
4201
4202         Remove Cocoa CFURLConnection loading code
4203         https://bugs.webkit.org/show_bug.cgi?id=179688
4204
4205         Reviewed by