CodeBlocks should be in IsoSubspaces
[WebKit-https.git] / Source / WTF / ChangeLog
1 2018-01-04  Filip Pizlo  <fpizlo@apple.com>
2
3         CodeBlocks should be in IsoSubspaces
4         https://bugs.webkit.org/show_bug.cgi?id=180884
5
6         Reviewed by Saam Barati.
7         
8         Deque<>::contains() is helpful for a debug ASSERT.
9
10         * wtf/Deque.h:
11         (WTF::inlineCapacity>::contains):
12
13 2018-01-08  Don Olmstead  <don.olmstead@sony.com>
14
15         Add WTF_EXPORTs to UniStdExtras
16         https://bugs.webkit.org/show_bug.cgi?id=181415
17
18         Reviewed by Alex Christensen.
19
20         * wtf/UniStdExtras.h:
21
22 2018-01-07  Mark Lam  <mark.lam@apple.com>
23
24         Apply poisoning to more pointers in JSC.
25         https://bugs.webkit.org/show_bug.cgi?id=181096
26         <rdar://problem/36182970>
27
28         Reviewed by JF Bastien.
29
30         Added support for PoisonedBag and PoisonedRefCountedArray.
31
32         * wtf/Bag.h:
33         (WTF::Private::BagNode::BagNode):
34         (WTF::Bag::Bag):
35         (WTF::Bag::operator=):
36         (WTF::Bag::clear):
37         (WTF::Bag::add):
38         (WTF::Bag::begin):
39         (WTF::Bag::unwrappedHead):
40         (WTF::Bag::Node::Node): Deleted.
41         * wtf/BagToHashMap.h:
42         (WTF::toHashMap):
43         * wtf/Poisoned.h:
44         (WTF::constExprPoisonRandom):
45         (WTF::makeConstExprPoison):
46         * wtf/RefCountedArray.h:
47         (WTF::RefCountedArray::RefCountedArray):
48         (WTF::RefCountedArray::clone const):
49         (WTF::RefCountedArray::operator=):
50         (WTF::RefCountedArray::~RefCountedArray):
51         (WTF::RefCountedArray::refCount const):
52         (WTF::RefCountedArray::size const):
53         (WTF::RefCountedArray::data):
54         (WTF::RefCountedArray::begin):
55         (WTF::RefCountedArray::end):
56         (WTF::RefCountedArray::data const):
57         (WTF::RefCountedArray::begin const):
58         (WTF::RefCountedArray::operator== const):
59         (WTF::RefCountedArray::Header::fromPayload):
60         * wtf/WTFAssertions.cpp:
61
62 2018-01-05  JF Bastien  <jfbastien@apple.com>
63
64         WebAssembly: poison JS object's secrets
65         https://bugs.webkit.org/show_bug.cgi?id=181339
66         <rdar://problem/36325001>
67
68         Reviewed by Mark Lam.
69
70         swapping a poisoned pointer with a non-poisoned one (as is done in
71         JSWebAssembyMemory::adopt) was missing.
72
73         * wtf/Poisoned.h:
74         (WTF::PoisonedImpl::swap):
75         (WTF::ConstExprPoisonedPtrTraits::swap):
76
77 2018-01-05  David Kilzer  <ddkilzer@apple.com>
78
79         Re-enable -Wcast-qual in WebCore for Apple ports
80         <https://webkit.org/b/177895>
81         <rdar://problem/34960830>
82
83         Reviewed by Joseph Pecoraro.
84
85         * wtf/RetainPtr.h:
86         (WTF::RetainPtr::fromStorageTypeHelper const): Add const_cast<>
87         operator here since some CFTypes are not defined as const
88         pointers, which triggers a warning in C++ source with
89         -Wcast-qual when casting from CFTypeRef back to the original
90         type.  Note that we use const_cast<CF_BRIDGED_TYPE(id) void*>()
91         here (and in TypeCastsCF.h below) since this is what CFTypeRef
92         is defined as in CFBase.h, but without the 'const' modifier.
93         (WTF::RetainPtr::fromStorageType const): Ditto.
94
95         * wtf/cf/TypeCastsCF.h: Use #pragma once.
96         (WTF_DECLARE_CF_TYPE_TRAIT): Rename from DECLARE_CF_TYPE_TRAIT.
97         Don't #undef it so that it can be used in other source files.
98         (WTF_DECLARE_CF_MUTABLE_TYPE_TRAIT): Add new macro that is used
99         for declaring CFMutable types.  The CFTypeID for CF_Foo_ and
100         CFMutable_Foo_ are the same, so we have to use a different macro
101         to declare type traits for those types.
102         (WTF::dynamic_cf_cast): Add assertion to catch issues in Debug
103         builds.
104         (WTF::checked_cf_cast): Inline code from WTF::dynamic_cf_cast
105         and change behavior to be more consistent between Debug and
106         Release builds, as well as other "checked" functions.
107         Previously this function would return nullptr in Release builds
108         if nullptr or the wrong type of object was passed in, but crash
109         in both cases on Debug builds.  The new behavior always returns
110         nullptr if nullptr was passed in (but never crashes), and always
111         crashes if the wrong type of object is passed in.
112
113 2018-01-04  Keith Miller  <keith_miller@apple.com>
114
115         TypedArrays and Wasm should use index masking.
116         https://bugs.webkit.org/show_bug.cgi?id=181313
117
118         Reviewed by Michael Saboff.
119
120         * wtf/MathExtras.h:
121         (WTF::computeIndexingMask):
122
123 2018-01-03  Michael Saboff  <msaboff@apple.com>
124
125         Disable SharedArrayBuffers from Web API
126         https://bugs.webkit.org/show_bug.cgi?id=181266
127
128         Reviewed by Saam Barati.
129
130         Turn off SharedArrayBuffers using a compile time flag ENABLE_SHARED_ARRAY_BUFFER.
131
132         * wtf/Platform.h:
133
134 2017-12-28  Yusuke Suzuki  <utatane.tea@gmail.com>
135
136         Remove std::chrono completely
137         https://bugs.webkit.org/show_bug.cgi?id=181186
138
139         Reviewed by Alex Christensen.
140
141         std::chrono's overflow unaware design is dangerous[1]. Even small code like
142         `condition.wait_for(std::chrono::seconds::max())` is broken in some platforms
143         due to overflow of std::chrono::time_point. So we intentionally avoid using
144         std::chrono, and use WallTime, MonotonicTime, Seconds instead.
145
146         This patch removes all the remaining use of std::chrono from WebKit tree.
147
148         [1]: https://lists.webkit.org/pipermail/webkit-dev/2016-May/028242.html
149
150         * wtf/CrossThreadCopier.h:
151         Remove std::chrono support from cross thread copiers.
152         * wtf/Forward.h:
153         * wtf/MonotonicTime.h:
154         (WTF::MonotonicTime::isolatedCopy const):
155         Add isolatedCopy function.
156         * wtf/RunLoop.h:
157         (WTF::RunLoop::TimerBase::startRepeating):
158         (WTF::RunLoop::TimerBase::startOneShot):
159         Just remove these helpers.
160         * wtf/Seconds.h:
161         (WTF::Seconds::isolatedCopy const):
162         Add isolatedCopy function.
163         * wtf/WallTime.h:
164         (WTF::WallTime::isolatedCopy const):
165         Add isolatedCopy function.
166         * wtf/persistence/PersistentCoders.h:
167         (WTF::Persistence::Coder<Seconds>::encode):
168         (WTF::Persistence::Coder<Seconds>::decode):
169         (WTF::Persistence::Coder<WallTime>::encode):
170         (WTF::Persistence::Coder<WallTime>::decode):
171         Add persistent coder support for Seconds and WallTime.
172         (WTF::Persistence::Coder<std::chrono::system_clock::time_point>::encode): Deleted.
173         (WTF::Persistence::Coder<std::chrono::system_clock::time_point>::decode): Deleted.
174         Remove std::chrono support from persistent coders.
175
176 2018-01-02  Mark Lam  <mark.lam@apple.com>
177
178         Refactoring: Rename DummyClass to DummyStruct because it's a struct.
179         https://bugs.webkit.org/show_bug.cgi?id=181230
180
181         Reviewed by JF Bastien.
182
183         * wtf/WTFAssertions.cpp:
184
185 2018-01-02  Mark Lam  <mark.lam@apple.com>
186
187         Ensure that poisoned pointers do not look like double or int32 JSValues.
188         https://bugs.webkit.org/show_bug.cgi?id=181221
189         <rdar://problem/36248638>
190
191         Reviewed by JF Bastien.
192
193         Changed poison values to ensure that poisoned bits (i.e. pointer ^ poison)
194         satisfies the following conditions:
195         1. bits 48-63 are 0: this ensures that poisoned bits look like a pointer and
196            not a double or int32 JSValue.
197         2. bits 32-47 are not completely 0.
198         3. bit 2 is never 0: this ensures that the poisoned value of a non-null pointer
199            will never be null.
200         4. bit 0-1 is always 0: this ensures that clients can still use the 2 bottom
201            bits of the poisoned value as flag bits (just like they were able to do with
202            pointer values).  The only difference is that bit 2 can no longer be used for
203            flag bits because poisoned values need it to always be set.
204
205         * WTF.xcodeproj/project.pbxproj:
206         * wtf/CMakeLists.txt:
207         * wtf/PointerAsserts.cpp: Removed.
208
209         * wtf/Poisoned.cpp:
210         (WTF::makePoison):
211         - Updated to satisfy the above requirements.
212         
213         * wtf/Poisoned.h:
214         (WTF::makeConstExprPoison):
215         (WTF::makePoison): Deleted.
216
217         * wtf/WTFAssertions.cpp: Copied from Source/WTF/wtf/PointerAsserts.cpp.
218         - Renamed from PointerAsserts.cpp because we assert more things than just
219           pointers here.
220         - Added some assertions to test makeConstExprPoison() to ensure that it satisfies
221           the above requirements.
222
223 2017-12-28  Yusuke Suzuki  <utatane.tea@gmail.com>
224
225         Remove std::chrono if it is not used for ArgumentCoder or PersistentCoder
226         https://bugs.webkit.org/show_bug.cgi?id=181174
227
228         Reviewed by Konstantin Tokarev.
229
230         Make WallTime more constexpr friendly. This change is already applied to MonoTonicTime.
231
232         We would like to move std::{isfinite,isinf,isnan} overloadings from std:: to each class scope in a separate patch[1].
233
234         [1]: https://bugs.webkit.org/show_bug.cgi?id=181183
235
236         * wtf/WallTime.h:
237         (WTF::WallTime::WallTime):
238         (WTF::WallTime::fromRawSeconds):
239         (WTF::WallTime::infinity):
240         (WTF::WallTime::secondsSinceEpoch const):
241         (WTF::WallTime::operator bool const):
242         (WTF::WallTime::operator+ const):
243         (WTF::WallTime::operator- const):
244         (WTF::WallTime::operator== const):
245         (WTF::WallTime::operator!= const):
246         (WTF::WallTime::operator< const):
247         (WTF::WallTime::operator> const):
248         (WTF::WallTime::operator<= const):
249         (WTF::WallTime::operator>= const):
250
251 2017-12-28  Fujii Hironori  <Hironori.Fujii@sony.com>
252
253         [Win][CMake] Use add_custom_command to copy each forwarding header files
254         https://bugs.webkit.org/show_bug.cgi?id=180921
255
256         Reviewed by Brent Fulgham.
257
258         * wtf/PlatformWin.cmake: Use WEBKIT_MAKE_FORWARDING_HEADERS.
259
260 2017-12-27  Yusuke Suzuki  <utatane.tea@gmail.com>
261
262         [WTF] Add clock_gettime based monotonicallyIncreasingTime implementation for Linux and BSDs
263         https://bugs.webkit.org/show_bug.cgi?id=181175
264
265         Reviewed by Michael Catanzaro.
266
267         Use platform-provided POSIX APIs to get monotonic time.
268
269         * wtf/CurrentTime.cpp:
270         (WTF::monotonicallyIncreasingTime):
271
272 2017-12-26  Carlos Alberto Lopez Perez  <clopez@igalia.com>
273
274         REGRESSION(r225769): Build error with constexpr std::max // std::min in libdstdc++4
275         https://bugs.webkit.org/show_bug.cgi?id=181160
276
277         Reviewed by Myles C. Maxfield.
278
279         In libstdc++-4 std::max and std::min are not annotated with constexpr.
280         This patch adds a WTF::min and WTF::max for using where a constexpr result is expected.
281         Related: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60271
282
283         * wtf/StdLibExtras.h:
284         (WTF::min):
285         (WTF::max):
286
287 2017-12-26  Yusuke Suzuki  <utatane.tea@gmail.com>
288
289         [JSC] Remove std::chrono completely
290         https://bugs.webkit.org/show_bug.cgi?id=181165
291
292         Reviewed by Konstantin Tokarev.
293
294         WTF::currentCPUTime now returns WTF::Seconds.
295         We also add the implementaiton for Linux and FreeBSD.
296
297         * wtf/CurrentTime.cpp:
298         (WTF::currentCPUTime):
299         * wtf/CurrentTime.h:
300
301 2017-12-22  Wenson Hsieh  <wenson_hsieh@apple.com>
302
303         Unreviewed, try to fix the Sierra build after r226277.
304
305         The macOS 10.12 SDK does not know about NSControlStateValue and some types of NSLevelIndicatorStyles, so these
306         need to be declared in a separate section in AppKitCompatibilityDeclarations.h (rather than in the < macOS 10.12
307         SDK #ifdef).
308
309         * wtf/mac/AppKitCompatibilityDeclarations.h:
310
311 2017-12-22  Wenson Hsieh  <wenson_hsieh@apple.com>
312
313         Fix build failures due to using deprecated AppKit symbols
314         https://bugs.webkit.org/show_bug.cgi?id=181110
315         <rdar://problem/36162865>
316
317         Reviewed by Dan Bernstein and Tim Horton.
318
319         When building with older macOS SDKs where some AppKit constants don't exist, define the modern constants to be
320         equal to their deprecated counterparts. This allows us to just have the modern types in WebKit sources while
321         avoiding breakage on old SDKs.
322
323         This, along with many other symbols in the compability header, can be removed once WebKit stops supporting macOS
324         10.11.
325
326         * wtf/mac/AppKitCompatibilityDeclarations.h:
327
328 2017-12-21  Mark Lam  <mark.lam@apple.com>
329
330         Add WTF::PoisonedUniquePtr to replace std::unique_ptr when poisoning is desired.
331         https://bugs.webkit.org/show_bug.cgi?id=181062
332         <rdar://problem/36167040>
333
334         Reviewed by Chris Dumez.
335
336         * WTF.xcodeproj/project.pbxproj:
337         * wtf/CMakeLists.txt:
338         * wtf/PointerAsserts.cpp: Copied from Source/WTF/wtf/RefPtr.cpp.
339         - renamed file because we asserts all kinds of pointers in here, not just RefPtr.
340         
341         * wtf/Poisoned.h:
342         - added a missing #include.
343         - make constexpr poison values more scrambled.
344         (WTF::makePoison):
345
346         * wtf/PoisonedUniquePtr.h: Added.
347         (WTF::PoisonedUniquePtr::PoisonedUniquePtr):
348         (WTF::PoisonedUniquePtr::~PoisonedUniquePtr):
349         (WTF::PoisonedUniquePtr::create):
350         (WTF::PoisonedUniquePtr::operator=):
351         (WTF::PoisonedUniquePtr::get const):
352         (WTF::PoisonedUniquePtr::operator[] const):
353         (WTF::PoisonedUniquePtr::clear):
354         (WTF::PoisonedUniquePtr::destroy):
355         (WTF::PoisonedUniquePtr::clearWithoutDestroy):
356         (WTF::makePoisonedUnique):
357         * wtf/RefPtr.cpp: Removed.
358
359 2017-12-21  Jeremy Jones  <jeremyj@apple.com>
360
361         Element fullscreen interface should display the location
362         https://bugs.webkit.org/show_bug.cgi?id=181006
363         rdar://problem/36143176
364
365         Reviewed by Simon Fraser.
366
367         Add SecTrustCopyInfo SPI.
368
369         * wtf/spi/cocoa/SecuritySPI.h:
370
371 2017-12-20  Fujii Hironori  <Hironori.Fujii@sony.com>
372
373         [CMake][WTF] Lowercase ForwardingHeaders directory name of WTF
374         https://bugs.webkit.org/show_bug.cgi?id=181022
375
376         Reviewed by Konstantin Tokarev.
377
378         * wtf/CMakeLists.txt: Renamed ForwardingHeaders directory name WTF to wtf.
379         * wtf/PlatformWin.cmake: Ditto.
380
381 2017-12-19  Brian Burg  <bburg@apple.com>
382
383         SLEEP_THREAD_FOR_DEBUGGER() macro should try to print out the PID of the affected process
384         https://bugs.webkit.org/show_bug.cgi?id=180947
385
386         Reviewed by Joseph Pecoraro.
387
388         * wtf/DebugUtilities.h:
389         - Use sleep() from CurrentTime.h as it is more cross-platform.
390         - Print a message with the process PID to simplify attaching to sleeping thread.
391         - Include source location in case multiple such macros are being used.
392
393 2017-12-18  Daniel Bates  <dabates@apple.com>
394
395         Conditionally forward declare NSMapTable SPI
396         https://bugs.webkit.org/show_bug.cgi?id=180936
397         <rdar://problem/35037796>
398
399         Reviewed by Dan Bernstein.
400
401         * wtf/spi/cocoa/NSMapTableSPI.h:
402
403 2017-12-16  Filip Pizlo  <fpizlo@apple.com>
404
405         Vector index masking
406         https://bugs.webkit.org/show_bug.cgi?id=180909
407
408         Reviewed by Keith Miller.
409         
410         Adds index masking to StringImpl and Vector.
411         
412         Perf:
413         
414         - 0.4% slower on microbenchmarks.
415         - Octane totally even.
416         - Kraken may be 0.8% slower.
417         - Speedometer is 0.8% slower with p = 0.008.
418         - membuster is even:
419             - snap2pre: 0.7% bigger w/ p = 0.26,
420             - snap2post: 0.3% smaller w/ p = 0.81,
421             - snap3pre: 1.2% bigger w/ p = 0.63,
422             - snap3post: 0.4% smaller w/ p = 0.76.
423
424         * wtf/MathExtras.h:
425         (WTF::roundUpToPowerOfTwo):
426         (WTF::maskForSize):
427         * wtf/SizeLimits.cpp:
428         * wtf/Vector.h:
429         (WTF::VectorBufferBase::allocateBuffer):
430         (WTF::VectorBufferBase::tryAllocateBuffer):
431         (WTF::VectorBufferBase::reallocateBuffer):
432         (WTF::VectorBufferBase::deallocateBuffer):
433         (WTF::VectorBufferBase::releaseBuffer):
434         (WTF::VectorBufferBase::VectorBufferBase):
435         (WTF::VectorBufferBase::updateMask):
436         (WTF::VectorBuffer::allocateBuffer):
437         (WTF::VectorBuffer::tryAllocateBuffer):
438         (WTF::VectorBuffer::swap):
439         (WTF::VectorBuffer::restoreInlineBufferIfNeeded):
440         (WTF::Vector::at):
441         (WTF::Vector::at const):
442         * wtf/text/StringImpl.h:
443         (WTF::StringImpl::maskOffset):
444         (WTF::StringImpl::mask const):
445         (WTF::StringImplShape::StringImplShape):
446         (WTF::StringImpl::at const):
447         (WTF::StringImpl::tailOffset):
448         * wtf/text/StringView.h:
449         (WTF::StringView::StringView):
450         (WTF::StringView::operator=):
451         (WTF::StringView::initialize):
452         (WTF::StringView::clear):
453         (WTF::StringView::operator[] const):
454         * wtf/text/WTFString.h:
455         (WTF::String::mask const):
456
457 2017-12-18  Claudio Saavedra  <csaavedra@igalia.com>
458
459         [GTK][Darwin] Do not define mach exceptions for GTK+
460
461         Rubber-stamped by Michael Catanzaro.
462         * wtf/Platform.h:
463
464 2017-12-17  Yusuke Suzuki  <utatane.tea@gmail.com>
465
466         [FTL] NewArrayBuffer should be sinked if it is only used for spreading
467         https://bugs.webkit.org/show_bug.cgi?id=179762
468
469         Reviewed by Saam Barati.
470
471         We add RecursableLambda<>. This can take a lambda and offer a way
472         to call this lambda recursively without introducing additional allocations.
473
474         C++ lambda is super useful in particular when we need to capture many
475         variables as references. Passing many arguments to a usual function is not
476         a good way. But C++ lambda does not allow us to easily call itself recursively.
477
478         Our recursableLambda offers `self` function as a first argument of the
479         given lambda. We can call this `self` recursively.
480
481         auto targetFunction = recursableLambda([] (auto self, ...) -> resultType {
482             self(...);
483         });
484
485         While `std::function<> func = [&func] { ... }` allows recursion, it causes
486         heap allocation for std::function<>. `auto func = [&func] { ... }` causes
487         a compile error since we need to deduce an actual type when capturing `func`.
488
489         * WTF.xcodeproj/project.pbxproj:
490         * wtf/RecursableLambda.h: Added.
491         (WTF::RecursableLambda::RecursableLambda):
492         (WTF::RecursableLambda::operator() const):
493         (WTF::recursableLambda):
494
495 2017-12-17  Mark Lam  <mark.lam@apple.com>
496
497         Enhance Ref and RefPtr to be able to work with smart pointers.
498         https://bugs.webkit.org/show_bug.cgi?id=180762
499         <rdar://problem/36027122>
500
501         Reviewed by JF Bastien and Darin Adler.
502
503         This is so we can use them with ConstExprPoisoned pointers to make PoisonedRef
504         and PoisonedRefPtr.
505
506         * WTF.xcodeproj/project.pbxproj:
507         * wtf/CMakeLists.txt:
508         * wtf/DumbPtrTraits.h: Added.
509         (WTF::DumbPtrTraits::exchange):
510         (WTF::DumbPtrTraits::swap):
511         (WTF::DumbPtrTraits::unwrap):
512         * wtf/Forward.h:
513         * wtf/Poisoned.h:
514         (WTF::ConstExprPoisonedPtrTraits::exchange):
515         (WTF::ConstExprPoisonedPtrTraits::swap):
516         (WTF::ConstExprPoisonedPtrTraits::unwrap):
517         * wtf/Ref.h:
518         (WTF::Ref::~Ref):
519         (WTF::Ref::Ref):
520         (WTF::Ref::ptrAllowingHashTableEmptyValue const):
521         (WTF::Ref::ptrAllowingHashTableEmptyValue):
522         (WTF::Ref::operator-> const):
523         (WTF::Ref::get const):
524         (WTF::Ref::operator T& const):
525         (WTF::=):
526         (WTF::U>::swap):
527         (WTF::swap):
528         (WTF::U>::replace):
529         (WTF::static_reference_cast):
530         (WTF::adoptRef):
531         (WTF::is):
532         (WTF::Ref<T>::swap): Deleted.
533         (WTF::Ref<T>::replace): Deleted.
534         (WTF::GetPtrHelper<Ref<T>>::getPtr): Deleted.
535         * wtf/RefPtr.cpp: Added.
536         * wtf/RefPtr.h:
537         (WTF::RefPtr::RefPtr):
538         (WTF::RefPtr::~RefPtr):
539         (WTF::RefPtr::get const):
540         (WTF::RefPtr::operator* const):
541         (WTF::RefPtr::operator-> const):
542         (WTF::U>::RefPtr):
543         (WTF::U>::leakRef):
544         (WTF::=):
545         (WTF::U>::swap):
546         (WTF::swap):
547         (WTF::operator==):
548         (WTF::operator!=):
549         (WTF::static_pointer_cast):
550         (WTF::adoptRef):
551         (WTF::is):
552         (WTF::RefPtr<T>::RefPtr): Deleted.
553         (WTF::RefPtr<T>::leakRef): Deleted.
554         (WTF::RefPtr<T>::swap): Deleted.
555
556 2017-12-16  Yusuke Suzuki  <utatane.tea@gmail.com>
557
558         Remove unnecessary boolean result of start() functions
559         https://bugs.webkit.org/show_bug.cgi?id=180856
560
561         Reviewed by Darin Adler.
562
563         CrossThreadTaskHandler's Thread is just released without calling
564         either `waitForCompletion` or `detach`. It means that this resource
565         of the thread is not released.
566
567         * benchmarks/ConditionSpeedTest.cpp:
568         * wtf/CrossThreadTaskHandler.cpp:
569         (WTF::CrossThreadTaskHandler::CrossThreadTaskHandler):
570         * wtf/CrossThreadTaskHandler.h:
571
572 2017-12-14  David Kilzer  <ddkilzer@apple.com>
573
574         Enable -Wstrict-prototypes for WebKit
575         <https://webkit.org/b/180757>
576         <rdar://problem/36024132>
577
578         Rubber-stamped by Joseph Pecoraro.
579
580         * Configurations/Base.xcconfig:
581         (CLANG_WARN_STRICT_PROTOTYPES): Add. Set to YES.
582         * wtf/Assertions.h:
583         (WTFReportBacktrace): Add 'void' to C function declaration.
584         (WTFCrashHookFunction): Add 'void' to C function pointer declaration.
585         (WTFInstallReportBacktraceOnCrashHook): Add 'void' to C function declaration.
586         (WTFIsDebuggerAttached): Ditto.
587         (WTFCrash): Ditto.
588         (WTFCrashWithSecurityImplication): Ditto.
589
590 2017-12-14  Yusuke Suzuki  <utatane.tea@gmail.com>
591
592         Drop Thread::tryCreate
593         https://bugs.webkit.org/show_bug.cgi?id=180808
594
595         Reviewed by Darin Adler.
596
597         We remove Thread::tryCreate. When thread creation fails, we have no way to keep WebKit working.
598         Compared to tryMalloc, Thread::create always consumes fixed size of resource. If it fails,
599         this is not due to arbitrary large user request. It is not reasonable that some thread creations
600         are handled gracefully while the other thread creations are not.
601
602         If we would like to have the limit of number of users' thread creation (like, calling `new Worker`
603         so many times), we should have a soft limit instead of relying on system's hard limit.
604
605         * wtf/ParallelJobsGeneric.cpp:
606         (WTF::ParallelEnvironment::ThreadPrivate::tryLockFor):
607         * wtf/Threading.cpp:
608         (WTF::Thread::create):
609         (WTF::Thread::tryCreate): Deleted.
610         * wtf/Threading.h:
611         (WTF::Thread::create): Deleted.
612
613 2017-12-13  Keith Miller  <keith_miller@apple.com>
614
615         JSObjects should have a mask for loading indexed properties
616         https://bugs.webkit.org/show_bug.cgi?id=180768
617
618         Reviewed by Mark Lam.
619
620         Add a clz that wraps the builtin clz intrinisics provided by
621         various compilers. The clz function by default assumes that
622         the input may be zero. On X86 this makes a difference because not
623         all CPUs have LZCNT and BSR has undefined behavior on zero. On ARM,
624         the zero check gets optimized away, regardless.
625
626         * wtf/StdLibExtras.h:
627         (std::clz):
628
629 2017-12-12  Yusuke Suzuki  <utatane.tea@gmail.com>
630
631         REGRESSION(r225769): Build errors with constexpr std::tie on older gcc
632         https://bugs.webkit.org/show_bug.cgi?id=180692
633
634         Reviewed by Carlos Garcia Campos.
635
636         Due to libstdc++'s bug[1], std::tie is not annotated with constexpr in libstdc++ 5.
637         This patch adds WTF::tie for a work around. Since we do not want to
638         include <tuple> in StdLibExtras.h, we define this function for all
639         the compilers.
640
641         [1]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65978
642
643         * wtf/StdLibExtras.h:
644
645 2017-12-13  Mark Lam  <mark.lam@apple.com>
646
647         Fill out some Poisoned APIs, fix some bugs, and add some tests.
648         https://bugs.webkit.org/show_bug.cgi?id=180724
649         <rdar://problem/36006884>
650
651         Reviewed by JF Bastien.
652
653         Also rename Int32Poisoned to ConstExprPoisoned.  The key it takes is actually a
654         uint32_t.  So, Int32 is really a misnomer.  In addition, the key needs to be a
655         constexpr.  So, ConstExprPoisoned is a better name for it.
656
657         * wtf/Poisoned.cpp:
658         (WTF::makePoison):
659         * wtf/Poisoned.h:
660         (WTF::PoisonedImplHelper::asReference):
661         (WTF::PoisonedImpl::PoisonedImpl):
662         (WTF::PoisonedImpl::clear):
663         (WTF::PoisonedImpl::operator* const):
664         (WTF::PoisonedImpl::operator-> const):
665         (WTF::PoisonedImpl::operator== const):
666         (WTF::PoisonedImpl::operator!= const):
667         (WTF::PoisonedImpl::operator< const):
668         (WTF::PoisonedImpl::operator<= const):
669         (WTF::PoisonedImpl::operator> const):
670         (WTF::PoisonedImpl::operator>= const):
671         (WTF::PoisonedImpl::operator=):
672         (WTF::PoisonedImpl::swap):
673         (WTF::PoisonedImpl::exchange):
674         (WTF::swap):
675         (WTF::makePoison):
676         (WTF::PoisonedImpl::operator==): Deleted.
677
678 2017-12-12  Yusuke Suzuki  <utatane.tea@gmail.com>
679
680         [JSC] Implement optimized WeakMap and WeakSet
681         https://bugs.webkit.org/show_bug.cgi?id=179929
682
683         Reviewed by Saam Barati.
684
685         We introduce JSValueMalloc, which is specialized malloc scheme with Gigacage::JSValue.
686         This is used for WeakMapImpl's buffer.
687
688         * WTF.xcodeproj/project.pbxproj:
689         * wtf/CMakeLists.txt:
690         * wtf/JSValueMalloc.cpp: Added.
691         (WTF::tryJSValueMalloc):
692         (WTF::jsValueMalloc):
693         (WTF::jsValueRealloc):
694         (WTF::jsValueFree):
695         * wtf/JSValueMalloc.h: Added.
696         (WTF::JSValueMalloc::malloc):
697         (WTF::JSValueMalloc::tryMalloc):
698         (WTF::JSValueMalloc::realloc):
699         (WTF::JSValueMalloc::free):
700         * wtf/MallocPtr.h:
701         (WTF::MallocPtr::~MallocPtr):
702         (WTF::MallocPtr::malloc):
703         (WTF::MallocPtr::tryMalloc):
704         (WTF::MallocPtr::realloc):
705         We extend MallocPtr to adopt malloc scheme as its template parameter.
706
707 2017-12-11  Filip Pizlo  <fpizlo@apple.com>
708
709         It should be possible to flag a cell for unconditional finalization
710         https://bugs.webkit.org/show_bug.cgi?id=180636
711
712         Reviewed by Saam Barati.
713         
714         This adds ConcurrentVector, which is like SegmentedVector, but wastes some space to allow
715         resizing to proceed concurrently to access. It's not possible to resize concurrently to
716         resizing, concurrent read/writes aren't protected from racing if they access the same element,
717         and who knows what you'll get if you iterate up to size() while someone else append()s. The
718         key insight is to stash all prior copies of the spine, so that nobody crashes trying to access
719         a stale spine.
720         
721         I'm going to want to do the same thing for FastBitVector, by creating a segmented WordOwner
722         class. That would require repeating the dance of having a spine that can resize while stashing
723         old versions. So, the spine resizing logic is abstracted behind ConcurrentBuffer. You could
724         use that as a kind of "concurrent vector" for immutable data. That's how ConcurrentVector uses
725         it: it's an immutable array of segment pointers.
726
727         * WTF.xcodeproj/project.pbxproj:
728         * wtf/ConcurrentBuffer.h: Added.
729         (WTF::ConcurrentBuffer::ConcurrentBuffer):
730         (WTF::ConcurrentBuffer::~ConcurrentBuffer):
731         (WTF::ConcurrentBuffer::growExact):
732         (WTF::ConcurrentBuffer::grow):
733         (WTF::ConcurrentBuffer::array const):
734         (WTF::ConcurrentBuffer::operator[]):
735         (WTF::ConcurrentBuffer::operator[] const):
736         (WTF::ConcurrentBuffer::createArray):
737         * wtf/ConcurrentVector.h: Added.
738         (WTF::ConcurrentVectorIterator::~ConcurrentVectorIterator):
739         (WTF::ConcurrentVectorIterator::operator* const):
740         (WTF::ConcurrentVectorIterator::operator-> const):
741         (WTF::ConcurrentVectorIterator::operator++):
742         (WTF::ConcurrentVectorIterator::operator== const):
743         (WTF::ConcurrentVectorIterator::operator!= const):
744         (WTF::ConcurrentVectorIterator::operator=):
745         (WTF::ConcurrentVectorIterator::ConcurrentVectorIterator):
746         (WTF::ConcurrentVector::~ConcurrentVector):
747         (WTF::ConcurrentVector::size const):
748         (WTF::ConcurrentVector::isEmpty const):
749         (WTF::ConcurrentVector::at):
750         (WTF::ConcurrentVector::at const):
751         (WTF::ConcurrentVector::operator[]):
752         (WTF::ConcurrentVector::operator[] const):
753         (WTF::ConcurrentVector::first):
754         (WTF::ConcurrentVector::first const):
755         (WTF::ConcurrentVector::last):
756         (WTF::ConcurrentVector::last const):
757         (WTF::ConcurrentVector::takeLast):
758         (WTF::ConcurrentVector::append):
759         (WTF::ConcurrentVector::alloc):
760         (WTF::ConcurrentVector::removeLast):
761         (WTF::ConcurrentVector::grow):
762         (WTF::ConcurrentVector::begin):
763         (WTF::ConcurrentVector::end):
764         (WTF::ConcurrentVector::segmentExistsFor):
765         (WTF::ConcurrentVector::segmentFor):
766         (WTF::ConcurrentVector::subscriptFor):
767         (WTF::ConcurrentVector::ensureSegmentsFor):
768         (WTF::ConcurrentVector::ensureSegment):
769         (WTF::ConcurrentVector::allocateSegment):
770
771 2017-12-12  JF Bastien  <jfbastien@apple.com>
772
773         makeString: support more integral types
774         https://bugs.webkit.org/show_bug.cgi?id=180720
775
776         Reviewed by Sam Weinig.
777
778         Only some integral types worked. Add more types by using template
779         magic. While we're here, also use the same magic for
780         floating-point types in the theoretical future where short float
781         or long double matter.
782
783         The core of the magic is a second, defaulted, template
784         parameter. It's declared in Forward.h (as void), and then in
785         classes where we want to enable_if we use it (in C++ speak we
786         create a partial class template specialization), otherwise we
787         leave it as void.
788
789         Also clean up some constructors which were being way too verbose
790         in stating that they were declarations for this template
791         specialization right here, when really we already knew that.
792
793         * wtf/Forward.h:
794         * wtf/text/StringConcatenate.h:
795         (WTF::StringTypeAdapter<char>::StringTypeAdapter<char>): Deleted.
796         (WTF::StringTypeAdapter<char>::length): Deleted.
797         (WTF::StringTypeAdapter<char>::is8Bit): Deleted.
798         (WTF::StringTypeAdapter<char>::writeTo const): Deleted.
799         (WTF::StringTypeAdapter<char>::toString const): Deleted.
800         (WTF::StringTypeAdapter<UChar>::StringTypeAdapter<UChar>): Deleted.
801         (WTF::StringTypeAdapter<UChar>::length const): Deleted.
802         (WTF::StringTypeAdapter<UChar>::is8Bit const): Deleted.
803         (WTF::StringTypeAdapter<UChar>::writeTo const): Deleted.
804         (WTF::StringTypeAdapter<UChar>::toString const): Deleted.
805         (WTF::StringTypeAdapter<char::StringTypeAdapter): Deleted.
806         (WTF::StringTypeAdapter<ASCIILiteral>::StringTypeAdapter): Deleted.
807         (WTF::StringTypeAdapter<Vector<char>>::StringTypeAdapter): Deleted.
808         (WTF::StringTypeAdapter<Vector<char>>::length const): Deleted.
809         (WTF::StringTypeAdapter<Vector<char>>::is8Bit const): Deleted.
810         (WTF::StringTypeAdapter<Vector<char>>::writeTo const): Deleted.
811         (WTF::StringTypeAdapter<Vector<char>>::toString const): Deleted.
812         (WTF::StringTypeAdapter<String>::StringTypeAdapter<String>): Deleted.
813         (WTF::StringTypeAdapter<String>::length const): Deleted.
814         (WTF::StringTypeAdapter<String>::is8Bit const): Deleted.
815         (WTF::StringTypeAdapter<String>::writeTo const): Deleted.
816         (WTF::StringTypeAdapter<String>::toString const): Deleted.
817         (WTF::StringTypeAdapter<AtomicString>::StringTypeAdapter): Deleted.
818         * wtf/text/StringConcatenateNumbers.h:
819         (WTF::StringTypeAdapter<FormattedNumber>::StringTypeAdapter):
820         (WTF::StringTypeAdapter<int>::StringTypeAdapter<int>): Deleted.
821         (WTF::StringTypeAdapter<int>::length const): Deleted.
822         (WTF::StringTypeAdapter<int>::is8Bit const): Deleted.
823         (WTF::StringTypeAdapter<int>::writeTo const): Deleted.
824         (WTF::StringTypeAdapter<int>::toString const): Deleted.
825         (WTF::StringTypeAdapter<unsigned>::StringTypeAdapter<unsigned>): Deleted.
826         (WTF::StringTypeAdapter<unsigned>::length const): Deleted.
827         (WTF::StringTypeAdapter<unsigned>::is8Bit const): Deleted.
828         (WTF::StringTypeAdapter<unsigned>::writeTo const): Deleted.
829         (WTF::StringTypeAdapter<unsigned>::toString const): Deleted.
830         (WTF::StringTypeAdapter<double>::StringTypeAdapter<double>): Deleted.
831         (WTF::StringTypeAdapter<double>::length const): Deleted.
832         (WTF::StringTypeAdapter<double>::is8Bit const): Deleted.
833         (WTF::StringTypeAdapter<double>::writeTo const): Deleted.
834         (WTF::StringTypeAdapter<double>::toString const): Deleted.
835         (WTF::StringTypeAdapter<float>::StringTypeAdapter<float>): Deleted.
836         (WTF::StringTypeAdapter<FormattedNumber>::StringTypeAdapter<FormattedNumber>): Deleted.
837         * wtf/text/StringView.h:
838         (WTF::StringTypeAdapter<StringView>::StringTypeAdapter<StringView>): Deleted.
839         (WTF::StringTypeAdapter<StringView>::length): Deleted.
840         (WTF::StringTypeAdapter<StringView>::is8Bit): Deleted.
841         (WTF::StringTypeAdapter<StringView>::writeTo): Deleted.
842         (WTF::StringTypeAdapter<StringView>::toString const): Deleted.
843
844 2017-12-12  Caio Lima  <ticaiolima@gmail.com>
845
846         [ESNext][BigInt] Implement BigInt literals and JSBigInt
847         https://bugs.webkit.org/show_bug.cgi?id=179000
848
849         Reviewed by Darin Adler and Yusuke Suzuki.
850
851         * wtf/HashFunctions.h:
852
853 2017-12-12  Joseph Pecoraro  <pecoraro@apple.com>
854
855         Symbol not found: __ZN3WTF8LockBase10unlockSlowEv
856         https://bugs.webkit.org/show_bug.cgi?id=180691
857
858         Reviewed by Yusuke Suzuki.
859
860         * wtf/mac/DeprecatedSymbolsUsedBySafari.mm:
861         (WTF::LockBase::lockSlow):
862         (WTF::LockBase::unlockSlow):
863         Add back LockBase Symbols used by System Safari on 10.13.
864
865 2017-12-12  Yusuke Suzuki  <utatane.tea@gmail.com>
866
867         [WTF] Thread::create should have Thread::tryCreate
868         https://bugs.webkit.org/show_bug.cgi?id=180333
869
870         Reviewed by Darin Adler.
871
872         Many callers of Thread::create assume that it returns non-nullptr Thread.
873         But if the number of threads hits the limit in the system, creating Thread
874         would fail. In that case, it is really difficult to keep WebKit working.
875
876         We introduce Thread::tryCreate, and change the returned value from Thread::create
877         from RefPtr<Thread> to Ref<Thread>. In Thread::create, we ensure thread creation
878         succeeds by RELEASE_ASSERT. And we use Thread::create intentionally if the
879         caller assumes that thread should be created.
880
881         * wtf/AutomaticThread.cpp:
882         (WTF::AutomaticThread::start):
883         * wtf/ParallelJobsGeneric.cpp:
884         (WTF::ParallelEnvironment::ThreadPrivate::tryLockFor):
885         * wtf/Threading.cpp:
886         (WTF::Thread::tryCreate):
887         (WTF::Thread::create): Deleted.
888         * wtf/Threading.h:
889         (WTF::Thread::create):
890         * wtf/WorkQueue.cpp:
891         (WTF::WorkQueue::concurrentApply):
892
893 2017-12-11  Eric Carlson  <eric.carlson@apple.com>
894
895         Web Inspector: Optionally log WebKit log parameters as JSON
896         https://bugs.webkit.org/show_bug.cgi?id=180529
897         <rdar://problem/35909462>
898
899         Reviewed by Joseph Pecoraro.
900
901         * wtf/Logger.h:
902         (WTF::Logger::log):
903         (WTF::LogArgument<Logger::LogSiteIdentifier>::toString):
904
905         * wtf/MediaTime.cpp:
906         (WTF::MediaTime::toJSONString const): Serialize to JSON string.
907         * wtf/MediaTime.h:
908
909 2017-12-11  Tim Horton  <timothy_horton@apple.com>
910
911         Stop using deprecated target conditional for simulator builds
912         https://bugs.webkit.org/show_bug.cgi?id=180662
913         <rdar://problem/35136156>
914
915         Reviewed by Simon Fraser.
916
917         * wtf/Platform.h:
918
919 2017-12-11  Yusuke Suzuki  <utatane.tea@gmail.com>
920
921         [WTF] Add Converter traits to StringHasher instead of function pointer
922         https://bugs.webkit.org/show_bug.cgi?id=180656
923
924         Reviewed by JF Bastien.
925
926         In the latest ICU, UChar is char16_t. So defining defaultConverter(UChar)
927         and defaultConverter(char16_t) causes duplicate definitions.
928         Instead of passing a funtion pointer, we pass a trait class DefaultConveter
929         which has `convert` static function. And we make this `convert` function
930         generic. This avoids defining convert function for UChar and char16_t.
931
932         * wtf/text/StringHash.h:
933         (WTF::ASCIICaseInsensitiveHash::FoldCase::convert):
934         (WTF::ASCIICaseInsensitiveHash::hash):
935         (WTF::ASCIICaseInsensitiveHash::foldCase): Deleted.
936         * wtf/text/StringHasher.h:
937         (WTF::StringHasher::DefaultConverter::convert):
938         (WTF::StringHasher::addCharactersAssumingAligned):
939         (WTF::StringHasher::addCharacters):
940         (WTF::StringHasher::computeHashAndMaskTop8Bits):
941         (WTF::StringHasher::computeHash):
942         (WTF::StringHasher::computeLiteralHash):
943         (WTF::StringHasher::computeLiteralHashAndMaskTop8Bits):
944         (WTF::StringHasher::computeHashImpl):
945         (WTF::StringHasher::Converter): Deleted.
946         (WTF::StringHasher::defaultConverter): Deleted.
947
948 2017-12-10  Yusuke Suzuki  <utatane.tea@gmail.com>
949
950         [WTF] Reduce sizeof(Thread) by adjusting alignment
951         https://bugs.webkit.org/show_bug.cgi?id=180630
952
953         Reviewed by Saam Barati.
954
955         Reduce sizeof(Thread) slightly by adjusting alignment.
956
957         * wtf/Threading.h:
958
959 2017-12-10  Yusuke Suzuki  <utatane.tea@gmail.com>
960
961         Unreviewed, follow-up patch after r225726
962         https://bugs.webkit.org/show_bug.cgi?id=180622
963
964         Suggested by Darin. We should take care of signed-extension of `char`.
965
966         * wtf/text/StringHasher.h:
967         (WTF::StringHasher::defaultConverter):
968
969 2017-12-09  Yusuke Suzuki  <utatane.tea@gmail.com>
970
971         [WTF] Remove RELAXED_CONSTEXPR
972         https://bugs.webkit.org/show_bug.cgi?id=180624
973
974         Reviewed by JF Bastien.
975
976         All of our required compilers support relaxed constexpr in C++14.
977         We can drop RELAXED_CONSTEXPR macro in our tree.
978
979         * wtf/Compiler.h:
980         * wtf/Expected.h:
981         (std::experimental::fundamentals_v3::expected::operator*):
982         (std::experimental::fundamentals_v3::expected::value):
983         (std::experimental::fundamentals_v3::expected::error):
984         * wtf/Unexpected.h:
985         (std::experimental::fundamentals_v3::unexpected::value):
986         (std::experimental::fundamentals_v3::unexpected::value const):
987
988 2017-12-09  Yusuke Suzuki  <utatane.tea@gmail.com>
989
990         Fix WTF::Hasher tuple expansion with variadic args
991         https://bugs.webkit.org/show_bug.cgi?id=180623
992
993         Reviewed by JF Bastien.
994
995         We expand a tuple with `...`, and use this in a function's argument list.
996         And in this argument list, we call `add()` for each value. This will be
997         expanded as follows.
998
999             [] (...) { }((add(hasher, std::get<i>(values)), 0)...);
1000
1001         will become,
1002
1003             [] (...) { }((add(hasher, std::get<0>(values)), 0), (add(hasher, std::get<1>(values)), 0), ...);
1004
1005         However, the evaluation order of the C++ argument is unspecified. Actually,
1006         in GCC environment, this `add()` is not called in our expected order. As a
1007         result, currently we have test failures in TestWTF.
1008
1009         This patch just uses variadic templates to expand tuples, and call add() in
1010         our expected order. This patch fixes an existing failure of TestWTF in GCC environment.
1011
1012         * wtf/Hasher.h:
1013         (WTF::Hasher::computeHash):
1014         (WTF::addArgs):
1015         (WTF::addTupleHelper):
1016         (WTF::add):
1017
1018 2017-12-09  Yusuke Suzuki  <utatane.tea@gmail.com>
1019
1020         Use relaxed constexpr for StringHasher
1021         https://bugs.webkit.org/show_bug.cgi?id=180622
1022
1023         Reviewed by JF Bastien.
1024
1025         Now VC++ is updated and all the WebKit compilers support C++14 relaxed constexpr.
1026         This patch uses relaxed constexpr for StringHasher constexpr implementation
1027
1028         * wtf/text/StringHasher.h:
1029         (WTF::StringHasher::addCharactersAssumingAligned):
1030         (WTF::StringHasher::Converter):
1031         (WTF::StringHasher::computeHashAndMaskTop8Bits):
1032         (WTF::StringHasher::computeHash):
1033         (WTF::StringHasher::computeLiteralHash):
1034         (WTF::StringHasher::computeLiteralHashAndMaskTop8Bits):
1035         (WTF::StringHasher::defaultConverter):
1036         (WTF::StringHasher::avalancheBits):
1037         (WTF::StringHasher::finalize):
1038         (WTF::StringHasher::finalizeAndMaskTop8Bits):
1039         (WTF::StringHasher::avoidZero):
1040         (WTF::StringHasher::calculateWithRemainingLastCharacter):
1041         (WTF::StringHasher::calculateWithTwoCharacters):
1042         (WTF::StringHasher::processPendingCharacter const):
1043         (WTF::StringHasher::StringHasher): Deleted.
1044         (WTF::StringHasher::avalancheBits3): Deleted.
1045         (WTF::StringHasher::avalancheBits2): Deleted.
1046         (WTF::StringHasher::avalancheBits1): Deleted.
1047         (WTF::StringHasher::avalancheBits0): Deleted.
1048         (WTF::StringHasher::calculateWithRemainingLastCharacter1): Deleted.
1049         (WTF::StringHasher::calculateWithRemainingLastCharacter0): Deleted.
1050         (WTF::StringHasher::calculate1): Deleted.
1051         (WTF::StringHasher::calculate0): Deleted.
1052         (WTF::StringHasher::calculate): Deleted.
1053         (WTF::StringHasher::computeLiteralHashImpl): Deleted.
1054
1055 2017-12-08  Eric Carlson  <eric.carlson@apple.com>
1056
1057         Move Logger from PAL to WTF so it can be used outside of WebCore
1058         https://bugs.webkit.org/show_bug.cgi?id=180561
1059
1060         Reviewed by Alex Christensen.
1061
1062         * WTF.xcodeproj/project.pbxproj:
1063         * wtf/Logger.h: Copied from Source/WebCore/PAL/pal/Logger.h.
1064         (PAL::LogArgument::toString): Deleted.
1065         (PAL::Logger::create): Deleted.
1066         (PAL::Logger::logAlways const): Deleted.
1067         (PAL::Logger::error const): Deleted.
1068         (PAL::Logger::warning const): Deleted.
1069         (PAL::Logger::info const): Deleted.
1070         (PAL::Logger::debug const): Deleted.
1071         (PAL::Logger::willLog const): Deleted.
1072         (PAL::Logger::enabled const): Deleted.
1073         (PAL::Logger::setEnabled): Deleted.
1074         (PAL::Logger::LogSiteIdentifier::LogSiteIdentifier): Deleted.
1075         (PAL::Logger::addObserver): Deleted.
1076         (PAL::Logger::removeObserver): Deleted.
1077         (PAL::Logger::Logger): Deleted.
1078         (PAL::Logger::log): Deleted.
1079         (PAL::Logger::observers): Deleted.
1080         (PAL::LogArgument<Logger::LogSiteIdentifier>::toString): Deleted.
1081         * wtf/LoggerHelper.h: Copied from Source/WebCore/PAL/pal/LoggerHelper.h.
1082
1083 2017-12-08  Yusuke Suzuki  <utatane.tea@gmail.com>
1084
1085         Remove pthread_once in favor of dispatch_once
1086         https://bugs.webkit.org/show_bug.cgi?id=180591
1087
1088         Reviewed by Saam Barati.
1089
1090         Fix the comment.
1091
1092         * wtf/Threading.h:
1093         (WTF::Thread::current):
1094
1095 2017-12-08  Yusuke Suzuki  <utatane.tea@gmail.com>
1096
1097         [WTF][Linux][GTK] Fix a minor bug in generic/WorkQueue when WorkQueue is immediately destroyed
1098         https://bugs.webkit.org/show_bug.cgi?id=180586
1099
1100         Reviewed by Darin Adler.
1101
1102         If WorkQueue is created and destroyed immediately, RunLoop::stop can be called
1103         befire calling RunLoop::run(). At that time WorkQueue thread is not stopped.
1104
1105         This patch dispatches a task stopping its own RunLoop to ensure stop is done.
1106         We also clean up WorkQueue implementation not to include unnecessary fields,
1107         lock, condition, and thread.
1108
1109         * wtf/WorkQueue.h:
1110         * wtf/generic/WorkQueueGeneric.cpp:
1111         (WorkQueue::platformInitialize):
1112         (WorkQueue::platformInvalidate):
1113
1114 2017-12-08  Yusuke Suzuki  <utatane.tea@gmail.com>
1115
1116         [WTF] Remove remaining use of Mutex
1117         https://bugs.webkit.org/show_bug.cgi?id=180579
1118
1119         Reviewed by Alex Christensen.
1120
1121         Mutex should be only used in low-level Locking and Threading.
1122         Other ones should use WTF::Lock and WTF::Condition instead.
1123         This patch replaces WTF::Mutex with WTF::Lock in WTF if it
1124         is not related to threading or locking implementation.
1125
1126         And we also use WTF::Lock and WTF::Condition in WTF::BinarySemaphore.
1127
1128         * wtf/RunLoop.cpp:
1129         (WTF::RunLoop::performWork):
1130         (WTF::RunLoop::dispatch):
1131         * wtf/RunLoop.h:
1132         * wtf/WorkQueue.cpp:
1133         * wtf/WorkQueue.h:
1134         * wtf/threads/BinarySemaphore.cpp:
1135         (WTF::BinarySemaphore::signal):
1136         (WTF::BinarySemaphore::wait):
1137         (WTF::BinarySemaphore::BinarySemaphore): Deleted.
1138         (WTF::BinarySemaphore::~BinarySemaphore): Deleted.
1139         * wtf/threads/BinarySemaphore.h:
1140         * wtf/win/WorkQueueWin.cpp:
1141         (WTF::WorkQueue::registerHandle):
1142         (WTF::WorkQueue::unregisterAndCloseHandle):
1143         (WTF::WorkQueue::dispatch):
1144         (WTF::WorkQueue::timerCallback):
1145         (WTF::WorkQueue::dispatchAfter):
1146         (WTF::TimerContext::TimerContext): Deleted.
1147
1148 2017-12-08  Yusuke Suzuki  <utatane.tea@gmail.com>
1149
1150         Use StaticLock and Lock instead of Mutex in Windows WebKitLegacy
1151         https://bugs.webkit.org/show_bug.cgi?id=180572
1152
1153         Reviewed by Mark Lam.
1154
1155         Remove DEPRECATED_DEFINE_STATIC_LOCAL since it's no longer used.
1156
1157         * wtf/StdLibExtras.h:
1158
1159 2017-12-07  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1160
1161         [Win] [64-bit] Resolve Microsoft warning C4319 on BitVector.cpp
1162         https://bugs.webkit.org/show_bug.cgi?id=180490
1163
1164         Reviewed by Alex Christensen.
1165
1166         bitsInPointer() returns unsigned which is smaller than size_t.
1167         "~"(negate) operator is applied before extending its size which result filled with zero.
1168         This may be potentially a bug if numBits is greater than max value of unsigned long
1169         (which is not practical).
1170
1171         * wtf/BitVector.cpp:
1172         (WTF::BitVector::OutOfLineBits::create):
1173
1174 2017-12-07  Yusuke Suzuki  <utatane.tea@gmail.com>
1175
1176         Use WTF Locking primitives in WebThread and drop pthread_xxx use
1177         https://bugs.webkit.org/show_bug.cgi?id=180445
1178
1179         Reviewed by Saam Barati.
1180
1181         Add initializer form to fill struct with zero if struct does not have any default initializers.
1182
1183         * wtf/ThreadSpecific.h:
1184         (WTF::ThreadSpecific::Data::Data):
1185
1186 2017-12-07  Mark Lam  <mark.lam@apple.com>
1187
1188         Apply poisoning to some native code pointers.
1189         https://bugs.webkit.org/show_bug.cgi?id=180541
1190         <rdar://problem/35916875>
1191
1192         Reviewed by Filip Pizlo.
1193
1194         Ensure that the resultant poisoned bits still looks like a pointer in that its
1195         bottom bits are 0, just like the alignment bits of a pointer.  This allows the
1196         client to use the bottom bits of the poisoned bits as flag bits just like the
1197         client was previously able to do with pointer values.
1198
1199         Note: we only ensure that the bottom alignment bits of the generated poison
1200         value is 0.  We're not masking out the poisoned bits.  This means that the bottom
1201         bits of the poisoned bits will only be null if the original pointer is aligned.
1202         Hence, if the client applies the poison to an unaligned pointer, we do not lose
1203         any information on the low bits.
1204
1205         Also removed 2 wrong assertions in PoisonedImpl's constructors.  We were
1206         asserting that Poisoned will never be used with a null value, but that's invalid.
1207         We do want to allow a null value so that we don't have to constantly do null
1208         checks in the clients.  This was uncovered by some layout tests.
1209
1210         * wtf/Poisoned.cpp:
1211         (WTF::makePoison):
1212         * wtf/Poisoned.h:
1213         (WTF::PoisonedImpl::PoisonedImpl):
1214
1215 2017-12-07  Mark Lam  <mark.lam@apple.com>
1216
1217         [Re-landing r225620] Refactoring: Rename ScrambledPtr to Poisoned.
1218         https://bugs.webkit.org/show_bug.cgi?id=180514
1219
1220         Reviewed by Saam Barati and JF Bastien.
1221
1222         Re-landing r225620 with speculative build fix for GCC 7.
1223
1224         * WTF.xcodeproj/project.pbxproj:
1225         * wtf/CMakeLists.txt:
1226         * wtf/Poisoned.cpp: Copied from Source/WTF/wtf/ScrambledPtr.cpp.
1227         (WTF::makePoison):
1228         (WTF::makeScrambledPtrKey): Deleted.
1229         * wtf/Poisoned.h: Copied from Source/WTF/wtf/ScrambledPtr.h.
1230         (WTF::PoisonedImpl::PoisonedImpl):
1231         (WTF::PoisonedImpl::assertIsPoisoned const):
1232         (WTF::PoisonedImpl::assertIsNotPoisoned const):
1233         (WTF::PoisonedImpl::unpoisoned const):
1234         (WTF::PoisonedImpl::operator-> const):
1235         (WTF::PoisonedImpl::bits const):
1236         (WTF::PoisonedImpl::operator! const):
1237         (WTF::PoisonedImpl::operator bool const):
1238         (WTF::PoisonedImpl::operator== const):
1239         (WTF::PoisonedImpl::operator==):
1240         (WTF::PoisonedImpl::operator=):
1241         (WTF::PoisonedImpl::poison):
1242         (WTF::PoisonedImpl::unpoison):
1243         (WTF::ScrambledPtr::ScrambledPtr): Deleted.
1244         (WTF::ScrambledPtr::assertIsScrambled const): Deleted.
1245         (WTF::ScrambledPtr::assertIsNotScrambled const): Deleted.
1246         (WTF::ScrambledPtr::descrambled const): Deleted.
1247         (WTF::ScrambledPtr::operator-> const): Deleted.
1248         (WTF::ScrambledPtr::bits const): Deleted.
1249         (WTF::ScrambledPtr::operator! const): Deleted.
1250         (WTF::ScrambledPtr::operator bool const): Deleted.
1251         (WTF::ScrambledPtr::operator== const): Deleted.
1252         (WTF::ScrambledPtr::operator==): Deleted.
1253         (WTF::ScrambledPtr::operator=): Deleted.
1254         (WTF::ScrambledPtr::scramble): Deleted.
1255         (WTF::ScrambledPtr::descramble): Deleted.
1256         * wtf/ScrambledPtr.cpp: Removed.
1257         * wtf/ScrambledPtr.h: Removed.
1258
1259 2017-12-07  Michael Catanzaro  <mcatanzaro@igalia.com>
1260
1261         Unreviewed, rolling out r225620
1262         https://bugs.webkit.org/show_bug.cgi?id=180514
1263         <rdar://problem/35901694>
1264
1265         It broke the build with GCC 7, and I don't know how to fix it.
1266
1267         * WTF.xcodeproj/project.pbxproj:
1268         * wtf/CMakeLists.txt:
1269         * wtf/Poisoned.h: Removed.
1270         * wtf/ScrambledPtr.cpp: Renamed from Source/WTF/wtf/Poisoned.cpp.
1271         (WTF::makeScrambledPtrKey):
1272         * wtf/ScrambledPtr.h: Added.
1273         (WTF::ScrambledPtr::ScrambledPtr):
1274         (WTF::ScrambledPtr::assertIsScrambled const):
1275         (WTF::ScrambledPtr::assertIsNotScrambled const):
1276         (WTF::ScrambledPtr::descrambled const):
1277         (WTF::ScrambledPtr::operator-> const):
1278         (WTF::ScrambledPtr::bits const):
1279         (WTF::ScrambledPtr::operator! const):
1280         (WTF::ScrambledPtr::operator bool const):
1281         (WTF::ScrambledPtr::operator== const):
1282         (WTF::ScrambledPtr::operator==):
1283         (WTF::ScrambledPtr::operator=):
1284         (WTF::ScrambledPtr::scramble):
1285         (WTF::ScrambledPtr::descramble):
1286
1287 2017-12-06  Mark Lam  <mark.lam@apple.com>
1288
1289         Refactoring: Rename ScrambledPtr to Poisoned.
1290         https://bugs.webkit.org/show_bug.cgi?id=180514
1291
1292         Reviewed by Saam Barati.
1293
1294         We're switching our nomenclature to "poisoning" instead of "scrambling" pointers.
1295         This allows us to use shorter names.
1296
1297         This patch is almost purely refactoring, except for one change: the PoisonedImpl
1298         template class (previously ScrambledPtr) has been modified to allow usage of
1299         a constexpr uint32_t poison value (see Int32Poisoned) in addition to a runtime
1300         determined uintptr_t poison value (see Poisoned).
1301
1302         * WTF.xcodeproj/project.pbxproj:
1303         * wtf/CMakeLists.txt:
1304         * wtf/Poisoned.cpp: Copied from Source/WTF/wtf/ScrambledPtr.cpp.
1305         (WTF::makePoison):
1306         (WTF::makeScrambledPtrKey): Deleted.
1307         * wtf/Poisoned.h: Copied from Source/WTF/wtf/ScrambledPtr.h.
1308         (WTF::PoisonedImpl::PoisonedImpl):
1309         (WTF::PoisonedImpl::assertIsPoisoned const):
1310         (WTF::PoisonedImpl::assertIsNotPoisoned const):
1311         (WTF::PoisonedImpl::unpoisoned const):
1312         (WTF::PoisonedImpl::operator-> const):
1313         (WTF::PoisonedImpl::bits const):
1314         (WTF::PoisonedImpl::operator! const):
1315         (WTF::PoisonedImpl::operator bool const):
1316         (WTF::PoisonedImpl::operator== const):
1317         (WTF::PoisonedImpl::operator==):
1318         (WTF::PoisonedImpl::operator=):
1319         (WTF::PoisonedImpl::poison):
1320         (WTF::PoisonedImpl::unpoison):
1321         (WTF::ScrambledPtr::ScrambledPtr): Deleted.
1322         (WTF::ScrambledPtr::assertIsScrambled const): Deleted.
1323         (WTF::ScrambledPtr::assertIsNotScrambled const): Deleted.
1324         (WTF::ScrambledPtr::descrambled const): Deleted.
1325         (WTF::ScrambledPtr::operator-> const): Deleted.
1326         (WTF::ScrambledPtr::bits const): Deleted.
1327         (WTF::ScrambledPtr::operator! const): Deleted.
1328         (WTF::ScrambledPtr::operator bool const): Deleted.
1329         (WTF::ScrambledPtr::operator== const): Deleted.
1330         (WTF::ScrambledPtr::operator==): Deleted.
1331         (WTF::ScrambledPtr::operator=): Deleted.
1332         (WTF::ScrambledPtr::scramble): Deleted.
1333         (WTF::ScrambledPtr::descramble): Deleted.
1334         * wtf/ScrambledPtr.cpp: Removed.
1335         * wtf/ScrambledPtr.h: Removed.
1336
1337 2017-12-02  Darin Adler  <darin@apple.com>
1338
1339         Modernize some aspects of text codecs, eliminate WebKit use of strcasecmp
1340         https://bugs.webkit.org/show_bug.cgi?id=180009
1341
1342         Reviewed by Alex Christensen.
1343
1344         * wtf/Assertions.cpp: Removed include of StringExtras.h.
1345         (WTFLogChannelByName): Use equalIgnoringASCIICase instead of strcasecmp.
1346         * wtf/DateMath.cpp: Removed include of StringExtras.h.
1347         * wtf/MD5.cpp: Ditto. Also removed include of CString.h.
1348         * wtf/SHA1.cpp: Ditto.
1349
1350         * wtf/StringExtras.h:
1351         (strncasecmp): Deleted.
1352         (strcasecmp): Deleted.
1353
1354         * wtf/StringPrintStream.cpp: Removed include of StringExtras.h.
1355         * wtf/text/Base64.cpp: Ditto.
1356
1357         * wtf/text/LineEnding.cpp:
1358         (WTF::normalizeLineEndingsToLF): Replaced old more general purpose function with
1359         this. Changed argument type to vector and used an rvalue reference and return value.
1360         Also fixed some small logic errors.
1361         (WTF::normalizeLineEndingsToCRLF): Ditto.
1362         (WTF::normalizeLineEndingsToNative): Updated for above changes.
1363         * wtf/text/LineEnding.h: Updated for above changes.
1364
1365         * wtf/text/StringCommon.h:
1366         (WTF::equalIgnoringASCIICase): Added overload for const char*.
1367         (WTF::equalLettersIgnoringASCIICase): Ditto.
1368
1369         * wtf/text/TextStream.cpp: Removed include of StringExtras.h.
1370         * wtf/text/WTFString.cpp: Ditto.
1371         * wtf/unicode/icu/CollatorICU.cpp: Ditto.
1372
1373 2017-12-06  Yusuke Suzuki  <utatane.tea@gmail.com>
1374
1375         [WTF] Remove XXXLockBase since constexpr constructor can initialize static variables without calling global constructors
1376         https://bugs.webkit.org/show_bug.cgi?id=180495
1377
1378         Reviewed by Mark Lam.
1379
1380         Very nice feature of C++11 is that constexpr constructor can initialize static global variables
1381         without calling global constructors. We do not need to have XXXLockBase with derived XXXLock
1382         class since StaticXXXLock can have constructors as long as it is constexpr.
1383         We remove bunch of these classes, and set `XXXLock() = default;` explicitly for readability.
1384         C++11's default constructor is constexpr as long as its member's default constructor / default
1385         initializer is constexpr.
1386
1387         * wtf/Condition.h:
1388         (WTF::ConditionBase::construct): Deleted.
1389         (WTF::ConditionBase::waitUntil): Deleted.
1390         (WTF::ConditionBase::waitFor): Deleted.
1391         (WTF::ConditionBase::wait): Deleted.
1392         (WTF::ConditionBase::notifyOne): Deleted.
1393         (WTF::ConditionBase::notifyAll): Deleted.
1394         (WTF::Condition::Condition): Deleted.
1395         * wtf/CountingLock.h:
1396         (WTF::CountingLock::CountingLock): Deleted.
1397         (WTF::CountingLock::~CountingLock): Deleted.
1398         * wtf/Lock.cpp:
1399         (WTF::Lock::lockSlow):
1400         (WTF::Lock::unlockSlow):
1401         (WTF::Lock::unlockFairlySlow):
1402         (WTF::Lock::safepointSlow):
1403         (WTF::LockBase::lockSlow): Deleted.
1404         (WTF::LockBase::unlockSlow): Deleted.
1405         (WTF::LockBase::unlockFairlySlow): Deleted.
1406         (WTF::LockBase::safepointSlow): Deleted.
1407         * wtf/Lock.h:
1408         (WTF::LockBase::construct): Deleted.
1409         (WTF::LockBase::lock): Deleted.
1410         (WTF::LockBase::tryLock): Deleted.
1411         (WTF::LockBase::try_lock): Deleted.
1412         (WTF::LockBase::unlock): Deleted.
1413         (WTF::LockBase::unlockFairly): Deleted.
1414         (WTF::LockBase::safepoint): Deleted.
1415         (WTF::LockBase::isHeld const): Deleted.
1416         (WTF::LockBase::isLocked const): Deleted.
1417         (WTF::LockBase::isFullyReset const): Deleted.
1418         (WTF::Lock::Lock): Deleted.
1419         * wtf/ReadWriteLock.cpp:
1420         (WTF::ReadWriteLock::readLock):
1421         (WTF::ReadWriteLock::readUnlock):
1422         (WTF::ReadWriteLock::writeLock):
1423         (WTF::ReadWriteLock::writeUnlock):
1424         (WTF::ReadWriteLockBase::construct): Deleted.
1425         (WTF::ReadWriteLockBase::readLock): Deleted.
1426         (WTF::ReadWriteLockBase::readUnlock): Deleted.
1427         (WTF::ReadWriteLockBase::writeLock): Deleted.
1428         (WTF::ReadWriteLockBase::writeUnlock): Deleted.
1429         * wtf/ReadWriteLock.h:
1430         (WTF::ReadWriteLock::read):
1431         (WTF::ReadWriteLock::write):
1432         (WTF::ReadWriteLockBase::ReadLock::tryLock): Deleted.
1433         (WTF::ReadWriteLockBase::ReadLock::lock): Deleted.
1434         (WTF::ReadWriteLockBase::ReadLock::unlock): Deleted.
1435         (WTF::ReadWriteLockBase::WriteLock::tryLock): Deleted.
1436         (WTF::ReadWriteLockBase::WriteLock::lock): Deleted.
1437         (WTF::ReadWriteLockBase::WriteLock::unlock): Deleted.
1438         (WTF::ReadWriteLockBase::read): Deleted.
1439         (WTF::ReadWriteLockBase::write): Deleted.
1440         (WTF::ReadWriteLock::ReadWriteLock): Deleted.
1441         * wtf/RecursiveLockAdapter.h:
1442         (WTF::RecursiveLockAdapter::RecursiveLockAdapter): Deleted.
1443         * wtf/WordLock.cpp:
1444         (WTF::WordLock::lockSlow):
1445         (WTF::WordLock::unlockSlow):
1446         (WTF::WordLockBase::lockSlow): Deleted.
1447         (WTF::WordLockBase::unlockSlow): Deleted.
1448         * wtf/WordLock.h:
1449         (WTF::WordLockBase::lock): Deleted.
1450         (WTF::WordLockBase::unlock): Deleted.
1451         (WTF::WordLockBase::isHeld const): Deleted.
1452         (WTF::WordLockBase::isLocked const): Deleted.
1453         (WTF::WordLockBase::isFullyReset const): Deleted.
1454         (WTF::WordLock::WordLock): Deleted.
1455         * wtf/WorkQueue.cpp:
1456
1457 2017-12-05  Stephan Szabo  <stephan.szabo@sony.com>
1458
1459         Switch windows build to Visual Studio 2017
1460         https://bugs.webkit.org/show_bug.cgi?id=172412
1461
1462         Reviewed by Per Arne Vollan.
1463
1464         * WTF.vcxproj/WTF.proj:
1465         * wtf/Compiler.h:
1466
1467 2017-12-05  Andy Estes  <aestes@apple.com>
1468
1469         [Darwin] Simplify use of TargetConditionals
1470         https://bugs.webkit.org/show_bug.cgi?id=180455
1471         <rdar://problem/35142971>
1472
1473         Reviewed by Tim Horton.
1474
1475         There's no need to check if TARGET_* macros are defined on Darwin platforms, since
1476         TargetConditionals.h always defines them. Also, we can simplify
1477         (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR) to TARGET_OS_IPHONE.
1478
1479         * wtf/Platform.h:
1480
1481 2017-12-05  Matt Lewis  <jlewis3@apple.com>
1482
1483         Unreviewed, rolling out r225430.
1484
1485         This caused an API failure on release.
1486
1487         Reverted changeset:
1488
1489         "Move DateComponents into WTF"
1490         https://bugs.webkit.org/show_bug.cgi?id=180211
1491         https://trac.webkit.org/changeset/225430
1492
1493 2017-12-05  Michael Saboff  <msaboff@apple.com>
1494
1495         Make WebKit build for ARM64_32
1496         https://bugs.webkit.org/show_bug.cgi?id=180447
1497
1498         Reviewed by Mark Lam.
1499
1500         Add the 'w' (32bit) pointer qualifier for ARM64_32 pointers in inline assembly.
1501
1502         * wtf/darwin/WeakLinking.h:
1503         (WTF::isNullFunctionPointer):
1504
1505 2017-12-05  Filip Pizlo  <fpizlo@apple.com>
1506
1507         bmalloc IsoHeap needs to allow a thread to deallocate some size for the first time
1508         https://bugs.webkit.org/show_bug.cgi?id=180443
1509
1510         Reviewed by Saam Barati.
1511         
1512         With this change it's possible to reenable isoheaps on iOS.
1513
1514         * wtf/IsoMalloc.h:
1515         * wtf/IsoMallocInlines.h:
1516
1517 2017-12-05  Yusuke Suzuki  <utatane.tea@gmail.com>
1518
1519         [WTF] Remove m_atomicStringTableDestructor in Thread by querying the condition at thread destruction
1520         https://bugs.webkit.org/show_bug.cgi?id=180429
1521
1522         Reviewed by Alex Christensen.
1523
1524         We now have a pointer to the AtomicStringTable::destroy in Thread.
1525         This pointer becomes nullptr only when the thread is the web thread not to destroy AtomicStringTable
1526         twice in the UI thread and the web thread.
1527
1528         Instead of having a pointer in each Thread, we query whether the current thread is the web thread at
1529         Thread destruction. And use this information to call AtomicStringTable::destroy. Then, we can drop
1530         m_atomicStringTableDestructor field in Thread.
1531
1532         * wtf/Threading.cpp:
1533         (WTF::Thread::didExit):
1534         * wtf/Threading.h:
1535         * wtf/mac/MainThreadMac.mm:
1536         * wtf/text/AtomicStringTable.cpp:
1537         (WTF::AtomicStringTable::create):
1538         (WTF::AtomicStringTable::destroy):
1539         * wtf/text/AtomicStringTable.h:
1540
1541 2017-12-01  Filip Pizlo  <fpizlo@apple.com>
1542
1543         GC constraint solving should be parallel
1544         https://bugs.webkit.org/show_bug.cgi?id=179934
1545
1546         Reviewed by JF Bastien.
1547         
1548         This does some changes to make it easier to do parallel constraint solving:
1549         
1550         - I finally removed dependencyWith. This was a silly construct whose only purpose is to confuse
1551           people about what it means to have a dependency chain. I took that as an opportunity to grealy
1552           simplify the GC's use of dependency chaining.
1553         
1554         - Added more logic to Deque<>, since I use it for part of the load balancer.
1555         
1556         - Made it possible to profile lock contention. See
1557           https://bugs.webkit.org/show_bug.cgi?id=180250#c0 for some preliminary measurements.
1558         
1559         - Introduced holdLockIf, which makes it easy to perform predicated lock acquisition. We use that
1560           to pick a lock in WebCore.
1561         
1562         - Introduced CountingLock. It's like WTF::Lock except it also enables optimistic read transactions
1563           sorta like Java's StampedLock.
1564
1565         * WTF.xcodeproj/project.pbxproj:
1566         * wtf/Atomics.h:
1567         (WTF::dependency):
1568         (WTF::DependencyWith::DependencyWith): Deleted.
1569         (WTF::dependencyWith): Deleted.
1570         * wtf/BitVector.h:
1571         (WTF::BitVector::iterator::operator++):
1572         * wtf/CMakeLists.txt:
1573         * wtf/ConcurrentPtrHashSet.cpp: Added.
1574         (WTF::ConcurrentPtrHashSet::ConcurrentPtrHashSet):
1575         (WTF::ConcurrentPtrHashSet::~ConcurrentPtrHashSet):
1576         (WTF::ConcurrentPtrHashSet::deleteOldTables):
1577         (WTF::ConcurrentPtrHashSet::clear):
1578         (WTF::ConcurrentPtrHashSet::initialize):
1579         (WTF::ConcurrentPtrHashSet::addSlow):
1580         (WTF::ConcurrentPtrHashSet::resizeIfNecessary):
1581         (WTF::ConcurrentPtrHashSet::resizeAndAdd):
1582         (WTF::ConcurrentPtrHashSet::Table::create):
1583         * wtf/ConcurrentPtrHashSet.h: Added.
1584         (WTF::ConcurrentPtrHashSet::contains):
1585         (WTF::ConcurrentPtrHashSet::add):
1586         (WTF::ConcurrentPtrHashSet::size const):
1587         (WTF::ConcurrentPtrHashSet::Table::maxLoad const):
1588         (WTF::ConcurrentPtrHashSet::hash):
1589         (WTF::ConcurrentPtrHashSet::cast):
1590         (WTF::ConcurrentPtrHashSet::containsImpl const):
1591         (WTF::ConcurrentPtrHashSet::addImpl):
1592         * wtf/Deque.h:
1593         (WTF::inlineCapacity>::takeFirst):
1594         * wtf/FastMalloc.h:
1595         * wtf/Lock.cpp:
1596         (WTF::LockBase::lockSlow):
1597         * wtf/Locker.h:
1598         (WTF::holdLockIf):
1599         * wtf/ScopedLambda.h:
1600         * wtf/SharedTask.h:
1601         (WTF::SharedTask<PassedResultType):
1602         (WTF::SharedTask<ResultType): Deleted.
1603         * wtf/StackShot.h: Added.
1604         (WTF::StackShot::StackShot):
1605         (WTF::StackShot::operator=):
1606         (WTF::StackShot::array const):
1607         (WTF::StackShot::size const):
1608         (WTF::StackShot::operator bool const):
1609         (WTF::StackShot::operator== const):
1610         (WTF::StackShot::hash const):
1611         (WTF::StackShot::isHashTableDeletedValue const):
1612         (WTF::StackShot::operator> const):
1613         (WTF::StackShot::deletedValueArray):
1614         (WTF::StackShotHash::hash):
1615         (WTF::StackShotHash::equal):
1616         * wtf/StackShotProfiler.h: Added.
1617         (WTF::StackShotProfiler::StackShotProfiler):
1618         (WTF::StackShotProfiler::profile):
1619         (WTF::StackShotProfiler::run):
1620
1621 2017-12-05  Yusuke Suzuki  <utatane.tea@gmail.com>
1622
1623         [WTF] Use m_suspendCount instead of m_suspended flag in Thread
1624         https://bugs.webkit.org/show_bug.cgi?id=180427
1625
1626         Reviewed by Carlos Garcia Campos.
1627
1628         When resuming the thread, signal handler is reinvoked once before `sigsuspend` is resumed.
1629         But this handler should not do anything since it is just a signal for `sigsuspend`.
1630         Previously, we use m_suspenedd flag to distinguish between suspending and resuming signal
1631         handler invocations.
1632
1633         But this additional m_suspended flag is not necessary since we can use m_suspendCount instead.
1634         This patch drops m_suspended and use m_suspendCount. Since semaphore operations emit full memory
1635         barrier, m_suspendCount is loaded and stored as we expect.
1636
1637         * wtf/Threading.h:
1638         * wtf/ThreadingPthreads.cpp:
1639         (WTF::Thread::signalHandlerSuspendResume):
1640         (WTF::Thread::suspend):
1641         (WTF::Thread::resume):
1642
1643 2017-12-04  Simon Fraser  <simon.fraser@apple.com>
1644
1645         Minor DisplayRefreshMonitor-related cleanup
1646         https://bugs.webkit.org/show_bug.cgi?id=179802
1647
1648         Reviewed by Sam Weinig.
1649
1650         New trace point for when the CVDisplayLink fires on its own thread.
1651
1652         * wtf/SystemTracing.h:
1653
1654 2017-12-04  JF Bastien  <jfbastien@apple.com>
1655
1656         Update std::expected to match libc++ coding style
1657         https://bugs.webkit.org/show_bug.cgi?id=180264
1658
1659         Reviewed by Alex Christensen.
1660
1661         As of https://wg21.link/p0323r4 std::expected is on its way to the
1662         Library Fundamentals v3 TS (LEWG and EWG voted for this, but LWG
1663         hasn't done wording review yet, hence "on its way"). The API is
1664         therefore pretty close to what will be in the TS, and I've gotten
1665         requests for an easily usable implementation of std::expected. I
1666         talked to our clang team and they'll help me migrate our
1667         implementation to libc++, but our implementation has to look more
1668         like libc++ than it does now. Once in libc++ I'll maintain changes
1669         on both sides to make sure neither is out-of-date for too long.
1670
1671         - Fork std::unexpected into its own header.
1672         - Add mild support for an exception-based implementation, but
1673           don't do noexcept yet.
1674         - Rename everything to follow STL style, and keep a global using
1675           or variable alias where possible to reduce WebKit code churn.
1676         - Minor API updates to remove things that aren't in the proposal
1677           anymore.
1678
1679         * wtf/Expected.h:
1680         (std::experimental::fundamentals_v3::bad_expected_access<void>::bad_expected_access):
1681         (std::experimental::fundamentals_v3::bad_expected_access::bad_expected_access):
1682         (std::experimental::fundamentals_v3::bad_expected_access::error):
1683         (std::experimental::fundamentals_v3::bad_expected_access::error const):
1684         (std::experimental::fundamentals_v3::__expected_detail::constexpr_base::constexpr_base):
1685         (std::experimental::fundamentals_v3::__expected_detail::base::base):
1686         (std::experimental::fundamentals_v3::__expected_detail::base::~base):
1687         (std::experimental::fundamentals_v3::expected::expected):
1688         (std::experimental::fundamentals_v3::expected::operator=):
1689         (std::experimental::fundamentals_v3::expected::swap):
1690         (std::experimental::fundamentals_v3::expected::operator-> const):
1691         (std::experimental::fundamentals_v3::expected::operator->):
1692         (std::experimental::fundamentals_v3::expected::operator* const):
1693         (std::experimental::fundamentals_v3::expected::operator*):
1694         (std::experimental::fundamentals_v3::expected::has_value const):
1695         (std::experimental::fundamentals_v3::expected::value const):
1696         (std::experimental::fundamentals_v3::expected::value):
1697         (std::experimental::fundamentals_v3::expected::error const):
1698         (std::experimental::fundamentals_v3::expected::error):
1699         (std::experimental::fundamentals_v3::expected::value_or const):
1700         (std::experimental::fundamentals_v3::expected::value_or):
1701         (std::experimental::fundamentals_v3::operator==):
1702         (std::experimental::fundamentals_v3::operator!=):
1703         (std::experimental::fundamentals_v3::swap):
1704         (WTF::Unexpected::Unexpected): Deleted.
1705         (WTF::Unexpected::value const): Deleted.
1706         (WTF::Unexpected::value): Deleted.
1707         (WTF::operator==): Deleted.
1708         (WTF::operator!=): Deleted.
1709         (WTF::makeUnexpected): Deleted.
1710         (WTF::ExpectedDetail::Throw): Deleted.
1711         (WTF::ExpectedDetail::destroy): Deleted.
1712         (WTF::ExpectedDetail::std::is_trivially_destructible<T>::value): Deleted.
1713         (WTF::ExpectedDetail::ConstexprBase::ConstexprBase): Deleted.
1714         (WTF::ExpectedDetail::Base::Base): Deleted.
1715         (WTF::ExpectedDetail::Base::~Base): Deleted.
1716         (WTF::Expected::Expected): Deleted.
1717         (WTF::Expected::operator=): Deleted.
1718         (WTF::Expected::swap): Deleted.
1719         (WTF::Expected::operator-> const): Deleted.
1720         (WTF::Expected::operator->): Deleted.
1721         (WTF::Expected::operator* const): Deleted.
1722         (WTF::Expected::operator*): Deleted.
1723         (WTF::Expected::operator bool const): Deleted.
1724         (WTF::Expected::hasValue const): Deleted.
1725         (WTF::Expected::value const): Deleted.
1726         (WTF::Expected::value): Deleted.
1727         (WTF::Expected::error const): Deleted.
1728         (WTF::Expected::error): Deleted.
1729         (WTF::Expected::getUnexpected const): Deleted.
1730         (WTF::Expected::valueOr const): Deleted.
1731         (WTF::Expected::valueOr): Deleted.
1732         (WTF::swap): Deleted.
1733         (WTF::makeExpected): Deleted.
1734         (WTF::makeExpectedFromError): Deleted.
1735         * wtf/Forward.h:
1736         * wtf/Optional.h:
1737         * wtf/StdLibExtras.h:
1738         * wtf/Unexpected.h: Added.
1739         (std::experimental::fundamentals_v3::unexpected::unexpected):
1740         (std::experimental::fundamentals_v3::unexpected::value const):
1741         (std::experimental::fundamentals_v3::unexpected::value):
1742         (std::experimental::fundamentals_v3::operator==):
1743         (std::experimental::fundamentals_v3::operator!=):
1744         (makeUnexpected):
1745
1746 2017-12-03  Tomas Popela  <tpopela@redhat.com>
1747
1748         Build fails on x86_64 and arm64 with BMalloc disabled
1749         https://bugs.webkit.org/show_bug.cgi?id=180188
1750
1751         Reviewed by Carlos Garcia Campos.
1752
1753         Add missing methods in WTF's Gigacage.h and fix g_gigacageBasePtr
1754         definition.
1755
1756         * wtf/Gigacage.cpp:
1757         * wtf/Gigacage.h:
1758         (Gigacage::basePtr):
1759         (Gigacage::isEnabled):
1760
1761 2017-12-03  Yusuke Suzuki  <utatane.tea@gmail.com>
1762
1763         WTF shouldn't have both Thread and ThreadIdentifier
1764         https://bugs.webkit.org/show_bug.cgi?id=180308
1765
1766         Reviewed by Darin Adler.
1767
1768         We should use a pointer of WTF::Thread instead of ThreadIdentifier.
1769
1770         One problem is that Windows support library uses WTF::createThread,
1771         which returns ThreadIdentifier. So we cannot drop ThreadIdentifier
1772         in Windows environment. This patch keeps ThreadIdentifier in Windows.
1773
1774         * wtf/MainThread.cpp:
1775         (WTF::initializeMainThread):
1776         (WTF::isMainThread):
1777         (WTF::canAccessThreadLocalDataForThread):
1778         * wtf/MainThread.h:
1779         * wtf/ParkingLot.cpp:
1780         (WTF::ParkingLot::parkConditionallyImpl):
1781         (WTF::ParkingLot::unparkOne):
1782         (WTF::ParkingLot::unparkOneImpl):
1783         (WTF::ParkingLot::unparkCount):
1784         * wtf/RecursiveLockAdapter.h:
1785         (WTF::RecursiveLockAdapter::lock):
1786         (WTF::RecursiveLockAdapter::unlock):
1787         (WTF::RecursiveLockAdapter::tryLock):
1788         * wtf/Threading.cpp:
1789         (WTF::Thread::dump const):
1790         * wtf/Threading.h:
1791         (WTF::Thread::id const):
1792         (WTF::Thread::operator==): Deleted.
1793         (WTF::Thread::operator!=): Deleted.
1794         (WTF::currentThread): Deleted.
1795         * wtf/ThreadingPrimitives.h:
1796         * wtf/ThreadingPthreads.cpp:
1797         (WTF::Thread::waitForCompletion):
1798         (WTF::Thread::detach):
1799         (WTF::Thread::initializeCurrentTLS):
1800         (WTF::Thread::suspend):
1801         (WTF::Thread::establishPlatformSpecificHandle):
1802         (WTF::Thread::currentID): Deleted.
1803         * wtf/ThreadingWin.cpp:
1804         (WTF::Thread::waitForCompletion):
1805         (WTF::Thread::suspend):
1806         (WTF::Thread::currentDying):
1807         * wtf/mac/MainThreadMac.mm:
1808         (WTF::initializeApplicationUIThread):
1809         (WTF::initializeWebThreadPlatform):
1810         (WTF::canAccessThreadLocalDataForThread):
1811         (WTF::initializeApplicationUIThreadIdentifier): Deleted.
1812         (WTF::initializeWebThreadIdentifier): Deleted.
1813
1814 2017-12-03  Darin Adler  <darin@apple.com>
1815
1816         Add WTF::Hasher, an easier to use replacement for WTF::IntegerHasher
1817         https://bugs.webkit.org/show_bug.cgi?id=180318
1818
1819         Reviewed by JF Bastien.
1820
1821         * WTF.xcodeproj/project.pbxproj: Added Hasher.h.
1822         * wtf/CMakeLists.txt: Ditto.
1823
1824         * wtf/Forward.h: Added Hasher and TextStream.
1825
1826         * wtf/Hasher.h: Moved StringHasher into a separate header. Added Hasher.
1827         Marked IntegerHasher deprecated.
1828
1829         * wtf/text/CString.cpp: Include StringHasher.h instead of Hasher.h.
1830         * wtf/text/StringHash.h: Ditto.
1831
1832         * wtf/text/StringHasher.h: Added. Moved StringHasher here from Hasher.h.
1833
1834         * wtf/text/StringImpl.h: Include StringHasher.h instead of Hasher.h.
1835
1836         * wtf/text/WTFString.h: Added a hash function. This was useful in some
1837         adoption I was doing in WebCore, not included in this patch.
1838
1839         * wtf/unicode/UTF8.cpp: Include StringHasher.h instead of Hasher.h.
1840
1841 2017-12-02  Brady Eidson  <beidson@apple.com>
1842
1843         Factor out the "databaseTaskQueue" parts of IDBServer into something reusable.
1844         https://bugs.webkit.org/show_bug.cgi?id=180298
1845
1846         Reviewed by Chris Dumez.
1847
1848         * WTF.xcodeproj/project.pbxproj:
1849         * wtf/CMakeLists.txt:
1850
1851         * wtf/CrossThreadTaskHandler.cpp: Added.
1852         (WTF::CrossThreadTaskHandler::CrossThreadTaskHandler):
1853         (WTF::CrossThreadTaskHandler::~CrossThreadTaskHandler):
1854         (WTF::CrossThreadTaskHandler::postTask):
1855         (WTF::CrossThreadTaskHandler::postTaskReply):
1856         (WTF::CrossThreadTaskHandler::taskRunLoop):
1857         (WTF::CrossThreadTaskHandler::handleTaskRepliesOnMainThread):
1858         * wtf/CrossThreadTaskHandler.h: Added.
1859
1860 2017-12-01  Mark Lam  <mark.lam@apple.com>
1861
1862         Let's scramble ClassInfo pointers in cells.
1863         https://bugs.webkit.org/show_bug.cgi?id=180291
1864         <rdar://problem/35807620>
1865
1866         Reviewed by JF Bastien.
1867
1868         * wtf/ScrambledPtr.h:
1869         (WTF::ScrambledPtr::descrambled const):
1870         (WTF::ScrambledPtr::bits const):
1871         (WTF::ScrambledPtr::operator==):
1872         (WTF::ScrambledPtr::operator=):
1873         (WTF::ScrambledPtr::scramble):
1874         (WTF::ScrambledPtr::descramble):
1875         (WTF::ScrambledPtr:: const): Deleted.
1876         (WTF::ScrambledPtr::scrambledBits const): Deleted.
1877
1878 2017-12-01  Christopher Reid  <chris.reid@sony.com>
1879
1880         Move DateComponents into WTF
1881         https://bugs.webkit.org/show_bug.cgi?id=180211
1882
1883         Reviewed by Myles C. Maxfield.
1884
1885         Moved DateComponents from WebCore/platform into WTF.
1886         Removed isLeapYear from DateComponents as DateMath already has that function.
1887
1888         * WTF.xcodeproj/project.pbxproj:
1889         * wtf/CMakeLists.txt:
1890         * wtf/DateComponents.cpp: Renamed from Source\WebCore\platform\DateComponents.cpp.
1891         * wtf/DateComponents.h: Renamed from Source\WebCore\platform\DateComponents.h.
1892
1893 2017-12-01  Youenn Fablet  <youenn@apple.com>
1894
1895         Implement https://w3c.github.io/ServiceWorker/#clients-get
1896         https://bugs.webkit.org/show_bug.cgi?id=180167
1897
1898         Reviewed by Chris Dumez.
1899
1900         * wtf/text/StringView.h:
1901         (WTF::StringView::toUInt64Strict const):
1902         * wtf/text/WTFString.h:
1903
1904 2017-12-01  Brian Burg  <bburg@apple.com>
1905
1906         Web Inspector: move Inspector::Protocol::Array<T> to JSON namespace
1907         https://bugs.webkit.org/show_bug.cgi?id=173662
1908
1909         Reviewed by Joseph Pecoraro.
1910
1911         Move Inspector::Protocol::Array<T> to JSON::ArrayOf<T>.
1912
1913         * wtf/JSONValues.h:
1914         (WTF::JSONImpl::ArrayOf::ArrayOf):
1915         (WTF::JSONImpl::ArrayOf::openAccessors):
1916         (WTF::JSONImpl::ArrayOf::addItem):
1917         (WTF::JSONImpl::ArrayOf::create):
1918
1919 2017-12-01  Brady Eidson  <beidson@apple.com>
1920
1921         Add Internals.terminateServiceWorker, and the ability to restart service workers for postMessage.
1922         https://bugs.webkit.org/show_bug.cgi?id=180170
1923
1924         Reviewed by Chris Dumez.
1925
1926         * wtf/CompletionHandler.h:
1927         (WTF::CompletionHandler<Out):
1928
1929 2017-11-30  Yusuke Suzuki  <utatane.tea@gmail.com>
1930
1931         [JSC] Remove easy toRemove & map.remove() use in OAS phase
1932         https://bugs.webkit.org/show_bug.cgi?id=180208
1933
1934         Reviewed by Mark Lam.
1935
1936         * wtf/HashMap.h:
1937         (WTF::X>::removeIf):
1938         * wtf/HashSet.h:
1939         (WTF::V>::removeIf):
1940         * wtf/HashTable.h:
1941         (WTF::KeyTraits>::removeIf):
1942
1943 2017-11-30  Commit Queue  <commit-queue@webkit.org>
1944
1945         Unreviewed, rolling out r225362.
1946         https://bugs.webkit.org/show_bug.cgi?id=180225
1947
1948         removeIf predicate function can touch remove target set
1949         (Requested by yusukesuzuki on #webkit).
1950
1951         Reverted changeset:
1952
1953         "[JSC] Remove easy toRemove & map.remove() use"
1954         https://bugs.webkit.org/show_bug.cgi?id=180208
1955         https://trac.webkit.org/changeset/225362
1956
1957 2017-11-30  Mark Lam  <mark.lam@apple.com>
1958
1959         Let's scramble MacroAssemblerCodePtr values.
1960         https://bugs.webkit.org/show_bug.cgi?id=180169
1961         <rdar://problem/35758340>
1962
1963         Reviewed by Filip Pizlo, Saam Barati, and JF Bastien.
1964
1965         Introduce a ScrambledPtr class to facilitate scrambling.
1966
1967         * WTF.xcodeproj/project.pbxproj:
1968         * wtf/CMakeLists.txt:
1969         * wtf/ScrambledPtr.cpp: Added.
1970         (WTF::makeScrambledPtrKey):
1971         * wtf/ScrambledPtr.h: Added.
1972         (WTF::ScrambledPtr::ScrambledPtr):
1973         (WTF::ScrambledPtr::paranoidAssertIsScrambled const):
1974         (WTF::ScrambledPtr::paranoidAssertIsNotScrambled const):
1975         (WTF::ScrambledPtr:: const):
1976         (WTF::ScrambledPtr::operator-> const):
1977         (WTF::ScrambledPtr::scrambledBits const):
1978         (WTF::ScrambledPtr::operator! const):
1979         (WTF::ScrambledPtr::operator bool const):
1980         (WTF::ScrambledPtr::operator== const):
1981         (WTF::ScrambledPtr::operator==):
1982         (WTF::ScrambledPtr::scramble):
1983         (WTF::ScrambledPtr::descramble):
1984
1985 2017-11-30  Yusuke Suzuki  <utatane.tea@gmail.com>
1986
1987         [JSC] Remove easy toRemove & map.remove() use
1988         https://bugs.webkit.org/show_bug.cgi?id=180208
1989
1990         Reviewed by Mark Lam.
1991
1992         Return bool from removeIf. It is true if removeIf removes at least one entry.
1993         This interface is similar to existing HashSet::remove, which returns true
1994         if it actually removes entry.
1995
1996         * wtf/HashMap.h:
1997         (WTF::X>::removeIf):
1998         * wtf/HashSet.h:
1999         (WTF::V>::removeIf):
2000         * wtf/HashTable.h:
2001         (WTF::KeyTraits>::removeIf):
2002
2003 2017-11-30  Chris Dumez  <cdumez@apple.com>
2004
2005         Populate self.registration.installing/waiting/active inside service workers
2006         https://bugs.webkit.org/show_bug.cgi?id=180168
2007
2008         Reviewed by Brady Eidson.
2009
2010         Add CrossThreadCopier support for std::optional<>.
2011
2012         * wtf/CrossThreadCopier.h:
2013
2014 2017-11-29  JF Bastien  <jfbastien@apple.com>
2015
2016         WTF / bmalloc: don't write to 0xbbadbeef when ASAN is looking
2017         https://bugs.webkit.org/show_bug.cgi?id=180175
2018
2019         Reviewed by Mark Lam.
2020
2021         ASAN knows that 0xbbadbeef is a bbad aaddress, and tells us so
2022         when we write to it, say in an assert. That creates bbad error
2023         reports where ASAN thinks we write to an invalid address, instead
2024         of thinking that we hit an assertion. In some cases, tooling that
2025         use fuzzers aggregate similar issues, and think that we just have
2026         the one bug and not a bunch of different asserts.
2027
2028         * wtf/Assertions.cpp:
2029         * wtf/Assertions.h:
2030
2031 2017-11-29  Filip Pizlo  <fpizlo@apple.com>
2032
2033         GC should support isoheaps
2034         https://bugs.webkit.org/show_bug.cgi?id=179288
2035
2036         Reviewed by Saam Barati.
2037         
2038         One of my favorite data structures in the GC is a singly-linked list that knows its tail, so that
2039         things get added to it at the end rather that at the beginning. In this patch, I use this to put
2040         the same node on multiple lists, which our existing linked list templates also don't support.
2041         
2042         This adds a new linked list that does those things:
2043         
2044         - It supports append(). It could also support prepend(), but currently there is no need for it.
2045         
2046         - It supports nodes that are on multiple lists. The GC uses std::mem_fn() to create a lambda that the
2047           list uses to set next.
2048
2049         * WTF.xcodeproj/project.pbxproj:
2050         * wtf/SinglyLinkedListWithTail.h: Added.
2051         (WTF::SinglyLinkedListWithTail::isEmpty const):
2052         (WTF::SinglyLinkedListWithTail::append):
2053         (WTF::SinglyLinkedListWithTail::first const):
2054         (WTF::SinglyLinkedListWithTail::last const):
2055
2056 2017-11-29  Stanislav Ocovaj  <stanislav.ocovaj@rt-rk.com>
2057
2058         [DFG][MIPS] Enable DFG JIT on MIPS.
2059         https://bugs.webkit.org/show_bug.cgi?id=175447
2060
2061         Reviewed by Carlos Alberto Lopez Perez.
2062
2063         * wtf/Platform.h:
2064
2065 2017-11-29  Matt Lewis  <jlewis3@apple.com>
2066
2067         Unreviewed, rolling out r225286.
2068
2069         The source files within this patch have been marked as
2070         executable.
2071
2072         Reverted changeset:
2073
2074         "[MIPS][JSC] Implement MacroAssembler::probe support on MIPS"
2075         https://bugs.webkit.org/show_bug.cgi?id=175447
2076         https://trac.webkit.org/changeset/225286
2077
2078 2017-11-29  Stanislav Ocovaj  <stanislav.ocovaj@rt-rk.com>
2079
2080         [DFG][MIPS] Enable DFG JIT on MIPS.
2081         https://bugs.webkit.org/show_bug.cgi?id=175447
2082
2083         Reviewed by Carlos Alberto Lopez Perez.
2084
2085         * wtf/Platform.h:
2086
2087 2017-11-14  Carlos Garcia Campos  <cgarcia@igalia.com>
2088
2089         Move JSONValues to WTF and convert uses of InspectorValues.h to JSONValues.h
2090         https://bugs.webkit.org/show_bug.cgi?id=173793
2091
2092         Reviewed by Joseph Pecoraro.
2093
2094         Based on patch by Brian Burg.
2095
2096         Move the implementation into WTF. Put the actual implementation inside
2097         namespace WTF::JSONImpl so that the symbols in libwtf start with the WTF prefix.
2098         Also provide a top-level JSON namespace so that clients can write JSON::Value.
2099         This is essentially a typedef for the entire WTF::JSONImpl namespace.
2100
2101         * WTF.xcodeproj/project.pbxproj:
2102         * wtf/CMakeLists.txt:
2103         * wtf/JSONValues.cpp: Renamed from Source/JavaScriptCore/inspector/InspectorValues.cpp.
2104         (JSON::Value::null):
2105         (JSON::Value::create):
2106         (JSON::Value::asValue):
2107         (JSON::Value::asObject):
2108         (JSON::Value::asArray):
2109         (JSON::Value::parseJSON):
2110         (JSON::Value::toJSONString const):
2111         (JSON::Value::asBoolean const):
2112         (JSON::Value::asDouble const):
2113         (JSON::Value::asInteger const):
2114         (JSON::Value::asString const):
2115         (JSON::Value::writeJSON const):
2116         (JSON::Value::memoryCost const):
2117         (JSON::ObjectBase::~ObjectBase):
2118         (JSON::ObjectBase::asObject):
2119         (JSON::ObjectBase::openAccessors):
2120         (JSON::ObjectBase::memoryCost const):
2121         (JSON::ObjectBase::getBoolean const):
2122         (JSON::ObjectBase::getString const):
2123         (JSON::ObjectBase::getObject const):
2124         (JSON::ObjectBase::getArray const):
2125         (JSON::ObjectBase::getValue const):
2126         (JSON::ObjectBase::remove):
2127         (JSON::ObjectBase::writeJSON const):
2128         (JSON::ObjectBase::ObjectBase):
2129         (JSON::ArrayBase::~ArrayBase):
2130         (JSON::ArrayBase::asArray):
2131         (JSON::ArrayBase::writeJSON const):
2132         (JSON::ArrayBase::ArrayBase):
2133         (JSON::ArrayBase::get const):
2134         (JSON::Object::create):
2135         (JSON::Array::create):
2136         (JSON::ArrayBase::memoryCost const):
2137         * wtf/JSONValues.h: Renamed from Source/JavaScriptCore/inspector/InspectorValues.h.
2138         (JSON::ObjectBase::find):
2139         (JSON::ObjectBase::find const):
2140         (JSON::ObjectBase::setBoolean):
2141         (JSON::ObjectBase::setInteger):
2142         (JSON::ObjectBase::setDouble):
2143         (JSON::ObjectBase::setString):
2144         (JSON::ObjectBase::setValue):
2145         (JSON::ObjectBase::setObject):
2146         (JSON::ObjectBase::setArray):
2147         (JSON::ArrayBase::pushBoolean):
2148         (JSON::ArrayBase::pushInteger):
2149         (JSON::ArrayBase::pushDouble):
2150         (JSON::ArrayBase::pushString):
2151         (JSON::ArrayBase::pushValue):
2152         (JSON::ArrayBase::pushObject):
2153         (JSON::ArrayBase::pushArray):
2154
2155 2017-11-28  Simon Fraser  <simon.fraser@apple.com>
2156
2157         Modernize GraphicsLayer dumping
2158         https://bugs.webkit.org/show_bug.cgi?id=180067
2159
2160         Reviewed by Sam Weinig.
2161         
2162         Expose the current indent.
2163
2164         * wtf/text/TextStream.h:
2165         (WTF::TextStream::indent const):
2166
2167 2017-11-27  Chris Dumez  <cdumez@apple.com>
2168
2169         Move callOnMainThreadAndWait() from SocketStreamHandleImplCFNet.cpp to MainThread.h
2170         https://bugs.webkit.org/show_bug.cgi?id=180060
2171
2172         Reviewed by Alex Christensen.
2173
2174         Move callOnMainThreadAndWait() from SocketStreamHandleImplCFNet.cpp to MainThread.h so that it can be reused.
2175
2176         * wtf/MainThread.cpp:
2177         (WTF::callOnMainThreadAndWait):
2178         * wtf/MainThread.h:
2179
2180 2017-11-27  Simon Fraser  <simon.fraser@apple.com>
2181
2182         Use TextStream's indent tracking, rather than passing indent to all the externalRepresentation() functions
2183         https://bugs.webkit.org/show_bug.cgi?id=180027
2184
2185         Reviewed by Jon Lee.
2186
2187         Remove all the indent arguments, and make use of TextStream::IndentScope to control
2188         output indentation.
2189
2190         Add an indent stream manipulator so you can say
2191           ts << indent << "text"
2192         to write the indent.
2193
2194         * wtf/text/TextStream.h:
2195         (WTF::TextStream::IndentScope::IndentScope):
2196         (WTF::TextStream::IndentScope::~IndentScope):
2197
2198 2016-08-05  Darin Adler  <darin@apple.com>
2199
2200         Fix some minor problems in the StringImpl header
2201         https://bugs.webkit.org/show_bug.cgi?id=160630
2202
2203         Reviewed by Brent Fulgham.
2204
2205         * wtf/text/AtomicString.h: Update since CharacterMatchFunctionPtr is now
2206         CodeUnitMatchFunction.
2207
2208         * wtf/text/StringCommon.h: Added CodeUnitMatchFunction, which replaces
2209         CharacterMatchFunctionPtr.
2210
2211         * wtf/text/StringImpl.cpp:
2212         (WTF::StringImpl::stripMatchedCharacters): Changed template argument name
2213         to CodeUnitPredicate to help make it clear this works on code units, not
2214         code points.
2215         (WTF::UCharPredicate): Deleted.
2216         (WTF::SpaceOrNewlinePredicate): Deleted.
2217         (WTF::StringImpl::stripWhiteSpace): Removed unneeded use of predicate class to
2218         turn a function into a functor; functions already work fine as functors without
2219         a class wrapping them.
2220         (WTF::StringImpl::stripLeadingAndTrailingCharacters): Ditto. Also renamed
2221         from stripWhiteSpace, since it strips arbitrary characters.
2222         (WTF::StringImpl::removeCharacters): Fixed various minor style issues and
2223         updated to new type name.
2224         (WTF::StringImpl::simplifyMatchedCharactersToSpace): Ditto.
2225         (WTF::StringImpl::simplifyWhiteSpace): More of the same.
2226         (WTF::StringImpl::find): Ditto.
2227
2228         * wtf/text/StringImpl.h: Removed unneeded include of uchar.h, since it's
2229         included by StringCommon.h. Removed =CharacterMatchFunctionPtr and
2230         IsWhiteSpaceFunctionPtr, both replaced by CodeUnitMatchFunction. Fixed
2231         a mistake recently introduced in isSpaceOrNewline, which was unnecessarily,
2232         inefficiently using ICU for non-ASCII Latin-1 characters.
2233
2234         * wtf/text/StringView.h: Use CodeUnitMatchFunction instead of CharacterMatchFunction.
2235
2236         * wtf/text/WTFString.cpp:
2237         (WTF::String::stripLeadingAndTrailingCharacters): Updated function name and type.
2238         (WTF::String::simplifyWhiteSpace): Updated type.
2239         (WTF::String::removeCharacters): Updated type.
2240         * wtf/text/WTFString.h: Ditto.
2241
2242 2017-11-23  Darin Adler  <darin@apple.com>
2243
2244         Fix dictionary leak in lookup, convert FindOptions to OptionSet, tweak code style nearby
2245         https://bugs.webkit.org/show_bug.cgi?id=179981
2246
2247         Reviewed by Sam Weinig.
2248
2249         * wtf/OptionSet.h: Added some operators so it's easier to use | and - with individual
2250         options from the set.
2251
2252 2017-11-23  Darin Adler  <darin@apple.com>
2253
2254         Reduce WTF::String operations that do unnecessary Unicode operations instead of ASCII
2255         https://bugs.webkit.org/show_bug.cgi?id=179907
2256
2257         Reviewed by Sam Weinig.
2258
2259         * wtf/text/ASCIIFastPath.h: Moved the using for charactersAreAllASCII here since
2260         the function is defined here.
2261
2262         * wtf/text/AtomicString.h: Removed overloads of contains, find, startsWith, and
2263         endsWith that take a boolean indicating whether they should be "case sensitive".
2264         When false, this was doing Unicode case folding, and no callers needed that.
2265         Also tweaked formatting and argument names.
2266
2267         * wtf/text/IntegerToStringConversion.h: Added an include of LChar.h since this file
2268         uses that. Also tweaked formatting a bit.
2269
2270         * wtf/text/StringImpl.cpp:
2271         (WTF::StringImpl::containsOnlyWhitespace): Deleted. Despite its name sounding like
2272         it used the full Unicode whitespace definition, this actually checked isASCIISpace.
2273         Callers now all use isAllSpecialCharacters instead with the whitespace definition
2274         that is appropriate to each call site.
2275         (WTF::latin1CaseFoldTable): Deleted.
2276         (WTF::equalCompatibilityCaseless): Deleted.
2277         (WTF::StringImpl::findIgnoringCase): Deleted.
2278         (WTF::findIgnoringCaseInner): Deleted.
2279         (WTF::reverseFindIgnoringCaseInner): Deleted.
2280         (WTF::StringImpl::reverseFindIgnoringCase): Deleted.
2281         (WTF::equalInner): Removed boolean caseSensitive argument.
2282         (WTF::StringImpl::startsWith): Ditto.
2283         (WTF::StringImpl::endsWith): Ditto.
2284
2285         * wtf/text/StringImpl.h: Moved TextCaseSensitivity out into a different header.
2286         Moved ASCIIFastPath.h include here from WTFString.h. Moved isAllSpecialCharacters
2287         free function here from WTFString.h. Moved lots of function bodies out of class
2288         definitions to make the class definitions easier to read. Sorted things a bit.
2289         Tweaked formatting. Marked constructor that takes one argument explicit. Added
2290         an isEmpty function like the one in String. Renamed copyChars to copyCharacters.
2291         Added isAllASCII, isAllLatin1 and isAllSpecialCharacters functions. Removed
2292         boolean caseSensitive arguments from various functions. Removed findIgnoringCase
2293         and reverseFindIgnoringCase. Added a FIXME to codePointCompare about the way it
2294         treats null and empty strings as equal. Changed length argument in remove to
2295         unsigned to match other lengths.
2296
2297         * wtf/text/WTFString.cpp:
2298         (WTF::String::removeInternal): Changed length argument to be unsigned.
2299         (WTF::createWithFormatAndArguments): Use emptyString.
2300         (WTF::String::isSafeToSendToAnotherThread const): Rewrote to be easier to read.
2301
2302         * wtf/text/WTFString.h: Moved ASCIIFastPath.h to StringImpl.h. Moved lots of
2303         function bodies out of class definitions to make the class definitions easier
2304         to read, made others one-liners. Removed the String::at function but kept the
2305         String::characterAt function; the two were identical. Removed boolean
2306         caseSensitive arguments from various functions. Removed findIgnoringCase and
2307         reverseFindIgnoringCase. Renamed containsOnlyASCII to isAllASCII and
2308         containsOnlyLatin1 to isAllLatin1 to match the naming of isAllSpecialCharacters.
2309         Moved the inline implementations of functions that are defined above further
2310         down, after things like the ASCIILiteral class and various functions.
2311
2312         * wtf/text/icu/UTextProviderLatin1.cpp: Updated name of copyChars.
2313
2314 2017-11-22  Stephan Szabo  <stephan.szabo@sony.com>
2315
2316         tuple related items are used in WTF without including tuple
2317         https://bugs.webkit.org/show_bug.cgi?id=179926
2318
2319         Reviewed by Darin Adler.
2320
2321         * wtf/HashFunctions.h:
2322         * wtf/PrintStream.h:
2323         * wtf/threads/Signals.h:
2324
2325 2017-11-21  Zan Dobersek  <zdobersek@igalia.com>
2326
2327         Drop ENABLE_IMAGE_DECODER_DOWN_SAMPLING code
2328         https://bugs.webkit.org/show_bug.cgi?id=179921
2329
2330         Reviewed by Carlos Garcia Campos.
2331
2332         * wtf/FeatureDefines.h: Remove the ENABLE_IMAGE_DECODER_DOWN_SAMPLING
2333         definition.
2334
2335 2017-11-19  Tim Horton  <timothy_horton@apple.com>
2336
2337         Remove unused TOUCH_ICON_LOADING feature flag
2338         https://bugs.webkit.org/show_bug.cgi?id=179873
2339
2340         Reviewed by Simon Fraser.
2341
2342         * wtf/FeatureDefines.h:
2343
2344 2017-11-19  Yusuke Suzuki  <utatane.tea@gmail.com>
2345
2346         Add CPU(UNKNOWN) to cover all the unknown CPU types
2347         https://bugs.webkit.org/show_bug.cgi?id=179243
2348
2349         Reviewed by JF Bastien.
2350
2351         This patch adds a new CPU type, `CPU(UNKNOWN)` to cover all the unknown CPUs.
2352         This CPU architecture tells conservative assumption to make JSC work on all
2353         the unknown generic CPUs. And we make several CPUs (ALPHA, SH4, S390, S390X, IA64, IA64_32)
2354         UNKNOWN.
2355
2356         We also make InlineASM available only for !CPU(UNKNOWN). In an unknown CPU, inline asm is not useful.
2357
2358         And we also introduce a generic way to detect 64bit pointer environment by using
2359         __SIZEOF_POINTER__ predefined macro, or `UINTPTR_MAX > UINT32_MAX`.
2360
2361         * wtf/InlineASM.h:
2362         * wtf/Platform.h:
2363         * wtf/dtoa/utils.h:
2364
2365 2017-11-19  Tim Horton  <timothy_horton@apple.com>
2366
2367         Remove unused LEGACY_VENDOR_PREFIXES feature flag
2368         https://bugs.webkit.org/show_bug.cgi?id=179872
2369
2370         Reviewed by Darin Adler.
2371
2372         * wtf/FeatureDefines.h:
2373
2374 2017-11-19  Chris Dumez  <cdumez@apple.com>
2375
2376         Fix potential thread safety issue in ThreadSafeIdentified
2377         https://bugs.webkit.org/show_bug.cgi?id=179879
2378
2379         Reviewed by Darin Adler.
2380
2381         Fix potential thread safety issue in ThreadSafeIdentified. Protect static std::atomic
2382         initialization with an std::call_once() given that we build with
2383         --fno-threadsafe-statics.
2384
2385         * wtf/Identified.h:
2386         (WTF::Identified::Identified):
2387         (WTF::Identified::generateIdentifier):
2388         (WTF::ThreadSafeIdentified::ThreadSafeIdentified):
2389         (WTF::ThreadSafeIdentified::generateIdentifier):
2390
2391 2017-11-18  Darin Adler  <darin@apple.com>
2392
2393         Eliminate some cases of double hashing, other related refactoring
2394         https://bugs.webkit.org/show_bug.cgi?id=179867
2395
2396         Reviewed by Sam Weinig.
2397
2398         * wtf/text/StringImpl.cpp:
2399         (WTF::StringImpl::containsOnlyWhitespace): Added FIXME.
2400
2401 2017-11-19  Chris Dumez  <cdumez@apple.com>
2402
2403         Fix potential thread safety issue in generateThreadSafeObjectIdentifier()
2404         https://bugs.webkit.org/show_bug.cgi?id=179877
2405
2406         Reviewed by Sam Weinig.
2407
2408         Fix potential thread safety issue in generateThreadSafeObjectIdentifier().
2409         Protect std::atomic initialization with an std::call_once() given that we
2410         build with --fno-threadsafe-statics.
2411
2412         * wtf/ObjectIdentifier.h:
2413         (WTF::generateThreadSafeObjectIdentifier):
2414
2415 2017-11-18  Yusuke Suzuki  <utatane.tea@gmail.com>
2416
2417         [WTF] Use system endianess information instead of relying CPU information
2418         https://bugs.webkit.org/show_bug.cgi?id=179861
2419
2420         Reviewed by JF Bastien.
2421
2422         Currently, we use known CPU information to determine endianess of the current
2423         architecture. But this means that unknown CPU does not work well in WebKit
2424         withou modifying code. Instead, we use compiler or system's macro to determine
2425         endianess. This paves the way to dropping many CPUs in Platform.h by replacing
2426         them with CPU(UNKNOWN)[1].
2427
2428         [1]: https://bugs.webkit.org/show_bug.cgi?id=179243
2429
2430         * wtf/Platform.h:
2431
2432 2017-11-18  Chris Dumez  <cdumez@apple.com>
2433
2434         ASSERTION FAILED: registration in WebCore::SWServerJobQueue::scriptContextStarted(ServiceWorkerIdentifier)
2435         https://bugs.webkit.org/show_bug.cgi?id=179846
2436
2437         Reviewed by Darin Adler.
2438
2439         Add a generateThreadSafeObjectIdentifier() for generating an ObjectIdentifier
2440         in a thread-safe manner, using std::atomic.
2441
2442         * wtf/ObjectIdentifier.h:
2443         (WTF::generateObjectIdentifier):
2444         (WTF::generateThreadSafeObjectIdentifier):
2445
2446 2017-11-18  Yusuke Suzuki  <utatane.tea@gmail.com>
2447
2448         [WTF] Remove CPU(HPPA) in StackBounds by using runtime stack direction test
2449         https://bugs.webkit.org/show_bug.cgi?id=179859
2450
2451         Reviewed by JF Bastien.
2452
2453         Currently, we know that CPU(HPPA)'s stack direction is upward! But listing
2454         CPU architectures here is not a scalable way.
2455
2456         Instead, we use runtime stack direction test. By doing so, we can handle
2457         such a strange architecture without listing the CPU to Platform.h. This paves
2458         the way to dropping many CPUs in Platform.h by replacing them with CPU(UNKNOWN)[1].
2459
2460         We also fix StackBounds::isGrowingDownward().
2461
2462         [1]: https://bugs.webkit.org/show_bug.cgi?id=179243
2463
2464         * wtf/StackBounds.cpp:
2465         (WTF::StackBounds::stackDirection):
2466         (WTF::testStackDirection2):
2467         (WTF::testStackDirection):
2468         (WTF::StackBounds::newThreadStackBounds):
2469         (WTF::StackBounds::currentThreadStackBoundsInternal):
2470         * wtf/StackBounds.h:
2471         (WTF::StackBounds::isGrowingDownward const):
2472
2473 2017-11-17  Chris Dumez  <cdumez@apple.com>
2474
2475         Use a strongly typed identifier for SWServer::Connection
2476         https://bugs.webkit.org/show_bug.cgi?id=179848
2477
2478         Reviewed by Brady Eidson.
2479
2480         Make ObjectIdentifier a little more flexible to support more use cases.
2481
2482         * wtf/ObjectIdentifier.h:
2483         (WTF::ObjectIdentifier::toUInt64 const):
2484         (WTF::makeObjectIdentifier):
2485
2486 2017-11-17  Simon Fraser  <simon.fraser@apple.com>
2487
2488         Add a TimingScope class for microbenchmarking sections of code
2489         https://bugs.webkit.org/show_bug.cgi?id=179825
2490
2491         Reviewed by Zalan Bujtas.
2492         
2493         Add a class, similar to B3TimingScope, which makes it easy to microbenchmark
2494         sections of code. Use looks like:
2495         
2496         TimingScope scope("some label", 100);
2497         
2498         where this will print mean scope duration every 100 calls. Sample output:
2499         
2500             FETurbulence::platformApplySoftware: 100 calls, mean duration: 3.073181ms
2501             FETurbulence::platformApplySoftware: 200 calls, mean duration: 3.074612ms
2502             FETurbulence::platformApplySoftware: 300 calls, mean duration: 3.065722ms
2503         
2504         Because TimingScope needs to store state beween invocations, and there may be
2505         multiple TimingScopes in use at the same time, data is stored in a global
2506         hash map with atomic access.
2507
2508         * WTF.xcodeproj/project.pbxproj:
2509         * wtf/CMakeLists.txt:
2510         * wtf/TimingScope.cpp: Added.
2511         (WTF::TimingScope::scopeDidEnd):
2512         * wtf/TimingScope.h: Added.
2513         (WTF::TimingScope::TimingScope):
2514         (WTF::TimingScope::~TimingScope):
2515
2516 2017-11-17  Alex Christensen  <achristensen@webkit.org>
2517
2518         Clean up after r224952
2519         https://bugs.webkit.org/show_bug.cgi?id=179809
2520
2521         Reviewed by Brady Eidson.
2522
2523         * wtf/MainThread.cpp:
2524         (WTF::dispatchFunctionsFromMainThread):
2525         (WTF::callOnMainThread):
2526         * wtf/MainThread.h:
2527         * wtf/generic/MainThreadGeneric.cpp:
2528         (WTF::scheduleDispatchFunctionsOnMainThread):
2529         (WTF::currentRunLoopInCommonMode): Deleted.
2530         * wtf/mac/MainThreadMac.mm:
2531         (WTF::scheduleDispatchFunctionsOnMainThread):
2532         (WTF::currentRunLoopInCommonMode): Deleted.
2533         * wtf/win/MainThreadWin.cpp:
2534         (WTF::scheduleDispatchFunctionsOnMainThread):
2535         (WTF::currentRunLoopInCommonMode): Deleted.
2536
2537 2017-11-15  Alex Christensen  <achristensen@webkit.org>
2538
2539         Fix fast/events/message-port-postMessage-recursive.html after r224896
2540         https://bugs.webkit.org/show_bug.cgi?id=179749
2541
2542         Reviewed by Jer Noble.
2543
2544         * wtf/mac/MainThreadMac.mm:
2545         (WTF::currentRunLoopInCommonMode):
2546         We sometimes run the runloop in kCFRunLoopDefaultMode, which should also have the responsiveness optimization.
2547         This allows the runloop to continue to iterate when we are doing lots of things on the main thread.
2548         CFRunLoop.h has a special definition of these two constants.
2549
2550 2017-11-15  Alex Christensen  <achristensen@webkit.org>
2551
2552         WebViews scheduled in custom run loop modes should be able to do more than 50ms of work at a time
2553         https://bugs.webkit.org/show_bug.cgi?id=179742
2554         <rdar://problem/35519421>
2555
2556         Reviewed by Jer Noble.
2557         
2558         In r224687 I fixed loading from scheduled WebViews with custom run loop modes, but in 
2559         dispatchFunctionsFromMainThread we have an optimization to yield the run loop if we have already
2560         done more than 50ms of work on the main thread in this run loop iteration.  When this happens
2561         and we are running in a custom run loop mode, we disable this responsiveness optimization.
2562         We are calling CFRunLoopRunInMode or [NSRunLoop acceptInputForMode:beforeDate:] in a while loop anyways,
2563         so we would not benefit from a responsiveness optimization.  We definitely don't want to reschedule
2564         on the main thread in the common run loop mode in this case.
2565
2566         * wtf/MainThread.cpp:
2567         (WTF::dispatchFunctionsFromMainThread):
2568         * wtf/MainThread.h:
2569         * wtf/generic/MainThreadGeneric.cpp:
2570         (WTF::currentRunLoopInCommonMode):
2571         * wtf/mac/MainThreadMac.mm:
2572         (WTF::currentRunLoopInCommonMode):
2573         * wtf/win/MainThreadWin.cpp:
2574         (WTF::currentRunLoopInCommonMode):
2575
2576 2017-11-15  Ryan Haddad  <ryanhaddad@apple.com>
2577
2578         Unreviewed, rolling out r224863.
2579
2580         Introduced LayoutTest crashes on iOS Simulator.
2581
2582         Reverted changeset:
2583
2584         "Move JSONValues to WTF and convert uses of InspectorValues.h
2585         to JSONValues.h"
2586         https://bugs.webkit.org/show_bug.cgi?id=173793
2587         https://trac.webkit.org/changeset/224863
2588
2589 2017-11-14  Carlos Garcia Campos  <cgarcia@igalia.com>
2590
2591         Move JSONValues to WTF and convert uses of InspectorValues.h to JSONValues.h
2592         https://bugs.webkit.org/show_bug.cgi?id=173793
2593
2594         Reviewed by Brian Burg.
2595
2596         * WTF.xcodeproj/project.pbxproj:
2597         * wtf/CMakeLists.txt:
2598         * wtf/JSONValues.cpp: Renamed from Source/JavaScriptCore/inspector/InspectorValues.cpp.
2599         (JSON::Value::null):
2600         (JSON::Value::create):
2601         (JSON::Value::asValue):
2602         (JSON::Value::asObject):
2603         (JSON::Value::asArray):
2604         (JSON::Value::parseJSON):
2605         (JSON::Value::toJSONString const):
2606         (JSON::Value::asBoolean const):
2607         (JSON::Value::asDouble const):
2608         (JSON::Value::asInteger const):
2609         (JSON::Value::asString const):
2610         (JSON::Value::writeJSON const):
2611         (JSON::Value::memoryCost const):
2612         (JSON::ObjectBase::~ObjectBase):
2613         (JSON::ObjectBase::asObject):
2614         (JSON::ObjectBase::openAccessors):
2615         (JSON::ObjectBase::memoryCost const):
2616         (JSON::ObjectBase::getBoolean const):
2617         (JSON::ObjectBase::getString const):
2618         (JSON::ObjectBase::getObject const):
2619         (JSON::ObjectBase::getArray const):
2620         (JSON::ObjectBase::getValue const):
2621         (JSON::ObjectBase::remove):
2622         (JSON::ObjectBase::writeJSON const):
2623         (JSON::ObjectBase::ObjectBase):
2624         (JSON::ArrayBase::~ArrayBase):
2625         (JSON::ArrayBase::asArray):
2626         (JSON::ArrayBase::writeJSON const):
2627         (JSON::ArrayBase::ArrayBase):
2628         (JSON::ArrayBase::get const):
2629         (JSON::Object::create):
2630         (JSON::Array::create):
2631         (JSON::ArrayBase::memoryCost const):
2632         * wtf/JSONValues.h: Renamed from Source/JavaScriptCore/inspector/InspectorValues.h.
2633         (JSON::ObjectBase::find):
2634         (JSON::ObjectBase::find const):
2635         (JSON::ObjectBase::setBoolean):
2636         (JSON::ObjectBase::setInteger):
2637         (JSON::ObjectBase::setDouble):
2638         (JSON::ObjectBase::setString):
2639         (JSON::ObjectBase::setValue):
2640         (JSON::ObjectBase::setObject):
2641         (JSON::ObjectBase::setArray):
2642         (JSON::ArrayBase::pushBoolean):
2643         (JSON::ArrayBase::pushInteger):
2644         (JSON::ArrayBase::pushDouble):
2645         (JSON::ArrayBase::pushString):
2646         (JSON::ArrayBase::pushValue):
2647         (JSON::ArrayBase::pushObject):
2648         (JSON::ArrayBase::pushArray):
2649
2650 2017-11-14  Alex Christensen  <achristensen@webkit.org>
2651
2652         Remove Cocoa CFURLConnection loading code
2653         https://bugs.webkit.org/show_bug.cgi?id=179688
2654
2655         Reviewed by Antti Koivisto.
2656
2657         * wtf/SchedulePair.h:
2658         * wtf/SchedulePairMac.mm:
2659
2660 2017-11-13  Brady Eidson  <beidson@apple.com>
2661
2662         Massive "Server-process-to-context-process" connection overhaul.
2663         https://bugs.webkit.org/show_bug.cgi?id=179554
2664
2665         Reviewed by Chris Dumez.
2666
2667         * wtf/ObjectIdentifier.h:
2668         (WTF::generateObjectIdentifier):
2669         (WTF::makeObjectIdentifier): Deleted.
2670
2671 2017-11-13  JF Bastien  <jfbastien@apple.com>
2672
2673         std::expected: fix and test move
2674         https://bugs.webkit.org/show_bug.cgi?id=179617
2675
2676         Reviewed by Alex Christensen.
2677
2678         Non-copyable move types should be able to be in an expected
2679         properly.
2680
2681         * wtf/Expected.h:
2682         (WTF::Expected::value const):
2683         (WTF::Expected::error):
2684         (WTF::Expected::error const):
2685
2686 2017-11-10  Jer Noble  <jer.noble@apple.com>
2687
2688         Add a FairPlay Streaming based CDM for Modern EME
2689         https://bugs.webkit.org/show_bug.cgi?id=179499
2690         <rdar://problem/35445033>
2691
2692         Reviewed by Eric Carlson.
2693
2694         * wtf/Platform.h:
2695
2696 2017-11-10  Alex Christensen  <achristensen@webkit.org>
2697
2698         REGRESSION(r224267): WebViews scheduled with custom run loop modes don't load
2699         https://bugs.webkit.org/show_bug.cgi?id=179515
2700         <rdar://problem/35445245>
2701
2702         Reviewed by Andy Estes.
2703
2704         * wtf/MainThread.cpp:
2705         (WTF::callOnMainThread):
2706         * wtf/MainThread.h:
2707         (WTF::callOnMainThread):
2708         (WTF::scheduleDispatchFunctionsOnMainThread):
2709         * wtf/generic/MainThreadGeneric.cpp:
2710         (WTF::scheduleDispatchFunctionsOnMainThread):
2711         * wtf/mac/MainThreadMac.mm:
2712         (WTF::scheduleDispatchFunctionsOnMainThread):
2713         * wtf/win/MainThreadWin.cpp:
2714         (WTF::scheduleDispatchFunctionsOnMainThread):
2715         Add an optional parameter which is an array of run loop mode names to pass to performSelectorOnMainThread.
2716
2717 2017-11-10  Ms2ger  <Ms2ger@igalia.com>
2718
2719         Export tryFastZeroedMalloc.
2720         https://bugs.webkit.org/show_bug.cgi?id=179051
2721
2722         Reviewed by Michael Catanzaro.
2723
2724         The other functions were exported in bug 72855. There does not seem to be a
2725         reason not to export this one.
2726
2727         * wtf/FastMalloc.h:
2728
2729 2017-11-09  Chris Dumez  <cdumez@apple.com>
2730
2731         Unreviewed, rolling out r224661.
2732
2733         Broke build on several internal Mac/iOS bots
2734
2735         Reverted changeset:
2736
2737         "Ignore HSTS for partitioned, cross-origin subresource
2738         requests"
2739         https://bugs.webkit.org/show_bug.cgi?id=178993
2740         https://trac.webkit.org/changeset/224661
2741
2742 2017-11-09  John Wilander  <wilander@apple.com>
2743
2744         Ignore HSTS for partitioned, cross-origin subresource requests
2745         https://bugs.webkit.org/show_bug.cgi?id=178993
2746         <rdar://problem/34962462>
2747
2748         Reviewed by Brent Fulgham.
2749
2750         * wtf/Platform.h:
2751             Added HAVE_CFNETWORK_IGNORE_HSTS.
2752
2753 2017-11-08  Tim Horton  <timothy_horton@apple.com>
2754
2755         [ios-simulator] API test WebKit.BundleParameters is a flaky failure
2756         https://bugs.webkit.org/show_bug.cgi?id=178363
2757         <rdar://problem/35043144>
2758
2759         Reviewed by Brent Fulgham.
2760
2761         * wtf/RefCounter.h:
2762         (WTF::RefCounter<T>::Count::deref):
2763         (WTF::RefCounter<T>::Count::refCounterWasDeleted):
2764         (WTF::RefCounter<T>::~RefCounter):
2765         If a RefCounter::Count is deref()'d and drops its RefCounter's value to
2766         zero, and the RefCounter is deleted in that valueDidChangeCallback, it
2767         will delete the Counter that is in the middle of deref(). Keep track
2768         of whether we're inside the callback and defer the deletion until
2769         the end of deref().
2770
2771 2017-11-07  Maciej Stachowiak  <mjs@apple.com>
2772
2773         Get rid of unsightly hex numbers from unified build object files
2774         https://bugs.webkit.org/show_bug.cgi?id=179410
2775
2776         Reviewed by Saam Barati.
2777
2778         * Scripts/generate-unified-source-bundles.rb: For extensions other than "cpp", also include 
2779         the extension in the base name of the file, to avoid ugly Xcode-generated object file names.
2780
2781 2017-11-07  Filip Pizlo  <fpizlo@apple.com>
2782
2783         Disable isoheaps on iOS
2784
2785         Reviewed by Ryosuke Niwa.
2786
2787         * wtf/IsoMalloc.h:
2788
2789 2017-11-07  Brady Eidson  <beidson@apple.com>
2790
2791         Implement "UpdateWorkerState" and use it
2792         https://bugs.webkit.org/show_bug.cgi?id=179318
2793
2794         Reviewed by Chris Dumez.
2795
2796         * wtf/ObjectIdentifier.h:
2797         (WTF::ObjectIdentifier::loggingString const):
2798
2799 2017-11-07  Michael Saboff  <msaboff@apple.com>
2800
2801         Add SPI function pointers qualifiers for CPU(ARM64E)
2802         https://bugs.webkit.org/show_bug.cgi?id=179383
2803
2804         Reviewed by Mark Lam.
2805
2806         For ARM64E, use the appropriate SPI qualifiers for helper function pointers.
2807
2808         * wtf/BlockPtr.h:
2809         (WTF::BlockPtr<R):
2810
2811 2017-10-31  Filip Pizlo  <fpizlo@apple.com>
2812
2813         bmalloc should support strictly type-segregated isolated heaps
2814         https://bugs.webkit.org/show_bug.cgi?id=178108
2815
2816         Reviewed by Saam Barati, Simon Fraser, and Ryosuke Niwa.
2817         
2818         This just adds an easy way of using the bmalloc IsoHeap API in WebKit. If bmalloc is not
2819         enabled, these macros will just make the object FastMalloced.
2820
2821         * WTF.xcodeproj/project.pbxproj:
2822         * wtf/FastTLS.h:
2823         * wtf/IsoMalloc.h: Added.
2824         * wtf/IsoMallocInlines.h: Added.
2825
2826 2017-11-06  Christopher Reid  <chris.reid@sony.com>
2827
2828         Use enum classes within FileSystem
2829         https://bugs.webkit.org/show_bug.cgi?id=175172
2830
2831         Reviewed by Myles C. Maxfield.
2832
2833         Adding a helper function for converting enum classes to their underlying type when necessary.
2834
2835         * wtf/EnumTraits.h:
2836
2837 2017-11-06  Michael Catanzaro  <mcatanzaro@igalia.com>
2838
2839         [WPE][GTK] Always use SET_AND_EXPOSE_TO_BUILD to set build variables
2840         https://bugs.webkit.org/show_bug.cgi?id=179038
2841
2842         Reviewed by Žan Doberšek.
2843
2844         * wtf/Platform.h:
2845
2846 2017-11-03  Chris Dumez  <cdumez@apple.com>
2847
2848         Use a single identifier type to identify Service Workers
2849         https://bugs.webkit.org/show_bug.cgi?id=179192
2850
2851         Reviewed by Brady Eidson.
2852
2853         Introduce class for strongly typed identifiers. This avoids mixing up
2854         different types of identifiers.
2855
2856         * WTF.xcodeproj/project.pbxproj:
2857         * wtf/ObjectIdentifier.h: Added.
2858         (WTF::ObjectIdentifier::encode const):
2859         (WTF::ObjectIdentifier::decode):
2860         (WTF::ObjectIdentifier::operator== const):
2861         (WTF::ObjectIdentifier::operator!= const):
2862         (WTF::ObjectIdentifier::ObjectIdentifier):
2863         (WTF::makeObjectIdentifier):
2864         (WTF::ObjectIdentifierHash::hash):
2865         (WTF::ObjectIdentifierHash::equal):
2866         (WTF::HashTraits<ObjectIdentifier<T>>::emptyValue):
2867         (WTF::HashTraits<ObjectIdentifier<T>>::constructDeletedValue):
2868         (WTF::HashTraits<ObjectIdentifier<T>>::isDeletedValue):
2869
2870 2017-11-02  Ryan Haddad  <ryanhaddad@apple.com>
2871
2872         Unreviewed, rolling out r224353.
2873
2874         Breaks internal builds.
2875
2876         Reverted changeset:
2877
2878         "Ignore HSTS for partitioned, cross-origin subresource
2879         requests"
2880         https://bugs.webkit.org/show_bug.cgi?id=178993
2881         https://trac.webkit.org/changeset/224353
2882
2883 2017-11-02  John Wilander  <wilander@apple.com>
2884
2885         Ignore HSTS for partitioned, cross-origin subresource requests
2886         https://bugs.webkit.org/show_bug.cgi?id=178993
2887         <rdar://problem/34962462>
2888
2889         Reviewed by Brent Fulgham and Alex Christensen.
2890
2891         * wtf/Platform.h:
2892             Added HAVE_CFNETWORK_IGNORE_HSTS.
2893
2894 2017-11-02  Frederic Wang  <fwang@igalia.com>
2895
2896         Add references to bug 179167 in FIXME comments
2897         https://bugs.webkit.org/show_bug.cgi?id=179168
2898
2899         Reviewed by Daniel Bates.
2900
2901         * wtf/FeatureDefines.h:
2902
2903 2017-11-01  Jiewen Tan  <jiewen_tan@apple.com>
2904
2905         Let is<T>() accept RefPtrs
2906         https://bugs.webkit.org/show_bug.cgi?id=178612
2907         <rdar://problem/35102004>
2908
2909         Reviewed by Ryosuke Niwa.
2910
2911         Add support for is<T>() for RefPtrs.
2912
2913         * wtf/RefPtr.h:
2914         (WTF::is):
2915
2916 2017-11-01  Simon Fraser  <simon.fraser@apple.com>
2917
2918         Misc display list and other cleanup
2919         https://bugs.webkit.org/show_bug.cgi?id=179150
2920
2921         Reviewed by Tim Horton.
2922
2923         Add system trace points for display list recording.
2924
2925         * wtf/SystemTracing.h:
2926
2927 2017-11-01  Fujii Hironori  <Hironori.Fujii@sony.com>
2928
2929         Use LazyNeverDestroyed instead of DEFINE_GLOBAL
2930         https://bugs.webkit.org/show_bug.cgi?id=174979
2931
2932         Reviewed by Yusuke Suzuki.
2933
2934         DEFINE_GLOBAL is not used anymore. Remove it.
2935
2936         * WTF.xcodeproj/project.pbxproj: Removed StaticConstructors.h
2937         * config.h: Removed definitions of SKIP_STATIC_CONSTRUCTORS_ON_MSVC and SKIP_STATIC_CONSTRUCTORS_ON_GCC.
2938         * wtf/CMakeLists.txt: Removed StaticConstructors.h
2939         * wtf/StaticConstructors.h: Removed.
2940
2941 2017-10-30  Michael Catanzaro  <mcatanzaro@igalia.com>
2942
2943         [WPE] Fix build warnings
2944         https://bugs.webkit.org/show_bug.cgi?id=178899
2945
2946         Reviewed by Carlos Alberto Lopez Perez.
2947
2948         * wtf/PlatformWPE.cmake:
2949
2950 2017-10-27  Yousuke Kimoto  <yousuke.kimoto@sony.com>
2951
2952         [WinCairo] Add WTF files for wincairo webkit
2953         https://bugs.webkit.org/show_bug.cgi?id=176894
2954
2955         Reviewed by Alex Christensen.
2956
2957         * wtf/PlatformWin.cmake:
2958         * wtf/WorkQueue.cpp:
2959         * wtf/WorkQueue.h:
2960         * wtf/win/Win32Handle.h:
2961         * wtf/win/WorkItemContext.cpp: Added.
2962         (WTF::WorkItemContext::WorkItemContext):
2963         (WTF::WorkItemContext::create):
2964         (WTF::WorkItemContext::~WorkItemContext):
2965         * wtf/win/WorkItemContext.h: Added.
2966         (WTF::WorkItemContext::handle):
2967         (WTF::WorkItemContext::waitHandle):
2968         (WTF::WorkItemContext::Function<void):
2969         (WTF::WorkItemContext::queue const):
2970         * wtf/win/WorkQueueWin.cpp:
2971         (WTF::WorkQueue::handleCallback):
2972         (WTF::WorkQueue::registerHandle):
2973         (WTF::WorkQueue::unregisterAndCloseHandle):
2974         (WTF::WorkQueue::unregisterWaitAndDestroyItemSoon):
2975         (WTF::WorkQueue::unregisterWaitAndDestroyItemCallback):
2976
2977 2017-10-27  Keith Miller  <keith_miller@apple.com>
2978
2979         Add unified source list files and build scripts to Xcode project navigator
2980         https://bugs.webkit.org/show_bug.cgi?id=178959
2981
2982         Reviewed by Andy Estes.
2983
2984         * WTF.xcodeproj/project.pbxproj:
2985
2986 2017-10-26  Mark Lam  <mark.lam@apple.com>
2987
2988         JSRopeString::RopeBuilder::append() should check for overflows.
2989         https://bugs.webkit.org/show_bug.cgi?id=178385
2990         <rdar://problem/35027468>
2991
2992         Reviewed by Saam Barati.
2993
2994         * wtf/CheckedArithmetic.h:
2995
2996 2017-10-25  Commit Queue  <commit-queue@webkit.org>
2997
2998         Unreviewed, rolling out r222945.
2999         https://bugs.webkit.org/show_bug.cgi?id=178818
3000
3001         "It made WasmBench crash" (Requested by saamyjoon on #webkit).
3002
3003         Reverted changeset:
3004
3005         "bmalloc mutex should be adaptive"
3006         https://bugs.webkit.org/show_bug.cgi?id=177839
3007         https://trac.webkit.org/changeset/222945
3008
3009 2017-10-25  Zan Dobersek  <zdobersek@igalia.com>
3010
3011         Make SERVICE_WORKER feature buildable on GTK, WPE
3012         https://bugs.webkit.org/show_bug.cgi?id=178574
3013
3014         Reviewed by Carlos Garcia Campos.
3015
3016         * wtf/Identified.h: Explicitly include the <atomic> header since
3017         std::atomic<> is used in the ThreadSafeIdentified definition.
3018
3019 2017-10-24  Michael Saboff  <msaboff@apple.com>
3020
3021         WTF: Eliminated PLATFORM checks for HAVE_MACH_EXCEPTIONS
3022         https://bugs.webkit.org/show_bug.cgi?id=178747
3023
3024         Reviewed by Saam Barati.
3025
3026         Removed unnecessary PLATFORM checks as they can cause build failures
3027         when the include file is present.
3028
3029         * wtf/Platform.h:
3030
3031 2017-10-23  Yusuke Suzuki  <utatane.tea@gmail.com>
3032
3033         [JSC] Use fastJoin in Array#toString
3034         https://bugs.webkit.org/show_bug.cgi?id=178062
3035
3036         Reviewed by Darin Adler.
3037
3038         A bit cleaning up to use StringImpl::copyChars instead of
3039         using for-loop directly.
3040
3041         * wtf/text/StringView.h:
3042         (WTF::StringView::getCharactersWithUpconvert const):
3043
3044 2017-10-20  Antoine Quint  <graouts@apple.com>
3045
3046         [Web Animations] Provide basic timeline and animation interfaces
3047         https://bugs.webkit.org/show_bug.cgi?id=178526
3048
3049         Reviewed by Dean Jackson.
3050
3051         Remove the WEB_ANIMATIONS compile-time flag.
3052
3053         * wtf/FeatureDefines.h:
3054
3055 2017-10-19  Keith Miller  <keith_miller@apple.com>
3056
3057         REGRESSION (r223476): WebCore exports symbols with names belonging to other frameworks
3058         https://bugs.webkit.org/show_bug.cgi?id=178424
3059
3060         Reviewed by David Kilzer.
3061
3062         This patch moves the wrapper function sharing the name of the externed function
3063         to the source file and marks it as always inline. Marking it as inline prevents
3064         the framework from exporting it.
3065
3066         * wtf/cocoa/SoftLinking.h:
3067
3068 2017-10-18  Keith Miller  <keith_miller@apple.com>
3069
3070         Setup WebCore build to start using unified sources.
3071         https://bugs.webkit.org/show_bug.cgi?id=178362
3072
3073         Reviewed by Tim Horton.
3074
3075         There are a number of changes to the bundler script. First, it is
3076         now possible to enable or disable building files based on if the
3077         associated feature flag is enabled or not. The syntax for this is
3078         similar to how we do #ifs in C++ code. e.g.
3079
3080         #if ENABLE_APPLE_PAY
3081             myApplePayFile.cpp
3082         #endif
3083
3084         would enable myApplePayFile.cpp if and only if the APPLE_PAY
3085         feature define is set.
3086
3087         I also changed comments from # to // to make it less likely they
3088         would be confused with a #if.
3089
3090         Finally, this patch enables bundling files in the same relative
3091         directory across source list files. Previously, if
3092         SourcesCocoa.txt had platform/cf/foo.cpp and SourcesMac.txt had
3093         platform/cf/bar.cpp those files would not be put in the same
3094         unified source bundle. Now, those files will be put into the same
3095         bundle but bar.cpp will always follow foo.cpp. The idea is that by
3096         putting more specific files after more general files we can avoid
3097         random build failures.
3098
3099         * Scripts/generate-unified-source-bundles.rb:
3100
3101 2017-10-18  Konstantin Tokarev  <annulen@yandex.ru>
3102
3103         REGRESSION(r217771): nullTerminatedWCharToString loses last character of input string
3104         https://bugs.webkit.org/show_bug.cgi?id=178444
3105
3106         Reviewed by Per Arne Vollan.
3107
3108         * wtf/text/win/WCharStringExtras.h:
3109         (WTF::nullTerminatedWCharToString):
3110
3111 2017-10-17  Keith Miller  <keith_miller@apple.com>
3112
3113         Change WebCore sources to work with unified source builds
3114         https://bugs.webkit.org/show_bug.cgi?id=178229
3115
3116         Rubber stamped by Tim Horton.
3117
3118         * wtf/Platform.h:
3119         * wtf/cocoa/SoftLinking.h:
3120
3121 2017-10-16  David Kilzer  <ddkilzer@apple.com>
3122
3123         Add RELEASE_ASSERT_WITH_SECURITY_IMPLICATION() macro
3124         <https://webkit.org/b/178269>
3125
3126         Reviewed by Alex Christensen.
3127
3128         * wtf/Assertions.h:
3129         (RELEASE_ASSERT_WITH_SECURITY_IMPLICATION): Add macro.
3130
3131 2017-10-14  Sam Weinig  <sam@webkit.org>
3132
3133         Remove HashCountedSet's copyToVector functions
3134         https://bugs.webkit.org/show_bug.cgi?id=178215
3135
3136         Reviewed by Daniel Bates.
3137
3138         * wtf/HashCountedSet.h:
3139         (WTF::copyToVector): Deleted.
3140         
3141             They are replaced by either copyToVector(hashCountedSet) or copyToVector(hashCountedSet.values())
3142
3143 2017-10-13  Sam Weinig  <sam@webkit.org>
3144
3145         Adopt type trait template aliases everywhere in WTF
3146         https://bugs.webkit.org/show_bug.cgi?id=178299
3147
3148         Reviewed by Yusuke Suzuki.
3149
3150         Adopt type trait template aliases (e.g. replace 'typename std::make_unsigned<Source>::type'
3151         with 'std::make_unsigned_t<Source>'). Also adopt using over typedef consistently.
3152
3153         * wtf/Atomics.h:
3154         * wtf/CagedUniquePtr.h:
3155         * wtf/CheckedArithmetic.h:
3156         * wtf/CompletionHandler.h:
3157         * wtf/Function.h:
3158         * wtf/HashCountedSet.h:
3159         * wtf/HashFunctions.h:
3160         * wtf/HashMap.h:
3161         * wtf/HashSet.h:
3162         * wtf/HashTable.h:
3163         * wtf/HashTraits.h:
3164         * wtf/IndexedContainerIterator.h:
3165         * wtf/IteratorAdaptors.h:
3166         * wtf/KeyValuePair.h:
3167         * wtf/LEBDecoder.h:
3168         * wtf/ListHashSet.h:
3169         * wtf/MathExtras.h:
3170         * wtf/NeverDestroyed.h:
3171         * wtf/OptionSet.h:
3172         * wtf/RetainPtr.h:
3173         * wtf/SizeLimits.cpp:
3174         * wtf/StdLibExtras.h:
3175         * wtf/SystemFree.h:
3176         * wtf/ThreadSpecific.h:
3177         * wtf/TypeCasts.h:
3178         * wtf/Vector.h:
3179         * wtf/text/IntegerToStringConversion.h:
3180
3181 2017-10-13  Jer Noble  <jer.noble@apple.com>
3182
3183         Performance: Skip texture upload if source image and destination texture haven't changed
3184         https://bugs.webkit.org/show_bug.cgi?id=178254
3185         <rdar://problem/34968181>
3186
3187         Reviewed by Dean Jackson.
3188
3189         Add a new class, UnsafePointer, for safely holding pointers to objects with uncontrolled lifetimes.
3190
3191         * WTF.xcodeproj/project.pbxproj:
3192         * wtf/UnsafePointer.h: Added.
3193         (WTF::UnsafePointer::UnsafePointer):
3194         (WTF::UnsafePointer::operator== const):
3195         (WTF::UnsafePointer::operator!= const):
3196         (WTF::UnsafePointer::operator bool const):
3197         (WTF::operator==):
3198         (WTF::operator!=):
3199
3200 2017-10-13  Per Arne Vollan  <pvollan@apple.com>
3201
3202         [Win] When built with VS2017, MiniBrowser crashes on startup.
3203         https://bugs.webkit.org/show_bug.cgi?id=175209
3204
3205         Reviewed by Daniel Bates.
3206
3207         Add AtomicString(const StaticStringImpl*) constructor. This is needed since
3208         this patch adds constexpr to the static, global StaticStringImpl objects
3209         generated in WebCore/bindings/scripts/StaticString.pm.
3210
3211         * wtf/text/AtomicString.h:
3212         (WTF::AtomicString::AtomicString):
3213         * wtf/text/AtomicStringImpl.cpp:
3214         (WTF::addStatic):
3215         (WTF::AtomicStringImpl::add):
3216         * wtf/text/AtomicStringImpl.h:
3217         * wtf/text/StringImpl.h:
3218         (WTF::StringImpl::assertHashIsCorrect const):
3219         (WTF::StringImpl::assertHashIsCorrect): Deleted.
3220
3221 2017-10-12  Alex Christensen  <achristensen@webkit.org>
3222
3223         Add Expected, HashMap, HashSet, and SHA1 to wtf/Forward.h
3224         https://bugs.webkit.org/show_bug.cgi?id=178243
3225
3226         Reviewed by Tim Horton.
3227
3228         * wtf/Forward.h:
3229         * wtf/HashMap.h:
3230         Move default parameters to Forward.h like we did with Vector.
3231         * wtf/HashSet.h:
3232         Also fix indentation.
3233
3234 2017-10-12  Alex Christensen  <achristensen@webkit.org>
3235
3236         Add CompletionHandler and HashCountedSet to wtf/Forward.h
3237         https://bugs.webkit.org/show_bug.cgi?id=178231
3238
3239         Reviewed by Tim Horton.
3240
3241         * wtf/Forward.h:
3242         * wtf/HashCountedSet.h:
3243
3244 2017-10-11  Sam Weinig  <sam@webkit.org>
3245
3246         Remove out-parameter variants of copyToVector
3247         https://bugs.webkit.org/show_bug.cgi?id=178155
3248
3249         Reviewed by Tim Horton.
3250
3251         * wtf/HashMap.h:
3252         (WTF::copyToVector): Deleted.
3253         * wtf/HashSet.h:
3254         (WTF::copyToVector): Deleted.
3255         
3256             Remove copyToVector.
3257         
3258         * wtf/Vector.h:
3259         (WTF::copyToVectorSpecialization):
3260         
3261             Add another version of copyToVector, called copyToVectorSpecialization, that allows
3262             you to specify the entire specialization for the Vector you want to copy to. This
3263             can be useful if you want your resulting Vector to have an inline capacity. 
3264
3265 2017-10-12  Sam Weinig  <sam@webkit.org>
3266
3267         It should be possible to iterate just the values (and not the counts) of a HashCountedSet
3268         https://bugs.webkit.org/show_bug.cgi?id=178169
3269
3270         Reviewed by Daniel Bates.
3271
3272         Cleanup (fix indentation, simplify type names, adopt using), and add a values() range to
3273         HashCountedSet. This will allow getting a Vector of all the values (and not the counts)
3274         using the new copyToVector. 
3275
3276         * wtf/HashCountedSet.h:
3277
3278 2017-10-11  Michael Saboff  <msaboff@apple.com>
3279
3280         [JSC] Add ability to build with ARMV8 ILP32 ABI
3281         https://bugs.webkit.org/show_bug.cgi?id=178194
3282
3283         Reviewed by Saam Barati.
3284
3285         For ARMV8 32 bit ABI, use JSVALUE32_64 and the CLOOP.
3286
3287         * wtf/Platform.h:
3288
3289 2017-10-11  Youenn Fablet  <youenn@apple.com>
3290
3291         Add API to clean CacheStorage data
3292         https://bugs.webkit.org/show_bug.cgi?id=178034
3293
3294         Reviewed by Chris Dumez.
3295
3296         Moving CallbackAggregator pattern into its own class for easier reuse.
3297
3298         * WTF.xcodeproj/project.pbxproj:
3299         * wtf/CallbackAggregator.h: Added.
3300         (WTF::CallbackAggregator::create):
3301         (WTF::CallbackAggregator::~CallbackAggregator):
3302         (WTF::CallbackAggregator::CallbackAggregator):
3303
3304 2017-10-10  Sam Weinig  <sam@webkit.org>
3305
3306         Replace copyKeysToVector/copyValuesToVector with copyToVector(map.keys())/copyToVector(map.values())
3307         https://bugs.webkit.org/show_bug.cgi?id=178102
3308
3309         Reviewed by Tim Horton.
3310
3311         * wtf/HashMap.h:
3312         (WTF::copyKeysToVector): Deleted.
3313         (WTF::copyValuesToVector): Deleted.
3314         
3315             Remove copyKeysToVector and copyValuesToVector which are no longer used.
3316
3317 2017-10-09  Youenn Fablet  <youenn@apple.com>
3318
3319         Vector should be able to easily create from a list of movable only items
3320         https://bugs.webkit.org/show_bug.cgi?id=176432
3321
3322         Reviewed by Darin Adler.
3323
3324         Adding static from method to construct a Vector from movable-only items.
3325         This may also be used instead of initializer list constructor for types that would benefit of being moved.
3326
3327         * wtf/Vector.h:
3328         (WTF::Vector::Vector):
3329         (WTF::Vector::from):
3330         (WTF::Vector::uncheckedInitialize): Introduced as an optimization to set the vector size once.
3331         (WTF::Malloc>::reserveInitialCapacity):
3332
3333 2017-10-09  Tim Horton  <timothy_horton@apple.com>
3334
3335         Disable INPUT_TYPE_COLOR in FeatureDefines.h
3336         https://bugs.webkit.org/show_bug.cgi?id=178103
3337         <rdar://problem/34872127>
3338
3339         Reviewed by Simon Fraser.
3340
3341         * wtf/FeatureDefines.h:
3342         Because FeatureDefines.h overrides features that are not enabled in
3343         FeatureDefines.xcconfig, you currently have to turn INPUT_TYPE_COLOR
3344         off in two places. Since we only ever want it on for Mac, it's OK
3345         to depend on the xcconfig defining it.
3346
3347 2017-10-09  Sam Weinig  <sam@webkit.org>
3348
3349         Make HashMap::keys() and HashMap::values() work with WTF::map/WTF::copyToVector
3350         https://bugs.webkit.org/show_bug.cgi?id=178072
3351
3352         Reviewed by Darin Adler.
3353
3354         Introduce SizedIteratorRange, a variant of IteratorRange that includes
3355         a reference to a backing container in order to get the size of container.
3356         This is useful for algorithms like WTF::map and WTF::copyToVector, that
3357         can use the size to efficiently allocate things of the correct size.
3358
3359         The main beneficiary are HashMap's keys() and values() functions which
3360         used to return IteratorRanges and now return SizedIteratorRange. This
3361         allows us to remove (in a future change) copyKeysToVector() and
3362         copyValuesToVector() by replacing them with copyToVector(map.keys()) and
3363         copyToVector(map.values()) respectively.
3364
3365         * wtf/HashMap.h:
3366         * wtf/IteratorRange.h:
3367         (WTF::SizedIteratorRange::SizedIteratorRange):
3368         (WTF::SizedIteratorRange::size const):
3369         (WTF::SizedIteratorRange::begin const):
3370         (WTF::SizedIteratorRange::end const):
3371         (WTF::makeSizedIteratorRange):
3372
3373 2017-10-08  Sam Weinig  <sam@webkit.org>
3374
3375         It should be possible to create a ListHashSet with a std::initializer_list.
3376         https://bugs.webkit.org/show_bug.cgi?id=178070
3377
3378         Reviewed by Darin Adler.
3379
3380         * wtf/ListHashSet.h:
3381         (WTF::U>::ListHashSet):
3382         Add a constructor that takes a std::initializer_list.
3383
3384 2017-10-08  Sam Weinig  <sam@webkit.org>
3385
3386         Address additional feedback from Darin for r223039 and sort the using declarations.
3387
3388         * wtf/Vector.h:
3389
3390 2017-10-08  Sam Weinig  <sam@webkit.org>
3391
3392         There should be a version of copyToVector that returns a Vector, rather than using an out parameter
3393         https://bugs.webkit.org/show_bug.cgi?id=177732
3394
3395         Reviewed by Saam Barati.
3396
3397         Add two new helper functions, copyToVector and copyToVectorOf, which will be able to
3398         replace the existing out parameter taking copyToVector. Like it's ancestral namesake,
3399         copyToVector takes an object that is both iterable (supports begin() and end()) and
3400         has a size, and returns a Vector with a copy of all the items iterated. The copyToVectorOf
3401         variant allow the user to specify a type to convert to, so if you have a HashSet<int>
3402         but want those as floats in a Vector, you can do:
3403         
3404             auto floatVector = copyToVectorOf<float>(intSet);
3405
3406         * wtf/Vector.h:
3407         (WTF::copyToVector):
3408         (WTF::copyToVectorOf):
3409
3410 2017-10-08  Darin Adler  <darin@apple.com>
3411
3412         Fix bugs related to setting reflected floating point DOM attributes
3413         https://bugs.webkit.org/show_bug.cgi?id=178061
3414
3415         Reviewed by Sam Weinig.
3416
3417         * wtf/dtoa.cpp:
3418         (WTF::formatStringTruncatingTrailingZerosIfNeeded): Fix a bug where
3419         this function would remove trailing zeroes from the exponent if
3420         present instead of from the mantissa. This meant that it would
3421         format 1e10 as "1.00000e+1" instead of "1e+10". Added regression
3422         tests for this to TestWebKitAPI.
3423
3424         * wtf/dtoa/utils.h:
3425         (WTF::double_conversion::StringBuilder::RemoveCharacters): Added.
3426         Used by the fix above.
3427
3428         * wtf/text/AtomicString.cpp:
3429         (WTF::AtomicString::number): Note: This function is used by code
3430         that sets the values of reflected floating point DOM attributes.
3431         Changed the function to use the rules from numberToString rather
3432         ones from numberToFixedPrecisionString. This is analogous to
3433         String::numberToStringECMAScript, and in the future we should change
3434         String and StringBuilder so this "ECMAScript" semantic is the default
3435         way to convert a floating point number to a string, and rename the fixed
3436         precision version that is currently called String::number. I audited
3437         the small number of sites calling AtomicString::number, by temporarily
3438         renaming it, and discovered that this is the correct behavior for all;
3439         none needed fixed precision. Also, fixed a mistake where this explicitly
3440         converted to String. That was defeating the purpose of having these
3441         functions in AtomicString: It would allocate a new String and then
3442         destroy it in the case where an equal string was already in the
3443         AtomicString table.
3444
3445 2017-10-06  Commit Queue  <commit-queue@webkit.org>
3446
3447         Unreviewed, rolling out r222791 and r222873.
3448         https://bugs.webkit.org/show_bug.cgi?id=178031
3449
3450         Caused crashes with workers/wasm LayoutTests (Requested by
3451         ryanhaddad on #webkit).
3452
3453         Reverted changesets:
3454
3455         "WebAssembly: no VM / JS version of everything but Instance"
3456         https://bugs.webkit.org/show_bug.cgi?id=177473
3457         http://trac.webkit.org/changeset/222791
3458
3459         "WebAssembly: address no VM / JS follow-ups"
3460         https://bugs.webkit.org/show_bug.cgi?id=177887
3461         http://trac.webkit.org/changeset/222873
3462
3463 2017-10-06  Antti Koivisto  <antti@apple.com>
3464
3465         Minor WeakPtr improvements
3466         https://bugs.webkit.org/show_bug.cgi?id=177958
3467
3468         Reviewed by Sam Weinig.
3469
3470         * wtf/WeakPtr.h:
3471         (WTF::WeakPtr::operator bool const):
3472
3473             Make explicit.
3474
3475         (WTF::WeakPtrFactory::createWeakPtr const):
3476         (WTF::makeWeakPtr):
3477
3478             Remove templating from createWeakPtr, makeWeakPtr() is now the
3479             canonical way to make derived-type WeakPtrs.
3480
3481 2017-10-04  Filip Pizlo  <fpizlo@apple.com>
3482
3483         bmalloc mutex should be adaptive
3484         https://bugs.webkit.org/show_bug.cgi?id=177839
3485
3486         Reviewed by Michael Saboff.
3487         
3488         Add some comments that I thought of while copy-pasting this code.
3489
3490         Reland after fixing ancient WordLock bug: the notify_one has to happen with the lock held
3491         to ensure it doesn't run after that thread has died.
3492
3493         * wtf/LockAlgorithmInlines.h:
3494         * wtf/WordLock.cpp:
3495
3496 2017-10-05  Carlos Alberto Lopez Perez  <clopez@igalia.com>
3497
3498         Generate a compile error if release is built without compiler optimizations
3499         https://bugs.webkit.org/show_bug.cgi?id=177665
3500
3501         Reviewed by Brian Burg.
3502
3503         For GCC and Clang, generate an error at build time that will alert
3504         the developer that she is trying to build Release without any compiler
3505         optimization. A build time error is much better than an unexpected
3506         "oh, WebKit is really slow ..."  situation later.
3507
3508         If this was intended, then we tell the developer that she can continue
3509         by just setting -DRELEASE_WITHOUT_OPTIMIZATIONS in the list of build
3510         flags.
3511
3512         The intention of this patch is to ensure that nobody builds Release
3513         without enabling compiler optimization by mistake.
3514
3515         * wtf/Compiler.h:
3516
3517 2017-10-05  David Kilzer  <ddkilzer@apple.com>
3518
3519         Bug 177893: Disable -Wcast-qual for new clang compiler in Apple ports
3520         <https://webkit.org/b/177893>
3521         <rdar://problem/33667497>
3522
3523         Reviewed by Tim Horton.
3524
3525         * wtf/RetainPtr.h:
3526         (WTF::RetainPtr::fromStorageType const): Disable warnings for
3527         -Wcast-qual until we can provide a safe cast function that lets
3528         us re-enable the warning.
3529
3530 2017-10-05  Matt Lewis  <jlewis3@apple.com>
3531
3532         Unreviewed, rolling out r222893.
3533
3534         This caused multiple API failures.
3535
3536         Reverted changeset:
3537
3538         "bmalloc mutex should be adaptive"
3539         https://bugs.webkit.org/show_bug.cgi?id=177839
3540         http://trac.webkit.org/changeset/222893
3541
3542 2017-10-04  Filip Pizlo  <fpizlo@apple.com>
3543
3544         bmalloc mutex should be adaptive
3545         https://bugs.webkit.org/show_bug.cgi?id=177839
3546
3547         Reviewed by Michael Saboff.
3548         
3549         Add some comments that I thought of while copy-pasting this code.
3550
3551         * wtf/LockAlgorithmInlines.h:
3552         * wtf/WordLock.cpp:
3553
3554 2017-10-04  JF Bastien  <jfbastien@apple.com>
3555
3556         WTF: Update std::expected to match current proposal
3557         https://bugs.webkit.org/show_bug.cgi?id=177881
3558
3559         Reviewed by Mark Lam.
3560
3561         The proposal is likely to be in C++20 and I've been asked to help co-champion
3562         it. I'm therefore updating our implementation to more closely match the current
3563         proposal, and to make sure it'll work for us if standardized.
3564
3565          - Rename UnexpectedType to Unexpected to match the proposal.
3566          - Remove relational operators, only equality / inequality remains.
3567          - Fix minor type signatures.
3568          - Add UnexpectedType typedef.
3569          - Uncomment rebind implementation.
3570          - Add in-place construction tag, as well as explicit error construction tag.
3571          - Add template unexpected constructor.
3572          - Note that make_unexpected isn't in the proposal anymore, but we keep it because we don't have C++17 deduction guides.
3573          - Remove hashing, which isn't in the proposal anymore.
3574
3575         * wtf/Expected.h:
3576         (WTF::Unexpected::Unexpected):
3577         (WTF::Unexpected::value const):
3578         (WTF::operator==):
3579         (WTF::operator!=):
3580         (WTF::makeUnexpected):
3581         (WTF::Expected::Expected):
3582         (WTF::Expected::operator=):
3583         (WTF::Expected::getUnexpected const):