Source/WebCore:
[WebKit-https.git] / Source / WTF / ChangeLog
1 2017-11-10  Ms2ger  <Ms2ger@igalia.com>
2
3         Export tryFastZeroedMalloc.
4         https://bugs.webkit.org/show_bug.cgi?id=179051
5
6         Reviewed by Michael Catanzaro.
7
8         The other functions were exported in bug 72855. There does not seem to be a
9         reason not to export this one.
10
11         * wtf/FastMalloc.h:
12
13 2017-11-09  Chris Dumez  <cdumez@apple.com>
14
15         Unreviewed, rolling out r224661.
16
17         Broke build on several internal Mac/iOS bots
18
19         Reverted changeset:
20
21         "Ignore HSTS for partitioned, cross-origin subresource
22         requests"
23         https://bugs.webkit.org/show_bug.cgi?id=178993
24         https://trac.webkit.org/changeset/224661
25
26 2017-11-09  John Wilander  <wilander@apple.com>
27
28         Ignore HSTS for partitioned, cross-origin subresource requests
29         https://bugs.webkit.org/show_bug.cgi?id=178993
30         <rdar://problem/34962462>
31
32         Reviewed by Brent Fulgham.
33
34         * wtf/Platform.h:
35             Added HAVE_CFNETWORK_IGNORE_HSTS.
36
37 2017-11-08  Tim Horton  <timothy_horton@apple.com>
38
39         [ios-simulator] API test WebKit.BundleParameters is a flaky failure
40         https://bugs.webkit.org/show_bug.cgi?id=178363
41         <rdar://problem/35043144>
42
43         Reviewed by Brent Fulgham.
44
45         * wtf/RefCounter.h:
46         (WTF::RefCounter<T>::Count::deref):
47         (WTF::RefCounter<T>::Count::refCounterWasDeleted):
48         (WTF::RefCounter<T>::~RefCounter):
49         If a RefCounter::Count is deref()'d and drops its RefCounter's value to
50         zero, and the RefCounter is deleted in that valueDidChangeCallback, it
51         will delete the Counter that is in the middle of deref(). Keep track
52         of whether we're inside the callback and defer the deletion until
53         the end of deref().
54
55 2017-11-07  Maciej Stachowiak  <mjs@apple.com>
56
57         Get rid of unsightly hex numbers from unified build object files
58         https://bugs.webkit.org/show_bug.cgi?id=179410
59
60         Reviewed by Saam Barati.
61
62         * Scripts/generate-unified-source-bundles.rb: For extensions other than "cpp", also include 
63         the extension in the base name of the file, to avoid ugly Xcode-generated object file names.
64
65 2017-11-07  Filip Pizlo  <fpizlo@apple.com>
66
67         Disable isoheaps on iOS
68
69         Reviewed by Ryosuke Niwa.
70
71         * wtf/IsoMalloc.h:
72
73 2017-11-07  Brady Eidson  <beidson@apple.com>
74
75         Implement "UpdateWorkerState" and use it
76         https://bugs.webkit.org/show_bug.cgi?id=179318
77
78         Reviewed by Chris Dumez.
79
80         * wtf/ObjectIdentifier.h:
81         (WTF::ObjectIdentifier::loggingString const):
82
83 2017-11-07  Michael Saboff  <msaboff@apple.com>
84
85         Add SPI function pointers qualifiers for CPU(ARM64E)
86         https://bugs.webkit.org/show_bug.cgi?id=179383
87
88         Reviewed by Mark Lam.
89
90         For ARM64E, use the appropriate SPI qualifiers for helper function pointers.
91
92         * wtf/BlockPtr.h:
93         (WTF::BlockPtr<R):
94
95 2017-10-31  Filip Pizlo  <fpizlo@apple.com>
96
97         bmalloc should support strictly type-segregated isolated heaps
98         https://bugs.webkit.org/show_bug.cgi?id=178108
99
100         Reviewed by Saam Barati, Simon Fraser, and Ryosuke Niwa.
101         
102         This just adds an easy way of using the bmalloc IsoHeap API in WebKit. If bmalloc is not
103         enabled, these macros will just make the object FastMalloced.
104
105         * WTF.xcodeproj/project.pbxproj:
106         * wtf/FastTLS.h:
107         * wtf/IsoMalloc.h: Added.
108         * wtf/IsoMallocInlines.h: Added.
109
110 2017-11-06  Christopher Reid  <chris.reid@sony.com>
111
112         Use enum classes within FileSystem
113         https://bugs.webkit.org/show_bug.cgi?id=175172
114
115         Reviewed by Myles C. Maxfield.
116
117         Adding a helper function for converting enum classes to their underlying type when necessary.
118
119         * wtf/EnumTraits.h:
120
121 2017-11-06  Michael Catanzaro  <mcatanzaro@igalia.com>
122
123         [WPE][GTK] Always use SET_AND_EXPOSE_TO_BUILD to set build variables
124         https://bugs.webkit.org/show_bug.cgi?id=179038
125
126         Reviewed by Žan Doberšek.
127
128         * wtf/Platform.h:
129
130 2017-11-03  Chris Dumez  <cdumez@apple.com>
131
132         Use a single identifier type to identify Service Workers
133         https://bugs.webkit.org/show_bug.cgi?id=179192
134
135         Reviewed by Brady Eidson.
136
137         Introduce class for strongly typed identifiers. This avoids mixing up
138         different types of identifiers.
139
140         * WTF.xcodeproj/project.pbxproj:
141         * wtf/ObjectIdentifier.h: Added.
142         (WTF::ObjectIdentifier::encode const):
143         (WTF::ObjectIdentifier::decode):
144         (WTF::ObjectIdentifier::operator== const):
145         (WTF::ObjectIdentifier::operator!= const):
146         (WTF::ObjectIdentifier::ObjectIdentifier):
147         (WTF::makeObjectIdentifier):
148         (WTF::ObjectIdentifierHash::hash):
149         (WTF::ObjectIdentifierHash::equal):
150         (WTF::HashTraits<ObjectIdentifier<T>>::emptyValue):
151         (WTF::HashTraits<ObjectIdentifier<T>>::constructDeletedValue):
152         (WTF::HashTraits<ObjectIdentifier<T>>::isDeletedValue):
153
154 2017-11-02  Ryan Haddad  <ryanhaddad@apple.com>
155
156         Unreviewed, rolling out r224353.
157
158         Breaks internal builds.
159
160         Reverted changeset:
161
162         "Ignore HSTS for partitioned, cross-origin subresource
163         requests"
164         https://bugs.webkit.org/show_bug.cgi?id=178993
165         https://trac.webkit.org/changeset/224353
166
167 2017-11-02  John Wilander  <wilander@apple.com>
168
169         Ignore HSTS for partitioned, cross-origin subresource requests
170         https://bugs.webkit.org/show_bug.cgi?id=178993
171         <rdar://problem/34962462>
172
173         Reviewed by Brent Fulgham and Alex Christensen.
174
175         * wtf/Platform.h:
176             Added HAVE_CFNETWORK_IGNORE_HSTS.
177
178 2017-11-02  Frederic Wang  <fwang@igalia.com>
179
180         Add references to bug 179167 in FIXME comments
181         https://bugs.webkit.org/show_bug.cgi?id=179168
182
183         Reviewed by Daniel Bates.
184
185         * wtf/FeatureDefines.h:
186
187 2017-11-01  Jiewen Tan  <jiewen_tan@apple.com>
188
189         Let is<T>() accept RefPtrs
190         https://bugs.webkit.org/show_bug.cgi?id=178612
191         <rdar://problem/35102004>
192
193         Reviewed by Ryosuke Niwa.
194
195         Add support for is<T>() for RefPtrs.
196
197         * wtf/RefPtr.h:
198         (WTF::is):
199
200 2017-11-01  Simon Fraser  <simon.fraser@apple.com>
201
202         Misc display list and other cleanup
203         https://bugs.webkit.org/show_bug.cgi?id=179150
204
205         Reviewed by Tim Horton.
206
207         Add system trace points for display list recording.
208
209         * wtf/SystemTracing.h:
210
211 2017-11-01  Fujii Hironori  <Hironori.Fujii@sony.com>
212
213         Use LazyNeverDestroyed instead of DEFINE_GLOBAL
214         https://bugs.webkit.org/show_bug.cgi?id=174979
215
216         Reviewed by Yusuke Suzuki.
217
218         DEFINE_GLOBAL is not used anymore. Remove it.
219
220         * WTF.xcodeproj/project.pbxproj: Removed StaticConstructors.h
221         * config.h: Removed definitions of SKIP_STATIC_CONSTRUCTORS_ON_MSVC and SKIP_STATIC_CONSTRUCTORS_ON_GCC.
222         * wtf/CMakeLists.txt: Removed StaticConstructors.h
223         * wtf/StaticConstructors.h: Removed.
224
225 2017-10-30  Michael Catanzaro  <mcatanzaro@igalia.com>
226
227         [WPE] Fix build warnings
228         https://bugs.webkit.org/show_bug.cgi?id=178899
229
230         Reviewed by Carlos Alberto Lopez Perez.
231
232         * wtf/PlatformWPE.cmake:
233
234 2017-10-27  Yousuke Kimoto  <yousuke.kimoto@sony.com>
235
236         [WinCairo] Add WTF files for wincairo webkit
237         https://bugs.webkit.org/show_bug.cgi?id=176894
238
239         Reviewed by Alex Christensen.
240
241         * wtf/PlatformWin.cmake:
242         * wtf/WorkQueue.cpp:
243         * wtf/WorkQueue.h:
244         * wtf/win/Win32Handle.h:
245         * wtf/win/WorkItemContext.cpp: Added.
246         (WTF::WorkItemContext::WorkItemContext):
247         (WTF::WorkItemContext::create):
248         (WTF::WorkItemContext::~WorkItemContext):
249         * wtf/win/WorkItemContext.h: Added.
250         (WTF::WorkItemContext::handle):
251         (WTF::WorkItemContext::waitHandle):
252         (WTF::WorkItemContext::Function<void):
253         (WTF::WorkItemContext::queue const):
254         * wtf/win/WorkQueueWin.cpp:
255         (WTF::WorkQueue::handleCallback):
256         (WTF::WorkQueue::registerHandle):
257         (WTF::WorkQueue::unregisterAndCloseHandle):
258         (WTF::WorkQueue::unregisterWaitAndDestroyItemSoon):
259         (WTF::WorkQueue::unregisterWaitAndDestroyItemCallback):
260
261 2017-10-27  Keith Miller  <keith_miller@apple.com>
262
263         Add unified source list files and build scripts to Xcode project navigator
264         https://bugs.webkit.org/show_bug.cgi?id=178959
265
266         Reviewed by Andy Estes.
267
268         * WTF.xcodeproj/project.pbxproj:
269
270 2017-10-26  Mark Lam  <mark.lam@apple.com>
271
272         JSRopeString::RopeBuilder::append() should check for overflows.
273         https://bugs.webkit.org/show_bug.cgi?id=178385
274         <rdar://problem/35027468>
275
276         Reviewed by Saam Barati.
277
278         * wtf/CheckedArithmetic.h:
279
280 2017-10-25  Commit Queue  <commit-queue@webkit.org>
281
282         Unreviewed, rolling out r222945.
283         https://bugs.webkit.org/show_bug.cgi?id=178818
284
285         "It made WasmBench crash" (Requested by saamyjoon on #webkit).
286
287         Reverted changeset:
288
289         "bmalloc mutex should be adaptive"
290         https://bugs.webkit.org/show_bug.cgi?id=177839
291         https://trac.webkit.org/changeset/222945
292
293 2017-10-25  Zan Dobersek  <zdobersek@igalia.com>
294
295         Make SERVICE_WORKER feature buildable on GTK, WPE
296         https://bugs.webkit.org/show_bug.cgi?id=178574
297
298         Reviewed by Carlos Garcia Campos.
299
300         * wtf/Identified.h: Explicitly include the <atomic> header since
301         std::atomic<> is used in the ThreadSafeIdentified definition.
302
303 2017-10-24  Michael Saboff  <msaboff@apple.com>
304
305         WTF: Eliminated PLATFORM checks for HAVE_MACH_EXCEPTIONS
306         https://bugs.webkit.org/show_bug.cgi?id=178747
307
308         Reviewed by Saam Barati.
309
310         Removed unnecessary PLATFORM checks as they can cause build failures
311         when the include file is present.
312
313         * wtf/Platform.h:
314
315 2017-10-23  Yusuke Suzuki  <utatane.tea@gmail.com>
316
317         [JSC] Use fastJoin in Array#toString
318         https://bugs.webkit.org/show_bug.cgi?id=178062
319
320         Reviewed by Darin Adler.
321
322         A bit cleaning up to use StringImpl::copyChars instead of
323         using for-loop directly.
324
325         * wtf/text/StringView.h:
326         (WTF::StringView::getCharactersWithUpconvert const):
327
328 2017-10-20  Antoine Quint  <graouts@apple.com>
329
330         [Web Animations] Provide basic timeline and animation interfaces
331         https://bugs.webkit.org/show_bug.cgi?id=178526
332
333         Reviewed by Dean Jackson.
334
335         Remove the WEB_ANIMATIONS compile-time flag.
336
337         * wtf/FeatureDefines.h:
338
339 2017-10-19  Keith Miller  <keith_miller@apple.com>
340
341         REGRESSION (r223476): WebCore exports symbols with names belonging to other frameworks
342         https://bugs.webkit.org/show_bug.cgi?id=178424
343
344         Reviewed by David Kilzer.
345
346         This patch moves the wrapper function sharing the name of the externed function
347         to the source file and marks it as always inline. Marking it as inline prevents
348         the framework from exporting it.
349
350         * wtf/cocoa/SoftLinking.h:
351
352 2017-10-18  Keith Miller  <keith_miller@apple.com>
353
354         Setup WebCore build to start using unified sources.
355         https://bugs.webkit.org/show_bug.cgi?id=178362
356
357         Reviewed by Tim Horton.
358
359         There are a number of changes to the bundler script. First, it is
360         now possible to enable or disable building files based on if the
361         associated feature flag is enabled or not. The syntax for this is
362         similar to how we do #ifs in C++ code. e.g.
363
364         #if ENABLE_APPLE_PAY
365             myApplePayFile.cpp
366         #endif
367
368         would enable myApplePayFile.cpp if and only if the APPLE_PAY
369         feature define is set.
370
371         I also changed comments from # to // to make it less likely they
372         would be confused with a #if.
373
374         Finally, this patch enables bundling files in the same relative
375         directory across source list files. Previously, if
376         SourcesCocoa.txt had platform/cf/foo.cpp and SourcesMac.txt had
377         platform/cf/bar.cpp those files would not be put in the same
378         unified source bundle. Now, those files will be put into the same
379         bundle but bar.cpp will always follow foo.cpp. The idea is that by
380         putting more specific files after more general files we can avoid
381         random build failures.
382
383         * Scripts/generate-unified-source-bundles.rb:
384
385 2017-10-18  Konstantin Tokarev  <annulen@yandex.ru>
386
387         REGRESSION(r217771): nullTerminatedWCharToString loses last character of input string
388         https://bugs.webkit.org/show_bug.cgi?id=178444
389
390         Reviewed by Per Arne Vollan.
391
392         * wtf/text/win/WCharStringExtras.h:
393         (WTF::nullTerminatedWCharToString):
394
395 2017-10-17  Keith Miller  <keith_miller@apple.com>
396
397         Change WebCore sources to work with unified source builds
398         https://bugs.webkit.org/show_bug.cgi?id=178229
399
400         Rubber stamped by Tim Horton.
401
402         * wtf/Platform.h:
403         * wtf/cocoa/SoftLinking.h:
404
405 2017-10-16  David Kilzer  <ddkilzer@apple.com>
406
407         Add RELEASE_ASSERT_WITH_SECURITY_IMPLICATION() macro
408         <https://webkit.org/b/178269>
409
410         Reviewed by Alex Christensen.
411
412         * wtf/Assertions.h:
413         (RELEASE_ASSERT_WITH_SECURITY_IMPLICATION): Add macro.
414
415 2017-10-14  Sam Weinig  <sam@webkit.org>
416
417         Remove HashCountedSet's copyToVector functions
418         https://bugs.webkit.org/show_bug.cgi?id=178215
419
420         Reviewed by Daniel Bates.
421
422         * wtf/HashCountedSet.h:
423         (WTF::copyToVector): Deleted.
424         
425             They are replaced by either copyToVector(hashCountedSet) or copyToVector(hashCountedSet.values())
426
427 2017-10-13  Sam Weinig  <sam@webkit.org>
428
429         Adopt type trait template aliases everywhere in WTF
430         https://bugs.webkit.org/show_bug.cgi?id=178299
431
432         Reviewed by Yusuke Suzuki.
433
434         Adopt type trait template aliases (e.g. replace 'typename std::make_unsigned<Source>::type'
435         with 'std::make_unsigned_t<Source>'). Also adopt using over typedef consistently.
436
437         * wtf/Atomics.h:
438         * wtf/CagedUniquePtr.h:
439         * wtf/CheckedArithmetic.h:
440         * wtf/CompletionHandler.h:
441         * wtf/Function.h:
442         * wtf/HashCountedSet.h:
443         * wtf/HashFunctions.h:
444         * wtf/HashMap.h:
445         * wtf/HashSet.h:
446         * wtf/HashTable.h:
447         * wtf/HashTraits.h:
448         * wtf/IndexedContainerIterator.h:
449         * wtf/IteratorAdaptors.h:
450         * wtf/KeyValuePair.h:
451         * wtf/LEBDecoder.h:
452         * wtf/ListHashSet.h:
453         * wtf/MathExtras.h:
454         * wtf/NeverDestroyed.h:
455         * wtf/OptionSet.h:
456         * wtf/RetainPtr.h:
457         * wtf/SizeLimits.cpp:
458         * wtf/StdLibExtras.h:
459         * wtf/SystemFree.h:
460         * wtf/ThreadSpecific.h:
461         * wtf/TypeCasts.h:
462         * wtf/Vector.h:
463         * wtf/text/IntegerToStringConversion.h:
464
465 2017-10-13  Jer Noble  <jer.noble@apple.com>
466
467         Performance: Skip texture upload if source image and destination texture haven't changed
468         https://bugs.webkit.org/show_bug.cgi?id=178254
469         <rdar://problem/34968181>
470
471         Reviewed by Dean Jackson.
472
473         Add a new class, UnsafePointer, for safely holding pointers to objects with uncontrolled lifetimes.
474
475         * WTF.xcodeproj/project.pbxproj:
476         * wtf/UnsafePointer.h: Added.
477         (WTF::UnsafePointer::UnsafePointer):
478         (WTF::UnsafePointer::operator== const):
479         (WTF::UnsafePointer::operator!= const):
480         (WTF::UnsafePointer::operator bool const):
481         (WTF::operator==):
482         (WTF::operator!=):
483
484 2017-10-13  Per Arne Vollan  <pvollan@apple.com>
485
486         [Win] When built with VS2017, MiniBrowser crashes on startup.
487         https://bugs.webkit.org/show_bug.cgi?id=175209
488
489         Reviewed by Daniel Bates.
490
491         Add AtomicString(const StaticStringImpl*) constructor. This is needed since
492         this patch adds constexpr to the static, global StaticStringImpl objects
493         generated in WebCore/bindings/scripts/StaticString.pm.
494
495         * wtf/text/AtomicString.h:
496         (WTF::AtomicString::AtomicString):
497         * wtf/text/AtomicStringImpl.cpp:
498         (WTF::addStatic):
499         (WTF::AtomicStringImpl::add):
500         * wtf/text/AtomicStringImpl.h:
501         * wtf/text/StringImpl.h:
502         (WTF::StringImpl::assertHashIsCorrect const):
503         (WTF::StringImpl::assertHashIsCorrect): Deleted.
504
505 2017-10-12  Alex Christensen  <achristensen@webkit.org>
506
507         Add Expected, HashMap, HashSet, and SHA1 to wtf/Forward.h
508         https://bugs.webkit.org/show_bug.cgi?id=178243
509
510         Reviewed by Tim Horton.
511
512         * wtf/Forward.h:
513         * wtf/HashMap.h:
514         Move default parameters to Forward.h like we did with Vector.
515         * wtf/HashSet.h:
516         Also fix indentation.
517
518 2017-10-12  Alex Christensen  <achristensen@webkit.org>
519
520         Add CompletionHandler and HashCountedSet to wtf/Forward.h
521         https://bugs.webkit.org/show_bug.cgi?id=178231
522
523         Reviewed by Tim Horton.
524
525         * wtf/Forward.h:
526         * wtf/HashCountedSet.h:
527
528 2017-10-11  Sam Weinig  <sam@webkit.org>
529
530         Remove out-parameter variants of copyToVector
531         https://bugs.webkit.org/show_bug.cgi?id=178155
532
533         Reviewed by Tim Horton.
534
535         * wtf/HashMap.h:
536         (WTF::copyToVector): Deleted.
537         * wtf/HashSet.h:
538         (WTF::copyToVector): Deleted.
539         
540             Remove copyToVector.
541         
542         * wtf/Vector.h:
543         (WTF::copyToVectorSpecialization):
544         
545             Add another version of copyToVector, called copyToVectorSpecialization, that allows
546             you to specify the entire specialization for the Vector you want to copy to. This
547             can be useful if you want your resulting Vector to have an inline capacity. 
548
549 2017-10-12  Sam Weinig  <sam@webkit.org>
550
551         It should be possible to iterate just the values (and not the counts) of a HashCountedSet
552         https://bugs.webkit.org/show_bug.cgi?id=178169
553
554         Reviewed by Daniel Bates.
555
556         Cleanup (fix indentation, simplify type names, adopt using), and add a values() range to
557         HashCountedSet. This will allow getting a Vector of all the values (and not the counts)
558         using the new copyToVector. 
559
560         * wtf/HashCountedSet.h:
561
562 2017-10-11  Michael Saboff  <msaboff@apple.com>
563
564         [JSC] Add ability to build with ARMV8 ILP32 ABI
565         https://bugs.webkit.org/show_bug.cgi?id=178194
566
567         Reviewed by Saam Barati.
568
569         For ARMV8 32 bit ABI, use JSVALUE32_64 and the CLOOP.
570
571         * wtf/Platform.h:
572
573 2017-10-11  Youenn Fablet  <youenn@apple.com>
574
575         Add API to clean CacheStorage data
576         https://bugs.webkit.org/show_bug.cgi?id=178034
577
578         Reviewed by Chris Dumez.
579
580         Moving CallbackAggregator pattern into its own class for easier reuse.
581
582         * WTF.xcodeproj/project.pbxproj:
583         * wtf/CallbackAggregator.h: Added.
584         (WTF::CallbackAggregator::create):
585         (WTF::CallbackAggregator::~CallbackAggregator):
586         (WTF::CallbackAggregator::CallbackAggregator):
587
588 2017-10-10  Sam Weinig  <sam@webkit.org>
589
590         Replace copyKeysToVector/copyValuesToVector with copyToVector(map.keys())/copyToVector(map.values())
591         https://bugs.webkit.org/show_bug.cgi?id=178102
592
593         Reviewed by Tim Horton.
594
595         * wtf/HashMap.h:
596         (WTF::copyKeysToVector): Deleted.
597         (WTF::copyValuesToVector): Deleted.
598         
599             Remove copyKeysToVector and copyValuesToVector which are no longer used.
600
601 2017-10-09  Youenn Fablet  <youenn@apple.com>
602
603         Vector should be able to easily create from a list of movable only items
604         https://bugs.webkit.org/show_bug.cgi?id=176432
605
606         Reviewed by Darin Adler.
607
608         Adding static from method to construct a Vector from movable-only items.
609         This may also be used instead of initializer list constructor for types that would benefit of being moved.
610
611         * wtf/Vector.h:
612         (WTF::Vector::Vector):
613         (WTF::Vector::from):
614         (WTF::Vector::uncheckedInitialize): Introduced as an optimization to set the vector size once.
615         (WTF::Malloc>::reserveInitialCapacity):
616
617 2017-10-09  Tim Horton  <timothy_horton@apple.com>
618
619         Disable INPUT_TYPE_COLOR in FeatureDefines.h
620         https://bugs.webkit.org/show_bug.cgi?id=178103
621         <rdar://problem/34872127>
622
623         Reviewed by Simon Fraser.
624
625         * wtf/FeatureDefines.h:
626         Because FeatureDefines.h overrides features that are not enabled in
627         FeatureDefines.xcconfig, you currently have to turn INPUT_TYPE_COLOR
628         off in two places. Since we only ever want it on for Mac, it's OK
629         to depend on the xcconfig defining it.
630
631 2017-10-09  Sam Weinig  <sam@webkit.org>
632
633         Make HashMap::keys() and HashMap::values() work with WTF::map/WTF::copyToVector
634         https://bugs.webkit.org/show_bug.cgi?id=178072
635
636         Reviewed by Darin Adler.
637
638         Introduce SizedIteratorRange, a variant of IteratorRange that includes
639         a reference to a backing container in order to get the size of container.
640         This is useful for algorithms like WTF::map and WTF::copyToVector, that
641         can use the size to efficiently allocate things of the correct size.
642
643         The main beneficiary are HashMap's keys() and values() functions which
644         used to return IteratorRanges and now return SizedIteratorRange. This
645         allows us to remove (in a future change) copyKeysToVector() and
646         copyValuesToVector() by replacing them with copyToVector(map.keys()) and
647         copyToVector(map.values()) respectively.
648
649         * wtf/HashMap.h:
650         * wtf/IteratorRange.h:
651         (WTF::SizedIteratorRange::SizedIteratorRange):
652         (WTF::SizedIteratorRange::size const):
653         (WTF::SizedIteratorRange::begin const):
654         (WTF::SizedIteratorRange::end const):
655         (WTF::makeSizedIteratorRange):
656
657 2017-10-08  Sam Weinig  <sam@webkit.org>
658
659         It should be possible to create a ListHashSet with a std::initializer_list.
660         https://bugs.webkit.org/show_bug.cgi?id=178070
661
662         Reviewed by Darin Adler.
663
664         * wtf/ListHashSet.h:
665         (WTF::U>::ListHashSet):
666         Add a constructor that takes a std::initializer_list.
667
668 2017-10-08  Sam Weinig  <sam@webkit.org>
669
670         Address additional feedback from Darin for r223039 and sort the using declarations.
671
672         * wtf/Vector.h:
673
674 2017-10-08  Sam Weinig  <sam@webkit.org>
675
676         There should be a version of copyToVector that returns a Vector, rather than using an out parameter
677         https://bugs.webkit.org/show_bug.cgi?id=177732
678
679         Reviewed by Saam Barati.
680
681         Add two new helper functions, copyToVector and copyToVectorOf, which will be able to
682         replace the existing out parameter taking copyToVector. Like it's ancestral namesake,
683         copyToVector takes an object that is both iterable (supports begin() and end()) and
684         has a size, and returns a Vector with a copy of all the items iterated. The copyToVectorOf
685         variant allow the user to specify a type to convert to, so if you have a HashSet<int>
686         but want those as floats in a Vector, you can do:
687         
688             auto floatVector = copyToVectorOf<float>(intSet);
689
690         * wtf/Vector.h:
691         (WTF::copyToVector):
692         (WTF::copyToVectorOf):
693
694 2017-10-08  Darin Adler  <darin@apple.com>
695
696         Fix bugs related to setting reflected floating point DOM attributes
697         https://bugs.webkit.org/show_bug.cgi?id=178061
698
699         Reviewed by Sam Weinig.
700
701         * wtf/dtoa.cpp:
702         (WTF::formatStringTruncatingTrailingZerosIfNeeded): Fix a bug where
703         this function would remove trailing zeroes from the exponent if
704         present instead of from the mantissa. This meant that it would
705         format 1e10 as "1.00000e+1" instead of "1e+10". Added regression
706         tests for this to TestWebKitAPI.
707
708         * wtf/dtoa/utils.h:
709         (WTF::double_conversion::StringBuilder::RemoveCharacters): Added.
710         Used by the fix above.
711
712         * wtf/text/AtomicString.cpp:
713         (WTF::AtomicString::number): Note: This function is used by code
714         that sets the values of reflected floating point DOM attributes.
715         Changed the function to use the rules from numberToString rather
716         ones from numberToFixedPrecisionString. This is analogous to
717         String::numberToStringECMAScript, and in the future we should change
718         String and StringBuilder so this "ECMAScript" semantic is the default
719         way to convert a floating point number to a string, and rename the fixed
720         precision version that is currently called String::number. I audited
721         the small number of sites calling AtomicString::number, by temporarily
722         renaming it, and discovered that this is the correct behavior for all;
723         none needed fixed precision. Also, fixed a mistake where this explicitly
724         converted to String. That was defeating the purpose of having these
725         functions in AtomicString: It would allocate a new String and then
726         destroy it in the case where an equal string was already in the
727         AtomicString table.
728
729 2017-10-06  Commit Queue  <commit-queue@webkit.org>
730
731         Unreviewed, rolling out r222791 and r222873.
732         https://bugs.webkit.org/show_bug.cgi?id=178031
733
734         Caused crashes with workers/wasm LayoutTests (Requested by
735         ryanhaddad on #webkit).
736
737         Reverted changesets:
738
739         "WebAssembly: no VM / JS version of everything but Instance"
740         https://bugs.webkit.org/show_bug.cgi?id=177473
741         http://trac.webkit.org/changeset/222791
742
743         "WebAssembly: address no VM / JS follow-ups"
744         https://bugs.webkit.org/show_bug.cgi?id=177887
745         http://trac.webkit.org/changeset/222873
746
747 2017-10-06  Antti Koivisto  <antti@apple.com>
748
749         Minor WeakPtr improvements
750         https://bugs.webkit.org/show_bug.cgi?id=177958
751
752         Reviewed by Sam Weinig.
753
754         * wtf/WeakPtr.h:
755         (WTF::WeakPtr::operator bool const):
756
757             Make explicit.
758
759         (WTF::WeakPtrFactory::createWeakPtr const):
760         (WTF::makeWeakPtr):
761
762             Remove templating from createWeakPtr, makeWeakPtr() is now the
763             canonical way to make derived-type WeakPtrs.
764
765 2017-10-04  Filip Pizlo  <fpizlo@apple.com>
766
767         bmalloc mutex should be adaptive
768         https://bugs.webkit.org/show_bug.cgi?id=177839
769
770         Reviewed by Michael Saboff.
771         
772         Add some comments that I thought of while copy-pasting this code.
773
774         Reland after fixing ancient WordLock bug: the notify_one has to happen with the lock held
775         to ensure it doesn't run after that thread has died.
776
777         * wtf/LockAlgorithmInlines.h:
778         * wtf/WordLock.cpp:
779
780 2017-10-05  Carlos Alberto Lopez Perez  <clopez@igalia.com>
781
782         Generate a compile error if release is built without compiler optimizations
783         https://bugs.webkit.org/show_bug.cgi?id=177665
784
785         Reviewed by Brian Burg.
786
787         For GCC and Clang, generate an error at build time that will alert
788         the developer that she is trying to build Release without any compiler
789         optimization. A build time error is much better than an unexpected
790         "oh, WebKit is really slow ..."  situation later.
791
792         If this was intended, then we tell the developer that she can continue
793         by just setting -DRELEASE_WITHOUT_OPTIMIZATIONS in the list of build
794         flags.
795
796         The intention of this patch is to ensure that nobody builds Release
797         without enabling compiler optimization by mistake.
798
799         * wtf/Compiler.h:
800
801 2017-10-05  David Kilzer  <ddkilzer@apple.com>
802
803         Bug 177893: Disable -Wcast-qual for new clang compiler in Apple ports
804         <https://webkit.org/b/177893>
805         <rdar://problem/33667497>
806
807         Reviewed by Tim Horton.
808
809         * wtf/RetainPtr.h:
810         (WTF::RetainPtr::fromStorageType const): Disable warnings for
811         -Wcast-qual until we can provide a safe cast function that lets
812         us re-enable the warning.
813
814 2017-10-05  Matt Lewis  <jlewis3@apple.com>
815
816         Unreviewed, rolling out r222893.
817
818         This caused multiple API failures.
819
820         Reverted changeset:
821
822         "bmalloc mutex should be adaptive"
823         https://bugs.webkit.org/show_bug.cgi?id=177839
824         http://trac.webkit.org/changeset/222893
825
826 2017-10-04  Filip Pizlo  <fpizlo@apple.com>
827
828         bmalloc mutex should be adaptive
829         https://bugs.webkit.org/show_bug.cgi?id=177839
830
831         Reviewed by Michael Saboff.
832         
833         Add some comments that I thought of while copy-pasting this code.
834
835         * wtf/LockAlgorithmInlines.h:
836         * wtf/WordLock.cpp:
837
838 2017-10-04  JF Bastien  <jfbastien@apple.com>
839
840         WTF: Update std::expected to match current proposal
841         https://bugs.webkit.org/show_bug.cgi?id=177881
842
843         Reviewed by Mark Lam.
844
845         The proposal is likely to be in C++20 and I've been asked to help co-champion
846         it. I'm therefore updating our implementation to more closely match the current
847         proposal, and to make sure it'll work for us if standardized.
848
849          - Rename UnexpectedType to Unexpected to match the proposal.
850          - Remove relational operators, only equality / inequality remains.
851          - Fix minor type signatures.
852          - Add UnexpectedType typedef.
853          - Uncomment rebind implementation.
854          - Add in-place construction tag, as well as explicit error construction tag.
855          - Add template unexpected constructor.
856          - Note that make_unexpected isn't in the proposal anymore, but we keep it because we don't have C++17 deduction guides.
857          - Remove hashing, which isn't in the proposal anymore.
858
859         * wtf/Expected.h:
860         (WTF::Unexpected::Unexpected):
861         (WTF::Unexpected::value const):
862         (WTF::operator==):
863         (WTF::operator!=):
864         (WTF::makeUnexpected):
865         (WTF::Expected::Expected):
866         (WTF::Expected::operator=):
867         (WTF::Expected::getUnexpected const):
868
869 2017-10-04  Ryan Haddad  <ryanhaddad@apple.com>
870
871         Unreviewed, rolling out r222840.
872
873         This change breaks internal builds.
874
875         Reverted changeset:
876
877         "Generate a compile error if release is built without compiler
878         optimizations"
879         https://bugs.webkit.org/show_bug.cgi?id=177665
880         http://trac.webkit.org/changeset/222840
881
882 2017-10-04  Carlos Alberto Lopez Perez  <clopez@igalia.com>
883
884         Generate a compile error if release is built without compiler optimizations
885         https://bugs.webkit.org/show_bug.cgi?id=177665
886
887         Reviewed by Michael Catanzaro.
888
889         For GCC and Clang, generate an error at build time that will alert
890         the developer that she is trying to build Release without any compiler
891         optimization. A build time error is much better than an unexpected
892         "oh, WebKit is really slow ..."  situation later.
893
894         If this was intended, then we tell the developer that she can continue
895         by just setting -DRELEASE_WITHOUT_OPTIMIZATIONS in the list of build
896         flags.
897
898         The intention of this patch is to ensure that nobody builds Release
899         without enabling compiler optimization by mistake.
900
901         * wtf/Compiler.h:
902
903 2017-10-04  Tomas Popela  <tpopela@redhat.com>
904
905         Allow building without WOFF enabled
906
907         Reviewed by Michael Catanzaro.
908
909         Don't force the WOFF to be turned on, but follow what is set in cmake.
910
911         * wtf/Platform.h:
912
913 2017-10-03  Saam Barati  <sbarati@apple.com>
914
915         Implement polymorphic prototypes
916         https://bugs.webkit.org/show_bug.cgi?id=176391
917
918         Reviewed by Filip Pizlo.
919
920         * wtf/Box.h:
921         (WTF::Box::operator bool const):
922         (WTF::Box::operator bool): Deleted.
923         Make Box movable. Also ensure its operator bool doesn't do an atomic increment.
924         * wtf/RefPtr.h:
925         (WTF::RefPtr::operator bool const):
926         Add `explicit operator bool()` for RefPtr.
927
928 2017-10-03  Antti Koivisto  <antti@apple.com>
929
930         Allow assigning WeakPtr<Derived> to WeakPtr<Base>
931         https://bugs.webkit.org/show_bug.cgi?id=177817
932
933         Reviewed by Geoff Garen.
934
935         Add templated copy/move constructors/assignment operators, similar to RefPtr.
936
937         * wtf/WeakPtr.h:
938         (WTF::WeakPtrFactory::createWeakPtr const):
939         (WTF::weak_reference_upcast):
940         (WTF::weak_reference_downcast):
941         (WTF::WeakPtr<T>::WeakPtr):
942         (WTF::=):
943         (WTF::makeWeakPtr):
944
945 2017-10-03  JF Bastien  <jfbastien@apple.com>
946
947         WebAssembly: no VM / JS version of everything but Instance
948         https://bugs.webkit.org/show_bug.cgi?id=177473
949
950         Reviewed by Filip Pizlo.
951
952         * wtf/StdLibExtras.h:
953         (WTF::default_construct_at): this makes code in WasmTable much
954         more readable, and is generally useful for generic code
955
956 2017-10-02  Myles C. Maxfield  <mmaxfield@apple.com>
957
958         Move LineEnding.{h,cpp} from WebCore/platform/text to wtf/text
959         https://bugs.webkit.org/show_bug.cgi?id=176575
960
961         Reviewed by Alex Christensen.
962
963         As part of the PAL effort, we're trying to move everything out of WebCore/platform, one-by-one.
964         These LineEnding files belong in WTF.
965
966         * WTF.xcodeproj/project.pbxproj:
967         * wtf/text/LineEnding.cpp: Renamed from Source/WebCore/platform/text/LineEnding.cpp.
968         (WTF::normalizeLineEndingsToCRLF):
969         * wtf/text/LineEnding.h: Renamed from Source/WebCore/platform/text/LineEnding.h.
970
971 2017-10-02  Geoffrey Garen  <ggaren@apple.com>
972
973         WeakPtr should have a move constructor
974         https://bugs.webkit.org/show_bug.cgi?id=177789
975
976         Reviewed by Chris Dumez.
977
978         * wtf/WeakPtr.h: Now that we just have a RefPtr data member,
979         the default operators are sufficient.
980
981 2017-10-02  Geoffrey Garen  <ggaren@apple.com>
982
983         NULL WeakPtr should not malloc!
984         https://bugs.webkit.org/show_bug.cgi?id=177773
985
986         Reviewed by Antti Koivisto.
987
988         Translating NULL into malloc is... inefficient.
989
990         * wtf/WeakPtr.h:
991         (WTF::WeakPtr::WeakPtr):
992         (WTF::WeakPtr::operator=):
993         (WTF::WeakPtr::clear): Make m_ref lazy so that a NULL m_ref can represent
994         a NULL pointer. Normal dereference is no slower because we can rely on
995         the fact that dereference of NULL should crash. operator bool() and get()
996         incur an extra branch. That's probably worth it to avoid malloc
997         for NULL.
998
999 2017-10-02  Antti Koivisto  <antti@apple.com>
1000
1001         Add makeWeakPtr variant that takes pointer
1002         https://bugs.webkit.org/show_bug.cgi?id=177767
1003
1004         Reviewed by Zalan Bujtas.
1005
1006         * wtf/WeakPtr.h:
1007         (WTF::makeWeakPtr):
1008
1009         This version deals with the nullptr.
1010
1011 2017-09-30  Antti Koivisto  <antti@apple.com>
1012
1013         Add makeWeakPtr for easier WeakPtr construction
1014         https://bugs.webkit.org/show_bug.cgi?id=177706
1015
1016         Reviewed by Sam Weinig.
1017
1018         Standalone makeWeakPtr() returns a WeakPtr of the same type as the argument.
1019
1020         For this to work the argument type needs to expose a (possibly base type) WeakPtrFactory
1021         as a public weakPtrFactory() member function.
1022
1023         * wtf/WeakPtr.h:
1024         (WTF::WeakPtr::operator-> const):
1025         (WTF::WeakPtr::operator* const): Also add operator*.
1026         (WTF::makeWeakPtr):
1027
1028 2017-09-28  Jiewen Tan  <jiewen_tan@apple.com>
1029
1030         WeakPtrFactory should allow downcasting
1031         https://bugs.webkit.org/show_bug.cgi?id=177389
1032         <rdar://problem/34604174>
1033
1034         Reviewed by Geoffrey Garen.
1035
1036         In this patch, WeakPtrFactory is enhanced with the ability to create WeakPtrs
1037         of its owner's sub classes and have them point to the same WeakReference.
1038
1039         * wtf/WeakPtr.h:
1040         (WTF::WeakPtr::WeakPtr):
1041         We cannot determine the base class of type T, thus no friends. It is made public
1042         such that WeakPtrFactory with a base class type U can create a derived type T
1043         WeakPtr.
1044         (WTF::WeakPtrFactory::createWeakPtr const):
1045
1046 2017-09-28  Don Olmstead  <don.olmstead@sony.com>
1047
1048         Sync SYSTEM_MALLOC implementation of Gigacage
1049         https://bugs.webkit.org/show_bug.cgi?id=177569
1050
1051         Reviewed by Mark Lam.
1052
1053         * wtf/Gigacage.h:
1054         (Gigacage::basePtr):
1055         (Gigacage::basePtrs):
1056
1057 2017-09-27  Per Arne Vollan  <pvollan@apple.com>
1058
1059         [Win64] Compile error, 'BasePtrs' is undefined.
1060         https://bugs.webkit.org/show_bug.cgi?id=177565
1061
1062         Reviewed by Mark Lam.
1063
1064         Copy definition of 'BasePtrs' from bmalloc/GigaCage.h.
1065
1066         * wtf/Gigacage.h:
1067
1068 2017-09-26  Said Abou-Hallawa  <sabouhallawa@apple.com>
1069
1070         Followup (r222427): SynchronizedFixedQueue should not have a public constructor
1071         https://bugs.webkit.org/show_bug.cgi?id=177458
1072
1073         Reviewed by Tim Horton.
1074
1075         Since SynchronizedFixedQueue is now derived from ThreadSafeRefCounted<SynchronizedFixedQueue>,
1076         the standard way to have an instance of it is to call SynchronizedFixedQueue::create()
1077         which returns a Ref<SynchronizedFixedQueue>. Now it does not make sense to still
1078         have the constructor public.
1079
1080         * wtf/SynchronizedFixedQueue.h:
1081         (WTF::SynchronizedFixedQueue::SynchronizedFixedQueue):
1082
1083 2017-09-24  Keith Miller  <keith_miller@apple.com>
1084
1085         JSC build should use unified sources for derived sources
1086         https://bugs.webkit.org/show_bug.cgi?id=177421
1087
1088         Reviewed by JF Bastien.
1089
1090         The script now needs to determine if a file is from a derived
1091         source. This is only relevant for the CMake build since the
1092         script needs to provide a list of the bundled source files. If the
1093         script does not provide the full path for derived sources then
1094         CMake will be unable to find them and the build will fail.
1095
1096         Additionally, I move the error message for the Xcode build outside
1097         the main loop. This means that the error message will contain all
1098         the files you need to add to Xcode and all those files will now be
1099         written in DerivedSources so they should be easier to add.
1100
1101         * Scripts/generate-unified-source-bundles.rb:
1102
1103 2017-09-26  Zan Dobersek  <zdobersek@igalia.com>
1104
1105         Support building JavaScriptCore with the Bionic C library
1106         https://bugs.webkit.org/show_bug.cgi?id=177427
1107
1108         Reviewed by Michael Catanzaro.
1109
1110         * wtf/Platform.h: Define HAVE_MACHINE_CONTEXT when __BIONIC__
1111         is defined, i.e. when building with the Bionic C library.
1112
1113 2017-09-23  Said Abou-Hallawa  <sabouhallawa@apple.com>
1114
1115         Images may render partial frames even after loading all the encoded data
1116         https://bugs.webkit.org/show_bug.cgi?id=177406
1117
1118         Reviewed by Simon Fraser.
1119
1120         Make it possible to create a RefPtr<SynchronizedFixedQueue>.
1121
1122         * wtf/SynchronizedFixedQueue.h:
1123         (WTF::SynchronizedFixedQueue::create):
1124         (WTF::SynchronizedFixedQueue::enqueue):
1125         (WTF::SynchronizedFixedQueue::dequeue):
1126
1127 2017-09-22  Zalan Bujtas  <zalan@apple.com>
1128
1129         WeakPtrFactory should populate m_ref lazily.
1130         https://bugs.webkit.org/show_bug.cgi?id=177375
1131
1132         Reviewed by Geoffrey Garen.
1133
1134         This helps us with the overhead of initializing WeakPtrFactory for
1135         objects that rarely end up creating the weak reference.
1136         -This is in preparation for introducing WeakPtr to RenderObject.
1137
1138         All credit to Geoffrey Garen.
1139
1140         * wtf/WeakPtr.h:
1141         (WTF::WeakReference::get const):
1142         (WTF::WeakReference::clear):
1143         (WTF::WeakReference::WeakReference):
1144         (WTF::WeakPtrFactory::~WeakPtrFactory):
1145         (WTF::WeakPtrFactory::createWeakPtr const):
1146         (WTF::WeakPtrFactory::revokeAll):
1147         (WTF::WeakPtrFactory::WeakPtrFactory): Deleted.
1148
1149 2017-09-21  Alex Christensen  <achristensen@webkit.org>
1150
1151         Make StringBuilder movable
1152         https://bugs.webkit.org/show_bug.cgi?id=177311
1153
1154         Reviewed by Chris Dumez.
1155
1156         * wtf/text/StringBuilder.h:
1157         (WTF::StringBuilder::StringBuilder):
1158
1159 2017-09-20  Keith Miller  <keith_miller@apple.com>
1160
1161         JSC should use unified sources for platform specific files.
1162         https://bugs.webkit.org/show_bug.cgi?id=177290
1163
1164         Reviewed by Michael Saboff.
1165
1166         The unified source bundler script can now handle more than one
1167         list of sources. Sources will not be bundled across source file
1168         lists. We want to ensure that changing one platform's sources
1169         doesn't break another platform's build, as much as
1170         possible. Additionally, it means that there won't be weird
1171         performance changes when files are added to an unrelated platform.
1172
1173         Remove stale reference to generate-unified-source-bundles.rb script
1174         from Xcode.
1175
1176         * Scripts/generate-unified-source-bundles.rb:
1177         * WTF.xcodeproj/project.pbxproj:
1178
1179 2017-09-20  Stephan Szabo  <stephan.szabo@sony.com>
1180
1181         [Win] WTF: Add alias for process id to use in place of direct uses of pid_t
1182         https://bugs.webkit.org/show_bug.cgi?id=177017
1183
1184         Reviewed by Alex Christensen.
1185
1186         * wtf/ProcessID.h:
1187         (WTF::getCurrentProcessID):
1188
1189 2017-09-20  Keith Miller  <keith_miller@apple.com>
1190
1191         JSC Xcode build should use unified sources for platform independent files
1192         https://bugs.webkit.org/show_bug.cgi?id=177190
1193
1194         Reviewed by Saam Barati.
1195
1196         Add a new directory for build scripts that are forwarded to subsequent framework builds.
1197
1198         * Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb.
1199         * WTF.xcodeproj/project.pbxproj:
1200         * wtf/CMakeLists.txt:
1201
1202 2017-09-20  Per Arne Vollan  <pvollan@apple.com>
1203
1204         [Win] Cannot find script to generate unified sources.
1205         https://bugs.webkit.org/show_bug.cgi?id=177014
1206
1207         Reviewed by Keith Miller.
1208
1209         Copy the ruby script to WTF/Scripts in the forwarding headers folder.
1210
1211         * wtf/CMakeLists.txt:
1212
1213 2017-09-20  Alberto Garcia  <berto@igalia.com>
1214
1215         Fix HPPA and Alpha builds
1216         https://bugs.webkit.org/show_bug.cgi?id=177224
1217
1218         Reviewed by Alex Christensen.
1219
1220         * wtf/Platform.h:
1221
1222 2017-09-19  Youenn Fablet  <youenn@apple.com>
1223
1224         Allow WTF::map to use any class that is iterable and has a size getter
1225         https://bugs.webkit.org/show_bug.cgi?id=177026
1226
1227         Reviewed by Darin Adler.
1228
1229         Computing the Item type given to the lambda using the iterator instead of ValueType which is specific to Vector.
1230         Adding the possibility to pass a non const container reference and a lambda taking non const references as well. 
1231
1232         * wtf/Vector.h:
1233         (WTF::MapFunctionInspector::acceptsReference):
1234         (WTF::Mapper::map):
1235         (WTF::map):
1236
1237 2017-09-19  Jer Noble  <jer.noble@apple.com>
1238
1239         [Cocoa] Add an ImageDecoder subclass backed by AVFoundation
1240         https://bugs.webkit.org/show_bug.cgi?id=176825
1241
1242         Reviewed by Eric Carlson.
1243
1244         * wtf/Platform.h:
1245
1246 2017-09-18  Andy Estes  <aestes@apple.com>
1247
1248         [Cocoa] Upstream sandbox-related WebKitSystemInterface functions
1249         https://bugs.webkit.org/show_bug.cgi?id=177047
1250
1251         Reviewed by Daniel Bates.
1252
1253         * wtf/spi/darwin/SandboxSPI.h:
1254
1255 2017-09-18  Ryan Haddad  <ryanhaddad@apple.com>
1256
1257         Unreviewed, rolling out r222170.
1258
1259         The API test added with this change is failing.
1260
1261         Reverted changeset:
1262
1263         "Allow WTF::map to use any class that is iterable and has a
1264         size getter"
1265         https://bugs.webkit.org/show_bug.cgi?id=177026
1266         http://trac.webkit.org/changeset/222170
1267
1268 2017-09-18  Youenn Fablet  <youenn@apple.com>
1269
1270         Allow WTF::map to use any class that is iterable and has a size getter
1271         https://bugs.webkit.org/show_bug.cgi?id=177026
1272
1273         Reviewed by Darin Adler.
1274
1275         Computing the Item type given to the lambda using the iterator instead of ValueType which is specific to Vector.
1276         Adding the possibility to pass a non const container reference and a lambda taking non const references as well. 
1277
1278         * wtf/Vector.h:
1279         (WTF::MapFunctionInspector::acceptsReference):
1280         (WTF::Mapper::map):
1281         (WTF::map):
1282
1283 2017-09-15  JF Bastien  <jfbastien@apple.com>
1284
1285         WTF: use Forward.h when appropriate instead of Vector.h
1286         https://bugs.webkit.org/show_bug.cgi?id=176984
1287
1288         Reviewed by Saam Barati.
1289
1290         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.
1291
1292         * wtf/Forward.h:
1293         * wtf/Vector.h:
1294         * wtf/text/StringVector.h:
1295
1296 2017-09-15  Keith Miller  <keith_miller@apple.com>
1297
1298         generate-unified-source-bundles.rb shouldn't write a file that isn't going to change
1299         https://bugs.webkit.org/show_bug.cgi?id=177021
1300
1301         Reviewed by Tim Horton.
1302
1303         * generate-unified-source-bundles.rb:
1304
1305 2017-09-14  Saam Barati  <sbarati@apple.com>
1306
1307         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
1308         https://bugs.webkit.org/show_bug.cgi?id=176863
1309
1310         Reviewed by Keith Miller.
1311
1312         This patch adds a way for a particular function to mark
1313         that none of its calls should be tail calls.
1314         
1315         It's useful in the following example if you don't want foo
1316         to do a tail call to bar or baz:
1317         
1318         int foo(bool b)
1319         {
1320             NO_TAIL_CALLS();
1321             if (b)
1322                 return baz();
1323             return bar();
1324         }
1325         
1326         Note that we're not saying that bar/baz should not be tail callable. bar/baz
1327         may have other callers that are allowed to tail call it. This macro just says
1328         that foo itself will not perform any tail calls.
1329
1330         * WTF.xcodeproj/project.pbxproj:
1331         * wtf/NoTailCalls.h: Added.
1332         (WTF::NoTailCalls::~NoTailCalls):
1333
1334 2017-09-14  Mark Lam  <mark.lam@apple.com>
1335
1336         AddressSanitizer: stack-buffer-underflow in JSC::Probe::Page::Page
1337         https://bugs.webkit.org/show_bug.cgi?id=176874
1338         <rdar://problem/34436415>
1339
1340         Reviewed by Saam Barati.
1341
1342         Added a convenience version of roundUpToMultipleOf() so that it can be applied to
1343         pointers without the client having to cast explicitly.
1344
1345         * wtf/StdLibExtras.h:
1346         (WTF::roundUpToMultipleOf):
1347
1348 2017-09-14  Youenn Fablet  <youenn@apple.com>
1349
1350         Allow WTF::map to take function as parameter
1351         https://bugs.webkit.org/show_bug.cgi?id=176909
1352
1353         Reviewed by Jer Noble.
1354
1355         * wtf/Vector.h:
1356         (WTF::map):
1357
1358 2017-09-13  Youenn Fablet  <youenn@apple.com>
1359
1360         Add a lambda-based map for Vectors
1361         https://bugs.webkit.org/show_bug.cgi?id=176487
1362
1363         Reviewed by Darin Adler.
1364
1365         This helper routine allows refactoring the reserveInitialCapacity/uncheckedAppend pattern, the mapper between source and destination item being a lambda.
1366
1367         * wtf/Vector.h:
1368         (WTF::Mapper::transform):
1369         (WTF::Mapper::map):
1370         (WTF::map):
1371
1372 2017-09-12  Yusuke Suzuki  <utatane.tea@gmail.com>
1373
1374         [DFG] Optimize WeakMap::get by adding intrinsic and fixup
1375         https://bugs.webkit.org/show_bug.cgi?id=176010
1376
1377         Reviewed by Filip Pizlo.
1378
1379         Add inlineGet method with HashTranslator.
1380
1381         * wtf/HashMap.h:
1382         (WTF::X>::inlineGet const):
1383         (WTF::MappedTraits>::inlineGet const):
1384         (WTF::MappedTraits>::fastGet const): Deleted.
1385         * wtf/LoggingHashMap.h:
1386
1387 2017-09-12  Keith Miller  <keith_miller@apple.com>
1388
1389         Do unified source builds for JSC
1390         https://bugs.webkit.org/show_bug.cgi?id=176076
1391
1392         Reviewed by Geoffrey Garen.
1393
1394         This patch adds a script that will automatically bundle source
1395         files, which is currently only used by the CMake build. It's
1396         important that we use the same script to generate the bundles
1397         for the CMake build as the Xcode build. If we didn't do this then
1398         it's likely that there would be build errors that occur in only
1399         one build system. On the same note, we also need to be careful to
1400         not bundle platform specific source files with platform
1401         independent ones. There are a couple of things the script does not
1402         currently handle but are not essential for the CMake build. First,
1403         it does not handle the max bundle size restrictions that the Xcode
1404         build will require. It also does not handle C files.
1405
1406         The unified source generator script works by collecting groups of
1407         up to 8 files from the same directory. We don't bundle files from
1408         across directories since I didn't see a speedup from doing
1409         so. Additionally, splitting at the directory boundary means that
1410         it is less likely that adding a new file will force a "clean"
1411         build. This would happen because the new file will shift every
1412         subsequent file into the next unified source bundle.
1413
1414         Using unified sources appears to be a roughly 3.5x build time
1415         speed up for clean builds on my MBP and appears to have a
1416         negligible effect in incremental builds.
1417
1418         * generate-unified-source-bundles.rb: Added.
1419         * wtf/Assertions.h:
1420
1421 2017-09-12  Joseph Pecoraro  <pecoraro@apple.com>
1422
1423         QualifiedName::init should assume AtomicStrings::init was already called
1424         https://bugs.webkit.org/show_bug.cgi?id=176639
1425
1426         Reviewed by Sam Weinig.
1427
1428         * wtf/NeverDestroyed.h:
1429         (WTF::LazyNeverDestroyed::isConstructed const):
1430
1431 2017-09-12  Brent Fulgham  <bfulgham@apple.com>
1432
1433         Show punycode to user if a URL mixes Armenian Seh or Vo with other scripts
1434         https://bugs.webkit.org/show_bug.cgi?id=176578
1435         <rdar://problem/33906231>
1436
1437         Reviewed by Alex Christensen.
1438
1439         * wtf/ASCIICType.h:
1440         (WTF::isASCIIDigitOrPunctuation): Added helper function to recognize ASCII digits
1441         and punctuation characters.
1442
1443 2017-09-12  Sam Weinig  <sam@webkit.org>
1444
1445         [Cleanup] Follow up cleanup for DOMFormData implementation
1446         https://bugs.webkit.org/show_bug.cgi?id=176740
1447
1448         Reviewed by Alex Christensen.
1449
1450         * WTF.xcodeproj/project.pbxproj:
1451         * wtf/HashTraits.h:
1452         (WTF::KeyValuePair::KeyValuePair): Deleted.
1453         * wtf/KeyValuePair.h: Added.
1454         (WTF::KeyValuePair::KeyValuePair):
1455         (WTF::makeKeyValuePair):
1456
1457             Move KeyValuePair to its own header and add a makeKeyValuePair helper.
1458
1459 2017-09-11  Ryan Haddad  <ryanhaddad@apple.com>
1460
1461         Unreviewed, rolling out r221854.
1462
1463         The test added with this change fails on 32-bit JSC bots.
1464
1465         Reverted changeset:
1466
1467         "[DFG] Optimize WeakMap::get by adding intrinsic and fixup"
1468         https://bugs.webkit.org/show_bug.cgi?id=176010
1469         http://trac.webkit.org/changeset/221854
1470
1471 2017-09-03  Yusuke Suzuki  <utatane.tea@gmail.com>
1472
1473         [DFG] Optimize WeakMap::get by adding intrinsic and fixup
1474         https://bugs.webkit.org/show_bug.cgi?id=176010
1475
1476         Reviewed by Filip Pizlo.
1477
1478         Add inlineGet method with HashTranslator.
1479
1480         * wtf/HashMap.h:
1481         (WTF::X>::inlineGet const):
1482         (WTF::MappedTraits>::inlineGet const):
1483         (WTF::MappedTraits>::fastGet const): Deleted.
1484         * wtf/LoggingHashMap.h:
1485
1486 2017-09-07  Myles C. Maxfield  <mmaxfield@apple.com>
1487
1488         [PAL] Unify PlatformUserPreferredLanguages.h with Language.h
1489         https://bugs.webkit.org/show_bug.cgi?id=176561
1490
1491         Reviewed by Brent Fulgham.
1492
1493         WebCore/platform/Language was the only* user of PlatformUserPreferredLanguages (with 1 exception).
1494         That exception is that JavaScriptCore needed the functionality of WebCore/platform/Language, but it
1495         couldn't get it because of the layering violation, so instead it erroneously called into
1496         PlatformUserPreferredLanguages instead. This patch merges these two files into WTF so JSC gets the
1497         right function and the PAL effort has one less file to move from WebCore/platform into PAL.
1498
1499         * WTF.xcodeproj/project.pbxproj:
1500         * wtf/CMakeLists.txt:
1501         * wtf/Language.cpp: Renamed from Source/WebCore/platform/Language.cpp.
1502         (WTF::addLanguageChangeObserver):
1503         (WTF::userPreferredLanguages):
1504         * wtf/Language.h: Renamed from Source/WebCore/platform/Language.h.
1505         * wtf/PlatformGTK.cmake:
1506         * wtf/PlatformJSCOnly.cmake:
1507         * wtf/PlatformMac.cmake:
1508         * wtf/PlatformUserPreferredLanguages.h: Removed.
1509         * wtf/PlatformWPE.cmake:
1510         * wtf/PlatformWin.cmake:
1511         * wtf/cf/LanguageCF.cpp: Renamed from Source/WTF/wtf/PlatformUserPreferredLanguagesMac.mm.
1512         (WTF::httpStyleLanguageCode):
1513         (WTF::languagePreferencesDidChange):
1514         (WTF::platformUserPreferredLanguages):
1515         * wtf/unix/LanguageUnix.cpp: Renamed from Source/WTF/wtf/PlatformUserPreferredLanguagesUnix.cpp.
1516         * wtf/win/LanguageWin.cpp: Renamed from Source/WTF/wtf/PlatformUserPreferredLanguagesWin.cpp.
1517
1518 2017-09-06  Eric Carlson  <eric.carlson@apple.com>
1519
1520         Require LoggingHelper overrides to provide identifier
1521         https://bugs.webkit.org/show_bug.cgi?id=176477
1522
1523         Reviewed by Jer Noble.
1524
1525         * wtf/Assertions.cpp: No more WTFLogLevelNotice.
1526         * wtf/Assertions.h: Ditto.
1527
1528 2017-09-06  Per Arne Vollan  <pvollan@apple.com>
1529
1530         [Win] WebCore failed to build, InbandTextTrackPrivateAVF: base class undefined.
1531         https://bugs.webkit.org/show_bug.cgi?id=176431
1532
1533         Reviewed by Alex Christensen.
1534
1535         AVFoundation header detection should be done in WebCore because of build dependencies. 
1536
1537         * AVFoundationSupport.py: Removed.
1538         * wtf/Platform.h:
1539         * wtf/PlatformWin.cmake:
1540
1541 2017-09-05  Yoshiaki Jitsukawa  <Yoshiaki.Jitsukawa@sony.com>
1542
1543         [Win] Fix the wincairo build after r221558 and r221583
1544         https://bugs.webkit.org/show_bug.cgi?id=176353
1545
1546         Reviewed by Yusuke Suzuki.
1547
1548         * wtf/Assertions.cpp:
1549
1550 2017-09-04  Eric Carlson  <eric.carlson@apple.com>
1551
1552         Switch HTMLMediaElement to release logging
1553         https://bugs.webkit.org/show_bug.cgi?id=176065
1554
1555         Reviewed by Jer Noble.
1556
1557         * wtf/MediaTime.cpp:
1558         (WTF::MediaTime::dump const): Use toString.
1559         (WTF::MediaTime::toString const): New.
1560
1561 2017-09-04  Yusuke Suzuki  <utatane.tea@gmail.com>
1562
1563         Remove OS(SOLARIS) support
1564         https://bugs.webkit.org/show_bug.cgi?id=176341
1565
1566         Reviewed by Sam Weinig.
1567
1568         WebKit project does not have stake holders supporting Solaris right now.
1569         And Solaris + SPARC in 64bit environment does not work well since its
1570         address space includes non-48bit area. It breaks our JSVALUE64 in JSC.
1571         In addition, Solaris a bit complicates our threading implementation
1572         because of its special threading stack.
1573
1574         This patch removes OS(SOLARIS) and COMPILER(SUNCC) support from WebKit.
1575
1576         * wtf/Compiler.h:
1577         * wtf/InlineASM.h:
1578         * wtf/MathExtras.h:
1579         (std::isfinite): Deleted.
1580         (std::signbit): Deleted.
1581         (std::isinf): Deleted.
1582         * wtf/NumberOfCores.cpp:
1583         (WTF::numberOfProcessorCores):
1584         * wtf/Platform.h:
1585         * wtf/StackBounds.cpp:
1586         * wtf/ThreadingPthreads.cpp:
1587
1588 2017-09-04  Commit Queue  <commit-queue@webkit.org>
1589
1590         Unreviewed, rolling out r221494 and r221500.
1591         https://bugs.webkit.org/show_bug.cgi?id=176258
1592
1593         This caused the windows build to fail. (Requested by mlewis13
1594         on #webkit).
1595
1596         Reverted changesets:
1597
1598         "Switch HTMLMediaElement to release logging"
1599         https://bugs.webkit.org/show_bug.cgi?id=176065
1600         http://trac.webkit.org/changeset/221494
1601
1602         "Switch HTMLMediaElement to release logging"
1603         https://bugs.webkit.org/show_bug.cgi?id=176065
1604         http://trac.webkit.org/changeset/221500
1605
1606 2017-09-03  Yusuke Suzuki  <utatane.tea@gmail.com>
1607
1608         Remove "malloc" and "free" use
1609         https://bugs.webkit.org/show_bug.cgi?id=176310
1610
1611         Reviewed by Darin Adler.
1612
1613         Use Vector instead.
1614
1615         * wtf/Assertions.cpp:
1616
1617 2017-09-04  Yusuke Suzuki  <utatane.tea@gmail.com>
1618
1619         Unreviewed, support libstdc++ use with clang
1620         https://bugs.webkit.org/show_bug.cgi?id=176301
1621
1622         * wtf/FastMalloc.h:
1623
1624 2017-09-03  Yusuke Suzuki  <utatane.tea@gmail.com>
1625
1626         [WTF] Add C++03 allocator interface for GCC < 6
1627         https://bugs.webkit.org/show_bug.cgi?id=176301
1628
1629         Reviewed by Darin Adler.
1630
1631         Unfortunately, std::list in GCC < 6 does not support C++11 allocator interface.
1632         This patch adds C++03 allocator interface to FastAllocator to make it usable
1633         for std::list. It also allows us to use FastAllocator for data structures that
1634         only support C++03 interface.
1635
1636         * wtf/FastMalloc.h:
1637         (WTF::FastAllocator::allocate):
1638         (WTF::FastAllocator::construct):
1639         (WTF::FastAllocator::destroy):
1640         (WTF::FastAllocator::max_size const):
1641         (WTF::FastAllocator::select_on_container_copy_construction const):
1642
1643 2017-09-03  Chris Dumez  <cdumez@apple.com>
1644
1645         Unreviewed, rolling out r221552.
1646
1647         Broke the build
1648
1649         Reverted changeset:
1650
1651         "[WTF] Add C++03 allocator interface for GCC < 6"
1652         https://bugs.webkit.org/show_bug.cgi?id=176301
1653         http://trac.webkit.org/changeset/221552
1654
1655 2017-09-03  Yusuke Suzuki  <utatane.tea@gmail.com>
1656
1657         [WTF] Add C++03 allocator interface for GCC < 6
1658         https://bugs.webkit.org/show_bug.cgi?id=176301
1659
1660         Reviewed by Darin Adler.
1661
1662         Unfortunately, std::list in GCC < 6 does not support C++11 allocator interface.
1663         This patch adds C++03 allocator interface to FastAllocator to make it usable
1664         for std::list. It also allows us to use FastAllocator for data structures that
1665         only support C++03 interface.
1666
1667         * wtf/FastMalloc.h:
1668         (WTF::FastAllocator::allocate):
1669         (WTF::FastAllocator::construct):
1670         (WTF::FastAllocator::destroy):
1671         (WTF::FastAllocator::max_size const):
1672         (WTF::FastAllocator::select_on_container_copy_construction const):
1673
1674 2017-09-03  Sam Weinig  <sam@webkit.org>
1675
1676         Remove CanvasProxy
1677         https://bugs.webkit.org/show_bug.cgi?id=176288
1678
1679         Reviewed by Yusuke Suzuki.
1680
1681         CanvasProxy does not appear to be in any current HTML spec
1682         and was disabled and unimplemented in our tree. Time to 
1683         get rid of it.
1684
1685         * wtf/FeatureDefines.h:
1686
1687 2017-09-01  Eric Carlson  <eric.carlson@apple.com>
1688
1689         Switch HTMLMediaElement to release logging
1690         https://bugs.webkit.org/show_bug.cgi?id=176065
1691
1692         Reviewed by Jer Noble.
1693
1694         * wtf/MediaTime.cpp:
1695         (WTF::MediaTime::dump const): Use toString.
1696         (WTF::MediaTime::toString const): New.
1697         * wtf/MediaTime.h:
1698         (PAL::LogArgument<WTF::MediaTime>::toString): Logger template.
1699
1700 2017-08-31  Don Olmstead  <don.olmstead@sony.com>
1701
1702         [CMake] Make USE_CF conditional within Windows
1703         https://bugs.webkit.org/show_bug.cgi?id=176173
1704
1705         Reviewed by Alex Christensen.
1706
1707         * wtf/Platform.h:
1708         * wtf/PlatformWin.cmake:
1709
1710 2017-08-31  Ryan Haddad  <ryanhaddad@apple.com>
1711
1712         Unreviewed, rolling out r221445.
1713
1714         This change broke Sierra Release builds.
1715
1716         Reverted changeset:
1717
1718         "Switch HTMLMediaElement to release logging"
1719         https://bugs.webkit.org/show_bug.cgi?id=176065
1720         http://trac.webkit.org/changeset/221445
1721
1722 2017-08-31  Eric Carlson  <eric.carlson@apple.com>
1723
1724         Switch HTMLMediaElement to release logging
1725         https://bugs.webkit.org/show_bug.cgi?id=176065
1726
1727         Reviewed by Jer Noble.
1728
1729         * wtf/MediaTime.cpp:
1730         (WTF::MediaTime::dump const): Use toString.
1731         (WTF::MediaTime::toString const): New.
1732         * wtf/MediaTime.h:
1733         (PAL::LogArgument<WTF::MediaTime>::toString): Logger template.
1734
1735 2017-08-31  Filip Pizlo  <fpizlo@apple.com>
1736
1737         All of the different ArrayBuffer::data's should be CagedPtr<>
1738         https://bugs.webkit.org/show_bug.cgi?id=175515
1739
1740         Reviewed by Michael Saboff.
1741         
1742         Added a specialization so that CagedPtr<void> is valid.
1743
1744         * wtf/CagedPtr.h:
1745
1746 2017-08-31  Per Arne Vollan  <pvollan@apple.com>
1747
1748         [Win] Crash under WorkQueue::performWorkOnRegisteredWorkThread in layout tests.
1749         https://bugs.webkit.org/show_bug.cgi?id=176163
1750
1751         Reviewed by Alex Christensen.
1752
1753         My previous attempt at fixing this crash in <http://trac.webkit.org/changeset/221323>
1754         was incorrect, since it is still crashing on the bot(s). The current theory of why this
1755         is failing is that the WorkQueue object deletes itself in the middle of the
1756         performWorkOnRegisteredWorkThread method when calling deref(). There is no need to
1757         increase the reference count of the work queue for each function we want to call on the
1758         work thread. It is sufficient to increase it for every work thread we start, and then
1759         dereference it when the thread ends. We should also not attempt to access members after
1760         the deref() call, which can potentially be unsafe.
1761  
1762         * wtf/win/WorkQueueWin.cpp:
1763         (WTF::WorkQueue::workThreadCallback):
1764         (WTF::WorkQueue::performWorkOnRegisteredWorkThread):
1765         (WTF::WorkQueue::dispatch):
1766
1767 2017-08-22  Filip Pizlo  <fpizlo@apple.com>
1768
1769         Strings need to be in some kind of gigacage
1770         https://bugs.webkit.org/show_bug.cgi?id=174924
1771
1772         Reviewed by Oliver Hunt.
1773         
1774         This makes all strings allocations come from the string gigacage. Because we expect string allocation
1775         to be a hot path, I created specialized allocation paths for the string gigacage. These paths are
1776         accessible via <wtf/text/StringMalloc.h>. However, those paths are equivalent to saying
1777         Gigacage::malloc and friends with the Gigacage::String kind.
1778
1779         * WTF.xcodeproj/project.pbxproj:
1780         * wtf/CMakeLists.txt:
1781         * wtf/Deque.h:
1782         * wtf/FastMalloc.cpp:
1783         (WTF::fastFree):
1784         * wtf/FastMalloc.h:
1785         (WTF::FastMalloc::malloc):
1786         (WTF::FastMalloc::tryMalloc):
1787         (WTF::FastMalloc::realloc):
1788         (WTF::FastMalloc::free):
1789         * wtf/Forward.h:
1790         * wtf/Gigacage.cpp:
1791         (Gigacage::tryMalloc):
1792         * wtf/Gigacage.h:
1793         (Gigacage::name):
1794         * wtf/Vector.h:
1795         (WTF::VectorBufferBase::allocateBuffer):
1796         (WTF::VectorBufferBase::tryAllocateBuffer):
1797         (WTF::VectorBufferBase::reallocateBuffer):
1798         (WTF::VectorBufferBase::deallocateBuffer):
1799         (WTF::Malloc>::Vector):
1800         (WTF::=):
1801         (WTF::Malloc>::contains const):
1802         (WTF::Malloc>::findMatching const):
1803         (WTF::Malloc>::find const):
1804         (WTF::Malloc>::reverseFind const):
1805         (WTF::Malloc>::appendIfNotContains):
1806         (WTF::Malloc>::fill):
1807         (WTF::Malloc>::appendRange):
1808         (WTF::Malloc>::expandCapacity):
1809         (WTF::Malloc>::tryExpandCapacity):
1810         (WTF::Malloc>::resize):
1811         (WTF::Malloc>::resizeToFit):
1812         (WTF::Malloc>::shrink):
1813         (WTF::Malloc>::grow):
1814         (WTF::Malloc>::asanSetInitialBufferSizeTo):
1815         (WTF::Malloc>::asanSetBufferSizeToFullCapacity):
1816         (WTF::Malloc>::asanBufferSizeWillChangeTo):
1817         (WTF::Malloc>::reserveCapacity):
1818         (WTF::Malloc>::tryReserveCapacity):
1819         (WTF::Malloc>::reserveInitialCapacity):
1820         (WTF::Malloc>::shrinkCapacity):
1821         (WTF::Malloc>::append):
1822         (WTF::Malloc>::tryAppend):
1823         (WTF::Malloc>::constructAndAppend):
1824         (WTF::Malloc>::tryConstructAndAppend):
1825         (WTF::Malloc>::appendSlowCase):
1826         (WTF::Malloc>::constructAndAppendSlowCase):
1827         (WTF::Malloc>::tryConstructAndAppendSlowCase):
1828         (WTF::Malloc>::uncheckedAppend):
1829         (WTF::Malloc>::appendVector):
1830         (WTF::Malloc>::insert):
1831         (WTF::Malloc>::insertVector):
1832         (WTF::Malloc>::remove):
1833         (WTF::Malloc>::removeFirst):
1834         (WTF::Malloc>::removeFirstMatching):
1835         (WTF::Malloc>::removeAll):
1836         (WTF::Malloc>::removeAllMatching):
1837         (WTF::Malloc>::reverse):
1838         (WTF::Malloc>::map const):
1839         (WTF::Malloc>::releaseBuffer):
1840         (WTF::Malloc>::checkConsistency):
1841         (WTF::swap):
1842         (WTF::operator==):
1843         (WTF::operator!=):
1844         (WTF::removeRepeatedElements):
1845         (WTF::minCapacity>::Vector): Deleted.
1846         (WTF::minCapacity>::contains const): Deleted.
1847         (WTF::minCapacity>::findMatching const): Deleted.
1848         (WTF::minCapacity>::find const): Deleted.
1849         (WTF::minCapacity>::reverseFind const): Deleted.
1850         (WTF::minCapacity>::appendIfNotContains): Deleted.
1851         (WTF::minCapacity>::fill): Deleted.
1852         (WTF::minCapacity>::appendRange): Deleted.
1853         (WTF::minCapacity>::expandCapacity): Deleted.
1854         (WTF::minCapacity>::tryExpandCapacity): Deleted.
1855         (WTF::minCapacity>::resize): Deleted.
1856         (WTF::minCapacity>::resizeToFit): Deleted.
1857         (WTF::minCapacity>::shrink): Deleted.
1858         (WTF::minCapacity>::grow): Deleted.
1859         (WTF::minCapacity>::asanSetInitialBufferSizeTo): Deleted.
1860         (WTF::minCapacity>::asanSetBufferSizeToFullCapacity): Deleted.
1861         (WTF::minCapacity>::asanBufferSizeWillChangeTo): Deleted.
1862         (WTF::minCapacity>::reserveCapacity): Deleted.
1863         (WTF::minCapacity>::tryReserveCapacity): Deleted.
1864         (WTF::minCapacity>::reserveInitialCapacity): Deleted.
1865         (WTF::minCapacity>::shrinkCapacity): Deleted.
1866         (WTF::minCapacity>::append): Deleted.
1867         (WTF::minCapacity>::tryAppend): Deleted.
1868         (WTF::minCapacity>::constructAndAppend): Deleted.
1869         (WTF::minCapacity>::tryConstructAndAppend): Deleted.
1870         (WTF::minCapacity>::appendSlowCase): Deleted.
1871         (WTF::minCapacity>::constructAndAppendSlowCase): Deleted.
1872         (WTF::minCapacity>::tryConstructAndAppendSlowCase): Deleted.
1873         (WTF::minCapacity>::uncheckedAppend): Deleted.
1874         (WTF::minCapacity>::appendVector): Deleted.
1875         (WTF::minCapacity>::insert): Deleted.
1876         (WTF::minCapacity>::insertVector): Deleted.
1877         (WTF::minCapacity>::remove): Deleted.
1878         (WTF::minCapacity>::removeFirst): Deleted.
1879         (WTF::minCapacity>::removeFirstMatching): Deleted.
1880         (WTF::minCapacity>::removeAll): Deleted.
1881         (WTF::minCapacity>::removeAllMatching): Deleted.
1882         (WTF::minCapacity>::reverse): Deleted.
1883         (WTF::minCapacity>::map const): Deleted.
1884         (WTF::minCapacity>::releaseBuffer): Deleted.
1885         (WTF::minCapacity>::checkConsistency): Deleted.
1886         * wtf/text/AtomicStringImpl.h:
1887         * wtf/text/CString.cpp:
1888         (WTF::CStringBuffer::createUninitialized):
1889         * wtf/text/CString.h:
1890         * wtf/text/StringBuffer.h:
1891         (WTF::StringBuffer::StringBuffer):
1892         (WTF::StringBuffer::~StringBuffer):
1893         (WTF::StringBuffer::resize):
1894         * wtf/text/StringImpl.cpp:
1895         (WTF::StringImpl::~StringImpl):
1896         (WTF::StringImpl::destroy):
1897         (WTF::StringImpl::createUninitializedInternalNonEmpty):
1898         (WTF::StringImpl::reallocateInternal):
1899         (WTF::StringImpl::releaseAssertCaged const):
1900         * wtf/text/StringImpl.h:
1901         (WTF::StringImpl::createSubstringSharingImpl):
1902         (WTF::StringImpl::tryCreateUninitialized):
1903         (WTF::StringImpl::adopt):
1904         (WTF::StringImpl::bufferOwnership const):
1905         (WTF::StringImpl::assertCaged const):
1906         * wtf/text/StringMalloc.cpp: Added.
1907         (WTF::tryStringMalloc):
1908         (WTF::stringMalloc):
1909         (WTF::stringRealloc):
1910         (WTF::stringFree):
1911         * wtf/text/StringMalloc.h: Added.
1912         (WTF::StringMalloc::malloc):
1913         (WTF::StringMalloc::tryMalloc):
1914         (WTF::StringMalloc::realloc):
1915         (WTF::StringMalloc::free):
1916         * wtf/text/StringVector.h: Added.
1917         * wtf/text/SymbolImpl.h:
1918         * wtf/text/UniquedStringImpl.h:
1919         * wtf/text/WTFString.h:
1920         (WTF::String::adopt):
1921         (WTF::String::assertCaged const):
1922         (WTF::String::releaseAssertCaged const):
1923
1924 2017-08-30  Chris Dumez  <cdumez@apple.com>
1925
1926         Implement FileSystemDirectoryReader.readEntries()
1927         https://bugs.webkit.org/show_bug.cgi?id=176091
1928         <rdar://problem/34168015>
1929
1930         Reviewed by Andreas Kling.
1931
1932         * wtf/CrossThreadCopier.h:
1933         (WTF::crossThreadCopy):
1934         * wtf/CrossThreadTask.h:
1935         Move crossThreadCopy() from CrossThreadTask.h to CrossThreadCopier.h and
1936         add "using WTF::crossThreadCopy" statement to make it more easily usable
1937         from WebCore.
1938
1939 2017-08-30  Matt Lewis  <jlewis3@apple.com>
1940
1941         Unreviewed, rolling out r221384.
1942
1943         This patch caused multiple 32-bit JSC test failures.
1944
1945         Reverted changeset:
1946
1947         "Strings need to be in some kind of gigacage"
1948         https://bugs.webkit.org/show_bug.cgi?id=174924
1949         http://trac.webkit.org/changeset/221384
1950
1951 2017-08-30  Brady Eidson  <beidson@apple.com>
1952
1953         Add "Identified" base class to replace a whole bunch of custom identifier generators.
1954         https://bugs.webkit.org/show_bug.cgi?id=176120
1955
1956         Reviewed by Alex Christensen.
1957
1958         * WTF.xcodeproj/project.pbxproj:
1959         * wtf/Identified.h: Added.
1960         (WTF::IdentifiedBase::identifier const):
1961         (WTF::IdentifiedBase::IdentifiedBase):
1962         (WTF::Identified::Identified):
1963         (WTF::ThreadSafeIdentified::ThreadSafeIdentified):
1964
1965 2017-08-22  Filip Pizlo  <fpizlo@apple.com>
1966
1967         Strings need to be in some kind of gigacage
1968         https://bugs.webkit.org/show_bug.cgi?id=174924
1969
1970         Reviewed by Oliver Hunt.
1971         
1972         This makes all strings allocations come from the string gigacage. Because we expect string allocation
1973         to be a hot path, I created specialized allocation paths for the string gigacage. These paths are
1974         accessible via <wtf/text/StringMalloc.h>. However, those paths are equivalent to saying
1975         Gigacage::malloc and friends with the Gigacage::String kind.
1976
1977         * WTF.xcodeproj/project.pbxproj:
1978         * wtf/CMakeLists.txt:
1979         * wtf/Deque.h:
1980         * wtf/FastMalloc.cpp:
1981         (WTF::fastFree):
1982         * wtf/FastMalloc.h:
1983         (WTF::FastMalloc::malloc):
1984         (WTF::FastMalloc::tryMalloc):
1985         (WTF::FastMalloc::realloc):
1986         (WTF::FastMalloc::free):
1987         * wtf/Forward.h:
1988         * wtf/Gigacage.cpp:
1989         (Gigacage::tryMalloc):
1990         * wtf/Gigacage.h:
1991         (Gigacage::name):
1992         * wtf/Vector.h:
1993         (WTF::VectorBufferBase::allocateBuffer):
1994         (WTF::VectorBufferBase::tryAllocateBuffer):
1995         (WTF::VectorBufferBase::reallocateBuffer):
1996         (WTF::VectorBufferBase::deallocateBuffer):
1997         (WTF::Malloc>::Vector):
1998         (WTF::=):
1999         (WTF::Malloc>::contains const):
2000         (WTF::Malloc>::findMatching const):
2001         (WTF::Malloc>::find const):
2002         (WTF::Malloc>::reverseFind const):
2003         (WTF::Malloc>::appendIfNotContains):
2004         (WTF::Malloc>::fill):
2005         (WTF::Malloc>::appendRange):
2006         (WTF::Malloc>::expandCapacity):
2007         (WTF::Malloc>::tryExpandCapacity):
2008         (WTF::Malloc>::resize):
2009         (WTF::Malloc>::resizeToFit):
2010         (WTF::Malloc>::shrink):
2011         (WTF::Malloc>::grow):
2012         (WTF::Malloc>::asanSetInitialBufferSizeTo):
2013         (WTF::Malloc>::asanSetBufferSizeToFullCapacity):
2014         (WTF::Malloc>::asanBufferSizeWillChangeTo):
2015         (WTF::Malloc>::reserveCapacity):
2016         (WTF::Malloc>::tryReserveCapacity):
2017         (WTF::Malloc>::reserveInitialCapacity):
2018         (WTF::Malloc>::shrinkCapacity):
2019         (WTF::Malloc>::append):
2020         (WTF::Malloc>::tryAppend):
2021         (WTF::Malloc>::constructAndAppend):
2022         (WTF::Malloc>::tryConstructAndAppend):
2023         (WTF::Malloc>::appendSlowCase):
2024         (WTF::Malloc>::constructAndAppendSlowCase):
2025         (WTF::Malloc>::tryConstructAndAppendSlowCase):
2026         (WTF::Malloc>::uncheckedAppend):
2027         (WTF::Malloc>::appendVector):
2028         (WTF::Malloc>::insert):
2029         (WTF::Malloc>::insertVector):
2030         (WTF::Malloc>::remove):
2031         (WTF::Malloc>::removeFirst):
2032         (WTF::Malloc>::removeFirstMatching):
2033         (WTF::Malloc>::removeAll):
2034         (WTF::Malloc>::removeAllMatching):
2035         (WTF::Malloc>::reverse):
2036         (WTF::Malloc>::map const):
2037         (WTF::Malloc>::releaseBuffer):
2038         (WTF::Malloc>::checkConsistency):
2039         (WTF::swap):
2040         (WTF::operator==):
2041         (WTF::operator!=):
2042         (WTF::removeRepeatedElements):
2043         (WTF::minCapacity>::Vector): Deleted.
2044         (WTF::minCapacity>::contains const): Deleted.
2045         (WTF::minCapacity>::findMatching const): Deleted.
2046         (WTF::minCapacity>::find const): Deleted.
2047         (WTF::minCapacity>::reverseFind const): Deleted.
2048         (WTF::minCapacity>::appendIfNotContains): Deleted.
2049         (WTF::minCapacity>::fill): Deleted.
2050         (WTF::minCapacity>::appendRange): Deleted.
2051         (WTF::minCapacity>::expandCapacity): Deleted.
2052         (WTF::minCapacity>::tryExpandCapacity): Deleted.
2053         (WTF::minCapacity>::resize): Deleted.
2054         (WTF::minCapacity>::resizeToFit): Deleted.
2055         (WTF::minCapacity>::shrink): Deleted.
2056         (WTF::minCapacity>::grow): Deleted.
2057         (WTF::minCapacity>::asanSetInitialBufferSizeTo): Deleted.
2058         (WTF::minCapacity>::asanSetBufferSizeToFullCapacity): Deleted.
2059         (WTF::minCapacity>::asanBufferSizeWillChangeTo): Deleted.
2060         (WTF::minCapacity>::reserveCapacity): Deleted.
2061         (WTF::minCapacity>::tryReserveCapacity): Deleted.
2062         (WTF::minCapacity>::reserveInitialCapacity): Deleted.
2063         (WTF::minCapacity>::shrinkCapacity): Deleted.
2064         (WTF::minCapacity>::append): Deleted.
2065         (WTF::minCapacity>::tryAppend): Deleted.
2066         (WTF::minCapacity>::constructAndAppend): Deleted.
2067         (WTF::minCapacity>::tryConstructAndAppend): Deleted.
2068         (WTF::minCapacity>::appendSlowCase): Deleted.
2069         (WTF::minCapacity>::constructAndAppendSlowCase): Deleted.
2070         (WTF::minCapacity>::tryConstructAndAppendSlowCase): Deleted.
2071         (WTF::minCapacity>::uncheckedAppend): Deleted.
2072         (WTF::minCapacity>::appendVector): Deleted.
2073         (WTF::minCapacity>::insert): Deleted.
2074         (WTF::minCapacity>::insertVector): Deleted.
2075         (WTF::minCapacity>::remove): Deleted.
2076         (WTF::minCapacity>::removeFirst): Deleted.
2077         (WTF::minCapacity>::removeFirstMatching): Deleted.
2078         (WTF::minCapacity>::removeAll): Deleted.
2079         (WTF::minCapacity>::removeAllMatching): Deleted.
2080         (WTF::minCapacity>::reverse): Deleted.
2081         (WTF::minCapacity>::map const): Deleted.
2082         (WTF::minCapacity>::releaseBuffer): Deleted.
2083         (WTF::minCapacity>::checkConsistency): Deleted.
2084         * wtf/text/AtomicStringImpl.h:
2085         * wtf/text/CString.cpp:
2086         (WTF::CStringBuffer::createUninitialized):
2087         * wtf/text/CString.h:
2088         * wtf/text/StringBuffer.h:
2089         (WTF::StringBuffer::StringBuffer):
2090         (WTF::StringBuffer::~StringBuffer):
2091         (WTF::StringBuffer::resize):
2092         * wtf/text/StringImpl.cpp:
2093         (WTF::StringImpl::~StringImpl):
2094         (WTF::StringImpl::destroy):
2095         (WTF::StringImpl::createUninitializedInternalNonEmpty):
2096         (WTF::StringImpl::reallocateInternal):
2097         (WTF::StringImpl::releaseAssertCaged const):
2098         * wtf/text/StringImpl.h:
2099         (WTF::StringImpl::createSubstringSharingImpl):
2100         (WTF::StringImpl::tryCreateUninitialized):
2101         (WTF::StringImpl::adopt):
2102         (WTF::StringImpl::bufferOwnership const):
2103         (WTF::StringImpl::assertCaged const):
2104         * wtf/text/StringMalloc.cpp: Added.
2105         (WTF::tryStringMalloc):
2106         (WTF::stringMalloc):
2107         (WTF::stringRealloc):
2108         (WTF::stringFree):
2109         * wtf/text/StringMalloc.h: Added.
2110         (WTF::StringMalloc::malloc):
2111         (WTF::StringMalloc::tryMalloc):
2112         (WTF::StringMalloc::realloc):
2113         (WTF::StringMalloc::free):
2114         * wtf/text/StringVector.h: Added.
2115         * wtf/text/SymbolImpl.h:
2116         * wtf/text/UniquedStringImpl.h:
2117         * wtf/text/WTFString.h:
2118         (WTF::String::adopt):
2119         (WTF::String::assertCaged const):
2120         (WTF::String::releaseAssertCaged const):
2121
2122 2017-08-28  Yusuke Suzuki  <utatane.tea@gmail.com>
2123
2124         [JSC] Use table based approach for JSON.stringify's Quote
2125         https://bugs.webkit.org/show_bug.cgi?id=176044
2126
2127         Reviewed by Darin Adler.
2128
2129         We change escape operation of JSON Quote from branch-based to table-based.
2130         This patch partially adopts SpiderMonkey's change to StringBuilderJSON.cpp
2131         to optimize this escaping operation. We separate changes from StringBuilder.cpp
2132         to apply MPL to StringBuilderJSON.cpp file. Since WebKit already adopts MPL in
2133         some files (like, DateMath.h), it is acceptable.
2134
2135         Kraken json-stringify-tinderbox shows 7.2% improvement.
2136
2137                                            baseline                  patched
2138
2139         json-stringify-tinderbox        40.429+-0.771      ^      37.693+-0.862         ^ definitely 1.0726x faster
2140
2141         * WTF.xcodeproj/project.pbxproj:
2142         * wtf/CMakeLists.txt:
2143         * wtf/text/StringBuilder.cpp:
2144         (WTF::appendQuotedJSONStringInternalSlow): Deleted.
2145         (WTF::appendQuotedJSONStringInternal): Deleted.
2146         (WTF::StringBuilder::appendQuotedJSONString): Deleted.
2147         * wtf/text/StringBuilderJSON.cpp: Added.
2148         (WTF::appendQuotedJSONStringInternal):
2149         (WTF::StringBuilder::appendQuotedJSONString):
2150
2151 2017-08-29  Per Arne Vollan  <pvollan@apple.com>
2152
2153         [Win] Crash under WorkQueue::performWorkOnRegisteredWorkThread in layout tests.
2154         https://bugs.webkit.org/show_bug.cgi?id=176064
2155
2156         Reviewed by Saam Barati.
2157
2158         The crash log indicates that the function pointer is null in this case.
2159
2160         * wtf/win/WorkQueueWin.cpp:
2161         (WTF::WorkQueue::dispatch):
2162
2163 2017-08-28  Andy Estes  <aestes@apple.com>
2164
2165         [Cocoa] Upstream WKGetWebDefaultCFStringEncoding()
2166         https://bugs.webkit.org/show_bug.cgi?id=176039
2167
2168         Reviewed by Alex Christensen.
2169
2170         * wtf/spi/cf/CFStringSPI.h:
2171
2172 2017-08-26  Yusuke Suzuki  <utatane.tea@gmail.com>
2173
2174         Unreviewed, suppress warnings in GTK port
2175
2176         Add printf format attribute.
2177
2178         * wtf/text/WTFString.cpp:
2179
2180 2017-08-25  Eric Carlson  <eric.carlson@apple.com>
2181
2182         Add Logger::logAlways
2183         https://bugs.webkit.org/show_bug.cgi?id=175996
2184
2185         Reviewed by Jer Noble.
2186
2187         * wtf/Assertions.cpp:
2188         * wtf/Assertions.h:
2189
2190 2017-08-25  Daniel Bates  <dabates@apple.com>
2191
2192         Demarcate code added due to lack of NSDMI for aggregates
2193         https://bugs.webkit.org/show_bug.cgi?id=175990
2194
2195         Reviewed by Andy Estes.
2196
2197         * wtf/Compiler.h:
2198
2199 2017-08-25  Don Olmstead  <don.olmstead@sony.com>
2200
2201         Define *_GIGACAGE_MASK when Gigacage is not supported
2202         https://bugs.webkit.org/show_bug.cgi?id=175994
2203
2204         Reviewed by Mark Lam.
2205
2206         * wtf/Gigacage.h:
2207
2208 2017-08-25  Eric Carlson  <eric.carlson@apple.com>
2209
2210         Add String::format variant that takes va_args
2211         https://bugs.webkit.org/show_bug.cgi?id=175988
2212
2213         Reviewed by Jer Noble.
2214
2215         * wtf/text/WTFString.cpp:
2216         (WTF::createWithFormatAndArguments): Created with the guts of String::format.
2217         (WTF::String::formatWithArguments): New, call createWithFormatAndArguments.
2218         (WTF::String::format): Move logic to createWithFormatAndArguments, use it.
2219         * wtf/text/WTFString.h:
2220
2221 2017-08-25  Saam Barati  <sbarati@apple.com>
2222
2223         Support compiling catch in the DFG
2224         https://bugs.webkit.org/show_bug.cgi?id=174590
2225         <rdar://problem/34047845>
2226
2227         Reviewed by Filip Pizlo.
2228
2229         This patch generalizes the BackwardsGraph fake root into a more generalizable
2230         class called SingleRootGraph. SingleRootGraph exposes the general graph interface
2231         used in Dominators and NaturalLoops. SingleRootGraph takes as input a graph with
2232         the normal graph interface, but also allows the input graph to contain more than
2233         one root. SingleRootGraph then exposes a single root, which it creates, that has
2234         an outgoing edge to all the roots in the original graph.
2235
2236         * WTF.xcodeproj/project.pbxproj:
2237         * wtf/BackwardsGraph.h:
2238         (WTF::BackwardsGraph::dump const):
2239         (WTF::BackwardsGraph::rootName): Deleted.
2240         (WTF::BackwardsGraph::Node::Node): Deleted.
2241         (WTF::BackwardsGraph::Node::root): Deleted.
2242         (WTF::BackwardsGraph::Node::operator== const): Deleted.
2243         (WTF::BackwardsGraph::Node::operator!= const): Deleted.
2244         (WTF::BackwardsGraph::Node::operator bool const): Deleted.
2245         (WTF::BackwardsGraph::Node::isRoot const): Deleted.
2246         (WTF::BackwardsGraph::Node::node const): Deleted.
2247         (): Deleted.
2248         (WTF::BackwardsGraph::Set::Set): Deleted.
2249         (WTF::BackwardsGraph::Set::add): Deleted.
2250         (WTF::BackwardsGraph::Set::remove): Deleted.
2251         (WTF::BackwardsGraph::Set::contains): Deleted.
2252         (WTF::BackwardsGraph::Set::dump const): Deleted.
2253         (WTF::BackwardsGraph::Map::Map): Deleted.
2254         (WTF::BackwardsGraph::Map::clear): Deleted.
2255         (WTF::BackwardsGraph::Map::size const): Deleted.
2256         (WTF::BackwardsGraph::Map::operator[]): Deleted.
2257         (WTF::BackwardsGraph::Map::operator[] const): Deleted.
2258         * wtf/Dominators.h:
2259         (WTF::Dominators::Dominators):
2260         (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf):
2261         (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf):
2262         (WTF::Dominators::iteratedDominanceFrontierOf const):
2263         (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl const):
2264         * wtf/SingleRootGraph.h: Added.
2265         (WTF::SingleRootGraphNode::rootName):
2266         (WTF::SingleRootGraphNode::SingleRootGraphNode):
2267         (WTF::SingleRootGraphNode::root):
2268         (WTF::SingleRootGraphNode::operator== const):
2269         (WTF::SingleRootGraphNode::operator!= const):
2270         (WTF::SingleRootGraphNode::operator bool const):
2271         (WTF::SingleRootGraphNode::isRoot const):
2272         (WTF::SingleRootGraphNode::node const):
2273         (WTF::SingleRootGraphSet::add):
2274         (WTF::SingleRootGraphSet::remove):
2275         (WTF::SingleRootGraphSet::contains):
2276         (WTF::SingleRootGraphSet::dump const):
2277         (WTF::SingleRootMap::SingleRootMap):
2278         (WTF::SingleRootMap::clear):
2279         (WTF::SingleRootMap::size const):
2280         (WTF::SingleRootMap::operator[]):
2281         (WTF::SingleRootMap::operator[] const):
2282         (WTF::SingleRootGraph::SingleRootGraph):
2283         (WTF::SingleRootGraph::root const):
2284         (WTF::SingleRootGraph::newMap):
2285         (WTF::SingleRootGraph::successors const):
2286         (WTF::SingleRootGraph::predecessors const):
2287         (WTF::SingleRootGraph::index const):
2288         (WTF::SingleRootGraph::node const):
2289         (WTF::SingleRootGraph::numNodes const):
2290         (WTF::SingleRootGraph::dump const):
2291         (WTF::SingleRootGraph::assertIsConsistent const):
2292
2293 2017-08-24  Commit Queue  <commit-queue@webkit.org>
2294
2295         Unreviewed, rolling out r221119, r221124, and r221143.
2296         https://bugs.webkit.org/show_bug.cgi?id=175973
2297
2298         "I think it regressed JSBench by 20%" (Requested by saamyjoon
2299         on #webkit).
2300
2301         Reverted changesets:
2302
2303         "Support compiling catch in the DFG"
2304         https://bugs.webkit.org/show_bug.cgi?id=174590
2305         http://trac.webkit.org/changeset/221119
2306
2307         "Unreviewed, build fix in GTK port"
2308         https://bugs.webkit.org/show_bug.cgi?id=174590
2309         http://trac.webkit.org/changeset/221124
2310
2311         "DFG::JITCode::osrEntry should get sorted since we perform a
2312         binary search on it"
2313         https://bugs.webkit.org/show_bug.cgi?id=175893
2314         http://trac.webkit.org/changeset/221143
2315
2316 2017-08-23  Filip Pizlo  <fpizlo@apple.com>
2317
2318         Reduce Gigacage sizes
2319         https://bugs.webkit.org/show_bug.cgi?id=175920
2320
2321         Reviewed by Mark Lam.
2322
2323         Provide filler API for the no-bmalloc/no-Gigacage case.
2324
2325         * wtf/Gigacage.h:
2326         (Gigacage::mask):
2327
2328 2017-08-23  Yusuke Suzuki  <utatane.tea@gmail.com>
2329
2330         Unreviewed, build fix in GTK port
2331         https://bugs.webkit.org/show_bug.cgi?id=174590
2332
2333         * wtf/SingleRootGraph.h:
2334         (WTF::SingleRootGraph::successors const):
2335         (WTF::SingleRootGraph::predecessors const):
2336
2337 2017-08-23  Saam Barati  <sbarati@apple.com>
2338
2339         Support compiling catch in the DFG
2340         https://bugs.webkit.org/show_bug.cgi?id=174590
2341
2342         Reviewed by Filip Pizlo.
2343
2344         This patch generalizes the BackwardsGraph fake root into a more generalizable
2345         class called SingleRootGraph. SingleRootGraph exposes the general graph interface
2346         used in Dominators and NaturalLoops. SingleRootGraph takes as input a graph with
2347         the normal graph interface, but also allows the input graph to contain more than
2348         one root. SingleRootGraph then exposes a single root, which it creates, that has
2349         an outgoing edge to all the roots in the original graph.
2350
2351         * WTF.xcodeproj/project.pbxproj:
2352         * wtf/BackwardsGraph.h:
2353         (WTF::BackwardsGraph::dump const):
2354         (WTF::BackwardsGraph::rootName): Deleted.
2355         (WTF::BackwardsGraph::Node::Node): Deleted.
2356         (WTF::BackwardsGraph::Node::root): Deleted.
2357         (WTF::BackwardsGraph::Node::operator== const): Deleted.
2358         (WTF::BackwardsGraph::Node::operator!= const): Deleted.
2359         (WTF::BackwardsGraph::Node::operator bool const): Deleted.
2360         (WTF::BackwardsGraph::Node::isRoot const): Deleted.
2361         (WTF::BackwardsGraph::Node::node const): Deleted.
2362         (): Deleted.
2363         (WTF::BackwardsGraph::Set::Set): Deleted.
2364         (WTF::BackwardsGraph::Set::add): Deleted.
2365         (WTF::BackwardsGraph::Set::remove): Deleted.
2366         (WTF::BackwardsGraph::Set::contains): Deleted.
2367         (WTF::BackwardsGraph::Set::dump const): Deleted.
2368         (WTF::BackwardsGraph::Map::Map): Deleted.
2369         (WTF::BackwardsGraph::Map::clear): Deleted.
2370         (WTF::BackwardsGraph::Map::size const): Deleted.
2371         (WTF::BackwardsGraph::Map::operator[]): Deleted.
2372         (WTF::BackwardsGraph::Map::operator[] const): Deleted.
2373         * wtf/Dominators.h:
2374         (WTF::Dominators::Dominators):
2375         (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf):
2376         (WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf):
2377         (WTF::Dominators::iteratedDominanceFrontierOf const):
2378         (WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl const):
2379         * wtf/SingleRootGraph.h: Added.
2380         (WTF::SingleRootGraphNode::rootName):
2381         (WTF::SingleRootGraphNode::SingleRootGraphNode):
2382         (WTF::SingleRootGraphNode::root):
2383         (WTF::SingleRootGraphNode::operator== const):
2384         (WTF::SingleRootGraphNode::operator!= const):
2385         (WTF::SingleRootGraphNode::operator bool const):
2386         (WTF::SingleRootGraphNode::isRoot const):
2387         (WTF::SingleRootGraphNode::node const):
2388         (WTF::SingleRootGraphSet::add):
2389         (WTF::SingleRootGraphSet::remove):
2390         (WTF::SingleRootGraphSet::contains):
2391         (WTF::SingleRootGraphSet::dump const):
2392         (WTF::SingleRootMap::SingleRootMap):
2393         (WTF::SingleRootMap::clear):
2394         (WTF::SingleRootMap::size const):
2395         (WTF::SingleRootMap::operator[]):
2396         (WTF::SingleRootMap::operator[] const):
2397         (WTF::SingleRootGraph::SingleRootGraph):
2398         (WTF::SingleRootGraph::root const):
2399         (WTF::SingleRootGraph::newMap):
2400         (WTF::SingleRootGraph::successors const):
2401         (WTF::SingleRootGraph::predecessors const):
2402         (WTF::SingleRootGraph::index const):
2403         (WTF::SingleRootGraph::node const):
2404         (WTF::SingleRootGraph::numNodes const):
2405         (WTF::SingleRootGraph::dump const):
2406         (WTF::SingleRootGraph::assertIsConsistent const):
2407
2408 2017-08-23  Youenn Fablet  <youenn@apple.com>
2409
2410         [Cache API] Enable persistent coder to encode FetchOptions
2411         https://bugs.webkit.org/show_bug.cgi?id=175883
2412
2413         Reviewed by Alex Christensen.
2414
2415         Enabling encoding/decoding of enums with EnumTraits.
2416         This code is similar to the one of IPC encoder/decoder.
2417
2418         * wtf/persistence/PersistentDecoder.h:
2419         (WTF::Persistence::Decoder::decode):
2420         * wtf/persistence/PersistentEncoder.h:
2421         (WTF::Persistence::Encoder::encode):
2422
2423 2017-08-23  Per Arne Vollan  <pvollan@apple.com>
2424
2425         [Win] Compile error, include file <wtf/AVFoundationHeaderDetection.h> is not found.
2426         https://bugs.webkit.org/show_bug.cgi?id=175853
2427
2428         Reviewed by Brent Fulgham.
2429
2430         Copy generated WTF header files to the same place as we copy forwarding headers.
2431  
2432         * WTF.vcxproj/WTF.proj:
2433
2434 2017-08-22  Chris Dumez  <cdumez@apple.com>
2435
2436         Introduce a new CompletionHandler type and use it for NetworkDataTaskClient's completion handlers to help catch bugs
2437         https://bugs.webkit.org/show_bug.cgi?id=175832
2438
2439         Reviewed by Alex Christensen.
2440
2441         Introduce a new CompletionHandler type which wraps a WTF::Function and ensures via assertions
2442         that the function is always called once and only once.
2443
2444         * WTF.xcodeproj/project.pbxproj:
2445         * wtf/CompletionHandler.h: Added.
2446         (WTF::CompletionHandler<Out):
2447
2448 2017-08-22  Alex Christensen  <achristensen@webkit.org>
2449
2450         Fix Windows build after r221017.
2451         https://bugs.webkit.org/show_bug.cgi?id=157053
2452
2453         * wtf/PlatformWin.cmake:
2454
2455 2017-08-22  Per Arne Vollan  <pvollan@apple.com>
2456
2457         Implement 64-bit MacroAssembler::probe support for Windows.
2458         https://bugs.webkit.org/show_bug.cgi?id=175724
2459
2460         Reviewed by Mark Lam.
2461
2462         Enable masm probe and DFG.
2463
2464         * wtf/Platform.h:
2465
2466 2017-08-21  Mark Lam  <mark.lam@apple.com>
2467
2468         [Follow up]: Add back the ability to disable MASM_PROBE from the build.
2469         https://bugs.webkit.org/show_bug.cgi?id=175656
2470         <rdar://problem/33933720>
2471
2472         Not reviewed.
2473
2474         Fixed a typo: should be "OS(WINDOWS)", not "OS(WINDOW)".
2475
2476         * wtf/Platform.h:
2477
2478 2017-08-21  Carlos Alberto Lopez Perez  <clopez@igalia.com>
2479
2480         [GTK] ARMv7 build fails to build MacroAssemblerARMv7.cpp.
2481         https://bugs.webkit.org/show_bug.cgi?id=175514
2482
2483         Reviewed by Keith Miller.
2484
2485         * wtf/Platform.h: Enable DFG and MASM_PROBE back for GTK ARM_THUMB2.
2486
2487 2017-08-20  Sam Weinig  <sam@webkit.org>
2488
2489         StringView could use a function to strip leading/trailing characters without allocation
2490         https://bugs.webkit.org/show_bug.cgi?id=175757
2491
2492         Reviewed by Darin Adler.
2493
2494         There are many places in WebCore/WebKit that we call functions like, 
2495         WebCore::stripLeadingAndTrailingHTMLSpaces,  or String::stripWhiteSpace() only to use 
2496         the allocated String as a temporary for either another transformation or a comparison.
2497         Now that we have StringView, we can avoid that extra allocation, by having returning a
2498         StringView  substring in these scenarios.
2499
2500         For instance, the check (from ScriptElement.cpp:287):
2501
2502         if (!stripLeadingAndTrailingHTMLSpaces(sourceURL).isEmpty()) {
2503             ...
2504         }
2505
2506         currently allocates a string just to make this check. With a new 
2507         stripLeadingAndTrailingHTMLSpaces such as:
2508
2509         StringView stripLeadingAndTrailingHTMLSpaces(StringView stringView)
2510         {
2511             return stringView.stripLeadingAndTrailingMatchedCharacters([] (auto c) {
2512                 return isHTMLSpace(c);
2513             });
2514         }
2515
2516         We could instead have exact same code from ScriptElement.cpp now avoid an allocation.
2517
2518         * wtf/text/StringView.h:
2519         (WTF::StringView::stripLeadingAndTrailingMatchedCharacters):
2520
2521 2017-08-21  Eric Carlson  <eric.carlson@apple.com>
2522
2523         Add WTFLogChannel level to allow runtime log filtering
2524         https://bugs.webkit.org/show_bug.cgi?id=175731
2525         <rdar://problem/33967234>
2526
2527         Reviewed by Jer Noble.
2528         
2529         Add WTFLog*, LOG, and RELEASE_LOG variants that take a "log level" parameter so code
2530         can include logging statements that are only conditionally emitted.
2531
2532         * wtf/Assertions.cpp:
2533         * wtf/Assertions.h:
2534         * wtf/MemoryPressureHandler.cpp:
2535         * wtf/RefCountedLeakCounter.cpp:
2536
2537 2017-08-20  Mark Lam  <mark.lam@apple.com>
2538
2539         Gardening: fix CLoop build.
2540         https://bugs.webkit.org/show_bug.cgi?id=175688
2541         <rdar://problem/33436870>
2542
2543         Not reviewed.
2544
2545         Disable MASM_PROBE if !ENABLE(JIT).
2546
2547         * wtf/Platform.h:
2548
2549 2017-08-18  Ryan Haddad  <ryanhaddad@apple.com>
2550
2551         Unreviewed, rolling out r220938.
2552
2553         The API tests added with this change are failing.
2554
2555         Reverted changeset:
2556
2557         "Add WTFLogChannel level to allow runtime log filtering"
2558         https://bugs.webkit.org/show_bug.cgi?id=175731
2559         http://trac.webkit.org/changeset/220938
2560
2561 2017-08-18  Eric Carlson  <eric.carlson@apple.com>
2562
2563         Add WTFLogChannel level to allow runtime log filtering
2564         https://bugs.webkit.org/show_bug.cgi?id=175731
2565         <rdar://problem/33967234>
2566
2567         Reviewed by Jer Noble.
2568         
2569         Add WTFLog*, LOG, and RELEASE_LOG variants that take a "log level" parameter so code
2570         can include logging statements that are only conditionally emitted.
2571
2572         * wtf/Assertions.cpp:
2573         * wtf/Assertions.h:
2574         * wtf/MemoryPressureHandler.cpp:
2575         * wtf/RefCountedLeakCounter.cpp:
2576
2577 2017-08-18  Per Arne Vollan  <pvollan@apple.com>
2578
2579         Implement 32-bit MacroAssembler::probe support for Windows.
2580         https://bugs.webkit.org/show_bug.cgi?id=175449
2581
2582         Reviewed by Mark Lam.
2583
2584         Enable the DFG on Win32. 
2585
2586         * wtf/Platform.h:
2587
2588 2017-08-17  Mark Lam  <mark.lam@apple.com>
2589
2590         Only use 16 VFP registers if !CPU(ARM_NEON).
2591         https://bugs.webkit.org/show_bug.cgi?id=175514
2592
2593         Reviewed by JF Bastien.
2594
2595         If CPU(ARM_NEON) is not enabled, we'll conservatively assume only VFP2 support is
2596         available. Hence, we'll only the first 16 FPDoubleRegisterIDs are available.
2597
2598         For reference, see:
2599         NEON registers: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0473c/CJACABEJ.html
2600         VFP2 and VFP3 registers: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0473c/CIHDIBDG.html
2601         NEON to VFP register mapping: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0473c/CJAIJHFC.html
2602
2603         This is mostly for GTK toolchains which may target older ARM CPUs which only have
2604         VFP2 support.
2605
2606         * wtf/Platform.h:
2607
2608 2017-08-16  Mark Lam  <mark.lam@apple.com>
2609
2610         Add back the ability to disable MASM_PROBE from the build.
2611         https://bugs.webkit.org/show_bug.cgi?id=175656
2612         <rdar://problem/33933720>
2613
2614         Reviewed by Yusuke Suzuki.
2615
2616         * wtf/Platform.h:
2617
2618 2017-08-16  Mark Lam  <mark.lam@apple.com>
2619
2620         Gardening: fix GTK ARM_THUMB2 build.
2621         https://bugs.webkit.org/show_bug.cgi?id=175446
2622
2623         Not reviewed.
2624
2625         Disable the use of the DFG for GTK ARM_THUMB2 builds until
2626         https://bugs.webkit.org/show_bug.cgi?id=175514 is fixed.
2627
2628         * wtf/Platform.h:
2629
2630 2017-08-16  Andy Estes  <aestes@apple.com>
2631
2632         [Payment Request] Add an ENABLE flag and an experimental feature preference
2633         https://bugs.webkit.org/show_bug.cgi?id=175622
2634
2635         Reviewed by Tim Horton.
2636
2637         * wtf/FeatureDefines.h:
2638
2639 2017-08-14  Simon Fraser  <simon.fraser@apple.com>
2640
2641         Remove Proximity Events and related code
2642         https://bugs.webkit.org/show_bug.cgi?id=175545
2643
2644         Reviewed by Daniel Bates.
2645
2646         No platform enables Proximity Events, so remove code inside ENABLE(PROXIMITY_EVENTS)
2647         and other related code.
2648
2649         * wtf/FeatureDefines.h:
2650
2651 2017-08-14  Simon Fraser  <simon.fraser@apple.com>
2652
2653         Remove ENABLE(REQUEST_AUTOCOMPLETE) code, which was disabled everywhere
2654         https://bugs.webkit.org/show_bug.cgi?id=175504
2655
2656         Reviewed by Sam Weinig.
2657
2658         * wtf/FeatureDefines.h:
2659
2660 2017-08-14  Simon Fraser  <simon.fraser@apple.com>
2661
2662         Remove ENABLE_VIEW_MODE_CSS_MEDIA and related code
2663         https://bugs.webkit.org/show_bug.cgi?id=175557
2664
2665         Reviewed by Jon Lee.
2666
2667         No port cares about the ENABLE(VIEW_MODE_CSS_MEDIA) feature, so remove it.
2668
2669         * wtf/FeatureDefines.h:
2670
2671 2017-08-12  Filip Pizlo  <fpizlo@apple.com>
2672
2673         Put the ScopedArgumentsTable's ScopeOffset array in some gigacage
2674         https://bugs.webkit.org/show_bug.cgi?id=174921
2675
2676         Reviewed by Mark Lam.
2677         
2678         If you want to std::unique_ptr a class that knows that it should be in the Gigacage, then we
2679         would create the Gigacage equivalent of WTF_MAKE_FAST_ALLOCATED and it would just work.
2680         
2681         But this does not work if we want to std::unique_ptr a primitive type. So, this patch adds a
2682         solution for this problem: CagedUniquePtr<>. This will handle allocation
2683         (CagedUniquePtr<>::create()) and deallocation (in the style of std::unique_ptr). It has three
2684         variants:
2685         
2686         - Non-array types.
2687         - Arrays that don't have destructors.
2688         - Arrays that have destructors.
2689         
2690         Just like std::unique_ptr, the array case is triggered by saying "[]" at the end of the type.
2691         
2692         Unlike std::unique_ptr and most other smart pointers, the whole point of this smart pointer is
2693         to dictate where the thing you're pointing at is allocated. For this reason, it has to know how
2694         to do things like the array destructor protocol. So it creates its own: the CagedUniquePtr for
2695         arrays with destructors is a fat pointer that remembers the length of the array.
2696         
2697         CagedUniquePtr<> makes it impossible to leak/release the pointer. This is stricter than what
2698         std::unique_ptr does, and is probably appropriate for all of the places where we would use this
2699         type.
2700         
2701         So far, we only use it for ScopedArgumentsTable::m_arguments, but I suspect that it will be
2702         useful in other places.
2703
2704         * WTF.xcodeproj/project.pbxproj:
2705         * wtf/CMakeLists.txt:
2706         * wtf/CagedUniquePtr.h: Added.
2707         (WTF::CagedUniquePtr::CagedUniquePtr):
2708         (WTF::CagedUniquePtr::create):
2709         (WTF::CagedUniquePtr::operator=):
2710         (WTF::CagedUniquePtr::~CagedUniquePtr):
2711         (WTF::CagedUniquePtr::get const):
2712         (WTF::CagedUniquePtr::getMayBeNull const):
2713         (WTF::CagedUniquePtr::operator== const):
2714         (WTF::CagedUniquePtr::operator!= const):
2715         (WTF::CagedUniquePtr::operator bool const):
2716         (WTF::CagedUniquePtr::operator* const):
2717         (WTF::CagedUniquePtr::operator-> const):
2718         (WTF::CagedUniquePtr::operator[] const):
2719         (WTF::CagedUniquePtr::destroy):
2720         * wtf/Gigacage.cpp:
2721         (Gigacage::tryMallocArray):
2722         (Gigacage::malloc):
2723         (Gigacage::mallocArray):
2724         * wtf/Gigacage.h:
2725
2726 2017-08-11  Ryosuke Niwa  <rniwa@webkit.org>
2727
2728         Replace DATA_TRANSFER_ITEMS by a runtime flag and add a stub implementation
2729         https://bugs.webkit.org/show_bug.cgi?id=175474
2730
2731         Reviewed by Wenson Hsieh.
2732
2733         * wtf/FeatureDefines.h:
2734
2735 2017-08-11  Don Olmstead  <don.olmstead@sony.com>
2736
2737         [WTF] Move ValueToString into WTF
2738         https://bugs.webkit.org/show_bug.cgi?id=175469
2739
2740         Reviewed by Sam Weinig.
2741
2742         * WTF.xcodeproj/project.pbxproj:
2743         * wtf/CMakeLists.txt:
2744         * wtf/text/ValueToString.h: Renamed from Source/WebCore/platform/ValueToString.h.
2745
2746 2017-08-11  Tim Horton  <timothy_horton@apple.com>
2747
2748         Fix the build with modern Clang's -Wexpansion-to-defined
2749         https://bugs.webkit.org/show_bug.cgi?id=175467
2750         <rdar://problem/33667497>
2751
2752         Reviewed by Simon Fraser.
2753
2754         * wtf/FeatureDefines.h:
2755         * wtf/Platform.h:
2756         Avoid object-like macros that expand to include defined(), because this
2757         behaves inconsistently between different compilers (though in ways
2758         that don't matter for these particular defines, which aren't used on MSVC),
2759         and Clang has added a warning for it.
2760
2761         Move ENABLE_WEBASSEMBLY to Platform.h since it depends on things that
2762         are defined there and can't be evaluated at time-of-use because of the
2763         aforementioned new rules. Previously, there was a cycle between
2764         ENABLE_WEBASSEMBLY and ENABLE_B3_JIT -- break that so that it just
2765         goes FTL_JIT->B3_JIT->WASM instead.
2766
2767 2017-08-10  Sam Weinig  <sam@webkit.org>
2768
2769         WTF::Function does not allow for reference / non-default constructible return types
2770         https://bugs.webkit.org/show_bug.cgi?id=175244
2771
2772         Reviewed by Chris Dumez.
2773
2774         When Function, then NoncopyableFunction, was templatized to allow non-void return values
2775         in r201493, it maintained the behavior of being callable even if the Function was null.
2776         To accomplish this, when null, the default construction of the return parameter was used.
2777         This means Function can't be used with return types that are not default constructible,
2778         such as reference types and Ref.
2779
2780         This behavior of returning something when null is surprising, as this is not how normal
2781         functions behave, and not very useful. Instead, we now assert that the function is not
2782         null when being called.
2783
2784         * wtf/Function.h:
2785         (WTF::Function operator(...)):
2786         Instead of allowing a null callable wrapper by returning the default construction of
2787         the return type, assert that the wrapper is there when calling a Function.
2788
2789 2017-08-10  Mark Lam  <mark.lam@apple.com>
2790
2791         Make the MASM_PROBE mechanism mandatory for DFG and FTL builds.
2792         https://bugs.webkit.org/show_bug.cgi?id=175446
2793         <rdar://problem/33836545>
2794
2795         Reviewed by Saam Barati.
2796
2797         This is needed in order to support https://bugs.webkit.org/show_bug.cgi?id=174645.
2798         One consequence of this is that the DFG will now be disabled for the MIPS and
2799         Windows ports. See:
2800             https://bugs.webkit.org/show_bug.cgi?id=175447
2801             https://bugs.webkit.org/show_bug.cgi?id=175449
2802
2803         Also, we should only ENABLE_SIGNAL_BASED_VM_TRAPS if the DFG is enabled.  It was
2804         never meaningful to use SIGNAL_BASED_VM_TRAPS with the baseline JIT anyway.  This
2805         is a mis-configuration error that is now fixed.
2806
2807         * wtf/Platform.h:
2808
2809 2017-08-10  Brady Eidson  <beidson@apple.com>
2810
2811         Rename the source files for the WTF persistent coders.
2812         https://bugs.webkit.org/show_bug.cgi?id=175441
2813
2814         Reviewed by Tim Horton.
2815
2816         * WTF.xcodeproj/project.pbxproj:
2817         * wtf/CMakeLists.txt:
2818
2819         * wtf/persistence/PersistentCoder.h: Renamed from Source/WTF/wtf/persistence/Coder.h.
2820         * wtf/persistence/PersistentCoders.cpp: Renamed from Source/WTF/wtf/persistence/Coders.cpp.
2821         * wtf/persistence/PersistentCoders.h: Renamed from Source/WTF/wtf/persistence/Coders.h.
2822         * wtf/persistence/PersistentDecoder.cpp: Renamed from Source/WTF/wtf/persistence/Decoder.cpp.
2823         * wtf/persistence/PersistentDecoder.h: Renamed from Source/WTF/wtf/persistence/Decoder.h.
2824         * wtf/persistence/PersistentEncoder.cpp: Renamed from Source/WTF/wtf/persistence/Encoder.cpp.
2825         * wtf/persistence/PersistentEncoder.h: Renamed from Source/WTF/wtf/persistence/Encoder.h.
2826
2827 2017-08-10  Yusuke Suzuki  <utatane.tea@gmail.com>
2828
2829         Unreviewed, attempt to fix build failure with VC2017
2830
2831         * wtf/PriorityQueue.h:
2832
2833 2017-08-10  Yusuke Suzuki  <utatane.tea@gmail.com>
2834
2835         Run more WTF tests
2836         https://bugs.webkit.org/show_bug.cgi?id=174970
2837
2838         Reviewed by Michael Catanzaro.
2839
2840         CHAR_BIT is not defined.
2841
2842         * wtf/LEBDecoder.h:
2843
2844 2017-08-09  Yusuke Suzuki  <utatane.tea@gmail.com>
2845
2846         [WTF] ThreadSpecific should not introduce additional indirection
2847         https://bugs.webkit.org/show_bug.cgi?id=175187
2848
2849         Reviewed by Mark Lam.
2850
2851         ThreadSpecific sets Data* to the TLS. And Data holds T*, which
2852         is fast allocated actual data. But ideally, we should store T
2853         instance directly in Data instead of introducing an additional
2854         indirection.
2855
2856         This patch adds storage in Data in order to embed the instance of T. The constructor
2857         for Data will invoke the constructor for T on the embedded storage. We also drop
2858         ThreadSpecific::replace which is only used by the web thread to set its thread specific
2859         ThreadGlobalData to the one shared from the main thread. The existing implementation
2860         relies on the main thread and the web thread never exiting in order for the shared
2861         ThreadGlobalData to stay alive. We can achieve the same semantics by using a
2862         ThreadSpecific<std::unique_ptr<T>> to hold the ThreadGlobalData instance instead.
2863
2864         * wtf/ThreadSpecific.h:
2865         (WTF::ThreadSpecific::Data::construct):
2866         (WTF::ThreadSpecific::Data::Data):
2867         We make it fast allocated since we previously allocated ThreadSpecific T data by fastMalloc.
2868
2869         (WTF::ThreadSpecific::Data::~Data):
2870         (WTF::ThreadSpecific::Data::storagePointer const):
2871         (WTF::canBeGCThread>::get):
2872         We also drop RELEASE_ASSERT from ::get(). We already inserted this assert to setAndConstruct(),
2873         so when creating the member to this TLS, we execute this release assert. So it is
2874         not necessary to execute this assertion every time we get data from this TLS.
2875
2876         (WTF::canBeGCThread>::set):
2877         (WTF::canBeGCThread>::destroy):
2878         (WTF::canBeGCThread>::setAndConstruct):
2879         (WTF::T):
2880         (WTF::canBeGCThread>::replace): Deleted.
2881
2882 2017-08-10  Tim Horton  <timothy_horton@apple.com>
2883
2884         Fix a silly typo in Compiler.h
2885
2886         * wtf/Compiler.h:
2887         Heature, indeed.
2888
2889 2017-08-10  Michael Catanzaro  <mcatanzaro@igalia.com>
2890
2891         Remove ENABLE_GAMEPAD_DEPRECATED
2892         https://bugs.webkit.org/show_bug.cgi?id=175361
2893
2894         Reviewed by Carlos Garcia Campos.
2895
2896         * wtf/FeatureDefines.h:
2897
2898 2017-08-09  Don Olmstead  <don.olmstead@sony.com>
2899
2900         [WTF] Move TextStream into WTF
2901         https://bugs.webkit.org/show_bug.cgi?id=175211
2902
2903         Reviewed by Myles C. Maxfield.
2904
2905         * WTF.xcodeproj/project.pbxproj:
2906         * wtf/CMakeLists.txt:
2907         * wtf/text/TextStream.cpp: Renamed from Source/WebCore/platform/text/TextStream.cpp.
2908         (WTF::TextStream::writeIndent):
2909         * wtf/text/TextStream.h: Renamed from Source/WebCore/platform/text/TextStream.h.
2910         (WTF::TextStream::FormatNumberRespectingIntegers::FormatNumberRespectingIntegers):
2911
2912 2017-08-09  Commit Queue  <commit-queue@webkit.org>
2913
2914         Unreviewed, rolling out r220466, r220477, and r220487.
2915         https://bugs.webkit.org/show_bug.cgi?id=175411
2916
2917         This change broke existing API tests and follow up fixes did
2918         not resolve all the issues. (Requested by ryanhaddad on
2919         #webkit).
2920
2921         Reverted changesets:
2922
2923         https://bugs.webkit.org/show_bug.cgi?id=175244
2924         http://trac.webkit.org/changeset/220466
2925
2926         "WTF::Function does not allow for reference / non-default
2927         constructible return types"
2928         https://bugs.webkit.org/show_bug.cgi?id=175244
2929         http://trac.webkit.org/changeset/220477
2930
2931         https://bugs.webkit.org/show_bug.cgi?id=175244
2932         http://trac.webkit.org/changeset/220487
2933
2934 2017-08-09  Sam Weinig  <sam@webkit.org>
2935
2936         WTF::Function does not allow for reference / non-default constructible return types
2937         https://bugs.webkit.org/show_bug.cgi?id=175244
2938
2939         Reviewed by Chris Dumez.
2940
2941         When Function, then NoncopyableFunction, was templatized to allow non-void return values
2942         in r201493, it maintained the behavior of being callable even if the Function was null.
2943         To accomplish this, when null, the default construction of the return parameter was used.
2944         This means Function can't be used with return types that are not default constructible,
2945         such as reference types and Ref.
2946
2947         This behavior of returning something when null is surprising, as this is not how normal
2948         functions behave, and not very useful. Instead, we now assert that the function is not
2949         null when being called.
2950
2951         * wtf/Function.h:
2952         (WTF::Function operator(...)):
2953         Instead of allowing a null callable wrapper by returning the default construction of
2954         the return type, assert that the wrapper is there when calling a Function.
2955
2956 2017-08-09  Ryan Haddad  <ryanhaddad@apple.com>
2957
2958         Unreviewed, rolling out r220457.
2959
2960         This change introduced API test failures.
2961
2962         Reverted changeset:
2963
2964         "WTF::Function does not allow for reference / non-default
2965         constructible return types"
2966         https://bugs.webkit.org/show_bug.cgi?id=175244
2967         http://trac.webkit.org/changeset/220457
2968
2969 2017-08-09  Sam Weinig  <sam@webkit.org>
2970
2971         WTF::Function does not allow for reference / non-default constructible return types
2972         https://bugs.webkit.org/show_bug.cgi?id=175244
2973
2974         Reviewed by Chris Dumez.
2975
2976         When Function, then NoncopyableFunction, was templatized to allow non-void return values
2977         in r201493, it maintained the behavior of being callable even if the Function was null.
2978         To accomplish this, when null, the default construction of the return parameter was used.
2979         This means Function can't be used with return types that are not default constructible,
2980         such as reference types and Ref.
2981
2982         This behavior of returning something when null is surprising, as this is not how normal
2983         functions behave, and not very useful. Instead, we now assert that the function is not
2984         null when being called.
2985
2986         * wtf/Function.h:
2987         (WTF::Function operator(...)):
2988         Instead of allowing a null callable wrapper by returning the default construction of
2989         the return type, assert that the wrapper is there when calling a Function.
2990
2991 2017-08-08  Filip Pizlo  <fpizlo@apple.com>
2992
2993         Baseline JIT should do caging
2994         https://bugs.webkit.org/show_bug.cgi?id=175037
2995
2996         Reviewed by Mark Lam.
2997
2998         * wtf/Gigacage.h:
2999         (Gigacage::disableDisablingPrimitiveGigacageIfShouldBeEnabled):
3000         (Gigacage::isDisablingPrimitiveGigacageDisabled):
3001         (Gigacage::isPrimitiveGigacagePermanentlyEnabled):
3002         (Gigacage::canPrimitiveGigacageBeDisabled):
3003         (Gigacage::basePtr):
3004
3005 2017-08-08  Ryan Haddad  <ryanhaddad@apple.com>
3006
3007         Unreviewed, rolling out r220368.
3008
3009         This change caused WK1 tests to exit early with crashes.
3010
3011         Reverted changeset:
3012
3013         "Baseline JIT should do caging"
3014         https://bugs.webkit.org/show_bug.cgi?id=175037
3015         http://trac.webkit.org/changeset/220368
3016
3017 2017-08-08  Michael Catanzaro  <mcatanzaro@igalia.com>
3018
3019         [CMake] Properly test if compiler supports compiler flags
3020         https://bugs.webkit.org/show_bug.cgi?id=174490
3021
3022         Reviewed by Konstantin Tokarev.
3023
3024         * wtf/Compiler.h:
3025
3026 2017-08-07  Filip Pizlo  <fpizlo@apple.com>
3027
3028         Baseline JIT should do caging
3029         https://bugs.webkit.org/show_bug.cgi?id=175037
3030
3031         Reviewed by Mark Lam.
3032
3033         * wtf/Gigacage.h:
3034         (Gigacage::disableDisablingPrimitiveGigacageIfShouldBeEnabled):
3035         (Gigacage::isDisablingPrimitiveGigacageDisabled):
3036         (Gigacage::isPrimitiveGigacagePermanentlyEnabled):
3037         (Gigacage::canPrimitiveGigacageBeDisabled):
3038
3039 2017-08-07  Filip Pizlo  <fpizlo@apple.com>
3040
3041         Unreviewed, try to fix Windows build.
3042
3043         * wtf/Gigacage.cpp:
3044         * wtf/Gigacage.h:
3045
3046 2017-08-06  Filip Pizlo  <fpizlo@apple.com>
3047
3048         Primitive auxiliaries and JSValue auxiliaries should have separate gigacages
3049         https://bugs.webkit.org/show_bug.cgi?id=174919
3050
3051         Reviewed by Keith Miller.
3052         
3053         This mirrors the changes from bmalloc/Gigacage.h.
3054         
3055         Also it teaches CagedPtr how to reason about multiple gigacages.
3056
3057         * wtf/CagedPtr.h:
3058         (WTF::CagedPtr::get const):
3059         (WTF::CagedPtr::operator[] const):
3060         * wtf/Gigacage.cpp:
3061         (Gigacage::tryMalloc):
3062         (Gigacage::tryAllocateVirtualPages):
3063         (Gigacage::freeVirtualPages):
3064         (Gigacage::tryAlignedMalloc):
3065         (Gigacage::alignedFree):
3066         (Gigacage::free):
3067         * wtf/Gigacage.h:
3068         (Gigacage::disablePrimitiveGigacage):
3069         (Gigacage::addPrimitiveDisableCallback):
3070         (Gigacage::removePrimitiveDisableCallback):
3071         (Gigacage::name):
3072         (Gigacage::basePtr):
3073         (Gigacage::caged):
3074         (Gigacage::isCaged):
3075         (Gigacage::tryAlignedMalloc):
3076         (Gigacage::alignedFree):
3077         (Gigacage::free):
3078         (Gigacage::disableGigacage): Deleted.
3079         (Gigacage::addDisableCallback): Deleted.
3080         (Gigacage::removeDisableCallback): Deleted.
3081
3082 2017-08-07  Brian Burg  <bburg@apple.com>
3083
3084         Remove CANVAS_PATH compilation guard
3085         https://bugs.webkit.org/show_bug.cgi?id=175207
3086
3087         Reviewed by Sam Weinig.
3088
3089         * wtf/FeatureDefines.h:
3090
3091 2017-08-05  Filip Pizlo  <fpizlo@apple.com>
3092
3093         REGRESSION (r219895-219897): Number of leaks on Open Source went from 9240 to 235983 and is now at 302372
3094         https://bugs.webkit.org/show_bug.cgi?id=175083
3095
3096         Reviewed by Oliver Hunt.
3097         
3098         Adds a classic ReadWriteLock class. I wrote my own because I can never remember if the pthread one is
3099         guaranted to bias in favor of writers or not.
3100
3101         * WTF.xcodeproj/project.pbxproj:
3102         * wtf/Condition.h:
3103         (WTF::ConditionBase::construct):
3104         (WTF::Condition::Condition):
3105         * wtf/Lock.h:
3106         (WTF::LockBase::construct):
3107         (WTF::Lock::Lock):
3108         * wtf/ReadWriteLock.cpp: Added.
3109         (WTF::ReadWriteLockBase::construct):
3110         (WTF::ReadWriteLockBase::readLock):
3111         (WTF::ReadWriteLockBase::readUnlock):
3112         (WTF::ReadWriteLockBase::writeLock):
3113         (WTF::ReadWriteLockBase::writeUnlock):
3114         * wtf/ReadWriteLock.h: Added.
3115         (WTF::ReadWriteLockBase::ReadLock::tryLock):
3116         (WTF::ReadWriteLockBase::ReadLock::lock):
3117         (WTF::ReadWriteLockBase::ReadLock::unlock):
3118         (WTF::ReadWriteLockBase::WriteLock::tryLock):
3119         (WTF::ReadWriteLockBase::WriteLock::lock):
3120         (WTF::ReadWriteLockBase::WriteLock::unlock):
3121         (WTF::ReadWriteLockBase::read):
3122         (WTF::ReadWriteLockBase::write):
3123         (WTF::ReadWriteLock::ReadWriteLock):
3124
3125 2017-08-04  Matt Lewis  <jlewis3@apple.com>
3126
3127         Unreviewed, rolling out r220271.
3128
3129         Rolling out due to Layout Test failing on iOS Simulator.
3130
3131         Reverted changeset:
3132
3133         "Remove STREAMS_API compilation guard"
3134         https://bugs.webkit.org/show_bug.cgi?id=175165
3135         http://trac.webkit.org/changeset/220271
3136
3137 2017-08-04  Youenn Fablet  <youenn@apple.com>
3138
3139         Remove STREAMS_API compilation guard
3140         https://bugs.webkit.org/show_bug.cgi?id=175165
3141
3142         Reviewed by Darin Adler.
3143
3144         * wtf/FeatureDefines.h:
3145
3146 2017-08-03  Brian Burg  <bburg@apple.com>
3147
3148         Remove ENABLE(WEB_SOCKET) guards
3149         https://bugs.webkit.org/show_bug.cgi?id=167044
3150
3151         Reviewed by Joseph Pecoraro.
3152
3153         * wtf/FeatureDefines.h:
3154
3155 2017-08-03  Youenn Fablet  <youenn@apple.com>
3156
3157         Remove FETCH_API compilation guard
3158         https://bugs.webkit.org/show_bug.cgi?id=175154
3159
3160         Reviewed by Chris Dumez.
3161
3162         * wtf/FeatureDefines.h:
3163
3164 2017-08-03  Brady Eidson  <beidson@apple.com>
3165
3166         Add SW IDLs and stub out basic functionality.
3167         https://bugs.webkit.org/show_bug.cgi?id=175115
3168
3169         Reviewed by Chris Dumez.
3170
3171         * wtf/FeatureDefines.h:
3172
3173 2017-08-03  Yusuke Suzuki  <utatane.tea@gmail.com>
3174
3175         Unreviewed, build fix for Windows port
3176         https://bugs.webkit.org/show_bug.cgi?id=175013
3177
3178         * wtf/Threading.h:
3179
3180 2017-08-03  Yusuke Suzuki  <utatane.tea@gmail.com>
3181
3182         Merge ThreadHolder to WTF::Thread itself
3183         https://bugs.webkit.org/show_bug.cgi?id=175013
3184
3185         Reviewed by Mark Lam.
3186
3187         Currently, we store ThreadHolder* to the TLS, and ThreadHolder* holds Ref<Thread>.
3188         When we get Thread& from the current thread TLS, we need to dereference the ThreadHolder*.
3189         However, ideally, we can store Thread* directly to the current thread TLS.
3190         While the ThreadHolder design is beautiful, it's worth optimizing by storing Thread* directly
3191         since Thread::current() is so frequently executed.
3192
3193         This patch merges ThreadHolder to Thread. And we now store Thread* directly in the TLS.
3194         When storing it to TLS, we call leakRef() to keep Thread ref count incremented by the TLS.
3195         And when destroying the TLS, we call `deref()` to ensure that Thread* is dereferenced from
3196         the TLS.
3197
3198         * WTF.xcodeproj/project.pbxproj:
3199         * wtf/CMakeLists.txt:
3200         * wtf/ThreadHolder.cpp: Removed.
3201         * wtf/ThreadHolder.h: Removed.
3202         * wtf/ThreadHolderPthreads.cpp: Removed.
3203         * wtf/ThreadHolderWin.cpp: Removed.
3204         * wtf/Threading.cpp:
3205         (WTF::Thread::entryPoint):
3206         (WTF::initializeThreading):
3207         * wtf/Threading.h:
3208         (WTF::Thread::currentMayBeNull):
3209         (WTF::Thread::current):
3210         * wtf/ThreadingPthreads.cpp:
3211         (WTF::Thread::waitForCompletion):
3212         (WTF::Thread::initializeCurrentTLS):
3213         (WTF::Thread::initializeTLSKey):
3214         (WTF::Thread::initializeTLS):
3215         (WTF::Thread::destructTLS):
3216         (WTF::Thread::createCurrentThread): Deleted.
3217         * wtf/ThreadingWin.cpp:
3218         (WTF::Thread::initializeCurrentTLS):
3219         (WTF::threadMapMutex):
3220         (WTF::Thread::initializeTLSKey):
3221         (WTF::Thread::currentDying):
3222         (WTF::Thread::get):
3223         (WTF::Thread::initializeTLS):
3224         (WTF::Thread::destructTLS):
3225         (WTF::waitForThreadCompletion):
3226         (WTF::Thread::createCurrentThread): Deleted.
3227
3228 2017-08-03  Yusuke Suzuki  <utatane.tea@gmail.com>
3229
3230         [Linux][WTF] Use one global semaphore to notify thread suspend and resume completion
3231         https://bugs.webkit.org/show_bug.cgi?id=175124
3232
3233         Reviewed by Carlos Garcia Campos.
3234
3235         POSIX sem_t is used to notify thread suspend and resume completion in Linux ports
3236         since sem_post is async-signal-safe function. Since we guard suspend() and resume()
3237         with one global lock, this semaphore is also guarded by this lock. So we do not need
3238         to have semaphore per WTF::Thread.
3239
3240         This patch introduces one global Semaphore. And drop per thread semaphore.
3241
3242         * wtf/Threading.h:
3243         * wtf/ThreadingPthreads.cpp:
3244         (WTF::Thread::~Thread):
3245         (WTF::Semaphore::Semaphore):
3246         (WTF::Semaphore::~Semaphore):
3247         (WTF::Semaphore::wait):
3248         (WTF::Semaphore::post):
3249         (WTF::Thread::signalHandlerSuspendResume):
3250         (WTF::Thread::initializePlatformThreading):
3251         (WTF::Thread::suspend):
3252         (WTF::Thread::resume):
3253         (WTF::Thread::Thread): Deleted.
3254         * wtf/ThreadingWin.cpp:
3255         (WTF::Thread::Thread): Deleted.
3256
3257 2017-08-03  Yusuke Suzuki  <utatane.tea@gmail.com>
3258
3259         [Linux][WTF] Reduce sizeof(WTF::Thread) by using a pointer to PlatformRegisters
3260         https://bugs.webkit.org/show_bug.cgi?id=175119
3261
3262         Reviewed by Carlos Garcia Campos.
3263
3264         sizeof(PlatformRegisters) is so large. In my Linux box, it is 256. It enlarges the sizeof(WTF::Thread).
3265         However, it is not necessary to hold it in WTF::Thread member. Thread's ucontext data and its stack is
3266         effective while suspending the thread. So, we can just use the pointer to the PlatformRegister instead
3267         of copying it to the member of the WTF::Thread.
3268
3269         * wtf/Threading.h:
3270         * wtf/ThreadingPthreads.cpp:
3271         (WTF::Thread::signalHandlerSuspendResume):
3272         (WTF::Thread::getRegisters):
3273
3274 2017-08-02  Yusuke Suzuki  <utatane.tea@gmail.com>
3275
3276         Unreviewed, build fix for Windows port
3277         https://bugs.webkit.org/show_bug.cgi?id=174716
3278
3279         This ugliness will be fixed in https://bugs.webkit.org/show_bug.cgi?id=175013.
3280
3281         * wtf/ThreadHolder.h:
3282         * wtf/Threading.h:
3283
3284 2017-08-02  Yusuke Suzuki  <utatane.tea@gmail.com>
3285
3286         Merge WTFThreadData to Thread::current
3287         https://bugs.webkit.org/show_bug.cgi?id=174716
3288
3289         Reviewed by Mark Lam.
3290
3291         We placed thread specific data in WTFThreadData previously. But now, we have a new good place
3292         to put thread specific data: WTF::Thread. Before this patch, WTFThreadData and WTF::Thread
3293         sometimes have the completely same fields (m_stack etc.) due to initialization order limitations.
3294         This patch merges WTFThreadData to WTF::Thread. We apply WTFThreadData's initialization style
3295         to WTF::Thread. So, WTF::Thread's holder now uses fast TLS for darwin environment. Thus,
3296         Thread::current() access is now accelerated. And WTF::Thread::current() can be accessed even
3297         before calling WTF::initializeThreading.
3298
3299         * WTF.xcodeproj/project.pbxproj:
3300         * wtf/CMakeLists.txt:
3301         * wtf/LockAlgorithm.h:
3302         * wtf/LockAlgorithmInlines.h:
3303         * wtf/MainThread.h:
3304         * wtf/ParkingLot.cpp:
3305         * wtf/StackStats.cpp:
3306         (WTF::StackStats::PerThreadStats::PerThreadStats):
3307         (WTF::StackStats::CheckPoint::CheckPoint):
3308         (WTF::StackStats::CheckPoint::~CheckPoint):
3309         (WTF::StackStats::probe):
3310         (WTF::StackStats::LayoutCheckPoint::LayoutCheckPoint):
3311         * wtf/ThreadHolder.cpp:
3312         (WTF::ThreadHolder::initializeCurrent):
3313         * wtf/ThreadHolder.h:
3314         (WTF::ThreadHolder::ThreadHolder):
3315         (WTF::ThreadHolder::currentMayBeNull):
3316         (WTF::ThreadHolder::current):
3317         * wtf/ThreadHolderPthreads.cpp:
3318         (WTF::ThreadHolder::initializeKey):
3319         (WTF::ThreadHolder::initialize):
3320         (WTF::ThreadHolder::destruct):
3321         (WTF::ThreadHolder::initializeOnce): Deleted.
3322         (WTF::ThreadHolder::current): Deleted.
3323         * wtf/ThreadHolderWin.cpp:
3324         (WTF::ThreadHolder::initializeKey):
3325         (WTF::ThreadHolder::currentDying):
3326         (WTF::ThreadHolder::initialize):
3327         (WTF::ThreadHolder::initializeOnce): Deleted.
3328         (WTF::ThreadHolder::current): Deleted.
3329         * wtf/Threading.cpp:
3330         (WTF::Thread::initializeInThread):
3331         (WTF::Thread::entryPoint):
3332         (WTF::Thread::create):
3333         (WTF::Thread::didExit):
3334         (WTF::initializeThreading):
3335         (WTF::Thread::currentMayBeNull): Deleted.
3336         * wtf/Threading.h:
3337         (WTF::Thread::current):
3338         (WTF::Thread::atomicStringTable):
3339         (WTF::Thread::setCurrentAtomicStringTable):
3340         (WTF::Thread::stackStats):
3341         (WTF::Thread::savedStackPointerAtVMEntry):
3342         (WTF::Thread::setSavedStackPointerAtVMEntry):
3343         (WTF::Thread::savedLastStackTop):
3344         (WTF::Thread::setSavedLastStackTop):
3345         * wtf/ThreadingPrimitives.h:
3346         * wtf/ThreadingPthreads.cpp:
3347         (WTF::Thread::createCurrentThread):
3348         (WTF::Thread::current): Deleted.
3349         * wtf/ThreadingWin.cpp:
3350         (WTF::Thread::createCurrentThread):
3351         (WTF::Thread::current): Deleted.
3352         * wtf/WTFThreadData.cpp: Removed.
3353         * wtf/WTFThreadData.h: Removed.
3354         * wtf/text/AtomicString.cpp:
3355         * wtf/text/AtomicStringImpl.cpp:
3356         (WTF::stringTable):
3357         * wtf/text/AtomicStringTable.cpp:
3358         (WTF::AtomicStringTable::create):
3359         * wtf/text/AtomicStringTable.h:
3360
3361 2017-08-02  Joseph Pecoraro  <pecoraro@apple.com>
3362
3363         NeverDestroyed related leaks seen on bots
3364         https://bugs.webkit.org/show_bug.cgi?id=175113
3365
3366         Reviewed by Yusuke Suzuki.
3367
3368         * wtf/NeverDestroyed.h:
3369         (WTF::NeverDestroyed::NeverDestroyed):
3370         Previously the result of makeNeverDestroyed was not always moving into
3371         the `static NeverDestroyed` static local variable. In some cases it would
3372         re-invoke the constructor, creating a new NeverDestroyed object. In the
3373         case of a Vector it was causing leaks.
3374
3375         Adding a move constructor convinces the compiler to move the result
3376         of makeNeverDestroyed into the NeverDestroyed static. It doesn't actually
3377         invoke the move constructor here, which I believe means it is deciding
3378         to perform optional copy elision optimization.
3379         'http://en.cppreference.com/w/cpp/language/copy_elision
3380
3381 2017-08-02  Filip Pizlo  <fpizlo@apple.com>
3382
3383         All C++ accesses to JSObject::m_butterfly should do caging
3384         https://bugs.webkit.org/show_bug.cgi?id=175039
3385
3386         Reviewed by Keith Miller.
3387         
3388         Adds a smart pointer class that does various kinds of caging for you.
3389
3390         * WTF.xcodeproj/project.pbxproj:
3391         * wtf/CMakeLists.txt:
3392         * wtf/CagedPtr.h: Added.
3393         (WTF::CagedPtr::CagedPtr):
3394         (WTF::CagedPtr::get const):
3395         (WTF::CagedPtr::getMayBeNull const):
3396         (WTF::CagedPtr::operator== const):
3397         (WTF::CagedPtr::operator!= const):
3398         (WTF::CagedPtr::operator bool const):
3399         (WTF::CagedPtr::operator* const):
3400         (WTF::CagedPtr::operator-> const):
3401
3402 2017-08-02  Filip Pizlo  <fpizlo@apple.com>
3403
3404         We should be OK with the gigacage being disabled on gmalloc
3405         https://bugs.webkit.org/show_bug.cgi?id=175082
3406
3407         Reviewed by Michael Saboff.
3408
3409         * wtf/Gigacage.h:
3410         (Gigacage::shouldBeEnabled):
3411
3412 2017-08-01  Filip Pizlo  <fpizlo@apple.com>
3413
3414         Bmalloc and GC should put auxiliaries (butterflies, typed array backing stores) in a gigacage (separate multi-GB VM region)
3415         https://bugs.webkit.org/show_bug.cgi?id=174727
3416
3417         Reviewed by Mark Lam.
3418         
3419         For the Gigacage project to have minimal impact, we need to have some abstraction that allows code to
3420         avoid having to guard itself with #if's. This adds a Gigacage abstraction that overlays the Gigacage
3421         namespace from bmalloc, which always lets you call things like Gigacage::caged and Gigacage::tryMalloc.
3422         
3423         Because of how many places need to possibly allocate in a gigacage, or possibly perform caged accesses,
3424         it's better to hide the question of whether or not it's enabled inside this API.
3425
3426         * WTF.xcodeproj/project.pbxproj:
3427         * wtf/CMakeLists.txt:
3428         * wtf/FastMalloc.cpp:
3429         * wtf/Gigacage.cpp: Added.
3430         (Gigacage::tryMalloc):
3431         (Gigacage::tryAllocateVirtualPages):
3432         (Gigacage::freeVirtualPages):
3433         (Gigacage::tryAlignedMalloc):
3434         (Gigacage::alignedFree):
3435         (Gigacage::free):
3436         * wtf/Gigacage.h: Added.
3437         (Gigacage::ensureGigacage):
3438         (Gigacage::disableGigacage):
3439         (Gigacage::addDisableCallback):
3440         (Gigacage::removeDisableCallback):
3441         (Gigacage::caged):
3442         (Gigacage::isCaged):
3443         (Gigacage::tryAlignedMalloc):
3444         (Gigacage::alignedFree):
3445         (Gigacage::free):
3446
3447 2017-07-31  Matt Lewis  <jlewis3@apple.com>
3448
3449         Unreviewed, rolling out r220060.
3450
3451         This broke our internal builds. Contact reviewer of patch for
3452         more information.
3453
3454         Reverted changeset:
3455
3456         "Merge WTFThreadData to Thread::current"
3457         https://bugs.webkit.org/show_bug.cgi?id=174716
3458         http://trac.webkit.org/changeset/220060
3459
3460 2017-07-31  Yusuke Suzuki  <utatane.tea@gmail.com>
3461
3462         Merge WTFThreadData to Thread::current
3463         https://bugs.webkit.org/show_bug.cgi?id=174716
3464
3465         Reviewed by Sam Weinig.
3466
3467         We placed thread specific data in WTFThreadData previously. But now, we have a new good place
3468         to put thread specific data: WTF::Thread. Before this patch, WTFThreadData and WTF::Thread
3469         sometimes have the completely same fields (m_stack etc.) due to initialization order limitations.
3470         This patch merges WTFThreadData to WTF::Thread. We apply WTFThreadData's initialization style
3471         to WTF::Thread. So, WTF::Thread's holder now uses fast TLS for darwin environment. Thus,
3472         Thread::current() access is now accelerated. And WTF::Thread::current() can be accessed even
3473         before calling WTF::initializeThreading.
3474
3475         * WTF.xcodeproj/project.pbxproj:
3476         * wtf/CMakeLists.txt:
3477         * wtf/LockAlgorithm.h:
3478         * wtf/LockAlgorithmInlines.h:
3479         * wtf/MainThread.h:
3480         * wtf/ParkingLot.cpp:
3481         * wtf/StackStats.cpp:
3482         (WTF::StackStats::PerThreadStats::PerThreadStats):
3483         (WTF::StackStats::CheckPoint::CheckPoint):
3484         (WTF::StackStats::CheckPoint::~CheckPoint):
3485         (WTF::StackStats::probe):
3486         (WTF::StackStats::LayoutCheckPoint::LayoutCheckPoint):
3487         * wtf/ThreadHolder.cpp:
3488         (WTF::ThreadHolder::initializeCurrent):
3489         * wtf/ThreadHolder.h:
3490         (WTF::ThreadHolder::ThreadHolder):
3491         (WTF::ThreadHolder::currentMayBeNull):
3492         (WTF::ThreadHolder::current):
3493         * wtf/ThreadHolderPthreads.cpp:
3494         (WTF::ThreadHolder::initialize):
3495         (WTF::ThreadHolder::destruct):
3496         (WTF::ThreadHolder::current): Deleted.
3497         * wtf/ThreadHolderWin.cpp:
3498         (WTF::ThreadHolder::currentDying):
3499         (WTF::ThreadHolder::initialize):
3500         (WTF::ThreadHolder::current): Deleted.
3501         * wtf/Threading.cpp:
3502         (WTF::Thread::initializeInThread):
3503         (WTF::Thread::entryPoint):
3504         (WTF::Thread::didExit):
3505         (WTF::initializeThreading):
3506         (WTF::Thread::currentMayBeNull): Deleted.
3507         * wtf/Threading.h:
3508         (WTF::Thread::atomicStringTable):
3509         (WTF::Thread::setCurrentAtomicStringTable):
3510         (WTF::Thread::stackStats):
3511         (WTF::Thread::savedStackPointerAtVMEntry):
3512         (WTF::Thread::setSavedStackPointerAtVMEntry):
3513         (WTF::Thread::savedLastStackTop):
3514         (WTF::Thread::setSavedLastStackTop):
3515         (WTF::Thread::current):
3516         * wtf/ThreadingPrimitives.h:
3517         * wtf/ThreadingPthreads.cpp:
3518         (WTF::Thread::createCurrentThread):
3519         (WTF::Thread::current): Deleted.
3520         * wtf/ThreadingWin.cpp:
3521         (WTF::Thread::createCurrentThread):
3522         (WTF::Thread::current): Deleted.
3523         * wtf/WTFThreadData.cpp: Removed.
3524         * wtf/WTFThreadData.h: Removed.
3525         * wtf/text/AtomicString.cpp:
3526         * wtf/text/AtomicStringImpl.cpp:
3527         (WTF::stringTable):
3528         * wtf/text/AtomicStringTable.cpp:
3529         (WTF::AtomicStringTable::create):
3530         * wtf/text/AtomicStringTable.h:
3531
3532 2017-07-31  Xabier Rodriguez Calvar  <calvaris@igalia.com>
3533
3534         Created a bool pretty printer at WTF for debugging purposes
3535         https://bugs.webkit.org/show_bug.cgi?id=174893
3536
3537         Reviewed by Darin Adler.
3538
3539         * wtf/PrintStream.cpp:
3540         (WTF::printInternal): The overload taking bool uses boolForPrinting
3541         * wtf/PrintStream.h:
3542         (WTF::boolForPrinting): Converts a bool in "true" or "false".
3543
3544 2017-07-30  Yusuke Suzuki  <utatane.tea@gmail.com>
3545
3546         [WTF] Introduce Private Symbols
3547         https://bugs.webkit.org/show_bug.cgi?id=174935
3548
3549         Reviewed by Darin Adler.
3550
3551         Upcoming proposal of class fields[1] requires private fields.
3552         The simple way to implement it is adding a property with a private symbol.
3553         Currently, we have private symbols for internal properties. They are usual
3554         Symbols managed by the hash table. So basically private symbols are statically
3555         created in BuiltinNames. However this new proposal encourages users to create
3556         such private symbols more and more.
3557
3558         So, this patch introduces notion of "Private" into WTF SymbolImpl. This patch
3559         adds PrivateSymbolImpl. This is SymbolImpl with "Private" flag. We do not need
3560         to look up the symbol from the hash table to check whether the given symbol
3561         is a private one.
3562
3563         [1]: https://github.com/tc39/proposal-class-fields
3564
3565         * wtf/text/StringImpl.h:
3566         * wtf/text/SymbolImpl.cpp:
3567         (WTF::PrivateSymbolImpl::create):
3568         (WTF::PrivateSymbolImpl::createNullSymbol):
3569         * wtf/text/SymbolImpl.h:
3570         (WTF::SymbolImpl::isPrivate):
3571         (WTF::SymbolImpl::StaticSymbolImpl::StaticSymbolImpl):
3572         (WTF::SymbolImpl::SymbolImpl):
3573         (WTF::PrivateSymbolImpl::PrivateSymbolImpl):
3574
3575 2017-07-30  Brady Eidson  <beidson@apple.com>
3576
3577         Add URLSchemeHandler API tests that verify the lack of URLSchemeTask object leaks.
3578         https://bugs.webkit.org/show_bug.cgi?id=174958
3579
3580         Reviewed by Darin Adler.
3581
3582         This patch adds a new template class "InstanceCounted<T>".
3583         
3584         For each specialization, "InstanceCounted" will keep track of the total number of
3585         instances in existence.
3586         
3587         This makes explicate leak checking in API tests possible.
3588         
3589         Since this adds some runtime and storage overhead the code that actually does anything
3590         is only compiled in debug builds.
3591         
3592         * WTF.xcodeproj/project.pbxproj:
3593         * wtf/InstanceCounted.h: Added.
3594         (WTF::InstanceCounted::InstanceCounted):
3595         (WTF::InstanceCounted::instanceCount):
3596         (WTF::InstanceCounted::~InstanceCounted):
3597
3598 2017-07-27  Yusuke Suzuki  <utatane.tea@gmail.com>
3599
3600         [WTF] Drop Thread initialization wait in some platforms by introducing StackBounds::newThreadStackBounds(PlatformThreadHandle&)
3601         https://bugs.webkit.org/show_bug.cgi?id=174303
3602
3603         Reviewed by Mark Lam.
3604
3605         Currently, the caller thread of Thread::create() need to wait for completion of the initialization of the target thread.
3606         This is because we need to initialize Thread::m_stack in the target thread. Before this patch, a target thread's
3607         StackBounds can only be retrieved by the target thread itself. However, this potentially causes context-switching between
3608         the caller and the target threads and hurts efficiency of creating threads.
3609
3610         Fortunately, in some platforms (including major platforms except for Windows), we can get StackBounds of a target
3611         thread from a caller thread. This allows us to avoid waiting for completion of thread initialization.
3612
3613         In this patch, we introduce HAVE_STACK_BOUNDS_FOR_NEW_THREAD and StackBounds::newThreadStackBounds. When creating
3614         a new thread, we will use StackBounds::newThreadStackBounds to get StackBounds if possible. As a result, we