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