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