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