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