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