Create a super rough prototype of B3
[WebKit-https.git] / Source / WTF / ChangeLog
1 2015-10-28  Filip Pizlo  <fpizlo@apple.com>
2
3         Create a super rough prototype of B3
4         https://bugs.webkit.org/show_bug.cgi?id=150280
5
6         Reviewed by Benjamin Poulain.
7
8         * WTF.xcodeproj/project.pbxproj:
9         * wtf/CMakeLists.txt:
10         * wtf/HashSet.h:
11         (WTF::copyToVector):
12         (WTF::=):
13         * wtf/ListDump.h:
14         (WTF::PointerListDump::PointerListDump):
15         (WTF::PointerListDump::dump):
16         (WTF::MapDump::MapDump):
17         (WTF::listDump):
18         (WTF::pointerListDump):
19         (WTF::sortedListDump):
20         * wtf/MathExtras.h:
21         (WTF::leftShiftWithSaturation):
22         (WTF::rangesOverlap):
23         * wtf/Platform.h:
24         * wtf/ScopedLambda.h: Added.
25         (WTF::scopedLambda):
26         * wtf/SharedTask.h:
27         (WTF::createSharedTask):
28
29 2015-10-28  Alberto Garcia  <berto@igalia.com>
30
31         [SOUP] Cannot build the network process in glibc-based BSD systems
32         https://bugs.webkit.org/show_bug.cgi?id=150618
33
34         Reviewed by Carlos Garcia Campos.
35
36         * wtf/Platform.h: Don't enable HAVE_STAT_BIRTHTIME if the system
37         is using glibc.
38
39 2015-10-21  Filip Pizlo  <fpizlo@apple.com>
40
41         Factor out the graph node worklists from DFG into WTF
42         https://bugs.webkit.org/show_bug.cgi?id=150411
43
44         Reviewed by Geoffrey Garen.
45
46         The new GraphNodeWorklist.h file is basically just the functionality from the old
47         DFGBlockWorklist.h, but templatized to work for any graph node type and any kind of graph
48         node set.
49
50         * WTF.xcodeproj/project.pbxproj:
51         * wtf/CMakeLists.txt:
52         * wtf/GraphNodeWorklist.h: Added.
53         (WTF::GraphNodeWorklist::push):
54         (WTF::GraphNodeWorklist::notEmpty):
55         (WTF::GraphNodeWorklist::pop):
56         (WTF::GraphNodeWith::GraphNodeWith):
57         (WTF::GraphNodeWith::operator bool):
58         (WTF::ExtendedGraphNodeWorklist::ExtendedGraphNodeWorklist):
59         (WTF::ExtendedGraphNodeWorklist::forcePush):
60         (WTF::ExtendedGraphNodeWorklist::push):
61         (WTF::ExtendedGraphNodeWorklist::notEmpty):
62         (WTF::ExtendedGraphNodeWorklist::pop):
63         (WTF::GraphNodeWithOrder::GraphNodeWithOrder):
64         (WTF::GraphNodeWithOrder::operator bool):
65         (WTF::PostOrderGraphNodeWorklist::PostOrderGraphNodeWorklist):
66         (WTF::PostOrderGraphNodeWorklist::~PostOrderGraphNodeWorklist):
67         (WTF::PostOrderGraphNodeWorklist::pushPre):
68         (WTF::PostOrderGraphNodeWorklist::pushPost):
69         (WTF::PostOrderGraphNodeWorklist::push):
70         (WTF::PostOrderGraphNodeWorklist::notEmpty):
71         (WTF::PostOrderGraphNodeWorklist::pop):
72         * wtf/HashTable.h:
73         (WTF::HashTableAddResult::HashTableAddResult):
74         (WTF::HashTableAddResult::operator bool):
75
76 2015-10-20  Tim Horton  <timothy_horton@apple.com>
77
78         Try to fix the build by disabling MAC_GESTURE_EVENTS on 10.9 and 10.10
79
80         * wtf/FeatureDefines.h:
81
82 2015-10-20  Yoav Weiss  <yoav@yoav.ws>
83
84         Rename the PICTURE_SIZES flag to CURRENTSRC
85         https://bugs.webkit.org/show_bug.cgi?id=150275
86
87         Reviewed by Dean Jackson.
88
89         * wtf/FeatureDefines.h:
90
91 2015-10-19  Beth Dakin  <bdakin@apple.com>
92
93         Build fix.
94
95         * wtf/FeatureDefines.h:
96
97 2015-10-19  Tim Horton  <timothy_horton@apple.com>
98
99         Add magnify and rotate gesture event support for Mac
100         https://bugs.webkit.org/show_bug.cgi?id=150179
101         <rdar://problem/8036240>
102
103         Reviewed by Darin Adler.
104
105         * wtf/FeatureDefines.h:
106         New feature flag.
107
108 2015-10-17  Mark Lam  <mark.lam@apple.com>
109
110         Add CPU(X86) to the supported MASM_PROBE CPUs. This was accidentally left out in r191197.
111
112         Not reviewed.
113
114         * wtf/Platform.h:
115
116 2015-10-16  Mark Lam  <mark.lam@apple.com>
117
118         Always enable MASM_PROBE for debug builds.
119         https://bugs.webkit.org/show_bug.cgi?id=150190
120
121         Reviewed by Geoffrey Garen.
122
123         * wtf/Platform.h:
124
125 2015-10-14  Andreas Kling  <akling@apple.com>
126
127         REGRESSION(r190882): Concatenating a character array and an empty string is broken.
128         <https://webkit.org/b/150135>
129
130         Reviewed by Geoffrey Garen.
131
132         StringAdapter templates for raw character arrays were always using 1 as the array length
133         in toString().
134
135         * wtf/text/StringConcatenate.h:
136
137 2015-10-14  Per Arne Vollan  <peavo@outlook.com>
138
139         [Win64] Enable concurrent JIT.
140         https://bugs.webkit.org/show_bug.cgi?id=150098
141
142         Reviewed by Csaba Osztrogonác.
143
144         * wtf/Platform.h:
145
146 2015-10-13  Simon Fraser  <simon.fraser@apple.com>
147
148         Add helper funtion for checking pointer equivalency and use it
149         https://bugs.webkit.org/show_bug.cgi?id=150022
150
151         Reviewed by Darin Adler.
152         
153         Add PointerComparison.h which contains the templated pointer comparison
154         function.
155
156         * WTF.xcodeproj/project.pbxproj:
157         * wtf/PointerComparison.h: Added.
158         (WTF::arePointingToEqualData):
159
160 2015-10-12  Andreas Kling  <akling@apple.com>
161
162         "A + B" with strings shouldn't copy if A or B is empty.
163         <https://webkit.org/b/150034>
164
165         Reviewed by Anders Carlsson.
166
167         Add a fast path to WTF's operator+ magic for concatenation of two strings where
168         one of them is empty. In that case, try to avoid allocation altogether by returning
169         the non-empty string.
170
171         Spotted this while analyzing memory peaks during page load; it turns out we were
172         duplicating whole text resources (JS, CSS) at the end of decoding, below
173         TextResourceDecoder::decodeAndFlush(). That function effectively does:
174
175             return decode() + flush();
176
177         Very often, flush() returns an empty string, so due to the naive operator+,
178         we'd allocate a new StringImpl of length (decode().length() + flush().length())
179         and copy the return value from decode() into it. So silly!
180
181         Had to make the tryMakeString() machinery use String as a return type instead of
182         RefPtr<StringImpl> to make all the right overloads gel. StringTypeAdapter templates
183         are now required to provide a toString() function.
184
185         * wtf/text/StringConcatenate.h:
186         (WTF::StringTypeAdapter<char>::toString):
187         (WTF::StringTypeAdapter<UChar>::toString):
188         (WTF::StringTypeAdapter<Vector<char>>::toString):
189         (WTF::StringTypeAdapter<String>::toString):
190         (WTF::tryMakeString):
191         (WTF::makeString):
192         * wtf/text/StringOperators.h:
193         (WTF::StringAppend::operator String):
194         * wtf/text/StringView.h:
195         (WTF::StringTypeAdapter<StringView>::toString):
196
197 2015-10-12  Filip Pizlo  <fpizlo@apple.com>
198
199         Unreviewed, fix style in the hopes that it fixes Windows.
200
201         * wtf/ParallelHelperPool.cpp:
202         (WTF::ParallelHelperClient::~ParallelHelperClient):
203         (WTF::ParallelHelperClient::setTask):
204         (WTF::ParallelHelperClient::doSomeHelping):
205         (WTF::ParallelHelperClient::runTaskInParallel):
206         (WTF::ParallelHelperClient::finish):
207         (WTF::ParallelHelperClient::claimTask):
208         (WTF::ParallelHelperClient::runTask):
209         (WTF::ParallelHelperPool::doSomeHelping):
210         (WTF::ParallelHelperPool::helperThreadBody):
211         * wtf/ParallelHelperPool.h:
212         (WTF::ParallelHelperClient::setFunction):
213         (WTF::ParallelHelperClient::runFunctionInParallel):
214         (WTF::ParallelHelperClient::pool):
215
216 2015-10-10  Filip Pizlo  <fpizlo@apple.com>
217
218         FTL should generate code to call slow paths lazily
219         https://bugs.webkit.org/show_bug.cgi?id=149936
220
221         Reviewed by Saam Barati.
222
223         Enables SharedTask to handle any function type, not just void().
224
225         It's probably better to use SharedTask instead of std::function in performance-sensitive
226         code. std::function uses the system malloc and has copy semantics. SharedTask uses FastMalloc
227         and has aliasing semantics. So, you can just trust that it will have sensible performance
228         characteristics.
229
230         * wtf/ParallelHelperPool.cpp:
231         (WTF::ParallelHelperClient::~ParallelHelperClient):
232         (WTF::ParallelHelperClient::setTask):
233         (WTF::ParallelHelperClient::doSomeHelping):
234         (WTF::ParallelHelperClient::runTaskInParallel):
235         (WTF::ParallelHelperClient::finish):
236         (WTF::ParallelHelperClient::claimTask):
237         (WTF::ParallelHelperClient::runTask):
238         (WTF::ParallelHelperPool::doSomeHelping):
239         (WTF::ParallelHelperPool::helperThreadBody):
240         * wtf/ParallelHelperPool.h:
241         (WTF::ParallelHelperClient::setFunction):
242         (WTF::ParallelHelperClient::runFunctionInParallel):
243         (WTF::ParallelHelperClient::pool):
244         * wtf/SharedTask.h:
245         (WTF::createSharedTask):
246         (WTF::SharedTask::SharedTask): Deleted.
247         (WTF::SharedTask::~SharedTask): Deleted.
248         (WTF::SharedTaskFunctor::SharedTaskFunctor): Deleted.
249
250 2015-10-10  Dan Bernstein  <mitz@apple.com>
251
252         [iOS] Remove unnecessary iOS version checks
253         https://bugs.webkit.org/show_bug.cgi?id=150002
254
255         Reviewed by Alexey Proskuryakov.
256
257         * wtf/Platform.h:
258
259 2015-10-10  Dan Bernstein  <mitz@apple.com>
260
261         [iOS] Remove project support for iOS 8
262         https://bugs.webkit.org/show_bug.cgi?id=149993
263
264         Reviewed by Alexey Proskuryakov.
265
266         * Configurations/Base.xcconfig:
267         * Configurations/WTF.xcconfig:
268         * Configurations/mbmalloc.xcconfig:
269
270 2015-10-08  Joseph Pecoraro  <pecoraro@apple.com>
271
272         Clean up Marked classes
273         https://bugs.webkit.org/show_bug.cgi?id=149853
274
275         Reviewed by Darin Adler.
276
277         * wtf/PageBlock.h:
278         Remove duplicate using statement.
279
280 2015-10-08  Joseph Pecoraro  <pecoraro@apple.com>
281
282         Remove PageReservation.h clang fixme that has been fixed for a while
283         https://bugs.webkit.org/show_bug.cgi?id=149908
284
285         Reviewed by Csaba Osztrogonác.
286
287         * wtf/PageReservation.h:
288         (WTF::PageReservation::operator bool): Deleted.
289
290 2015-10-06  Daniel Bates  <dbates@webkit.org>
291
292         Enable XSLT when building WebKit for iOS using the public iOS SDK
293         https://bugs.webkit.org/show_bug.cgi?id=149827
294
295         Reviewed by Alexey Proskuryakov.
296
297         * wtf/FeatureDefines.h:
298
299 2015-10-04  Filip Pizlo  <fpizlo@apple.com>
300
301         Inline cache repatching should be throttled if it happens a lot
302         https://bugs.webkit.org/show_bug.cgi?id=149796
303         rdar://problem/22674436
304
305         Reviewed by Saam Barati.
306
307         Add some helpers for saturated math.
308
309         * wtf/MathExtras.h:
310         (WTF::incrementWithSaturation):
311         (WTF::leftShiftWithSaturation):
312
313 2015-10-01  Brent Fulgham  <bfulgham@apple.com>
314
315         [Win] Unreviewed CMake build fixes.
316
317         * wtf/CMakeLists.txt: Correct build flags to match
318         the original project files.
319
320 2015-09-30  Commit Queue  <commit-queue@webkit.org>
321
322         Unreviewed, rolling out r190324.
323         https://bugs.webkit.org/show_bug.cgi?id=149671
324
325         Caused flaky crashes, rdar://problem/22916304 (Requested by ap
326         on #webkit).
327
328         Reverted changeset:
329
330         "ParallelHelperPool::runFunctionInParallel() shouldn't
331         allocate, and ParallelHelperPool.h shouldn't be included
332         everywhere"
333         https://bugs.webkit.org/show_bug.cgi?id=149635
334         http://trac.webkit.org/changeset/190324
335
336 2015-09-29  Filip Pizlo  <fpizlo@apple.com>
337
338         ParallelHelperPool::runFunctionInParallel() shouldn't allocate, and ParallelHelperPool.h shouldn't be included everywhere
339         https://bugs.webkit.org/show_bug.cgi?id=149635
340
341         Reviewed by Saam Barati.
342
343         * wtf/ParallelHelperPool.h:
344         (WTF::ParallelHelperClient::runFunctionInParallel): Stack-allocate the task instead of heap-allocating it.
345
346 2015-09-29  Filip Pizlo  <fpizlo@apple.com>
347
348         GC copy phase spans too many files
349         https://bugs.webkit.org/show_bug.cgi?id=149586
350
351         Reviewed by Andreas Kling.
352
353         Extract the load balancing algorithm used by the GC's copy phase into a reusable template.
354         The GC copy phase now uses this.
355
356         * WTF.vcxproj/WTF.vcxproj:
357         * WTF.vcxproj/WTF.vcxproj.filters:
358         * WTF.xcodeproj/project.pbxproj:
359         * wtf/CMakeLists.txt:
360         * wtf/ParallelVectorIterator.h: Added.
361         (WTF::ParallelVectorIterator::ParallelVectorIterator):
362         (WTF::ParallelVectorIterator::iterate):
363
364 2015-09-26  Filip Pizlo  <fpizlo@apple.com>
365
366         Unreviewed, fix Windows build by adding WTF_EXPORT_PRIVATE in various places.
367
368         * wtf/ParallelHelperPool.h:
369         (WTF::ParallelHelperClient::setFunction):
370         (WTF::ParallelHelperPool::numberOfThreads):
371
372 2015-09-24  Filip Pizlo  <fpizlo@apple.com>
373
374         VMs should share GC threads
375         https://bugs.webkit.org/show_bug.cgi?id=149433
376         rdar://problem/12859344
377
378         Reviewed by Geoffrey Garen.
379
380         This adds two major things to WTF: WeakRandom and ParallelHelperPool. WeakRandom was
381         already in JSC; we're just hoisting it into WTF. It's just a weak random number generator
382         that's suitable for places where you need just a tiny bit of randomness.
383
384         ParallelHelperPool is a new API that simplifies data-parallel algorithms like the JSC GC.
385         In a data-parallel algorithm, we want to run one task on as many cores as possible and let
386         the task worry about which subset of the input data to work on. In some cases, the
387         algorithm will not need to do any load balancing - and if load balancing is required, it's
388         up to the user. This is appropriate in contexts where the load balancing needs to be
389         custom-tuned for performance, like the GC's marking phase.
390
391         This new API has three concepts: task, client, and pool. A task is a reference counted
392         object with a run() method, which may be run in parallel. It is usually used to wrap a
393         functor. A pool is a pool of threads that can run things. A client is a placeholder for a
394         task. A client can have zero or one tasks. A client must be registered with a pool. When a
395         client has a task, the pool's threads may choose to run it. If a thread starts running a
396         task, it will run it to completion. When the task returns on any thread, the client takes
397         it to mean that the task should be removed. That means that any currently running instances
398         of the task will finish but no new threads will attempt to run the task. You can easily ask
399         a client to wait until a task finishes. You can also easily ask a client to run a task on
400         the current thread in addition to possibly some helper threads from the pool.
401
402         For some data-parallel algorithms, programming with ParallelHelperPool is as easy as:
403
404         client.runFunctionInParallel(
405             [=] () {
406                 do things;
407             });
408
409         Note that you cannot tell ahead of time how many threads will join to help the task.
410         Threads may become available after the task has already started running. Those threads may
411         join after the other threads have already started. It's not advisable to make algorithmic
412         decisions based on client.numberOfActiveThreads(), since that number may change. Usually
413         the best way to use ParallelHelperPool is with an algorithm that has its own custom
414         worklist. An example of a very simple custom worklist is the one in the JSC GC's copying
415         phase - it's just a Vector and an index that indicates the next set of elements to process.
416
417         This new API was initially designed to simplify how GCThread works, by replacing Phase with
418         a callback that contains the phase's workload. I then realized that with a few tweaks, I
419         could make this somewhat general enough that it might become interesting outside GC. I also
420         realized that I could use this to enable thread sharing. So, although the API is kinda
421         quirky, it's grounded in the reality of how the JSC GC does parallelism.
422
423         * WTF.vcxproj/WTF.vcxproj:
424         * WTF.vcxproj/WTF.vcxproj.filters:
425         * WTF.xcodeproj/project.pbxproj:
426         * wtf/CMakeLists.txt:
427         * wtf/ParallelHelperPool.cpp: Added.
428         (WTF::ParallelHelperClient::ParallelHelperClient):
429         (WTF::ParallelHelperClient::~ParallelHelperClient):
430         (WTF::ParallelHelperClient::setTask):
431         (WTF::ParallelHelperClient::finish):
432         (WTF::ParallelHelperClient::doSomeHelping):
433         (WTF::ParallelHelperClient::runTaskInParallel):
434         (WTF::ParallelHelperClient::claimTask):
435         (WTF::ParallelHelperClient::runTask):
436         (WTF::ParallelHelperPool::ParallelHelperPool):
437         (WTF::ParallelHelperPool::~ParallelHelperPool):
438         (WTF::ParallelHelperPool::addThreads):
439         (WTF::ParallelHelperPool::ensureThreads):
440         (WTF::ParallelHelperPool::doSomeHelping):
441         (WTF::ParallelHelperPool::didMakeWorkAvailable):
442         (WTF::ParallelHelperPool::helperThreadBody):
443         (WTF::ParallelHelperPool::hasClientWithTask):
444         (WTF::ParallelHelperPool::getClientWithTask):
445         (WTF::ParallelHelperPool::waitForClientWithTask):
446         * wtf/ParallelHelperPool.h: Added.
447         (WTF::ParallelHelperClient::setFunction):
448         (WTF::ParallelHelperClient::runFunctionInParallel):
449         (WTF::ParallelHelperClient::pool):
450         (WTF::ParallelHelperClient::numberOfActiveThreads):
451         (WTF::ParallelHelperPool::numberOfThreads):
452         * wtf/SharedTask.h: Added.
453         (WTF::SharedTask::SharedTask):
454         (WTF::SharedTask::~SharedTask):
455         (WTF::SharedTaskFunctor::SharedTaskFunctor):
456         (WTF::createSharedTask):
457         * wtf/WeakRandom.h: Copied from Source/JavaScriptCore/runtime/WeakRandom.h.
458         (WTF::WeakRandom::WeakRandom):
459         (WTF::WeakRandom::initializeSeed):
460         (WTF::WeakRandom::seedUnsafe):
461         (WTF::WeakRandom::getUint32):
462         (WTF::WeakRandom::advance):
463         (JSC::WeakRandom::WeakRandom): Deleted.
464         (JSC::WeakRandom::seedUnsafe): Deleted.
465         (JSC::WeakRandom::getUint32): Deleted.
466         (JSC::WeakRandom::advance): Deleted.
467         (JSC::WeakRandom::initializeSeed): Deleted.
468
469 2015-09-25  Alex Christensen  <achristensen@webkit.org>
470
471         Clean up CMake build on Mac
472         https://bugs.webkit.org/show_bug.cgi?id=149573
473
474         Reviewed by Chris Dumez.
475
476         * wtf/PlatformMac.cmake:
477
478 2015-09-25  Alex Christensen  <achristensen@webkit.org>
479
480         [Win] Switch to CMake
481         https://bugs.webkit.org/show_bug.cgi?id=148111
482
483         Reviewed by Brent Fulgham.
484
485         * WTF.vcxproj/WTF.proj:
486
487 2015-09-25  Joseph Pecoraro  <pecoraro@apple.com>
488
489         Simplify Stopwatch::elapsedTime
490         https://bugs.webkit.org/show_bug.cgi?id=149538
491
492         Reviewed by Darin Adler.
493
494         * wtf/Stopwatch.h:
495         (WTF::Stopwatch::elapsedTime):
496         Simplify by not starting/stopping but just computing without updating members.
497
498 2015-09-25  Brent Fulgham  <bfulgham@apple.com>
499
500         [Win] Unreviewed build fix.
501
502         * wtf/FeatureDefines.h: Don't turn STREAMS_API on by default
503         on Windows.
504
505 2015-09-24  Ryosuke Niwa  <rniwa@webkit.org>
506
507         Ran sort-Xcode-project-file.
508
509         * WTF.xcodeproj/project.pbxproj:
510
511 2015-09-23  Andy Estes  <aestes@apple.com>
512
513         Disable QuickLook on watchOS
514         https://bugs.webkit.org/show_bug.cgi?id=149508
515         <rdar://problem/22517968>
516
517         Reviewed by Dan Bernstein.
518
519         * wtf/Platform.h:
520
521 2015-09-22  Andy Estes  <aestes@apple.com>
522
523         Disable QuickLook on tvOS
524         https://bugs.webkit.org/show_bug.cgi?id=149492
525         <rdar://problem/22741586>
526
527         Reviewed by Dan Bernstein.
528
529         * wtf/Platform.h: Stopped enabling QuickLook on tvOS.
530
531 2015-09-22  Filip Pizlo  <fpizlo@apple.com>
532
533         Get rid of ENABLE(PARALLEL_GC)
534         https://bugs.webkit.org/show_bug.cgi?id=149436
535
536         Reviewed by Mark Lam.
537
538         We always enable parallel GC everywhere but Windows, and it doesn't look like it was disabled
539         there for any good reason. So, get rid of the flag.
540
541         * wtf/MainThread.cpp:
542         (WTF::canAccessThreadLocalDataForThread):
543         (WTF::initializeGCThreads):
544         (WTF::registerGCThread):
545         (WTF::isMainThreadOrGCThread):
546         * wtf/Platform.h:
547
548 2015-09-22  Filip Pizlo  <fpizlo@apple.com>
549
550         Get rid of ENABLE(GGC)
551         https://bugs.webkit.org/show_bug.cgi?id=149472
552
553         Reviewed by Mark Hahnenberg and Mark Lam.
554
555         * wtf/Platform.h:
556
557 2015-09-21  Filip Pizlo  <fpizlo@apple.com>
558
559         Always use the compiler's CAS implementation and get rid of ENABLE(COMPARE_AND_SWAP)
560         https://bugs.webkit.org/show_bug.cgi?id=149438
561
562         Reviewed by Mark Lam.
563
564         * wtf/Atomics.h: Make weakCompareAndSwap() just forward to the system CAS via WTF::Atomic.
565         (WTF::weakCompareAndSwap):
566         (WTF::weakCompareAndSwapUIntPtr): Deleted.
567         (WTF::weakCompareAndSwapSize): Deleted.
568         * wtf/Bitmap.h: Small changes to use the new API.
569         (WTF::WordType>::concurrentTestAndSet):
570         * wtf/Platform.h: Remove ENABLE(COMPARE_AND_SWAP)
571
572 2015-09-21  Csaba Osztrogonác  <ossy@webkit.org>
573
574         Remove old GCC cruft from wtf/StdLibExtras.h
575         https://bugs.webkit.org/show_bug.cgi?id=149401
576
577         Reviewed by Alex Christensen.
578
579         * wtf/StdLibExtras.h:
580
581 2015-09-21  Andy Estes  <aestes@apple.com>
582
583         Disable Parental Controls on the Apple TV platform
584         https://bugs.webkit.org/show_bug.cgi?id=149421
585
586         Reviewed by Darin Adler.
587
588         * wtf/Platform.h:
589
590 2015-09-21  Filip Pizlo  <fpizlo@apple.com>
591
592         JSC should infer property types
593         https://bugs.webkit.org/show_bug.cgi?id=148610
594
595         Reviewed by Geoffrey Garen.
596
597         * wtf/HashTable.h:
598         (WTF::HashTableAddResult::HashTableAddResult): Make it possible to say "HashMap::AddResult result" without assigning anything to it yet.
599         * wtf/PrintStream.h:
600         (WTF::printInternal): Beef up printing of some common WTF types, in particular RefPtr<UniquedStringImpl>.
601
602 2015-09-20  Youenn Fablet  <youenn.fablet@crf.canon.fr>
603
604         Remove XHR_TIMEOUT compilation guard
605         https://bugs.webkit.org/show_bug.cgi?id=149260
606
607         Reviewed by Benjamin Poulain.
608
609         * wtf/FeatureDefines.h:
610
611 2015-09-17  Filip Pizlo  <fpizlo@apple.com>
612
613         Unreviewed, revert unintended change.
614
615         * benchmarks/LockSpeedTest.cpp:
616         (main):
617
618 2015-09-15  Ryosuke Niwa  <rniwa@webkit.org>
619
620         Add ShadowRoot interface and Element.prototype.attachShadow
621         https://bugs.webkit.org/show_bug.cgi?id=149187
622
623         Reviewed by Antti Koivisto.
624
625         * wtf/FeatureDefines.h:
626
627
628 2015-09-11  Keith Miller  <keith_miller@apple.com>
629
630         cryptographicallyRandomValuesFromOS should use CCRandomCopyBytes when available.
631         https://bugs.webkit.org/show_bug.cgi?id=148439
632
633         Reviewed by Alexey Proskuryakov.
634
635         Recently, we switched to using arc4random_buf on Darwin but further research indicates that
636         arc4random_buf has the same behavior we had before and thus we were just pushing the problem
637         further down the stack. CCRandomCopyBytes, however, appears to be more advanced and has much
638         better error handling than we had before.
639
640         * WTF.xcodeproj/project.pbxproj:
641         * wtf/OSRandomSource.cpp:
642         (WTF::cryptographicallyRandomValuesFromOS):
643         * wtf/spi/darwin/CommonCryptoSPI.h: Added.
644
645 2015-09-08  Filip Pizlo  <fpizlo@apple.com>
646
647         There should be one stub hanging off an inline cache that contains code for all of the cases, rather than forming a linked list consisting of one stub per case
648         https://bugs.webkit.org/show_bug.cgi?id=148717
649
650         Reviewed by Michael Saboff.
651
652         Beef up dumping a bit.
653
654         * wtf/PrintStream.h:
655         (WTF::pointerDump):
656         (WTF::printInternal):
657
658 2015-09-08  Mark Lam  <mark.lam@apple.com>
659
660         GC stack scan should include ABI red zone.
661         https://bugs.webkit.org/show_bug.cgi?id=148976
662
663         Reviewed by Geoffrey Garen and Benjamin Poulain.
664
665         * wtf/StackBounds.h:
666         (WTF::StackBounds::origin):
667         (WTF::StackBounds::end):
668         (WTF::StackBounds::size):
669
670 2015-09-04  Csaba Osztrogonác  <ossy@webkit.org>
671
672         Enable reference qualified functions for GCC
673         https://bugs.webkit.org/show_bug.cgi?id=148526
674
675         Reviewed by Darin Adler.
676
677         * wtf/Compiler.h:
678
679 2015-09-04  Csaba Osztrogonác  <ossy@webkit.org>
680
681         webkit-unassigned@lists.webkit.org
682         https://bugs.webkit.org/show_bug.cgi?id=148525
683
684         Reviewed by Darin Adler.
685
686         * wtf/Compiler.h:
687
688 2015-08-29  Zan Dobersek  <zdobersek@igalia.com>
689
690         [WTF] Improve a ParkingLot::parkConditionally() comment for a libstdc++ workaround
691         https://bugs.webkit.org/show_bug.cgi?id=148571
692
693         Reviewed by Filip Pizlo.
694
695         * wtf/ParkingLot.cpp:
696         (WTF::ParkingLot::parkConditionally): Adjust the comment about the workaround for
697         the libstdc++ std::condition_variable implementation, linking to the WebKit bug
698         that dissected the problem and the GCC bug that originally reported the problem.
699
700 2015-08-28  Anders Carlsson  <andersca@apple.com>
701
702         Remove the #if PLATFORM(MAC) in DeprecatedSymbolsUsedBySafari.mm so we'll actually build it on iOS.
703
704         Reviewed by Dan Bernstein.
705
706         * wtf/mac/DeprecatedSymbolsUsedBySafari.mm:
707
708 2015-08-27  Anders Carlsson  <andersca@apple.com>
709
710         Define legacy main thread calling functions for iOS as well
711         https://bugs.webkit.org/show_bug.cgi?id=148530
712
713         Reviewed by Tim Horton.
714
715         * wtf/mac/DeprecatedSymbolsUsedBySafari.mm:
716
717 2015-08-26  Anders Carlsson  <andersca@apple.com>
718
719         Fix build.
720
721         * wtf/WorkQueue.cpp:
722
723 2015-08-26  Anders Carlsson  <andersca@apple.com>
724
725         Add and implement WorkQueue::concurrentApply
726         https://bugs.webkit.org/show_bug.cgi?id=148488
727
728         Reviewed by Geoffrey Garen.
729
730         WorkQueue::concurrentApply is modeled after dispatch_apply, and on Cocoa it uses dispatch_apply directly.
731         For other ports there's a generic concurrentApply implemented using our threading primitives.
732         
733         * wtf/NeverDestroyed.h:
734         (WTF::LazyNeverDestroyed::operator->):
735         * wtf/WorkQueue.cpp:
736         (WTF::WorkQueue::concurrentApply):
737         * wtf/WorkQueue.h:
738         * wtf/cocoa/WorkQueueCocoa.cpp:
739         (WTF::WorkQueue::concurrentApply):
740
741 2015-08-25  Filip Pizlo  <fpizlo@apple.com>
742
743         Node::origin should be able to tell you if it's OK to exit
744         https://bugs.webkit.org/show_bug.cgi?id=145204
745
746         Reviewed by Geoffrey Garen.
747
748         * wtf/Insertion.h:
749         (WTF::executeInsertions): Add a useful assertion. This come into play because JSC will use UINT_MAX as "invalid index", and that ought to trigger this assertion.
750
751 2015-08-25  Csaba Osztrogonác  <ossy@webkit.org>
752
753         Require GCC version at least 4.9
754         https://bugs.webkit.org/show_bug.cgi?id=148430
755
756         Reviewed by Darin Adler.
757
758         * wtf/Compiler.h:
759
760 2015-08-22  Anders Carlsson  <andersca@apple.com>
761
762         std::once_flag needs to be static.
763
764         * wtf/mac/DeprecatedSymbolsUsedBySafari.mm:
765         (WTF::MainThreadFunctionTracker::singleton):
766
767 2015-08-21  Anders Carlsson  <andersca@apple.com>
768
769         Build fix.
770
771         * wtf/MainThread.h:
772
773 2015-08-21  Anders Carlsson  <andersca@apple.com>
774
775         Address review feedback from Darin.
776
777         * wtf/MainThread.h:
778         * wtf/mac/DeprecatedSymbolsUsedBySafari.mm:
779         (WTF::callOnMainThread):
780         (WTF::cancelCallOnMainThread):
781
782 2015-08-21  Anders Carlsson  <andersca@apple.com>
783
784         Deprecate the old school callOnMainThread/cancelCallOnMainThread functions
785         https://bugs.webkit.org/show_bug.cgi?id=148327
786
787         Reviewed by Sam Weinig.
788
789         * wtf/MainThread.cpp:
790         (WTF::functionQueue):
791         (WTF::dispatchFunctionsFromMainThread):
792         (WTF::callOnMainThread):
793         Change the function queue to be a queue of std::function<void ()> and get rid of dead code.
794
795         * wtf/MainThread.h:
796         Conditionalize callOnMainThread and cancelCallOnMainThread because Safari on Mavericks still expects to them to be
797         declared in MainThread.h under 10.9.
798
799         * wtf/mac/DeprecatedSymbolsUsedBySafari.mm:
800         Add a MainThreadFunctionTracker singleton that keeps track of scheduled functions so we can ensure that they're not
801         called if they're cancelled.
802
803         (WTF::MainThreadFunctionTracker::singleton):
804         Return the singleton.
805
806         (WTF::MainThreadFunctionTracker::callOnMainThread):
807         Add the function/context pair to our map and schedule the function to be run on the main thread.
808         If the function has been removed, don't call it.
809
810         (WTF::MainThreadFunctionTracker::cancelCallOnMainThread):
811         Remove all entries with the given function/context pair.
812
813         (WTF::MainThreadFunctionTracker::addFunction):
814         Add the function/context pair to the map and return the unique identifier.
815
816         (WTF::MainThreadFunctionTracker::removeIdentifier):
817         Look up the identifier and remove it if it still exists. If it exists we know that it hasn't been canceled and that we can call it.
818
819         (WTF::MainThreadFunctionTracker::removeFunctions):
820         Remove all function identifiers matched by the function/context pair.
821
822         (WTF::callOnMainThread):
823         Implement using MainThreadFunctionTracker.
824
825         (WTF::cancelCallOnMainThread):
826         Implement using MainThreadFunctionTracker.
827
828 2015-08-21  Anders Carlsson  <andersca@apple.com>
829
830         Get rid of uses of the old callOnMainThread function that takes a function ptr + context
831         https://bugs.webkit.org/show_bug.cgi?id=148324
832
833         Reviewed by Tim Horton.
834
835         * wtf/text/cf/StringImplCF.cpp:
836         (WTF::StringWrapperCFAllocator::deallocate):
837         (WTF::StringWrapperCFAllocator::deallocateOnMainThread): Deleted.
838
839 2015-08-20  Commit Queue  <commit-queue@webkit.org>
840
841         Unreviewed, rolling out r188717 and r188719.
842         https://bugs.webkit.org/show_bug.cgi?id=148272
843
844         Broke the Mavericks build (Requested by andersca on #webkit).
845
846         Reverted changesets:
847
848         "Merge Lock and LockBase"
849         https://bugs.webkit.org/show_bug.cgi?id=148266
850         http://trac.webkit.org/changeset/188717
851
852         "Merge ConditionBase and Condition"
853         https://bugs.webkit.org/show_bug.cgi?id=148270
854         http://trac.webkit.org/changeset/188719
855
856 2015-08-20  Anders Carlsson  <andersca@apple.com>
857
858         Merge ConditionBase and Condition
859         https://bugs.webkit.org/show_bug.cgi?id=148270
860
861         Reviewed by Filip Pizlo.
862
863         * wtf/Condition.h:
864         Direct initialize m_hasWaiters so Condition gets a constexpr constructor.
865
866         * wtf/Lock.h:
867         Remove a now outdated comment.
868
869 2015-08-20  Anders Carlsson  <andersca@apple.com>
870
871         Merge Lock and LockBase
872         https://bugs.webkit.org/show_bug.cgi?id=148266
873
874         Reviewed by Filip Pizlo.
875
876         * wtf/Atomics.h:
877         (WTF::Atomic::Atomic):
878         Add a default constructor as well as a constexpr constructor that takes a value.
879
880         * wtf/Lock.cpp:
881         (WTF::Lock::lockSlow):
882         (WTF::Lock::unlockSlow):
883         Rename LockBase to Lock.
884
885         * wtf/Lock.h:
886         Rename LockBase to Lock and direct-initialize Atomic to 0. Since the Atomic constructor is constexpr,
887         Lock also gets a constexpr constructor. Change the LockBase -> StaticLock typedef and add a fixme.
888
889         * wtf/WordLock.h:
890         Direct initialize m_word to 0.
891
892 2015-08-19  Filip Pizlo  <fpizlo@apple.com>
893
894         Remove WTF::SpinLock
895         https://bugs.webkit.org/show_bug.cgi?id=148208
896
897         Reviewed by Geoffrey Garen.
898
899         Remove the SpinLock.h file and remove references to the SpinLock class. Put the old SpinLock
900         algorithm in LockSpeedTest.cpp - which isn't compiled as part of a WTF or WebKit build - just
901         so we can still benchmark our locking algorithms against a spinlock baseline.
902
903         * WTF.vcxproj/WTF.vcxproj:
904         * WTF.xcodeproj/project.pbxproj:
905         * benchmarks/LockSpeedTest.cpp:
906         * wtf/CMakeLists.txt:
907         * wtf/Lock.h:
908         * wtf/SpinLock.h: Removed.
909         * wtf/WordLock.h:
910
911 2015-08-19  Alex Christensen  <achristensen@webkit.org>
912
913         CMake Windows build should not include files directly from other Source directories
914         https://bugs.webkit.org/show_bug.cgi?id=148198
915
916         Reviewed by Brent Fulgham.
917
918         * wtf/CMakeLists.txt:
919         * wtf/PlatformWin.cmake:
920
921 2015-08-18  Filip Pizlo  <fpizlo@apple.com>
922
923         Replace all uses of std::mutex/std::condition_variable with WTF::Lock/WTF::Condition
924         https://bugs.webkit.org/show_bug.cgi?id=148140
925
926         Reviewed by Geoffrey Garen.
927
928         Also beef up Condition by giving it a StaticCondition variant.
929
930         * wtf/Condition.h:
931         (WTF::ConditionBase::notifyAll):
932         (WTF::ConditionBase::waitForSecondsImpl):
933         (WTF::ConditionBase::absoluteFromRelative):
934         (WTF::Condition::Condition):
935         (WTF::Condition::notifyAll): Deleted.
936         (WTF::Condition::waitForSecondsImpl): Deleted.
937         (WTF::Condition::absoluteFromRelative): Deleted.
938         * wtf/CryptographicallyRandomNumber.cpp:
939         * wtf/HashTable.cpp:
940         (WTF::HashTableStats::recordCollisionAtCount):
941         (WTF::HashTableStats::dumpStats):
942         (WTF::hashTableStatsMutex): Deleted.
943         * wtf/HashTable.h:
944         (WTF::KeyTraits>::HashTable):
945         (WTF::KeyTraits>::invalidateIterators):
946         (WTF::addIterator):
947         (WTF::removeIterator):
948         * wtf/Lock.h:
949         * wtf/MainThread.cpp:
950         (WTF::functionQueue):
951         (WTF::dispatchFunctionsFromMainThread):
952         (WTF::callOnMainThread):
953         (WTF::cancelCallOnMainThread):
954         (WTF::mainThreadFunctionQueueMutex): Deleted.
955         * wtf/StackStats.cpp:
956         (WTF::StackStats::PerThreadStats::PerThreadStats):
957         (WTF::StackStats::CheckPoint::CheckPoint):
958         (WTF::StackStats::CheckPoint::~CheckPoint):
959         (WTF::StackStats::probe):
960         (WTF::StackStats::LayoutCheckPoint::LayoutCheckPoint):
961         (WTF::StackStats::LayoutCheckPoint::~LayoutCheckPoint):
962         (WTF::StackStats::initialize): Deleted.
963         * wtf/StackStats.h:
964         (WTF::StackStats::LayoutCheckPoint::LayoutCheckPoint):
965         (WTF::StackStats::probe):
966         (WTF::StackStats::initialize): Deleted.
967         * wtf/ThreadingPthreads.cpp:
968         (WTF::initializeThreading):
969         * wtf/mac/DeprecatedSymbolsUsedBySafari.mm:
970         (WTF::callOnMainThread):
971         (WTF::lockAtomicallyInitializedStaticMutex):
972         (WTF::unlockAtomicallyInitializedStaticMutex):
973         (WTF::atomicallyInitializedStaticMutex): Deleted.
974         * wtf/text/StringView.cpp:
975         (WTF::StringView::UnderlyingString::UnderlyingString):
976         (WTF::underlyingStrings):
977         (WTF::StringView::invalidate):
978         (WTF::StringView::adoptUnderlyingString):
979         (WTF::StringView::setUnderlyingString):
980         (WTF::underlyingStringsMutex): Deleted.
981         * wtf/unicode/icu/CollatorICU.cpp:
982         (WTF::Collator::Collator):
983         (WTF::Collator::~Collator):
984         (WTF::cachedCollatorMutex): Deleted.
985
986 2015-08-18  Zan Dobersek  <zdobersek@igalia.com>
987
988         [GLib] GMainLoopSource should receive the std::function<> objects through rvalue references
989         https://bugs.webkit.org/show_bug.cgi?id=147981
990
991         Reviewed by Carlos Garcia Campos.
992
993         Scheduling methods on GMainLoopSource and GThreadSafeMainLoopSource should
994         have the std::function<> objects passed through rvalue references, and should
995         move the passed-in objects forward when required.
996
997         * wtf/glib/GMainLoopSource.cpp:
998         (WTF::GMainLoopSource::schedule):
999         (WTF::GMainLoopSource::scheduleAfterDelay):
1000         (WTF::GMainLoopSource::scheduleAndDeleteOnDestroy):
1001         (WTF::GMainLoopSource::scheduleAfterDelayAndDeleteOnDestroy):
1002         * wtf/glib/GMainLoopSource.h:
1003         * wtf/glib/GThreadSafeMainLoopSource.cpp:
1004         (WTF::GThreadSafeMainLoopSource::schedule):
1005         (WTF::GThreadSafeMainLoopSource::scheduleAfterDelay):
1006         * wtf/glib/GThreadSafeMainLoopSource.h:
1007
1008 2015-08-18  Eric Carlson  <eric.carlson@apple.com>
1009
1010         Remove "platform text track menu"
1011         https://bugs.webkit.org/show_bug.cgi?id=148139
1012
1013         Reviewed by Jer Noble.
1014
1015         * wtf/Platform.h: Remove PLATFORM_TEXT_TRACK_MENU.
1016
1017 2015-08-18  Filip Pizlo  <fpizlo@apple.com>
1018
1019         WTF::Condition should have a fast path for notifyOne/notifyAll that avoids calling unparkOne/unparkAll
1020         https://bugs.webkit.org/show_bug.cgi?id=148090
1021
1022         Reviewed by Geoffrey Garen.
1023
1024         This change makes notifyOne()/notifyAll() blazing fast when nobody is waiting, by using the
1025         various hooks that ParkingLot gives us to maintain a m_hasWaiters variable. When it's false, it
1026         means that any unpark operation would simply return immediately.
1027
1028         This is a 45% speed-up for the 1-producer/1-consumer scenario with a 100-element queue when you
1029         use the notifyOne()-per-enqueue style. What's cool about this change is that you can now safely
1030         call notifyOne() (or notifyAll()) out of paranoia, just in case someone might be waiting. It's
1031         free to do so if nobody is waiting!
1032
1033         * wtf/Condition.h:
1034         (WTF::Condition::Condition):
1035         (WTF::Condition::waitUntil):
1036         (WTF::Condition::notifyOne):
1037         (WTF::Condition::notifyAll):
1038
1039 2015-08-17  Filip Pizlo  <fpizlo@apple.com>
1040
1041         Replace all remaining uses of WTF::Mutex with WTF::Lock
1042         https://bugs.webkit.org/show_bug.cgi?id=148089
1043
1044         Reviewed by Geoffrey Garen.
1045
1046         This also beefs up and rationalizes the Condition API, so that it can deal with units of time
1047         other than just steady_clock. This makes it easier to port ThreadCondition and
1048         std::condition_variable code over to Condition. This patch does not take a position on what
1049         kind of time is best; from reading a lot of the uses in WebCore, it seems like our use of
1050         double to measure seconds is often nicer than the many different classes in std::chrono.
1051
1052         Also added a Condition speed test, to make sure that all of this is a good idea. And indeed it
1053         is. The 1-producer/1-consumer scenario with a 100-element queue runs 36x faster using
1054         Lock/Condition than Mutex/ThreadCondition when you use the notifyOne()-per-enqueue style. It
1055         runs 58x faster with Lock/Condition when you use the notifyAll()-at-boundary style. Note that
1056         I have a bug open for making the notifyOne()-per-enqueue style even faster:
1057         https://bugs.webkit.org/show_bug.cgi?id=148090. Also, the 10-consumer/10-producer scenario with
1058         a 100-element queue runs 20x faster with Lock/Condition for notifyOne()-per-enqueue and 30x
1059         faster with notifyAll()-at-boundary. The only way to tweak the test to get
1060         Mutex/ThreadCondition to win is to have one producer, one consumer, a 1-element queue, and use
1061         the notifyOne()-per-enqueue style. In that case, one of the two threads is going to be waiting
1062         most of the time and the test basically measures wake-up latency and nothing else. Because
1063         Condition::wait() does a little bit more work than ThreadCondition::wait(),
1064         Mutex/ThreadCondition end up running 3% faster in this test case. But if you vary any of the
1065         parameters of the test, Mutex/ThreadCondition ends up losing - all it takes is more threads or
1066         a queue size of 5 or more. To my knowledge, we never do producer/consumer with a queue bounded
1067         to one element precisely because that approach is the least efficient regardless of locking
1068         algorithm. For example, neither WTF::MessageQueue nor DFG::Worklist have any bounds on their
1069         queue size. So, it seems that replacing all uses of system mutexes and condition variables with
1070         our own thing is a great idea.
1071
1072         * benchmarks/LockSpeedTest.cpp:
1073         * benchmarks/ConditionSpeedTest.cpp: Added.
1074         * wtf/Condition.h:
1075         (WTF::Condition::Condition):
1076         (WTF::Condition::waitUntil):
1077         (WTF::Condition::waitFor):
1078         (WTF::Condition::wait):
1079         (WTF::Condition::waitUntilWallClockSeconds):
1080         (WTF::Condition::waitUntilMonotonicClockSeconds):
1081         (WTF::Condition::notifyOne):
1082         (WTF::Condition::notifyAll):
1083         (WTF::Condition::waitForSecondsImpl):
1084         (WTF::Condition::waitForImpl):
1085         (WTF::Condition::absoluteFromRelative):
1086         * wtf/MessageQueue.h:
1087         (WTF::MessageQueue::infiniteTime):
1088         (WTF::MessageQueue<DataType>::append):
1089         (WTF::MessageQueue<DataType>::appendAndKill):
1090         (WTF::MessageQueue<DataType>::appendAndCheckEmpty):
1091         (WTF::MessageQueue<DataType>::prepend):
1092         (WTF::MessageQueue<DataType>::removeIf):
1093         (WTF::MessageQueue<DataType>::isEmpty):
1094         (WTF::MessageQueue<DataType>::kill):
1095         (WTF::MessageQueue<DataType>::killed):
1096         * wtf/ParallelJobsGeneric.cpp:
1097         (WTF::ParallelEnvironment::ThreadPrivate::execute):
1098         (WTF::ParallelEnvironment::ThreadPrivate::waitForFinish):
1099         (WTF::ParallelEnvironment::ThreadPrivate::workerThread):
1100         * wtf/ParallelJobsGeneric.h:
1101         * wtf/ParkingLot.cpp:
1102         (WTF::ParkingLot::parkConditionally):
1103         * wtf/ParkingLot.h:
1104         (WTF::ParkingLot::compareAndPark):
1105         * wtf/ThreadingPthreads.cpp:
1106         (WTF::initializeThreading):
1107         * wtf/ThreadingWin.cpp:
1108         (WTF::initializeThreading):
1109         * wtf/dtoa.cpp:
1110         (WTF::pow5mult):
1111         * wtf/dtoa.h:
1112
1113 2015-08-17  Alex Christensen  <achristensen@webkit.org>
1114
1115         Build Debug Suffix on Windows with CMake
1116         https://bugs.webkit.org/show_bug.cgi?id=148083
1117
1118         Reviewed by Brent Fulgham.
1119
1120         * wtf/PlatformWin.cmake:
1121         Add DEBUG_SUFFIX
1122
1123 2015-08-17  Myles C. Maxfield  <mmaxfield@apple.com>
1124
1125         Implement IntegerHasher
1126         https://bugs.webkit.org/show_bug.cgi?id=147866
1127
1128         Reviewed by Darin Adler and Anders Carlsson.
1129
1130         Rename StringHasher.h to Hasher.h, and include an IntegerHasher class.
1131
1132         * WTF.vcxproj/WTF.vcxproj: Update to target new file.
1133         * WTF.vcxproj/WTF.vcxproj.filters: Ditto.
1134         * WTF.xcodeproj/project.pbxproj: Ditto.
1135         * wtf/CMakeLists.txt: Ditto.
1136         * wtf/Hasher.h: Renamed from Source/WTF/wtf/StringHasher.h.
1137         * wtf/text/CString.cpp: Use new #include
1138         * wtf/text/StringHash.h: Ditto.
1139         * wtf/text/StringImpl.h: Ditto.
1140         * wtf/unicode/UTF8.cpp: Ditto.
1141
1142 2015-08-17  Alex Christensen  <achristensen@webkit.org>
1143
1144         Move some commands from ./CMakeLists.txt to Source/cmake
1145         https://bugs.webkit.org/show_bug.cgi?id=148003
1146
1147         Reviewed by Brent Fulgham.
1148
1149         * CMakeLists.txt:
1150         Added commands needed to build WTF by itself.
1151
1152 2015-08-14  Filip Pizlo  <fpizlo@apple.com>
1153
1154         Use WTF::Lock and WTF::Condition instead of WTF::Mutex, WTF::ThreadCondition, std::mutex, and std::condition_variable
1155         https://bugs.webkit.org/show_bug.cgi?id=147999
1156
1157         Reviewed by Geoffrey Garen.
1158
1159         Relanding after fixing a deadlock on Linux.
1160
1161         * wtf/Condition.h: "using WTF::Condition".
1162         * wtf/Lock.h:
1163         (WTF::LockBase::lock):
1164         (WTF::LockBase::tryLock): Add tryLock() because it turns out that we use it sometimes.
1165         (WTF::LockBase::try_lock): unique_lock needs this.
1166         (WTF::LockBase::unlock):
1167         * wtf/ParkingLot.cpp:
1168         (WTF::ParkingLot::parkConditionally): Work around a Linux C++ bug where wait_until with time_point::max() immediately returns and doesn't flash the lock.
1169
1170 2015-08-14  Keith Miller  <keith_miller@apple.com>
1171
1172         cryptographicallyRandomValuesFromOS should use arc4random_buf on Darwin.
1173         https://bugs.webkit.org/show_bug.cgi?id=148038
1174
1175         Reviewed by Geoffrey Garen.
1176
1177         Currently, we open a file descriptor to /dev/urandom, which can sometimes
1178         fail to open. Using arc4random_buf instead should get around this issue.
1179
1180         * wtf/OSRandomSource.cpp:
1181         (WTF::cryptographicallyRandomValuesFromOS):
1182
1183 2015-08-14  Commit Queue  <commit-queue@webkit.org>
1184
1185         Unreviewed, rolling out r188444.
1186         https://bugs.webkit.org/show_bug.cgi?id=148029
1187
1188         Broke GTK and EFL (see bug #148027) (Requested by philn on
1189         #webkit).
1190
1191         Reverted changeset:
1192
1193         "Use WTF::Lock and WTF::Condition instead of WTF::Mutex,
1194         WTF::ThreadCondition, std::mutex, and std::condition_variable"
1195         https://bugs.webkit.org/show_bug.cgi?id=147999
1196         http://trac.webkit.org/changeset/188444
1197
1198 2015-08-13  Filip Pizlo  <fpizlo@apple.com>
1199
1200         Use WTF::Lock and WTF::Condition instead of WTF::Mutex, WTF::ThreadCondition, std::mutex, and std::condition_variable
1201         https://bugs.webkit.org/show_bug.cgi?id=147999
1202
1203         Reviewed by Geoffrey Garen.
1204
1205         * wtf/Condition.h: "using WTF::Condition".
1206         * wtf/Lock.h:
1207         (WTF::LockBase::lock):
1208         (WTF::LockBase::tryLock): Add tryLock() because it turns out that we use it sometimes.
1209         (WTF::LockBase::try_lock): unique_lock needs this.
1210         (WTF::LockBase::unlock):
1211
1212 2015-08-13  Commit Queue  <commit-queue@webkit.org>
1213
1214         Unreviewed, rolling out r188428.
1215         https://bugs.webkit.org/show_bug.cgi?id=148015
1216
1217         broke cmake build (Requested by alexchristensen on #webkit).
1218
1219         Reverted changeset:
1220
1221         "Move some commands from ./CMakeLists.txt to Source/cmake"
1222         https://bugs.webkit.org/show_bug.cgi?id=148003
1223         http://trac.webkit.org/changeset/188428
1224
1225 2015-08-13  Alex Christensen  <achristensen@webkit.org>
1226
1227         Move some commands from ./CMakeLists.txt to Source/cmake
1228         https://bugs.webkit.org/show_bug.cgi?id=148003
1229
1230         Reviewed by Brent Fulgham.
1231
1232         * CMakeLists.txt:
1233         Added commands needed to build WTF by itself.
1234
1235 2015-08-13  Mark Lam  <mark.lam@apple.com>
1236
1237         WorkQueue::dispatchAfter() on Windows fires early.
1238         https://bugs.webkit.org/show_bug.cgi?id=147992
1239
1240         Reviewed by Brent Fulgham.
1241
1242         The Windows implementation of WorkQueue::dispatchAfter() uses CreateTimerQueueTimer().
1243         Unfortunately, CreateTimerQueueTimer() is sloppy and can fire early.  We need to compensate
1244         for this slop to ensure that the specified duration does expire before the callback function
1245         is called.  Otherwise, the JSC watchdog (which depends on this) can fail randomly.
1246
1247         * wtf/win/WorkQueueWin.cpp:
1248         (WTF::WorkQueue::dispatchAfter):
1249
1250 2015-08-13  Filip Pizlo  <fpizlo@apple.com>
1251
1252         WTF should have a compact Condition object to use with Lock
1253         https://bugs.webkit.org/show_bug.cgi?id=147986
1254
1255         Reviewed by Geoffrey Garen.
1256
1257         Adds a condition variable implementation based on ParkingLot, called simply WTF::Condition.
1258         It can be used with WTF::Lock or actually any lock implementation. It should even work with
1259         WTF::SpinLock, WTF::Mutex, or std::mutex. Best of all, Condition only requires one byte.
1260
1261         ParkingLot almost contained all of the functionality needed to implemenet wait/notify. We
1262         could have implemented Condition using a 32-bit (or even 64-bit) version that protects
1263         against a notify that happens just before we park. But, this changes the ParkingLot API to
1264         give us the ability to run some code between when ParkingLot enqueues the current thread
1265         and when it actually sleeps. This callback is called with no locks held, so it can call
1266         unlock() on any kind of lock, so long as that lock's unlock() method doesn't recurse into
1267         ParkingLot::parkConditionally(). That seems unlikely; unlock() is more likely to call
1268         ParkingLot::unparkOne() or unparkAll(). WTF::Lock will never call parkConditionally()
1269         inside unlock(), so WTF::Lock is definitely appropriate for use with Condition.
1270
1271         Condition supports most of the API that std::condition_variable supports. It does some
1272         things to try to reduce footgun potential. The preferred timeout form is waitUntil() which
1273         takes an absolute time from the steady_clock. The only relative timeout form also takes a
1274         predicate callback, so it's impossible to write the subtly incorrect
1275         "while (...) wait_for(...)" idiom.
1276
1277         This patch doesn't actually introduce any uses of WTF::Condition other than the unit tests.
1278         I'll start switching code over to using WTF::Condition in another patch.
1279
1280         * WTF.vcxproj/WTF.vcxproj:
1281         * WTF.xcodeproj/project.pbxproj:
1282         * wtf/CMakeLists.txt:
1283         * wtf/Condition.h: Added.
1284         (WTF::Condition::Condition):
1285         (WTF::Condition::waitUntil):
1286         (WTF::Condition::waitFor):
1287         (WTF::Condition::wait):
1288         (WTF::Condition::notifyOne):
1289         (WTF::Condition::notifyAll):
1290         * wtf/Lock.cpp:
1291         (WTF::LockBase::unlockSlow): Make this useful assertion be a release assertion. It catches cases where you unlock the lock even though you don't hold it.
1292         * wtf/ParkingLot.cpp:
1293         (WTF::ParkingLot::parkConditionally): Add the beforeSleep() callback.
1294         (WTF::ParkingLot::unparkOne):
1295         * wtf/ParkingLot.h:
1296         (WTF::ParkingLot::compareAndPark):
1297
1298 2015-08-12  Anders Carlsson  <andersca@apple.com>
1299
1300         Use WTF::Optional in WindowFeatures
1301         https://bugs.webkit.org/show_bug.cgi?id=147956
1302
1303         Reviewed by Sam Weinig.
1304
1305         Add new operators to WTF::Optional to make it more like std::optional.
1306
1307         * wtf/Optional.h:
1308         (WTF::Optional::operator->):
1309         (WTF::Optional::operator*):
1310
1311 2015-08-12  Filip Pizlo  <fpizlo@apple.com>
1312
1313         WTF::Lock should not suffer from the thundering herd
1314         https://bugs.webkit.org/show_bug.cgi?id=147947
1315
1316         Reviewed by Geoffrey Garen.
1317
1318         This changes Lock::unlockSlow() to use unparkOne() instead of unparkAll(). The problem with
1319         doing this is that it's not obvious after calling unparkOne() if there are any other threads
1320         that are still parked on the lock's queue. If we assume that there are and leave the
1321         hasParkedBit set, then future calls to unlock() will take the slow path. We don't want that
1322         if there aren't actually any threads parked. On the other hand, if we assume that there
1323         aren't any threads parked and clear the hasParkedBit, then if there actually were some
1324         threads parked, then they may never be awoken since future calls to unlock() won't take slow
1325         path and so won't call unparkOne(). In other words, we need a way to be very precise about
1326         when we clear the hasParkedBit and we need to do it in a race-free way: it can't be the case
1327         that we clear the bit just as some thread gets parked on the queue.
1328
1329         A similar problem arises in futexes, and one of the solutions is to have a thread that
1330         acquires a lock after parking sets the hasParkedBit. This is what Rusty Russel's usersem
1331         does. It's a subtle algorithm. Also, it means that if a thread barges in before the unparked
1332         thread runs, then that barging thread will not know that there are threads parked. This
1333         could increase the severity of barging.
1334
1335         Since ParkingLot is a user-level API, we don't have to worry about the kernel-user security
1336         issues and so we can expose callbacks while ParkingLot is holding its internal locks. This
1337         change does exactly that for unparkOne(). The new variant of unparkOne() will call a user
1338         function while the queue from which we are unparking is locked. The callback is told basic
1339         stats about the queue: did we unpark a thread this time, and could there be more threads to
1340         unpark in the future. The callback runs while it's impossible for the queue state to change,
1341         since the ParkingLot's internal locks for the queue is held. This means that
1342         Lock::unlockSlow() can either clear, or leave, the hasParkedBit while releasing the lock
1343         inside the callback from unparkOne(). This takes care of the thundering herd problem while
1344         also reducing the greed that arises from barging threads.
1345
1346         This required some careful reworking of the ParkingLot algorithm. The first thing I noticed
1347         was that the ThreadData::shouldPark flag was useless, since it's set exactly when
1348         ThreadData::address is non-null. Then I had to make sure that dequeue() could lazily create
1349         both hashtables and buckets, since the "callback is called while queue is locked" invariant
1350         requires that we didn't exit early due to the hashtable or bucket not being present. Note
1351         that all of this is done in such a way that the old unparkOne() and unparkAll() don't have
1352         to create any buckets, though they now may create the hashtable. We don't care as much about
1353         the hashtable being created by unpark since it's just such an unlikely scenario and it would
1354         only happen once.
1355
1356         This change reduces the kernel CPU usage of WTF::Lock for the long critical section test by
1357         about 8x and makes it always perform as well as WTF::WordLock and WTF::Mutex for that
1358         benchmark.
1359
1360         * benchmarks/LockSpeedTest.cpp:
1361         * wtf/Lock.cpp:
1362         (WTF::LockBase::unlockSlow):
1363         * wtf/Lock.h:
1364         (WTF::LockBase::isLocked):
1365         (WTF::LockBase::isFullyReset):
1366         * wtf/ParkingLot.cpp:
1367         (WTF::ParkingLot::parkConditionally):
1368         (WTF::ParkingLot::unparkOne):
1369         (WTF::ParkingLot::unparkAll):
1370         * wtf/ParkingLot.h:
1371         * wtf/WordLock.h:
1372         (WTF::WordLock::isLocked):
1373         (WTF::WordLock::isFullyReset):
1374
1375 2015-08-11  Filip Pizlo  <fpizlo@apple.com>
1376
1377         Always use a byte-sized lock implementation
1378         https://bugs.webkit.org/show_bug.cgi?id=147908
1379
1380         Reviewed by Geoffrey Garen.
1381
1382         At the start of my locking algorithm crusade, I implemented Lock, which is a sizeof(void*)
1383         lock implementation with some nice theoretical properties and good performance. Then I added
1384         the ParkingLot abstraction and ByteLock. ParkingLot uses Lock in its implementation.
1385         ByteLock uses ParkingLot to create a sizeof(char) lock implementation that performs like
1386         Lock.
1387
1388         It turns out that ByteLock is always at least as good as Lock, and sometimes a lot better:
1389         it requires 8x less memory on 64-bit systems. It's hard to construct a benchmark where
1390         ByteLock is significantly slower than Lock, and when you do construct such a benchmark,
1391         tweaking it a bit can also create a scenario where ByteLock is significantly faster than
1392         Lock.
1393
1394         So, the thing that we call "Lock" should really use ByteLock's algorithm, since it is more
1395         compact and just as fast. That's what this patch does.
1396
1397         But we still need to keep the old Lock algorithm, because it's used to implement ParkingLot,
1398         which in turn is used to implement ByteLock. So this patch does this transformation:
1399
1400         - Move the algorithm in Lock into files called WordLock.h|cpp. Make ParkingLot use
1401           WordLock.
1402
1403         - Move the algorithm in ByteLock into Lock.h|cpp. Make everyone who used ByteLock use Lock
1404           instead. All other users of Lock now get the byte-sized lock implementation.
1405
1406         - Remove the old ByteLock files.
1407
1408         * WTF.vcxproj/WTF.vcxproj:
1409         * WTF.xcodeproj/project.pbxproj:
1410         * benchmarks/LockSpeedTest.cpp:
1411         (main):
1412         * wtf/WordLock.cpp: Added.
1413         (WTF::WordLock::lockSlow):
1414         (WTF::WordLock::unlockSlow):
1415         * wtf/WordLock.h: Added.
1416         (WTF::WordLock::WordLock):
1417         (WTF::WordLock::lock):
1418         (WTF::WordLock::unlock):
1419         (WTF::WordLock::isHeld):
1420         (WTF::WordLock::isLocked):
1421         * wtf/ByteLock.cpp: Removed.
1422         * wtf/ByteLock.h: Removed.
1423         * wtf/CMakeLists.txt:
1424         * wtf/Lock.cpp:
1425         (WTF::LockBase::lockSlow):
1426         (WTF::LockBase::unlockSlow):
1427         * wtf/Lock.h:
1428         (WTF::LockBase::lock):
1429         (WTF::LockBase::unlock):
1430         (WTF::LockBase::isHeld):
1431         (WTF::LockBase::isLocked):
1432         (WTF::Lock::Lock):
1433         * wtf/ParkingLot.cpp:
1434
1435 2015-08-11  Filip Pizlo  <fpizlo@apple.com>
1436
1437         Remove ByteSpinLock
1438         https://bugs.webkit.org/show_bug.cgi?id=147900
1439
1440         Rubber stamped by Mark Lam.
1441
1442         * WTF.xcodeproj/project.pbxproj:
1443         * wtf/ByteSpinLock.h: Removed.
1444
1445 2015-08-11  Brent Fulgham  <bfulgham@apple.com>
1446
1447         [Win] Switch Windows build to Visual Studio 2015
1448         https://bugs.webkit.org/show_bug.cgi?id=147887
1449         <rdar://problem/22235098>
1450
1451         Reviewed by Alex Christensen.
1452
1453         Update Visual Studio project file settings to use the current Visual
1454         Studio and compiler. Continue targeting binaries to run on our minimum
1455         supported configuration of Windows 7.
1456
1457         * WTF.vcxproj/WTF.vcxproj:
1458         * WTF.vcxproj/WTFGenerated.vcxproj:
1459
1460 2015-08-10  Filip Pizlo  <fpizlo@apple.com>
1461
1462         WTF should have a ParkingLot for parking sleeping threads, so that locks can fit in 1.6 bits
1463         https://bugs.webkit.org/show_bug.cgi?id=147665
1464
1465         Reviewed by Mark Lam.
1466
1467         This change adds a major new abstraction for concurrency algorithms in WebKit. It's called a
1468         ParkingLot, and it makes available a thread parking queue for each virtual address in memory.
1469         The queues are maintained by a data-access-parallel concurrent hashtable implementation. The
1470         memory usage is bounded at around half a KB per thread.
1471
1472         The ParkingLot makes it easy to turn any spinlock-based concurrency protocol into one that
1473         parks threads after a while. Because queue state management is up to the ParkingLot and not
1474         the user's data structure, this patch uses it to implement a full adaptive mutex in one byte.
1475         In fact, only three states of that byte are used (0 = available, 1 = locked, 2 = locked and
1476         there are parked threads). Hence the joke that ParkingLot allows locks that fit in 1.6 bits.
1477
1478         ByteLock is used as a replacement for ByteSpinLock in JavaScriptCore.
1479
1480         The API tests for this also demo how to create a completely fair (FIFO) binary semamphore. The
1481         comment in Lock.h shows how we could accelerate Lock performance using ParkingLot. After we
1482         are sure that this code works, we can expand the use of ParkingLot. That's covered by
1483         https://bugs.webkit.org/show_bug.cgi?id=147841.
1484
1485         * WTF.vcxproj/WTF.vcxproj:
1486         * WTF.xcodeproj/project.pbxproj:
1487         * benchmarks/LockSpeedTest.cpp:
1488         (main):
1489         * wtf/Atomics.h:
1490         (WTF::Atomic::compareExchangeWeak):
1491         (WTF::Atomic::compareExchangeStrong):
1492         * wtf/ByteLock.cpp: Added.
1493         (WTF::ByteLock::lockSlow):
1494         (WTF::ByteLock::unlockSlow):
1495         * wtf/ByteLock.h: Added.
1496         (WTF::ByteLock::ByteLock):
1497         (WTF::ByteLock::lock):
1498         (WTF::ByteLock::unlock):
1499         (WTF::ByteLock::isHeld):
1500         (WTF::ByteLock::isLocked):
1501         * wtf/CMakeLists.txt:
1502         * wtf/Lock.h:
1503         * wtf/ParkingLot.cpp: Added.
1504         (WTF::ParkingLot::parkConditionally):
1505         (WTF::ParkingLot::unparkOne):
1506         (WTF::ParkingLot::unparkAll):
1507         (WTF::ParkingLot::forEach):
1508         * wtf/ParkingLot.h: Added.
1509         (WTF::ParkingLot::compareAndPark):
1510
1511 2015-08-11  Brent Fulgham  <bfulgham@apple.com>
1512
1513         [Win] Unreviewed gardening.
1514
1515         * WTF.vcxproj/WTF.vcxproj.filters: Place file references so that files appear in correct
1516         folders in IDE.
1517
1518 2015-08-10  Youenn Fablet  <youenn.fablet@crf.canon.fr>
1519
1520         Compile warning (-Wsign-compare) on 32-bits at WebCore/platform/FileSystem.cpp
1521         https://bugs.webkit.org/show_bug.cgi?id=146414
1522
1523         Reviewed by Darin Adler.
1524
1525         Added convertSafely routine based on isInBounds routine.
1526         Updated BoundChecker by adding a third boolean parameter to this template giving whether Target has greater or equal precision than Source.
1527         Removed BoundCheckElider, which is no longer necessary and had some issues.
1528
1529         * wtf/CheckedArithmetic.h:
1530         (WTF::isInBounds):
1531         (WTF::convertSafely):
1532
1533 2015-08-07  Filip Pizlo  <fpizlo@apple.com>
1534
1535         Lightweight locks should be adaptive
1536         https://bugs.webkit.org/show_bug.cgi?id=147545
1537
1538         Reviewed by Geoffrey Garen.
1539
1540         A common idiom in WebKit is to use spinlocks. We use them because the lock acquisition
1541         overhead is lower than system locks and because they take dramatically less space than system
1542         locks. The speed and space advantages of spinlocks can be astonishing: an uncontended spinlock
1543         acquire is up to 10x faster and under microcontention - short critical section with two or
1544         more threads taking turns - spinlocks are up to 100x faster. Spinlocks take only 1 byte or 4
1545         bytes depending on the flavor, while system locks take 64 bytes or more. Clearly, WebKit
1546         should continue to avoid system locks - they are just far too slow and far too big.
1547
1548         But there is a problem with this idiom. System lock implementations will sleep a thread when
1549         it attempts to acquire a lock that is held, while spinlocks will cause the thread to burn CPU.
1550         In WebKit spinlocks, the thread will repeatedly call sched_yield(). This is awesome for
1551         microcontention, but awful when the lock will not be released for a while. In fact, when
1552         critical sections take tens of microseconds or more, the CPU time cost of our spinlocks is
1553         almost 100x more than the CPU time cost of a system lock. This case doesn't arise too
1554         frequently in our current uses of spinlocks, but that's probably because right now there are
1555         places where we make a conscious decision to use system locks - even though they use more
1556         memory and are slower - because we don't want to waste CPU cycles when a thread has to wait a
1557         while to acquire the lock.
1558
1559         The solution is to just implement a modern adaptive mutex in WTF. Luckily, this isn't a new
1560         concept. This patch implements a mutex that is reminiscent of the kinds of low-overhead locks
1561         that JVMs use. The actual implementation here is inspired by some of the ideas from [1]. The
1562         idea is simple: the fast path is an inlined CAS to immediately acquire a lock that isn't held,
1563         the slow path tries some number of spins to acquire the lock, and if that fails, the thread is
1564         put on a queue and put to sleep. The queue is made up of statically allocated thread nodes and
1565         the lock itself is a tagged pointer: either it is just bits telling us the complete lock state
1566         (not held or held) or it is a pointer to the head of a queue of threads waiting to acquire the
1567         lock. This approach gives WTF::Lock three different levels of adaptation: an inlined fast path
1568         if the lock is not contended, a short burst of spinning for microcontention, and a full-blown
1569         queue for critical sections that are held for a long time.
1570
1571         On a locking microbenchmark, this new Lock exhibits the following performance
1572         characteristics:
1573
1574         - Lock+unlock on an uncontended no-op critical section: 2x slower than SpinLock and 3x faster
1575           than a system mutex.
1576
1577         - Lock+unlock on a contended no-op critical section: 2x slower than SpinLock and 100x faster
1578           than a system mutex.
1579
1580         - CPU time spent in lock() on a lock held for a while: same as system mutex, 90x less than a
1581           SpinLock.
1582
1583         - Memory usage: sizeof(void*), so on 64-bit it's 8x less than a system mutex but 2x worse than
1584           a SpinLock.
1585
1586         This patch replaces all uses of SpinLock with Lock, since our critical sections are not
1587         no-ops so if you do basically anything in your critical section, the Lock overhead will be
1588         invisible. Also, in all places where we used SpinLock, we could tolerate 8 bytes of overhead
1589         instead of 4. Performance benchmarking using JSC macrobenchmarks shows no difference, which is
1590         as it should be: the purpose of this change is to reduce CPU time wasted, not wallclock time.
1591         This patch doesn't replace any uses of ByteSpinLock, since we expect that the space benefits
1592         of having a lock that just uses a byte are still better than the CPU wastage benefits of
1593         Lock. But, this work will enable some future work to create locks that will fit in just 1.6
1594         bits: https://bugs.webkit.org/show_bug.cgi?id=147665.
1595         
1596         Rolling this back in after fixing Lock::unlockSlow() for architectures that have a truly weak
1597         CAS. Since the Lock::unlock() fast path can go to slow path spuriously, it may go there even if
1598         there aren't any threads on the Lock's queue. So, unlockSlow() must be able to deal with the
1599         possibility of a null queue head.
1600
1601         [1] http://www.filpizlo.com/papers/pizlo-pppj2011-fable.pdf
1602
1603         * WTF.vcxproj/WTF.vcxproj:
1604         * WTF.xcodeproj/project.pbxproj:
1605         * benchmarks: Added.
1606         * benchmarks/LockSpeedTest.cpp: Added.
1607         (main):
1608         * wtf/Atomics.h:
1609         (WTF::Atomic::compareExchangeWeak):
1610         (WTF::Atomic::compareExchangeStrong):
1611         * wtf/CMakeLists.txt:
1612         * wtf/Lock.cpp: Added.
1613         (WTF::LockBase::lockSlow):
1614         (WTF::LockBase::unlockSlow):
1615         * wtf/Lock.h: Added.
1616         (WTF::LockBase::lock):
1617         (WTF::LockBase::unlock):
1618         (WTF::LockBase::isHeld):
1619         (WTF::LockBase::isLocked):
1620         (WTF::Lock::Lock):
1621         * wtf/MetaAllocator.cpp:
1622         (WTF::MetaAllocator::release):
1623         (WTF::MetaAllocatorHandle::shrink):
1624         (WTF::MetaAllocator::allocate):
1625         (WTF::MetaAllocator::currentStatistics):
1626         (WTF::MetaAllocator::addFreshFreeSpace):
1627         (WTF::MetaAllocator::debugFreeSpaceSize):
1628         * wtf/MetaAllocator.h:
1629         * wtf/SpinLock.h:
1630         * wtf/ThreadingPthreads.cpp:
1631         * wtf/ThreadingWin.cpp:
1632         * wtf/text/AtomicString.cpp:
1633         * wtf/text/AtomicStringImpl.cpp:
1634         (WTF::AtomicStringTableLocker::AtomicStringTableLocker):
1635
1636 2015-08-05  Filip Pizlo  <fpizlo@apple.com>
1637
1638         Unreviewed, roll out http://trac.webkit.org/changeset/187972.
1639
1640         * wtf/Atomics.cpp:
1641         (WTF::getSwapLock):
1642         (WTF::atomicStep):
1643         * wtf/MessageQueue.h:
1644         (WTF::MessageQueue::infiniteTime):
1645         (WTF::MessageQueue<DataType>::append):
1646         (WTF::MessageQueue<DataType>::appendAndKill):
1647         (WTF::MessageQueue<DataType>::appendAndCheckEmpty):
1648         (WTF::MessageQueue<DataType>::prepend):
1649         (WTF::MessageQueue<DataType>::removeIf):
1650         (WTF::MessageQueue<DataType>::isEmpty):
1651         (WTF::MessageQueue<DataType>::kill):
1652         (WTF::MessageQueue<DataType>::killed):
1653         * wtf/ParallelJobsGeneric.cpp:
1654         (WTF::ParallelEnvironment::ThreadPrivate::execute):
1655         (WTF::ParallelEnvironment::ThreadPrivate::waitForFinish):
1656         (WTF::ParallelEnvironment::ThreadPrivate::workerThread):
1657         * wtf/ParallelJobsGeneric.h:
1658         * wtf/RunLoop.cpp:
1659         (WTF::RunLoop::performWork):
1660         (WTF::RunLoop::dispatch):
1661         * wtf/RunLoop.h:
1662         * wtf/ThreadSpecificWin.cpp:
1663         (WTF::destructorsList):
1664         (WTF::destructorsMutex):
1665         (WTF::threadSpecificKeyCreate):
1666         (WTF::threadSpecificKeyDelete):
1667         (WTF::ThreadSpecificThreadExit):
1668         * wtf/Threading.cpp:
1669         (WTF::threadEntryPoint):
1670         (WTF::createThread):
1671         * wtf/ThreadingPrimitives.h:
1672         * wtf/ThreadingPthreads.cpp:
1673         (WTF::threadMapMutex):
1674         (WTF::initializeThreading):
1675         (WTF::identifierByPthreadHandle):
1676         (WTF::establishIdentifierForPthreadHandle):
1677         (WTF::changeThreadPriority):
1678         (WTF::waitForThreadCompletion):
1679         (WTF::detachThread):
1680         (WTF::threadDidExit):
1681         (WTF::currentThread):
1682         (WTF::Mutex::Mutex):
1683         (WTF::Mutex::~Mutex):
1684         (WTF::Mutex::lock):
1685         (WTF::Mutex::tryLock):
1686         (WTF::Mutex::unlock):
1687         (WTF::ThreadCondition::~ThreadCondition):
1688         (WTF::ThreadCondition::wait):
1689         (WTF::ThreadCondition::timedWait):
1690         (WTF::DeprecatedMutex::DeprecatedMutex): Deleted.
1691         (WTF::DeprecatedMutex::~DeprecatedMutex): Deleted.
1692         (WTF::DeprecatedMutex::lock): Deleted.
1693         (WTF::DeprecatedMutex::tryLock): Deleted.
1694         (WTF::DeprecatedMutex::unlock): Deleted.
1695         * wtf/ThreadingWin.cpp:
1696         (WTF::initializeCurrentThreadInternal):
1697         (WTF::threadMapMutex):
1698         (WTF::initializeThreading):
1699         (WTF::storeThreadHandleByIdentifier):
1700         (WTF::threadHandleForIdentifier):
1701         (WTF::clearThreadHandleForIdentifier):
1702         (WTF::currentThread):
1703         (WTF::Mutex::Mutex):
1704         (WTF::Mutex::~Mutex):
1705         (WTF::Mutex::lock):
1706         (WTF::Mutex::tryLock):
1707         (WTF::Mutex::unlock):
1708         (WTF::ThreadCondition::~ThreadCondition):
1709         (WTF::ThreadCondition::wait):
1710         (WTF::ThreadCondition::timedWait):
1711         (WTF::DeprecatedMutex::DeprecatedMutex): Deleted.
1712         (WTF::DeprecatedMutex::~DeprecatedMutex): Deleted.
1713         (WTF::DeprecatedMutex::lock): Deleted.
1714         (WTF::DeprecatedMutex::tryLock): Deleted.
1715         (WTF::DeprecatedMutex::unlock): Deleted.
1716         * wtf/WorkQueue.h:
1717         * wtf/dtoa.cpp:
1718         * wtf/dtoa.h:
1719         * wtf/efl/DispatchQueueEfl.cpp:
1720         (DispatchQueue::dispatch):
1721         (DispatchQueue::performWork):
1722         (DispatchQueue::performTimerWork):
1723         (DispatchQueue::insertTimerWorkItem):
1724         (DispatchQueue::wakeUpThread):
1725         (DispatchQueue::getNextTimeOut):
1726         * wtf/efl/DispatchQueueEfl.h:
1727         * wtf/efl/RunLoopEfl.cpp:
1728         (WTF::RunLoop::wakeUpEvent):
1729         (WTF::RunLoop::wakeUp):
1730         * wtf/threads/BinarySemaphore.cpp:
1731         (WTF::BinarySemaphore::signal):
1732         (WTF::BinarySemaphore::wait):
1733         * wtf/threads/BinarySemaphore.h:
1734         * wtf/win/WorkQueueWin.cpp:
1735         (WTF::WorkQueue::handleCallback):
1736         (WTF::WorkQueue::platformInvalidate):
1737         (WTF::WorkQueue::dispatch):
1738         (WTF::WorkQueue::timerCallback):
1739         (WTF::WorkQueue::dispatchAfter):
1740
1741 2015-08-05  Filip Pizlo  <fpizlo@apple.com>
1742
1743         Unreviewed, fix Windows.
1744
1745         * wtf/ThreadSpecificWin.cpp:
1746         (WTF::destructorsList):
1747         (WTF::destructorsMutex):
1748         (WTF::threadSpecificKeyCreate):
1749         (WTF::threadSpecificKeyDelete):
1750         (WTF::ThreadSpecificThreadExit):
1751
1752 2015-08-04  Filip Pizlo  <fpizlo@apple.com>
1753
1754         Rename Mutex to DeprecatedMutex
1755         https://bugs.webkit.org/show_bug.cgi?id=147675
1756
1757         Reviewed by Geoffrey Garen.
1758
1759         * wtf/Atomics.cpp:
1760         (WTF::getSwapLock):
1761         (WTF::atomicStep):
1762         * wtf/MessageQueue.h:
1763         (WTF::MessageQueue::infiniteTime):
1764         (WTF::MessageQueue<DataType>::append):
1765         (WTF::MessageQueue<DataType>::appendAndKill):
1766         (WTF::MessageQueue<DataType>::appendAndCheckEmpty):
1767         (WTF::MessageQueue<DataType>::prepend):
1768         (WTF::MessageQueue<DataType>::removeIf):
1769         (WTF::MessageQueue<DataType>::isEmpty):
1770         (WTF::MessageQueue<DataType>::kill):
1771         (WTF::MessageQueue<DataType>::killed):
1772         * wtf/ParallelJobsGeneric.cpp:
1773         (WTF::ParallelEnvironment::ThreadPrivate::execute):
1774         (WTF::ParallelEnvironment::ThreadPrivate::waitForFinish):
1775         (WTF::ParallelEnvironment::ThreadPrivate::workerThread):
1776         * wtf/ParallelJobsGeneric.h:
1777         * wtf/RunLoop.cpp:
1778         (WTF::RunLoop::performWork):
1779         (WTF::RunLoop::dispatch):
1780         * wtf/RunLoop.h:
1781         * wtf/Threading.cpp:
1782         (WTF::threadEntryPoint):
1783         (WTF::createThread):
1784         * wtf/ThreadingPrimitives.h:
1785         * wtf/ThreadingPthreads.cpp:
1786         (WTF::threadMapMutex):
1787         (WTF::initializeThreading):
1788         (WTF::identifierByPthreadHandle):
1789         (WTF::establishIdentifierForPthreadHandle):
1790         (WTF::changeThreadPriority):
1791         (WTF::waitForThreadCompletion):
1792         (WTF::detachThread):
1793         (WTF::threadDidExit):
1794         (WTF::currentThread):
1795         (WTF::DeprecatedMutex::DeprecatedMutex):
1796         (WTF::DeprecatedMutex::~DeprecatedMutex):
1797         (WTF::DeprecatedMutex::lock):
1798         (WTF::DeprecatedMutex::tryLock):
1799         (WTF::DeprecatedMutex::unlock):
1800         (WTF::ThreadCondition::~ThreadCondition):
1801         (WTF::ThreadCondition::wait):
1802         (WTF::ThreadCondition::timedWait):
1803         (WTF::Mutex::Mutex): Deleted.
1804         (WTF::Mutex::~Mutex): Deleted.
1805         (WTF::Mutex::lock): Deleted.
1806         (WTF::Mutex::tryLock): Deleted.
1807         (WTF::Mutex::unlock): Deleted.
1808         * wtf/ThreadingWin.cpp:
1809         (WTF::initializeCurrentThreadInternal):
1810         (WTF::threadMapMutex):
1811         (WTF::initializeThreading):
1812         (WTF::storeThreadHandleByIdentifier):
1813         (WTF::threadHandleForIdentifier):
1814         (WTF::clearThreadHandleForIdentifier):
1815         (WTF::currentThread):
1816         (WTF::DeprecatedMutex::DeprecatedMutex):
1817         (WTF::DeprecatedMutex::~DeprecatedMutex):
1818         (WTF::DeprecatedMutex::lock):
1819         (WTF::DeprecatedMutex::tryLock):
1820         (WTF::DeprecatedMutex::unlock):
1821         (WTF::ThreadCondition::~ThreadCondition):
1822         (WTF::ThreadCondition::wait):
1823         (WTF::ThreadCondition::timedWait):
1824         (WTF::Mutex::Mutex): Deleted.
1825         (WTF::Mutex::~Mutex): Deleted.
1826         (WTF::Mutex::lock): Deleted.
1827         (WTF::Mutex::tryLock): Deleted.
1828         (WTF::Mutex::unlock): Deleted.
1829         * wtf/WorkQueue.h:
1830         * wtf/dtoa.cpp:
1831         * wtf/dtoa.h:
1832         * wtf/efl/DispatchQueueEfl.cpp:
1833         (DispatchQueue::dispatch):
1834         (DispatchQueue::performWork):
1835         (DispatchQueue::performTimerWork):
1836         (DispatchQueue::insertTimerWorkItem):
1837         (DispatchQueue::wakeUpThread):
1838         (DispatchQueue::getNextTimeOut):
1839         * wtf/efl/DispatchQueueEfl.h:
1840         * wtf/efl/RunLoopEfl.cpp:
1841         (WTF::RunLoop::wakeUpEvent):
1842         (WTF::RunLoop::wakeUp):
1843         * wtf/threads/BinarySemaphore.cpp:
1844         (WTF::BinarySemaphore::signal):
1845         (WTF::BinarySemaphore::wait):
1846         * wtf/threads/BinarySemaphore.h:
1847         * wtf/win/WorkQueueWin.cpp:
1848         (WTF::WorkQueue::handleCallback):
1849         (WTF::WorkQueue::platformInvalidate):
1850         (WTF::WorkQueue::dispatch):
1851         (WTF::WorkQueue::timerCallback):
1852         (WTF::WorkQueue::dispatchAfter):
1853
1854 2015-08-04  Alex Christensen  <achristensen@webkit.org>
1855
1856         Fix quirks with CMake and VS2015
1857         https://bugs.webkit.org/show_bug.cgi?id=147663
1858
1859         Reviewed by Brent Fulgham.
1860
1861         * wtf/Platform.h:
1862         Build fix after r187908
1863
1864 2015-08-04  Brent Fulgham  <bfulgham@apple.com>
1865
1866         [Win] Update Apple Windows build for VS2015
1867         https://bugs.webkit.org/show_bug.cgi?id=147653
1868
1869         Reviewed by Dean Jackson.
1870
1871         * WTF.vcxproj/WTF.vcxproj.filters: Drive-by-fix to place files in
1872         proper project locations in the IDE.
1873         * wtf/Platform.h: Don't define the _HAS_EXCEPTIONS macro when building with
1874         Visual Studio 2015.
1875
1876 2015-08-04  Commit Queue  <commit-queue@webkit.org>
1877
1878         Unreviewed, rolling out r187815 and r187817.
1879         https://bugs.webkit.org/show_bug.cgi?id=147644
1880
1881         Caused lots of Windows crashes (Requested by smfr on #webkit).
1882
1883         Reverted changesets:
1884
1885         "[WTF] Turn tryMakeString(), makeString() into variadic
1886         templates"
1887         https://bugs.webkit.org/show_bug.cgi?id=147142
1888         http://trac.webkit.org/changeset/187815
1889
1890         "Unreviewed build fix."
1891         http://trac.webkit.org/changeset/187817
1892
1893 2015-08-04  Alex Christensen  <achristensen@webkit.org>
1894
1895         Enable WebGL on Windows CMake build.
1896         https://bugs.webkit.org/show_bug.cgi?id=143311
1897
1898         Reviewed by Csaba Osztrogonác.
1899
1900         * wtf/FeatureDefines.h:
1901         Made the CMake feature defines the same as the non-CMake feature defines.
1902
1903 2015-08-03  Csaba Osztrogonác  <ossy@webkit.org>
1904
1905         Introduce COMPILER(GCC_OR_CLANG) guard and make COMPILER(GCC) true only for GCC
1906         https://bugs.webkit.org/show_bug.cgi?id=146833
1907
1908         Reviewed by Alexey Proskuryakov.
1909
1910         * wtf/Assertions.cpp:
1911         * wtf/Assertions.h: Removed redundant COMPILER(CLANG) guard.
1912         * wtf/Atomics.cpp:
1913         * wtf/Atomics.h:
1914         (WTF::weakCompareAndSwap):
1915         (WTF::compilerFence):
1916         * wtf/Compiler.h:
1917          - Renamed COMPILER(GCC) to COMPILER(GCC_OR_CLANG), because it is true for both compiler.
1918          - Added COMPILER(GCC) which is true only for GCC.
1919          - Moved all GCC related stuff to one block and removed redundant guards accordingly.
1920          - Removed the unused default false definition of GCC_VERSION_AT_LEAST for non GCC compilers.
1921         * wtf/ExportMacros.h:
1922         * wtf/FastMalloc.h:
1923         * wtf/Platform.h:
1924         * wtf/StdLibExtras.h:
1925         * wtf/Vector.h:
1926         * wtf/text/ASCIIFastPath.h:
1927         (WTF::copyLCharsFromUCharSource):
1928
1929 2015-08-03  Zan Dobersek  <zdobersek@igalia.com>
1930
1931         Unreviewed build fix.
1932
1933         * wtf/text/StringConcatenate.h: Include <tuple> to avoid missing
1934         std::tuple<> class definitions.
1935
1936 2015-08-03  Zan Dobersek  <zdobersek@igalia.com>
1937
1938         [WTF] Turn tryMakeString(), makeString() into variadic templates
1939         https://bugs.webkit.org/show_bug.cgi?id=147142
1940
1941         Reviewed by Sam Weinig.
1942
1943         Built upon the original work by Anders Carlsson, Mark Rowe and Sam Weinig.
1944
1945         Implement tryMakeString() and makeString() as variadic templates, replacing
1946         the argument count-based overloads.
1947
1948         tryMakeString() now constructs a stack-based tuple of necessary StringTypeAdapter
1949         objects and utilizes the StringAdapterTuple struct template to operate on that
1950         tuple, recursively calling the necessary operations on each element in the tuple.
1951         This effectively mimics the process of previous tryMakeString() implementation,
1952         but makes it scalable to a tuple of elements that are to be concatenated.
1953
1954         StringAppend class template now stores two StringTypeAdapter objects for the
1955         two passed-in string objects, packed in a tuple, calling
1956         StringAdapterTuple<>::createString() directly when concatenating the two objects
1957         into one String.
1958
1959         * wtf/text/StringConcatenate.h:
1960         (WTF::StringTypeAdapter<char>::length):
1961         (WTF::StringTypeAdapter<char>::is8Bit):
1962         (WTF::StringAdapterTuple::sumWithOverflow):
1963         (WTF::StringAdapterTuple::is8Bit):
1964         (WTF::StringAdapterTuple::writeTo):
1965         (WTF::StringAdapterTuple::createString):
1966         (WTF::tryMakeString):
1967         (WTF::makeString):
1968         (WTF::sumWithOverflow): Deleted.
1969         * wtf/text/StringOperators.h:
1970         (WTF::StringAppend::StringAppend):
1971         (WTF::StringAppend::operator String):
1972         (WTF::StringAppend::is8Bit):
1973         (WTF::StringAppend::writeTo):
1974         (WTF::StringAppend::length):
1975         (WTF::StringAppend::string1):
1976         (WTF::StringAppend::string2):
1977
1978 2015-08-03  Anders Carlsson  <andersca@apple.com>
1979
1980         Make it possible to use String::utf8() in the debugger
1981         https://bugs.webkit.org/show_bug.cgi?id=147566
1982
1983         Reviewed by Tim Horton.
1984
1985         Add a new utf8() overload that doesn't take any parameters and just calls utf8(LenientConversion), since lldb doesn't support evaluating
1986         function calls with default parameters at the moment.
1987
1988         * wtf/text/WTFString.cpp:
1989         (WTF::String::utf8):
1990         * wtf/text/WTFString.h:
1991
1992 2015-08-02  Benjamin Poulain  <bpoulain@apple.com>
1993
1994         Investigate HashTable::HashTable(const HashTable&) and HashTable::operator=(const HashTable&) performance for hash-based static analyses
1995         https://bugs.webkit.org/show_bug.cgi?id=118455
1996
1997         Reviewed by Filip Pizlo.
1998
1999         Previously, when copying a HashTable, we would start from scratch
2000         with an empty table and insert elements one by one, growing-rehashing
2001         the table as needed.
2002
2003         With this patch, we have 2 improvements to remove most of the cost.
2004
2005         First, we compute a good size from the start. This removes all the
2006         reallocations and rehashs.
2007         This is where the biggest gain comes from.
2008
2009         The second part is a simpler version of add() when we know that
2010         we cannot find a bucket with the same key and there cannot
2011         be any deleted bucket.
2012         This removes most branches from the hot loop, cutting another 25%
2013         of the time.
2014
2015         * wtf/HashTable.h:
2016         (WTF::KeyTraits>::addUniqueForInitialization):
2017         (WTF::KeyTraits>::HashTable):
2018
2019 2015-08-01  Myles C. Maxfield  <mmaxfield@apple.com>
2020
2021         HashTraits<AtomicString> can use SimpleClassHashTraits
2022         https://bugs.webkit.org/show_bug.cgi?id=147528
2023
2024         Reviewed by Andreas Kling.
2025
2026         No point in duplicating the code inside SimpleClassHashTraits.
2027
2028         * wtf/text/AtomicStringHash.h:
2029         (WTF::HashTraits<WTF::AtomicString>::constructDeletedValue): Deleted.
2030         (WTF::HashTraits<WTF::AtomicString>::isDeletedValue): Deleted.
2031
2032 2015-08-01  Alex Christensen  <achristensen@webkit.org>
2033
2034         Fix compile errors with VS2015
2035         https://bugs.webkit.org/show_bug.cgi?id=147526
2036
2037         Reviewed by Myles Maxfield.
2038
2039         * wtf/StringExtras.h:
2040         (snprintf):
2041         (wtf_vsnprintf):
2042         VS2015 has an implementation of snprintf.
2043
2044 2015-07-31  Alex Christensen  <achristensen@webkit.org>
2045
2046         Prepare for VS2015
2047         https://bugs.webkit.org/show_bug.cgi?id=146579
2048
2049         Reviewed by Jon Honeycutt.
2050
2051         * wtf/StdLibExtras.h:
2052         (std::exchange):
2053         Added preprocessor macros around functions implemented in VS2015's standard library.
2054
2055 2015-07-30  Chris Dumez  <cdumez@apple.com>
2056
2057         Mark more classes as fast allocated
2058         https://bugs.webkit.org/show_bug.cgi?id=147440
2059
2060         Reviewed by Sam Weinig.
2061
2062         Mark more classes as fast allocated for performance. We heap-allocate
2063         objects of those types throughout the code base.
2064
2065         * wtf/Bag.h:
2066         * wtf/SegmentedVector.h:
2067         * wtf/SentinelLinkedList.h:
2068
2069 2015-07-29  Basile Clement  <basile_clement@apple.com>
2070
2071         Remove native call inlining
2072         https://bugs.webkit.org/show_bug.cgi?id=147417
2073
2074         Rubber-stamped by Filip Pizlo.
2075
2076         * wtf/Platform.h:
2077
2078 2015-07-28  Yusuke Suzuki  <utatane.tea@gmail.com>
2079
2080         [ES6] Add ENABLE_ES6_MODULES compile time flag with the default value "false"
2081         https://bugs.webkit.org/show_bug.cgi?id=147350
2082
2083         Reviewed by Sam Weinig.
2084
2085         * wtf/FeatureDefines.h:
2086
2087 2015-07-28  Filip Pizlo  <fpizlo@apple.com>
2088
2089         Unreviewed, fix Windows build.
2090
2091         * wtf/MetaAllocatorHandle.h:
2092         (WTF::MetaAllocatorHandle::key):
2093
2094 2015-07-27  Filip Pizlo  <fpizlo@apple.com>
2095
2096         Add logging when executable code gets deallocated
2097         https://bugs.webkit.org/show_bug.cgi?id=147355
2098
2099         Reviewed by Mark Lam.
2100
2101         * wtf/MetaAllocator.cpp:
2102         (WTF::MetaAllocatorHandle::dump): It's useful to be able to dump these.
2103         * wtf/MetaAllocatorHandle.h:
2104
2105 2015-07-28  Benjamin Poulain  <bpoulain@apple.com>
2106
2107         Speed up StringBuilder::appendQuotedJSONString()
2108         https://bugs.webkit.org/show_bug.cgi?id=147352
2109
2110         Reviewed by Andreas Kling.
2111
2112         * wtf/text/StringBuilder.cpp:
2113         (WTF::appendQuotedJSONStringInternal):
2114         The cases '"' and '\\' are not that uncommon, and they can easily
2115         be handled in the original branch testing for them.
2116
2117         This is about 2.5% better on the JSON.stringify test.
2118
2119 2015-07-27  Alex Christensen  <achristensen@webkit.org>
2120
2121         Progress towards building AppleWin with CMake
2122         https://bugs.webkit.org/show_bug.cgi?id=147325
2123
2124         Reviewed by Martin Robinson.
2125
2126         * wtf/PlatformWin.cmake:
2127         Link with CoreFoundation.lib.
2128
2129 2015-07-25  Carlos Alberto Lopez Perez  <clopez@igalia.com>
2130
2131         REGRESSION (bmalloc): WebKit performance tests don't report memory stats.
2132         https://bugs.webkit.org/show_bug.cgi?id=141247
2133
2134         Reviewed by Geoffrey Garen.
2135
2136         Meanwhile a better way of getting memory stats with bmalloc is not found
2137         (see bug 136592), we can report as memory stats the resident set size
2138         information that the operating system provides to us.
2139
2140         This at least should be good enough to get back the memory stats on the
2141         performance tests and being able to track down memory usage regressions
2142         at https://perf.webkit.org
2143
2144         * wtf/FastMalloc.cpp:
2145         (WTF::fastMallocStatistics): Report maxrss data as committedVMBytes.
2146
2147 2015-07-24  Csaba Osztrogonác  <ossy@webkit.org>
2148
2149         Remove the unused GCC workaround - std::is_trivially_destructible
2150         https://bugs.webkit.org/show_bug.cgi?id=147226
2151
2152         Reviewed by Darin Adler.
2153
2154         * wtf/StdLibExtras.h:
2155
2156 2015-07-23  Alex Christensen  <achristensen@webkit.org>
2157
2158         Remove compile and runtime flags for promises.
2159         https://bugs.webkit.org/show_bug.cgi?id=147244
2160
2161         Reviewed by Yusuke Suzuki.
2162
2163         * wtf/FeatureDefines.h:
2164
2165 2015-07-22  Sukolsak Sakshuwong  <sukolsak@gmail.com>
2166
2167         Add ENABLE_WEBASSEMBLY feature flag for WebAssembly
2168         https://bugs.webkit.org/show_bug.cgi?id=147212
2169
2170         Reviewed by Filip Pizlo.
2171
2172         * wtf/FeatureDefines.h:
2173
2174 2015-07-22  Filip Pizlo  <fpizlo@apple.com>
2175
2176         Introduce release assert for using threads before threading is initialized
2177         https://bugs.webkit.org/show_bug.cgi?id=147200
2178
2179         Reviewed by Michael Saboff.
2180         
2181         This will help bugs where you use createThread() before calling initializeThreading().
2182
2183         * wtf/ThreadIdentifierDataPthreads.cpp:
2184         (WTF::ThreadIdentifierData::initialize):
2185
2186 2015-07-21  Daniel Bates  <dabates@apple.com>
2187
2188         WTFCrash() in WebKit::WebProcess::networkConnection()
2189         https://bugs.webkit.org/show_bug.cgi?id=147112
2190         <rdar://problem/18477459>
2191
2192         Reviewed by Gavin Barraclough.
2193
2194         Add explicit boolean conversion function and remove overload of operator! to support
2195         checking whether an activity token is valid more directly than using the overloaded operator!.
2196
2197         * wtf/RefCounter.h:
2198         (WTF::RefCounter::Token::operator bool): Added.
2199         (WTF::RefCounter::Token::operator!): Deleted.
2200
2201 2015-07-20  Mark Lam  <mark.lam@apple.com>
2202
2203         Rollout r187020 and r187021: breaks JSC API tests on debug builds.
2204         https://bugs.webkit.org/show_bug.cgi?id=147110
2205
2206         * wtf/WTFThreadData.cpp:
2207         (WTF::WTFThreadData::WTFThreadData):
2208         * wtf/WTFThreadData.h:
2209         (WTF::WTFThreadData::stack):
2210
2211 2015-07-20  Alex Christensen  <achristensen@webkit.org>
2212
2213         Resurrect CMake build on Windows.
2214         https://bugs.webkit.org/show_bug.cgi?id=147083
2215
2216         Reviewed by Gyuyoung Kim.
2217
2218         * wtf/PlatformWin.cmake:
2219
2220 2015-07-20  Per Arne Vollan  <peavo@outlook.com>
2221
2222         JavaScriptCore performance is very bad on Windows
2223         https://bugs.webkit.org/show_bug.cgi?id=146448
2224
2225         Reviewed by Mark Lam.
2226
2227         Updating the stack bounds is time consuming.
2228         Only update the stack bounds when a new fiber is running.
2229
2230         * wtf/WTFThreadData.cpp:
2231         (WTF::WTFThreadData::WTFThreadData):
2232         * wtf/WTFThreadData.h:
2233         (WTF::WTFThreadData::stack):
2234
2235 2015-07-20  Julien Brianceau  <julien.brianceau@gmail.com>
2236
2237         Use isnan from std namespace in Stopwatch.h.
2238         https://bugs.webkit.org/show_bug.cgi?id=146911
2239
2240         Reviewed by Žan Doberšek.
2241
2242         * wtf/Stopwatch.h:
2243         (WTF::Stopwatch::isActive):
2244         (WTF::Stopwatch::start):
2245         (WTF::Stopwatch::stop):
2246         (WTF::Stopwatch::elapsedTime):
2247
2248 2015-07-16  Benjamin Poulain  <bpoulain@apple.com>
2249
2250         [Content extensions] Combine suffixes when generating NFAs
2251         https://bugs.webkit.org/show_bug.cgi?id=146961
2252
2253         Reviewed by Alex Christensen.
2254
2255         * wtf/Vector.h:
2256         (WTF::minCapacity>::Vector):
2257         (WTF::=):
2258         Copying a vector with a different inline capacity was broken due to
2259         the addition of MinimumCapacity.
2260
2261         This feature was needed by this patch so I fixed WTF.
2262
2263 2015-07-15  Anders Carlsson  <andersca@apple.com>
2264
2265         Make JavaScriptCore SPI headers used by WebCore SPI headers self-contained
2266         https://bugs.webkit.org/show_bug.cgi?id=146978
2267
2268         Reviewed by Dan Bernstein.
2269
2270         * wtf/ExportMacros.h:
2271
2272 2015-07-14  Anders Carlsson  <andersca@apple.com>
2273
2274         Assertions.h should include ExportMacros.h
2275         https://bugs.webkit.org/show_bug.cgi?id=146948
2276
2277         Reviewed by Tim Horton.
2278
2279         * wtf/Assertions.h:
2280
2281 2015-07-11  Joseph Pecoraro  <pecoraro@apple.com>
2282
2283         Unreviewed build fix, restrict APP_LINKS to just iOS.
2284
2285         * wtf/Platform.h:
2286
2287 2015-07-09  Tim Horton  <timothy_horton@apple.com>
2288
2289         Use CoreAnimation fences instead of synchronous IPC to synchronize resize
2290         https://bugs.webkit.org/show_bug.cgi?id=146294
2291         <rdar://problem/21090193>
2292
2293         Reviewed by Anders Carlsson.
2294
2295         * wtf/Platform.h:
2296         Add HAVE(COREANIMATION_FENCES)
2297
2298 2015-07-04  Chris Dumez  <cdumez@apple.com>
2299
2300         Drop RefPtr::clear() method
2301         https://bugs.webkit.org/show_bug.cgi?id=146556
2302
2303         Reviewed by Brady Eidson.
2304
2305         Drop RefPtr::clear() method in favor of "= nullptr;" pattern.
2306         Also made the "= nullptr;" pattern as efficient as clear()
2307         by providing a operator=(nullptr_t) overload. Local micro-
2308         benchmarking showed that "= nullptr;" used to be ~1.7% slower
2309         than clear().
2310
2311 2015-07-03  Dan Bernstein  <mitz@apple.com>
2312
2313         [Xcode] Update some build settings as recommended by Xcode 7
2314         https://bugs.webkit.org/show_bug.cgi?id=146597
2315
2316         Reviewed by Sam Weinig.
2317
2318         * Configurations/Base.xcconfig: Enabled CLANG_WARN_UNREACHABLE_CODE and
2319         GCC_NO_COMMON_BLOCKS. Removed GCC_MODEL_TUNING.
2320
2321         * WTF.xcodeproj/project.pbxproj: Updated LastUpgradeCheck.
2322
2323 2015-07-01  Alex Christensen  <achristensen@webkit.org>
2324
2325         Re-enable WebGL on WinCairo
2326         https://bugs.webkit.org/show_bug.cgi?id=146537
2327
2328         Reviewed by Csaba Osztrogonác.
2329
2330         * wtf/FeatureDefines.h:
2331         Enable WebGL on WinCairo again.
2332
2333 2015-07-01  Alex Christensen  <achristensen@webkit.org>
2334
2335         Ignore Visual Studio warning in SegmentedVector
2336         https://bugs.webkit.org/show_bug.cgi?id=146514
2337
2338         Reviewed by Andreas Kling.
2339
2340         * wtf/SegmentedVector.h:
2341         (WTF::SegmentedVector::deleteAllSegments):
2342         Use pragmas to ignore the 0 element array warning.
2343
2344 2015-07-01  Dean Jackson  <dino@apple.com>
2345
2346         Disable the experimental WebGL2 implementation
2347         https://bugs.webkit.org/show_bug.cgi?id=146526
2348         <rdar://problem/21641235>
2349
2350         Reviewed by Myles Maxfield.
2351
2352         Add (and disable) an ENABLE_WEBGL2 flag.
2353
2354         * wtf/FeatureDefines.h:
2355
2356 2015-06-30  Alex Christensen  <achristensen@webkit.org>
2357
2358         [Win] Unreviewed build fix after r186169.
2359
2360         * wtf/FeatureDefines.h:
2361         Temporarily disable WebGL on WinCairo. It was already temporarily disabled on AppleWin.
2362
2363 2015-06-30  Andy VanWagoner  <thetalecrafter@gmail.com>
2364
2365         Implement ECMAScript Internationalization API
2366         https://bugs.webkit.org/show_bug.cgi?id=90906
2367
2368         Reviewed by Benjamin Poulain.
2369
2370         * wtf/FeatureDefines.h: add ENABLE_INTL flag
2371
2372 2015-06-30  Keith Miller  <keith_miller@apple.com>
2373
2374         Errors in read() are not handled in WTF::cryptographicallyRandomValuesFromOS.
2375         https://bugs.webkit.org/show_bug.cgi?id=146473
2376
2377         Reviewed by Filip Pizlo.
2378
2379         We were not checking if errors occurred in WTF::cryptographicallyRandomValuesFromOS.
2380         We now buffer the data until enough bits of entropy exist to fill the buffer
2381         rather than crash. Additionally, added two crash functions so we can distinguish
2382         between the two reasons why we crashed in traces.
2383
2384         * wtf/OSRandomSource.cpp:
2385         (WTF::crashUnableToOpenFD):
2386         (WTF::crashUnableToReadFromFD):
2387         (WTF::cryptographicallyRandomValuesFromOS):
2388
2389 2015-06-29  Dean Jackson  <dino@apple.com>
2390
2391         Temporarily disable PICTURE_SIZES
2392         https://bugs.webkit.org/show_bug.cgi?id=146435
2393         <rdar://problem/21087013>
2394
2395         Reviewed by Tim Horton.
2396
2397         Temporarily disable PICTURE_SIZES because it causes problems with out
2398         of date <picture> polyfills.
2399
2400         * wtf/FeatureDefines.h:
2401
2402 2015-06-26  Antti Koivisto  <antti@apple.com>
2403
2404         Network process hangs fetching disk cache entries
2405         https://bugs.webkit.org/show_bug.cgi?id=146348
2406         <rdar://problem/21528072>
2407
2408         Reviewed by Anders Carlsson.
2409
2410         RunLoop::dispatch may deadlock if invoked with std::function that captures an object that calls RunLoop::dispatch in destructor.
2411
2412         * wtf/RunLoop.cpp:
2413         (WTF::RunLoop::performWork):
2414
2415             Don't reuse std::function variable in loop. We may end up destroying previously held std::function in assignment
2416             while holding the runloop mutex. With this change std::function is always destroyed with mutex unlocked.
2417
2418 2015-06-24  Commit Queue  <commit-queue@webkit.org>
2419
2420         Unreviewed, rolling out r185906.
2421         https://bugs.webkit.org/show_bug.cgi?id=146276
2422
2423         MSVC doesn't yet provide a const-qualified std::array<T,
2424         N>::size(), failing to compile the static_assert (Requested by
2425         zdobersek on #webkit).
2426
2427         Reverted changeset:
2428
2429         "Improve the source code generated by make_names.pl"
2430         https://bugs.webkit.org/show_bug.cgi?id=146208
2431         http://trac.webkit.org/changeset/185906
2432
2433 2015-06-24  Zan Dobersek  <zdobersek@igalia.com>
2434
2435         Improve the source code generated by make_names.pl
2436         https://bugs.webkit.org/show_bug.cgi?id=146208
2437
2438         Reviewed by Darin Adler.
2439
2440         * wtf/text/StringImpl.h:
2441         (WTF::StringImpl::assertHashIsCorrect): Make this method const-qualified.
2442
2443 2015-06-22  Darin Adler  <darin@apple.com>
2444
2445         Make Array.join work directly on substrings without reifying them
2446         https://bugs.webkit.org/show_bug.cgi?id=146191
2447
2448         Reviewed by Andreas Kling.
2449
2450         * wtf/Vector.h: Added an overload of uncheckedAppend like the one we added
2451         a while back, a non-template function that forwards through to the function
2452         template. This lets us call uncheckedAppend on an argument list and have it
2453         properly convert it to the Vector's element type.
2454
2455         * wtf/text/StringView.h:
2456         (WTF::StringView::getCharactersWithUpconvert): Changed to not use memcpy;
2457         saw some indication the hand-written loop was faster when profiling. Also
2458         use m_length directly when we know we are dealing with an 8-bit string,
2459         since the masking that the index function does is not needed in that case.
2460         (WTF::StringView::UpconvertedCharacters::UpconvertedCharacters): Ditto.
2461         (WTF::StringView::toString): Ditto.
2462         (WTF::StringView::toFloat): Ditto.
2463         (WTF::StringView::toInt): Ditto.
2464         (WTF::StringView::toStringWithoutCopying): Ditto.
2465         (WTF::StringView::find): Ditto.
2466
2467 2015-06-22  YunQiang Su  <wzssyqa@gmail.com>
2468
2469         [WTF] Platform.h: use _ABI64 instead of _MIPS_SIM_ABI64 to determine MIPS N64
2470         https://bugs.webkit.org/show_bug.cgi?id=145113
2471
2472         Reviewed by Csaba Osztrogonác.
2473
2474         * wtf/Platform.h:
2475
2476 2015-06-22  Anders Carlsson  <andersca@apple.com>
2477
2478         Fix build.
2479
2480         * wtf/threads/BinarySemaphore.cpp:
2481
2482 2015-06-22  Anders Carlsson  <andersca@apple.com>
2483
2484         Get rid of the Windows specific BinarySemaphore implementation
2485         https://bugs.webkit.org/show_bug.cgi?id=146216
2486
2487         Reviewed by Andreas Kling.
2488
2489         The fact that the Windows implementation uses a HEVENT internally was only useful
2490         to the Windows port of WebKit2; we can get rid of it now.
2491
2492         * WTF.vcxproj/WTF.vcxproj:
2493         * WTF.vcxproj/WTF.vcxproj.filters:
2494         * wtf/threads/BinarySemaphore.h:
2495         (WTF::BinarySemaphore::event): Deleted.
2496         * wtf/threads/win/BinarySemaphoreWin.cpp: Removed.
2497         (WTF::BinarySemaphore::BinarySemaphore): Deleted.
2498         (WTF::BinarySemaphore::~BinarySemaphore): Deleted.
2499         (WTF::BinarySemaphore::signal): Deleted.
2500         (WTF::BinarySemaphore::wait): Deleted.
2501
2502 2015-06-21  Gavin Barraclough  <barraclough@apple.com>
2503
2504         Page load performance regression due to bugs.webkit.org/show_bug.cgi?id=145542
2505         https://bugs.webkit.org/show_bug.cgi?id=146198
2506
2507         Unreviewed rollout.
2508
2509         * wtf/glib/GUniquePtr.h:
2510
2511 2015-06-20  Michael Catanzaro  <mcatanzaro@igalia.com>
2512
2513         [EFL][GTK] Define GLIB_VERSION_MIN_REQUIRED and require glib 2.36 for GTK
2514         https://bugs.webkit.org/show_bug.cgi?id=146181
2515
2516         Reviewed by Martin Robinson.
2517
2518         Define GLIB_VERSION_MIN_REQUIRED to avoid deprecation warnings.
2519
2520         * wtf/Platform.h:
2521
2522 2015-06-19  Michael Catanzaro  <mcatanzaro@igalia.com>
2523
2524         [SOUP] Define SOUP_VERSION_MIN_REQUIRED
2525         https://bugs.webkit.org/show_bug.cgi?id=146165
2526
2527         Reviewed by Martin Robinson.
2528
2529         Define SOUP_VERSION_MIN_REQUIRED to avoid deprecation warnings.
2530
2531         * wtf/Platform.h:
2532
2533 2015-06-19  Mark Lam  <mark.lam@apple.com>
2534
2535         Gardening: build fixes for GTK and EFL for CheckedArithmetic change.
2536
2537         Not reviewed.
2538
2539         * wtf/CheckedArithmetic.h:
2540         (WTF::Checked::operator<):
2541         (WTF::Checked::operator<=):
2542         (WTF::Checked::operator>):
2543         (WTF::Checked::operator>=):
2544
2545 2015-06-19  Mark Lam  <mark.lam@apple.com>
2546
2547         CheckedArithmetic's operator bool() and operator==() is broken.
2548         https://bugs.webkit.org/show_bug.cgi?id=146129
2549
2550         Reviewed by Geoffrey Garen and Oliver Hunt.
2551
2552         The existing operator UnspecifiedBoolType*() in CheckedArithmetic is erroneously
2553         allowing the Checked value to be implicitly casted into pointer types.  This is
2554         because it is doing a reinterpret_cast<UnspecifiedBoolType*>(1) whereas the idiom
2555         relies on the address of a member e.g. &Checked::m_value.  As a result,
2556         ImageBufferData::putData() was getting an implicit cast of a Checked value to
2557         (void*)1 and doing incorrect pointer comparisons on it.
2558
2559         Also, 2 of CheckedArithmetic's operator==() will crash if used on an overflowed
2560         value, while a 3rd one does not.  The 3rd one should be consistent and also crash
2561         if used on an overflowed Checked value.
2562
2563         In this fix, we replace operator UnspecifiedBoolType*() with an explicit operator
2564         bool().  We also add the missing operators <, <=, >, and >=.  That takes care of
2565         the comparisons in ImageBufferData::putData().
2566
2567         * wtf/CheckedArithmetic.h:
2568         (WTF::CrashOnOverflow::overflowed):
2569         (WTF::CrashOnOverflow::crash):
2570         (WTF::RecordOverflow::crash):
2571
2572         (WTF::Checked::operator!):
2573         (WTF::Checked::operator bool):
2574         (WTF::Checked::unsafeGet):
2575         - Don't call CRASH() directly.  Delegate to the handler.
2576
2577         (WTF::Checked::operator==):
2578         - Should call the handler's crash() to be consistent with the other 2 versions of
2579           operator== which will crash in unsafeGet() if used on an overflowed Checked
2580           value.
2581
2582         (WTF::Checked::operator<):
2583         (WTF::Checked::operator<=):
2584         (WTF::Checked::operator>):
2585         (WTF::Checked::operator>=):
2586         - Add missing operators.
2587
2588         (WTF::Checked::operator UnspecifiedBoolType*): Deleted.
2589
2590 2015-06-19  Csaba Osztrogonác  <ossy@webkit.org>
2591
2592         [WK2] Fix unused-private-field warning in WebProcess/Plugins/PluginView.<h|cpp>
2593         https://bugs.webkit.org/show_bug.cgi?id=145252
2594
2595         Reviewed by Tim Horton.
2596
2597         * wtf/FeatureDefines.h: Moved the definition of ENABLE_PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC
2598         here from Source/WebKit2/WebProcess/WebPage/WebPage.h
2599
2600 2015-06-17  Andreas Kling  <akling@apple.com>
2601
2602         SegmentedVector should waste less memory.
2603         <https://webkit.org/b/146069>
2604
2605         Reviewed by Anders Carlsson.
2606
2607         We were wasting sizeof(Vector) on every segment in SegmentVector.
2608         The segments were using inline capacity, and would never go beyond it,
2609         so all the size/capacity/out-of-line-buffer metadata was useless.
2610
2611         Change the internal representation to Vector<T[SegmentSize]> instead.
2612         This saves 16 bytes per segment, so lower SegmentSize -> bigger savings!
2613
2614         * wtf/SegmentedVector.h:
2615         (WTF::SegmentedVectorIterator::operator*):
2616         (WTF::SegmentedVectorIterator::operator->):
2617         (WTF::SegmentedVectorIterator::operator++):
2618         (WTF::SegmentedVectorIterator::operator==):
2619         (WTF::SegmentedVectorIterator::operator!=):
2620         (WTF::SegmentedVectorIterator::SegmentedVectorIterator):
2621         (WTF::SegmentedVector::at):
2622         (WTF::SegmentedVector::append):
2623         (WTF::SegmentedVector::removeLast):
2624         (WTF::SegmentedVector::grow):
2625         (WTF::SegmentedVector::begin):
2626         (WTF::SegmentedVector::end):
2627         (WTF::SegmentedVector::deleteAllSegments):
2628         (WTF::SegmentedVector::ensureSegmentsFor):
2629         (WTF::SegmentedVector::ensureSegment):
2630         (WTF::SegmentedVector::allocateSegment):
2631         (WTF::SegmentedVectorIterator::operator=): Deleted.
2632         (WTF::SegmentedVector::SegmentedVector): Deleted.
2633
2634 2015-06-16  Andreas Kling  <akling@apple.com>
2635
2636         Remove unused template parameter InlineCapacity from SegmentedVector.
2637         <https://webkit.org/b/146044>
2638
2639         Reviewed by Anders Carlsson.
2640
2641         * wtf/SegmentedVector.h:
2642         (WTF::SegmentedVectorIterator::operator=):
2643         (WTF::SegmentedVectorIterator::SegmentedVectorIterator):
2644         (WTF::SegmentedVector::at):
2645
2646 2015-06-16  Mark Lam  <mark.lam@apple.com>
2647
2648         Use NakedPtr<Exception>& to return exception results.
2649         https://bugs.webkit.org/show_bug.cgi?id=145870
2650
2651         Reviewed by Anders Carlsson and Filip Pizlo.
2652
2653         Introducing the NakedPtr class.
2654
2655         * WTF.xcodeproj/project.pbxproj:
2656         * wtf/NakedPtr.h: Added.
2657         (WTF::NakedPtr::NakedPtr):
2658         (WTF::NakedPtr::get):
2659         (WTF::NakedPtr::clear):
2660         (WTF::NakedPtr::operator*):
2661         (WTF::NakedPtr::operator->):
2662         (WTF::NakedPtr::operator T*):
2663         (WTF::NakedPtr::operator!):
2664         (WTF::NakedPtr::operator bool):
2665         (WTF::=):
2666         (WTF::NakedPtr<T>::swap):
2667         (WTF::swap):
2668
2669 2015-06-12  Zan Dobersek  <zdobersek@igalia.com>
2670
2671         [GLib] Move files under Source/WTF/wtf/gobject to Source/WTF/wtf/glib
2672         https://bugs.webkit.org/show_bug.cgi?id=145799
2673
2674         Reviewed by Carlos Garcia Campos.
2675
2676         Move the GLib-specific files to the Source/WTF/wtf/glib/ directory.
2677         'gobject' wasn't the most appropriate name for the directory since
2678         GObject is a submodule of GLib, but a lot of the code there didn't
2679         have much to do with GObject specifically.
2680
2681         Build rules for the moved files are also updated.
2682
2683         * WTF.vcxproj/WTF.vcxproj:
2684         * WTF.vcxproj/WTF.vcxproj.filters:
2685         * wtf/Platform.h:
2686         * wtf/PlatformEfl.cmake:
2687         * wtf/PlatformGTK.cmake:
2688         * wtf/RunLoop.h:
2689         * wtf/WorkQueue.h:
2690         * wtf/glib/GLibUtilities.cpp: Renamed from Source/WTF/wtf/gobject/GlibUtilities.cpp.
2691         (getCurrentExecutablePath):
2692         * wtf/glib/GLibUtilities.h: Renamed from Source/WTF/wtf/gobject/GlibUtilities.h.
2693         * wtf/glib/GMainLoopSource.cpp: Renamed from Source/WTF/wtf/gobject/GMainLoopSource.cpp.
2694         (WTF::GMainLoopSource::create):
2695         (WTF::GMainLoopSource::GMainLoopSource):
2696         (WTF::GMainLoopSource::~GMainLoopSource):
2697         (WTF::GMainLoopSource::isScheduled):
2698         (WTF::GMainLoopSource::isActive):
2699         (WTF::GMainLoopSource::cancel):
2700         (WTF::GMainLoopSource::scheduleIdleSource):
2701         (WTF::GMainLoopSource::schedule):
2702         (WTF::GMainLoopSource::scheduleTimeoutSource):
2703         (WTF::GMainLoopSource::scheduleAfterDelay):
2704         (WTF::createMicrosecondsTimeoutSource):
2705         (WTF::GMainLoopSource::scheduleAndDeleteOnDestroy):
2706         (WTF::GMainLoopSource::scheduleAfterDelayAndDeleteOnDestroy):
2707         (WTF::GMainLoopSource::prepareVoidCallback):
2708         (WTF::GMainLoopSource::finishVoidCallback):
2709         (WTF::GMainLoopSource::voidCallback):
2710         (WTF::GMainLoopSource::prepareBoolCallback):
2711         (WTF::GMainLoopSource::finishBoolCallback):
2712         (WTF::GMainLoopSource::boolCallback):
2713         (WTF::GMainLoopSource::socketCallback):
2714         (WTF::GMainLoopSource::voidSourceCallback):
2715         (WTF::GMainLoopSource::boolSourceCallback):
2716         (WTF::GMainLoopSource::socketSourceCallback):
2717         (WTF::GMainLoopSource::Context::destroySource):
2718         * wtf/glib/GMainLoopSource.h: Renamed from Source/WTF/wtf/gobject/GMainLoopSource.h.
2719         (WTF::GMainLoopSource::Context::operator=):
2720         * wtf/glib/GMutexLocker.h: Renamed from Source/WTF/wtf/gobject/GMutexLocker.h.
2721         (WTF::MutexWrapper<GMutex>::lock):
2722         (WTF::MutexWrapper<GMutex>::unlock):
2723         (WTF::MutexWrapper<GRecMutex>::lock):
2724         (WTF::MutexWrapper<GRecMutex>::unlock):
2725         (WTF::GMutexLocker::GMutexLocker):
2726         (WTF::GMutexLocker::~GMutexLocker):
2727         (WTF::GMutexLocker::lock):
2728         (WTF::GMutexLocker::unlock):
2729         * wtf/glib/GRefPtr.cpp: Renamed from Source/WTF/wtf/gobject/GRefPtr.cpp.
2730         (WTF::refGPtr):
2731         (WTF::derefGPtr):
2732         * wtf/glib/GRefPtr.h: Renamed from Source/WTF/wtf/gobject/GRefPtr.h.
2733         (WTF::GRefPtr::GRefPtr):
2734         (WTF::GRefPtr::~GRefPtr):
2735         (WTF::GRefPtr::clear):
2736         (WTF::GRefPtr::outPtr):
2737         (WTF::GRefPtr::isHashTableDeletedValue):
2738         (WTF::GRefPtr::get):
2739         (WTF::GRefPtr::operator*):
2740         (WTF::GRefPtr::operator->):
2741         (WTF::GRefPtr::operator!):
2742         (WTF::GRefPtr::operator UnspecifiedBoolType):
2743         (WTF::GRefPtr::hashTableDeletedValue):
2744         (WTF::=):
2745         (WTF::GRefPtr<T>::swap):
2746         (WTF::swap):
2747         (WTF::operator==):
2748         (WTF::operator!=):
2749         (WTF::static_pointer_cast):
2750         (WTF::const_pointer_cast):
2751         (WTF::adoptGRef):
2752         (WTF::refGPtr):
2753         (WTF::derefGPtr):
2754         * wtf/glib/GThreadSafeMainLoopSource.cpp: Renamed from Source/WTF/wtf/gobject/GThreadSafeMainLoopSource.cpp.
2755         (WTF::GThreadSafeMainLoopSource::GThreadSafeMainLoopSource):
2756         (WTF::GThreadSafeMainLoopSource::~GThreadSafeMainLoopSource):
2757         (WTF::GThreadSafeMainLoopSource::cancel):
2758         (WTF::GThreadSafeMainLoopSource::schedule):
2759         (WTF::GThreadSafeMainLoopSource::scheduleAfterDelay):
2760         (WTF::GThreadSafeMainLoopSource::prepareVoidCallback):
2761         (WTF::GThreadSafeMainLoopSource::finishVoidCallback):
2762         (WTF::GThreadSafeMainLoopSource::voidCallback):
2763         (WTF::GThreadSafeMainLoopSource::prepareBoolCallback):
2764         (WTF::GThreadSafeMainLoopSource::finishBoolCallback):
2765         (WTF::GThreadSafeMainLoopSource::boolCallback):
2766         * wtf/glib/GThreadSafeMainLoopSource.h: Renamed from Source/WTF/wtf/gobject/GThreadSafeMainLoopSource.h.
2767         * wtf/glib/GTypedefs.h: Renamed from Source/WTF/wtf/gobject/GTypedefs.h.
2768         * wtf/glib/GUniquePtr.h: Renamed from Source/WTF/wtf/gobject/GUniquePtr.h.
2769         (WTF::GPtrDeleter::operator()):
2770         (WTF::GUniqueOutPtr::GUniqueOutPtr):
2771         (WTF::GUniqueOutPtr::~GUniqueOutPtr):
2772         (WTF::GUniqueOutPtr::outPtr):
2773         (WTF::GUniqueOutPtr::release):
2774         (WTF::GUniqueOutPtr::operator*):
2775         (WTF::GUniqueOutPtr::operator->):
2776         (WTF::GUniqueOutPtr::get):
2777         (WTF::GUniqueOutPtr::operator!):
2778         (WTF::GUniqueOutPtr::operator UnspecifiedBoolType):
2779         (WTF::GUniqueOutPtr::reset):
2780         * wtf/glib/MainThreadGLib.cpp:
2781         * wtf/gobject/GMainLoopSource.cpp:
2782         (WTF::GMainLoopSource::create): Deleted.
2783         (WTF::GMainLoopSource::GMainLoopSource): Deleted.
2784         (WTF::GMainLoopSource::~GMainLoopSource): Deleted.
2785         (WTF::GMainLoopSource::isScheduled): Deleted.
2786         (WTF::GMainLoopSource::isActive): Deleted.
2787         (WTF::GMainLoopSource::cancel): Deleted.
2788         (WTF::GMainLoopSource::scheduleIdleSource): Deleted.
2789         (WTF::GMainLoopSource::schedule): Deleted.
2790         (WTF::GMainLoopSource::scheduleTimeoutSource): Deleted.
2791         (WTF::GMainLoopSource::scheduleAfterDelay): Deleted.
2792         (WTF::createMicrosecondsTimeoutSource): Deleted.
2793         (WTF::GMainLoopSource::scheduleAndDeleteOnDestroy): Deleted.
2794         (WTF::GMainLoopSource::scheduleAfterDelayAndDeleteOnDestroy): Deleted.
2795         (WTF::GMainLoopSource::prepareVoidCallback): Deleted.
2796         (WTF::GMainLoopSource::finishVoidCallback): Deleted.
2797         (WTF::GMainLoopSource::voidCallback): Deleted.
2798         (WTF::GMainLoopSource::prepareBoolCallback): Deleted.
2799         (WTF::GMainLoopSource::finishBoolCallback): Deleted.
2800         (WTF::GMainLoopSource::boolCallback): Deleted.
2801         (WTF::GMainLoopSource::socketCallback): Deleted.
2802         (WTF::GMainLoopSource::voidSourceCallback): Deleted.
2803         (WTF::GMainLoopSource::boolSourceCallback): Deleted.
2804         (WTF::GMainLoopSource::socketSourceCallback): Deleted.
2805         (WTF::GMainLoopSource::Context::destroySource): Deleted.
2806         * wtf/gobject/GMainLoopSource.h:
2807         (WTF::GMainLoopSource::Context::operator=): Deleted.
2808         * wtf/gobject/GMutexLocker.h:
2809         (WTF::MutexWrapper<GMutex>::lock): Deleted.
2810         (WTF::MutexWrapper<GMutex>::unlock): Deleted.
2811         (WTF::MutexWrapper<GRecMutex>::lock): Deleted.
2812         (WTF::MutexWrapper<GRecMutex>::unlock): Deleted.
2813         (WTF::GMutexLocker::GMutexLocker): Deleted.
2814         (WTF::GMutexLocker::~GMutexLocker): Deleted.
2815         (WTF::GMutexLocker::lock): Deleted.
2816         (WTF::GMutexLocker::unlock): Deleted.
2817         * wtf/gobject/GRefPtr.cpp:
2818         (WTF::refGPtr): Deleted.
2819         (WTF::derefGPtr): Deleted.
2820         * wtf/gobject/GRefPtr.h:
2821         (WTF::GRefPtr::GRefPtr): Deleted.
2822         (WTF::GRefPtr::~GRefPtr): Deleted.
2823         (WTF::GRefPtr::clear): Deleted.
2824         (WTF::GRefPtr::outPtr): Deleted.
2825         (WTF::GRefPtr::isHashTableDeletedValue): Deleted.
2826         (WTF::GRefPtr::get): Deleted.
2827         (WTF::GRefPtr::operator*): Deleted.
2828         (WTF::GRefPtr::operator->): Deleted.
2829         (WTF::GRefPtr::operator!): Deleted.
2830         (WTF::GRefPtr::operator UnspecifiedBoolType): Deleted.
2831         (WTF::GRefPtr::hashTableDeletedValue): Deleted.
2832         (WTF::=): Deleted.
2833         (WTF::GRefPtr<T>::swap): Deleted.
2834         (WTF::swap): Deleted.
2835         (WTF::operator==): Deleted.
2836         (WTF::operator!=): Deleted.
2837         (WTF::static_pointer_cast): Deleted.
2838         (WTF::const_pointer_cast): Deleted.
2839         (WTF::adoptGRef): Deleted.
2840         (WTF::refGPtr): Deleted.
2841         (WTF::derefGPtr): Deleted.
2842         * wtf/gobject/GThreadSafeMainLoopSource.cpp:
2843         (WTF::GThreadSafeMainLoopSource::GThreadSafeMainLoopSource): Deleted.
2844         (WTF::GThreadSafeMainLoopSource::~GThreadSafeMainLoopSource): Deleted.
2845         (WTF::GThreadSafeMainLoopSource::cancel): Deleted.
2846         (WTF::GThreadSafeMainLoopSource::schedule): Deleted.
2847         (WTF::GThreadSafeMainLoopSource::scheduleAfterDelay): Deleted.
2848         (WTF::GThreadSafeMainLoopSource::prepareVoidCallback): Deleted.
2849         (WTF::GThreadSafeMainLoopSource::finishVoidCallback): Deleted.
2850         (WTF::GThreadSafeMainLoopSource::voidCallback): Deleted.
2851         (WTF::GThreadSafeMainLoopSource::prepareBoolCallback): Deleted.
2852         (WTF::GThreadSafeMainLoopSource::finishBoolCallback): Deleted.
2853         (WTF::GThreadSafeMainLoopSource::boolCallback): Deleted.
2854         * wtf/gobject/GUniquePtr.h:
2855         (WTF::GPtrDeleter::operator()): Deleted.
2856         (WTF::GUniqueOutPtr::GUniqueOutPtr): Deleted.
2857         (WTF::GUniqueOutPtr::~GUniqueOutPtr): Deleted.
2858         (WTF::GUniqueOutPtr::outPtr): Deleted.
2859         (WTF::GUniqueOutPtr::release): Deleted.
2860         (WTF::GUniqueOutPtr::operator*): Deleted.
2861         (WTF::GUniqueOutPtr::operator->): Deleted.
2862         (WTF::GUniqueOutPtr::get): Deleted.
2863         (WTF::GUniqueOutPtr::operator!): Deleted.
2864         (WTF::GUniqueOutPtr::operator UnspecifiedBoolType): Deleted.
2865         (WTF::GUniqueOutPtr::reset): Deleted.
2866         * wtf/gobject/GlibUtilities.cpp:
2867         (getCurrentExecutablePath): Deleted.
2868
2869 2015-06-10  Basile Clement  <basile_clement@apple.com>
2870
2871         Unreviewed, fix an typo in unused template code.
2872
2873         * wtf/TinyPtrSet.h:
2874         (WTF::TinyPtrSet::iterator::operator*): s/at(index)/at(m_index)/
2875
2876 2015-06-09  Csaba Osztrogonác  <ossy@webkit.org>
2877
2878         [cmake] Fix the style issues in cmake project files
2879         https://bugs.webkit.org/show_bug.cgi?id=145755
2880
2881         Reviewed by Darin Adler.
2882
2883         * wtf/CMakeLists.txt:
2884
2885 2015-06-08  Alexey Proskuryakov  <ap@apple.com>
2886
2887         Build fix.
2888
2889         * wtf/TinyPtrSet.h: (WTF::TinyPtrSet::isEmpty): s/poointer/pointer/
2890
2891 2015-06-07  Filip Pizlo  <fpizlo@apple.com>
2892
2893         The tiny set magic in StructureSet should be available in WTF
2894         https://bugs.webkit.org/show_bug.cgi?id=145722
2895
2896         Reviewed by Geoffrey Garen.
2897         
2898         As the management of structure sets evolved in JSC, the StructureSet data structure grew
2899         increasingly smart. It's got some smart stuff for managing small sets of pointers. I
2900         wanted to take the generic logic out of JSC and put it into a reusable templatized class
2901         in WTF.
2902         
2903         * WTF.vcxproj/WTF.vcxproj:
2904         * WTF.xcodeproj/project.pbxproj:
2905         * wtf/CMakeLists.txt:
2906         * wtf/TinyPtrSet.h: Added.
2907         (WTF::TinyPtrSet::TinyPtrSet):
2908         (WTF::TinyPtrSet::operator=):
2909         (WTF::TinyPtrSet::~TinyPtrSet):
2910         (WTF::TinyPtrSet::clear):
2911         (WTF::TinyPtrSet::onlyEntry):
2912         (WTF::TinyPtrSet::isEmpty):
2913         (WTF::TinyPtrSet::add):
2914         (WTF::TinyPtrSet::remove):
2915         (WTF::TinyPtrSet::contains):
2916         (WTF::TinyPtrSet::merge):
2917         (WTF::TinyPtrSet::forEach):
2918         (WTF::TinyPtrSet::genericFilter):
2919         (WTF::TinyPtrSet::filter):
2920         (WTF::TinyPtrSet::exclude):
2921         (WTF::TinyPtrSet::isSubsetOf):
2922         (WTF::TinyPtrSet::isSupersetOf):
2923         (WTF::TinyPtrSet::overlaps):
2924         (WTF::TinyPtrSet::size):
2925         (WTF::TinyPtrSet::at):
2926         (WTF::TinyPtrSet::operator[]):
2927         (WTF::TinyPtrSet::last):
2928         (WTF::TinyPtrSet::iterator::iterator):
2929         (WTF::TinyPtrSet::iterator::operator*):
2930         (WTF::TinyPtrSet::iterator::operator++):
2931         (WTF::TinyPtrSet::iterator::operator==):
2932         (WTF::TinyPtrSet::iterator::operator!=):
2933         (WTF::TinyPtrSet::begin):
2934         (WTF::TinyPtrSet::end):
2935         (WTF::TinyPtrSet::operator==):
2936         (WTF::TinyPtrSet::addOutOfLine):
2937         (WTF::TinyPtrSet::containsOutOfLine):
2938         (WTF::TinyPtrSet::copyFrom):
2939         (WTF::TinyPtrSet::copyFromOutOfLine):
2940         (WTF::TinyPtrSet::OutOfLineList::create):
2941         (WTF::TinyPtrSet::OutOfLineList::destroy):
2942         (WTF::TinyPtrSet::OutOfLineList::list):
2943         (WTF::TinyPtrSet::OutOfLineList::OutOfLineList):
2944         (WTF::TinyPtrSet::deleteListIfNecessary):
2945         (WTF::TinyPtrSet::isThin):
2946         (WTF::TinyPtrSet::pointer):
2947         (WTF::TinyPtrSet::singleEntry):
2948         (WTF::TinyPtrSet::list):
2949         (WTF::TinyPtrSet::set):
2950         (WTF::TinyPtrSet::setEmpty):
2951         (WTF::TinyPtrSet::getReservedFlag):
2952         (WTF::TinyPtrSet::setReservedFlag):
2953
2954 2015-06-05  Chris Dumez  <cdumez@apple.com>
2955
2956         [WK2][iOS] Limit the number of vnodes used by the WebContent processes
2957         https://bugs.webkit.org/show_bug.cgi?id=145672
2958         <rdar://problem/21126637>
2959
2960         Reviewed by Antti Koivisto.
2961
2962         * wtf/RefCounter.h:
2963         (WTF::RefCounter::value):
2964
2965         Expose the actual refcount instead of a boolean value.
2966
2967 2015-06-05  Alex Christensen  <achristensen@webkit.org>
2968
2969         [Web Timing] Use new SPI to enable data collection.
2970         https://bugs.webkit.org/show_bug.cgi?id=145650
2971         rdar://problem/21203358
2972
2973         Reviewed by Chris Dumez.
2974
2975         * wtf/Platform.h:
2976         Added HAVE_TIMINGDATAOPTIONS for platform and version dependent feature.
2977
2978 2015-06-05  Xabier Rodriguez Calvar  <calvaris@igalia.com> and Youenn Fablet <youenn.fablet@crf.canon.fr>
2979
2980         [Streams API] ReadableStream should store callbacks as a Deque
2981         https://bugs.webkit.org/show_bug.cgi?id=145641
2982
2983         Reviewed by Darin Adler.
2984
2985         * wtf/Deque.h:
2986         (WTF::Deque::append): Adding not templated append method, forwarding to templated append method.
2987
2988 2015-06-02  Xabier Rodriguez Calvar  <calvaris@igalia.com> and Youenn Fablet <youenn.fablet@crf.canon.fr>
2989
2990         [Streams API] Delegate ReadableStreamReader reference counting to ReadableStream
2991         https://bugs.webkit.org/show_bug.cgi?id=144907
2992
2993         Reviewed by Darin Adler.
2994
2995         * wtf/Vector.h:
2996         (WTF::Vector::append): Adding not templated append method, forwarding to ValueType templated append method.
2997
2998 2015-06-02  Yusuke Suzuki  <utatane.tea@gmail.com>
2999
3000         Heap-use-after-free read of size 4 in JavaScriptCore: WTF::StringImpl::isSymbol() (StringImpl.h:496)
3001         https://bugs.webkit.org/show_bug.cgi?id=145532
3002
3003         Reviewed by Geoffrey Garen.
3004
3005         Return `RefPtr<AtomicStringImpl>` instead of `AtomicStringImpl*`.
3006
3007         * wtf/text/AtomicStringImpl.cpp:
3008         (WTF::AtomicStringImpl::lookUpSlowCase):
3009         (WTF::AtomicStringImpl::lookUpInternal):
3010         * wtf/text/AtomicStringImpl.h:
3011         (WTF::AtomicStringImpl::lookUp):
3012
3013 2015-06-01  Anders Carlsson  <andersca@apple.com>
3014
3015         Use xpc_connection_set_oneshot_instance where possible
3016         https://bugs.webkit.org/show_bug.cgi?id=145535
3017         rdar://problem/21109994
3018
3019         Reviewed by Sam Weinig.
3020
3021         Add SPI declaration.
3022
3023         * wtf/spi/darwin/XPCSPI.h:
3024
3025 2015-05-29  Anders Carlsson  <andersca@apple.com>
3026
3027         Missing #import of Platform.h in several WTF headers
3028         https://bugs.webkit.org/show_bug.cgi?id=145475
3029         rdar://problem/21161818
3030
3031         Reviewed by Darin Adler.
3032
3033         Add Platform.h #includes.
3034
3035         * wtf/Assertions.h:
3036         * wtf/RetainPtr.h:
3037
3038 2015-05-29  Commit Queue  <commit-queue@webkit.org>
3039
3040         Unreviewed, rolling out r184949.
3041         https://bugs.webkit.org/show_bug.cgi?id=145458
3042
3043         Ends up generating worse code for HashTable move constructors
3044         (Requested by zdobersek on #webkit).
3045
3046         Reverted changeset:
3047
3048         "Clean up HashTable constructors"
3049         https://bugs.webkit.org/show_bug.cgi?id=145369
3050         http://trac.webkit.org/changeset/184949
3051
3052 2015-05-28  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
3053
3054         Purge PassRefPtr in StringConcatenate.h
3055         https://bugs.webkit.org/show_bug.cgi?id=145376
3056
3057         Reviewed by Darin Adler.
3058
3059         Replace PassRefPtr with RefPtr. Additionally use nullptr instead of 0.
3060
3061         * wtf/text/StringConcatenate.h:
3062         (WTF::tryMakeString):
3063         (WTF::makeString):
3064
3065 2015-05-28  Zan Dobersek  <zdobersek@igalia.com>
3066
3067         Clean up HashTable constructors
3068         https://bugs.webkit.org/show_bug.cgi?id=145369
3069
3070         Reviewed by Andreas Kling.
3071
3072         Use nullptr to initialize pointer member variables in the HashTable
3073         default constructor. Copy and move constructors can use constructor
3074         delegation instead of replicating all member initializations. Move
3075         constructor should simply call HashTable::swap() instead of replicating
3076         all the swap operations.
3077
3078         * wtf/HashTable.h:
3079         (WTF::KeyTraits>::HashTable):
3080
3081 2015-05-27  Alexey Proskuryakov  <ap@apple.com>
3082
3083         [Mac] Fix clang static analyzer build
3084         https://bugs.webkit.org/show_bug.cgi?id=145426
3085         rdar://problem/20947408
3086
3087         Reviewed by Dan Bernstein.
3088
3089         * wtf/spi/darwin/XPCSPI.h: Correct declarations of xpc_retain and xpc_release.
3090
3091 2015-05-27  Dean Jackson  <dino@apple.com>
3092
3093         img.currentSrc problem in strict mode with old picturefill
3094         https://bugs.webkit.org/show_bug.cgi?id=144095
3095         <rdar://problem/21087013>
3096
3097         Reviewed by Simon Fraser.
3098
3099         Add a PICTURE_SIZES flag.
3100
3101         * wtf/FeatureDefines.h:
3102
3103 2015-05-26  Andreas Kling  <akling@apple.com>
3104
3105         StringView should have find(StringView, start).
3106         <https://webkit.org/b/145351>
3107
3108         Reviewed by Darin Adler.
3109
3110         Move the class agnostic guts of StringImpl's find() implementation from StringImpl
3111         to StringCommon.h and templatize the code into a findCommon() helper.
3112
3113         StringImpl::find() and StringView::find() now both call findCommon().
3114
3115         * wtf/text/StringCommon.h:
3116         (WTF::findInner):
3117         (WTF::find):
3118         (WTF::findCommon):
3119         * wtf/text/StringImpl.cpp:
3120         (WTF::StringImpl::find):
3121         (WTF::findInner): Deleted.
3122         * wtf/text/StringImpl.h:
3123         (WTF::find): Deleted.
3124         * wtf/text/StringView.cpp:
3125         (WTF::StringView::find):
3126         * wtf/text/StringView.h:
3127
3128
3129 2015-05-26  Dan Bernstein  <mitz@apple.com>
3130
3131         <rdar://problem/21104551> Update build settings
3132
3133         Reviewed by Anders Carlsson.
3134
3135         * Configurations/DebugRelease.xcconfig:
3136
3137 2015-05-23  Dan Bernstein  <mitz@apple.com>
3138
3139         Remove unused definitions of WEBKIT_VERSION_MIN_REQUIRED
3140         https://bugs.webkit.org/show_bug.cgi?id=145345
3141
3142         Reviewed by Sam Weinig.
3143
3144         * Configurations/Base.xcconfig: Also changed to use $(inherited).
3145
3146 2015-05-23  Yusuke Suzuki  <utatane.tea@gmail.com>
3147
3148         Introduce UniquedStringImpl and SymbolImpl to separate symbolic strings from AtomicStringImpl
3149         https://bugs.webkit.org/show_bug.cgi?id=144848
3150
3151         Reviewed by Darin Adler.
3152
3153         he current AtomicStringImpl accidentally means the symbol OR atomic StringImpl.
3154         t's not correct to its name and it's error prone.
3155
3156         In this patch, we'll introduce/changes classes into WTF.
3157
3158         1. UniquedStringImpl
3159         It's derived class from StringImpl. And it represents symbol || atomic StringImpl.
3160
3161         2. SymbolImpl
3162         It's derived class from UniquedStringImpl. Only symbol strings can become this.
3163         It ensures the given StringImpl is symbol in compile time.
3164
3165         3. AtomicStringImpl
3166         It's derived class from UniquedStringImpl. Only atomic (non-normal && non-symbol) strings can become this.
3167         It ensures the given StringImpl is atomic in compile time.
3168
3169         And, in this time, I just accept UniqueStringImpl in AtomicString. As the result,
3170         1. Now AtomicStringImpl issue is fixed. Its SymbolImpl is separated and UniquedStringImpl is introduced.
3171         2. But AtomicString still have both symbol and atomic strings.
3172         This should be solved in the separated patch.
3173
3174         * WTF.vcxproj/WTF.vcxproj:
3175         * WTF.vcxproj/WTF.vcxproj.filters:
3176         * WTF.xcodeproj/project.pbxproj:
3177         * wtf/CMakeLists.txt:
3178         * wtf/PrintStream.cpp:
3179         * wtf/PrintStream.h:
3180         (WTF::printInternal):
3181         * wtf/text/AtomicString.h:
3182         (WTF::AtomicString::AtomicString):
3183         * wtf/text/AtomicStringImpl.h:
3184         * wtf/text/StringImpl.cpp:
3185         (WTF::StringImpl::~StringImpl):
3186         (WTF::StringImpl::createSymbol):
3187         (WTF::StringImpl::createSymbolEmpty):
3188         * wtf/text/StringImpl.h:
3189         * wtf/text/SymbolImpl.h: Copied from Source/JavaScriptCore/runtime/PrivateName.h.
3190         * wtf/text/SymbolRegistry.cpp:
3191         (WTF::SymbolRegistry::symbolForKey):
3192         (WTF::SymbolRegistry::keyForSymbol):
3193         (WTF::SymbolRegistry::remove):
3194         * wtf/text/SymbolRegistry.h:
3195         * wtf/text/UniquedStringImpl.h: Copied from Source/JavaScriptCore/runtime/PrivateName.h.
3196
3197 2015-05-20  Zan Dobersek  <zdobersek@igalia.com>
3198
3199         [GTK] Move MainThreadGtk, RunLoopGtk, WorkQueueGtk under Source/WTF/wtf/glib/
3200         https://bugs.webkit.org/show_bug.cgi?id=145117
3201
3202         Reviewed by Csaba Osztrogonác.
3203
3204         Move the MainThreadGtk, RunLoopGtk and WorkQueueGtk implementation files from
3205         Source/WTF/wtf/gtk/ to Source/WTF/wtf/glib/. These implementations are not
3206         GTK-specific and only depend on GLib, so they are renamed as well.
3207
3208         There are other such implementations under Source/WTF/wtf/gobject/ (GObject
3209         is just a subset of GLib) that will be moved under the new directory in
3210         future patches.
3211
3212         * wtf/PlatformGTK.cmake:
3213         * wtf/glib/MainThreadGLib.cpp: Renamed from Source/WTF/wtf/gtk/MainThreadGtk.cpp.
3214         (WTF::initializeMainThreadPlatform):
3215         (WTF::scheduleDispatchFunctionsOnMainThread):
3216         * wtf/glib/RunLoopGLib.cpp: Renamed from Source/WTF/wtf/gtk/RunLoopGtk.cpp.
3217         (WTF::RunLoop::RunLoop):
3218         (WTF::RunLoop::~RunLoop):
3219         (WTF::RunLoop::run):
3220         (WTF::RunLoop::stop):
3221         (WTF::RunLoop::wakeUp):
3222         (WTF::RunLoop::TimerBase::TimerBase):
3223         (WTF::RunLoop::TimerBase::~TimerBase):
3224         (WTF::RunLoop::TimerBase::start):
3225         (WTF::RunLoop::TimerBase::stop):
3226         (WTF::RunLoop::TimerBase::isActive):
3227         * wtf/glib/WorkQueueGLib.cpp: Renamed from Source/WTF/wtf/gtk/WorkQueueGtk.cpp.
3228         (WTF::WorkQueue::platformInitialize):
3229         (WTF::WorkQueue::platformInvalidate):
3230         (WTF::WorkQueue::registerSocketEventHandler):
3231         (WTF::WorkQueue::unregisterSocketEventHandler):
3232         (WTF::WorkQueue::dispatch):
3233         (WTF::WorkQueue::dispatchAfter):
3234
3235 2015-05-19  Andreas Kling  <akling@apple.com>
3236
3237         Give StringView a utf8() API.
3238         <https://webkit.org/b/145201>
3239
3240         Reviewed by Anders Carlsson
3241
3242         Added an LChar version of StringImpl::utf8ForCharacters() and use that to give
3243         StringView a utf8() API just like String has.
3244
3245         * wtf/text/StringImpl.cpp:
3246         (WTF::StringImpl::utf8ForCharacters):
3247         * wtf/text/StringImpl.h:
3248         * wtf/text/StringView.cpp:
3249         (WTF::StringView::utf8):
3250         * wtf/text/StringView.h:
3251
3252 2015-05-19  Yusuke Suzuki  <utatane.tea@gmail.com>
3253
3254         Move AtomicStringImpl table related operations from AtomicString to AtomicStringImpl
3255         https://bugs.webkit.org/show_bug.cgi?id=145109
3256
3257         Reviewed by Darin Adler.
3258
3259         Now AtomicStringImpl table operations are located in AtomicString.
3260         But they should be under AtomicStringImpl.
3261         This patch simply moves these operations to AtomicStringImpl.
3262
3263         And this patch renames static AtomicString::find to static AtomicStringImpl::lookUp
3264         because it conflicts with AtomicStringImpl's member function name.
3265
3266         * WTF.vcxproj/WTF.vcxproj:
3267         * WTF.vcxproj/WTF.vcxproj.filters:
3268         * WTF.vcxproj/copy-files.cmd:
3269         * WTF.xcodeproj/project.pbxproj:
3270         * wtf/CMakeLists.txt:
3271         * wtf/PlatformMac.cmake:
3272         * wtf/PlatformWin.cmake:
3273         * wtf/text/AtomicString.cpp:
3274         (WTF::AtomicString::lower):
3275         (WTF::AtomicString::convertToASCIILowercase):
3276         (WTF::AtomicString::fromUTF8Internal):
3277         (WTF::AtomicStringTableLocker::AtomicStringTableLocker): Deleted.
3278         (WTF::stringTable): Deleted.
3279         (WTF::addToStringTable): Deleted.
3280         (WTF::CStringTranslator::hash): Deleted.
3281         (WTF::CStringTranslator::equal): Deleted.
3282         (WTF::CStringTranslator::translate): Deleted.
3283         (WTF::AtomicString::add): Deleted.
3284         (WTF::UCharBufferTranslator::hash): Deleted.
3285         (WTF::UCharBufferTranslator::equal): Deleted.
3286         (WTF::UCharBufferTranslator::translate): Deleted.
3287         (WTF::HashAndCharactersTranslator::hash): Deleted.
3288         (WTF::HashAndCharactersTranslator::equal): Deleted.
3289         (WTF::HashAndCharactersTranslator::translate): Deleted.
3290         (WTF::HashAndUTF8CharactersTranslator::hash): Deleted.
3291         (WTF::HashAndUTF8CharactersTranslator::equal): Deleted.
3292         (WTF::HashAndUTF8CharactersTranslator::translate): Deleted.
3293         (WTF::SubstringTranslator::translate): Deleted.
3294         (WTF::SubstringTranslator8::hash): Deleted.
3295         (WTF::SubstringTranslator8::equal): Deleted.
3296         (WTF::SubstringTranslator16::hash): Deleted.
3297         (WTF::SubstringTranslator16::equal): Deleted.
3298         (WTF::LCharBufferTranslator::hash): Deleted.
3299         (WTF::LCharBufferTranslator::equal): Deleted.
3300         (WTF::LCharBufferTranslator::translate): Deleted.
3301         (WTF::CharBufferFromLiteralDataTranslator::hash): Deleted.
3302         (WTF::CharBufferFromLiteralDataTranslator::equal): Deleted.
3303         (WTF::CharBufferFromLiteralDataTranslator::translate): Deleted.
3304         (WTF::AtomicString::addFromLiteralData): Deleted.
3305         (WTF::AtomicString::addSlowCase): Deleted.
3306         (WTF::AtomicString::remove): Deleted.
3307         (WTF::AtomicString::findSlowCase): Deleted.
3308         (WTF::AtomicString::findInternal): Deleted.
3309         (WTF::AtomicString::isInAtomicStringTable): Deleted.
3310         * wtf/text/AtomicString.h:
3311         (WTF::AtomicString::AtomicString):
3312         (WTF::AtomicString::fromUTF8):
3313         (WTF::AtomicString::find): Deleted.
3314         (WTF::AtomicString::add): Deleted.
3315         (WTF::AtomicString::addWithStringTableProvider): Deleted.
3316         * wtf/text/AtomicStringImpl.cpp: Copied from Source/WTF/wtf/text/AtomicString.cpp.
3317         (WTF::AtomicStringTableLocker::AtomicStringTableLocker):
3318         (WTF::stringTable):
3319         (WTF::addToStringTable):
3320         (WTF::CStringTranslator::hash):
3321         (WTF::CStringTranslator::equal):
3322         (WTF::CStringTranslator::translate):
3323         (WTF::AtomicStringImpl::add):
3324         (WTF::UCharBufferTranslator::hash):
3325         (WTF::UCharBufferTranslator::equal):
3326         (WTF::UCharBufferTranslator::translate):
3327         (WTF::HashAndCharactersTranslator::hash):
3328         (WTF::HashAndCharactersTranslator::equal):
3329         (WTF::HashAndCharactersTranslator::translate):
3330         (WTF::HashAndUTF8CharactersTranslator::hash):
3331         (WTF::HashAndUTF8CharactersTranslator::equal):
3332         (WTF::HashAndUTF8CharactersTranslator::translate):
3333         (WTF::SubstringTranslator::translate):
3334         (WTF::SubstringTranslator8::hash):
3335         (WTF::SubstringTranslator8::equal):
3336         (WTF::SubstringTranslator16::hash):
3337         (WTF::SubstringTranslator16::equal):
3338         (WTF::LCharBufferTranslator::hash):
3339         (WTF::LCharBufferTranslator::equal):
3340         (WTF::LCharBufferTranslator::translate):
3341         (WTF::CharBufferFromLiteralDataTranslator::hash):
3342         (WTF::CharBufferFromLiteralDataTranslator::equal):
3343         (WTF::CharBufferFromLiteralDataTranslator::translate):
3344         (WTF::AtomicStringImpl::addLiteral):
3345         (WTF::AtomicStringImpl::addSlowCase):
3346         (WTF::AtomicStringImpl::remove):
3347         (WTF::AtomicStringImpl::lookUpSlowCase):
3348         (WTF::AtomicStringImpl::addUTF8):
3349         (WTF::AtomicStringImpl::lookUpInternal):
3350         (WTF::AtomicStringImpl::isInAtomicStringTable):
3351         * wtf/text/AtomicStringImpl.h:
3352         (WTF::AtomicStringImpl::lookUp):
3353         (WTF::AtomicStringImpl::add):
3354         (WTF::AtomicStringImpl::addWithStringTableProvider):
3355         (WTF::AtomicStringImpl::AtomicStringImpl): Deleted.
3356         * wtf/text/StringImpl.cpp:
3357         (WTF::StringImpl::~StringImpl):
3358         * wtf/text/StringImpl.h:
3359         * wtf/text/WTFString.h:
3360         (WTF::String::String):
3361         * wtf/text/cf/AtomicStringCF.cpp:
3362         (WTF::AtomicString::add): Deleted.
3363         * wtf/text/cf/AtomicStringImplCF.cpp: Renamed from Source/WTF/wtf/text/cf/AtomicStringCF.cpp.
3364         (WTF::AtomicStringImpl::add):
3365
3366 2015-05-19  Ting-Wei Lan  <lantw44@gmail.com>
3367
3368         [SOUP] Use st_birthtime to get creation time of files on systems support it
3369         https://bugs.webkit.org/show_bug.cgi?id=144989
3370
3371         Reviewed by Carlos Garcia Campos.
3372
3373         Define HAVE(STAT_BIRTHTIME) as 1 on operating systems supporting
3374         getting creation time of files using st_birthtime in stat.
3375
3376         * wtf/Platform.h:
3377
3378 2015-05-19  Chris Dumez  <cdumez@apple.com>
3379
3380         Mark static variables as const when possible
3381         https://bugs.webkit.org/show_bug.cgi?id=145161
3382
3383         Reviewed by Andreas Kling.
3384
3385         * wtf/dtoa.cpp:
3386         (WTF::pow5mult):
3387
3388 2015-05-19  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
3389
3390         [EFL] Remove unnecessary PLATFORM(EFL) macro in EFL specific files
3391         https://bugs.webkit.org/show_bug.cgi?id=145160
3392
3393         Reviewed by Csaba Osztrogonác.
3394
3395         * wtf/efl/EflTypedefs.h: Remove PLATFORM(EFL).
3396         * wtf/efl/UniquePtrEfl.h: ditto.
3397
3398 2015-05-18  Michael Catanzaro  <mcatanzaro@igalia.com>
3399
3400         [CMake] Ignore warnings in system headers
3401         https://bugs.webkit.org/show_bug.cgi?id=144747
3402
3403         Reviewed by Darin Adler.
3404
3405         Separate include directories into WebKit project includes and system includes. Suppress all
3406         warnings from headers in system include directories using the SYSTEM argument to
3407         the include_directories command.
3408
3409         * wtf/CMakeLists.txt:
3410         * wtf/PlatformEfl.cmake:
3411         * wtf/PlatformGTK.cmake:
3412
3413 2015-05-18  Myles C. Maxfield  <mmaxfield@apple.com>
3414
3415         Addressing post-review comments on r184353
3416         https://bugs.webkit.org/show_bug.cgi?id=145146
3417
3418         Reviewed by Benjamin Poulain.
3419
3420         Create an overload for equalIgnoringASCIICase() for AtomicString and string literals.
3421
3422         * wtf/text/AtomicString.h:
3423         (WTF::equalIgnoringASCIICase):
3424
3425 2015-05-18  Skachkov Alexandr  <gskachkov@gmail.com>
3426
3427         [ES6] Arrow function syntax. Feature flag for arrow function
3428         https://bugs.webkit.org/show_bug.cgi?id=145108
3429
3430         Reviewed by Ryosuke Niwa.
3431
3432         Added feature flag ENABLE_ES6_ARROWFUNCTION_SYNTAX for arrow function
3433
3434         * wtf/FeatureDefines.h:
3435
3436 2015-05-17  Benjamin Poulain  <benjamin@webkit.org>
3437
3438         Do not use fastMallocGoodSize anywhere
3439         https://bugs.webkit.org/show_bug.cgi?id=145103
3440
3441         Reviewed by Michael Saboff.
3442
3443         It is silly we see fastMallocGoodSize in profiles, it does absolutely nothing.
3444
3445         This patch keeps fastMallocGoodSize() around for older code linking
3446         with newer WebKit, but remove any use of it inside WebKit.
3447
3448         * wtf/FastMalloc.cpp:
3449         (WTF::fastMallocGoodSize):
3450         * wtf/FastMalloc.h:
3451         * wtf/Vector.h:
3452         (WTF::VectorBufferBase::allocateBuffer):
3453         (WTF::VectorBufferBase::tryAllocateBuffer):
3454         (WTF::VectorBufferBase::reallocateBuffer):
3455
3456 2015-05-15  Dan Bernstein  <mitz@apple.com>
3457
3458         Build fix for some versions of clang.
3459
3460         * wtf/SaturatedArithmetic.h:
3461         (signedAddOverflows):
3462         (signedSubtractOverflows):
3463
3464 2015-05-14  Dan Bernstein  <mitz@apple.com>
3465
3466         Reverted r177753, now that <rdar://problem/19347133> is fixed.
3467
3468         Rubber-stamped by Benjamin Poulain.
3469
3470         * wtf/SaturatedArithmetic.h:
3471         (signedAddOverflows):
3472         (signedSubtractOverflows):
3473
3474 2015-05-14  Myles C. Maxfield  <mmaxfield@apple.com>
3475
3476         Add String literal overloads to equalIgnoringASCIICase()
3477         https://bugs.webkit.org/show_bug.cgi?id=145008
3478
3479         Reviewed by Benjamin Poulain.
3480
3481         Create an overload for equalIgnoringASCIICase for string literals.
3482
3483         * wtf/text/StringImpl.h:
3484         (WTF::equalIgnoringASCIICase): Use a non-templated helper function.
3485         * wtf/text/StringImpl.cpp:
3486         (WTF::equalIgnoringASCIICase): Implement it.
3487         * wtf/text/StringView.h:
3488         (WTF::equalIgnoringASCIICase): Use a non-templated helper function.
3489         * wtf/text/StringView.cpp:
3490         (WTF::equalIgnoringASCIICase): Implement it.
3491         * wtf/text/WTFString.h:
3492         (WTF::equalIgnoringASCIICase): Delegate to StringImpl's implementation.
3493
3494 2015-05-14  Žan Doberšek  <zdobersek@igalia.com>
3495
3496         [GTK] RunLoop constructor should properly retrieve or establish the thread-default GMainContext
3497         https://bugs.webkit.org/show_bug.cgi?id=144732
3498
3499         Reviewed by Carlos Garcia Campos.
3500
3501         RunLoop constructor in the GTK implementation should use the
3502         existing thread-default context, create a new one if not on
3503         the main thread, or use the global-default one if on the main
3504         thread.
3505
3506         In RunLoop::run(), the GMainContext should then be pushed as
3507         the thread-default before calling g_main_loop_run(), and popped
3508         off when the main loop stops.
3509
3510         * wtf/gtk/RunLoopGtk.cpp:
3511         (WTF::RunLoop::RunLoop):
3512         (WTF::RunLoop::run):
3513
3514 2015-05-13  Oliver Hunt  <oliver@apple.com>
3515        Ensure that all the smart pointer types in WTF clear their pointer before deref
3516        https://bugs.webkit.org/show_bug.cgi?id=143789
3517
3518        Reviewed by Ryosuke Niwa.
3519
3520        In order to prevent use after free bugs caused by destructors
3521        that end up trying to access the smart pointer itself, we should
3522        make sure we always clear the m_ptr field before calling deref.
3523
3524        Essentially the UaF path is:
3525        struct Foo : RefCounted<Foo> {
3526          Wibble* m_wibble;
3527          void doSomething();
3528          ~Foo() { m_wibble->doSomethingLikeCleanup(); }
3529        };
3530
3531        struct Wibble {
3532          void doSomethingLikeCleanup()
3533          {
3534            if (m_foo) {
3535                /* if this branch is not here we get a null deref */
3536                m_foo->doSomething();
3537            }
3538          }
3539          void replaceFoo(Foo* foo) { m_foo = foo; }
3540          RefPtr<Foo> m_foo;
3541        };
3542
3543        Wibble* someWibble = /* a Wibble with m_foo->m_refCount == 1 */;
3544                             /* and m_foo points to someWibble       */;
3545
3546        someWibble->replaceFoo(someOtherFoo);
3547        + someWibble->m_foo->m_ptr->deref();
3548          + someWibble->m_foo->m_ptr->~Foo()
3549            + someWibble->m_foo->m_ptr->m_wibble->doSomethingLikeCleanup()
3550              + someWibble->m_foo->m_ptr->m_wibble /* someWibble */ ->m_foo->m_ptr /*logically dead*/ ->doSomething()
3551
3552        By clearing m_ptr first we either force a null pointer deref or
3553        we force our code down a path that does not use the dead smart
3554        pointer.
3555
3556        * wtf/PassRefPtr.h:
3557        (WTF::PassRefPtr::~PassRefPtr):
3558        * wtf/Ref.h:
3559        (WTF::Ref::~Ref):
3560        (WTF::Ref::operator=):
3561        * wtf/RefPtr.h:
3562        (WTF::RefPtr::~RefPtr):
3563        * wtf/RetainPtr.h:
3564        (WTF::RetainPtr::~RetainPtr):
3565        (WTF::RetainPtr<T>::clear):
3566
3567 2015-05-12  Michael Saboff  <msaboff@apple.com>
3568
3569         If JSC cannot get executable memory, it shouldn't call madvise
3570         https://bugs.webkit.org/show_bug.cgi?id=144931
3571
3572         Reviewed by Mark Lam.
3573
3574         Made calling madvise conditional on really getting mmapped memory.
3575
3576         * wtf/OSAllocatorPosix.cpp:
3577         (WTF::OSAllocator::reserveUncommitted):
3578
3579 2015-05-11  Brent Fulgham  <bfulgham@apple.com>
3580
3581         [Win] Move Windows build target to Windows 7 (or newer)
3582         https://bugs.webkit.org/show_bug.cgi?id=144890
3583         <rdar://problem/20707307>
3584
3585         Reviewed by Anders Carlsson.
3586
3587         Update linked SDK and minimal Windows level to be compatible with