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