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