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