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