1 2017-07-03 Matt Lewis <jlewis3@apple.com>
3 Unreviewed, rolling out r219103.
5 Caused multiple build failures.
9 "Remove copy of ICU headers from WebKit"
10 https://bugs.webkit.org/show_bug.cgi?id=116407
11 http://trac.webkit.org/changeset/219103
13 2017-07-03 Myles C. Maxfield <mmaxfield@apple.com>
15 Remove copy of ICU headers from WebKit
16 https://bugs.webkit.org/show_bug.cgi?id=116407
18 Reviewed by Alex Christensen.
20 Add an extra rsync command to CopyWTFHeaders which copies the ICU headers
21 to DSTROOT/usr/local/include/. These headers already live inside a
22 "unicode" folder, so an example path of a header is
23 DSTROOT/usr/local/include/unicode/uchar.h. This is already in the search
24 path of the other WebKit projects, so those other projects can remove
25 their explicit listing of the old place these headers lived.
27 Also add the remaining ICU 55.1 headers which the other projects (like
28 WebCore) need. Revert any local changes to these headers in favor of
29 using the GCC_PREPROCESSOR_DEFINITIONS build setting. This is so we can
30 compile the same way against unmodified headers.
32 * Configurations/Base.xcconfig:
33 * Configurations/CopyWTFHeaders.xcconfig:
34 * WTF.xcodeproj/project.pbxproj:
35 * icu/unicode/alphaindex.h: Added.
36 * icu/unicode/appendable.h: Added.
37 * icu/unicode/basictz.h: Added.
38 * icu/unicode/brkiter.h: Added.
39 (BreakIterator::isBufferClone):
40 * icu/unicode/bytestrie.h: Added.
41 * icu/unicode/bytestriebuilder.h: Added.
42 * icu/unicode/calendar.h: Added.
43 (Calendar::createInstance):
45 (Calendar::internalSet):
46 (Calendar::weekNumber):
47 * icu/unicode/caniter.h: Added.
48 * icu/unicode/chariter.h: Renamed from Source/WebCore/icu/unicode/chariter.h.
49 * icu/unicode/choicfmt.h: Added.
50 * icu/unicode/coleitr.h: Added.
51 (CollationElementIterator::primaryOrder):
52 (CollationElementIterator::secondaryOrder):
53 (CollationElementIterator::tertiaryOrder):
54 (CollationElementIterator::isIgnorable):
55 * icu/unicode/coll.h: Added.
56 * icu/unicode/compactdecimalformat.h: Added.
57 * icu/unicode/curramt.h: Added.
58 (CurrencyAmount::getCurrency):
59 (CurrencyAmount::getISOCurrency):
60 * icu/unicode/currpinf.h: Added.
61 (CurrencyPluralInfo::operator!=):
62 * icu/unicode/currunit.h: Added.
63 (CurrencyUnit::getISOCurrency):
64 * icu/unicode/datefmt.h: Added.
65 * icu/unicode/dbbi.h: Added.
66 * icu/unicode/dcfmtsym.h: Added.
67 (DecimalFormatSymbols::getSymbol):
68 (DecimalFormatSymbols::getConstSymbol):
69 (DecimalFormatSymbols::setSymbol):
70 (DecimalFormatSymbols::getLocale):
71 (DecimalFormatSymbols::getCurrencyPattern):
72 * icu/unicode/decimfmt.h: Added.
73 (DecimalFormat::getConstSymbol):
74 * icu/unicode/docmain.h: Added.
75 * icu/unicode/dtfmtsym.h: Added.
76 * icu/unicode/dtintrv.h: Added.
77 (DateInterval::getFromDate):
78 (DateInterval::getToDate):
79 (DateInterval::operator!=):
80 * icu/unicode/dtitvfmt.h: Added.
81 (DateIntervalFormat::operator!=):
82 * icu/unicode/dtitvinf.h: Added.
83 (DateIntervalInfo::operator!=):
84 * icu/unicode/dtptngen.h: Added.
85 * icu/unicode/dtrule.h: Added.
86 * icu/unicode/enumset.h: Added.
95 (EnumSet::isValidEnum):
96 (EnumSet::isValidValue):
100 * icu/unicode/errorcode.h: Added.
101 * icu/unicode/fieldpos.h: Added.
102 (FieldPosition::operator=):
103 (FieldPosition::operator==):
104 (FieldPosition::operator!=):
105 * icu/unicode/filteredbrk.h: Added.
106 * icu/unicode/fmtable.h: Added.
107 (Formattable::getDate):
108 (Formattable::getString):
109 (Formattable::getLong):
110 (Formattable::toUFormattable):
111 (Formattable::fromUFormattable):
112 * icu/unicode/format.h: Added.
113 * icu/unicode/fpositer.h: Added.
114 * icu/unicode/gender.h: Added.
115 * icu/unicode/gregocal.h: Added.
116 * icu/unicode/icudataver.h: Added.
117 * icu/unicode/icuplug.h: Added.
118 * icu/unicode/idna.h: Added.
119 * icu/unicode/listformatter.h: Added.
120 (ListFormatData::ListFormatData):
121 * icu/unicode/locdspnm.h: Added.
122 (LocaleDisplayNames::createInstance):
123 * icu/unicode/locid.h: Added.
124 (Locale::operator!=):
125 (Locale::getCountry):
126 (Locale::getLanguage):
128 (Locale::getVariant):
131 * icu/unicode/measfmt.h: Added.
132 * icu/unicode/measunit.h: Added.
133 * icu/unicode/measure.h: Added.
134 (Measure::getNumber):
136 * icu/unicode/messagepattern.h: Added.
137 * icu/unicode/msgfmt.h: Added.
138 * icu/unicode/normalizer2.h: Added.
139 * icu/unicode/normlzr.h: Added.
140 (Normalizer::operator!= ):
141 (Normalizer::quickCheck):
142 (Normalizer::isNormalized):
143 (Normalizer::compare):
144 * icu/unicode/numfmt.h: Added.
145 (NumberFormat::isParseIntegerOnly):
146 (NumberFormat::isLenient):
147 * icu/unicode/numsys.h: Added.
148 * icu/unicode/parsepos.h: Added.
149 (ParsePosition::operator=):
150 (ParsePosition::operator==):
151 (ParsePosition::operator!=):
152 (ParsePosition::getIndex):
153 (ParsePosition::setIndex):
154 (ParsePosition::getErrorIndex):
155 (ParsePosition::setErrorIndex):
156 * icu/unicode/plurfmt.h: Added.
157 * icu/unicode/plurrule.h: Added.
158 * icu/unicode/rbbi.h: Added.
159 (RuleBasedBreakIterator::operator!=):
160 * icu/unicode/rbnf.h: Added.
161 (RuleBasedNumberFormat::isLenient):
162 (RuleBasedNumberFormat::getDefaultRuleSet):
163 * icu/unicode/rbtz.h: Added.
164 * icu/unicode/regex.h: Added.
165 * icu/unicode/region.h: Added.
166 * icu/unicode/reldatefmt.h: Added.
167 * icu/unicode/resbund.h: Added.
168 * icu/unicode/schriter.h: Added.
169 * icu/unicode/scientificnumberformatter.h: Added.
170 * icu/unicode/search.h: Added.
171 (SearchIterator::operator!=):
172 * icu/unicode/selfmt.h: Added.
173 * icu/unicode/simpletz.h: Added.
174 (SimpleTimeZone::setStartRule):
175 (SimpleTimeZone::setEndRule):
176 (SimpleTimeZone::getOffset):
177 * icu/unicode/smpdtfmt.h: Added.
178 (SimpleDateFormat::get2DigitYearStart):
179 * icu/unicode/sortkey.h: Added.
180 (CollationKey::operator!=):
181 (CollationKey::isBogus):
182 (CollationKey::getByteArray):
183 * icu/unicode/stringtriebuilder.h: Added.
184 * icu/unicode/stsearch.h: Added.
185 * icu/unicode/symtable.h: Added.
186 * icu/unicode/tblcoll.h: Added.
187 * icu/unicode/timezone.h: Added.
190 * icu/unicode/tmunit.h: Added.
191 * icu/unicode/tmutamt.h: Added.
192 (TimeUnitAmount::operator!=):
193 * icu/unicode/tmutfmt.h: Added.
194 (TimeUnitFormat::operator!=):
195 * icu/unicode/translit.h: Added.
196 (Transliterator::getMaximumContextLength):
197 (Transliterator::setID):
198 (Transliterator::integerToken):
199 (Transliterator::pointerToken):
200 * icu/unicode/tzfmt.h: Added.
201 * icu/unicode/tznames.h: Added.
202 * icu/unicode/tzrule.h: Added.
203 * icu/unicode/tztrans.h: Added.
204 * icu/unicode/ubidi.h: Added.
205 * icu/unicode/ucal.h: Renamed from Source/JavaScriptCore/icu/unicode/ucal.h.
206 * icu/unicode/ucasemap.h: Added.
207 * icu/unicode/ucat.h: Added.
208 * icu/unicode/ucharstrie.h: Added.
209 * icu/unicode/ucharstriebuilder.h: Added.
210 * icu/unicode/uchriter.h: Added.
211 * icu/unicode/uclean.h: Added.
212 * icu/unicode/ucnv_cb.h: Renamed from Source/WebCore/icu/unicode/ucnv_cb.h.
213 * icu/unicode/ucnvsel.h: Added.
214 * icu/unicode/ucoleitr.h: Renamed from Source/WebCore/icu/unicode/ucoleitr.h.
215 * icu/unicode/uconfig.h:
216 * icu/unicode/ucsdet.h: Renamed from Source/WebCore/icu/unicode/ucsdet.h.
217 * icu/unicode/udat.h: Renamed from Source/JavaScriptCore/icu/unicode/udat.h.
218 * icu/unicode/udata.h: Added.
219 * icu/unicode/udateintervalformat.h: Added.
220 * icu/unicode/udatpg.h: Renamed from Source/JavaScriptCore/icu/unicode/udatpg.h.
221 * icu/unicode/udisplaycontext.h: Renamed from Source/JavaScriptCore/icu/unicode/udisplaycontext.h.
222 * icu/unicode/ufieldpositer.h: Renamed from Source/JavaScriptCore/icu/unicode/ufieldpositer.h.
223 * icu/unicode/uformattable.h: Renamed from Source/JavaScriptCore/icu/unicode/uformattable.h.
224 * icu/unicode/ugender.h: Added.
225 * icu/unicode/uidna.h: Renamed from Source/WebCore/icu/unicode/uidna.h.
226 * icu/unicode/uldnames.h: Added.
227 * icu/unicode/ulistformatter.h: Added.
228 * icu/unicode/ulocdata.h: Added.
229 * icu/unicode/umisc.h: Renamed from Source/JavaScriptCore/icu/unicode/umisc.h.
230 * icu/unicode/umsg.h: Added.
231 * icu/unicode/unifilt.h: Added.
232 * icu/unicode/unifunct.h: Added.
233 * icu/unicode/unimatch.h: Added.
234 * icu/unicode/unirepl.h: Added.
235 * icu/unicode/uniset.h: Added.
236 (UnicodeSet::operator!=):
237 (UnicodeSet::isFrozen):
238 (UnicodeSet::containsSome):
239 (UnicodeSet::isBogus):
240 (UnicodeSet::fromUSet):
241 (UnicodeSet::toUSet):
243 (UnicodeSet::spanBack):
244 * icu/unicode/unum.h: Renamed from Source/JavaScriptCore/icu/unicode/unum.h.
245 * icu/unicode/unumsys.h: Renamed from Source/JavaScriptCore/icu/unicode/unumsys.h.
246 * icu/unicode/upluralrules.h: Added.
247 * icu/unicode/uregex.h: Added.
248 * icu/unicode/uregion.h: Added.
249 * icu/unicode/urep.h: Added.
250 * icu/unicode/ures.h: Added.
251 (ures_getUnicodeString):
252 (ures_getNextUnicodeString):
253 (ures_getUnicodeStringByIndex):
254 (ures_getUnicodeStringByKey):
255 * icu/unicode/usearch.h: Renamed from Source/WebCore/icu/unicode/usearch.h.
256 * icu/unicode/usetiter.h: Added.
257 (UnicodeSetIterator::isString):
258 (UnicodeSetIterator::getCodepoint):
259 (UnicodeSetIterator::getCodepointEnd):
260 * icu/unicode/ushape.h: Renamed from Source/WebCore/icu/unicode/ushape.h.
261 * icu/unicode/usprep.h: Added.
262 * icu/unicode/ustdio.h: Added.
263 * icu/unicode/ustream.h: Added.
264 * icu/unicode/ustringtrie.h: Added.
265 * icu/unicode/utf32.h: Added.
266 * icu/unicode/utmscale.h: Added.
267 * icu/unicode/utrace.h: Added.
268 * icu/unicode/utrans.h: Added.
269 * icu/unicode/utypes.h:
270 * icu/unicode/vtzone.h: Added.
272 2017-07-03 Keith Miller <keith_miller@apple.com>
274 Fix ifndef in Assertions.h
275 https://bugs.webkit.org/show_bug.cgi?id=174104
277 Reviewed by Saam Barati.
279 The ifndef should have been checking for
280 CRASH_WITH_SECURITY_IMPLICATION_AND_INFO since that is what the
285 2017-07-03 Andy Estes <aestes@apple.com>
287 [Xcode] Add an experimental setting to build with ccache
288 https://bugs.webkit.org/show_bug.cgi?id=173875
290 Reviewed by Tim Horton.
292 * Configurations/DebugRelease.xcconfig: Included ccache.xcconfig.
294 2017-07-03 Daewoong Jang <daewoong.jang@navercorp.com>
296 Remove an unused function export
297 https://bugs.webkit.org/show_bug.cgi?id=174084
299 Reviewed by Yusuke Suzuki.
303 2017-07-02 Yusuke Suzuki <utatane.tea@gmail.com>
305 WTF::Thread should have the threads stack bounds.
306 https://bugs.webkit.org/show_bug.cgi?id=173975
308 Reviewed by Mark Lam.
310 We move StackBounds from WTFThreadData to WTF::Thread.
311 One important thing is that we should make valid StackBounds
312 visible to Thread::create() caller. When the caller get
313 WTF::Thread from Thread::create(), this WTF::Thread should
314 have a valid StackBounds. But StackBounds information can be
315 retrived only in the WTF::Thread's thread itself.
318 (WTF::StackBounds::emptyBounds):
319 (WTF::StackBounds::StackBounds):
320 * wtf/StackStats.cpp:
321 (WTF::StackStats::PerThreadStats::PerThreadStats):
323 (WTF::threadEntryPoint):
324 (WTF::Thread::create):
325 (WTF::Thread::currentMayBeNull):
326 (WTF::Thread::initialize):
328 (WTF::Thread::stack):
329 * wtf/ThreadingPthreads.cpp:
330 (WTF::Thread::initializeCurrentThreadEvenIfNonWTFCreated):
331 (WTF::Thread::current):
332 (WTF::initializeCurrentThreadEvenIfNonWTFCreated): Deleted.
333 (WTF::Thread::currentMayBeNull): Deleted.
334 * wtf/ThreadingWin.cpp:
335 (WTF::Thread::initializeCurrentThreadEvenIfNonWTFCreated):
336 (WTF::Thread::initializeCurrentThreadInternal):
337 (WTF::Thread::current):
338 * wtf/WTFThreadData.cpp:
339 (WTF::WTFThreadData::WTFThreadData):
340 * wtf/WTFThreadData.h:
341 (WTF::WTFThreadData::stack): Deleted.
343 2017-07-01 Dan Bernstein <mitz@apple.com>
345 [iOS] Remove code only needed when building for iOS 9.x
346 https://bugs.webkit.org/show_bug.cgi?id=174068
348 Reviewed by Tim Horton.
351 * wtf/mac/DeprecatedSymbolsUsedBySafari.mm:
352 * wtf/spi/darwin/dyldSPI.h:
354 2017-07-01 Caio Lima <ticaiolima@gmail.com>
356 [JSC] WTFGetBacktrace can return numberOfFrames == 0 in some architectures
357 https://bugs.webkit.org/show_bug.cgi?id=172768
359 Reviewed by Mark Lam.
361 In some architectures, like ARMv6 running on a Raspberry pi, the
362 backtrace function from "execinfo.h" is returning 0. In
363 that case, the RELEASE_ASSERT in StackTrace::captureStackTrace
364 fails causing a runtime crash.
365 This patch is adding a guard for the case described above to
366 avoid a runtime crash in such case.
368 * wtf/StackTrace.cpp:
369 (WTF::StackTrace::captureStackTrace):
371 2017-07-01 Dan Bernstein <mitz@apple.com>
373 [macOS] Remove code only needed when building for OS X Yosemite
374 https://bugs.webkit.org/show_bug.cgi?id=174067
376 Reviewed by Tim Horton.
378 * Configurations/Base.xcconfig:
379 * Configurations/DebugRelease.xcconfig:
381 * wtf/mac/AppKitCompatibilityDeclarations.h:
382 * wtf/spi/cocoa/SecuritySPI.h:
383 * wtf/text/TextBreakIterator.cpp:
385 2017-07-01 Joseph Pecoraro <pecoraro@apple.com>
387 Add a warning if WEBGL2 is enabled without WEBGL
388 https://bugs.webkit.org/show_bug.cgi?id=174054
390 Reviewed by Sam Weinig.
392 * wtf/FeatureDefines.h:
394 2017-06-30 Keith Miller <keith_miller@apple.com>
396 Force crashWithInfo to be out of line.
397 https://bugs.webkit.org/show_bug.cgi?id=174028
399 Reviewed by Filip Pizlo.
401 The first pass at making crashes hold information about why they
402 were crashing had the problem that it would inline the assertion.
403 This meant that clang could coalesce DFG_ASSERTS with other
404 assertion failures in the same function. This patch moves it out
405 of line to help fix that issue.
407 * wtf/Assertions.cpp:
410 (WTF::isIntegralType):
412 2017-06-30 Yusuke Suzuki <utatane.tea@gmail.com>
414 [WTF] Drop SymbolRegistry::keyForSymbol
415 https://bugs.webkit.org/show_bug.cgi?id=174052
417 Reviewed by Sam Weinig.
419 Since we can know whether a given symbol is registered by checking RegisteredSymbolImpl,
420 we do not need to query key string for a given symbol by using SymbolRegistry::keyForSymbol.
422 * wtf/text/SymbolImpl.h:
423 (WTF::SymbolImpl::extractFoldedString): Deleted.
424 * wtf/text/SymbolRegistry.cpp:
425 (WTF::SymbolRegistry::keyForSymbol): Deleted.
426 * wtf/text/SymbolRegistry.h:
428 2017-06-29 Jer Noble <jer.noble@apple.com>
430 Make Legacy EME API controlled by RuntimeEnabled setting.
431 https://bugs.webkit.org/show_bug.cgi?id=173994
433 Reviewed by Sam Weinig.
435 * wtf/FeatureDefines.h:
437 2017-06-30 Ryosuke Niwa <rniwa@webkit.org>
439 Ran sort-Xcode-project-file.
441 * WTF.xcodeproj/project.pbxproj:
443 2017-06-30 Matt Lewis <jlewis3@apple.com>
445 Unreviewed, rolling out r218992.
447 The patch broke the iOS device builds.
451 "DFG_ASSERT should allow stuffing registers before trapping."
452 https://bugs.webkit.org/show_bug.cgi?id=174005
453 http://trac.webkit.org/changeset/218992
455 2017-06-30 Keith Miller <keith_miller@apple.com>
457 DFG_ASSERT should allow stuffing registers before trapping.
458 https://bugs.webkit.org/show_bug.cgi?id=174005
460 Reviewed by Mark Lam.
462 Add new template functions that enable stuffing up to five values
463 into registers before crashing.
468 2017-06-28 Brent Fulgham <bfulgham@apple.com>
470 Teach ResourceLoadStatistics to recognize changes in the file system
471 https://bugs.webkit.org/show_bug.cgi?id=173800
472 <rdar://problem/32937842>
474 Reviewed by Chris Dumez.
476 * wtf/DispatchPtr.h: Added (moved from WebKit2)
477 * wtf/Platform.h: Make sure USE_FILE_LOCK is enabled.
479 2017-06-28 David Kilzer <ddkilzer@apple.com>
481 Fix typo in comment: WordResult => WorkResult
483 * wtf/AutomaticThread.h:
485 2017-06-27 Caio Lima <ticaiolima@gmail.com>
487 [ESnext] Implement Object Rest - Implementing Object Rest Destructuring
488 https://bugs.webkit.org/show_bug.cgi?id=167962
490 Reviewed by Saam Barati.
495 2017-06-26 Yusuke Suzuki <utatane.tea@gmail.com>
497 [WTF] Drop Thread::create(obsolete things) API since we can use lambda
498 https://bugs.webkit.org/show_bug.cgi?id=173825
500 Reviewed by Saam Barati.
502 Thread::create(ThreadFunction, void* data, const char* name) is a bit old API.
503 Since we have C++ lambda, the above API is simply unnecessary. And C++ lambda
504 based one is better since the above API needs casting data to and from void*.
508 * wtf/ParallelJobsGeneric.cpp:
509 (WTF::ParallelEnvironment::ThreadPrivate::tryLockFor):
510 (WTF::ParallelEnvironment::ThreadPrivate::workerThread): Deleted.
511 * wtf/ParallelJobsGeneric.h:
513 * wtf/ThreadingWin.cpp:
516 2017-06-25 Yusuke Suzuki <utatane.tea@gmail.com>
518 initializeThreading() [first] causes WTFCrash due to maxSingleAllocationSize not being initialized
519 https://bugs.webkit.org/show_bug.cgi?id=173720
521 Reviewed by Mark Lam.
523 When using std::numeric_limits<size_t>::max() for global variable's initialization,
524 it seems that it invokes static constructor to initialize this in VC++.
525 We avoid this edge case by introducing a workaround using SIZE_MAX here.
527 When I perform git-grep, there is only one site (this) using std::numeric_limits<>::xxx()
528 to initialize global variable.
530 * wtf/FastMalloc.cpp:
532 2017-06-25 Konstantin Tokarev <annulen@yandex.ru>
534 Remove excessive headers from JavaScriptCore
535 https://bugs.webkit.org/show_bug.cgi?id=173812
537 Reviewed by Darin Adler.
541 2017-06-23 Keith Miller <keith_miller@apple.com>
543 Switch VMTraps to use halt instructions rather than breakpoint instructions
544 https://bugs.webkit.org/show_bug.cgi?id=173677
545 <rdar://problem/32178892>
547 Reviewed by JF Bastien.
549 Remove the Trap signal handler code since it plays badly with lldb and combine
550 SIGBUS with SIGSEGV since distiguishing them is generally non-portable.
552 Also, update the platform code to only use signaling VMTraps
553 on where we have an appropriate instruction (x86 and ARM64).
556 * wtf/threads/Signals.cpp:
557 (WTF::fromMachException):
559 (WTF::installSignalHandler):
560 (WTF::jscSignalHandler):
561 * wtf/threads/Signals.h:
562 (WTF::toSystemSignal):
563 (WTF::fromSystemSignal):
565 2017-06-23 Antti Koivisto <antti@apple.com>
567 Add notifyutil registrations for going in and out of simulated low memory state
568 https://bugs.webkit.org/show_bug.cgi?id=173797
570 Reviewed by Andreas Kling.
574 notifyutil -p org.WebKit.lowMemory.begin
575 notifyutil -p org.WebKit.lowMemory.end
579 * wtf/cocoa/MemoryPressureHandlerCocoa.mm:
580 (WTF::MemoryPressureHandler::install):
582 2017-06-23 Konstantin Tokarev <annulen@yandex.ru>
584 Remove more unused headers from WTF
585 https://bugs.webkit.org/show_bug.cgi?id=173761
587 Reviewed by Yusuke Suzuki.
590 * wtf/PageAllocation.h:
591 * wtf/ParallelJobs.h:
593 2017-06-22 Andreas Kling <akling@apple.com>
595 Rename MemoryPressureHandler::setTabCount to setPageCount
596 https://bugs.webkit.org/show_bug.cgi?id=173750
598 Reviewed by Daniel Bates.
600 This function is counting WebCore::Page objects (excluding utility Pages used
601 by SVG-as-image and the web inspector) so let's name it appropriately.
602 Not all WebKit clients have tabs.
604 * wtf/MemoryPressureHandler.cpp:
605 (WTF::MemoryPressureHandler::setPageCount):
606 (WTF::MemoryPressureHandler::thresholdForMemoryKill):
607 (WTF::MemoryPressureHandler::measurementTimerFired):
608 (WTF::MemoryPressureHandler::setTabCount): Deleted.
609 * wtf/MemoryPressureHandler.h:
611 2017-06-21 Andreas Kling <akling@apple.com>
613 Increase memory kill limits for WebContent processes that manage multiple tabs.
614 https://bugs.webkit.org/show_bug.cgi?id=173674
616 Reviewed by Geoffrey Garen.
618 When opening <a target=_blank> links, we currently have to use the same WebContent
619 process for the new tab, to support scripting the window.opener object.
620 This means that some WebContent processes end up hosting multiple tabs, making it
621 more likely that those processes will hit the memory limits.
623 Address this by adding some additional allowance for multi-tab processes:
625 For each additional tab, up to 4 tabs, add 1GB to the memory kill limit.
627 * wtf/MemoryPressureHandler.cpp:
628 (WTF::thresholdForMemoryKillWithProcessState):
629 (WTF::MemoryPressureHandler::setTabCount):
630 (WTF::MemoryPressureHandler::thresholdForMemoryKill):
631 (WTF::MemoryPressureHandler::measurementTimerFired):
632 * wtf/MemoryPressureHandler.h:
634 2017-06-21 Chris Dumez <cdumez@apple.com>
636 Allow constructing a WTF:Function from a function pointer
637 https://bugs.webkit.org/show_bug.cgi?id=173660
639 Reviewed by Alex Christensen.
641 Allow constructing a WTF:Function from a function pointer and
642 assigning a function pointer to a WTF:Function.
646 2017-06-20 Simon Fraser <simon.fraser@apple.com>
648 Remove WILL_REVEAL_EDGE_EVENTS code
649 https://bugs.webkit.org/show_bug.cgi?id=173632
651 Reviewed by Sam Weinig, Beth Dakin.
653 Remove will-reveal-edge events, which never took off.
655 * wtf/FeatureDefines.h:
657 2017-06-20 Konstantin Tokarev <annulen@yandex.ru>
659 Remove excessive include directives from WTF
660 https://bugs.webkit.org/show_bug.cgi?id=173553
662 Reviewed by Saam Barati.
664 * wtf/AutomaticThread.h:
665 * wtf/BagToHashMap.h:
666 * wtf/CrossThreadCopier.h:
667 * wtf/CrossThreadQueue.h:
672 * wtf/MessageQueue.h:
673 * wtf/MetaAllocator.h:
674 * wtf/MetaAllocatorHandle.h:
675 * wtf/RandomNumberSeed.h:
679 * wtf/SchedulePair.h:
681 * wtf/SynchronizedFixedQueue.h:
682 * wtf/ThreadMessage.h:
685 * wtf/ThreadingPthreads.cpp:
686 * wtf/ThreadingWin.cpp:
687 * wtf/WTFThreadData.h:
689 * wtf/glib/GRefPtr.h:
690 * wtf/text/AtomicStringTable.h:
691 * wtf/text/LineBreakIteratorPoolICU.h:
693 2017-06-20 Yusuke Suzuki <utatane.tea@gmail.com>
695 [WTF] Enable WTF::Signals only when HAVE(MACHINE_CONTEXT) is true
696 https://bugs.webkit.org/show_bug.cgi?id=173590
698 Reviewed by Carlos Garcia Campos.
700 WTF::Signals require a feature rewriting a value of a machine context.
701 This is only available under HAVE(MACHINE_CONTEXT).
702 This patch disables WTF::Signals on !HAVE(MACHINE_CONTEXT) environments.
704 * wtf/threads/Signals.cpp:
705 * wtf/threads/Signals.h:
707 2017-06-20 Yusuke Suzuki <utatane.tea@gmail.com>
709 [WTF] Rebaseline std::optional
710 https://bugs.webkit.org/show_bug.cgi?id=173582
712 Reviewed by JF Bastien.
714 Update the copy of our std::optional to the latest version.
715 It adds std::optional::has_value() and std::optional::reset().
719 2017-06-18 Yusuke Suzuki <utatane.tea@gmail.com>
721 [WTF] Include execinfo.h and dlfcn.h based on platform defines
722 https://bugs.webkit.org/show_bug.cgi?id=173531
724 Reviewed by Alex Christensen.
726 execinfo.h and dlfcn.h can be missing in some libc libraries.
727 When including it, we should honor platform defines like HAVE(DLADDR).
729 * wtf/StackTrace.cpp:
731 2017-06-18 Darin Adler <darin@apple.com>
733 Fix Ref to deref before assignment, add tests for this to RefPtr, Ref, Function
734 https://bugs.webkit.org/show_bug.cgi?id=173526
736 Reviewed by Sam Weinig.
738 * wtf/Ref.h: Changed operator= to not be defined inside the class definition.
739 Added swap functions. Changed operator= implementations to use swap in the
740 conventional manner, the same way that RefPtr does.
742 2017-06-18 Chris Dumez <cdumez@apple.com>
744 Use WTF::Function instead of std::function in WTF/
745 https://bugs.webkit.org/show_bug.cgi?id=173519
747 Reviewed by Sam Weinig.
749 Use WTF::Function instead of std::function in WTF/ to avoid
755 * wtf/FunctionDispatcher.h:
757 * wtf/MemoryPressureHandler.h:
758 (WTF::MemoryPressureHandler::setMemoryKillCallback):
759 (WTF::MemoryPressureHandler::setMemoryPressureStatusChangedCallback):
760 (WTF::MemoryPressureHandler::setDidExceedInactiveLimitWhileActiveCallback):
764 (WTF::RefCounter<T>::RefCounter):
766 * wtf/linux/MemoryPressureHandlerLinux.cpp:
767 (WTF::MemoryPressureHandler::EventFDPoller::EventFDPoller):
768 * wtf/text/WTFString.cpp:
769 (WTF::String::split):
770 * wtf/text/WTFString.h:
772 2017-06-16 Alex Christensen <achristensen@webkit.org>
776 * wtf/PlatformMac.cmake:
777 Generate MachExceptionsServer.h
779 2017-06-16 Wenson Hsieh <wenson_hsieh@apple.com>
781 [iOS DnD] Upstream iOS drag and drop implementation into OpenSource WebKit
782 https://bugs.webkit.org/show_bug.cgi?id=173366
783 <rdar://problem/32767014>
785 Reviewed by Tim Horton.
787 Define ENABLE_DRAG_SUPPORT as 1 by default and 0 for iOS, and define ENABLE_DATA_INTERACTION as 0 by default.
788 These are overridden to both be 1 for iOS 11+ in the FeatureDefines.xcconfig within each individual project.
792 2017-06-15 Chris Dumez <cdumez@apple.com>
795 https://bugs.webkit.org/show_bug.cgi?id=173426
797 Reviewed by Alex Christensen.
799 We should check if xpc_release is defined before defining it,
802 * wtf/spi/darwin/XPCSPI.h:
804 2017-06-15 Konstantin Tokarev <annulen@yandex.ru>
806 Implement FALLTHROUGH macro for compilers other than Clang
807 https://bugs.webkit.org/show_bug.cgi?id=173385
809 Reviewed by Alex Christensen.
811 FALLTHROUGH should be able to use [[gnu::fallthrough]] attribute of
812 GCC, and [[fallthrough]] from C++17, whichever is available.
816 2017-06-14 Nael Ouedraogo <nael.ouedraogo@crf.canon.fr>
818 MediaSource duration attribute should not be equal to Infinity when set to a value greater than 2^64
819 https://bugs.webkit.org/show_bug.cgi?id=171668
821 Reviewed by Jer Noble.
823 MediaSource duration attribute is a double represented in MediaSource by a MediaTime instance created with
824 MediaTime::CreateWithDouble(). This method implements an overflow control mechanism which sets MediaTime to
825 Infinity when the double value passed as argument is greater than 2^64.
827 This patch removes the overflow control mechanism when time value is represented as a double. This patch also
828 modifies the behavior of mathematical operations between a double MediaTime and rational MediaTime: the rational
829 MediaTime is converted to a double before applying the operation. Double MediaTime precision is the same as for
830 double. Overflow mechanisms still apply to the conversion of a double MediaTime to rational with setTimescale()
831 method. No behavior change for rational MediaTime.
834 (WTF::MediaTime::createWithFloat):
835 (WTF::MediaTime::createWithDouble):
836 (WTF::MediaTime::operator+):
837 (WTF::MediaTime::operator-):
839 2017-06-13 Zan Dobersek <zdobersek@igalia.com>
841 [GTK][WPE] Use CMAKE_THREAD_LIBS_INIT in WTF platform CMake files
842 https://bugs.webkit.org/show_bug.cgi?id=173310
844 Reviewed by Xabier Rodriguez-Calvar.
846 In the WTF platform CMake files for the GTK+ and WPE ports, use the
847 CMAKE_THREAD_LIBS_INIT variable to specify the threading library we
848 should be linking against. On some platforms this variable will be
849 empty because the given compiler will automatically handle the -pthread
850 compiler flag and sort out linking on its own.
852 The same approach is already used for the JSCOnly configuration.
854 * wtf/PlatformGTK.cmake:
855 * wtf/PlatformWPE.cmake:
857 2017-06-13 Youenn Fablet <youenn@apple.com>
859 Filter SDP from ICE candidates in case of local ICE candidate filtering
860 https://bugs.webkit.org/show_bug.cgi?id=173120
862 Reviewed by Eric Carlson.
864 Adding split helper routine with functor parameter.
866 * wtf/text/WTFString.cpp:
867 (WTF::String::split):
868 * wtf/text/WTFString.h:
869 (WTF::String::contains):
871 2017-06-13 Don Olmstead <don.olmstead@sony.com>
873 [WTF] Remove redundant includes in config.h
874 https://bugs.webkit.org/show_bug.cgi?id=173292
876 Reviewed by Alex Christensen.
879 * wtf/ExportMacros.h:
881 2017-06-12 Jer Noble <jer.noble@apple.com>
883 Screen sleeps while doing WebRTC video
884 https://bugs.webkit.org/show_bug.cgi?id=173278
886 Reviewed by Eric Carlson.
888 Drive-by fix: add some generic methods for iterating over collections.
890 * WTF.xcodeproj/project.pbxproj:
891 * wtf/Algorithms.h: Added.
896 2017-06-12 Carlos Garcia Campos <cgarcia@igalia.com>
898 [GTK] Move WebKit GType macros to WTF
899 https://bugs.webkit.org/show_bug.cgi?id=173249
901 Reviewed by Žan Doberšek.
903 They can be used by glib-based ports and eventually by JavaScriptCore glib bindings too.
905 * wtf/glib/WTFGType.h: Copied from Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h.
907 2017-06-11 Yusuke Suzuki <utatane.tea@gmail.com>
909 [WTF] Make ThreadMessage portable
910 https://bugs.webkit.org/show_bug.cgi?id=172073
912 Reviewed by Keith Miller.
914 Recently, we change ThreadMessage semantics: message handler
915 can be executed in the sender thread.
916 This allows ThreadMessage to be implemented in a portable way.
918 This patch implements ThreadMessage for all the platforms.
919 We use platform-independent Thread APIs, suspend(), resume(),
922 * wtf/PlatformRegisters.h:
923 (WTF::registersFromUContext):
924 * wtf/ThreadMessage.cpp:
925 (WTF::sendMessageScoped):
926 (WTF::ThreadMessageData::ThreadMessageData): Deleted.
928 (WTF::initializeThreadMessages): Deleted.
929 (WTF::sendMessageUsingSignal): Deleted.
930 (WTF::sendMessageUsingMach): Deleted.
931 (WTF::deliverMessagesUsingMach): Deleted.
932 * wtf/ThreadMessage.h:
934 (WTF::initializeThreading):
936 (WTF::Thread::threadMessages): Deleted.
937 * wtf/ThreadingPthreads.cpp:
938 (WTF::Thread::signalHandlerSuspendResume):
939 (WTF::threadStateMetadata):
940 (WTF::Thread::getRegisters):
941 * wtf/threads/Signals.cpp:
942 (WTF::handleSignalsWithMach):
944 2017-06-11 Yusuke Suzuki <utatane.tea@gmail.com>
946 [WTF] Drop unnecessary includes in Threading.h
947 https://bugs.webkit.org/show_bug.cgi?id=173167
949 Reviewed by Darin Adler.
951 Threading.h includes bunch of headers. But some of them are not necessary.
952 This patch cleans up it a bit.
954 * wtf/Assertions.cpp:
957 * wtf/ThreadingPrimitives.h:
959 2017-06-10 Yusuke Suzuki <utatane.tea@gmail.com>
961 [WTF] Add RegisteredSymbolImpl
962 https://bugs.webkit.org/show_bug.cgi?id=173230
964 Reviewed by Mark Lam.
966 Most symbols are not registered in SymbolRegistry. However, we currently always
967 allocate a pointer member to point to a SymbolRegistry, and this pointer is always null.
968 SymbolImpl is immutable, and it will never be registered with a SymbolRegistry
969 after it is created. Hence, this member is wasteful.
971 Instead, we add a new derived class RegisteredSymbolImpl, which will set a flag in
972 SymbolImpl to indicate that it is registered with a SymbolRegistry. The only way to
973 create a RegisteredSymbolImpl is via a factory method provided by the SymbolRegistry.
974 The factory method will pass the SymbolRegistry this pointer to the RegisteredSymbolImpl's
975 constructor for initializing the RegisteredSymbolImpl's m_symbolRegistry field.
978 1. We do not need to set m_symbolRegistry after creating a Symbol. It is clean.
979 2. We reduce the size of SymbolImpls that do not need to be registered.
981 * wtf/text/StringImpl.cpp:
982 (WTF::StringImpl::~StringImpl):
983 * wtf/text/StringImpl.h:
984 * wtf/text/SymbolImpl.cpp:
985 (WTF::SymbolImpl::create):
986 (WTF::RegisteredSymbolImpl::create):
987 * wtf/text/SymbolImpl.h:
988 (WTF::SymbolImpl::hashForSymbol):
989 (WTF::SymbolImpl::isRegistered):
990 (WTF::SymbolImpl::SymbolImpl):
991 (WTF::RegisteredSymbolImpl::symbolRegistry):
992 (WTF::RegisteredSymbolImpl::clearSymbolRegistry):
993 (WTF::RegisteredSymbolImpl::RegisteredSymbolImpl):
994 (WTF::SymbolImpl::symbolRegistry):
995 * wtf/text/SymbolRegistry.cpp:
996 (WTF::SymbolRegistry::~SymbolRegistry):
997 (WTF::SymbolRegistry::symbolForKey):
998 (WTF::SymbolRegistry::keyForSymbol):
999 (WTF::SymbolRegistry::remove):
1000 * wtf/text/SymbolRegistry.h:
1002 2017-06-10 Dan Bernstein <mitz@apple.com>
1004 Reverted r218056 because it made the IDE reindex constantly.
1006 * Configurations/DebugRelease.xcconfig:
1008 2017-06-10 Dan Bernstein <mitz@apple.com>
1010 [Xcode] With Xcode 9 developer beta, everything rebuilds when switching between command-line and IDE
1011 https://bugs.webkit.org/show_bug.cgi?id=173223
1013 Reviewed by Sam Weinig.
1015 The rebuilds were happening due to a difference in the compiler options that the IDE and
1016 xcodebuild were specifying. Only the IDE was passing the -index-store-path option. To make
1017 xcodebuild pass that option, too, set CLANG_INDEX_STORE_ENABLE to YES if it is unset, and
1018 specify an appropriate path in CLANG_INDEX_STORE_PATH.
1020 * Configurations/DebugRelease.xcconfig:
1022 2017-06-09 Chris Dumez <cdumez@apple.com>
1024 Update Thread::create() to take in a WTF::Function instead of a std::function
1025 https://bugs.webkit.org/show_bug.cgi?id=173175
1027 Reviewed by Mark Lam.
1029 Update Thread::create() to take in a WTF::Function instead of a std::function. Unlike
1030 std::function, WTF:Function is not copyable and does not make implicit copies of captured
1031 variables. Doing captures such as [string = string.isolatedCopy()] when passing an
1032 std::function to another thread has lead to bugs in the past due to implicit copying of
1033 the captured string.
1035 * wtf/Threading.cpp:
1036 (WTF::Thread::create):
1039 2017-06-09 Chris Dumez <cdumez@apple.com>
1041 Update WorkQueue::concurrentApply() to take a WTF::Function instead of an std::function
1042 https://bugs.webkit.org/show_bug.cgi?id=173165
1044 Reviewed by Saam Barati.
1046 Update WorkQueue::concurrentApply() to take a WTF::Function instead of an std::function
1047 as std::function has issues with regards to thread safety.
1050 * wtf/cocoa/WorkQueueCocoa.cpp:
1051 (WTF::WorkQueue::concurrentApply):
1053 2017-06-08 Xabier Rodriguez Calvar <calvaris@igalia.com>
1055 MediaTime class has rounding issues in different platforms
1056 https://bugs.webkit.org/show_bug.cgi?id=172640
1058 Reviewed by Jer Noble.
1060 The way a timescale is set when creating a MediaTime from a double
1061 can create rounding issues in different platforms because in some
1062 rounding is made and in others, it truncates. This way we ensure a
1065 Dumping MediaTimes is also confusing and by the output you don't
1066 know if it's containing a double or a fraction. Now, if it
1067 contains a double, it only prints the double because printing the
1068 fraction is misleading (it currently prints the double read as an
1069 integer) and if it contains a fraction it shows the fraction and
1070 its double representation separated by an = instead of a ,.
1072 * wtf/MediaTime.cpp:
1073 (WTF::MediaTime::createWithDouble): When creating MediaTime from
1074 double, we round instead of leaving it to the cast operation.
1075 (WTF::MediaTime::dump):
1077 2017-06-07 Jer Noble <jer.noble@apple.com>
1079 Refactoring: MediaEngineSupportParameters should take a ContentType rather than separate type & codecs strings
1080 https://bugs.webkit.org/show_bug.cgi?id=173038
1082 Reviewed by Eric Carlson.
1084 Drive by fix: add a version of split that takes a UChar and returns a Vector<String>.
1086 * wtf/text/WTFString.h:
1087 (WTF::String::split):
1089 2017-06-07 Zan Dobersek <zdobersek@igalia.com>
1091 [GCrypt] RSA-PSS support
1092 https://bugs.webkit.org/show_bug.cgi?id=172856
1094 Reviewed by Jiewen Tan.
1096 * wtf/Platform.h: Define HAVE_RSA_PSS to 1 for USE(GCRYPT). Support for RSA-PSS
1097 is provided by default through the libgcrypt library.
1099 2017-06-06 Chris Dumez <cdumez@apple.com>
1101 Unreviewed, rolling out r214974.
1103 Causes some tabs to start using a huge amount of CPU after 8
1104 minutes in the background
1108 "Make inactive web processes behave as though under memory
1110 https://bugs.webkit.org/show_bug.cgi?id=170042
1111 http://trac.webkit.org/changeset/214974
1113 2017-06-06 Don Olmstead <don.olmstead@am.sony.com>
1115 [WebCore] Enable REQUEST_ANIMATION_FRAME_TIMER for all ports
1116 https://bugs.webkit.org/show_bug.cgi?id=172780
1118 Reviewed by Alex Christensen.
1122 2017-06-06 Darin Adler <darin@apple.com>
1124 Cut down use of WTF_ARRAY_LENGTH
1125 https://bugs.webkit.org/show_bug.cgi?id=172997
1127 Reviewed by Chris Dumez.
1130 (WTF::equalLettersIgnoringASCIICase): Added helper function template.
1131 (WTF::parseDateFromNullTerminatedCharacters): Use a modern for loop instead of
1132 WTF_ARRAY_LENGTH. Use startsWithLettersIgnoringASCIICase and
1133 equalLettersIgnoringASCIICase instead of strncasecmp.
1135 * wtf/text/IntegerToStringConversion.h:
1136 (WTF::numberToStringImpl): Use std::end instead of WTF_ARRAY_LENGTH.
1137 (WTF::writeNumberToBufferImpl): Ditto.
1139 2017-06-06 Filip Pizlo <fpizlo@apple.com>
1141 index out of bound in bytecodebasicblock
1142 https://bugs.webkit.org/show_bug.cgi?id=172963
1144 Reviewed by Saam Barati and Mark Lam.
1147 (UNREACHABLE_FOR_PLATFORM):
1149 2017-06-05 Jer Noble <jer.noble@apple.com>
1151 Allow clients to specify a list of codecs which should require hardware decode support.
1152 https://bugs.webkit.org/show_bug.cgi?id=172787
1154 Reviewed by Alex Christensen.
1156 Add a couple of convenience methods:
1157 - a String::split() that returns a vector (rather than taking an out-reference to a vector).
1158 - A Vector::map() template which takes a Callable and returns a Vector of a different type.
1162 * wtf/text/WTFString.h:
1163 (WTF::String::split):
1165 2017-06-04 Konstantin Tokarev <annulen@yandex.ru>
1167 Fix build of Windows-specific code with ICU 59.1
1168 https://bugs.webkit.org/show_bug.cgi?id=172729
1170 Reviewed by Darin Adler.
1172 * wtf/text/win/WCharStringExtras.h: Added new header file wuth helper
1173 functions for conversion between WTF::String and wchart_t*.
1174 (WTF::stringToNullTerminatedWChar):
1175 (WTF::wcharToString):
1176 (WTF::nullTerminatedWCharToString):
1178 2017-06-02 Stephan Szabo <stephan.szabo@am.sony.com>
1180 [JSCOnly] Build static jsc.exe on Windows
1181 https://bugs.webkit.org/show_bug.cgi?id=172833
1183 Reviewed by Konstantin Tokarev.
1185 * wtf/PlatformJSCOnly.cmake:
1187 2017-06-02 Simon Fraser <simon.fraser@apple.com>
1189 Get <chrono> out of StdLibExtras.h
1190 https://bugs.webkit.org/show_bug.cgi?id=172744
1192 Reviewed by Zalan Bujtas.
1194 We hates std::chrono. Don't include it everywhere to discourage use.
1196 * wtf/StdLibExtras.h:
1198 2017-06-02 Filip Pizlo <fpizlo@apple.com>
1200 Atomics.load and Atomics.store need to be fully fenced
1201 https://bugs.webkit.org/show_bug.cgi?id=172844
1203 Reviewed by Keith Miller.
1205 Add loadFullyFenced and storeFullyFenced to Atomic<>.
1208 (WTF::Atomic::loadFullyFenced):
1209 (WTF::Atomic::storeRelaxed):
1210 (WTF::Atomic::storeFullyFenced):
1211 (WTF::atomicLoadFullyFenced):
1212 (WTF::atomicStoreFullyFenced):
1214 2017-06-01 Keith Miller <keith_miller@apple.com>
1216 Undo rollout in r217638 with bug fix
1217 https://bugs.webkit.org/show_bug.cgi?id=172824
1219 Unreviewed, reland patch with unused set_state code removed.
1221 * Configurations/WTF.xcconfig:
1222 * WTF.xcodeproj/project.pbxproj:
1224 * wtf/PlatformRegisters.h:
1225 (WTF::registersFromUContext):
1226 * wtf/StackBounds.h:
1227 (WTF::StackBounds::StackBounds):
1228 * wtf/ThreadHolder.cpp:
1229 (WTF::ThreadHolder::~ThreadHolder):
1230 * wtf/ThreadMessage.cpp:
1231 (WTF::sendMessageUsingSignal):
1232 (WTF::sendMessageUsingMach):
1233 (WTF::deliverMessagesUsingMach):
1234 (WTF::sendMessageScoped):
1235 * wtf/ThreadMessage.h:
1238 (WTF::Thread::machThread):
1239 * wtf/mac/MachExceptions.defs: Copied from Source/WTF/wtf/ThreadMessage.h.
1240 * wtf/threads/Signals.cpp:
1241 (WTF::startMachExceptionHandlerThread):
1242 (WTF::fromMachException):
1244 (WTF::handleSignalsWithMach):
1245 (WTF::setExceptionPorts):
1246 (WTF::activeThreads):
1247 (WTF::registerThreadForMachExceptionHandling):
1248 (WTF::unregisterThreadForMachExceptionHandling):
1249 (WTF::installSignalHandler):
1250 (WTF::jscSignalHandler):
1251 * wtf/threads/Signals.h:
1253 2017-05-31 Commit Queue <commit-queue@webkit.org>
1255 Unreviewed, rolling out r217611 and r217631.
1256 https://bugs.webkit.org/show_bug.cgi?id=172785
1258 "caused wasm-hashset-many.html to become flaky." (Requested by
1259 keith_miller on #webkit).
1261 Reverted changesets:
1263 "Reland r216808, underlying lldb bug has been fixed."
1264 https://bugs.webkit.org/show_bug.cgi?id=172759
1265 http://trac.webkit.org/changeset/217611
1267 "Use dispatch queues for mach exceptions"
1268 https://bugs.webkit.org/show_bug.cgi?id=172775
1269 http://trac.webkit.org/changeset/217631
1271 2017-05-31 Keith Miller <keith_miller@apple.com>
1273 Use dispatch queues for mach exceptions
1274 https://bugs.webkit.org/show_bug.cgi?id=172775
1276 Reviewed by Geoffrey Garen.
1278 This patch adds support for using a dispatch queue to handle our
1279 mach exceptions. We use a high priority concurrent dispatch queue
1280 to handle our mach exceptions. We don't know the priority of the
1281 thread whose exception we are handling so the most conservative
1282 answer is to respond with a high priority. These events are both
1283 rare and usually quite fast so it is likely not a significant cost
1284 when the thread with an exception has a low priority.
1286 * wtf/threads/Signals.cpp:
1287 (WTF::startMachExceptionHandlerThread):
1289 2017-05-31 Keith Miller <keith_miller@apple.com>
1291 Reland r216808, underlying lldb bug has been fixed.
1292 https://bugs.webkit.org/show_bug.cgi?id=172759
1294 Unreviewed, relanding old patch. See: rdar://problem/31183352
1296 * Configurations/WTF.xcconfig:
1297 * WTF.xcodeproj/project.pbxproj:
1299 * wtf/PlatformRegisters.h:
1300 (WTF::registersFromUContext):
1301 * wtf/StackBounds.h:
1302 (WTF::StackBounds::StackBounds):
1303 * wtf/ThreadHolder.cpp:
1304 (WTF::ThreadHolder::~ThreadHolder):
1305 * wtf/ThreadMessage.cpp:
1306 (WTF::sendMessageUsingSignal):
1307 (WTF::sendMessageUsingMach):
1308 (WTF::deliverMessagesUsingMach):
1309 (WTF::sendMessageScoped):
1310 * wtf/ThreadMessage.h:
1313 (WTF::Thread::machThread):
1314 * wtf/mac/MachExceptions.defs: Copied from Source/WTF/wtf/ThreadMessage.h.
1315 * wtf/threads/Signals.cpp:
1316 (WTF::startMachExceptionHandlerThread):
1317 (WTF::fromMachException):
1319 (WTF::handleSignalsWithMach):
1320 (WTF::setExceptionPorts):
1321 (WTF::activeThreads):
1322 (WTF::registerThreadForMachExceptionHandling):
1323 (WTF::unregisterThreadForMachExceptionHandling):
1324 (WTF::installSignalHandler):
1325 (WTF::jscSignalHandler):
1326 * wtf/threads/Signals.h:
1328 2017-05-31 Matt Lewis <jlewis3@apple.com>
1330 Unreviewed, rolling out r217603.
1332 This patch broke the internal builds.
1336 "Get <chrono> out of StdLibExtras.h"
1337 https://bugs.webkit.org/show_bug.cgi?id=172744
1338 http://trac.webkit.org/changeset/217603
1340 2017-05-31 Simon Fraser <simon.fraser@apple.com>
1342 Get <chrono> out of StdLibExtras.h
1343 https://bugs.webkit.org/show_bug.cgi?id=172744
1345 Reviewed by Saam Barati.
1347 We hates std::chrono. Don't include it everywhere to discourage use.
1349 * wtf/StdLibExtras.h:
1351 2017-05-30 Ryosuke Niwa <rniwa@webkit.org>
1353 Only include DataDetectorsUI headers in iOS
1354 https://bugs.webkit.org/show_bug.cgi?id=172633
1356 Reviewed by David Kilzer.
1358 Enable data detectors only on iOS and not other variants of iOS.
1360 * wtf/FeatureDefines.h:
1363 2017-05-29 Yusuke Suzuki <utatane.tea@gmail.com>
1365 Unreviewed, disable faster Interpreter::getOpcodeID for ARM_THUMB2 with non-Darwin OSes
1366 https://bugs.webkit.org/show_bug.cgi?id=172686
1368 Because of test failures.
1372 2017-05-28 Dan Bernstein <mitz@apple.com>
1374 [Xcode] ALWAYS_SEARCH_USER_PATHS is set to YES
1375 https://bugs.webkit.org/show_bug.cgi?id=172691
1377 Reviewed by Tim Horton.
1379 * Configurations/Base.xcconfig: Set ALWAYS_SEARCH_USER_PATHS to NO.
1381 2017-05-28 Yusuke Suzuki <utatane.tea@gmail.com>
1383 [JSC][Linux][FreeBSD] Use faster Interpreter::getOpcodeID()
1384 https://bugs.webkit.org/show_bug.cgi?id=172686
1386 Reviewed by Mark Lam.
1388 As of r217526, JSC gets faster Interpreter::getOpcodeID() by
1389 embedding OpcodeID value just before the LLInt machine code
1390 handler pointer. By doing so, we can retrieve OpcodeID from
1391 the LLInt machine code handler by dereferencing the code
1392 pointer. `*((int*)ptr - 1)`.
1394 This patch allows Linux and FreeBSD environments to use this
1399 2017-05-28 Mark Lam <mark.lam@apple.com>
1401 Implement a faster Interpreter::getOpcodeID().
1402 https://bugs.webkit.org/show_bug.cgi?id=172669
1404 Reviewed by Saam Barati.
1406 Added the USE(LLINT_EMBEDDED_OPCODE_ID) configuration.
1410 2017-05-26 Brent Fulgham <bfulgham@apple.com>
1412 [WK2] Address thread safety issues with ResourceLoadStatistics
1413 https://bugs.webkit.org/show_bug.cgi?id=172519
1414 <rdar://problem/31707642>
1416 Reviewed by Chris Dumez.
1418 Add a new specialization for HashSet.
1420 * wtf/CrossThreadCopier.h:
1422 2017-05-26 Ryan Haddad <ryanhaddad@apple.com>
1424 Unreviewed, rolling out r217458.
1426 This change caused 55 JSC test failures.
1430 "Date should use historical data if it's available."
1431 https://bugs.webkit.org/show_bug.cgi?id=172592
1432 http://trac.webkit.org/changeset/217458
1434 2017-05-25 Keith Miller <keith_miller@apple.com>
1436 Date should use historical data if it's available.
1437 https://bugs.webkit.org/show_bug.cgi?id=172592
1439 Reviewed by Mark Lam.
1441 The spec previously disallowed using historical data for Dates.
1442 This is no longer the case. Additionally, not using historical
1443 data, when available, seems unfortunate for users. This patch
1444 removes the code dropping historical data.
1447 (WTF::calculateLocalTimeOffset):
1448 (WTF::msToMilliseconds): Deleted.
1450 2017-05-25 Yusuke Suzuki <utatane.tea@gmail.com>
1452 [Win] ASSERTION FAILED: !HashTranslator::equal(KeyTraits::emptyValue(), key)
1453 https://bugs.webkit.org/show_bug.cgi?id=172586
1455 Reviewed by Brent Fulgham.
1457 In ThreadHolder for Windows, we need to construct HashMap<ThreadIdentifier, ThreadHolder*>.
1458 The problem is that ThreadHolder::platformInitialize touches Thread::id() even before Thread
1459 is not established. In that case, id() returns incorrect value.
1461 But, calling ThreadHolder::initialize() after waiting for completion of Thread::establish() is
1462 not a good idea. Since we already have NewThreadContext->creationMutex, we can wait for completion
1463 of Thread::establish() easily. However, if we do so, Thread::create() returns RefPtr<Thread> that
1464 may not call ThreadHolder::initialize() in its thread yet. In that case, ThreadHolder::get() fails.
1465 Thus, Windows WTF::waitForThreadCompletion implementation becomes broken. We can add a new mutex
1466 to wait for completion of ThreadHolder::initialize in the creator of the thread (like a ping-pong!).
1467 But it overly complicates the implementation.
1469 The following is overly complicated initialization phase.
1471 Creator -> AC mutex(1) -------> establishment -> RL mutex(1) ----------------------> AC mutex(2) ->
1473 Thread -----------------> AC mutex(1) -> ThreadHolder init -> RL mutex(2) ->
1475 So, instead, in this patch, we just use Thread::currentID(). When calling ThreadHolder::initialize(),
1476 we pass ThreadIdentifier by using Thread::currentID(). This implementation works great because,
1478 1. ThreadHolder::initialize requires ThreadIdentifier only in Windows environment because Pthread
1479 ThreadHolder does not create HashMap<>. And this is used for obsolete Threading APIs. Thus this
1480 hack will be removed in the near future.
1482 2. In Windows, Thread::currentID() can return a valid value without using ThreadHolder. And it does
1483 not require Thread establishment. So, calling currentID() to initialize ThreadHolder is ok in
1486 * wtf/ThreadHolder.cpp:
1487 (WTF::ThreadHolder::initialize): Deleted.
1488 * wtf/ThreadHolder.h:
1489 * wtf/ThreadHolderPthreads.cpp:
1490 (WTF::ThreadHolder::initialize):
1491 * wtf/ThreadHolderWin.cpp:
1492 (WTF::ThreadHolder::initialize):
1493 (WTF::ThreadHolder::platformInitialize): Deleted.
1494 * wtf/ThreadingWin.cpp:
1495 (WTF::wtfThreadEntryPoint):
1497 2017-05-25 Adrian Perez de Castro <aperez@igalia.com>
1499 Clang warns about (intended) returning pointer to stack location in WTF/wtf/ThreadingPthreads.cpp
1500 https://bugs.webkit.org/show_bug.cgi?id=172595
1502 Reviewed by Mark Lam.
1504 * wtf/ThreadingPthreads.cpp: Use a #pragma to silence Clang warning about returning a
1505 pointer to the stack (which is intended)
1507 2017-05-25 David Kilzer <ddkilzer@apple.com>
1509 REGRESSION (r217416): Using #pragma once in WTFString.h broke the build
1511 * wtf/text/WTFString.h: Switch back to #ifndef/#define/#endif.
1513 2017-05-25 David Kilzer <ddkilzer@apple.com>
1515 Make a change to force a build on the Apple bots
1517 * wtf/text/WTFString.h: Use #pragma once.
1519 2017-05-24 Andreas Kling <akling@apple.com>
1521 Disable memory kill mechanisms when running with FastMalloc disabled.
1522 https://bugs.webkit.org/show_bug.cgi?id=172550
1523 <rdar://problem/32181908>
1525 Reviewed by Antti Koivisto.
1527 If someone is using WebKit with a non-standard allocator, they are likely trying to debug
1528 or test something, and suddenly getting killed is not gonna help with that.
1530 * wtf/MemoryPressureHandler.cpp:
1531 (WTF::MemoryPressureHandler::setShouldUsePeriodicMemoryMonitor):
1533 2017-05-22 Jiewen Tan <jiewen_tan@apple.com>
1535 [WebCrypto] Support RSA-PSS
1536 https://bugs.webkit.org/show_bug.cgi?id=170869
1537 <rdar://problem/31640672>
1539 Reviewed by Brent Fulgham.
1542 Add a flag to enable RSA-PSS in the future.
1544 2017-05-23 Myles C. Maxfield <mmaxfield@apple.com>
1546 Remove dead ENABLE(FONT_LOAD_EVENTS) code
1547 https://bugs.webkit.org/show_bug.cgi?id=172517
1549 Rubber-stamped by Simon Fraser.
1551 * wtf/FeatureDefines.h:
1553 2017-05-23 Don Olmstead <don.olmstead@am.sony.com>
1555 [WTF] Export additional symbols in threading
1556 https://bugs.webkit.org/show_bug.cgi?id=171952
1558 Reviewed by Konstantin Tokarev.
1560 * wtf/ThreadMessage.h:
1561 * wtf/threads/Signals.h:
1563 2017-05-23 Tomas Popela <tpopela@redhat.com>
1565 [WTF] Compilation fails with system malloc
1566 https://bugs.webkit.org/show_bug.cgi?id=172445
1568 Reviewed by Michael Catanzaro.
1570 We are using the bmalloc even if the system malloc should be used.
1571 Don't use bmalloc if the system malloc is requested and add the
1572 missing implementation for computeRAMSize() on UNIX that's utilizing
1576 (WTF::computeRAMSize):
1578 2017-05-22 Brian Burg <bburg@apple.com>
1580 Add a debugging macro that sleeps a thread until a debugger attaches
1581 https://bugs.webkit.org/show_bug.cgi?id=171575
1583 Reviewed by Mark Lam.
1585 This is really useful for debugging early errors if for some reason you can't
1586 launch a process directly from the debugger easily, such as Web Content processes.
1588 * WTF.xcodeproj/project.pbxproj:
1590 Always define the WTFBreakpointTrap() macro. Still make it an error if the CPU
1591 type isn't supported for OS(DARWIN); if used on other platforms, cause a WTFCrash()
1592 with a comment that indicates this is not implemented.
1594 * wtf/DebugUtilities.h: Added.
1596 2017-05-19 Don Olmstead <don.olmstead@am.sony.com>
1598 [WTF] Remove PLATFORM(WIN) references
1599 https://bugs.webkit.org/show_bug.cgi?id=172301
1601 Reviewed by Yusuke Suzuki.
1603 * wtf/MemoryPressureHandler.cpp:
1604 * wtf/MemoryPressureHandler.h:
1607 2017-05-19 Don Olmstead <don.olmstead@am.sony.com>
1609 [CMake] Add HAVE check for __int128_t
1610 https://bugs.webkit.org/show_bug.cgi?id=172317
1612 Reviewed by Yusuke Suzuki.
1614 * wtf/MediaTime.cpp:
1615 (WTF::MediaTime::setTimeScale):
1618 2017-05-18 Andreas Kling <akling@apple.com>
1620 [WK2] Notify WebPageProxy client when an active process goes over the inactive memory limit
1621 https://bugs.webkit.org/show_bug.cgi?id=172244
1622 <rdar://problem/31800943>
1624 Reviewed by Geoffrey Garen.
1626 Add an installable callback to MemoryPressureHandler that gets invoked when an active process
1627 exceeds the kill limit for an inactive process.
1629 This allows a UI client to become aware that backgrounding a tab may cause it to get killed.
1631 * wtf/MemoryPressureHandler.cpp:
1632 (WTF::thresholdForMemoryKillWithProcessState):
1633 (WTF::MemoryPressureHandler::thresholdForMemoryKill):
1634 (WTF::MemoryPressureHandler::measurementTimerFired):
1635 (WTF::MemoryPressureHandler::doesExceedInactiveLimitWhileActive):
1636 (WTF::MemoryPressureHandler::doesNotExceedInactiveLimitWhileActive):
1637 * wtf/MemoryPressureHandler.h:
1638 (WTF::MemoryPressureHandler::setDidExceedInactiveLimitWhileActiveCallback):
1640 2017-05-18 Geoffrey Garen <ggaren@apple.com>
1642 AutomaticThread should wait longer before timing out
1643 https://bugs.webkit.org/show_bug.cgi?id=172292
1645 Reviewed by Filip Pizlo.
1647 Increased the idle timeout from 1s => 10s.
1649 This reduces the number of thread restarts on JetStream from
1650 ~150 => ~0. It also matches other thread pool APIs on Darwin.
1652 Intuitively, it seems wrong for helper threads to idle exit during
1653 hardcore benchmarking.
1655 This patch in combination with a bmalloc fix seems to be a 1%-2% JetStream
1656 speedup on my Mac Pro.
1658 A nice side-benefit is that per-thread traces are easier to read.
1660 * wtf/AutomaticThread.cpp:
1661 (WTF::AutomaticThread::start):
1662 * wtf/AutomaticThread.h:
1664 2017-05-18 Don Olmstead <don.olmstead@am.sony.com>
1666 [Win] Remove usage of _snprintf
1667 https://bugs.webkit.org/show_bug.cgi?id=172251
1669 Reviewed by Per Arne Vollan.
1672 (WTF::initializeLogFileOnce):
1675 2017-05-15 Mark Lam <mark.lam@apple.com>
1677 Rolling out r214038 and r213697: Crashes when using computed properties with rest destructuring and object spread.
1678 https://bugs.webkit.org/show_bug.cgi?id=172147
1680 Rubber-stamped by Saam Barati.
1685 2017-05-14 Chris Dumez <cdumez@apple.com>
1687 Drop PassRefPtr class from WTF
1688 https://bugs.webkit.org/show_bug.cgi?id=172091
1690 Reviewed by Alex Christensen.
1692 Drop PassRefPtr class from WTF as it is no longer used or needed.
1693 Also drop RefPtr::release() for the same reasons.
1695 * WTF.xcodeproj/project.pbxproj:
1696 * wtf/CMakeLists.txt:
1697 * wtf/CrossThreadCopier.cpp:
1698 * wtf/CrossThreadCopier.h:
1700 * wtf/PassRefPtr.h: Removed.
1702 (WTF::refIfNotNull):
1703 (WTF::derefIfNotNull):
1704 (WTF::RefPtr::RefPtr):
1705 (WTF::RefPtr::release): Deleted.
1706 * wtf/SizeLimits.cpp:
1709 2017-05-13 Chris Dumez <cdumez@apple.com>
1711 Stop using RefPtr::release()
1712 https://bugs.webkit.org/show_bug.cgi?id=172074
1714 Reviewed by Geoffrey Garen.
1716 * wtf/win/WorkQueueWin.cpp:
1717 (WTF::WorkQueue::dispatchAfter):
1719 2017-05-13 Commit Queue <commit-queue@webkit.org>
1721 Unreviewed, rolling out r216808.
1722 https://bugs.webkit.org/show_bug.cgi?id=172075
1724 caused lldb to hang when debugging (Requested by smfr on
1729 "Use Mach exceptions instead of signals where possible"
1730 https://bugs.webkit.org/show_bug.cgi?id=171865
1731 http://trac.webkit.org/changeset/216808
1733 2017-05-12 Keith Miller <keith_miller@apple.com>
1735 Use Mach exceptions instead of signals where possible
1736 https://bugs.webkit.org/show_bug.cgi?id=171865
1738 Reviewed by Mark Lam.
1740 This patch enables using mach exceptions on darwin. The way the
1741 mach exception api works is that we create a mach port, which is
1742 like a file descriptor. We then wait for a message to arrive on
1743 that port in a thread. When another thread raises an exception (say
1744 due to a bad memory access) the OS sends our thread a message. The
1745 payload of that message is the register file of the crashing
1746 thread. We then call our custom handlers that change the state as
1747 needed. In order to restart the thread we send a payload back to
1748 the OS with an updated register file along with a success message
1751 This patch also makes thread messages work without signals by
1752 simply suspending the thread, and then running the message at that
1755 You can read more about mach exceptions here:
1756 http://www.cs.cmu.edu/afs/cs/project/mach/public/doc/unpublished/exception.ps
1757 and the Mach interface Generator (MiG) here:
1758 http://www.cs.cmu.edu/afs/cs/project/mach/public/doc/unpublished/mig.ps
1760 * Configurations/WTF.xcconfig:
1761 * WTF.xcodeproj/project.pbxproj:
1763 * wtf/PlatformRegisters.h:
1764 (WTF::registersFromUContext):
1765 * wtf/StackBounds.h:
1766 (WTF::StackBounds::StackBounds):
1767 * wtf/ThreadHolder.cpp:
1768 (WTF::ThreadHolder::~ThreadHolder):
1769 * wtf/ThreadMessage.cpp:
1770 (WTF::sendMessageUsingSignal):
1771 (WTF::sendMessageUsingMach):
1772 (WTF::deliverMessagesUsingMach):
1773 (WTF::sendMessageScoped):
1774 * wtf/ThreadMessage.h:
1777 (WTF::Thread::machThread):
1778 * wtf/mac/MachExceptions.defs: Copied from Source/WTF/wtf/ThreadMessage.h.
1779 * wtf/threads/Signals.cpp:
1780 (WTF::startMachExceptionHandlerThread):
1781 (WTF::fromMachException):
1783 (WTF::handleSignalsWithMach):
1784 (WTF::setExceptionPorts):
1785 (WTF::activeThreads):
1786 (WTF::registerThreadForMachExceptionHandling):
1787 (WTF::unregisterThreadForMachExceptionHandling):
1788 (WTF::installSignalHandler):
1789 (WTF::jscSignalHandler):
1790 * wtf/threads/Signals.h:
1792 2017-05-12 Ting-Wei Lan <lantw44@gmail.com>
1794 Include algorithm before using std::min
1795 https://bugs.webkit.org/show_bug.cgi?id=171733
1797 Reviewed by Chris Dumez.
1799 * wtf/text/StringCommon.h:
1801 2017-05-12 Andreas Kling <akling@apple.com>
1803 More aggressive memory kill limits.
1804 https://bugs.webkit.org/show_bug.cgi?id=172037
1805 <rdar://problem/31969082>
1807 Reviewed by Michael Saboff.
1809 Bring down the memory kill limits to 4GB for active processes, and 2GB for inactive.
1810 Also make MemoryUsagePolicy::Strict kick in above 1.5GB.
1812 * wtf/MemoryPressureHandler.cpp:
1813 (WTF::MemoryPressureHandler::thresholdForMemoryKill):
1814 (WTF::thresholdForPolicy):
1816 2017-05-12 Michael Saboff <msaboff@apple.com>
1818 [iOS] Use memory footprint to dynamically adjust behavior of allocators
1819 https://bugs.webkit.org/show_bug.cgi?id=171944
1821 Reviewed by Filip Pizlo.
1823 Moved the non-Windows implementation of RAMSize() to bmalloc/AvailableMemory.cpp and
1824 called the function availableMemory().
1827 (WTF::computeRAMSize):
1829 2017-05-12 Claudio Saavedra <csaavedra@igalia.com>
1831 [WPE] Add MemoryFootprintLinux to build
1833 Unreviewed build fix after r216731.
1835 * wtf/PlatformWPE.cmake:
1837 2017-05-12 Csaba Osztrogonác <ossy@webkit.org>
1839 Unreviewed trivial JSCOnly buildfix after r216731.
1840 https://bugs.webkit.org/show_bug.cgi?id=171693
1842 * wtf/PlatformJSCOnly.cmake:
1844 2017-05-11 Yusuke Suzuki <utatane.tea@gmail.com>
1846 [Win] Implement memoryFootprint for Windows
1847 https://bugs.webkit.org/show_bug.cgi?id=171693
1849 Reviewed by Alex Christensen.
1851 This patch implements memoryFootprint for Windows. In Windows, we calculate the size
1852 of private working set. This can be done by enumerating private pages in working set.
1854 And we also split MemoryFootprint.cpp to cocoa, linux, and win versions.
1856 * WTF.xcodeproj/project.pbxproj:
1857 * wtf/CMakeLists.txt:
1859 (WTF::MallocPtr::operator*):
1860 (WTF::MallocPtr::operator->):
1861 * wtf/PlatformGTK.cmake:
1862 * wtf/PlatformJSCOnly.cmake:
1863 * wtf/PlatformMac.cmake:
1864 * wtf/PlatformWin.cmake:
1865 * wtf/cocoa/MemoryFootprintCocoa.cpp: Copied from Source/WTF/wtf/MemoryFootprint.cpp.
1866 (WTF::memoryFootprint):
1867 * wtf/linux/MemoryFootprintLinux.cpp: Renamed from Source/WTF/wtf/MemoryFootprint.cpp.
1869 (WTF::memoryFootprint):
1870 * wtf/win/MemoryFootprintWin.cpp: Added.
1871 (WTF::memoryFootprint):
1873 2017-05-11 Don Olmstead <don.olmstead@am.sony.com>
1875 [CMake] Add HAVE check for regex.h
1876 https://bugs.webkit.org/show_bug.cgi?id=171950
1878 Reviewed by Michael Catanzaro.
1882 2017-05-11 Chris Dumez <cdumez@apple.com>
1884 Annotate Ref::ptr() with RETURNS_NONNULL
1885 https://bugs.webkit.org/show_bug.cgi?id=171996
1887 Reviewed by Andreas Kling.
1889 Annotate Ref::ptr() with RETURNS_NONNULL as it can never return null.
1892 (WTF::Ref::ptr): Deleted.
1894 2017-05-11 Joseph Pecoraro <pecoraro@apple.com>
1896 Remove Vibration API
1897 https://bugs.webkit.org/show_bug.cgi?id=171766
1899 Rubber-stamped by Alexey Proskuryakov.
1901 * wtf/FeatureDefines.h:
1903 2017-05-09 Sam Weinig <sam@webkit.org>
1905 Remove support for legacy Notifications
1906 https://bugs.webkit.org/show_bug.cgi?id=171487
1908 Reviewed by Jon Lee.
1910 * wtf/FeatureDefines.h:
1911 Remove definition of ENABLE_LEGACY_NOTIFICATIONS.
1913 2017-05-10 Adrian Perez de Castro <aperez@igalia.com>
1915 Remove some last remnants of the EFL port
1916 https://bugs.webkit.org/show_bug.cgi?id=171922
1918 Reviewed by Antonio Gomes.
1920 The EFL port is no more.
1922 * wtf/PlatformEfl.cmake: Removed.
1924 2017-05-10 Fujii Hironori <Hironori.Fujii@sony.com>
1926 [Win] StaticStringImpl in HTMLNames.cpp aren't constructed
1927 https://bugs.webkit.org/show_bug.cgi?id=171800
1929 Reviewed by Yusuke Suzuki.
1931 Global variables of StaticStringImpl in HTMLNames.cpp aren't
1932 constructed on Windows since Bug 171586. It seems that
1933 reinterpret_cast prevents constexpr's compile time initialization
1936 * wtf/text/StringImpl.h:
1937 (WTF::StringImplShape::StringImplShape): Added const char* and
1938 const char16_t* members in the union. Do not use reinterpret_cast
1939 in constexpr constructors.
1941 2017-05-09 Mark Lam <mark.lam@apple.com>
1943 Force StaticStringImpl constructor to use the constexpr versions of StringImplShape constructors.
1944 https://bugs.webkit.org/show_bug.cgi?id=171861
1946 Reviewed by Yusuke Suzuki.
1948 This is strictly necessary for correctness of the StaticStringImpl implementation.
1949 We force the constructor selection by adding an extra dummy argument to the
1950 constexpr versions of the StringImplShape constructors to disambiguate them from
1951 the non-constexpr versions.
1953 * wtf/text/StringImpl.h:
1954 (WTF::StringImplShape::StringImplShape):
1955 (WTF::StringImpl::StaticStringImpl::StaticStringImpl):
1957 2017-05-09 Zan Dobersek <zdobersek@igalia.com>
1959 Upstream the WPE port
1960 https://bugs.webkit.org/show_bug.cgi?id=171110
1962 Reviewed by Alex Christensen.
1965 * wtf/PlatformWPE.cmake: Added.
1966 * wtf/glib/RunLoopSourcePriority.h:
1968 2017-05-08 Mark Lam <mark.lam@apple.com>
1970 Speculative Windows build fix after r216428.
1971 https://bugs.webkit.org/show_bug.cgi?id=171776
1977 2017-05-08 Mark Lam <mark.lam@apple.com>
1979 Introduce ExceptionScope::assertNoException() and releaseAssertNoException().
1980 https://bugs.webkit.org/show_bug.cgi?id=171776
1982 Reviewed by Keith Miller.
1984 1. Add an option to skip some number of top frames when capturing the StackTrace.
1985 2. Add an option to use an indentation string when dumping the StackTrace.
1987 * wtf/StackTrace.cpp:
1988 (WTF::StackTrace::captureStackTrace):
1989 (WTF::StackTrace::dump):
1992 2017-05-05 Yusuke Suzuki <utatane.tea@gmail.com>
1994 [WTF] Use memoryFootprint for MemoryUsage retrieval in Linux
1995 https://bugs.webkit.org/show_bug.cgi?id=171757
1997 Reviewed by Michael Catanzaro.
1999 This patch leverages memoryFootprint() to retrieve physical footprint in Linux.
2001 * wtf/linux/MemoryPressureHandlerLinux.cpp:
2002 (WTF::MemoryPressureHandler::ReliefLogger::platformMemoryUsage):
2004 2017-05-05 Don Olmstead <don.olmstead@am.sony.com>
2006 [WTF] Do not export deleted constructor in StringView
2007 https://bugs.webkit.org/show_bug.cgi?id=171751
2009 Reviewed by Alexey Proskuryakov.
2011 * wtf/text/StringView.h:
2013 2017-05-05 Yusuke Suzuki <utatane.tea@gmail.com>
2015 [GTK][JSCOnly] Merge MainThread implementations and use generic one
2016 https://bugs.webkit.org/show_bug.cgi?id=171738
2018 Reviewed by Michael Catanzaro.
2020 GLib MainThread implementation is generic enough to be used in JSCOnly.
2021 We move it to generic/ and GTK (GLib ports) and JSCOnly use it.
2022 And we also drop GLib MainThread's isMainThread function because
2023 generic thread ID one is enough.
2025 This patch also cleans up initializing main thread code by using std::call_once.
2027 * wtf/MainThread.cpp:
2028 (WTF::initializeMainThread):
2029 (WTF::isMainThread):
2030 (WTF::initializeMainThreadToProcessMainThread):
2031 (WTF::initializeWebThread):
2032 (WTF::canAccessThreadLocalDataForThread):
2033 (WTF::initializeMainThreadOnce): Deleted.
2034 (WTF::initializeMainThreadToProcessMainThreadOnce): Deleted.
2035 (WTF::initializeWebThreadOnce): Deleted.
2036 * wtf/PlatformGTK.cmake:
2037 * wtf/PlatformJSCOnly.cmake:
2038 * wtf/generic/MainThreadGeneric.cpp:
2039 (WTF::MainThreadDispatcher::MainThreadDispatcher):
2040 (WTF::MainThreadDispatcher::schedule):
2041 (WTF::MainThreadDispatcher::fired):
2042 (WTF::scheduleDispatchFunctionsOnMainThread):
2043 * wtf/glib/MainThreadGLib.cpp: Removed.
2045 2017-05-04 Commit Queue <commit-queue@webkit.org>
2047 Unreviewed, rolling out r216206.
2048 https://bugs.webkit.org/show_bug.cgi?id=171714
2050 Multiple LayoutTests crashing in Document::page() (Requested
2055 "Remove support for legacy Notifications"
2056 https://bugs.webkit.org/show_bug.cgi?id=171487
2057 http://trac.webkit.org/changeset/216206
2059 2017-05-04 Don Olmstead <don.olmstead@am.sony.com>
2061 [Win] Remove redundant macros that are set in the CMake config
2062 https://bugs.webkit.org/show_bug.cgi?id=171571
2064 Reviewed by Brent Fulgham.
2068 2017-05-04 Mark Lam <mark.lam@apple.com>
2070 NeverDestroyed<String>(ASCIILiteral(...)) is not thread safe.
2071 https://bugs.webkit.org/show_bug.cgi?id=171586
2072 <rdar://problem/31873190>
2074 Reviewed by Yusuke Suzuki.
2076 StaticStringImpl is meant to be thread-safe. However, it has a bug: it did not
2077 set the s_hashFlagDidReportCost flag. As a result, if cost() is called on it,
2078 different threads may try to change its flags bits at the same time. This patch
2079 changes StaticStringImpl to always set the s_hashFlagDidReportCost flag.
2081 Also factored out StringImplShape and made StringImpl and StaticStringImpl extend
2082 it. This makes it more clear that the 2 are intended to have the same shape.
2083 Note: there is already a static_assert that the 2 have the same size. This
2084 change also ensures that they both have the same shape, which is a requirement in
2085 order for StaticStringImpl to work.
2087 Introduced the MAKE_STATIC_STRING_IMPL macro as a convenient way to instantiate
2088 StaticStringImpls from literal strings. This allows us to trivially change
2090 NeverDestroyed<String> myString(ASCIILiteral("myString"));
2094 NeverDestroyed<String> myString(MAKE_STATIC_STRING_IMPL("myString"));
2096 and by so doing, make it thread-safe.
2098 MAKE_STATIC_STRING_IMPL instantiates a lambda function to create the static
2101 * wtf/text/StringImpl.h:
2102 (WTF::StringImplShape::StringImplShape):
2103 (WTF::StringImpl::StringImpl):
2104 (WTF::StringImpl::cost):
2105 (WTF::StringImpl::setHash):
2106 (WTF::StringImpl::StaticStringImpl::StaticStringImpl):
2107 (WTF::StringImpl::StaticStringImpl::operator StringImpl&):
2108 * wtf/text/WTFString.h:
2109 (WTF::String::String):
2110 * wtf/text/icu/TextBreakIteratorICU.h:
2113 2017-05-04 Sam Weinig <sam@webkit.org>
2115 Remove support for legacy Notifications
2116 https://bugs.webkit.org/show_bug.cgi?id=171487
2118 Reviewed by Jon Lee.
2120 * wtf/FeatureDefines.h:
2121 Remove definition of ENABLE_LEGACY_NOTIFICATIONS.
2123 2017-05-04 Yusuke Suzuki <utatane.tea@gmail.com>
2125 [GTK][JSCOnly] Implement memoryFootprint for Linux
2126 https://bugs.webkit.org/show_bug.cgi?id=171680
2128 Reviewed by Carlos Alberto Lopez Perez.
2130 Darwin's phys_footprint returns the amount of dirty anonymous memory in the process.
2131 This patch implements the same thing in Linux by reading /proc/self/smaps.
2132 We sum sizes of private dirty pages in anonymous regions.
2134 * wtf/MemoryFootprint.cpp:
2136 (WTF::memoryFootprint):
2138 2017-05-03 Mark Lam <mark.lam@apple.com>
2140 Use the CLoop for CPU(ARM64E).
2141 https://bugs.webkit.org/show_bug.cgi?id=171620
2142 <rdar://problem/31973027>
2144 Reviewed by Geoffrey Garen.
2148 2017-05-02 Daniel Bates <dabates@apple.com>
2150 Fix the build after <https://trac.webkit.org/changeset/216102>
2151 (https://bugs.webkit.org/show_bug.cgi?id=170925)
2153 Export into global scope ASCIICaseInsensitiveStringViewHashTranslator.
2155 Also fix indentation of member functions of ASCIICaseInsensitiveStringViewHashTranslator.
2157 * wtf/text/StringHash.h:
2159 2017-05-02 Daniel Bates <dabates@apple.com>
2161 Using StringView.split() instead of String.split() in some places
2162 https://bugs.webkit.org/show_bug.cgi?id=170925
2164 Reviewed by Darin Adler and Sam Weinig.
2166 * wtf/HashMap.h: Add HashMap::get() overload that takes a HashTranslator.
2167 * wtf/text/StringHash.h:
2168 (WebCore::ASCIICaseInsensitiveStringViewHashTranslator::hash): Added.
2169 (WebCore::ASCIICaseInsensitiveStringViewHashTranslator::equal): Added.
2171 2017-05-01 Dan Bernstein <mitz@apple.com>
2173 [Xcode] It’s easy to accidentally install a WTF header outside /usr/local/include/wtf
2174 https://bugs.webkit.org/show_bug.cgi?id=171533
2176 Reviewed by Andy Estes.
2178 * WTF.xcodeproj/project.pbxproj: Removed the WTF target’s Headers build phase. Its existence
2179 was making it easy to accidentally add a header to the target and make it Private, which
2180 would have Xcode install a copy of it right under /usr/local/include, in addition to the
2181 copy installed under /usr/local/include/wtf by the Copy WTF Headers target.
2182 Also got rid of INSTALL_PATH_PREFIX in the script build phase in the Copy WTF Headers
2183 target, because it is being never set anymore.
2185 2017-05-01 Dan Bernstein <mitz@apple.com>
2187 WTF installs an extra copy of a header outside /usr/local/include/wtf
2189 * WTF.xcodeproj/project.pbxproj: Demoted CPUTime.h from Private to Project.
2191 2017-05-01 Daniel Bates <dabates@apple.com>
2193 Cleanup: Change ASCIICaseInsensitiveHash from a class to a struct
2194 https://bugs.webkit.org/show_bug.cgi?id=171460
2196 Reviewed by Sam Weinig.
2198 All of the members of ASCIICaseInsensitiveHash have public visibility.
2199 We are underutilizing the purpose of a class - defaults to private
2200 visibility of members. We should change ASCIICaseInsensitiveHash from
2201 a class to a struct, which by definition defaults to public visibility
2204 * wtf/text/StringHash.h:
2206 2017-04-29 Yusuke Suzuki <utatane.tea@gmail.com>
2208 Move WebCore CPUTime to WTF and implement it in all the platforms
2209 https://bugs.webkit.org/show_bug.cgi?id=171477
2211 Reviewed by Chris Dumez.
2213 We move WebCore::CPUTime to WTF::CPUTime since it is useful even in JSC
2214 and it does not depend on any external libraries.
2215 And we additionally implement WTF::CPUTime in all the platforms: Windows and Unix.
2217 In CPUTime, instead of holding int64_t, we hold MonotonicTime and Seconds.
2219 * WTF.xcodeproj/project.pbxproj:
2220 * wtf/CMakeLists.txt:
2221 * wtf/CPUTime.cpp: Copied from Source/WebCore/platform/CPUTime.cpp.
2222 (WTF::CPUTime::percentageCPUUsageSince):
2223 * wtf/CPUTime.h: Renamed from Source/WebCore/platform/CPUTime.h.
2224 * wtf/PlatformEfl.cmake:
2225 * wtf/PlatformGTK.cmake:
2226 * wtf/PlatformJSCOnly.cmake:
2227 * wtf/PlatformMac.cmake:
2228 * wtf/PlatformWin.cmake:
2229 * wtf/cocoa/CPUTimeCocoa.mm: Renamed from Source/WebCore/platform/cocoa/CPUTimeCocoa.mm.
2230 (WTF::timeValueToMicroseconds):
2231 (WTF::CPUTime::get):
2232 * wtf/unix/CPUTimeUnix.cpp: Renamed from Source/WebCore/platform/CPUTime.cpp.
2233 (WTF::timevalToSeconds):
2234 (WTF::CPUTime::get):
2235 * wtf/win/CPUTimeWin.cpp: Added.
2236 (WTF::fileTimeToSeconds):
2237 (WTF::CPUTime::get):
2239 2017-04-28 Simon Fraser <simon.fraser@apple.com>
2241 Add system trace points for Document::updateTouchEventRegions()
2242 https://bugs.webkit.org/show_bug.cgi?id=171470
2243 rdar://problem/31901239
2245 Reviewed by Tim Horton.
2247 Add trace markers for updateTouchEventRegions.
2249 * wtf/SystemTracing.h:
2251 2017-04-28 Daniel Bates <dabates@apple.com>
2253 Add StringView::toExistingAtomicString()
2254 https://bugs.webkit.org/show_bug.cgi?id=171405
2256 Reviewed by Andreas Kling.
2258 Similar to the reasons for JSString::toExistingAtomicString() we should expose a way to
2259 convert a StringView to an existing atomic string. Looking up an atomic string is more
2260 efficient that creating one, which requires a lookup and memory allocation.
2262 We are not making use of StringView::toExistingAtomicString() now, but will in the patch
2263 for <https://bugs.webkit.org/show_bug.cgi?id=170925>.
2265 * wtf/text/AtomicStringImpl.cpp:
2266 (WTF::AtomicStringImpl::lookUp): Modified to take a const LChar*/UChar*.
2267 (WTF::AtomicStringImpl::lookUpInternal): Renamed to AtomicStringImpl::lookup() to avoid
2268 an extra function call.
2269 * wtf/text/AtomicStringImpl.h:
2270 * wtf/text/StringView.h:
2271 (WTF::StringView::toExistingAtomicString): Added.
2273 2017-04-28 Chris Dumez <cdumez@apple.com>
2275 Update DOMTokenList.replace() to match the latest DOM specification
2276 https://bugs.webkit.org/show_bug.cgi?id=171388
2278 Reviewed by Alex Christensen.
2280 Add Vector::findMatching() API which takes in a lambda function for convenience.
2281 Add optional startIndex parameter to Vector::removeFirstMatching() / removeAllMatching()
2282 to remove items only after given index.
2285 (WTF::minCapacity>::findMatching):
2286 (WTF::minCapacity>::find):
2287 (WTF::minCapacity>::removeFirstMatching):
2288 (WTF::minCapacity>::removeAllMatching):
2290 2017-04-27 Carlos Garcia Campos <cgarcia@igalia.com>
2292 Move UUID from WebCore/platform to WTF
2293 https://bugs.webkit.org/show_bug.cgi?id=171372
2295 Reviewed by Michael Catanzaro.
2297 * WTF.xcodeproj/project.pbxproj:
2298 * wtf/CMakeLists.txt:
2299 * wtf/UUID.cpp: Renamed from Source/WebCore/platform/UUID.cpp.
2300 * wtf/UUID.h: Renamed from Source/WebCore/platform/UUID.h.
2302 2017-04-26 Keith Miller <keith_miller@apple.com>
2304 LocklessBag needs a destructor
2305 https://bugs.webkit.org/show_bug.cgi?id=171334
2307 Reviewed by Mark Lam.
2309 Currently, if the bag is destructed any remaining nodes in the bag will
2312 * wtf/LocklessBag.h:
2313 (WTF::LocklessBag::consumeAll):
2314 (WTF::LocklessBag::~LocklessBag):
2315 * wtf/threads/Signals.cpp:
2316 (WTF::jscSignalHandler):
2317 (WTF::installSignalHandler):
2319 2017-04-26 Don Olmstead <don.olmstead@am.sony.com>
2321 [ARM] Enable GCC visibility
2322 https://bugs.webkit.org/show_bug.cgi?id=171296
2324 Reviewed by Michael Catanzaro.
2328 2017-04-26 Yusuke Suzuki <utatane.tea@gmail.com>
2330 sendMessageScoped's signal handler calls LocklessBag::consumeAll, which causes heap deallocation in signal handler and leads deadlock
2331 https://bugs.webkit.org/show_bug.cgi?id=171319
2333 Reviewed by Keith Miller.
2335 In sendMessageScoped, we call LocklessBag<SignalHandler>::consumeAll `thread->threadMessages().consumeAll()`.
2336 In LocklessBag::consumeAll, we call `delete` on Nodes.
2337 The problem is that this is called under the context of signal handler. Thus, when calling this, the original
2338 thread may hold the lock in bmalloc. In that case, this `delete` call attempts to lock the heap lock recursively,
2339 and causes deadlock.
2341 Instead, this patch transfers the LocklessBag's Node to the sender thread. And the sender thread deletes it instead.
2343 * wtf/LocklessBag.h:
2344 (WTF::LocklessBag::consumeAllWithNode):
2345 * wtf/ThreadMessage.cpp:
2346 (WTF::ThreadMessageData::ThreadMessageData):
2347 (WTF::sendMessageScoped):
2349 2017-04-25 Don Olmstead <don.olmstead@am.sony.com>
2351 [Win] Use Clang's __has_declspec_attribute for export macros
2352 https://bugs.webkit.org/show_bug.cgi?id=171240
2354 Reviewed by Alex Christensen.
2357 * wtf/ExportMacros.h:
2360 2017-04-25 Keith Miller <keith_miller@apple.com>
2362 Our signal handler shouldn't print when sigaction succeeds
2363 https://bugs.webkit.org/show_bug.cgi?id=171286
2365 Reviewed by Michael Saboff.
2367 It turns out !result is not the same as !!result.
2369 * wtf/threads/Signals.cpp:
2370 (WTF::jscSignalHandler):
2372 2017-04-25 Myles C. Maxfield <mmaxfield@apple.com>
2374 Add performance test for FontCache::systemFallbackForCharacters()
2375 https://bugs.webkit.org/show_bug.cgi?id=170842
2377 Reviewed by Tim Horton.
2379 * wtf/unicode/CharacterNames.h:
2381 2017-04-24 Andy VanWagoner <thetalecrafter@gmail.com>
2383 Clean up ICU headers
2384 https://bugs.webkit.org/show_bug.cgi?id=170997
2386 Reviewed by JF Bastien.
2388 Update all icu headers to 55.1
2390 * icu/LICENSE: Update copyright
2391 * icu/README: Explain ICU headers for OS X better
2392 * icu/unicode/localpointer.h:
2393 (LocalPointer::LocalPointer):
2394 (LocalPointer::adoptInsteadAndCheckErrorCode):
2395 * icu/unicode/platform.h:
2396 * icu/unicode/putil.h:
2397 * icu/unicode/std_string.h:
2398 * icu/unicode/ubrk.h:
2399 * icu/unicode/uchar.h:
2400 * icu/unicode/ucnv.h:
2401 * icu/unicode/ucol.h:
2402 * icu/unicode/uconfig.h:
2403 * icu/unicode/ucurr.h:
2404 * icu/unicode/uloc.h:
2405 * icu/unicode/umachine.h:
2406 * icu/unicode/unistr.h:
2407 (UnicodeString::getArrayStart):
2408 (UnicodeString::UnicodeString):
2409 (UnicodeString::hasShortLength):
2410 (UnicodeString::getShortLength):
2411 (UnicodeString::length):
2412 (UnicodeString::getCapacity):
2413 (UnicodeString::isBogus):
2414 (UnicodeString::isWritable):
2415 (UnicodeString::isBufferWritable):
2416 (UnicodeString::getBuffer):
2417 (UnicodeString::isEmpty):
2418 (UnicodeString::setZeroLength):
2419 (UnicodeString::setShortLength):
2420 (UnicodeString::setLength):
2421 (UnicodeString::setToEmpty):
2422 (UnicodeString::remove):
2423 * icu/unicode/urename.h:
2424 * icu/unicode/uscript.h:
2425 * icu/unicode/uset.h:
2426 * icu/unicode/ustring.h:
2427 * icu/unicode/utf8.h:
2428 * icu/unicode/utypes.h:
2429 * icu/unicode/uvernum.h:
2431 2017-04-24 Yusuke Suzuki <utatane.tea@gmail.com>
2433 Unreviewed, fix Windows build after r215715
2434 https://bugs.webkit.org/show_bug.cgi?id=171199
2438 2017-04-24 Yusuke Suzuki <utatane.tea@gmail.com>
2440 [WTF] Move JSC tools/StackTrace to WTF and unify stack trace dump code
2441 https://bugs.webkit.org/show_bug.cgi?id=171199
2443 Reviewed by Mark Lam.
2445 JSC tools/StackTrace's dump code is almost identical to WTF Assertions'
2446 stack trace dump code. This patch moves tools/StackTrace to WTF and use
2447 it in Assertions. It unifies the two duplicate implementations into one.
2449 * WTF.xcodeproj/project.pbxproj:
2450 * wtf/Assertions.cpp:
2451 * wtf/CMakeLists.txt:
2453 * wtf/StackTrace.cpp: Renamed from Source/JavaScriptCore/tools/StackTrace.cpp.
2454 (WTF::StackTrace::captureStackTrace):
2455 (WTF::StackTrace::dump):
2456 * wtf/StackTrace.h: Copied from Source/JavaScriptCore/tools/StackTrace.h.
2457 (WTF::StackTrace::StackTrace):
2458 (WTF::StackTrace::stack):
2459 (WTF::StackTrace::DemangleEntry::mangledName):
2460 (WTF::StackTrace::DemangleEntry::demangledName):
2461 (WTF::StackTrace::DemangleEntry::DemangleEntry):
2462 * wtf/SystemFree.h: Renamed from Source/JavaScriptCore/tools/StackTrace.h.
2463 (WTF::SystemFree::operator()):
2465 2017-04-24 Yusuke Suzuki <utatane.tea@gmail.com>
2467 [AppleWin] The procedure entry point ?waitForThreadCompletion@WTF@@YAHI@Z could not be located in the dynamic link library WebKitQuartzCoreAdditions.dll
2468 https://bugs.webkit.org/show_bug.cgi?id=171029
2470 Reviewed by Brent Fulgham.
2472 While WTF Threading APIs are updated, WebKitQuartzCoreAdditions.dll in Windows uses some of the old APIs,
2473 waitForThreadCompletion and createThread. This patch implements both on top of the new APIs.
2474 These APIs are only exposed in Windows for this compatibility problem and new code should not use it.
2476 * wtf/ThreadHolder.cpp:
2477 (WTF::ThreadHolder::initialize):
2478 * wtf/ThreadHolder.h:
2479 * wtf/ThreadHolderWin.cpp:
2480 (WTF::ThreadHolder::get):
2481 (WTF::ThreadHolder::platformInitialize):
2482 (WTF::ThreadHolder::destruct):
2484 * wtf/ThreadingWin.cpp:
2485 (WTF::createThread):
2486 (WTF::waitForThreadCompletion):
2488 2017-04-24 Carlos Garcia Campos <cgarcia@igalia.com>
2490 [GTK] Switch to use ENABLE_REMOTE_INSPECTOR instead of ENABLE_INSPECTOR_SERVER for the remote inspector
2491 https://bugs.webkit.org/show_bug.cgi?id=166680
2493 Reviewed by Michael Catanzaro.
2495 Add GRefPtr hash traits to allow using GRefPtr as a key of HashMaps.
2497 * wtf/glib/GRefPtr.h:
2498 (WTF::HashTraits<GRefPtr<P>>::emptyValue):
2499 (WTF::HashTraits<GRefPtr<P>>::peek):
2500 (WTF::HashTraits<GRefPtr<P>>::customDeleteBucket):
2502 2017-04-22 Yusuke Suzuki <utatane.tea@gmail.com>
2504 [JSC] Get stack pointer without pthread attr
2505 https://bugs.webkit.org/show_bug.cgi?id=171162
2507 Reviewed by Mark Lam.
2509 If HAVE(MACHINE_CONTEXT) is not enabled, we get stack base and boundary by using
2510 pthread_attr functions. However, it is wrong since this function can be called
2511 after the thread is suspended. In that case, we should not call any functions
2512 that is not async signal safe. For example, pthread_getattr_np calls malloc.
2514 Instead we use getApproximateStackPointer(), which returns approximate stack pointer.
2517 * wtf/ThreadingPthreads.cpp:
2518 (WTF::getApproximateStackPointer):
2519 (WTF::isOnAlternativeSignalStack):
2520 When gathering conservative roots, we should keep stack pointer pointing stack.
2521 And if concurrent GC is enabled, we always need to keep the above invariant.
2522 So, we do not support alternative signal stack.
2524 (WTF::Thread::signalHandlerSuspendResume):
2525 (WTF::Thread::getRegisters):
2527 2017-04-22 Yusuke Suzuki <utatane.tea@gmail.com>
2529 REGRESSION(r215638): [Linux] Several worker tests are crashing in Thread::signalHandlerSuspendResume after r215638
2530 https://bugs.webkit.org/show_bug.cgi?id=171159
2532 Reviewed by Michael Catanzaro.
2534 Now, SIGUSR2 is used by ThreadMessage. Instead SIGUSR1 becomes empty.
2535 We should use some signal, that is not managed by WTF Signal mechanism
2536 because the behaivor of this suspend and resume is a bit tricky.
2537 For example, we set a bit tricky signal mask to sigaction to temporary
2538 block SIGUSR2 in the handler to avoid nested SIGUSR2. And we cannot
2539 use ThreadMessage to implement this mechanism because this suspend
2540 and resume handler will stop in the middle of the handler by sigsuspend.
2541 It is not the expected semantics by ThreadMessage.
2543 So now, we use SIGUSR1 instead. And we note that SIGUSR1 is used for
2546 * wtf/ThreadingPthreads.cpp:
2547 * wtf/threads/Signals.h:
2549 2017-04-20 Sam Weinig <sam@webkit.org>
2551 Split cryptographic digest computation and parsing out of CSP code so it can be reused
2552 https://bugs.webkit.org/show_bug.cgi?id=171076
2554 Reviewed by Chris Dumez.
2556 * wtf/text/Base64.cpp:
2557 (WTF::base64Decode):
2558 (WTF::base64URLDecode):
2559 Add overloads for base64Decode and base64URLDecode that take a StringView, to avoid allocations
2562 * wtf/text/Base64.h:
2563 (WTF::isBase64OrBase64URLCharacter):
2564 Move helper predicate used for parsing either type of Base64 encoded string from WebCore.
2566 2017-04-21 Keith Miller <keith_miller@apple.com>
2568 Unreviewed, rolling out r215634.
2570 underlying build issues should have been fixed
2574 "Unreviewed, rolling out r215620 and r215623."
2575 https://bugs.webkit.org/show_bug.cgi?id=171139
2576 http://trac.webkit.org/changeset/215634
2578 2017-04-21 Keith Miller <keith_miller@apple.com>
2580 Remove LL/SC from Atomics
2581 https://bugs.webkit.org/show_bug.cgi?id=171141
2583 Reviewed by Saam Barati.
2585 Adding load link and store conditionally was not an actual progression
2586 and the existing code is causing problems for users of Atomics. So let's
2591 (WTF::Atomic::exchange):
2592 (WTF::Atomic::transaction):
2593 (WTF::Atomic::transactionRelaxed):
2594 (WTF::Atomic::prepare): Deleted.
2595 (WTF::Atomic::attempt): Deleted.
2597 (WTF::WordType>::concurrentTestAndSet):
2598 (WTF::WordType>::concurrentTestAndClear):
2599 * wtf/LockAlgorithm.h:
2600 (WTF::LockAlgorithm::lockFast):
2601 (WTF::LockAlgorithm::unlockFast):
2603 2017-04-21 Commit Queue <commit-queue@webkit.org>
2605 Unreviewed, rolling out r215620 and r215623.
2606 https://bugs.webkit.org/show_bug.cgi?id=171139
2608 broke arm64 build (Requested by keith_miller on #webkit).
2610 Reverted changesets:
2613 https://bugs.webkit.org/show_bug.cgi?id=170976
2614 http://trac.webkit.org/changeset/215620
2616 "Unreviewed, fix Cloop build."
2617 http://trac.webkit.org/changeset/215623
2619 2017-04-20 Keith Miller <keith_miller@apple.com>
2622 https://bugs.webkit.org/show_bug.cgi?id=170976
2624 Reviewed by Filip Pizlo.
2626 This patch adds a bunch of new functionality to WTF. First, it add
2627 a new data structure of a lockless bag. The LocklessBag class can
2628 be used as either a multi-writer multi-reader lockless bag or a
2629 multi-writer single consumer lockless bag.
2631 Next, this patch adds an abstraction around sigaction in WTF.
2632 Basically, you can add a handler, which can be an arbitrary
2633 lambda. Although it should still be safe for the signal you are
2634 handling. the signal handler manager will then do all the
2635 appropriate handling of chaining:
2637 In the SIGUSR case we always forward the signal to any other
2638 non-default handler installed before us. We need to do this,
2639 otherwise, since it's not possible to tell if a SIGUSR was
2640 intended exlusively for our handlers. Signal handlers don't record
2641 how many times they were sent only that there is at least one
2644 In the faulting cases we require that every handle be able to
2645 recognise a fault they installed, vs crashes. If none of our
2646 handlers claim to have handled the fault we will forward the
2647 fault. If a handler was installed before the first fault handler
2648 we simply call that handler and rely on them to take the
2649 appropriate action. If no handler was installed before our first
2650 handler we restore the default handler and allow the fault to
2653 Finally, this patch adds a signal based messaging system. This
2654 system allows the user to run an arbitrary lambda from the SIGUSR2
2655 signal handler of any target WTF::Thread. This is already in use
2656 for the VMTraps API which allows us to kill rogue VMs by sending
2657 the VM's running WTF::Thread a SIGUSR and requesting it jetison
2658 all optimized code and throw an uncatchable exception from all
2659 function entries/loop backedges. In the future, we will also use
2660 this API for Wasm to reset the instruction caches in currently
2661 executing Wasm threads.
2663 * WTF.xcodeproj/project.pbxproj:
2665 (WTF::Atomic::Atomic):
2666 * wtf/LocklessBag.h: Added.
2667 (WTF::LocklessBag::LocklessBag):
2668 (WTF::LocklessBag::add):
2669 (WTF::LocklessBag::iterate):
2670 (WTF::LocklessBag::consumeAll):
2671 * wtf/ThreadMessage.cpp: Added.
2672 (WTF::ThreadMessageData::ThreadMessageData):
2673 (WTF::initializeThreadMessages):
2674 (WTF::sendMessageScoped):
2675 * wtf/ThreadMessage.h: Added.
2677 * wtf/Threading.cpp:
2678 (WTF::initializeThreading):
2680 (WTF::Thread::threadMessages):
2681 * wtf/ThreadingPthreads.cpp:
2682 (WTF::Thread::currentMayBeNull):
2683 (WTF::Thread::current):
2684 (WTF::Thread::signal):
2685 * wtf/threads/Signals.cpp: Added.
2686 (WTF::jscSignalHandler):
2687 (WTF::installSignalHandler):
2688 * wtf/threads/Signals.h: Added.
2689 (WTF::toSystemSignal):
2690 (WTF::fromSystemSignal):
2692 2017-04-21 Konstantin Tokarev <annulen@yandex.ru>
2694 [cmake] WTF target should not have wtf and subdirectries in public interface
2695 https://bugs.webkit.org/show_bug.cgi?id=171115
2697 Reviewed by Michael Catanzaro.
2699 In r209665 WEBCORE_FRAMEWORK macro started to export INCLUDE_DIRECTORIES of
2700 targets as their public interface, so that linked targets can use them
2701 implicitly without copying directory lists around. This matches existing
2702 practice for all targets except WTF, headers from which are always included
2703 with full path starting from "<wtf/...".
2705 Since r209665 it became possible to include headers from wtf or its
2706 subdirectories in CMake builds without using "<wtf/..." path. It should
2709 * wtf/CMakeLists.txt: WTF/wtf and its sudirectories should not be in
2710 public include paths of WTF target.
2712 2017-04-20 Sam Weinig <sam@webkit.org>
2714 Move notFound into its own file
2715 https://bugs.webkit.org/show_bug.cgi?id=170972
2717 Reviewed by Zalan Bujtas.
2719 It is odd to require including <wtf/Vector.h> just to use WTF::notFound.
2720 This is not causing any current problems, but does in few changes I have
2723 * WTF.xcodeproj/project.pbxproj:
2724 * wtf/NotFound.h: Added.
2726 * wtf/text/StringCommon.h:
2728 2017-04-20 Filip Pizlo <fpizlo@apple.com>
2730 Optimize SharedArrayBuffer in the DFG+FTL
2731 https://bugs.webkit.org/show_bug.cgi?id=164108
2733 Reviewed by Saam Barati.
2735 Made small changes as part of benchmarking the JS versions of these locks.
2737 * benchmarks/LockSpeedTest.cpp:
2738 * benchmarks/ToyLocks.h:
2742 2017-04-19 Youenn Fablet <youenn@apple.com>
2744 [Win] Activate streams API by default
2745 https://bugs.webkit.org/show_bug.cgi?id=171000
2747 Reviewed by Brent Fulgham.
2749 * wtf/FeatureDefines.h:
2751 2017-04-19 David Kilzer <ddkilzer@apple.com>
2753 Vector.h: error: 'auto' not allowed in lambda parameter
2754 <https://webkit.org/b/171010>
2755 <rdar://problem/31716076>
2757 Reviewed by Saam Barati.
2760 (WTF::removeRepeatedElements): Replace 'auto' with a specific
2761 type, 'T', based on a Vector<> template type.
2763 2017-04-19 Ryan Haddad <ryanhaddad@apple.com>
2765 Unreviewed, rolling out r215518.
2767 This change appears to have broken the Windows build.
2771 "Move notFound into its own file"
2772 https://bugs.webkit.org/show_bug.cgi?id=170972
2773 http://trac.webkit.org/changeset/215518
2775 2017-04-19 Sam Weinig <sam@webkit.org>
2777 Move notFound into its own file
2778 https://bugs.webkit.org/show_bug.cgi?id=170972
2780 Reviewed by Zalan Bujtas.
2782 It is odd to require including <wtf/Vector.h> just to use WTF::notFound.
2783 This is not causing any current problems, but does in few changes I have
2786 * WTF.xcodeproj/project.pbxproj:
2787 * wtf/NotFound.h: Added.
2789 * wtf/text/StringCommon.h:
2791 2017-04-18 Carlos Garcia Campos <cgarcia@igalia.com>
2793 [GLIB] Define priorities also for async network IO tasks
2794 https://bugs.webkit.org/show_bug.cgi?id=170905
2796 Reviewed by Žan Doberšek.
2798 Add AsyncIONetwork, DiskCacheRead and DiskCacheWrite priorities.
2800 * wtf/glib/RunLoopSourcePriority.h:
2802 2017-04-18 Yusuke Suzuki <utatane.tea@gmail.com>
2804 [JSC][GTK] glib RunLoop does not accept negative start interval
2805 https://bugs.webkit.org/show_bug.cgi?id=170775
2807 Reviewed by Saam Barati.
2809 RunLoop::Timer for glib does not accept negative start interval.
2810 We use 0_s if the given value is negative.
2812 * wtf/glib/RunLoopGLib.cpp:
2813 (WTF::RunLoop::TimerBase::secondsUntilFire):
2815 2017-04-17 Alex Christensen <achristensen@webkit.org>
2817 Allow Variants of RetainPtrs
2818 https://bugs.webkit.org/show_bug.cgi?id=170923
2820 Reviewed by Tim Horton and Sam Weinig.
2823 (WTF::RetainPtr::operator&): Deleted.
2824 Operator& was causing a compile error when making Variant<RetainPtr<T>, ...>
2825 and because it is strange and only used once, let's just remove it.
2829 Use std::addressof instead of operator& which could be overloaded to return any type with any meaning.
2831 2017-04-17 Youenn Fablet <youenn@apple.com>
2833 Disable outdated WritableStream API
2834 https://bugs.webkit.org/show_bug.cgi?id=170749
2835 <rdar://problem/31446233>
2837 Reviewed by Alex Christensen.
2839 Replacing READABLE_STREAM_API, READABLE_BYTE_STREAM_API and WRITABLE_STREAM_API compilation flag by:
2840 - A STREAMS_API compilation flag.
2841 - A ReadableByteStreamAPI and WritableStreamAPI runtime flags, turned off except for RWT and DRT.
2843 * wtf/FeatureDefines.h:
2845 2017-04-17 Dan Bernstein <mitz@apple.com>
2847 [Cocoa] Move isNullFunctionPointer down into WTF
2848 https://bugs.webkit.org/show_bug.cgi?id=170892
2850 Reviewed by Sam Weinig.
2852 Test: TestWebKitAPI/Tests/WTF/darwin/WeakLinking.cpp
2854 * WTF.xcodeproj/project.pbxproj: Added reference to new file.
2855 * wtf/darwin: Added.
2856 * wtf/darwin/WeakLinking.h: Added.
2857 (WTF::isNullFunctionPointer): Copied from ResourceLoadStatisticsClassifierCocoa.cpp in
2858 WebKit2 and changed into a function template that works with any function pointer.
2860 2017-04-17 Ryan Haddad <ryanhaddad@apple.com>
2862 Unreviewed, rolling out r215366.
2864 This test is failing on performance bots.
2868 "Add performance test for asking the platform for a font for
2870 https://bugs.webkit.org/show_bug.cgi?id=170842
2871 http://trac.webkit.org/changeset/215366
2873 2017-04-17 Yusuke Suzuki <utatane.tea@gmail.com>
2875 [JSCOnly] Fix build failures in macOS
2876 https://bugs.webkit.org/show_bug.cgi?id=170887
2878 Reviewed by Alex Christensen.
2880 JSCOnly port does not use mac/MainThread.cpp.
2881 We change the ifdef gurard to use generic implementaion in JSCOnly on macOS.
2883 * wtf/MainThread.cpp:
2884 * wtf/PlatformJSCOnly.cmake:
2886 2017-04-17 JF Bastien <jfbastien@apple.com>
2888 B3: don't allow unsigned offsets in Value
2889 https://bugs.webkit.org/show_bug.cgi?id=170692
2891 Reviewed by Filip Pizlo.
2893 Add C++17's std::conjunction type trait, except for Microsoft VS
2894 2015 update 2 and later because it adds the logical operator type
2895 traits, event when C++ is pre-2017:
2896 https://blogs.msdn.microsoft.com/vcblog/2016/01/22/vs-2015-update-2s-stl-is-c17-so-far-feature-complete/
2898 * wtf/StdLibExtras.h:
2900 2017-04-14 Mark Lam <mark.lam@apple.com>
2902 Update architectures in xcconfig files.
2903 https://bugs.webkit.org/show_bug.cgi?id=170867
2904 <rdar://problem/31628104>
2906 Reviewed by Joseph Pecoraro.
2908 * Configurations/Base.xcconfig:
2910 2017-04-14 Myles C. Maxfield <mmaxfield@apple.com>
2912 Add performance test for asking the platform for a font for U+2060 WORD JOINER
2913 https://bugs.webkit.org/show_bug.cgi?id=170842
2915 Reviewed by Tim Horton.
2917 * wtf/unicode/CharacterNames.h:
2919 2017-04-13 Yusuke Suzuki <utatane.tea@gmail.com>
2921 [JSC] Date.parse should accept wider range of representation
2922 https://bugs.webkit.org/show_bug.cgi?id=170720
2924 Reviewed by Darin Adler.
2926 We would like to relax Date.parse to accept the representation "May 8".
2927 At that time, we choose `2000` as a default year. This is because of
2928 the following reason.
2930 1. According to the V8, this default value is compatible to the old KJS. While current V8 uses 2001,
2931 SpiderMonkey does not have such a fallback path. So this reason is not big deal.
2933 2. It is a leap year. When using `new Date("Feb 29")`, we assume that people want to save month and day.
2934 Leap year can save user inputs if they is valid. If we use the current year instead, the current year
2935 may not be a leap year. In that case, `new Date("Feb 29").getMonth()` becomes 2 (March).
2938 (WTF::parseDateFromNullTerminatedCharacters):
2940 2017-04-13 Dan Bernstein <mitz@apple.com>
2942 WTF installs an extra copy of a header outside /usr/local/include/wtf
2944 * WTF.xcodeproj/project.pbxproj: Demoted PriorityQueue.h from Private to Project.
2946 2017-04-13 Oliver Hunt <oliver@apple.com>
2948 allocationSize should use safe arithmetic by default
2949 https://bugs.webkit.org/show_bug.cgi?id=170804
2951 Reviewed by JF Bastien.
2953 Make all allocationSize() functions work in terms
2956 * wtf/text/StringImpl.h:
2957 (WTF::StringImpl::allocationSize):
2958 (WTF::StringImpl::tailOffset):
2960 2017-04-13 JF Bastien <jfbastien@apple.com>
2962 WebAssembly: manage memory better
2963 https://bugs.webkit.org/show_bug.cgi?id=170628
2965 Reviewed by Keith Miller, Michael Saboff.
2967 Re-use a VM tag which was intended for JavaScript core, was then
2968 used by our GC, and is now unused. If I don't do this then
2969 WebAssembly fast memories will make vmmap look super weird because
2970 it'll look like multi-gigabyte of virtual memory are allocated as
2971 part of our process' regular memory!
2973 Separately I need to update vmmap and other tools to print the
2974 right name. Right now this tag gets identified as "JS garbage
2977 * wtf/OSAllocator.h:
2980 2017-04-13 Yusuke Suzuki <utatane.tea@gmail.com>
2982 [JSC] Use proper ifdef guard for code using MachineContext
2983 https://bugs.webkit.org/show_bug.cgi?id=170800
2985 Reviewed by Carlos Alberto Lopez Perez.
2987 SamplingProfiler and FastMemory rely on MachineContext feature.
2991 2017-04-12 Dan Bernstein <mitz@apple.com>
2993 [Mac] Future-proof .xcconfig files
2994 https://bugs.webkit.org/show_bug.cgi?id=170802
2996 Reviewed by Tim Horton.
2998 * Configurations/Base.xcconfig:
2999 * Configurations/DebugRelease.xcconfig:
3001 2017-04-12 Yusuke Suzuki <utatane.tea@gmail.com>
3003 Use HAVE(MACHINE_CONTEXT) instead of USE(MACHINE_CONTEXT)
3004 https://bugs.webkit.org/show_bug.cgi?id=170770
3006 Rubber stamped by Mark Lam.
3009 * wtf/PlatformRegisters.h:
3010 * wtf/ThreadingPthreads.cpp:
3011 (WTF::Thread::getRegisters):
3013 2017-04-12 Yusuke Suzuki <utatane.tea@gmail.com>
3015 [JSC] Clean up heap/MachineStackMarker by introducing USE(MACHINE_CONTEXT)
3016 https://bugs.webkit.org/show_bug.cgi?id=170770
3018 Reviewed by Mark Lam.
3020 We add a new define USE_MACHINE_CONTEXT, which becomes true if mcontext_t exists
3021 and we know the way to retrieve values from mcontext_t.
3024 * wtf/PlatformRegisters.h:
3025 * wtf/ThreadingPthreads.cpp:
3026 (WTF::Thread::getRegisters):
3028 2017-04-12 Yusuke Suzuki <utatane.tea@gmail.com>
3030 [WTF] Introduce Thread class and use RefPtr<Thread> and align Windows Threading implementation semantics to Pthread one
3031 https://bugs.webkit.org/show_bug.cgi?id=170502
3033 Reviewed by Mark Lam.
3035 This patch is refactoring of WTF Threading mechanism to merge JavaScriptCore's threading extension to WTF Threading.
3036 Previously, JavaScriptCore requires richer threading features (such as suspending and resuming threads), and they
3037 are implemented for PlatformThread in JavaScriptCore. But these features should be implemented in WTF Threading side
3038 instead of maintaining JSC's own threading features too. This patch removes these features from JSC and move it to
3041 However, current WTF Threading has one problem: Windows version of WTF Threading has different semantics from Pthreads
3042 one. In Windows WTF Threading, we cannot perform any operation after the target thread is detached: WTF Threading stop
3043 tracking the state of the thread once the thread is detached. But this is not the same to Pthreads one. In Pthreads,
3044 pthread_detach just means that the resource of the thread will be destroyed automatically. While some operations like
3045 pthread_join will be rejected, some operations like pthread_kill will be accepted.
3047 The problem is that detached thread can be suspended and resumed in JSC. For example, in jsc.cpp, we start the worker
3048 thread and detach it immediately. In worker thread, we will create VM and thus concurrent GC will suspend and resume
3049 the detached thread. However, in Windows WTF Threading, we have no reference to the detached thread. Thus we cannot
3050 perform suspend and resume operations onto the detached thread.
3052 To solve the problem, we change Windows Threading mechanism drastically to align it to the Pthread semantics. In the
3053 new Threading, we have RefPtr<Thread> class. It holds a handle to a platform thread. We can perform threading operations
3054 with this class. For example, Thread::suspend is offered. And we use destructor of the thread local variable to release
3055 the resources held by RefPtr<Thread>. In Windows, Thread::detach does nothing because the resource will be destroyed
3056 automatically by RefPtr<Thread>.
3058 To do so, we introduce ThreadHolder for Windows. This is similar to the previous ThreadIdentifierData for Pthreads.
3059 It holds RefPtr<Thread> in the thread local storage (technically, it is Fiber Local Storage in Windows). Thread::current()
3060 will return this reference.
3062 The problematic situation is that the order of the deallocation of the thread local storage is not defined. So we should
3063 not touch thread local storage in the destructor of the thread local storage. To avoid such edge cases, we have
3064 currentThread() / Thread::currentID() APIs. They are safe to be called even in the destructor of the other thread local
3065 storage. And in Windows, in the FLS destructor, we will create the thread_local variable to defer the destruction of
3066 the ThreadHolder. We ensure that this destructor is called after the other FLS destructors are called in Windows 10.
3068 This patch is performance neutral.
3070 * WTF.xcodeproj/project.pbxproj:
3071 * benchmarks/ConditionSpeedTest.cpp:
3072 * benchmarks/LockFairnessTest.cpp:
3073 * benchmarks/LockSpeedTest.cpp:
3074 * wtf/AutomaticThread.cpp:
3075 (WTF::AutomaticThread::start):
3076 * wtf/CMakeLists.txt:
3078 * wtf/MemoryPressureHandler.h:
3079 * wtf/ParallelJobsGeneric.cpp:
3080 (WTF::ParallelEnvironment::ThreadPrivate::tryLockFor):
3081 (WTF::ParallelEnvironment::ThreadPrivate::workerThread):
3082 * wtf/ParallelJobsGeneric.h:
3083 (WTF::ParallelEnvironment::ThreadPrivate::ThreadPrivate): Deleted.
3084 * wtf/ParkingLot.cpp:
3085 (WTF::ParkingLot::forEachImpl):
3087 (WTF::ParkingLot::forEach):
3088 * wtf/PlatformRegisters.h: Renamed from Source/JavaScriptCore/runtime/PlatformThread.h.
3090 (WTF::RefPtr::RefPtr):
3091 * wtf/ThreadFunctionInvocation.h:
3092 (WTF::ThreadFunctionInvocation::ThreadFunctionInvocation):
3093 * wtf/ThreadHolder.cpp: Added.
3094 (WTF::ThreadHolder::~ThreadHolder):
3095 (WTF::ThreadHolder::initialize):
3096 * wtf/ThreadHolder.h: Renamed from Source/WTF/wtf/ThreadIdentifierDataPthreads.h.
3097 (WTF::ThreadHolder::thread):
3098 (WTF::ThreadHolder::ThreadHolder):
3099 * wtf/ThreadHolderPthreads.cpp: Renamed from Source/WTF/wtf/ThreadIdentifierDataPthreads.cpp.
3100 (WTF::ThreadHolder::initializeOnce):
3101 (WTF::ThreadHolder::current):
3102 (WTF::ThreadHolder::destruct):
3103 * wtf/ThreadHolderWin.cpp: Added.
3104 (WTF::threadMapMutex):
3106 (WTF::ThreadHolder::initializeOnce):
3107 (WTF::ThreadHolder::current):
3108 (WTF::ThreadHolder::destruct):
3109 * wtf/ThreadSpecific.h:
3110 * wtf/Threading.cpp:
3111 (WTF::Thread::normalizeThreadName):
3112 (WTF::threadEntryPoint):
3113 (WTF::Thread::create):
3114 (WTF::Thread::setCurrentThreadIsUserInteractive):
3115 (WTF::Thread::setCurrentThreadIsUserInitiated):
3116 (WTF::Thread::setGlobalMaxQOSClass):
3117 (WTF::Thread::adjustedQOSClass):
3118 (WTF::Thread::dump):
3119 (WTF::initializeThreading):
3120 (WTF::normalizeThreadName): Deleted.
3121 (WTF::createThread): Deleted.
3122 (WTF::setCurrentThreadIsUserInteractive): Deleted.
3123 (WTF::setCurrentThreadIsUserInitiated): Deleted.
3124 (WTF::setGlobalMaxQOSClass): Deleted.
3125 (WTF::adjustedQOSClass): Deleted.
3128 (WTF::Thread::operator==):
3129 (WTF::Thread::operator!=):
3130 (WTF::Thread::joinableState):
3131 (WTF::Thread::didBecomeDetached):
3132 (WTF::Thread::didJoin):
3133 (WTF::Thread::hasExited):
3134 (WTF::currentThread):
3135 * wtf/ThreadingPthreads.cpp:
3136 (WTF::Thread::Thread):
3137 (WTF::Thread::~Thread):
3138 (WTF::Thread::signalHandlerSuspendResume):
3139 (WTF::Thread::initializePlatformThreading):
3140 (WTF::initializeCurrentThreadEvenIfNonWTFCreated):
3141 (WTF::wtfThreadEntryPoint):
3142 (WTF::Thread::createInternal):
3143 (WTF::Thread::initializeCurrentThreadInternal):
3144 (WTF::Thread::changePriority):
3145 (WTF::Thread::waitForCompletion):
3146 (WTF::Thread::detach):
3147 (WTF::Thread::current):
3148 (WTF::Thread::currentID):
3149 (WTF::Thread::signal):
3150 (WTF::Thread::resume):
3151 (WTF::Thread::getRegisters):
3152 (WTF::Thread::didExit):
3153 (WTF::Thread::establish):
3154 (WTF::PthreadState::PthreadState): Deleted.
3155 (WTF::PthreadState::joinableState): Deleted.
3156 (WTF::PthreadState::pthreadHandle): Deleted.
3157 (WTF::PthreadState::didBecomeDetached): Deleted.
3158 (WTF::PthreadState::didExit): Deleted.
3159 (WTF::PthreadState::didJoin): Deleted.
3160 (WTF::PthreadState::hasExited): Deleted.
3161 (WTF::threadMapMutex): Deleted.
3162 (WTF::initializeThreading): Deleted.
3163 (WTF::threadMap): Deleted.
3164 (WTF::identifierByPthreadHandle): Deleted.
3165 (WTF::establishIdentifierForPthreadHandle): Deleted.
3166 (WTF::pthreadHandleForIdentifierWithLockAlreadyHeld): Deleted.
3167 (WTF::createThreadInternal): Deleted.
3168 (WTF::initializeCurrentThreadInternal): Deleted.
3169 (WTF::changeThreadPriority): Deleted.
3170 (WTF::waitForThreadCompletion): Deleted.
3171 (WTF::detachThread): Deleted.
3172 (WTF::threadDidExit): Deleted.
3173 (WTF::currentThread): Deleted.
3174 (WTF::signalThread): Deleted.
3175 * wtf/ThreadingWin.cpp:
3176 (WTF::Thread::Thread):
3177 (WTF::Thread::~Thread):
3178 (WTF::Thread::initializeCurrentThreadInternal):
3179 (WTF::Thread::initializePlatformThreading):
3180 (WTF::wtfThreadEntryPoint):
3181 (WTF::Thread::createInternal):
3182 (WTF::Thread::changePriority):
3183 (WTF::Thread::waitForCompletion):
3184 (WTF::Thread::detach):
3185 (WTF::Thread::resume):
3186 (WTF::Thread::getRegisters):
3187 (WTF::Thread::current):
3188 (WTF::Thread::currentID):
3189 (WTF::Thread::didExit):
3190 (WTF::Thread::establish):
3191 (WTF::initializeCurrentThreadInternal): Deleted.
3192 (WTF::threadMapMutex): Deleted.
3193 (WTF::initializeThreading): Deleted.
3194 (WTF::threadMap): Deleted.
3195 (WTF::storeThreadHandleByIdentifier): Deleted.
3196 (WTF::threadHandleForIdentifier): Deleted.
3197 (WTF::clearThreadHandleForIdentifier): Deleted.
3198 (WTF::createThreadInternal): Deleted.
3199 (WTF::changeThreadPriority): Deleted.
3200 (WTF::waitForThreadCompletion): Deleted.
3201 (WTF::detachThread): Deleted.
3202 (WTF::currentThread): Deleted.
3203 * wtf/WorkQueue.cpp:
3204 (WTF::WorkQueue::concurrentApply):
3206 * wtf/cocoa/WorkQueueCocoa.cpp:
3207 (WTF::dispatchQOSClass):
3208 * wtf/generic/WorkQueueGeneric.cpp:
3209 (WorkQueue::platformInitialize):
3210 (WorkQueue::platformInvalidate):
3211 * wtf/linux/MemoryPressureHandlerLinux.cpp:
3212 (WTF::MemoryPressureHandler::EventFDPoller::EventFDPoller):
3213 (WTF::MemoryPressureHandler::EventFDPoller::~EventFDPoller):
3214 * wtf/win/MainThreadWin.cpp:
3215 (WTF::initializeMainThreadPlatform):
3217 2017-04-11 Zan Dobersek <zdobersek@igalia.com>
3219 [GTK] Use the DisplayRefreshMonitor facilities
3220 https://bugs.webkit.org/show_bug.cgi?id=170599
3222 Reviewed by Carlos Garcia Campos.
3224 * wtf/Platform.h: Enable USE_REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR for the GTK+ port.
3225 * wtf/glib/RunLoopSourcePriority.h: Add the DisplayRefreshMonitorTimer entry that
3226 matches the value of LayerFlushTimer.
3228 2017-04-11 Yusuke Suzuki <utatane.tea@gmail.com>
3230 [WebCore][JSC] ResourceUsageData.{timeOfNextEdenCollection,timeOfNextFullCollection} should be MonotonicTime
3231 https://bugs.webkit.org/show_bug.cgi?id=170725
3233 Reviewed by Sam Weinig.
3235 Make MonotonicTime more constexpr friendly mainly to annotate MonotonicTime::nan() as constexpr.
3237 * wtf/MonotonicTime.h:
3238 (WTF::MonotonicTime::MonotonicTime):
3239 (WTF::MonotonicTime::fromRawSeconds):
3240 (WTF::MonotonicTime::infinity):
3241 (WTF::MonotonicTime::nan):
3242 (WTF::MonotonicTime::secondsSinceEpoch):
3243 (WTF::MonotonicTime::operator bool):
3244 (WTF::MonotonicTime::operator+):
3245 (WTF::MonotonicTime::operator-):
3246 (WTF::MonotonicTime::operator==):
3247 (WTF::MonotonicTime::operator!=):
3248 (WTF::MonotonicTime::operator<):
3249 (WTF::MonotonicTime::operator>):
3250 (WTF::MonotonicTime::operator<=):
3251 (WTF::MonotonicTime::operator>=):
3253 2017-04-11 Yusuke Suzuki <utatane.tea@gmail.com>
3255 Unreviewed, build fix for Windows port after r215228
3256 https://bugs.webkit.org/show_bug.cgi?id=170723
3258 * wtf/win/RunLoopWin.cpp:
3259 (WTF::RunLoop::TimerBase::timerFired):
3261 2017-04-11 Yusuke Suzuki <utatane.tea@gmail.com>
3263 [JSC][GTK] Use RunLoop::Timer in GTK port
3264 https://bugs.webkit.org/show_bug.cgi?id=170723
3266 Reviewed by Carlos Garcia Campos.
3268 Add secondsUntilFire method. And add setName and setPriority
3269 for GTK RunLoop::Timer.
3272 * wtf/cf/RunLoopCF.cpp:
3273 (WTF::RunLoop::TimerBase::secondsUntilFire):
3274 * wtf/generic/RunLoopGeneric.cpp:
3275 (WTF::RunLoop::TimerBase::secondsUntilFire):
3276 * wtf/glib/RunLoopGLib.cpp:
3277 (WTF::RunLoop::TimerBase::setName):
3278 (WTF::RunLoop::TimerBase::secondsUntilFire):
3279 * wtf/win/RunLoopWin.cpp:
3280 (WTF::RunLoop::TimerBase::timerFired):
3281 (WTF::RunLoop::TimerBase::start):
3282 (WTF::RunLoop::TimerBase::isActive):
3283 (WTF::RunLoop::TimerBase::secondsUntilFire):
3285 2017-04-11 Yusuke Suzuki <utatane.tea@gmail.com>
3287 [JSC] Enable JSRunLoopTimer for JSCOnly and Windows
3288 https://bugs.webkit.org/show_bug.cgi?id=170655
3290 Reviewed by Carlos Garcia Campos.
3292 This patch makes RunLoop::Timer in Generic and Windows thread-safe to use it
3293 in JSC's JSRunLoopTimer. Eventually, we would like to replace JSRunLoopTimer's
3294 platform-dependent implementation to WTF::RunLoop::Timer.
3297 * wtf/cf/RunLoopCF.cpp:
3298 (WTF::RunLoop::TimerBase::start):
3299 * wtf/generic/RunLoopGeneric.cpp:
3300 (WTF::RunLoop::TimerBase::ScheduledTask::EarliestSchedule::operator()):
3301 (WTF::RunLoop::populateTasks):
3302 (WTF::RunLoop::runImpl):
3303 (WTF::RunLoop::schedule):
3304 (WTF::RunLoop::scheduleAndWakeUp):
3305 (WTF::RunLoop::TimerBase::~TimerBase):
3306 (WTF::RunLoop::TimerBase::start):
3307 (WTF::RunLoop::TimerBase::stop):
3308 (WTF::RunLoop::TimerBase::isActive):
3309 * wtf/glib/RunLoopGLib.cpp:
3310 (WTF::RunLoop::TimerBase::TimerBase):
3311 * wtf/win/RunLoopWin.cpp:
3312 (WTF::RunLoop::TimerBase::timerFired):
3313 (WTF::RunLoop::TimerBase::start):
3314 (WTF::RunLoop::TimerBase::stop):
3315 (WTF::RunLoop::TimerBase::isActive):
3317 2017-04-11 Zan Dobersek <zdobersek@igalia.com>
3319 REGRESSION(r213645): It made JSC tests super slow and timeout on AArch64 Linux
3320 https://bugs.webkit.org/show_bug.cgi?id=169510
3322 Reviewed by Saam Barati.
3324 Add the `volatile` qualifiers for ASM statements that set up ldxr and stxr
3325 instruction calls when HAVE(LL_SC) is enabled for aarch64 platforms.
3327 This avoids indefinite execution when running GCC-compiled JSC on Linux.
3328 Specific bug or expected behavior that differs from Clang wasn't determined.
3330 HAVE(LL_SC) is re-enabled on non-Darwin aarch64 platforms.
3335 2017-04-10 Thorsten Glaser <tg@mirbsd.de>
3338 https://bugs.webkit.org/show_bug.cgi?id=170673
3340 Reviewed by Carlos Alberto Lopez Perez.
3344 2017-04-09 Yusuke Suzuki <utatane.tea@gmail.com>
3346 [WTF] Annotate Seconds' member functions and operators with constexpr
3347 https://bugs.webkit.org/show_bug.cgi?id=170662
3349 Reviewed by Daniel Bates.
3351 Annotate Seconds' member functions and operators with constexpr.
3352 It allows us to use Seconds calculation in compile time and use these
3353 calculation for static const global variables.
3355 operator% is an exception: it uses fmod and it is not offered as constexpr.
3358 (defaultMinimumForClamp):
3359 (defaultMaximumForClamp):
3360 (clampToAccepting64):
3361 Super unfortunate ugly code. This is because GCC 4.9 does not support C++14 relaxed constexpr.
3364 (WTF::Seconds::Seconds):
3365 (WTF::Seconds::value):
3366 (WTF::Seconds::minutes):
3367 (WTF::Seconds::seconds):
3368 (WTF::Seconds::milliseconds):
3369 (WTF::Seconds::microseconds):
3370 (WTF::Seconds::nanoseconds):
3371 (WTF::Seconds::operator bool):
3372 (WTF::Seconds::operator+):
3373 (WTF::Seconds::operator-):
3374 (WTF::Seconds::operator*):
3375 (WTF::Seconds::operator/):
3376 (WTF::Seconds::operator==):
3377 (WTF::Seconds::operator!=):
3378 (WTF::Seconds::operator<):
3379 (WTF::Seconds::operator>):
3380 (WTF::Seconds::operator<=):
3381 (WTF::Seconds::operator>=):
3383 2017-04-09 Chris Dumez <cdumez@apple.com>
3385 Start dropping Timer API dealing with double
3386 https://bugs.webkit.org/show_bug.cgi?id=170649
3388 Reviewed by Yusuke Suzuki.
3390 Start dropping Timer API dealing with double as people should use Seconds now.
3392 * wtf/RunLoopTimer.h:
3393 * wtf/glib/MainThreadGLib.cpp:
3394 (WTF::MainThreadDispatcher::schedule):
3396 2017-04-07 Keith Miller <keith_miller@apple.com>
3398 Unreviewed, remove constexpr function since GTK didn't like it.
3400 * wtf/PriorityQueue.h:
3401 (WTF::PriorityQueue::parentOf):
3403 2017-04-07 Chris Dumez <cdumez@apple.com>
3405 Start using MonotonicTime / Seconds in Timer class
3406 https://bugs.webkit.org/show_bug.cgi?id=170625
3408 Reviewed by Simon Fraser.
3410 Add modulo operator to MonotonicTime.
3412 * wtf/MonotonicTime.h:
3413 (WTF::MonotonicTime::operator%):
3415 2017-04-07 Keith Miller <keith_miller@apple.com>
3417 Add a PriorityQueue class
3418 https://bugs.webkit.org/show_bug.cgi?id=170579
3420 Reviewed by Saam Barati.
3422 This patch adds a new PriorityQueue class that is backed by
3423 WTF::Vector. It also has a number of other niceties such as being
3424 able to iterate the queue and increase or decrease keys.
3426 One note is that increaseKey and decreaseKey are O(n) rather than
3427 O(log(n)). Traditionally, the lookup of the key is done with a
3428 hash map but that's not feasible here. This is because unless the
3429 queue's element type is a pointer there is no good way maintain a
3430 persistent reference to every entry in the queue while we sift.
3431 The only way to update the location of an entry is to do a hash
3432 table lookup with the entry's hash but this is probably more
3433 expensive than just doing a linear search.
3435 Also, add comparison operator functions, which can be passed to PriorityQueue.
3437 * WTF.xcodeproj/project.pbxproj:
3442 (isGreaterThanEqual):
3443 * wtf/PriorityQueue.h: Added.
3444 (WTF::PriorityQueue::size):
3445 (WTF::PriorityQueue::isEmpty):
3446 (WTF::PriorityQueue::enqueue):
3447 (WTF::PriorityQueue::peek):
3448 (WTF::PriorityQueue::dequeue):
3449 (WTF::PriorityQueue::decreaseKey):
3450 (WTF::PriorityQueue::increaseKey):
3451 (WTF::PriorityQueue::begin):
3452 (WTF::PriorityQueue::end):
3453 (WTF::PriorityQueue::isValidHeap):
3454 (WTF::PriorityQueue::parentOf):
3455 (WTF::PriorityQueue::leftChildOf):
3456 (WTF::PriorityQueue::rightChildOf):
3457 (WTF::PriorityQueue::siftUp):
3458 (WTF::PriorityQueue::siftDown):
3460 2017-04-07 Alex Christensen <achristensen@webkit.org>
3462 Use audit_token_t instead of pid_t for checking sandbox of other processes
3463 https://bugs.webkit.org/show_bug.cgi?id=170616
3464 <rdar://problem/31158189>
3466 Reviewed by Daniel Bates.
3468 * wtf/spi/darwin/SandboxSPI.h:
3471 2017-04-07 Ting-Wei Lan <lantw44@gmail.com>
3473 Include cstdio before using sscanf and stderr
3474 https://bugs.webkit.org/show_bug.cgi?id=170098
3476 Reviewed by Michael Catanzaro.
3478 * wtf/NumberOfCores.cpp:
3480 2017-04-07 Saam Barati <sbarati@apple.com>
3482 WebAssembly: Make to a compilation API that allows for multi-VM concurrent compilations of Wasm Modules
3483 https://bugs.webkit.org/show_bug.cgi?id=170488
3485 Reviewed by JF Bastien.
3487 * wtf/SharedTask.h: Make SharedTaskFunctor forward its arguments.
3489 2017-04-07 Carlos Garcia Campos <cgarcia@igalia.com>
3491 [GTK] Update the priorities used in glib main loop sources
3492 https://bugs.webkit.org/show_bug.cgi?id=170457
3494 Reviewed by Žan Doberšek.
3496 Add an enum to define prirorities used in different GLib main sources. It allows to give them a better name
3497 than high, low, medium, etc., but also to document them and other GLib based ports can define their own
3498 values without changing all the places where they are used. The default values are based on the priorities
3499 pre-defined by GLib.
3501 * wtf/glib/MainThreadGLib.cpp:
3502 (WTF::MainThreadDispatcher::MainThreadDispatcher):
3503 * wtf/glib/RunLoopGLib.cpp:
3504 (WTF::RunLoop::RunLoop):
3505 (WTF::RunLoop::dispatchAfter):
3506 (WTF::RunLoop::TimerBase::TimerBase):
3507 * wtf/glib/RunLoopSourcePriority.h: Added.
3508 * wtf/linux/MemoryPressureHandlerLinux.cpp:
3509 (WTF::MemoryPressureHandler::EventFDPoller::EventFDPoller):
3511 2017-04-06 Filip Pizlo <fpizlo@apple.com>
3513 Linear scan should run liveness only once
3514 https://bugs.webkit.org/show_bug.cgi?id=170569
3516 Reviewed by Keith Miller.
3518 Have Liveness<> call Adapter::prepareToCompute(), since this makes it a lot easier to implement
3519 constraint generation, since the constraint generator now gets to run after the Adapter is fully
3523 (WTF::IndexMap::append): Also make this a bit more versatile.
3525 (WTF::Liveness::LocalCalc::Iterable::contains):
3526 (WTF::Liveness::Iterable::contains):
3527 (WTF::Liveness::compute):
3529 2017-04-06 Andreas Kling <akling@apple.com>
3531 Kill any WebContent process using over 16 GB of memory.
3532 https://bugs.webkit.org/show_bug.cgi?id=170515
3533 <rdar://problem/29930931>
3535 Reviewed by Antti Koivisto.
3537 Restructure the code since it was getting out of sync with the intended behavior.
3538 Now there's a thresholdForMemoryKill() which returns the current memory limit based
3539 on the process status.
3541 The memory usage policy is separated from the killing, and now only drives the
3542 asynchronous invocations of pressure relief that occur when we pass over one of
3543 the policy edges (now 1GB for Conservative, 2GB for Strict.)
3545 Removed the "Panic" policy and moved the memory kill logic to shrinkOrDie().
3547 Behavior as of this patch:
3549 - Everyone gets killed over 16 GB.
3550 - Inactive processes get killed over 4 GB.
3551 - Strict memory usage policy kicks in at 2 GB.
3552 - Conservative memory usage policy at 1 GB.
3554 Like before, we make a best-effort attempt to free up memory before killing the process.
3556 * wtf/MemoryPressureHandler.cpp:
3558 (WTF::MemoryPressureHandler::thresholdForMemoryKill):
3559 (WTF::thresholdForPolicy):
3560 (WTF::policyForFootprint):
3561 (WTF::MemoryPressureHandler::shrinkOrDie):
3562 (WTF::MemoryPressureHandler::setMemoryUsagePolicyBasedOnFootprint):
3563 (WTF::MemoryPressureHandler::measurementTimerFired):
3564 * wtf/MemoryPressureHandler.h:
3566 2017-04-05 Andreas Kling <akling@apple.com>
3568 Make inactive web processes behave as though under memory pressure.
3569 https://bugs.webkit.org/show_bug.cgi?id=170042
3570 <rdar://problem/31038445>
3572 Reviewed by Antti Koivisto.
3574 Once a web process becomes inactive, let's try to reduce its impact
3575 on memory usage by treating it as if it's under memory pressure until
3578 * wtf/MemoryPressureHandler.cpp:
3579 (WTF::MemoryPressureHandler::setProcessState):
3580 (WTF::MemoryPressureHandler::isUnderMemoryPressure):
3581 * wtf/MemoryPressureHandler.h:
3582 (WTF::MemoryPressureHandler::isUnderMemoryPressure): Deleted.
3584 2017-04-05 Yusuke Suzuki <utatane.tea@gmail.com>
3586 [JSC] Suppress warnings in GCC
3587 https://bugs.webkit.org/show_bug.cgi?id=170501
3589 Reviewed by Keith Miller.
3591 Add a new macro UNUSED_FUNCTION to annotate unused static functions.
3592 #pragma GCC diagnostic ignored "-Wunused-function" does not work.
3596 2017-04-04 Filip Pizlo <fpizlo@apple.com>
3598 Air::eliminateDeadCode() should not use a HashSet
3599 https://bugs.webkit.org/show_bug.cgi?id=170487
3601 Reviewed by Saam Barati.
3603 BitVector::iterator knows when it's at the end. Expose this functionality.
3606 (WTF::BitVector::iterator::isAtEnd):
3608 2017-04-04 Keith Miller <keith_miller@apple.com>
3610 WebAssembly: ModuleInformation should be a ref counted thing that can be shared across threads.
3611 https://bugs.webkit.org/show_bug.cgi?id=170478
3613 Reviewed by Saam Barati.
3615 This adds a new String::fromUTF8 that converts a vector of characters to
3618 Also, it cleans up some style.
3620 * wtf/text/WTFString.h:
3621 (WTF::String::fromUTF8):