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