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