1 2016-11-02 Alex Christensen <achristensen@webkit.org>
3 Remove Battery Status API from the tree
4 https://bugs.webkit.org/show_bug.cgi?id=164213
6 Reviewed by Sam Weinig.
8 * wtf/FeatureDefines.h:
10 2016-11-02 Romain Bellessort <romain.bellessort@crf.canon.fr>
12 [Readable Streams API] Enable creation of ReadableByteStreamController
13 https://bugs.webkit.org/show_bug.cgi?id=164014
15 Reviewed by Youenn Fablet.
17 Added flag for the byte stream part of Readable Streams API.
19 * wtf/FeatureDefines.h:
21 2016-11-02 Per Arne Vollan <pvollan@apple.com>
23 [Win] Copy build results to AAS 'Program Files' folder.
24 https://bugs.webkit.org/show_bug.cgi?id=164273
26 Reviewed by Brent Fulgham.
28 The preferred location for the binaries is the AAS 'Program Files' folder.
30 * WTF.vcxproj/WTF.proj:
32 2016-10-29 Filip Pizlo <fpizlo@apple.com>
34 JSC should support SharedArrayBuffer
35 https://bugs.webkit.org/show_bug.cgi?id=163986
37 Reviewed by Keith Miller.
39 Adds some small things we need for SharedArrayBuffer.
42 (WTF::Atomic::compareExchangeWeakRelaxed):
43 (WTF::Atomic::exchangeAdd):
44 (WTF::Atomic::exchangeAnd):
45 (WTF::Atomic::exchangeOr):
46 (WTF::Atomic::exchangeSub):
47 (WTF::Atomic::exchangeXor):
50 (WTF::atomicCompareExchangeWeak):
51 (WTF::atomicCompareExchangeWeakRelaxed):
52 (WTF::atomicCompareExchangeStrong):
53 (WTF::atomicExchangeAdd):
54 (WTF::atomicExchangeAnd):
55 (WTF::atomicExchangeOr):
56 (WTF::atomicExchangeSub):
57 (WTF::atomicExchangeXor):
58 (WTF::atomicExchange):
59 (WTF::Atomic::exchangeAndAdd): Deleted.
60 (WTF::weakCompareAndSwap): Deleted.
61 We need to be able to do atomics operations on naked pointers. We also need to be able to do
62 all of the things that std::atomic does. This adds those things and renames
63 weakCompareAndSwap to atomicCompareExchangeWeakRelaxed so that we're using consistent
67 (WTF::WordType>::concurrentTestAndSet): Renamed weakCompareAndSwap.
68 (WTF::WordType>::concurrentTestAndClear): Renamed weakCompareAndSwap.
69 * wtf/FastBitVector.h:
70 (WTF::FastBitVector::atomicSetAndCheck): Renamed weakCompareAndSwap.
72 (WTF::ParkingLot::unparkOne):
73 (WTF::ParkingLot::unparkCount):
75 Added unparkCount(), which lets you unpark some bounded number of threads and returns the
76 number of threads unparked. This is just a modest extension of unparkAll(). unparkAll() now
77 just calls unparkCount(ptr, UINT_MAX).
79 2016-10-30 Frederic Wang <fwang@igalia.com>
81 Use HarfBuzz ot-math API to parse the OpenType MATH table
82 https://bugs.webkit.org/show_bug.cgi?id=162671
84 Reviewed by Michael Catanzaro.
86 * wtf/Platform.h: By default, do not enable internal OpenType MATH parsing on GTK.
88 2016-10-25 Mark Lam <mark.lam@apple.com>
90 String.prototype.replace() should throw an OutOfMemoryError when using too much memory.
91 https://bugs.webkit.org/show_bug.cgi?id=163996
92 <rdar://problem/28263117>
94 Reviewed by Geoffrey Garen.
97 (WTF::minCapacity>::tryConstructAndAppend):
98 (WTF::minCapacity>::tryConstructAndAppendSlowCase):
99 - Added try versions of constructAndAppend() so that we can handle the failure
100 to allocate more gracefully.
102 2016-10-25 Konstantin Tokarev <annulen@yandex.ru>
104 Non-specialized version of deleteObject should not have template argument
105 https://bugs.webkit.org/show_bug.cgi?id=163943
107 Reviewed by Anders Carlsson.
109 Fixes compilation of GDIObject.h with MinGW
111 * wtf/win/GDIObject.h:
114 2016-10-24 Per Arne Vollan <pvollan@apple.com>
116 [Win] CMake build type is not set.
117 https://bugs.webkit.org/show_bug.cgi?id=163917
119 Reviewed by Alex Christensen.
121 The CMAKE_BUILD_TYPE variable should be set to Debug or Release.
123 * WTF.vcxproj/WTF.proj:
125 2016-10-23 Yusuke Suzuki <utatane.tea@gmail.com>
127 [DOMJIT] Add a way for DOMJIT::Patchpoint to express effects
128 https://bugs.webkit.org/show_bug.cgi?id=163657
130 Reviewed by Saam Barati.
132 Simplify nonEmptyRangesOverlap.
135 (WTF::nonEmptyRangesOverlap):
137 2016-10-23 Chris Dumez <cdumez@apple.com>
139 Another unreviewed attempt to fix the WatchOS / TvOS build after r207585.
140 <rdar://problem/28902292>
142 Disable USE_CFURLCONNECTION on newer WatchOS / TvOS.
146 2016-10-20 Keith Miller <keith_miller@apple.com>
148 Add support for WASM calls
149 https://bugs.webkit.org/show_bug.cgi?id=161727
151 Reviewed by Filip Pizlo and Michael Saboff.
153 Added a new decodeUInt64. Also, added WTF::LEBDecoder namespace.
156 (WTF::LEBDecoder::decodeUInt):
157 (WTF::LEBDecoder::decodeUInt32):
158 (WTF::LEBDecoder::decodeUInt64):
159 (WTF::LEBDecoder::decodeInt32):
160 (decodeUInt32): Deleted.
161 (decodeInt32): Deleted.
163 2016-10-20 Filip Pizlo <fpizlo@apple.com>
165 The tracking of the coarse-grain Heap state (allocating or not, collector or not, eden vs full) should respect the orthogonality between allocating and collecting
166 https://bugs.webkit.org/show_bug.cgi?id=163738
168 Reviewed by Geoffrey Garen.
170 There will soon be different kinds of GC threads, and WTF's "are you a GC thread" thing
171 should know about this.
173 * wtf/MainThread.cpp:
174 (WTF::initializeGCThreads):
175 (WTF::registerGCThread):
176 (WTF::mayBeGCThread):
179 2016-10-19 Sam Weinig <sam@webkit.org>
181 Add convenience function that combines WTF::visit(...) with WTF::makeVisitor(...)
182 https://bugs.webkit.org/show_bug.cgi?id=163713
184 Reviewed by Dan Bernstein.
186 - Add WTF::switchOn which merges WTF::visit with WTF::makeVisitor in the following
188 WTF::visit(WTF::makeVisitor(...), variant)
193 2016-10-19 Alex Christensen <achristensen@webkit.org>
196 https://bugs.webkit.org/show_bug.cgi?id=163675
198 Reviewed by Brent Fulgham.
201 * wtf/SchedulePair.h:
202 * wtf/SchedulePairMac.mm:
204 2016-10-19 Filip Pizlo <fpizlo@apple.com>
206 REGRESSION (r207480): 3 Dromaeo tests failing
207 https://bugs.webkit.org/show_bug.cgi?id=163633
209 Reviewed by Mark Lam.
211 It's a ParkingLot bug: if we timeout and get unparked at the same time, then the unparking
212 thread will clear our address eventually - but not immediately. This causes a nasty
213 assertion failure. The tricky thing is that when we detect this, we need to wait until that
214 unparking thread does the deed. Otherwise, they will still do it at some later time.
216 Alternatively, we could use some kind of versioning to detect this - increment the version
217 when you park, so that unparking threads will know if they are time travelers. That seems
220 I don't think it matters too much what we do here, so long as it's simple and correct, since
221 this requires a race that is rare enough that it didn't happen once in my testing, and I was
222 pretty thorough. For example, it didn't happen once in 15 runs of JetStream. The race is
223 rare because it requires the timeout to happen right as someone else is unparking. Since
224 it's so rare, its probably OK that the unparked thread waits just a tiny moment until the
225 unparking thread is done.
227 * wtf/ParkingLot.cpp:
228 (WTF::ParkingLot::parkConditionallyImpl):
229 (WTF::ParkingLot::unparkOneImpl):
231 2016-10-19 Filip Pizlo <fpizlo@apple.com>
233 Baseline JIT should use AutomaticThread
234 https://bugs.webkit.org/show_bug.cgi?id=163686
236 Reviewed by Geoffrey Garen.
238 Added a AutomaticThreadCondition::wait() method, so that if you really want to use one
239 common condition for your thread and something else, you can do it. This trivially works
240 if you only use notifyAll(), and behaves as you'd expect for notifyOne() (i.e. it's
241 dangerous, since you don't know who will wake up).
243 The Baseline JIT used the one-true-Condition idiom because it used notifyAll() in an
244 optimal way: there are just two threads talking to each other, so it wakes up at most one
245 thread and that thread is exactly the one you want woken up. Adding wait() means that I did
246 not have to change that code.
248 * wtf/AutomaticThread.cpp:
249 (WTF::AutomaticThreadCondition::wait):
250 * wtf/AutomaticThread.h:
252 2016-10-18 Filip Pizlo <fpizlo@apple.com>
254 DFG worklist should use AutomaticThread
255 https://bugs.webkit.org/show_bug.cgi?id=163615
257 Reviewed by Mark Lam.
259 This adds new functionality to AutomaticThread to support DFG::Worklist:
261 - AutomaticThread::threadDidStart/threadWillStop virtual methods called at the start and end
262 of a thread's lifetime. This allows Worklist to tie some resources to the life of the
263 thread, and also means that now those resources will naturally free up when the Worklist is
266 - AutomaticThreadCondition::notifyOne(). This required changes to Condition::notifyOne(). We
267 need to know if the Condition woke up anyone. If it didn't, then we need to launch one of
270 * wtf/AutomaticThread.cpp:
271 (WTF::AutomaticThreadCondition::notifyOne):
272 (WTF::AutomaticThread::ThreadScope::ThreadScope):
273 (WTF::AutomaticThread::ThreadScope::~ThreadScope):
274 (WTF::AutomaticThread::start):
275 (WTF::AutomaticThread::threadDidStart):
276 (WTF::AutomaticThread::threadWillStop):
277 * wtf/AutomaticThread.h:
279 (WTF::ConditionBase::notifyOne):
281 2016-10-18 Sam Weinig <sam@webkit.org>
283 Replace std::experimental::variant with WTF::Variant (or similar)
284 https://bugs.webkit.org/show_bug.cgi?id=163626
286 Reviewed by Chris Dumez.
288 Rename std::experimental::variant, Variant. Move helpers get/holds_alternative/etc.
289 into the WTF namespace.
294 2016-10-18 Filip Pizlo <fpizlo@apple.com>
296 WTF should make it easier to create threads that die automatically after inactivity
297 https://bugs.webkit.org/show_bug.cgi?id=163576
299 Reviewed by Andreas Kling.
301 For a long time now, I've been adding threads to WTF/JSC and each time I do this, I feel
302 guilty because those threads don't shut down when they are inactive. For example, in bug
303 163562, I need to add a new GC thread. There will be one of them per VM. This means that a
304 JSC API client that starts a lot of VMs will have a lot of threads. I don't think that's
307 A common pattern for all of these threads is that they have some well-defined trigger that
308 causes them to run. This trigger has a lock, a condition variable, some logic that determines
309 if there is work to do, and then of course the logic for the thread's actual work. The thread
310 bodies usually look like this:
312 void Thingy::runThread()
317 LockHolder locker(m_lock);
326 If you look at ParallelHelperPool (the GC's threads) and DFG::Worklist (some of the JIT's
327 threads), you will see this pattern.
329 This change adds a new kind of thread, called AutomaticThread, that lets you write threads to
330 this pattern while getting automatic thread shutdown for free: instead of just waiting on a
331 condition variable, AutomaticThread will have a timeout that causes the thread to die. The
332 condition variable associated with AutomaticThread, called AutomaticThreadCondition, is smart
333 enough to restart any threads that have decided to stop due to inactivity. The inactivity
334 threshold is current just 1 second.
336 In this patch I only adopt AutomaticThread for ParallelHelperPool. I plan to adopt it in more
339 * WTF.xcodeproj/project.pbxproj:
340 * wtf/AutomaticThread.cpp: Added.
341 (WTF::AutomaticThreadCondition::create):
342 (WTF::AutomaticThreadCondition::AutomaticThreadCondition):
343 (WTF::AutomaticThreadCondition::~AutomaticThreadCondition):
344 (WTF::AutomaticThreadCondition::notifyAll):
345 (WTF::AutomaticThreadCondition::add):
346 (WTF::AutomaticThreadCondition::remove):
347 (WTF::AutomaticThreadCondition::contains):
348 (WTF::AutomaticThread::AutomaticThread):
349 (WTF::AutomaticThread::~AutomaticThread):
350 (WTF::AutomaticThread::join):
351 (WTF::AutomaticThread::start):
352 * wtf/AutomaticThread.h: Added.
353 * wtf/CMakeLists.txt:
354 * wtf/ParallelHelperPool.cpp:
355 (WTF::ParallelHelperClient::ParallelHelperClient):
356 (WTF::ParallelHelperClient::~ParallelHelperClient):
357 (WTF::ParallelHelperClient::setTask):
358 (WTF::ParallelHelperClient::finish):
359 (WTF::ParallelHelperClient::doSomeHelping):
360 (WTF::ParallelHelperClient::runTask):
361 (WTF::ParallelHelperPool::ParallelHelperPool):
362 (WTF::ParallelHelperPool::~ParallelHelperPool):
363 (WTF::ParallelHelperPool::ensureThreads):
364 (WTF::ParallelHelperPool::doSomeHelping):
365 (WTF::ParallelHelperPool::Thread::Thread):
366 (WTF::ParallelHelperPool::didMakeWorkAvailable):
367 (WTF::ParallelHelperPool::helperThreadBody): Deleted.
368 (WTF::ParallelHelperPool::waitForClientWithTask): Deleted.
369 * wtf/ParallelHelperPool.h:
371 2016-10-18 Said Abou-Hallawa <sabouhallawa@apple.com>
373 SVGCSSParser: m_implicitShorthand value is not reset after adding the shorthand property
374 https://bugs.webkit.org/show_bug.cgi?id=116470
376 Reviewed by Simon Fraser.
378 * wtf/TemporaryChange.h:
379 (WTF::TemporaryChange::TemporaryChange):
380 Add a new constructor to make TemporaryChange work as a restorer. The
381 temporary change will happen after we construct the object.
383 2016-10-17 Simon Fraser <simon.fraser@apple.com>
385 Implement DOMRect/DOMRectReadOnly
386 https://bugs.webkit.org/show_bug.cgi?id=163464
388 Reviewed by Darin Adler.
390 Implement min()/max() in a way that follows Math.min/Math.max, which return
391 NaN if either argument is NaN.
394 (WTF::nanPropagatingMin):
395 (WTF::nanPropagatingMax):
397 2016-10-15 Sam Weinig <sam@webkit.org>
399 MessageEvent's source property should be a (DOMWindow or MessagePort)? rather than a EventTarget?
400 https://bugs.webkit.org/show_bug.cgi?id=163475
402 Reviewed by Simon Fraser.
405 Add missing return statement that was tripping up some compilers.
407 2016-10-12 Ryan Haddad <ryanhaddad@apple.com>
409 Unreviewed, rolling out r207225.
411 This change causes debug tests to exit early with crashes.
415 "Optional's move-constructor and move-assignment operator
416 don't disengage the value being moved from"
417 https://bugs.webkit.org/show_bug.cgi?id=163309
418 http://trac.webkit.org/changeset/207225
420 2016-10-11 Sam Weinig <sam@webkit.org>
422 Optional's move-constructor and move-assignment operator don't disengage the value being moved from
423 https://bugs.webkit.org/show_bug.cgi?id=163309
425 Reviewed by Anders Carlsson.
428 (WTF::Optional::Optional):
429 (WTF::Optional::operator=):
430 Disengage 'other' on move-construction and move-assignment.
432 2016-10-08 Filip Pizlo <fpizlo@apple.com>
434 MarkedBlock should know what objects are live during marking
435 https://bugs.webkit.org/show_bug.cgi?id=162309
437 Reviewed by Geoffrey Garen.
439 This removes the atomicity mode, because it's not really used: it only affects the
440 concurrentBlah methods, but their only users turn on atomicity. This was useful because
441 previously, some binary Bitmap methods (like merge(const Bitmap&)) couldn't be used
442 effectively in the GC because some of the GC's bitmaps set the atomic mode and some didn't.
443 Removing this useless mode is the best solution.
445 Also added some new binary Bitmap methods: mergeAndClear(Bitmap& other) and
446 setAndClear(Bitmap& other). They perform their action on 'this' (either merge or set,
447 respectively) while also clearing the contents of 'other'. This is great for one of the GC
451 (WTF::WordType>::Bitmap):
452 (WTF::WordType>::get):
453 (WTF::WordType>::set):
454 (WTF::WordType>::testAndSet):
455 (WTF::WordType>::testAndClear):
456 (WTF::WordType>::concurrentTestAndSet):
457 (WTF::WordType>::concurrentTestAndClear):
458 (WTF::WordType>::clear):
459 (WTF::WordType>::clearAll):
460 (WTF::WordType>::nextPossiblyUnset):
461 (WTF::WordType>::findRunOfZeros):
462 (WTF::WordType>::count):
463 (WTF::WordType>::isEmpty):
464 (WTF::WordType>::isFull):
465 (WTF::WordType>::merge):
466 (WTF::WordType>::filter):
467 (WTF::WordType>::exclude):
468 (WTF::WordType>::forEachSetBit):
469 (WTF::WordType>::mergeAndClear):
470 (WTF::WordType>::setAndClear):
472 (WTF::WordType>::hash):
474 2016-10-11 Said Abou-Hallawa <sabouhallawa@apple.com>
476 Add SynchronizedFixedQueue class
477 https://bugs.webkit.org/show_bug.cgi?id=162478
479 Reviewed by Geoffrey Garen.
481 This class represents a simple producer/consumer worker. It facilitates
482 synchronizing enqueuing to and dequeuing from a fixed size-queue. It uses
483 a single lock and a single condition to synchronize all its members among
484 the working threads. This means a single thread is active at any time and
485 and the other threads are blocked waiting for the lock to be released. Or
486 they are sleeping waiting for the condition to be satisfied.
488 * WTF.xcodeproj/project.pbxproj:
489 * wtf/SynchronizedFixedQueue.h: Added.
490 (WTF::SynchronizedFixedQueue::SynchronizedFixedQueue):
491 (WTF::SynchronizedFixedQueue::open): Restore the queue to its original state.
492 (WTF::SynchronizedFixedQueue::close): Wake all the sleeping threads with a closing state.
493 (WTF::SynchronizedFixedQueue::isOpen): Does the queue accept new items?
494 (WTF::SynchronizedFixedQueue::enqueue): Enqueue an item into the queue.
495 (WTF::SynchronizedFixedQueue::dequeue): Dequeue an item form the queue.
497 2016-10-11 Alex Christensen <achristensen@webkit.org>
499 Remove dead networking code
500 https://bugs.webkit.org/show_bug.cgi?id=163263
502 Reviewed by Daniel Bates.
505 * wtf/SchedulePair.h:
506 * wtf/SchedulePairMac.mm:
508 2016-10-10 Zan Dobersek <zdobersek@igalia.com>
510 Add ENABLE_ENCRYPTED_MEDIA configuration option
511 https://bugs.webkit.org/show_bug.cgi?id=163219
513 Reviewed by Darin Adler.
515 * wtf/FeatureDefines.h:
516 If undefined, define the ENABLE_ENCRYPTED_MEDIA option to 0.
518 2016-10-10 Yusuke Suzuki <utatane.tea@gmail.com>
520 [DOMJIT] Implement Node accessors in DOMJIT
521 https://bugs.webkit.org/show_bug.cgi?id=163005
523 Reviewed by Filip Pizlo.
525 Add CAST_OFFSET. It is not necessary for JSCell thingy
526 since we don't use virtual member functions. However, it
527 is not true for WebCore DOM wrapped objects.
529 * wtf/StdLibExtras.h:
531 2016-10-07 Chris Dumez <cdumez@apple.com>
533 window.navigator.language incorrectly returns all lowercase string
534 https://bugs.webkit.org/show_bug.cgi?id=163096
536 Reviewed by Darin Adler.
538 Update platformUserPreferredLanguages() so that it no longer lowercases
539 the string it returns. On Mac, we rely on CFLocale which returns
540 BCP-47 language tags as per:
541 - https://developer.apple.com/reference/corefoundation/1666963-cflocale?language=objc
543 * wtf/PlatformUserPreferredLanguagesMac.mm:
544 (WTF::httpStyleLanguageCode):
545 * wtf/PlatformUserPreferredLanguagesUnix.cpp:
546 (WTF::platformLanguage):
548 2016-10-06 Brent Fulgham <bfulgham@apple.com>
550 [Win][Direct2D] Add Direct2D CMake rules
551 https://bugs.webkit.org/show_bug.cgi?id=162925
553 Reviewed by Brent Fulgham.
555 * wtf/Platform.h: Don't USE(CA) or USE(CG) if building
558 2016-10-05 Yusuke Suzuki <utatane.tea@gmail.com>
560 [DOMJIT] Add initial CheckDOM and CallDOM implementations
561 https://bugs.webkit.org/show_bug.cgi?id=162941
563 Reviewed by Filip Pizlo.
568 2016-10-05 Zan Dobersek <zdobersek@igalia.com>
570 Rename ENABLE_ENCRYPTED_MEDIA_V2 to ENABLE_LEGACY_ENCRYPTED_MEDIA
571 https://bugs.webkit.org/show_bug.cgi?id=162903
573 Reviewed by Alex Christensen.
575 Rename build guards for the remaining implementation of the legacy EME API
576 to ENABLE_LEGACY_ENCRYPTED_MEDIA. This will allow for the future implementation
577 of the near-finished API to be guarded with the simple ENABLE_ENCRYPTED_MEDIA guards.
579 * wtf/FeatureDefines.h:
581 2016-10-04 Saam Barati <sbarati@apple.com>
583 String.prototype.toLowerCase should be a DFG/FTL intrinsic
584 https://bugs.webkit.org/show_bug.cgi?id=162887
586 Reviewed by Filip Pizlo and Yusuke Suzuki.
588 This patch exposes a new StringImpl function called convertToLowercaseWithoutLocaleStartingAtFailingIndex8Bit
589 which extracts slow path for the 8-bit part of convertToLowercaseWithoutLocale
590 into a helper function. I decided to extract this into its own function because
591 it may be the case that JSCs JITs will want to continue the operation
592 after it has already ensured that part of an 8-bit string is lower case.
594 * wtf/text/StringImpl.cpp:
595 (WTF::StringImpl::convertToLowercaseWithoutLocale):
596 (WTF::StringImpl::convertToLowercaseWithoutLocaleStartingAtFailingIndex8Bit):
597 * wtf/text/StringImpl.h:
598 * wtf/text/WTFString.cpp:
599 (WTF::String::convertToLowercaseWithoutLocaleStartingAtFailingIndex8Bit):
600 * wtf/text/WTFString.h:
602 2016-10-04 Chris Dumez <cdumez@apple.com>
604 Implement KeyboardEvent.code from the UI Event spec
605 https://bugs.webkit.org/show_bug.cgi?id=149584
607 Reviewed by Darin Adler.
609 Add build time flag to toggle support for the code attribute on
610 KeyboardEvent and only enable it on Mac for now, given that the
611 implementation is missing on other platforms.
613 * wtf/FeatureDefines.h:
615 2016-10-03 Chris Dumez <cdumez@apple.com>
617 Add support for KeyboardEvent.key attribute
618 https://bugs.webkit.org/show_bug.cgi?id=36267
620 Reviewed by Darin Adler.
622 Add compile time flag for the key attribute on KeyboardEvent and enable
625 * wtf/FeatureDefines.h:
627 2016-09-29 Sam Weinig <sam@webkit.org>
629 Add initial support for IDL union conversion
630 https://bugs.webkit.org/show_bug.cgi?id=161576
632 Reviewed by Chris Dumez.
634 * WTF.xcodeproj/project.pbxproj:
635 * wtf/CMakeLists.txt:
638 * wtf/Brigand.h: Added.
639 Import a standalone copy of Edouard Alligand and Joel Falcou's
640 Brigand library for help with for help with list based meta programming
642 * wtf/StdLibExtras.h:
643 Add a new three new type traits, IsTemplate, IsBaseOfTemplate and RemoveCVAndReference.
644 - IsTemplate acts like std::is_class, but works with a generic base.
645 - IsBaseOfTemplate acts like std::is_base_of, but works with a generic base.
646 - RemoveCVAndReference combines std::remove_cv and std::remove_reference.
648 2016-09-30 Filip Pizlo <fpizlo@apple.com>
650 B3::moveConstants should be able to edit code to minimize the number of constants
651 https://bugs.webkit.org/show_bug.cgi?id=162764
653 Reviewed by Saam Barati.
655 I thought it would be a good idea to document the fact that dominator traversal happens in a
656 particular order for a reason.
660 2016-09-29 Filip Pizlo <fpizlo@apple.com>
662 Air should have a way of expressing additional instruction flags
663 https://bugs.webkit.org/show_bug.cgi?id=162699
665 Reviewed by Mark Lam.
667 * wtf/CommaPrinter.h:
668 (WTF::CommaPrinter::CommaPrinter):
669 (WTF::CommaPrinter::dump):
670 (WTF::CommaPrinter::didPrint):
672 2016-09-30 Youenn Fablet <youenn@apple.com>
674 Add a way to go from a RefPtr<T> to Ref<const T>
675 https://bugs.webkit.org/show_bug.cgi?id=162683
677 Reviewed by Alex Christensen.
680 (WTF::RefPtr::releaseConstNonNull): Added.
682 2016-09-29 Mark Lam <mark.lam@apple.com>
684 Re-enable StringView life-cycle checking.
685 https://bugs.webkit.org/show_bug.cgi?id=160384
686 <rdar://problem/28479434>
688 Reviewed by Saam Barati.
690 Re-landing after slow running tests have been resolved.
692 * wtf/text/StringView.h:
694 2016-09-29 Commit Queue <commit-queue@webkit.org>
696 Unreviewed, rolling out r206563.
697 https://bugs.webkit.org/show_bug.cgi?id=162732
699 Caused stress/op_*.js.ftl-no-cjit tests to time out (Requested
700 by ryanhaddad on #webkit).
704 "Re-enable StringView life-cycle checking."
705 https://bugs.webkit.org/show_bug.cgi?id=160384
706 http://trac.webkit.org/changeset/206563
708 2016-09-29 Fujii Hironori <Hironori.Fujii@sony.com>
710 Clang 3.9 reports a compilation warning about ENABLE_EXCEPTION_SCOPE_VERIFICATION
711 https://bugs.webkit.org/show_bug.cgi?id=162718
713 Reviewed by Alex Christensen.
715 Clang 3.9 reports a following compilation warning:
716 Source/JavaScriptCore/runtime/VM.h:656:5: warning: macro expansion producing 'defined' has undefined behavior [-Wexpansion-to-defined]
718 * wtf/Platform.h: Changed the definition of ENABLE_EXCEPTION_SCOPE_VERIFICATION not to use 'defined'.
720 2016-09-28 Mark Lam <mark.lam@apple.com>
722 Re-enable StringView life-cycle checking.
723 https://bugs.webkit.org/show_bug.cgi?id=160384
724 <rdar://problem/28479434>
726 Reviewed by Saam Barati.
728 * wtf/text/StringView.h:
730 2016-09-28 Filip Pizlo <fpizlo@apple.com>
732 The write barrier should be down with TSO
733 https://bugs.webkit.org/show_bug.cgi?id=162316
735 Reviewed by Geoffrey Garen.
737 Added clearRange(), which quickly clears a range of bits. This turned out to be useful for
738 a DFG optimization pass.
740 * wtf/FastBitVector.cpp:
741 (WTF::FastBitVector::clearRange):
742 * wtf/FastBitVector.h:
744 2016-09-28 Mark Lam <mark.lam@apple.com>
746 Fix race condition in StringView's UnderlyingString lifecycle management.
747 https://bugs.webkit.org/show_bug.cgi?id=162702
749 Reviewed by Geoffrey Garen.
751 There 2 relevant functions at play:
753 void StringView::setUnderlyingString(const StringImpl* string)
755 UnderlyingString* underlyingString;
757 underlyingString = nullptr;
759 std::lock_guard<StaticLock> lock(underlyingStringsMutex);
760 auto result = underlyingStrings().add(string, nullptr);
761 if (result.isNewEntry)
762 result.iterator->value = new UnderlyingString(*string);
764 ++result.iterator->value->refCount;
765 underlyingString = result.iterator->value; // Point P2.
767 adoptUnderlyingString(underlyingString); // Point P5.
772 void StringView::adoptUnderlyingString(UnderlyingString* underlyingString)
774 if (m_underlyingString) {
776 if (!--m_underlyingString->refCount) {
777 if (m_underlyingString->isValid) { // Point P1.
778 std::lock_guard<StaticLock> lock(underlyingStringsMutex);
779 underlyingStrings().remove(&m_underlyingString->string); // Point P3.
781 delete m_underlyingString; // Point P4.
784 m_underlyingString = underlyingString;
787 Imagine the following scenario:
789 1. Thread T1 has been using an UnderlyingString U1, and is now done with it.
790 T1 runs up to point P1 in adoptUnderlyingString(), and is blocked waiting for
791 the underlyingStringsMutex (which is currently being held by Thread T2).
792 2. Context switch to Thread T2.
793 T2 wants to use UnderlyingString U1, and runs up to point P2 in setUnderlyingString()
794 and releases the underlyingStringsMutex.
795 Note: T2 thinks it has successfully refCounted U1, and therefore U1 is safe to use.
796 3. Context switch to Thread T1.
797 T1 acquires the underlyingStringsMutex, and proceeds to remove it from the
798 underlyingStrings() map (see Point P3). It thinks it has successfully done so
799 and proceeds to delete U1 (see Point P4).
800 4. Context switch to Thread T2.
801 T2 proceeds to use U1 (see Point P5 in setUnderlyingString()).
802 Note: U1 has already been freed. This is a use after free.
804 The fix is to acquire the underlyingStringsMutex at Point P0 in adoptUnderlyingString()
805 instead of after P1. This ensures that the decrementing of the UnderlyingString
806 refCount and its removal from the underlyingStrings() map is done as an atomic unit.
808 Note: If you look in StringView.cpp, you see another setUnderlyingString() which
809 takes a StringView otherString. This version of setUnderlyingString() can only
810 be called from within the same thread that created the other StringView. As a
811 result, here, we are guaranteed that the UnderlyingString refCount is never zero,
812 and there's no other threat of another thread trying to delete the UnderlyingString
813 while we adopt it. Hence, we don't need to acquire the underlyingStringsMutex
816 This race condition was found when running layout tests fetch/fetch-worker-crash.html
817 and storage/indexeddb/modern/opendatabase-versions.html when CHECK_STRINGVIEW_LIFETIME
818 is enabled. This issue resulted in those tests crashing due to a use-after-free.
820 * wtf/text/StringView.cpp:
821 (WTF::StringView::adoptUnderlyingString):
822 (WTF::StringView::setUnderlyingString):
824 2016-09-28 Brent Fulgham <bfulgham@apple.com>
826 Correct 'safeCast' implementation
827 https://bugs.webkit.org/show_bug.cgi?id=162679
828 <rdar://problem/28518189>
830 Reviewed by Zalan Bujtas.
832 * wtf/StdLibExtras.h:
833 (WTF::safeCast): Use a RELEASE_ASSERT.
835 2016-09-27 Don Olmstead <don.olmstead@am.sony.com>
837 [CMake] Add HAVE_LOCALTIME_R definition
838 https://bugs.webkit.org/show_bug.cgi?id=162636
840 Reviewed by Alex Christensen.
844 * wtf/GregorianDateTime.cpp:
845 (WTF::GregorianDateTime::setToCurrentLocalTime):
848 2016-09-27 JF Bastien <jfbastien@apple.com>
850 Speed up Heap::isMarkedConcurrently
851 https://bugs.webkit.org/show_bug.cgi?id=162095
853 Reviewed by Filip Pizlo.
855 Heap::isMarkedConcurrently had a load-load fence which is expensive on weak memory ISAs such as ARM.
857 This patch is fairly perf-neutral overall, but the GC's instrumentation reports:
858 GC:Eden is 93% average runtime after change
859 GC:Full is 76% average runtime after change
861 The fence was there because:
862 1. If the read of m_markingVersion in MarkedBlock::areMarksStale isn't what's expected then;
863 2. The read of m_marks in MarkedBlock::isMarked needs to observe the value that was stored *before* m_markingVersion was stored.
865 This ordering isn't guaranteed on ARM, which has a weak memory model.
867 There are 3 ways to guarantee this ordering:
868 A. Use a barrier instruction.
869 B. Use a load-acquire (new in ARMv8).
870 C. use ARM's address dependency rule, which C++ calls memory_order_consume.
873 A. is slow but orders all of memory in an intuitive manner.
874 B. is faster-ish and has the same property-ish.
875 C. should be faster still, but *only orders dependent loads*. This last part is critical! Consume isn't an all-out replacement for acquire (acquire is rather a superset of consume).
877 ARM explains the address dependency rule in their document "barrier litmus tests and cookbook":
879 > *Resolving by the use of barriers and address dependency*
881 > There is a rule within the ARM architecture that:
882 > Where the value returned by a read is used to compute the virtual address of a subsequent read or write (this is known as an address dependency), then these two memory accesses will be observed in program order. An address dependency exists even if the value read by the first read has no effect in changing the virtual address (as might be the case if the value returned is masked off before it is used, or if it had no effect on changing a predicted address value).
883 > This restriction applies only when the data value returned from one read is used as a data value to calculate the address of a subsequent read or write. This does not apply if the data value returned from one read is used to determine the condition code flags, and the values of the flags are used for condition code evaluation to determine the address of a subsequent reads, either through conditional execution or the evaluation of a branch. This is known as a control dependency.
884 > Where both a control and address dependency exist, the ordering behaviour is consistent with the address dependency.
886 C++'s memory_order_consume is unfortunately unimplemented by C++ compilers, and maybe unimplementable as spec'd. I'm working with interested folks in the committee to fix this situation: http://wg21.link/p0190r2
889 (WTF::zeroWithConsumeDependency): a 0 which carries a dependency
890 (WTF::consumeLoad): pixie magic
892 2016-09-27 JF Bastien <jfbastien@apple.com>
894 Atomics.h on Windows: remove seq_cst hack
895 https://bugs.webkit.org/show_bug.cgi?id=162022
897 Reviewed by Mark Lam.
899 No need to force access to seq_cst, always inlining fixes the MSVC warning.
902 (WTF::Atomic::compareExchangeWeak): remove seq_cst hack
903 (WTF::Atomic::compareExchangeStrong): remove seq_cst hack
904 (WTF::Atomic::exchangeAndAdd): remove seq_cst hack
905 (WTF::Atomic::exchange): remove seq_cst hack
907 2016-09-27 Don Olmstead <don.olmstead@am.sony.com>
909 [CMake] Use CMake to determine HAVE_* defines
910 https://bugs.webkit.org/show_bug.cgi?id=162368
912 Reviewed by Alex Christensen.
916 2016-09-20 Anders Carlsson <andersca@apple.com>
918 PlatformEvent::m_modifiers should be an OptionSet
919 https://bugs.webkit.org/show_bug.cgi?id=162326
921 Reviewed by Daniel Bates.
924 (WTF::OptionSet::operator!=):
925 (WTF::OptionSet::operator-):
927 2016-09-27 Jer Noble <jer.noble@apple.com>
929 Remove deprecated ENCRYPTED_MEDIA implementation.
930 https://bugs.webkit.org/show_bug.cgi?id=161010
932 Reviewed by Eric Carlson.
934 Remove ENABLE_ENCRYPTED_MEDIA.
936 * wtf/FeatureDefines.h:
938 2016-09-27 Youenn Fablet <youenn@apple.com>
940 [Fetch API] Use Ref<const T> in FetchBody::m_data variant
941 https://bugs.webkit.org/show_bug.cgi?id=162599
943 Reviewed by Alex Christensen.
945 Enabling to use DeferrableRefCounted<const T> by making m_refCount mutable.
947 * wtf/DeferrableRefCounted.h:
948 (WTF::DeferrableRefCountedBase::ref):
949 (WTF::DeferrableRefCountedBase::derefBase):
950 (WTF::DeferrableRefCounted::deref):
952 2016-09-26 Daniel Bates <dabates@apple.com>
954 Rename IOS_TEXT_AUTOSIZING to TEXT_AUTOSIZING
955 https://bugs.webkit.org/show_bug.cgi?id=162365
957 Reviewed by Simon Fraser.
959 * wtf/FeatureDefines.h:
961 2016-09-26 Benjamin Poulain <benjamin@webkit.org>
963 [JSC] Shrink the Math inline caches some more
964 https://bugs.webkit.org/show_bug.cgi?id=162485
966 Reviewed by Saam Barati.
969 Don't copy the arguments before initializing the nodes.
971 2016-09-26 Michael Catanzaro <mcatanzaro@igalia.com>
973 std::unique_ptr deleter functions should not check if pointer is null
974 https://bugs.webkit.org/show_bug.cgi?id=162558
976 Reviewed by Alex Christensen.
978 std::unique_ptr already does this before calling the deleter.
980 * wtf/efl/UniquePtrEfl.h:
981 * wtf/glib/GUniquePtr.h:
983 == Rolled over to ChangeLog-2016-09-26 ==