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