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