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