1 2018-08-09 Saam Barati <sbarati@apple.com>
3 memoryFootprint should return size_t not optional<size_t>
4 https://bugs.webkit.org/show_bug.cgi?id=188444
6 Reviewed by Simon Fraser.
8 We're now going to return zero instead of returning nullopt on failure.
9 There was a lot of code dancing around memoryFootprint failing for no
12 Users of this API were previously doing this on failure:
13 - Treating it as zero (this was the most common user).
15 - Bailing out early and not changing our memory pressure state. This change
16 has the effect that instead of not changing our memory pressure state on
17 failure, we will go back to thinking we're not under memory pressure. Since
18 we relied on this API not failing to do anything useful (like kill the process
19 or release memory), this won't change our behavior here in a meaningful way.
21 * wtf/MemoryFootprint.h:
22 * wtf/MemoryPressureHandler.cpp:
23 (WTF::MemoryPressureHandler::currentMemoryUsagePolicy):
24 (WTF::MemoryPressureHandler::shrinkOrDie):
25 (WTF::MemoryPressureHandler::measurementTimerFired):
26 * wtf/cocoa/MemoryFootprintCocoa.cpp:
27 (WTF::memoryFootprint):
28 * wtf/linux/MemoryFootprintLinux.cpp:
29 (WTF::memoryFootprint):
30 * wtf/linux/MemoryPressureHandlerLinux.cpp:
31 (WTF::MemoryPressureHandler::ReliefLogger::platformMemoryUsage):
32 * wtf/win/MemoryFootprintWin.cpp:
33 (WTF::memoryFootprint):
35 2018-08-05 Darin Adler <darin@apple.com>
37 [Cocoa] More tweaks and refactoring to prepare for ARC
38 https://bugs.webkit.org/show_bug.cgi?id=188245
40 Reviewed by Dan Bernstein.
42 * WTF.xcodeproj/project.pbxproj: Updated for rename: FoundationSPI.h -> objcSPI.h.
44 * wtf/BlockPtr.h: Added missing include of "StdLibExtras.h".
45 Also re-sorted includes.
47 * wtf/HashFunctions.h: Add function for "__unsafe_unretained id".
48 * wtf/HashTraits.h: Add traits for "__unsafe_unretained id".
50 * wtf/PlatformMac.cmake: Updated for rename: FoundationSPI.h -> objcSPI.h.
52 * wtf/WeakObjCPtr.h: Use mutable instead of const_cast, and write a version
53 that uses __weak explicitly under ARC. Also moved function declarations from
56 * wtf/cocoa/AutodrainedPool.cpp: Updated include for rename: FoundationSPI.h -> objcSPI.h.
58 * wtf/spi/cocoa/objcSPI.h: Renamed from FoundationSPI.h and added the
59 additional functions used by WeakObjCPtr.h. Also changed to both include the
60 internal header and the function definitions when compiling with
61 USE(APPLE_INTERNAL_SDK), helping us check that function definitions match.
63 2018-08-07 Yusuke Suzuki <yusukesuzuki@slowstart.org>
65 Shrink size of PropertyCondition by packing UniquedStringImpl* and Kind
66 https://bugs.webkit.org/show_bug.cgi?id=188328
68 Reviewed by Saam Barati.
70 This patch adds CompactPointerTuple, which can pack a pointer and 8bit value into 8bytes.
71 In 32bit architecture, it just has two fields for a pointer and 8bit value. In 64bit architecture,
72 we use upper 5bits (zeros because of the effective width of virtual address) and lower 3bits (zeros
73 because of the alignment ensured by static_assert) to pack 8bit value into the pointer data. Since
74 even the 5-level page tables use 57bit effective address, this strategy works well.
76 * WTF.xcodeproj/project.pbxproj:
78 * wtf/CompactPointerTuple.h: Added.
79 (WTF::CompactPointerTuple::encodeType):
80 (WTF::CompactPointerTuple::decodeType):
81 (WTF::CompactPointerTuple::CompactPointerTuple):
82 (WTF::CompactPointerTuple::pointer const):
83 (WTF::CompactPointerTuple::setPointer):
84 (WTF::CompactPointerTuple::type const):
85 (WTF::CompactPointerTuple::setType):
88 2018-08-07 Ryan Haddad <ryanhaddad@apple.com>
90 Unreviewed, suppress warnings to fix the build.
94 (WTF::SHA1::addBytes):
95 (WTF::SHA1::computeHash):
97 2018-08-07 Karo Gyoker <karogyoker2+webkit@gmail.com>
99 Hardcoded LFENCE instruction
100 https://bugs.webkit.org/show_bug.cgi?id=188145
102 Reviewed by Filip Pizlo.
104 Remove lfence instruction because it is crashing systems without SSE2 and
105 this is not the way how WebKit mitigates Spectre.
108 (WTF::crossModifyingCodeFence):
109 (WTF::speculationFence): Deleted.
110 (WTF::x86_lfence): Deleted.
112 2018-08-07 Antti Koivisto <antti@apple.com>
114 Web process never leaves memory pressured state if caused by process size limit
115 https://bugs.webkit.org/show_bug.cgi?id=188299
116 <rdar://problem/42157442>
118 Reviewed by Darin Adler.
120 For vm memory pressure warnings we get notified when exiting the state and we can clear
121 the isUnderMemoryPressure bit. However as a compatibility behavior we were also notified using
122 the same event when approaching the process size limit. In this case there is no "all clear"
123 event so we'd stay in pressured state forever, leading to unnecessarily degraded user experience.
125 * WTF.xcodeproj/project.pbxproj:
126 * wtf/cocoa/MemoryPressureHandlerCocoa.mm:
127 (WTF::MemoryPressureHandler::install):
129 Install a handler for process size limit events. This disables the compatibility behavior,
130 vm pressure events will be received for vm pressure only.
132 Process size limit events are treated as one-shot. We do cleanups based on criticality but
133 don't enter the pressured state.
135 (WTF::MemoryPressureHandler::uninstall):
136 (WTF::MemoryPressureHandler::holdOff):
137 * wtf/spi/darwin/DispatchSPI.h: Added.
139 2018-08-06 Alex Christensen <achristensen@webkit.org>
141 Use enum classes and OptionSets for PaintPhase and PaintBehavior
142 https://bugs.webkit.org/show_bug.cgi?id=188323
144 Reviewed by Simon Fraser.
147 (WTF::OptionSet::OptionSet):
148 Allow a zero-valued enum value in the OptionSet constructor.
150 2018-08-06 Ryan Haddad <ryanhaddad@apple.com>
152 Unreviewed, rolling out r234569.
154 Breaks internal builds.
158 "We should cache the compiled sandbox profile in a data vault"
159 https://bugs.webkit.org/show_bug.cgi?id=184991
160 https://trac.webkit.org/changeset/234569
162 2018-08-03 Ryan Haddad <ryanhaddad@apple.com>
164 Unreviewed, fix the build by ignoring some deprecation warnings.
168 (WTF::MD5::addBytes):
169 (WTF::MD5::checksum):
171 2018-08-03 Ben Richards <benton_richards@apple.com>
173 We should cache the compiled sandbox profile in a data vault
174 https://bugs.webkit.org/show_bug.cgi?id=184991
176 Reviewed by Ryosuke Niwa.
178 Added trace points for sandbox initialization and exposed functions needed for sandbox caching
180 * wtf/SystemTracing.h:
181 * wtf/spi/darwin/SandboxSPI.h:
183 2018-08-02 Saam Barati <sbarati@apple.com>
185 Reading instructionPointer from PlatformRegisters may fail when using pointer tagging
186 https://bugs.webkit.org/show_bug.cgi?id=188271
187 <rdar://problem/42850884>
189 Reviewed by Michael Saboff.
193 (WTF::usesPointerTagging):
195 2018-08-02 Alex Christensen <achristensen@webkit.org>
197 Add some Variant types to Forward.h
198 https://bugs.webkit.org/show_bug.cgi?id=188250
202 2018-08-02 David Fenton <david_fenton@apple.com>
204 Unreviewed, rolling out r234489.
206 Caused 50+ crashes and 60+ API failures on iOS
210 "[WTF] Rename String::format to String::deprecatedFormat"
211 https://bugs.webkit.org/show_bug.cgi?id=188191
212 https://trac.webkit.org/changeset/234489
214 2018-08-01 Tomas Popela <tpopela@redhat.com>
216 [WTF] Rename String::format to String::deprecatedFormat
217 https://bugs.webkit.org/show_bug.cgi?id=188191
219 Reviewed by Darin Adler.
221 It should be replaced with string concatenation.
223 * wtf/Assertions.cpp:
224 * wtf/JSONValues.cpp:
226 (WTF::WorkQueue::concurrentApply):
229 * wtf/text/WTFString.cpp:
230 (WTF::String::deprecatedFormat):
231 (WTF::String::format): Deleted.
232 * wtf/text/WTFString.h:
234 2018-07-31 Tomas Popela <tpopela@redhat.com>
236 [WTF] String::formatWithArguments() is unused
237 https://bugs.webkit.org/show_bug.cgi?id=187955
239 Reviewed by Darin Adler.
241 This method is unused, remove it.
243 * wtf/text/WTFString.cpp:
244 (WTF::String::formatWithArguments): Deleted.
245 * wtf/text/WTFString.h:
247 2018-07-28 Mark Lam <mark.lam@apple.com>
249 Gardening: build fix for internal builds.
250 https://bugs.webkit.org/show_bug.cgi?id=188123
251 <rdar://problem/42672268>
255 Some code is relying on RELEASE_ASSERT (without extra crash info arguments)
256 being purely inlined and not require linkage to an external symbol. This patch
257 restores this property of the original RELEASE_ASSERT.
259 This means moving the variant of WTFCrashWithInfo that does not take extra args
260 to Assertions.h and making it an "inline" function. When compiling with clang,
261 we also specify __attribute__((optnone)) to force the function out of being an
262 inline function (each linkage unit will get a copy of the function). This causes
263 the 1st 4 arguments of WTFCrashWithInfo (e.g. line number) to still be captured
264 in the argument registers for crash diagnostics.
266 * wtf/Assertions.cpp:
270 2018-07-27 Mark Lam <mark.lam@apple.com>
272 Add some crash info to Heap::checkConn() RELEASE_ASSERTs.
273 https://bugs.webkit.org/show_bug.cgi?id=188123
274 <rdar://problem/42672268>
276 Reviewed by Keith Miller.
278 1. Rename STUFF_FOR_CRASH_REGISTERx to CRASH_GPRx. These are only used in
279 locally in Assertions.cpp. There is little to no chance of a name collision,
280 and the shorter names will be much easier to read and grok in the code.
282 2. Added an additional 2 registers so that we can pass more info.
284 3. Change the WTFCrashWithInfo() implementations to issue only a single asm
285 statement so that the compiler does not inadvertently move values out of the
286 CRASH_GPRs that we want them to be in.
288 4. Use register targeting for local variables to get the compiler to put our
289 desired values in specific registers. For how this works, see
290 https://gcc.gnu.org/onlinedocs/gcc/Local-Register-Variables.html#Local-Register-Variables
292 "The only supported use for this feature is to specify registers for input and
293 output operands when calling Extended asm (see Extended Asm). This may be
294 necessary if the constraints for a particular machine don’t provide sufficient
295 control to select the desired register."
297 5. Enhance ASSERT, ASSERT_UNUSED, RELEASE_ASSERT, RELEASE_ASSERT_NOT_REACHED to
298 accept crash info arguments. We no longer need to use an if statement with a
299 call to CRASH_WITH_INFO instead of these assertions. The only case not handled
300 yet is one where we might want to dataLog some info before the crash. I'll
301 add that functionality in a subsequent patch.
303 6. Move UNREACHABLE_FOR_PLATFORM to the bottom of Assertions.h because it depends
304 on the definition of RELEASE_ASSERT_NOT_REACHED, which now depends on the
305 definiton of CRASH_WITH_INFO.
307 * wtf/Assertions.cpp:
311 2018-07-27 Alex Christensen <achristensen@webkit.org>
313 Make CompletionHandler more const correct
314 https://bugs.webkit.org/show_bug.cgi?id=186543
316 Reviewed by Saam Barati.
318 * wtf/CompletionHandler.h:
319 (WTF::CompletionHandler<Out):
320 Calling a CompletionHandler mutates it. Make the code reflect that.
322 2018-07-27 Simon Fraser <simon.fraser@apple.com>
324 Be more conservative with compositing layer creation when memory is low
325 https://bugs.webkit.org/show_bug.cgi?id=187866
326 rdar://problem/42366345
328 Reviewed by Zalan Bujtas.
330 When process physical footprint is above a fraction of the jetsam limit, be more conservative in making
331 compositing layers. We avoid compositing for these situations:
332 1. Layers with 3D transforms which are affine (like translateZ(0)).
333 2. Layers with will-change
334 3. Layers for canvases (other than WebGL/WebGPU)
336 We reuse some macOS code in MemoryPressureHandler() but choose different thresholds for iOS,
337 falling into "conservative mode" at 50% of jetsam limit, and "strict mode" at 65%.
338 Compositing chooses to be more conservative in either "conservative" or "strict" memory modes.
340 Plumb through a "compositingPolicyOverride" both so that on-device testing isn't
341 flakily falling into a different mode, and so that we can impose the conservative
344 * wtf/MemoryPressureHandler.cpp:
345 (WTF::thresholdForPolicy):
346 (WTF::MemoryPressureHandler::currentMemoryUsagePolicy):
347 * wtf/MemoryPressureHandler.h:
349 2018-07-26 Andy VanWagoner <andy@vanwagoner.family>
351 [INTL] Remove INTL sub-feature compile flags
352 https://bugs.webkit.org/show_bug.cgi?id=188081
354 Reviewed by Michael Catanzaro.
356 Removed INTL sub-feature compile flags, and an old unused i18n flag.
358 * wtf/FeatureDefines.h:
360 2018-07-26 Chris Dumez <cdumez@apple.com>
362 It should be possible to use WTF::CallbackAggregator from a background thread
363 https://bugs.webkit.org/show_bug.cgi?id=188084
365 Reviewed by Alex Christensen.
367 Make WTF::CallbackAggregator usable on background threads by updating its destructor to call the
368 completion handler on whatever thread it is destroyed on, instead of always dispatching to the
369 main thread before calling the completion handler.
371 Existing CallbackAggregator users that deal with threads have been updated to make sure they
372 destroy the CallbackAggregator on the expected thread.
374 This will allow us to use CallbackAggregator in the ResourceLoadStatisticsMemoryStore, which lives
375 on a background WorkQueue.
377 * wtf/CallbackAggregator.h:
378 (WTF::CallbackAggregator::~CallbackAggregator):
379 (WTF::CallbackAggregator::CallbackAggregator):
381 2018-07-26 Ross Kirsling <ross.kirsling@sony.com>
383 String(View) should have a splitAllowingEmptyEntries function instead of a flag parameter
384 https://bugs.webkit.org/show_bug.cgi?id=187963
386 Reviewed by Alex Christensen.
388 * wtf/Assertions.cpp:
389 Update split/splitAllowingEmptyEntries usage.
391 * wtf/text/StringView.h:
392 (WTF::StringView::splitAllowingEmptyEntries const):
393 * wtf/text/WTFString.cpp:
394 (WTF::String::splitInternal const):
395 (WTF::String::split const):
396 (WTF::String::splitAllowingEmptyEntries const):
397 * wtf/text/WTFString.h:
398 (WTF::String::split const):
399 Introduce splitAllowingEmptyEntries instead of boolean or enum parameter.
401 2018-07-26 Sam Weinig <sam@webkit.org>
403 Remove unused/undefined String::appendInternal
404 https://bugs.webkit.org/show_bug.cgi?id=188063
406 Reviewed by Daniel Bates.
408 * wtf/text/WTFString.h:
409 String::appendInternal is declared in WTFString.h, but is never used
410 and and never even defined. Remove it.
412 2018-07-26 Commit Queue <commit-queue@webkit.org>
414 Unreviewed, rolling out r234181 and r234189.
415 https://bugs.webkit.org/show_bug.cgi?id=188075
417 These are not needed right now (Requested by thorton on
422 "Enable Web Content Filtering on watchOS"
423 https://bugs.webkit.org/show_bug.cgi?id=187979
424 https://trac.webkit.org/changeset/234181
426 "HAVE(PARENTAL_CONTROLS) should be true on watchOS"
427 https://bugs.webkit.org/show_bug.cgi?id=187985
428 https://trac.webkit.org/changeset/234189
430 2018-07-04 Darin Adler <darin@apple.com>
432 Improve WebGPU implementation, including using Metal Objective-C protocols more simply and correctly
433 https://bugs.webkit.org/show_bug.cgi?id=187333
435 Reviewed by Sam Weinig.
437 * wtf/Compiler.h: Added OBJC_PROTOCOL, a macro for convieniently treating an
438 Objective-C protocol in a way that lets it be mentioned in a C++ source file.
439 This is the rough equivalent of OBJC_CLASS, but for protocols.
441 * wtf/Platform.h: Added USE(METAL), alongside USE(OPENGL) and the like.
442 Now used in the WebGPU platform layer to guard the Metal-specific code.
444 2018-07-26 Tomas Popela <tpopela@redhat.com>
446 [WTF] Coverity scan issues
447 https://bugs.webkit.org/show_bug.cgi?id=186800
449 Reviewed by Brent Fulgham.
451 * wtf/CheckedArithmetic.h: Swap the operands to multiply().
452 * wtf/ThreadSpecific.h: Initialize the m_key variable.
453 * wtf/dtoa.cpp: Initialize the next variable.
455 2018-07-25 Tomas Popela <tpopela@redhat.com>
457 Correctly close the variable argument list
458 https://bugs.webkit.org/show_bug.cgi?id=186758
460 Reviewed by Michael Catanzaro.
462 The argcCopy is not ended when we early return. Also don't call
463 va_end() on args because it's closed in caller.
465 * wtf/text/WTFString.cpp:
466 (WTF::createWithFormatAndArguments):
468 2018-07-24 Tim Horton <timothy_horton@apple.com>
470 HAVE(PARENTAL_CONTROLS) should be true on watchOS
471 https://bugs.webkit.org/show_bug.cgi?id=187985
472 <rdar://problem/42559346>
474 Reviewed by Andy Estes.
478 2018-07-24 Daniel Bates <dabates@apple.com>
480 Move-constructing NeverDestroyed should move construct underlying object instead of copy constructing it
481 https://bugs.webkit.org/show_bug.cgi?id=187971
483 Reviewed by Saam Barati.
485 Fixes an issue where move constructing a NeverDestroyed<T> would always copy construct T into
486 the destination storage buffer regardless of whether T is move constructable. For example:
489 static NeverDestroyed<T> x;
490 static NeverDestroyed<T> y { WTFMove(x) }; // currently makes a copy of x's T even if T is move constructable
493 Currently the NeverDestroyed<T> instantiates T into the destination storage buffer by WTFMove()ing
494 the NeverDestroyed<T> into it, implicitly converting it to const T& by way of const T& conversion
495 operator. As a result the compiler picks the copy constructor for T to invoke instead of evaluating
496 whether T can be move constructed. Instead we should explicitly WTFMove() the underlying T so that
497 the compiler can choose to either move-construct T or copy construct it.
499 A side benefit of this change it is now possible to invoke makeNeverDestroyed() with the result
500 of a function that returns a move-only type (e.g. RenderStyle):
502 static auto sharedStyle = makeNeverDestroyed([] {
503 auto style = RenderStyle::create();
508 * wtf/NeverDestroyed.h:
509 (WTF::NeverDestroyed::NeverDestroyed):
511 2018-07-24 Ryan Haddad <ryanhaddad@apple.com>
513 Unreviewed, rolling out r234121.
515 Caused perf test failures.
519 "We should cache the compiled sandbox profile in a data vault"
520 https://bugs.webkit.org/show_bug.cgi?id=184991
521 https://trac.webkit.org/changeset/234121
523 2018-07-24 Thibault Saunier <tsaunier@igalia.com>
525 [GStreamer] Implement bitrate modulation support in GStreamer based libwebrtc Encoders
526 https://bugs.webkit.org/show_bug.cgi?id=187643
528 Reviewed by Philippe Normand.
530 Added support for GRegex in GRefPtr.
533 * wtf/glib/GRefPtr.cpp:
536 * wtf/glib/GRefPtr.h:
538 2018-07-23 Ross Kirsling <ross.kirsling@sony.com>
540 WTF::StringView::split should have an allowEmptyEntries flag
541 https://bugs.webkit.org/show_bug.cgi?id=187864
543 Reviewed by Konstantin Tokarev.
545 * wtf/text/StringView.cpp:
546 (WTF::StringView::SplitResult::Iterator::findNextSubstring):
547 (WTF::StringView::SplitResult::Iterator::operator++):
548 * wtf/text/StringView.h:
549 (WTF::StringView::split const):
550 (WTF::StringView::SplitResult::SplitResult):
551 (WTF::StringView::SplitResult::Iterator::operator== const):
552 We can't mimic String::split completely, because this one's iterator-based --
553 achieve desired behavior by adding m_allowEmptyEntries to SplitResult and m_isDone to its Iterator.
554 (The latter keeps us from hitting begin() == end() prematurely on a final empty entry.)
556 2018-07-23 Ben Richards <benton_richards@apple.com>
558 We should cache the compiled sandbox profile in a data vault
559 https://bugs.webkit.org/show_bug.cgi?id=184991
561 Reviewed by Ryosuke Niwa.
563 Added trace points for sandbox initialization and exposed functions needed for sandbox caching
565 * wtf/SystemTracing.h:
566 * wtf/spi/darwin/SandboxSPI.h:
568 2018-06-06 Filip Pizlo <fpizlo@apple.com>
570 We should support CreateThis in the FTL
571 https://bugs.webkit.org/show_bug.cgi?id=164904
573 Reviewed by Yusuke Suzuki.
576 (WTF::TinyPtrSet::operator!= const):
578 2018-07-21 Yusuke Suzuki <utatane.tea@gmail.com>
580 [JSC] Use Function / ScopedLambda / RecursableLambda instead of std::function
581 https://bugs.webkit.org/show_bug.cgi?id=187472
583 Reviewed by Mark Lam.
585 * wtf/ScopedLambda.h:
586 (WTF::ScopedLambda<ResultType):
588 2018-07-18 Michael Catanzaro <mcatanzaro@igalia.com>
590 Switch CMake ports back to C++ 14
591 https://bugs.webkit.org/show_bug.cgi?id=187744
593 Reviewed by Ryosuke Niwa.
595 Always use WTF's internal std::optional implementation, since std::optional is not part of
600 2018-07-17 Keith Miller <keith_miller@apple.com>
602 Revert r233630 since it broke internal wasm benchmarks
603 https://bugs.webkit.org/show_bug.cgi?id=187746
609 2018-07-14 Kocsen Chung <kocsen_chung@apple.com>
611 Ensure WebKit stack is ad-hoc signed
612 https://bugs.webkit.org/show_bug.cgi?id=187667
614 Reviewed by Alexey Proskuryakov.
616 * Configurations/Base.xcconfig:
618 2018-07-14 David Kilzer <ddkilzer@apple.com>
620 Replace TR2_OPTIONAL_ASSERTED_EXPRESSION macro in <wtf/Optional.h>
621 <https://webkit.org/b/187672>
623 Reviewed by Frédéric Wang.
626 (std::optional::operator -> const):
627 (std::optional::operator * const):
628 (std::optional<T::operator-> const):
629 (std::optional<T::operator* const):
630 - Replace TR2_OPTIONAL_ASSERTED_EXPRESSION macro with
631 ASSERT_UNDER_CONSTEXPR_CONTEXT macro and return statement.
633 2018-07-13 Mark Lam <mark.lam@apple.com>
635 Signal.cpp's activeThreads() should only create its ThreadGroup once.
636 https://bugs.webkit.org/show_bug.cgi?id=187634
637 <rdar://problem/40662311>
639 Reviewed by Yusuke Suzuki.
641 registerThreadForMachExceptionHandling() is relying on the activeThreads()
642 ThreadGroup being a singleton.
644 * wtf/threads/Signals.cpp:
645 (WTF::activeThreads):
647 2018-07-12 David Kilzer <ddkilzer@apple.com>
649 Revert: iOS port should define HAVE_RUNLOOP_TIMER
650 <https://webkit.org/b/187370>
652 * wtf/Platform.h: This is only needed on macOS when using
653 -[WebView scheduleInRunLoop:forMode:] and
654 -[WebView unscheduleFromRunLoop:forMode:] to make WK1 WebViews
655 load synchronously using -loadHTMLString: or -loadData:.
657 2018-07-12 Per Arne Vollan <pvollan@apple.com>
659 Add compile guard for enabling NSRunLoop in the WebContent process.
660 https://bugs.webkit.org/show_bug.cgi?id=187563
662 Reviewed by Chris Dumez.
664 * wtf/FeatureDefines.h:
666 2018-07-09 Zan Dobersek <zdobersek@igalia.com>
668 Unreviewed follow-up to r233660.
670 * wtf/linux/MemoryFootprintLinux.cpp:
671 (WTF::memoryFootprint): Revert accidental change of logical OR into a bitwise OR.
673 2018-07-09 Youenn Fablet <youenn@apple.com>
675 StringView operator==(char*) should check the length of the string
676 https://bugs.webkit.org/show_bug.cgi?id=187422
678 Reviewed by Chris Dumez.
680 Update StringView operator== to ensure that any character raw pointer comparison actually check the length of the raw pointer string.
681 This patch mimicks the behavior of String.
682 For instance, comparing a StringView with "he\0llo" and "he" will give the same result.
684 * wtf/linux/MemoryFootprintLinux.cpp:
685 (WTF::memoryFootprint):
686 * wtf/text/StringView.h:
690 (WTF::StringView::stripLeadingAndTrailingMatchedCharacters):
692 2018-07-09 Yusuke Suzuki <utatane.tea@gmail.com>
694 [WTF] Annotate RunLoop::Timer fast-allocated
695 https://bugs.webkit.org/show_bug.cgi?id=187473
697 Reviewed by Saam Barati.
699 It is allocated by std::unique_ptr for MemoryPressureHandler. And it uses system malloc now.
703 2018-07-08 Yusuke Suzuki <utatane.tea@gmail.com>
705 [JSC] Optimize padding of UnlinkedCodeBlock to shrink
706 https://bugs.webkit.org/show_bug.cgi?id=187448
708 Reviewed by Saam Barati.
712 2018-07-07 David Kilzer <ddkilzer@apple.com>
714 iOS port should define HAVE_RUNLOOP_TIMER
715 <https://webkit.org/b/187370>
717 Reviewed by Simon Fraser.
720 (HAVE_DTRACE): Remove unused macro since r200568.
721 (HAVE_RUNLOOP_TIMER): Define for PLATFORM(COCOA), not just
722 PLATFORM(MAC). Alphabetize macros.
724 2018-07-07 Yusuke Suzuki <utatane.tea@gmail.com>
726 [linux] ASSERT: Using an alternative signal stack is not supported. Consider disabling the concurrent GC.
727 https://bugs.webkit.org/show_bug.cgi?id=187297
729 Reviewed by Mark Lam.
731 This patch relaxes the JSC's limitation: accepting an alternative signal stack mechanism.
733 * wtf/ThreadingPthreads.cpp:
734 (WTF::getApproximateStackPointer):
735 Fix approximate stack pointer function to make it valid.
737 (WTF::Thread::signalHandlerSuspendResume):
738 Use StackBounds::contains to check whether the given stack pointer is in range of StackBounds.
739 If it is out of range, it seems that this stack pointer is pointing an alternative signal stack.
741 (WTF::Thread::suspend):
742 Repeatedly retry suspension by using Thread::yield().
744 (WTF::isOnAlternativeSignalStack): Deleted.
746 2018-07-06 Frederic Wang <fwang@igalia.com>
748 WTF's internal std::optional implementation should abort() on bad optional access
749 https://bugs.webkit.org/show_bug.cgi?id=186536
751 Reviewed by Michael Catanzaro.
753 Currently, some ports built with recent compilers will cause the program to abort when one
754 tries to access the value of an unset std:optional (i.e. std::nullopt) as specified by C++17.
755 However, most ports still use WTF's internal std::optional implementation, which does not
756 verify illegal access. Hence it's not possible for developers working on these ports to
757 detect issues like bugs #186189, #186535, #186752, #186753, #187139, #187145, #187243 or
759 WTF's version of std::optional was introduced in bug #164199 but it was not possible to
760 verify the availability of the value inside constexpr member functions because the assert
761 might involve asm declarations. This commit introduces a new ASSERT_UNDER_CONSTEXPR_CONTEXT
762 macro (a simplified version of ASSERT that can be used in constexpr context) and uses it in
763 WTF's implementation of std::optional.
765 * wtf/Assertions.h: Define ASSERT_UNDER_CONSTEXPR_CONTEXT as a version of ASSERT that can be
766 used in constexpr context (in particular avoids asm declarations).
768 (std::optional::operator ->): Add an assert to ensure the optional value is available.
769 (std::optional::operator *): Ditto.
770 (std::optional::value const): Ditto.
771 (std::optional::value): Ditto.
772 (std::optional<T::value const): Ditto.
774 2018-07-05 Commit Queue <commit-queue@webkit.org>
776 Unreviewed, rolling out r233417 and r233418.
777 https://bugs.webkit.org/show_bug.cgi?id=187364
779 Introduced an occasional crash on Google Drive (Requested by
784 "WTF's internal std::optional implementation should abort() on
786 https://bugs.webkit.org/show_bug.cgi?id=186536
787 https://trac.webkit.org/changeset/233417
789 "WTF's internal std::optional implementation should abort() on
791 https://bugs.webkit.org/show_bug.cgi?id=186536
792 https://trac.webkit.org/changeset/233418
794 2018-07-04 Guillaume Emont <guijemont@igalia.com>
796 FunctionTraits: Make cCallArity() constant on 32-bits.
797 https://bugs.webkit.org/show_bug.cgi?id=187292
799 Reviewed by Yusuke Suzuki.
801 On X86, in Source/JavaScriptCore/jit/CCallHelpers.h we have a
802 static_assert that uses cCallArity(), so it needs to be constant to
803 avoid a compilation error. This is achieved by changing an ASSERT into
807 * wtf/FunctionTraits.h:
808 (WTF::slotsForCCallArgument):
810 2018-07-04 Tim Horton <timothy_horton@apple.com>
812 Introduce PLATFORM(IOSMAC)
813 https://bugs.webkit.org/show_bug.cgi?id=187315
815 Reviewed by Dan Bernstein.
817 * Configurations/Base.xcconfig:
818 * wtf/FeatureDefines.h:
821 2018-07-02 Alicia Boya GarcÃa <aboya@igalia.com>
823 [Linux] Fix memory leak in WTF::forEachLine()
824 https://bugs.webkit.org/show_bug.cgi?id=187174
826 Reviewed by Žan Doberšek.
828 * wtf/linux/MemoryFootprintLinux.cpp:
831 2018-07-02 Frederic Wang <fwang@igalia.com>
833 WTF's internal std::optional implementation should abort() on bad optional access
834 https://bugs.webkit.org/show_bug.cgi?id=186536
836 Reviewed by Michael Catanzaro.
838 Currently, some ports built with recent compilers will cause the program to abort when one
839 tries to access the value of an unset std:optional (i.e. std::nullopt) as specified by C++17.
840 However, most ports still use WTF's internal std::optional implementation, which does not
841 verify illegal access. Hence it's not possible for developers working on these ports to
842 detect issues like bugs #186189, #186535, #186752, #186753, #187139, #187145 or #187243.
843 WTF's version of std::optional was introduced in bug #164199 but it was not possible to
844 verify the availability of the value inside constexpr member functions because the assert
845 might involve asm declarations. This commit introduces a new
846 RELEASE_ASSERT_UNDER_CONSTEXPR_CONTEXT macro (a simplified version of RELEASE_ASSERT that can
847 be used in constexpr context) and uses it in WTF's implementation of std::optional.
849 * wtf/Assertions.h: Define RELEASE_ASSERT_UNDER_CONSTEXPR_CONTEXT as a version of
850 RELEASE_ASSERT that can be used in constexpr context (in particular avoids asm declarations).
852 (std::optional::operator ->): Add an assert to ensure the optional value is available.
853 (std::optional::operator *): Ditto.
854 (std::optional::value const): Ditto.
855 (std::optional::value): Ditto.
856 (std::optional<T::value const): Ditto.
858 2018-07-01 Yusuke Suzuki <utatane.tea@gmail.com>
860 [WTF] RandomDevice should be initialized inside std::call_once
861 https://bugs.webkit.org/show_bug.cgi?id=186017
863 Reviewed by Darin Adler.
865 While Linux ports uses mutex-guarded static variables, Mac ports do not.
866 So we should guard static variables' initialization by using std::call_once.
867 This patch does it for RandomDevice.
869 * wtf/OSRandomSource.cpp:
870 (WTF::cryptographicallyRandomValuesFromOS):
871 * wtf/RandomDevice.h: Small fix for OS(FUCHSIA).
873 2018-07-01 Myles C. Maxfield <mmaxfield@apple.com>
875 [Cocoa] LastResort in the font family list causes emoji with joiners to be rendered as multiple .notdef characters
876 https://bugs.webkit.org/show_bug.cgi?id=187209
877 <rdar://problem/40920785>
879 Reviewed by Darin Adler.
881 * wtf/unicode/CharacterNames.h:
883 2018-06-23 Darin Adler <darin@apple.com>
885 [Cocoa] Improve ARC compatibility of more code in JavaScriptCore
886 https://bugs.webkit.org/show_bug.cgi?id=186973
888 Reviewed by Dan Bernstein.
890 * WTF.xcodeproj/project.pbxproj: Added CFXPCBridgeSPI.h, fixed a few
891 other small problems in the project file, and let Xcode fix a few too.
893 * wtf/cocoa/Entitlements.h: Added hasEntitlement function with overloads
894 for an audit token and an XPC connection.
895 * wtf/cocoa/Entitlements.mm:
896 (WTF::hasEntitlement): Added, with overloads for a SecTask, an audit token,
897 and an XPC connection.
898 (WTF::processHasEntitlement): Refactored to use the function above.
900 * wtf/spi/cocoa/CFXPCBridgeSPI.h: Added.
902 2018-06-30 Adam Barth <abarth@webkit.org>
904 Port JavaScriptCore to OS(FUCHSIA)
905 https://bugs.webkit.org/show_bug.cgi?id=187223
907 Reviewed by Daniel Bates.
909 * wtf/Platform.h: Fuchsia uses mcontext_t to provide machine context.
911 2018-06-30 Adam Barth <abarth@webkit.org>
913 Port WTF to OS(FUCHSIA)
914 https://bugs.webkit.org/show_bug.cgi?id=187221
916 Reviewed by Yusuke Suzuki.
918 * wtf/FastMalloc.cpp: Fuchsia does not have resource.h
919 (WTF::fastMallocStatistics): Skip collecting stats without resource.h
920 * wtf/InlineASM.h: Fuchsia uses ELF
921 * wtf/Platform.h: Define OS(FUCHSIA) as an OS(UNIX) variant
922 * wtf/RandomDevice.cpp: Call zx_cprng_draw for crypographic randomness
923 (WTF::RandomDevice::cryptographicallyRandomValues):
924 * wtf/ThreadingPthreads.cpp: Fuchsia does not have pthread_setschedparam
925 (WTF::Thread::changePriority):
926 * wtf/unix/CPUTimeFuchsia.cpp: Added.
928 2018-06-30 Commit Queue <commit-queue@webkit.org>
930 Unreviewed, rolling out r233391.
931 https://bugs.webkit.org/show_bug.cgi?id=187217
933 This patch broke Windows ports (Requested by fredw on
938 "WTF's internal std::optional implementation should abort() on
940 https://bugs.webkit.org/show_bug.cgi?id=186536
941 https://trac.webkit.org/changeset/233391
943 2018-06-29 Frederic Wang <fwang@igalia.com>
945 WTF's internal std::optional implementation should abort() on bad optional access
946 https://bugs.webkit.org/show_bug.cgi?id=186536
948 Reviewed by Michael Catanzaro.
950 Currently, some ports built with recent compilers will cause the program to abort when one
951 tries to access the value of an unset std:optional (i.e. std::nullopt) as specified by C++17.
952 However, most ports still use WTF's internal std::optional implementation, which does not
953 verify illegal access. Hence it's not possible for developers working on these ports to
954 detect issues like bugs #186189, #186535, #186752, #186753, #187139 or #187145. WTF's version
955 of std::optional was introduced in bug #164199 but it was not possible to verify the
956 availability of the value inside constexpr member functions because the assert might involve
957 asm declarations. This commit introduces a new RELEASE_ASSERT_UNDER_CONSTEXPR_CONTEXT macro
958 (a simplified version of RELEASE_ASSERT that can be used in constexpr context) and uses it in
959 WTF's implementation of std::optional.
961 * wtf/Assertions.h: Define RELEASE_ASSERT_UNDER_CONSTEXPR_CONTEXT as a version of
962 RELEASE_ASSERT that can be used in constexpr context (in particular avoids asm declarations).
964 (std::optional::operator ->): Add an assert to ensure the optional value is available.
965 (std::optional::operator *): Ditto.
966 (std::optional::value const): Ditto.
967 (std::optional::value): Ditto.
968 (std::optional<T::value const): Ditto.
970 2018-06-29 Darin Adler <darin@apple.com>
972 [Cocoa] reduce unnecessary use of .mm source files in WTF, spruce up some implementation details
973 https://bugs.webkit.org/show_bug.cgi?id=186924
975 Reviewed by Anders Carlsson.
977 * WTF.xcodeproj/project.pbxproj: Update for file and directory renames, file type changes,
980 * wtf/MemoryPressureHandler.cpp:
981 (WTF::MemoryPressureHandler::holdOff): Deleted empty placeholder; this one is not needed.
983 * wtf/PlatformMac.cmake: Update for file and directory renames, file type changes,
986 * wtf/cocoa/CPUTimeCocoa.cpp: Renamed from Source/WTF/wtf/cocoa/CPUTimeCocoa.mm.
988 * wtf/text/cocoa/StringImplCocoa.mm: Renamed from Source/WTF/wtf/text/mac/StringImplMac.mm.
989 Also removed an unneeded include.
991 * wtf/text/cocoa/StringViewCocoa.mm: Renamed from Source/WTF/wtf/text/mac/StringViewObjC.mm.
993 * wtf/text/cocoa/TextBreakIteratorInternalICUCocoa.cpp: Renamed from
994 Source/WTF/wtf/text/mac/TextBreakIteratorInternalICUMac.mm.
996 2018-06-28 Olivia Barnett <obarnett@apple.com>
998 Find in page for typographic quotes does not find low (German) quotes
999 https://bugs.webkit.org/show_bug.cgi?id=187164
1000 <rdar://problem/29612785>
1002 Reviewed by Tim Horton.
1004 Added Unicode definitions for German quotation marks.
1006 * wtf/unicode/CharacterNames.h:
1008 2018-06-27 Jonathan Bedard <jbedard@apple.com>
1010 Enable WebKit iOS 12 build
1011 https://bugs.webkit.org/show_bug.cgi?id=187024
1012 <rdar://problem/39759057>
1014 Reviewed by David Kilzer.
1016 * wtf/spi/darwin/XPCSPI.h: Add endpoint and connection declarations.
1018 2018-06-25 David Fenton <david_fenton@apple.com>
1020 Unreviewed, rolling out r233120.
1022 caused regression in ios API tests
1026 "[Cocoa] reduce unnecessary use of .mm source files in WTF,
1027 spruce up some implementation details"
1028 https://bugs.webkit.org/show_bug.cgi?id=186924
1029 https://trac.webkit.org/changeset/233120
1031 2018-06-25 Alicia Boya GarcÃa <aboya@igalia.com>
1033 Fix ASAN_ENABLED in GCC
1034 https://bugs.webkit.org/show_bug.cgi?id=186957
1036 Reviewed by Michael Catanzaro.
1038 ASAN_ENABLED used to rely on Clang-specific features for detection.
1039 This patch enables ASAN_ENABLED to work on GCC too.
1041 It also fixes compilation errors and warnings that were triggered when
1042 compiling code guarded by ASAN_ENABLED in gcc.
1046 (WTF::VectorBuffer::endOfBuffer):
1048 2018-06-22 Darin Adler <darin@apple.com>
1050 [Cocoa] Convert the small bit of Objective-C++ code in WTF to ARC
1051 https://bugs.webkit.org/show_bug.cgi?id=186961
1053 Reviewed by Anders Carlsson.
1055 * Configurations/Base.xcconfig: Turn on ARC.
1057 * wtf/cocoa/MemoryPressureHandlerCocoa.mm:
1058 (WTF::MemoryPressureHandler::uninstall): Remove calls to dispatch_release.
1059 (WTF::MemoryPressureHandler::holdOff): Ditto.
1061 * wtf/mac/MainThreadMac.mm:
1062 (WTF::initializeMainThreadPlatform): Remove call to retain.
1063 (WTF::initializeWebThreadPlatform): Ditto.
1065 2018-06-22 Yusuke Suzuki <utatane.tea@gmail.com>
1067 [WTF] Use Ref<> for the result type of non-failing factory functions
1068 https://bugs.webkit.org/show_bug.cgi?id=186920
1070 Reviewed by Darin Adler.
1072 Use Ref<> instead of RefPtr<> if the `create` function do not return nullptr.
1074 * wtf/AutomaticThread.cpp:
1075 (WTF::AutomaticThreadCondition::create):
1076 (WTF::AutomaticThread::AutomaticThread):
1077 * wtf/AutomaticThread.h:
1078 * wtf/ParallelHelperPool.cpp:
1079 (WTF::ParallelHelperPool::Thread::Thread):
1080 * wtf/ParallelHelperPool.h:
1081 * wtf/WorkerPool.cpp:
1082 (WTF::WorkerPool::WorkerPool):
1084 * wtf/win/WorkQueueWin.cpp:
1085 (WTF::TimerContext::create):
1086 (WTF::WorkQueue::dispatchAfter):
1088 2018-06-23 Yusuke Suzuki <utatane.tea@gmail.com>
1090 [WTF] Add user-defined literal for ASCIILiteral
1091 https://bugs.webkit.org/show_bug.cgi?id=186839
1093 Reviewed by Darin Adler.
1095 This patch adds user-defined literal for ASCIILiteral. We can create ASCIILiteral in the form of `"Hello World"_s`.
1096 And we remove public ASCIILiteral constructor. This change ensures that ASCIILiteral is created from literal.
1098 * WTF.xcodeproj/project.pbxproj:
1099 * wtf/CMakeLists.txt:
1101 (WTF::Indenter::Indenter):
1103 (WTF::LogArgument::toString):
1104 * wtf/MediaTime.cpp:
1105 (WTF::toJSONStringInternal):
1106 (WTF::MediaTimeRange::toJSONString const):
1107 * wtf/linux/MemoryFootprintLinux.cpp:
1108 (WTF::memoryFootprint):
1109 * wtf/text/ASCIILiteral.cpp: Copied from Source/WebCore/css/CSSUnsetValue.cpp.
1110 (WTF::ASCIILiteral::dump const):
1111 * wtf/text/ASCIILiteral.h: Copied from Source/WTF/wtf/Indenter.h.
1112 (WTF::ASCIILiteral::operator const char* const):
1113 (WTF::ASCIILiteral::fromLiteralUnsafe):
1114 (WTF::ASCIILiteral::null):
1115 (WTF::ASCIILiteral::characters const):
1116 (WTF::ASCIILiteral::ASCIILiteral):
1117 (WTF::StringLiterals::operator _s):
1118 * wtf/text/WTFString.cpp:
1120 * wtf/text/WTFString.h:
1123 (WTF::ASCIILiteral::ASCIILiteral): Deleted.
1124 (WTF::ASCIILiteral::operator const char*): Deleted.
1125 * wtf/unix/LanguageUnix.cpp:
1126 (WTF::platformLanguage):
1128 2018-06-22 Darin Adler <darin@apple.com>
1130 [Cocoa] reduce unnecessary use of .mm source files in WTF, spruce up some implementation details
1131 https://bugs.webkit.org/show_bug.cgi?id=186924
1133 Reviewed by Anders Carlsson.
1135 * WTF.xcodeproj/project.pbxproj: Update for file and directory renames, file type changes,
1138 * wtf/MemoryPressureHandler.cpp:
1139 (WTF::MemoryPressureHandler::holdOff): Deleted empty placeholder; this one is not needed.
1141 * wtf/PlatformMac.cmake: Update for file and directory renames, file type changes,
1144 * wtf/cocoa/CPUTimeCocoa.cpp: Renamed from Source/WTF/wtf/cocoa/CPUTimeCocoa.mm.
1145 Reworked math to make better use of the Seconds class.
1147 * wtf/text/WTFString.h: Added a new inline version of the constructor that takes an NSString.
1148 This is identical to the one that takes a CFStringRef, so no need to keep both.
1150 * wtf/text/cocoa/StringImplCocoa.mm: Renamed from Source/WTF/wtf/text/mac/StringImplMac.mm.
1151 Also removed an unneeded include.
1153 * wtf/text/cocoa/StringViewCocoa.mm: Renamed from Source/WTF/wtf/text/mac/StringViewObjC.mm.
1155 * wtf/text/cocoa/TextBreakIteratorInternalICUCocoa.cpp: Renamed from
1156 Source/WTF/wtf/text/mac/TextBreakIteratorInternalICUMac.mm.
1158 * wtf/text/mac/StringMac.mm: Removed.
1160 2018-06-21 Carlos Garcia Campos <cgarcia@igalia.com>
1162 [GLIB] improve get_type() fast path in WEBKIT_DEFINE_TYPE
1163 https://bugs.webkit.org/show_bug.cgi?id=186885
1165 Reviewed by Anders Carlsson.
1167 This is a backport of glib commit
1168 https://gitlab.gnome.org/GNOME/glib/commit/e924f777369710221c3e0a9d7bf40392a27d1fa4
1170 "The -fstack-protector-strong used in many distributions by default has a
1171 rather drastic slowdown of the fast path in generated _get_type()
1172 functions using G_DEFINE_* macros. The amount can vary by architecture,
1173 GCC version, and compiler flags.
1175 To work around this, and ensure a higher probability that our fast-path
1176 will match what we had previously, we need to break out the slow-path
1177 (registering the type) into a secondary function that is not a candidate
1180 This ensures that the common case (type registered, return the GType id)
1181 is the hot path and handled in the prologue of the generated assembly even
1182 when -fstack-protector-strong is enabled."
1184 * wtf/glib/WTFGType.h:
1186 2018-06-20 Yusuke Suzuki <utatane.tea@gmail.com>
1188 [GTK][WPE][Nicosia] Add name for Nicosia Painting Threads
1189 https://bugs.webkit.org/show_bug.cgi?id=186836
1191 Reviewed by Carlos Garcia Campos.
1193 AutomaticThread can take a name for the generated threads now.
1194 This patch adds the above ability to WorkerPool.
1196 * wtf/WorkerPool.cpp:
1197 (WTF::WorkerPool::WorkerPool):
1199 (WTF::WorkerPool::create):
1200 (WTF::WorkerPool::name const):
1202 2018-06-18 Jiewen Tan <jiewen_tan@apple.com>
1204 Add a graceful exit for AuthenticationManager::initializeConnection
1205 https://bugs.webkit.org/show_bug.cgi?id=186632
1206 <rdar://problem/41041033>
1208 Reviewed by Brent Fulgham.
1210 * wtf/spi/darwin/XPCSPI.h:
1212 2018-06-18 Carlos Alberto Lopez Perez <clopez@igalia.com>
1214 [WTF] Remove workarounds needed to support libstdc++-4
1215 https://bugs.webkit.org/show_bug.cgi?id=186762
1217 Reviewed by Michael Catanzaro.
1219 Revert r226299, r226300 r226301 and r226302-
1221 * wtf/StdLibExtras.h:
1223 2018-06-12 Darin Adler <darin@apple.com>
1225 [Cocoa] Make some RetainPtr refinements to get more ready for ARC
1226 https://bugs.webkit.org/show_bug.cgi?id=186526
1228 Reviewed by Anders Carlsson.
1230 * wtf/RetainPtr.h: Improved the definition of autorelease so it does
1231 the right thing for both Objective-C types and non-Objective-C types.
1232 Also added bridgingAutorelease for when we want to autorelease as
1233 part of converting from a CF type to an Objective-C type. The two
1234 advantages of bridgingAutorelease are that it does not require an
1235 additional explicit __bridge cast and that it does not prevent the
1236 ARC objc_autoreleaseReturnValue optimization the way that doing an
1237 autorelease on the CF type would.
1239 * wtf/text/mac/StringImplMac.mm:
1240 (WTF::StringImpl::operator NSString *): Use bridgingAutorelease.
1242 2018-06-15 Basuke Suzuki <Basuke.Suzuki@sony.com>
1244 [WinCairo] Move unrelated features of WorkQueueWin into IPC::Connection
1245 https://bugs.webkit.org/show_bug.cgi?id=186582
1247 Remove unrelated feature from WorkQueueWin.
1249 Reviewed by Brent Fulgham.
1251 * wtf/PlatformWin.cmake: Remove WorkItemContext.*
1252 * wtf/WorkQueue.cpp:
1254 * wtf/win/Win32Handle.h:
1255 * wtf/win/WorkItemContext.cpp: Removed.
1256 * wtf/win/WorkItemContext.h: Removed.
1257 * wtf/win/WorkQueueWin.cpp:
1258 (WTF::WorkQueue::handleCallback): Deleted.
1259 (WTF::WorkQueue::registerHandle): Deleted.
1260 (WTF::WorkQueue::unregisterAndCloseHandle): Deleted.
1261 (WTF::WorkQueue::unregisterWaitAndDestroyItemSoon): Deleted.
1262 (WTF::WorkQueue::unregisterWaitAndDestroyItemCallback): Deleted.
1264 2018-06-13 Keith Miller <keith_miller@apple.com>
1266 AutomaticThread should have a way to provide a thread name
1267 https://bugs.webkit.org/show_bug.cgi?id=186604
1269 Reviewed by Filip Pizlo.
1271 AutomaticThread now has a virtual method to get a name, which can be
1272 overridden to provide a custom name to the thread.
1274 * wtf/AutomaticThread.cpp:
1275 (WTF::AutomaticThread::start):
1276 * wtf/AutomaticThread.h:
1277 * wtf/WorkerPool.cpp:
1279 2018-06-11 Saam Barati <sbarati@apple.com>
1281 The NaturalLoops algorithm only works when the list of blocks in a loop is de-duplicated
1282 https://bugs.webkit.org/show_bug.cgi?id=184829
1284 Reviewed by Michael Saboff.
1286 This patch switches NaturalLoops to walking over a block's predecessors
1287 instead of successors when building the initial list of loops and their
1288 headers. The algorithm broke down when we had a footer block with multiple
1289 control flow edges pointing to the same header. This made the loop data
1290 structure contain multiple entries for the same basic block. The algorithm
1291 breaks down when we end up in this state, since it means our way of detecting
1292 what loop is more inner is broken, since that check uses a loop's size.
1294 * wtf/NaturalLoops.h:
1295 (WTF::NaturalLoop::addBlock):
1296 (WTF::NaturalLoops::NaturalLoops):
1298 2018-06-11 Keith Rollin <krollin@apple.com>
1300 Add logging around internalError(const URL&)
1301 https://bugs.webkit.org/show_bug.cgi?id=186369
1302 <rdar://problem/40872046>
1304 Reviewed by Brent Fulgham.
1306 There are times when we receive bug reports where the user says that
1307 they are simply shown a page saying an internal error occurred. To
1308 help understand the circumstances of that error, add some logging to
1309 internalError() in WebErrors.cpp. This logging logs at the Error level
1310 that internalError() was called and then logs a backtrace.
1312 * wtf/Assertions.cpp:
1315 2018-06-11 Michael Saboff <msaboff@apple.com>
1317 JavaScriptCore: Disable 32-bit JIT on Windows
1318 https://bugs.webkit.org/show_bug.cgi?id=185989
1320 Reviewed by Mark Lam.
1322 Fixed the CLOOP so it can work when COMPUTED_GOTOs are not supported.
1326 2018-06-09 Dan Bernstein <mitz@apple.com>
1328 [Xcode] Clean up and modernize some build setting definitions
1329 https://bugs.webkit.org/show_bug.cgi?id=186463
1331 Reviewed by Sam Weinig.
1333 * Configurations/Base.xcconfig: Removed definition for macOS 10.11.
1334 * Configurations/DebugRelease.xcconfig: Ditto.
1336 2018-06-08 Darin Adler <darin@apple.com>
1338 [Cocoa] Remove all uses of NSAutoreleasePool as part of preparation for ARC
1339 https://bugs.webkit.org/show_bug.cgi?id=186436
1341 Reviewed by Anders Carlsson.
1343 * WTF.xcodeproj/project.pbxproj: Added FoundationSPI.h.
1345 * wtf/AutodrainedPool.h: Streamlined header a bit, added some comments.
1347 * wtf/PlatformMac.cmake: Added FoundationSPI.h.
1349 * wtf/cocoa/AutodrainedPool.cpp: Moved here from AutodrainedPoolMac.mm.
1350 (WTF::AutodrainedPool::AutodrainedPool): Use objc_autoreleasePoolPush/Pop instead of
1351 the NSAutoreleasePool class.
1352 (WTF::AutodrainedPool::~AutodrainedPool): Ditto.
1354 * wtf/spi/cocoa/FoundationSPI.h: Moved from Source/WebCore/PAL/pal/spi/cocoa/FoundationSPI.h.
1355 Changed both include and declarations so it's the objc_autoreleasePoolPush/Pop instead
1356 of the higher level NS functions that call them.
1358 2018-06-08 Brian Burg <bburg@apple.com>
1360 [Cocoa] Web Automation: include browser name and version in listing for automation targets
1361 https://bugs.webkit.org/show_bug.cgi?id=186204
1362 <rdar://problem/36950423>
1364 Reviewed by Darin Adler.
1366 * wtf/spi/cf/CFBundleSPI.h: Add needed infoDictionary key values.
1368 2018-06-07 Yusuke Suzuki <utatane.tea@gmail.com>
1370 [WTF] Add WorkerPool
1371 https://bugs.webkit.org/show_bug.cgi?id=174569
1373 Reviewed by Carlos Garcia Campos.
1375 This patch adds WorkerPool, which is a thread pool that consists of AutomaticThread.
1376 Since it is based on AutomaticThread, this WorkerPool can take `timeout`: once `timeout`
1377 passes without any tasks, threads in WorkerPool will be destroyed.
1379 We add shouldSleep handler to AutomaticThread to make destruction of threads in WorkerPool moderate.
1380 Without this, all threads are destroyed at once after `timeout` passes.
1382 * WTF.xcodeproj/project.pbxproj:
1383 * wtf/AutomaticThread.cpp:
1384 (WTF::AutomaticThread::AutomaticThread):
1385 (WTF::AutomaticThread::start):
1386 * wtf/AutomaticThread.h:
1387 * wtf/CMakeLists.txt:
1388 * wtf/WorkerPool.cpp: Added.
1389 (WTF::WorkerPool::WorkerPool):
1390 (WTF::WorkerPool::~WorkerPool):
1391 (WTF::WorkerPool::shouldSleep):
1392 (WTF::WorkerPool::postTask):
1393 * wtf/WorkerPool.h: Added.
1394 (WTF::WorkerPool::create):
1396 2018-06-07 Chris Dumez <cdumez@apple.com>
1398 Add base class to get WeakPtrFactory member and avoid some boilerplate code
1399 https://bugs.webkit.org/show_bug.cgi?id=186407
1401 Reviewed by Brent Fulgham.
1403 Add CanMakeWeakPtr base class to get WeakPtrFactory member and its getter, in
1404 order to avoid some boilerplate code in every class needing a WeakPtrFactory.
1405 This also gets rid of old-style createWeakPtr() methods in favor of the newer
1409 (WTF::CanMakeWeakPtr::weakPtrFactory const):
1410 (WTF::CanMakeWeakPtr::weakPtrFactory):
1412 2018-06-07 Tadeu Zagallo <tzagallo@apple.com>
1414 Don't try to allocate JIT memory if we don't have the JIT entitlement
1415 https://bugs.webkit.org/show_bug.cgi?id=182605
1416 <rdar://problem/38271229>
1418 Reviewed by Mark Lam.
1420 Move processHasEntitlement from Source/WebKit/Shared/mac/SandboxUtilities.h
1421 into WTF so JavaScriptCore can also use it.
1423 * WTF.xcodeproj/project.pbxproj:
1424 * wtf/PlatformMac.cmake:
1425 * wtf/cocoa/Entitlements.cpp:
1426 (WTF::processHasEntitlement):
1427 * wtf/cocoa/Entitlements.h:
1428 * wtf/spi/cocoa/SecuritySPI.h:
1430 2018-06-05 Darin Adler <darin@apple.com>
1432 [Cocoa] Retire DispatchPtr, and add more move semantics and simpler #ifs to other smart pointers
1433 https://bugs.webkit.org/show_bug.cgi?id=186324
1435 Reviewed by Anders Carlsson.
1437 * WTF.xcodeproj/project.pbxproj: Removed DispatchPtr.h.
1438 * wtf/BlockPtr.h: Remove unneeded checks for __OBJC__. Added some use
1440 * wtf/CMakeLists.txt: Removed DispatchPtr.h.
1441 * wtf/DispatchPtr.h: Removed. We no longer need to support Mavericks.
1442 * wtf/OSObjectPtr.h: Remove unneeded checks for __OBJC__. Added some use
1445 2018-06-05 Darin Adler <darin@apple.com>
1447 [Cocoa] More preparation for ARC, focusing on WebKit and smart pointers
1448 https://bugs.webkit.org/show_bug.cgi?id=186314
1450 Reviewed by Anders Carlsson.
1452 * wtf/BlockPtr.h: Put Block_copy/release calls into #if since they are
1453 not needed under ARC.
1455 * wtf/OSObjectPtr.h: Added constructor and assignment operator so we can
1456 work with OS objects without adopting them.
1458 2018-06-05 Darin Adler <darin@apple.com>
1460 [Cocoa] Improve some soft linking compatibility with ARC
1461 https://bugs.webkit.org/show_bug.cgi?id=186309
1463 Reviewed by Anders Carlsson.
1465 * wtf/cocoa/SoftLinking.h: Updated the SOFT_LINK_CONSTANT family of
1466 macros to use a const type. This increases the chance that they will
1467 work without triggering ARC compilation errors since it's easier to
1468 get the type right for read-only access than for read/write.
1470 2018-06-05 Youenn Fablet <youenn@apple.com>
1472 ServiceWorker registration should store any script fetched through importScripts
1473 https://bugs.webkit.org/show_bug.cgi?id=182444
1474 <rdar://problem/37164835>
1476 Reviewed by Chris Dumez.
1478 * wtf/persistence/PersistentCoders.h:
1480 2018-06-04 Darin Adler <darin@apple.com>
1482 [Cocoa] Improve smart pointer support for ARC (OSObjectPtr/DispatchPtr)
1483 https://bugs.webkit.org/show_bug.cgi?id=186300
1485 Reviewed by Daniel Bates.
1487 * wtf/DispatchPtr.h: Don't call dispatch_retain or dispatch_release
1488 since ARC will automatically do it for us in the same places we are
1491 * wtf/OSObjectPtr.h:
1492 (WTF::retainOSObject): Don't call os_retain since ARC will do it.
1493 (WTF::releaseOSObject): Don't call os_release since ARC will do it.
1495 2018-05-31 Commit Queue <commit-queue@webkit.org>
1497 Unreviewed, rolling out r232212.
1498 https://bugs.webkit.org/show_bug.cgi?id=186153
1500 broke build (Requested by alexchristensen on #webkit).
1504 "JavaScriptCore: Disable 32-bit JIT on Windows"
1505 https://bugs.webkit.org/show_bug.cgi?id=185989
1506 https://trac.webkit.org/changeset/232212
1508 2018-05-30 Keith Miller <keith_miller@apple.com>
1510 LLInt get_by_id prototype caching doesn't properly handle changes
1511 https://bugs.webkit.org/show_bug.cgi?id=186112
1513 Reviewed by Filip Pizlo.
1515 Mark some methods const.
1518 (WTF::Bag::begin const):
1519 (WTF::Bag::end const):
1520 (WTF::Bag::unwrappedHead const):
1521 (WTF::Bag::end): Deleted.
1522 (WTF::Bag::unwrappedHead): Deleted.
1524 2018-05-30 Alex Christensen <achristensen@webkit.org>
1526 Reduce String allocations
1527 https://bugs.webkit.org/show_bug.cgi?id=186059
1529 Reviewed by Darin Adler.
1531 * wtf/text/StringView.cpp:
1532 (WTF::convertASCIICase):
1533 (WTF::StringView::convertToASCIILowercase const):
1534 (WTF::StringView::convertToASCIIUppercase const):
1535 * wtf/text/StringView.h:
1536 * wtf/text/cf/StringViewCF.cpp:
1537 (WTF::StringView::createCFString const):
1539 2018-05-30 Dominik Infuehr <dinfuehr@igalia.com>
1541 [MIPS] Fix build on MIPS32r1
1542 https://bugs.webkit.org/show_bug.cgi?id=185944
1544 Reviewed by Yusuke Suzuki.
1546 Added WTF_MIPS_ISA_REV_AT_LEAST to test for certain release or later.
1550 2018-05-29 Tim Horton <timothy_horton@apple.com>
1553 https://bugs.webkit.org/show_bug.cgi?id=186078
1555 Unreviewed build fix.
1559 2018-05-29 Saam Barati <sbarati@apple.com>
1561 JSC should put bmalloc's scavenger into mini mode
1562 https://bugs.webkit.org/show_bug.cgi?id=185988
1564 Reviewed by Michael Saboff.
1566 * wtf/FastMalloc.cpp:
1567 (WTF::fastEnableMiniMode):
1570 2018-05-29 Yusuke Suzuki <utatane.tea@gmail.com>
1572 Unreviewed, follow-up after r232244
1573 https://bugs.webkit.org/show_bug.cgi?id=186023
1575 _BitScanReverse64 is available only in X86_64 and ARM.
1580 2018-05-27 Yusuke Suzuki <utatane.tea@gmail.com>
1582 [WTF] Add clz32 / clz64 for MSVC
1583 https://bugs.webkit.org/show_bug.cgi?id=186023
1585 Reviewed by Daniel Bates.
1587 This patch adds efficient implementations of clz32 and clz64 for MSVC.
1588 While MSVC has _lzcnt intrinsic, it is only valid if the CPU has lzcnt instruction.
1589 Instead of checking cpuid here, we just use _BitScanReverse and _BitScanReverse64.
1595 2018-05-26 Filip Pizlo <fpizlo@apple.com>
1597 testair sometimes crashes due to races in initialization of ARC4RandomNumberGenerator
1598 https://bugs.webkit.org/show_bug.cgi?id=186014
1600 Reviewed by Yusuke Suzuki.
1602 testair launches a bunch of threads and the threads do B3 things that use random numbers.
1603 Sometimes two threads will initialize the random number generator at the same time, because
1604 that's what happens when you use static NeverDestroyed<>.
1606 This changes that code to use std::call_once to initialize the shared
1607 ARC4RandomNumberGenerator.
1609 Also, this adds a diagnostic message to the lock's assertion. This assertion was the symptom
1610 of the race, and knowing the state of the lock when the assertion fired gave a darn good clue
1611 about what was going on: the lock's value was 0 at time of unlock, implying that another
1612 thread reinitialized the lock to zero by rerunning the constructor.
1614 * wtf/CryptographicallyRandomNumber.cpp:
1615 * wtf/LockAlgorithmInlines.h:
1616 (WTF::Hooks>::unlockSlow):
1618 2018-05-25 Michael Saboff <msaboff@apple.com>
1620 JavaScriptCore: Disable 32-bit JIT on Windows
1621 https://bugs.webkit.org/show_bug.cgi?id=185989
1623 Reviewed by Saam Barati.
1627 2018-05-24 Carlos Alberto Lopez Perez <clopez@igalia.com>
1629 [GTK][WPE] Memory pressure monitor doesn't reliable notify all the subprocesses
1630 https://bugs.webkit.org/show_bug.cgi?id=184261
1632 Reviewed by Carlos Garcia Campos.
1634 Receive the memory pressure notifications from the UIProcess memory monitor via WebKit IPC.
1636 * wtf/MemoryPressureHandler.h:
1637 * wtf/linux/MemoryPressureHandlerLinux.cpp:
1638 (WTF::MemoryPressureHandler::triggerMemoryPressureEvent):
1639 (WTF::MemoryPressureHandler::install):
1640 (WTF::MemoryPressureHandler::uninstall):
1642 2018-05-24 Jiewen Tan <jiewen_tan@apple.com>
1644 Adopt SecKeyProxy SPI in certificate based challenge response code
1645 https://bugs.webkit.org/show_bug.cgi?id=185848
1646 <rdar://problem/34586181>
1648 Reviewed by Alex Christensen.
1650 Add a condition macro to determine if SecKeyProxy SPI exists.
1654 2018-05-23 Eric Carlson <eric.carlson@apple.com>
1656 Avoid loading AVFoundation to check supported MIME types if possible
1657 https://bugs.webkit.org/show_bug.cgi?id=185839
1658 <rdar://problem/40182010>
1660 Reviewed by Jer Noble.
1662 * wtf/cocoa/SoftLinking.h: Add SOFT_LINK_FRAMEWORK_OPTIONAL_PREFLIGHT.
1664 2018-05-23 Filip Pizlo <fpizlo@apple.com>
1666 Speed up JetStream/base64
1667 https://bugs.webkit.org/show_bug.cgi?id=185914
1669 Reviewed by Michael Saboff.
1671 Make Vector<>::append ALWAYS_INLINE.
1674 (WTF::Vector::append):
1675 (WTF::minCapacity>::expandCapacity):
1676 (WTF::minCapacity>::append):
1677 (WTF::minCapacity>::tryAppend):
1679 2018-05-23 Michael Saboff <msaboff@apple.com>
1681 Date.parse() doesn't properly handle input outside of ES Spec limits
1682 https://bugs.webkit.org/show_bug.cgi?id=185868
1684 Reviewed by Mark Lam.
1686 Clamped date creation to +/-100,000,000 days relative to midnight at the beginning
1687 of 01 January, 1970 UTC as per ecma262/#sec-time-values-and-time-range and
1688 ecma262/#sec-date-time-string-format.
1691 (WTF::ymdhmsToSeconds):
1692 (WTF::parseES5DateFromNullTerminatedCharacters):
1694 2018-05-22 Michael Catanzaro <mcatanzaro@igalia.com>
1696 Prohibit shrinking the FastBitVector
1697 https://bugs.webkit.org/show_bug.cgi?id=181020
1699 Reviewed by Oliver Hunt.
1701 Prohibit shrinking the FastBitVector. It's not prepared for this and the current usage does
1704 * wtf/FastBitVector.cpp:
1705 (WTF::FastBitVectorWordOwner::resizeSlow):
1707 2018-05-22 Mark Lam <mark.lam@apple.com>
1709 StringImpl utf8 conversion should not fail silently.
1710 https://bugs.webkit.org/show_bug.cgi?id=185888
1711 <rdar://problem/40464506>
1713 Reviewed by Filip Pizlo.
1715 * WTF.xcodeproj/project.pbxproj:
1716 * wtf/CMakeLists.txt:
1717 * wtf/PrintStream.cpp:
1718 (WTF::printExpectedCStringHelper):
1719 (WTF::printInternal):
1720 * wtf/text/StringImpl.cpp:
1721 (WTF::StringImpl::utf8Impl):
1722 (WTF::StringImpl::utf8ForCharacters):
1723 (WTF::StringImpl::tryUtf8ForRange const):
1724 (WTF::StringImpl::tryUtf8 const):
1725 (WTF::StringImpl::utf8 const):
1726 (WTF::StringImpl::utf8ForRange const): Deleted.
1727 * wtf/text/StringImpl.h:
1728 * wtf/text/StringView.cpp:
1729 (WTF::StringView::tryUtf8 const):
1730 (WTF::StringView::utf8 const):
1731 * wtf/text/StringView.h:
1732 * wtf/text/UTF8ConversionError.h: Added.
1733 * wtf/text/WTFString.cpp:
1734 (WTF::String::tryUtf8 const):
1735 (WTF::String::utf8 const):
1736 * wtf/text/WTFString.h:
1738 2018-05-22 Chris Dumez <cdumez@apple.com>
1740 Regression(AsyncPolicyDelegates): Box.app login Window is blank
1741 https://bugs.webkit.org/show_bug.cgi?id=185832
1742 <rdar://problem/40307871>
1744 Reviewed by Geoffrey Garen.
1746 Moved WeakObjCPtr.h from WebKit2 to WTF with RetainPtr.h, so that it can be used
1747 in WebKitLegacy code.
1749 * WTF.xcodeproj/project.pbxproj:
1750 * wtf/WeakObjCPtr.h: Renamed from Source/WebKit/Shared/mac/WeakObjCPtr.h.
1752 2018-05-22 Filip Pizlo <fpizlo@apple.com>
1755 https://bugs.webkit.org/show_bug.cgi?id=185846
1757 Rubber stamped by Geoffrey Garen.
1761 2018-05-22 Ryan Haddad <ryanhaddad@apple.com>
1763 Unreviewed, rolling out r232052.
1765 Breaks internal builds.
1770 https://bugs.webkit.org/show_bug.cgi?id=185176
1771 https://trac.webkit.org/changeset/232052
1773 2018-05-21 Yusuke Suzuki <utatane.tea@gmail.com>
1776 https://bugs.webkit.org/show_bug.cgi?id=185176
1778 Reviewed by JF Bastien.
1780 * Configurations/Base.xcconfig:
1781 * wtf/StdLibExtras.h:
1783 2018-05-18 Filip Pizlo <fpizlo@apple.com>
1785 DFG should inline InstanceOf ICs
1786 https://bugs.webkit.org/show_bug.cgi?id=185695
1788 Reviewed by Yusuke Suzuki.
1790 I found myself needing a way to represent bottom/false/true/top, so I created it.
1792 * WTF.xcodeproj/project.pbxproj:
1793 * wtf/BooleanLattice.h: Added.
1794 (WTF::lubBooleanLattice):
1795 (WTF::printInternal):
1796 * wtf/CMakeLists.txt:
1798 2018-05-17 Jiewen Tan <jiewen_tan@apple.com>
1800 Convert CertificateInfo into Credential in UI Process instead of Networking Process
1801 https://bugs.webkit.org/show_bug.cgi?id=185662
1802 <rdar://problem/40275561>
1804 Reviewed by Alex Christensen.
1806 Remove marco HAVE_SEC_IDENTITY since it is no longer useful.
1810 2018-05-17 Zalan Bujtas <zalan@apple.com>
1812 Add ASSERT_NOT_IMPLEMENTED_YET() macro
1813 https://bugs.webkit.org/show_bug.cgi?id=185713
1815 Reviewed by Antti Koivisto.
1817 To mark unimplemented code paths.
1819 * wtf/Assertions.cpp:
1822 2018-05-16 Andy VanWagoner <andy@vanwagoner.family>
1824 Add support for Intl NumberFormat formatToParts
1825 https://bugs.webkit.org/show_bug.cgi?id=185375
1827 Reviewed by Yusuke Suzuki.
1829 Add flag for NumberFormat formatToParts.
1831 * wtf/FeatureDefines.h:
1833 2018-05-16 Yusuke Suzuki <utatane.tea@gmail.com>
1835 Unreviewed, follow-up after r231762
1836 https://bugs.webkit.org/show_bug.cgi?id=185589
1838 Addresses darin's suggestions to improve timeClip.
1843 2018-05-14 Yusuke Suzuki <utatane.tea@gmail.com>
1845 [Win] Use C++17 in MSVC
1846 https://bugs.webkit.org/show_bug.cgi?id=185232
1848 Reviewed by Alex Christensen.
1850 Disable some WebKit defined C++17 features for MSVC.
1852 * wtf/StdLibExtras.h:
1854 2018-05-14 Yusuke Suzuki <utatane.tea@gmail.com>
1856 [JSC] timeClip(-0) should produce +0
1857 https://bugs.webkit.org/show_bug.cgi?id=185589
1859 Reviewed by Saam Barati.
1861 According to the spec[1], timeClip(-0) should produce +0.
1862 We achieve this by adding 0.0 to the result of trunc(t).
1864 [1]: https://tc39.github.io/ecma262/#sec-timeclip
1869 2018-05-13 Geoffrey Garen <ggaren@apple.com>
1871 Simplified Mach exception handling
1872 https://bugs.webkit.org/show_bug.cgi?id=185595
1874 Reviewed by Keith Miller.
1876 * wtf/threads/Signals.cpp:
1877 (WTF::startMachExceptionHandlerThread): Use mach_msg_server_once instead
1878 of duplicating its functionality. Separate error handling logic from
1879 program logic to help program logic stand out. Use
1880 DISPATCH_TARGET_QUEUE_* instead of explicitly fetching a queue.
1882 Also, we don't need the high priority queue. The kernel donates a
1883 priority voucher from the exception thread to the receiver thread, and
1884 mach_msg_server_once takes care to forward that voucher.
1886 2018-05-14 Zan Dobersek <zdobersek@igalia.com>
1888 [GTK] REGRESSION(r231170) Build broken with Clang 5.0
1889 https://bugs.webkit.org/show_bug.cgi?id=185198
1891 Reviewed by Michael Catanzaro.
1894 * wtf/Forward.h: Delete the std::optional forward declaration that is
1895 potentially incompatible with definition provided by the standard library.
1897 * wtf/StdLibExtras.h: In addition to the remaining C++14 configurations,
1898 also use custom std::in_place_t implementation when compiling with
1899 libstdc++ 6.x, which doesn't provide its own.
1901 2018-05-13 Filip Pizlo <fpizlo@apple.com>
1903 Disable pointer poisoning
1904 https://bugs.webkit.org/show_bug.cgi?id=185586
1906 Reviewed by Yusuke Suzuki.
1908 This seems like a 0.3% speed-up on microbenchmarks. It seems like it may be a small speed-up on
1913 2018-05-11 Chris Dumez <cdumez@apple.com>
1915 REGRESSION (async policy delegate): Revoking an object URL immediately after triggering download breaks file download
1916 https://bugs.webkit.org/show_bug.cgi?id=185531
1917 <rdar://problem/39909589>
1919 Reviewed by Geoffrey Garen.
1921 Add a default constructor for CompletionHandlerCallingScope, for convenience.
1923 * wtf/CompletionHandler.h:
1925 2018-05-11 Saam Barati <sbarati@apple.com>
1927 Don't allocate value profiles when the JIT is disabled
1928 https://bugs.webkit.org/show_bug.cgi?id=185525
1930 Reviewed by Michael Saboff.
1932 * wtf/RefCountedArray.h:
1933 (WTF::RefCountedArray::RefCountedArray):
1935 2018-05-10 Tim Horton <timothy_horton@apple.com>
1937 Fix the build after r231393
1938 https://bugs.webkit.org/show_bug.cgi?id=185519
1939 <rdar://problem/40131741>
1941 Reviewed by Simon Fraser.
1945 2018-05-09 Michael Catanzaro <mcatanzaro@igalia.com>
1947 [WPE] Build cleanly with GCC 8 and ICU 60
1948 https://bugs.webkit.org/show_bug.cgi?id=185462
1950 Reviewed by Carlos Alberto Lopez Perez.
1953 (WTF::HashTableBucketInitializer<true>::initialize): Since -Wclass-memaccess warning. This
1954 is probably safe enough, since it's for an empty bucket.
1955 * wtf/StdLibExtras.h:
1956 (WTF::bitwise_cast): Silence -Wclass-memaccess as we use type traits to ensure safety here.
1957 * wtf/Vector.h: Ditto, all uses are safe.
1958 * wtf/glib/WTFGType.h: Silence -Wcast-function-type.
1960 2018-05-09 Yusuke Suzuki <utatane.tea@gmail.com>
1962 [ARMv7] Drop ARMv7 disassembler in favor of capstone
1963 https://bugs.webkit.org/show_bug.cgi?id=185423
1965 Reviewed by Michael Catanzaro.
1967 Remove USE_ARMV7_DISASSEMBLER. Just use Capstone.
1971 2018-05-06 Yusuke Suzuki <utatane.tea@gmail.com>
1973 [JSC][GTK][JSCONLY] Use capstone disassembler
1974 https://bugs.webkit.org/show_bug.cgi?id=185283
1976 Reviewed by Michael Catanzaro.
1978 Add USE_CAPSTONE used for MIPS and ARM.
1982 2018-05-09 Antti Koivisto <antti@apple.com>
1984 Add OptionSet::operator& and operator bool
1985 https://bugs.webkit.org/show_bug.cgi?id=185306
1987 Reviewed by Anders Carlsson.
1989 This is primarily to allow writing
1991 if (options & Option:A)
1995 if (options.contains(Option:A))
1997 This is consistent with other OptionSet operators.
2000 (WTF::OptionSet::operator bool):
2001 (WTF::OptionSet::operator&):
2003 Also remove T versions of operator| and operator-, they are not needed due to
2004 implicit conversion from T to OptionSet<T>.
2006 2018-05-06 Filip Pizlo <fpizlo@apple.com>
2008 InPlaceAbstractState::beginBasicBlock shouldn't have to clear any abstract values
2009 https://bugs.webkit.org/show_bug.cgi?id=185365
2011 Reviewed by Saam Barati.
2013 Fix some inlining goof-ups.
2015 Rolling back in after fixing cloop build.
2018 (WTF::TinyPtrSet::add):
2019 (WTF::TinyPtrSet::merge):
2020 (WTF::TinyPtrSet::addOutOfLine):
2021 (WTF::TinyPtrSet::mergeOtherOutOfLine):
2023 2018-05-08 Dean Jackson <dino@apple.com>
2025 Use thumbnails in System Previews
2026 https://bugs.webkit.org/show_bug.cgi?id=185397
2027 <rdar://problem/40039376>
2029 Reviewed by Jon Lee.
2031 SYSTEM_PREVIEW is only available on some platforms.
2035 2018-05-08 Ryan Haddad <ryanhaddad@apple.com>
2037 Unreviewed, rolling out r231468.
2039 Broke the CLoop build
2043 "InPlaceAbstractState::beginBasicBlock shouldn't have to clear
2044 any abstract values"
2045 https://bugs.webkit.org/show_bug.cgi?id=185365
2046 https://trac.webkit.org/changeset/231468
2048 2018-05-07 Yusuke Suzuki <utatane.tea@gmail.com>
2050 [JSCONLY] Enable ARMv7 DFG
2051 https://bugs.webkit.org/show_bug.cgi?id=185415
2053 Reviewed by Mark Lam.
2055 Enable ARMv7 DFG JIT by default on Linux and FreeBSD.
2059 2018-05-06 Filip Pizlo <fpizlo@apple.com>
2061 InPlaceAbstractState::beginBasicBlock shouldn't have to clear any abstract values
2062 https://bugs.webkit.org/show_bug.cgi?id=185365
2064 Reviewed by Saam Barati.
2066 Fix some inlining goof-ups.
2069 (WTF::TinyPtrSet::add):
2070 (WTF::TinyPtrSet::merge):
2071 (WTF::TinyPtrSet::addOutOfLine):
2072 (WTF::TinyPtrSet::mergeOtherOutOfLine):
2074 2018-05-06 Yusuke Suzuki <utatane.tea@gmail.com>
2076 [WTF] Embed default atomic string table in Thread
2077 https://bugs.webkit.org/show_bug.cgi?id=185349
2079 Reviewed by Darin Adler.
2081 Do not need to allocate AtomicStringTable separate from Thread
2082 since the table's lifetime is completely the same as Thread.
2084 This patch just embeds it as a data member of Thread.
2086 * wtf/Threading.cpp:
2087 (WTF::Thread::initializeInThread):
2088 (WTF::Thread::didExit):
2090 * wtf/text/AtomicStringTable.cpp:
2091 (WTF::AtomicStringTable::create): Deleted.
2092 (WTF::AtomicStringTable::destroy): Deleted.
2093 * wtf/text/AtomicStringTable.h:
2095 2018-05-06 Yusuke Suzuki <utatane.tea@gmail.com>
2097 [WTF] Use static initializers for WTF::Mutex and WTF::ThreadCondition
2098 https://bugs.webkit.org/show_bug.cgi?id=185361
2100 Reviewed by Sam Weinig.
2102 Use static initializers for WTF::Mutex and WTF::ThreadCondition to make
2103 constructors of them simple and constexpr.
2105 * wtf/ThreadingPrimitives.h:
2106 * wtf/ThreadingPthreads.cpp:
2107 (WTF::Mutex::Mutex): Deleted.
2108 (WTF::ThreadCondition::ThreadCondition): Deleted.
2109 * wtf/ThreadingWin.cpp:
2110 (WTF::Mutex::Mutex): Deleted.
2111 (WTF::ThreadCondition::ThreadCondition): Deleted.
2113 2018-05-04 Tim Horton <timothy_horton@apple.com>
2115 Shift to a lower-level framework for simplifying URLs
2116 https://bugs.webkit.org/show_bug.cgi?id=185334
2118 Reviewed by Dan Bernstein.
2122 2018-05-04 Eric Carlson <eric.carlson@apple.com>
2124 Log media time range as JSON
2125 https://bugs.webkit.org/show_bug.cgi?id=185321
2126 <rdar://problem/39986746>
2128 Reviewed by Youenn Fablet.
2130 * wtf/MediaTime.cpp:
2131 (WTF::toJSONStringInternal): Extract guts of MediaTime::toJSONString to this static function
2132 so it can be used by MediaTimeRange::toJSONString as well.
2133 (WTF::MediaTime::toJSONString const):
2134 (WTF::MediaTimeRange::toJSONString const):
2137 2018-05-04 Antti Koivisto <antti@apple.com>
2139 OptionsSet initializer list constructor should be constexpr
2140 https://bugs.webkit.org/show_bug.cgi?id=185298
2142 Reviewed by Anders Carlsson.
2145 (WTF::OptionSet::OptionSet):
2147 2018-05-03 Yusuke Suzuki <utatane.tea@gmail.com>
2149 Use default std::optional if it is provided
2150 https://bugs.webkit.org/show_bug.cgi?id=185159
2152 Reviewed by Michael Catanzaro.
2156 Do not use <optional> for clang currently.
2157 (WTF::valueOrCompute):
2159 2018-05-03 Filip Pizlo <fpizlo@apple.com>
2161 Strings should not be allocated in a gigacage
2162 https://bugs.webkit.org/show_bug.cgi?id=185218
2164 Reviewed by Saam Barati.
2166 * WTF.xcodeproj/project.pbxproj:
2171 (Gigacage::basePtr):
2173 (WTF::VectorBufferBase::allocateBuffer):
2174 (WTF::VectorBufferBase::tryAllocateBuffer):
2175 (WTF::VectorBufferBase::reallocateBuffer):
2176 (WTF::VectorBufferBase::deallocateBuffer):
2177 (WTF::minCapacity>::Vector):
2179 (WTF::minCapacity>::contains const):
2180 (WTF::minCapacity>::findMatching const):
2181 (WTF::minCapacity>::find const):
2182 (WTF::minCapacity>::reverseFind const):
2183 (WTF::minCapacity>::appendIfNotContains):
2184 (WTF::minCapacity>::fill):
2185 (WTF::minCapacity>::appendRange):
2186 (WTF::minCapacity>::expandCapacity):
2187 (WTF::minCapacity>::tryExpandCapacity):
2188 (WTF::minCapacity>::resize):
2189 (WTF::minCapacity>::resizeToFit):
2190 (WTF::minCapacity>::shrink):
2191 (WTF::minCapacity>::grow):
2192 (WTF::minCapacity>::asanSetInitialBufferSizeTo):
2193 (WTF::minCapacity>::asanSetBufferSizeToFullCapacity):
2194 (WTF::minCapacity>::asanBufferSizeWillChangeTo):
2195 (WTF::minCapacity>::reserveCapacity):
2196 (WTF::minCapacity>::tryReserveCapacity):
2197 (WTF::minCapacity>::reserveInitialCapacity):
2198 (WTF::minCapacity>::shrinkCapacity):
2199 (WTF::minCapacity>::append):
2200 (WTF::minCapacity>::tryAppend):
2201 (WTF::minCapacity>::constructAndAppend):
2202 (WTF::minCapacity>::tryConstructAndAppend):
2203 (WTF::minCapacity>::appendSlowCase):
2204 (WTF::minCapacity>::constructAndAppendSlowCase):
2205 (WTF::minCapacity>::tryConstructAndAppendSlowCase):
2206 (WTF::minCapacity>::uncheckedAppend):
2207 (WTF::minCapacity>::appendVector):
2208 (WTF::minCapacity>::insert):
2209 (WTF::minCapacity>::insertVector):
2210 (WTF::minCapacity>::remove):
2211 (WTF::minCapacity>::removeFirst):
2212 (WTF::minCapacity>::removeFirstMatching):
2213 (WTF::minCapacity>::removeAll):
2214 (WTF::minCapacity>::removeAllMatching):
2215 (WTF::minCapacity>::reverse):
2216 (WTF::minCapacity>::map const):
2217 (WTF::minCapacity>::releaseBuffer):
2218 (WTF::minCapacity>::checkConsistency):
2222 (WTF::removeRepeatedElements):
2223 (WTF::Malloc>::Vector): Deleted.
2224 (WTF::Malloc>::contains const): Deleted.
2225 (WTF::Malloc>::findMatching const): Deleted.
2226 (WTF::Malloc>::find const): Deleted.
2227 (WTF::Malloc>::reverseFind const): Deleted.
2228 (WTF::Malloc>::appendIfNotContains): Deleted.
2229 (WTF::Malloc>::fill): Deleted.
2230 (WTF::Malloc>::appendRange): Deleted.
2231 (WTF::Malloc>::expandCapacity): Deleted.
2232 (WTF::Malloc>::tryExpandCapacity): Deleted.
2233 (WTF::Malloc>::resize): Deleted.
2234 (WTF::Malloc>::resizeToFit): Deleted.
2235 (WTF::Malloc>::shrink): Deleted.
2236 (WTF::Malloc>::grow): Deleted.
2237 (WTF::Malloc>::asanSetInitialBufferSizeTo): Deleted.
2238 (WTF::Malloc>::asanSetBufferSizeToFullCapacity): Deleted.
2239 (WTF::Malloc>::asanBufferSizeWillChangeTo): Deleted.
2240 (WTF::Malloc>::reserveCapacity): Deleted.
2241 (WTF::Malloc>::tryReserveCapacity): Deleted.
2242 (WTF::Malloc>::reserveInitialCapacity): Deleted.
2243 (WTF::Malloc>::shrinkCapacity): Deleted.
2244 (WTF::Malloc>::append): Deleted.
2245 (WTF::Malloc>::tryAppend): Deleted.
2246 (WTF::Malloc>::constructAndAppend): Deleted.
2247 (WTF::Malloc>::tryConstructAndAppend): Deleted.
2248 (WTF::Malloc>::appendSlowCase): Deleted.
2249 (WTF::Malloc>::constructAndAppendSlowCase): Deleted.
2250 (WTF::Malloc>::tryConstructAndAppendSlowCase): Deleted.
2251 (WTF::Malloc>::uncheckedAppend): Deleted.
2252 (WTF::Malloc>::appendVector): Deleted.
2253 (WTF::Malloc>::insert): Deleted.
2254 (WTF::Malloc>::insertVector): Deleted.
2255 (WTF::Malloc>::remove): Deleted.
2256 (WTF::Malloc>::removeFirst): Deleted.
2257 (WTF::Malloc>::removeFirstMatching): Deleted.
2258 (WTF::Malloc>::removeAll): Deleted.
2259 (WTF::Malloc>::removeAllMatching): Deleted.
2260 (WTF::Malloc>::reverse): Deleted.
2261 (WTF::Malloc>::map const): Deleted.
2262 (WTF::Malloc>::releaseBuffer): Deleted.
2263 (WTF::Malloc>::checkConsistency): Deleted.
2264 * wtf/text/AtomicStringImpl.h:
2265 * wtf/text/CString.cpp:
2266 (WTF::CStringBuffer::createUninitialized):
2267 * wtf/text/CString.h:
2268 * wtf/text/StringBuffer.h:
2269 (WTF::StringBuffer::StringBuffer):
2270 (WTF::StringBuffer::~StringBuffer):
2271 (WTF::StringBuffer::resize):
2272 * wtf/text/StringImpl.cpp:
2273 (WTF::StringImpl::~StringImpl):
2274 (WTF::StringImpl::destroy):
2275 (WTF::StringImpl::createUninitializedInternalNonEmpty):
2276 (WTF::StringImpl::reallocateInternal):
2277 (WTF::StringImpl::releaseAssertCaged const): Deleted.
2278 * wtf/text/StringImpl.h:
2279 (WTF::StringImpl::createSubstringSharingImpl):
2280 (WTF::StringImpl::tryCreateUninitialized):
2281 (WTF::StringImpl::adopt):
2282 (WTF::StringImpl::assertCaged const): Deleted.
2283 * wtf/text/StringMalloc.cpp: Removed.
2284 * wtf/text/StringMalloc.h: Removed.
2285 * wtf/text/StringVector.h: Removed.
2286 * wtf/text/SymbolImpl.h:
2287 * wtf/text/UniquedStringImpl.h:
2288 * wtf/text/WTFString.h:
2289 (WTF::String::adopt):
2290 (WTF::String::assertCaged const): Deleted.
2291 (WTF::String::releaseAssertCaged const): Deleted.
2293 2018-05-03 Wenson Hsieh <wenson_hsieh@apple.com>
2295 Ads in NYTimes app are shifted downwards by the scroll view's top content inset
2296 https://bugs.webkit.org/show_bug.cgi?id=185251
2297 <rdar://problem/39062357>
2299 Reviewed by Tim Horton.
2301 Add a new DYLD_IOS_VERSION macro definition for previous or non-internal SDKs.
2303 * wtf/spi/darwin/dyldSPI.h:
2305 2018-05-03 Ryan Haddad <ryanhaddad@apple.com>
2307 Unreviewed, rolling out r231197.
2309 The test added with this change crashes on the 32-bit JSC bot.
2313 "Correctly detect string overflow when using the 'Function'
2315 https://bugs.webkit.org/show_bug.cgi?id=184883
2316 https://trac.webkit.org/changeset/231197
2318 2018-05-03 Commit Queue <commit-queue@webkit.org>
2320 Unreviewed, rolling out r231223 and r231288.
2321 https://bugs.webkit.org/show_bug.cgi?id=185256
2323 The change in r231223 breaks internal builds, and r231288 is a
2324 dependent change. (Requested by ryanhaddad on #webkit).
2326 Reverted changesets:
2328 "Use default std::optional if it is provided"
2329 https://bugs.webkit.org/show_bug.cgi?id=185159
2330 https://trac.webkit.org/changeset/231223
2332 "Use pointer instead of
2333 std::optional<std::reference_wrapper<>>"
2334 https://bugs.webkit.org/show_bug.cgi?id=185186
2335 https://trac.webkit.org/changeset/231288
2337 2018-05-02 Commit Queue <commit-queue@webkit.org>
2339 Unreviewed, rolling out r231251.
2340 https://bugs.webkit.org/show_bug.cgi?id=185229
2342 __cpp_lib_optional should be used after including <optional>
2343 since it is defined in <optional> (Requested by yusukesuzuki
2348 "Follow-up build fix for r231223"
2349 https://bugs.webkit.org/show_bug.cgi?id=185159
2350 https://trac.webkit.org/changeset/231251
2352 2018-05-02 Jonathan Bedard <jbedard@apple.com>
2354 Follow-up build fix for r231223
2355 https://bugs.webkit.org/show_bug.cgi?id=185159
2356 <rdar://problem/39891074>
2358 Unreviewed build fix.
2360 We should be consistent about when we include <optional> vs define our own.
2364 2018-05-02 Jer Noble <jer.noble@apple.com>
2366 Enable HAVE_AVKIT for the MINIMAL_SIMULATOR
2367 https://bugs.webkit.org/show_bug.cgi?id=185183
2369 Reviewed by Daniel Bates.
2373 2018-05-01 Yusuke Suzuki <utatane.tea@gmail.com>
2375 Use default std::optional if it is provided
2376 https://bugs.webkit.org/show_bug.cgi?id=185159
2378 Reviewed by JF Bastien.
2380 Now C++17 flag is enabled. It means that any standard libraries can use <optional> internally.
2381 If we define std::optional regardless of the existence of the standard library's <optional>,
2382 it causes compile errors. For example, in GCC 7 (specifically GCC 7.3.0) environment,
2383 <optional> is included in <unordered_map>.
2384 We do not define std::optional in WebKit side if <optional> is offered.
2386 And we also remove std::optional<T&> use since this is not accepted in C++17. Use
2387 std::optional<std::reference_wrapper<T>> instead.
2390 constexpr does not mean const in C++17.
2393 Do not define std::optional if <optional> is provided.
2395 (WTF::valueOrCompute):
2397 2018-05-01 Robin Morisset <rmorisset@apple.com>
2399 Correctly detect string overflow when using the 'Function' constructor
2400 https://bugs.webkit.org/show_bug.cgi?id=184883
2401 <rdar://problem/36320331>
2403 Reviewed by Filip Pizlo.
2405 I added new tryAppend methods alongside the old append methods in StringBuilder, that return a boolean (true means success, false means an overflow happened).
2406 I made new methods instead of just adapting the existing ones (and reverted such a change on appendQuotedJSONString) so that callers that rely on the old behaviour (a hard CRASH() on overflow) don't silently start failing.
2408 * wtf/text/StringBuilder.cpp:
2409 (WTF::StringBuilder::allocateBufferUpConvert):
2410 (WTF::StringBuilder::tryAllocateBufferUpConvert):
2411 (WTF::StringBuilder::appendUninitialized):
2412 (WTF::StringBuilder::append):
2413 (WTF::StringBuilder::tryAppend):
2414 * wtf/text/StringBuilder.h:
2415 (WTF::StringBuilder::tryAppend):
2416 (WTF::StringBuilder::append):
2417 (WTF::StringBuilder::tryAppendLiteral):
2418 * wtf/text/StringBuilderJSON.cpp:
2419 (WTF::StringBuilder::appendQuotedJSONString):
2420 (WTF::StringBuilder::tryAppendQuotedJSONString):
2422 2018-04-30 Mark Lam <mark.lam@apple.com>
2424 Apply PtrTags to the MetaAllocator and friends.
2425 https://bugs.webkit.org/show_bug.cgi?id=185110
2426 <rdar://problem/39533895>
2428 Reviewed by Saam Barati.
2430 1. Introduce a MetaAllocatorPtr smart pointer to do pointer tagging.
2431 2. Use MetaAllocatorPtr in MetaAllocator and MetaAllocatorHandle.
2433 * WTF.xcodeproj/project.pbxproj:
2434 * wtf/CMakeLists.txt:
2435 * wtf/MetaAllocator.cpp:
2436 (WTF::MetaAllocator::release):
2437 (WTF::MetaAllocatorHandle::MetaAllocatorHandle):
2438 (WTF::MetaAllocatorHandle::shrink):
2439 (WTF::MetaAllocatorHandle::dump const):
2440 (WTF::MetaAllocator::allocate):
2441 (WTF::MetaAllocator::findAndRemoveFreeSpace):
2442 (WTF::MetaAllocator::addFreeSpaceFromReleasedHandle):
2443 (WTF::MetaAllocator::addFreshFreeSpace):
2444 (WTF::MetaAllocator::debugFreeSpaceSize):
2445 (WTF::MetaAllocator::addFreeSpace):
2446 (WTF::MetaAllocator::allocFreeSpaceNode):
2447 * wtf/MetaAllocator.h:
2448 (WTF::MetaAllocatorTracker::find):
2449 (WTF::MetaAllocator::FreeSpaceNode::FreeSpaceNode):
2450 (WTF::MetaAllocator::FreeSpaceNode::sizeInBytes):
2451 (WTF::MetaAllocator::FreeSpaceNode::key):
2452 * wtf/MetaAllocatorHandle.h:
2453 (WTF::MetaAllocatorHandle::start const):
2454 (WTF::MetaAllocatorHandle::end const):
2455 (WTF::MetaAllocatorHandle::startAsInteger const):
2456 (WTF::MetaAllocatorHandle::endAsInteger const):
2457 (WTF::MetaAllocatorHandle::sizeInBytes const):
2458 (WTF::MetaAllocatorHandle::containsIntegerAddress const):
2459 (WTF::MetaAllocatorHandle::key):
2460 * wtf/MetaAllocatorPtr.h: Added.
2461 (WTF::MetaAllocatorPtr::MetaAllocatorPtr):
2462 (WTF::MetaAllocatorPtr:: const):
2463 (WTF::MetaAllocatorPtr::operator bool const):
2464 (WTF::MetaAllocatorPtr::operator! const):
2465 (WTF::MetaAllocatorPtr::operator== const):
2466 (WTF::MetaAllocatorPtr::operator!= const):
2467 (WTF::MetaAllocatorPtr::operator+ const):
2468 (WTF::MetaAllocatorPtr::operator- const):
2469 (WTF::MetaAllocatorPtr::operator+=):
2470 (WTF::MetaAllocatorPtr::operator-=):
2471 (WTF::MetaAllocatorPtr::isEmptyValue const):
2472 (WTF::MetaAllocatorPtr::isDeletedValue const):
2473 (WTF::MetaAllocatorPtr::hash const):
2474 (WTF::MetaAllocatorPtr::emptyValue):
2475 (WTF::MetaAllocatorPtr::deletedValue):
2476 (WTF::MetaAllocatorPtrHash::hash):
2477 (WTF::MetaAllocatorPtrHash::equal):
2480 2018-04-30 JF Bastien <jfbastien@apple.com>
2482 Use some C++17 features
2483 https://bugs.webkit.org/show_bug.cgi?id=185135
2485 Reviewed by Alex Christensen.
2487 * wtf/StdLibExtras.h: libstdc++ doesn't say it's C++17 when it
2488 defines std::conjunction. Use the feature test macro instead.
2490 2018-04-30 Yusuke Suzuki <utatane.tea@gmail.com>
2492 Use WordLock instead of std::mutex for Threading
2493 https://bugs.webkit.org/show_bug.cgi?id=185121
2495 Reviewed by Geoffrey Garen.
2497 Before r231151, WordLock depends on ThreadSpecific. It means that our Threading implementation
2498 cannot use this lock since Threading primitives could touch these locks after ThreadSpecific
2499 for that WordLock is destroyed.
2501 Now WordLock is changed not to use ThreadSpecific. So it does not depend on our Threading
2502 mechanism and our Threading can start using WordLock internally.
2504 This patch changes WTF::Thread and WTF::ThreadGroup to use WordLock instead of std::mutex.
2506 And add constexpr to explicitly describe that Lock, Condition, and WordLock constructors are constexpr.
2510 * wtf/ThreadGroup.h:
2511 (WTF::ThreadGroup::getLock):
2512 * wtf/Threading.cpp:
2513 (WTF::Thread::didExit):
2514 (WTF::Thread::addToThreadGroup):
2515 (WTF::Thread::removeFromThreadGroup):
2517 * wtf/ThreadingPthreads.cpp:
2518 (WTF::Thread::changePriority):
2519 (WTF::Thread::waitForCompletion):
2520 (WTF::Thread::detach):
2521 (WTF::Thread::signal):
2522 (WTF::Thread::establishPlatformSpecificHandle):
2523 * wtf/ThreadingWin.cpp:
2524 (WTF::Thread::changePriority):
2525 (WTF::Thread::waitForCompletion):
2526 (WTF::Thread::detach):
2527 (WTF::Thread::establishPlatformSpecificHandle):
2528 (WTF::Thread::initializeTLSKey):
2529 (WTF::Thread::currentDying):
2531 (WTF::Thread::initializeTLS):
2532 (WTF::Thread::destructTLS):
2533 (WTF::threadMapMutex): Deleted.
2536 2018-04-29 Michael Catanzaro <mcatanzaro@igalia.com>
2538 [CMake] Require GCC 6
2539 https://bugs.webkit.org/show_bug.cgi?id=184985
2541 Reviewed by Alex Christensen.
2543 Stop enforcing GCC version in Compiler.h. It's better to do this in the build system. And I
2544 don't like having the same check in two different places.
2548 2018-04-29 Geoffrey Garen <ggaren@apple.com>
2550 WordLock doesn't need per-thread data
2551 https://bugs.webkit.org/show_bug.cgi?id=185119
2553 Reviewed by Yusuke Suzuki.
2555 The stack is per-thread data, so we can stack-allocate our ThreadData.
2557 This eliminates malloc() and high-level WTF threading primitives from
2558 WordLock, making WordLock more portable to non-WTF code, including
2561 (NOTE: This patch makes the bug fixed in r231148 100% reproducible.)
2564 (WTF::WordLock::lockSlow): Allocate ThreadData on the stack.
2566 2018-04-28 Geoffrey Garen <ggaren@apple.com>
2568 Fixed a very unlikely race condition in WTF::WordLock
2569 https://bugs.webkit.org/show_bug.cgi?id=185117
2571 Reviewed by Saam Barati.
2573 The race goes like this:
2575 Thread L is in lockSlowCase() and thread U is in unlockSlowCase();
2577 - U acquires queueHead->parkingLock.
2578 - U sets queueHead->shouldPark = false
2579 - U releases queueHead->parkingLock.
2580 - L spuriously wakes up from queueHead->parkingLock.wait()
2581 - L acquires queueHead->parkingLock.
2582 - L notices that queueHead->shouldPark = false, and acquires the WordLock
2583 - L finishes all its work and exits, freeing queueHead
2584 - U notifies queueHead->parkingLock (after free) and crashes or deadlocks
2586 These conditions are currently so unlikely that I don't know how to test
2587 them. I noticed this race because I changed WordLock's allocation pattern
2588 to allow queueHead to be freed more often, and I crashed / deadlocked 100%.
2590 Shout out to <http://en.cppreference.com/w/cpp/thread/condition_variable/notify_one>
2591 for explaining this.
2593 * benchmarks/ToyLocks.h: Fixed build.
2596 (WTF::WordLock::unlockSlow): Hold the lock a little longer to avoid
2599 2018-04-27 David Kilzer <ddkilzer@apple.com>
2601 Add logging when SpringBoard enables WebThread
2602 <https://webkit.org/b/185100>
2603 <rdar://problem/39746542>
2605 Reviewed by Daniel Bates.
2608 (RELEASE_LOG_FAULT): Add macro to call os_log_fault().
2609 * wtf/Platform.h: Drive-by fix to enable USE(OS_LOG) on
2610 public iOS SDKs since <rdar://problem/27758343> was
2613 2018-04-26 Mark Lam <mark.lam@apple.com>
2615 Gardening: Speculative build fix for Windows.
2616 https://bugs.webkit.org/show_bug.cgi?id=184976
2617 <rdar://problem/39723901>
2622 (WTF::makePtrTagHash): Undo last speculative build fix that did not work for 64-bit.
2624 2018-04-26 Andy VanWagoner <thetalecrafter@gmail.com>
2626 [INTL] Implement Intl.PluralRules
2627 https://bugs.webkit.org/show_bug.cgi?id=184312
2629 Reviewed by JF Bastien.
2631 Added Intl.PluralRules feature flag.
2633 * wtf/FeatureDefines.h:
2635 2018-04-25 Mark Lam <mark.lam@apple.com>
2637 Gardening: Speculative build fix for Windows 32-bit to compensate for MSVC's lack of smarts.
2638 https://bugs.webkit.org/show_bug.cgi?id=184976
2639 <rdar://problem/39723901>
2643 According to https://stackoverflow.com/questions/37658794/integer-constant-overflow-warning-in-constexpr,
2644 disabling the warning around the definition of the function will not disable it
2645 for all clients of the function.
2648 (WTF::makePtrTagHash):
2650 2018-04-25 Mark Lam <mark.lam@apple.com>
2652 Push the definition of PtrTag down to the WTF layer.
2653 https://bugs.webkit.org/show_bug.cgi?id=184976
2654 <rdar://problem/39723901>
2656 Reviewed by Saam Barati.
2658 This is in preparation for doing pointer profiling at the WTF layer as well.
2659 Also deleted an unused ptrTag() function.
2661 * WTF.xcodeproj/project.pbxproj:
2662 * wtf/CMakeLists.txt:
2663 * wtf/PtrTag.h: Copied from Source/JavaScriptCore/runtime/PtrTag.h.
2664 (WTF::makePtrTagHash):
2665 (JSC::ptrTagName): Deleted.
2666 (JSC::tagForPtr): Deleted.
2667 (JSC::ptrTag): Deleted.
2668 (JSC::tagCodePtr): Deleted.
2669 (JSC::untagCodePtr): Deleted.
2670 (JSC::retagCodePtr): Deleted.
2671 (JSC::removeCodePtrTag): Deleted.
2672 (JSC::tagCFunctionPtr): Deleted.
2673 (JSC::untagCFunctionPtr): Deleted.
2674 (JSC::assertIsCFunctionPtr): Deleted.
2675 (JSC::assertIsNullOrCFunctionPtr): Deleted.
2676 (JSC::assertIsNotTagged): Deleted.
2677 (JSC::assertIsTagged): Deleted.
2678 (JSC::assertIsNullOrTagged): Deleted.
2679 (JSC::assertIsTaggedWith): Deleted.
2680 (JSC::assertIsNullOrTaggedWith): Deleted.
2682 2018-04-25 Dean Jackson <dino@apple.com>
2684 Make a better flag for system preview, and disable it where necessary
2685 https://bugs.webkit.org/show_bug.cgi?id=184968
2686 <rdar://problem/39686506>
2688 Reviewed by Eric Carlson.
2690 Add a new USE(SYSTEM_PREVIEW).
2694 2018-04-24 Commit Queue <commit-queue@webkit.org>
2696 Unreviewed, rolling out r230971.
2697 https://bugs.webkit.org/show_bug.cgi?id=184939
2699 This fix was not appropriate (Requested by n_wang on #webkit).
2703 "AX: soft link libAccessibility.dylb"
2704 https://bugs.webkit.org/show_bug.cgi?id=184919
2705 https://trac.webkit.org/changeset/230971
2707 2018-04-24 Nan Wang <n_wang@apple.com>
2709 AX: soft link libAccessibility.dylb
2710 https://bugs.webkit.org/show_bug.cgi?id=184919
2712 Reviewed by Chris Fleizach.
2714 * wtf/cocoa/SoftLinking.h:
2716 2018-04-23 Zalan Bujtas <zalan@apple.com>
2718 [LayoutFormattingContext] Initial commit.
2719 https://bugs.webkit.org/show_bug.cgi?id=184896
2721 Reviewed by Antti Koivisto.
2723 * wtf/FeatureDefines.h:
2725 2018-04-23 Per Arne Vollan <pvollan@apple.com>
2727 Deactivate the WindowServer connection for the WebContent process.
2728 https://bugs.webkit.org/show_bug.cgi?id=184451
2729 <rdar://problem/38313938>
2731 Reviewed by Brent Fulgham.
2733 Defining ENABLE_WEBPROCESS_WINDOWSERVER_BLOCKING as 1 will deactivate the WindowServer connection
2734 for the WebContent process by enabling the call to 'CGSSetDenyWindowServerConnections(true)' on
2735 process startup. After calling this function, every attempt to establish a connection to the
2736 WindowServer from the WebContent process will fail, except for CA render server connections.
2738 * wtf/FeatureDefines.h:
2740 2018-04-20 JF Bastien <jfbastien@apple.com>
2742 Handle more JSON stringify OOM
2743 https://bugs.webkit.org/show_bug.cgi?id=184846
2744 <rdar://problem/39390672>
2746 Reviewed by Mark Lam.
2748 JSON stringification can OOM easily. Here's another case.
2750 * wtf/text/StringBuilderJSON.cpp:
2751 (WTF::StringBuilder::appendQuotedJSONString):
2753 2018-04-18 Jer Noble <jer.noble@apple.com>
2755 Don't put build products into WK_ALTERNATE_WEBKIT_SDK_PATH for engineering builds
2756 https://bugs.webkit.org/show_bug.cgi?id=184762
2758 Reviewed by Dan Bernstein.
2760 * Configurations/Base.xcconfig:
2762 2018-04-20 Daniel Bates <dabates@apple.com>
2764 Remove code for compilers that did not support NSDMI for aggregates
2765 https://bugs.webkit.org/show_bug.cgi?id=184599
2767 Reviewed by Per Arne Vollan.
2769 Remove workaround for earlier Visual Studio versions that did not support non-static data
2770 member initializers (NSDMI) for aggregates. We have since updated all the build.webkit.org
2771 and EWS bots to a newer version that supports this feature.
2775 2018-04-19 David Kilzer <ddkilzer@apple.com>
2777 Enable Objective-C weak references
2778 <https://webkit.org/b/184789>
2779 <rdar://problem/39571716>
2781 Reviewed by Dan Bernstein.
2783 * Configurations/Base.xcconfig:
2784 (CLANG_ENABLE_OBJC_WEAK): Enable.
2786 2018-04-19 Brady Eidson <beidson@apple.com>
2788 Add globally-unique HistoryItem identifiers (and have WebKit2 adopt them).
2789 <rdar://problem/39533949> and https://bugs.webkit.org/show_bug.cgi?id=184750
2791 Reviewed by Ryosuke Niwa.
2793 * wtf/DebugUtilities.h:
2796 2018-04-19 Per Arne Vollan <pvollan@apple.com>
2798 Unreviewed, rolling out r230677.
2800 Introduced Netflix problems.
2804 "Deactivate the WindowServer connection for the WebContent process."
2805 https://bugs.webkit.org/show_bug.cgi?id=184451
2806 https://trac.webkit.org/changeset/230677
2808 2018-04-19 Nan Wang <n_wang@apple.com>
2810 AX: AOM: respect the accessibility setting for dispatching the accessible events
2811 https://bugs.webkit.org/show_bug.cgi?id=184619
2813 Reviewed by Ryosuke Niwa.
2817 2018-04-18 Ross Kirsling <ross.kirsling@sony.com>
2819 [Win] Layout Test js/date-constructor.html is failing
2820 https://bugs.webkit.org/show_bug.cgi?id=140945
2822 Reviewed by Per Arne Vollan.
2825 (WTF::calculateDSTOffset):
2826 Move all shared calculations outside of the #if -- including the "jump forward a day" case that had been overlooked.
2828 2018-04-17 Saam Barati <sbarati@apple.com>
2830 Add system trace points for process launch and for initializeWebProcess
2831 https://bugs.webkit.org/show_bug.cgi?id=184669
2833 Reviewed by Simon Fraser.
2835 This patch adds TracePointCodes to measure process launch time and
2836 WebProcess::initializeWebProcess time.
2838 It also renames the TracePoint function to tracePoint since WebKit style
2839 does not capitalize the first letter in function names.
2841 * wtf/SystemTracing.h:
2843 (WTF::TraceScope::TraceScope):
2844 (WTF::TraceScope::~TraceScope):
2845 (WTF::TracePoint): Deleted.
2847 2018-04-16 Andy Estes <aestes@apple.com>
2849 [iOS] Enable WKPDFView by default
2850 https://bugs.webkit.org/show_bug.cgi?id=184675
2851 <rdar://problem/27885452>
2853 Reviewed by Darin Adler.
2855 * wtf/FeatureDefines.h:
2857 2018-04-16 Per Arne Vollan <pvollan@apple.com>
2859 Deactivate the WindowServer connection for the WebContent process.
2860 https://bugs.webkit.org/show_bug.cgi?id=184451
2861 <rdar://problem/38313938>
2863 Reviewed by Brent Fulgham.
2865 Defining ENABLE_WEBPROCESS_WINDOWSERVER_BLOCKING as 1 will deactivate the WindowServer connection
2866 for the WebContent process by enabling the call to 'CGSSetDenyWindowServerConnections(true)' on
2867 process startup. After calling this function, every attempt to establish a connection to the
2868 WindowServer from the WebContent process will fail, except for CA render server connections.
2870 * wtf/FeatureDefines.h:
2872 2018-04-14 Commit Queue <commit-queue@webkit.org>
2874 Unreviewed, rolling out r230659.
2875 https://bugs.webkit.org/show_bug.cgi?id=184633
2877 Landed prematurely (Requested by ap on #webkit).
2881 "Deactivate the WindowServer connection for the WebContent
2883 https://bugs.webkit.org/show_bug.cgi?id=184451
2884 https://trac.webkit.org/changeset/230659
2886 2018-04-14 Per Arne Vollan <pvollan@apple.com>
2888 Deactivate the WindowServer connection for the WebContent process.
2889 https://bugs.webkit.org/show_bug.cgi?id=184451
2890 <rdar://problem/38313938>
2892 Reviewed by Brent Fulgham.
2894 Defining ENABLE_WEBPROCESS_WINDOWSERVER_BLOCKING as 1 will deactivate the WindowServer connection
2895 for the WebContent process by enabling the call to 'CGSSetDenyWindowServerConnections(true)' on
2896 process startup. After calling this function, every attempt to establish a connection to the
2897 WindowServer from the WebContent process will fail, except for CA render server connections.
2899 * wtf/FeatureDefines.h:
2901 2018-04-13 Chris Dumez <cdumez@apple.com>
2903 Split WindowProxy handling out of ScriptController and into a new class owned by AbstractFrame
2904 https://bugs.webkit.org/show_bug.cgi?id=184591
2906 Reviewed by Sam Weinig.
2908 Add isEmpty() convenience method to SizedIteratorRange.
2910 * wtf/IteratorRange.h:
2911 (WTF::SizedIteratorRange::isEmpty const):
2913 2018-04-13 Brady Eidson <beidson@apple.com>
2915 Introduce SuspendedPageProxy to keep old web processes around after their WebPageProxy has been swapped to a new one.
2916 https://bugs.webkit.org/show_bug.cgi?id=184559
2918 Reviewed by Alex Christensen.
2920 * wtf/DebugUtilities.h:
2921 (WTF::debugString): Add a debug utility to easily construct a "const char*" that is released after a spin of the run loop.
2922 This greatly eases uses our String classes and functions inside of "%s" style environments like printf and LOG.
2924 2018-04-12 Michael Catanzaro <mcatanzaro@igalia.com>
2926 Remove unused crash hook functionality
2927 https://bugs.webkit.org/show_bug.cgi?id=183369
2929 Reviewed by Alexey Proskuryakov.
2931 WTFSetCrashHook and WTFInstallReportBacktraceOnCrashHook are not used on any platforms and
2934 * wtf/Assertions.cpp:
2937 2018-04-11 Said Abou-Hallawa <sabouhallawa@apple.com>
2939 Unreviewed, rolling out r230523.
2941 Introduced MotionMark regression
2945 "Deactivate the WindowServer connection for the WebContent
2947 https://bugs.webkit.org/show_bug.cgi?id=184451
2948 https://trac.webkit.org/changeset/230523
2950 2018-04-11 Per Arne Vollan <pvollan@apple.com>
2952 Deactivate the WindowServer connection for the WebContent process.
2953 https://bugs.webkit.org/show_bug.cgi?id=184451
2954 <rdar://problem/38313938>
2956 Reviewed by Brent Fulgham.
2958 Defining ENABLE_WEBPROCESS_WINDOWSERVER_BLOCKING as 1 will deactivate the WindowServer connection
2959 for the WebContent process by enabling the call to 'CGSSetDenyWindowServerConnections(true)' on
2960 process startup. After calling this function, every attempt to establish a connection to the
2961 WindowServer from the WebContent process will fail, except for CA render server connections.
2963 * wtf/FeatureDefines.h:
2965 2018-04-10 Andy Estes <aestes@apple.com>
2967 [iOS] Use PDFKit to render PDFs in WKWebView
2968 https://bugs.webkit.org/show_bug.cgi?id=184387
2970 Reviewed by Beth Dakin.
2972 * wtf/FeatureDefines.h: Defined ENABLE_WKLEGACYPDFVIEW and ENABLE_WKPDFVIEW.
2974 2018-04-09 Mark Lam <mark.lam@apple.com>
2976 Decorate method table entries to support pointer profiling.
2977 https://bugs.webkit.org/show_bug.cgi?id=184430
2978 <rdar://problem/39296190>
2980 Reviewed by Saam Barati.
2982 * wtf/PointerPreparations.h:
2984 2018-04-08 Yusuke Suzuki <utatane.tea@gmail.com>
2986 Unreviewed, use alignas(void*)
2987 https://bugs.webkit.org/show_bug.cgi?id=183508
2989 Very large alignment is not supported in MSVC.
2994 2018-04-08 Yusuke Suzuki <utatane.tea@gmail.com>
2996 Use alignas instead of compiler-specific attributes
2997 https://bugs.webkit.org/show_bug.cgi?id=183508
2999 Reviewed by Mark Lam.
3001 Use alignas for g_gigacageBasePtr. We also add reinterpret_cast to fix
3002 compile errors in ARMv7 and MIPS JSCOnly ports.
3006 (Gigacage::basePtrs):
3008 2018-04-06 Saam Barati <sbarati@apple.com>
3010 bmalloc's tryLargeZeroedMemalignVirtual shouldn't treat the entire virtual size as dirty towards its footprint
3011 https://bugs.webkit.org/show_bug.cgi?id=184207
3013 Reviewed by Mark Lam.
3016 (Gigacage::freeVirtualPages):
3018 2018-04-05 Yusuke Suzuki <utatane.tea@gmail.com>
3020 [WTF] Remove StaticLock
3021 https://bugs.webkit.org/show_bug.cgi?id=184332
3023 Reviewed by Mark Lam.
3025 Now, WTF::StaticLock is `using StaticLock = Lock`. Lock just works
3026 in either static storage and dynamic storage. Remove StaticLock and
3029 We also remove StaticWordLock and StaticReadWriteLock. And we add
3030 WTF::RecursiveLock, which is RecursiveLockAdapter<Lock>.
3032 * wtf/HashTable.cpp:
3033 (WTF::HashTableStats::recordCollisionAtCount):
3034 (WTF::HashTableStats::dumpStats):
3036 (WTF::userPreferredLanguages):
3038 * wtf/MainThread.cpp:
3039 (WTF::dispatchFunctionsFromMainThread):
3040 (WTF::callOnMainThread):
3041 * wtf/ParkingLot.cpp:
3042 * wtf/ReadWriteLock.h:
3043 * wtf/RecursiveLockAdapter.h:
3044 * wtf/StackStats.cpp:
3045 (WTF::StackStats::CheckPoint::CheckPoint):
3046 (WTF::StackStats::CheckPoint::~CheckPoint):
3047 (WTF::StackStats::probe):
3048 (WTF::StackStats::LayoutCheckPoint::LayoutCheckPoint):
3049 (WTF::StackStats::LayoutCheckPoint::~LayoutCheckPoint):
3051 * wtf/ThreadMessage.cpp:
3052 (WTF::sendMessageScoped):
3053 * wtf/ThreadingPthreads.cpp:
3054 * wtf/ThreadingWin.cpp:
3056 * wtf/cf/LanguageCF.cpp:
3057 (WTF::languagePreferencesDidChange):
3058 (WTF::platformUserPreferredLanguages):
3060 * wtf/text/AtomicStringImpl.cpp:
3061 * wtf/text/StringView.cpp:
3062 (WTF::StringView::invalidate):
3063 (WTF::StringView::adoptUnderlyingString):
3064 (WTF::StringView::setUnderlyingString):
3065 * wtf/unicode/icu/CollatorICU.cpp:
3066 (WTF::Collator::Collator):
3067 (WTF::Collator::~Collator):
3068 * wtf/win/LanguageWin.cpp:
3069 (WTF::platformLanguage):
3071 2018-04-04 Brent Fulgham <bfulgham@apple.com>
3073 Failures from mach port reference handling should be fatal
3074 https://bugs.webkit.org/show_bug.cgi?id=184202
3075 <rdar://problem/37771114>
3077 Reviewed by Anders Carlsson.
3079 * WTF.xcodeproj/project.pbxproj:
3080 * wtf/MachSendRight.h: Copied from WebCore/platform/cocoa/MachSendRight.h.
3081 (WebCore::MachSendRight::operator bool const): Deleted.
3082 (WebCore::MachSendRight::sendRight const): Deleted.
3083 * wtf/PlatformMac.cmake:
3084 * wtf/cocoa/CPUTimeCocoa.mm:
3085 (WTF::CPUTime::forCurrentThread): Do proper cleanup if the port is invalid.
3086 * wtf/cocoa/MachSendRight.cpp: Copied from WebCore/platform/cocoa/MachSendRight.cpp.
3087 (WTF::retainSendRight):
3088 (WTF::releaseSendRight):
3089 (WTF::deallocateSendRightSafely):
3090 (WebCore::retainSendRight): Deleted.
3091 (WebCore::releaseSendRight): Deleted.
3092 (WebCore::MachSendRight::adopt): Deleted.
3093 (WebCore::MachSendRight::create): Deleted.
3094 (WebCore::MachSendRight::MachSendRight): Deleted.
3095 (WebCore::MachSendRight::~MachSendRight): Deleted.
3096 (WebCore::MachSendRight::operator=): Deleted.
3097 (WebCore::MachSendRight::copySendRight const): Deleted.
3098 (WebCore::MachSendRight::leakSendRight): Deleted.
3100 2018-04-04 Youenn Fablet <youenn@apple.com>
3102 Introduce a ThreadSafeRefCounted parameter to ensure being destroyed on the main thread
3103 https://bugs.webkit.org/show_bug.cgi?id=183988
3105 Reviewed by Darin Adler.
3107 * wtf/ThreadSafeRefCounted.h:
3108 (WTF::ThreadSafeRefCounted::deref const):
3110 2018-04-04 Yusuke Suzuki <utatane.tea@gmail.com>
3112 [WTF] Remove Atomics.cpp
3113 https://bugs.webkit.org/show_bug.cgi?id=184300
3115 Reviewed by Konstantin Tokarev.
3117 This Atomics.cpp is a workaround for GCC which version is < 4.8.
3118 Our compiler requirement is now 5.0.0. This workaround is no
3121 * wtf/Atomics.cpp: Removed.
3122 * wtf/CMakeLists.txt:
3124 2018-04-03 Tomas Popela <tpopela@redhat.com>
3126 Unreviewed, mute the unused parameter compilation warning
3128 Triggered on the PPC64 machine.
3130 * wtf/ThreadingPthreads.cpp:
3131 (WTF::Thread::signalHandlerSuspendResume):
3133 2018-04-03 Tomas Popela <tpopela@redhat.com>
3135 Unreviewed, fix the unused variable compilation warning
3137 Move the ucontext_t code under the HAVE(MACHINE_CONTEXT). Triggered
3138 on the PPC64 machine.
3140 * wtf/ThreadingPthreads.cpp:
3141 (WTF::Thread::signalHandlerSuspendResume):
3143 2018-04-02 Saam Barati <sbarati@apple.com>
3145 bmalloc should compute its own estimate of its footprint
3146 https://bugs.webkit.org/show_bug.cgi?id=184121
3148 Reviewed by Filip Pizlo.
3150 * wtf/FastMalloc.cpp:
3151 (WTF::fastCommitAlignedMemory):
3152 (WTF::fastDecommitAlignedMemory):
3155 2018-03-30 Filip Pizlo <fpizlo@apple.com>
3157 Strings and Vectors shouldn't do index masking
3158 https://bugs.webkit.org/show_bug.cgi?id=184193
3160 Reviewed by Mark Lam.
3162 * wtf/SizeLimits.cpp:
3164 (WTF::VectorBufferBase::allocateBuffer):
3165 (WTF::VectorBufferBase::tryAllocateBuffer):
3166 (WTF::VectorBufferBase::reallocateBuffer):
3167 (WTF::VectorBufferBase::deallocateBuffer):
3168 (WTF::VectorBufferBase::releaseBuffer):
3169 (WTF::VectorBufferBase::VectorBufferBase):
3170 (WTF::VectorBuffer::allocateBuffer):
3171 (WTF::VectorBuffer::tryAllocateBuffer):
3172 (WTF::VectorBuffer::swap):
3173 (WTF::VectorBuffer::restoreInlineBufferIfNeeded):
3175 (WTF::Vector::at const):
3176 (WTF::VectorBufferBase::updateMask): Deleted.
3177 * wtf/text/StringImpl.h:
3178 (WTF::StringImpl::flagIsSymbol):
3179 (WTF::StringImpl::length const):
3180 (WTF::StringImplShape::StringImplShape):
3181 (WTF::StringImpl::at const):
3182 (WTF::StringImpl::tailOffset):
3183 (WTF::StringImpl::maskOffset): Deleted.
3184 (WTF::StringImpl::mask const): Deleted.
3185 * wtf/text/StringView.h:
3186 (WTF::StringView::StringView):
3187 (WTF::StringView::operator=):
3188 (WTF::StringView::initialize):
3189 (WTF::StringView::clear):
3190 (WTF::StringView::operator[] const):
3191 * wtf/text/WTFString.h:
3192 (WTF::String::length const):
3193 (WTF::String::mask const): Deleted.
3195 2018-03-30 Mark Lam <mark.lam@apple.com>
3197 Add pointer profiling support in baseline JIT and supporting files.
3198 https://bugs.webkit.org/show_bug.cgi?id=184200
3199 <rdar://problem/39057300>
3201 Reviewed by Filip Pizlo.
3203 * wtf/PointerPreparations.h:
3204 - Remove WTF_PREPARE_FUNCTION_POINTER_FOR_EXECUTION. It is no longer needed.
3206 2018-03-30 JF Bastien <jfbastien@apple.com>
3208 WorkQueueWin: don't move rvalues
3209 https://bugs.webkit.org/show_bug.cgi?id=184190
3210 <rdar://problem/39049850>
3212 Reviewed by Mark Lam.
3214 As part of #184167 optional is now more frequently an rvalue
3215 reference, and moving its .value() is not a thing that should be
3218 * wtf/win/WorkQueueWin.cpp:
3219 (WTF::WorkQueue::unregisterAndCloseHandle):
3221 2018-03-30 JF Bastien <jfbastien@apple.com>
3223 Remove CXX_REFERENCE_QUALIFIED_FUNCTIONS and optional's equivalent
3224 https://bugs.webkit.org/show_bug.cgi?id=184167
3225 <rdar://problem/39023130>
3227 Reviewed by Yusuke Suzuki.
3229 Remove COMPILER_SUPPORTS(CXX_REFERENCE_QUALIFIED_FUNCTIONS), it's
3230 supported by all compilers WebKit supports (it's a C++11 feature,
3231 *detection* of it with __has_extension was added to clang on May
3232 13th 2011, and VS2015 / GCC support it).
3234 Optional.h had a similar thing, ditch it too.
3238 (std::optional::contained_val const):
3239 (std::optional::contained_val):
3242 * wtf/text/WTFString.cpp:
3243 * wtf/text/WTFString.h:
3245 2018-03-30 JF Bastien <jfbastien@apple.com>
3247 Introduce WTF_LAZY_INSTANTIATE
3248 https://bugs.webkit.org/show_bug.cgi?id=184169
3249 <rdar://problem/39023385>
3251 Reviewed by Mark Lam.
3253 As part of #184164 I'm adding some forwarding methods to
3254 WTF::String. These need to forward RetainPtr and CString, and
3255 usually that would require #include'ing RetainPtr.h and CString.h
3256 to WTFString.h which isn't really something we should do.
3258 Introduce WTF_LAZY_INSTANTIATE to forward-declare functions which
3259 just pass parameters to another function, and return whatever that
3260 other function returned, without having to include the return's /
3261 parameters' type header.
3263 Try it out here: godbolt.org/g/oV8G5Q
3267 2018-03-29 JF Bastien <jfbastien@apple.com>
3269 Use Forward.h instead of forward-declaring WTF::String
3270 https://bugs.webkit.org/show_bug.cgi?id=184172
3271 <rdar://problem/39026146>
3273 Reviewed by Yusuke Suzuki.
3275 As part of #184164 I'm changing WTF::String, and the forward
3276 declarations are just wrong because I'm making it templated. We
3277 should use Forward.h anyways, so do that instead.
3281 * wtf/PrintStream.h:
3283 2018-03-29 Yusuke Suzuki <utatane.tea@gmail.com>
3285 Remove WTF_EXPORTDATA and JS_EXPORTDATA
3286 https://bugs.webkit.org/show_bug.cgi?id=184170
3288 Reviewed by JF Bastien.
3290 Replace WTF_EXPORTDATA and JS_EXPORTDATA with
3291 WTF_EXPORT_PRIVATE and JS_EXPORT_PRIVATE respectively.
3293 * wtf/ExportMacros.h:
3297 * wtf/text/AtomicString.cpp:
3298 * wtf/text/AtomicString.h:
3299 * wtf/text/StringImpl.h:
3301 2018-03-29 Ross Kirsling <ross.kirsling@sony.com>
3303 MSVC __forceinline slows down JSC release build fivefold after r229391
3304 https://bugs.webkit.org/show_bug.cgi?id=184062
3306 Reviewed by Alex Christensen.
3309 Add ALWAYS_INLINE_EXCEPT_MSVC to support MSVC optimizer sensitivities.
3311 2018-03-29 JF Bastien <jfbastien@apple.com>
3313 Remove WTF_EXPORT_STRING_API
3314 https://bugs.webkit.org/show_bug.cgi?id=184168
3315 <rdar://problem/39023253>
3317 Reviewed by Yusuke Suzuki.
3319 Remove WTF_EXPORT_STRING_API as requested by a FIXME, and use
3320 WTF_EXPORT_PRIVATE instead.
3322 * wtf/ExportMacros.h:
3323 * wtf/text/AtomicString.h:
3324 * wtf/text/AtomicStringImpl.h:
3325 * wtf/text/StringImpl.h:
3326 * wtf/text/StringView.h:
3327 * wtf/text/SymbolImpl.h:
3328 * wtf/text/WTFString.h:
3330 2018-03-29 Commit Queue <commit-queue@webkit.org>
3332 Unreviewed, rolling out r230062.
3333 https://bugs.webkit.org/show_bug.cgi?id=184128
3335 Broke mac port. web content process crashes while loading any
3336 web page (Requested by rniwa on #webkit).
3340 "MSVC __forceinline slows down JSC release build fivefold
3342 https://bugs.webkit.org/show_bug.cgi?id=184062
3343 https://trac.webkit.org/changeset/230062
3345 2018-03-28 Ross Kirsling <ross.kirsling@sony.com>
3347 MSVC __forceinline slows down JSC release build fivefold after r229391
3348 https://bugs.webkit.org/show_bug.cgi?id=184062
3350 Reviewed by Alex Christensen.
3353 Add ALWAYS_INLINE_EXCEPT_MSVC to support MSVC optimizer sensitivities.
3355 2018-03-28 Fujii Hironori <Hironori.Fujii@sony.com>
3357 [Win] Assertions.h: VC doesn't support GCC extension ##__VA_ARGS__
3358 https://bugs.webkit.org/show_bug.cgi?id=184076
3360 Reviewed by Alex Christensen.
3362 ##__VA_ARGS__ is used to define RELEASE_LOG, RELEASE_LOG_ERROR,
3363 RELEASE_LOG_IF, RELEASE_LOG_ERROR_IF, RELEASE_LOG_WITH_LEVEL,
3364 RELEASE_LOG_WITH_LEVEL_IF and RELEASE_LOG_INFO_IF.
3366 A macro using ##__VA_ARGS__,
3368 #define foo(format, ...) bar(format, ##__VA_ARGS__)
3370 can be defined without ##__VA_ARGS__:
3372 #define foo(...) bar(__VA_ARGS__)
3374 * wtf/Assertions.h: Use __VA_ARGS__ instead of ##__VA_ARGS__.
3376 2018-03-28 Brent Fulgham <bfulgham@apple.com>
3378 Avoid uninitialized mach ports
3379 https://bugs.webkit.org/show_bug.cgi?id=184090
3380 <rdar://problem/37261129>
3382 Reviewed by Chris Dumez.
3384 It is possible for mach_port_allocate to return an error, but we rarely check its return value. The value
3385 of the argument passed to mach_port_allocate is not guaranteed to be valid when it returns an error, so
3386 there is a potential for us to try to use invalid ports.
3388 We should always check return values, and ensure that the mach port variables we seek to initialize are
3389 kept in a valid state.
3391 Reviewed by Chris Dumez.
3393 * wtf/Threading.h: Initialize mach port.
3395 2018-03-28 Robin Morisset <rmorisset@apple.com>
3397 appendQuotedJSONString stops on arithmetic overflow instead of propagating it upwards
3398 https://bugs.webkit.org/show_bug.cgi?id=183894
3400 Reviewed by Saam Barati.
3402 appendQuotedJSONString now returns a bool indicating whether it succeeded, instead of silently failing when given a string too large
3405 * wtf/text/StringBuilder.h:
3406 * wtf/text/StringBuilderJSON.cpp:
3407 (WTF::StringBuilder::appendQuotedJSONString):
3409 2018-03-27 Per Arne Vollan <pvollan@apple.com>
3411 The layout test fast/canvas/webgl/read-pixels-test.html is timing out.
3412 https://bugs.webkit.org/show_bug.cgi?id=183923
3413 <rdar://problem/38756869>
3415 Reviewed by Brent Fulgham.
3417 Add compile guard for blocking of the WindowServer in the WebProcess.
3419 * wtf/FeatureDefines.h:
3421 2018-03-26 Tim Horton <timothy_horton@apple.com>
3423 Add and adopt HAVE(CORE_ANIMATION_RENDER_SERVER)
3424 https://bugs.webkit.org/show_bug.cgi?id=184026
3425 <rdar://problem/38883321>
3427 Reviewed by Sam Weinig.
3431 2018-03-26 Yusuke Suzuki <utatane.tea@gmail.com>
3433 We should have SSE4 detection in the X86 MacroAssembler.
3434 https://bugs.webkit.org/show_bug.cgi?id=165363
3436 Reviewed by JF Bastien.
3438 GCC 5 supports clobbering PIC registers in inline ASM [1,2].
3440 [1]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47602
3441 [2]: https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=216154
3446 2018-03-26 Antoine Quint <graouts@apple.com>
3448 [ASan] Allow Ref<> to be swapped
3449 https://bugs.webkit.org/show_bug.cgi?id=184017
3450 <rdar://problem/36336787>
3452 Reviewed by JF Bastien.
3454 Unpoison a Ref in various calls just like in ~Ref so that sorting a Vector<Ref<>> works with ASan on.
3457 (WTF::Ref::assignToHashTableEmptyValue):
3461 2018-03-26 Brent Fulgham <bfulgham@apple.com>
3463 Warn against cookie access in the WebContent process using ProcessPrivilege assertions
3464 https://bugs.webkit.org/show_bug.cgi?id=183911
3465 <rdar://problem/38762306>
3467 Reviewed by Youenn Fablet.
3469 Extend the ProcessPrivilege API with the ability to add and remove individual
3472 * wtf/ProcessPrivilege.cpp:
3473 (WTF::addProcessPrivilege):
3474 (WTF::removeProcessPrivilege):
3475 * wtf/ProcessPrivilege.h:
3477 2018-03-25 Carlos Alberto Lopez Perez <clopez@igalia.com>
3479 WebProcess memory monitor: use %zu format specifier for size_t
3480 https://bugs.webkit.org/show_bug.cgi?id=183997
3482 Reviewed by Michael Catanzaro.
3484 usse %zu format specifier for size_t instead of %lu.
3486 * wtf/MemoryPressureHandler.cpp:
3487 (WTF::MemoryPressureHandler::shrinkOrDie):
3488 (WTF::MemoryPressureHandler::measurementTimerFired):
3490 2018-03-25 Tim Horton <timothy_horton@apple.com>
3492 Add and adopt ENABLE(AIRPLAY_PICKER)
3493 https://bugs.webkit.org/show_bug.cgi?id=183992
3495 Reviewed by Daniel Bates.
3497 * wtf/FeatureDefines.h:
3499 2018-03-23 Tim Horton <timothy_horton@apple.com>
3501 Introduce and adopt HAVE(AUDIO_TOOLBOX_AUDIO_SESSION)
3502 https://bugs.webkit.org/show_bug.cgi?id=183954
3503 <rdar://problem/38808858>
3505 Reviewed by Dan Bernstein.
3509 2018-03-23 David Kilzer <ddkilzer@apple.com>
3511 Stop using dispatch_set_target_queue()
3512 <https://webkit.org/b/183908>
3513 <rdar://problem/33553533>
3515 Reviewed by Daniel Bates.
3517 * wtf/cocoa/WorkQueueCocoa.cpp:
3518 (WTF::WorkQueue::platformInitialize): Remove !HAVE(QOS_CLASSES)
3519 code path since it's never used now that HAVE(QOS_CLASSES) is
3520 equivalent to PLATFORM(COCOA) in <wtf/Platform.h>.
3522 2018-03-23 Carlos Alberto Lopez Perez <clopez@igalia.com>
3524 WebProcess memory monitor thresholds should be better tuned for embedded systems.
3525 https://bugs.webkit.org/show_bug.cgi?id=183773
3527 Reviewed by Yusuke Suzuki.
3529 Take into account the total system RAM for the thresholds calculation.
3531 For systems with more than 3GB the conservative and strict thresholds remain as they are,
3532 but for systems with less RAM the thresholds are dynamically configured as follows:
3534 - Conservative threshold (release non critical memory) if WebProcess using more than 33% of the total RAM.
3535 - Strict threshold (release all possible memory) if WebProcess using more than 50% of the total RAM.
3537 The Kill threshold is also modified. Now it is capped at 90% of the total RAM.
3539 * wtf/MemoryPressureHandler.cpp:
3540 (WTF::thresholdForMemoryKillWithProcessState):
3541 (WTF::thresholdForPolicy):
3542 (WTF::MemoryPressureHandler::shrinkOrDie):
3544 2018-03-23 Yusuke Suzuki <utatane.tea@gmail.com>
3546 [WTF] Add standard containers with FastAllocator specialization
3547 https://bugs.webkit.org/show_bug.cgi?id=183789
3549 Reviewed by Darin Adler.
3551 Sometimes we want standard containers due to various reasons.
3552 For example, WTF::HashMap lacks the ability to hold all the
3553 integer keys since it uses 0 for empty value and -1 for deleted
3554 value. However, using std::containers use std::allocator without
3557 This patch introduces WTF::{StdMap, StdSet, StdList, StdUnorderedMap, StdUnorderedSet}.
3558 They are standard containers with FastAllocator specialization.
3560 * WTF.xcodeproj/project.pbxproj:
3561 * wtf/CMakeLists.txt:
3562 * wtf/StdList.h: Copied from Source/JavaScriptCore/runtime/TypeLocationCache.h.
3563 * wtf/StdMap.h: Copied from Source/JavaScriptCore/runtime/TypeLocationCache.h.
3564 * wtf/StdSet.h: Copied from Source/JavaScriptCore/runtime/TypeLocationCache.h.
3565 * wtf/StdUnorderedMap.h: Copied from Source/JavaScriptCore/runtime/TypeLocationCache.h.
3566 * wtf/StdUnorderedSet.h: Copied from Source/JavaScriptCore/runtime/TypeLocationCache.h.
3568 2018-03-22 Tim Horton <timothy_horton@apple.com>
3570 Adopt USE(OPENGL[_ES]) in more places
3571 https://bugs.webkit.org/show_bug.cgi?id=183882
3572 <rdar://problem/37912195>
3574 Reviewed by Dan Bernstein.
3578 2018-03-20 Brent Fulgham <bfulgham@apple.com>
3580 Create an assertion mechanism to ensure proper WebCore use in each WebKit Process
3581 https://bugs.webkit.org/show_bug.cgi?id=183806
3582 <rdar://problem/38694251>
3584 Reviewed by Ryosuke Niwa.
3586 Part of our security improvements involve better isolation between the different WebKit
3587 processes (UIProcess, WebContent, Networking, Storage, etc.).
3589 We need an assertion language we can use to protect certain critical APIs and code paths
3590 against accidental misuse.
3592 This patch adds a new enum type meant to represent different categories of program logic
3593 that we do not want used in the wrong process.
3595 This first patch just creates these types and makes them available. New assertions using
3596 these values will be added as we complete our work ensuring proper process isolation.
3598 In a method we want to protect, we can add an assertion describing the process privileges
3599 needed to execute the code. For example, for cookie access we might use this:
3601 ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessRawCookies);
3603 At the launch of the UIProcess we would use this method to ensure all privileges are available:
3605 setProcessPrivileges(allPrivileges());
3607 In the network process, during platform initialization, we would use something like this:
3609 setProcessPrivileges({ ProcessPrivilege::CanAccessRawCookies, ProcessPrivilege::CanAccessCredentials });
3611 In the WebContent process, we would not set any privileges. We could just leave it as the
3612 default initialization, or use this:
3614 setProcessPrivileges({ });
3616 Later, when we attempt to execute the initial code, we would expect an assertion for the
3617 WebContent process, while Network and UIProcess pass the assertion.
3619 * WTF.xcodeproj/project.pbxproj: Add new files.
3620 * wtf/CMakeLists.txt: Ditto.
3621 * wtf/ProcessPrivilege.cpp: Added.
3622 (WTF::processPrivileges):
3623 (WTF::setProcessPrivileges):
3624 (WTF::hasProcessPrivilege):
3625 * wtf/ProcessPrivilege.h: Added.
3627 2018-03-20 Tim Horton <timothy_horton@apple.com>
3629 Introduce HAVE_MEDIA_PLAYER and HAVE_CORE_VIDEO
3630 https://bugs.webkit.org/show_bug.cgi?id=183803
3631 <rdar://problem/38690487>
3633 Reviewed by Sam Weinig.
3637 2018-03-20 Brian Burg <bburg@apple.com>
3639 SLEEP_THREAD_FOR_DEBUGGER should not use fancy number literals
3640 https://bugs.webkit.org/show_bug.cgi?id=183792
3642 Reviewed by Timothy Hatcher.
3644 * wtf/DebugUtilities.h: Remove the '_s' since this won't
3645 compile when included by files compiled as Objective-C++.