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