blob: 7c06a7d8d77efb51cb2efea2d579016d20c69f7d [file] [log] [blame]
2018-03-23 Tim Horton <timothy_horton@apple.com>
Introduce and adopt HAVE(AUDIO_TOOLBOX_AUDIO_SESSION)
https://bugs.webkit.org/show_bug.cgi?id=183954
<rdar://problem/38808858>
Reviewed by Dan Bernstein.
* wtf/Platform.h:
2018-03-23 David Kilzer <ddkilzer@apple.com>
Stop using dispatch_set_target_queue()
<https://webkit.org/b/183908>
<rdar://problem/33553533>
Reviewed by Daniel Bates.
* wtf/cocoa/WorkQueueCocoa.cpp:
(WTF::WorkQueue::platformInitialize): Remove !HAVE(QOS_CLASSES)
code path since it's never used now that HAVE(QOS_CLASSES) is
equivalent to PLATFORM(COCOA) in <wtf/Platform.h>.
2018-03-23 Carlos Alberto Lopez Perez <clopez@igalia.com>
WebProcess memory monitor thresholds should be better tuned for embedded systems.
https://bugs.webkit.org/show_bug.cgi?id=183773
Reviewed by Yusuke Suzuki.
Take into account the total system RAM for the thresholds calculation.
For systems with more than 3GB the conservative and strict thresholds remain as they are,
but for systems with less RAM the thresholds are dynamically configured as follows:
- Conservative threshold (release non critical memory) if WebProcess using more than 33% of the total RAM.
- Strict threshold (release all possible memory) if WebProcess using more than 50% of the total RAM.
The Kill threshold is also modified. Now it is capped at 90% of the total RAM.
* wtf/MemoryPressureHandler.cpp:
(WTF::thresholdForMemoryKillWithProcessState):
(WTF::thresholdForPolicy):
(WTF::MemoryPressureHandler::shrinkOrDie):
2018-03-23 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Add standard containers with FastAllocator specialization
https://bugs.webkit.org/show_bug.cgi?id=183789
Reviewed by Darin Adler.
Sometimes we want standard containers due to various reasons.
For example, WTF::HashMap lacks the ability to hold all the
integer keys since it uses 0 for empty value and -1 for deleted
value. However, using std::containers use std::allocator without
specialization.
This patch introduces WTF::{StdMap, StdSet, StdList, StdUnorderedMap, StdUnorderedSet}.
They are standard containers with FastAllocator specialization.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/StdList.h: Copied from Source/JavaScriptCore/runtime/TypeLocationCache.h.
* wtf/StdMap.h: Copied from Source/JavaScriptCore/runtime/TypeLocationCache.h.
* wtf/StdSet.h: Copied from Source/JavaScriptCore/runtime/TypeLocationCache.h.
* wtf/StdUnorderedMap.h: Copied from Source/JavaScriptCore/runtime/TypeLocationCache.h.
* wtf/StdUnorderedSet.h: Copied from Source/JavaScriptCore/runtime/TypeLocationCache.h.
2018-03-22 Tim Horton <timothy_horton@apple.com>
Adopt USE(OPENGL[_ES]) in more places
https://bugs.webkit.org/show_bug.cgi?id=183882
<rdar://problem/37912195>
Reviewed by Dan Bernstein.
* wtf/Platform.h:
2018-03-20 Brent Fulgham <bfulgham@apple.com>
Create an assertion mechanism to ensure proper WebCore use in each WebKit Process
https://bugs.webkit.org/show_bug.cgi?id=183806
<rdar://problem/38694251>
Reviewed by Ryosuke Niwa.
Part of our security improvements involve better isolation between the different WebKit
processes (UIProcess, WebContent, Networking, Storage, etc.).
We need an assertion language we can use to protect certain critical APIs and code paths
against accidental misuse.
This patch adds a new enum type meant to represent different categories of program logic
that we do not want used in the wrong process.
This first patch just creates these types and makes them available. New assertions using
these values will be added as we complete our work ensuring proper process isolation.
In a method we want to protect, we can add an assertion describing the process privileges
needed to execute the code. For example, for cookie access we might use this:
ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessRawCookies);
At the launch of the UIProcess we would use this method to ensure all privileges are available:
setProcessPrivileges(allPrivileges());
In the network process, during platform initialization, we would use something like this:
setProcessPrivileges({ ProcessPrivilege::CanAccessRawCookies, ProcessPrivilege::CanAccessCredentials });
In the WebContent process, we would not set any privileges. We could just leave it as the
default initialization, or use this:
setProcessPrivileges({ });
Later, when we attempt to execute the initial code, we would expect an assertion for the
WebContent process, while Network and UIProcess pass the assertion.
* WTF.xcodeproj/project.pbxproj: Add new files.
* wtf/CMakeLists.txt: Ditto.
* wtf/ProcessPrivilege.cpp: Added.
(WTF::processPrivileges):
(WTF::setProcessPrivileges):
(WTF::hasProcessPrivilege):
* wtf/ProcessPrivilege.h: Added.
2018-03-20 Tim Horton <timothy_horton@apple.com>
Introduce HAVE_MEDIA_PLAYER and HAVE_CORE_VIDEO
https://bugs.webkit.org/show_bug.cgi?id=183803
<rdar://problem/38690487>
Reviewed by Sam Weinig.
* wtf/Platform.h:
2018-03-20 Brian Burg <bburg@apple.com>
SLEEP_THREAD_FOR_DEBUGGER should not use fancy number literals
https://bugs.webkit.org/show_bug.cgi?id=183792
Reviewed by Timothy Hatcher.
* wtf/DebugUtilities.h: Remove the '_s' since this won't
compile when included by files compiled as Objective-C++.
2018-03-20 Tim Horton <timothy_horton@apple.com>
Add and adopt WK_PLATFORM_NAME and adjust default feature defines
https://bugs.webkit.org/show_bug.cgi?id=183758
<rdar://problem/38017644>
Reviewed by Dan Bernstein.
* wtf/FeatureDefines.h:
2018-03-19 Eric Carlson <eric.carlson@apple.com>
[Extra zoom mode] Require fullscreen for video playback
https://bugs.webkit.org/show_bug.cgi?id=183742
<rdar://problem/38235862>
Reviewed by Jer Noble.
* wtf/Platform.h:
2018-03-15 Tim Horton <timothy_horton@apple.com>
Avoid defining commonly-named system macros on all Cocoa platforms
https://bugs.webkit.org/show_bug.cgi?id=183687
Reviewed by Dan Bernstein.
* wtf/Platform.h:
2018-03-14 Tim Horton <timothy_horton@apple.com>
Fix the build after r229387
https://bugs.webkit.org/show_bug.cgi?id=183639
<rdar://problem/38448568>
Reviewed by Dean Jackson.
* wtf/Platform.h:
2018-03-13 Tim Horton <timothy_horton@apple.com>
Add and adopt WK_ALTERNATE_FRAMEWORKS_DIR in WTF and bmalloc
https://bugs.webkit.org/show_bug.cgi?id=183576
<rdar://problem/38396766>
Reviewed by Dan Bernstein.
* Configurations/Base.xcconfig:
* Configurations/CopyWTFHeaders.xcconfig:
* Configurations/WTF.xcconfig:
* Configurations/mbmalloc.xcconfig:
2018-03-13 Michael Catanzaro <mcatanzaro@igalia.com>
Unreviewed, fix typo in a comment
* wtf/Platform.h:
2018-03-12 Don Olmstead <don.olmstead@sony.com>
[CMake][Win] Forwarding headers of WTF and PAL are copied twice in Visual Studio builds
https://bugs.webkit.org/show_bug.cgi?id=183240
Reviewed by Alex Christensen.
* wtf/CMakeLists.txt:
* wtf/PlatformGTK.cmake:
* wtf/PlatformJSCOnly.cmake:
* wtf/PlatformMac.cmake:
* wtf/PlatformWPE.cmake:
* wtf/PlatformWin.cmake:
2018-03-12 Yusuke Suzuki <utatane.tea@gmail.com>
Unreviewed, include time.h
https://bugs.webkit.org/show_bug.cgi?id=183312
Attempt to fix oss-fuzz build.
* wtf/CurrentTime.cpp:
* wtf/unix/CPUTimeUnix.cpp:
2018-03-12 Yoav Weiss <yoav@yoav.ws>
Runtime flag for link prefetch and remove link subresource.
https://bugs.webkit.org/show_bug.cgi?id=183540
Reviewed by Chris Dumez.
Remove the LINK_PREFETCH build time flag.
* wtf/FeatureDefines.h:
2018-03-12 Mark Lam <mark.lam@apple.com>
Make a NativeFunction into a class to support pointer profiling.
https://bugs.webkit.org/show_bug.cgi?id=183573
<rdar://problem/38384697>
Reviewed by Filip Pizlo.
Changed Poisoned so that it can be used on tagged pointers as well.
* wtf/Poisoned.h:
2018-03-11 Filip Pizlo <fpizlo@apple.com>
Split DirectArguments into JSValueOOB and JSValueStrict parts
https://bugs.webkit.org/show_bug.cgi?id=183458
Reviewed by Yusuke Suzuki.
* wtf/MathExtras.h:
(WTF::dynamicPoison): Deleted.
2018-03-11 Yusuke Suzuki <utatane.tea@gmail.com>
[Win] Use SRWLOCK and CONDITION_VARIABLE to simplify implementation
https://bugs.webkit.org/show_bug.cgi?id=183541
Reviewed by Darin Adler.
After Windows Vista, Windows offers SRWLOCK and CONDITION_VARIABLE.
They can simplify the implementation of our WTF::Mutex and WTF::ThreadCondition.
C++ std::mutex and std::condition_variable uses std::chrono for their timed
functions. Since std::chrono is not overflow-aware, we cannot reliably use
this functionalities. This is why we still keep WTF::Mutex and WTF::ThreadCondition.
They are used for ParkingLot.
* wtf/ThreadingPrimitives.h:
* wtf/ThreadingWin.cpp:
(WTF::Mutex::Mutex):
(WTF::Mutex::~Mutex):
(WTF::Mutex::lock):
(WTF::Mutex::tryLock):
(WTF::Mutex::unlock):
(WTF::absoluteTimeToWaitTimeoutInterval):
(WTF::ThreadCondition::ThreadCondition):
(WTF::ThreadCondition::~ThreadCondition):
(WTF::ThreadCondition::wait):
(WTF::ThreadCondition::timedWait):
(WTF::ThreadCondition::signal):
(WTF::ThreadCondition::broadcast):
(WTF::PlatformCondition::timedWait): Deleted.
(WTF::PlatformCondition::signal): Deleted.
2018-03-10 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r229436.
https://bugs.webkit.org/show_bug.cgi?id=183542
seems to have regressed wasm compile times by 10% (Requested
by pizlo-mbp on #webkit).
Reverted changeset:
"bmalloc mutex should be adaptive"
https://bugs.webkit.org/show_bug.cgi?id=177839
https://trac.webkit.org/changeset/229436
2018-03-09 Mark Lam <mark.lam@apple.com>
[Re-landing] Prepare LLInt code to support pointer profiling.
https://bugs.webkit.org/show_bug.cgi?id=183387
<rdar://problem/38199678>
Reviewed by JF Bastien.
* wtf/Platform.h:
2018-03-08 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r229354 and r229364.
https://bugs.webkit.org/show_bug.cgi?id=183492
Breaks internal builds (Requested by ryanhaddad on #webkit).
Reverted changesets:
"Prepare LLInt code to support pointer profiling."
https://bugs.webkit.org/show_bug.cgi?id=183387
https://trac.webkit.org/changeset/229354
"Add support for ARM64E."
https://bugs.webkit.org/show_bug.cgi?id=183398
https://trac.webkit.org/changeset/229364
2018-03-08 Filip Pizlo <fpizlo@apple.com>
bmalloc mutex should be adaptive
https://bugs.webkit.org/show_bug.cgi?id=177839
Reviewed by Michael Saboff.
Add some comments that I thought of while copy-pasting this code.
Reland after failing to reproduce the WasmBench crash that caused it to get rolled out. Maybe that fixed
itself somehow?
* wtf/LockAlgorithmInlines.h:
* wtf/WordLock.cpp:
(WTF::WordLock::unlockSlow):
2018-03-08 Keith Miller <keith_miller@apple.com>
Disable JIT on Cocoa 32-bit ARM.
https://bugs.webkit.org/show_bug.cgi?id=183426
Reviewed by Michael Saboff.
* wtf/Platform.h:
2018-03-08 Keith Miller <keith_miller@apple.com>
Use asm instead of __asm__ in WTFBreakpointTrap so MSVC builds
https://bugs.webkit.org/show_bug.cgi?id=183465
Reviewed by Michael Saboff.
* wtf/Assertions.h:
2018-03-07 Filip Pizlo <fpizlo@apple.com>
Make it possible to randomize register allocation
https://bugs.webkit.org/show_bug.cgi?id=183416
Reviewed by Keith Miller.
* wtf/MathExtras.h:
(WTF::shuffleVector):
2018-03-08 Yusuke Suzuki <utatane.tea@gmail.com>
[Win] Use __debugbreak for WTFBreakpointTrap
https://bugs.webkit.org/show_bug.cgi?id=183450
Reviewed by Mark Lam.
This patch adds WTFBreakpointTrap() implementation for MSVC by using
__debugbreak. It fixes build failure in Windows due to the use of
WTFBreakpointTrap().
* wtf/Assertions.h:
2018-03-08 Zan Dobersek <zdobersek@igalia.com>
[GLib] RunLoop::wakeUp(): use a zero value instead of the monotonic time
https://bugs.webkit.org/show_bug.cgi?id=183447
Reviewed by Carlos Garcia Campos.
* wtf/glib/RunLoopGLib.cpp:
(WTF::RunLoop::wakeUp): Micro-optimize the wake-up schedule by using
a zero value as the GSource ready time, instead of retrieving and using
the current monotonic time.
2018-03-08 Tim Horton <timothy_horton@apple.com>
Don't have Celestial in minimal simulator configuration
https://bugs.webkit.org/show_bug.cgi?id=183432
<rdar://problem/38252985>
Reviewed by Dan Bernstein.
* wtf/Platform.h:
2018-03-06 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Set canInitializeWithMemset = true if T is an integral type
https://bugs.webkit.org/show_bug.cgi?id=183357
Reviewed by Darin Adler.
This patch set `canInitializeWithMemset = true` if T is an integral type.
This can offer a chance to use memset if we use UniqueArray<T> where T is
an integral type. We also rename VectorTypeOperations::initialize to
VectorTypeOperations::initializeIfNonPOD, VectorTypeOperations::forceInitialize
to VectorTypeOperations::initialize respectively.
* wtf/RefCountedArray.h:
(WTF::RefCountedArray::RefCountedArray):
* wtf/UniqueArray.h:
* wtf/Vector.h:
(WTF::VectorTypeOperations::initializeIfNonPOD):
(WTF::VectorTypeOperations::initialize):
(WTF::Vector::Vector):
(WTF::Malloc>::resize):
(WTF::Malloc>::grow):
(WTF::VectorTypeOperations::forceInitialize): Deleted.
* wtf/VectorTraits.h:
2018-03-07 Keith Miller <keith_miller@apple.com>
Meta-program setupArguments and callOperation
https://bugs.webkit.org/show_bug.cgi?id=183263
Rubber-stamped by Filip Pizlo.
Add a new function traits struct that provides interesting
information about the provided function pointer. Right now it only
provides information for function pointers, in theory we could
also get it to work for other types.
* WTF.xcodeproj/project.pbxproj:
* wtf/Bitmap.h:
(WTF::WordType>::Bitmap):
* wtf/CMakeLists.txt:
* wtf/FunctionTraits.h: Added.
(WTF::slotsForCCallArgument):
(WTF::computeCCallSlots):
(WTF::FunctionTraits<Result):
2018-03-07 Tim Horton <timothy_horton@apple.com>
Shuffle around some feature flags for minimal simulator mode
https://bugs.webkit.org/show_bug.cgi?id=183419
<rdar://problem/37694987>
Reviewed by Beth Dakin.
* wtf/FeatureDefines.h:
* wtf/Platform.h:
2018-03-06 Mark Lam <mark.lam@apple.com>
Prepare LLInt code to support pointer profiling.
https://bugs.webkit.org/show_bug.cgi?id=183387
<rdar://problem/38199678>
Reviewed by JF Bastien.
* wtf/Platform.h:
2018-03-06 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r229330.
https://bugs.webkit.org/show_bug.cgi?id=183379
Broke some Apple internal code (Requested by ap on #webkit).
Reverted changeset:
"Remove unused crash hook functionality"
https://bugs.webkit.org/show_bug.cgi?id=183369
https://trac.webkit.org/changeset/229330
2018-03-06 Michael Catanzaro <mcatanzaro@igalia.com>
Remove unused crash hook functionality
https://bugs.webkit.org/show_bug.cgi?id=183369
Reviewed by Alexey Proskuryakov.
WTFSetCrashHook and WTFInstallReportBacktraceOnCrashHook are not used on any platforms and
can be removed.
* wtf/Assertions.cpp:
* wtf/Assertions.h:
2018-03-05 Yusuke Suzuki <utatane.tea@gmail.com>
Fix std::make_unique / new[] using system malloc
https://bugs.webkit.org/show_bug.cgi?id=182975
Reviewed by JF Bastien.
If we use `make_unique<char[]>(num)` or `new char[num]`, allocation is
done by the system malloc instead of bmalloc. This patch fixes this issue
by following three changes.
1. Introduce UniqueArray<T>. It allocates memory from FastMalloc. While C++
array with `new` need to hold the size to call destructor correctly, our
UniqueArray only supports type T which does not have a non trivial destructor.
It reduces the allocation size since we do not need to track the size of the
array compared to standard `new T[]`. This is basically usable if we want to
have raw array which pointer won't be changed even if the container is moved.
In addition, we also extend UniqueArray<T> for types which have non trivial
destructors.
2. Use Vector<T> instead.
3. Annotate allocated types with MAKE_FAST_ALLOCATED. Since it introduces
new[] and delete[] operators, make_unique<T[]>(num) will allocate memory
from FastMalloc.
* WTF.xcodeproj/project.pbxproj:
* wtf/Assertions.cpp:
* wtf/CMakeLists.txt:
* wtf/FastMalloc.h:
(WTF::FastFree::operator() const):
(WTF::FastFree<T::operator() const):
* wtf/MallocPtr.h:
(WTF::MallocPtr::operator bool const):
* wtf/StackShot.h:
(WTF::StackShot::StackShot):
(WTF::StackShot::operator=):
* wtf/SystemFree.h:
(WTF::SystemFree<T::operator() const):
* wtf/UniqueArray.h: Copied from Source/WebKit/Platform/win/LoggingWin.cpp.
(WTF::makeUniqueArray):
* wtf/Vector.h:
(WTF::VectorTypeOperations::forceInitialize):
2018-03-05 Michael Saboff <msaboff@apple.com>
Start using MAP_JIT for macOS
https://bugs.webkit.org/show_bug.cgi?id=183353
Reviewed by Filip Pizlo.
Unify setting this flag for both iOS and macOS.
* wtf/OSAllocatorPosix.cpp:
(WTF::OSAllocator::reserveAndCommit):
2018-03-05 Yusuke Suzuki <utatane.tea@gmail.com>
Unreviewed, follow-up after r229209
https://bugs.webkit.org/show_bug.cgi?id=183312
Add RELEASE_ASSERT to ensure success.
* wtf/cocoa/CPUTimeCocoa.mm:
(WTF::CPUTime::forCurrentThread):
* wtf/unix/CPUTimeUnix.cpp:
(WTF::CPUTime::forCurrentThread):
* wtf/win/CPUTimeWin.cpp:
(WTF::CPUTime::forCurrentThread):
2018-03-05 Yusuke Suzuki <utatane.tea@gmail.com>
Unreviewed, fix MediaTime test
https://bugs.webkit.org/show_bug.cgi?id=183319
__builtin_xxx_overflow writes overflowed data into ResultType value even if overflow happens.
This is different from the original CheckedArithmetic semantics.
* wtf/CheckedArithmetic.h:
2018-03-04 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Move currentCPUTime and sleep(Seconds) to CPUTime.h and Seconds.h respectively
https://bugs.webkit.org/show_bug.cgi?id=183312
Reviewed by Mark Lam.
1. currentCPUTime to CPUTime.h. It is now defined as CPUTime::forCurrentThread.
We also removes fallback implementation for currentCPUTime since (1) that implementation
is wrong and (2) no environments we support needs this.
2. sleep(Seconds) to Seconds.h. Since sleep(MonotonicTime) and sleep(WallTime) are defined
in MonotonicTime.h and WallTime.h, this code move is natural.
3. Remove wtf/CurrentTime.h since nothing is defined now. But we keep CurrentTime.cpp to
consolidate various time-source implementations in one place.
* WTF.xcodeproj/project.pbxproj:
* benchmarks/ConditionSpeedTest.cpp:
* benchmarks/LockFairnessTest.cpp:
* benchmarks/LockSpeedTest.cpp:
* wtf/CMakeLists.txt:
* wtf/CPUTime.h:
* wtf/CurrentTime.cpp:
(WTF::currentCPUTime): Deleted.
(WTF::sleep): Deleted.
* wtf/CurrentTime.h: Removed.
* wtf/DateMath.cpp:
* wtf/DebugUtilities.h:
* wtf/FastMalloc.cpp:
* wtf/MainThread.cpp:
* wtf/MonotonicTime.cpp:
* wtf/ParkingLot.cpp:
* wtf/Seconds.cpp:
(WTF::sleep):
* wtf/Seconds.h:
* wtf/StackShotProfiler.h:
* wtf/Stopwatch.h:
* wtf/ThreadingPthreads.cpp:
* wtf/ThreadingWin.cpp:
* wtf/cocoa/CPUTimeCocoa.mm:
(WTF::CPUTime::forCurrentThread):
* wtf/cocoa/MemoryPressureHandlerCocoa.mm:
* wtf/linux/MemoryPressureHandlerLinux.cpp:
* wtf/unix/CPUTimeUnix.cpp:
(WTF::CPUTime::forCurrentThread):
* wtf/win/CPUTimeWin.cpp:
(WTF::CPUTime::forCurrentThread):
* wtf/win/RunLoopWin.cpp:
2018-03-04 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Use __builtin_xxx_overflow for CheckedArithmetic
https://bugs.webkit.org/show_bug.cgi?id=183319
Reviewed by Darin Adler.
GCC and Clang has the builtins for arithmetic operations with overflow flags.
CheckedArithmetic operations can be done with this builtins. Since the compiler
can use overflow flags, potentially this is more efficient. CheckedArithmetic
already has TestWebKitAPI tests and we ensured the tests pass.
* wtf/CheckedArithmetic.h:
2018-03-02 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Remove RunLoop and RunLoop::Timer's interface using double as seconds
https://bugs.webkit.org/show_bug.cgi?id=183293
Reviewed by Alex Christensen.
This patch mainly drops startRepeating(double) and startOneShot(double) interfaces.
Use startRepeating(Seconds) and startOneShot(Seconds) instead.
* wtf/MemoryPressureHandler.cpp:
(WTF::MemoryPressureHandler::setShouldUsePeriodicMemoryMonitor):
* wtf/RunLoop.h:
(WTF::RunLoop::TimerBase::startRepeating):
(WTF::RunLoop::TimerBase::startOneShot):
(WTF::RunLoop::TimerBase::startInternal):
* wtf/RunLoopTimer.h:
* wtf/RunLoopTimerCF.cpp:
(WTF::RunLoopTimerBase::start):
* wtf/cf/RunLoopCF.cpp:
(WTF::RunLoop::runForDuration):
(WTF::RunLoop::TimerBase::start):
* wtf/generic/RunLoopGeneric.cpp:
(WTF::RunLoop::TimerBase::start):
* wtf/glib/RunLoopGLib.cpp:
(WTF::RunLoop::TimerBase::start):
* wtf/win/MemoryPressureHandlerWin.cpp:
(WTF::MemoryPressureHandler::install):
* wtf/win/RunLoopWin.cpp:
(WTF::RunLoop::TimerBase::start):
2018-03-02 Christopher Reid <chris.reid@sony.com>
Build fix after r229174
https://bugs.webkit.org/show_bug.cgi?id=183301
Reviewed by Alex Christensen.
Updating MemoryPressureHandler::holdOff to use Seconds instead of unsigned.
* wtf/MemoryPressureHandler.cpp:
2018-03-02 Tim Horton <timothy_horton@apple.com>
Make it possible to build for iOS without Celestial
https://bugs.webkit.org/show_bug.cgi?id=183295
<rdar://problem/38074468>
Reviewed by Dan Bernstein.
* wtf/Platform.h:
2018-03-02 Tim Horton <timothy_horton@apple.com>
Make it possible to disable WKPDFView
https://bugs.webkit.org/show_bug.cgi?id=183281
<rdar://problem/38060815>
Reviewed by Dan Bates.
* wtf/FeatureDefines.h:
2018-03-02 Yusuke Suzuki <utatane.tea@gmail.com>
[JSC] Annotate more classes with WTF_MAKE_FAST_ALLOCATED
https://bugs.webkit.org/show_bug.cgi?id=183279
Reviewed by JF Bastien.
* wtf/SimpleStats.h:
* wtf/ThreadGroup.h:
2018-03-01 Yusuke Suzuki <utatane.tea@gmail.com>
Remove monotonicallyIncreasingTime
https://bugs.webkit.org/show_bug.cgi?id=182911
Reviewed by Michael Catanzaro.
This patch drops monotonicallyIncreasingTime and monotonicallyIncreasingTimeMS.
We have MonotonicTime API instead. This offers strongly typed MonotonicTime,
Seconds etc. This reduces the chance of bugs mixing doubles which represent milliseconds
and seconds.
Large part of this patch is mechanical one: replacing monotonicallyIncreasingTime with
MonotonicTime, using MonotonicTime and Seconds instead of raw doubles.
But this patch actually finds some bugs (but it is a bit difficult to show it as a test).
One is mixing media time (CACurrentMediaTime()) and MonotonicTime. Basically they are
super close because both uses mach_absolute_time(). But they would be slightly different.
So we should not mix them.
The second bug is GraphicsLayer::suspendAnimations(double). While CA ports (Apple, AppleWin,
iOS etc.) use this double as MonotonicTime, GTK and WPE use this double as Seconds (timeOffset).
This patch fixes it and now the signature becomes GraphicsLayer::suspendAnimations(MonotonicTime).
In this patch, we still uses bunch of double for Seconds. But fixing them at this patch increases
the size of this larger and larger. So some of them remains double. This should be fixed in
subsequent patches.
* benchmarks/ConditionSpeedTest.cpp:
* benchmarks/LockSpeedTest.cpp:
* wtf/CurrentTime.cpp:
(WTF::MonotonicTime::now):
(WTF::monotonicallyIncreasingTime): Deleted.
* wtf/CurrentTime.h:
(WTF::monotonicallyIncreasingTimeMS): Deleted.
* wtf/MemoryPressureHandler.h:
* wtf/MonotonicTime.cpp:
(WTF::MonotonicTime::now): Deleted.
* wtf/MonotonicTime.h:
* wtf/ParkingLot.cpp:
* wtf/Seconds.h:
(WTF::Seconds::nan):
* wtf/Stopwatch.h:
(WTF::Stopwatch::reset):
(WTF::Stopwatch::start):
(WTF::Stopwatch::stop):
(WTF::Stopwatch::elapsedTime):
(WTF::Stopwatch::elapsedTimeSince):
* wtf/cocoa/MemoryPressureHandlerCocoa.mm:
(WTF::MemoryPressureHandler::holdOff):
(WTF::MemoryPressureHandler::respondToMemoryPressure):
* wtf/linux/MemoryPressureHandlerLinux.cpp:
(WTF::MemoryPressureHandler::EventFDPoller::EventFDPoller):
(WTF::MemoryPressureHandler::holdOff):
(WTF::MemoryPressureHandler::respondToMemoryPressure):
* wtf/win/MemoryPressureHandlerWin.cpp:
(WTF::MemoryPressureHandler::holdOff):
2018-03-02 Dan Bernstein <mitz@apple.com>
Safari uses WebContent.Development when loading injected bundle embedded in its app bundle
https://bugs.webkit.org/show_bug.cgi?id=183275
Reviewed by Tim Horton.
* wtf/spi/cocoa/SecuritySPI.h: Declared SecTaskGetCodeSignStatus.
2018-02-27 Karlen Simonyan <szkarlen@gmail.com>
[Win64] JSCOnly compile error using VS2017 and cmake
https://bugs.webkit.org/show_bug.cgi?id=183176
Reviewed by Alex Christensen.
* wtf/PlatformJSCOnly.cmake:
2018-02-26 Carlos Garcia Campos <cgarcia@igalia.com>
[GStreamer] User current executable name instead of g_get_prgname() for gst_init
https://bugs.webkit.org/show_bug.cgi?id=183119
Reviewed by Philippe Normand.
Add getCurrentExecutableName() helper function to get the name of the current executable.
* wtf/glib/GLibUtilities.cpp:
(getCurrentExecutableName): Get the basename of getCurrentExecutablePath() falling back to g_get_prgname().
* wtf/glib/GLibUtilities.h:
2018-02-23 John Wilander <wilander@apple.com>
Introduce ITP debug logging as an opt-in developer feature
https://bugs.webkit.org/show_bug.cgi?id=183065
<rdar://problem/37803761>
Reviewed by Brent Fulgham.
* wtf/Assertions.h:
Introduces RELEASE_LOG_INFO() and RELEASE_LOG_INFO_IF().
2018-02-23 Fujii Hironori <Hironori.Fujii@sony.com>
warning: unused variable 'InitialBufferSize' in Assertions.cpp
https://bugs.webkit.org/show_bug.cgi?id=183076
Reviewed by Yusuke Suzuki.
* wtf/Assertions.cpp: Moved the definition of InitialBufferSize to inside #if.
2018-02-22 Yusuke Suzuki <utatane.tea@gmail.com>
Remove currentTime() / currentTimeMS()
https://bugs.webkit.org/show_bug.cgi?id=183052
Reviewed by Mark Lam.
This patch removes WTF::currentTime() and WTF::currentTimeMS().
We have fancy WallTime APIs. It has strong types like WallTime and Seconds,
and this reduces the chance of bugs mixing doubles which represent milliseconds
and seconds.
* wtf/Condition.h:
* wtf/CurrentTime.cpp:
(WTF::currentTime):
(WTF::WallTime::now):
* wtf/CurrentTime.h:
(WTF::currentTimeMS): Deleted.
* wtf/DateMath.h:
(WTF::jsCurrentTime):
* wtf/ParkingLot.cpp:
(WTF::ParkingLot::parkConditionallyImpl):
* wtf/ThreadingPrimitives.h:
* wtf/ThreadingPthreads.cpp:
(WTF::ThreadCondition::timedWait):
* wtf/ThreadingWin.cpp:
(WTF::ThreadCondition::timedWait):
(WTF::absoluteTimeToWaitTimeoutInterval):
* wtf/WallTime.cpp:
(WTF::WallTime::now): Deleted.
* wtf/WallTime.h:
2018-02-22 Yusuke Suzuki <utatane.tea@gmail.com>
Remove sleep(double) and sleepMS(double) interfaces
https://bugs.webkit.org/show_bug.cgi?id=183038
Reviewed by Mark Lam.
This patch removes sleep(double) and sleepMS(double) interfaces.
We can just use sleep(Seconds) instead.
* benchmarks/LockFairnessTest.cpp:
* benchmarks/LockSpeedTest.cpp:
* wtf/CurrentTime.cpp:
(WTF::sleep):
* wtf/CurrentTime.h:
(WTF::sleepMS): Deleted.
* wtf/DebugUtilities.h:
* wtf/Seconds.cpp:
(WTF::sleep): Deleted.
* wtf/Seconds.h:
* wtf/StackShotProfiler.h:
2018-02-21 Don Olmstead <don.olmstead@sony.com>
[CMake][Win] Use cmakeconfig.h rather than config.h and Platform.h
https://bugs.webkit.org/show_bug.cgi?id=182883
Reviewed by Per Arne Vollan.
* wtf/Platform.h:
2018-02-14 Brian Burg <bburg@apple.com>
Web Automation: combine session commands to resize and move top-level browsing contexts
https://bugs.webkit.org/show_bug.cgi?id=182749
<rdar://problem/37515170>
Reviewed by Andy Estes.
* wtf/JSONValues.h: add a getDouble() implementation that returns a std::optional<T>
rather than using an out-parameter. I'd like to move more code to this style.
2018-02-20 Tim Horton <timothy_horton@apple.com>
Introduce HAVE(IOSURFACE_ACCELERATOR)
https://bugs.webkit.org/show_bug.cgi?id=182955
<rdar://problem/37699510>
Reviewed by Sam Weinig.
* wtf/Platform.h:
2018-02-20 Chris Dumez <cdumez@apple.com>
Provisional load may get committed before receiving the decidePolicyForNavigationResponse response
https://bugs.webkit.org/show_bug.cgi?id=182720
<rdar://problem/37515204>
Reviewed by Alex Christensen.
Add convenience CompletionHandlerCallingScope class which calls its CompletionHandler
when destroyed, and provides a release() methods to manually call the completionHandler.
* wtf/CompletionHandler.h:
(WTF::CompletionHandlerCallingScope::CompletionHandlerCallingScope):
(WTF::CompletionHandlerCallingScope::~CompletionHandlerCallingScope):
(WTF::CompletionHandlerCallingScope::CompletionHandler<void):
2018-02-20 Tim Horton <timothy_horton@apple.com>
Always inline soft linking functions to work around a clang bug
https://bugs.webkit.org/show_bug.cgi?id=182985
<rdar://problem/37587017>
Reviewed by Dan Bernstein.
* wtf/cocoa/SoftLinking.h:
In some cases, clang will emit a weak extern symbol for a re-declared
symbol that has availability attributes on it. To avoid this, always
inline to avoid emitting a second symbol.
2018-02-16 Dean Jackson <dino@apple.com>
Use OPENGL macros to be more clear about which OpenGL/ES WebGL uses on Cocoa
https://bugs.webkit.org/show_bug.cgi?id=182894
Reviewed by Tim Horton.
If we're on a Cocoa platform, define USE_OPENGL/USE_OPENGL_ES
depending on what we're actually going to use. In this case,
they are exclusive, but it doesn't appear that other platforms
use this approach. Ultimately the idea is to be more concerned
with the type of OpenGL we're using, rather than the platform.
* wtf/Platform.h: Define USE_OPENGL(_ES) for PLATFORM(COCOA).
2018-02-16 Filip Pizlo <fpizlo@apple.com>
Unreviewed, roll out r228306 (custom memcpy/memset) because the bots say that it was not a
progression.
* WTF.xcodeproj/project.pbxproj:
* wtf/BitVector.cpp:
(WTF::BitVector::setSlow):
(WTF::BitVector::clearAll):
(WTF::BitVector::resizeOutOfLine):
* wtf/BitVector.h:
(WTF::BitVector::OutOfLineBits::numWords const):
(WTF::BitVector::wordCount): Deleted.
* wtf/CMakeLists.txt:
* wtf/ConcurrentBuffer.h:
(WTF::ConcurrentBuffer::growExact):
* wtf/FastBitVector.h:
(WTF::FastBitVectorWordOwner::operator=):
(WTF::FastBitVectorWordOwner::clearAll):
(WTF::FastBitVectorWordOwner::set):
* wtf/FastCopy.h: Removed.
* wtf/FastMalloc.cpp:
(WTF::fastZeroedMalloc):
(WTF::fastStrDup):
(WTF::tryFastZeroedMalloc):
* wtf/FastZeroFill.h: Removed.
* wtf/OSAllocator.h:
(WTF::OSAllocator::reallocateCommitted):
* wtf/StringPrintStream.cpp:
(WTF::StringPrintStream::increaseSize):
* wtf/Vector.h:
* wtf/persistence/PersistentDecoder.cpp:
(WTF::Persistence::Decoder::decodeFixedLengthData):
* wtf/persistence/PersistentEncoder.cpp:
(WTF::Persistence::Encoder::encodeFixedLengthData):
* wtf/text/CString.cpp:
(WTF::CString::init):
(WTF::CString::copyBufferIfNeeded):
* wtf/text/LineBreakIteratorPoolICU.h:
(WTF::LineBreakIteratorPool::makeLocaleWithBreakKeyword):
* wtf/text/StringBuilder.cpp:
(WTF::StringBuilder::allocateBuffer):
(WTF::StringBuilder::append):
* wtf/text/StringConcatenate.h:
* wtf/text/StringImpl.h:
(WTF::StringImpl::copyCharacters):
* wtf/text/icu/UTextProvider.cpp:
(WTF::uTextCloneImpl):
* wtf/text/icu/UTextProviderLatin1.cpp:
(WTF::uTextLatin1Clone):
(WTF::openLatin1UTextProvider):
* wtf/threads/Signals.cpp:
2018-02-16 Keith Miller <keith_miller@apple.com>
Remove unused line from Platform.h
https://bugs.webkit.org/show_bug.cgi?id=182871
Reviewed by Mark Lam.
* wtf/Platform.h:
2018-02-14 Michael Saboff <msaboff@apple.com>
REGRESSION(225695) : com.apple.WebKit.WebContent at com.apple.JavaScriptCore: JSC::RegExp::match + 630 :: stack overflow
https://bugs.webkit.org/show_bug.cgi?id=182705
Reviewed by Mark Lam.
Moved the setting of ENABLE_YARR_JIT_ALL_PARENS_EXPRESSIONS to Platform.h since more than just the YARR
code needs to know if that feature is enabled.
* wtf/Platform.h:
2018-02-12 Mark Lam <mark.lam@apple.com>
Add more support for pointer preparations.
https://bugs.webkit.org/show_bug.cgi?id=182703
<rdar://problem/37469451>
Reviewed by Saam Barati.
* wtf/PointerPreparations.h:
2018-02-09 Ross Kirsling <ross.kirsling@sony.com>
Use REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR on any non-Windows port.
https://bugs.webkit.org/show_bug.cgi?id=182623
Reviewed by Alex Christensen.
* wtf/Platform.h:
Simplify #if.
2018-02-08 Filip Pizlo <fpizlo@apple.com>
Experiment with alternative implementation of memcpy/memset
https://bugs.webkit.org/show_bug.cgi?id=182563
Reviewed by Michael Saboff and Mark Lam.
Adds a faster x86_64-specific implementation of memcpy and memset. These versions go by
different names than memcpy/memset and have a different API:
WTF::fastCopy<T>(T* dst, T* src, size_t N): copies N values of type T from src to dst.
WTF::fastZeroFill(T* dst, size_T N): writes N * sizeof(T) zeroes to dst.
There are also *Bytes variants that take void* for dst and src and size_t numBytes. Those are
most appropriate in places where the code is already computing bytes.
These will just call memcpy/memset on platforms where the optimized versions are not supported.
These new functions are not known to the compiler to be memcpy/memset. This has the effect that
the compiler will not try to replace them with anything else. This could be good or bad:
- It's *good* if the size is *not known* at compile time. In that case, by my benchmarks, these
versions are faster than either the memcpy/memset call or whatever else the compiler could
emit. This is because of a combination of inlining and the algorithm itself (see below).
- It's *bad* if the size is *known* at compile time. In that case, the compiler could
potentially emit a fully unrolled memcpy/memset. That might not happen if the size is large
(even if it's known), but in this patch I avoid replacing any memcpy/memset calls when the
size is a constant. In particular, this totally avoids the call overhead -- if the size is
small, then the compiler will emit a nice inlined copy or set. If the size is large, then the
most optimal thing to do is emit the shortest piece of code possible, and that's a call to
memcpy/memset.
It's unfortunate that you have to choose between them on your own. One way to avoid that might
have been to override the memcpy/memset symbols, so that the compiler can still do its
reasoning. But that's not quite right, since then we would lose inlining in the unknonw-size
case. Also, it's possible that for some unknown-size cases, the compiler could choose to emit
something on its own because it might think that some property of aliasing or alignment could
help it. I think it's a bit better to use our own copy/set implementations even in those cases.
Another way that I tried avoiding this is to detect inside fastCopy/fastZeroFill if the size is
constant. But there is no good way to do that in C++. There is a builtin for doing that inside a
macro, but that feels janky, so I didn't want to do it in this patch.
The reason why these new fastCopy/fastZeroFill functions are faster is that:
- They can be inlined. There is no function call. Only a few registers get clobbered. So, the
impact on the quality of the code surrounding the memcpy/memset is smaller.
- They use type information to select the implementation. For sizes that are multiples of 2, 4,
or 8, the resulting code performs dramatically better on small arrays than memcpy because it
uses fewer cycles. The difference is greatest for 2 and 4 byte types, since memcpy usually
handles small arrays by tiering from a 8-byte word copy loop to a byte copy loop. So, for 2
or 4 byte arrays, we use an algorithm that tiers from 8-byte word down to a 2-byte or 4-byte
(depending on type) copy loop. So, for example, when copying a 16-bit string that has 1, 2, or
3 characters, this means doing 1, 2, or 3 word copies rather than 2, 4, or 6 byte copies. For
8-byte types, the resulting savings are mainly that there is no check to see if a tier-down to
the byte-copy loop is needed -- so really that means reducing code size. 1-byte types don't
get this inherent advantage over memcpy/memset, but they still benefit from all of the other
advantages of these functions. Of course, this advantage isn't inherent to our approach. The
compiler could also notice that the arguments to memcpy/memset have some alignment properties.
It could do it even more generally than we do - for example a copy over bytes where the size
is a multiple of 4 can use the 4-byte word algorithm. But based on my tests, the compiler does
not do this (even though it does other things, like turn a memset call with a zero value
argument into a bzero call).
- They use a very nicely written word copy/set loop for small arrays. I spent a lot of time
getting the assembly just right. When we use memcpy/memset, sometimes we would optimize the
call by having a fast path word copy loop for small sizes. That's not necessary with this
implementation, since the assembly copy loop gets inlined.
- They use `rep movs` or `rep stos` for copies of 200 bytes or more. This decision benchmarks
poorly on every synthetic memcpy/memset benchmark I have built, and so unsurprisingly, it's
not what system memcpy/memset does. Most system memcpy/memset implementations end up doing
some SSE for medium-sized copies,. However, I previously found that this decision is bad for
one of the memset calls in GC (see clearArray() and friends in ArrayConventions.h|cpp) - I was
able to make the overhead of that call virtually disappear by doing `rep stos` more
aggressively. The theory behind this change is that it's not just the GC that prefers smaller
`rep` threshold and no SSE. I am betting that `rep`ing more is better when the heap gets
chaotic and the data being copied is used in interesting ways -- hence, synthetic
memcpy/memset benchmarks think it's bad (they don't do enough chaotic memory accesses) while
it's good for real-world uses. Also, when I previously worked on JVMs, I had found that the
best memcpy/memset heuristics when dealing with GC'd objects in a crazy heap were different
than any memcpy/memset in any system library.
This appears to be a 0.9% speed-up on PLT. I'm not sure if it's more because of the inlining or
the `rep`. I think it's both. I'll leave figuring out the exact tuning for future patches.
* wtf/BitVector.cpp:
(WTF::BitVector::setSlow):
(WTF::BitVector::clearAll):
(WTF::BitVector::resizeOutOfLine):
* wtf/BitVector.h:
(WTF::BitVector::wordCount):
(WTF::BitVector::OutOfLineBits::numWords const):
* wtf/ConcurrentBuffer.h:
(WTF::ConcurrentBuffer::growExact):
* wtf/FastBitVector.h:
(WTF::FastBitVectorWordOwner::operator=):
(WTF::FastBitVectorWordOwner::clearAll):
(WTF::FastBitVectorWordOwner::set):
* wtf/FastCopy.h: Added.
(WTF::fastCopy):
(WTF::fastCopyBytes):
* wtf/FastMalloc.cpp:
(WTF::fastZeroedMalloc):
(WTF::fastStrDup):
(WTF::tryFastZeroedMalloc):
* wtf/FastZeroFill.h: Added.
(WTF::fastZeroFill):
(WTF::fastZeroFillBytes):
* wtf/MD5.cpp:
* wtf/OSAllocator.h:
(WTF::OSAllocator::reallocateCommitted):
* wtf/StringPrintStream.cpp:
(WTF::StringPrintStream::increaseSize):
* wtf/Vector.h:
* wtf/persistence/PersistentDecoder.cpp:
(WTF::Persistence::Decoder::decodeFixedLengthData):
* wtf/persistence/PersistentEncoder.cpp:
(WTF::Persistence::Encoder::encodeFixedLengthData):
* wtf/text/CString.cpp:
(WTF::CString::init):
(WTF::CString::copyBufferIfNeeded):
* wtf/text/LineBreakIteratorPoolICU.h:
(WTF::LineBreakIteratorPool::makeLocaleWithBreakKeyword):
* wtf/text/StringBuilder.cpp:
(WTF::StringBuilder::allocateBuffer):
(WTF::StringBuilder::append):
* wtf/text/StringConcatenate.h:
* wtf/text/StringImpl.h:
(WTF::StringImpl::copyCharacters):
* wtf/text/icu/UTextProvider.cpp:
(WTF::uTextCloneImpl):
* wtf/text/icu/UTextProviderLatin1.cpp:
(WTF::uTextLatin1Clone):
(WTF::openLatin1UTextProvider):
* wtf/threads/Signals.cpp:
2018-02-06 Darin Adler <darin@apple.com>
Event improvements
https://bugs.webkit.org/show_bug.cgi?id=179591
Reviewed by Chris Dumez.
* wtf/text/OrdinalNumber.h: Added som missing const.
* wtf/text/TextPosition.h: Ditto.
2018-02-06 Fujii Hironori <Hironori.Fujii@sony.com>
[GTK] fast/events/message-channel-gc-4.html is flaky
https://bugs.webkit.org/show_bug.cgi?id=182104
Reviewed by Carlos Garcia Campos.
Revert r228001 because RunLoop::current isn't called in GC thread
anymore since r228152.
* wtf/RunLoop.cpp:
(WTF::RunLoop::current): Removed a template argument
CanBeGCThread::True of ThreadSpecific.
2018-02-05 Konstantin Tokarev <annulen@yandex.ru>
[cmake] Fix build with ICU configured without collation support
https://bugs.webkit.org/show_bug.cgi?id=182498
Reviewed by Alex Christensen.
WebKit has CollatorDefault.cpp providing necessary stubs when
UCONFIG_NO_COLLATION is defined, however it is not included in cmake
file list.
* wtf/CMakeLists.txt:
2018-02-05 Alicia Boya García <aboya@igalia.com>
Fix bug in MediaTime comparison for negative values with different scale.
https://bugs.webkit.org/show_bug.cgi?id=182433
Reviewed by Xabier Rodriguez-Calvar.
* wtf/MediaTime.cpp:
(WTF::MediaTime::compare const):
2018-02-02 Mark Lam <mark.lam@apple.com>
More ARM64_32 fixes.
https://bugs.webkit.org/show_bug.cgi?id=182441
<rdar://problem/37162310>
Reviewed by Dan Bernstein.
My previous speculative ARM64_32 build fix in copyLCharsFromUCharSource() was wrong.
I've now fixed it to choose the default implementation case instead of the ARM64
case if the target is ARM64_32.
* wtf/text/ASCIIFastPath.h:
(WTF::copyLCharsFromUCharSource):
2018-02-02 Konstantin Tokarev <annulen@yandex.ru>
Unreviewed build fix for JSCOnly on macOS after r227845.
https://bugs.webkit.org/show_bug.cgi?id=182274
Reverted part of r227845 that moved CommonCryptoSPI.h
handling into PlatformMac, because it is needed for all
ports which can be built on macOS.
* wtf/CMakeLists.txt:
* wtf/PlatformMac.cmake:
2018-02-02 Fujii Hironori <Hironori.Fujii@sony.com>
[GTK] fast/events/message-channel-gc-4.html is flaky
https://bugs.webkit.org/show_bug.cgi?id=182104
Reviewed by Carlos Garcia Campos.
RELEASE_ASSERT of ThreadSpecific::set fails because
RunLoop::current is called even in GC thread since r227275.
* wtf/RunLoop.cpp:
(WTF::RunLoop::current):
Let the second template argument of ThreadSpecific CanBeGCThread::True.
2018-02-01 Michael Catanzaro <mcatanzaro@igalia.com>
[WPE][GTK] Make RunLoop::TimerBase robust to its own deletion inside its source callback
https://bugs.webkit.org/show_bug.cgi?id=182271
Reviewed by Carlos Garcia Campos.
RunLoopTimer::fired executes the user's callback, which could delete the RunLoopTimer
itself. But the source callback is not prepared to handle this case. We can detect it
easily, because TimerBase's destructor will call g_source_destroy(), which confusingly
removes the GSource from its GMainContext without actually destroying the GSource. Then we
can check if the GSource is still attached using g_source_is_destroyed().
* wtf/glib/RunLoopGLib.cpp:
(WTF::RunLoop::TimerBase::TimerBase):
2018-01-31 Saam Barati <sbarati@apple.com>
Replace tryLargeMemalignVirtual with tryLargeZeroedMemalignVirtual and use it to allocate large zeroed memory in Wasm
https://bugs.webkit.org/show_bug.cgi?id=182064
<rdar://problem/36840132>
Reviewed by Geoffrey Garen.
* wtf/Gigacage.cpp:
(Gigacage::tryAllocateZeroedVirtualPages):
(Gigacage::freeVirtualPages):
(Gigacage::tryAllocateVirtualPages): Deleted.
* wtf/Gigacage.h:
* wtf/OSAllocator.h:
2018-01-31 Mark Lam <mark.lam@apple.com>
Fix some ARM64_32 build failures.
https://bugs.webkit.org/show_bug.cgi?id=182356
<rdar://problem/37057690>
Reviewed by Michael Saboff.
* wtf/MathExtras.h:
(WTF::dynamicPoison):
* wtf/text/ASCIIFastPath.h:
(WTF::copyLCharsFromUCharSource):
2018-01-30 Mark Lam <mark.lam@apple.com>
Apply poisoning to TypedArray vector pointers.
https://bugs.webkit.org/show_bug.cgi?id=182155
<rdar://problem/36286266>
Reviewed by JF Bastien.
1. Added the ability to poison a CagedPtr.
2. Prevent CagedPtr from being implicitly instantiated, and add operator= methods
instead. This is because implicitly instantiated CagedPtrs with a poisoned
trait may silently use a wrong poison value.
* wtf/CagedPtr.h:
(WTF::CagedPtr::CagedPtr):
(WTF::CagedPtr::get const):
(WTF::CagedPtr::operator=):
2018-01-30 Fujii Hironori <Hironori.Fujii@sony.com>
[Win] Warning fix.
https://bugs.webkit.org/show_bug.cgi?id=177007
Reviewed by Yusuke Suzuki.
A 32 bit integer should not be casted to a pointer directly in 64
bit Windows. It should be casted to a uintptr_t beforehand.
Rules for Using Pointers (Windows)
https://msdn.microsoft.com/library/windows/desktop/aa384242
* wtf/ThreadingWin.cpp (InvalidThread): Casted 0xbbadbeef to uintptr_t.
2018-01-30 Don Olmstead <don.olmstead@sony.com>
Unreviewed build fix for JSCOnly after r227845.
https://bugs.webkit.org/show_bug.cgi?id=182274
* wtf/PlatformJSCOnly.cmake:
2018-01-30 Don Olmstead <don.olmstead@sony.com>
[CMake] Make WTF headers copies
https://bugs.webkit.org/show_bug.cgi?id=182274
Reviewed by Alex Christensen.
* wtf/CMakeLists.txt:
* wtf/PlatformGTK.cmake:
* wtf/PlatformJSCOnly.cmake:
* wtf/PlatformMac.cmake:
* wtf/PlatformWPE.cmake:
* wtf/PlatformWin.cmake:
2018-01-30 Mark Lam <mark.lam@apple.com>
Move ENABLE_POISON to Platform.h.
https://bugs.webkit.org/show_bug.cgi?id=182298
<rdar://problem/37032686>
Reviewed by Michael Saboff and JF Bastien.
ENABLE_POISON belongs in Platform.h to ensure that all places that depend on
ENABLE(POISON) will see it properly defined.
* wtf/Platform.h:
* wtf/Poisoned.h:
2018-01-26 Mark Lam <mark.lam@apple.com>
Add infrastructure for pointer preparation.
https://bugs.webkit.org/show_bug.cgi?id=182191
<rdar://problem/36889194>
Reviewed by JF Bastien.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/PointerPreparations.h: Added.
2018-01-26 Chris Nardi <cnardi@chromium.org>
Addressing post-review comments after r226614
https://bugs.webkit.org/show_bug.cgi?id=182151
Reviewed by Myles C. Maxfield.
* wtf/text/StringImpl.h:
(WTF::isSpaceOrNewline):
* wtf/text/TextBreakIterator.cpp:
(WTF::numCodeUnitsInGraphemeClusters):
* wtf/text/TextBreakIterator.h:
2018-01-26 Filip Pizlo <fpizlo@apple.com>
Fix style - need to use C comments.
* wtf/Platform.h:
2018-01-26 Filip Pizlo <fpizlo@apple.com>
Disable TLS-based TLCs
https://bugs.webkit.org/show_bug.cgi?id=182175
Reviewed by Saam Barati.
Add a flag for TLS-based TLCs and set it to 0. We can re-enable this feature when we need to use TLCs for
actual thread-local allocation and when we fix the fact that WebCore context switches JSC VMs without telling
us.
* wtf/Platform.h:
2018-01-25 Filip Pizlo <fpizlo@apple.com>
Unreviewed, fix windows build.
* wtf/MathExtras.h:
(WTF::opaque):
2018-01-24 Filip Pizlo <fpizlo@apple.com>
DirectArguments should protect itself using dynamic poisoning and precise index masking
https://bugs.webkit.org/show_bug.cgi?id=182086
Reviewed by Saam Barati.
Add helpers for:
Dynamic poisoning: this means arranging to have the pointer you will dereference become an
invalid pointer if the type check you were relying on would have failed.
Precise index masking: a variant of index masking that does not depend on distancing. I figured
I'd just try this first for DirectArguments, since I didn't think that arguments[i] was ever
hot enough to warrant anything better. Turns out that in all of the benchmarks that care about
arguments performance, we optimize things to the point that the index masking isn't on a hot
path anymore. Turns out, it's neutral!
* wtf/MathExtras.h:
(WTF::preciseIndexMask):
(WTF::dynamicPoison):
2018-01-25 Jer Noble <jer.noble@apple.com>
Unreviewed build fix after r227631; make USE_VIDEOTOOLBOX universally enabled on iOS.
* wtf/Platform.h:
2018-01-25 Jer Noble <jer.noble@apple.com>
Move ImageDecoderAVFObjC from using AVSampleBufferGenerator to AVAssetReaderOutput for parsing
https://bugs.webkit.org/show_bug.cgi?id=182091
Reviewed by Eric Carlson.
* wtf/Platform.h:
2018-01-25 Mark Lam <mark.lam@apple.com>
Rename the Poisoned::isPoisoned constant to Poisoned::isPoisonedType.
https://bugs.webkit.org/show_bug.cgi?id=182143
<rdar://problem/36880970>
Reviewed by JF Bastien.
This is so that it doesn't conflict with the isPoisoned() debugging methods that
are normally not built. Also renamed PoisonedUniquePtr::isPoisonedUniquePtr to
PoisonedUniquePtr::isPoisonedUniquePtrType to be consistent.
* wtf/Poisoned.h:
* wtf/PoisonedUniquePtr.h:
2018-01-25 Filip Pizlo <fpizlo@apple.com>
JSC GC should support TLCs (thread local caches)
https://bugs.webkit.org/show_bug.cgi?id=181559
Reviewed by Mark Lam and Saam Barati.
* wtf/Bitmap.h: Just fixing a compile error.
2018-01-25 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r227592.
https://bugs.webkit.org/show_bug.cgi?id=182110
it made ARM64 (Linux and iOS) crash (Requested by pizlo-mbp on
#webkit).
Reverted changeset:
"JSC GC should support TLCs (thread local caches)"
https://bugs.webkit.org/show_bug.cgi?id=181559
https://trac.webkit.org/changeset/227592
2018-01-20 Filip Pizlo <fpizlo@apple.com>
JSC GC should support TLCs (thread local caches)
https://bugs.webkit.org/show_bug.cgi?id=181559
Reviewed by Mark Lam and Saam Barati.
* wtf/Bitmap.h: Just fixing a compile error.
2018-01-23 Mark Lam <mark.lam@apple.com>
Update Poisoned pointers to take a Poison class instead of a uintptr_t&.
https://bugs.webkit.org/show_bug.cgi?id=182017
<rdar://problem/36795513>
Reviewed by Filip Pizlo and JF Bastien.
This paves the way for custom poison values which we'll need for use in
TypedArrays later.
* wtf/Bag.h:
* wtf/DumbPtrTraits.h:
(WTF::DumbPtrTraits::poison): Deleted.
* wtf/DumbValueTraits.h:
(WTF::DumbValueTraits::poison): Deleted.
* wtf/Poisoned.h:
(WTF::Poison::key):
(WTF::Poisoned::swap):
(WTF::Poisoned::poison const):
(WTF::Poisoned::unpoison const):
(WTF::Poisoned::poison):
(WTF::Poisoned::unpoison):
(WTF::PoisonedPtrTraits::swap):
(WTF::PoisonedValueTraits::swap):
(WTF::PoisonedPtrTraits::poison): Deleted.
(WTF::PoisonedValueTraits::poison): Deleted.
* wtf/PoisonedUniquePtr.h:
* wtf/Ref.h:
* wtf/RefCountedArray.h:
* wtf/RefPtr.h:
* wtf/WTFAssertions.cpp:
2018-01-23 Alex Christensen <achristensen@webkit.org>
Remove pre-Sierra-OS-specific code in WTF and JavaScriptCore
https://bugs.webkit.org/show_bug.cgi?id=182028
Reviewed by Keith Miller.
* wtf/Platform.h:
* wtf/mac/AppKitCompatibilityDeclarations.h:
* wtf/mac/DeprecatedSymbolsUsedBySafari.mm:
(WTF::MainThreadFunctionTracker::singleton): Deleted.
(WTF::MainThreadFunctionTracker::callOnMainThread): Deleted.
(WTF::MainThreadFunctionTracker::cancelCallOnMainThread): Deleted.
(WTF::MainThreadFunctionTracker::addFunction): Deleted.
(WTF::MainThreadFunctionTracker::removeIdentifier): Deleted.
(WTF::MainThreadFunctionTracker::removeFunctions): Deleted.
(WTF::callOnMainThread): Deleted.
(WTF::cancelCallOnMainThread): Deleted.
* wtf/spi/cocoa/SecuritySPI.h:
* wtf/spi/darwin/dyldSPI.h:
* wtf/text/icu/TextBreakIteratorICU.h:
(WTF::TextBreakIteratorICU::TextBreakIteratorICU):
(WTF::caretRules): Deleted.
2018-01-23 Filip Pizlo <fpizlo@apple.com>
JSC should use a speculation fence on VM entry/exit
https://bugs.webkit.org/show_bug.cgi?id=181991
Reviewed by JF Bastien and Mark Lam.
Implement speculationFence as lfence on x86 and isb on ARM64. I'm not sure if isb is
appropriate for all ARM64's.
* wtf/Atomics.h:
(WTF::speculationFence):
(WTF::x86_lfence):
2018-01-22 Alex Christensen <achristensen@webkit.org>
Begin removing QTKit code
https://bugs.webkit.org/show_bug.cgi?id=181951
Reviewed by Jer Noble.
* wtf/Platform.h:
2018-01-21 Wenson Hsieh <wenson_hsieh@apple.com>
Add a new feature flag for EXTRA_ZOOM_MODE and reintroduce AdditionalFeatureDefines.h
https://bugs.webkit.org/show_bug.cgi?id=181918
Reviewed by Tim Horton.
Include AdditionalFeatureDefines.h, if possible. This allows WebKitAdditions to override
the value of certain feature flags in the OpenSource WebKit repository.
* wtf/Platform.h:
2018-01-19 Alex Christensen <achristensen@webkit.org>
Fix jsc-only build
https://bugs.webkit.org/show_bug.cgi?id=181874
Reviewed by JF Bastien.
This makes "build-webkit --jsc-only" work on Mac!
* wtf/PlatformJSCOnly.cmake:
2018-01-19 Keith Miller <keith_miller@apple.com>
HaveInternalSDK includes should be "#include?"
https://bugs.webkit.org/show_bug.cgi?id=179670
Reviewed by Dan Bernstein.
* Configurations/Base.xcconfig:
2018-01-19 Alexey Proskuryakov <ap@apple.com>
Update XPCSPI.h
https://bugs.webkit.org/show_bug.cgi?id=181827
rdar://problem/36393031
Reviewed by Daniel Bates.
* wtf/spi/darwin/XPCSPI.h:
2018-01-18 Chris Dumez <cdumez@apple.com>
We should be able to terminate service workers that are unresponsive
https://bugs.webkit.org/show_bug.cgi?id=181563
<rdar://problem/35280031>
Reviewed by Alex Christensen.
* wtf/ObjectIdentifier.h:
(WTF::ObjectIdentifier::loggingString const):
Allow using loggingString() from RELEASE_LOG().
2018-01-18 Dan Bernstein <mitz@apple.com>
[Xcode] Streamline and future-proof target-macOS-version-dependent build setting definitions
https://bugs.webkit.org/show_bug.cgi?id=181803
Reviewed by Tim Horton.
* Configurations/Base.xcconfig: Updated.
* Configurations/DebugRelease.xcconfig: Updated.
2018-01-17 Daniel Bates <dabates@apple.com>
REGRESSION (r222795): Cardiogram never signs in
https://bugs.webkit.org/show_bug.cgi?id=181693
<rdar://problem/36286293>
Reviewed by Ryosuke Niwa.
Add macro define for future iOS.
* wtf/spi/darwin/dyldSPI.h:
2018-01-17 Per Arne Vollan <pvollan@apple.com>
[Win] Compile error: 'wtf/text/icu/TextBreakIteratorICU.h' not found.
https://bugs.webkit.org/show_bug.cgi?id=181744
<rdar://problem/36582562>
Reviewed by Alex Christensen.
Add WTF folders to forwarding headers directories.
* wtf/PlatformWin.cmake:
2018-01-16 Per Arne Vollan <pvollan@apple.com>
[Win] JSC compile error in runtime/DateConversion.cpp.
https://bugs.webkit.org/show_bug.cgi?id=181690
<rdar://problem/36480409>
Reviewed by Brent Fulgham.
Add 'text/win' folder to list of forwarding headers directories.
* wtf/PlatformWin.cmake:
2018-01-15 Michael Catanzaro <mcatanzaro@igalia.com>
Improve use of ExportMacros
https://bugs.webkit.org/show_bug.cgi?id=181652
Reviewed by Konstantin Tokarev.
* wtf/ExportMacros.h: Simplify the #defines in this file.
* wtf/Platform.h: Remove unneeded define. Remove comment that expects all ports to
eventually enable the export macros. WPE will never want these. We don't currently want
them for GTK either, though how we link GTK has been in flux recently.
2018-01-15 JF Bastien <jfbastien@apple.com>
Remove makePoisonedUnique
https://bugs.webkit.org/show_bug.cgi?id=181630
<rdar://problem/36498623>
Reviewed by Mark Lam.
I added a conversion from std::unique_ptr, so we can just use
std::make_unique and it'll auto-poison when converted.
* wtf/PoisonedUniquePtr.h:
(WTF::makePoisonedUnique): Deleted.
2018-01-13 Mark Lam <mark.lam@apple.com>
Replace all use of ConstExprPoisoned with Poisoned.
https://bugs.webkit.org/show_bug.cgi?id=181542
<rdar://problem/36442138>
Reviewed by JF Bastien.
1. Removed ConstExprPoisoned and its artifacts.
2. Consolidated Poisoned into PoisonedImpl. PoisonedImpl is not more.
3. Changed all clients of ConstExprPoisoned to use Poisoned instead.
4. Worked around the GCC and Clang compiler bug that confuses an intptr_t&
template arg with intptr_t.
See use of std::enable_if_t<Other::isPoisoned> in Poisoned.h.
5. Removed ENABLE(MIXED_POISON) since we now have a workaround (3) that makes it
possible to use the mixed poison code.
6. Also fixed broken implementation of comparison operators in Poisoned.
* wtf/Bag.h:
* wtf/DumbPtrTraits.h:
(WTF::DumbPtrTraits::poison):
* wtf/DumbValueTraits.h:
(WTF::DumbValueTraits::poison):
* wtf/Poisoned.h:
(WTF::Poisoned::Poisoned):
(WTF::Poisoned::operator== const):
(WTF::Poisoned::operator!= const):
(WTF::Poisoned::operator< const):
(WTF::Poisoned::operator<= const):
(WTF::Poisoned::operator> const):
(WTF::Poisoned::operator>= const):
(WTF::Poisoned::operator=):
(WTF::Poisoned::swap):
(WTF::swap):
(WTF::PoisonedPtrTraits::poison):
(WTF::PoisonedPtrTraits::swap):
(WTF::PoisonedValueTraits::poison):
(WTF::PoisonedValueTraits::swap):
(WTF::PoisonedImpl::PoisonedImpl): Deleted.
(WTF::PoisonedImpl::assertIsPoisoned const): Deleted.
(WTF::PoisonedImpl::assertIsNotPoisoned const): Deleted.
(WTF::PoisonedImpl::unpoisoned const): Deleted.
(WTF::PoisonedImpl::clear): Deleted.
(WTF::PoisonedImpl::operator* const): Deleted.
(WTF::PoisonedImpl::operator-> const): Deleted.
(WTF::PoisonedImpl::bits const): Deleted.
(WTF::PoisonedImpl::operator! const): Deleted.
(WTF::PoisonedImpl::operator bool const): Deleted.
(WTF::PoisonedImpl::operator== const): Deleted.
(WTF::PoisonedImpl::operator!= const): Deleted.
(WTF::PoisonedImpl::operator< const): Deleted.
(WTF::PoisonedImpl::operator<= const): Deleted.
(WTF::PoisonedImpl::operator> const): Deleted.
(WTF::PoisonedImpl::operator>= const): Deleted.
(WTF::PoisonedImpl::operator=): Deleted.
(WTF::PoisonedImpl::swap): Deleted.
(WTF::PoisonedImpl::exchange): Deleted.
(WTF::PoisonedImpl::poison): Deleted.
(WTF::PoisonedImpl::unpoison): Deleted.
(WTF::constExprPoisonRandom): Deleted.
(WTF::makeConstExprPoison): Deleted.
(WTF::ConstExprPoisonedPtrTraits::exchange): Deleted.
(WTF::ConstExprPoisonedPtrTraits::swap): Deleted.
(WTF::ConstExprPoisonedPtrTraits::unwrap): Deleted.
(WTF::ConstExprPoisonedValueTraits::exchange): Deleted.
(WTF::ConstExprPoisonedValueTraits::swap): Deleted.
(WTF::ConstExprPoisonedValueTraits::unwrap): Deleted.
* wtf/PoisonedUniquePtr.h:
(WTF::PoisonedUniquePtr::PoisonedUniquePtr):
(WTF::PoisonedUniquePtr::operator=):
* wtf/Ref.h:
* wtf/RefCountedArray.h:
(WTF::RefCountedArray::RefCountedArray):
* wtf/RefPtr.h:
* wtf/WTFAssertions.cpp:
2018-01-12 JF Bastien <jfbastien@apple.com>
PoisonedWriteBarrier
https://bugs.webkit.org/show_bug.cgi?id=181599
<rdar://problem/36474351>
Reviewed by Mark Lam.
Supporting changes needed to allow poisoning of WriteBarrier
objects.
* WTF.xcodeproj/project.pbxproj:
* wtf/DumbPtrTraits.h:
* wtf/DumbValueTraits.h: Copied from Source/WTF/wtf/DumbPtrTraits.h.
(WTF::DumbValueTraits::exchange):
(WTF::DumbValueTraits::swap):
(WTF::DumbValueTraits::unwrap):
* wtf/Forward.h:
* wtf/Poisoned.h:
(WTF::ConstExprPoisonedValueTraits::exchange):
(WTF::ConstExprPoisonedValueTraits::swap):
(WTF::ConstExprPoisonedValueTraits::unwrap):
2018-01-11 Basuke Suzuki <Basuke.Suzuki@sony.com>
Remove noexcept from definition of std::tie()
https://bugs.webkit.org/show_bug.cgi?id=181577
Reviewed by Yusuke Suzuki.
* wtf/StdLibExtras.h:
(WTF::tie):
2018-01-11 Filip Pizlo <fpizlo@apple.com>
Reserve a fast TLS key for GC TLC
https://bugs.webkit.org/show_bug.cgi?id=181539
Reviewed by Alexey Proskuryakov.
Who knew that thread-local caches would be a mitigation for timing attacks. Here's how it
works: if we have TLCs then we can "context switch" them when we "context switch" origins.
This allows us to put some minimal distance between objects from different origins, which
gives us the ability to allow small overflows when doing certain bounds checks without
creating a useful Spectre information leak.
So I think that means we have to implement thread-local caches (also known as thread-local
allocation buffers, but I prefer the TLC terminology).
* wtf/FastTLS.h:
2018-01-04 Filip Pizlo <fpizlo@apple.com>
CodeBlocks should be in IsoSubspaces
https://bugs.webkit.org/show_bug.cgi?id=180884
Reviewed by Saam Barati.
Deque<>::contains() is helpful for a debug ASSERT.
* wtf/Deque.h:
(WTF::inlineCapacity>::contains):
2018-01-11 JF Bastien <jfbastien@apple.com>
NFC reorder headers
https://bugs.webkit.org/show_bug.cgi?id=181521
Reviewed by Darin Adler.
Follow-up on r226752. I misunderstood the header include order
style. No functional change.
* wtf/Poisoned.h:
* wtf/PoisonedUniquePtr.h:
2018-01-10 JF Bastien <jfbastien@apple.com>
Poison small JSObject derivatives which only contain pointers
https://bugs.webkit.org/show_bug.cgi?id=181483
<rdar://problem/36407127>
Reviewed by Mark Lam.
The associated JSC poisoning change requires some template
"improvements" to our poisoning machinery. Worth noting is that
I'm making PoisonedUniquePtr move-assignable and
move-constructible from unique_ptr, which makes it a better
drop-in replacement because we don't need to use
makePoisonedUniquePtr. This means function-locals can be
unique_ptr and get the nice RAII pattern, and once the function is
done you can just move to the class' PoisonedUniquePtr without
worrying.
* wtf/Poisoned.h:
(WTF::PoisonedImpl::PoisonedImpl):
* wtf/PoisonedUniquePtr.h:
(WTF::PoisonedUniquePtr::PoisonedUniquePtr):
(WTF::PoisonedUniquePtr::operator=):
2018-01-10 Don Olmstead <don.olmstead@sony.com>
Add nullptr_t specialization of poison
https://bugs.webkit.org/show_bug.cgi?id=181469
Reviewed by JF Bastien.
* wtf/Poisoned.h:
(WTF::PoisonedImpl::poison):
2018-01-10 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r226667 and r226673.
https://bugs.webkit.org/show_bug.cgi?id=181488
This caused a flaky crash. (Requested by mlewis13 on #webkit).
Reverted changesets:
"CodeBlocks should be in IsoSubspaces"
https://bugs.webkit.org/show_bug.cgi?id=180884
https://trac.webkit.org/changeset/226667
"REGRESSION (r226667): CodeBlocks should be in IsoSubspaces"
https://bugs.webkit.org/show_bug.cgi?id=180884
https://trac.webkit.org/changeset/226673
2018-01-04 Filip Pizlo <fpizlo@apple.com>
CodeBlocks should be in IsoSubspaces
https://bugs.webkit.org/show_bug.cgi?id=180884
Reviewed by Saam Barati.
Deque<>::contains() is helpful for a debug ASSERT.
* wtf/Deque.h:
(WTF::inlineCapacity>::contains):
2018-01-08 Don Olmstead <don.olmstead@sony.com>
Add WTF_EXPORTs to UniStdExtras
https://bugs.webkit.org/show_bug.cgi?id=181415
Reviewed by Alex Christensen.
* wtf/UniStdExtras.h:
2018-01-07 Mark Lam <mark.lam@apple.com>
Apply poisoning to more pointers in JSC.
https://bugs.webkit.org/show_bug.cgi?id=181096
<rdar://problem/36182970>
Reviewed by JF Bastien.
Added support for PoisonedBag and PoisonedRefCountedArray.
* wtf/Bag.h:
(WTF::Private::BagNode::BagNode):
(WTF::Bag::Bag):
(WTF::Bag::operator=):
(WTF::Bag::clear):
(WTF::Bag::add):
(WTF::Bag::begin):
(WTF::Bag::unwrappedHead):
(WTF::Bag::Node::Node): Deleted.
* wtf/BagToHashMap.h:
(WTF::toHashMap):
* wtf/Poisoned.h:
(WTF::constExprPoisonRandom):
(WTF::makeConstExprPoison):
* wtf/RefCountedArray.h:
(WTF::RefCountedArray::RefCountedArray):
(WTF::RefCountedArray::clone const):
(WTF::RefCountedArray::operator=):
(WTF::RefCountedArray::~RefCountedArray):
(WTF::RefCountedArray::refCount const):
(WTF::RefCountedArray::size const):
(WTF::RefCountedArray::data):
(WTF::RefCountedArray::begin):
(WTF::RefCountedArray::end):
(WTF::RefCountedArray::data const):
(WTF::RefCountedArray::begin const):
(WTF::RefCountedArray::operator== const):
(WTF::RefCountedArray::Header::fromPayload):
* wtf/WTFAssertions.cpp:
2018-01-05 JF Bastien <jfbastien@apple.com>
WebAssembly: poison JS object's secrets
https://bugs.webkit.org/show_bug.cgi?id=181339
<rdar://problem/36325001>
Reviewed by Mark Lam.
swapping a poisoned pointer with a non-poisoned one (as is done in
JSWebAssembyMemory::adopt) was missing.
* wtf/Poisoned.h:
(WTF::PoisonedImpl::swap):
(WTF::ConstExprPoisonedPtrTraits::swap):
2018-01-05 David Kilzer <ddkilzer@apple.com>
Re-enable -Wcast-qual in WebCore for Apple ports
<https://webkit.org/b/177895>
<rdar://problem/34960830>
Reviewed by Joseph Pecoraro.
* wtf/RetainPtr.h:
(WTF::RetainPtr::fromStorageTypeHelper const): Add const_cast<>
operator here since some CFTypes are not defined as const
pointers, which triggers a warning in C++ source with
-Wcast-qual when casting from CFTypeRef back to the original
type. Note that we use const_cast<CF_BRIDGED_TYPE(id) void*>()
here (and in TypeCastsCF.h below) since this is what CFTypeRef
is defined as in CFBase.h, but without the 'const' modifier.
(WTF::RetainPtr::fromStorageType const): Ditto.
* wtf/cf/TypeCastsCF.h: Use #pragma once.
(WTF_DECLARE_CF_TYPE_TRAIT): Rename from DECLARE_CF_TYPE_TRAIT.
Don't #undef it so that it can be used in other source files.
(WTF_DECLARE_CF_MUTABLE_TYPE_TRAIT): Add new macro that is used
for declaring CFMutable types. The CFTypeID for CF_Foo_ and
CFMutable_Foo_ are the same, so we have to use a different macro
to declare type traits for those types.
(WTF::dynamic_cf_cast): Add assertion to catch issues in Debug
builds.
(WTF::checked_cf_cast): Inline code from WTF::dynamic_cf_cast
and change behavior to be more consistent between Debug and
Release builds, as well as other "checked" functions.
Previously this function would return nullptr in Release builds
if nullptr or the wrong type of object was passed in, but crash
in both cases on Debug builds. The new behavior always returns
nullptr if nullptr was passed in (but never crashes), and always
crashes if the wrong type of object is passed in.
2018-01-04 Keith Miller <keith_miller@apple.com>
TypedArrays and Wasm should use index masking.
https://bugs.webkit.org/show_bug.cgi?id=181313
Reviewed by Michael Saboff.
* wtf/MathExtras.h:
(WTF::computeIndexingMask):
2018-01-03 Michael Saboff <msaboff@apple.com>
Disable SharedArrayBuffers from Web API
https://bugs.webkit.org/show_bug.cgi?id=181266
Reviewed by Saam Barati.
Turn off SharedArrayBuffers using a compile time flag ENABLE_SHARED_ARRAY_BUFFER.
* wtf/Platform.h:
2017-12-28 Yusuke Suzuki <utatane.tea@gmail.com>
Remove std::chrono completely
https://bugs.webkit.org/show_bug.cgi?id=181186
Reviewed by Alex Christensen.
std::chrono's overflow unaware design is dangerous[1]. Even small code like
`condition.wait_for(std::chrono::seconds::max())` is broken in some platforms
due to overflow of std::chrono::time_point. So we intentionally avoid using
std::chrono, and use WallTime, MonotonicTime, Seconds instead.
This patch removes all the remaining use of std::chrono from WebKit tree.
[1]: https://lists.webkit.org/pipermail/webkit-dev/2016-May/028242.html
* wtf/CrossThreadCopier.h:
Remove std::chrono support from cross thread copiers.
* wtf/Forward.h:
* wtf/MonotonicTime.h:
(WTF::MonotonicTime::isolatedCopy const):
Add isolatedCopy function.
* wtf/RunLoop.h:
(WTF::RunLoop::TimerBase::startRepeating):
(WTF::RunLoop::TimerBase::startOneShot):
Just remove these helpers.
* wtf/Seconds.h:
(WTF::Seconds::isolatedCopy const):
Add isolatedCopy function.
* wtf/WallTime.h:
(WTF::WallTime::isolatedCopy const):
Add isolatedCopy function.
* wtf/persistence/PersistentCoders.h:
(WTF::Persistence::Coder<Seconds>::encode):
(WTF::Persistence::Coder<Seconds>::decode):
(WTF::Persistence::Coder<WallTime>::encode):
(WTF::Persistence::Coder<WallTime>::decode):
Add persistent coder support for Seconds and WallTime.
(WTF::Persistence::Coder<std::chrono::system_clock::time_point>::encode): Deleted.
(WTF::Persistence::Coder<std::chrono::system_clock::time_point>::decode): Deleted.
Remove std::chrono support from persistent coders.
2018-01-02 Mark Lam <mark.lam@apple.com>
Refactoring: Rename DummyClass to DummyStruct because it's a struct.
https://bugs.webkit.org/show_bug.cgi?id=181230
Reviewed by JF Bastien.
* wtf/WTFAssertions.cpp:
2018-01-02 Mark Lam <mark.lam@apple.com>
Ensure that poisoned pointers do not look like double or int32 JSValues.
https://bugs.webkit.org/show_bug.cgi?id=181221
<rdar://problem/36248638>
Reviewed by JF Bastien.
Changed poison values to ensure that poisoned bits (i.e. pointer ^ poison)
satisfies the following conditions:
1. bits 48-63 are 0: this ensures that poisoned bits look like a pointer and
not a double or int32 JSValue.
2. bits 32-47 are not completely 0.
3. bit 2 is never 0: this ensures that the poisoned value of a non-null pointer
will never be null.
4. bit 0-1 is always 0: this ensures that clients can still use the 2 bottom
bits of the poisoned value as flag bits (just like they were able to do with
pointer values). The only difference is that bit 2 can no longer be used for
flag bits because poisoned values need it to always be set.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/PointerAsserts.cpp: Removed.
* wtf/Poisoned.cpp:
(WTF::makePoison):
- Updated to satisfy the above requirements.
* wtf/Poisoned.h:
(WTF::makeConstExprPoison):
(WTF::makePoison): Deleted.
* wtf/WTFAssertions.cpp: Copied from Source/WTF/wtf/PointerAsserts.cpp.
- Renamed from PointerAsserts.cpp because we assert more things than just
pointers here.
- Added some assertions to test makeConstExprPoison() to ensure that it satisfies
the above requirements.
2017-12-28 Yusuke Suzuki <utatane.tea@gmail.com>
Remove std::chrono if it is not used for ArgumentCoder or PersistentCoder
https://bugs.webkit.org/show_bug.cgi?id=181174
Reviewed by Konstantin Tokarev.
Make WallTime more constexpr friendly. This change is already applied to MonoTonicTime.
We would like to move std::{isfinite,isinf,isnan} overloadings from std:: to each class scope in a separate patch[1].
[1]: https://bugs.webkit.org/show_bug.cgi?id=181183
* wtf/WallTime.h:
(WTF::WallTime::WallTime):
(WTF::WallTime::fromRawSeconds):
(WTF::WallTime::infinity):
(WTF::WallTime::secondsSinceEpoch const):
(WTF::WallTime::operator bool const):
(WTF::WallTime::operator+ const):
(WTF::WallTime::operator- const):
(WTF::WallTime::operator== const):
(WTF::WallTime::operator!= const):
(WTF::WallTime::operator< const):
(WTF::WallTime::operator> const):
(WTF::WallTime::operator<= const):
(WTF::WallTime::operator>= const):
2017-12-28 Fujii Hironori <Hironori.Fujii@sony.com>
[Win][CMake] Use add_custom_command to copy each forwarding header files
https://bugs.webkit.org/show_bug.cgi?id=180921
Reviewed by Brent Fulgham.
* wtf/PlatformWin.cmake: Use WEBKIT_MAKE_FORWARDING_HEADERS.
2017-12-27 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Add clock_gettime based monotonicallyIncreasingTime implementation for Linux and BSDs
https://bugs.webkit.org/show_bug.cgi?id=181175
Reviewed by Michael Catanzaro.
Use platform-provided POSIX APIs to get monotonic time.
* wtf/CurrentTime.cpp:
(WTF::monotonicallyIncreasingTime):
2017-12-26 Carlos Alberto Lopez Perez <clopez@igalia.com>
REGRESSION(r225769): Build error with constexpr std::max // std::min in libdstdc++4
https://bugs.webkit.org/show_bug.cgi?id=181160
Reviewed by Myles C. Maxfield.
In libstdc++-4 std::max and std::min are not annotated with constexpr.
This patch adds a WTF::min and WTF::max for using where a constexpr result is expected.
Related: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60271
* wtf/StdLibExtras.h:
(WTF::min):
(WTF::max):
2017-12-26 Yusuke Suzuki <utatane.tea@gmail.com>
[JSC] Remove std::chrono completely
https://bugs.webkit.org/show_bug.cgi?id=181165
Reviewed by Konstantin Tokarev.
WTF::currentCPUTime now returns WTF::Seconds.
We also add the implementaiton for Linux and FreeBSD.
* wtf/CurrentTime.cpp:
(WTF::currentCPUTime):
* wtf/CurrentTime.h:
2017-12-22 Wenson Hsieh <wenson_hsieh@apple.com>
Unreviewed, try to fix the Sierra build after r226277.
The macOS 10.12 SDK does not know about NSControlStateValue and some types of NSLevelIndicatorStyles, so these
need to be declared in a separate section in AppKitCompatibilityDeclarations.h (rather than in the < macOS 10.12
SDK #ifdef).
* wtf/mac/AppKitCompatibilityDeclarations.h:
2017-12-22 Wenson Hsieh <wenson_hsieh@apple.com>
Fix build failures due to using deprecated AppKit symbols
https://bugs.webkit.org/show_bug.cgi?id=181110
<rdar://problem/36162865>
Reviewed by Dan Bernstein and Tim Horton.
When building with older macOS SDKs where some AppKit constants don't exist, define the modern constants to be
equal to their deprecated counterparts. This allows us to just have the modern types in WebKit sources while
avoiding breakage on old SDKs.
This, along with many other symbols in the compability header, can be removed once WebKit stops supporting macOS
10.11.
* wtf/mac/AppKitCompatibilityDeclarations.h:
2017-12-21 Mark Lam <mark.lam@apple.com>
Add WTF::PoisonedUniquePtr to replace std::unique_ptr when poisoning is desired.
https://bugs.webkit.org/show_bug.cgi?id=181062
<rdar://problem/36167040>
Reviewed by Chris Dumez.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/PointerAsserts.cpp: Copied from Source/WTF/wtf/RefPtr.cpp.
- renamed file because we asserts all kinds of pointers in here, not just RefPtr.
* wtf/Poisoned.h:
- added a missing #include.
- make constexpr poison values more scrambled.
(WTF::makePoison):
* wtf/PoisonedUniquePtr.h: Added.
(WTF::PoisonedUniquePtr::PoisonedUniquePtr):
(WTF::PoisonedUniquePtr::~PoisonedUniquePtr):
(WTF::PoisonedUniquePtr::create):
(WTF::PoisonedUniquePtr::operator=):
(WTF::PoisonedUniquePtr::get const):
(WTF::PoisonedUniquePtr::operator[] const):
(WTF::PoisonedUniquePtr::clear):
(WTF::PoisonedUniquePtr::destroy):
(WTF::PoisonedUniquePtr::clearWithoutDestroy):
(WTF::makePoisonedUnique):
* wtf/RefPtr.cpp: Removed.
2017-12-21 Jeremy Jones <jeremyj@apple.com>
Element fullscreen interface should display the location
https://bugs.webkit.org/show_bug.cgi?id=181006
rdar://problem/36143176
Reviewed by Simon Fraser.
Add SecTrustCopyInfo SPI.
* wtf/spi/cocoa/SecuritySPI.h:
2017-12-20 Fujii Hironori <Hironori.Fujii@sony.com>
[CMake][WTF] Lowercase ForwardingHeaders directory name of WTF
https://bugs.webkit.org/show_bug.cgi?id=181022
Reviewed by Konstantin Tokarev.
* wtf/CMakeLists.txt: Renamed ForwardingHeaders directory name WTF to wtf.
* wtf/PlatformWin.cmake: Ditto.
2017-12-19 Brian Burg <bburg@apple.com>
SLEEP_THREAD_FOR_DEBUGGER() macro should try to print out the PID of the affected process
https://bugs.webkit.org/show_bug.cgi?id=180947
Reviewed by Joseph Pecoraro.
* wtf/DebugUtilities.h:
- Use sleep() from CurrentTime.h as it is more cross-platform.
- Print a message with the process PID to simplify attaching to sleeping thread.
- Include source location in case multiple such macros are being used.
2017-12-18 Daniel Bates <dabates@apple.com>
Conditionally forward declare NSMapTable SPI
https://bugs.webkit.org/show_bug.cgi?id=180936
<rdar://problem/35037796>
Reviewed by Dan Bernstein.
* wtf/spi/cocoa/NSMapTableSPI.h:
2017-12-16 Filip Pizlo <fpizlo@apple.com>
Vector index masking
https://bugs.webkit.org/show_bug.cgi?id=180909
Reviewed by Keith Miller.
Adds index masking to StringImpl and Vector.
Perf:
- 0.4% slower on microbenchmarks.
- Octane totally even.
- Kraken may be 0.8% slower.
- Speedometer is 0.8% slower with p = 0.008.
- membuster is even:
- snap2pre: 0.7% bigger w/ p = 0.26,
- snap2post: 0.3% smaller w/ p = 0.81,
- snap3pre: 1.2% bigger w/ p = 0.63,
- snap3post: 0.4% smaller w/ p = 0.76.
* wtf/MathExtras.h:
(WTF::roundUpToPowerOfTwo):
(WTF::maskForSize):
* wtf/SizeLimits.cpp:
* wtf/Vector.h:
(WTF::VectorBufferBase::allocateBuffer):
(WTF::VectorBufferBase::tryAllocateBuffer):
(WTF::VectorBufferBase::reallocateBuffer):
(WTF::VectorBufferBase::deallocateBuffer):
(WTF::VectorBufferBase::releaseBuffer):
(WTF::VectorBufferBase::VectorBufferBase):
(WTF::VectorBufferBase::updateMask):
(WTF::VectorBuffer::allocateBuffer):
(WTF::VectorBuffer::tryAllocateBuffer):
(WTF::VectorBuffer::swap):
(WTF::VectorBuffer::restoreInlineBufferIfNeeded):
(WTF::Vector::at):
(WTF::Vector::at const):
* wtf/text/StringImpl.h:
(WTF::StringImpl::maskOffset):
(WTF::StringImpl::mask const):
(WTF::StringImplShape::StringImplShape):
(WTF::StringImpl::at const):
(WTF::StringImpl::tailOffset):
* wtf/text/StringView.h:
(WTF::StringView::StringView):
(WTF::StringView::operator=):
(WTF::StringView::initialize):
(WTF::StringView::clear):
(WTF::StringView::operator[] const):
* wtf/text/WTFString.h:
(WTF::String::mask const):
2017-12-18 Claudio Saavedra <csaavedra@igalia.com>
[GTK][Darwin] Do not define mach exceptions for GTK+
Rubber-stamped by Michael Catanzaro.
* wtf/Platform.h:
2017-12-17 Yusuke Suzuki <utatane.tea@gmail.com>
[FTL] NewArrayBuffer should be sinked if it is only used for spreading
https://bugs.webkit.org/show_bug.cgi?id=179762
Reviewed by Saam Barati.
We add RecursableLambda<>. This can take a lambda and offer a way
to call this lambda recursively without introducing additional allocations.
C++ lambda is super useful in particular when we need to capture many
variables as references. Passing many arguments to a usual function is not
a good way. But C++ lambda does not allow us to easily call itself recursively.
Our recursableLambda offers `self` function as a first argument of the
given lambda. We can call this `self` recursively.
auto targetFunction = recursableLambda([] (auto self, ...) -> resultType {
self(...);
});
While `std::function<> func = [&func] { ... }` allows recursion, it causes
heap allocation for std::function<>. `auto func = [&func] { ... }` causes
a compile error since we need to deduce an actual type when capturing `func`.
* WTF.xcodeproj/project.pbxproj:
* wtf/RecursableLambda.h: Added.
(WTF::RecursableLambda::RecursableLambda):
(WTF::RecursableLambda::operator() const):
(WTF::recursableLambda):
2017-12-17 Mark Lam <mark.lam@apple.com>
Enhance Ref and RefPtr to be able to work with smart pointers.
https://bugs.webkit.org/show_bug.cgi?id=180762
<rdar://problem/36027122>
Reviewed by JF Bastien and Darin Adler.
This is so we can use them with ConstExprPoisoned pointers to make PoisonedRef
and PoisonedRefPtr.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/DumbPtrTraits.h: Added.
(WTF::DumbPtrTraits::exchange):
(WTF::DumbPtrTraits::swap):
(WTF::DumbPtrTraits::unwrap):
* wtf/Forward.h:
* wtf/Poisoned.h:
(WTF::ConstExprPoisonedPtrTraits::exchange):
(WTF::ConstExprPoisonedPtrTraits::swap):
(WTF::ConstExprPoisonedPtrTraits::unwrap):
* wtf/Ref.h:
(WTF::Ref::~Ref):
(WTF::Ref::Ref):
(WTF::Ref::ptrAllowingHashTableEmptyValue const):
(WTF::Ref::ptrAllowingHashTableEmptyValue):
(WTF::Ref::operator-> const):
(WTF::Ref::get const):
(WTF::Ref::operator T& const):
(WTF::=):
(WTF::U>::swap):
(WTF::swap):
(WTF::U>::replace):
(WTF::static_reference_cast):
(WTF::adoptRef):
(WTF::is):
(WTF::Ref<T>::swap): Deleted.
(WTF::Ref<T>::replace): Deleted.
(WTF::GetPtrHelper<Ref<T>>::getPtr): Deleted.
* wtf/RefPtr.cpp: Added.
* wtf/RefPtr.h:
(WTF::RefPtr::RefPtr):
(WTF::RefPtr::~RefPtr):
(WTF::RefPtr::get const):
(WTF::RefPtr::operator* const):
(WTF::RefPtr::operator-> const):
(WTF::U>::RefPtr):
(WTF::U>::leakRef):
(WTF::=):
(WTF::U>::swap):
(WTF::swap):
(WTF::operator==):
(WTF::operator!=):
(WTF::static_pointer_cast):
(WTF::adoptRef):
(WTF::is):
(WTF::RefPtr<T>::RefPtr): Deleted.
(WTF::RefPtr<T>::leakRef): Deleted.
(WTF::RefPtr<T>::swap): Deleted.
2017-12-16 Yusuke Suzuki <utatane.tea@gmail.com>
Remove unnecessary boolean result of start() functions
https://bugs.webkit.org/show_bug.cgi?id=180856
Reviewed by Darin Adler.
CrossThreadTaskHandler's Thread is just released without calling
either `waitForCompletion` or `detach`. It means that this resource
of the thread is not released.
* benchmarks/ConditionSpeedTest.cpp:
* wtf/CrossThreadTaskHandler.cpp:
(WTF::CrossThreadTaskHandler::CrossThreadTaskHandler):
* wtf/CrossThreadTaskHandler.h:
2017-12-14 David Kilzer <ddkilzer@apple.com>
Enable -Wstrict-prototypes for WebKit
<https://webkit.org/b/180757>
<rdar://problem/36024132>
Rubber-stamped by Joseph Pecoraro.
* Configurations/Base.xcconfig:
(CLANG_WARN_STRICT_PROTOTYPES): Add. Set to YES.
* wtf/Assertions.h:
(WTFReportBacktrace): Add 'void' to C function declaration.
(WTFCrashHookFunction): Add 'void' to C function pointer declaration.
(WTFInstallReportBacktraceOnCrashHook): Add 'void' to C function declaration.
(WTFIsDebuggerAttached): Ditto.
(WTFCrash): Ditto.
(WTFCrashWithSecurityImplication): Ditto.
2017-12-14 Yusuke Suzuki <utatane.tea@gmail.com>
Drop Thread::tryCreate
https://bugs.webkit.org/show_bug.cgi?id=180808
Reviewed by Darin Adler.
We remove Thread::tryCreate. When thread creation fails, we have no way to keep WebKit working.
Compared to tryMalloc, Thread::create always consumes fixed size of resource. If it fails,
this is not due to arbitrary large user request. It is not reasonable that some thread creations
are handled gracefully while the other thread creations are not.
If we would like to have the limit of number of users' thread creation (like, calling `new Worker`
so many times), we should have a soft limit instead of relying on system's hard limit.
* wtf/ParallelJobsGeneric.cpp:
(WTF::ParallelEnvironment::ThreadPrivate::tryLockFor):
* wtf/Threading.cpp:
(WTF::Thread::create):
(WTF::Thread::tryCreate): Deleted.
* wtf/Threading.h:
(WTF::Thread::create): Deleted.
2017-12-13 Keith Miller <keith_miller@apple.com>
JSObjects should have a mask for loading indexed properties
https://bugs.webkit.org/show_bug.cgi?id=180768
Reviewed by Mark Lam.
Add a clz that wraps the builtin clz intrinisics provided by
various compilers. The clz function by default assumes that
the input may be zero. On X86 this makes a difference because not
all CPUs have LZCNT and BSR has undefined behavior on zero. On ARM,
the zero check gets optimized away, regardless.
* wtf/StdLibExtras.h:
(std::clz):
2017-12-12 Yusuke Suzuki <utatane.tea@gmail.com>
REGRESSION(r225769): Build errors with constexpr std::tie on older gcc
https://bugs.webkit.org/show_bug.cgi?id=180692
Reviewed by Carlos Garcia Campos.
Due to libstdc++'s bug[1], std::tie is not annotated with constexpr in libstdc++ 5.
This patch adds WTF::tie for a work around. Since we do not want to
include <tuple> in StdLibExtras.h, we define this function for all
the compilers.
[1]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65978
* wtf/StdLibExtras.h:
2017-12-13 Mark Lam <mark.lam@apple.com>
Fill out some Poisoned APIs, fix some bugs, and add some tests.
https://bugs.webkit.org/show_bug.cgi?id=180724
<rdar://problem/36006884>
Reviewed by JF Bastien.
Also rename Int32Poisoned to ConstExprPoisoned. The key it takes is actually a
uint32_t. So, Int32 is really a misnomer. In addition, the key needs to be a
constexpr. So, ConstExprPoisoned is a better name for it.
* wtf/Poisoned.cpp:
(WTF::makePoison):
* wtf/Poisoned.h:
(WTF::PoisonedImplHelper::asReference):
(WTF::PoisonedImpl::PoisonedImpl):
(WTF::PoisonedImpl::clear):
(WTF::PoisonedImpl::operator* const):
(WTF::PoisonedImpl::operator-> const):
(WTF::PoisonedImpl::operator== const):
(WTF::PoisonedImpl::operator!= const):
(WTF::PoisonedImpl::operator< const):
(WTF::PoisonedImpl::operator<= const):
(WTF::PoisonedImpl::operator> const):
(WTF::PoisonedImpl::operator>= const):
(WTF::PoisonedImpl::operator=):
(WTF::PoisonedImpl::swap):
(WTF::PoisonedImpl::exchange):
(WTF::swap):
(WTF::makePoison):
(WTF::PoisonedImpl::operator==): Deleted.
2017-12-12 Yusuke Suzuki <utatane.tea@gmail.com>
[JSC] Implement optimized WeakMap and WeakSet
https://bugs.webkit.org/show_bug.cgi?id=179929
Reviewed by Saam Barati.
We introduce JSValueMalloc, which is specialized malloc scheme with Gigacage::JSValue.
This is used for WeakMapImpl's buffer.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/JSValueMalloc.cpp: Added.
(WTF::tryJSValueMalloc):
(WTF::jsValueMalloc):
(WTF::jsValueRealloc):
(WTF::jsValueFree):
* wtf/JSValueMalloc.h: Added.
(WTF::JSValueMalloc::malloc):
(WTF::JSValueMalloc::tryMalloc):
(WTF::JSValueMalloc::realloc):
(WTF::JSValueMalloc::free):
* wtf/MallocPtr.h:
(WTF::MallocPtr::~MallocPtr):
(WTF::MallocPtr::malloc):
(WTF::MallocPtr::tryMalloc):
(WTF::MallocPtr::realloc):
We extend MallocPtr to adopt malloc scheme as its template parameter.
2017-12-11 Filip Pizlo <fpizlo@apple.com>
It should be possible to flag a cell for unconditional finalization
https://bugs.webkit.org/show_bug.cgi?id=180636
Reviewed by Saam Barati.
This adds ConcurrentVector, which is like SegmentedVector, but wastes some space to allow
resizing to proceed concurrently to access. It's not possible to resize concurrently to
resizing, concurrent read/writes aren't protected from racing if they access the same element,
and who knows what you'll get if you iterate up to size() while someone else append()s. The
key insight is to stash all prior copies of the spine, so that nobody crashes trying to access
a stale spine.
I'm going to want to do the same thing for FastBitVector, by creating a segmented WordOwner
class. That would require repeating the dance of having a spine that can resize while stashing
old versions. So, the spine resizing logic is abstracted behind ConcurrentBuffer. You could
use that as a kind of "concurrent vector" for immutable data. That's how ConcurrentVector uses
it: it's an immutable array of segment pointers.
* WTF.xcodeproj/project.pbxproj:
* wtf/ConcurrentBuffer.h: Added.
(WTF::ConcurrentBuffer::ConcurrentBuffer):
(WTF::ConcurrentBuffer::~ConcurrentBuffer):
(WTF::ConcurrentBuffer::growExact):
(WTF::ConcurrentBuffer::grow):
(WTF::ConcurrentBuffer::array const):
(WTF::ConcurrentBuffer::operator[]):
(WTF::ConcurrentBuffer::operator[] const):
(WTF::ConcurrentBuffer::createArray):
* wtf/ConcurrentVector.h: Added.
(WTF::ConcurrentVectorIterator::~ConcurrentVectorIterator):
(WTF::ConcurrentVectorIterator::operator* const):
(WTF::ConcurrentVectorIterator::operator-> const):
(WTF::ConcurrentVectorIterator::operator++):
(WTF::ConcurrentVectorIterator::operator== const):
(WTF::ConcurrentVectorIterator::operator!= const):
(WTF::ConcurrentVectorIterator::operator=):
(WTF::ConcurrentVectorIterator::ConcurrentVectorIterator):
(WTF::ConcurrentVector::~ConcurrentVector):
(WTF::ConcurrentVector::size const):
(WTF::ConcurrentVector::isEmpty const):
(WTF::ConcurrentVector::at):
(WTF::ConcurrentVector::at const):
(WTF::ConcurrentVector::operator[]):
(WTF::ConcurrentVector::operator[] const):
(WTF::ConcurrentVector::first):
(WTF::ConcurrentVector::first const):
(WTF::ConcurrentVector::last):
(WTF::ConcurrentVector::last const):
(WTF::ConcurrentVector::takeLast):
(WTF::ConcurrentVector::append):
(WTF::ConcurrentVector::alloc):
(WTF::ConcurrentVector::removeLast):
(WTF::ConcurrentVector::grow):
(WTF::ConcurrentVector::begin):
(WTF::ConcurrentVector::end):
(WTF::ConcurrentVector::segmentExistsFor):
(WTF::ConcurrentVector::segmentFor):
(WTF::ConcurrentVector::subscriptFor):
(WTF::ConcurrentVector::ensureSegmentsFor):
(WTF::ConcurrentVector::ensureSegment):
(WTF::ConcurrentVector::allocateSegment):
2017-12-12 JF Bastien <jfbastien@apple.com>
makeString: support more integral types
https://bugs.webkit.org/show_bug.cgi?id=180720
Reviewed by Sam Weinig.
Only some integral types worked. Add more types by using template
magic. While we're here, also use the same magic for
floating-point types in the theoretical future where short float
or long double matter.
The core of the magic is a second, defaulted, template
parameter. It's declared in Forward.h (as void), and then in
classes where we want to enable_if we use it (in C++ speak we
create a partial class template specialization), otherwise we
leave it as void.
Also clean up some constructors which were being way too verbose
in stating that they were declarations for this template
specialization right here, when really we already knew that.
* wtf/Forward.h:
* wtf/text/StringConcatenate.h:
(WTF::StringTypeAdapter<char>::StringTypeAdapter<char>): Deleted.
(WTF::StringTypeAdapter<char>::length): Deleted.
(WTF::StringTypeAdapter<char>::is8Bit): Deleted.
(WTF::StringTypeAdapter<char>::writeTo const): Deleted.
(WTF::StringTypeAdapter<char>::toString const): Deleted.
(WTF::StringTypeAdapter<UChar>::StringTypeAdapter<UChar>): Deleted.
(WTF::StringTypeAdapter<UChar>::length const): Deleted.
(WTF::StringTypeAdapter<UChar>::is8Bit const): Deleted.
(WTF::StringTypeAdapter<UChar>::writeTo const): Deleted.
(WTF::StringTypeAdapter<UChar>::toString const): Deleted.
(WTF::StringTypeAdapter<char::StringTypeAdapter): Deleted.
(WTF::StringTypeAdapter<ASCIILiteral>::StringTypeAdapter): Deleted.
(WTF::StringTypeAdapter<Vector<char>>::StringTypeAdapter): Deleted.
(WTF::StringTypeAdapter<Vector<char>>::length const): Deleted.
(WTF::StringTypeAdapter<Vector<char>>::is8Bit const): Deleted.
(WTF::StringTypeAdapter<Vector<char>>::writeTo const): Deleted.
(WTF::StringTypeAdapter<Vector<char>>::toString const): Deleted.
(WTF::StringTypeAdapter<String>::StringTypeAdapter<String>): Deleted.
(WTF::StringTypeAdapter<String>::length const): Deleted.
(WTF::StringTypeAdapter<String>::is8Bit const): Deleted.
(WTF::StringTypeAdapter<String>::writeTo const): Deleted.
(WTF::StringTypeAdapter<String>::toString const): Deleted.
(WTF::StringTypeAdapter<AtomicString>::StringTypeAdapter): Deleted.
* wtf/text/StringConcatenateNumbers.h:
(WTF::StringTypeAdapter<FormattedNumber>::StringTypeAdapter):
(WTF::StringTypeAdapter<int>::StringTypeAdapter<int>): Deleted.
(WTF::StringTypeAdapter<int>::length const): Deleted.
(WTF::StringTypeAdapter<int>::is8Bit const): Deleted.
(WTF::StringTypeAdapter<int>::writeTo const): Deleted.
(WTF::StringTypeAdapter<int>::toString const): Deleted.
(WTF::StringTypeAdapter<unsigned>::StringTypeAdapter<unsigned>): Deleted.
(WTF::StringTypeAdapter<unsigned>::length const): Deleted.
(WTF::StringTypeAdapter<unsigned>::is8Bit const): Deleted.
(WTF::StringTypeAdapter<unsigned>::writeTo const): Deleted.
(WTF::StringTypeAdapter<unsigned>::toString const): Deleted.
(WTF::StringTypeAdapter<double>::StringTypeAdapter<double>): Deleted.
(WTF::StringTypeAdapter<double>::length const): Deleted.
(WTF::StringTypeAdapter<double>::is8Bit const): Deleted.
(WTF::StringTypeAdapter<double>::writeTo const): Deleted.
(WTF::StringTypeAdapter<double>::toString const): Deleted.
(WTF::StringTypeAdapter<float>::StringTypeAdapter<float>): Deleted.
(WTF::StringTypeAdapter<FormattedNumber>::StringTypeAdapter<FormattedNumber>): Deleted.
* wtf/text/StringView.h:
(WTF::StringTypeAdapter<StringView>::StringTypeAdapter<StringView>): Deleted.
(WTF::StringTypeAdapter<StringView>::length): Deleted.
(WTF::StringTypeAdapter<StringView>::is8Bit): Deleted.
(WTF::StringTypeAdapter<StringView>::writeTo): Deleted.
(WTF::StringTypeAdapter<StringView>::toString const): Deleted.
2017-12-12 Caio Lima <ticaiolima@gmail.com>
[ESNext][BigInt] Implement BigInt literals and JSBigInt
https://bugs.webkit.org/show_bug.cgi?id=179000
Reviewed by Darin Adler and Yusuke Suzuki.
* wtf/HashFunctions.h:
2017-12-12 Joseph Pecoraro <pecoraro@apple.com>
Symbol not found: __ZN3WTF8LockBase10unlockSlowEv
https://bugs.webkit.org/show_bug.cgi?id=180691
Reviewed by Yusuke Suzuki.
* wtf/mac/DeprecatedSymbolsUsedBySafari.mm:
(WTF::LockBase::lockSlow):
(WTF::LockBase::unlockSlow):
Add back LockBase Symbols used by System Safari on 10.13.
2017-12-12 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Thread::create should have Thread::tryCreate
https://bugs.webkit.org/show_bug.cgi?id=180333
Reviewed by Darin Adler.
Many callers of Thread::create assume that it returns non-nullptr Thread.
But if the number of threads hits the limit in the system, creating Thread
would fail. In that case, it is really difficult to keep WebKit working.
We introduce Thread::tryCreate, and change the returned value from Thread::create
from RefPtr<Thread> to Ref<Thread>. In Thread::create, we ensure thread creation
succeeds by RELEASE_ASSERT. And we use Thread::create intentionally if the
caller assumes that thread should be created.
* wtf/AutomaticThread.cpp:
(WTF::AutomaticThread::start):
* wtf/ParallelJobsGeneric.cpp:
(WTF::ParallelEnvironment::ThreadPrivate::tryLockFor):
* wtf/Threading.cpp:
(WTF::Thread::tryCreate):
(WTF::Thread::create): Deleted.
* wtf/Threading.h:
(WTF::Thread::create):
* wtf/WorkQueue.cpp:
(WTF::WorkQueue::concurrentApply):
2017-12-11 Eric Carlson <eric.carlson@apple.com>
Web Inspector: Optionally log WebKit log parameters as JSON
https://bugs.webkit.org/show_bug.cgi?id=180529
<rdar://problem/35909462>
Reviewed by Joseph Pecoraro.
* wtf/Logger.h:
(WTF::Logger::log):
(WTF::LogArgument<Logger::LogSiteIdentifier>::toString):
* wtf/MediaTime.cpp:
(WTF::MediaTime::toJSONString const): Serialize to JSON string.
* wtf/MediaTime.h:
2017-12-11 Tim Horton <timothy_horton@apple.com>
Stop using deprecated target conditional for simulator builds
https://bugs.webkit.org/show_bug.cgi?id=180662
<rdar://problem/35136156>
Reviewed by Simon Fraser.
* wtf/Platform.h:
2017-12-11 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Add Converter traits to StringHasher instead of function pointer
https://bugs.webkit.org/show_bug.cgi?id=180656
Reviewed by JF Bastien.
In the latest ICU, UChar is char16_t. So defining defaultConverter(UChar)
and defaultConverter(char16_t) causes duplicate definitions.
Instead of passing a funtion pointer, we pass a trait class DefaultConveter
which has `convert` static function. And we make this `convert` function
generic. This avoids defining convert function for UChar and char16_t.
* wtf/text/StringHash.h:
(WTF::ASCIICaseInsensitiveHash::FoldCase::convert):
(WTF::ASCIICaseInsensitiveHash::hash):
(WTF::ASCIICaseInsensitiveHash::foldCase): Deleted.
* wtf/text/StringHasher.h:
(WTF::StringHasher::DefaultConverter::convert):
(WTF::StringHasher::addCharactersAssumingAligned):
(WTF::StringHasher::addCharacters):
(WTF::StringHasher::computeHashAndMaskTop8Bits):
(WTF::StringHasher::computeHash):
(WTF::StringHasher::computeLiteralHash):
(WTF::StringHasher::computeLiteralHashAndMaskTop8Bits):
(WTF::StringHasher::computeHashImpl):
(WTF::StringHasher::Converter): Deleted.
(WTF::StringHasher::defaultConverter): Deleted.
2017-12-10 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Reduce sizeof(Thread) by adjusting alignment
https://bugs.webkit.org/show_bug.cgi?id=180630
Reviewed by Saam Barati.
Reduce sizeof(Thread) slightly by adjusting alignment.
* wtf/Threading.h:
2017-12-10 Yusuke Suzuki <utatane.tea@gmail.com>
Unreviewed, follow-up patch after r225726
https://bugs.webkit.org/show_bug.cgi?id=180622
Suggested by Darin. We should take care of signed-extension of `char`.
* wtf/text/StringHasher.h:
(WTF::StringHasher::defaultConverter):
2017-12-09 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Remove RELAXED_CONSTEXPR
https://bugs.webkit.org/show_bug.cgi?id=180624
Reviewed by JF Bastien.
All of our required compilers support relaxed constexpr in C++14.
We can drop RELAXED_CONSTEXPR macro in our tree.
* wtf/Compiler.h:
* wtf/Expected.h:
(std::experimental::fundamentals_v3::expected::operator*):
(std::experimental::fundamentals_v3::expected::value):
(std::experimental::fundamentals_v3::expected::error):
* wtf/Unexpected.h:
(std::experimental::fundamentals_v3::unexpected::value):
(std::experimental::fundamentals_v3::unexpected::value const):
2017-12-09 Yusuke Suzuki <utatane.tea@gmail.com>
Fix WTF::Hasher tuple expansion with variadic args
https://bugs.webkit.org/show_bug.cgi?id=180623
Reviewed by JF Bastien.
We expand a tuple with `...`, and use this in a function's argument list.
And in this argument list, we call `add()` for each value. This will be
expanded as follows.
[] (...) { }((add(hasher, std::get<i>(values)), 0)...);
will become,
[] (...) { }((add(hasher, std::get<0>(values)), 0), (add(hasher, std::get<1>(values)), 0), ...);
However, the evaluation order of the C++ argument is unspecified. Actually,
in GCC environment, this `add()` is not called in our expected order. As a
result, currently we have test failures in TestWTF.
This patch just uses variadic templates to expand tuples, and call add() in
our expected order. This patch fixes an existing failure of TestWTF in GCC environment.
* wtf/Hasher.h:
(WTF::Hasher::computeHash):
(WTF::addArgs):
(WTF::addTupleHelper):
(WTF::add):
2017-12-09 Yusuke Suzuki <utatane.tea@gmail.com>
Use relaxed constexpr for StringHasher
https://bugs.webkit.org/show_bug.cgi?id=180622
Reviewed by JF Bastien.
Now VC++ is updated and all the WebKit compilers support C++14 relaxed constexpr.
This patch uses relaxed constexpr for StringHasher constexpr implementation
* wtf/text/StringHasher.h:
(WTF::StringHasher::addCharactersAssumingAligned):
(WTF::StringHasher::Converter):
(WTF::StringHasher::computeHashAndMaskTop8Bits):
(WTF::StringHasher::computeHash):
(WTF::StringHasher::computeLiteralHash):
(WTF::StringHasher::computeLiteralHashAndMaskTop8Bits):
(WTF::StringHasher::defaultConverter):
(WTF::StringHasher::avalancheBits):
(WTF::StringHasher::finalize):
(WTF::StringHasher::finalizeAndMaskTop8Bits):
(WTF::StringHasher::avoidZero):
(WTF::StringHasher::calculateWithRemainingLastCharacter):
(WTF::StringHasher::calculateWithTwoCharacters):
(WTF::StringHasher::processPendingCharacter const):
(WTF::StringHasher::StringHasher): Deleted.
(WTF::StringHasher::avalancheBits3): Deleted.
(WTF::StringHasher::avalancheBits2): Deleted.
(WTF::StringHasher::avalancheBits1): Deleted.
(WTF::StringHasher::avalancheBits0): Deleted.
(WTF::StringHasher::calculateWithRemainingLastCharacter1): Deleted.
(WTF::StringHasher::calculateWithRemainingLastCharacter0): Deleted.
(WTF::StringHasher::calculate1): Deleted.
(WTF::StringHasher::calculate0): Deleted.
(WTF::StringHasher::calculate): Deleted.
(WTF::StringHasher::computeLiteralHashImpl): Deleted.
2017-12-08 Eric Carlson <eric.carlson@apple.com>
Move Logger from PAL to WTF so it can be used outside of WebCore
https://bugs.webkit.org/show_bug.cgi?id=180561
Reviewed by Alex Christensen.
* WTF.xcodeproj/project.pbxproj:
* wtf/Logger.h: Copied from Source/WebCore/PAL/pal/Logger.h.
(PAL::LogArgument::toString): Deleted.
(PAL::Logger::create): Deleted.
(PAL::Logger::logAlways const): Deleted.
(PAL::Logger::error const): Deleted.
(PAL::Logger::warning const): Deleted.
(PAL::Logger::info const): Deleted.
(PAL::Logger::debug const): Deleted.
(PAL::Logger::willLog const): Deleted.
(PAL::Logger::enabled const): Deleted.
(PAL::Logger::setEnabled): Deleted.
(PAL::Logger::LogSiteIdentifier::LogSiteIdentifier): Deleted.
(PAL::Logger::addObserver): Deleted.
(PAL::Logger::removeObserver): Deleted.
(PAL::Logger::Logger): Deleted.
(PAL::Logger::log): Deleted.
(PAL::Logger::observers): Deleted.
(PAL::LogArgument<Logger::LogSiteIdentifier>::toString): Deleted.
* wtf/LoggerHelper.h: Copied from Source/WebCore/PAL/pal/LoggerHelper.h.
2017-12-08 Yusuke Suzuki <utatane.tea@gmail.com>
Remove pthread_once in favor of dispatch_once
https://bugs.webkit.org/show_bug.cgi?id=180591
Reviewed by Saam Barati.
Fix the comment.
* wtf/Threading.h:
(WTF::Thread::current):
2017-12-08 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF][Linux][GTK] Fix a minor bug in generic/WorkQueue when WorkQueue is immediately destroyed
https://bugs.webkit.org/show_bug.cgi?id=180586
Reviewed by Darin Adler.
If WorkQueue is created and destroyed immediately, RunLoop::stop can be called
befire calling RunLoop::run(). At that time WorkQueue thread is not stopped.
This patch dispatches a task stopping its own RunLoop to ensure stop is done.
We also clean up WorkQueue implementation not to include unnecessary fields,
lock, condition, and thread.
* wtf/WorkQueue.h:
* wtf/generic/WorkQueueGeneric.cpp:
(WorkQueue::platformInitialize):
(WorkQueue::platformInvalidate):
2017-12-08 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Remove remaining use of Mutex
https://bugs.webkit.org/show_bug.cgi?id=180579
Reviewed by Alex Christensen.
Mutex should be only used in low-level Locking and Threading.
Other ones should use WTF::Lock and WTF::Condition instead.
This patch replaces WTF::Mutex with WTF::Lock in WTF if it
is not related to threading or locking implementation.
And we also use WTF::Lock and WTF::Condition in WTF::BinarySemaphore.
* wtf/RunLoop.cpp:
(WTF::RunLoop::performWork):
(WTF::RunLoop::dispatch):
* wtf/RunLoop.h:
* wtf/WorkQueue.cpp:
* wtf/WorkQueue.h:
* wtf/threads/BinarySemaphore.cpp:
(WTF::BinarySemaphore::signal):
(WTF::BinarySemaphore::wait):
(WTF::BinarySemaphore::BinarySemaphore): Deleted.
(WTF::BinarySemaphore::~BinarySemaphore): Deleted.
* wtf/threads/BinarySemaphore.h:
* wtf/win/WorkQueueWin.cpp:
(WTF::WorkQueue::registerHandle):
(WTF::WorkQueue::unregisterAndCloseHandle):
(WTF::WorkQueue::dispatch):
(WTF::WorkQueue::timerCallback):
(WTF::WorkQueue::dispatchAfter):
(WTF::TimerContext::TimerContext): Deleted.
2017-12-08 Yusuke Suzuki <utatane.tea@gmail.com>
Use StaticLock and Lock instead of Mutex in Windows WebKitLegacy
https://bugs.webkit.org/show_bug.cgi?id=180572
Reviewed by Mark Lam.
Remove DEPRECATED_DEFINE_STATIC_LOCAL since it's no longer used.
* wtf/StdLibExtras.h:
2017-12-07 Basuke Suzuki <Basuke.Suzuki@sony.com>
[Win] [64-bit] Resolve Microsoft warning C4319 on BitVector.cpp
https://bugs.webkit.org/show_bug.cgi?id=180490
Reviewed by Alex Christensen.
bitsInPointer() returns unsigned which is smaller than size_t.
"~"(negate) operator is applied before extending its size which result filled with zero.
This may be potentially a bug if numBits is greater than max value of unsigned long
(which is not practical).
* wtf/BitVector.cpp:
(WTF::BitVector::OutOfLineBits::create):
2017-12-07 Yusuke Suzuki <utatane.tea@gmail.com>
Use WTF Locking primitives in WebThread and drop pthread_xxx use
https://bugs.webkit.org/show_bug.cgi?id=180445
Reviewed by Saam Barati.
Add initializer form to fill struct with zero if struct does not have any default initializers.
* wtf/ThreadSpecific.h:
(WTF::ThreadSpecific::Data::Data):
2017-12-07 Mark Lam <mark.lam@apple.com>
Apply poisoning to some native code pointers.
https://bugs.webkit.org/show_bug.cgi?id=180541
<rdar://problem/35916875>
Reviewed by Filip Pizlo.
Ensure that the resultant poisoned bits still looks like a pointer in that its
bottom bits are 0, just like the alignment bits of a pointer. This allows the
client to use the bottom bits of the poisoned bits as flag bits just like the
client was previously able to do with pointer values.
Note: we only ensure that the bottom alignment bits of the generated poison
value is 0. We're not masking out the poisoned bits. This means that the bottom
bits of the poisoned bits will only be null if the original pointer is aligned.
Hence, if the client applies the poison to an unaligned pointer, we do not lose
any information on the low bits.
Also removed 2 wrong assertions in PoisonedImpl's constructors. We were
asserting that Poisoned will never be used with a null value, but that's invalid.
We do want to allow a null value so that we don't have to constantly do null
checks in the clients. This was uncovered by some layout tests.
* wtf/Poisoned.cpp:
(WTF::makePoison):
* wtf/Poisoned.h:
(WTF::PoisonedImpl::PoisonedImpl):
2017-12-07 Mark Lam <mark.lam@apple.com>
[Re-landing r225620] Refactoring: Rename ScrambledPtr to Poisoned.
https://bugs.webkit.org/show_bug.cgi?id=180514
Reviewed by Saam Barati and JF Bastien.
Re-landing r225620 with speculative build fix for GCC 7.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/Poisoned.cpp: Copied from Source/WTF/wtf/ScrambledPtr.cpp.
(WTF::makePoison):
(WTF::makeScrambledPtrKey): Deleted.
* wtf/Poisoned.h: Copied from Source/WTF/wtf/ScrambledPtr.h.
(WTF::PoisonedImpl::PoisonedImpl):
(WTF::PoisonedImpl::assertIsPoisoned const):
(WTF::PoisonedImpl::assertIsNotPoisoned const):
(WTF::PoisonedImpl::unpoisoned const):
(WTF::PoisonedImpl::operator-> const):
(WTF::PoisonedImpl::bits const):
(WTF::PoisonedImpl::operator! const):
(WTF::PoisonedImpl::operator bool const):
(WTF::PoisonedImpl::operator== const):
(WTF::PoisonedImpl::operator==):
(WTF::PoisonedImpl::operator=):
(WTF::PoisonedImpl::poison):
(WTF::PoisonedImpl::unpoison):
(WTF::ScrambledPtr::ScrambledPtr): Deleted.
(WTF::ScrambledPtr::assertIsScrambled const): Deleted.
(WTF::ScrambledPtr::assertIsNotScrambled const): Deleted.
(WTF::ScrambledPtr::descrambled const): Deleted.
(WTF::ScrambledPtr::operator-> const): Deleted.
(WTF::ScrambledPtr::bits const): Deleted.
(WTF::ScrambledPtr::operator! const): Deleted.
(WTF::ScrambledPtr::operator bool const): Deleted.
(WTF::ScrambledPtr::operator== const): Deleted.
(WTF::ScrambledPtr::operator==): Deleted.
(WTF::ScrambledPtr::operator=): Deleted.
(WTF::ScrambledPtr::scramble): Deleted.
(WTF::ScrambledPtr::descramble): Deleted.
* wtf/ScrambledPtr.cpp: Removed.
* wtf/ScrambledPtr.h: Removed.
2017-12-07 Michael Catanzaro <mcatanzaro@igalia.com>
Unreviewed, rolling out r225620
https://bugs.webkit.org/show_bug.cgi?id=180514
<rdar://problem/35901694>
It broke the build with GCC 7, and I don't know how to fix it.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/Poisoned.h: Removed.
* wtf/ScrambledPtr.cpp: Renamed from Source/WTF/wtf/Poisoned.cpp.
(WTF::makeScrambledPtrKey):
* wtf/ScrambledPtr.h: Added.
(WTF::ScrambledPtr::ScrambledPtr):
(WTF::ScrambledPtr::assertIsScrambled const):
(WTF::ScrambledPtr::assertIsNotScrambled const):
(WTF::ScrambledPtr::descrambled const):
(WTF::ScrambledPtr::operator-> const):
(WTF::ScrambledPtr::bits const):
(WTF::ScrambledPtr::operator! const):
(WTF::ScrambledPtr::operator bool const):
(WTF::ScrambledPtr::operator== const):
(WTF::ScrambledPtr::operator==):
(WTF::ScrambledPtr::operator=):
(WTF::ScrambledPtr::scramble):
(WTF::ScrambledPtr::descramble):
2017-12-06 Mark Lam <mark.lam@apple.com>
Refactoring: Rename ScrambledPtr to Poisoned.
https://bugs.webkit.org/show_bug.cgi?id=180514
Reviewed by Saam Barati.
We're switching our nomenclature to "poisoning" instead of "scrambling" pointers.
This allows us to use shorter names.
This patch is almost purely refactoring, except for one change: the PoisonedImpl
template class (previously ScrambledPtr) has been modified to allow usage of
a constexpr uint32_t poison value (see Int32Poisoned) in addition to a runtime
determined uintptr_t poison value (see Poisoned).
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/Poisoned.cpp: Copied from Source/WTF/wtf/ScrambledPtr.cpp.
(WTF::makePoison):
(WTF::makeScrambledPtrKey): Deleted.
* wtf/Poisoned.h: Copied from Source/WTF/wtf/ScrambledPtr.h.
(WTF::PoisonedImpl::PoisonedImpl):
(WTF::PoisonedImpl::assertIsPoisoned const):
(WTF::PoisonedImpl::assertIsNotPoisoned const):
(WTF::PoisonedImpl::unpoisoned const):
(WTF::PoisonedImpl::operator-> const):
(WTF::PoisonedImpl::bits const):
(WTF::PoisonedImpl::operator! const):
(WTF::PoisonedImpl::operator bool const):
(WTF::PoisonedImpl::operator== const):
(WTF::PoisonedImpl::operator==):
(WTF::PoisonedImpl::operator=):
(WTF::PoisonedImpl::poison):
(WTF::PoisonedImpl::unpoison):
(WTF::ScrambledPtr::ScrambledPtr): Deleted.
(WTF::ScrambledPtr::assertIsScrambled const): Deleted.
(WTF::ScrambledPtr::assertIsNotScrambled const): Deleted.
(WTF::ScrambledPtr::descrambled const): Deleted.
(WTF::ScrambledPtr::operator-> const): Deleted.
(WTF::ScrambledPtr::bits const): Deleted.
(WTF::ScrambledPtr::operator! const): Deleted.
(WTF::ScrambledPtr::operator bool const): Deleted.
(WTF::ScrambledPtr::operator== const): Deleted.
(WTF::ScrambledPtr::operator==): Deleted.
(WTF::ScrambledPtr::operator=): Deleted.
(WTF::ScrambledPtr::scramble): Deleted.
(WTF::ScrambledPtr::descramble): Deleted.
* wtf/ScrambledPtr.cpp: Removed.
* wtf/ScrambledPtr.h: Removed.
2017-12-02 Darin Adler <darin@apple.com>
Modernize some aspects of text codecs, eliminate WebKit use of strcasecmp
https://bugs.webkit.org/show_bug.cgi?id=180009
Reviewed by Alex Christensen.
* wtf/Assertions.cpp: Removed include of StringExtras.h.
(WTFLogChannelByName): Use equalIgnoringASCIICase instead of strcasecmp.
* wtf/DateMath.cpp: Removed include of StringExtras.h.
* wtf/MD5.cpp: Ditto. Also removed include of CString.h.
* wtf/SHA1.cpp: Ditto.
* wtf/StringExtras.h:
(strncasecmp): Deleted.
(strcasecmp): Deleted.
* wtf/StringPrintStream.cpp: Removed include of StringExtras.h.
* wtf/text/Base64.cpp: Ditto.
* wtf/text/LineEnding.cpp:
(WTF::normalizeLineEndingsToLF): Replaced old more general purpose function with
this. Changed argument type to vector and used an rvalue reference and return value.
Also fixed some small logic errors.
(WTF::normalizeLineEndingsToCRLF): Ditto.
(WTF::normalizeLineEndingsToNative): Updated for above changes.
* wtf/text/LineEnding.h: Updated for above changes.
* wtf/text/StringCommon.h:
(WTF::equalIgnoringASCIICase): Added overload for const char*.
(WTF::equalLettersIgnoringASCIICase): Ditto.
* wtf/text/TextStream.cpp: Removed include of StringExtras.h.
* wtf/text/WTFString.cpp: Ditto.
* wtf/unicode/icu/CollatorICU.cpp: Ditto.
2017-12-06 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Remove XXXLockBase since constexpr constructor can initialize static variables without calling global constructors
https://bugs.webkit.org/show_bug.cgi?id=180495
Reviewed by Mark Lam.
Very nice feature of C++11 is that constexpr constructor can initialize static global variables
without calling global constructors. We do not need to have XXXLockBase with derived XXXLock
class since StaticXXXLock can have constructors as long as it is constexpr.
We remove bunch of these classes, and set `XXXLock() = default;` explicitly for readability.
C++11's default constructor is constexpr as long as its member's default constructor / default
initializer is constexpr.
* wtf/Condition.h:
(WTF::ConditionBase::construct): Deleted.
(WTF::ConditionBase::waitUntil): Deleted.
(WTF::ConditionBase::waitFor): Deleted.
(WTF::ConditionBase::wait): Deleted.
(WTF::ConditionBase::notifyOne): Deleted.
(WTF::ConditionBase::notifyAll): Deleted.
(WTF::Condition::Condition): Deleted.
* wtf/CountingLock.h:
(WTF::CountingLock::CountingLock): Deleted.
(WTF::CountingLock::~CountingLock): Deleted.
* wtf/Lock.cpp:
(WTF::Lock::lockSlow):
(WTF::Lock::unlockSlow):
(WTF::Lock::unlockFairlySlow):
(WTF::Lock::safepointSlow):
(WTF::LockBase::lockSlow): Deleted.
(WTF::LockBase::unlockSlow): Deleted.
(WTF::LockBase::unlockFairlySlow): Deleted.
(WTF::LockBase::safepointSlow): Deleted.
* wtf/Lock.h:
(WTF::LockBase::construct): Deleted.
(WTF::LockBase::lock): Deleted.
(WTF::LockBase::tryLock): Deleted.
(WTF::LockBase::try_lock): Deleted.
(WTF::LockBase::unlock): Deleted.
(WTF::LockBase::unlockFairly): Deleted.
(WTF::LockBase::safepoint): Deleted.
(WTF::LockBase::isHeld const): Deleted.
(WTF::LockBase::isLocked const): Deleted.
(WTF::LockBase::isFullyReset const): Deleted.
(WTF::Lock::Lock): Deleted.
* wtf/ReadWriteLock.cpp:
(WTF::ReadWriteLock::readLock):
(WTF::ReadWriteLock::readUnlock):
(WTF::ReadWriteLock::writeLock):
(WTF::ReadWriteLock::writeUnlock):
(WTF::ReadWriteLockBase::construct): Deleted.
(WTF::ReadWriteLockBase::readLock): Deleted.
(WTF::ReadWriteLockBase::readUnlock): Deleted.
(WTF::ReadWriteLockBase::writeLock): Deleted.
(WTF::ReadWriteLockBase::writeUnlock): Deleted.
* wtf/ReadWriteLock.h:
(WTF::ReadWriteLock::read):
(WTF::ReadWriteLock::write):
(WTF::ReadWriteLockBase::ReadLock::tryLock): Deleted.
(WTF::ReadWriteLockBase::ReadLock::lock): Deleted.
(WTF::ReadWriteLockBase::ReadLock::unlock): Deleted.
(WTF::ReadWriteLockBase::WriteLock::tryLock): Deleted.
(WTF::ReadWriteLockBase::WriteLock::lock): Deleted.
(WTF::ReadWriteLockBase::WriteLock::unlock): Deleted.
(WTF::ReadWriteLockBase::read): Deleted.
(WTF::ReadWriteLockBase::write): Deleted.
(WTF::ReadWriteLock::ReadWriteLock): Deleted.
* wtf/RecursiveLockAdapter.h:
(WTF::RecursiveLockAdapter::RecursiveLockAdapter): Deleted.
* wtf/WordLock.cpp:
(WTF::WordLock::lockSlow):
(WTF::WordLock::unlockSlow):
(WTF::WordLockBase::lockSlow): Deleted.
(WTF::WordLockBase::unlockSlow): Deleted.
* wtf/WordLock.h:
(WTF::WordLockBase::lock): Deleted.
(WTF::WordLockBase::unlock): Deleted.
(WTF::WordLockBase::isHeld const): Deleted.
(WTF::WordLockBase::isLocked const): Deleted.
(WTF::WordLockBase::isFullyReset const): Deleted.
(WTF::WordLock::WordLock): Deleted.
* wtf/WorkQueue.cpp:
2017-12-05 Stephan Szabo <stephan.szabo@sony.com>
Switch windows build to Visual Studio 2017
https://bugs.webkit.org/show_bug.cgi?id=172412
Reviewed by Per Arne Vollan.
* WTF.vcxproj/WTF.proj:
* wtf/Compiler.h:
2017-12-05 Andy Estes <aestes@apple.com>
[Darwin] Simplify use of TargetConditionals
https://bugs.webkit.org/show_bug.cgi?id=180455
<rdar://problem/35142971>
Reviewed by Tim Horton.
There's no need to check if TARGET_* macros are defined on Darwin platforms, since
TargetConditionals.h always defines them. Also, we can simplify
(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR) to TARGET_OS_IPHONE.
* wtf/Platform.h:
2017-12-05 Matt Lewis <jlewis3@apple.com>
Unreviewed, rolling out r225430.
This caused an API failure on release.
Reverted changeset:
"Move DateComponents into WTF"
https://bugs.webkit.org/show_bug.cgi?id=180211
https://trac.webkit.org/changeset/225430
2017-12-05 Michael Saboff <msaboff@apple.com>
Make WebKit build for ARM64_32
https://bugs.webkit.org/show_bug.cgi?id=180447
Reviewed by Mark Lam.
Add the 'w' (32bit) pointer qualifier for ARM64_32 pointers in inline assembly.
* wtf/darwin/WeakLinking.h:
(WTF::isNullFunctionPointer):
2017-12-05 Filip Pizlo <fpizlo@apple.com>
bmalloc IsoHeap needs to allow a thread to deallocate some size for the first time
https://bugs.webkit.org/show_bug.cgi?id=180443
Reviewed by Saam Barati.
With this change it's possible to reenable isoheaps on iOS.
* wtf/IsoMalloc.h:
* wtf/IsoMallocInlines.h:
2017-12-05 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Remove m_atomicStringTableDestructor in Thread by querying the condition at thread destruction
https://bugs.webkit.org/show_bug.cgi?id=180429
Reviewed by Alex Christensen.
We now have a pointer to the AtomicStringTable::destroy in Thread.
This pointer becomes nullptr only when the thread is the web thread not to destroy AtomicStringTable
twice in the UI thread and the web thread.
Instead of having a pointer in each Thread, we query whether the current thread is the web thread at
Thread destruction. And use this information to call AtomicStringTable::destroy. Then, we can drop
m_atomicStringTableDestructor field in Thread.
* wtf/Threading.cpp:
(WTF::Thread::didExit):
* wtf/Threading.h:
* wtf/mac/MainThreadMac.mm:
* wtf/text/AtomicStringTable.cpp:
(WTF::AtomicStringTable::create):
(WTF::AtomicStringTable::destroy):
* wtf/text/AtomicStringTable.h:
2017-12-01 Filip Pizlo <fpizlo@apple.com>
GC constraint solving should be parallel
https://bugs.webkit.org/show_bug.cgi?id=179934
Reviewed by JF Bastien.
This does some changes to make it easier to do parallel constraint solving:
- I finally removed dependencyWith. This was a silly construct whose only purpose is to confuse
people about what it means to have a dependency chain. I took that as an opportunity to grealy
simplify the GC's use of dependency chaining.
- Added more logic to Deque<>, since I use it for part of the load balancer.
- Made it possible to profile lock contention. See
https://bugs.webkit.org/show_bug.cgi?id=180250#c0 for some preliminary measurements.
- Introduced holdLockIf, which makes it easy to perform predicated lock acquisition. We use that
to pick a lock in WebCore.
- Introduced CountingLock. It's like WTF::Lock except it also enables optimistic read transactions
sorta like Java's StampedLock.
* WTF.xcodeproj/project.pbxproj:
* wtf/Atomics.h:
(WTF::dependency):
(WTF::DependencyWith::DependencyWith): Deleted.
(WTF::dependencyWith): Deleted.
* wtf/BitVector.h:
(WTF::BitVector::iterator::operator++):
* wtf/CMakeLists.txt:
* wtf/ConcurrentPtrHashSet.cpp: Added.
(WTF::ConcurrentPtrHashSet::ConcurrentPtrHashSet):
(WTF::ConcurrentPtrHashSet::~ConcurrentPtrHashSet):
(WTF::ConcurrentPtrHashSet::deleteOldTables):
(WTF::ConcurrentPtrHashSet::clear):
(WTF::ConcurrentPtrHashSet::initialize):
(WTF::ConcurrentPtrHashSet::addSlow):
(WTF::ConcurrentPtrHashSet::resizeIfNecessary):
(WTF::ConcurrentPtrHashSet::resizeAndAdd):
(WTF::ConcurrentPtrHashSet::Table::create):
* wtf/ConcurrentPtrHashSet.h: Added.
(WTF::ConcurrentPtrHashSet::contains):
(WTF::ConcurrentPtrHashSet::add):
(WTF::ConcurrentPtrHashSet::size const):
(WTF::ConcurrentPtrHashSet::Table::maxLoad const):
(WTF::ConcurrentPtrHashSet::hash):
(WTF::ConcurrentPtrHashSet::cast):
(WTF::ConcurrentPtrHashSet::containsImpl const):
(WTF::ConcurrentPtrHashSet::addImpl):
* wtf/Deque.h:
(WTF::inlineCapacity>::takeFirst):
* wtf/FastMalloc.h:
* wtf/Lock.cpp:
(WTF::LockBase::lockSlow):
* wtf/Locker.h:
(WTF::holdLockIf):
* wtf/ScopedLambda.h:
* wtf/SharedTask.h:
(WTF::SharedTask<PassedResultType):
(WTF::SharedTask<ResultType): Deleted.
* wtf/StackShot.h: Added.
(WTF::StackShot::StackShot):
(WTF::StackShot::operator=):
(WTF::StackShot::array const):
(WTF::StackShot::size const):
(WTF::StackShot::operator bool const):
(WTF::StackShot::operator== const):
(WTF::StackShot::hash const):
(WTF::StackShot::isHashTableDeletedValue const):
(WTF::StackShot::operator> const):
(WTF::StackShot::deletedValueArray):
(WTF::StackShotHash::hash):
(WTF::StackShotHash::equal):
* wtf/StackShotProfiler.h: Added.
(WTF::StackShotProfiler::StackShotProfiler):
(WTF::StackShotProfiler::profile):
(WTF::StackShotProfiler::run):
2017-12-05 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Use m_suspendCount instead of m_suspended flag in Thread
https://bugs.webkit.org/show_bug.cgi?id=180427
Reviewed by Carlos Garcia Campos.
When resuming the thread, signal handler is reinvoked once before `sigsuspend` is resumed.
But this handler should not do anything since it is just a signal for `sigsuspend`.
Previously, we use m_suspenedd flag to distinguish between suspending and resuming signal
handler invocations.
But this additional m_suspended flag is not necessary since we can use m_suspendCount instead.
This patch drops m_suspended and use m_suspendCount. Since semaphore operations emit full memory
barrier, m_suspendCount is loaded and stored as we expect.
* wtf/Threading.h:
* wtf/ThreadingPthreads.cpp:
(WTF::Thread::signalHandlerSuspendResume):
(WTF::Thread::suspend):
(WTF::Thread::resume):
2017-12-04 Simon Fraser <simon.fraser@apple.com>
Minor DisplayRefreshMonitor-related cleanup
https://bugs.webkit.org/show_bug.cgi?id=179802
Reviewed by Sam Weinig.
New trace point for when the CVDisplayLink fires on its own thread.
* wtf/SystemTracing.h:
2017-12-04 JF Bastien <jfbastien@apple.com>
Update std::expected to match libc++ coding style
https://bugs.webkit.org/show_bug.cgi?id=180264
Reviewed by Alex Christensen.
As of https://wg21.link/p0323r4 std::expected is on its way to the
Library Fundamentals v3 TS (LEWG and EWG voted for this, but LWG
hasn't done wording review yet, hence "on its way"). The API is
therefore pretty close to what will be in the TS, and I've gotten
requests for an easily usable implementation of std::expected. I
talked to our clang team and they'll help me migrate our
implementation to libc++, but our implementation has to look more
like libc++ than it does now. Once in libc++ I'll maintain changes
on both sides to make sure neither is out-of-date for too long.
- Fork std::unexpected into its own header.
- Add mild support for an exception-based implementation, but
don't do noexcept yet.
- Rename everything to follow STL style, and keep a global using
or variable alias where possible to reduce WebKit code churn.
- Minor API updates to remove things that aren't in the proposal
anymore.
* wtf/Expected.h:
(std::experimental::fundamentals_v3::bad_expected_access<void>::bad_expected_access):
(std::experimental::fundamentals_v3::bad_expected_access::bad_expected_access):
(std::experimental::fundamentals_v3::bad_expected_access::error):
(std::experimental::fundamentals_v3::bad_expected_access::error const):
(std::experimental::fundamentals_v3::__expected_detail::constexpr_base::constexpr_base):
(std::experimental::fundamentals_v3::__expected_detail::base::base):
(std::experimental::fundamentals_v3::__expected_detail::base::~base):
(std::experimental::fundamentals_v3::expected::expected):
(std::experimental::fundamentals_v3::expected::operator=):
(std::experimental::fundamentals_v3::expected::swap):
(std::experimental::fundamentals_v3::expected::operator-> const):
(std::experimental::fundamentals_v3::expected::operator->):
(std::experimental::fundamentals_v3::expected::operator* const):
(std::experimental::fundamentals_v3::expected::operator*):
(std::experimental::fundamentals_v3::expected::has_value const):
(std::experimental::fundamentals_v3::expected::value const):
(std::experimental::fundamentals_v3::expected::value):
(std::experimental::fundamentals_v3::expected::error const):
(std::experimental::fundamentals_v3::expected::error):
(std::experimental::fundamentals_v3::expected::value_or const):
(std::experimental::fundamentals_v3::expected::value_or):
(std::experimental::fundamentals_v3::operator==):
(std::experimental::fundamentals_v3::operator!=):
(std::experimental::fundamentals_v3::swap):
(WTF::Unexpected::Unexpected): Deleted.
(WTF::Unexpected::value const): Deleted.
(WTF::Unexpected::value): Deleted.
(WTF::operator==): Deleted.
(WTF::operator!=): Deleted.
(WTF::makeUnexpected): Deleted.
(WTF::ExpectedDetail::Throw): Deleted.
(WTF::ExpectedDetail::destroy): Deleted.
(WTF::ExpectedDetail::std::is_trivially_destructible<T>::value): Deleted.
(WTF::ExpectedDetail::ConstexprBase::ConstexprBase): Deleted.
(WTF::ExpectedDetail::Base::Base): Deleted.
(WTF::ExpectedDetail::Base::~Base): Deleted.
(WTF::Expected::Expected): Deleted.
(WTF::Expected::operator=): Deleted.
(WTF::Expected::swap): Deleted.
(WTF::Expected::operator-> const): Deleted.
(WTF::Expected::operator->): Deleted.
(WTF::Expected::operator* const): Deleted.
(WTF::Expected::operator*): Deleted.
(WTF::Expected::operator bool const): Deleted.
(WTF::Expected::hasValue const): Deleted.
(WTF::Expected::value const): Deleted.
(WTF::Expected::value): Deleted.
(WTF::Expected::error const): Deleted.
(WTF::Expected::error): Deleted.
(WTF::Expected::getUnexpected const): Deleted.
(WTF::Expected::valueOr const): Deleted.
(WTF::Expected::valueOr): Deleted.
(WTF::swap): Deleted.
(WTF::makeExpected): Deleted.
(WTF::makeExpectedFromError): Deleted.
* wtf/Forward.h:
* wtf/Optional.h:
* wtf/StdLibExtras.h:
* wtf/Unexpected.h: Added.
(std::experimental::fundamentals_v3::unexpected::unexpected):
(std::experimental::fundamentals_v3::unexpected::value const):
(std::experimental::fundamentals_v3::unexpected::value):
(std::experimental::fundamentals_v3::operator==):
(std::experimental::fundamentals_v3::operator!=):
(makeUnexpected):
2017-12-03 Tomas Popela <tpopela@redhat.com>
Build fails on x86_64 and arm64 with BMalloc disabled
https://bugs.webkit.org/show_bug.cgi?id=180188
Reviewed by Carlos Garcia Campos.
Add missing methods in WTF's Gigacage.h and fix g_gigacageBasePtr
definition.
* wtf/Gigacage.cpp:
* wtf/Gigacage.h:
(Gigacage::basePtr):
(Gigacage::isEnabled):
2017-12-03 Yusuke Suzuki <utatane.tea@gmail.com>
WTF shouldn't have both Thread and ThreadIdentifier
https://bugs.webkit.org/show_bug.cgi?id=180308
Reviewed by Darin Adler.
We should use a pointer of WTF::Thread instead of ThreadIdentifier.
One problem is that Windows support library uses WTF::createThread,
which returns ThreadIdentifier. So we cannot drop ThreadIdentifier
in Windows environment. This patch keeps ThreadIdentifier in Windows.
* wtf/MainThread.cpp:
(WTF::initializeMainThread):
(WTF::isMainThread):
(WTF::canAccessThreadLocalDataForThread):
* wtf/MainThread.h:
* wtf/ParkingLot.cpp:
(WTF::ParkingLot::parkConditionallyImpl):
(WTF::ParkingLot::unparkOne):
(WTF::ParkingLot::unparkOneImpl):
(WTF::ParkingLot::unparkCount):
* wtf/RecursiveLockAdapter.h:
(WTF::RecursiveLockAdapter::lock):
(WTF::RecursiveLockAdapter::unlock):
(WTF::RecursiveLockAdapter::tryLock):
* wtf/Threading.cpp:
(WTF::Thread::dump const):
* wtf/Threading.h:
(WTF::Thread::id const):
(WTF::Thread::operator==): Deleted.
(WTF::Thread::operator!=): Deleted.
(WTF::currentThread): Deleted.
* wtf/ThreadingPrimitives.h:
* wtf/ThreadingPthreads.cpp:
(WTF::Thread::waitForCompletion):
(WTF::Thread::detach):
(WTF::Thread::initializeCurrentTLS):
(WTF::Thread::suspend):
(WTF::Thread::establishPlatformSpecificHandle):
(WTF::Thread::currentID): Deleted.
* wtf/ThreadingWin.cpp:
(WTF::Thread::waitForCompletion):
(WTF::Thread::suspend):
(WTF::Thread::currentDying):
* wtf/mac/MainThreadMac.mm:
(WTF::initializeApplicationUIThread):
(WTF::initializeWebThreadPlatform):
(WTF::canAccessThreadLocalDataForThread):
(WTF::initializeApplicationUIThreadIdentifier): Deleted.
(WTF::initializeWebThreadIdentifier): Deleted.
2017-12-03 Darin Adler <darin@apple.com>
Add WTF::Hasher, an easier to use replacement for WTF::IntegerHasher
https://bugs.webkit.org/show_bug.cgi?id=180318
Reviewed by JF Bastien.
* WTF.xcodeproj/project.pbxproj: Added Hasher.h.
* wtf/CMakeLists.txt: Ditto.
* wtf/Forward.h: Added Hasher and TextStream.
* wtf/Hasher.h: Moved StringHasher into a separate header. Added Hasher.
Marked IntegerHasher deprecated.
* wtf/text/CString.cpp: Include StringHasher.h instead of Hasher.h.
* wtf/text/StringHash.h: Ditto.
* wtf/text/StringHasher.h: Added. Moved StringHasher here from Hasher.h.
* wtf/text/StringImpl.h: Include StringHasher.h instead of Hasher.h.
* wtf/text/WTFString.h: Added a hash function. This was useful in some
adoption I was doing in WebCore, not included in this patch.
* wtf/unicode/UTF8.cpp: Include StringHasher.h instead of Hasher.h.
2017-12-02 Brady Eidson <beidson@apple.com>
Factor out the "databaseTaskQueue" parts of IDBServer into something reusable.
https://bugs.webkit.org/show_bug.cgi?id=180298
Reviewed by Chris Dumez.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/CrossThreadTaskHandler.cpp: Added.
(WTF::CrossThreadTaskHandler::CrossThreadTaskHandler):
(WTF::CrossThreadTaskHandler::~CrossThreadTaskHandler):
(WTF::CrossThreadTaskHandler::postTask):
(WTF::CrossThreadTaskHandler::postTaskReply):
(WTF::CrossThreadTaskHandler::taskRunLoop):
(WTF::CrossThreadTaskHandler::handleTaskRepliesOnMainThread):
* wtf/CrossThreadTaskHandler.h: Added.
2017-12-01 Mark Lam <mark.lam@apple.com>
Let's scramble ClassInfo pointers in cells.
https://bugs.webkit.org/show_bug.cgi?id=180291
<rdar://problem/35807620>
Reviewed by JF Bastien.
* wtf/ScrambledPtr.h:
(WTF::ScrambledPtr::descrambled const):
(WTF::ScrambledPtr::bits const):
(WTF::ScrambledPtr::operator==):
(WTF::ScrambledPtr::operator=):
(WTF::ScrambledPtr::scramble):
(WTF::ScrambledPtr::descramble):
(WTF::ScrambledPtr:: const): Deleted.
(WTF::ScrambledPtr::scrambledBits const): Deleted.
2017-12-01 Christopher Reid <chris.reid@sony.com>
Move DateComponents into WTF
https://bugs.webkit.org/show_bug.cgi?id=180211
Reviewed by Myles C. Maxfield.
Moved DateComponents from WebCore/platform into WTF.
Removed isLeapYear from DateComponents as DateMath already has that function.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/DateComponents.cpp: Renamed from Source\WebCore\platform\DateComponents.cpp.
* wtf/DateComponents.h: Renamed from Source\WebCore\platform\DateComponents.h.
2017-12-01 Youenn Fablet <youenn@apple.com>
Implement https://w3c.github.io/ServiceWorker/#clients-get
https://bugs.webkit.org/show_bug.cgi?id=180167
Reviewed by Chris Dumez.
* wtf/text/StringView.h:
(WTF::StringView::toUInt64Strict const):
* wtf/text/WTFString.h:
2017-12-01 Brian Burg <bburg@apple.com>
Web Inspector: move Inspector::Protocol::Array<T> to JSON namespace
https://bugs.webkit.org/show_bug.cgi?id=173662
Reviewed by Joseph Pecoraro.
Move Inspector::Protocol::Array<T> to JSON::ArrayOf<T>.
* wtf/JSONValues.h:
(WTF::JSONImpl::ArrayOf::ArrayOf):
(WTF::JSONImpl::ArrayOf::openAccessors):
(WTF::JSONImpl::ArrayOf::addItem):
(WTF::JSONImpl::ArrayOf::create):
2017-12-01 Brady Eidson <beidson@apple.com>
Add Internals.terminateServiceWorker, and the ability to restart service workers for postMessage.
https://bugs.webkit.org/show_bug.cgi?id=180170
Reviewed by Chris Dumez.
* wtf/CompletionHandler.h:
(WTF::CompletionHandler<Out):
2017-11-30 Yusuke Suzuki <utatane.tea@gmail.com>
[JSC] Remove easy toRemove & map.remove() use in OAS phase
https://bugs.webkit.org/show_bug.cgi?id=180208
Reviewed by Mark Lam.
* wtf/HashMap.h:
(WTF::X>::removeIf):
* wtf/HashSet.h:
(WTF::V>::removeIf):
* wtf/HashTable.h:
(WTF::KeyTraits>::removeIf):
2017-11-30 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r225362.
https://bugs.webkit.org/show_bug.cgi?id=180225
removeIf predicate function can touch remove target set
(Requested by yusukesuzuki on #webkit).
Reverted changeset:
"[JSC] Remove easy toRemove & map.remove() use"
https://bugs.webkit.org/show_bug.cgi?id=180208
https://trac.webkit.org/changeset/225362
2017-11-30 Mark Lam <mark.lam@apple.com>
Let's scramble MacroAssemblerCodePtr values.
https://bugs.webkit.org/show_bug.cgi?id=180169
<rdar://problem/35758340>
Reviewed by Filip Pizlo, Saam Barati, and JF Bastien.
Introduce a ScrambledPtr class to facilitate scrambling.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/ScrambledPtr.cpp: Added.
(WTF::makeScrambledPtrKey):
* wtf/ScrambledPtr.h: Added.
(WTF::ScrambledPtr::ScrambledPtr):
(WTF::ScrambledPtr::paranoidAssertIsScrambled const):
(WTF::ScrambledPtr::paranoidAssertIsNotScrambled const):
(WTF::ScrambledPtr:: const):
(WTF::ScrambledPtr::operator-> const):
(WTF::ScrambledPtr::scrambledBits const):
(WTF::ScrambledPtr::operator! const):
(WTF::ScrambledPtr::operator bool const):
(WTF::ScrambledPtr::operator== const):
(WTF::ScrambledPtr::operator==):
(WTF::ScrambledPtr::scramble):
(WTF::ScrambledPtr::descramble):
2017-11-30 Yusuke Suzuki <utatane.tea@gmail.com>
[JSC] Remove easy toRemove & map.remove() use
https://bugs.webkit.org/show_bug.cgi?id=180208
Reviewed by Mark Lam.
Return bool from removeIf. It is true if removeIf removes at least one entry.
This interface is similar to existing HashSet::remove, which returns true
if it actually removes entry.
* wtf/HashMap.h:
(WTF::X>::removeIf):
* wtf/HashSet.h:
(WTF::V>::removeIf):
* wtf/HashTable.h:
(WTF::KeyTraits>::removeIf):
2017-11-30 Chris Dumez <cdumez@apple.com>
Populate self.registration.installing/waiting/active inside service workers
https://bugs.webkit.org/show_bug.cgi?id=180168
Reviewed by Brady Eidson.
Add CrossThreadCopier support for std::optional<>.
* wtf/CrossThreadCopier.h:
2017-11-29 JF Bastien <jfbastien@apple.com>
WTF / bmalloc: don't write to 0xbbadbeef when ASAN is looking
https://bugs.webkit.org/show_bug.cgi?id=180175
Reviewed by Mark Lam.
ASAN knows that 0xbbadbeef is a bbad aaddress, and tells us so
when we write to it, say in an assert. That creates bbad error
reports where ASAN thinks we write to an invalid address, instead
of thinking that we hit an assertion. In some cases, tooling that
use fuzzers aggregate similar issues, and think that we just have
the one bug and not a bunch of different asserts.
* wtf/Assertions.cpp:
* wtf/Assertions.h:
2017-11-29 Filip Pizlo <fpizlo@apple.com>
GC should support isoheaps
https://bugs.webkit.org/show_bug.cgi?id=179288
Reviewed by Saam Barati.
One of my favorite data structures in the GC is a singly-linked list that knows its tail, so that
things get added to it at the end rather that at the beginning. In this patch, I use this to put
the same node on multiple lists, which our existing linked list templates also don't support.
This adds a new linked list that does those things:
- It supports append(). It could also support prepend(), but currently there is no need for it.
- It supports nodes that are on multiple lists. The GC uses std::mem_fn() to create a lambda that the
list uses to set next.
* WTF.xcodeproj/project.pbxproj:
* wtf/SinglyLinkedListWithTail.h: Added.
(WTF::SinglyLinkedListWithTail::isEmpty const):
(WTF::SinglyLinkedListWithTail::append):
(WTF::SinglyLinkedListWithTail::first const):
(WTF::SinglyLinkedListWithTail::last const):
2017-11-29 Stanislav Ocovaj <stanislav.ocovaj@rt-rk.com>
[DFG][MIPS] Enable DFG JIT on MIPS.
https://bugs.webkit.org/show_bug.cgi?id=175447
Reviewed by Carlos Alberto Lopez Perez.
* wtf/Platform.h:
2017-11-29 Matt Lewis <jlewis3@apple.com>
Unreviewed, rolling out r225286.
The source files within this patch have been marked as
executable.
Reverted changeset:
"[MIPS][JSC] Implement MacroAssembler::probe support on MIPS"
https://bugs.webkit.org/show_bug.cgi?id=175447
https://trac.webkit.org/changeset/225286
2017-11-29 Stanislav Ocovaj <stanislav.ocovaj@rt-rk.com>
[DFG][MIPS] Enable DFG JIT on MIPS.
https://bugs.webkit.org/show_bug.cgi?id=175447
Reviewed by Carlos Alberto Lopez Perez.
* wtf/Platform.h:
2017-11-14 Carlos Garcia Campos <cgarcia@igalia.com>
Move JSONValues to WTF and convert uses of InspectorValues.h to JSONValues.h
https://bugs.webkit.org/show_bug.cgi?id=173793
Reviewed by Joseph Pecoraro.
Based on patch by Brian Burg.
Move the implementation into WTF. Put the actual implementation inside
namespace WTF::JSONImpl so that the symbols in libwtf start with the WTF prefix.
Also provide a top-level JSON namespace so that clients can write JSON::Value.
This is essentially a typedef for the entire WTF::JSONImpl namespace.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/JSONValues.cpp: Renamed from Source/JavaScriptCore/inspector/InspectorValues.cpp.
(JSON::Value::null):
(JSON::Value::create):
(JSON::Value::asValue):
(JSON::Value::asObject):
(JSON::Value::asArray):
(JSON::Value::parseJSON):
(JSON::Value::toJSONString const):
(JSON::Value::asBoolean const):
(JSON::Value::asDouble const):
(JSON::Value::asInteger const):
(JSON::Value::asString const):
(JSON::Value::writeJSON const):
(JSON::Value::memoryCost const):
(JSON::ObjectBase::~ObjectBase):
(JSON::ObjectBase::asObject):
(JSON::ObjectBase::openAccessors):
(JSON::ObjectBase::memoryCost const):
(JSON::ObjectBase::getBoolean const):
(JSON::ObjectBase::getString const):
(JSON::ObjectBase::getObject const):
(JSON::ObjectBase::getArray const):
(JSON::ObjectBase::getValue const):
(JSON::ObjectBase::remove):
(JSON::ObjectBase::writeJSON const):
(JSON::ObjectBase::ObjectBase):
(JSON::ArrayBase::~ArrayBase):
(JSON::ArrayBase::asArray):
(JSON::ArrayBase::writeJSON const):
(JSON::ArrayBase::ArrayBase):
(JSON::ArrayBase::get const):
(JSON::Object::create):
(JSON::Array::create):
(JSON::ArrayBase::memoryCost const):
* wtf/JSONValues.h: Renamed from Source/JavaScriptCore/inspector/InspectorValues.h.
(JSON::ObjectBase::find):
(JSON::ObjectBase::find const):
(JSON::ObjectBase::setBoolean):
(JSON::ObjectBase::setInteger):
(JSON::ObjectBase::setDouble):
(JSON::ObjectBase::setString):
(JSON::ObjectBase::setValue):
(JSON::ObjectBase::setObject):
(JSON::ObjectBase::setArray):
(JSON::ArrayBase::pushBoolean):
(JSON::ArrayBase::pushInteger):
(JSON::ArrayBase::pushDouble):
(JSON::ArrayBase::pushString):
(JSON::ArrayBase::pushValue):
(JSON::ArrayBase::pushObject):
(JSON::ArrayBase::pushArray):
2017-11-28 Simon Fraser <simon.fraser@apple.com>
Modernize GraphicsLayer dumping
https://bugs.webkit.org/show_bug.cgi?id=180067
Reviewed by Sam Weinig.
Expose the current indent.
* wtf/text/TextStream.h:
(WTF::TextStream::indent const):
2017-11-27 Chris Dumez <cdumez@apple.com>
Move callOnMainThreadAndWait() from SocketStreamHandleImplCFNet.cpp to MainThread.h
https://bugs.webkit.org/show_bug.cgi?id=180060
Reviewed by Alex Christensen.
Move callOnMainThreadAndWait() from SocketStreamHandleImplCFNet.cpp to MainThread.h so that it can be reused.
* wtf/MainThread.cpp:
(WTF::callOnMainThreadAndWait):
* wtf/MainThread.h:
2017-11-27 Simon Fraser <simon.fraser@apple.com>
Use TextStream's indent tracking, rather than passing indent to all the externalRepresentation() functions
https://bugs.webkit.org/show_bug.cgi?id=180027
Reviewed by Jon Lee.
Remove all the indent arguments, and make use of TextStream::IndentScope to control
output indentation.
Add an indent stream manipulator so you can say
ts << indent << "text"
to write the indent.
* wtf/text/TextStream.h:
(WTF::TextStream::IndentScope::IndentScope):
(WTF::TextStream::IndentScope::~IndentScope):
2016-08-05 Darin Adler <darin@apple.com>
Fix some minor problems in the StringImpl header
https://bugs.webkit.org/show_bug.cgi?id=160630
Reviewed by Brent Fulgham.
* wtf/text/AtomicString.h: Update since CharacterMatchFunctionPtr is now
CodeUnitMatchFunction.
* wtf/text/StringCommon.h: Added CodeUnitMatchFunction, which replaces
CharacterMatchFunctionPtr.
* wtf/text/StringImpl.cpp:
(WTF::StringImpl::stripMatchedCharacters): Changed template argument name
to CodeUnitPredicate to help make it clear this works on code units, not
code points.
(WTF::UCharPredicate): Deleted.
(WTF::SpaceOrNewlinePredicate): Deleted.
(WTF::StringImpl::stripWhiteSpace): Removed unneeded use of predicate class to
turn a function into a functor; functions already work fine as functors without
a class wrapping them.
(WTF::StringImpl::stripLeadingAndTrailingCharacters): Ditto. Also renamed
from stripWhiteSpace, since it strips arbitrary characters.
(WTF::StringImpl::removeCharacters): Fixed various minor style issues and
updated to new type name.
(WTF::StringImpl::simplifyMatchedCharactersToSpace): Ditto.
(WTF::StringImpl::simplifyWhiteSpace): More of the same.
(WTF::StringImpl::find): Ditto.
* wtf/text/StringImpl.h: Removed unneeded include of uchar.h, since it's
included by StringCommon.h. Removed =CharacterMatchFunctionPtr and
IsWhiteSpaceFunctionPtr, both replaced by CodeUnitMatchFunction. Fixed
a mistake recently introduced in isSpaceOrNewline, which was unnecessarily,
inefficiently using ICU for non-ASCII Latin-1 characters.
* wtf/text/StringView.h: Use CodeUnitMatchFunction instead of CharacterMatchFunction.
* wtf/text/WTFString.cpp:
(WTF::String::stripLeadingAndTrailingCharacters): Updated function name and type.
(WTF::String::simplifyWhiteSpace): Updated type.
(WTF::String::removeCharacters): Updated type.
* wtf/text/WTFString.h: Ditto.
2017-11-23 Darin Adler <darin@apple.com>
Fix dictionary leak in lookup, convert FindOptions to OptionSet, tweak code style nearby
https://bugs.webkit.org/show_bug.cgi?id=179981
Reviewed by Sam Weinig.
* wtf/OptionSet.h: Added some operators so it's easier to use | and - with individual
options from the set.
2017-11-23 Darin Adler <darin@apple.com>
Reduce WTF::String operations that do unnecessary Unicode operations instead of ASCII
https://bugs.webkit.org/show_bug.cgi?id=179907
Reviewed by Sam Weinig.
* wtf/text/ASCIIFastPath.h: Moved the using for charactersAreAllASCII here since
the function is defined here.
* wtf/text/AtomicString.h: Removed overloads of contains, find, startsWith, and
endsWith that take a boolean indicating whether they should be "case sensitive".
When false, this was doing Unicode case folding, and no callers needed that.
Also tweaked formatting and argument names.
* wtf/text/IntegerToStringConversion.h: Added an include of LChar.h since this file
uses that. Also tweaked formatting a bit.
* wtf/text/StringImpl.cpp:
(WTF::StringImpl::containsOnlyWhitespace): Deleted. Despite its name sounding like
it used the full Unicode whitespace definition, this actually checked isASCIISpace.
Callers now all use isAllSpecialCharacters instead with the whitespace definition
that is appropriate to each call site.
(WTF::latin1CaseFoldTable): Deleted.
(WTF::equalCompatibilityCaseless): Deleted.
(WTF::StringImpl::findIgnoringCase): Deleted.
(WTF::findIgnoringCaseInner): Deleted.
(WTF::reverseFindIgnoringCaseInner): Deleted.
(WTF::StringImpl::reverseFindIgnoringCase): Deleted.
(WTF::equalInner): Removed boolean caseSensitive argument.
(WTF::StringImpl::startsWith): Ditto.
(WTF::StringImpl::endsWith): Ditto.
* wtf/text/StringImpl.h: Moved TextCaseSensitivity out into a different header.
Moved ASCIIFastPath.h include here from WTFString.h. Moved isAllSpecialCharacters
free function here from WTFString.h. Moved lots of function bodies out of class
definitions to make the class definitions easier to read. Sorted things a bit.
Tweaked formatting. Marked constructor that takes one argument explicit. Added
an isEmpty function like the one in String. Renamed copyChars to copyCharacters.
Added isAllASCII, isAllLatin1 and isAllSpecialCharacters functions. Removed
boolean caseSensitive arguments from various functions. Removed findIgnoringCase
and reverseFindIgnoringCase. Added a FIXME to codePointCompare about the way it
treats null and empty strings as equal. Changed length argument in remove to
unsigned to match other lengths.
* wtf/text/WTFString.cpp:
(WTF::String::removeInternal): Changed length argument to be unsigned.
(WTF::createWithFormatAndArguments): Use emptyString.
(WTF::String::isSafeToSendToAnotherThread const): Rewrote to be easier to read.
* wtf/text/WTFString.h: Moved ASCIIFastPath.h to StringImpl.h. Moved lots of
function bodies out of class definitions to make the class definitions easier
to read, made others one-liners. Removed the String::at function but kept the
String::characterAt function; the two were identical. Removed boolean
caseSensitive arguments from various functions. Removed findIgnoringCase and
reverseFindIgnoringCase. Renamed containsOnlyASCII to isAllASCII and
containsOnlyLatin1 to isAllLatin1 to match the naming of isAllSpecialCharacters.
Moved the inline implementations of functions that are defined above further
down, after things like the ASCIILiteral class and various functions.
* wtf/text/icu/UTextProviderLatin1.cpp: Updated name of copyChars.
2017-11-22 Stephan Szabo <stephan.szabo@sony.com>
tuple related items are used in WTF without including tuple
https://bugs.webkit.org/show_bug.cgi?id=179926
Reviewed by Darin Adler.
* wtf/HashFunctions.h:
* wtf/PrintStream.h:
* wtf/threads/Signals.h:
2017-11-21 Zan Dobersek <zdobersek@igalia.com>
Drop ENABLE_IMAGE_DECODER_DOWN_SAMPLING code
https://bugs.webkit.org/show_bug.cgi?id=179921
Reviewed by Carlos Garcia Campos.
* wtf/FeatureDefines.h: Remove the ENABLE_IMAGE_DECODER_DOWN_SAMPLING
definition.
2017-11-19 Tim Horton <timothy_horton@apple.com>
Remove unused TOUCH_ICON_LOADING feature flag
https://bugs.webkit.org/show_bug.cgi?id=179873
Reviewed by Simon Fraser.
* wtf/FeatureDefines.h:
2017-11-19 Yusuke Suzuki <utatane.tea@gmail.com>
Add CPU(UNKNOWN) to cover all the unknown CPU types
https://bugs.webkit.org/show_bug.cgi?id=179243
Reviewed by JF Bastien.
This patch adds a new CPU type, `CPU(UNKNOWN)` to cover all the unknown CPUs.
This CPU architecture tells conservative assumption to make JSC work on all
the unknown generic CPUs. And we make several CPUs (ALPHA, SH4, S390, S390X, IA64, IA64_32)
UNKNOWN.
We also make InlineASM available only for !CPU(UNKNOWN). In an unknown CPU, inline asm is not useful.
And we also introduce a generic way to detect 64bit pointer environment by using
__SIZEOF_POINTER__ predefined macro, or `UINTPTR_MAX > UINT32_MAX`.
* wtf/InlineASM.h:
* wtf/Platform.h:
* wtf/dtoa/utils.h:
2017-11-19 Tim Horton <timothy_horton@apple.com>
Remove unused LEGACY_VENDOR_PREFIXES feature flag
https://bugs.webkit.org/show_bug.cgi?id=179872
Reviewed by Darin Adler.
* wtf/FeatureDefines.h:
2017-11-19 Chris Dumez <cdumez@apple.com>
Fix potential thread safety issue in ThreadSafeIdentified
https://bugs.webkit.org/show_bug.cgi?id=179879
Reviewed by Darin Adler.
Fix potential thread safety issue in ThreadSafeIdentified. Protect static std::atomic
initialization with an std::call_once() given that we build with
--fno-threadsafe-statics.
* wtf/Identified.h:
(WTF::Identified::Identified):
(WTF::Identified::generateIdentifier):
(WTF::ThreadSafeIdentified::ThreadSafeIdentified):
(WTF::ThreadSafeIdentified::generateIdentifier):
2017-11-18 Darin Adler <darin@apple.com>
Eliminate some cases of double hashing, other related refactoring
https://bugs.webkit.org/show_bug.cgi?id=179867
Reviewed by Sam Weinig.
* wtf/text/StringImpl.cpp:
(WTF::StringImpl::containsOnlyWhitespace): Added FIXME.
2017-11-19 Chris Dumez <cdumez@apple.com>
Fix potential thread safety issue in generateThreadSafeObjectIdentifier()
https://bugs.webkit.org/show_bug.cgi?id=179877
Reviewed by Sam Weinig.
Fix potential thread safety issue in generateThreadSafeObjectIdentifier().
Protect std::atomic initialization with an std::call_once() given that we
build with --fno-threadsafe-statics.
* wtf/ObjectIdentifier.h:
(WTF::generateThreadSafeObjectIdentifier):
2017-11-18 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Use system endianess information instead of relying CPU information
https://bugs.webkit.org/show_bug.cgi?id=179861
Reviewed by JF Bastien.
Currently, we use known CPU information to determine endianess of the current
architecture. But this means that unknown CPU does not work well in WebKit
withou modifying code. Instead, we use compiler or system's macro to determine
endianess. This paves the way to dropping many CPUs in Platform.h by replacing
them with CPU(UNKNOWN)[1].
[1]: https://bugs.webkit.org/show_bug.cgi?id=179243
* wtf/Platform.h:
2017-11-18 Chris Dumez <cdumez@apple.com>
ASSERTION FAILED: registration in WebCore::SWServerJobQueue::scriptContextStarted(ServiceWorkerIdentifier)
https://bugs.webkit.org/show_bug.cgi?id=179846
Reviewed by Darin Adler.
Add a generateThreadSafeObjectIdentifier() for generating an ObjectIdentifier
in a thread-safe manner, using std::atomic.
* wtf/ObjectIdentifier.h:
(WTF::generateObjectIdentifier):
(WTF::generateThreadSafeObjectIdentifier):
2017-11-18 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Remove CPU(HPPA) in StackBounds by using runtime stack direction test
https://bugs.webkit.org/show_bug.cgi?id=179859
Reviewed by JF Bastien.
Currently, we know that CPU(HPPA)'s stack direction is upward! But listing
CPU architectures here is not a scalable way.
Instead, we use runtime stack direction test. By doing so, we can handle
such a strange architecture without listing the CPU to Platform.h. This paves
the way to dropping many CPUs in Platform.h by replacing them with CPU(UNKNOWN)[1].
We also fix StackBounds::isGrowingDownward().
[1]: https://bugs.webkit.org/show_bug.cgi?id=179243
* wtf/StackBounds.cpp:
(WTF::StackBounds::stackDirection):
(WTF::testStackDirection2):
(WTF::testStackDirection):
(WTF::StackBounds::newThreadStackBounds):
(WTF::StackBounds::currentThreadStackBoundsInternal):
* wtf/StackBounds.h:
(WTF::StackBounds::isGrowingDownward const):
2017-11-17 Chris Dumez <cdumez@apple.com>
Use a strongly typed identifier for SWServer::Connection
https://bugs.webkit.org/show_bug.cgi?id=179848
Reviewed by Brady Eidson.
Make ObjectIdentifier a little more flexible to support more use cases.
* wtf/ObjectIdentifier.h:
(WTF::ObjectIdentifier::toUInt64 const):
(WTF::makeObjectIdentifier):
2017-11-17 Simon Fraser <simon.fraser@apple.com>
Add a TimingScope class for microbenchmarking sections of code
https://bugs.webkit.org/show_bug.cgi?id=179825
Reviewed by Zalan Bujtas.
Add a class, similar to B3TimingScope, which makes it easy to microbenchmark
sections of code. Use looks like:
TimingScope scope("some label", 100);
where this will print mean scope duration every 100 calls. Sample output:
FETurbulence::platformApplySoftware: 100 calls, mean duration: 3.073181ms
FETurbulence::platformApplySoftware: 200 calls, mean duration: 3.074612ms
FETurbulence::platformApplySoftware: 300 calls, mean duration: 3.065722ms
Because TimingScope needs to store state beween invocations, and there may be
multiple TimingScopes in use at the same time, data is stored in a global
hash map with atomic access.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/TimingScope.cpp: Added.
(WTF::TimingScope::scopeDidEnd):
* wtf/TimingScope.h: Added.
(WTF::TimingScope::TimingScope):
(WTF::TimingScope::~TimingScope):
2017-11-17 Alex Christensen <achristensen@webkit.org>
Clean up after r224952
https://bugs.webkit.org/show_bug.cgi?id=179809
Reviewed by Brady Eidson.
* wtf/MainThread.cpp:
(WTF::dispatchFunctionsFromMainThread):
(WTF::callOnMainThread):
* wtf/MainThread.h:
* wtf/generic/MainThreadGeneric.cpp:
(WTF::scheduleDispatchFunctionsOnMainThread):
(WTF::currentRunLoopInCommonMode): Deleted.
* wtf/mac/MainThreadMac.mm:
(WTF::scheduleDispatchFunctionsOnMainThread):
(WTF::currentRunLoopInCommonMode): Deleted.
* wtf/win/MainThreadWin.cpp:
(WTF::scheduleDispatchFunctionsOnMainThread):
(WTF::currentRunLoopInCommonMode): Deleted.
2017-11-15 Alex Christensen <achristensen@webkit.org>
Fix fast/events/message-port-postMessage-recursive.html after r224896
https://bugs.webkit.org/show_bug.cgi?id=179749
Reviewed by Jer Noble.
* wtf/mac/MainThreadMac.mm:
(WTF::currentRunLoopInCommonMode):
We sometimes run the runloop in kCFRunLoopDefaultMode, which should also have the responsiveness optimization.
This allows the runloop to continue to iterate when we are doing lots of things on the main thread.
CFRunLoop.h has a special definition of these two constants.
2017-11-15 Alex Christensen <achristensen@webkit.org>
WebViews scheduled in custom run loop modes should be able to do more than 50ms of work at a time
https://bugs.webkit.org/show_bug.cgi?id=179742
<rdar://problem/35519421>
Reviewed by Jer Noble.
In r224687 I fixed loading from scheduled WebViews with custom run loop modes, but in
dispatchFunctionsFromMainThread we have an optimization to yield the run loop if we have already
done more than 50ms of work on the main thread in this run loop iteration. When this happens
and we are running in a custom run loop mode, we disable this responsiveness optimization.
We are calling CFRunLoopRunInMode or [NSRunLoop acceptInputForMode:beforeDate:] in a while loop anyways,
so we would not benefit from a responsiveness optimization. We definitely don't want to reschedule
on the main thread in the common run loop mode in this case.
* wtf/MainThread.cpp:
(WTF::dispatchFunctionsFromMainThread):
* wtf/MainThread.h:
* wtf/generic/MainThreadGeneric.cpp:
(WTF::currentRunLoopInCommonMode):
* wtf/mac/MainThreadMac.mm:
(WTF::currentRunLoopInCommonMode):
* wtf/win/MainThreadWin.cpp:
(WTF::currentRunLoopInCommonMode):
2017-11-15 Ryan Haddad <ryanhaddad@apple.com>
Unreviewed, rolling out r224863.
Introduced LayoutTest crashes on iOS Simulator.
Reverted changeset:
"Move JSONValues to WTF and convert uses of InspectorValues.h
to JSONValues.h"
https://bugs.webkit.org/show_bug.cgi?id=173793
https://trac.webkit.org/changeset/224863
2017-11-14 Carlos Garcia Campos <cgarcia@igalia.com>
Move JSONValues to WTF and convert uses of InspectorValues.h to JSONValues.h
https://bugs.webkit.org/show_bug.cgi?id=173793
Reviewed by Brian Burg.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/JSONValues.cpp: Renamed from Source/JavaScriptCore/inspector/InspectorValues.cpp.
(JSON::Value::null):
(JSON::Value::create):
(JSON::Value::asValue):
(JSON::Value::asObject):
(JSON::Value::asArray):
(JSON::Value::parseJSON):
(JSON::Value::toJSONString const):
(JSON::Value::asBoolean const):
(JSON::Value::asDouble const):
(JSON::Value::asInteger const):
(JSON::Value::asString const):
(JSON::Value::writeJSON const):
(JSON::Value::memoryCost const):
(JSON::ObjectBase::~ObjectBase):
(JSON::ObjectBase::asObject):
(JSON::ObjectBase::openAccessors):
(JSON::ObjectBase::memoryCost const):
(JSON::ObjectBase::getBoolean const):
(JSON::ObjectBase::getString const):
(JSON::ObjectBase::getObject const):
(JSON::ObjectBase::getArray const):
(JSON::ObjectBase::getValue const):
(JSON::ObjectBase::remove):
(JSON::ObjectBase::writeJSON const):
(JSON::ObjectBase::ObjectBase):
(JSON::ArrayBase::~ArrayBase):
(JSON::ArrayBase::asArray):
(JSON::ArrayBase::writeJSON const):
(JSON::ArrayBase::ArrayBase):
(JSON::ArrayBase::get const):
(JSON::Object::create):
(JSON::Array::create):
(JSON::ArrayBase::memoryCost const):
* wtf/JSONValues.h: Renamed from Source/JavaScriptCore/inspector/InspectorValues.h.
(JSON::ObjectBase::find):
(JSON::ObjectBase::find const):
(JSON::ObjectBase::setBoolean):
(JSON::ObjectBase::setInteger):
(JSON::ObjectBase::setDouble):
(JSON::ObjectBase::setString):
(JSON::ObjectBase::setValue):
(JSON::ObjectBase::setObject):
(JSON::ObjectBase::setArray):
(JSON::ArrayBase::pushBoolean):
(JSON::ArrayBase::pushInteger):
(JSON::ArrayBase::pushDouble):
(JSON::ArrayBase::pushString):
(JSON::ArrayBase::pushValue):
(JSON::ArrayBase::pushObject):
(JSON::ArrayBase::pushArray):
2017-11-14 Alex Christensen <achristensen@webkit.org>
Remove Cocoa CFURLConnection loading code
https://bugs.webkit.org/show_bug.cgi?id=179688
Reviewed by Antti Koivisto.
* wtf/SchedulePair.h:
* wtf/SchedulePairMac.mm:
2017-11-13 Brady Eidson <beidson@apple.com>
Massive "Server-process-to-context-process" connection overhaul.
https://bugs.webkit.org/show_bug.cgi?id=179554
Reviewed by Chris Dumez.
* wtf/ObjectIdentifier.h:
(WTF::generateObjectIdentifier):
(WTF::makeObjectIdentifier): Deleted.
2017-11-13 JF Bastien <jfbastien@apple.com>
std::expected: fix and test move
https://bugs.webkit.org/show_bug.cgi?id=179617
Reviewed by Alex Christensen.
Non-copyable move types should be able to be in an expected
properly.
* wtf/Expected.h:
(WTF::Expected::value const):
(WTF::Expected::error):
(WTF::Expected::error const):
2017-11-10 Jer Noble <jer.noble@apple.com>
Add a FairPlay Streaming based CDM for Modern EME
https://bugs.webkit.org/show_bug.cgi?id=179499
<rdar://problem/35445033>
Reviewed by Eric Carlson.
* wtf/Platform.h:
2017-11-10 Alex Christensen <achristensen@webkit.org>
REGRESSION(r224267): WebViews scheduled with custom run loop modes don't load
https://bugs.webkit.org/show_bug.cgi?id=179515
<rdar://problem/35445245>
Reviewed by Andy Estes.
* wtf/MainThread.cpp:
(WTF::callOnMainThread):
* wtf/MainThread.h:
(WTF::callOnMainThread):
(WTF::scheduleDispatchFunctionsOnMainThread):
* wtf/generic/MainThreadGeneric.cpp:
(WTF::scheduleDispatchFunctionsOnMainThread):
* wtf/mac/MainThreadMac.mm:
(WTF::scheduleDispatchFunctionsOnMainThread):
* wtf/win/MainThreadWin.cpp:
(WTF::scheduleDispatchFunctionsOnMainThread):
Add an optional parameter which is an array of run loop mode names to pass to performSelectorOnMainThread.
2017-11-10 Ms2ger <Ms2ger@igalia.com>
Export tryFastZeroedMalloc.
https://bugs.webkit.org/show_bug.cgi?id=179051
Reviewed by Michael Catanzaro.
The other functions were exported in bug 72855. There does not seem to be a
reason not to export this one.
* wtf/FastMalloc.h:
2017-11-09 Chris Dumez <cdumez@apple.com>
Unreviewed, rolling out r224661.
Broke build on several internal Mac/iOS bots
Reverted changeset:
"Ignore HSTS for partitioned, cross-origin subresource
requests"
https://bugs.webkit.org/show_bug.cgi?id=178993
https://trac.webkit.org/changeset/224661
2017-11-09 John Wilander <wilander@apple.com>
Ignore HSTS for partitioned, cross-origin subresource requests
https://bugs.webkit.org/show_bug.cgi?id=178993
<rdar://problem/34962462>
Reviewed by Brent Fulgham.
* wtf/Platform.h:
Added HAVE_CFNETWORK_IGNORE_HSTS.
2017-11-08 Tim Horton <timothy_horton@apple.com>
[ios-simulator] API test WebKit.BundleParameters is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=178363
<rdar://problem/35043144>
Reviewed by Brent Fulgham.
* wtf/RefCounter.h:
(WTF::RefCounter<T>::Count::deref):
(WTF::RefCounter<T>::Count::refCounterWasDeleted):
(WTF::RefCounter<T>::~RefCounter):
If a RefCounter::Count is deref()'d and drops its RefCounter's value to
zero, and the RefCounter is deleted in that valueDidChangeCallback, it
will delete the Counter that is in the middle of deref(). Keep track
of whether we're inside the callback and defer the deletion until
the end of deref().
2017-11-07 Maciej Stachowiak <mjs@apple.com>
Get rid of unsightly hex numbers from unified build object files
https://bugs.webkit.org/show_bug.cgi?id=179410
Reviewed by Saam Barati.
* Scripts/generate-unified-source-bundles.rb: For extensions other than "cpp", also include
the extension in the base name of the file, to avoid ugly Xcode-generated object file names.
2017-11-07 Filip Pizlo <fpizlo@apple.com>
Disable isoheaps on iOS
Reviewed by Ryosuke Niwa.
* wtf/IsoMalloc.h:
2017-11-07 Brady Eidson <beidson@apple.com>
Implement "UpdateWorkerState" and use it
https://bugs.webkit.org/show_bug.cgi?id=179318
Reviewed by Chris Dumez.
* wtf/ObjectIdentifier.h:
(WTF::ObjectIdentifier::loggingString const):
2017-11-07 Michael Saboff <msaboff@apple.com>
Add SPI function pointers qualifiers for CPU(ARM64E)
https://bugs.webkit.org/show_bug.cgi?id=179383
Reviewed by Mark Lam.
For ARM64E, use the appropriate SPI qualifiers for helper function pointers.
* wtf/BlockPtr.h:
(WTF::BlockPtr<R):
2017-10-31 Filip Pizlo <fpizlo@apple.com>
bmalloc should support strictly type-segregated isolated heaps
https://bugs.webkit.org/show_bug.cgi?id=178108
Reviewed by Saam Barati, Simon Fraser, and Ryosuke Niwa.
This just adds an easy way of using the bmalloc IsoHeap API in WebKit. If bmalloc is not
enabled, these macros will just make the object FastMalloced.
* WTF.xcodeproj/project.pbxproj:
* wtf/FastTLS.h:
* wtf/IsoMalloc.h: Added.
* wtf/IsoMallocInlines.h: Added.
2017-11-06 Christopher Reid <chris.reid@sony.com>
Use enum classes within FileSystem
https://bugs.webkit.org/show_bug.cgi?id=175172
Reviewed by Myles C. Maxfield.
Adding a helper function for converting enum classes to their underlying type when necessary.
* wtf/EnumTraits.h:
2017-11-06 Michael Catanzaro <mcatanzaro@igalia.com>
[WPE][GTK] Always use SET_AND_EXPOSE_TO_BUILD to set build variables
https://bugs.webkit.org/show_bug.cgi?id=179038
Reviewed by Žan Doberšek.
* wtf/Platform.h:
2017-11-03 Chris Dumez <cdumez@apple.com>
Use a single identifier type to identify Service Workers
https://bugs.webkit.org/show_bug.cgi?id=179192
Reviewed by Brady Eidson.
Introduce class for strongly typed identifiers. This avoids mixing up
different types of identifiers.
* WTF.xcodeproj/project.pbxproj:
* wtf/ObjectIdentifier.h: Added.
(WTF::ObjectIdentifier::encode const):
(WTF::ObjectIdentifier::decode):
(WTF::ObjectIdentifier::operator== const):
(WTF::ObjectIdentifier::operator!= const):
(WTF::ObjectIdentifier::ObjectIdentifier):
(WTF::makeObjectIdentifier):
(WTF::ObjectIdentifierHash::hash):
(WTF::ObjectIdentifierHash::equal):
(WTF::HashTraits<ObjectIdentifier<T>>::emptyValue):
(WTF::HashTraits<ObjectIdentifier<T>>::constructDeletedValue):
(WTF::HashTraits<ObjectIdentifier<T>>::isDeletedValue):
2017-11-02 Ryan Haddad <ryanhaddad@apple.com>
Unreviewed, rolling out r224353.
Breaks internal builds.
Reverted changeset:
"Ignore HSTS for partitioned, cross-origin subresource
requests"
https://bugs.webkit.org/show_bug.cgi?id=178993
https://trac.webkit.org/changeset/224353
2017-11-02 John Wilander <wilander@apple.com>
Ignore HSTS for partitioned, cross-origin subresource requests
https://bugs.webkit.org/show_bug.cgi?id=178993
<rdar://problem/34962462>
Reviewed by Brent Fulgham and Alex Christensen.
* wtf/Platform.h:
Added HAVE_CFNETWORK_IGNORE_HSTS.
2017-11-02 Frederic Wang <fwang@igalia.com>
Add references to bug 179167 in FIXME comments
https://bugs.webkit.org/show_bug.cgi?id=179168
Reviewed by Daniel Bates.
* wtf/FeatureDefines.h:
2017-11-01 Jiewen Tan <jiewen_tan@apple.com>
Let is<T>() accept RefPtrs
https://bugs.webkit.org/show_bug.cgi?id=178612
<rdar://problem/35102004>
Reviewed by Ryosuke Niwa.
Add support for is<T>() for RefPtrs.
* wtf/RefPtr.h:
(WTF::is):
2017-11-01 Simon Fraser <simon.fraser@apple.com>
Misc display list and other cleanup
https://bugs.webkit.org/show_bug.cgi?id=179150
Reviewed by Tim Horton.
Add system trace points for display list recording.
* wtf/SystemTracing.h:
2017-11-01 Fujii Hironori <Hironori.Fujii@sony.com>
Use LazyNeverDestroyed instead of DEFINE_GLOBAL
https://bugs.webkit.org/show_bug.cgi?id=174979
Reviewed by Yusuke Suzuki.
DEFINE_GLOBAL is not used anymore. Remove it.
* WTF.xcodeproj/project.pbxproj: Removed StaticConstructors.h
* config.h: Removed definitions of SKIP_STATIC_CONSTRUCTORS_ON_MSVC and SKIP_STATIC_CONSTRUCTORS_ON_GCC.
* wtf/CMakeLists.txt: Removed StaticConstructors.h
* wtf/StaticConstructors.h: Removed.
2017-10-30 Michael Catanzaro <mcatanzaro@igalia.com>
[WPE] Fix build warnings
https://bugs.webkit.org/show_bug.cgi?id=178899
Reviewed by Carlos Alberto Lopez Perez.
* wtf/PlatformWPE.cmake:
2017-10-27 Yousuke Kimoto <yousuke.kimoto@sony.com>
[WinCairo] Add WTF files for wincairo webkit
https://bugs.webkit.org/show_bug.cgi?id=176894
Reviewed by Alex Christensen.
* wtf/PlatformWin.cmake:
* wtf/WorkQueue.cpp:
* wtf/WorkQueue.h:
* wtf/win/Win32Handle.h:
* wtf/win/WorkItemContext.cpp: Added.
(WTF::WorkItemContext::WorkItemContext):
(WTF::WorkItemContext::create):
(WTF::WorkItemContext::~WorkItemContext):
* wtf/win/WorkItemContext.h: Added.
(WTF::WorkItemContext::handle):
(WTF::WorkItemContext::waitHandle):
(WTF::WorkItemContext::Function<void):
(WTF::WorkItemContext::queue const):
* wtf/win/WorkQueueWin.cpp:
(WTF::WorkQueue::handleCallback):
(WTF::WorkQueue::registerHandle):
(WTF::WorkQueue::unregisterAndCloseHandle):
(WTF::WorkQueue::unregisterWaitAndDestroyItemSoon):
(WTF::WorkQueue::unregisterWaitAndDestroyItemCallback):
2017-10-27 Keith Miller <keith_miller@apple.com>
Add unified source list files and build scripts to Xcode project navigator
https://bugs.webkit.org/show_bug.cgi?id=178959
Reviewed by Andy Estes.
* WTF.xcodeproj/project.pbxproj:
2017-10-26 Mark Lam <mark.lam@apple.com>
JSRopeString::RopeBuilder::append() should check for overflows.
https://bugs.webkit.org/show_bug.cgi?id=178385
<rdar://problem/35027468>
Reviewed by Saam Barati.
* wtf/CheckedArithmetic.h:
2017-10-25 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r222945.
https://bugs.webkit.org/show_bug.cgi?id=178818
"It made WasmBench crash" (Requested by saamyjoon on #webkit).
Reverted changeset:
"bmalloc mutex should be adaptive"
https://bugs.webkit.org/show_bug.cgi?id=177839
https://trac.webkit.org/changeset/222945
2017-10-25 Zan Dobersek <zdobersek@igalia.com>
Make SERVICE_WORKER feature buildable on GTK, WPE
https://bugs.webkit.org/show_bug.cgi?id=178574
Reviewed by Carlos Garcia Campos.
* wtf/Identified.h: Explicitly include the <atomic> header since
std::atomic<> is used in the ThreadSafeIdentified definition.
2017-10-24 Michael Saboff <msaboff@apple.com>
WTF: Eliminated PLATFORM checks for HAVE_MACH_EXCEPTIONS
https://bugs.webkit.org/show_bug.cgi?id=178747
Reviewed by Saam Barati.
Removed unnecessary PLATFORM checks as they can cause build failures
when the include file is present.
* wtf/Platform.h:
2017-10-23 Yusuke Suzuki <utatane.tea@gmail.com>
[JSC] Use fastJoin in Array#toString
https://bugs.webkit.org/show_bug.cgi?id=178062
Reviewed by Darin Adler.
A bit cleaning up to use StringImpl::copyChars instead of
using for-loop directly.
* wtf/text/StringView.h:
(WTF::StringView::getCharactersWithUpconvert const):
2017-10-20 Antoine Quint <graouts@apple.com>
[Web Animations] Provide basic timeline and animation interfaces
https://bugs.webkit.org/show_bug.cgi?id=178526
Reviewed by Dean Jackson.
Remove the WEB_ANIMATIONS compile-time flag.
* wtf/FeatureDefines.h:
2017-10-19 Keith Miller <keith_miller@apple.com>
REGRESSION (r223476): WebCore exports symbols with names belonging to other frameworks
https://bugs.webkit.org/show_bug.cgi?id=178424
Reviewed by David Kilzer.
This patch moves the wrapper function sharing the name of the externed function
to the source file and marks it as always inline. Marking it as inline prevents
the framework from exporting it.
* wtf/cocoa/SoftLinking.h:
2017-10-18 Keith Miller <keith_miller@apple.com>
Setup WebCore build to start using unified sources.
https://bugs.webkit.org/show_bug.cgi?id=178362
Reviewed by Tim Horton.
There are a number of changes to the bundler script. First, it is
now possible to enable or disable building files based on if the
associated feature flag is enabled or not. The syntax for this is
similar to how we do #ifs in C++ code. e.g.
#if ENABLE_APPLE_PAY
myApplePayFile.cpp
#endif
would enable myApplePayFile.cpp if and only if the APPLE_PAY
feature define is set.
I also changed comments from # to // to make it less likely they
would be confused with a #if.
Finally, this patch enables bundling files in the same relative
directory across source list files. Previously, if
SourcesCocoa.txt had platform/cf/foo.cpp and SourcesMac.txt had
platform/cf/bar.cpp those files would not be put in the same
unified source bundle. Now, those files will be put into the same
bundle but bar.cpp will always follow foo.cpp. The idea is that by
putting more specific files after more general files we can avoid
random build failures.
* Scripts/generate-unified-source-bundles.rb:
2017-10-18 Konstantin Tokarev <annulen@yandex.ru>
REGRESSION(r217771): nullTerminatedWCharToString loses last character of input string
https://bugs.webkit.org/show_bug.cgi?id=178444
Reviewed by Per Arne Vollan.
* wtf/text/win/WCharStringExtras.h:
(WTF::nullTerminatedWCharToString):
2017-10-17 Keith Miller <keith_miller@apple.com>
Change WebCore sources to work with unified source builds
https://bugs.webkit.org/show_bug.cgi?id=178229
Rubber stamped by Tim Horton.
* wtf/Platform.h:
* wtf/cocoa/SoftLinking.h:
2017-10-16 David Kilzer <ddkilzer@apple.com>
Add RELEASE_ASSERT_WITH_SECURITY_IMPLICATION() macro
<https://webkit.org/b/178269>
Reviewed by Alex Christensen.
* wtf/Assertions.h:
(RELEASE_ASSERT_WITH_SECURITY_IMPLICATION): Add macro.
2017-10-14 Sam Weinig <sam@webkit.org>
Remove HashCountedSet's copyToVector functions
https://bugs.webkit.org/show_bug.cgi?id=178215
Reviewed by Daniel Bates.
* wtf/HashCountedSet.h:
(WTF::copyToVector): Deleted.
They are replaced by either copyToVector(hashCountedSet) or copyToVector(hashCountedSet.values())
2017-10-13 Sam Weinig <sam@webkit.org>
Adopt type trait template aliases everywhere in WTF
https://bugs.webkit.org/show_bug.cgi?id=178299
Reviewed by Yusuke Suzuki.
Adopt type trait template aliases (e.g. replace 'typename std::make_unsigned<Source>::type'
with 'std::make_unsigned_t<Source>'). Also adopt using over typedef consistently.
* wtf/Atomics.h:
* wtf/CagedUniquePtr.h:
* wtf/CheckedArithmetic.h:
* wtf/CompletionHandler.h:
* wtf/Function.h:
* wtf/HashCountedSet.h:
* wtf/HashFunctions.h:
* wtf/HashMap.h:
* wtf/HashSet.h:
* wtf/HashTable.h:
* wtf/HashTraits.h:
* wtf/IndexedContainerIterator.h:
* wtf/IteratorAdaptors.h:
* wtf/KeyValuePair.h:
* wtf/LEBDecoder.h:
* wtf/ListHashSet.h:
* wtf/MathExtras.h:
* wtf/NeverDestroyed.h:
* wtf/OptionSet.h:
* wtf/RetainPtr.h:
* wtf/SizeLimits.cpp:
* wtf/StdLibExtras.h:
* wtf/SystemFree.h:
* wtf/ThreadSpecific.h:
* wtf/TypeCasts.h:
* wtf/Vector.h:
* wtf/text/IntegerToStringConversion.h:
2017-10-13 Jer Noble <jer.noble@apple.com>
Performance: Skip texture upload if source image and destination texture haven't changed
https://bugs.webkit.org/show_bug.cgi?id=178254
<rdar://problem/34968181>
Reviewed by Dean Jackson.
Add a new class, UnsafePointer, for safely holding pointers to objects with uncontrolled lifetimes.
* WTF.xcodeproj/project.pbxproj:
* wtf/UnsafePointer.h: Added.
(WTF::UnsafePointer::UnsafePointer):
(WTF::UnsafePointer::operator== const):
(WTF::UnsafePointer::operator!= const):
(WTF::UnsafePointer::operator bool const):
(WTF::operator==):
(WTF::operator!=):
2017-10-13 Per Arne Vollan <pvollan@apple.com>
[Win] When built with VS2017, MiniBrowser crashes on startup.
https://bugs.webkit.org/show_bug.cgi?id=175209
Reviewed by Daniel Bates.
Add AtomicString(const StaticStringImpl*) constructor. This is needed since
this patch adds constexpr to the static, global StaticStringImpl objects
generated in WebCore/bindings/scripts/StaticString.pm.
* wtf/text/AtomicString.h:
(WTF::AtomicString::AtomicString):
* wtf/text/AtomicStringImpl.cpp:
(WTF::addStatic):
(WTF::AtomicStringImpl::add):
* wtf/text/AtomicStringImpl.h:
* wtf/text/StringImpl.h:
(WTF::StringImpl::assertHashIsCorrect const):
(WTF::StringImpl::assertHashIsCorrect): Deleted.
2017-10-12 Alex Christensen <achristensen@webkit.org>
Add Expected, HashMap, HashSet, and SHA1 to wtf/Forward.h
https://bugs.webkit.org/show_bug.cgi?id=178243
Reviewed by Tim Horton.
* wtf/Forward.h:
* wtf/HashMap.h:
Move default parameters to Forward.h like we did with Vector.
* wtf/HashSet.h:
Also fix indentation.
2017-10-12 Alex Christensen <achristensen@webkit.org>
Add CompletionHandler and HashCountedSet to wtf/Forward.h
https://bugs.webkit.org/show_bug.cgi?id=178231
Reviewed by Tim Horton.
* wtf/Forward.h:
* wtf/HashCountedSet.h:
2017-10-11 Sam Weinig <sam@webkit.org>
Remove out-parameter variants of copyToVector
https://bugs.webkit.org/show_bug.cgi?id=178155
Reviewed by Tim Horton.
* wtf/HashMap.h:
(WTF::copyToVector): Deleted.
* wtf/HashSet.h:
(WTF::copyToVector): Deleted.
Remove copyToVector.
* wtf/Vector.h:
(WTF::copyToVectorSpecialization):
Add another version of copyToVector, called copyToVectorSpecialization, that allows
you to specify the entire specialization for the Vector you want to copy to. This
can be useful if you want your resulting Vector to have an inline capacity.
2017-10-12 Sam Weinig <sam@webkit.org>
It should be possible to iterate just the values (and not the counts) of a HashCountedSet
https://bugs.webkit.org/show_bug.cgi?id=178169
Reviewed by Daniel Bates.
Cleanup (fix indentation, simplify type names, adopt using), and add a values() range to
HashCountedSet. This will allow getting a Vector of all the values (and not the counts)
using the new copyToVector.
* wtf/HashCountedSet.h:
2017-10-11 Michael Saboff <msaboff@apple.com>
[JSC] Add ability to build with ARMV8 ILP32 ABI
https://bugs.webkit.org/show_bug.cgi?id=178194
Reviewed by Saam Barati.
For ARMV8 32 bit ABI, use JSVALUE32_64 and the CLOOP.
* wtf/Platform.h:
2017-10-11 Youenn Fablet <youenn@apple.com>
Add API to clean CacheStorage data
https://bugs.webkit.org/show_bug.cgi?id=178034
Reviewed by Chris Dumez.
Moving CallbackAggregator pattern into its own class for easier reuse.
* WTF.xcodeproj/project.pbxproj:
* wtf/CallbackAggregator.h: Added.
(WTF::CallbackAggregator::create):
(WTF::CallbackAggregator::~CallbackAggregator):
(WTF::CallbackAggregator::CallbackAggregator):
2017-10-10 Sam Weinig <sam@webkit.org>
Replace copyKeysToVector/copyValuesToVector with copyToVector(map.keys())/copyToVector(map.values())
https://bugs.webkit.org/show_bug.cgi?id=178102
Reviewed by Tim Horton.
* wtf/HashMap.h:
(WTF::copyKeysToVector): Deleted.
(WTF::copyValuesToVector): Deleted.
Remove copyKeysToVector and copyValuesToVector which are no longer used.
2017-10-09 Youenn Fablet <youenn@apple.com>
Vector should be able to easily create from a list of movable only items
https://bugs.webkit.org/show_bug.cgi?id=176432
Reviewed by Darin Adler.
Adding static from method to construct a Vector from movable-only items.
This may also be used instead of initializer list constructor for types that would benefit of being moved.
* wtf/Vector.h:
(WTF::Vector::Vector):
(WTF::Vector::from):
(WTF::Vector::uncheckedInitialize): Introduced as an optimization to set the vector size once.
(WTF::Malloc>::reserveInitialCapacity):
2017-10-09 Tim Horton <timothy_horton@apple.com>
Disable INPUT_TYPE_COLOR in FeatureDefines.h
https://bugs.webkit.org/show_bug.cgi?id=178103
<rdar://problem/34872127>
Reviewed by Simon Fraser.
* wtf/FeatureDefines.h:
Because FeatureDefines.h overrides features that are not enabled in
FeatureDefines.xcconfig, you currently have to turn INPUT_TYPE_COLOR
off in two places. Since we only ever want it on for Mac, it's OK
to depend on the xcconfig defining it.
2017-10-09 Sam Weinig <sam@webkit.org>
Make HashMap::keys() and HashMap::values() work with WTF::map/WTF::copyToVector
https://bugs.webkit.org/show_bug.cgi?id=178072
Reviewed by Darin Adler.
Introduce SizedIteratorRange, a variant of IteratorRange that includes
a reference to a backing container in order to get the size of container.
This is useful for algorithms like WTF::map and WTF::copyToVector, that
can use the size to efficiently allocate things of the correct size.
The main beneficiary are HashMap's keys() and values() functions which
used to return IteratorRanges and now return SizedIteratorRange. This
allows us to remove (in a future change) copyKeysToVector() and
copyValuesToVector() by replacing them with copyToVector(map.keys()) and
copyToVector(map.values()) respectively.
* wtf/HashMap.h:
* wtf/IteratorRange.h:
(WTF::SizedIteratorRange::SizedIteratorRange):
(WTF::SizedIteratorRange::size const):
(WTF::SizedIteratorRange::begin const):
(WTF::SizedIteratorRange::end const):
(WTF::makeSizedIteratorRange):
2017-10-08 Sam Weinig <sam@webkit.org>
It should be possible to create a ListHashSet with a std::initializer_list.
https://bugs.webkit.org/show_bug.cgi?id=178070
Reviewed by Darin Adler.
* wtf/ListHashSet.h:
(WTF::U>::ListHashSet):
Add a constructor that takes a std::initializer_list.
2017-10-08 Sam Weinig <sam@webkit.org>
Address additional feedback from Darin for r223039 and sort the using declarations.
* wtf/Vector.h:
2017-10-08 Sam Weinig <sam@webkit.org>
There should be a version of copyToVector that returns a Vector, rather than using an out parameter
https://bugs.webkit.org/show_bug.cgi?id=177732
Reviewed by Saam Barati.
Add two new helper functions, copyToVector and copyToVectorOf, which will be able to
replace the existing out parameter taking copyToVector. Like it's ancestral namesake,
copyToVector takes an object that is both iterable (supports begin() and end()) and
has a size, and returns a Vector with a copy of all the items iterated. The copyToVectorOf
variant allow the user to specify a type to convert to, so if you have a HashSet<int>
but want those as floats in a Vector, you can do:
auto floatVector = copyToVectorOf<float>(intSet);
* wtf/Vector.h:
(WTF::copyToVector):
(WTF::copyToVectorOf):
2017-10-08 Darin Adler <darin@apple.com>
Fix bugs related to setting reflected floating point DOM attributes
https://bugs.webkit.org/show_bug.cgi?id=178061
Reviewed by Sam Weinig.
* wtf/dtoa.cpp:
(WTF::formatStringTruncatingTrailingZerosIfNeeded): Fix a bug where
this function would remove trailing zeroes from the exponent if
present instead of from the mantissa. This meant that it would
format 1e10 as "1.00000e+1" instead of "1e+10". Added regression
tests for this to TestWebKitAPI.
* wtf/dtoa/utils.h:
(WTF::double_conversion::StringBuilder::RemoveCharacters): Added.
Used by the fix above.
* wtf/text/AtomicString.cpp:
(WTF::AtomicString::number): Note: This function is used by code
that sets the values of reflected floating point DOM attributes.
Changed the function to use the rules from numberToString rather
ones from numberToFixedPrecisionString. This is analogous to
String::numberToStringECMAScript, and in the future we should change
String and StringBuilder so this "ECMAScript" semantic is the default
way to convert a floating point number to a string, and rename the fixed
precision version that is currently called String::number. I audited
the small number of sites calling AtomicString::number, by temporarily
renaming it, and discovered that this is the correct behavior for all;
none needed fixed precision. Also, fixed a mistake where this explicitly
converted to String. That was defeating the purpose of having these
functions in AtomicString: It would allocate a new String and then
destroy it in the case where an equal string was already in the
AtomicString table.
2017-10-06 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r222791 and r222873.
https://bugs.webkit.org/show_bug.cgi?id=178031
Caused crashes with workers/wasm LayoutTests (Requested by
ryanhaddad on #webkit).
Reverted changesets:
"WebAssembly: no VM / JS version of everything but Instance"
https://bugs.webkit.org/show_bug.cgi?id=177473
http://trac.webkit.org/changeset/222791
"WebAssembly: address no VM / JS follow-ups"
https://bugs.webkit.org/show_bug.cgi?id=177887
http://trac.webkit.org/changeset/222873
2017-10-06 Antti Koivisto <antti@apple.com>
Minor WeakPtr improvements
https://bugs.webkit.org/show_bug.cgi?id=177958
Reviewed by Sam Weinig.
* wtf/WeakPtr.h:
(WTF::WeakPtr::operator bool const):
Make explicit.
(WTF::WeakPtrFactory::createWeakPtr const):
(WTF::makeWeakPtr):
Remove templating from createWeakPtr, makeWeakPtr() is now the
canonical way to make derived-type WeakPtrs.
2017-10-04 Filip Pizlo <fpizlo@apple.com>
bmalloc mutex should be adaptive
https://bugs.webkit.org/show_bug.cgi?id=177839
Reviewed by Michael Saboff.
Add some comments that I thought of while copy-pasting this code.
Reland after fixing ancient WordLock bug: the notify_one has to happen with the lock held
to ensure it doesn't run after that thread has died.
* wtf/LockAlgorithmInlines.h:
* wtf/WordLock.cpp:
2017-10-05 Carlos Alberto Lopez Perez <clopez@igalia.com>
Generate a compile error if release is built without compiler optimizations
https://bugs.webkit.org/show_bug.cgi?id=177665
Reviewed by Brian Burg.
For GCC and Clang, generate an error at build time that will alert
the developer that she is trying to build Release without any compiler
optimization. A build time error is much better than an unexpected
"oh, WebKit is really slow ..." situation later.
If this was intended, then we tell the developer that she can continue
by just setting -DRELEASE_WITHOUT_OPTIMIZATIONS in the list of build
flags.
The intention of this patch is to ensure that nobody builds Release
without enabling compiler optimization by mistake.
* wtf/Compiler.h:
2017-10-05 David Kilzer <ddkilzer@apple.com>
Bug 177893: Disable -Wcast-qual for new clang compiler in Apple ports
<https://webkit.org/b/177893>
<rdar://problem/33667497>
Reviewed by Tim Horton.
* wtf/RetainPtr.h:
(WTF::RetainPtr::fromStorageType const): Disable warnings for
-Wcast-qual until we can provide a safe cast function that lets
us re-enable the warning.
2017-10-05 Matt Lewis <jlewis3@apple.com>
Unreviewed, rolling out r222893.
This caused multiple API failures.
Reverted changeset:
"bmalloc mutex should be adaptive"
https://bugs.webkit.org/show_bug.cgi?id=177839
http://trac.webkit.org/changeset/222893
2017-10-04 Filip Pizlo <fpizlo@apple.com>
bmalloc mutex should be adaptive
https://bugs.webkit.org/show_bug.cgi?id=177839
Reviewed by Michael Saboff.
Add some comments that I thought of while copy-pasting this code.
* wtf/LockAlgorithmInlines.h:
* wtf/WordLock.cpp:
2017-10-04 JF Bastien <jfbastien@apple.com>
WTF: Update std::expected to match current proposal
https://bugs.webkit.org/show_bug.cgi?id=177881
Reviewed by Mark Lam.
The proposal is likely to be in C++20 and I've been asked to help co-champion
it. I'm therefore updating our implementation to more closely match the current
proposal, and to make sure it'll work for us if standardized.
- Rename UnexpectedType to Unexpected to match the proposal.
- Remove relational operators, only equality / inequality remains.
- Fix minor type signatures.
- Add UnexpectedType typedef.
- Uncomment rebind implementation.
- Add in-place construction tag, as well as explicit error construction tag.
- Add template unexpected constructor.
- Note that make_unexpected isn't in the proposal anymore, but we keep it because we don't have C++17 deduction guides.
- Remove hashing, which isn't in the proposal anymore.
* wtf/Expected.h:
(WTF::Unexpected::Unexpected):
(WTF::Unexpected::value const):
(WTF::operator==):
(WTF::operator!=):
(WTF::makeUnexpected):
(WTF::Expected::Expected):
(WTF::Expected::operator=):
(WTF::Expected::getUnexpected const):
2017-10-04 Ryan Haddad <ryanhaddad@apple.com>
Unreviewed, rolling out r222840.
This change breaks internal builds.
Reverted changeset:
"Generate a compile error if release is built without compiler
optimizations"
https://bugs.webkit.org/show_bug.cgi?id=177665
http://trac.webkit.org/changeset/222840
2017-10-04 Carlos Alberto Lopez Perez <clopez@igalia.com>
Generate a compile error if release is built without compiler optimizations
https://bugs.webkit.org/show_bug.cgi?id=177665
Reviewed by Michael Catanzaro.
For GCC and Clang, generate an error at build time that will alert
the developer that she is trying to build Release without any compiler
optimization. A build time error is much better than an unexpected
"oh, WebKit is really slow ..." situation later.
If this was intended, then we tell the developer that she can continue
by just setting -DRELEASE_WITHOUT_OPTIMIZATIONS in the list of build
flags.
The intention of this patch is to ensure that nobody builds Release
without enabling compiler optimization by mistake.
* wtf/Compiler.h:
2017-10-04 Tomas Popela <tpopela@redhat.com>
Allow building without WOFF enabled
Reviewed by Michael Catanzaro.
Don't force the WOFF to be turned on, but follow what is set in cmake.
* wtf/Platform.h:
2017-10-03 Saam Barati <sbarati@apple.com>
Implement polymorphic prototypes
https://bugs.webkit.org/show_bug.cgi?id=176391
Reviewed by Filip Pizlo.
* wtf/Box.h:
(WTF::Box::operator bool const):
(WTF::Box::operator bool): Deleted.
Make Box movable. Also ensure its operator bool doesn't do an atomic increment.
* wtf/RefPtr.h:
(WTF::RefPtr::operator bool const):
Add `explicit operator bool()` for RefPtr.
2017-10-03 Antti Koivisto <antti@apple.com>
Allow assigning WeakPtr<Derived> to WeakPtr<Base>
https://bugs.webkit.org/show_bug.cgi?id=177817
Reviewed by Geoff Garen.
Add templated copy/move constructors/assignment operators, similar to RefPtr.
* wtf/WeakPtr.h:
(WTF::WeakPtrFactory::createWeakPtr const):
(WTF::weak_reference_upcast):
(WTF::weak_reference_downcast):
(WTF::WeakPtr<T>::WeakPtr):
(WTF::=):
(WTF::makeWeakPtr):
2017-10-03 JF Bastien <jfbastien@apple.com>
WebAssembly: no VM / JS version of everything but Instance
https://bugs.webkit.org/show_bug.cgi?id=177473
Reviewed by Filip Pizlo.
* wtf/StdLibExtras.h:
(WTF::default_construct_at): this makes code in WasmTable much
more readable, and is generally useful for generic code
2017-10-02 Myles C. Maxfield <mmaxfield@apple.com>
Move LineEnding.{h,cpp} from WebCore/platform/text to wtf/text
https://bugs.webkit.org/show_bug.cgi?id=176575
Reviewed by Alex Christensen.
As part of the PAL effort, we're trying to move everything out of WebCore/platform, one-by-one.
These LineEnding files belong in WTF.
* WTF.xcodeproj/project.pbxproj:
* wtf/text/LineEnding.cpp: Renamed from Source/WebCore/platform/text/LineEnding.cpp.
(WTF::normalizeLineEndingsToCRLF):
* wtf/text/LineEnding.h: Renamed from Source/WebCore/platform/text/LineEnding.h.
2017-10-02 Geoffrey Garen <ggaren@apple.com>
WeakPtr should have a move constructor
https://bugs.webkit.org/show_bug.cgi?id=177789
Reviewed by Chris Dumez.
* wtf/WeakPtr.h: Now that we just have a RefPtr data member,
the default operators are sufficient.
2017-10-02 Geoffrey Garen <ggaren@apple.com>
NULL WeakPtr should not malloc!
https://bugs.webkit.org/show_bug.cgi?id=177773
Reviewed by Antti Koivisto.
Translating NULL into malloc is... inefficient.
* wtf/WeakPtr.h:
(WTF::WeakPtr::WeakPtr):
(WTF::WeakPtr::operator=):
(WTF::WeakPtr::clear): Make m_ref lazy so that a NULL m_ref can represent
a NULL pointer. Normal dereference is no slower because we can rely on
the fact that dereference of NULL should crash. operator bool() and get()
incur an extra branch. That's probably worth it to avoid malloc
for NULL.
2017-10-02 Antti Koivisto <antti@apple.com>
Add makeWeakPtr variant that takes pointer
https://bugs.webkit.org/show_bug.cgi?id=177767
Reviewed by Zalan Bujtas.
* wtf/WeakPtr.h:
(WTF::makeWeakPtr):
This version deals with the nullptr.
2017-09-30 Antti Koivisto <antti@apple.com>
Add makeWeakPtr for easier WeakPtr construction
https://bugs.webkit.org/show_bug.cgi?id=177706
Reviewed by Sam Weinig.
Standalone makeWeakPtr() returns a WeakPtr of the same type as the argument.
For this to work the argument type needs to expose a (possibly base type) WeakPtrFactory
as a public weakPtrFactory() member function.
* wtf/WeakPtr.h:
(WTF::WeakPtr::operator-> const):
(WTF::WeakPtr::operator* const): Also add operator*.
(WTF::makeWeakPtr):
2017-09-28 Jiewen Tan <jiewen_tan@apple.com>
WeakPtrFactory should allow downcasting
https://bugs.webkit.org/show_bug.cgi?id=177389
<rdar://problem/34604174>
Reviewed by Geoffrey Garen.
In this patch, WeakPtrFactory is enhanced with the ability to create WeakPtrs
of its owner's sub classes and have them point to the same WeakReference.
* wtf/WeakPtr.h:
(WTF::WeakPtr::WeakPtr):
We cannot determine the base class of type T, thus no friends. It is made public
such that WeakPtrFactory with a base class type U can create a derived type T
WeakPtr.
(WTF::WeakPtrFactory::createWeakPtr const):
2017-09-28 Don Olmstead <don.olmstead@sony.com>
Sync SYSTEM_MALLOC implementation of Gigacage
https://bugs.webkit.org/show_bug.cgi?id=177569
Reviewed by Mark Lam.
* wtf/Gigacage.h:
(Gigacage::basePtr):
(Gigacage::basePtrs):
2017-09-27 Per Arne Vollan <pvollan@apple.com>
[Win64] Compile error, 'BasePtrs' is undefined.
https://bugs.webkit.org/show_bug.cgi?id=177565
Reviewed by Mark Lam.
Copy definition of 'BasePtrs' from bmalloc/GigaCage.h.
* wtf/Gigacage.h:
2017-09-26 Said Abou-Hallawa <sabouhallawa@apple.com>
Followup (r222427): SynchronizedFixedQueue should not have a public constructor
https://bugs.webkit.org/show_bug.cgi?id=177458
Reviewed by Tim Horton.
Since SynchronizedFixedQueue is now derived from ThreadSafeRefCounted<SynchronizedFixedQueue>,
the standard way to have an instance of it is to call SynchronizedFixedQueue::create()
which returns a Ref<SynchronizedFixedQueue>. Now it does not make sense to still
have the constructor public.
* wtf/SynchronizedFixedQueue.h:
(WTF::SynchronizedFixedQueue::SynchronizedFixedQueue):
2017-09-24 Keith Miller <keith_miller@apple.com>
JSC build should use unified sources for derived sources
https://bugs.webkit.org/show_bug.cgi?id=177421
Reviewed by JF Bastien.
The script now needs to determine if a file is from a derived
source. This is only relevant for the CMake build since the
script needs to provide a list of the bundled source files. If the
script does not provide the full path for derived sources then
CMake will be unable to find them and the build will fail.
Additionally, I move the error message for the Xcode build outside
the main loop. This means that the error message will contain all
the files you need to add to Xcode and all those files will now be
written in DerivedSources so they should be easier to add.
* Scripts/generate-unified-source-bundles.rb:
2017-09-26 Zan Dobersek <zdobersek@igalia.com>
Support building JavaScriptCore with the Bionic C library
https://bugs.webkit.org/show_bug.cgi?id=177427
Reviewed by Michael Catanzaro.
* wtf/Platform.h: Define HAVE_MACHINE_CONTEXT when __BIONIC__
is defined, i.e. when building with the Bionic C library.
2017-09-23 Said Abou-Hallawa <sabouhallawa@apple.com>
Images may render partial frames even after loading all the encoded data
https://bugs.webkit.org/show_bug.cgi?id=177406
Reviewed by Simon Fraser.
Make it possible to create a RefPtr<SynchronizedFixedQueue>.
* wtf/SynchronizedFixedQueue.h:
(WTF::SynchronizedFixedQueue::create):
(WTF::SynchronizedFixedQueue::enqueue):
(WTF::SynchronizedFixedQueue::dequeue):
2017-09-22 Zalan Bujtas <zalan@apple.com>
WeakPtrFactory should populate m_ref lazily.
https://bugs.webkit.org/show_bug.cgi?id=177375
Reviewed by Geoffrey Garen.
This helps us with the overhead of initializing WeakPtrFactory for
objects that rarely end up creating the weak reference.
-This is in preparation for introducing WeakPtr to RenderObject.
All credit to Geoffrey Garen.
* wtf/WeakPtr.h:
(WTF::WeakReference::get const):
(WTF::WeakReference::clear):
(WTF::WeakReference::WeakReference):
(WTF::WeakPtrFactory::~WeakPtrFactory):
(WTF::WeakPtrFactory::createWeakPtr const):
(WTF::WeakPtrFactory::revokeAll):
(WTF::WeakPtrFactory::WeakPtrFactory): Deleted.
2017-09-21 Alex Christensen <achristensen@webkit.org>
Make StringBuilder movable
https://bugs.webkit.org/show_bug.cgi?id=177311
Reviewed by Chris Dumez.
* wtf/text/StringBuilder.h:
(WTF::StringBuilder::StringBuilder):
2017-09-20 Keith Miller <keith_miller@apple.com>
JSC should use unified sources for platform specific files.
https://bugs.webkit.org/show_bug.cgi?id=177290
Reviewed by Michael Saboff.
The unified source bundler script can now handle more than one
list of sources. Sources will not be bundled across source file
lists. We want to ensure that changing one platform's sources
doesn't break another platform's build, as much as
possible. Additionally, it means that there won't be weird
performance changes when files are added to an unrelated platform.
Remove stale reference to generate-unified-source-bundles.rb script
from Xcode.
* Scripts/generate-unified-source-bundles.rb:
* WTF.xcodeproj/project.pbxproj:
2017-09-20 Stephan Szabo <stephan.szabo@sony.com>
[Win] WTF: Add alias for process id to use in place of direct uses of pid_t
https://bugs.webkit.org/show_bug.cgi?id=177017
Reviewed by Alex Christensen.
* wtf/ProcessID.h:
(WTF::getCurrentProcessID):
2017-09-20 Keith Miller <keith_miller@apple.com>
JSC Xcode build should use unified sources for platform independent files
https://bugs.webkit.org/show_bug.cgi?id=177190
Reviewed by Saam Barati.
Add a new directory for build scripts that are forwarded to subsequent framework builds.
* Scripts/generate-unified-source-bundles.rb: Renamed from Source/WTF/generate-unified-source-bundles.rb.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
2017-09-20 Per Arne Vollan <pvollan@apple.com>
[Win] Cannot find script to generate unified sources.
https://bugs.webkit.org/show_bug.cgi?id=177014
Reviewed by Keith Miller.
Copy the ruby script to WTF/Scripts in the forwarding headers folder.
* wtf/CMakeLists.txt:
2017-09-20 Alberto Garcia <berto@igalia.com>
Fix HPPA and Alpha builds
https://bugs.webkit.org/show_bug.cgi?id=177224
Reviewed by Alex Christensen.
* wtf/Platform.h:
2017-09-19 Youenn Fablet <youenn@apple.com>
Allow WTF::map to use any class that is iterable and has a size getter
https://bugs.webkit.org/show_bug.cgi?id=177026
Reviewed by Darin Adler.
Computing the Item type given to the lambda using the iterator instead of ValueType which is specific to Vector.
Adding the possibility to pass a non const container reference and a lambda taking non const references as well.
* wtf/Vector.h:
(WTF::MapFunctionInspector::acceptsReference):
(WTF::Mapper::map):
(WTF::map):
2017-09-19 Jer Noble <jer.noble@apple.com>
[Cocoa] Add an ImageDecoder subclass backed by AVFoundation
https://bugs.webkit.org/show_bug.cgi?id=176825
Reviewed by Eric Carlson.
* wtf/Platform.h:
2017-09-18 Andy Estes <aestes@apple.com>
[Cocoa] Upstream sandbox-related WebKitSystemInterface functions
https://bugs.webkit.org/show_bug.cgi?id=177047
Reviewed by Daniel Bates.
* wtf/spi/darwin/SandboxSPI.h:
2017-09-18 Ryan Haddad <ryanhaddad@apple.com>
Unreviewed, rolling out r222170.
The API test added with this change is failing.
Reverted changeset:
"Allow WTF::map to use any class that is iterable and has a
size getter"
https://bugs.webkit.org/show_bug.cgi?id=177026
http://trac.webkit.org/changeset/222170
2017-09-18 Youenn Fablet <youenn@apple.com>
Allow WTF::map to use any class that is iterable and has a size getter
https://bugs.webkit.org/show_bug.cgi?id=177026
Reviewed by Darin Adler.
Computing the Item type given to the lambda using the iterator instead of ValueType which is specific to Vector.
Adding the possibility to pass a non const container reference and a lambda taking non const references as well.
* wtf/Vector.h:
(WTF::MapFunctionInspector::acceptsReference):
(WTF::Mapper::map):
(WTF::map):
2017-09-15 JF Bastien <jfbastien@apple.com>
WTF: use Forward.h when appropriate instead of Vector.h
https://bugs.webkit.org/show_bug.cgi?id=176984
Reviewed by Saam Barati.
There's no need to include Vector.h when Forward.h will suffice. All we need is to move the template default parameters from Vector, and then the forward declaration can be used in so many new places: if a header only takes Vector by reference, rvalue reference, pointer, returns any of these, or has them as members then the header doesn't need to see the definition because the declaration will suffice.
* wtf/Forward.h:
* wtf/Vector.h:
* wtf/text/StringVector.h:
2017-09-15 Keith Miller <keith_miller@apple.com>
generate-unified-source-bundles.rb shouldn't write a file that isn't going to change
https://bugs.webkit.org/show_bug.cgi?id=177021
Reviewed by Tim Horton.
* generate-unified-source-bundles.rb:
2017-09-14 Saam Barati <sbarati@apple.com>
We should have a way of preventing a caller from making a tail call and we should use it for ProxyObject instead of using build flags
https://bugs.webkit.org/show_bug.cgi?id=176863
Reviewed by Keith Miller.
This patch adds a way for a particular function to mark
that none of its calls should be tail calls.
It's useful in the following example if you don't want foo
to do a tail call to bar or baz:
int foo(bool b)
{
NO_TAIL_CALLS();
if (b)
return baz();
return bar();
}
Note that we're not saying that bar/baz should not be tail callable. bar/baz
may have other callers that are allowed to tail call it. This macro just says
that foo itself will not perform any tail calls.
* WTF.xcodeproj/project.pbxproj:
* wtf/NoTailCalls.h: Added.
(WTF::NoTailCalls::~NoTailCalls):
2017-09-14 Mark Lam <mark.lam@apple.com>
AddressSanitizer: stack-buffer-underflow in JSC::Probe::Page::Page
https://bugs.webkit.org/show_bug.cgi?id=176874
<rdar://problem/34436415>
Reviewed by Saam Barati.
Added a convenience version of roundUpToMultipleOf() so that it can be applied to
pointers without the client having to cast explicitly.
* wtf/StdLibExtras.h:
(WTF::roundUpToMultipleOf):
2017-09-14 Youenn Fablet <youenn@apple.com>
Allow WTF::map to take function as parameter
https://bugs.webkit.org/show_bug.cgi?id=176909
Reviewed by Jer Noble.
* wtf/Vector.h:
(WTF::map):
2017-09-13 Youenn Fablet <youenn@apple.com>
Add a lambda-based map for Vectors
https://bugs.webkit.org/show_bug.cgi?id=176487
Reviewed by Darin Adler.
This helper routine allows refactoring the reserveInitialCapacity/uncheckedAppend pattern, the mapper between source and destination item being a lambda.
* wtf/Vector.h:
(WTF::Mapper::transform):
(WTF::Mapper::map):
(WTF::map):
2017-09-12 Yusuke Suzuki <utatane.tea@gmail.com>
[DFG] Optimize WeakMap::get by adding intrinsic and fixup
https://bugs.webkit.org/show_bug.cgi?id=176010
Reviewed by Filip Pizlo.
Add inlineGet method with HashTranslator.
* wtf/HashMap.h:
(WTF::X>::inlineGet const):
(WTF::MappedTraits>::inlineGet const):
(WTF::MappedTraits>::fastGet const): Deleted.
* wtf/LoggingHashMap.h:
2017-09-12 Keith Miller <keith_miller@apple.com>
Do unified source builds for JSC
https://bugs.webkit.org/show_bug.cgi?id=176076
Reviewed by Geoffrey Garen.
This patch adds a script that will automatically bundle source
files, which is currently only used by the CMake build. It's
important that we use the same script to generate the bundles
for the CMake build as the Xcode build. If we didn't do this then
it's likely that there would be build errors that occur in only
one build system. On the same note, we also need to be careful to
not bundle platform specific source files with platform
independent ones. There are a couple of things the script does not
currently handle but are not essential for the CMake build. First,
it does not handle the max bundle size restrictions that the Xcode
build will require. It also does not handle C files.
The unified source generator script works by collecting groups of
up to 8 files from the same directory. We don't bundle files from
across directories since I didn't see a speedup from doing
so. Additionally, splitting at the directory boundary means that
it is less likely that adding a new file will force a "clean"
build. This would happen because the new file will shift every
subsequent file into the next unified source bundle.
Using unified sources appears to be a roughly 3.5x build time
speed up for clean builds on my MBP and appears to have a
negligible effect in incremental builds.
* generate-unified-source-bundles.rb: Added.
* wtf/Assertions.h:
2017-09-12 Joseph Pecoraro <pecoraro@apple.com>
QualifiedName::init should assume AtomicStrings::init was already called
https://bugs.webkit.org/show_bug.cgi?id=176639
Reviewed by Sam Weinig.
* wtf/NeverDestroyed.h:
(WTF::LazyNeverDestroyed::isConstructed const):
2017-09-12 Brent Fulgham <bfulgham@apple.com>
Show punycode to user if a URL mixes Armenian Seh or Vo with other scripts
https://bugs.webkit.org/show_bug.cgi?id=176578
<rdar://problem/33906231>
Reviewed by Alex Christensen.
* wtf/ASCIICType.h:
(WTF::isASCIIDigitOrPunctuation): Added helper function to recognize ASCII digits
and punctuation characters.
2017-09-12 Sam Weinig <sam@webkit.org>
[Cleanup] Follow up cleanup for DOMFormData implementation
https://bugs.webkit.org/show_bug.cgi?id=176740
Reviewed by Alex Christensen.
* WTF.xcodeproj/project.pbxproj:
* wtf/HashTraits.h:
(WTF::KeyValuePair::KeyValuePair): Deleted.
* wtf/KeyValuePair.h: Added.
(WTF::KeyValuePair::KeyValuePair):
(WTF::makeKeyValuePair):
Move KeyValuePair to its own header and add a makeKeyValuePair helper.
2017-09-11 Ryan Haddad <ryanhaddad@apple.com>
Unreviewed, rolling out r221854.
The test added with this change fails on 32-bit JSC bots.
Reverted changeset:
"[DFG] Optimize WeakMap::get by adding intrinsic and fixup"
https://bugs.webkit.org/show_bug.cgi?id=176010
http://trac.webkit.org/changeset/221854
2017-09-03 Yusuke Suzuki <utatane.tea@gmail.com>
[DFG] Optimize WeakMap::get by adding intrinsic and fixup
https://bugs.webkit.org/show_bug.cgi?id=176010
Reviewed by Filip Pizlo.
Add inlineGet method with HashTranslator.
* wtf/HashMap.h:
(WTF::X>::inlineGet const):
(WTF::MappedTraits>::inlineGet const):
(WTF::MappedTraits>::fastGet const): Deleted.
* wtf/LoggingHashMap.h:
2017-09-07 Myles C. Maxfield <mmaxfield@apple.com>
[PAL] Unify PlatformUserPreferredLanguages.h with Language.h
https://bugs.webkit.org/show_bug.cgi?id=176561
Reviewed by Brent Fulgham.
WebCore/platform/Language was the only* user of PlatformUserPreferredLanguages (with 1 exception).
That exception is that JavaScriptCore needed the functionality of WebCore/platform/Language, but it
couldn't get it because of the layering violation, so instead it erroneously called into
PlatformUserPreferredLanguages instead. This patch merges these two files into WTF so JSC gets the
right function and the PAL effort has one less file to move from WebCore/platform into PAL.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/Language.cpp: Renamed from Source/WebCore/platform/Language.cpp.
(WTF::addLanguageChangeObserver):
(WTF::userPreferredLanguages):
* wtf/Language.h: Renamed from Source/WebCore/platform/Language.h.
* wtf/PlatformGTK.cmake:
* wtf/PlatformJSCOnly.cmake:
* wtf/PlatformMac.cmake:
* wtf/PlatformUserPreferredLanguages.h: Removed.
* wtf/PlatformWPE.cmake:
* wtf/PlatformWin.cmake:
* wtf/cf/LanguageCF.cpp: Renamed from Source/WTF/wtf/PlatformUserPreferredLanguagesMac.mm.
(WTF::httpStyleLanguageCode):
(WTF::languagePreferencesDidChange):
(WTF::platformUserPreferredLanguages):
* wtf/unix/LanguageUnix.cpp: Renamed from Source/WTF/wtf/PlatformUserPreferredLanguagesUnix.cpp.
* wtf/win/LanguageWin.cpp: Renamed from Source/WTF/wtf/PlatformUserPreferredLanguagesWin.cpp.
2017-09-06 Eric Carlson <eric.carlson@apple.com>
Require LoggingHelper overrides to provide identifier
https://bugs.webkit.org/show_bug.cgi?id=176477
Reviewed by Jer Noble.
* wtf/Assertions.cpp: No more WTFLogLevelNotice.
* wtf/Assertions.h: Ditto.
2017-09-06 Per Arne Vollan <pvollan@apple.com>
[Win] WebCore failed to build, InbandTextTrackPrivateAVF: base class undefined.
https://bugs.webkit.org/show_bug.cgi?id=176431
Reviewed by Alex Christensen.
AVFoundation header detection should be done in WebCore because of build dependencies.
* AVFoundationSupport.py: Removed.
* wtf/Platform.h:
* wtf/PlatformWin.cmake:
2017-09-05 Yoshiaki Jitsukawa <Yoshiaki.Jitsukawa@sony.com>
[Win] Fix the wincairo build after r221558 and r221583
https://bugs.webkit.org/show_bug.cgi?id=176353
Reviewed by Yusuke Suzuki.
* wtf/Assertions.cpp:
2017-09-04 Eric Carlson <eric.carlson@apple.com>
Switch HTMLMediaElement to release logging
https://bugs.webkit.org/show_bug.cgi?id=176065
Reviewed by Jer Noble.
* wtf/MediaTime.cpp:
(WTF::MediaTime::dump const): Use toString.
(WTF::MediaTime::toString const): New.
2017-09-04 Yusuke Suzuki <utatane.tea@gmail.com>
Remove OS(SOLARIS) support
https://bugs.webkit.org/show_bug.cgi?id=176341
Reviewed by Sam Weinig.
WebKit project does not have stake holders supporting Solaris right now.
And Solaris + SPARC in 64bit environment does not work well since its
address space includes non-48bit area. It breaks our JSVALUE64 in JSC.
In addition, Solaris a bit complicates our threading implementation
because of its special threading stack.
This patch removes OS(SOLARIS) and COMPILER(SUNCC) support from WebKit.
* wtf/Compiler.h:
* wtf/InlineASM.h:
* wtf/MathExtras.h:
(std::isfinite): Deleted.
(std::signbit): Deleted.
(std::isinf): Deleted.
* wtf/NumberOfCores.cpp:
(WTF::numberOfProcessorCores):
* wtf/Platform.h:
* wtf/StackBounds.cpp:
* wtf/ThreadingPthreads.cpp:
2017-09-04 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r221494 and r221500.
https://bugs.webkit.org/show_bug.cgi?id=176258
This caused the windows build to fail. (Requested by mlewis13
on #webkit).
Reverted changesets:
"Switch HTMLMediaElement to release logging"
https://bugs.webkit.org/show_bug.cgi?id=176065
http://trac.webkit.org/changeset/221494
"Switch HTMLMediaElement to release logging"
https://bugs.webkit.org/show_bug.cgi?id=176065
http://trac.webkit.org/changeset/221500
2017-09-03 Yusuke Suzuki <utatane.tea@gmail.com>
Remove "malloc" and "free" use
https://bugs.webkit.org/show_bug.cgi?id=176310
Reviewed by Darin Adler.
Use Vector instead.
* wtf/Assertions.cpp:
2017-09-04 Yusuke Suzuki <utatane.tea@gmail.com>
Unreviewed, support libstdc++ use with clang
https://bugs.webkit.org/show_bug.cgi?id=176301
* wtf/FastMalloc.h:
2017-09-03 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Add C++03 allocator interface for GCC < 6
https://bugs.webkit.org/show_bug.cgi?id=176301
Reviewed by Darin Adler.
Unfortunately, std::list in GCC < 6 does not support C++11 allocator interface.
This patch adds C++03 allocator interface to FastAllocator to make it usable
for std::list. It also allows us to use FastAllocator for data structures that
only support C++03 interface.
* wtf/FastMalloc.h:
(WTF::FastAllocator::allocate):
(WTF::FastAllocator::construct):
(WTF::FastAllocator::destroy):
(WTF::FastAllocator::max_size const):
(WTF::FastAllocator::select_on_container_copy_construction const):
2017-09-03 Chris Dumez <cdumez@apple.com>
Unreviewed, rolling out r221552.
Broke the build
Reverted changeset:
"[WTF] Add C++03 allocator interface for GCC < 6"
https://bugs.webkit.org/show_bug.cgi?id=176301
http://trac.webkit.org/changeset/221552
2017-09-03 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Add C++03 allocator interface for GCC < 6
https://bugs.webkit.org/show_bug.cgi?id=176301
Reviewed by Darin Adler.
Unfortunately, std::list in GCC < 6 does not support C++11 allocator interface.
This patch adds C++03 allocator interface to FastAllocator to make it usable
for std::list. It also allows us to use FastAllocator for data structures that
only support C++03 interface.
* wtf/FastMalloc.h:
(WTF::FastAllocator::allocate):
(WTF::FastAllocator::construct):
(WTF::FastAllocator::destroy):
(WTF::FastAllocator::max_size const):
(WTF::FastAllocator::select_on_container_copy_construction const):
2017-09-03 Sam Weinig <sam@webkit.org>
Remove CanvasProxy
https://bugs.webkit.org/show_bug.cgi?id=176288
Reviewed by Yusuke Suzuki.
CanvasProxy does not appear to be in any current HTML spec
and was disabled and unimplemented in our tree. Time to
get rid of it.
* wtf/FeatureDefines.h:
2017-09-01 Eric Carlson <eric.carlson@apple.com>
Switch HTMLMediaElement to release logging
https://bugs.webkit.org/show_bug.cgi?id=176065
Reviewed by Jer Noble.
* wtf/MediaTime.cpp:
(WTF::MediaTime::dump const): Use toString.
(WTF::MediaTime::toString const): New.
* wtf/MediaTime.h:
(PAL::LogArgument<WTF::MediaTime>::toString): Logger template.
2017-08-31 Don Olmstead <don.olmstead@sony.com>
[CMake] Make USE_CF conditional within Windows
https://bugs.webkit.org/show_bug.cgi?id=176173
Reviewed by Alex Christensen.
* wtf/Platform.h:
* wtf/PlatformWin.cmake:
2017-08-31 Ryan Haddad <ryanhaddad@apple.com>
Unreviewed, rolling out r221445.
This change broke Sierra Release builds.
Reverted changeset:
"Switch HTMLMediaElement to release logging"
https://bugs.webkit.org/show_bug.cgi?id=176065
http://trac.webkit.org/changeset/221445
2017-08-31 Eric Carlson <eric.carlson@apple.com>
Switch HTMLMediaElement to release logging
https://bugs.webkit.org/show_bug.cgi?id=176065
Reviewed by Jer Noble.
* wtf/MediaTime.cpp:
(WTF::MediaTime::dump const): Use toString.
(WTF::MediaTime::toString const): New.
* wtf/MediaTime.h:
(PAL::LogArgument<WTF::MediaTime>::toString): Logger template.
2017-08-31 Filip Pizlo <fpizlo@apple.com>
All of the different ArrayBuffer::data's should be CagedPtr<>
https://bugs.webkit.org/show_bug.cgi?id=175515
Reviewed by Michael Saboff.
Added a specialization so that CagedPtr<void> is valid.
* wtf/CagedPtr.h:
2017-08-31 Per Arne Vollan <pvollan@apple.com>
[Win] Crash under WorkQueue::performWorkOnRegisteredWorkThread in layout tests.
https://bugs.webkit.org/show_bug.cgi?id=176163
Reviewed by Alex Christensen.
My previous attempt at fixing this crash in <http://trac.webkit.org/changeset/221323>
was incorrect, since it is still crashing on the bot(s). The current theory of why this
is failing is that the WorkQueue object deletes itself in the middle of the
performWorkOnRegisteredWorkThread method when calling deref(). There is no need to
increase the reference count of the work queue for each function we want to call on the
work thread. It is sufficient to increase it for every work thread we start, and then
dereference it when the thread ends. We should also not attempt to access members after
the deref() call, which can potentially be unsafe.
* wtf/win/WorkQueueWin.cpp:
(WTF::WorkQueue::workThreadCallback):
(WTF::WorkQueue::performWorkOnRegisteredWorkThread):
(WTF::WorkQueue::dispatch):
2017-08-22 Filip Pizlo <fpizlo@apple.com>
Strings need to be in some kind of gigacage
https://bugs.webkit.org/show_bug.cgi?id=174924
Reviewed by Oliver Hunt.
This makes all strings allocations come from the string gigacage. Because we expect string allocation
to be a hot path, I created specialized allocation paths for the string gigacage. These paths are
accessible via <wtf/text/StringMalloc.h>. However, those paths are equivalent to saying
Gigacage::malloc and friends with the Gigacage::String kind.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/Deque.h:
* wtf/FastMalloc.cpp:
(WTF::fastFree):
* wtf/FastMalloc.h:
(WTF::FastMalloc::malloc):
(WTF::FastMalloc::tryMalloc):
(WTF::FastMalloc::realloc):
(WTF::FastMalloc::free):
* wtf/Forward.h:
* wtf/Gigacage.cpp:
(Gigacage::tryMalloc):
* wtf/Gigacage.h:
(Gigacage::name):
* wtf/Vector.h:
(WTF::VectorBufferBase::allocateBuffer):
(WTF::VectorBufferBase::tryAllocateBuffer):
(WTF::VectorBufferBase::reallocateBuffer):
(WTF::VectorBufferBase::deallocateBuffer):
(WTF::Malloc>::Vector):
(WTF::=):
(WTF::Malloc>::contains const):
(WTF::Malloc>::findMatching const):
(WTF::Malloc>::find const):
(WTF::Malloc>::reverseFind const):
(WTF::Malloc>::appendIfNotContains):
(WTF::Malloc>::fill):
(WTF::Malloc>::appendRange):
(WTF::Malloc>::expandCapacity):
(WTF::Malloc>::tryExpandCapacity):
(WTF::Malloc>::resize):
(WTF::Malloc>::resizeToFit):
(WTF::Malloc>::shrink):
(WTF::Malloc>::grow):
(WTF::Malloc>::asanSetInitialBufferSizeTo):
(WTF::Malloc>::asanSetBufferSizeToFullCapacity):
(WTF::Malloc>::asanBufferSizeWillChangeTo):
(WTF::Malloc>::reserveCapacity):
(WTF::Malloc>::tryReserveCapacity):
(WTF::Malloc>::reserveInitialCapacity):
(WTF::Malloc>::shrinkCapacity):
(WTF::Malloc>::append):
(WTF::Malloc>::tryAppend):
(WTF::Malloc>::constructAndAppend):
(WTF::Malloc>::tryConstructAndAppend):
(WTF::Malloc>::appendSlowCase):
(WTF::Malloc>::constructAndAppendSlowCase):
(WTF::Malloc>::tryConstructAndAppendSlowCase):
(WTF::Malloc>::uncheckedAppend):
(WTF::Malloc>::appendVector):
(WTF::Malloc>::insert):
(WTF::Malloc>::insertVector):
(WTF::Malloc>::remove):
(WTF::Malloc>::removeFirst):
(WTF::Malloc>::removeFirstMatching):
(WTF::Malloc>::removeAll):
(WTF::Malloc>::removeAllMatching):
(WTF::Malloc>::reverse):
(WTF::Malloc>::map const):
(WTF::Malloc>::releaseBuffer):
(WTF::Malloc>::checkConsistency):
(WTF::swap):
(WTF::operator==):
(WTF::operator!=):
(WTF::removeRepeatedElements):
(WTF::minCapacity>::Vector): Deleted.
(WTF::minCapacity>::contains const): Deleted.
(WTF::minCapacity>::findMatching const): Deleted.
(WTF::minCapacity>::find const): Deleted.
(WTF::minCapacity>::reverseFind const): Deleted.
(WTF::minCapacity>::appendIfNotContains): Deleted.
(WTF::minCapacity>::fill): Deleted.
(WTF::minCapacity>::appendRange): Deleted.
(WTF::minCapacity>::expandCapacity): Deleted.
(WTF::minCapacity>::tryExpandCapacity): Deleted.
(WTF::minCapacity>::resize): Deleted.
(WTF::minCapacity>::resizeToFit): Deleted.
(WTF::minCapacity>::shrink): Deleted.
(WTF::minCapacity>::grow): Deleted.
(WTF::minCapacity>::asanSetInitialBufferSizeTo): Deleted.
(WTF::minCapacity>::asanSetBufferSizeToFullCapacity): Deleted.
(WTF::minCapacity>::asanBufferSizeWillChangeTo): Deleted.
(WTF::minCapacity>::reserveCapacity): Deleted.
(WTF::minCapacity>::tryReserveCapacity): Deleted.
(WTF::minCapacity>::reserveInitialCapacity): Deleted.
(WTF::minCapacity>::shrinkCapacity): Deleted.
(WTF::minCapacity>::append): Deleted.
(WTF::minCapacity>::tryAppend): Deleted.
(WTF::minCapacity>::constructAndAppend): Deleted.
(WTF::minCapacity>::tryConstructAndAppend): Deleted.
(WTF::minCapacity>::appendSlowCase): Deleted.
(WTF::minCapacity>::constructAndAppendSlowCase): Deleted.
(WTF::minCapacity>::tryConstructAndAppendSlowCase): Deleted.
(WTF::minCapacity>::uncheckedAppend): Deleted.
(WTF::minCapacity>::appendVector): Deleted.
(WTF::minCapacity>::insert): Deleted.
(WTF::minCapacity>::insertVector): Deleted.
(WTF::minCapacity>::remove): Deleted.
(WTF::minCapacity>::removeFirst): Deleted.
(WTF::minCapacity>::removeFirstMatching): Deleted.
(WTF::minCapacity>::removeAll): Deleted.
(WTF::minCapacity>::removeAllMatching): Deleted.
(WTF::minCapacity>::reverse): Deleted.
(WTF::minCapacity>::map const): Deleted.
(WTF::minCapacity>::releaseBuffer): Deleted.
(WTF::minCapacity>::checkConsistency): Deleted.
* wtf/text/AtomicStringImpl.h:
* wtf/text/CString.cpp:
(WTF::CStringBuffer::createUninitialized):
* wtf/text/CString.h:
* wtf/text/StringBuffer.h:
(WTF::StringBuffer::StringBuffer):
(WTF::StringBuffer::~StringBuffer):
(WTF::StringBuffer::resize):
* wtf/text/StringImpl.cpp:
(WTF::StringImpl::~StringImpl):
(WTF::StringImpl::destroy):
(WTF::StringImpl::createUninitializedInternalNonEmpty):
(WTF::StringImpl::reallocateInternal):
(WTF::StringImpl::releaseAssertCaged const):
* wtf/text/StringImpl.h:
(WTF::StringImpl::createSubstringSharingImpl):
(WTF::StringImpl::tryCreateUninitialized):
(WTF::StringImpl::adopt):
(WTF::StringImpl::bufferOwnership const):
(WTF::StringImpl::assertCaged const):
* wtf/text/StringMalloc.cpp: Added.
(WTF::tryStringMalloc):
(WTF::stringMalloc):
(WTF::stringRealloc):
(WTF::stringFree):
* wtf/text/StringMalloc.h: Added.
(WTF::StringMalloc::malloc):
(WTF::StringMalloc::tryMalloc):
(WTF::StringMalloc::realloc):
(WTF::StringMalloc::free):
* wtf/text/StringVector.h: Added.
* wtf/text/SymbolImpl.h:
* wtf/text/UniquedStringImpl.h:
* wtf/text/WTFString.h:
(WTF::String::adopt):
(WTF::String::assertCaged const):
(WTF::String::releaseAssertCaged const):
2017-08-30 Chris Dumez <cdumez@apple.com>
Implement FileSystemDirectoryReader.readEntries()
https://bugs.webkit.org/show_bug.cgi?id=176091
<rdar://problem/34168015>
Reviewed by Andreas Kling.
* wtf/CrossThreadCopier.h:
(WTF::crossThreadCopy):
* wtf/CrossThreadTask.h:
Move crossThreadCopy() from CrossThreadTask.h to CrossThreadCopier.h and
add "using WTF::crossThreadCopy" statement to make it more easily usable
from WebCore.
2017-08-30 Matt Lewis <jlewis3@apple.com>
Unreviewed, rolling out r221384.
This patch caused multiple 32-bit JSC test failures.
Reverted changeset:
"Strings need to be in some kind of gigacage"
https://bugs.webkit.org/show_bug.cgi?id=174924
http://trac.webkit.org/changeset/221384
2017-08-30 Brady Eidson <beidson@apple.com>
Add "Identified" base class to replace a whole bunch of custom identifier generators.
https://bugs.webkit.org/show_bug.cgi?id=176120
Reviewed by Alex Christensen.
* WTF.xcodeproj/project.pbxproj:
* wtf/Identified.h: Added.
(WTF::IdentifiedBase::identifier const):
(WTF::IdentifiedBase::IdentifiedBase):
(WTF::Identified::Identified):
(WTF::ThreadSafeIdentified::ThreadSafeIdentified):
2017-08-22 Filip Pizlo <fpizlo@apple.com>
Strings need to be in some kind of gigacage
https://bugs.webkit.org/show_bug.cgi?id=174924
Reviewed by Oliver Hunt.
This makes all strings allocations come from the string gigacage. Because we expect string allocation
to be a hot path, I created specialized allocation paths for the string gigacage. These paths are
accessible via <wtf/text/StringMalloc.h>. However, those paths are equivalent to saying
Gigacage::malloc and friends with the Gigacage::String kind.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/Deque.h:
* wtf/FastMalloc.cpp:
(WTF::fastFree):
* wtf/FastMalloc.h:
(WTF::FastMalloc::malloc):
(WTF::FastMalloc::tryMalloc):
(WTF::FastMalloc::realloc):
(WTF::FastMalloc::free):
* wtf/Forward.h:
* wtf/Gigacage.cpp:
(Gigacage::tryMalloc):
* wtf/Gigacage.h:
(Gigacage::name):
* wtf/Vector.h:
(WTF::VectorBufferBase::allocateBuffer):
(WTF::VectorBufferBase::tryAllocateBuffer):
(WTF::VectorBufferBase::reallocateBuffer):
(WTF::VectorBufferBase::deallocateBuffer):
(WTF::Malloc>::Vector):
(WTF::=):
(WTF::Malloc>::contains const):
(WTF::Malloc>::findMatching const):
(WTF::Malloc>::find const):
(WTF::Malloc>::reverseFind const):
(WTF::Malloc>::appendIfNotContains):
(WTF::Malloc>::fill):
(WTF::Malloc>::appendRange):
(WTF::Malloc>::expandCapacity):
(WTF::Malloc>::tryExpandCapacity):
(WTF::Malloc>::resize):
(WTF::Malloc>::resizeToFit):
(WTF::Malloc>::shrink):
(WTF::Malloc>::grow):
(WTF::Malloc>::asanSetInitialBufferSizeTo):
(WTF::Malloc>::asanSetBufferSizeToFullCapacity):
(WTF::Malloc>::asanBufferSizeWillChangeTo):
(WTF::Malloc>::reserveCapacity):
(WTF::Malloc>::tryReserveCapacity):
(WTF::Malloc>::reserveInitialCapacity):
(WTF::Malloc>::shrinkCapacity):
(WTF::Malloc>::append):
(WTF::Malloc>::tryAppend):
(WTF::Malloc>::constructAndAppend):
(WTF::Malloc>::tryConstructAndAppend):
(WTF::Malloc>::appendSlowCase):
(WTF::Malloc>::constructAndAppendSlowCase):
(WTF::Malloc>::tryConstructAndAppendSlowCase):
(WTF::Malloc>::uncheckedAppend):
(WTF::Malloc>::appendVector):
(WTF::Malloc>::insert):
(WTF::Malloc>::insertVector):
(WTF::Malloc>::remove):
(WTF::Malloc>::removeFirst):
(WTF::Malloc>::removeFirstMatching):
(WTF::Malloc>::removeAll):
(WTF::Malloc>::removeAllMatching):
(WTF::Malloc>::reverse):
(WTF::Malloc>::map const):
(WTF::Malloc>::releaseBuffer):
(WTF::Malloc>::checkConsistency):
(WTF::swap):
(WTF::operator==):
(WTF::operator!=):
(WTF::removeRepeatedElements):
(WTF::minCapacity>::Vector): Deleted.
(WTF::minCapacity>::contains const): Deleted.
(WTF::minCapacity>::findMatching const): Deleted.
(WTF::minCapacity>::find const): Deleted.
(WTF::minCapacity>::reverseFind const): Deleted.
(WTF::minCapacity>::appendIfNotContains): Deleted.
(WTF::minCapacity>::fill): Deleted.
(WTF::minCapacity>::appendRange): Deleted.
(WTF::minCapacity>::expandCapacity): Deleted.
(WTF::minCapacity>::tryExpandCapacity): Deleted.
(WTF::minCapacity>::resize): Deleted.
(WTF::minCapacity>::resizeToFit): Deleted.
(WTF::minCapacity>::shrink): Deleted.
(WTF::minCapacity>::grow): Deleted.
(WTF::minCapacity>::asanSetInitialBufferSizeTo): Deleted.
(WTF::minCapacity>::asanSetBufferSizeToFullCapacity): Deleted.
(WTF::minCapacity>::asanBufferSizeWillChangeTo): Deleted.
(WTF::minCapacity>::reserveCapacity): Deleted.
(WTF::minCapacity>::tryReserveCapacity): Deleted.
(WTF::minCapacity>::reserveInitialCapacity): Deleted.
(WTF::minCapacity>::shrinkCapacity): Deleted.
(WTF::minCapacity>::append): Deleted.
(WTF::minCapacity>::tryAppend): Deleted.
(WTF::minCapacity>::constructAndAppend): Deleted.
(WTF::minCapacity>::tryConstructAndAppend): Deleted.
(WTF::minCapacity>::appendSlowCase): Deleted.
(WTF::minCapacity>::constructAndAppendSlowCase): Deleted.
(WTF::minCapacity>::tryConstructAndAppendSlowCase): Deleted.
(WTF::minCapacity>::uncheckedAppend): Deleted.
(WTF::minCapacity>::appendVector): Deleted.
(WTF::minCapacity>::insert): Deleted.
(WTF::minCapacity>::insertVector): Deleted.
(WTF::minCapacity>::remove): Deleted.
(WTF::minCapacity>::removeFirst): Deleted.
(WTF::minCapacity>::removeFirstMatching): Deleted.
(WTF::minCapacity>::removeAll): Deleted.
(WTF::minCapacity>::removeAllMatching): Deleted.
(WTF::minCapacity>::reverse): Deleted.
(WTF::minCapacity>::map const): Deleted.
(WTF::minCapacity>::releaseBuffer): Deleted.
(WTF::minCapacity>::checkConsistency): Deleted.
* wtf/text/AtomicStringImpl.h:
* wtf/text/CString.cpp:
(WTF::CStringBuffer::createUninitialized):
* wtf/text/CString.h:
* wtf/text/StringBuffer.h:
(WTF::StringBuffer::StringBuffer):
(WTF::StringBuffer::~StringBuffer):
(WTF::StringBuffer::resize):
* wtf/text/StringImpl.cpp:
(WTF::StringImpl::~StringImpl):
(WTF::StringImpl::destroy):
(WTF::StringImpl::createUninitializedInternalNonEmpty):
(WTF::StringImpl::reallocateInternal):
(WTF::StringImpl::releaseAssertCaged const):
* wtf/text/StringImpl.h:
(WTF::StringImpl::createSubstringSharingImpl):
(WTF::StringImpl::tryCreateUninitialized):
(WTF::StringImpl::adopt):
(WTF::StringImpl::bufferOwnership const):
(WTF::StringImpl::assertCaged const):
* wtf/text/StringMalloc.cpp: Added.
(WTF::tryStringMalloc):
(WTF::stringMalloc):
(WTF::stringRealloc):
(WTF::stringFree):
* wtf/text/StringMalloc.h: Added.
(WTF::StringMalloc::malloc):
(WTF::StringMalloc::tryMalloc):
(WTF::StringMalloc::realloc):
(WTF::StringMalloc::free):
* wtf/text/StringVector.h: Added.
* wtf/text/SymbolImpl.h:
* wtf/text/UniquedStringImpl.h:
* wtf/text/WTFString.h:
(WTF::String::adopt):
(WTF::String::assertCaged const):
(WTF::String::releaseAssertCaged const):
2017-08-28 Yusuke Suzuki <utatane.tea@gmail.com>
[JSC] Use table based approach for JSON.stringify's Quote
https://bugs.webkit.org/show_bug.cgi?id=176044
Reviewed by Darin Adler.
We change escape operation of JSON Quote from branch-based to table-based.
This patch partially adopts SpiderMonkey's change to StringBuilderJSON.cpp
to optimize this escaping operation. We separate changes from StringBuilder.cpp
to apply MPL to StringBuilderJSON.cpp file. Since WebKit already adopts MPL in
some files (like, DateMath.h), it is acceptable.
Kraken json-stringify-tinderbox shows 7.2% improvement.
baseline patched
json-stringify-tinderbox 40.429+-0.771 ^ 37.693+-0.862 ^ definitely 1.0726x faster
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/text/StringBuilder.cpp:
(WTF::appendQuotedJSONStringInternalSlow): Deleted.
(WTF::appendQuotedJSONStringInternal): Deleted.
(WTF::StringBuilder::appendQuotedJSONString): Deleted.
* wtf/text/StringBuilderJSON.cpp: Added.
(WTF::appendQuotedJSONStringInternal):
(WTF::StringBuilder::appendQuotedJSONString):
2017-08-29 Per Arne Vollan <pvollan@apple.com>
[Win] Crash under WorkQueue::performWorkOnRegisteredWorkThread in layout tests.
https://bugs.webkit.org/show_bug.cgi?id=176064
Reviewed by Saam Barati.
The crash log indicates that the function pointer is null in this case.
* wtf/win/WorkQueueWin.cpp:
(WTF::WorkQueue::dispatch):
2017-08-28 Andy Estes <aestes@apple.com>
[Cocoa] Upstream WKGetWebDefaultCFStringEncoding()
https://bugs.webkit.org/show_bug.cgi?id=176039
Reviewed by Alex Christensen.
* wtf/spi/cf/CFStringSPI.h:
2017-08-26 Yusuke Suzuki <utatane.tea@gmail.com>
Unreviewed, suppress warnings in GTK port
Add printf format attribute.
* wtf/text/WTFString.cpp:
2017-08-25 Eric Carlson <eric.carlson@apple.com>
Add Logger::logAlways
https://bugs.webkit.org/show_bug.cgi?id=175996
Reviewed by Jer Noble.
* wtf/Assertions.cpp:
* wtf/Assertions.h:
2017-08-25 Daniel Bates <dabates@apple.com>
Demarcate code added due to lack of NSDMI for aggregates
https://bugs.webkit.org/show_bug.cgi?id=175990
Reviewed by Andy Estes.
* wtf/Compiler.h:
2017-08-25 Don Olmstead <don.olmstead@sony.com>
Define *_GIGACAGE_MASK when Gigacage is not supported
https://bugs.webkit.org/show_bug.cgi?id=175994
Reviewed by Mark Lam.
* wtf/Gigacage.h:
2017-08-25 Eric Carlson <eric.carlson@apple.com>
Add String::format variant that takes va_args
https://bugs.webkit.org/show_bug.cgi?id=175988
Reviewed by Jer Noble.
* wtf/text/WTFString.cpp:
(WTF::createWithFormatAndArguments): Created with the guts of String::format.
(WTF::String::formatWithArguments): New, call createWithFormatAndArguments.
(WTF::String::format): Move logic to createWithFormatAndArguments, use it.
* wtf/text/WTFString.h:
2017-08-25 Saam Barati <sbarati@apple.com>
Support compiling catch in the DFG
https://bugs.webkit.org/show_bug.cgi?id=174590
<rdar://problem/34047845>
Reviewed by Filip Pizlo.
This patch generalizes the BackwardsGraph fake root into a more generalizable
class called SingleRootGraph. SingleRootGraph exposes the general graph interface
used in Dominators and NaturalLoops. SingleRootGraph takes as input a graph with
the normal graph interface, but also allows the input graph to contain more than
one root. SingleRootGraph then exposes a single root, which it creates, that has
an outgoing edge to all the roots in the original graph.
* WTF.xcodeproj/project.pbxproj:
* wtf/BackwardsGraph.h:
(WTF::BackwardsGraph::dump const):
(WTF::BackwardsGraph::rootName): Deleted.
(WTF::BackwardsGraph::Node::Node): Deleted.
(WTF::BackwardsGraph::Node::root): Deleted.
(WTF::BackwardsGraph::Node::operator== const): Deleted.
(WTF::BackwardsGraph::Node::operator!= const): Deleted.
(WTF::BackwardsGraph::Node::operator bool const): Deleted.
(WTF::BackwardsGraph::Node::isRoot const): Deleted.
(WTF::BackwardsGraph::Node::node const): Deleted.
(): Deleted.
(WTF::BackwardsGraph::Set::Set): Deleted.
(WTF::BackwardsGraph::Set::add): Deleted.
(WTF::BackwardsGraph::Set::remove): Deleted.
(WTF::BackwardsGraph::Set::contains): Deleted.
(WTF::BackwardsGraph::Set::dump const): Deleted.
(WTF::BackwardsGraph::Map::Map): Deleted.
(WTF::BackwardsGraph::Map::clear): Deleted.
(WTF::BackwardsGraph::Map::size const): Deleted.
(WTF::BackwardsGraph::Map::operator[]): Deleted.
(WTF::BackwardsGraph::Map::operator[] const): Deleted.
* wtf/Dominators.h:
(WTF::Dominators::Dominators):
(WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf):
(WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf):
(WTF::Dominators::iteratedDominanceFrontierOf const):
(WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl const):
* wtf/SingleRootGraph.h: Added.
(WTF::SingleRootGraphNode::rootName):
(WTF::SingleRootGraphNode::SingleRootGraphNode):
(WTF::SingleRootGraphNode::root):
(WTF::SingleRootGraphNode::operator== const):
(WTF::SingleRootGraphNode::operator!= const):
(WTF::SingleRootGraphNode::operator bool const):
(WTF::SingleRootGraphNode::isRoot const):
(WTF::SingleRootGraphNode::node const):
(WTF::SingleRootGraphSet::add):
(WTF::SingleRootGraphSet::remove):
(WTF::SingleRootGraphSet::contains):
(WTF::SingleRootGraphSet::dump const):
(WTF::SingleRootMap::SingleRootMap):
(WTF::SingleRootMap::clear):
(WTF::SingleRootMap::size const):
(WTF::SingleRootMap::operator[]):
(WTF::SingleRootMap::operator[] const):
(WTF::SingleRootGraph::SingleRootGraph):
(WTF::SingleRootGraph::root const):
(WTF::SingleRootGraph::newMap):
(WTF::SingleRootGraph::successors const):
(WTF::SingleRootGraph::predecessors const):
(WTF::SingleRootGraph::index const):
(WTF::SingleRootGraph::node const):
(WTF::SingleRootGraph::numNodes const):
(WTF::SingleRootGraph::dump const):
(WTF::SingleRootGraph::assertIsConsistent const):
2017-08-24 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r221119, r221124, and r221143.
https://bugs.webkit.org/show_bug.cgi?id=175973
"I think it regressed JSBench by 20%" (Requested by saamyjoon
on #webkit).
Reverted changesets:
"Support compiling catch in the DFG"
https://bugs.webkit.org/show_bug.cgi?id=174590
http://trac.webkit.org/changeset/221119
"Unreviewed, build fix in GTK port"
https://bugs.webkit.org/show_bug.cgi?id=174590
http://trac.webkit.org/changeset/221124
"DFG::JITCode::osrEntry should get sorted since we perform a
binary search on it"
https://bugs.webkit.org/show_bug.cgi?id=175893
http://trac.webkit.org/changeset/221143
2017-08-23 Filip Pizlo <fpizlo@apple.com>
Reduce Gigacage sizes
https://bugs.webkit.org/show_bug.cgi?id=175920
Reviewed by Mark Lam.
Provide filler API for the no-bmalloc/no-Gigacage case.
* wtf/Gigacage.h:
(Gigacage::mask):
2017-08-23 Yusuke Suzuki <utatane.tea@gmail.com>
Unreviewed, build fix in GTK port
https://bugs.webkit.org/show_bug.cgi?id=174590
* wtf/SingleRootGraph.h:
(WTF::SingleRootGraph::successors const):
(WTF::SingleRootGraph::predecessors const):
2017-08-23 Saam Barati <sbarati@apple.com>
Support compiling catch in the DFG
https://bugs.webkit.org/show_bug.cgi?id=174590
Reviewed by Filip Pizlo.
This patch generalizes the BackwardsGraph fake root into a more generalizable
class called SingleRootGraph. SingleRootGraph exposes the general graph interface
used in Dominators and NaturalLoops. SingleRootGraph takes as input a graph with
the normal graph interface, but also allows the input graph to contain more than
one root. SingleRootGraph then exposes a single root, which it creates, that has
an outgoing edge to all the roots in the original graph.
* WTF.xcodeproj/project.pbxproj:
* wtf/BackwardsGraph.h:
(WTF::BackwardsGraph::dump const):
(WTF::BackwardsGraph::rootName): Deleted.
(WTF::BackwardsGraph::Node::Node): Deleted.
(WTF::BackwardsGraph::Node::root): Deleted.
(WTF::BackwardsGraph::Node::operator== const): Deleted.
(WTF::BackwardsGraph::Node::operator!= const): Deleted.
(WTF::BackwardsGraph::Node::operator bool const): Deleted.
(WTF::BackwardsGraph::Node::isRoot const): Deleted.
(WTF::BackwardsGraph::Node::node const): Deleted.
(): Deleted.
(WTF::BackwardsGraph::Set::Set): Deleted.
(WTF::BackwardsGraph::Set::add): Deleted.
(WTF::BackwardsGraph::Set::remove): Deleted.
(WTF::BackwardsGraph::Set::contains): Deleted.
(WTF::BackwardsGraph::Set::dump const): Deleted.
(WTF::BackwardsGraph::Map::Map): Deleted.
(WTF::BackwardsGraph::Map::clear): Deleted.
(WTF::BackwardsGraph::Map::size const): Deleted.
(WTF::BackwardsGraph::Map::operator[]): Deleted.
(WTF::BackwardsGraph::Map::operator[] const): Deleted.
* wtf/Dominators.h:
(WTF::Dominators::Dominators):
(WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOf):
(WTF::Dominators::forAllBlocksInPrunedIteratedDominanceFrontierOf):
(WTF::Dominators::iteratedDominanceFrontierOf const):
(WTF::Dominators::forAllBlocksInIteratedDominanceFrontierOfImpl const):
* wtf/SingleRootGraph.h: Added.
(WTF::SingleRootGraphNode::rootName):
(WTF::SingleRootGraphNode::SingleRootGraphNode):
(WTF::SingleRootGraphNode::root):
(WTF::SingleRootGraphNode::operator== const):
(WTF::SingleRootGraphNode::operator!= const):
(WTF::SingleRootGraphNode::operator bool const):
(WTF::SingleRootGraphNode::isRoot const):
(WTF::SingleRootGraphNode::node const):
(WTF::SingleRootGraphSet::add):
(WTF::SingleRootGraphSet::remove):
(WTF::SingleRootGraphSet::contains):
(WTF::SingleRootGraphSet::dump const):
(WTF::SingleRootMap::SingleRootMap):
(WTF::SingleRootMap::clear):
(WTF::SingleRootMap::size const):
(WTF::SingleRootMap::operator[]):
(WTF::SingleRootMap::operator[] const):
(WTF::SingleRootGraph::SingleRootGraph):
(WTF::SingleRootGraph::root const):
(WTF::SingleRootGraph::newMap):
(WTF::SingleRootGraph::successors const):
(WTF::SingleRootGraph::predecessors const):
(WTF::SingleRootGraph::index const):
(WTF::SingleRootGraph::node const):
(WTF::SingleRootGraph::numNodes const):
(WTF::SingleRootGraph::dump const):
(WTF::SingleRootGraph::assertIsConsistent const):
2017-08-23 Youenn Fablet <youenn@apple.com>
[Cache API] Enable persistent coder to encode FetchOptions
https://bugs.webkit.org/show_bug.cgi?id=175883
Reviewed by Alex Christensen.
Enabling encoding/decoding of enums with EnumTraits.
This code is similar to the one of IPC encoder/decoder.
* wtf/persistence/PersistentDecoder.h:
(WTF::Persistence::Decoder::decode):
* wtf/persistence/PersistentEncoder.h:
(WTF::Persistence::Encoder::encode):
2017-08-23 Per Arne Vollan <pvollan@apple.com>
[Win] Compile error, include file <wtf/AVFoundationHeaderDetection.h> is not found.
https://bugs.webkit.org/show_bug.cgi?id=175853
Reviewed by Brent Fulgham.
Copy generated WTF header files to the same place as we copy forwarding headers.
* WTF.vcxproj/WTF.proj:
2017-08-22 Chris Dumez <cdumez@apple.com>
Introduce a new CompletionHandler type and use it for NetworkDataTaskClient's completion handlers to help catch bugs
https://bugs.webkit.org/show_bug.cgi?id=175832
Reviewed by Alex Christensen.
Introduce a new CompletionHandler type which wraps a WTF::Function and ensures via assertions
that the function is always called once and only once.
* WTF.xcodeproj/project.pbxproj:
* wtf/CompletionHandler.h: Added.
(WTF::CompletionHandler<Out):
2017-08-22 Alex Christensen <achristensen@webkit.org>
Fix Windows build after r221017.
https://bugs.webkit.org/show_bug.cgi?id=157053
* wtf/PlatformWin.cmake:
2017-08-22 Per Arne Vollan <pvollan@apple.com>
Implement 64-bit MacroAssembler::probe support for Windows.
https://bugs.webkit.org/show_bug.cgi?id=175724
Reviewed by Mark Lam.
Enable masm probe and DFG.
* wtf/Platform.h:
2017-08-21 Mark Lam <mark.lam@apple.com>
[Follow up]: Add back the ability to disable MASM_PROBE from the build.
https://bugs.webkit.org/show_bug.cgi?id=175656
<rdar://problem/33933720>
Not reviewed.
Fixed a typo: should be "OS(WINDOWS)", not "OS(WINDOW)".
* wtf/Platform.h:
2017-08-21 Carlos Alberto Lopez Perez <clopez@igalia.com>
[GTK] ARMv7 build fails to build MacroAssemblerARMv7.cpp.
https://bugs.webkit.org/show_bug.cgi?id=175514
Reviewed by Keith Miller.
* wtf/Platform.h: Enable DFG and MASM_PROBE back for GTK ARM_THUMB2.
2017-08-20 Sam Weinig <sam@webkit.org>
StringView could use a function to strip leading/trailing characters without allocation
https://bugs.webkit.org/show_bug.cgi?id=175757
Reviewed by Darin Adler.
There are many places in WebCore/WebKit that we call functions like,
WebCore::stripLeadingAndTrailingHTMLSpaces, or String::stripWhiteSpace() only to use
the allocated String as a temporary for either another transformation or a comparison.
Now that we have StringView, we can avoid that extra allocation, by having returning a
StringView substring in these scenarios.
For instance, the check (from ScriptElement.cpp:287):
if (!stripLeadingAndTrailingHTMLSpaces(sourceURL).isEmpty()) {
...
}
currently allocates a string just to make this check. With a new
stripLeadingAndTrailingHTMLSpaces such as:
StringView stripLeadingAndTrailingHTMLSpaces(StringView stringView)
{
return stringView.stripLeadingAndTrailingMatchedCharacters([] (auto c) {
return isHTMLSpace(c);
});
}
We could instead have exact same code from ScriptElement.cpp now avoid an allocation.
* wtf/text/StringView.h:
(WTF::StringView::stripLeadingAndTrailingMatchedCharacters):
2017-08-21 Eric Carlson <eric.carlson@apple.com>
Add WTFLogChannel level to allow runtime log filtering
https://bugs.webkit.org/show_bug.cgi?id=175731
<rdar://problem/33967234>
Reviewed by Jer Noble.
Add WTFLog*, LOG, and RELEASE_LOG variants that take a "log level" parameter so code
can include logging statements that are only conditionally emitted.
* wtf/Assertions.cpp:
* wtf/Assertions.h:
* wtf/MemoryPressureHandler.cpp:
* wtf/RefCountedLeakCounter.cpp:
2017-08-20 Mark Lam <mark.lam@apple.com>
Gardening: fix CLoop build.
https://bugs.webkit.org/show_bug.cgi?id=175688
<rdar://problem/33436870>
Not reviewed.
Disable MASM_PROBE if !ENABLE(JIT).
* wtf/Platform.h:
2017-08-18 Ryan Haddad <ryanhaddad@apple.com>
Unreviewed, rolling out r220938.
The API tests added with this change are failing.
Reverted changeset:
"Add WTFLogChannel level to allow runtime log filtering"
https://bugs.webkit.org/show_bug.cgi?id=175731
http://trac.webkit.org/changeset/220938
2017-08-18 Eric Carlson <eric.carlson@apple.com>
Add WTFLogChannel level to allow runtime log filtering
https://bugs.webkit.org/show_bug.cgi?id=175731
<rdar://problem/33967234>
Reviewed by Jer Noble.
Add WTFLog*, LOG, and RELEASE_LOG variants that take a "log level" parameter so code
can include logging statements that are only conditionally emitted.
* wtf/Assertions.cpp:
* wtf/Assertions.h:
* wtf/MemoryPressureHandler.cpp:
* wtf/RefCountedLeakCounter.cpp:
2017-08-18 Per Arne Vollan <pvollan@apple.com>
Implement 32-bit MacroAssembler::probe support for Windows.
https://bugs.webkit.org/show_bug.cgi?id=175449
Reviewed by Mark Lam.
Enable the DFG on Win32.
* wtf/Platform.h:
2017-08-17 Mark Lam <mark.lam@apple.com>
Only use 16 VFP registers if !CPU(ARM_NEON).
https://bugs.webkit.org/show_bug.cgi?id=175514
Reviewed by JF Bastien.
If CPU(ARM_NEON) is not enabled, we'll conservatively assume only VFP2 support is
available. Hence, we'll only the first 16 FPDoubleRegisterIDs are available.
For reference, see:
NEON registers: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0473c/CJACABEJ.html
VFP2 and VFP3 registers: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0473c/CIHDIBDG.html
NEON to VFP register mapping: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0473c/CJAIJHFC.html
This is mostly for GTK toolchains which may target older ARM CPUs which only have
VFP2 support.
* wtf/Platform.h:
2017-08-16 Mark Lam <mark.lam@apple.com>
Add back the ability to disable MASM_PROBE from the build.
https://bugs.webkit.org/show_bug.cgi?id=175656
<rdar://problem/33933720>
Reviewed by Yusuke Suzuki.
* wtf/Platform.h:
2017-08-16 Mark Lam <mark.lam@apple.com>
Gardening: fix GTK ARM_THUMB2 build.
https://bugs.webkit.org/show_bug.cgi?id=175446
Not reviewed.
Disable the use of the DFG for GTK ARM_THUMB2 builds until
https://bugs.webkit.org/show_bug.cgi?id=175514 is fixed.
* wtf/Platform.h:
2017-08-16 Andy Estes <aestes@apple.com>
[Payment Request] Add an ENABLE flag and an experimental feature preference
https://bugs.webkit.org/show_bug.cgi?id=175622
Reviewed by Tim Horton.
* wtf/FeatureDefines.h:
2017-08-14 Simon Fraser <simon.fraser@apple.com>
Remove Proximity Events and related code
https://bugs.webkit.org/show_bug.cgi?id=175545
Reviewed by Daniel Bates.
No platform enables Proximity Events, so remove code inside ENABLE(PROXIMITY_EVENTS)
and other related code.
* wtf/FeatureDefines.h:
2017-08-14 Simon Fraser <simon.fraser@apple.com>
Remove ENABLE(REQUEST_AUTOCOMPLETE) code, which was disabled everywhere
https://bugs.webkit.org/show_bug.cgi?id=175504
Reviewed by Sam Weinig.
* wtf/FeatureDefines.h:
2017-08-14 Simon Fraser <simon.fraser@apple.com>
Remove ENABLE_VIEW_MODE_CSS_MEDIA and related code
https://bugs.webkit.org/show_bug.cgi?id=175557
Reviewed by Jon Lee.
No port cares about the ENABLE(VIEW_MODE_CSS_MEDIA) feature, so remove it.
* wtf/FeatureDefines.h:
2017-08-12 Filip Pizlo <fpizlo@apple.com>
Put the ScopedArgumentsTable's ScopeOffset array in some gigacage
https://bugs.webkit.org/show_bug.cgi?id=174921
Reviewed by Mark Lam.
If you want to std::unique_ptr a class that knows that it should be in the Gigacage, then we
would create the Gigacage equivalent of WTF_MAKE_FAST_ALLOCATED and it would just work.
But this does not work if we want to std::unique_ptr a primitive type. So, this patch adds a
solution for this problem: CagedUniquePtr<>. This will handle allocation
(CagedUniquePtr<>::create()) and deallocation (in the style of std::unique_ptr). It has three
variants:
- Non-array types.
- Arrays that don't have destructors.
- Arrays that have destructors.
Just like std::unique_ptr, the array case is triggered by saying "[]" at the end of the type.
Unlike std::unique_ptr and most other smart pointers, the whole point of this smart pointer is
to dictate where the thing you're pointing at is allocated. For this reason, it has to know how
to do things like the array destructor protocol. So it creates its own: the CagedUniquePtr for
arrays with destructors is a fat pointer that remembers the length of the array.
CagedUniquePtr<> makes it impossible to leak/release the pointer. This is stricter than what
std::unique_ptr does, and is probably appropriate for all of the places where we would use this
type.
So far, we only use it for ScopedArgumentsTable::m_arguments, but I suspect that it will be
useful in other places.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/CagedUniquePtr.h: Added.
(WTF::CagedUniquePtr::CagedUniquePtr):
(WTF::CagedUniquePtr::create):
(WTF::CagedUniquePtr::operator=):
(WTF::CagedUniquePtr::~CagedUniquePtr):
(WTF::CagedUniquePtr::get const):
(WTF::CagedUniquePtr::getMayBeNull const):
(WTF::CagedUniquePtr::operator== const):
(WTF::CagedUniquePtr::operator!= const):
(WTF::CagedUniquePtr::operator bool const):
(WTF::CagedUniquePtr::operator* const):
(WTF::CagedUniquePtr::operator-> const):
(WTF::CagedUniquePtr::operator[] const):
(WTF::CagedUniquePtr::destroy):
* wtf/Gigacage.cpp:
(Gigacage::tryMallocArray):
(Gigacage::malloc):
(Gigacage::mallocArray):
* wtf/Gigacage.h:
2017-08-11 Ryosuke Niwa <rniwa@webkit.org>
Replace DATA_TRANSFER_ITEMS by a runtime flag and add a stub implementation
https://bugs.webkit.org/show_bug.cgi?id=175474
Reviewed by Wenson Hsieh.
* wtf/FeatureDefines.h:
2017-08-11 Don Olmstead <don.olmstead@sony.com>
[WTF] Move ValueToString into WTF
https://bugs.webkit.org/show_bug.cgi?id=175469
Reviewed by Sam Weinig.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/text/ValueToString.h: Renamed from Source/WebCore/platform/ValueToString.h.
2017-08-11 Tim Horton <timothy_horton@apple.com>
Fix the build with modern Clang's -Wexpansion-to-defined
https://bugs.webkit.org/show_bug.cgi?id=175467
<rdar://problem/33667497>
Reviewed by Simon Fraser.
* wtf/FeatureDefines.h:
* wtf/Platform.h:
Avoid object-like macros that expand to include defined(), because this
behaves inconsistently between different compilers (though in ways
that don't matter for these particular defines, which aren't used on MSVC),
and Clang has added a warning for it.
Move ENABLE_WEBASSEMBLY to Platform.h since it depends on things that
are defined there and can't be evaluated at time-of-use because of the
aforementioned new rules. Previously, there was a cycle between
ENABLE_WEBASSEMBLY and ENABLE_B3_JIT -- break that so that it just
goes FTL_JIT->B3_JIT->WASM instead.
2017-08-10 Sam Weinig <sam@webkit.org>
WTF::Function does not allow for reference / non-default constructible return types
https://bugs.webkit.org/show_bug.cgi?id=175244
Reviewed by Chris Dumez.
When Function, then NoncopyableFunction, was templatized to allow non-void return values
in r201493, it maintained the behavior of being callable even if the Function was null.
To accomplish this, when null, the default construction of the return parameter was used.
This means Function can't be used with return types that are not default constructible,
such as reference types and Ref.
This behavior of returning something when null is surprising, as this is not how normal
functions behave, and not very useful. Instead, we now assert that the function is not
null when being called.
* wtf/Function.h:
(WTF::Function operator(...)):
Instead of allowing a null callable wrapper by returning the default construction of
the return type, assert that the wrapper is there when calling a Function.
2017-08-10 Mark Lam <mark.lam@apple.com>
Make the MASM_PROBE mechanism mandatory for DFG and FTL builds.
https://bugs.webkit.org/show_bug.cgi?id=175446
<rdar://problem/33836545>
Reviewed by Saam Barati.
This is needed in order to support https://bugs.webkit.org/show_bug.cgi?id=174645.
One consequence of this is that the DFG will now be disabled for the MIPS and
Windows ports. See:
https://bugs.webkit.org/show_bug.cgi?id=175447
https://bugs.webkit.org/show_bug.cgi?id=175449
Also, we should only ENABLE_SIGNAL_BASED_VM_TRAPS if the DFG is enabled. It was
never meaningful to use SIGNAL_BASED_VM_TRAPS with the baseline JIT anyway. This
is a mis-configuration error that is now fixed.
* wtf/Platform.h:
2017-08-10 Brady Eidson <beidson@apple.com>
Rename the source files for the WTF persistent coders.
https://bugs.webkit.org/show_bug.cgi?id=175441
Reviewed by Tim Horton.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/persistence/PersistentCoder.h: Renamed from Source/WTF/wtf/persistence/Coder.h.
* wtf/persistence/PersistentCoders.cpp: Renamed from Source/WTF/wtf/persistence/Coders.cpp.
* wtf/persistence/PersistentCoders.h: Renamed from Source/WTF/wtf/persistence/Coders.h.
* wtf/persistence/PersistentDecoder.cpp: Renamed from Source/WTF/wtf/persistence/Decoder.cpp.
* wtf/persistence/PersistentDecoder.h: Renamed from Source/WTF/wtf/persistence/Decoder.h.
* wtf/persistence/PersistentEncoder.cpp: Renamed from Source/WTF/wtf/persistence/Encoder.cpp.
* wtf/persistence/PersistentEncoder.h: Renamed from Source/WTF/wtf/persistence/Encoder.h.
2017-08-10 Yusuke Suzuki <utatane.tea@gmail.com>
Unreviewed, attempt to fix build failure with VC2017
* wtf/PriorityQueue.h:
2017-08-10 Yusuke Suzuki <utatane.tea@gmail.com>
Run more WTF tests
https://bugs.webkit.org/show_bug.cgi?id=174970
Reviewed by Michael Catanzaro.
CHAR_BIT is not defined.
* wtf/LEBDecoder.h:
2017-08-09 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] ThreadSpecific should not introduce additional indirection
https://bugs.webkit.org/show_bug.cgi?id=175187
Reviewed by Mark Lam.
ThreadSpecific sets Data* to the TLS. And Data holds T*, which
is fast allocated actual data. But ideally, we should store T
instance directly in Data instead of introducing an additional
indirection.
This patch adds storage in Data in order to embed the instance of T. The constructor
for Data will invoke the constructor for T on the embedded storage. We also drop
ThreadSpecific::replace which is only used by the web thread to set its thread specific
ThreadGlobalData to the one shared from the main thread. The existing implementation
relies on the main thread and the web thread never exiting in order for the shared
ThreadGlobalData to stay alive. We can achieve the same semantics by using a
ThreadSpecific<std::unique_ptr<T>> to hold the ThreadGlobalData instance instead.
* wtf/ThreadSpecific.h:
(WTF::ThreadSpecific::Data::construct):
(WTF::ThreadSpecific::Data::Data):
We make it fast allocated since we previously allocated ThreadSpecific T data by fastMalloc.
(WTF::ThreadSpecific::Data::~Data):
(WTF::ThreadSpecific::Data::storagePointer const):
(WTF::canBeGCThread>::get):
We also drop RELEASE_ASSERT from ::get(). We already inserted this assert to setAndConstruct(),
so when creating the member to this TLS, we execute this release assert. So it is
not necessary to execute this assertion every time we get data from this TLS.
(WTF::canBeGCThread>::set):
(WTF::canBeGCThread>::destroy):
(WTF::canBeGCThread>::setAndConstruct):
(WTF::T):
(WTF::canBeGCThread>::replace): Deleted.
2017-08-10 Tim Horton <timothy_horton@apple.com>
Fix a silly typo in Compiler.h
* wtf/Compiler.h:
Heature, indeed.
2017-08-10 Michael Catanzaro <mcatanzaro@igalia.com>
Remove ENABLE_GAMEPAD_DEPRECATED
https://bugs.webkit.org/show_bug.cgi?id=175361
Reviewed by Carlos Garcia Campos.
* wtf/FeatureDefines.h:
2017-08-09 Don Olmstead <don.olmstead@sony.com>
[WTF] Move TextStream into WTF
https://bugs.webkit.org/show_bug.cgi?id=175211
Reviewed by Myles C. Maxfield.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/text/TextStream.cpp: Renamed from Source/WebCore/platform/text/TextStream.cpp.
(WTF::TextStream::writeIndent):
* wtf/text/TextStream.h: Renamed from Source/WebCore/platform/text/TextStream.h.
(WTF::TextStream::FormatNumberRespectingIntegers::FormatNumberRespectingIntegers):
2017-08-09 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r220466, r220477, and r220487.
https://bugs.webkit.org/show_bug.cgi?id=175411
This change broke existing API tests and follow up fixes did
not resolve all the issues. (Requested by ryanhaddad on
#webkit).
Reverted changesets:
https://bugs.webkit.org/show_bug.cgi?id=175244
http://trac.webkit.org/changeset/220466
"WTF::Function does not allow for reference / non-default
constructible return types"
https://bugs.webkit.org/show_bug.cgi?id=175244
http://trac.webkit.org/changeset/220477
https://bugs.webkit.org/show_bug.cgi?id=175244
http://trac.webkit.org/changeset/220487
2017-08-09 Sam Weinig <sam@webkit.org>
WTF::Function does not allow for reference / non-default constructible return types
https://bugs.webkit.org/show_bug.cgi?id=175244
Reviewed by Chris Dumez.
When Function, then NoncopyableFunction, was templatized to allow non-void return values
in r201493, it maintained the behavior of being callable even if the Function was null.
To accomplish this, when null, the default construction of the return parameter was used.
This means Function can't be used with return types that are not default constructible,
such as reference types and Ref.
This behavior of returning something when null is surprising, as this is not how normal
functions behave, and not very useful. Instead, we now assert that the function is not
null when being called.
* wtf/Function.h:
(WTF::Function operator(...)):
Instead of allowing a null callable wrapper by returning the default construction of
the return type, assert that the wrapper is there when calling a Function.
2017-08-09 Ryan Haddad <ryanhaddad@apple.com>
Unreviewed, rolling out r220457.
This change introduced API test failures.
Reverted changeset:
"WTF::Function does not allow for reference / non-default
constructible return types"
https://bugs.webkit.org/show_bug.cgi?id=175244
http://trac.webkit.org/changeset/220457
2017-08-09 Sam Weinig <sam@webkit.org>
WTF::Function does not allow for reference / non-default constructible return types
https://bugs.webkit.org/show_bug.cgi?id=175244
Reviewed by Chris Dumez.
When Function, then NoncopyableFunction, was templatized to allow non-void return values
in r201493, it maintained the behavior of being callable even if the Function was null.
To accomplish this, when null, the default construction of the return parameter was used.
This means Function can't be used with return types that are not default constructible,
such as reference types and Ref.
This behavior of returning something when null is surprising, as this is not how normal
functions behave, and not very useful. Instead, we now assert that the function is not
null when being called.
* wtf/Function.h:
(WTF::Function operator(...)):
Instead of allowing a null callable wrapper by returning the default construction of
the return type, assert that the wrapper is there when calling a Function.
2017-08-08 Filip Pizlo <fpizlo@apple.com>
Baseline JIT should do caging
https://bugs.webkit.org/show_bug.cgi?id=175037
Reviewed by Mark Lam.
* wtf/Gigacage.h:
(Gigacage::disableDisablingPrimitiveGigacageIfShouldBeEnabled):
(Gigacage::isDisablingPrimitiveGigacageDisabled):
(Gigacage::isPrimitiveGigacagePermanentlyEnabled):
(Gigacage::canPrimitiveGigacageBeDisabled):
(Gigacage::basePtr):
2017-08-08 Ryan Haddad <ryanhaddad@apple.com>
Unreviewed, rolling out r220368.
This change caused WK1 tests to exit early with crashes.
Reverted changeset:
"Baseline JIT should do caging"
https://bugs.webkit.org/show_bug.cgi?id=175037
http://trac.webkit.org/changeset/220368
2017-08-08 Michael Catanzaro <mcatanzaro@igalia.com>
[CMake] Properly test if compiler supports compiler flags
https://bugs.webkit.org/show_bug.cgi?id=174490
Reviewed by Konstantin Tokarev.
* wtf/Compiler.h:
2017-08-07 Filip Pizlo <fpizlo@apple.com>
Baseline JIT should do caging
https://bugs.webkit.org/show_bug.cgi?id=175037
Reviewed by Mark Lam.
* wtf/Gigacage.h:
(Gigacage::disableDisablingPrimitiveGigacageIfShouldBeEnabled):
(Gigacage::isDisablingPrimitiveGigacageDisabled):
(Gigacage::isPrimitiveGigacagePermanentlyEnabled):
(Gigacage::canPrimitiveGigacageBeDisabled):
2017-08-07 Filip Pizlo <fpizlo@apple.com>
Unreviewed, try to fix Windows build.
* wtf/Gigacage.cpp:
* wtf/Gigacage.h:
2017-08-06 Filip Pizlo <fpizlo@apple.com>
Primitive auxiliaries and JSValue auxiliaries should have separate gigacages
https://bugs.webkit.org/show_bug.cgi?id=174919
Reviewed by Keith Miller.
This mirrors the changes from bmalloc/Gigacage.h.
Also it teaches CagedPtr how to reason about multiple gigacages.
* wtf/CagedPtr.h:
(WTF::CagedPtr::get const):
(WTF::CagedPtr::operator[] const):
* wtf/Gigacage.cpp:
(Gigacage::tryMalloc):
(Gigacage::tryAllocateVirtualPages):
(Gigacage::freeVirtualPages):
(Gigacage::tryAlignedMalloc):
(Gigacage::alignedFree):
(Gigacage::free):
* wtf/Gigacage.h:
(Gigacage::disablePrimitiveGigacage):
(Gigacage::addPrimitiveDisableCallback):
(Gigacage::removePrimitiveDisableCallback):
(Gigacage::name):
(Gigacage::basePtr):
(Gigacage::caged):
(Gigacage::isCaged):
(Gigacage::tryAlignedMalloc):
(Gigacage::alignedFree):
(Gigacage::free):
(Gigacage::disableGigacage): Deleted.
(Gigacage::addDisableCallback): Deleted.
(Gigacage::removeDisableCallback): Deleted.
2017-08-07 Brian Burg <bburg@apple.com>
Remove CANVAS_PATH compilation guard
https://bugs.webkit.org/show_bug.cgi?id=175207
Reviewed by Sam Weinig.
* wtf/FeatureDefines.h:
2017-08-05 Filip Pizlo <fpizlo@apple.com>
REGRESSION (r219895-219897): Number of leaks on Open Source went from 9240 to 235983 and is now at 302372
https://bugs.webkit.org/show_bug.cgi?id=175083
Reviewed by Oliver Hunt.
Adds a classic ReadWriteLock class. I wrote my own because I can never remember if the pthread one is
guaranted to bias in favor of writers or not.
* WTF.xcodeproj/project.pbxproj:
* wtf/Condition.h:
(WTF::ConditionBase::construct):
(WTF::Condition::Condition):
* wtf/Lock.h:
(WTF::LockBase::construct):
(WTF::Lock::Lock):
* wtf/ReadWriteLock.cpp: Added.
(WTF::ReadWriteLockBase::construct):
(WTF::ReadWriteLockBase::readLock):
(WTF::ReadWriteLockBase::readUnlock):
(WTF::ReadWriteLockBase::writeLock):
(WTF::ReadWriteLockBase::writeUnlock):
* wtf/ReadWriteLock.h: Added.
(WTF::ReadWriteLockBase::ReadLock::tryLock):
(WTF::ReadWriteLockBase::ReadLock::lock):
(WTF::ReadWriteLockBase::ReadLock::unlock):
(WTF::ReadWriteLockBase::WriteLock::tryLock):
(WTF::ReadWriteLockBase::WriteLock::lock):
(WTF::ReadWriteLockBase::WriteLock::unlock):
(WTF::ReadWriteLockBase::read):
(WTF::ReadWriteLockBase::write):
(WTF::ReadWriteLock::ReadWriteLock):
2017-08-04 Matt Lewis <jlewis3@apple.com>
Unreviewed, rolling out r220271.
Rolling out due to Layout Test failing on iOS Simulator.
Reverted changeset:
"Remove STREAMS_API compilation guard"
https://bugs.webkit.org/show_bug.cgi?id=175165
http://trac.webkit.org/changeset/220271
2017-08-04 Youenn Fablet <youenn@apple.com>
Remove STREAMS_API compilation guard
https://bugs.webkit.org/show_bug.cgi?id=175165
Reviewed by Darin Adler.
* wtf/FeatureDefines.h:
2017-08-03 Brian Burg <bburg@apple.com>
Remove ENABLE(WEB_SOCKET) guards
https://bugs.webkit.org/show_bug.cgi?id=167044
Reviewed by Joseph Pecoraro.
* wtf/FeatureDefines.h:
2017-08-03 Youenn Fablet <youenn@apple.com>
Remove FETCH_API compilation guard
https://bugs.webkit.org/show_bug.cgi?id=175154
Reviewed by Chris Dumez.
* wtf/FeatureDefines.h:
2017-08-03 Brady Eidson <beidson@apple.com>
Add SW IDLs and stub out basic functionality.
https://bugs.webkit.org/show_bug.cgi?id=175115
Reviewed by Chris Dumez.
* wtf/FeatureDefines.h:
2017-08-03 Yusuke Suzuki <utatane.tea@gmail.com>
Unreviewed, build fix for Windows port
https://bugs.webkit.org/show_bug.cgi?id=175013
* wtf/Threading.h:
2017-08-03 Yusuke Suzuki <utatane.tea@gmail.com>
Merge ThreadHolder to WTF::Thread itself
https://bugs.webkit.org/show_bug.cgi?id=175013
Reviewed by Mark Lam.
Currently, we store ThreadHolder* to the TLS, and ThreadHolder* holds Ref<Thread>.
When we get Thread& from the current thread TLS, we need to dereference the ThreadHolder*.
However, ideally, we can store Thread* directly to the current thread TLS.
While the ThreadHolder design is beautiful, it's worth optimizing by storing Thread* directly
since Thread::current() is so frequently executed.
This patch merges ThreadHolder to Thread. And we now store Thread* directly in the TLS.
When storing it to TLS, we call leakRef() to keep Thread ref count incremented by the TLS.
And when destroying the TLS, we call `deref()` to ensure that Thread* is dereferenced from
the TLS.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/ThreadHolder.cpp: Removed.
* wtf/ThreadHolder.h: Removed.
* wtf/ThreadHolderPthreads.cpp: Removed.
* wtf/ThreadHolderWin.cpp: Removed.
* wtf/Threading.cpp:
(WTF::Thread::entryPoint):
(WTF::initializeThreading):
* wtf/Threading.h:
(WTF::Thread::currentMayBeNull):
(WTF::Thread::current):
* wtf/ThreadingPthreads.cpp:
(WTF::Thread::waitForCompletion):
(WTF::Thread::initializeCurrentTLS):
(WTF::Thread::initializeTLSKey):
(WTF::Thread::initializeTLS):
(WTF::Thread::destructTLS):
(WTF::Thread::createCurrentThread): Deleted.
* wtf/ThreadingWin.cpp:
(WTF::Thread::initializeCurrentTLS):
(WTF::threadMapMutex):
(WTF::Thread::initializeTLSKey):
(WTF::Thread::currentDying):
(WTF::Thread::get):
(WTF::Thread::initializeTLS):
(WTF::Thread::destructTLS):
(WTF::waitForThreadCompletion):
(WTF::Thread::createCurrentThread): Deleted.
2017-08-03 Yusuke Suzuki <utatane.tea@gmail.com>
[Linux][WTF] Use one global semaphore to notify thread suspend and resume completion
https://bugs.webkit.org/show_bug.cgi?id=175124
Reviewed by Carlos Garcia Campos.
POSIX sem_t is used to notify thread suspend and resume completion in Linux ports
since sem_post is async-signal-safe function. Since we guard suspend() and resume()
with one global lock, this semaphore is also guarded by this lock. So we do not need
to have semaphore per WTF::Thread.
This patch introduces one global Semaphore. And drop per thread semaphore.
* wtf/Threading.h:
* wtf/ThreadingPthreads.cpp:
(WTF::Thread::~Thread):
(WTF::Semaphore::Semaphore):
(WTF::Semaphore::~Semaphore):
(WTF::Semaphore::wait):
(WTF::Semaphore::post):
(WTF::Thread::signalHandlerSuspendResume):
(WTF::Thread::initializePlatformThreading):
(WTF::Thread::suspend):
(WTF::Thread::resume):
(WTF::Thread::Thread): Deleted.
* wtf/ThreadingWin.cpp:
(WTF::Thread::Thread): Deleted.
2017-08-03 Yusuke Suzuki <utatane.tea@gmail.com>
[Linux][WTF] Reduce sizeof(WTF::Thread) by using a pointer to PlatformRegisters
https://bugs.webkit.org/show_bug.cgi?id=175119
Reviewed by Carlos Garcia Campos.
sizeof(PlatformRegisters) is so large. In my Linux box, it is 256. It enlarges the sizeof(WTF::Thread).
However, it is not necessary to hold it in WTF::Thread member. Thread's ucontext data and its stack is
effective while suspending the thread. So, we can just use the pointer to the PlatformRegister instead
of copying it to the member of the WTF::Thread.
* wtf/Threading.h:
* wtf/ThreadingPthreads.cpp:
(WTF::Thread::signalHandlerSuspendResume):
(WTF::Thread::getRegisters):
2017-08-02 Yusuke Suzuki <utatane.tea@gmail.com>
Unreviewed, build fix for Windows port
https://bugs.webkit.org/show_bug.cgi?id=174716
This ugliness will be fixed in https://bugs.webkit.org/show_bug.cgi?id=175013.
* wtf/ThreadHolder.h:
* wtf/Threading.h:
2017-08-02 Yusuke Suzuki <utatane.tea@gmail.com>
Merge WTFThreadData to Thread::current
https://bugs.webkit.org/show_bug.cgi?id=174716
Reviewed by Mark Lam.
We placed thread specific data in WTFThreadData previously. But now, we have a new good place
to put thread specific data: WTF::Thread. Before this patch, WTFThreadData and WTF::Thread
sometimes have the completely same fields (m_stack etc.) due to initialization order limitations.
This patch merges WTFThreadData to WTF::Thread. We apply WTFThreadData's initialization style
to WTF::Thread. So, WTF::Thread's holder now uses fast TLS for darwin environment. Thus,
Thread::current() access is now accelerated. And WTF::Thread::current() can be accessed even
before calling WTF::initializeThreading.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/LockAlgorithm.h:
* wtf/LockAlgorithmInlines.h:
* wtf/MainThread.h:
* wtf/ParkingLot.cpp:
* wtf/StackStats.cpp:
(WTF::StackStats::PerThreadStats::PerThreadStats):
(WTF::StackStats::CheckPoint::CheckPoint):
(WTF::StackStats::CheckPoint::~CheckPoint):
(WTF::StackStats::probe):
(WTF::StackStats::LayoutCheckPoint::LayoutCheckPoint):
* wtf/ThreadHolder.cpp:
(WTF::ThreadHolder::initializeCurrent):
* wtf/ThreadHolder.h:
(WTF::ThreadHolder::ThreadHolder):
(WTF::ThreadHolder::currentMayBeNull):
(WTF::ThreadHolder::current):
* wtf/ThreadHolderPthreads.cpp:
(WTF::ThreadHolder::initializeKey):
(WTF::ThreadHolder::initialize):
(WTF::ThreadHolder::destruct):
(WTF::ThreadHolder::initializeOnce): Deleted.
(WTF::ThreadHolder::current): Deleted.
* wtf/ThreadHolderWin.cpp:
(WTF::ThreadHolder::initializeKey):
(WTF::ThreadHolder::currentDying):
(WTF::ThreadHolder::initialize):
(WTF::ThreadHolder::initializeOnce): Deleted.
(WTF::ThreadHolder::current): Deleted.
* wtf/Threading.cpp:
(WTF::Thread::initializeInThread):
(WTF::Thread::entryPoint):
(WTF::Thread::create):
(WTF::Thread::didExit):
(WTF::initializeThreading):
(WTF::Thread::currentMayBeNull): Deleted.
* wtf/Threading.h:
(WTF::Thread::current):
(WTF::Thread::atomicStringTable):
(WTF::Thread::setCurrentAtomicStringTable):
(WTF::Thread::stackStats):
(WTF::Thread::savedStackPointerAtVMEntry):
(WTF::Thread::setSavedStackPointerAtVMEntry):
(WTF::Thread::savedLastStackTop):
(WTF::Thread::setSavedLastStackTop):
* wtf/ThreadingPrimitives.h:
* wtf/ThreadingPthreads.cpp:
(WTF::Thread::createCurrentThread):
(WTF::Thread::current): Deleted.
* wtf/ThreadingWin.cpp:
(WTF::Thread::createCurrentThread):
(WTF::Thread::current): Deleted.
* wtf/WTFThreadData.cpp: Removed.
* wtf/WTFThreadData.h: Removed.
* wtf/text/AtomicString.cpp:
* wtf/text/AtomicStringImpl.cpp:
(WTF::stringTable):
* wtf/text/AtomicStringTable.cpp:
(WTF::AtomicStringTable::create):
* wtf/text/AtomicStringTable.h:
2017-08-02 Joseph Pecoraro <pecoraro@apple.com>
NeverDestroyed related leaks seen on bots
https://bugs.webkit.org/show_bug.cgi?id=175113
Reviewed by Yusuke Suzuki.
* wtf/NeverDestroyed.h:
(WTF::NeverDestroyed::NeverDestroyed):
Previously the result of makeNeverDestroyed was not always moving into
the `static NeverDestroyed` static local variable. In some cases it would
re-invoke the constructor, creating a new NeverDestroyed object. In the
case of a Vector it was causing leaks.
Adding a move constructor convinces the compiler to move the result
of makeNeverDestroyed into the NeverDestroyed static. It doesn't actually
invoke the move constructor here, which I believe means it is deciding
to perform optional copy elision optimization.
'http://en.cppreference.com/w/cpp/language/copy_elision
2017-08-02 Filip Pizlo <fpizlo@apple.com>
All C++ accesses to JSObject::m_butterfly should do caging
https://bugs.webkit.org/show_bug.cgi?id=175039
Reviewed by Keith Miller.
Adds a smart pointer class that does various kinds of caging for you.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/CagedPtr.h: Added.
(WTF::CagedPtr::CagedPtr):
(WTF::CagedPtr::get const):
(WTF::CagedPtr::getMayBeNull const):
(WTF::CagedPtr::operator== const):
(WTF::CagedPtr::operator!= const):
(WTF::CagedPtr::operator bool const):
(WTF::CagedPtr::operator* const):
(WTF::CagedPtr::operator-> const):
2017-08-02 Filip Pizlo <fpizlo@apple.com>
We should be OK with the gigacage being disabled on gmalloc
https://bugs.webkit.org/show_bug.cgi?id=175082
Reviewed by Michael Saboff.
* wtf/Gigacage.h:
(Gigacage::shouldBeEnabled):
2017-08-01 Filip Pizlo <fpizlo@apple.com>
Bmalloc and GC should put auxiliaries (butterflies, typed array backing stores) in a gigacage (separate multi-GB VM region)
https://bugs.webkit.org/show_bug.cgi?id=174727
Reviewed by Mark Lam.
For the Gigacage project to have minimal impact, we need to have some abstraction that allows code to
avoid having to guard itself with #if's. This adds a Gigacage abstraction that overlays the Gigacage
namespace from bmalloc, which always lets you call things like Gigacage::caged and Gigacage::tryMalloc.
Because of how many places need to possibly allocate in a gigacage, or possibly perform caged accesses,
it's better to hide the question of whether or not it's enabled inside this API.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/FastMalloc.cpp:
* wtf/Gigacage.cpp: Added.
(Gigacage::tryMalloc):
(Gigacage::tryAllocateVirtualPages):
(Gigacage::freeVirtualPages):
(Gigacage::tryAlignedMalloc):
(Gigacage::alignedFree):
(Gigacage::free):
* wtf/Gigacage.h: Added.
(Gigacage::ensureGigacage):
(Gigacage::disableGigacage):
(Gigacage::addDisableCallback):
(Gigacage::removeDisableCallback):
(Gigacage::caged):
(Gigacage::isCaged):
(Gigacage::tryAlignedMalloc):
(Gigacage::alignedFree):
(Gigacage::free):
2017-07-31 Matt Lewis <jlewis3@apple.com>
Unreviewed, rolling out r220060.
This broke our internal builds. Contact reviewer of patch for
more information.
Reverted changeset:
"Merge WTFThreadData to Thread::current"
https://bugs.webkit.org/show_bug.cgi?id=174716
http://trac.webkit.org/changeset/220060
2017-07-31 Yusuke Suzuki <utatane.tea@gmail.com>
Merge WTFThreadData to Thread::current
https://bugs.webkit.org/show_bug.cgi?id=174716
Reviewed by Sam Weinig.
We placed thread specific data in WTFThreadData previously. But now, we have a new good place
to put thread specific data: WTF::Thread. Before this patch, WTFThreadData and WTF::Thread
sometimes have the completely same fields (m_stack etc.) due to initialization order limitations.
This patch merges WTFThreadData to WTF::Thread. We apply WTFThreadData's initialization style
to WTF::Thread. So, WTF::Thread's holder now uses fast TLS for darwin environment. Thus,
Thread::current() access is now accelerated. And WTF::Thread::current() can be accessed even
before calling WTF::initializeThreading.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/LockAlgorithm.h:
* wtf/LockAlgorithmInlines.h:
* wtf/MainThread.h:
* wtf/ParkingLot.cpp:
* wtf/StackStats.cpp:
(WTF::StackStats::PerThreadStats::PerThreadStats):
(WTF::StackStats::CheckPoint::CheckPoint):
(WTF::StackStats::CheckPoint::~CheckPoint):
(WTF::StackStats::probe):
(WTF::StackStats::LayoutCheckPoint::LayoutCheckPoint):
* wtf/ThreadHolder.cpp:
(WTF::ThreadHolder::initializeCurrent):
* wtf/ThreadHolder.h:
(WTF::ThreadHolder::ThreadHolder):
(WTF::ThreadHolder::currentMayBeNull):
(WTF::ThreadHolder::current):
* wtf/ThreadHolderPthreads.cpp:
(WTF::ThreadHolder::initialize):
(WTF::ThreadHolder::destruct):
(WTF::ThreadHolder::current): Deleted.
* wtf/ThreadHolderWin.cpp:
(WTF::ThreadHolder::currentDying):
(WTF::ThreadHolder::initialize):
(WTF::ThreadHolder::current): Deleted.
* wtf/Threading.cpp:
(WTF::Thread::initializeInThread):
(WTF::Thread::entryPoint):
(WTF::Thread::didExit):
(WTF::initializeThreading):
(WTF::Thread::currentMayBeNull): Deleted.
* wtf/Threading.h:
(WTF::Thread::atomicStringTable):
(WTF::Thread::setCurrentAtomicStringTable):
(WTF::Thread::stackStats):
(WTF::Thread::savedStackPointerAtVMEntry):
(WTF::Thread::setSavedStackPointerAtVMEntry):
(WTF::Thread::savedLastStackTop):
(WTF::Thread::setSavedLastStackTop):
(WTF::Thread::current):
* wtf/ThreadingPrimitives.h:
* wtf/ThreadingPthreads.cpp:
(WTF::Thread::createCurrentThread):
(WTF::Thread::current): Deleted.
* wtf/ThreadingWin.cpp:
(WTF::Thread::createCurrentThread):
(WTF::Thread::current): Deleted.
* wtf/WTFThreadData.cpp: Removed.
* wtf/WTFThreadData.h: Removed.
* wtf/text/AtomicString.cpp:
* wtf/text/AtomicStringImpl.cpp:
(WTF::stringTable):
* wtf/text/AtomicStringTable.cpp:
(WTF::AtomicStringTable::create):
* wtf/text/AtomicStringTable.h:
2017-07-31 Xabier Rodriguez Calvar <calvaris@igalia.com>
Created a bool pretty printer at WTF for debugging purposes
https://bugs.webkit.org/show_bug.cgi?id=174893
Reviewed by Darin Adler.
* wtf/PrintStream.cpp:
(WTF::printInternal): The overload taking bool uses boolForPrinting
* wtf/PrintStream.h:
(WTF::boolForPrinting): Converts a bool in "true" or "false".
2017-07-30 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Introduce Private Symbols
https://bugs.webkit.org/show_bug.cgi?id=174935
Reviewed by Darin Adler.
Upcoming proposal of class fields[1] requires private fields.
The simple way to implement it is adding a property with a private symbol.
Currently, we have private symbols for internal properties. They are usual
Symbols managed by the hash table. So basically private symbols are statically
created in BuiltinNames. However this new proposal encourages users to create
such private symbols more and more.
So, this patch introduces notion of "Private" into WTF SymbolImpl. This patch
adds PrivateSymbolImpl. This is SymbolImpl with "Private" flag. We do not need
to look up the symbol from the hash table to check whether the given symbol
is a private one.
[1]: https://github.com/tc39/proposal-class-fields
* wtf/text/StringImpl.h:
* wtf/text/SymbolImpl.cpp:
(WTF::PrivateSymbolImpl::create):
(WTF::PrivateSymbolImpl::createNullSymbol):
* wtf/text/SymbolImpl.h:
(WTF::SymbolImpl::isPrivate):
(WTF::SymbolImpl::StaticSymbolImpl::StaticSymbolImpl):
(WTF::SymbolImpl::SymbolImpl):
(WTF::PrivateSymbolImpl::PrivateSymbolImpl):
2017-07-30 Brady Eidson <beidson@apple.com>
Add URLSchemeHandler API tests that verify the lack of URLSchemeTask object leaks.
https://bugs.webkit.org/show_bug.cgi?id=174958
Reviewed by Darin Adler.
This patch adds a new template class "InstanceCounted<T>".
For each specialization, "InstanceCounted" will keep track of the total number of
instances in existence.
This makes explicate leak checking in API tests possible.
Since this adds some runtime and storage overhead the code that actually does anything
is only compiled in debug builds.
* WTF.xcodeproj/project.pbxproj:
* wtf/InstanceCounted.h: Added.
(WTF::InstanceCounted::InstanceCounted):
(WTF::InstanceCounted::instanceCount):
(WTF::InstanceCounted::~InstanceCounted):
2017-07-27 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Drop Thread initialization wait in some platforms by introducing StackBounds::newThreadStackBounds(PlatformThreadHandle&)
https://bugs.webkit.org/show_bug.cgi?id=174303
Reviewed by Mark Lam.
Currently, the caller thread of Thread::create() need to wait for completion of the initialization of the target thread.
This is because we need to initialize Thread::m_stack in the target thread. Before this patch, a target thread's
StackBounds can only be retrieved by the target thread itself. However, this potentially causes context-switching between
the caller and the target threads and hurts efficiency of creating threads.
Fortunately, in some platforms (including major platforms except for Windows), we can get StackBounds of a target
thread from a caller thread. This allows us to avoid waiting for completion of thread initialization.
In this patch, we introduce HAVE_STACK_BOUNDS_FOR_NEW_THREAD and StackBounds::newThreadStackBounds. When creating
a new thread, we will use StackBounds::newThreadStackBounds to get StackBounds if possible. As a result, we
do not need to wait for completion of thread initialization to ensure m_stack field of Thread is initialized.
While some documents claim that it is possible on Windows to get the StackBounds of another thread[1], the method relies on
undocumented Windows NT APIs (NtQueryInformationThread, NtReadVirtualMemory etc.). So in this patch, we just
use the conservative approach simply waiting for completion of thread initialization.
[1]: https://stackoverflow.com/questions/3918375/how-to-get-thread-stack-information-on-windows
* wtf/Platform.h:
* wtf/StackBounds.cpp:
(WTF::StackBounds::newThreadStackBounds):
(WTF::StackBounds::currentThreadStackBoundsInternal):
(WTF::StackBounds::initialize): Deleted.
* wtf/StackBounds.h:
(WTF::StackBounds::currentThreadStackBounds):
(WTF::StackBounds::StackBounds):
* wtf/Threading.cpp:
(WTF::Thread::NewThreadContext::NewThreadContext):
(WTF::Thread::entryPoint):
(WTF::Thread::create):
(WTF::Thread::initialize): Deleted.
* wtf/Threading.h:
* wtf/ThreadingPrimitives.h:
* wtf/ThreadingPthreads.cpp:
(WTF::Thread::initializeCurrentThreadEvenIfNonWTFCreated):
(WTF::wtfThreadEntryPoint):
(WTF::Thread::establishHandle):
(WTF::Thread::initializeCurrentThreadInternal):
(WTF::Thread::current):
* wtf/ThreadingWin.cpp:
(WTF::Thread::initializeCurrentThreadEvenIfNonWTFCreated):
(WTF::Thread::initializeCurrentThreadInternal):
(WTF::Thread::current):
* wtf/win/MainThreadWin.cpp:
(WTF::initializeMainThreadPlatform):
2017-07-27 JF Bastien <jfbastien@apple.com>
Update lock benchmarks
https://bugs.webkit.org/show_bug.cgi?id=174907
Reviewed by Filip Pizlo.
* benchmarks/ConditionSpeedTest.cpp:
(main):
* benchmarks/LockFairnessTest.cpp:
* benchmarks/LockSpeedTest.cpp:
* benchmarks/ToyLocks.h:
2017-07-26 Brian Burg <bburg@apple.com>
Remove WEB_TIMING feature flag
https://bugs.webkit.org/show_bug.cgi?id=174795
Reviewed by Alex Christensen.
* wtf/FeatureDefines.h:
2017-07-26 Claudio Saavedra <csaavedra@igalia.com>
[WPE] Enable KeyboardEvent key and code attributes
https://bugs.webkit.org/show_bug.cgi?id=174822
Reviewed by Žan Doberšek.
There is no reason for this to be disabled from what I see.
* wtf/FeatureDefines.h: Enable KeyboardEvent key and code attributes.
2017-07-23 Filip Pizlo <fpizlo@apple.com>
B3 should do LICM
https://bugs.webkit.org/show_bug.cgi?id=174750
Reviewed by Keith Miller and Saam Barati.
Moved DFG::NaturalLoops to WTF. The new templatized NaturalLoops<> uses the same Graph abstraction as
Dominators<>. This allows us to add a B3::NaturalLoops for free.
Also made small tweaks to RangeSet, which the LICM uses.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/Dominators.h:
* wtf/NaturalLoops.h: Added.
(WTF::NaturalLoop::NaturalLoop):
(WTF::NaturalLoop::graph):
(WTF::NaturalLoop::header):
(WTF::NaturalLoop::size):
(WTF::NaturalLoop::at):
(WTF::NaturalLoop::operator[]):
(WTF::NaturalLoop::contains):
(WTF::NaturalLoop::index):
(WTF::NaturalLoop::isOuterMostLoop):
(WTF::NaturalLoop::dump):
(WTF::NaturalLoop::addBlock):
(WTF::NaturalLoops::NaturalLoops):
(WTF::NaturalLoops::graph):
(WTF::NaturalLoops::numLoops):
(WTF::NaturalLoops::loop):
(WTF::NaturalLoops::headerOf):
(WTF::NaturalLoops::innerMostLoopOf):
(WTF::NaturalLoops::innerMostOuterLoop):
(WTF::NaturalLoops::belongsTo):
(WTF::NaturalLoops::loopDepth):
(WTF::NaturalLoops::loopsOf):
(WTF::NaturalLoops::dump):
* wtf/RangeSet.h:
(WTF::RangeSet::begin):
(WTF::RangeSet::end):
(WTF::RangeSet::addAll):
2017-07-23 Michael Catanzaro <mcatanzaro@igalia.com>
Implement FALLTHROUGH attribute for C with GCC
https://bugs.webkit.org/show_bug.cgi?id=174555
Reviewed by Darin Adler.
My previous attempt to silence the JSC -Wimplicit-fallthrough warnings failed because they
are coming from a C file, and our FALLTHROUGH macro is only implemented for C++. So
implement it for C as well, using C attribute syntax.
Note this is only possible to do for GCC, because Clang only supports this attribute using
the [[C++ attribute syntax]].
* wtf/Compiler.h:
2017-07-14 Filip Pizlo <fpizlo@apple.com>
It should be easy to decide how WebKit yields
https://bugs.webkit.org/show_bug.cgi?id=174298
Reviewed by Saam Barati.
Created a Thread::yield() abstraction for sched_yield(), and made WTF use it everywhere that it
had previously used std::this_thread::yield().
To make it less annoying to experiment with changes to the lock algorithm in the future, this also
moves the meat of the algorithm into LockAlgorithmInlines.h. Only two files include that header.
Since LockAlgorithm.h no longer includes ParkingLot.h, a bunch of files in WK now need to include
timing headers (Seconds, MonotonicTime, etc) manually.
* WTF.xcodeproj/project.pbxproj:
* benchmarks/ToyLocks.h:
* wtf/CMakeLists.txt:
* wtf/Lock.cpp:
* wtf/LockAlgorithm.h:
(WTF::LockAlgorithm::lockSlow): Deleted.
(WTF::LockAlgorithm::unlockSlow): Deleted.
* wtf/LockAlgorithmInlines.h: Added.
(WTF::hasParkedBit>::lockSlow):
(WTF::hasParkedBit>::unlockSlow):
* wtf/MainThread.cpp:
* wtf/RunLoopTimer.h:
* wtf/Threading.cpp:
* wtf/Threading.h:
* wtf/ThreadingPthreads.cpp:
(WTF::Thread::yield):
* wtf/ThreadingWin.cpp:
(WTF::Thread::yield):
* wtf/WordLock.cpp:
(WTF::WordLockBase::lockSlow):
(WTF::WordLockBase::unlockSlow):
2017-07-22 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Extend ThreadGroup::add results from bool to ThreadGroupAddResult
https://bugs.webkit.org/show_bug.cgi?id=174705
Reviewed by Mark Lam.
After starting using ThreadGroup to bookkeep active threads for Signals,
we would like to know tristate of ThreadGroup::add result, NewlyAdded, AlreadyAdded, NotAdded.
This patch extends the result of ThreadGroup::add from bool to ThreadGroupAddResult tristate.
Note that NotAdded is returned if the target thread is dying.
* wtf/ThreadGroup.cpp:
(WTF::ThreadGroup::add):
(WTF::ThreadGroup::addCurrentThread):
* wtf/ThreadGroup.h:
* wtf/Threading.cpp:
(WTF::Thread::addToThreadGroup):
* wtf/Threading.h:
* wtf/threads/Signals.cpp:
(WTF::registerThreadForMachExceptionHandling):
2017-07-21 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r219732.
https://bugs.webkit.org/show_bug.cgi?id=174748
static is not threadsafe in WebKit tree (Requested by
yusukesuzuki on #webkit).
Reverted changeset:
"[WTF] Drop initializeDate"
https://bugs.webkit.org/show_bug.cgi?id=174714
http://trac.webkit.org/changeset/219732
2017-07-21 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Drop initializeDate
https://bugs.webkit.org/show_bug.cgi?id=174714
Reviewed by Darin Adler.
minYear static variable will be initialized in an exclusive manner, which is ensured by C++ "static" semantics.
Thus, we do not need to call initializeDate() explicitly.
* wtf/DateMath.cpp:
(WTF::equivalentYearForDST):
(WTF::initializeDates): Deleted.
* wtf/Threading.cpp:
(WTF::initializeThreading):
2017-07-21 Yusuke Suzuki <utatane.tea@gmail.com>
[JSC] Introduce static symbols
https://bugs.webkit.org/show_bug.cgi?id=158863
Reviewed by Darin Adler.
We add a new class StaticSymbolImpl. StaticSymbolImpl can offer
the way to create static SymbolImpl. It can be shared between
multiple VMs and multiple threads.
* wtf/text/SymbolImpl.h:
(WTF::SymbolImpl::StaticSymbolImpl::StaticSymbolImpl):
(WTF::SymbolImpl::StaticSymbolImpl::operator SymbolImpl&):
For StaticSymbolImpl's hashForSymbol, we use usual string hash value.
Since all the SymbolImpls are unique, basically, any value is OK here.
Non-confilicting to the other SymbolImpls is ideal.
2017-07-21 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Newly added AtomicStringImpl should use BufferInternal static string if StringImpl is static
https://bugs.webkit.org/show_bug.cgi?id=174501
Reviewed by Darin Adler.
When creating AtomicStringImpl from static StringImpl, we can just use createWithoutCopying
to create a BufferInternal AtomicStringImpl which m_data{8,16} is static string's one.
* wtf/text/AtomicStringImpl.cpp:
(WTF::CStringTranslator::hash):
(WTF::CStringTranslator::equal):
(WTF::CStringTranslator::translate):
(WTF::AtomicStringImpl::add):
(WTF::HashTranslatorCharBuffer::HashTranslatorCharBuffer):
(WTF::UCharBufferTranslator::hash):
(WTF::UCharBufferTranslator::equal):
(WTF::UCharBufferTranslator::translate):
(WTF::LCharBufferTranslator::hash):
(WTF::LCharBufferTranslator::equal):
(WTF::LCharBufferTranslator::translate):
(WTF::BufferFromStaticDataTranslator::hash):
(WTF::BufferFromStaticDataTranslator::equal):
(WTF::BufferFromStaticDataTranslator::translate):
(WTF::AtomicStringImpl::addLiteral):
(WTF::addSymbol):
(WTF::addStatic):
(WTF::AtomicStringImpl::addSlowCase):
(WTF::AtomicStringImpl::lookUp):
(WTF::CharBufferFromLiteralDataTranslator::hash): Deleted.
(WTF::CharBufferFromLiteralDataTranslator::equal): Deleted.
(WTF::CharBufferFromLiteralDataTranslator::translate): Deleted.
(WTF::addSubstring): Deleted.
* wtf/text/StringImpl.h:
2017-07-21 Konstantin Tokarev <annulen@yandex.ru>
[cmake] Unreviewed, add definitions necessary to use ICU shipped with macOS
macOS system ICU libraries are built with U_DISABLE_RENAMING=1 and
U_SHOW_CPLUSPLUS_API=0. After r219155 we have to pass this definitons
explicitly, because ICU headers in the tree are not modified anymore.
* wtf/PlatformMac.cmake: Rely on ICU_LIBRARIES instead of passing ICU
library name explicitly in WTF_LIBRARIES.
2017-07-20 Chris Dumez <cdumez@apple.com>
Replace calls to Vector::resize() with calls to more efficient shrink() / grow() when applicable
https://bugs.webkit.org/show_bug.cgi?id=174660
Reviewed by Geoffrey Garen.
Replace calls to Vector::resize() with calls to more efficient shrink() / grow() when applicable.
This essentially replaces a branch to figure out if the new size is less or greater than the
current size by an assertion.
* wtf/IndexSparseSet.h:
(WTF::OverflowHandler>::IndexSparseSet):
(WTF::OverflowHandler>::clear):
* wtf/Insertion.h:
(WTF::executeInsertions):
* wtf/RangeSet.h:
(WTF::RangeSet::compact):
* wtf/Vector.h:
(WTF::removeRepeatedElements):
* wtf/persistence/Coders.h:
2017-07-20 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Use ThreadGroup to bookkeep active threads for Mach exception
https://bugs.webkit.org/show_bug.cgi?id=174678
Reviewed by Mark Lam.
We can use ThreadGroup to bookkeep active threads for Mach exceptions.
When the thread dies, it is automatically removed from the thread groups.
So we do not need to call unregisterThreadForMachExceptionHandling.
* wtf/ThreadGroup.cpp:
(WTF::ThreadGroup::~ThreadGroup):
(WTF::ThreadGroup::add):
* wtf/ThreadGroup.h:
* wtf/ThreadHolder.cpp:
(WTF::ThreadHolder::~ThreadHolder):
* wtf/Threading.cpp:
(WTF::Thread::addToThreadGroup):
(WTF::Thread::removeFromThreadGroup):
* wtf/Threading.h:
* wtf/threads/Signals.cpp:
(WTF::setExceptionPorts):
(WTF::activeThreads):
(WTF::registerThreadForMachExceptionHandling):
(WTF::installSignalHandler):
(WTF::unregisterThreadForMachExceptionHandling): Deleted.
* wtf/threads/Signals.h:
2017-07-19 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Remove unnecessary indirection of WTF::Thread entry point
https://bugs.webkit.org/show_bug.cgi?id=174291
Reviewed by Mark Lam.
Now wtfThreadEntryPoint is almost the same. Only the difference is function signature due to platform APIs.
We remove ThreadFunctionInvocation indirection in ThreadingPthread.cpp and ThreadingWin.cpp.
Also, ThreadFunctionInvocation keeps a RefPtr to the Thread object. This was previously needed to keep the
Thread object alive until the thread itself could install the ThreadHolder into its thread local storage.
The ThreadHolder has a Ref that keeps the Thread object alive for the lifetime of the thread. Since
Thread::create() now waits for the thread to be initialized before returning and Thread::create() hold a Ref
to the Thread object, we are guaranteed that the Thread object will be alive long enough for it to be installed
in the thread's ThreadHolder, and we no longer need ThreadFunctionInvocation.
And we also simplify ThreadHolder::initialize a bit. Now Thread::create waits for the completion of Thread
initialization. So, after establishing thread handle, we can call ThreadHolder::initialize before completing
Thread initialization.
Also we drop errno.h ifdefs in ThreadingWin.cpp. This is introduced to support WinCE. But now WinCE port is removed.
* WTF.xcodeproj/project.pbxproj:
* wtf/ThreadFunctionInvocation.h: Removed.
* wtf/ThreadHolder.h:
* wtf/ThreadHolderWin.cpp:
(WTF::ThreadHolder::initialize):
* wtf/Threading.cpp:
(WTF::Thread::entryPoint):
(WTF::Thread::create):
(WTF::threadEntryPoint): Deleted.
* wtf/Threading.h:
* wtf/ThreadingPthreads.cpp:
(WTF::Thread::initializeCurrentThreadEvenIfNonWTFCreated):
(WTF::wtfThreadEntryPoint):
(WTF::Thread::establishHandle):
(WTF::Thread::initializeCurrentThreadInternal):
(WTF::Thread::current):
(WTF::Thread::establishPlatformSpecificHandle):
(WTF::Thread::createInternal): Deleted.
(WTF::Thread::establish): Deleted.
* wtf/ThreadingWin.cpp:
(WTF::Thread::initializeCurrentThreadEvenIfNonWTFCreated):
(WTF::Thread::initializeCurrentThreadInternal):
(WTF::wtfThreadEntryPoint):
(WTF::Thread::establishHandle):
(WTF::Thread::current):
(WTF::Thread::establishPlatformSpecificHandle):
(WTF::Thread::createInternal): Deleted.
(WTF::Thread::establish): Deleted.
* wtf/win/MainThreadWin.cpp:
(WTF::initializeMainThreadPlatform):
2017-07-19 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Implement WTF::ThreadGroup
https://bugs.webkit.org/show_bug.cgi?id=174081
Reviewed by Mark Lam.
This patch implements WTF::ThreadGroup. It implements core of JSC::MachineThreads with more reliable way.
JSC::MachineThreads was complicated because of managing dead threads. Each JSC::MachineThreads has its
own TLS with a registered destructor. And everytime a thread dies, the registered TLS destructor is called.
And this destructor will remove the current dying thread from JSC::MachineThreads.
However the above implementation is tricky. And each JSC::MachineThreads requires own TLS space, which is
not considered in WTF's Windows ThreadSpecific implementation. Current design works well since we only
have small number of MachineThreads right now.
Instead, we use more reliable way. After introducing WTF::Thread, WTF::Thread has WTF::Thread::didExit,
which is called when associated TLS (with WTF::Thread) is destroyed. We leverage this mechanism to remove
WTF::Thread from MachineThreads.
This patch introduces WTF::ThreadGroup. It is tightly integrated with WTF::Thread: WTF::Thread knows
ThreadGroups which includes this thread. And WTF::ThreadGroup of course knows WTF::Threads added to it.
WTF::Thread::didExit carefully remove itself from WTF::ThreadGroups.
The most important part of this patch is locking. WTF::Thread can die. And WTF::ThreadGroup can die.
If we take a design using two fine grain locks in WTF::Thread and WTF::ThreadGroup, we easily encounter
dead lock. Consider the following case.
1. When adding WTF::Thread (TH) to WTF::ThreadGroup (THG), we first hold a lock of THG, and hold a lock of TH (locking order is THG -> TH).
2. When TH dies, TH need to hold a lock of TH to iterate THGs. And we hold a lock of THG to unregister TH from it (locking order is TH -> THG).
3. When suspending and resuming THs in THG, we first hold a lock of THG. And then, we hold a lock of TH to suspend and resume it (locking order is THG -> TH).
4. When destroying THG, we need to hold a lock of TH to unregister THG from TH. We can hold a lock of THG before that (locking order is THG -> TH).
Then, it easily causes dead lock. We cannot swap the locking order of (2) since iterating THG requires a lock of TH.
To solve this problem, we use std::shared_ptr and std::weak_ptr.
1. When adding WTF::Thread (TH) to WTF::ThreadGroup (THG), we first hold THG, and hold a lock of TH. (THG -> TH)
2. When TH dies, TH first hold lock of TH. And we use std::weak_ptr<>::lock() to retain non-destructed ThreadGroups.
If some of ThreadGroups are dying, we just ignore them. It is ok because such a ThreadGroup will be destructed. So we do not need to unregister this thread from
such a ThreadGroup. Then, we have Vector<std::shared_ptr<ThreadGroup>>. So we unlock a lock of TH. To unregister a thread from thread group, we first hold a
lock of THG and then hold a lock of TH. Both lifetime is ensured: THG is retained by std::shared_ptr. And TH is itself. (TH), (THG -> TH).
3. When suspending and resuming THs in THG, we first hold a lock of THG. And then, we hold a lock of TH to suspend and resume it (THG -> TH).
4. When destroying THG, we hold a lock of THG. And hold a lock of TH. During holding THG's lock, registered thread never dies because (2) holds THG lock. (THG -> TH).
We also fix suspend and resume locking mechanism to avoid dead lock. We should hold the global lock when suspending and resuming.
If we use per-thread lock, the suspended thread can hold the lock of the other threads. It causes dead lock.
* WTF.xcodeproj/project.pbxproj:
* wtf/AutomaticThread.cpp:
* wtf/CMakeLists.txt:
* wtf/CrossThreadCopier.h:
* wtf/ParkingLot.h:
* wtf/ThreadGroup.cpp: Copied from Source/JavaScriptCore/wasm/WasmMachineThreads.cpp.
(WTF::ThreadGroup::~ThreadGroup):
(WTF::ThreadGroup::add):
(WTF::ThreadGroup::addCurrentThread):
* wtf/ThreadGroup.h: Copied from Source/JavaScriptCore/wasm/WasmMachineThreads.cpp.
(WTF::ThreadGroup::create):
(WTF::ThreadGroup::threads):
(WTF::ThreadGroup::getLock):
(WTF::ThreadGroup::weakFromThis):
* wtf/Threading.cpp:
(WTF::shouldRemoveThreadFromThreadGroup):
(WTF::Thread::didExit):
(WTF::Thread::addToThreadGroup):
(WTF::Thread::removeFromThreadGroup):
* wtf/Threading.h:
* wtf/ThreadingPthreads.cpp:
(WTF::Thread::resume):
(WTF::Thread::getRegisters):
* wtf/ThreadingWin.cpp:
(WTF::Thread::resume):
(WTF::Thread::getRegisters):
2017-07-18 Andy Estes <aestes@apple.com>
[Xcode] Enable CLANG_WARN_RANGE_LOOP_ANALYSIS
https://bugs.webkit.org/show_bug.cgi?id=174631
Reviewed by Tim Horton.
* Configurations/Base.xcconfig:
2017-07-18 Yusuke Suzuki <utatane.tea@gmail.com>
WTF::Thread should have the threads stack bounds.
https://bugs.webkit.org/show_bug.cgi?id=173975
Reviewed by Mark Lam.
We move StackBounds from WTFThreadData to WTF::Thread.
One important thing is that we should make valid StackBounds
visible to Thread::create() caller. When the caller get
WTF::Thread from Thread::create(), this WTF::Thread should
have a valid StackBounds. But StackBounds information can be
retrived only in the WTF::Thread's thread itself.
We also clean up WTF::initializeThreading. StringImpl::empty()
is now statically initialized by using constexpr constructor.
Thus we do not need to call StringImpl::empty() explicitly here.
And WTF::initializeThreading() does not have any main thread
affinity right now in all the platforms. So we fix the comment
in Threading.h. Then, now, WTF::initializeThreading() is called
in UI thread when using Web thread in iOS.
* wtf/StackBounds.h:
(WTF::StackBounds::emptyBounds):
(WTF::StackBounds::StackBounds):
* wtf/Threading.cpp:
(WTF::threadEntryPoint):
(WTF::Thread::create):
(WTF::Thread::currentMayBeNull):
(WTF::Thread::initialize):
(WTF::initializeThreading):
* wtf/Threading.h:
(WTF::Thread::stack):
* wtf/ThreadingPthreads.cpp:
(WTF::Thread::initializeCurrentThreadEvenIfNonWTFCreated):
(WTF::Thread::current):
(WTF::initializeCurrentThreadEvenIfNonWTFCreated): Deleted.
(WTF::Thread::currentMayBeNull): Deleted.
* wtf/ThreadingWin.cpp:
(WTF::Thread::initializeCurrentThreadEvenIfNonWTFCreated):
(WTF::Thread::initializeCurrentThreadInternal):
(WTF::Thread::current):
* wtf/WTFThreadData.cpp:
(WTF::WTFThreadData::WTFThreadData):
* wtf/WTFThreadData.h:
(WTF::WTFThreadData::stack):
2017-07-18 Andy Estes <aestes@apple.com>
[Xcode] Enable CLANG_WARN_OBJC_LITERAL_CONVERSION
https://bugs.webkit.org/show_bug.cgi?id=174631
Reviewed by Sam Weinig.
* Configurations/Base.xcconfig:
2017-07-18 Andy Estes <aestes@apple.com>
[Xcode] Enable CLANG_WARN_NON_LITERAL_NULL_CONVERSION
https://bugs.webkit.org/show_bug.cgi?id=174631
Reviewed by Dan Bernstein.
* Configurations/Base.xcconfig:
2017-07-18 Andy Estes <aestes@apple.com>
[Xcode] Enable CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING
https://bugs.webkit.org/show_bug.cgi?id=174631
Reviewed by Darin Adler.
* Configurations/Base.xcconfig:
2017-07-17 Konstantin Tokarev <annulen@yandex.ru>
[cmake] Set library types before their targets are created
https://bugs.webkit.org/show_bug.cgi?id=174600
Reviewed by Michael Catanzaro.
Since r219560 library targets are created before PlatformXXX.cmake
files are processed, however library type must be passed in
add_library() call and cannot be changed afterwards. Set these
variables in OptionsXXX.cmake.
* wtf/PlatformGTK.cmake:
* wtf/PlatformMac.cmake:
2017-07-17 Yoshiaki Jitsukawa <Yoshiaki.Jitsukawa@sony.com>
Move USE_AVFOUNDATION definition on Windows to wtf/Platform.h
https://bugs.webkit.org/show_bug.cgi?id=174356
Reviewed by Brent Fulgham.
Move the definition of USE_AVFOUNDATION on Windows to wtf/platform.h
Add a custom command to generate AVFoundationHeaderDetection.h, which
is renamed from WebCoreHeaderDetection.h
* AVFoundationSupport.py: Moved from Source/WebCore/AVFoundationSupport.py.
* wtf/Platform.h:
* wtf/PlatformWin.cmake:
2017-07-17 Darin Adler <darin@apple.com>
Improve use of NeverDestroyed
https://bugs.webkit.org/show_bug.cgi?id=174348
Reviewed by Sam Weinig.
* wtf/HashSet.h: Added an overload of HashSet::add that takes an initializer list of
const references. This is handy to add a bunch of values all at once. Later we can
consider optimizing to grow the hash table only once instead of deciding whether to
grow repeatedly as we add each value.
(WTF::copyToVector): Changed to use std::copy, removing 4 of the 6 lines of code here.
* wtf/MemoryPressureHandler.cpp: Include NeverDestroyed.h here ...
* wtf/MemoryPressureHandler.h: ... not here.
* wtf/NeverDestroyed.h: Added the ability to have a const NeverDestroyed.
Added a makeNeverDestroyed function that deduces the type from the argument.
With auto, this can be used to avoid writing out a long type twice.
* wtf/ThreadingPthreads.cpp: Removed unneeded include of NeverDestroyed.h.
* wtf/text/AtomicString.cpp: Ditto.
2017-07-17 Konstantin Tokarev <annulen@yandex.ru>
[CMake] Create targets before WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS is called
https://bugs.webkit.org/show_bug.cgi?id=174557
Reviewed by Michael Catanzaro.
* wtf/CMakeLists.txt:
2017-07-14 Jonathan Bedard <jbedard@apple.com>
Add iOS 11 SPI
https://bugs.webkit.org/show_bug.cgi?id=174430
<rdar://problem/33269288>
Reviewed by Tim Horton.
* Configurations/WTF.xcconfig: Exclude MachExceptions.def when building iOS 11 for
the iOS simulator.
2017-07-14 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r219510.
https://bugs.webkit.org/show_bug.cgi?id=174525
Need to revert length() == 0 check for null string (Requested
by yusukesuzuki on #webkit).
Reverted changeset:
"[WTF] Newly added AtomicStringImpl should use BufferInternal
static string if StringImpl is static"
https://bugs.webkit.org/show_bug.cgi?id=174501
http://trac.webkit.org/changeset/219510
2017-07-14 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Newly added AtomicStringImpl should use BufferInternal static string if StringImpl is static
https://bugs.webkit.org/show_bug.cgi?id=174501
Reviewed by Darin Adler.
When creating AtomicStringImpl from static StringImpl, we can just use createWithoutCopying
to create a BufferInternal AtomicStringImpl which m_data{8,16} is static string's one.
* wtf/text/AtomicStringImpl.cpp:
(WTF::CStringTranslator::hash):
(WTF::CStringTranslator::equal):
(WTF::CStringTranslator::translate):
(WTF::AtomicStringImpl::add):
(WTF::HashTranslatorCharBuffer::HashTranslatorCharBuffer):
(WTF::UCharBufferTranslator::hash):
(WTF::UCharBufferTranslator::equal):
(WTF::UCharBufferTranslator::translate):
(WTF::LCharBufferTranslator::hash):
(WTF::LCharBufferTranslator::equal):
(WTF::LCharBufferTranslator::translate):
(WTF::BufferFromStaticDataTranslator::hash):
(WTF::BufferFromStaticDataTranslator::equal):
(WTF::BufferFromStaticDataTranslator::translate):
(WTF::AtomicStringImpl::addLiteral):
(WTF::addSymbol):
(WTF::addStatic):
(WTF::AtomicStringImpl::addSlowCase):
(WTF::AtomicStringImpl::lookUp):
(WTF::CharBufferFromLiteralDataTranslator::hash): Deleted.
(WTF::CharBufferFromLiteralDataTranslator::equal): Deleted.
(WTF::CharBufferFromLiteralDataTranslator::translate): Deleted.
(WTF::addSubstring): Deleted.
* wtf/text/StringImpl.h:
2017-07-14 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Use std::unique_ptr for StackTrace
https://bugs.webkit.org/show_bug.cgi?id=174495
Reviewed by Alex Christensen.
Instead of returning pointer to heap allocated StackTrace,
we should return std::unique_ptr<StackTrace>.
And we also move WTFGetBackTrace from Assertions.cpp to
StackTrace.cpp to consolidate stack trace related operations
into StackTrace.cpp.
* wtf/Assertions.cpp:
* wtf/StackTrace.cpp:
(WTFGetBacktrace):
(WTF::StackTrace::captureStackTrace):
* wtf/StackTrace.h:
2017-07-13 Yusuke Suzuki <utatane.tea@gmail.com>
Unreviewed, annotate inline for operator==/!= for FastAllocator
https://bugs.webkit.org/show_bug.cgi?id=174366
* wtf/FastMalloc.h:
(WTF::operator==):
(WTF::operator!=):
2017-07-12 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r219176.
https://bugs.webkit.org/show_bug.cgi?id=174436
"Can cause infinite recursion on iOS" (Requested by mlam on
#webkit).
Reverted changeset:
"WTF::Thread should have the threads stack bounds."
https://bugs.webkit.org/show_bug.cgi?id=173975
http://trac.webkit.org/changeset/219176
2017-07-12 Adrian Perez de Castro <aperez@igalia.com>
[WTF] Failure to build when the compiler specifically targets ARMv8-A / defines __ARM_ARCH_8A__
https://bugs.webkit.org/show_bug.cgi?id=174425
Reviewed by Michael Catanzaro.
* wtf/Platform.h: Also check for __ARCH_ARM_8A__ to detect ARMv8.
2017-07-12 Michael Saboff <msaboff@apple.com>
Unreviewed build fix when both DATA_LOG_TO_FILE and DATA_LOG_FILENAME are defined.
* wtf/DataLog.cpp:
(WTF::initializeLogFileOnce): Changed declaration of logBasename from
char* logBasename to const char* logBasename.
2017-07-12 Matt Lewis <jlewis3@apple.com>
Unreviewed, rolling out r219401.
This revision rolled out the previous patch, but after talking
with reviewer, a rebaseline is what was needed.Rolling back in
before rebaseline.
Reverted changeset:
"Unreviewed, rolling out r219379."
https://bugs.webkit.org/show_bug.cgi?id=174400
http://trac.webkit.org/changeset/219401
2017-07-12 Matt Lewis <jlewis3@apple.com>
Unreviewed, rolling out r219379.
This revision caused a consistent failure in the test
fast/dom/Window/property-access-on-cached-window-after-frame-
removed.html.
Reverted changeset:
"Remove NAVIGATOR_HWCONCURRENCY"
https://bugs.webkit.org/show_bug.cgi?id=174400
http://trac.webkit.org/changeset/219379
2017-07-12 Yusuke Suzuki <utatane.tea@gmail.com>
Unreviewed, attempt to fix Windows build
https://bugs.webkit.org/show_bug.cgi?id=174366
* wtf/FastMalloc.h:
(WTF::operator==):
(WTF::operator!=):
(WTF::FastAllocator::operator==): Deleted.
(WTF::FastAllocator::operator!=): Deleted.
2017-07-11 Carlos Garcia Campos <cgarcia@igalia.com>
[GTK][WPE] Enable FILE_LOCK and implement lockFile and unlockFile
https://bugs.webkit.org/show_bug.cgi?id=174357
Reviewed by Michael Catanzaro.
* wtf/Platform.h: Enable FILE_LOCK in GTK and WPE ports.
2017-07-11 Dean Jackson <dino@apple.com>
Remove NAVIGATOR_HWCONCURRENCY
https://bugs.webkit.org/show_bug.cgi?id=174400
Reviewed by Sam Weinig.
* wtf/FeatureDefines.h:
2017-07-11 Dean Jackson <dino@apple.com>
Rolling out r219372.
* wtf/FeatureDefines.h:
2017-07-11 Dean Jackson <dino@apple.com>
Remove NAVIGATOR_HWCONCURRENCY
https://bugs.webkit.org/show_bug.cgi?id=174400
Reviewed by Sam Weinig.
* wtf/FeatureDefines.h:
2017-07-11 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Drop unnecessary AtomicString constructor since we have constexpr hash function
https://bugs.webkit.org/show_bug.cgi?id=174347
Reviewed by Alex Christensen.
Previously, we calculate hash value in perl script and generate source code with that value.
This AtomicString constructor takes this pre-calculated hash value to efficiently construct
itself. But now, we have constexpr hash function, then we do not need to specify hash value
directly in this way. Thus we drop this functionality.
* wtf/text/AtomicString.h:
* wtf/text/AtomicStringImpl.cpp:
(WTF::HashAndCharactersTranslator::hash): Deleted.
(WTF::HashAndCharactersTranslator::equal): Deleted.
(WTF::HashAndCharactersTranslator::translate): Deleted.
* wtf/text/AtomicStringImpl.h:
(WTF::AtomicStringImpl::add):
2017-07-10 Per Arne Vollan <pvollan@apple.com>
[Win] Link error when building WTF from WTF.proj project file.
https://bugs.webkit.org/show_bug.cgi?id=174316
<rdar://problem/33178200>
Reviewed by Brent Fulgham.
WTF_CPU_X86 cmake variable needs to be set for link libraries directories to be correct.
* WTF.vcxproj/WTF.proj:
2017-07-03 Brian Burg <bburg@apple.com>
Web Replay: remove some unused code
https://bugs.webkit.org/show_bug.cgi?id=173903
Rubber-stamped by Joseph Pecoraro.
* wtf/FeatureDefines.h:
2017-07-10 Brady Eidson <beidson@apple.com>
Cleanup lifetime issues of UniqueIDBDatabase and IDBBackingStore.
<rdar://problem/32908525> and https://bugs.webkit.org/show_bug.cgi?id=174244
Reviewed by David Kilzer and Alex Christensen.
Add proper "kill" support to CrossThreadQueue, as well as isEmpty() support.
* wtf/CrossThreadQueue.h:
(WTF::CrossThreadQueue<DataType>::append):
(WTF::CrossThreadQueue<DataType>::kill):
(WTF::CrossThreadQueue<DataType>::isKilled):
(WTF::CrossThreadQueue<DataType>::isEmpty):
(WTF::CrossThreadQueue::isKilled): Deleted.
2017-07-09 Yusuke Suzuki <utatane.tea@gmail.com>
[JSC] Use fastMalloc / fastFree for STL containers
https://bugs.webkit.org/show_bug.cgi?id=174297
Reviewed by Sam Weinig.
* wtf/FastMalloc.h:
(WTF::FastAllocator::FastAllocator):
(WTF::FastAllocator::allocate):
(WTF::FastAllocator::deallocate):
(WTF::FastAllocator::operator==):
(WTF::FastAllocator::operator!=):
2017-07-07 Brent Fulgham <bfulgham@apple.com>
[WK2] Use a rolling 30-day uptime for processing statistics
https://bugs.webkit.org/show_bug.cgi?id=174235
<rdar://problem/33164381>
Reviewed by Chris Dumez.
Modify Deque to allow it to be used in a template specialization in KeyedDecoder.
* wtf/Deque.h:
2017-07-07 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r219238, r219239, and r219241.
https://bugs.webkit.org/show_bug.cgi?id=174265
"fast/workers/dedicated-worker-lifecycle.html is flaky"
(Requested by yusukesuzuki on #webkit).
Reverted changesets:
"[WTF] Implement WTF::ThreadGroup"
https://bugs.webkit.org/show_bug.cgi?id=174081
http://trac.webkit.org/changeset/219238
"Unreviewed, build fix after r219238"
https://bugs.webkit.org/show_bug.cgi?id=174081
http://trac.webkit.org/changeset/219239
"Unreviewed, CLoop build fix after r219238"
https://bugs.webkit.org/show_bug.cgi?id=174081
http://trac.webkit.org/changeset/219241
2017-07-07 Yusuke Suzuki <utatane.tea@gmail.com>
Unreviewed, Windows build fix after r219233 part 4
https://bugs.webkit.org/show_bug.cgi?id=174231
* wtf/Assertions.h:
2017-07-06 Yusuke Suzuki <utatane.tea@gmail.com>
Unreviewed, Windows build fix after r219233 part 3
https://bugs.webkit.org/show_bug.cgi?id=174231
* wtf/Assertions.h:
(compilerFenceForCrash):
2017-07-06 Yusuke Suzuki <utatane.tea@gmail.com>
Unreviewed, Windows build fix after r219233 part 2
https://bugs.webkit.org/show_bug.cgi?id=174231
* wtf/Assertions.h:
2017-07-06 Yusuke Suzuki <utatane.tea@gmail.com>
Unreviewed, Windows build fix after r219233
https://bugs.webkit.org/show_bug.cgi?id=174231
* wtf/Compiler.h:
2017-07-06 Yusuke Suzuki <utatane.tea@gmail.com>
Unreviewed, build fix after r219238
https://bugs.webkit.org/show_bug.cgi?id=174081
* wtf/Threading.cpp:
(WTF::Thread::addToThreadGroup):
2017-07-05 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Implement WTF::ThreadGroup
https://bugs.webkit.org/show_bug.cgi?id=174081
Reviewed by Mark Lam.
This patch implements WTF::ThreadGroup. It implements core of JSC::MachineThreads with more reliable way.
JSC::MachineThreads was complicated because of managing dead threads. Each JSC::MachineThreads has its
own TLS with a registered destructor. And everytime a thread dies, the registered TLS destructor is called.
And this destructor will remove the current dying thread from JSC::MachineThreads.
However the above implementation is tricky. And each JSC::MachineThreads requires own TLS space, which is
not considered in WTF's Windows ThreadSpecific implementation. Current design works well since we only
have small number of MachineThreads right now.
Instead, we use more reliable way. After introducing WTF::Thread, WTF::Thread has WTF::Thread::didExit,
which is called when associated TLS (with WTF::Thread) is destroyed. We leverage this mechanism to remove
WTF::Thread from MachineThreads.
This patch introduces WTF::ThreadGroup. It is tightly integrated with WTF::Thread: WTF::Thread knows
ThreadGroups which includes this thread. And WTF::ThreadGroup of course knows WTF::Threads added to it.
WTF::Thread::didExit carefully remove itself from WTF::ThreadGroups.
The most important part of this patch is locking. WTF::Thread can die. And WTF::ThreadGroup can die.
If we take a design using two fine grain locks in WTF::Thread and WTF::ThreadGroup, we easily encounter
dead lock. Consider the following case.
1. When adding WTF::Thread (TH) to WTF::ThreadGroup (THG), we first hold a lock of THG, and hold a lock of TH (locking order is THG -> TH).
2. When TH dies, TH need to hold a lock of TH to iterate THGs. And we hold a lock of THG to unregister TH from it (locking order is TH -> THG).
3. When suspending and resuming THs in THG, we first hold a lock of THG. And then, we hold a lock of TH to suspend and resume it (locking order is THG -> TH).
4. When destroying THG, we need to hold a lock of TH to unregister THG from TH. We can hold a lock of THG before that (locking order is THG -> TH).
Then, it easily causes dead lock. We cannot swap the locking order of (2) since iterating THG requires a lock of TH.
To solve this problem, we introduce one global lock ThreadGroup::destructionMutex (GL).
1. When adding WTF::Thread (TH) to WTF::ThreadGroup (THG), we first hold GL, and hold a lock of THG. Do not hold a
lock of TH. TH's thread groups information is guarded by GL instead of a lock of TH (locking order is GL -> THG).
2. When TH dies, TH need to hold GL to iterate THGs. And we hold a lock of THG to unregister TH from it (locking order is GL -> THG).
3. When suspending and resuming THs in THG, we first hold a lock of THG. And then, we hold a lock of TH to suspend and resume it (locking order is THG -> TH).
4. When destroying THG, we need to hold GL to unregister THG from TH. We can hold a lock of THG after that (locking order is GL -> THG).
We still have a lock of THG. By separating GL and THG's lock, we can hold a lock of THG while completely unrelated TH is destructed which takes a lock of GL and unrelated THG.
* WTF.xcodeproj/project.pbxproj:
* wtf/AutomaticThread.cpp:
* wtf/CMakeLists.txt:
* wtf/CrossThreadCopier.h:
* wtf/ParkingLot.h:
* wtf/ThreadGroup.cpp: Copied from Source/JavaScriptCore/wasm/WasmMachineThreads.cpp.
(WTF::ThreadGroup::destructionMutex):
(WTF::ThreadGroup::~ThreadGroup):
(WTF::ThreadGroup::add):
(WTF::ThreadGroup::addCurrentThread):
(WTF::ThreadGroup::removeCurrentThread):
* wtf/ThreadGroup.h: Copied from Source/JavaScriptCore/wasm/WasmMachineThreads.cpp.
(WTF::ThreadGroup::create):
(WTF::ThreadGroup::threads):
(WTF::ThreadGroup::getLock):
* wtf/Threading.cpp:
(WTF::Thread::didExit):
(WTF::Thread::addToThreadGroup):
(WTF::Thread::removeFromThreadGroup):
* wtf/Threading.h:
(WTF::Thread::canAddToThreadGroup):
2017-07-06 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Clean up StringStatics.cpp by using LazyNeverDestroyed<> for Atoms
https://bugs.webkit.org/show_bug.cgi?id=174150
Reviewed by Mark Lam.
This patch cleans up StringStatics.cpp and remove it from the tree.
1. Move StringImpl methods to appropriate place, "StringImpl.cpp".
StringImpl::hashSlowCase() and StringImpl::concurrentHash() are defined in
StringStatics.cpp. But they should be defined in StringImpl.cpp.
This patch just moves them to StringImpl.cpp.
2. Use LazyNeverDestroyed to initialize AtomicString atoms like emptyAtom.
Previously, we initialized AtomicString atoms like emptyAtom in a hacky way.
We first define them as extern global variables. However, AtomicString has
a non-trivial constructor. Thus, we cannot do this because it requires global
constructor calls. This is why we have StringStatics.cpp. In this file, we
include "StaticConstructors.h". After including this file, all the global
constructor call disabled in Windows. And in GCC environment, we allocate
void* storage for that variable. And we use placement new in AtomicString::init()
to initialize these storage.
However, we already have better way for that: LazyNeverDestroyed. It just allocates
storage like the above. And it does not have any global constructors. Thus
we can just declare it as a global variable. And we initialize them lazily in
AtomicString::init(). This way effectively avoids "StaticConstructors.h" hacky way.
And it makes "StringStatics.cpp" unnecessary.
Then, we just move these variables and AtomicString::init() to AtomicString.cpp.
And we also change emptyAtom to emptyAtom() to get the value from LazyNeverDestroyed<>.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/text/AtomicString.cpp:
(WTF::AtomicString::convertASCIICase):
(WTF::AtomicString::fromUTF8Internal):
(WTF::AtomicString::init):
* wtf/text/AtomicString.h:
(WTF::nullAtom):
(WTF::emptyAtom):
(WTF::starAtom):
(WTF::xmlAtom):
(WTF::xmlnsAtom):
(WTF::AtomicString::fromUTF8):
* wtf/text/StringBuilder.h:
(WTF::StringBuilder::toAtomicString):
* wtf/text/StringImpl.cpp:
(WTF::StringImpl::hashSlowCase):
(WTF::StringImpl::concurrentHash):
* wtf/text/StringStatics.cpp: Removed.
2017-07-06 Keith Miller <keith_miller@apple.com>
Add extra insurance to prevent clang from making crash traces sad
https://bugs.webkit.org/show_bug.cgi?id=174231
Reviewed by Saam Barati.
This patch makes it slightly harder for Clang to coalesce our crash calls.
Additionally, it also makes Clang never tail call the WTFCrashWithInfo so
our stack trace should always be "reasonable".
* wtf/Assertions.h:
* wtf/Compiler.h:
2017-07-06 Matt Lewis <jlewis3@apple.com>
Unreviewed, rolling out r219178.
This caused a consistent failure with the API test
StringBuilderTest.ToAtomicStringOnEmpty on all Debug testers.
Reverted changeset:
"[WTF] Clean up StringStatics.cpp by using
LazyNeverDestroyed<> for Atoms"
https://bugs.webkit.org/show_bug.cgi?id=174150
http://trac.webkit.org/changeset/219178
2017-07-05 Don Olmstead <don.olmstead@sony.com>
[WTF] Move SoftLinking.h into WTF
https://bugs.webkit.org/show_bug.cgi?id=174000
Reviewed by Alex Christensen.
* WTF.xcodeproj/project.pbxproj:
* wtf/SoftLinking.h: Copied from Source/WebCore/platform/ios/QuickLookSoftLink.mm.
* wtf/cocoa/SoftLinking.h: Renamed from Source/WebCore/platform/cocoa/SoftLinking.h.
* wtf/win/SoftLinking.h: Renamed from Source/WebCore/platform/win/SoftLinking.h.
2017-07-05 Yusuke Suzuki <utatane.tea@gmail.com>
Upgrade GCC baseline
https://bugs.webkit.org/show_bug.cgi?id=174155
Reviewed by Michael Catanzaro.
* wtf/Compiler.h:
2017-07-05 Yusuke Suzuki <utatane.tea@gmail.com>
WTF::StringImpl::copyChars segfaults when built with GCC 7
https://bugs.webkit.org/show_bug.cgi?id=173407
Reviewed by Andreas Kling.
With GCC 7, StringImpl::copyChars() behaves as unexpected.
This function violates strict aliasing rule.
This optimization is originally introduced to improve performance
in SunSpider's string tests in 2008. When running it in my Linux
box, it no longer causes any observable difference. So, we just
remove this optimization.
baseline patched
string-base64 7.7544+-0.1761 7.6138+-0.2071 might be 1.0185x faster
string-fasta 10.5429+-0.2746 ? 10.7500+-0.2669 ? might be 1.0196x slower
string-tagcloud 14.8588+-0.2828 14.8039+-0.3039
string-unpack-code 36.1769+-0.4251 35.3397+-0.5398 might be 1.0237x faster
string-validate-input 8.5182+-0.2206 8.3514+-0.2179 might be 1.0200x faster
* wtf/text/StringImpl.h:
(WTF::StringImpl::copyChars):
2017-07-05 Yusuke Suzuki <utatane.tea@gmail.com>
Use std::lock_guard instead of std::unique_lock if move semantics and try_lock is not necessary
https://bugs.webkit.org/show_bug.cgi?id=174148
Reviewed by Mark Lam.
It is not necessary to use std::unique_lock if we do not use additional features compared to std::lock_guard.
(WTF::ThreadHolder::get):
(WTF::ThreadHolder::initialize):
(WTF::ThreadHolder::destruct):
* wtf/Threading.cpp:
(WTF::Thread::didExit):
* wtf/ThreadingPthreads.cpp:
(WTF::Thread::changePriority):
(WTF::Thread::waitForCompletion):
(WTF::Thread::detach):
(WTF::Thread::signal):
(WTF::Thread::resume):
(WTF::Thread::getRegisters):
(WTF::Thread::establish):
* wtf/ThreadingWin.cpp:
(WTF::Thread::changePriority):
(WTF::Thread::waitForCompletion):
(WTF::Thread::detach):
(WTF::Thread::resume):
(WTF::Thread::getRegisters):
(WTF::Thread::establish):
* wtf/WordLock.cpp:
(WTF::WordLockBase::unlockSlow):
2017-07-05 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Clean up StringStatics.cpp by using LazyNeverDestroyed<> for Atoms
https://bugs.webkit.org/show_bug.cgi?id=174150
Reviewed by Mark Lam.
This patch cleans up StringStatics.cpp and remove it from the tree.
1. Move StringImpl methods to appropriate place, "StringImpl.cpp".
StringImpl::hashSlowCase() and StringImpl::concurrentHash() are defined in
StringStatics.cpp. But they should be defined in StringImpl.cpp.
This patch just moves them to StringImpl.cpp.
2. Use LazyNeverDestroyed to initialize AtomicString atoms like emptyAtom.
Previously, we initialized AtomicString atoms like emptyAtom in a hacky way.
We first define them as extern global variables. However, AtomicString has
a non-trivial constructor. Thus, we cannot do this because it requires global
constructor calls. This is why we have StringStatics.cpp. In this file, we
include "StaticConstructors.h". After including this file, all the global
constructor call disabled in Windows. And in GCC environment, we allocate
void* storage for that variable. And we use placement new in AtomicString::init()
to initialize these storage.
However, we already have better way for that: LazyNeverDestroyed. It just allocates
storage like the above. And it does not have any global constructors. Thus
we can just declare it as a global variable. And we initialize them lazily in
AtomicString::init(). This way effectively avoids "StaticConstructors.h" hacky way.
And it makes "StringStatics.cpp" unnecessary.
Then, we just move these variables and AtomicString::init() to AtomicString.cpp.
And we also change emptyAtom to emptyAtom() to get the value from LazyNeverDestroyed<>.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/text/AtomicString.cpp:
(WTF::AtomicString::convertASCIICase):
(WTF::AtomicString::fromUTF8Internal):
(WTF::AtomicString::init):
* wtf/text/AtomicString.h:
(WTF::nullAtom):
(WTF::emptyAtom):
(WTF::starAtom):
(WTF::xmlAtom):
(WTF::xmlnsAtom):
(WTF::AtomicString::fromUTF8):
* wtf/text/StringBuilder.h:
(WTF::StringBuilder::toAtomicString):
* wtf/text/StringImpl.cpp:
(WTF::StringImpl::hashSlowCase):
(WTF::StringImpl::concurrentHash):
* wtf/text/StringStatics.cpp: Removed.
2017-07-05 Yusuke Suzuki <utatane.tea@gmail.com>
WTF::Thread should have the threads stack bounds.
https://bugs.webkit.org/show_bug.cgi?id=173975
Reviewed by Keith Miller.
We move StackBounds from WTFThreadData to WTF::Thread.
One important thing is that we should make valid StackBounds
visible to Thread::create() caller. When the caller get
WTF::Thread from Thread::create(), this WTF::Thread should
have a valid StackBounds. But StackBounds information can be
retrived only in the WTF::Thread's thread itself.
We also clean up WTF::initializeThreading. StringImpl::empty()
is now statically initialized by using constexpr constructor.
Thus we do not need to call StringImpl::empty() explicitly here.
And WTF::initializeThreading() does not have any main thread
affinity right now in all the platforms. So we fix the comment
in Threading.h. Then, now, WTF::initializeThreading() is called
in UI thread when using Web thread in iOS.
* wtf/StackBounds.h:
(WTF::StackBounds::emptyBounds):
(WTF::StackBounds::StackBounds):
* wtf/StackStats.cpp:
(WTF::StackStats::PerThreadStats::PerThreadStats):
* wtf/Threading.cpp:
(WTF::threadEntryPoint):
(WTF::Thread::create):
(WTF::Thread::currentMayBeNull):
(WTF::Thread::initialize):
(WTF::initializeThreading):
* wtf/Threading.h:
(WTF::Thread::stack):
* wtf/ThreadingPthreads.cpp:
(WTF::Thread::initializeCurrentThreadEvenIfNonWTFCreated):
(WTF::Thread::current):
(WTF::initializeCurrentThreadEvenIfNonWTFCreated): Deleted.
(WTF::Thread::currentMayBeNull): Deleted.
* wtf/ThreadingWin.cpp:
(WTF::Thread::initializeCurrentThreadEvenIfNonWTFCreated):
(WTF::Thread::initializeCurrentThreadInternal):
(WTF::Thread::current):
* wtf/WTFThreadData.cpp:
(WTF::WTFThreadData::WTFThreadData):
* wtf/WTFThreadData.h:
(WTF::WTFThreadData::stack): Deleted.
2017-07-05 Keith Miller <keith_miller@apple.com>
Crashing with information should have an abort reason
https://bugs.webkit.org/show_bug.cgi?id=174185
Reviewed by Saam Barati.
Fix an ifdef to actually work with X86_64. It turns out X64_64 is
not an architecture... Whoops.
* wtf/Assertions.cpp:
2017-07-03 Myles C. Maxfield <mmaxfield@apple.com>
Remove copy of ICU headers from WebKit
https://bugs.webkit.org/show_bug.cgi?id=116407
Reviewed by Alex Christensen.
Add an extra rsync command to CopyWTFHeaders which copies the ICU headers
to DSTROOT/usr/local/include/. These headers already live inside a
"unicode" folder, so an example path of a header is
DSTROOT/usr/local/include/unicode/uchar.h. This is already in the search
path of the other WebKit projects, so those other projects can remove
their explicit listing of the old place these headers lived.
Also add the remaining ICU 55.1 headers which the other projects (like
WebCore) need. Revert any local changes to these headers in favor of
using the GCC_PREPROCESSOR_DEFINITIONS build setting. This is so we can
compile the same way against unmodified headers.
* Configurations/Base.xcconfig:
* Configurations/CopyWTFHeaders.xcconfig:
* WTF.xcodeproj/project.pbxproj:
* icu/unicode/alphaindex.h: Added.
* icu/unicode/appendable.h: Added.
* icu/unicode/basictz.h: Added.
* icu/unicode/brkiter.h: Added.
(BreakIterator::isBufferClone):
* icu/unicode/bytestrie.h: Added.
* icu/unicode/bytestriebuilder.h: Added.
* icu/unicode/calendar.h: Added.
(Calendar::createInstance):
(Calendar::roll):
(Calendar::internalSet):
(Calendar::weekNumber):
* icu/unicode/caniter.h: Added.
* icu/unicode/chariter.h: Renamed from Source/WebCore/icu/unicode/chariter.h.
* icu/unicode/choicfmt.h: Added.
* icu/unicode/coleitr.h: Added.
(CollationElementIterator::primaryOrder):
(CollationElementIterator::secondaryOrder):
(CollationElementIterator::tertiaryOrder):
(CollationElementIterator::isIgnorable):
* icu/unicode/coll.h: Added.
* icu/unicode/compactdecimalformat.h: Added.
* icu/unicode/curramt.h: Added.
(CurrencyAmount::getCurrency):
(CurrencyAmount::getISOCurrency):
* icu/unicode/currpinf.h: Added.
(CurrencyPluralInfo::operator!=):
* icu/unicode/currunit.h: Added.
(CurrencyUnit::getISOCurrency):
* icu/unicode/datefmt.h: Added.
* icu/unicode/dbbi.h: Added.
* icu/unicode/dcfmtsym.h: Added.
(DecimalFormatSymbols::getSymbol):
(DecimalFormatSymbols::getConstSymbol):
(DecimalFormatSymbols::setSymbol):
(DecimalFormatSymbols::getLocale):
(DecimalFormatSymbols::getCurrencyPattern):
* icu/unicode/decimfmt.h: Added.
(DecimalFormat::getConstSymbol):
* icu/unicode/docmain.h: Added.
* icu/unicode/dtfmtsym.h: Added.
* icu/unicode/dtintrv.h: Added.
(DateInterval::getFromDate):
(DateInterval::getToDate):
(DateInterval::operator!=):
* icu/unicode/dtitvfmt.h: Added.
(DateIntervalFormat::operator!=):
* icu/unicode/dtitvinf.h: Added.
(DateIntervalInfo::operator!=):
* icu/unicode/dtptngen.h: Added.
* icu/unicode/dtrule.h: Added.
* icu/unicode/enumset.h: Added.
(EnumSet::EnumSet):
(EnumSet::~EnumSet):
(EnumSet::clear):
(EnumSet::add):
(EnumSet::remove):
(EnumSet::contains):
(EnumSet::set):
(EnumSet::get):
(EnumSet::isValidEnum):
(EnumSet::isValidValue):
(EnumSet::operator=):
(EnumSet::getAll):
(EnumSet::flag):
* icu/unicode/errorcode.h: Added.
* icu/unicode/fieldpos.h: Added.
(FieldPosition::operator=):
(FieldPosition::operator==):
(FieldPosition::operator!=):
* icu/unicode/filteredbrk.h: Added.
* icu/unicode/fmtable.h: Added.
(Formattable::getDate):
(Formattable::getString):
(Formattable::getLong):
(Formattable::toUFormattable):
(Formattable::fromUFormattable):
* icu/unicode/format.h: Added.
* icu/unicode/fpositer.h: Added.
* icu/unicode/gender.h: Added.
* icu/unicode/gregocal.h: Added.
* icu/unicode/icudataver.h: Added.
* icu/unicode/icuplug.h: Added.
* icu/unicode/idna.h: Added.
* icu/unicode/listformatter.h: Added.
(ListFormatData::ListFormatData):
* icu/unicode/locdspnm.h: Added.
(LocaleDisplayNames::createInstance):
* icu/unicode/locid.h: Added.
(Locale::operator!=):
(Locale::getCountry):
(Locale::getLanguage):
(Locale::getScript):
(Locale::getVariant):
(Locale::getName):
(Locale::isBogus):
* icu/unicode/measfmt.h: Added.
* icu/unicode/measunit.h: Added.
* icu/unicode/measure.h: Added.
(Measure::getNumber):
(Measure::getUnit):
* icu/unicode/messagepattern.h: Added.
* icu/unicode/msgfmt.h: Added.
* icu/unicode/normalizer2.h: Added.
* icu/unicode/normlzr.h: Added.
(Normalizer::operator!= ):
(Normalizer::quickCheck):
(Normalizer::isNormalized):
(Normalizer::compare):
* icu/unicode/numfmt.h: Added.
(NumberFormat::isParseIntegerOnly):
(NumberFormat::isLenient):
* icu/unicode/numsys.h: Added.
* icu/unicode/parsepos.h: Added.
(ParsePosition::operator=):
(ParsePosition::operator==):
(ParsePosition::operator!=):
(ParsePosition::getIndex):
(ParsePosition::setIndex):
(ParsePosition::getErrorIndex):
(ParsePosition::setErrorIndex):
* icu/unicode/plurfmt.h: Added.
* icu/unicode/plurrule.h: Added.
* icu/unicode/rbbi.h: Added.
(RuleBasedBreakIterator::operator!=):
* icu/unicode/rbnf.h: Added.
(RuleBasedNumberFormat::isLenient):
(RuleBasedNumberFormat::getDefaultRuleSet):
* icu/unicode/rbtz.h: Added.
* icu/unicode/regex.h: Added.
* icu/unicode/region.h: Added.
* icu/unicode/reldatefmt.h: Added.
* icu/unicode/resbund.h: Added.
* icu/unicode/schriter.h: Added.
* icu/unicode/scientificnumberformatter.h: Added.
* icu/unicode/search.h: Added.
(SearchIterator::operator!=):
* icu/unicode/selfmt.h: Added.
* icu/unicode/simpletz.h: Added.
(SimpleTimeZone::setStartRule):
(SimpleTimeZone::setEndRule):
(SimpleTimeZone::getOffset):
* icu/unicode/smpdtfmt.h: Added.
(SimpleDateFormat::get2DigitYearStart):
* icu/unicode/sortkey.h: Added.
(CollationKey::operator!=):
(CollationKey::isBogus):
(CollationKey::getByteArray):
* icu/unicode/stringtriebuilder.h: Added.
* icu/unicode/stsearch.h: Added.
* icu/unicode/symtable.h: Added.
* icu/unicode/tblcoll.h: Added.
* icu/unicode/timezone.h: Added.
(TimeZone::getID):
(TimeZone::setID):
* icu/unicode/tmunit.h: Added.
* icu/unicode/tmutamt.h: Added.
(TimeUnitAmount::operator!=):
* icu/unicode/tmutfmt.h: Added.
(TimeUnitFormat::operator!=):
* icu/unicode/translit.h: Added.
(Transliterator::getMaximumContextLength):
(Transliterator::setID):
(Transliterator::integerToken):
(Transliterator::pointerToken):
* icu/unicode/tzfmt.h: Added.
* icu/unicode/tznames.h: Added.
* icu/unicode/tzrule.h: Added.
* icu/unicode/tztrans.h: Added.
* icu/unicode/ubidi.h: Added.
* icu/unicode/ucal.h: Renamed from Source/JavaScriptCore/icu/unicode/ucal.h.
* icu/unicode/ucasemap.h: Added.
* icu/unicode/ucat.h: Added.
* icu/unicode/ucharstrie.h: Added.
* icu/unicode/ucharstriebuilder.h: Added.
* icu/unicode/uchriter.h: Added.
* icu/unicode/uclean.h: Added.
* icu/unicode/ucnv_cb.h: Renamed from Source/WebCore/icu/unicode/ucnv_cb.h.
* icu/unicode/ucnvsel.h: Added.
* icu/unicode/ucoleitr.h: Renamed from Source/WebCore/icu/unicode/ucoleitr.h.
* icu/unicode/uconfig.h:
* icu/unicode/ucsdet.h: Renamed from Source/WebCore/icu/unicode/ucsdet.h.
* icu/unicode/udat.h: Renamed from Source/JavaScriptCore/icu/unicode/udat.h.
* icu/unicode/udata.h: Added.
* icu/unicode/udateintervalformat.h: Added.
* icu/unicode/udatpg.h: Renamed from Source/JavaScriptCore/icu/unicode/udatpg.h.
* icu/unicode/udisplaycontext.h: Renamed from Source/JavaScriptCore/icu/unicode/udisplaycontext.h.
* icu/unicode/ufieldpositer.h: Renamed from Source/JavaScriptCore/icu/unicode/ufieldpositer.h.
* icu/unicode/uformattable.h: Renamed from Source/JavaScriptCore/icu/unicode/uformattable.h.
* icu/unicode/ugender.h: Added.
* icu/unicode/uidna.h: Renamed from Source/WebCore/icu/unicode/uidna.h.
* icu/unicode/uldnames.h: Added.
* icu/unicode/ulistformatter.h: Added.
* icu/unicode/ulocdata.h: Added.
* icu/unicode/umisc.h: Renamed from Source/JavaScriptCore/icu/unicode/umisc.h.
* icu/unicode/umsg.h: Added.
* icu/unicode/unifilt.h: Added.
* icu/unicode/unifunct.h: Added.
* icu/unicode/unimatch.h: Added.
* icu/unicode/unirepl.h: Added.
* icu/unicode/uniset.h: Added.
(UnicodeSet::operator!=):
(UnicodeSet::isFrozen):
(UnicodeSet::containsSome):
(UnicodeSet::isBogus):
(UnicodeSet::fromUSet):
(UnicodeSet::toUSet):
(UnicodeSet::span):
(UnicodeSet::spanBack):
* icu/unicode/unum.h: Renamed from Source/JavaScriptCore/icu/unicode/unum.h.
* icu/unicode/unumsys.h: Renamed from Source/JavaScriptCore/icu/unicode/unumsys.h.
* icu/unicode/upluralrules.h: Added.
* icu/unicode/uregex.h: Added.
* icu/unicode/uregion.h: Added.
* icu/unicode/urep.h: Added.
* icu/unicode/ures.h: Added.
(ures_getUnicodeString):
(ures_getNextUnicodeString):
(ures_getUnicodeStringByIndex):
(ures_getUnicodeStringByKey):
* icu/unicode/usearch.h: Renamed from Source/WebCore/icu/unicode/usearch.h.
* icu/unicode/usetiter.h: Added.
(UnicodeSetIterator::isString):
(UnicodeSetIterator::getCodepoint):
(UnicodeSetIterator::getCodepointEnd):
* icu/unicode/ushape.h: Renamed from Source/WebCore/icu/unicode/ushape.h.
* icu/unicode/uspoof.h: Added.
* icu/unicode/usprep.h: Added.
* icu/unicode/ustdio.h: Added.
* icu/unicode/ustream.h: Added.
* icu/unicode/ustringtrie.h: Added.
* icu/unicode/utf32.h: Added.
* icu/unicode/utmscale.h: Added.
* icu/unicode/utrace.h: Added.
* icu/unicode/utrans.h: Added.
* icu/unicode/utypes.h:
* icu/unicode/vtzone.h: Added.
2017-07-04 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Make double-conversion's cache data constant and drop double_conversion::initialize()
https://bugs.webkit.org/show_bug.cgi?id=174124
Reviewed by Saam Barati.
We annotate double-conversion's cache data as const and constexpr. And move it out of function.
Since they are not involving global constructors, they are compiled as rodata and initialized
without calling double_conversion::initialize().
And we drop double_conversion::initialize() function since it is no longer necessary.
* wtf/Threading.cpp:
(WTF::initializeThreading):
* wtf/dtoa/cached-powers.cc:
* wtf/dtoa/cached-powers.h:
2017-07-04 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Initialize srandom and srand with cryptographically random number
https://bugs.webkit.org/show_bug.cgi?id=174123
Reviewed by Mark Lam.
Use cryptographically random number instead of current time as a seed.
* wtf/RandomNumberSeed.h:
(WTF::initializeRandomNumberGenerator):
2017-07-04 Joseph Pecoraro <pecoraro@apple.com>
Xcode duplicate UUID for DisallowCType.h and DispatchPtr.h
https://bugs.webkit.org/show_bug.cgi?id=174117
Reviewed by Alexey Proskuryakov.
* WTF.xcodeproj/project.pbxproj:
Give DisallowCType.h and DispatchPtr.h different UUIDs.
2017-07-03 Saam Barati <sbarati@apple.com>
LayoutTest workers/bomb.html is a Crash
https://bugs.webkit.org/show_bug.cgi?id=167757
<rdar://problem/33086462>
Reviewed by Keith Miller.
* wtf/AutomaticThread.cpp:
(WTF::AutomaticThreadCondition::waitFor):
* wtf/AutomaticThread.h:
2017-07-03 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r219060.
https://bugs.webkit.org/show_bug.cgi?id=174108
crashing constantly when initializing UIWebView (Requested by
thorton on #webkit).
Reverted changeset:
"WTF::Thread should have the threads stack bounds."
https://bugs.webkit.org/show_bug.cgi?id=173975
http://trac.webkit.org/changeset/219060
2017-07-03 Matt Lewis <jlewis3@apple.com>
Unreviewed, rolling out r219103.
Caused multiple build failures.
Reverted changeset:
"Remove copy of ICU headers from WebKit"
https://bugs.webkit.org/show_bug.cgi?id=116407
http://trac.webkit.org/changeset/219103
2017-07-03 Myles C. Maxfield <mmaxfield@apple.com>
Remove copy of ICU headers from WebKit
https://bugs.webkit.org/show_bug.cgi?id=116407
Reviewed by Alex Christensen.
Add an extra rsync command to CopyWTFHeaders which copies the ICU headers
to DSTROOT/usr/local/include/. These headers already live inside a
"unicode" folder, so an example path of a header is
DSTROOT/usr/local/include/unicode/uchar.h. This is already in the search
path of the other WebKit projects, so those other projects can remove
their explicit listing of the old place these headers lived.
Also add the remaining ICU 55.1 headers which the other projects (like
WebCore) need. Revert any local changes to these headers in favor of
using the GCC_PREPROCESSOR_DEFINITIONS build setting. This is so we can
compile the same way against unmodified headers.
* Configurations/Base.xcconfig:
* Configurations/CopyWTFHeaders.xcconfig:
* WTF.xcodeproj/project.pbxproj:
* icu/unicode/alphaindex.h: Added.
* icu/unicode/appendable.h: Added.
* icu/unicode/basictz.h: Added.
* icu/unicode/brkiter.h: Added.
(BreakIterator::isBufferClone):
* icu/unicode/bytestrie.h: Added.
* icu/unicode/bytestriebuilder.h: Added.
* icu/unicode/calendar.h: Added.
(Calendar::createInstance):
(Calendar::roll):
(Calendar::internalSet):
(Calendar::weekNumber):
* icu/unicode/caniter.h: Added.
* icu/unicode/chariter.h: Renamed from Source/WebCore/icu/unicode/chariter.h.
* icu/unicode/choicfmt.h: Added.
* icu/unicode/coleitr.h: Added.
(CollationElementIterator::primaryOrder):
(CollationElementIterator::secondaryOrder):
(CollationElementIterator::tertiaryOrder):
(CollationElementIterator::isIgnorable):
* icu/unicode/coll.h: Added.
* icu/unicode/compactdecimalformat.h: Added.
* icu/unicode/curramt.h: Added.
(CurrencyAmount::getCurrency):
(CurrencyAmount::getISOCurrency):
* icu/unicode/currpinf.h: Added.
(CurrencyPluralInfo::operator!=):
* icu/unicode/currunit.h: Added.
(CurrencyUnit::getISOCurrency):
* icu/unicode/datefmt.h: Added.
* icu/unicode/dbbi.h: Added.
* icu/unicode/dcfmtsym.h: Added.
(DecimalFormatSymbols::getSymbol):
(DecimalFormatSymbols::getConstSymbol):
(DecimalFormatSymbols::setSymbol):
(DecimalFormatSymbols::getLocale):
(DecimalFormatSymbols::getCurrencyPattern):
* icu/unicode/decimfmt.h: Added.
(DecimalFormat::getConstSymbol):
* icu/unicode/docmain.h: Added.
* icu/unicode/dtfmtsym.h: Added.
* icu/unicode/dtintrv.h: Added.
(DateInterval::getFromDate):
(DateInterval::getToDate):
(DateInterval::operator!=):
* icu/unicode/dtitvfmt.h: Added.
(DateIntervalFormat::operator!=):
* icu/unicode/dtitvinf.h: Added.
(DateIntervalInfo::operator!=):
* icu/unicode/dtptngen.h: Added.
* icu/unicode/dtrule.h: Added.
* icu/unicode/enumset.h: Added.
(EnumSet::EnumSet):
(EnumSet::~EnumSet):
(EnumSet::clear):
(EnumSet::add):
(EnumSet::remove):
(EnumSet::contains):
(EnumSet::set):
(EnumSet::get):
(EnumSet::isValidEnum):
(EnumSet::isValidValue):
(EnumSet::operator=):
(EnumSet::getAll):
(EnumSet::flag):
* icu/unicode/errorcode.h: Added.
* icu/unicode/fieldpos.h: Added.
(FieldPosition::operator=):
(FieldPosition::operator==):
(FieldPosition::operator!=):
* icu/unicode/filteredbrk.h: Added.
* icu/unicode/fmtable.h: Added.
(Formattable::getDate):
(Formattable::getString):
(Formattable::getLong):
(Formattable::toUFormattable):
(Formattable::fromUFormattable):
* icu/unicode/format.h: Added.
* icu/unicode/fpositer.h: Added.
* icu/unicode/gender.h: Added.
* icu/unicode/gregocal.h: Added.
* icu/unicode/icudataver.h: Added.
* icu/unicode/icuplug.h: Added.
* icu/unicode/idna.h: Added.
* icu/unicode/listformatter.h: Added.
(ListFormatData::ListFormatData):
* icu/unicode/locdspnm.h: Added.
(LocaleDisplayNames::createInstance):
* icu/unicode/locid.h: Added.
(Locale::operator!=):
(Locale::getCountry):
(Locale::getLanguage):
(Locale::getScript):
(Locale::getVariant):
(Locale::getName):
(Locale::isBogus):
* icu/unicode/measfmt.h: Added.
* icu/unicode/measunit.h: Added.
* icu/unicode/measure.h: Added.
(Measure::getNumber):
(Measure::getUnit):
* icu/unicode/messagepattern.h: Added.
* icu/unicode/msgfmt.h: Added.
* icu/unicode/normalizer2.h: Added.
* icu/unicode/normlzr.h: Added.
(Normalizer::operator!= ):
(Normalizer::quickCheck):
(Normalizer::isNormalized):
(Normalizer::compare):
* icu/unicode/numfmt.h: Added.
(NumberFormat::isParseIntegerOnly):
(NumberFormat::isLenient):
* icu/unicode/numsys.h: Added.
* icu/unicode/parsepos.h: Added.
(ParsePosition::operator=):
(ParsePosition::operator==):
(ParsePosition::operator!=):
(ParsePosition::getIndex):
(ParsePosition::setIndex):
(ParsePosition::getErrorIndex):
(ParsePosition::setErrorIndex):
* icu/unicode/plurfmt.h: Added.
* icu/unicode/plurrule.h: Added.
* icu/unicode/rbbi.h: Added.
(RuleBasedBreakIterator::operator!=):
* icu/unicode/rbnf.h: Added.
(RuleBasedNumberFormat::isLenient):
(RuleBasedNumberFormat::getDefaultRuleSet):
* icu/unicode/rbtz.h: Added.
* icu/unicode/regex.h: Added.
* icu/unicode/region.h: Added.
* icu/unicode/reldatefmt.h: Added.
* icu/unicode/resbund.h: Added.
* icu/unicode/schriter.h: Added.
* icu/unicode/scientificnumberformatter.h: Added.
* icu/unicode/search.h: Added.
(SearchIterator::operator!=):
* icu/unicode/selfmt.h: Added.
* icu/unicode/simpletz.h: Added.
(SimpleTimeZone::setStartRule):
(SimpleTimeZone::setEndRule):
(SimpleTimeZone::getOffset):
* icu/unicode/smpdtfmt.h: Added.
(SimpleDateFormat::get2DigitYearStart):
* icu/unicode/sortkey.h: Added.
(CollationKey::operator!=):
(CollationKey::isBogus):
(CollationKey::getByteArray):
* icu/unicode/stringtriebuilder.h: Added.
* icu/unicode/stsearch.h: Added.
* icu/unicode/symtable.h: Added.
* icu/unicode/tblcoll.h: Added.
* icu/unicode/timezone.h: Added.
(TimeZone::getID):
(TimeZone::setID):
* icu/unicode/tmunit.h: Added.
* icu/unicode/tmutamt.h: Added.
(TimeUnitAmount::operator!=):
* icu/unicode/tmutfmt.h: Added.
(TimeUnitFormat::operator!=):
* icu/unicode/translit.h: Added.
(Transliterator::getMaximumContextLength):
(Transliterator::setID):
(Transliterator::integerToken):
(Transliterator::pointerToken):
* icu/unicode/tzfmt.h: Added.
* icu/unicode/tznames.h: Added.
* icu/unicode/tzrule.h: Added.
* icu/unicode/tztrans.h: Added.
* icu/unicode/ubidi.h: Added.
* icu/unicode/ucal.h: Renamed from Source/JavaScriptCore/icu/unicode/ucal.h.
* icu/unicode/ucasemap.h: Added.
* icu/unicode/ucat.h: Added.
* icu/unicode/ucharstrie.h: Added.
* icu/unicode/ucharstriebuilder.h: Added.
* icu/unicode/uchriter.h: Added.
* icu/unicode/uclean.h: Added.
* icu/unicode/ucnv_cb.h: Renamed from Source/WebCore/icu/unicode/ucnv_cb.h.
* icu/unicode/ucnvsel.h: Added.
* icu/unicode/ucoleitr.h: Renamed from Source/WebCore/icu/unicode/ucoleitr.h.
* icu/unicode/uconfig.h:
* icu/unicode/ucsdet.h: Renamed from Source/WebCore/icu/unicode/ucsdet.h.
* icu/unicode/udat.h: Renamed from Source/JavaScriptCore/icu/unicode/udat.h.
* icu/unicode/udata.h: Added.
* icu/unicode/udateintervalformat.h: Added.
* icu/unicode/udatpg.h: Renamed from Source/JavaScriptCore/icu/unicode/udatpg.h.
* icu/unicode/udisplaycontext.h: Renamed from Source/JavaScriptCore/icu/unicode/udisplaycontext.h.
* icu/unicode/ufieldpositer.h: Renamed from Source/JavaScriptCore/icu/unicode/ufieldpositer.h.
* icu/unicode/uformattable.h: Renamed from Source/JavaScriptCore/icu/unicode/uformattable.h.
* icu/unicode/ugender.h: Added.
* icu/unicode/uidna.h: Renamed from Source/WebCore/icu/unicode/uidna.h.
* icu/unicode/uldnames.h: Added.
* icu/unicode/ulistformatter.h: Added.
* icu/unicode/ulocdata.h: Added.
* icu/unicode/umisc.h: Renamed from Source/JavaScriptCore/icu/unicode/umisc.h.
* icu/unicode/umsg.h: Added.
* icu/unicode/unifilt.h: Added.
* icu/unicode/unifunct.h: Added.
* icu/unicode/unimatch.h: Added.
* icu/unicode/unirepl.h: Added.
* icu/unicode/uniset.h: Added.
(UnicodeSet::operator!=):
(UnicodeSet::isFrozen):
(UnicodeSet::containsSome):
(UnicodeSet::isBogus):
(UnicodeSet::fromUSet):
(UnicodeSet::toUSet):
(UnicodeSet::span):
(UnicodeSet::spanBack):
* icu/unicode/unum.h: Renamed from Source/JavaScriptCore/icu/unicode/unum.h.
* icu/unicode/unumsys.h: Renamed from Source/JavaScriptCore/icu/unicode/unumsys.h.
* icu/unicode/upluralrules.h: Added.
* icu/unicode/uregex.h: Added.
* icu/unicode/uregion.h: Added.
* icu/unicode/urep.h: Added.
* icu/unicode/ures.h: Added.
(ures_getUnicodeString):
(ures_getNextUnicodeString):
(ures_getUnicodeStringByIndex):
(ures_getUnicodeStringByKey):
* icu/unicode/usearch.h: Renamed from Source/WebCore/icu/unicode/usearch.h.
* icu/unicode/usetiter.h: Added.
(UnicodeSetIterator::isString):
(UnicodeSetIterator::getCodepoint):
(UnicodeSetIterator::getCodepointEnd):
* icu/unicode/ushape.h: Renamed from Source/WebCore/icu/unicode/ushape.h.
* icu/unicode/usprep.h: Added.
* icu/unicode/ustdio.h: Added.
* icu/unicode/ustream.h: Added.
* icu/unicode/ustringtrie.h: Added.
* icu/unicode/utf32.h: Added.
* icu/unicode/utmscale.h: Added.
* icu/unicode/utrace.h: Added.
* icu/unicode/utrans.h: Added.
* icu/unicode/utypes.h:
* icu/unicode/vtzone.h: Added.
2017-07-03 Keith Miller <keith_miller@apple.com>
Fix ifndef in Assertions.h
https://bugs.webkit.org/show_bug.cgi?id=174104
Reviewed by Saam Barati.
The ifndef should have been checking for
CRASH_WITH_SECURITY_IMPLICATION_AND_INFO since that is what the
ifndef defines.
* wtf/Assertions.h:
2017-07-03 Andy Estes <aestes@apple.com>
[Xcode] Add an experimental setting to build with ccache
https://bugs.webkit.org/show_bug.cgi?id=173875
Reviewed by Tim Horton.
* Configurations/DebugRelease.xcconfig: Included ccache.xcconfig.
2017-07-03 Daewoong Jang <daewoong.jang@navercorp.com>
Remove an unused function export
https://bugs.webkit.org/show_bug.cgi?id=174084
Reviewed by Yusuke Suzuki.
* wtf/Threading.h:
2017-07-02 Yusuke Suzuki <utatane.tea@gmail.com>
WTF::Thread should have the threads stack bounds.
https://bugs.webkit.org/show_bug.cgi?id=173975
Reviewed by Mark Lam.
We move StackBounds from WTFThreadData to WTF::Thread.
One important thing is that we should make valid StackBounds
visible to Thread::create() caller. When the caller get
WTF::Thread from Thread::create(), this WTF::Thread should
have a valid StackBounds. But StackBounds information can be
retrived only in the WTF::Thread's thread itself.
* wtf/StackBounds.h:
(WTF::StackBounds::emptyBounds):
(WTF::StackBounds::StackBounds):
* wtf/StackStats.cpp:
(WTF::StackStats::PerThreadStats::PerThreadStats):
* wtf/Threading.cpp:
(WTF::threadEntryPoint):
(WTF::Thread::create):
(WTF::Thread::currentMayBeNull):
(WTF::Thread::initialize):
* wtf/Threading.h:
(WTF::Thread::stack):
* wtf/ThreadingPthreads.cpp:
(WTF::Thread::initializeCurrentThreadEvenIfNonWTFCreated):
(WTF::Thread::current):
(WTF::initializeCurrentThreadEvenIfNonWTFCreated): Deleted.
(WTF::Thread::currentMayBeNull): Deleted.
* wtf/ThreadingWin.cpp:
(WTF::Thread::initializeCurrentThreadEvenIfNonWTFCreated):
(WTF::Thread::initializeCurrentThreadInternal):
(WTF::Thread::current):
* wtf/WTFThreadData.cpp:
(WTF::WTFThreadData::WTFThreadData):
* wtf/WTFThreadData.h:
(WTF::WTFThreadData::stack): Deleted.
2017-07-01 Dan Bernstein <mitz@apple.com>
[iOS] Remove code only needed when building for iOS 9.x
https://bugs.webkit.org/show_bug.cgi?id=174068
Reviewed by Tim Horton.
* wtf/Platform.h:
* wtf/mac/DeprecatedSymbolsUsedBySafari.mm:
* wtf/spi/darwin/dyldSPI.h:
2017-07-01 Caio Lima <ticaiolima@gmail.com>
[JSC] WTFGetBacktrace can return numberOfFrames == 0 in some architectures
https://bugs.webkit.org/show_bug.cgi?id=172768
Reviewed by Mark Lam.
In some architectures, like ARMv6 running on a Raspberry pi, the
backtrace function from "execinfo.h" is returning 0. In
that case, the RELEASE_ASSERT in StackTrace::captureStackTrace
fails causing a runtime crash.
This patch is adding a guard for the case described above to
avoid a runtime crash in such case.
* wtf/StackTrace.cpp:
(WTF::StackTrace::captureStackTrace):
2017-07-01 Dan Bernstein <mitz@apple.com>
[macOS] Remove code only needed when building for OS X Yosemite
https://bugs.webkit.org/show_bug.cgi?id=174067
Reviewed by Tim Horton.
* Configurations/Base.xcconfig:
* Configurations/DebugRelease.xcconfig:
* wtf/Platform.h:
* wtf/mac/AppKitCompatibilityDeclarations.h:
* wtf/spi/cocoa/SecuritySPI.h:
* wtf/text/TextBreakIterator.cpp:
2017-07-01 Joseph Pecoraro <pecoraro@apple.com>
Add a warning if WEBGL2 is enabled without WEBGL
https://bugs.webkit.org/show_bug.cgi?id=174054
Reviewed by Sam Weinig.
* wtf/FeatureDefines.h:
2017-06-30 Keith Miller <keith_miller@apple.com>
Force crashWithInfo to be out of line.
https://bugs.webkit.org/show_bug.cgi?id=174028
Reviewed by Filip Pizlo.
The first pass at making crashes hold information about why they
were crashing had the problem that it would inline the assertion.
This meant that clang could coalesce DFG_ASSERTS with other
assertion failures in the same function. This patch moves it out
of line to help fix that issue.
* wtf/Assertions.cpp:
(WTFCrashWithInfo):
* wtf/Assertions.h:
(WTF::isIntegralType):
2017-06-30 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Drop SymbolRegistry::keyForSymbol
https://bugs.webkit.org/show_bug.cgi?id=174052
Reviewed by Sam Weinig.
Since we can know whether a given symbol is registered by checking RegisteredSymbolImpl,
we do not need to query key string for a given symbol by using SymbolRegistry::keyForSymbol.
* wtf/text/SymbolImpl.h:
(WTF::SymbolImpl::extractFoldedString): Deleted.
* wtf/text/SymbolRegistry.cpp:
(WTF::SymbolRegistry::keyForSymbol): Deleted.
* wtf/text/SymbolRegistry.h:
2017-06-29 Jer Noble <jer.noble@apple.com>
Make Legacy EME API controlled by RuntimeEnabled setting.
https://bugs.webkit.org/show_bug.cgi?id=173994
Reviewed by Sam Weinig.
* wtf/FeatureDefines.h:
2017-06-30 Ryosuke Niwa <rniwa@webkit.org>
Ran sort-Xcode-project-file.
* WTF.xcodeproj/project.pbxproj:
2017-06-30 Matt Lewis <jlewis3@apple.com>
Unreviewed, rolling out r218992.
The patch broke the iOS device builds.
Reverted changeset:
"DFG_ASSERT should allow stuffing registers before trapping."
https://bugs.webkit.org/show_bug.cgi?id=174005
http://trac.webkit.org/changeset/218992
2017-06-30 Keith Miller <keith_miller@apple.com>
DFG_ASSERT should allow stuffing registers before trapping.
https://bugs.webkit.org/show_bug.cgi?id=174005
Reviewed by Mark Lam.
Add new template functions that enable stuffing up to five values
into registers before crashing.
* wtf/Assertions.h:
(CRASH_WITH_INFO):
2017-06-28 Brent Fulgham <bfulgham@apple.com>
Teach ResourceLoadStatistics to recognize changes in the file system
https://bugs.webkit.org/show_bug.cgi?id=173800
<rdar://problem/32937842>
Reviewed by Chris Dumez.
* wtf/DispatchPtr.h: Added (moved from WebKit2)
* wtf/Platform.h: Make sure USE_FILE_LOCK is enabled.
2017-06-28 David Kilzer <ddkilzer@apple.com>
Fix typo in comment: WordResult => WorkResult
* wtf/AutomaticThread.h:
2017-06-27 Caio Lima <ticaiolima@gmail.com>
[ESnext] Implement Object Rest - Implementing Object Rest Destructuring
https://bugs.webkit.org/show_bug.cgi?id=167962
Reviewed by Saam Barati.
* wtf/HashSet.h:
(WTF::=):
2017-06-26 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Drop Thread::create(obsolete things) API since we can use lambda
https://bugs.webkit.org/show_bug.cgi?id=173825
Reviewed by Saam Barati.
Thread::create(ThreadFunction, void* data, const char* name) is a bit old API.
Since we have C++ lambda, the above API is simply unnecessary. And C++ lambda
based one is better since the above API needs casting data to and from void*.
* wtf/Function.h:
Avoid ambiguity.
* wtf/ParallelJobsGeneric.cpp:
(WTF::ParallelEnvironment::ThreadPrivate::tryLockFor):
(WTF::ParallelEnvironment::ThreadPrivate::workerThread): Deleted.
* wtf/ParallelJobsGeneric.h:
* wtf/Threading.cpp:
* wtf/ThreadingWin.cpp:
(WTF::createThread):
2017-06-25 Yusuke Suzuki <utatane.tea@gmail.com>
initializeThreading() [first] causes WTFCrash due to maxSingleAllocationSize not being initialized
https://bugs.webkit.org/show_bug.cgi?id=173720
Reviewed by Mark Lam.
When using std::numeric_limits<size_t>::max() for global variable's initialization,
it seems that it invokes static constructor to initialize this in VC++.
We avoid this edge case by introducing a workaround using SIZE_MAX here.
When I perform git-grep, there is only one site (this) using std::numeric_limits<>::xxx()
to initialize global variable.
* wtf/FastMalloc.cpp:
2017-06-25 Konstantin Tokarev <annulen@yandex.ru>
Remove excessive headers from JavaScriptCore
https://bugs.webkit.org/show_bug.cgi?id=173812
Reviewed by Darin Adler.
* wtf/Bag.h:
2017-06-23 Keith Miller <keith_miller@apple.com>
Switch VMTraps to use halt instructions rather than breakpoint instructions
https://bugs.webkit.org/show_bug.cgi?id=173677
<rdar://problem/32178892>
Reviewed by JF Bastien.
Remove the Trap signal handler code since it plays badly with lldb and combine
SIGBUS with SIGSEGV since distiguishing them is generally non-portable.
Also, update the platform code to only use signaling VMTraps
on where we have an appropriate instruction (x86 and ARM64).
* wtf/Platform.h:
* wtf/threads/Signals.cpp:
(WTF::fromMachException):
(WTF::toMachMask):
(WTF::installSignalHandler):
(WTF::jscSignalHandler):
* wtf/threads/Signals.h:
(WTF::toSystemSignal):
(WTF::fromSystemSignal):
2017-06-23 Antti Koivisto <antti@apple.com>
Add notifyutil registrations for going in and out of simulated low memory state
https://bugs.webkit.org/show_bug.cgi?id=173797
Reviewed by Andreas Kling.
Add
notifyutil -p org.WebKit.lowMemory.begin
notifyutil -p org.WebKit.lowMemory.end
for debugging.
* wtf/cocoa/MemoryPressureHandlerCocoa.mm:
(WTF::MemoryPressureHandler::install):
2017-06-23 Konstantin Tokarev <annulen@yandex.ru>
Remove more unused headers from WTF
https://bugs.webkit.org/show_bug.cgi?id=173761
Reviewed by Yusuke Suzuki.
* wtf/Liveness.h:
* wtf/PageAllocation.h:
* wtf/ParallelJobs.h:
2017-06-22 Andreas Kling <akling@apple.com>
Rename MemoryPressureHandler::setTabCount to setPageCount
https://bugs.webkit.org/show_bug.cgi?id=173750
Reviewed by Daniel Bates.
This function is counting WebCore::Page objects (excluding utility Pages used
by SVG-as-image and the web inspector) so let's name it appropriately.
Not all WebKit clients have tabs.
* wtf/MemoryPressureHandler.cpp:
(WTF::MemoryPressureHandler::setPageCount):
(WTF::MemoryPressureHandler::thresholdForMemoryKill):
(WTF::MemoryPressureHandler::measurementTimerFired):
(WTF::MemoryPressureHandler::setTabCount): Deleted.
* wtf/MemoryPressureHandler.h:
2017-06-21 Andreas Kling <akling@apple.com>
Increase memory kill limits for WebContent processes that manage multiple tabs.
https://bugs.webkit.org/show_bug.cgi?id=173674
Reviewed by Geoffrey Garen.
When opening <a target=_blank> links, we currently have to use the same WebContent
process for the new tab, to support scripting the window.opener object.
This means that some WebContent processes end up hosting multiple tabs, making it
more likely that those processes will hit the memory limits.
Address this by adding some additional allowance for multi-tab processes:
For each additional tab, up to 4 tabs, add 1GB to the memory kill limit.
* wtf/MemoryPressureHandler.cpp:
(WTF::thresholdForMemoryKillWithProcessState):
(WTF::MemoryPressureHandler::setTabCount):
(WTF::MemoryPressureHandler::thresholdForMemoryKill):
(WTF::MemoryPressureHandler::measurementTimerFired):
* wtf/MemoryPressureHandler.h:
2017-06-21 Chris Dumez <cdumez@apple.com>
Allow constructing a WTF:Function from a function pointer
https://bugs.webkit.org/show_bug.cgi?id=173660
Reviewed by Alex Christensen.
Allow constructing a WTF:Function from a function pointer and
assigning a function pointer to a WTF:Function.
* wtf/Function.h:
2017-06-20 Simon Fraser <simon.fraser@apple.com>
Remove WILL_REVEAL_EDGE_EVENTS code
https://bugs.webkit.org/show_bug.cgi?id=173632
Reviewed by Sam Weinig, Beth Dakin.
Remove will-reveal-edge events, which never took off.
* wtf/FeatureDefines.h:
2017-06-20 Konstantin Tokarev <annulen@yandex.ru>
Remove excessive include directives from WTF
https://bugs.webkit.org/show_bug.cgi?id=173553
Reviewed by Saam Barati.
* wtf/AutomaticThread.h:
* wtf/BagToHashMap.h:
* wtf/CrossThreadCopier.h:
* wtf/CrossThreadQueue.h:
* wtf/DateMath.h:
* wtf/Expected.h:
* wtf/HashMap.h:
* wtf/Indenter.h:
* wtf/MessageQueue.h:
* wtf/MetaAllocator.h:
* wtf/MetaAllocatorHandle.h:
* wtf/RandomNumberSeed.h:
* wtf/Ref.h:
* wtf/RefPtr.h:
* wtf/RunLoop.h:
* wtf/SchedulePair.h:
* wtf/StackStats.h:
* wtf/SynchronizedFixedQueue.h:
* wtf/ThreadMessage.h:
* wtf/Threading.cpp:
* wtf/Threading.h:
* wtf/ThreadingPthreads.cpp:
* wtf/ThreadingWin.cpp:
* wtf/WTFThreadData.h:
* wtf/WorkQueue.h:
* wtf/glib/GRefPtr.h:
* wtf/text/AtomicStringTable.h:
* wtf/text/LineBreakIteratorPoolICU.h:
2017-06-20 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Enable WTF::Signals only when HAVE(MACHINE_CONTEXT) is true
https://bugs.webkit.org/show_bug.cgi?id=173590
Reviewed by Carlos Garcia Campos.
WTF::Signals require a feature rewriting a value of a machine context.
This is only available under HAVE(MACHINE_CONTEXT).
This patch disables WTF::Signals on !HAVE(MACHINE_CONTEXT) environments.
* wtf/threads/Signals.cpp:
* wtf/threads/Signals.h:
2017-06-20 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Rebaseline std::optional
https://bugs.webkit.org/show_bug.cgi?id=173582
Reviewed by JF Bastien.
Update the copy of our std::optional to the latest version.
It adds std::optional::has_value() and std::optional::reset().
* wtf/Optional.h:
2017-06-18 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Include execinfo.h and dlfcn.h based on platform defines
https://bugs.webkit.org/show_bug.cgi?id=173531
Reviewed by Alex Christensen.
execinfo.h and dlfcn.h can be missing in some libc libraries.
When including it, we should honor platform defines like HAVE(DLADDR).
* wtf/StackTrace.cpp:
2017-06-18 Darin Adler <darin@apple.com>
Fix Ref to deref before assignment, add tests for this to RefPtr, Ref, Function
https://bugs.webkit.org/show_bug.cgi?id=173526
Reviewed by Sam Weinig.
* wtf/Ref.h: Changed operator= to not be defined inside the class definition.
Added swap functions. Changed operator= implementations to use swap in the
conventional manner, the same way that RefPtr does.
2017-06-18 Chris Dumez <cdumez@apple.com>
Use WTF::Function instead of std::function in WTF/
https://bugs.webkit.org/show_bug.cgi?id=173519
Reviewed by Sam Weinig.
Use WTF::Function instead of std::function in WTF/ to avoid
copying.
* wtf/Brigand.h:
* wtf/Condition.h:
* wtf/Expected.h:
* wtf/FunctionDispatcher.h:
* wtf/MainThread.h:
* wtf/MemoryPressureHandler.h:
(WTF::MemoryPressureHandler::setMemoryKillCallback):
(WTF::MemoryPressureHandler::setMemoryPressureStatusChangedCallback):
(WTF::MemoryPressureHandler::setDidExceedInactiveLimitWhileActiveCallback):
* wtf/Optional.h:
* wtf/ParkingLot.h:
* wtf/RefCounter.h:
(WTF::RefCounter<T>::RefCounter):
* wtf/WorkQueue.h:
* wtf/linux/MemoryPressureHandlerLinux.cpp:
(WTF::MemoryPressureHandler::EventFDPoller::EventFDPoller):
* wtf/text/WTFString.cpp:
(WTF::String::split):
* wtf/text/WTFString.h:
2017-06-16 Alex Christensen <achristensen@webkit.org>
Fix Mac CMake build.
* wtf/PlatformMac.cmake:
Generate MachExceptionsServer.h
2017-06-16 Wenson Hsieh <wenson_hsieh@apple.com>
[iOS DnD] Upstream iOS drag and drop implementation into OpenSource WebKit
https://bugs.webkit.org/show_bug.cgi?id=173366
<rdar://problem/32767014>
Reviewed by Tim Horton.
Define ENABLE_DRAG_SUPPORT as 1 by default and 0 for iOS, and define ENABLE_DATA_INTERACTION as 0 by default.
These are overridden to both be 1 for iOS 11+ in the FeatureDefines.xcconfig within each individual project.
* wtf/Platform.h:
2017-06-15 Chris Dumez <cdumez@apple.com>
Fix typo in XPCSPI.h
https://bugs.webkit.org/show_bug.cgi?id=173426
Reviewed by Alex Christensen.
We should check if xpc_release is defined before defining it,
not xpc_retain.
* wtf/spi/darwin/XPCSPI.h:
2017-06-15 Konstantin Tokarev <annulen@yandex.ru>
Implement FALLTHROUGH macro for compilers other than Clang
https://bugs.webkit.org/show_bug.cgi?id=173385
Reviewed by Alex Christensen.
FALLTHROUGH should be able to use [[gnu::fallthrough]] attribute of
GCC, and [[fallthrough]] from C++17, whichever is available.
* wtf/Compiler.h:
2017-06-14 Nael Ouedraogo <nael.ouedraogo@crf.canon.fr>
MediaSource duration attribute should not be equal to Infinity when set to a value greater than 2^64
https://bugs.webkit.org/show_bug.cgi?id=171668
Reviewed by Jer Noble.
MediaSource duration attribute is a double represented in MediaSource by a MediaTime instance created with
MediaTime::CreateWithDouble(). This method implements an overflow control mechanism which sets MediaTime to
Infinity when the double value passed as argument is greater than 2^64.
This patch removes the overflow control mechanism when time value is represented as a double. This patch also
modifies the behavior of mathematical operations between a double MediaTime and rational MediaTime: the rational
MediaTime is converted to a double before applying the operation. Double MediaTime precision is the same as for
double. Overflow mechanisms still apply to the conversion of a double MediaTime to rational with setTimescale()
method. No behavior change for rational MediaTime.
* wtf/MediaTime.cpp:
(WTF::MediaTime::createWithFloat):
(WTF::MediaTime::createWithDouble):
(WTF::MediaTime::operator+):
(WTF::MediaTime::operator-):
2017-06-13 Zan Dobersek <zdobersek@igalia.com>
[GTK][WPE] Use CMAKE_THREAD_LIBS_INIT in WTF platform CMake files
https://bugs.webkit.org/show_bug.cgi?id=173310
Reviewed by Xabier Rodriguez-Calvar.
In the WTF platform CMake files for the GTK+ and WPE ports, use the
CMAKE_THREAD_LIBS_INIT variable to specify the threading library we
should be linking against. On some platforms this variable will be
empty because the given compiler will automatically handle the -pthread
compiler flag and sort out linking on its own.
The same approach is already used for the JSCOnly configuration.
* wtf/PlatformGTK.cmake:
* wtf/PlatformWPE.cmake:
2017-06-13 Youenn Fablet <youenn@apple.com>
Filter SDP from ICE candidates in case of local ICE candidate filtering
https://bugs.webkit.org/show_bug.cgi?id=173120
Reviewed by Eric Carlson.
Adding split helper routine with functor parameter.
* wtf/text/WTFString.cpp:
(WTF::String::split):
* wtf/text/WTFString.h:
(WTF::String::contains):
2017-06-13 Don Olmstead <don.olmstead@sony.com>
[WTF] Remove redundant includes in config.h
https://bugs.webkit.org/show_bug.cgi?id=173292
Reviewed by Alex Christensen.
* config.h:
* wtf/ExportMacros.h:
2017-06-12 Jer Noble <jer.noble@apple.com>
Screen sleeps while doing WebRTC video
https://bugs.webkit.org/show_bug.cgi?id=173278
Reviewed by Eric Carlson.
Drive-by fix: add some generic methods for iterating over collections.
* WTF.xcodeproj/project.pbxproj:
* wtf/Algorithms.h: Added.
(WTF::forEach):
(WTF::anyOf):
(WTF::allOf):
2017-06-12 Carlos Garcia Campos <cgarcia@igalia.com>
[GTK] Move WebKit GType macros to WTF
https://bugs.webkit.org/show_bug.cgi?id=173249
Reviewed by Žan Doberšek.
They can be used by glib-based ports and eventually by JavaScriptCore glib bindings too.
* wtf/glib/WTFGType.h: Copied from Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h.
2017-06-11 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Make ThreadMessage portable
https://bugs.webkit.org/show_bug.cgi?id=172073
Reviewed by Keith Miller.
Recently, we change ThreadMessage semantics: message handler
can be executed in the sender thread.
This allows ThreadMessage to be implemented in a portable way.
This patch implements ThreadMessage for all the platforms.
We use platform-independent Thread APIs, suspend(), resume(),
and getRegisters().
* wtf/PlatformRegisters.h:
(WTF::registersFromUContext):
* wtf/ThreadMessage.cpp:
(WTF::sendMessageScoped):
(WTF::ThreadMessageData::ThreadMessageData): Deleted.
(): Deleted.
(WTF::initializeThreadMessages): Deleted.
(WTF::sendMessageUsingSignal): Deleted.
(WTF::sendMessageUsingMach): Deleted.
(WTF::deliverMessagesUsingMach): Deleted.
* wtf/ThreadMessage.h:
* wtf/Threading.cpp:
(WTF::initializeThreading):
* wtf/Threading.h:
(WTF::Thread::threadMessages): Deleted.
* wtf/ThreadingPthreads.cpp:
(WTF::Thread::signalHandlerSuspendResume):
(WTF::threadStateMetadata):
(WTF::Thread::getRegisters):
* wtf/threads/Signals.cpp:
(WTF::handleSignalsWithMach):
2017-06-11 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Drop unnecessary includes in Threading.h
https://bugs.webkit.org/show_bug.cgi?id=173167
Reviewed by Darin Adler.
Threading.h includes bunch of headers. But some of them are not necessary.
This patch cleans up it a bit.
* wtf/Assertions.cpp:
* wtf/LocklessBag.h:
* wtf/Threading.h:
* wtf/ThreadingPrimitives.h:
2017-06-10 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Add RegisteredSymbolImpl
https://bugs.webkit.org/show_bug.cgi?id=173230
Reviewed by Mark Lam.
Most symbols are not registered in SymbolRegistry. However, we currently always
allocate a pointer member to point to a SymbolRegistry, and this pointer is always null.
SymbolImpl is immutable, and it will never be registered with a SymbolRegistry
after it is created. Hence, this member is wasteful.
Instead, we add a new derived class RegisteredSymbolImpl, which will set a flag in
SymbolImpl to indicate that it is registered with a SymbolRegistry. The only way to
create a RegisteredSymbolImpl is via a factory method provided by the SymbolRegistry.
The factory method will pass the SymbolRegistry this pointer to the RegisteredSymbolImpl's
constructor for initializing the RegisteredSymbolImpl's m_symbolRegistry field.
By doing so,
1. We do not need to set m_symbolRegistry after creating a Symbol. It is clean.
2. We reduce the size of SymbolImpls that do not need to be registered.
* wtf/text/StringImpl.cpp:
(WTF::StringImpl::~StringImpl):
* wtf/text/StringImpl.h:
* wtf/text/SymbolImpl.cpp:
(WTF::SymbolImpl::create):
(WTF::RegisteredSymbolImpl::create):
* wtf/text/SymbolImpl.h:
(WTF::SymbolImpl::hashForSymbol):
(WTF::SymbolImpl::isRegistered):
(WTF::SymbolImpl::SymbolImpl):
(WTF::RegisteredSymbolImpl::symbolRegistry):
(WTF::RegisteredSymbolImpl::clearSymbolRegistry):
(WTF::RegisteredSymbolImpl::RegisteredSymbolImpl):
(WTF::SymbolImpl::symbolRegistry):
* wtf/text/SymbolRegistry.cpp:
(WTF::SymbolRegistry::~SymbolRegistry):
(WTF::SymbolRegistry::symbolForKey):
(WTF::SymbolRegistry::keyForSymbol):
(WTF::SymbolRegistry::remove):
* wtf/text/SymbolRegistry.h:
2017-06-10 Dan Bernstein <mitz@apple.com>
Reverted r218056 because it made the IDE reindex constantly.
* Configurations/DebugRelease.xcconfig:
2017-06-10 Dan Bernstein <mitz@apple.com>
[Xcode] With Xcode 9 developer beta, everything rebuilds when switching between command-line and IDE
https://bugs.webkit.org/show_bug.cgi?id=173223
Reviewed by Sam Weinig.
The rebuilds were happening due to a difference in the compiler options that the IDE and
xcodebuild were specifying. Only the IDE was passing the -index-store-path option. To make
xcodebuild pass that option, too, set CLANG_INDEX_STORE_ENABLE to YES if it is unset, and
specify an appropriate path in CLANG_INDEX_STORE_PATH.
* Configurations/DebugRelease.xcconfig:
2017-06-09 Chris Dumez <cdumez@apple.com>
Update Thread::create() to take in a WTF::Function instead of a std::function
https://bugs.webkit.org/show_bug.cgi?id=173175
Reviewed by Mark Lam.
Update Thread::create() to take in a WTF::Function instead of a std::function. Unlike
std::function, WTF:Function is not copyable and does not make implicit copies of captured
variables. Doing captures such as [string = string.isolatedCopy()] when passing an
std::function to another thread has lead to bugs in the past due to implicit copying of
the captured string.
* wtf/Threading.cpp:
(WTF::Thread::create):
* wtf/Threading.h:
2017-06-09 Chris Dumez <cdumez@apple.com>
Update WorkQueue::concurrentApply() to take a WTF::Function instead of an std::function
https://bugs.webkit.org/show_bug.cgi?id=173165
Reviewed by Saam Barati.
Update WorkQueue::concurrentApply() to take a WTF::Function instead of an std::function
as std::function has issues with regards to thread safety.
* wtf/WorkQueue.h:
* wtf/cocoa/WorkQueueCocoa.cpp:
(WTF::WorkQueue::concurrentApply):
2017-06-08 Xabier Rodriguez Calvar <calvaris@igalia.com>
MediaTime class has rounding issues in different platforms
https://bugs.webkit.org/show_bug.cgi?id=172640
Reviewed by Jer Noble.
The way a timescale is set when creating a MediaTime from a double
can create rounding issues in different platforms because in some
rounding is made and in others, it truncates. This way we ensure a
common behavior.
Dumping MediaTimes is also confusing and by the output you don't
know if it's containing a double or a fraction. Now, if it
contains a double, it only prints the double because printing the
fraction is misleading (it currently prints the double read as an
integer) and if it contains a fraction it shows the fraction and
its double representation separated by an = instead of a ,.
* wtf/MediaTime.cpp:
(WTF::MediaTime::createWithDouble): When creating MediaTime from
double, we round instead of leaving it to the cast operation.
(WTF::MediaTime::dump):
2017-06-07 Jer Noble <jer.noble@apple.com>
Refactoring: MediaEngineSupportParameters should take a ContentType rather than separate type & codecs strings
https://bugs.webkit.org/show_bug.cgi?id=173038
Reviewed by Eric Carlson.
Drive by fix: add a version of split that takes a UChar and returns a Vector<String>.
* wtf/text/WTFString.h:
(WTF::String::split):
2017-06-07 Zan Dobersek <zdobersek@igalia.com>
[GCrypt] RSA-PSS support
https://bugs.webkit.org/show_bug.cgi?id=172856
Reviewed by Jiewen Tan.
* wtf/Platform.h: Define HAVE_RSA_PSS to 1 for USE(GCRYPT). Support for RSA-PSS
is provided by default through the libgcrypt library.
2017-06-06 Chris Dumez <cdumez@apple.com>
Unreviewed, rolling out r214974.
Causes some tabs to start using a huge amount of CPU after 8
minutes in the background
Reverted changeset:
"Make inactive web processes behave as though under memory
pressure."
https://bugs.webkit.org/show_bug.cgi?id=170042
http://trac.webkit.org/changeset/214974
2017-06-06 Don Olmstead <don.olmstead@am.sony.com>
[WebCore] Enable REQUEST_ANIMATION_FRAME_TIMER for all ports
https://bugs.webkit.org/show_bug.cgi?id=172780
Reviewed by Alex Christensen.
* wtf/Platform.h:
2017-06-06 Darin Adler <darin@apple.com>
Cut down use of WTF_ARRAY_LENGTH
https://bugs.webkit.org/show_bug.cgi?id=172997
Reviewed by Chris Dumez.
* wtf/DateMath.cpp:
(WTF::equalLettersIgnoringASCIICase): Added helper function template.
(WTF::parseDateFromNullTerminatedCharacters): Use a modern for loop instead of
WTF_ARRAY_LENGTH. Use startsWithLettersIgnoringASCIICase and
equalLettersIgnoringASCIICase instead of strncasecmp.
* wtf/text/IntegerToStringConversion.h:
(WTF::numberToStringImpl): Use std::end instead of WTF_ARRAY_LENGTH.
(WTF::writeNumberToBufferImpl): Ditto.
2017-06-06 Filip Pizlo <fpizlo@apple.com>
index out of bound in bytecodebasicblock
https://bugs.webkit.org/show_bug.cgi?id=172963
Reviewed by Saam Barati and Mark Lam.
* wtf/Assertions.h:
(UNREACHABLE_FOR_PLATFORM):
2017-06-05 Jer Noble <jer.noble@apple.com>
Allow clients to specify a list of codecs which should require hardware decode support.
https://bugs.webkit.org/show_bug.cgi?id=172787
Reviewed by Alex Christensen.
Add a couple of convenience methods:
- a String::split() that returns a vector (rather than taking an out-reference to a vector).
- A Vector::map() template which takes a Callable and returns a Vector of a different type.
* wtf/Vector.h:
(WTF::Vector::map):
* wtf/text/WTFString.h:
(WTF::String::split):
2017-06-04 Konstantin Tokarev <annulen@yandex.ru>
Fix build of Windows-specific code with ICU 59.1
https://bugs.webkit.org/show_bug.cgi?id=172729
Reviewed by Darin Adler.
* wtf/text/win/WCharStringExtras.h: Added new header file wuth helper
functions for conversion between WTF::String and wchart_t*.
(WTF::stringToNullTerminatedWChar):
(WTF::wcharToString):
(WTF::nullTerminatedWCharToString):
2017-06-02 Stephan Szabo <stephan.szabo@am.sony.com>
[JSCOnly] Build static jsc.exe on Windows
https://bugs.webkit.org/show_bug.cgi?id=172833
Reviewed by Konstantin Tokarev.
* wtf/PlatformJSCOnly.cmake:
2017-06-02 Simon Fraser <simon.fraser@apple.com>
Get <chrono> out of StdLibExtras.h
https://bugs.webkit.org/show_bug.cgi?id=172744
Reviewed by Zalan Bujtas.
We hates std::chrono. Don't include it everywhere to discourage use.
* wtf/StdLibExtras.h:
2017-06-02 Filip Pizlo <fpizlo@apple.com>
Atomics.load and Atomics.store need to be fully fenced
https://bugs.webkit.org/show_bug.cgi?id=172844
Reviewed by Keith Miller.
Add loadFullyFenced and storeFullyFenced to Atomic<>.
* wtf/Atomics.h:
(WTF::Atomic::loadFullyFenced):
(WTF::Atomic::storeRelaxed):
(WTF::Atomic::storeFullyFenced):
(WTF::atomicLoadFullyFenced):
(WTF::atomicStoreFullyFenced):
2017-06-01 Keith Miller <keith_miller@apple.com>
Undo rollout in r217638 with bug fix
https://bugs.webkit.org/show_bug.cgi?id=172824
Unreviewed, reland patch with unused set_state code removed.
* Configurations/WTF.xcconfig:
* WTF.xcodeproj/project.pbxproj:
* wtf/Platform.h:
* wtf/PlatformRegisters.h:
(WTF::registersFromUContext):
* wtf/StackBounds.h:
(WTF::StackBounds::StackBounds):
* wtf/ThreadHolder.cpp:
(WTF::ThreadHolder::~ThreadHolder):
* wtf/ThreadMessage.cpp:
(WTF::sendMessageUsingSignal):
(WTF::sendMessageUsingMach):
(WTF::deliverMessagesUsingMach):
(WTF::sendMessageScoped):
* wtf/ThreadMessage.h:
(WTF::sendMessage):
* wtf/Threading.h:
(WTF::Thread::machThread):
* wtf/mac/MachExceptions.defs: Copied from Source/WTF/wtf/ThreadMessage.h.
* wtf/threads/Signals.cpp:
(WTF::startMachExceptionHandlerThread):
(WTF::fromMachException):
(WTF::toMachMask):
(WTF::handleSignalsWithMach):
(WTF::setExceptionPorts):
(WTF::activeThreads):
(WTF::registerThreadForMachExceptionHandling):
(WTF::unregisterThreadForMachExceptionHandling):
(WTF::installSignalHandler):
(WTF::jscSignalHandler):
* wtf/threads/Signals.h:
2017-05-31 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r217611 and r217631.
https://bugs.webkit.org/show_bug.cgi?id=172785
"caused wasm-hashset-many.html to become flaky." (Requested by
keith_miller on #webkit).
Reverted changesets:
"Reland r216808, underlying lldb bug has been fixed."
https://bugs.webkit.org/show_bug.cgi?id=172759
http://trac.webkit.org/changeset/217611
"Use dispatch queues for mach exceptions"
https://bugs.webkit.org/show_bug.cgi?id=172775
http://trac.webkit.org/changeset/217631
2017-05-31 Keith Miller <keith_miller@apple.com>
Use dispatch queues for mach exceptions
https://bugs.webkit.org/show_bug.cgi?id=172775
Reviewed by Geoffrey Garen.
This patch adds support for using a dispatch queue to handle our
mach exceptions. We use a high priority concurrent dispatch queue
to handle our mach exceptions. We don't know the priority of the
thread whose exception we are handling so the most conservative
answer is to respond with a high priority. These events are both
rare and usually quite fast so it is likely not a significant cost
when the thread with an exception has a low priority.
* wtf/threads/Signals.cpp:
(WTF::startMachExceptionHandlerThread):
2017-05-31 Keith Miller <keith_miller@apple.com>
Reland r216808, underlying lldb bug has been fixed.
https://bugs.webkit.org/show_bug.cgi?id=172759
Unreviewed, relanding old patch. See: rdar://problem/31183352
* Configurations/WTF.xcconfig:
* WTF.xcodeproj/project.pbxproj:
* wtf/Platform.h:
* wtf/PlatformRegisters.h:
(WTF::registersFromUContext):
* wtf/StackBounds.h:
(WTF::StackBounds::StackBounds):
* wtf/ThreadHolder.cpp:
(WTF::ThreadHolder::~ThreadHolder):
* wtf/ThreadMessage.cpp:
(WTF::sendMessageUsingSignal):
(WTF::sendMessageUsingMach):
(WTF::deliverMessagesUsingMach):
(WTF::sendMessageScoped):
* wtf/ThreadMessage.h:
(WTF::sendMessage):
* wtf/Threading.h:
(WTF::Thread::machThread):
* wtf/mac/MachExceptions.defs: Copied from Source/WTF/wtf/ThreadMessage.h.
* wtf/threads/Signals.cpp:
(WTF::startMachExceptionHandlerThread):
(WTF::fromMachException):
(WTF::toMachMask):
(WTF::handleSignalsWithMach):
(WTF::setExceptionPorts):
(WTF::activeThreads):
(WTF::registerThreadForMachExceptionHandling):
(WTF::unregisterThreadForMachExceptionHandling):
(WTF::installSignalHandler):
(WTF::jscSignalHandler):
* wtf/threads/Signals.h:
2017-05-31 Matt Lewis <jlewis3@apple.com>
Unreviewed, rolling out r217603.
This patch broke the internal builds.
Reverted changeset:
"Get <chrono> out of StdLibExtras.h"
https://bugs.webkit.org/show_bug.cgi?id=172744
http://trac.webkit.org/changeset/217603
2017-05-31 Simon Fraser <simon.fraser@apple.com>
Get <chrono> out of StdLibExtras.h
https://bugs.webkit.org/show_bug.cgi?id=172744
Reviewed by Saam Barati.
We hates std::chrono. Don't include it everywhere to discourage use.
* wtf/StdLibExtras.h:
2017-05-30 Ryosuke Niwa <rniwa@webkit.org>
Only include DataDetectorsUI headers in iOS
https://bugs.webkit.org/show_bug.cgi?id=172633
Reviewed by David Kilzer.
Enable data detectors only on iOS and not other variants of iOS.
* wtf/FeatureDefines.h:
* wtf/Platform.h:
2017-05-29 Yusuke Suzuki <utatane.tea@gmail.com>
Unreviewed, disable faster Interpreter::getOpcodeID for ARM_THUMB2 with non-Darwin OSes
https://bugs.webkit.org/show_bug.cgi?id=172686
Because of test failures.
* wtf/Platform.h:
2017-05-28 Dan Bernstein <mitz@apple.com>
[Xcode] ALWAYS_SEARCH_USER_PATHS is set to YES
https://bugs.webkit.org/show_bug.cgi?id=172691
Reviewed by Tim Horton.
* Configurations/Base.xcconfig: Set ALWAYS_SEARCH_USER_PATHS to NO.
2017-05-28 Yusuke Suzuki <utatane.tea@gmail.com>
[JSC][Linux][FreeBSD] Use faster Interpreter::getOpcodeID()
https://bugs.webkit.org/show_bug.cgi?id=172686
Reviewed by Mark Lam.
As of r217526, JSC gets faster Interpreter::getOpcodeID() by
embedding OpcodeID value just before the LLInt machine code
handler pointer. By doing so, we can retrieve OpcodeID from
the LLInt machine code handler by dereferencing the code
pointer. `*((int*)ptr - 1)`.
This patch allows Linux and FreeBSD environments to use this
optimization.
* wtf/Platform.h:
2017-05-28 Mark Lam <mark.lam@apple.com>
Implement a faster Interpreter::getOpcodeID().
https://bugs.webkit.org/show_bug.cgi?id=172669
Reviewed by Saam Barati.
Added the USE(LLINT_EMBEDDED_OPCODE_ID) configuration.
* wtf/Platform.h:
2017-05-26 Brent Fulgham <bfulgham@apple.com>
[WK2] Address thread safety issues with ResourceLoadStatistics
https://bugs.webkit.org/show_bug.cgi?id=172519
<rdar://problem/31707642>
Reviewed by Chris Dumez.
Add a new specialization for HashSet.
* wtf/CrossThreadCopier.h:
2017-05-26 Ryan Haddad <ryanhaddad@apple.com>
Unreviewed, rolling out r217458.
This change caused 55 JSC test failures.
Reverted changeset:
"Date should use historical data if it's available."
https://bugs.webkit.org/show_bug.cgi?id=172592
http://trac.webkit.org/changeset/217458
2017-05-25 Keith Miller <keith_miller@apple.com>
Date should use historical data if it's available.
https://bugs.webkit.org/show_bug.cgi?id=172592
Reviewed by Mark Lam.
The spec previously disallowed using historical data for Dates.
This is no longer the case. Additionally, not using historical
data, when available, seems unfortunate for users. This patch
removes the code dropping historical data.
* wtf/DateMath.cpp:
(WTF::calculateLocalTimeOffset):
(WTF::msToMilliseconds): Deleted.
2017-05-25 Yusuke Suzuki <utatane.tea@gmail.com>
[Win] ASSERTION FAILED: !HashTranslator::equal(KeyTraits::emptyValue(), key)
https://bugs.webkit.org/show_bug.cgi?id=172586
Reviewed by Brent Fulgham.
In ThreadHolder for Windows, we need to construct HashMap<ThreadIdentifier, ThreadHolder*>.
The problem is that ThreadHolder::platformInitialize touches Thread::id() even before Thread
is not established. In that case, id() returns incorrect value.
But, calling ThreadHolder::initialize() after waiting for completion of Thread::establish() is
not a good idea. Since we already have NewThreadContext->creationMutex, we can wait for completion
of Thread::establish() easily. However, if we do so, Thread::create() returns RefPtr<Thread> that
may not call ThreadHolder::initialize() in its thread yet. In that case, ThreadHolder::get() fails.
Thus, Windows WTF::waitForThreadCompletion implementation becomes broken. We can add a new mutex
to wait for completion of ThreadHolder::initialize in the creator of the thread (like a ping-pong!).
But it overly complicates the implementation.
The following is overly complicated initialization phase.
Creator -> AC mutex(1) -------> establishment -> RL mutex(1) ----------------------> AC mutex(2) ->
Thread -----------------> AC mutex(1) -> ThreadHolder init -> RL mutex(2) ->
So, instead, in this patch, we just use Thread::currentID(). When calling ThreadHolder::initialize(),
we pass ThreadIdentifier by using Thread::currentID(). This implementation works great because,
1. ThreadHolder::initialize requires ThreadIdentifier only in Windows environment because Pthread
ThreadHolder does not create HashMap<>. And this is used for obsolete Threading APIs. Thus this
hack will be removed in the near future.
2. In Windows, Thread::currentID() can return a valid value without using ThreadHolder. And it does
not require Thread establishment. So, calling currentID() to initialize ThreadHolder is ok in
Windows.
* wtf/ThreadHolder.cpp:
(WTF::ThreadHolder::initialize): Deleted.
* wtf/ThreadHolder.h:
* wtf/ThreadHolderPthreads.cpp:
(WTF::ThreadHolder::initialize):
* wtf/ThreadHolderWin.cpp:
(WTF::ThreadHolder::initialize):
(WTF::ThreadHolder::platformInitialize): Deleted.
* wtf/ThreadingWin.cpp:
(WTF::wtfThreadEntryPoint):
2017-05-25 Adrian Perez de Castro <aperez@igalia.com>
Clang warns about (intended) returning pointer to stack location in WTF/wtf/ThreadingPthreads.cpp
https://bugs.webkit.org/show_bug.cgi?id=172595
Reviewed by Mark Lam.
* wtf/ThreadingPthreads.cpp: Use a #pragma to silence Clang warning about returning a
pointer to the stack (which is intended)
2017-05-25 David Kilzer <ddkilzer@apple.com>
REGRESSION (r217416): Using #pragma once in WTFString.h broke the build
* wtf/text/WTFString.h: Switch back to #ifndef/#define/#endif.
2017-05-25 David Kilzer <ddkilzer@apple.com>
Make a change to force a build on the Apple bots
* wtf/text/WTFString.h: Use #pragma once.
2017-05-24 Andreas Kling <akling@apple.com>
Disable memory kill mechanisms when running with FastMalloc disabled.
https://bugs.webkit.org/show_bug.cgi?id=172550
<rdar://problem/32181908>
Reviewed by Antti Koivisto.
If someone is using WebKit with a non-standard allocator, they are likely trying to debug
or test something, and suddenly getting killed is not gonna help with that.
* wtf/MemoryPressureHandler.cpp:
(WTF::MemoryPressureHandler::setShouldUsePeriodicMemoryMonitor):
2017-05-22 Jiewen Tan <jiewen_tan@apple.com>
[WebCrypto] Support RSA-PSS
https://bugs.webkit.org/show_bug.cgi?id=170869
<rdar://problem/31640672>
Reviewed by Brent Fulgham.
* wtf/Platform.h:
Add a flag to enable RSA-PSS in the future.
2017-05-23 Myles C. Maxfield <mmaxfield@apple.com>
Remove dead ENABLE(FONT_LOAD_EVENTS) code
https://bugs.webkit.org/show_bug.cgi?id=172517
Rubber-stamped by Simon Fraser.
* wtf/FeatureDefines.h:
2017-05-23 Don Olmstead <don.olmstead@am.sony.com>
[WTF] Export additional symbols in threading
https://bugs.webkit.org/show_bug.cgi?id=171952
Reviewed by Konstantin Tokarev.
* wtf/ThreadMessage.h:
* wtf/threads/Signals.h:
2017-05-23 Tomas Popela <tpopela@redhat.com>
[WTF] Compilation fails with system malloc
https://bugs.webkit.org/show_bug.cgi?id=172445
Reviewed by Michael Catanzaro.
We are using the bmalloc even if the system malloc should be used.
Don't use bmalloc if the system malloc is requested and add the
missing implementation for computeRAMSize() on UNIX that's utilizing
the sysinfo() call.
* wtf/RAMSize.cpp:
(WTF::computeRAMSize):
2017-05-22 Brian Burg <bburg@apple.com>
Add a debugging macro that sleeps a thread until a debugger attaches
https://bugs.webkit.org/show_bug.cgi?id=171575
Reviewed by Mark Lam.
This is really useful for debugging early errors if for some reason you can't
launch a process directly from the debugger easily, such as Web Content processes.
* WTF.xcodeproj/project.pbxproj:
* wtf/Assertions.h:
Always define the WTFBreakpointTrap() macro. Still make it an error if the CPU
type isn't supported for OS(DARWIN); if used on other platforms, cause a WTFCrash()
with a comment that indicates this is not implemented.
* wtf/DebugUtilities.h: Added.
2017-05-19 Don Olmstead <don.olmstead@am.sony.com>
[WTF] Remove PLATFORM(WIN) references
https://bugs.webkit.org/show_bug.cgi?id=172301
Reviewed by Yusuke Suzuki.
* wtf/MemoryPressureHandler.cpp:
* wtf/MemoryPressureHandler.h:
* wtf/Platform.h:
2017-05-19 Don Olmstead <don.olmstead@am.sony.com>
[CMake] Add HAVE check for __int128_t
https://bugs.webkit.org/show_bug.cgi?id=172317
Reviewed by Yusuke Suzuki.
* wtf/MediaTime.cpp:
(WTF::MediaTime::setTimeScale):
* wtf/Platform.h:
2017-05-18 Andreas Kling <akling@apple.com>
[WK2] Notify WebPageProxy client when an active process goes over the inactive memory limit
https://bugs.webkit.org/show_bug.cgi?id=172244
<rdar://problem/31800943>
Reviewed by Geoffrey Garen.
Add an installable callback to MemoryPressureHandler that gets invoked when an active process
exceeds the kill limit for an inactive process.
This allows a UI client to become aware that backgrounding a tab may cause it to get killed.
* wtf/MemoryPressureHandler.cpp:
(WTF::thresholdForMemoryKillWithProcessState):
(WTF::MemoryPressureHandler::thresholdForMemoryKill):
(WTF::MemoryPressureHandler::measurementTimerFired):
(WTF::MemoryPressureHandler::doesExceedInactiveLimitWhileActive):
(WTF::MemoryPressureHandler::doesNotExceedInactiveLimitWhileActive):
* wtf/MemoryPressureHandler.h:
(WTF::MemoryPressureHandler::setDidExceedInactiveLimitWhileActiveCallback):
2017-05-18 Geoffrey Garen <ggaren@apple.com>
AutomaticThread should wait longer before timing out
https://bugs.webkit.org/show_bug.cgi?id=172292
Reviewed by Filip Pizlo.
Increased the idle timeout from 1s => 10s.
This reduces the number of thread restarts on JetStream from
~150 => ~0. It also matches other thread pool APIs on Darwin.
Intuitively, it seems wrong for helper threads to idle exit during
hardcore benchmarking.
This patch in combination with a bmalloc fix seems to be a 1%-2% JetStream
speedup on my Mac Pro.
A nice side-benefit is that per-thread traces are easier to read.
* wtf/AutomaticThread.cpp:
(WTF::AutomaticThread::start):
* wtf/AutomaticThread.h:
2017-05-18 Don Olmstead <don.olmstead@am.sony.com>
[Win] Remove usage of _snprintf
https://bugs.webkit.org/show_bug.cgi?id=172251
Reviewed by Per Arne Vollan.
* wtf/DataLog.cpp:
(WTF::initializeLogFileOnce):
(WTF::setDataFile):
2017-05-15 Mark Lam <mark.lam@apple.com>
Rolling out r214038 and r213697: Crashes when using computed properties with rest destructuring and object spread.
https://bugs.webkit.org/show_bug.cgi?id=172147
Rubber-stamped by Saam Barati.
* wtf/HashSet.h:
(WTF::=):
2017-05-14 Chris Dumez <cdumez@apple.com>
Drop PassRefPtr class from WTF
https://bugs.webkit.org/show_bug.cgi?id=172091
Reviewed by Alex Christensen.
Drop PassRefPtr class from WTF as it is no longer used or needed.
Also drop RefPtr::release() for the same reasons.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/CrossThreadCopier.cpp:
* wtf/CrossThreadCopier.h:
* wtf/Forward.h:
* wtf/PassRefPtr.h: Removed.
* wtf/RefPtr.h:
(WTF::refIfNotNull):
(WTF::derefIfNotNull):
(WTF::RefPtr::RefPtr):
(WTF::RefPtr::release): Deleted.
* wtf/SizeLimits.cpp:
* wtf/Vector.h:
2017-05-13 Chris Dumez <cdumez@apple.com>
Stop using RefPtr::release()
https://bugs.webkit.org/show_bug.cgi?id=172074
Reviewed by Geoffrey Garen.
* wtf/win/WorkQueueWin.cpp:
(WTF::WorkQueue::dispatchAfter):
2017-05-13 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r216808.
https://bugs.webkit.org/show_bug.cgi?id=172075
caused lldb to hang when debugging (Requested by smfr on
#webkit).
Reverted changeset:
"Use Mach exceptions instead of signals where possible"
https://bugs.webkit.org/show_bug.cgi?id=171865
http://trac.webkit.org/changeset/216808
2017-05-12 Keith Miller <keith_miller@apple.com>
Use Mach exceptions instead of signals where possible
https://bugs.webkit.org/show_bug.cgi?id=171865
Reviewed by Mark Lam.
This patch enables using mach exceptions on darwin. The way the
mach exception api works is that we create a mach port, which is
like a file descriptor. We then wait for a message to arrive on
that port in a thread. When another thread raises an exception (say
due to a bad memory access) the OS sends our thread a message. The
payload of that message is the register file of the crashing
thread. We then call our custom handlers that change the state as
needed. In order to restart the thread we send a payload back to
the OS with an updated register file along with a success message
header.
This patch also makes thread messages work without signals by
simply suspending the thread, and then running the message at that
time.
You can read more about mach exceptions here:
http://www.cs.cmu.edu/afs/cs/project/mach/public/doc/unpublished/exception.ps
and the Mach interface Generator (MiG) here:
http://www.cs.cmu.edu/afs/cs/project/mach/public/doc/unpublished/mig.ps
* Configurations/WTF.xcconfig:
* WTF.xcodeproj/project.pbxproj:
* wtf/Platform.h:
* wtf/PlatformRegisters.h:
(WTF::registersFromUContext):
* wtf/StackBounds.h:
(WTF::StackBounds::StackBounds):
* wtf/ThreadHolder.cpp:
(WTF::ThreadHolder::~ThreadHolder):
* wtf/ThreadMessage.cpp:
(WTF::sendMessageUsingSignal):
(WTF::sendMessageUsingMach):
(WTF::deliverMessagesUsingMach):
(WTF::sendMessageScoped):
* wtf/ThreadMessage.h:
(WTF::sendMessage):
* wtf/Threading.h:
(WTF::Thread::machThread):
* wtf/mac/MachExceptions.defs: Copied from Source/WTF/wtf/ThreadMessage.h.
* wtf/threads/Signals.cpp:
(WTF::startMachExceptionHandlerThread):
(WTF::fromMachException):
(WTF::toMachMask):
(WTF::handleSignalsWithMach):
(WTF::setExceptionPorts):
(WTF::activeThreads):
(WTF::registerThreadForMachExceptionHandling):
(WTF::unregisterThreadForMachExceptionHandling):
(WTF::installSignalHandler):
(WTF::jscSignalHandler):
* wtf/threads/Signals.h:
2017-05-12 Ting-Wei Lan <lantw44@gmail.com>
Include algorithm before using std::min
https://bugs.webkit.org/show_bug.cgi?id=171733
Reviewed by Chris Dumez.
* wtf/text/StringCommon.h:
2017-05-12 Andreas Kling <akling@apple.com>
More aggressive memory kill limits.
https://bugs.webkit.org/show_bug.cgi?id=172037
<rdar://problem/31969082>
Reviewed by Michael Saboff.
Bring down the memory kill limits to 4GB for active processes, and 2GB for inactive.
Also make MemoryUsagePolicy::Strict kick in above 1.5GB.
* wtf/MemoryPressureHandler.cpp:
(WTF::MemoryPressureHandler::thresholdForMemoryKill):
(WTF::thresholdForPolicy):
2017-05-12 Michael Saboff <msaboff@apple.com>
[iOS] Use memory footprint to dynamically adjust behavior of allocators
https://bugs.webkit.org/show_bug.cgi?id=171944
Reviewed by Filip Pizlo.
Moved the non-Windows implementation of RAMSize() to bmalloc/AvailableMemory.cpp and
called the function availableMemory().
* wtf/RAMSize.cpp:
(WTF::computeRAMSize):
2017-05-12 Claudio Saavedra <csaavedra@igalia.com>
[WPE] Add MemoryFootprintLinux to build
Unreviewed build fix after r216731.
* wtf/PlatformWPE.cmake:
2017-05-12 Csaba Osztrogonác <ossy@webkit.org>
Unreviewed trivial JSCOnly buildfix after r216731.
https://bugs.webkit.org/show_bug.cgi?id=171693
* wtf/PlatformJSCOnly.cmake:
2017-05-11 Yusuke Suzuki <utatane.tea@gmail.com>
[Win] Implement memoryFootprint for Windows
https://bugs.webkit.org/show_bug.cgi?id=171693
Reviewed by Alex Christensen.
This patch implements memoryFootprint for Windows. In Windows, we calculate the size
of private working set. This can be done by enumerating private pages in working set.
And we also split MemoryFootprint.cpp to cocoa, linux, and win versions.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/MallocPtr.h:
(WTF::MallocPtr::operator*):
(WTF::MallocPtr::operator->):
* wtf/PlatformGTK.cmake:
* wtf/PlatformJSCOnly.cmake:
* wtf/PlatformMac.cmake:
* wtf/PlatformWin.cmake:
* wtf/cocoa/MemoryFootprintCocoa.cpp: Copied from Source/WTF/wtf/MemoryFootprint.cpp.
(WTF::memoryFootprint):
* wtf/linux/MemoryFootprintLinux.cpp: Renamed from Source/WTF/wtf/MemoryFootprint.cpp.
(WTF::forEachLine):
(WTF::memoryFootprint):
* wtf/win/MemoryFootprintWin.cpp: Added.
(WTF::memoryFootprint):
2017-05-11 Don Olmstead <don.olmstead@am.sony.com>
[CMake] Add HAVE check for regex.h
https://bugs.webkit.org/show_bug.cgi?id=171950
Reviewed by Michael Catanzaro.
* wtf/Platform.h:
2017-05-11 Chris Dumez <cdumez@apple.com>
Annotate Ref::ptr() with RETURNS_NONNULL
https://bugs.webkit.org/show_bug.cgi?id=171996
Reviewed by Andreas Kling.
Annotate Ref::ptr() with RETURNS_NONNULL as it can never return null.
* wtf/Ref.h:
(WTF::Ref::ptr): Deleted.
2017-05-11 Joseph Pecoraro <pecoraro@apple.com>
Remove Vibration API
https://bugs.webkit.org/show_bug.cgi?id=171766
Rubber-stamped by Alexey Proskuryakov.
* wtf/FeatureDefines.h:
2017-05-09 Sam Weinig <sam@webkit.org>
Remove support for legacy Notifications
https://bugs.webkit.org/show_bug.cgi?id=171487
Reviewed by Jon Lee.
* wtf/FeatureDefines.h:
Remove definition of ENABLE_LEGACY_NOTIFICATIONS.
2017-05-10 Adrian Perez de Castro <aperez@igalia.com>
Remove some last remnants of the EFL port
https://bugs.webkit.org/show_bug.cgi?id=171922
Reviewed by Antonio Gomes.
The EFL port is no more.
* wtf/PlatformEfl.cmake: Removed.
2017-05-10 Fujii Hironori <Hironori.Fujii@sony.com>
[Win] StaticStringImpl in HTMLNames.cpp aren't constructed
https://bugs.webkit.org/show_bug.cgi?id=171800
Reviewed by Yusuke Suzuki.
Global variables of StaticStringImpl in HTMLNames.cpp aren't
constructed on Windows since Bug 171586. It seems that
reinterpret_cast prevents constexpr's compile time initialization
in VC++.
* wtf/text/StringImpl.h:
(WTF::StringImplShape::StringImplShape): Added const char* and
const char16_t* members in the union. Do not use reinterpret_cast
in constexpr constructors.
2017-05-09 Mark Lam <mark.lam@apple.com>
Force StaticStringImpl constructor to use the constexpr versions of StringImplShape constructors.
https://bugs.webkit.org/show_bug.cgi?id=171861
Reviewed by Yusuke Suzuki.
This is strictly necessary for correctness of the StaticStringImpl implementation.
We force the constructor selection by adding an extra dummy argument to the
constexpr versions of the StringImplShape constructors to disambiguate them from
the non-constexpr versions.
* wtf/text/StringImpl.h:
(WTF::StringImplShape::StringImplShape):
(WTF::StringImpl::StaticStringImpl::StaticStringImpl):
2017-05-09 Zan Dobersek <zdobersek@igalia.com>
Upstream the WPE port
https://bugs.webkit.org/show_bug.cgi?id=171110
Reviewed by Alex Christensen.
* wtf/Platform.h:
* wtf/PlatformWPE.cmake: Added.
* wtf/glib/RunLoopSourcePriority.h:
2017-05-08 Mark Lam <mark.lam@apple.com>
Speculative Windows build fix after r216428.
https://bugs.webkit.org/show_bug.cgi?id=171776
Not reviewed.
* wtf/StackTrace.h:
2017-05-08 Mark Lam <mark.lam@apple.com>
Introduce ExceptionScope::assertNoException() and releaseAssertNoException().
https://bugs.webkit.org/show_bug.cgi?id=171776
Reviewed by Keith Miller.
1. Add an option to skip some number of top frames when capturing the StackTrace.
2. Add an option to use an indentation string when dumping the StackTrace.
* wtf/StackTrace.cpp:
(WTF::StackTrace::captureStackTrace):
(WTF::StackTrace::dump):
* wtf/StackTrace.h:
2017-05-05 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Use memoryFootprint for MemoryUsage retrieval in Linux
https://bugs.webkit.org/show_bug.cgi?id=171757
Reviewed by Michael Catanzaro.
This patch leverages memoryFootprint() to retrieve physical footprint in Linux.
* wtf/linux/MemoryPressureHandlerLinux.cpp:
(WTF::MemoryPressureHandler::ReliefLogger::platformMemoryUsage):
2017-05-05 Don Olmstead <don.olmstead@am.sony.com>
[WTF] Do not export deleted constructor in StringView
https://bugs.webkit.org/show_bug.cgi?id=171751
Reviewed by Alexey Proskuryakov.
* wtf/text/StringView.h:
2017-05-05 Yusuke Suzuki <utatane.tea@gmail.com>
[GTK][JSCOnly] Merge MainThread implementations and use generic one
https://bugs.webkit.org/show_bug.cgi?id=171738
Reviewed by Michael Catanzaro.
GLib MainThread implementation is generic enough to be used in JSCOnly.
We move it to generic/ and GTK (GLib ports) and JSCOnly use it.
And we also drop GLib MainThread's isMainThread function because
generic thread ID one is enough.
This patch also cleans up initializing main thread code by using std::call_once.
* wtf/MainThread.cpp:
(WTF::initializeMainThread):
(WTF::isMainThread):
(WTF::initializeMainThreadToProcessMainThread):
(WTF::initializeWebThread):
(WTF::canAccessThreadLocalDataForThread):
(WTF::initializeMainThreadOnce): Deleted.
(WTF::initializeMainThreadToProcessMainThreadOnce): Deleted.
(WTF::initializeWebThreadOnce): Deleted.
* wtf/PlatformGTK.cmake:
* wtf/PlatformJSCOnly.cmake:
* wtf/generic/MainThreadGeneric.cpp:
(WTF::MainThreadDispatcher::MainThreadDispatcher):
(WTF::MainThreadDispatcher::schedule):
(WTF::MainThreadDispatcher::fired):
(WTF::scheduleDispatchFunctionsOnMainThread):
* wtf/glib/MainThreadGLib.cpp: Removed.
2017-05-04 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r216206.
https://bugs.webkit.org/show_bug.cgi?id=171714
Multiple LayoutTests crashing in Document::page() (Requested
by ap on #webkit).
Reverted changeset:
"Remove support for legacy Notifications"
https://bugs.webkit.org/show_bug.cgi?id=171487
http://trac.webkit.org/changeset/216206
2017-05-04 Don Olmstead <don.olmstead@am.sony.com>
[Win] Remove redundant macros that are set in the CMake config
https://bugs.webkit.org/show_bug.cgi?id=171571
Reviewed by Brent Fulgham.
* config.h:
2017-05-04 Mark Lam <mark.lam@apple.com>
NeverDestroyed<String>(ASCIILiteral(...)) is not thread safe.
https://bugs.webkit.org/show_bug.cgi?id=171586
<rdar://problem/31873190>
Reviewed by Yusuke Suzuki.
StaticStringImpl is meant to be thread-safe. However, it has a bug: it did not
set the s_hashFlagDidReportCost flag. As a result, if cost() is called on it,
different threads may try to change its flags bits at the same time. This patch
changes StaticStringImpl to always set the s_hashFlagDidReportCost flag.
Also factored out StringImplShape and made StringImpl and StaticStringImpl extend
it. This makes it more clear that the 2 are intended to have the same shape.
Note: there is already a static_assert that the 2 have the same size. This
change also ensures that they both have the same shape, which is a requirement in
order for StaticStringImpl to work.
Introduced the MAKE_STATIC_STRING_IMPL macro as a convenient way to instantiate
StaticStringImpls from literal strings. This allows us to trivially change
NeverDestroyed<String> myString(ASCIILiteral("myString"));
to ...
NeverDestroyed<String> myString(MAKE_STATIC_STRING_IMPL("myString"));
and by so doing, make it thread-safe.
MAKE_STATIC_STRING_IMPL instantiates a lambda function to create the static
StaticStringImpls.
* wtf/text/StringImpl.h:
(WTF::StringImplShape::StringImplShape):
(WTF::StringImpl::StringImpl):
(WTF::StringImpl::cost):
(WTF::StringImpl::setHash):
(WTF::StringImpl::StaticStringImpl::StaticStringImpl):
(WTF::StringImpl::StaticStringImpl::operator StringImpl&):
* wtf/text/WTFString.h:
(WTF::String::String):
* wtf/text/icu/TextBreakIteratorICU.h:
(WTF::caretRules):
2017-05-04 Sam Weinig <sam@webkit.org>
Remove support for legacy Notifications
https://bugs.webkit.org/show_bug.cgi?id=171487
Reviewed by Jon Lee.
* wtf/FeatureDefines.h:
Remove definition of ENABLE_LEGACY_NOTIFICATIONS.
2017-05-04 Yusuke Suzuki <utatane.tea@gmail.com>
[GTK][JSCOnly] Implement memoryFootprint for Linux
https://bugs.webkit.org/show_bug.cgi?id=171680
Reviewed by Carlos Alberto Lopez Perez.
Darwin's phys_footprint returns the amount of dirty anonymous memory in the process.
This patch implements the same thing in Linux by reading /proc/self/smaps.
We sum sizes of private dirty pages in anonymous regions.
* wtf/MemoryFootprint.cpp:
(WTF::forEachLine):
(WTF::memoryFootprint):
2017-05-03 Mark Lam <mark.lam@apple.com>
Use the CLoop for CPU(ARM64E).
https://bugs.webkit.org/show_bug.cgi?id=171620
<rdar://problem/31973027>
Reviewed by Geoffrey Garen.
* wtf/Platform.h:
2017-05-02 Daniel Bates <dabates@apple.com>
Fix the build after <https://trac.webkit.org/changeset/216102>
(https://bugs.webkit.org/show_bug.cgi?id=170925)
Export into global scope ASCIICaseInsensitiveStringViewHashTranslator.
Also fix indentation of member functions of ASCIICaseInsensitiveStringViewHashTranslator.
* wtf/text/StringHash.h:
2017-05-02 Daniel Bates <dabates@apple.com>
Using StringView.split() instead of String.split() in some places
https://bugs.webkit.org/show_bug.cgi?id=170925
Reviewed by Darin Adler and Sam Weinig.
* wtf/HashMap.h: Add HashMap::get() overload that takes a HashTranslator.
* wtf/text/StringHash.h:
(WebCore::ASCIICaseInsensitiveStringViewHashTranslator::hash): Added.
(WebCore::ASCIICaseInsensitiveStringViewHashTranslator::equal): Added.
2017-05-01 Dan Bernstein <mitz@apple.com>
[Xcode] It’s easy to accidentally install a WTF header outside /usr/local/include/wtf
https://bugs.webkit.org/show_bug.cgi?id=171533
Reviewed by Andy Estes.
* WTF.xcodeproj/project.pbxproj: Removed the WTF target’s Headers build phase. Its existence
was making it easy to accidentally add a header to the target and make it Private, which
would have Xcode install a copy of it right under /usr/local/include, in addition to the
copy installed under /usr/local/include/wtf by the Copy WTF Headers target.
Also got rid of INSTALL_PATH_PREFIX in the script build phase in the Copy WTF Headers
target, because it is being never set anymore.
2017-05-01 Dan Bernstein <mitz@apple.com>
WTF installs an extra copy of a header outside /usr/local/include/wtf
* WTF.xcodeproj/project.pbxproj: Demoted CPUTime.h from Private to Project.
2017-05-01 Daniel Bates <dabates@apple.com>
Cleanup: Change ASCIICaseInsensitiveHash from a class to a struct
https://bugs.webkit.org/show_bug.cgi?id=171460
Reviewed by Sam Weinig.
All of the members of ASCIICaseInsensitiveHash have public visibility.
We are underutilizing the purpose of a class - defaults to private
visibility of members. We should change ASCIICaseInsensitiveHash from
a class to a struct, which by definition defaults to public visibility
for members.
* wtf/text/StringHash.h:
2017-04-29 Yusuke Suzuki <utatane.tea@gmail.com>
Move WebCore CPUTime to WTF and implement it in all the platforms
https://bugs.webkit.org/show_bug.cgi?id=171477
Reviewed by Chris Dumez.
We move WebCore::CPUTime to WTF::CPUTime since it is useful even in JSC
and it does not depend on any external libraries.
And we additionally implement WTF::CPUTime in all the platforms: Windows and Unix.
In CPUTime, instead of holding int64_t, we hold MonotonicTime and Seconds.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/CPUTime.cpp: Copied from Source/WebCore/platform/CPUTime.cpp.
(WTF::CPUTime::percentageCPUUsageSince):
* wtf/CPUTime.h: Renamed from Source/WebCore/platform/CPUTime.h.
* wtf/PlatformEfl.cmake:
* wtf/PlatformGTK.cmake:
* wtf/PlatformJSCOnly.cmake:
* wtf/PlatformMac.cmake:
* wtf/PlatformWin.cmake:
* wtf/cocoa/CPUTimeCocoa.mm: Renamed from Source/WebCore/platform/cocoa/CPUTimeCocoa.mm.
(WTF::timeValueToMicroseconds):
(WTF::CPUTime::get):
* wtf/unix/CPUTimeUnix.cpp: Renamed from Source/WebCore/platform/CPUTime.cpp.
(WTF::timevalToSeconds):
(WTF::CPUTime::get):
* wtf/win/CPUTimeWin.cpp: Added.
(WTF::fileTimeToSeconds):
(WTF::CPUTime::get):
2017-04-28 Simon Fraser <simon.fraser@apple.com>
Add system trace points for Document::updateTouchEventRegions()
https://bugs.webkit.org/show_bug.cgi?id=171470
rdar://problem/31901239
Reviewed by Tim Horton.
Add trace markers for updateTouchEventRegions.
* wtf/SystemTracing.h:
2017-04-28 Daniel Bates <dabates@apple.com>
Add StringView::toExistingAtomicString()
https://bugs.webkit.org/show_bug.cgi?id=171405
Reviewed by Andreas Kling.
Similar to the reasons for JSString::toExistingAtomicString() we should expose a way to
convert a StringView to an existing atomic string. Looking up an atomic string is more
efficient that creating one, which requires a lookup and memory allocation.
We are not making use of StringView::toExistingAtomicString() now, but will in the patch
for <https://bugs.webkit.org/show_bug.cgi?id=170925>.
* wtf/text/AtomicStringImpl.cpp:
(WTF::AtomicStringImpl::lookUp): Modified to take a const LChar*/UChar*.
(WTF::AtomicStringImpl::lookUpInternal): Renamed to AtomicStringImpl::lookup() to avoid
an extra function call.
* wtf/text/AtomicStringImpl.h:
* wtf/text/StringView.h:
(WTF::StringView::toExistingAtomicString): Added.
2017-04-28 Chris Dumez <cdumez@apple.com>
Update DOMTokenList.replace() to match the latest DOM specification
https://bugs.webkit.org/show_bug.cgi?id=171388
Reviewed by Alex Christensen.
Add Vector::findMatching() API which takes in a lambda function for convenience.
Add optional startIndex parameter to Vector::removeFirstMatching() / removeAllMatching()
to remove items only after given index.
* wtf/Vector.h:
(WTF::minCapacity>::findMatching):
(WTF::minCapacity>::find):
(WTF::minCapacity>::removeFirstMatching):
(WTF::minCapacity>::removeAllMatching):
2017-04-27 Carlos Garcia Campos <cgarcia@igalia.com>
Move UUID from WebCore/platform to WTF
https://bugs.webkit.org/show_bug.cgi?id=171372
Reviewed by Michael Catanzaro.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/UUID.cpp: Renamed from Source/WebCore/platform/UUID.cpp.
* wtf/UUID.h: Renamed from Source/WebCore/platform/UUID.h.
2017-04-26 Keith Miller <keith_miller@apple.com>
LocklessBag needs a destructor
https://bugs.webkit.org/show_bug.cgi?id=171334
Reviewed by Mark Lam.
Currently, if the bag is destructed any remaining nodes in the bag will
be leaked.
* wtf/LocklessBag.h:
(WTF::LocklessBag::consumeAll):
(WTF::LocklessBag::~LocklessBag):
* wtf/threads/Signals.cpp:
(WTF::jscSignalHandler):
(WTF::installSignalHandler):
2017-04-26 Don Olmstead <don.olmstead@am.sony.com>
[ARM] Enable GCC visibility
https://bugs.webkit.org/show_bug.cgi?id=171296
Reviewed by Michael Catanzaro.
* wtf/Platform.h:
2017-04-26 Yusuke Suzuki <utatane.tea@gmail.com>
sendMessageScoped's signal handler calls LocklessBag::consumeAll, which causes heap deallocation in signal handler and leads deadlock
https://bugs.webkit.org/show_bug.cgi?id=171319
Reviewed by Keith Miller.
In sendMessageScoped, we call LocklessBag<SignalHandler>::consumeAll `thread->threadMessages().consumeAll()`.
In LocklessBag::consumeAll, we call `delete` on Nodes.
The problem is that this is called under the context of signal handler. Thus, when calling this, the original
thread may hold the lock in bmalloc. In that case, this `delete` call attempts to lock the heap lock recursively,
and causes deadlock.
Instead, this patch transfers the LocklessBag's Node to the sender thread. And the sender thread deletes it instead.
* wtf/LocklessBag.h:
(WTF::LocklessBag::consumeAllWithNode):
* wtf/ThreadMessage.cpp:
(WTF::ThreadMessageData::ThreadMessageData):
(WTF::sendMessageScoped):
2017-04-25 Don Olmstead <don.olmstead@am.sony.com>
[Win] Use Clang's __has_declspec_attribute for export macros
https://bugs.webkit.org/show_bug.cgi?id=171240
Reviewed by Alex Christensen.
* wtf/Compiler.h:
* wtf/ExportMacros.h:
* wtf/Platform.h:
2017-04-25 Keith Miller <keith_miller@apple.com>
Our signal handler shouldn't print when sigaction succeeds
https://bugs.webkit.org/show_bug.cgi?id=171286
Reviewed by Michael Saboff.
It turns out !result is not the same as !!result.
* wtf/threads/Signals.cpp:
(WTF::jscSignalHandler):
2017-04-25 Myles C. Maxfield <mmaxfield@apple.com>
Add performance test for FontCache::systemFallbackForCharacters()
https://bugs.webkit.org/show_bug.cgi?id=170842
Reviewed by Tim Horton.
* wtf/unicode/CharacterNames.h:
2017-04-24 Andy VanWagoner <thetalecrafter@gmail.com>
Clean up ICU headers
https://bugs.webkit.org/show_bug.cgi?id=170997
Reviewed by JF Bastien.
Update all icu headers to 55.1
* icu/LICENSE: Update copyright
* icu/README: Explain ICU headers for OS X better
* icu/unicode/localpointer.h:
(LocalPointer::LocalPointer):
(LocalPointer::adoptInsteadAndCheckErrorCode):
* icu/unicode/platform.h:
* icu/unicode/putil.h:
* icu/unicode/std_string.h:
* icu/unicode/ubrk.h:
* icu/unicode/uchar.h:
* icu/unicode/ucnv.h:
* icu/unicode/ucol.h:
* icu/unicode/uconfig.h:
* icu/unicode/ucurr.h:
* icu/unicode/uloc.h:
* icu/unicode/umachine.h:
* icu/unicode/unistr.h:
(UnicodeString::getArrayStart):
(UnicodeString::UnicodeString):
(UnicodeString::hasShortLength):
(UnicodeString::getShortLength):
(UnicodeString::length):
(UnicodeString::getCapacity):
(UnicodeString::isBogus):
(UnicodeString::isWritable):
(UnicodeString::isBufferWritable):
(UnicodeString::getBuffer):
(UnicodeString::isEmpty):
(UnicodeString::setZeroLength):
(UnicodeString::setShortLength):
(UnicodeString::setLength):
(UnicodeString::setToEmpty):
(UnicodeString::remove):
* icu/unicode/urename.h:
* icu/unicode/uscript.h:
* icu/unicode/uset.h:
* icu/unicode/ustring.h:
* icu/unicode/utf8.h:
* icu/unicode/utypes.h:
* icu/unicode/uvernum.h:
2017-04-24 Yusuke Suzuki <utatane.tea@gmail.com>
Unreviewed, fix Windows build after r215715
https://bugs.webkit.org/show_bug.cgi?id=171199
* wtf/StackTrace.h:
2017-04-24 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Move JSC tools/StackTrace to WTF and unify stack trace dump code
https://bugs.webkit.org/show_bug.cgi?id=171199
Reviewed by Mark Lam.
JSC tools/StackTrace's dump code is almost identical to WTF Assertions'
stack trace dump code. This patch moves tools/StackTrace to WTF and use
it in Assertions. It unifies the two duplicate implementations into one.
* WTF.xcodeproj/project.pbxproj:
* wtf/Assertions.cpp:
* wtf/CMakeLists.txt:
* wtf/Platform.h:
* wtf/StackTrace.cpp: Renamed from Source/JavaScriptCore/tools/StackTrace.cpp.
(WTF::StackTrace::captureStackTrace):
(WTF::StackTrace::dump):
* wtf/StackTrace.h: Copied from Source/JavaScriptCore/tools/StackTrace.h.
(WTF::StackTrace::StackTrace):
(WTF::StackTrace::stack):
(WTF::StackTrace::DemangleEntry::mangledName):
(WTF::StackTrace::DemangleEntry::demangledName):
(WTF::StackTrace::DemangleEntry::DemangleEntry):
* wtf/SystemFree.h: Renamed from Source/JavaScriptCore/tools/StackTrace.h.
(WTF::SystemFree::operator()):
2017-04-24 Yusuke Suzuki <utatane.tea@gmail.com>
[AppleWin] The procedure entry point ?waitForThreadCompletion@WTF@@YAHI@Z could not be located in the dynamic link library WebKitQuartzCoreAdditions.dll
https://bugs.webkit.org/show_bug.cgi?id=171029
Reviewed by Brent Fulgham.
While WTF Threading APIs are updated, WebKitQuartzCoreAdditions.dll in Windows uses some of the old APIs,
waitForThreadCompletion and createThread. This patch implements both on top of the new APIs.
These APIs are only exposed in Windows for this compatibility problem and new code should not use it.
* wtf/ThreadHolder.cpp:
(WTF::ThreadHolder::initialize):
* wtf/ThreadHolder.h:
* wtf/ThreadHolderWin.cpp:
(WTF::ThreadHolder::get):
(WTF::ThreadHolder::platformInitialize):
(WTF::ThreadHolder::destruct):
* wtf/Threading.h:
* wtf/ThreadingWin.cpp:
(WTF::createThread):
(WTF::waitForThreadCompletion):
2017-04-24 Carlos Garcia Campos <cgarcia@igalia.com>
[GTK] Switch to use ENABLE_REMOTE_INSPECTOR instead of ENABLE_INSPECTOR_SERVER for the remote inspector
https://bugs.webkit.org/show_bug.cgi?id=166680
Reviewed by Michael Catanzaro.
Add GRefPtr hash traits to allow using GRefPtr as a key of HashMaps.
* wtf/glib/GRefPtr.h:
(WTF::HashTraits<GRefPtr<P>>::emptyValue):
(WTF::HashTraits<GRefPtr<P>>::peek):
(WTF::HashTraits<GRefPtr<P>>::customDeleteBucket):
2017-04-22 Yusuke Suzuki <utatane.tea@gmail.com>
[JSC] Get stack pointer without pthread attr
https://bugs.webkit.org/show_bug.cgi?id=171162
Reviewed by Mark Lam.
If HAVE(MACHINE_CONTEXT) is not enabled, we get stack base and boundary by using
pthread_attr functions. However, it is wrong since this function can be called
after the thread is suspended. In that case, we should not call any functions
that is not async signal safe. For example, pthread_getattr_np calls malloc.
Instead we use getApproximateStackPointer(), which returns approximate stack pointer.
* wtf/Threading.h:
* wtf/ThreadingPthreads.cpp:
(WTF::getApproximateStackPointer):
(WTF::isOnAlternativeSignalStack):
When gathering conservative roots, we should keep stack pointer pointing stack.
And if concurrent GC is enabled, we always need to keep the above invariant.
So, we do not support alternative signal stack.
(WTF::Thread::signalHandlerSuspendResume):
(WTF::Thread::getRegisters):
2017-04-22 Yusuke Suzuki <utatane.tea@gmail.com>
REGRESSION(r215638): [Linux] Several worker tests are crashing in Thread::signalHandlerSuspendResume after r215638
https://bugs.webkit.org/show_bug.cgi?id=171159
Reviewed by Michael Catanzaro.
Now, SIGUSR2 is used by ThreadMessage. Instead SIGUSR1 becomes empty.
We should use some signal, that is not managed by WTF Signal mechanism
because the behaivor of this suspend and resume is a bit tricky.
For example, we set a bit tricky signal mask to sigaction to temporary
block SIGUSR2 in the handler to avoid nested SIGUSR2. And we cannot
use ThreadMessage to implement this mechanism because this suspend
and resume handler will stop in the middle of the handler by sigsuspend.
It is not the expected semantics by ThreadMessage.
So now, we use SIGUSR1 instead. And we note that SIGUSR1 is used for
pthread ports.
* wtf/ThreadingPthreads.cpp:
* wtf/threads/Signals.h:
2017-04-20 Sam Weinig <sam@webkit.org>
Split cryptographic digest computation and parsing out of CSP code so it can be reused
https://bugs.webkit.org/show_bug.cgi?id=171076
Reviewed by Chris Dumez.
* wtf/text/Base64.cpp:
(WTF::base64Decode):
(WTF::base64URLDecode):
Add overloads for base64Decode and base64URLDecode that take a StringView, to avoid allocations
of Strings.
* wtf/text/Base64.h:
(WTF::isBase64OrBase64URLCharacter):
Move helper predicate used for parsing either type of Base64 encoded string from WebCore.
2017-04-21 Keith Miller <keith_miller@apple.com>
Unreviewed, rolling out r215634.
underlying build issues should have been fixed
Reverted changeset:
"Unreviewed, rolling out r215620 and r215623."
https://bugs.webkit.org/show_bug.cgi?id=171139
http://trac.webkit.org/changeset/215634
2017-04-21 Keith Miller <keith_miller@apple.com>
Remove LL/SC from Atomics
https://bugs.webkit.org/show_bug.cgi?id=171141
Reviewed by Saam Barati.
Adding load link and store conditionally was not an actual progression
and the existing code is causing problems for users of Atomics. So let's
get rid of it.
* wtf/Atomics.h:
(WTF::hasFence):
(WTF::Atomic::exchange):
(WTF::Atomic::transaction):
(WTF::Atomic::transactionRelaxed):
(WTF::Atomic::prepare): Deleted.
(WTF::Atomic::attempt): Deleted.
* wtf/Bitmap.h:
(WTF::WordType>::concurrentTestAndSet):
(WTF::WordType>::concurrentTestAndClear):
* wtf/LockAlgorithm.h:
(WTF::LockAlgorithm::lockFast):
(WTF::LockAlgorithm::unlockFast):
2017-04-21 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r215620 and r215623.
https://bugs.webkit.org/show_bug.cgi?id=171139
broke arm64 build (Requested by keith_miller on #webkit).
Reverted changesets:
"Add signaling API"
https://bugs.webkit.org/show_bug.cgi?id=170976
http://trac.webkit.org/changeset/215620
"Unreviewed, fix Cloop build."
http://trac.webkit.org/changeset/215623
2017-04-20 Keith Miller <keith_miller@apple.com>
Add signaling API
https://bugs.webkit.org/show_bug.cgi?id=170976
Reviewed by Filip Pizlo.
This patch adds a bunch of new functionality to WTF. First, it add
a new data structure of a lockless bag. The LocklessBag class can
be used as either a multi-writer multi-reader lockless bag or a
multi-writer single consumer lockless bag.
Next, this patch adds an abstraction around sigaction in WTF.
Basically, you can add a handler, which can be an arbitrary
lambda. Although it should still be safe for the signal you are
handling. the signal handler manager will then do all the
appropriate handling of chaining:
In the SIGUSR case we always forward the signal to any other
non-default handler installed before us. We need to do this,
otherwise, since it's not possible to tell if a SIGUSR was
intended exlusively for our handlers. Signal handlers don't record
how many times they were sent only that there is at least one
unhandled signal.
In the faulting cases we require that every handle be able to
recognise a fault they installed, vs crashes. If none of our
handlers claim to have handled the fault we will forward the
fault. If a handler was installed before the first fault handler
we simply call that handler and rely on them to take the
appropriate action. If no handler was installed before our first
handler we restore the default handler and allow the fault to
happen again.
Finally, this patch adds a signal based messaging system. This
system allows the user to run an arbitrary lambda from the SIGUSR2
signal handler of any target WTF::Thread. This is already in use
for the VMTraps API which allows us to kill rogue VMs by sending
the VM's running WTF::Thread a SIGUSR and requesting it jetison
all optimized code and throw an uncatchable exception from all
function entries/loop backedges. In the future, we will also use
this API for Wasm to reset the instruction caches in currently
executing Wasm threads.
* WTF.xcodeproj/project.pbxproj:
* wtf/Atomics.h:
(WTF::Atomic::Atomic):
* wtf/LocklessBag.h: Added.
(WTF::LocklessBag::LocklessBag):
(WTF::LocklessBag::add):
(WTF::LocklessBag::iterate):
(WTF::LocklessBag::consumeAll):
* wtf/ThreadMessage.cpp: Added.
(WTF::ThreadMessageData::ThreadMessageData):
(WTF::initializeThreadMessages):
(WTF::sendMessageScoped):
* wtf/ThreadMessage.h: Added.
(WTF::sendMessage):
* wtf/Threading.cpp:
(WTF::initializeThreading):
* wtf/Threading.h:
(WTF::Thread::threadMessages):
* wtf/ThreadingPthreads.cpp:
(WTF::Thread::currentMayBeNull):
(WTF::Thread::current):
(WTF::Thread::signal):
* wtf/threads/Signals.cpp: Added.
(WTF::jscSignalHandler):
(WTF::installSignalHandler):
* wtf/threads/Signals.h: Added.
(WTF::toSystemSignal):
(WTF::fromSystemSignal):
2017-04-21 Konstantin Tokarev <annulen@yandex.ru>
[cmake] WTF target should not have wtf and subdirectries in public interface
https://bugs.webkit.org/show_bug.cgi?id=171115
Reviewed by Michael Catanzaro.
In r209665 WEBCORE_FRAMEWORK macro started to export INCLUDE_DIRECTORIES of
targets as their public interface, so that linked targets can use them
implicitly without copying directory lists around. This matches existing
practice for all targets except WTF, headers from which are always included
with full path starting from "<wtf/...".
Since r209665 it became possible to include headers from wtf or its
subdirectories in CMake builds without using "<wtf/..." path. It should
not be allowed.
* wtf/CMakeLists.txt: WTF/wtf and its sudirectories should not be in
public include paths of WTF target.
2017-04-20 Sam Weinig <sam@webkit.org>
Move notFound into its own file
https://bugs.webkit.org/show_bug.cgi?id=170972
Reviewed by Zalan Bujtas.
It is odd to require including <wtf/Vector.h> just to use WTF::notFound.
This is not causing any current problems, but does in few changes I have
queued up.
* WTF.xcodeproj/project.pbxproj:
* wtf/NotFound.h: Added.
* wtf/Vector.h:
* wtf/text/StringCommon.h:
2017-04-20 Filip Pizlo <fpizlo@apple.com>
Optimize SharedArrayBuffer in the DFG+FTL
https://bugs.webkit.org/show_bug.cgi?id=164108
Reviewed by Saam Barati.
Made small changes as part of benchmarking the JS versions of these locks.
* benchmarks/LockSpeedTest.cpp:
* benchmarks/ToyLocks.h:
* wtf/Range.h:
(WTF::Range::dump):
2017-04-19 Youenn Fablet <youenn@apple.com>
[Win] Activate streams API by default
https://bugs.webkit.org/show_bug.cgi?id=171000
Reviewed by Brent Fulgham.
* wtf/FeatureDefines.h:
2017-04-19 David Kilzer <ddkilzer@apple.com>
Vector.h: error: 'auto' not allowed in lambda parameter
<https://webkit.org/b/171010>
<rdar://problem/31716076>
Reviewed by Saam Barati.
* wtf/Vector.h:
(WTF::removeRepeatedElements): Replace 'auto' with a specific
type, 'T', based on a Vector<> template type.
2017-04-19 Ryan Haddad <ryanhaddad@apple.com>
Unreviewed, rolling out r215518.
This change appears to have broken the Windows build.
Reverted changeset:
"Move notFound into its own file"
https://bugs.webkit.org/show_bug.cgi?id=170972
http://trac.webkit.org/changeset/215518
2017-04-19 Sam Weinig <sam@webkit.org>
Move notFound into its own file
https://bugs.webkit.org/show_bug.cgi?id=170972
Reviewed by Zalan Bujtas.
It is odd to require including <wtf/Vector.h> just to use WTF::notFound.
This is not causing any current problems, but does in few changes I have
queued up.
* WTF.xcodeproj/project.pbxproj:
* wtf/NotFound.h: Added.
* wtf/Vector.h:
* wtf/text/StringCommon.h:
2017-04-18 Carlos Garcia Campos <cgarcia@igalia.com>
[GLIB] Define priorities also for async network IO tasks
https://bugs.webkit.org/show_bug.cgi?id=170905
Reviewed by Žan Doberšek.
Add AsyncIONetwork, DiskCacheRead and DiskCacheWrite priorities.
* wtf/glib/RunLoopSourcePriority.h:
2017-04-18 Yusuke Suzuki <utatane.tea@gmail.com>
[JSC][GTK] glib RunLoop does not accept negative start interval
https://bugs.webkit.org/show_bug.cgi?id=170775
Reviewed by Saam Barati.
RunLoop::Timer for glib does not accept negative start interval.
We use 0_s if the given value is negative.
* wtf/glib/RunLoopGLib.cpp:
(WTF::RunLoop::TimerBase::secondsUntilFire):
2017-04-17 Alex Christensen <achristensen@webkit.org>
Allow Variants of RetainPtrs
https://bugs.webkit.org/show_bug.cgi?id=170923
Reviewed by Tim Horton and Sam Weinig.
* wtf/RetainPtr.h:
(WTF::RetainPtr::operator&): Deleted.
Operator& was causing a compile error when making Variant<RetainPtr<T>, ...>
and because it is strange and only used once, let's just remove it.
* wtf/Variant.h:
(WTF::get):
(WTF::get_if):
Use std::addressof instead of operator& which could be overloaded to return any type with any meaning.
2017-04-17 Youenn Fablet <youenn@apple.com>
Disable outdated WritableStream API
https://bugs.webkit.org/show_bug.cgi?id=170749
<rdar://problem/31446233>
Reviewed by Alex Christensen.
Replacing READABLE_STREAM_API, READABLE_BYTE_STREAM_API and WRITABLE_STREAM_API compilation flag by:
- A STREAMS_API compilation flag.
- A ReadableByteStreamAPI and WritableStreamAPI runtime flags, turned off except for RWT and DRT.
* wtf/FeatureDefines.h:
2017-04-17 Dan Bernstein <mitz@apple.com>
[Cocoa] Move isNullFunctionPointer down into WTF
https://bugs.webkit.org/show_bug.cgi?id=170892
Reviewed by Sam Weinig.
Test: TestWebKitAPI/Tests/WTF/darwin/WeakLinking.cpp
* WTF.xcodeproj/project.pbxproj: Added reference to new file.
* wtf/darwin: Added.
* wtf/darwin/WeakLinking.h: Added.
(WTF::isNullFunctionPointer): Copied from ResourceLoadStatisticsClassifierCocoa.cpp in
WebKit2 and changed into a function template that works with any function pointer.
2017-04-17 Ryan Haddad <ryanhaddad@apple.com>
Unreviewed, rolling out r215366.
This test is failing on performance bots.
Reverted changeset:
"Add performance test for asking the platform for a font for
U+2060 WORD JOINER"
https://bugs.webkit.org/show_bug.cgi?id=170842
http://trac.webkit.org/changeset/215366
2017-04-17 Yusuke Suzuki <utatane.tea@gmail.com>
[JSCOnly] Fix build failures in macOS
https://bugs.webkit.org/show_bug.cgi?id=170887
Reviewed by Alex Christensen.
JSCOnly port does not use mac/MainThread.cpp.
We change the ifdef gurard to use generic implementaion in JSCOnly on macOS.
* wtf/MainThread.cpp:
* wtf/PlatformJSCOnly.cmake:
2017-04-17 JF Bastien <jfbastien@apple.com>
B3: don't allow unsigned offsets in Value
https://bugs.webkit.org/show_bug.cgi?id=170692
Reviewed by Filip Pizlo.
Add C++17's std::conjunction type trait, except for Microsoft VS
2015 update 2 and later because it adds the logical operator type
traits, event when C++ is pre-2017:
https://blogs.msdn.microsoft.com/vcblog/2016/01/22/vs-2015-update-2s-stl-is-c17-so-far-feature-complete/
* wtf/StdLibExtras.h:
2017-04-14 Mark Lam <mark.lam@apple.com>
Update architectures in xcconfig files.
https://bugs.webkit.org/show_bug.cgi?id=170867
<rdar://problem/31628104>
Reviewed by Joseph Pecoraro.
* Configurations/Base.xcconfig:
2017-04-14 Myles C. Maxfield <mmaxfield@apple.com>
Add performance test for asking the platform for a font for U+2060 WORD JOINER
https://bugs.webkit.org/show_bug.cgi?id=170842
Reviewed by Tim Horton.
* wtf/unicode/CharacterNames.h:
2017-04-13 Yusuke Suzuki <utatane.tea@gmail.com>
[JSC] Date.parse should accept wider range of representation
https://bugs.webkit.org/show_bug.cgi?id=170720
Reviewed by Darin Adler.
We would like to relax Date.parse to accept the representation "May 8".
At that time, we choose `2000` as a default year. This is because of
the following reason.
1. According to the V8, this default value is compatible to the old KJS. While current V8 uses 2001,
SpiderMonkey does not have such a fallback path. So this reason is not big deal.
2. It is a leap year. When using `new Date("Feb 29")`, we assume that people want to save month and day.
Leap year can save user inputs if they is valid. If we use the current year instead, the current year
may not be a leap year. In that case, `new Date("Feb 29").getMonth()` becomes 2 (March).
* wtf/DateMath.cpp:
(WTF::parseDateFromNullTerminatedCharacters):
2017-04-13 Dan Bernstein <mitz@apple.com>
WTF installs an extra copy of a header outside /usr/local/include/wtf
* WTF.xcodeproj/project.pbxproj: Demoted PriorityQueue.h from Private to Project.
2017-04-13 Oliver Hunt <oliver@apple.com>
allocationSize should use safe arithmetic by default
https://bugs.webkit.org/show_bug.cgi?id=170804
Reviewed by JF Bastien.
Make all allocationSize() functions work in terms
of Checked<size_t>
* wtf/text/StringImpl.h:
(WTF::StringImpl::allocationSize):
(WTF::StringImpl::tailOffset):
2017-04-13 JF Bastien <jfbastien@apple.com>
WebAssembly: manage memory better
https://bugs.webkit.org/show_bug.cgi?id=170628
Reviewed by Keith Miller, Michael Saboff.
Re-use a VM tag which was intended for JavaScript core, was then
used by our GC, and is now unused. If I don't do this then
WebAssembly fast memories will make vmmap look super weird because
it'll look like multi-gigabyte of virtual memory are allocated as
part of our process' regular memory!
Separately I need to update vmmap and other tools to print the
right name. Right now this tag gets identified as "JS garbage
collector".
* wtf/OSAllocator.h:
* wtf/VMTags.h:
2017-04-13 Yusuke Suzuki <utatane.tea@gmail.com>
[JSC] Use proper ifdef guard for code using MachineContext
https://bugs.webkit.org/show_bug.cgi?id=170800
Reviewed by Carlos Alberto Lopez Perez.
SamplingProfiler and FastMemory rely on MachineContext feature.
* wtf/Platform.h:
2017-04-12 Dan Bernstein <mitz@apple.com>
[Mac] Future-proof .xcconfig files
https://bugs.webkit.org/show_bug.cgi?id=170802
Reviewed by Tim Horton.
* Configurations/Base.xcconfig:
* Configurations/DebugRelease.xcconfig:
2017-04-12 Yusuke Suzuki <utatane.tea@gmail.com>
Use HAVE(MACHINE_CONTEXT) instead of USE(MACHINE_CONTEXT)
https://bugs.webkit.org/show_bug.cgi?id=170770
Rubber stamped by Mark Lam.
* wtf/Platform.h:
* wtf/PlatformRegisters.h:
* wtf/ThreadingPthreads.cpp:
(WTF::Thread::getRegisters):
2017-04-12 Yusuke Suzuki <utatane.tea@gmail.com>
[JSC] Clean up heap/MachineStackMarker by introducing USE(MACHINE_CONTEXT)
https://bugs.webkit.org/show_bug.cgi?id=170770
Reviewed by Mark Lam.
We add a new define USE_MACHINE_CONTEXT, which becomes true if mcontext_t exists
and we know the way to retrieve values from mcontext_t.
* wtf/Platform.h:
* wtf/PlatformRegisters.h:
* wtf/ThreadingPthreads.cpp:
(WTF::Thread::getRegisters):
2017-04-12 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Introduce Thread class and use RefPtr<Thread> and align Windows Threading implementation semantics to Pthread one
https://bugs.webkit.org/show_bug.cgi?id=170502
Reviewed by Mark Lam.
This patch is refactoring of WTF Threading mechanism to merge JavaScriptCore's threading extension to WTF Threading.
Previously, JavaScriptCore requires richer threading features (such as suspending and resuming threads), and they
are implemented for PlatformThread in JavaScriptCore. But these features should be implemented in WTF Threading side
instead of maintaining JSC's own threading features too. This patch removes these features from JSC and move it to
WTF Threading.
However, current WTF Threading has one problem: Windows version of WTF Threading has different semantics from Pthreads
one. In Windows WTF Threading, we cannot perform any operation after the target thread is detached: WTF Threading stop
tracking the state of the thread once the thread is detached. But this is not the same to Pthreads one. In Pthreads,
pthread_detach just means that the resource of the thread will be destroyed automatically. While some operations like
pthread_join will be rejected, some operations like pthread_kill will be accepted.
The problem is that detached thread can be suspended and resumed in JSC. For example, in jsc.cpp, we start the worker
thread and detach it immediately. In worker thread, we will create VM and thus concurrent GC will suspend and resume
the detached thread. However, in Windows WTF Threading, we have no reference to the detached thread. Thus we cannot
perform suspend and resume operations onto the detached thread.
To solve the problem, we change Windows Threading mechanism drastically to align it to the Pthread semantics. In the
new Threading, we have RefPtr<Thread> class. It holds a handle to a platform thread. We can perform threading operations
with this class. For example, Thread::suspend is offered. And we use destructor of the thread local variable to release
the resources held by RefPtr<Thread>. In Windows, Thread::detach does nothing because the resource will be destroyed
automatically by RefPtr<Thread>.
To do so, we introduce ThreadHolder for Windows. This is similar to the previous ThreadIdentifierData for Pthreads.
It holds RefPtr<Thread> in the thread local storage (technically, it is Fiber Local Storage in Windows). Thread::current()
will return this reference.
The problematic situation is that the order of the deallocation of the thread local storage is not defined. So we should
not touch thread local storage in the destructor of the thread local storage. To avoid such edge cases, we have
currentThread() / Thread::currentID() APIs. They are safe to be called even in the destructor of the other thread local
storage. And in Windows, in the FLS destructor, we will create the thread_local variable to defer the destruction of
the ThreadHolder. We ensure that this destructor is called after the other FLS destructors are called in Windows 10.
This patch is performance neutral.
* WTF.xcodeproj/project.pbxproj:
* benchmarks/ConditionSpeedTest.cpp:
* benchmarks/LockFairnessTest.cpp:
* benchmarks/LockSpeedTest.cpp:
* wtf/AutomaticThread.cpp:
(WTF::AutomaticThread::start):
* wtf/CMakeLists.txt:
* wtf/MainThread.h:
* wtf/MemoryPressureHandler.h:
* wtf/ParallelJobsGeneric.cpp:
(WTF::ParallelEnvironment::ThreadPrivate::tryLockFor):
(WTF::ParallelEnvironment::ThreadPrivate::workerThread):
* wtf/ParallelJobsGeneric.h:
(WTF::ParallelEnvironment::ThreadPrivate::ThreadPrivate): Deleted.
* wtf/ParkingLot.cpp:
(WTF::ParkingLot::forEachImpl):
* wtf/ParkingLot.h:
(WTF::ParkingLot::forEach):
* wtf/PlatformRegisters.h: Renamed from Source/JavaScriptCore/runtime/PlatformThread.h.
* wtf/RefPtr.h:
(WTF::RefPtr::RefPtr):
* wtf/ThreadFunctionInvocation.h:
(WTF::ThreadFunctionInvocation::ThreadFunctionInvocation):
* wtf/ThreadHolder.cpp: Added.
(WTF::ThreadHolder::~ThreadHolder):
(WTF::ThreadHolder::initialize):
* wtf/ThreadHolder.h: Renamed from Source/WTF/wtf/ThreadIdentifierDataPthreads.h.
(WTF::ThreadHolder::thread):
(WTF::ThreadHolder::ThreadHolder):
* wtf/ThreadHolderPthreads.cpp: Renamed from Source/WTF/wtf/ThreadIdentifierDataPthreads.cpp.
(WTF::ThreadHolder::initializeOnce):
(WTF::ThreadHolder::current):
(WTF::ThreadHolder::destruct):
* wtf/ThreadHolderWin.cpp: Added.
(WTF::threadMapMutex):
(WTF::threadMap):
(WTF::ThreadHolder::initializeOnce):
(WTF::ThreadHolder::current):
(WTF::ThreadHolder::destruct):
* wtf/ThreadSpecific.h:
* wtf/Threading.cpp:
(WTF::Thread::normalizeThreadName):
(WTF::threadEntryPoint):
(WTF::Thread::create):
(WTF::Thread::setCurrentThreadIsUserInteractive):
(WTF::Thread::setCurrentThreadIsUserInitiated):
(WTF::Thread::setGlobalMaxQOSClass):
(WTF::Thread::adjustedQOSClass):
(WTF::Thread::dump):
(WTF::initializeThreading):
(WTF::normalizeThreadName): Deleted.
(WTF::createThread): Deleted.
(WTF::setCurrentThreadIsUserInteractive): Deleted.
(WTF::setCurrentThreadIsUserInitiated): Deleted.
(WTF::setGlobalMaxQOSClass): Deleted.
(WTF::adjustedQOSClass): Deleted.
* wtf/Threading.h:
(WTF::Thread::id):
(WTF::Thread::operator==):
(WTF::Thread::operator!=):
(WTF::Thread::joinableState):
(WTF::Thread::didBecomeDetached):
(WTF::Thread::didJoin):
(WTF::Thread::hasExited):
(WTF::currentThread):
* wtf/ThreadingPthreads.cpp:
(WTF::Thread::Thread):
(WTF::Thread::~Thread):
(WTF::Thread::signalHandlerSuspendResume):
(WTF::Thread::initializePlatformThreading):
(WTF::initializeCurrentThreadEvenIfNonWTFCreated):
(WTF::wtfThreadEntryPoint):
(WTF::Thread::createInternal):
(WTF::Thread::initializeCurrentThreadInternal):
(WTF::Thread::changePriority):
(WTF::Thread::waitForCompletion):
(WTF::Thread::detach):
(WTF::Thread::current):
(WTF::Thread::currentID):
(WTF::Thread::signal):
(WTF::Thread::resume):
(WTF::Thread::getRegisters):
(WTF::Thread::didExit):
(WTF::Thread::establish):
(WTF::PthreadState::PthreadState): Deleted.
(WTF::PthreadState::joinableState): Deleted.
(WTF::PthreadState::pthreadHandle): Deleted.
(WTF::PthreadState::didBecomeDetached): Deleted.
(WTF::PthreadState::didExit): Deleted.
(WTF::PthreadState::didJoin): Deleted.
(WTF::PthreadState::hasExited): Deleted.
(WTF::threadMapMutex): Deleted.
(WTF::initializeThreading): Deleted.
(WTF::threadMap): Deleted.
(WTF::identifierByPthreadHandle): Deleted.
(WTF::establishIdentifierForPthreadHandle): Deleted.
(WTF::pthreadHandleForIdentifierWithLockAlreadyHeld): Deleted.
(WTF::createThreadInternal): Deleted.
(WTF::initializeCurrentThreadInternal): Deleted.
(WTF::changeThreadPriority): Deleted.
(WTF::waitForThreadCompletion): Deleted.
(WTF::detachThread): Deleted.
(WTF::threadDidExit): Deleted.
(WTF::currentThread): Deleted.
(WTF::signalThread): Deleted.
* wtf/ThreadingWin.cpp:
(WTF::Thread::Thread):
(WTF::Thread::~Thread):
(WTF::Thread::initializeCurrentThreadInternal):
(WTF::Thread::initializePlatformThreading):
(WTF::wtfThreadEntryPoint):
(WTF::Thread::createInternal):
(WTF::Thread::changePriority):
(WTF::Thread::waitForCompletion):
(WTF::Thread::detach):
(WTF::Thread::resume):
(WTF::Thread::getRegisters):
(WTF::Thread::current):
(WTF::Thread::currentID):
(WTF::Thread::didExit):
(WTF::Thread::establish):
(WTF::initializeCurrentThreadInternal): Deleted.
(WTF::threadMapMutex): Deleted.
(WTF::initializeThreading): Deleted.
(WTF::threadMap): Deleted.
(WTF::storeThreadHandleByIdentifier): Deleted.
(WTF::threadHandleForIdentifier): Deleted.
(WTF::clearThreadHandleForIdentifier): Deleted.
(WTF::createThreadInternal): Deleted.
(WTF::changeThreadPriority): Deleted.
(WTF::waitForThreadCompletion): Deleted.
(WTF::detachThread): Deleted.
(WTF::currentThread): Deleted.
* wtf/WorkQueue.cpp:
(WTF::WorkQueue::concurrentApply):
* wtf/WorkQueue.h:
* wtf/cocoa/WorkQueueCocoa.cpp:
(WTF::dispatchQOSClass):
* wtf/generic/WorkQueueGeneric.cpp:
(WorkQueue::platformInitialize):
(WorkQueue::platformInvalidate):
* wtf/linux/MemoryPressureHandlerLinux.cpp:
(WTF::MemoryPressureHandler::EventFDPoller::EventFDPoller):
(WTF::MemoryPressureHandler::EventFDPoller::~EventFDPoller):
* wtf/win/MainThreadWin.cpp:
(WTF::initializeMainThreadPlatform):
2017-04-11 Zan Dobersek <zdobersek@igalia.com>
[GTK] Use the DisplayRefreshMonitor facilities
https://bugs.webkit.org/show_bug.cgi?id=170599
Reviewed by Carlos Garcia Campos.
* wtf/Platform.h: Enable USE_REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR for the GTK+ port.
* wtf/glib/RunLoopSourcePriority.h: Add the DisplayRefreshMonitorTimer entry that
matches the value of LayerFlushTimer.
2017-04-11 Yusuke Suzuki <utatane.tea@gmail.com>
[WebCore][JSC] ResourceUsageData.{timeOfNextEdenCollection,timeOfNextFullCollection} should be MonotonicTime
https://bugs.webkit.org/show_bug.cgi?id=170725
Reviewed by Sam Weinig.
Make MonotonicTime more constexpr friendly mainly to annotate MonotonicTime::nan() as constexpr.
* wtf/MonotonicTime.h:
(WTF::MonotonicTime::MonotonicTime):
(WTF::MonotonicTime::fromRawSeconds):
(WTF::MonotonicTime::infinity):
(WTF::MonotonicTime::nan):
(WTF::MonotonicTime::secondsSinceEpoch):
(WTF::MonotonicTime::operator bool):
(WTF::MonotonicTime::operator+):
(WTF::MonotonicTime::operator-):
(WTF::MonotonicTime::operator==):
(WTF::MonotonicTime::operator!=):
(WTF::MonotonicTime::operator<):
(WTF::MonotonicTime::operator>):
(WTF::MonotonicTime::operator<=):
(WTF::MonotonicTime::operator>=):
2017-04-11 Yusuke Suzuki <utatane.tea@gmail.com>
Unreviewed, build fix for Windows port after r215228
https://bugs.webkit.org/show_bug.cgi?id=170723
* wtf/win/RunLoopWin.cpp:
(WTF::RunLoop::TimerBase::timerFired):
2017-04-11 Yusuke Suzuki <utatane.tea@gmail.com>
[JSC][GTK] Use RunLoop::Timer in GTK port
https://bugs.webkit.org/show_bug.cgi?id=170723
Reviewed by Carlos Garcia Campos.
Add secondsUntilFire method. And add setName and setPriority
for GTK RunLoop::Timer.
* wtf/RunLoop.h:
* wtf/cf/RunLoopCF.cpp:
(WTF::RunLoop::TimerBase::secondsUntilFire):
* wtf/generic/RunLoopGeneric.cpp:
(WTF::RunLoop::TimerBase::secondsUntilFire):
* wtf/glib/RunLoopGLib.cpp:
(WTF::RunLoop::TimerBase::setName):
(WTF::RunLoop::TimerBase::secondsUntilFire):
* wtf/win/RunLoopWin.cpp:
(WTF::RunLoop::TimerBase::timerFired):
(WTF::RunLoop::TimerBase::start):
(WTF::RunLoop::TimerBase::isActive):
(WTF::RunLoop::TimerBase::secondsUntilFire):
2017-04-11 Yusuke Suzuki <utatane.tea@gmail.com>
[JSC] Enable JSRunLoopTimer for JSCOnly and Windows
https://bugs.webkit.org/show_bug.cgi?id=170655
Reviewed by Carlos Garcia Campos.
This patch makes RunLoop::Timer in Generic and Windows thread-safe to use it
in JSC's JSRunLoopTimer. Eventually, we would like to replace JSRunLoopTimer's
platform-dependent implementation to WTF::RunLoop::Timer.
* wtf/RunLoop.h:
* wtf/cf/RunLoopCF.cpp:
(WTF::RunLoop::TimerBase::start):
* wtf/generic/RunLoopGeneric.cpp:
(WTF::RunLoop::TimerBase::ScheduledTask::EarliestSchedule::operator()):
(WTF::RunLoop::populateTasks):
(WTF::RunLoop::runImpl):
(WTF::RunLoop::schedule):
(WTF::RunLoop::scheduleAndWakeUp):
(WTF::RunLoop::TimerBase::~TimerBase):
(WTF::RunLoop::TimerBase::start):
(WTF::RunLoop::TimerBase::stop):
(WTF::RunLoop::TimerBase::isActive):
* wtf/glib/RunLoopGLib.cpp:
(WTF::RunLoop::TimerBase::TimerBase):
* wtf/win/RunLoopWin.cpp:
(WTF::RunLoop::TimerBase::timerFired):
(WTF::RunLoop::TimerBase::start):
(WTF::RunLoop::TimerBase::stop):
(WTF::RunLoop::TimerBase::isActive):
2017-04-11 Zan Dobersek <zdobersek@igalia.com>
REGRESSION(r213645): It made JSC tests super slow and timeout on AArch64 Linux
https://bugs.webkit.org/show_bug.cgi?id=169510
Reviewed by Saam Barati.
Add the `volatile` qualifiers for ASM statements that set up ldxr and stxr
instruction calls when HAVE(LL_SC) is enabled for aarch64 platforms.
This avoids indefinite execution when running GCC-compiled JSC on Linux.
Specific bug or expected behavior that differs from Clang wasn't determined.
HAVE(LL_SC) is re-enabled on non-Darwin aarch64 platforms.
* wtf/Atomics.h:
* wtf/Platform.h:
2017-04-10 Thorsten Glaser <tg@mirbsd.de>
[GTK] Fix x32 build
https://bugs.webkit.org/show_bug.cgi?id=170673
Reviewed by Carlos Alberto Lopez Perez.
* wtf/Platform.h:
2017-04-09 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Annotate Seconds' member functions and operators with constexpr
https://bugs.webkit.org/show_bug.cgi?id=170662
Reviewed by Daniel Bates.
Annotate Seconds' member functions and operators with constexpr.
It allows us to use Seconds calculation in compile time and use these
calculation for static const global variables.
operator% is an exception: it uses fmod and it is not offered as constexpr.
* wtf/MathExtras.h:
(defaultMinimumForClamp):
(defaultMaximumForClamp):
(clampToAccepting64):
Super unfortunate ugly code. This is because GCC 4.9 does not support C++14 relaxed constexpr.
* wtf/Seconds.h:
(WTF::Seconds::Seconds):
(WTF::Seconds::value):
(WTF::Seconds::minutes):
(WTF::Seconds::seconds):
(WTF::Seconds::milliseconds):
(WTF::Seconds::microseconds):
(WTF::Seconds::nanoseconds):
(WTF::Seconds::operator bool):
(WTF::Seconds::operator+):
(WTF::Seconds::operator-):
(WTF::Seconds::operator*):
(WTF::Seconds::operator/):
(WTF::Seconds::operator==):
(WTF::Seconds::operator!=):
(WTF::Seconds::operator<):
(WTF::Seconds::operator>):
(WTF::Seconds::operator<=):
(WTF::Seconds::operator>=):
2017-04-09 Chris Dumez <cdumez@apple.com>
Start dropping Timer API dealing with double
https://bugs.webkit.org/show_bug.cgi?id=170649
Reviewed by Yusuke Suzuki.
Start dropping Timer API dealing with double as people should use Seconds now.
* wtf/RunLoopTimer.h:
* wtf/glib/MainThreadGLib.cpp:
(WTF::MainThreadDispatcher::schedule):
2017-04-07 Keith Miller <keith_miller@apple.com>
Unreviewed, remove constexpr function since GTK didn't like it.
* wtf/PriorityQueue.h:
(WTF::PriorityQueue::parentOf):
2017-04-07 Chris Dumez <cdumez@apple.com>
Start using MonotonicTime / Seconds in Timer class
https://bugs.webkit.org/show_bug.cgi?id=170625
Reviewed by Simon Fraser.
Add modulo operator to MonotonicTime.
* wtf/MonotonicTime.h:
(WTF::MonotonicTime::operator%):
2017-04-07 Keith Miller <keith_miller@apple.com>
Add a PriorityQueue class
https://bugs.webkit.org/show_bug.cgi?id=170579
Reviewed by Saam Barati.
This patch adds a new PriorityQueue class that is backed by
WTF::Vector. It also has a number of other niceties such as being
able to iterate the queue and increase or decrease keys.
One note is that increaseKey and decreaseKey are O(n) rather than
O(log(n)). Traditionally, the lookup of the key is done with a
hash map but that's not feasible here. This is because unless the
queue's element type is a pointer there is no good way maintain a
persistent reference to every entry in the queue while we sift.
The only way to update the location of an entry is to do a hash
table lookup with the entry's hash but this is probably more
expensive than just doing a linear search.
Also, add comparison operator functions, which can be passed to PriorityQueue.
* WTF.xcodeproj/project.pbxproj:
* wtf/MathExtras.h:
(isLessThan):
(isLessThanEqual):
(isGreaterThan):
(isGreaterThanEqual):
* wtf/PriorityQueue.h: Added.
(WTF::PriorityQueue::size):
(WTF::PriorityQueue::isEmpty):
(WTF::PriorityQueue::enqueue):
(WTF::PriorityQueue::peek):
(WTF::PriorityQueue::dequeue):
(WTF::PriorityQueue::decreaseKey):
(WTF::PriorityQueue::increaseKey):
(WTF::PriorityQueue::begin):
(WTF::PriorityQueue::end):
(WTF::PriorityQueue::isValidHeap):
(WTF::PriorityQueue::parentOf):
(WTF::PriorityQueue::leftChildOf):
(WTF::PriorityQueue::rightChildOf):
(WTF::PriorityQueue::siftUp):
(WTF::PriorityQueue::siftDown):
2017-04-07 Alex Christensen <achristensen@webkit.org>
Use audit_token_t instead of pid_t for checking sandbox of other processes
https://bugs.webkit.org/show_bug.cgi?id=170616
<rdar://problem/31158189>
Reviewed by Daniel Bates.
* wtf/spi/darwin/SandboxSPI.h:
Declare more SPI.
2017-04-07 Ting-Wei Lan <lantw44@gmail.com>
Include cstdio before using sscanf and stderr
https://bugs.webkit.org/show_bug.cgi?id=170098
Reviewed by Michael Catanzaro.
* wtf/NumberOfCores.cpp:
2017-04-07 Saam Barati <sbarati@apple.com>
WebAssembly: Make to a compilation API that allows for multi-VM concurrent compilations of Wasm Modules
https://bugs.webkit.org/show_bug.cgi?id=170488
Reviewed by JF Bastien.
* wtf/SharedTask.h: Make SharedTaskFunctor forward its arguments.
2017-04-07 Carlos Garcia Campos <cgarcia@igalia.com>
[GTK] Update the priorities used in glib main loop sources
https://bugs.webkit.org/show_bug.cgi?id=170457
Reviewed by Žan Doberšek.
Add an enum to define prirorities used in different GLib main sources. It allows to give them a better name
than high, low, medium, etc., but also to document them and other GLib based ports can define their own
values without changing all the places where they are used. The default values are based on the priorities
pre-defined by GLib.
* wtf/glib/MainThreadGLib.cpp:
(WTF::MainThreadDispatcher::MainThreadDispatcher):
* wtf/glib/RunLoopGLib.cpp:
(WTF::RunLoop::RunLoop):
(WTF::RunLoop::dispatchAfter):
(WTF::RunLoop::TimerBase::TimerBase):
* wtf/glib/RunLoopSourcePriority.h: Added.
* wtf/linux/MemoryPressureHandlerLinux.cpp:
(WTF::MemoryPressureHandler::EventFDPoller::EventFDPoller):
2017-04-06 Filip Pizlo <fpizlo@apple.com>
Linear scan should run liveness only once
https://bugs.webkit.org/show_bug.cgi?id=170569
Reviewed by Keith Miller.
Have Liveness<> call Adapter::prepareToCompute(), since this makes it a lot easier to implement
constraint generation, since the constraint generator now gets to run after the Adapter is fully
constructed.
* wtf/IndexMap.h:
(WTF::IndexMap::append): Also make this a bit more versatile.
* wtf/Liveness.h:
(WTF::Liveness::LocalCalc::Iterable::contains):
(WTF::Liveness::Iterable::contains):
(WTF::Liveness::compute):
2017-04-06 Andreas Kling <akling@apple.com>
Kill any WebContent process using over 16 GB of memory.
https://bugs.webkit.org/show_bug.cgi?id=170515
<rdar://problem/29930931>
Reviewed by Antti Koivisto.
Restructure the code since it was getting out of sync with the intended behavior.
Now there's a thresholdForMemoryKill() which returns the current memory limit based
on the process status.
The memory usage policy is separated from the killing, and now only drives the
asynchronous invocations of pressure relief that occur when we pass over one of
the policy edges (now 1GB for Conservative, 2GB for Strict.)
Removed the "Panic" policy and moved the memory kill logic to shrinkOrDie().
Behavior as of this patch:
- Everyone gets killed over 16 GB.
- Inactive processes get killed over 4 GB.
- Strict memory usage policy kicks in at 2 GB.
- Conservative memory usage policy at 1 GB.
Like before, we make a best-effort attempt to free up memory before killing the process.
* wtf/MemoryPressureHandler.cpp:
(WTF::toString):
(WTF::MemoryPressureHandler::thresholdForMemoryKill):
(WTF::thresholdForPolicy):
(WTF::policyForFootprint):
(WTF::MemoryPressureHandler::shrinkOrDie):
(WTF::MemoryPressureHandler::setMemoryUsagePolicyBasedOnFootprint):
(WTF::MemoryPressureHandler::measurementTimerFired):
* wtf/MemoryPressureHandler.h:
2017-04-05 Andreas Kling <akling@apple.com>
Make inactive web processes behave as though under memory pressure.
https://bugs.webkit.org/show_bug.cgi?id=170042
<rdar://problem/31038445>
Reviewed by Antti Koivisto.
Once a web process becomes inactive, let's try to reduce its impact
on memory usage by treating it as if it's under memory pressure until
it becomes active.
* wtf/MemoryPressureHandler.cpp:
(WTF::MemoryPressureHandler::setProcessState):
(WTF::MemoryPressureHandler::isUnderMemoryPressure):
* wtf/MemoryPressureHandler.h:
(WTF::MemoryPressureHandler::isUnderMemoryPressure): Deleted.
2017-04-05 Yusuke Suzuki <utatane.tea@gmail.com>
[JSC] Suppress warnings in GCC
https://bugs.webkit.org/show_bug.cgi?id=170501
Reviewed by Keith Miller.
Add a new macro UNUSED_FUNCTION to annotate unused static functions.
#pragma GCC diagnostic ignored "-Wunused-function" does not work.
* wtf/Compiler.h:
2017-04-04 Filip Pizlo <fpizlo@apple.com>
Air::eliminateDeadCode() should not use a HashSet
https://bugs.webkit.org/show_bug.cgi?id=170487
Reviewed by Saam Barati.
BitVector::iterator knows when it's at the end. Expose this functionality.
* wtf/BitVector.h:
(WTF::BitVector::iterator::isAtEnd):
2017-04-04 Keith Miller <keith_miller@apple.com>
WebAssembly: ModuleInformation should be a ref counted thing that can be shared across threads.
https://bugs.webkit.org/show_bug.cgi?id=170478
Reviewed by Saam Barati.
This adds a new String::fromUTF8 that converts a vector of characters to
a string.
Also, it cleans up some style.
* wtf/text/WTFString.h:
(WTF::String::fromUTF8):
* wtf/unicode/UTF8.cpp:
(WTF::Unicode::convertLatin1ToUTF8):
2017-04-04 Filip Pizlo <fpizlo@apple.com>
B3::fixSSA() needs a tune-up
https://bugs.webkit.org/show_bug.cgi?id=170485
Reviewed by Saam Barati.
This makes IndexSparseSet capable of being used as a map if you instantiate it with
KeyValuePair<unsigned, ValueType>.
* wtf/HashTraits.h:
* wtf/IndexSparseSet.h:
(WTF::DefaultIndexSparseSetTraits::create):
(WTF::DefaultIndexSparseSetTraits::key):
(WTF::OverflowHandler>::IndexSparseSet):
(WTF::OverflowHandler>::add):
(WTF::OverflowHandler>::set):
(WTF::OverflowHandler>::remove):
(WTF::OverflowHandler>::clear):
(WTF::OverflowHandler>::size):
(WTF::OverflowHandler>::isEmpty):
(WTF::OverflowHandler>::contains):
(WTF::OverflowHandler>::sort):
(WTF::IndexSparseSet<OverflowHandler>::IndexSparseSet): Deleted.
(WTF::IndexSparseSet<OverflowHandler>::add): Deleted.
(WTF::IndexSparseSet<OverflowHandler>::remove): Deleted.
(WTF::IndexSparseSet<OverflowHandler>::clear): Deleted.
(WTF::IndexSparseSet<OverflowHandler>::size): Deleted.
(WTF::IndexSparseSet<OverflowHandler>::isEmpty): Deleted.
(WTF::IndexSparseSet<OverflowHandler>::contains): Deleted.
(WTF::IndexSparseSet<OverflowHandler>::sort): Deleted.
* wtf/Liveness.h:
(WTF::Liveness::LocalCalc::Iterable::iterator::iterator):
(WTF::Liveness::workset):
2017-04-04 Filip Pizlo <fpizlo@apple.com>
Don't need to Air::reportUsedRegisters for wasm at -O1
https://bugs.webkit.org/show_bug.cgi?id=170459
Reviewed by Saam Barati.
Just moved the liveness computation into a method, which enabled me to do the profiling
that I used to write this patch.
* wtf/Liveness.h:
(WTF::Liveness::Liveness):
(WTF::Liveness::compute):
2017-04-03 Filip Pizlo <fpizlo@apple.com>
Air liveness should build constraints and solve them rather than repeatedly parsing IR
https://bugs.webkit.org/show_bug.cgi?id=170421
Reviewed by Saam Barati.
* wtf/Vector.h:
(WTF::minCapacity>::appendIfNotContains): Because sometimes Vector<> is the best kind of set.
2017-04-03 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Introduce WTF::RandomDevice which keeps /dev/urandom opened
https://bugs.webkit.org/show_bug.cgi?id=170095
Reviewed by Michael Catanzaro.
In this patch, we introduce RandomDevice, which keeps /dev/urandom opened
to avoid repeatedly open and close urandom file descriptor in Linux.
The purpose is similar to std::random_device, but WTF::RandomDevice explicitly
avoids using ARC4, which is recently attempted to be removed from the WebKit
tree[1].
[1]: https://trac.webkit.org/r214329
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/OSRandomSource.cpp:
(WTF::cryptographicallyRandomValuesFromOS):
(WTF::crashUnableToOpenURandom): Deleted.
(WTF::crashUnableToReadFromURandom): Deleted.
* wtf/RandomDevice.cpp: Copied from Source/WTF/wtf/OSRandomSource.cpp.
(WTF::crashUnableToOpenURandom):
(WTF::crashUnableToReadFromURandom):
(WTF::RandomDevice::RandomDevice):
(WTF::RandomDevice::~RandomDevice):
(WTF::RandomDevice::cryptographicallyRandomValues):
* wtf/RandomDevice.h: Added.
2017-04-03 Filip Pizlo <fpizlo@apple.com>
WTF::Liveness should have an API that focuses on actions at instruction boundaries
https://bugs.webkit.org/show_bug.cgi?id=170407
Reviewed by Keith Miller.
Change the Liveness<> API to handle early and late things in one lump inside forEachUse
and forEachDef functions. This reduces the amount of different functions that Liveness<>
expects from its adaptor. This makes it easier to implement optimizations that cache the
use/def behavior of each instruction boundary.
* wtf/Liveness.h:
(WTF::Liveness::Liveness):
(WTF::Liveness::LocalCalc::execute):
2017-04-01 Csaba Osztrogonác <ossy@webkit.org>
Mac cmake buildfix after 214586.
https://bugs.webkit.org/show_bug.cgi?id=170381
Unreviewed.
* wtf/BlockPtr.h:
2017-03-30 Filip Pizlo <fpizlo@apple.com>
Air should support linear scan for optLevel<2
https://bugs.webkit.org/show_bug.cgi?id=170161
Reviewed by Saam Barati.
This change introduces a new low-latency register allocator. It can allocate registers very
quickly by doing a relatively poor job. Implementing this algorithm required beefing up some of
our core algorithms.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/Deque.h: Make it possible to do some basic priority queueing with this data structure.
(WTF::inlineCapacity>::removeAllMatching):
(WTF::inlineCapacity>::appendAndBubble):
(WTF::inlineCapacity>::takeLast):
* wtf/IndexKeyType.h: Added. This makes it possible to use IndexMap and IndexSet with value or pointer types. Previously they just worked with pointer types.
(WTF::IndexKeyType::index):
* wtf/IndexMap.h: Adopt IndexKeyType.
(WTF::IndexMap::operator[]):
(WTF::IndexMap::append):
* wtf/IndexSet.h: Adopt IndexKeyType.
(WTF::IndexSet::add):
(WTF::IndexSet::addAll):
(WTF::IndexSet::remove):
(WTF::IndexSet::contains):
(WTF::IndexSet::Iterable::iterator::operator*):
* wtf/Range.h: Added. This used to be B3::HeapRange. This generalizes that data structure to any kind of range stuff.
(WTF::Range::Range):
(WTF::Range::top):
(WTF::Range::operator==):
(WTF::Range::operator!=):
(WTF::Range::operator bool):
(WTF::Range::operator|):
(WTF::Range::operator|=):
(WTF::Range::begin):
(WTF::Range::end):
(WTF::Range::overlaps):
(WTF::Range::dump):
* wtf/RangeSet.h:
(WTF::RangeSet::add):
2017-03-25 Yusuke Suzuki <utatane.tea@gmail.com>
[JSC] Move platformThreadSignal to WTF
https://bugs.webkit.org/show_bug.cgi?id=170097
Reviewed by Mark Lam.
* wtf/Threading.h:
* wtf/ThreadingPthreads.cpp:
(WTF::signalThread):
2017-03-26 Filip Pizlo <fpizlo@apple.com>
B3::fixSSA should do liveness pruning
https://bugs.webkit.org/show_bug.cgi?id=170111
Reviewed by Saam Barati.
Move Air::Liveness<> to WTF::Liveness<>. This is pretty easy since Air::Liveness<> was
already fairly generic. It leverages the CFG concept so that it can understand many
different kinds of basic blocks. It doesn't try to understand the contents of basic
blocks; it just asks the adaptor for the block size and asks for the early/late
uses/defs of each thing in the block.
This makes it easy to create a B3::VariableLiveness, which fixSSA then uses for
pruning. One of the new features is the Liveness::LiveAtHead nested class, which you
instantiate if you want to perform liveAtHead queries, which SSA construction wants to
do.
This also fixes https://bugs.webkit.org/show_bug.cgi?id=170102#c12
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/Liveness.h: Added.
(WTF::Liveness::Liveness):
(WTF::Liveness::LocalCalc::LocalCalc):
(WTF::Liveness::LocalCalc::Iterable::Iterable):
(WTF::Liveness::LocalCalc::Iterable::iterator::iterator):
(WTF::Liveness::LocalCalc::Iterable::iterator::operator++):
(WTF::Liveness::LocalCalc::Iterable::iterator::operator*):
(WTF::Liveness::LocalCalc::Iterable::iterator::operator==):
(WTF::Liveness::LocalCalc::Iterable::iterator::operator!=):
(WTF::Liveness::LocalCalc::Iterable::begin):
(WTF::Liveness::LocalCalc::Iterable::end):
(WTF::Liveness::LocalCalc::Iterable::contains):
(WTF::Liveness::LocalCalc::live):
(WTF::Liveness::LocalCalc::isLive):
(WTF::Liveness::LocalCalc::execute):
(WTF::Liveness::rawLiveAtHead):
(WTF::Liveness::Iterable::Iterable):
(WTF::Liveness::Iterable::iterator::iterator):
(WTF::Liveness::Iterable::iterator::operator*):
(WTF::Liveness::Iterable::iterator::operator++):
(WTF::Liveness::Iterable::iterator::operator==):
(WTF::Liveness::Iterable::iterator::operator!=):
(WTF::Liveness::Iterable::begin):
(WTF::Liveness::Iterable::end):
(WTF::Liveness::Iterable::contains):
(WTF::Liveness::liveAtHead):
(WTF::Liveness::liveAtTail):
(WTF::Liveness::workset):
(WTF::Liveness::LiveAtHead::LiveAtHead):
(WTF::Liveness::LiveAtHead::isLiveAtHead):
2017-03-25 Filip Pizlo <fpizlo@apple.com>
Air::Liveness shouldn't need HashSets
https://bugs.webkit.org/show_bug.cgi?id=170102
Reviewed by Yusuke Suzuki.
* wtf/IndexSparseSet.h: Add some helpers for a HashSet-free liveness analysis.
(WTF::IndexSparseSet::values):
(WTF::IndexSparseSet<OverflowHandler>::sort):
* wtf/StdLibExtras.h:
(WTF::mergeDeduplicatedSorted): Rapidly merge two sorted lists that don't have duplicates to produce a new sorted list that doesn't have duplicates.
* wtf/Vector.h:
(WTF::minCapacity>::uncheckedAppend): Inline this!
(WTF::removeRepeatedElements): This is a version of std::unique() that works naturally for Vectors.
2017-03-26 Filip Pizlo <fpizlo@apple.com>
Air should use RegisterSet for RegLiveness
https://bugs.webkit.org/show_bug.cgi?id=170108
Reviewed by Yusuke Suzuki.
* wtf/Atomics.h:
(WTF::ensurePointer): This is a useful replacement for std::once, which requires less fencing.
* wtf/Bitmap.h: Add more utilities.
(WTF::Bitmap::iterator::iterator): An iterator for set bits.
(WTF::Bitmap::iterator::operator*):
(WTF::Bitmap::iterator::operator++):
(WTF::Bitmap::iterator::operator==):
(WTF::Bitmap::iterator::operator!=):
(WTF::Bitmap::begin):
(WTF::Bitmap::end):
(WTF::WordType>::subsumes): a.subsumes(b) if all of b's set bits are set in a.
(WTF::WordType>::findBit): find next set or clear bit.
2017-03-24 JF Bastien <jfbastien@apple.com>
WebAssembly: store state in TLS instead of on VM
https://bugs.webkit.org/show_bug.cgi?id=169611
Reviewed by Filip Pizlo.
* wtf/FastTLS.h: reserve one key for WebAssembly, delete a bunch
of dead code which clang couldn't compile (it's valid GCC assembly
which LLVM dislikes).
2017-03-24 Ryan Haddad <ryanhaddad@apple.com>
Unreviewed, rolling out r214351.
This change caused API test
WebKit1.DidCreateJavaScriptContextBackForwardCacheTest to
fail.
Reverted changeset:
"Make inactive web processes behave as though under memory
pressure."
https://bugs.webkit.org/show_bug.cgi?id=170042
http://trac.webkit.org/changeset/214351
2017-03-24 Chris Dumez <cdumez@apple.com>
Unreviewed, rolling out r214329.
Significantly regressed Speedometer
Reverted changeset:
"window.crypto.getRandomValues() uses the insecure RC4 RNG"
https://bugs.webkit.org/show_bug.cgi?id=169623
http://trac.webkit.org/changeset/214329
2017-03-24 Andreas Kling <akling@apple.com>
Make inactive web processes behave as though under memory pressure.
<https://webkit.org/b/170042>
Reviewed by Antti Koivisto.
Once a web process becomes inactive, let's try to reduce its impact
on memory usage by treating it as if it's under memory pressure until
it becomes active.
* wtf/MemoryPressureHandler.cpp:
(WTF::MemoryPressureHandler::setProcessState):
(WTF::MemoryPressureHandler::isUnderMemoryPressure):
* wtf/MemoryPressureHandler.h:
(WTF::MemoryPressureHandler::isUnderMemoryPressure): Deleted.
2017-03-23 Michael Catanzaro <mcatanzaro@igalia.com>
window.crypto.getRandomValues() uses the insecure RC4 RNG
https://bugs.webkit.org/show_bug.cgi?id=169623
Reviewed by Alex Christensen.
Remove the RC4 random generator in favor of using OS randomness for now. This is basically
a merge of https://codereview.chromium.org/1431233002 from Blink, original author "eroman".
* wtf/CryptographicallyRandomNumber.cpp:
(WTF::cryptographicallyRandomNumber):
(WTF::cryptographicallyRandomValues):
(): Deleted.
2017-03-23 Tomas Popela <tpopela@redhat.com>
Fix uninitialized public members in WTF
https://bugs.webkit.org/show_bug.cgi?id=169676
Reviewed by Michael Catanzaro.
Found by Coverity scan.
* wtf/Bag.h:
* wtf/HashTable.h:
* wtf/HashTraits.h:
* wtf/Insertion.h:
* wtf/OrderMaker.h:
* wtf/ParallelJobsGeneric.h:
2017-03-22 Andreas Kling <akling@apple.com>
Let MemoryPressureHandler track whether the process is active or inactive.
<https://webkit.org/b/169990>
Reviewed by Antti Koivisto.
An active process is a process that meets any of these criteria:
- Has had a visible Page in an active window in the last hour
- Is playing audio
This replaces the old mechanism where MemoryPressureHandler would invoke
a callback to know whether the process was eligible for a memory kill.
Instead we now plumb the relevant information down from WebCore and kill
based on this activity state.
* wtf/MemoryPressureHandler.cpp:
(WTF::MemoryPressureHandler::measurementTimerFired):
(WTF::MemoryPressureHandler::setProcessState):
* wtf/MemoryPressureHandler.h:
(WTF::MemoryPressureHandler::setMemoryKillCallback):
(WTF::MemoryPressureHandler::processState):
(WTF::MemoryPressureHandler::setProcessIsEligibleForMemoryKillCallback): Deleted.
2017-03-20 Simon Fraser <simon.fraser@apple.com>
Add a system trace point for memory warning handling
https://bugs.webkit.org/show_bug.cgi?id=169893
Reviewed by Zalan Bujtas.
Make it possible to pass data to the Begin trace point.
* wtf/SystemTracing.h:
(WTF::TraceScope::TraceScope):
2017-03-17 Said Abou-Hallawa <sabouhallawa@apple.com>
Time channel attack on SVG Filters
https://bugs.webkit.org/show_bug.cgi?id=118689
Reviewed by Simon Fraser.
Performing arithmetic operations on subnormal floating-point numbers is
very expensive. Normalizing the floating-point number to the minimum normal
value should accelerate the calculations and there won't be a noticeable
difference in the result since all the subnormal values and the minimum
normal value are all very close to zero.
* wtf/MathExtras.h:
(normalizedFloat):
2017-03-11 Filip Pizlo <fpizlo@apple.com>
Air should be powerful enough to support Tmp-splitting
https://bugs.webkit.org/show_bug.cgi?id=169515
Reviewed by Saam Barati.
Teach IndexMap how to handle types that don't have a default constructor. This makes it
easy to create a IndexMap<BasicBlock, InsertionSet>, which is a super powerful
construct.
* wtf/IndexMap.h:
(WTF::IndexMap::IndexMap):
(WTF::IndexMap::resize):
(WTF::IndexMap::clear):
2017-03-16 Simon Fraser <simon.fraser@apple.com>
Improve the system tracing points
https://bugs.webkit.org/show_bug.cgi?id=169790
Reviewed by Zalan Bujtas.
Use a more cohesive set of system trace points that give a good overview of what
WebKit is doing. Added points for resource loading, render tree building, sync messages
to the web process, async image decode, WASM and fetching cookies.
* wtf/SystemTracing.h:
2017-03-16 Carlos Garcia Campos <cgarcia@igalia.com>
[UNIX] Implement currentSearchLocaleID() and currentTextBreakLocaleID()
https://bugs.webkit.org/show_bug.cgi?id=169745
Reviewed by Yusuke Suzuki.
Add a common implementation for Unix based ports using setlocale.
* wtf/PlatformGTK.cmake:
* wtf/PlatformJSCOnly.cmake:
* wtf/text/gtk/TextBreakIteratorInternalICUGtk.cpp: Removed.
* wtf/text/unix/TextBreakIteratorInternalICUUnix.cpp: Renamed from Source/WTF/wtf/text/jsconly/TextBreakIteratorInternalICUJSCOnly.cpp.
(WTF::currentSearchLocaleID):
(WTF::currentTextBreakLocaleID):
2017-03-16 Carlos Garcia Campos <cgarcia@igalia.com>
[GLIB] MainThread implementation is not GTK+ specific
https://bugs.webkit.org/show_bug.cgi?id=169736
Reviewed by Yusuke Suzuki.
It's implemented in MainThreadGLib.cpp for glib based ports, so ifdefs in MainThread should not be
PLATFORM(GTK) but USE(GLIB).
* wtf/MainThread.cpp:
* wtf/MainThread.h:
2017-03-15 Carlos Alberto Lopez Perez <clopez@igalia.com>
[CMake][JSCOnly] Fix build with GLib event loop
https://bugs.webkit.org/show_bug.cgi?id=169730
Reviewed by Michael Catanzaro.
* wtf/MainThread.cpp:
* wtf/PlatformJSCOnly.cmake: WorkQueueGLib was removed in r199713.
2017-03-15 Dean Jackson <dino@apple.com>
Sort Xcode project files
https://bugs.webkit.org/show_bug.cgi?id=169669
Reviewed by Antoine Quint.
* WTF.xcodeproj/project.pbxproj:
2017-03-14 Filip Pizlo <fpizlo@apple.com>
Fix some typos in this benchmark.
Rubber stamped by Saam Barati.
* benchmarks/HashSetDFGReplay.cpp:
(main):
2017-03-14 Filip Pizlo <fpizlo@apple.com>
Record the HashSet/HashMap operations in DFG/FTL/B3 and replay them in a benchmark
https://bugs.webkit.org/show_bug.cgi?id=169590
Reviewed by Saam Barati.
This adds LoggingHashSet and LoggingHashMap, which are drop-in replacements for HashSet and
HashMap that log everything that they do, so that you can replay it later.
This also adds a benchmark (HashSetDFGReplay) based on doing a recording of some of the HashSets
in the DFG compiler.
* WTF.xcodeproj/project.pbxproj:
* benchmarks/HashSetDFGReplay.cpp: Added.
(benchmark):
(main):
* wtf/CMakeLists.txt:
* wtf/GlobalVersion.cpp: Added.
(WTF::newGlobalVersion):
* wtf/GlobalVersion.h: Added.
* wtf/HashMap.h:
(WTF::X>::swap):
* wtf/HashSet.h:
(WTF::V>::addVoid):
* wtf/LoggingHashID.h: Added.
(WTF::LoggingHashID::LoggingHashID):
(WTF::LoggingHashID::dump):
* wtf/LoggingHashMap.h: Added.
* wtf/LoggingHashSet.h: Added.
* wtf/LoggingHashTraits.h: Added.
(WTF::LoggingHashKeyTraits::print):
(WTF::LoggingHashValueTraits::print):
2017-03-13 Jer Noble <jer.noble@apple.com>
Make classes used by Media Stream encode/decode friendly
https://bugs.webkit.org/show_bug.cgi?id=169567
Reviewed by Eric Carlson.
* wtf/MediaTime.h:
(WTF::MediaTime::encode):
(WTF::MediaTime::decode):
2017-03-14 Yusuke Suzuki <utatane.tea@gmail.com>
Add secondsAs<T> methods to Seconds to convert it to integers with clamp
https://bugs.webkit.org/show_bug.cgi?id=169537
Reviewed by Carlos Garcia Campos.
When using the usual static_cast, infinity becomes 0 accidentally.
It is not intended value when using Seconds for timeout value.
Instead, we use clampToAccepting64 to convert Seconds to
integer values to pass them to the system functions.
* wtf/MathExtras.h:
(clampToAccepting64):
* wtf/Seconds.h:
(WTF::Seconds::minutesAs):
(WTF::Seconds::secondsAs):
(WTF::Seconds::millisecondsAs):
(WTF::Seconds::microsecondsAs):
(WTF::Seconds::nanosecondsAs):
* wtf/cocoa/WorkQueueCocoa.cpp:
(WTF::WorkQueue::dispatchAfter):
* wtf/glib/RunLoopGLib.cpp:
(WTF::RunLoop::dispatchAfter):
(WTF::RunLoop::TimerBase::updateReadyTime):
2017-03-13 Yusuke Suzuki <utatane.tea@gmail.com>
[JSC][Linux] Implement VMTrap in Linux ports
https://bugs.webkit.org/show_bug.cgi?id=169436
Reviewed by Mark Lam.
Enable VMTrap mechanism for Linux and FreeBSD.
* wtf/Platform.h:
2017-03-13 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Clean up RunLoop and WorkQueue with Seconds and Function
https://bugs.webkit.org/show_bug.cgi?id=169537
Reviewed by Sam Weinig.
This patch modernizes RunLoop and WorkQueue.
1. Use Ref<> aggressively
2. Use Seconds instead of chrono times
3. Use Function<> instead of std::function
* wtf/MainThread.cpp:
(WTF::dispatchFunctionsFromMainThread):
* wtf/RunLoop.h:
* wtf/WorkQueue.h:
* wtf/cocoa/WorkQueueCocoa.cpp:
(WTF::WorkQueue::dispatch):
(WTF::WorkQueue::dispatchAfter):
(WTF::WorkQueue::concurrentApply):
* wtf/generic/MainThreadGeneric.cpp:
(WTF::scheduleDispatchFunctionsOnMainThread):
* wtf/generic/RunLoopGeneric.cpp:
(WTF::RunLoop::TimerBase::ScheduledTask::create):
(WTF::RunLoop::TimerBase::ScheduledTask::EarliestSchedule::operator()):
(WTF::RunLoop::populateTasks):
(WTF::RunLoop::runImpl):
(WTF::RunLoop::schedule):
(WTF::RunLoop::scheduleAndWakeUp):
(WTF::RunLoop::dispatchAfter):
(WTF::RunLoop::TimerBase::start):
* wtf/generic/WorkQueueGeneric.cpp:
(WorkQueue::dispatch):
(WorkQueue::dispatchAfter):
* wtf/glib/RunLoopGLib.cpp:
(WTF::DispatchAfterContext::DispatchAfterContext):
(WTF::RunLoop::dispatchAfter):
(WTF::RunLoop::TimerBase::updateReadyTime):
(WTF::RunLoop::TimerBase::start):
* wtf/win/WorkQueueWin.cpp:
(WTF::WorkQueue::performWorkOnRegisteredWorkThread):
(WTF::WorkQueue::dispatch):
(WTF::WorkQueue::dispatchAfter):
2017-03-13 Chris Dumez <cdumez@apple.com>
[WK2] Only report background WebProcesses as unresponsive in the background after 90 seconds
https://bugs.webkit.org/show_bug.cgi?id=169425
<rdar://problem/30954003>
Reviewed by Andreas Kling.
* wtf/RunLoop.h:
(WTF::RunLoop::TimerBase::startRepeating):
(WTF::RunLoop::TimerBase::startOneShot):
Add overloads to RunLoop::Timer that take Seconds in parameter,
for convenience.
* wtf/Seconds.h:
(WTF::Seconds::fromHours):
(WTF::seconds_literals::operator _h):
Allow _h suffix for initializing Seconds type to hours.
2017-03-11 Csaba Osztrogonác <ossy@webkit.org>
REGRESSION(r213645): It made JSC tests super slow and timeout on AArch64 Linux
https://bugs.webkit.org/show_bug.cgi?id=169510
Unreviewed, disable LL_SC on Linux to unbreak this platform.
* wtf/Atomics.h:
* wtf/Platform.h:
2017-03-10 Filip Pizlo <fpizlo@apple.com>
The JITs should be able to emit fast TLS loads
https://bugs.webkit.org/show_bug.cgi?id=169483
Reviewed by Keith Miller.
Consolidated what we know about fast TLS in FastTLS.h.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/FastTLS.h: Added.
(WTF::loadFastTLS):
(WTF::fastTLSOffsetForKey):
* wtf/Platform.h:
* wtf/WTFThreadData.cpp:
(WTF::WTFThreadData::createAndRegisterForGetspecificDirect):
* wtf/WTFThreadData.h:
(WTF::wtfThreadData):
2017-03-10 Mark Lam <mark.lam@apple.com>
Turn ENABLE(MASM_PROBE) on by default for OS(DARWIN) release builds.
https://bugs.webkit.org/show_bug.cgi?id=169493
Reviewed by Saam Barati.
MASM_PROBE was already enabled for debug builds. This change makes it so that we
don't have to rebuild the world every time we need to use it on a release build.
* wtf/Platform.h:
2017-03-10 Csaba Osztrogonác <ossy@webkit.org>
Unreviewed AArch64 Linux buildfix after r213645.
https://bugs.webkit.org/show_bug.cgi?id=169300
* wtf/Atomics.h: intptr_t and int64_t are typedefs for long int on Linux.
They are different types only on Darwin platforms.
2017-03-09 Caio Lima <ticaiolima@gmail.com>
[ESnext] Implement Object Rest - Implementing Object Rest Destructuring
https://bugs.webkit.org/show_bug.cgi?id=167962
Reviewed by Keith Miller.
* wtf/HashSet.h:
(WTF::=):
2017-03-09 Youenn Fablet <youenn@apple.com>
Activate VideoToolbox when WebRTC is enabled on iOS
https://bugs.webkit.org/show_bug.cgi?id=169423
Reviewed by Jon Lee.
* wtf/Platform.h: Activate VIDEOTOOLBOX if WEBRTC is enabled.
2017-03-09 Filip Pizlo <fpizlo@apple.com>
std::isnan/isinf/isfinite should work with WTF time classes
https://bugs.webkit.org/show_bug.cgi?id=164991
Reviewed by Darin Adler.
The consensus view (see comments in https://bugs.webkit.org/show_bug.cgi?id=152045) of how
to check if something is NaN is to use std::isnan(). To be able to do that for time
classes, they need to provide their own isnan() overhload. This also provides isinf()
overloads.
* wtf/MonotonicTime.h:
(std::isnan):
(std::isinf):
* wtf/Seconds.h:
(std::isnan):
(std::isinf):
* wtf/TimeWithDynamicClockType.h:
(std::isnan):
(std::isinf):
* wtf/WallTime.h:
(std::isnan):
(std::isinf):
2017-03-09 Mark Lam <mark.lam@apple.com>
Use const AbstractLocker& (instead of const LockHolder&) in more places.
https://bugs.webkit.org/show_bug.cgi?id=169424
Reviewed by Filip Pizlo.
* wtf/RunLoop.h:
* wtf/generic/RunLoopGeneric.cpp:
(WTF::RunLoop::wakeUp):
(WTF::RunLoop::schedule):
2017-03-09 Mark Lam <mark.lam@apple.com>
Make the VM Traps mechanism non-polling for the DFG and FTL.
https://bugs.webkit.org/show_bug.cgi?id=168920
<rdar://problem/30738588>
Reviewed by Filip Pizlo.
Make StackBounds more useful for checking if a pointer is within stack bounds.
* wtf/MetaAllocator.cpp:
(WTF::MetaAllocator::isInAllocatedMemory):
* wtf/MetaAllocator.h:
* wtf/Platform.h:
* wtf/StackBounds.h:
(WTF::StackBounds::emptyBounds):
(WTF::StackBounds::StackBounds):
(WTF::StackBounds::isEmpty):
(WTF::StackBounds::contains):
2017-03-07 Filip Pizlo <fpizlo@apple.com>
WTF should make it super easy to do ARM concurrency tricks
https://bugs.webkit.org/show_bug.cgi?id=169300
Reviewed by Mark Lam.
This adds Atomic<>::loadLink and Atomic<>::storeCond, available only when HAVE(LL_SC).
It abstracts loadLink/storeCond behind prepare/attempt. You can write prepare/attempt
loops whenever your loop fits into the least common denominator of LL/SC and CAS.
This modifies Atomic<>::transaction to use prepare/attempt. So, if you write your loop
using Atomic<>::transaction, then you get LL/SC for free.
Depending on the kind of transaction you are doing, you may not want to perform an LL
until you have a chance to just load the current value. Atomic<>::transaction() assumes
that you do not care to have any ordering guarantees in that case. If you think that
the transaction has a good chance of aborting this way, you want
Atomic<>::transaction() to first do a plain load. But if you don't think that such an
abort is likely, then you want to go straight to the LL. The API supports this concept
via TransactionAbortLikelihood.
Additionally, this redoes the depend/consume API to be dead simple. Dependency is
unsigned. You get a dependency on a loaded value by just saying
dependency(loadedValue). You consume the dependency by using it as a bonus index to
some pointer dereference. This is made easy with the consume<T*>(ptr, dependency)
helper. In those cases where you want to pass around both a computed value and a
dependency, there's DependencyWith<T>. But you won't need it in most cases. The loaded
value or any value computed from the loaded value is a fine input to dependency()!
This change updates a bunch of hot paths to use the new APIs. Using transaction() gives
us optimal LL/SC loops for object marking and lock acquisition.
This change also updates a bunch of hot paths to use dependency()/consume().
This is a significant Octane/splay speed-up on ARM.
* wtf/Atomics.h:
(WTF::hasFence):
(WTF::Atomic::prepare):
(WTF::Atomic::attempt):
(WTF::Atomic::transaction):
(WTF::Atomic::transactionRelaxed):
(WTF::nullDependency):
(WTF::dependency):
(WTF::DependencyWith::DependencyWith):
(WTF::dependencyWith):
(WTF::consume):
(WTF::Atomic::tryTransactionRelaxed): Deleted.
(WTF::Atomic::tryTransaction): Deleted.
(WTF::zeroWithConsumeDependency): Deleted.
(WTF::consumeLoad): Deleted.
* wtf/Bitmap.h:
(WTF::WordType>::get):
(WTF::WordType>::concurrentTestAndSet):
(WTF::WordType>::concurrentTestAndClear):
* wtf/LockAlgorithm.h:
(WTF::LockAlgorithm::lockFast):
(WTF::LockAlgorithm::unlockFast):
(WTF::LockAlgorithm::unlockSlow):
* wtf/Platform.h:
2017-03-08 Anders Carlsson <andersca@apple.com>
Simplify the PaymentCoordinator interface
https://bugs.webkit.org/show_bug.cgi?id=169382
Part of rdar://problem/28880714.
Reviewed by Tim Horton.
* wtf/EnumTraits.h:
Fix a build warning.
2017-03-06 Andreas Kling <akling@apple.com>
[iOS] Report domains crashing under memory pressure via enhanced privacy logging.
<https://webkit.org/b/169133>
<rdar://problem/29964017>
Reviewed by Antti Koivisto.
Add a mechanism for getting a callback when the memory pressure status changes.
* wtf/MemoryPressureHandler.cpp:
(WTF::MemoryPressureHandler::measurementTimerFired):
(WTF::MemoryPressureHandler::beginSimulatedMemoryPressure):
(WTF::MemoryPressureHandler::endSimulatedMemoryPressure):
(WTF::MemoryPressureHandler::setUnderMemoryPressure):
(WTF::MemoryPressureHandler::memoryPressureStatusChanged):
* wtf/MemoryPressureHandler.h:
(WTF::MemoryPressureHandler::setMemoryPressureStatusChangedCallback):
(WTF::MemoryPressureHandler::setUnderMemoryPressure): Deleted.
2017-03-03 Jer Noble <jer.noble@apple.com>
[Win64] '__int128_t': undeclared identifier in MediaTime.cpp
https://bugs.webkit.org/show_bug.cgi?id=169123
Reviewed by Alex Christensen.
Don't perform the 128-bit optimized path on Windows, where the __int128_t intrinsic isn't available.
* wtf/MediaTime.cpp:
(WTF::MediaTime::setTimeScale):
2017-03-03 Keith Miller <keith_miller@apple.com>
WASM should support faster loads.
https://bugs.webkit.org/show_bug.cgi?id=162693
Reviewed by Saam Barati.
Add new forms of dataLog that take a boolean which describes if the log should happen. This makes cases where we have a static const bool for printing nicer since you can do:
dataLogIf(verbose, things, to, print);
instead of:
if (verbose)
dataLog(things, to, print);
Also, add a operator! to Ref that has the same semantics as C++ refs.
* wtf/DataLog.h:
(WTF::dataLogLn):
(WTF::dataLogIf):
(WTF::dataLogLnIf):
* wtf/Ref.h:
(WTF::Ref::operator!):
2017-03-02 Jer Noble <jer.noble@apple.com>
Sufficently large timeValue and timeScale arguments to MediaTime will cause wrapping in toTimeScale().
https://bugs.webkit.org/show_bug.cgi?id=169098
Reviewed by Keith Miller.
Use a non-standard but Clang & GCC supported __int128_t type extension to do the 128-bit math rather than
rolling our own. Since this is only available in 64-bit builds, for 32-bit, just fix the underlying 128-bit
math.
* wtf/MediaTime.cpp:
(WTF::MediaTime::setTimeScale):
2017-03-01 Konstantin Tokarev <annulen@yandex.ru>
Removed unused WTF_COMPILER_SUPPORTS_CXX_USER_LITERALS macro
https://bugs.webkit.org/show_bug.cgi?id=168969
Reviewed by Darin Adler.
* wtf/Compiler.h:
2017-03-01 Tomas Popela <tpopela@redhat.com>
[WTF] va_list is not ended in StringPrintStream
https://bugs.webkit.org/show_bug.cgi?id=169035
Reviewed by Michael Saboff.
Also fix whitespace errors while touching this file.
* wtf/StringPrintStream.cpp:
(WTF::StringPrintStream::vprintf):
(WTF::StringPrintStream::increaseSize):
2017-03-01 Andreas Kling <akling@apple.com>
Move MemoryPressureHandler to WTF
<https://webkit.org/b/168908>
Reviewed by Sam Weinig.
Move MemoryPressureHandler down to WTF so it can be used from JavaScriptCore.
I had to do a blind rewrite of the Windows memory checking timer since it can
no longer use WebCore::Timer. I also moved the Win32Handle helper class to WTF.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/MemoryPressureHandler.cpp: Renamed from Source/WebCore/platform/MemoryPressureHandler.cpp.
(WTF::MemoryPressureHandler::singleton):
(WTF::MemoryPressureHandler::MemoryPressureHandler):
(WTF::MemoryPressureHandler::setShouldUsePeriodicMemoryMonitor):
(WTF::toString):
(WTF::thresholdForPolicy):
(WTF::policyForFootprint):
(WTF::MemoryPressureHandler::measurementTimerFired):
(WTF::MemoryPressureHandler::beginSimulatedMemoryPressure):
(WTF::MemoryPressureHandler::endSimulatedMemoryPressure):
(WTF::MemoryPressureHandler::releaseMemory):
(WTF::MemoryPressureHandler::ReliefLogger::logMemoryUsageChange):
(WTF::MemoryPressureHandler::install):
(WTF::MemoryPressureHandler::uninstall):
(WTF::MemoryPressureHandler::holdOff):
(WTF::MemoryPressureHandler::respondToMemoryPressure):
(WTF::MemoryPressureHandler::platformReleaseMemory):
(WTF::MemoryPressureHandler::ReliefLogger::platformMemoryUsage):
(WTF::MemoryPressureHandler::platformInitialize):
* wtf/MemoryPressureHandler.h: Renamed from Source/WebCore/platform/MemoryPressureHandler.h.
(WTF::MemoryPressureHandler::setMemoryKillCallback):
(WTF::MemoryPressureHandler::setProcessIsEligibleForMemoryKillCallback):
(WTF::MemoryPressureHandler::setLowMemoryHandler):
(WTF::MemoryPressureHandler::isUnderMemoryPressure):
(WTF::MemoryPressureHandler::setUnderMemoryPressure):
(WTF::MemoryPressureHandler::ReliefLogger::ReliefLogger):
(WTF::MemoryPressureHandler::ReliefLogger::~ReliefLogger):
(WTF::MemoryPressureHandler::ReliefLogger::logString):
(WTF::MemoryPressureHandler::ReliefLogger::setLoggingEnabled):
(WTF::MemoryPressureHandler::ReliefLogger::loggingEnabled):
(WTF::MemoryPressureHandler::ReliefLogger::MemoryUsage::MemoryUsage):
* wtf/PlatformEfl.cmake:
* wtf/PlatformGTK.cmake:
* wtf/PlatformMac.cmake:
* wtf/PlatformWin.cmake:
* wtf/cocoa/MemoryPressureHandlerCocoa.mm: Renamed from Source/WebCore/platform/cocoa/MemoryPressureHandlerCocoa.mm.
(WTF::MemoryPressureHandler::platformReleaseMemory):
(WTF::MemoryPressureHandler::install):
(WTF::MemoryPressureHandler::uninstall):
(WTF::MemoryPressureHandler::holdOff):
(WTF::MemoryPressureHandler::respondToMemoryPressure):
(WTF::MemoryPressureHandler::ReliefLogger::platformMemoryUsage):
* wtf/linux/CurrentProcessMemoryStatus.cpp: Renamed from Source/WebCore/platform/linux/CurrentProcessMemoryStatus.cpp.
(WTF::systemPageSize):
(WTF::currentProcessMemoryStatus):
* wtf/linux/CurrentProcessMemoryStatus.h: Renamed from Source/WebCore/platform/linux/CurrentProcessMemoryStatus.h.
* wtf/linux/MemoryPressureHandlerLinux.cpp: Renamed from Source/WebCore/platform/linux/MemoryPressureHandlerLinux.cpp.
(WTF::MemoryPressureHandler::EventFDPoller::EventFDPoller):
* wtf/win/MemoryPressureHandlerWin.cpp: Renamed from Source/WebCore/platform/win/MemoryPressureHandlerWin.cpp.
(WTF::MemoryPressureHandler::platformInitialize):
(WTF::MemoryPressureHandler::windowsMeasurementTimerFired):
(WTF::MemoryPressureHandler::platformReleaseMemory):
(WTF::MemoryPressureHandler::install):
(WTF::MemoryPressureHandler::uninstall):
(WTF::MemoryPressureHandler::holdOff):
(WTF::MemoryPressureHandler::respondToMemoryPressure):
(WTF::MemoryPressureHandler::ReliefLogger::platformMemoryUsage):
* wtf/win/Win32Handle.h: Renamed from Source/WebCore/platform/win/Win32Handle.h.
(WTF::Win32Handle::Win32Handle):
(WTF::Win32Handle::~Win32Handle):
(WTF::Win32Handle::clear):
(WTF::Win32Handle::isValid):
(WTF::Win32Handle::get):
(WTF::Win32Handle::release):
(WTF::Win32Handle::operator=):
2017-02-28 Chris Dumez <cdumez@apple.com>
[iOS] Throttle requestAnimationFrame to 30fps in low power mode
https://bugs.webkit.org/show_bug.cgi?id=168837
<rdar://problem/30700929>
Reviewed by Simon Fraser.
Add support for operator -= on WTF::OptionSet for convenience:
set -= Enum::A;
looks much better than:
set = set - Enum::A;
* wtf/OptionSet.h:
(WTF::OptionSet::operator-=):
2017-02-28 Michael Saboff <msaboff@apple.com>
Add ability to configure JSC options from a file
https://bugs.webkit.org/show_bug.cgi?id=168914
Reviewed by Filip Pizlo.
Added the ability to set options and DataLog file location via a configuration file.
The pathname can include the printf style "%pid", which will be replaced with the
current process id.
* wtf/DataLog.cpp:
(WTF::initializeLogFileOnce):
(WTF::setDataFile):
* wtf/DataLog.h:
2017-02-27 Andy Estes <aestes@apple.com>
[iOS] Enable file replacement
https://bugs.webkit.org/show_bug.cgi?id=168907
<rdar://problem/22258242>
Reviewed by David Kilzer.
* wtf/FeatureDefines.h: Set ENABLE_FILE_REPLACEMENT to 1 on all Cocoa platforms.
2017-02-27 Myles C. Maxfield <mmaxfield@apple.com>
Rename ICU cursor iterator to caret iterator
https://bugs.webkit.org/show_bug.cgi?id=168206
Reviewed by Simon Fraser.
* wtf/text/TextBreakIterator.cpp:
(WTF::mapModeToBackingIterator):
* wtf/text/TextBreakIterator.h:
* wtf/text/cf/TextBreakIteratorCF.h:
(WTF::TextBreakIteratorCF::TextBreakIteratorCF):
* wtf/text/icu/TextBreakIteratorICU.h:
(WTF::caretRules):
(WTF::TextBreakIteratorICU::TextBreakIteratorICU):
(WTF::cursorRules): Deleted.
* wtf/text/mac/TextBreakIteratorInternalICUMac.mm:
(WTF::mapModeToBackingIterator):
2017-02-27 Myles C. Maxfield <mmaxfield@apple.com>
Use RAII for ICU breaking iterators
https://bugs.webkit.org/show_bug.cgi?id=168203
Reviewed by Simon Fraser.
* wtf/text/TextBreakIterator.h:
(WTF::CachedTextBreakIterator::CachedTextBreakIterator):
(WTF::CachedTextBreakIterator::~CachedTextBreakIterator):
(WTF::CachedTextBreakIterator::preceding):
(WTF::CachedTextBreakIterator::following):
(WTF::CachedTextBreakIterator::isBoundary):
2017-02-24 Jer Noble <jer.noble@apple.com>
Add public method to MediaTime for doing timeScale conversion.
https://bugs.webkit.org/show_bug.cgi?id=168860
Reviewed by Eric Carlson.
The newly public method, modeled on CMTimeConvertScale, allows callers to specify what rounding technique
will be used when converting to a new time scale.
* wtf/MediaTime.cpp:
(WTF::MediaTime::toTimeScale):
(WTF::MediaTime::setTimeScale):
* wtf/MediaTime.h:
2017-02-26 Myles C. Maxfield <mmaxfield@apple.com>
Stop compiling our own cursorMovementIterator()
https://bugs.webkit.org/show_bug.cgi?id=168211
Reviewed by David Hyatt.
This patch creates a unified Text Breaking API, which can be backed by either ICU
or CoreFoundation (for ports which can use it). Rather than using inheritance and
virtual functions to implement this, because there are only two subclasses, the
simpler option of just using a Variant is used instead. There is also a cache which
allows you to reuse iterators without reconstructing them. This cache is better
than the previous method of having a single static iterator because the cache
lets you use two iterators simultaneously.
In the future, I will hook up all iterators to use this shared class. However, for
this patch, I've only hooked up the caret position iterator (backed by CoreFoundation
on Cocoa ports and UBRK_CHARACTER on other ports).
* WTF.xcodeproj/project.pbxproj:
* wtf/spi/cf/CFStringSPI.h: Added.
* wtf/text/TextBreakIterator.cpp:
(WTF::initializeIteratorWithRules): Deleted.
(WTF::cursorMovementIterator): Deleted.
* wtf/text/TextBreakIterator.h:
(WTF::TextBreakIterator::preceding):
(WTF::TextBreakIterator::following):
(WTF::TextBreakIterator::isBoundary):
(WTF::TextBreakIterator::setText):
(WTF::TextBreakIterator::mode):
(WTF::TextBreakIterator::locale):
(WTF::TextBreakIteratorCache::singleton):
(WTF::TextBreakIteratorCache::take):
(WTF::TextBreakIteratorCache::put):
(WTF::TextBreakIteratorCache::TextBreakIteratorCache):
* wtf/text/cf/TextBreakIteratorCF.h: Added.
(WTF::TextBreakIteratorCF::TextBreakIteratorCF):
(WTF::TextBreakIteratorCF::setText):
(WTF::TextBreakIteratorCF::preceding):
(WTF::TextBreakIteratorCF::following):
(WTF::TextBreakIteratorCF::isBoundary):
* wtf/text/icu/TextBreakIteratorICU.h: Added.
(WTF::TextBreakIteratorICU::set8BitText):
(WTF::TextBreakIteratorICU::TextBreakIteratorICU):
(WTF::TextBreakIteratorICU::operator=):
(WTF::TextBreakIteratorICU::~TextBreakIteratorICU):
(WTF::TextBreakIteratorICU::setText):
(WTF::TextBreakIteratorICU::preceding):
(WTF::TextBreakIteratorICU::following):
(WTF::TextBreakIteratorICU::isBoundary):
* wtf/text/icu/UTextProviderLatin1.h:
* wtf/text/mac/TextBreakIteratorInternalICUMac.mm:
(WTF::mapModeToBackingIterator):
(WTF::TextBreakIterator::TextBreakIterator):
2017-02-24 Joseph Pecoraro <pecoraro@apple.com>
[Resource Timing] Gather timing information with reliable responseEnd time
https://bugs.webkit.org/show_bug.cgi?id=168351
Reviewed by Alex Christensen.
* wtf/persistence/Coders.h:
(WTF::Persistence::Coder<Seconds>::encode):
(WTF::Persistence::Coder<Seconds>::decode):
2017-02-24 Keith Miller <keith_miller@apple.com>
Rubber-stamped by Chris Dumez.
Replace typename Bool with typename BoolType because X11 has
#define Bool int for some unknown reason...
* wtf/HashFunctions.h:
(WTF::TupleHash::allTrue):
* wtf/HashTraits.h:
(WTF::TupleHashTraits::allTrue):
2017-02-24 Chris Dumez <cdumez@apple.com>
Unreviewed, rolling out r212944.
Caused a lot of failures on the debug bots
Reverted changeset:
"[Resource Timing] Gather timing information with reliable
responseEnd time"
https://bugs.webkit.org/show_bug.cgi?id=168351
http://trac.webkit.org/changeset/212944
2017-02-24 Keith Miller <keith_miller@apple.com>
We should be able to use std::tuples as keys in HashMap
https://bugs.webkit.org/show_bug.cgi?id=168805
Reviewed by Filip Pizlo.
This patch adds support for using std::tupeles as the key
type in HashMap. It is equivalent to doing a sequence of
std::pairs but has a nicer syntax.
* wtf/HashFunctions.h:
(WTF::TupleHash::hash):
(WTF::TupleHash::equal):
(WTF::TupleHash::allTrue):
* wtf/HashTraits.h:
(WTF::TupleHashTraits::allTrue):
(WTF::TupleHashTraits::emptyValue):
(WTF::TupleHashTraits::constructDeletedValue):
(WTF::TupleHashTraits::isDeletedValue):
2017-02-24 Alex Christensen <achristensen@webkit.org>
Prepare to enable WebRTC on iOS
https://bugs.webkit.org/show_bug.cgi?id=168811
Reviewed by Youenn Fablet.
* wtf/Platform.h:
2017-02-23 Joseph Pecoraro <pecoraro@apple.com>
[Resource Timing] Gather timing information with reliable responseEnd time
https://bugs.webkit.org/show_bug.cgi?id=168351
Reviewed by Alex Christensen.
* wtf/persistence/Coders.h:
(WTF::Persistence::Coder<Seconds>::encode):
(WTF::Persistence::Coder<Seconds>::decode):
2017-02-22 Carlos Garcia Campos <cgarcia@igalia.com>
Better handle Thread and RunLoop initialization
https://bugs.webkit.org/show_bug.cgi?id=167828
Reviewed by Yusuke Suzuki.
Make initialization functions more independent so that they can run in different
order. WTF::initializeMainThread initializes WTF threading, so that neither WTF nor JSC theading need to be
initialized before. RunLoop::initializeMainRunLoop() requires main thread to be initialized in some
ports, so it initializes main thread too. WebKit1 always calls WTF::initializeMainThreadToProcessMainThread()
before RunLoop::initializeMainRunLoop() so there's no problem there. GC threads are initialized alwayas by the
main thread. The rules should be simpler now:
- JSC::initializeThreading: should always be called when JSC is used.
- WTF::initializeThreading: only needs to be explicitly called when JSC is not used and process doesn't
initialize a main thread or main run loop.
- WTF::initializeMainThread: only needs to be explicitly called if process initializes a main thread but not a
main run loop.
- WTF::initializeMainThreadToProcessMainThread(): should always be called in WebKit1 before
RunLoop::initializeMainRunLoop().
- RunLoop::initializeMainRunLoop(): to initialize the main run loop. The only requirement is JSC::initializeThreading()
to be called before if JSC is used.
* wtf/MainThread.cpp:
(WTF::initializeMainThreadOnce): Use pthread_once to initialize the main thread also in GTK+ port.
(WTF::initializeMainThreadToProcessMainThreadOnce): Call initializeThreading() before the platform
initialization and initializeGCThreads() after it.
(WTF::initializeMainThread): Ditto.
* wtf/RunLoop.cpp:
(WTF::RunLoop::initializeMainRunLoop): Call initializeMainThread().
* wtf/glib/MainThreadGLib.cpp:
(WTF::initializeMainThreadPlatform):
(WTF::isMainThread):
* wtf/mac/MainThreadMac.mm:
(WTF::initializeMainThreadPlatform): Remove call to initializeGCThreads().
(WTF::initializeMainThreadToProcessMainThreadPlatform): Ditto.
2017-02-22 Myles C. Maxfield <mmaxfield@apple.com>
[Cocoa] Remove Yosemite-specific font lookup code
https://bugs.webkit.org/show_bug.cgi?id=168682
Reviewed by Zalan Bujtas.
* wtf/Platform.h:
2017-02-22 Keith Miller <keith_miller@apple.com>
Remove the demand executable allocator
https://bugs.webkit.org/show_bug.cgi?id=168754
Reviewed by Saam Barati.
* wtf/Platform.h:
2017-02-22 Alex Christensen <achristensen@webkit.org>
Re-commit part of r212812 accidentally rolled out with r212841.
https://bugs.webkit.org/show_bug.cgi?id=167293
* wtf/Platform.h:
Use libwebrtc on Mac if webrtc is enabled.
2017-02-22 Alex Christensen <achristensen@webkit.org>
Fix ASAN build after activating libwebrtc.
* wtf/Ref.h:
__asan_address_is_poisoned returns an int, not a bool.
This didn't cause a problem before because we didn't include the real definition anywhere,
but libwebrtc includes <sanitizer/asan_interface.h> directly now so the return types need to be correct.
2017-02-22 Carlos Garcia Campos <cgarcia@igalia.com>
[GTK] Test fast/events/message-port-postMessage-recursive.html times out
https://bugs.webkit.org/show_bug.cgi?id=168570
Reviewed by Michael Catanzaro.
This has recently been added and the patch is good. It's just revealing a problem with our timers. The test is
posting a message recursively, and also starts a timeout timer to finish the test. The timeout timer is never
fired for us, because WebCore timers have lower priority than the one used by postMessage. ScriptExecutionContext
uses Document::postTask, that uses scheduleOnMainThread, that uses RunLoop::dispatch(). We are not setting any
priority for the timer used by RunLoop::dispatch, so it's using the default.
Use a RunLoop::Timer to schedule tasks to the main thread instead of using RunLoop::dispatch(). This allows us
to use a different priority, that is now set to G_PRIORITY_HIGH_IDLE + 20 to match WebCore timers. But it also
avoids the double queue we had with RunLoop::dispatch(), because scheduleOnMainThread() also queues the tasks.
* wtf/glib/MainThreadGLib.cpp:
(WTF::MainThreadDispatcher::MainThreadDispatcher):
(WTF::MainThreadDispatcher::schedule):
(WTF::MainThreadDispatcher::fired):
(WTF::scheduleDispatchFunctionsOnMainThread):
2017-02-21 Youenn Fablet <youenn@apple.com>
[WebRTC][Mac] Activate libwebrtc
https://bugs.webkit.org/show_bug.cgi?id=167293
Reviewed by Alex Christensen.
* wtf/Platform.h:
2017-02-20 Filip Pizlo <fpizlo@apple.com>
The collector thread should only start when the mutator doesn't have heap access
https://bugs.webkit.org/show_bug.cgi?id=167737
Reviewed by Keith Miller.
Extend the use of AbstractLocker so that we can use more locking idioms.
* wtf/AutomaticThread.cpp:
(WTF::AutomaticThreadCondition::notifyOne):
(WTF::AutomaticThreadCondition::notifyAll):
(WTF::AutomaticThreadCondition::add):
(WTF::AutomaticThreadCondition::remove):
(WTF::AutomaticThreadCondition::contains):
(WTF::AutomaticThread::AutomaticThread):
(WTF::AutomaticThread::tryStop):
(WTF::AutomaticThread::isWaiting):
(WTF::AutomaticThread::notify):
(WTF::AutomaticThread::start):
(WTF::AutomaticThread::threadIsStopping):
* wtf/AutomaticThread.h:
* wtf/NumberOfCores.cpp:
(WTF::numberOfProcessorCores):
* wtf/ParallelHelperPool.cpp:
(WTF::ParallelHelperClient::finish):
(WTF::ParallelHelperClient::claimTask):
(WTF::ParallelHelperPool::Thread::Thread):
(WTF::ParallelHelperPool::didMakeWorkAvailable):
(WTF::ParallelHelperPool::hasClientWithTask):
(WTF::ParallelHelperPool::getClientWithTask):
* wtf/ParallelHelperPool.h:
2017-02-21 Alex Christensen <achristensen@webkit.org>
Unreviewed, rolling out r212699.
Internal build not ready
Reverted changeset:
"[WebRTC][Mac] Activate libwebrtc"
https://bugs.webkit.org/show_bug.cgi?id=167293
http://trac.webkit.org/changeset/212699
2017-02-20 Youenn Fablet <youenn@apple.com>
[WebRTC][Mac] Activate libwebrtc
https://bugs.webkit.org/show_bug.cgi?id=167293
Reviewed by Alex Christensen.
* wtf/Platform.h:
2017-02-20 Mark Lam <mark.lam@apple.com>
[Re-landing] CachedCall should let GC know to keep its arguments alive.
https://bugs.webkit.org/show_bug.cgi?id=168567
<rdar://problem/30475767>
Reviewed by Saam Barati.
Added a WTF_FORBID_HEAP_ALLOCATION that will cause a compilation failure if
a class declared with it is malloced.
While this doesn't prevent that class declared WTF_FORBID_HEAP_ALLOCATION from
being embedded in another class that is heap allocated, it does at minimum
document the intent and gives the users of this class a chance to do the
right thing.
* WTF.xcodeproj/project.pbxproj:
* wtf/ForbidHeapAllocation.h: Added.
2017-02-20 Ryan Haddad <ryanhaddad@apple.com>
Unreviewed, rolling out r212685.
This change broke the 32-bit Sierra build.
Reverted changeset:
"Resource Load Statistics: Add alternate classification
method"
https://bugs.webkit.org/show_bug.cgi?id=168347
http://trac.webkit.org/changeset/212685
2017-02-20 John Wilander <wilander@apple.com>
Resource Load Statistics: Add alternate classification method
https://bugs.webkit.org/show_bug.cgi?id=168347
<rdar://problem/30352793>
Reviewed by Alex Christensen.
* wtf/Platform.h:
Added support for HAVE(CORE_PREDICTION).
2017-02-20 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r212618.
https://bugs.webkit.org/show_bug.cgi?id=168609
"Appears to cause PLT regression" (Requested by mlam on
#webkit).
Reverted changeset:
"CachedCall should let GC know to keep its arguments alive."
https://bugs.webkit.org/show_bug.cgi?id=168567
http://trac.webkit.org/changeset/212618
2017-02-20 Carlos Garcia Campos <cgarcia@igalia.com>
Unreviewed, rolling out r212622.
Caused several test failures
Reverted changeset:
"[GTK] Test fast/events/message-port-postMessage-
recursive.html times out"
https://bugs.webkit.org/show_bug.cgi?id=168570
http://trac.webkit.org/changeset/212622
2017-02-19 Carlos Garcia Campos <cgarcia@igalia.com>
[GTK] Test fast/events/message-port-postMessage-recursive.html times out
https://bugs.webkit.org/show_bug.cgi?id=168570
Reviewed by Michael Catanzaro.
This has recently been added and the patch is good. It's just revealing a problem with our timers. The test is
posting a message recursively, and also starts a timeout timer to finish the test. The timeout timer is never
fired for us, because WebCore timers have lower priority than the one used by
postMessage. ScriptExecutionContext uses Document::postTask, that uses scheduleOnMainThread, that uses
RunLoop::dispatch(). We are not setting any priority for the timer used by RunLoop::dispatch, so it's using the
default. RunLoop::dispatch is normally used to schedule tasks between threads, or just to ensure something is
run in a different run loop iteration, but in general nothing urgent as a graphics redraw or something like
that. It's quite common to use g_idle_add to schedule tasks between threads, so I think it makes sense to use
G_PRIORITY_DEFAULT_IDLE for the RunLoop timer.
* wtf/glib/RunLoopGLib.cpp:
(WTF::RunLoop::RunLoop):
2017-02-19 Mark Lam <mark.lam@apple.com>
CachedCall should let GC know to keep its arguments alive.
https://bugs.webkit.org/show_bug.cgi?id=168567
<rdar://problem/30475767>
Reviewed by Saam Barati.
Added a WTF_FORBID_HEAP_ALLOCATION that will cause a compilation failure if
a class declared with it is malloced.
While this doesn't prevent that class declared WTF_FORBID_HEAP_ALLOCATION from
being embedded in another class that is heap allocated, it does at minimum
document the intent and gives the users of this class a chance to do the
right thing.
* WTF.xcodeproj/project.pbxproj:
* wtf/ForbidHeapAllocation.h: Added.
2017-02-19 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r212466.
https://bugs.webkit.org/show_bug.cgi?id=168577
causes crashes on AArch64 on linux, maybe it's causing crashes
on iOS too (Requested by pizlo on #webkit).
Reverted changeset:
"The collector thread should only start when the mutator
doesn't have heap access"
https://bugs.webkit.org/show_bug.cgi?id=167737
http://trac.webkit.org/changeset/212466
2017-02-18 Chris Dumez <cdumez@apple.com>
Recursive MessagePort.postMessage() calls causes tab to become unresponsive
https://bugs.webkit.org/show_bug.cgi?id=168548
<rdar://problem/29808005>
Reviewed by Darin Adler.
Add API to retrieve all messages in the queue at once.
* wtf/MessageQueue.h:
2017-02-16 Alex Christensen <achristensen@webkit.org>
Remove EFL-specific files in Source.
Rubber-stamped by Anders Carlsson.
* wtf/text/efl: Removed.
* wtf/text/efl/TextBreakIteratorInternalICUEfl.cpp: Removed.
2017-02-10 Filip Pizlo <fpizlo@apple.com>
The collector thread should only start when the mutator doesn't have heap access
https://bugs.webkit.org/show_bug.cgi?id=167737
Reviewed by Keith Miller.
Extend the use of AbstractLocker so that we can use more locking idioms.
* wtf/AutomaticThread.cpp:
(WTF::AutomaticThreadCondition::notifyOne):
(WTF::AutomaticThreadCondition::notifyAll):
(WTF::AutomaticThreadCondition::add):
(WTF::AutomaticThreadCondition::remove):
(WTF::AutomaticThreadCondition::contains):
(WTF::AutomaticThread::AutomaticThread):
(WTF::AutomaticThread::tryStop):
(WTF::AutomaticThread::isWaiting):
(WTF::AutomaticThread::notify):
(WTF::AutomaticThread::start):
(WTF::AutomaticThread::threadIsStopping):
* wtf/AutomaticThread.h:
* wtf/NumberOfCores.cpp:
(WTF::numberOfProcessorCores): Allow this to be overridden for testing.
* wtf/ParallelHelperPool.cpp:
(WTF::ParallelHelperClient::finish):
(WTF::ParallelHelperClient::claimTask):
(WTF::ParallelHelperPool::Thread::Thread):
(WTF::ParallelHelperPool::didMakeWorkAvailable):
(WTF::ParallelHelperPool::hasClientWithTask):
(WTF::ParallelHelperPool::getClientWithTask):
* wtf/ParallelHelperPool.h:
2017-02-16 Anders Carlsson <andersca@apple.com>
Remove EFL from WTF
https://bugs.webkit.org/show_bug.cgi?id=168452
Reviewed by Alex Christensen.
* wtf/CurrentTime.cpp:
* wtf/DisallowCType.h:
* wtf/FeatureDefines.h:
* wtf/MainThread.cpp:
* wtf/MainThread.h:
* wtf/Platform.h:
* wtf/RunLoop.h:
* wtf/WorkQueue.h:
* wtf/efl/DispatchQueueEfl.cpp: Removed.
* wtf/efl/DispatchQueueEfl.h: Removed.
* wtf/efl/DispatchQueueWorkItemEfl.h: Removed.
* wtf/efl/EflTypedefs.h: Removed.
* wtf/efl/MainThreadEfl.cpp: Removed.
* wtf/efl/RunLoopEfl.cpp: Removed.
* wtf/efl/UniquePtrEfl.h: Removed.
* wtf/efl/WorkQueueEfl.cpp: Removed.
2017-02-13 Alex Christensen <achristensen@webkit.org>
URLs with an invalid IPv4 address should be invalid
https://bugs.webkit.org/show_bug.cgi?id=168260
Reviewed by Tim Horton.
* wtf/Expected.h:
(WTF::Expected::value):
Added missing WTFMove for rvalue Expected::value().
2017-02-13 Said Abou-Hallawa <sabouhallawa@apple.com>
The current frame of an image should not deleted if another frame is asynchronously being decoded
https://bugs.webkit.org/show_bug.cgi?id=167618
Reviewed by Simon Fraser.
Add ASSERT_IMPLIES() which should fire when a condition is true but the
assertion is false.
* wtf/Assertions.h:
2017-02-13 Brady Eidson <beidson@apple.com>
Followup to: Replace all WebKit Library Version checks in WK2 with SDK version checks.
https://bugs.webkit.org/show_bug.cgi?id=168124
Reviewed by Geoffrey Garen.
* wtf/spi/darwin/dyldSPI.h:
2017-02-13 Myles C. Maxfield <mmaxfield@apple.com>
Update custom line breaking iterators to the latest version of Unicode
https://bugs.webkit.org/show_bug.cgi?id=168182
Reviewed by Zalan Bujtas.
ICU 55.1 supports loose / normal / strict line breaking rules. The oldest platform we ship
on has a version of ICU >= that one. Therefore, we don't need to compile our own rules;
we can just use ICU's rules.
* wtf/text/LineBreakIteratorPoolICU.h:
(WTF::LineBreakIteratorPool::makeLocaleWithBreakKeyword):
(WTF::LineBreakIteratorPool::take):
* wtf/text/TextBreakIterator.cpp:
(WTF::acquireLineBreakIterator):
(WTF::openLineBreakIterator):
(WTF::mapLineIteratorModeToRules): Deleted.
(WTF::isCJKLocale): Deleted.
* wtf/text/TextBreakIterator.h:
(WTF::LazyLineBreakIterator::LazyLineBreakIterator):
(WTF::LazyLineBreakIterator::mode):
(WTF::LazyLineBreakIterator::get):
(WTF::LazyLineBreakIterator::resetStringAndReleaseIterator):
(WTF::LazyLineBreakIterator::isLooseCJKMode): Deleted.
2017-02-10 Dan Bernstein <mitz@apple.com>
[Xcode] WTF installs extra copies of two headers outside /usr/local/include/wtf
https://bugs.webkit.org/show_bug.cgi?id=168160
Reviewed by Sam Weinig.
* WTF.xcodeproj/project.pbxproj: Demoted OrdinalNumber.h MemoryFootprint.h from Private to
Project.
2017-02-10 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r212139.
https://bugs.webkit.org/show_bug.cgi?id=168152
Caused some assertions (Requested by JoePeck on #webkit).
Reverted changeset:
"Fix misleading comment in RunLoop.h"
https://bugs.webkit.org/show_bug.cgi?id=167832
http://trac.webkit.org/changeset/212139
2017-02-10 Joseph Pecoraro <pecoraro@apple.com>
Fix misleading comment in RunLoop.h
https://bugs.webkit.org/show_bug.cgi?id=167832
Reviewed by Sam Weinig.
* wtf/RunLoop.h:
Mac initialization used to force using CFRunLoopGetMain(). Now however it just
uses RunLoop::current which uses CFRunLoopGetCurrent(). So this comment that
it can be done on any thread is misleading and can lead to incorrect behavior
if it is actually done on a non-main thread on Mac.
2017-02-09 Alex Christensen <achristensen@webkit.org>
Unreviewed, rolling out r212040.
Broke build. I'm not surprised
Reverted changeset:
"[WebRTC][Mac] Activate libwebrtc"
https://bugs.webkit.org/show_bug.cgi?id=167293
http://trac.webkit.org/changeset/212040
2017-02-09 Youenn Fablet <youenn@apple.com>
[WebRTC][Mac] Activate libwebrtc
https://bugs.webkit.org/show_bug.cgi?id=167293
Reviewed by Alex Christensen.
* wtf/Platform.h:
2017-02-09 Brady Eidson <beidson@apple.com>
Transition "WebKit Library Version" checks to SDK version checks.
<rdar://problem/30313696> and https://bugs.webkit.org/show_bug.cgi?id=168056
Reviewed by Geoffrey Garen.
* wtf/spi/darwin/dyldSPI.h: Add entries for the iOS 10.3, macOS 10.11, and macOS 10.12.4 SDKs.
2017-02-09 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r211980 and r211987.
https://bugs.webkit.org/show_bug.cgi?id=168072
Caused API test WebKit2.DuplicateCompletionHandlerCalls to
fail (Requested by ryanhaddad on #webkit).
Reverted changesets:
"Transition "WebKit Library Version" checks to SDK version
checks."
https://bugs.webkit.org/show_bug.cgi?id=168056
http://trac.webkit.org/changeset/211980
"Build fix for APPLE_INTERNAL_SDK builds after r211980."
http://trac.webkit.org/changeset/211987
2017-02-09 Alexey Proskuryakov <ap@apple.com>
Remove unused WebThreadRunSync
https://bugs.webkit.org/show_bug.cgi?id=168024
Reviewed by Tim Horton.
* wtf/ios/WebCoreThread.cpp:
* wtf/ios/WebCoreThread.h:
2017-02-09 Brady Eidson <beidson@apple.com>
Build fix for APPLE_INTERNAL_SDK builds after r211980.
Unreviewed.
* wtf/spi/darwin/dyldSPI.h:
2017-02-09 Brady Eidson <beidson@apple.com>
Transition "WebKit Library Version" checks to SDK version checks.
<rdar://problem/30313696> and https://bugs.webkit.org/show_bug.cgi?id=168056
Reviewed by Geoffrey Garen.
* wtf/spi/darwin/dyldSPI.h: Add entries for the iOS 10.3, macOS 10.11, and macOS 10.12.4 SDKs.
2017-02-06 Jer Noble <jer.noble@apple.com>
Playback stalls when a SourceBuffer append causes frame eviction
https://bugs.webkit.org/show_bug.cgi?id=167834
Reviewed by Eric Carlson.
Optimize the MediaTime class; specifically the compare() method. The class only
needs 6 bits to store the TimeFlags, so make that a uint8_t rather than uint32_t.
The implementation is slightly simpler if the TimeScale is unsigned, so make that
a uint32_t rather than int32_t. Inline the comparison operators. Optimize the equality
comparison by bitwise-and'ing the flags together and masking the result. Optimize for
common comparison scenarios (equal timeScales, equal timeValues(), etc.). Attempt the
mathematically simpler simpler method for comparing ratios, and only fall back to the
complex method if the results of multiplying the timeScale by the timeValue overflows.
* wtf/MediaTime.cpp:
(WTF::greatestCommonDivisor):
(WTF::leastCommonMultiple):
(WTF::signum):
(WTF::MediaTime::MediaTime):
(WTF::MediaTime::createWithFloat):
(WTF::MediaTime::createWithDouble):
(WTF::MediaTime::operator+):
(WTF::MediaTime::operator-):
(WTF::MediaTime::operator!):
(WTF::MediaTime::operator bool):
(WTF::MediaTime::compare):
(WTF::MediaTime::setTimeScale):
(WTF::abs):
(WTF::MediaTime::operator<): Deleted.
(WTF::MediaTime::operator>): Deleted.
(WTF::MediaTime::operator!=): Deleted.
(WTF::MediaTime::operator==): Deleted.
(WTF::MediaTime::operator>=): Deleted.
(WTF::MediaTime::operator<=): Deleted.
* wtf/MediaTime.h:
2017-02-04 Michael Catanzaro <mcatanzaro@igalia.com>
[GTK] Fix huge ENABLE_RESOURCE_USAGE warning spam
Unreviewed. We shouldn't redefine ENABLE_RESOURCE_USAGE in Platform.h as
it's already defined in cmakeconfig.h.
* wtf/Platform.h:
2017-02-03 Joseph Pecoraro <pecoraro@apple.com>
Performance Timing: Convert WTF::MonotonicTime and WTF::Seconds
https://bugs.webkit.org/show_bug.cgi?id=167768
Reviewed by Geoffrey Garen.
* wtf/Stopwatch.h:
(WTF::Stopwatch::elapsedTimeSince):
(WTF::Stopwatch::elapsedTimeSinceMonotonicTime): Deleted.
2017-02-03 Carlos Garcia Campos <cgarcia@igalia.com>
[GTK] Add initial implementation of resource usage overlay
https://bugs.webkit.org/show_bug.cgi?id=167731
Reviewed by Michael Catanzaro.
Enable RESOURCE_USAGE for GTK+ port too.
* wtf/Platform.h:
2017-02-02 Andreas Kling <akling@apple.com>
[Mac] In-process memory pressure monitor for WebContent processes AKA websam
<https://webkit.org/b/167491>
<rdar://problem/30116072>
Reviewed by Antti Koivisto.
Add a WTF helper function for getting the current process's memory footprint.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/MemoryFootprint.cpp:
(WTF::memoryFootprint):
* wtf/MemoryFootprint.h:
2017-02-02 Mark Lam <mark.lam@apple.com>
Add a SIGILL crash analyzer to make debugging SIGILLs easier.
https://bugs.webkit.org/show_bug.cgi?id=167714
<rdar://problem/30318237>
Reviewed by Filip Pizlo.
* wtf/StdLibExtras.h:
2017-02-02 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r211571 and r211582.
https://bugs.webkit.org/show_bug.cgi?id=167751
This change caused API test WebKit1.MemoryPressureHandler to
fail with an assertion. (Requested by ryanhaddad on #webkit).
Reverted changesets:
"[Mac] In-process memory pressure monitor for WebContent
processes."
https://bugs.webkit.org/show_bug.cgi?id=167491
http://trac.webkit.org/changeset/211571
"Unreviewed attempt to fix the Windows build after r211571."
http://trac.webkit.org/changeset/211582
2017-02-02 Andreas Kling <akling@apple.com>
[Mac] In-process memory pressure monitor for WebContent processes.
<https://webkit.org/b/167491>
<rdar://problem/30116072>
Reviewed by Antti Koivisto.
Add a WTF helper function for getting the current process's memory footprint.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/MemoryFootprint.cpp:
(WTF::memoryFootprint):
* wtf/MemoryFootprint.h:
2017-02-01 Wenson Hsieh <wenson_hsieh@apple.com>
Unreviewed, fix the WebKit nightly open source build
<rdar://problem/30308635>
We cannot assume all internal SDKs have the latest WebKitAdditions, so we need an explicit header check here.
* wtf/Platform.h:
2017-02-01 Andreas Kling <akling@apple.com>
Implement the alwaysRunsAtBackgroundPriority WK2 setting using thread QoS.
<https://webkit.org/b/167387>
<rdar://problem/29711409>
Reviewed by Antti Koivisto.
Add a new mechanism for overriding the max thread QoS level globally:
void setGlobalMaxQOSClass(qos_class_t)
qos_class_t adjustedQOSClass(qos_class_t)
The QoS cap applies to all newly created threads, threads that try to override
their QoS class manually, and also passed down to bmalloc.
* wtf/Threading.cpp:
(WTF::setCurrentThreadIsUserInteractive):
(WTF::setCurrentThreadIsUserInitiated):
(WTF::setGlobalMaxQOSClass):
(WTF::adjustedQOSClass):
* wtf/Threading.h:
* wtf/ThreadingPthreads.cpp:
(WTF::createThreadInternal):
* wtf/cocoa/WorkQueueCocoa.cpp:
(WTF::dispatchQOSClass):
2017-01-31 Antti Koivisto <antti@apple.com>
Teach cache coders to encode time_points
https://bugs.webkit.org/show_bug.cgi?id=167670
Reviewed by Andreas Kling.
* wtf/persistence/Coders.h:
(WTF::Persistence::Coder<std::chrono::system_clock::time_point>::encode):
(WTF::Persistence::Coder<std::chrono::system_clock::time_point>::decode):
2017-01-31 Joseph Pecoraro <pecoraro@apple.com>
Removed unused m_nestedCount from RunLoop
https://bugs.webkit.org/show_bug.cgi?id=167674
Reviewed by Sam Weinig.
* wtf/RunLoop.h:
* wtf/cf/RunLoopCF.cpp:
(WTF::RunLoop::RunLoop):
(WTF::RunLoop::run):
2017-01-31 Filip Pizlo <fpizlo@apple.com>
The mutator should be able to perform increments of GC work
https://bugs.webkit.org/show_bug.cgi?id=167528
Reviewed by Keith Miller and Geoffrey Garen.
We want dataLog to be locked even if you're not logging to a file!
* wtf/DataLog.cpp:
(WTF::initializeLogFileOnce):
2017-01-28 Wenson Hsieh <wenson_hsieh@apple.com>
Check USE(APPLE_INTERNAL_SDK) instead of specific headers when importing from WebKitAdditions
https://bugs.webkit.org/show_bug.cgi?id=167555
Reviewed by Dan Bernstein.
Instead of guarding #import <WebKitAdditions/*> on the existence of the imported file, consult
USE(APPLE_INTERNAL_SDK) instead.
* wtf/Platform.h:
2017-01-26 Saam Barati <sbarati@apple.com>
Harden how the compiler references GC objects
https://bugs.webkit.org/show_bug.cgi?id=167277
<rdar://problem/30179506>
Reviewed by Filip Pizlo.
I made TinyPtrSet use bitwise_cast instead of static_cast
for its singleEntry() function so that it can work on pointer-like
types just as it can on actual pointer types.
An example of where this matters is when you have TinyPtrSet<T>
where T is defined to be a struct which wraps a pointer, e.g:
struct T {
void* m_pointer;
}
* wtf/TinyPtrSet.h:
(WTF::TinyPtrSet::singleEntry):
2017-01-25 Wenson Hsieh <wenson_hsieh@apple.com>
Introduce an item-provider-based pasteboard wrapper
https://bugs.webkit.org/show_bug.cgi?id=167410
Reviewed by Enrica Casucci.
Adds an additional feature flag.
* wtf/FeatureDefines.h:
2017-01-25 Konstantin Tokarev <annulen@yandex.ru>
Removed leftovers of pre-2015 VisualStudio support
https://bugs.webkit.org/show_bug.cgi?id=167434
Reviewed by Alex Christensen.
* wtf/Compiler.h:
* wtf/Platform.h:
* wtf/StringExtras.h:
2017-01-25 Chris Dumez <cdumez@apple.com>
Disable Download attribute support on iOS
https://bugs.webkit.org/show_bug.cgi?id=167337
<rdar://problem/30154148>
Reviewed by Alexey Proskuryakov.
Disable Download attribute support on iOS as it currently does not work.
* wtf/FeatureDefines.h:
2017-01-25 Wenson Hsieh <wenson_hsieh@apple.com>
Add a hook to include additional feature defines
https://bugs.webkit.org/show_bug.cgi?id=167403
Reviewed by Enrica Casucci.
* wtf/Platform.h: Include AdditionalFeatureDefines.h, if it exists.
2017-01-24 Joseph Pecoraro <pecoraro@apple.com>
Fold USER_TIMING into WEB_TIMING and make it a RuntimeEnabledFeature
https://bugs.webkit.org/show_bug.cgi?id=167394
Reviewed by Ryosuke Niwa.
* wtf/FeatureDefines.h:
2017-01-24 Konstantin Tokarev <annulen@yandex.ru>
VS2015 supports ref qualifiers
https://bugs.webkit.org/show_bug.cgi?id=167368
Reviewed by Sam Weinig.
* wtf/Compiler.h: Enable
WTF_COMPILER_SUPPORTS_CXX_REFERENCE_QUALIFIED_FUNCTIONS for VS2015
2017-01-24 Daniel Bates <dabates@apple.com>
StringView.split() should use an iterator design pattern instead of allocating a Vector
https://bugs.webkit.org/show_bug.cgi?id=163225
Reviewed by Darin Adler.
Implement StringView.split() using an iterator design.
Using an iterator design avoids the need to allocate a Vector of StringView objects,
which is space-inefficient and error prone as the returned Vector may outlive the
lifetime of the underlying string associated with the split (as StringView is a non-
owning reference to a string).
StringView.split() now returns a StringView::SplitResult object that implements begin()/end()
to support iterating over StringView substrings delimited by the specified separator
character. For example, to iterate over the 'c'-separated substrings of a StringView v,
you can write:
for (StringView substring : v.split('c'))
// Do something with substring.
* wtf/text/StringView.cpp:
(WTF::StringView::SplitResult::Iterator::findNextSubstring): Advances the iterator to point to the
next substring.
(WTF::StringView::split): Modified to return a SplitResult::Iterator object instead of a Vector<StringView>.
* wtf/text/StringView.h:
(WTF::StringView::SplitResult::SplitResult):
(WTF::StringView::SplitResult::Iterator::Iterator):
(WTF::StringView::SplitResult::Iterator::operator*):
(WTF::StringView::SplitResult::Iterator::operator==):
(WTF::StringView::SplitResult::Iterator::operator!=):
Implements the iterator interface.
2017-01-20 Joseph Pecoraro <pecoraro@apple.com>
Remove outdated ENABLE(CSP_NEXT) build flag
https://bugs.webkit.org/show_bug.cgi?id=167252
Reviewed by Brent Fulgham.
* wtf/FeatureDefines.h:
2017-01-17 Andreas Kling <akling@apple.com>
Annotate FastMalloc functions with returns_nonnull attribute.
<https://webkit.org/b/167144>
Reviewed by Antti Koivisto.
Decorate fastMalloc() and friends with __attribute__((returns_nonnull)) for supporting
compilers that can do useful things with that information.
* wtf/Compiler.h:
* wtf/FastMalloc.h:
2017-01-17 Joseph Pecoraro <pecoraro@apple.com>
ENABLE(USER_TIMING) Not Defined for Apple Windows or OS X Ports
https://bugs.webkit.org/show_bug.cgi?id=116551
<rdar://problem/13949830>
Reviewed by Alex Christensen.
* wtf/FeatureDefines.h:
2017-01-16 Joseph Pecoraro <pecoraro@apple.com>
Remove the REQUEST_ANIMATION_FRAME flag
https://bugs.webkit.org/show_bug.cgi?id=156980
<rdar://problem/25906849>
Reviewed by Simon Fraser.
* wtf/FeatureDefines.h:
2017-01-15 Sam Weinig <sam@webkit.org>
Add the ability to use numbers in makeString()
https://bugs.webkit.org/show_bug.cgi?id=167087
Reviewed by Darin Adler.
Allow numbers to be easily used in makeString() and tryMakeString().
For instance, you can now write:
int amount = 7;
auto foo = makeString("There are ", amount, " apples in the cart");
* WTF.xcodeproj/project.pbxproj:
Add new file.
* wtf/text/IntegerToStringConversion.h:
(WTF::writeNumberToBufferImpl):
(WTF::writeNumberToBufferSigned):
(WTF::writeNumberToBufferUnsigned):
(WTF::lengthOfNumberAsStringImpl):
(WTF::lengthOfNumberAsStringSigned):
(WTF::lengthOfNumberAsStringUnsigned):
Add variants of integer writing code that compute the length of the string
that would be produced and writes the string to an existing buffer.
(WTF::IntegerToStringConversionTrait<AtomicString>::flush): Deleted.
(WTF::IntegerToStringConversionTrait<String>::flush): Deleted.
(WTF::IntegerToStringConversionTrait<StringBuilder>::flush): Deleted.
Move these traits to their respective classes.
* wtf/text/AtomicString.h:
(WTF::IntegerToStringConversionTrait<AtomicString>::flush):
* wtf/text/StringBuilder.h:
(WTF::IntegerToStringConversionTrait<StringBuilder>::flush):
* wtf/text/WTFString.h:
(WTF::IntegerToStringConversionTrait<String>::flush):
Traits moved here from IntegerToStringConversion.h
* wtf/text/StringConcatenateNumbers.h: Added.
(WTF::StringTypeAdapter<int>::StringTypeAdapter<int>):
(WTF::StringTypeAdapter<int>::length):
(WTF::StringTypeAdapter<int>::is8Bit):
(WTF::StringTypeAdapter<int>::writeTo):
(WTF::StringTypeAdapter<int>::toString):
(WTF::StringTypeAdapter<unsigned>::StringTypeAdapter<unsigned>):
(WTF::StringTypeAdapter<unsigned>::length):
(WTF::StringTypeAdapter<unsigned>::is8Bit):
(WTF::StringTypeAdapter<unsigned>::writeTo):
(WTF::StringTypeAdapter<unsigned>::toString):
(WTF::StringTypeAdapter<float>::StringTypeAdapter<float>):
(WTF::StringTypeAdapter<float>::length):
(WTF::StringTypeAdapter<float>::is8Bit):
(WTF::StringTypeAdapter<float>::writeTo):
(WTF::StringTypeAdapter<float>::toString):
(WTF::StringTypeAdapter<double>::StringTypeAdapter<double>):
(WTF::StringTypeAdapter<double>::length):
(WTF::StringTypeAdapter<double>::is8Bit):
(WTF::StringTypeAdapter<double>::writeTo):
(WTF::StringTypeAdapter<double>::toString):
Add basic adaptors for int, unsigned, float, and double.
(WTF::FormattedNumber::fixedPrecision):
(WTF::FormattedNumber::fixedWidth):
(WTF::FormattedNumber::length):
(WTF::FormattedNumber::buffer):
(WTF::FormattedNumber::stringView):
(WTF::StringTypeAdapter<FormattedNumber>::StringTypeAdapter<FormattedNumber>):
(WTF::StringTypeAdapter<FormattedNumber>::length):
(WTF::StringTypeAdapter<FormattedNumber>::is8Bit):
(WTF::StringTypeAdapter<FormattedNumber>::writeTo):
(WTF::StringTypeAdapter<FormattedNumber>::toString):
Add a special class, FormattedNumber, and an adaptor for it, allowing for
fixedPrecision and fixedWidth representation of doubles.
2017-01-14 Yusuke Suzuki <utatane.tea@gmail.com>
WebAssembly: Suppress warnings & errors in GCC
https://bugs.webkit.org/show_bug.cgi?id=167049
Reviewed by Sam Weinig.
* wtf/LEBDecoder.h:
(WTF::LEBDecoder::decodeInt):
If T = int, it performs `-1 << shift`. It causes
warning in GCC. Instead, we first cast it to the
UnsignedT, perform operation and re-cast to the
T.
2017-01-13 Joseph Pecoraro <pecoraro@apple.com>
Remove ENABLE(DETAILS_ELEMENT) guards
https://bugs.webkit.org/show_bug.cgi?id=167042
Reviewed by Alex Christensen.
* wtf/FeatureDefines.h:
2017-01-11 Darin Adler <darin@apple.com>
Remove PassRefPtr from more of "platform"
https://bugs.webkit.org/show_bug.cgi?id=166809
Reviewed by Sam Weinig.
* wtf/Ref.h: Changed the template so that a const Ref<T> does not prohibit non-const
use of T. We can still use const Ref<const T> to express that. The earlier design
was intentional, but was not consistent with either actual references or with
other smart pointer classes like RefPtr. One way to see how much better this is,
is to see all the many, many cases where we have const_cast just to work around
this. I searched for those and included fixes for many in this patch.
2017-01-12 Chris Dumez <cdumez@apple.com>
[iOS] Implement support for KeyboardEvent.code
https://bugs.webkit.org/show_bug.cgi?id=166932
<rdar://problem/29972518>
Reviewed by Darin Adler.
Enable KEYBOARD_CODE_ATTRIBUTE feature on iOS.
* wtf/FeatureDefines.h:
2017-01-11 Andreas Kling <akling@apple.com>
Crash when WebCore's GC heap grows way too large.
<https://webkit.org/b/166875>
<rdar://problem/27896585>
Reviewed by Mark Lam.
Publish the WTF::GB constant.
* wtf/StdLibExtras.h:
2017-01-11 Anders Carlsson <andersca@apple.com>
navigator.plugins.refresh and WKContextRefreshPlugIns doesn't pick up changes to already-present plug-ins
https://bugs.webkit.org/show_bug.cgi?id=166942
rdar://problem/29839194
Reviewed by Sam Weinig.
* wtf/spi/cf/CFBundleSPI.h:
Add SPI declaration.
2017-01-06 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
[GTK] Should support key and code properties on keyboard events
https://bugs.webkit.org/show_bug.cgi?id=166759
Reviewed by Carlos Garcia Campos.
* wtf/FeatureDefines.h: enable key and code properties support for GTK.
2017-01-08 Antti Koivisto <antti@apple.com>
Move cache coders to WTF
https://bugs.webkit.org/show_bug.cgi?id=166825
Rubber-stamped by Sam Weinig.
Make it possible to use robust serialization of WTF types on the lower levels of the stack.
* WTF.xcodeproj/project.pbxproj:
* wtf/persistence: Added.
* wtf/persistence/Coder.h: Copied from Source/WebKit2/NetworkProcess/cache/NetworkCacheCoder.h.
(WebKit::NetworkCache::Coder::encode): Deleted.
(WebKit::NetworkCache::Coder::decode): Deleted.
* wtf/persistence/Coders.cpp: Copied from Source/WebKit2/NetworkProcess/cache/NetworkCacheCoders.cpp.
(WebKit::NetworkCache::Coder<AtomicString>::encode): Deleted.
(WebKit::NetworkCache::Coder<AtomicString>::decode): Deleted.
(WebKit::NetworkCache::Coder<CString>::encode): Deleted.
(WebKit::NetworkCache::Coder<CString>::decode): Deleted.
(WebKit::NetworkCache::Coder<String>::encode): Deleted.
(WebKit::NetworkCache::decodeStringText): Deleted.
(WebKit::NetworkCache::Coder<String>::decode): Deleted.
(WebKit::NetworkCache::Coder<SHA1::Digest>::encode): Deleted.
(WebKit::NetworkCache::Coder<SHA1::Digest>::decode): Deleted.
(WebKit::NetworkCache::Coder<WebCore::HTTPHeaderMap>::encode): Deleted.
(WebKit::NetworkCache::Coder<WebCore::HTTPHeaderMap>::decode): Deleted.
* wtf/persistence/Coders.h: Copied from Source/WebKit2/NetworkProcess/cache/NetworkCacheCoders.h.
(WebKit::NetworkCache::Coder<std::optional<T>>::encode): Deleted.
(WebKit::NetworkCache::Coder<std::optional<T>>::decode): Deleted.
* wtf/persistence/Decoder.cpp: Copied from Source/WebKit2/NetworkProcess/cache/NetworkCacheDecoder.cpp.
(WebKit::NetworkCache::Decoder::Decoder): Deleted.
(WebKit::NetworkCache::Decoder::~Decoder): Deleted.
(WebKit::NetworkCache::Decoder::bufferIsLargeEnoughToContain): Deleted.
(WebKit::NetworkCache::Decoder::decodeFixedLengthData): Deleted.
(WebKit::NetworkCache::Decoder::decodeNumber): Deleted.
(WebKit::NetworkCache::Decoder::decode): Deleted.
(WebKit::NetworkCache::Decoder::verifyChecksum): Deleted.
* wtf/persistence/Decoder.h: Copied from Source/WebKit2/NetworkProcess/cache/NetworkCacheDecoder.h.
(WebKit::NetworkCache::Decoder::length): Deleted.
(WebKit::NetworkCache::Decoder::currentOffset): Deleted.
(WebKit::NetworkCache::Decoder::decodeEnum): Deleted.
(WebKit::NetworkCache::Decoder::decode): Deleted.
(WebKit::NetworkCache::Decoder::bufferIsLargeEnoughToContain): Deleted.
* wtf/persistence/Encoder.cpp: Copied from Source/WebKit2/NetworkProcess/cache/NetworkCacheEncoder.cpp.
(WebKit::NetworkCache::Encoder::Encoder): Deleted.
(WebKit::NetworkCache::Encoder::~Encoder): Deleted.
(WebKit::NetworkCache::Encoder::grow): Deleted.
(WebKit::NetworkCache::Encoder::updateChecksumForData): Deleted.
(WebKit::NetworkCache::Encoder::encodeFixedLengthData): Deleted.
(WebKit::NetworkCache::Encoder::encodeNumber): Deleted.
(WebKit::NetworkCache::Encoder::encode): Deleted.
(WebKit::NetworkCache::Encoder::encodeChecksum): Deleted.
* wtf/persistence/Encoder.h: Copied from Source/WebKit2/NetworkProcess/cache/NetworkCacheEncoder.h.
(WebKit::NetworkCache::Encoder::encodeEnum): Deleted.
(WebKit::NetworkCache::Encoder::encode): Deleted.
(WebKit::NetworkCache::Encoder::operator<<): Deleted.
(WebKit::NetworkCache::Encoder::buffer): Deleted.
(WebKit::NetworkCache::Encoder::bufferSize): Deleted.
(WebKit::NetworkCache::Encoder::updateChecksumForNumber): Deleted.
2017-01-08 Konstantin Tokarev <annulen@yandex.ru>
Introduce CPU(X86_SSE2) instead of various SSE2 checks
https://bugs.webkit.org/show_bug.cgi?id=166808
Reviewed by Michael Catanzaro.
Now copyLCharsFromUCharSource can use SSE2 implementation on non-Darwin
OSes, and all SSE2 code paths are available for MSVC on x86 if /arch:SSE2
or higher is enabled, and for MSVC on x86_64.
* wtf/Platform.h:
* wtf/text/ASCIIFastPath.h:
(WTF::copyLCharsFromUCharSource):
2017-01-05 Myles C. Maxfield <mmaxfield@apple.com>
Carets can split up marriages and families
https://bugs.webkit.org/show_bug.cgi?id=166711
<rdar://problem/29019333>
Reviewed by Alex Christensen.
There are four code points which should be allowed to accept emoji modifiers:
- U+1F46A FAMILY
- U+1F46B MAN AND WOMAN HOLDING HANDS
- U+1F46C TWO MEN HOLDING HANDS
- U+1F46D TWO WOMEN HOLDING HANDS
Even though macOS's and iOS's emoji keyboard don't allow users to actually type
these combinations, we may still receive them from other platforms. We should
therefore treat these as joining sequences. Rendering isn't a problem because
the fonts accept the emoji modifiers, but our caret placement code isn't educated
about it. Currently, we treat these emoji groups as ligatures, allowing the caret
to be placed between the two code points, which visually shows as being horizontally
centered in the glyph. Instead, we should treat these code points as accepting
emoji modifiers.
Tests: editing/caret/emoji.html
editing/caret/ios/emoji.html
* wtf/text/TextBreakIterator.cpp:
(WTF::cursorMovementIterator):
2017-01-05 Filip Pizlo <fpizlo@apple.com>
AutomaticThread timeout shutdown leaves a small window where notify() would think that the thread is still running
https://bugs.webkit.org/show_bug.cgi?id=166742
Reviewed by Geoffrey Garen.
Remove the use of the RAII ThreadScope, since the use of RAII helped make this bug possible:
we'd do ~ThreadScope after we had done ~LockHolder, so in between when we decided to shut
down a thread and when it reported itself as being shut down, there was a window where a
notify() call would get confused.
Now, we run all thread shutdown stuff while the lock is held. We release the lock last. One
API implication is that threadWillStop becomes threadIsStopping and it's called while the
lock is held. This seems benign.
* wtf/AutomaticThread.cpp:
(WTF::AutomaticThread::start):
(WTF::AutomaticThread::threadIsStopping):
(WTF::AutomaticThread::ThreadScope::ThreadScope): Deleted.
(WTF::AutomaticThread::ThreadScope::~ThreadScope): Deleted.
(WTF::AutomaticThread::threadWillStop): Deleted.
* wtf/AutomaticThread.h:
2017-01-04 Darin Adler <darin@apple.com>
Remove PassRefPtr use from the "html" directory, other improvements
https://bugs.webkit.org/show_bug.cgi?id=166635
Reviewed by Alex Christensen.
* wtf/RefPtr.h:
(WTF::makeRefPtr): Added.
2017-01-04 Yusuke Suzuki <utatane.tea@gmail.com>
Unreviewed build fix after r210313
https://bugs.webkit.org/show_bug.cgi?id=166676
Revert `#pragma once` to ifdefs due to build failure.
* wtf/text/StringView.h:
2017-01-04 Yusuke Suzuki <utatane.tea@gmail.com>
Limit thread name appropriately
https://bugs.webkit.org/show_bug.cgi?id=166676
Reviewed by Sam Weinig.
In some platform, the max length of thread names are limited.
For example, the number of the max length is 32 in Windows and
16 in Linux. But the specified thread name is typically long
in WebKit like "com.apple.CoreIPC.ReceiveQueue"
We port the logic substring the thread name in
generic/WorkQueueGeneric.cpp to Threading. It retrieves the name
"ReceiveQueue" from "com.apple.CoreIPC.ReceiveQueue". And apply
the appropriate the thread name limit and use it on Linux and
Windows environment.
* wtf/Threading.cpp:
(WTF::normalizeThreadName):
(WTF::createThread):
* wtf/Threading.h:
* wtf/ThreadingPthreads.cpp:
(WTF::initializeCurrentThreadInternal):
* wtf/ThreadingWin.cpp:
(WTF::initializeCurrentThreadInternal):
* wtf/generic/WorkQueueGeneric.cpp:
(WorkQueue::platformInitialize):
* wtf/text/StringView.h:
(WTF::StringView::left):
(WTF::StringView::right):
(WTF::StringView::reverseFind):
2017-01-04 Sam Weinig <sam@webkit.org>
REGRESSION (r210257): com.apple.WebKit.WebContent.Development crashed in com.apple.WebCore: WebCore::ExceptionOr<WTF::Ref<WebCore::Database> >::operator= + 14
<rdar://problem/29866398>
* wtf/Expected.h:
(WTF::Expected::swap):
Add missing calls to destroy() when moving things over each other in a union.
2017-01-03 Yusuke Suzuki <utatane.tea@gmail.com>
Use prctl to name thread on Linux
https://bugs.webkit.org/show_bug.cgi?id=166663
Reviewed by Michael Catanzaro.
It is quite useful if we can name threads. This name will be shown in GDB.
While macOS uses pthread_setname_np, we can use prctl on Linux.
* wtf/ThreadingPthreads.cpp:
(WTF::initializeCurrentThreadInternal):
2017-01-03 Yusuke Suzuki <utatane.tea@gmail.com>
WorkQueueGeneric's platformInvalidate() can deadlock when called on the RunLoop's thread
https://bugs.webkit.org/show_bug.cgi?id=166645
Reviewed by Carlos Garcia Campos.
WorkQueue can be destroyed on its invoking thread itself.
The scenario is the following.
1. Create WorkQueue (in thread A).
2. Dispatch a task (in thread A, dispatching a task to thread B).
3. Deref in thread A.
4. The task is executed in thread B.
5. Deref in thread B.
6. The WorkQueue is destroyed, calling platformInvalidate in thread B.
In that case, if platformInvalidate waits thread B's termination, it causes deadlock.
We do not need to wait the thread termination.
* wtf/WorkQueue.h:
* wtf/generic/WorkQueueGeneric.cpp:
(WorkQueue::platformInitialize):
(WorkQueue::platformInvalidate):
2017-01-03 Sam Weinig <sam@webkit.org>
Make WTF::Expected support Ref template parameters
https://bugs.webkit.org/show_bug.cgi?id=166662
Reviewed by Alex Christensen.
Tests: Added to TestWebKitAPI/Expected.cpp
* wtf/Expected.h:
(WTF::UnexpectedType::value):
Add overloads based on this value type to allow getting at the value
as an rvalue for moving the error into the Expected.
(WTF::Expected::Expected):
Add overload that takes an ErrorType/UnexpectedType<ErrorType> as an rvalue.
(WTF::Expected::swap):
Move the temporary value/error rather than copying.
2017-01-02 Julien Brianceau <jbriance@cisco.com>
Remove sh4 specific code from JavaScriptCore
https://bugs.webkit.org/show_bug.cgi?id=166640
Reviewed by Filip Pizlo.
* wtf/Platform.h:
2017-01-02 Yusuke Suzuki <utatane.tea@gmail.com>
Leverage Substring to create new AtomicStringImpl for StaticStringImpl and SymbolImpl
https://bugs.webkit.org/show_bug.cgi?id=166636
Reviewed by Darin Adler.
Previously we always create the full atomic string if we need to create the same string
based on the given value. For example, when generating AtomicStringImpl from the SymbolImpl,
we need to create a new AtomicStringImpl since SymbolImpl never becomes `isAtomic() == true`.
But it is costly.
This patch leverages the substring system of StringImpl. Instead of allocating the completely
duplicate string, we create a substring StringImpl that shares the same content with the
base string.
* wtf/text/AtomicStringImpl.cpp:
(WTF::stringTable):
(WTF::addToStringTable):
(WTF::addSubstring):
(WTF::AtomicStringImpl::addSlowCase):
(WTF::AtomicStringImpl::remove):
(WTF::AtomicStringImpl::lookUpSlowCase):
* wtf/text/StringImpl.h:
(WTF::StringImpl::StaticStringImpl::operator StringImpl&):
2017-01-02 Yusuke Suzuki <utatane.tea@gmail.com>
Use StaticStringImpl instead of StaticASCIILiteral
https://bugs.webkit.org/show_bug.cgi?id=166586
Reviewed by Darin Adler.
It is more handy way to define static StringImpl. It calculates the length
and hash value by using the constexpr constructor and function. So we do
not need to calculate these things in Perl script.
And it allows us to use StaticStringImpl in the hand written C++ code.
Previously, we need to calculate the length and hash value by hand if we
would like to use StaticASCIILiteral in the hand written C++ code, and it
meant that we cannot use it at all in the hand written C++ code.
* wtf/text/AtomicStringImpl.cpp:
(WTF::AtomicStringImpl::addSlowCase):
(WTF::AtomicStringImpl::lookUpSlowCase):
* wtf/text/AtomicStringImpl.h:
* wtf/text/StringImpl.h:
* wtf/text/SymbolImpl.h:
* wtf/text/UniquedStringImpl.h:
2017-01-02 Andreas Kling <akling@apple.com>
Discard media controls JS/CSS caches under memory pressure.
<https://webkit.org/b/166639>
Reviewed by Antti Koivisto.
* wtf/text/WTFString.h:
(WTF::String::clearImplIfNotShared): Add a helper for clearing a String if the underlying
StringImpl is not referenced by anyone else.
2016-12-22 Mark Lam <mark.lam@apple.com>
De-duplicate finally blocks.
https://bugs.webkit.org/show_bug.cgi?id=160168
Reviewed by Saam Barati.
Added some methods to bring SegmentedVector closer to parity with Vector.
* wtf/SegmentedVector.h:
(WTF::SegmentedVector::first):
(WTF::SegmentedVector::last):
(WTF::SegmentedVector::takeLast):
2016-12-19 Mark Lam <mark.lam@apple.com>
Rolling out r209974 and r209952. They break some websites in mysterious ways. Step 2: Rollout r209952.
https://bugs.webkit.org/show_bug.cgi?id=166049
Not reviewed.
* wtf/SegmentedVector.h:
(WTF::SegmentedVector::last):
(WTF::SegmentedVector::first): Deleted.
(WTF::SegmentedVector::takeLast): Deleted.
2016-12-16 Mark Lam <mark.lam@apple.com>
Add predecessor info to dumps from JSC_dumpBytecodeLivenessResults=true.
https://bugs.webkit.org/show_bug.cgi?id=165958
Reviewed by Keith Miller.
Added some methods to bring SegmentedVector closer to parity with Vector.
* wtf/SegmentedVector.h:
(WTF::SegmentedVector::first):
(WTF::SegmentedVector::last):
(WTF::SegmentedVector::takeLast):
2016-12-16 Michael Saboff <msaboff@apple.com>
REGRESSION: HipChat and Mail sometimes hang beneath JSC::Heap::lastChanceToFinalize()
https://bugs.webkit.org/show_bug.cgi?id=165962
Reviewed by Filip Pizlo.
There is an inherent race in Condition::waitFor() where the timeout can happen just before
a notify from another thread.
Fixed this by adding a condition variable and flag to each AutomaticThread. The flag
is used to signify to a notifying thread that the thread is waiting. That flag is set
in the waiting thread before calling waitFor() and cleared by another thread when it
notifies the thread. The access to that flag happens when the lock is held.
Now the waiting thread checks if the flag after a timeout to see that it in fact should
proceed like a normal notification.
The added condition variable allows us to target a specific thread. We used to keep a list
of waiting threads, now we keep a list of all threads. To notify one thread, we look for
a waiting thread and notify it directly. If we can't find a waiting thread, we start a
sleeping thread.
We notify all threads by waking all waiting threads and starting all sleeping threads.
* wtf/AutomaticThread.cpp:
(WTF::AutomaticThreadCondition::notifyOne):
(WTF::AutomaticThreadCondition::notifyAll):
(WTF::AutomaticThread::isWaiting):
(WTF::AutomaticThread::notify):
(WTF::AutomaticThread::start):
* wtf/AutomaticThread.h:
2016-12-15 Myles C. Maxfield <mmaxfield@apple.com>
Unreviewed build fix after r209910
Unreviewed.
* wtf/Platform.h:
2016-12-15 Myles C. Maxfield <mmaxfield@apple.com>
Stop reinterpret_casting UBreakIterators to the undefined type TextBreakIterator
https://bugs.webkit.org/show_bug.cgi?id=165931
We have a class declaration for TextBreakIterator but no definition for it. When we
create an ICU UBreakIterator, we immediately reinterpret_cast it to this undefined
type, and pass it around our code inside WebCore. Then, whenever we want to actually
use this iterator, we reinterpret_cast it back to UBreakIterator. This is likely due
to some ports historically implementing breaking interators on top of other libraries
other than ICU; however, now, all ports use ICU. Because this internal type is not
helpful and just adds confusion, we should just call our breaking iterators what
they are: UBreakIterators.
This patch is a mechanical replacement of TextBreakIterator to UBreakIterator and
removes the functions we were calling which pass through directly to ubrk_*().
Reviewed by Alex Christensen.
* wtf/text/LineBreakIteratorPoolICU.h:
(WTF::LineBreakIteratorPool::take):
(WTF::LineBreakIteratorPool::put):
* wtf/text/StringView.cpp:
(WTF::StringView::GraphemeClusters::Iterator::Impl::computeIndexEnd):
* wtf/text/TextBreakIterator.cpp:
(WTF::initializeIterator):
(WTF::initializeIteratorWithRules):
(WTF::setTextForIterator):
(WTF::setContextAwareTextForIterator):
(WTF::wordBreakIterator):
(WTF::sentenceBreakIterator):
(WTF::cursorMovementIterator):
(WTF::acquireLineBreakIterator):
(WTF::releaseLineBreakIterator):
(WTF::openLineBreakIterator):
(WTF::closeLineBreakIterator):
(WTF::getNonSharedCharacterBreakIterator):
(WTF::cacheNonSharedCharacterBreakIterator):
(WTF::isWordTextBreak):
(WTF::numGraphemeClusters):
(WTF::numCharactersInGraphemeClusters):
(WTF::textBreakFirst): Deleted.
(WTF::textBreakLast): Deleted.
(WTF::textBreakNext): Deleted.
(WTF::textBreakPrevious): Deleted.
(WTF::textBreakPreceding): Deleted.
(WTF::textBreakFollowing): Deleted.
(WTF::textBreakCurrent): Deleted.
(WTF::isTextBreak): Deleted.
* wtf/text/TextBreakIterator.h:
(WTF::LazyLineBreakIterator::lastCharacter):
(WTF::LazyLineBreakIterator::secondToLastCharacter):
(WTF::LazyLineBreakIterator::setPriorContext):
(WTF::LazyLineBreakIterator::updatePriorContext):
(WTF::LazyLineBreakIterator::resetPriorContext):
(WTF::LazyLineBreakIterator::priorContextLength):
(WTF::LazyLineBreakIterator::get):
(WTF::NonSharedCharacterBreakIterator::operator UBreakIterator*):
(WTF::NonSharedCharacterBreakIterator::operator TextBreakIterator*): Deleted.
2016-12-15 Myles C. Maxfield <mmaxfield@apple.com>
Sort Xcode project files
https://bugs.webkit.org/show_bug.cgi?id=165937
Reviewed by Simon Fraser.
* WTF.xcodeproj/project.pbxproj:
2016-12-15 Konstantin Tokarev <annulen@yandex.ru>
Added missing override and final specifiers
https://bugs.webkit.org/show_bug.cgi?id=165903
Reviewed by Darin Adler.
* wtf/RunLoop.h:
2016-12-15 Yusuke Suzuki <utatane.tea@gmail.com>
[JSC] Optimize Kraken stringify
https://bugs.webkit.org/show_bug.cgi?id=165857
Reviewed by Darin Adler.
Kraken json-stringify-tinderbox performance heavily relies on StringBuilder::appendQuotedJSONString.
According to the result produced by Linux `perf`, it occupies 28% of execution time.
We tighten the hottest loop in the above function. We create the super fast path for non escaping case.
And add " and \ cases (since including " in the string is common). Then we fallback to the slow case.
It improves the performance 5.5% in Kraken json-stringify-tinderbox in MBP.
Performance result in my MBP (dandelion).
Collected 100 samples per benchmark/VM, with 100 VM invocations per benchmark. Emitted a call to gc()
between sample measurements. Used 1 benchmark iteration per VM invocation for warm-up. Used the
jsc-specific preciseTime() function to get microsecond-level timing. Reporting benchmark execution times
with 95% confidence intervals in milliseconds.
baseline patched
json-stringify-tinderbox 29.243+-0.241 ^ 27.701+-0.235 ^ definitely 1.0557x faster
<arithmetic> 29.243+-0.241 ^ 27.701+-0.235 ^ definitely 1.0557x faster
Performance result in my Linux laptop (hanayamata).
Collected 100 samples per benchmark/VM, with 100 VM invocations per benchmark. Emitted a call to gc()
between sample measurements. Used 1 benchmark iteration per VM invocation for warm-up. Used the
jsc-specific preciseTime() function to get microsecond-level timing. Reporting benchmark execution times
with 95% confidence intervals in milliseconds.
baseline patched
json-stringify-tinderbox 26.711+-0.475 ^ 25.255+-0.034 ^ definitely 1.0577x faster
<arithmetic> 26.711+-0.475 ^ 25.255+-0.034 ^ definitely 1.0577x faster
* wtf/text/StringBuilder.cpp:
(WTF::appendQuotedJSONStringInternalSlow):
(WTF::appendQuotedJSONStringInternal):
2016-12-14 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r209795.
https://bugs.webkit.org/show_bug.cgi?id=165853
rolled out the wrong revision (Requested by pizlo on #webkit).
Reverted changeset:
"MarkedBlock::marksConveyLivenessDuringMarking should take
into account collection scope"
https://bugs.webkit.org/show_bug.cgi?id=165741
http://trac.webkit.org/changeset/209795
2016-12-14 Enrique Ocaña González <eocanha@igalia.com>
REGRESSION(r207879-207891): [GStreamer] Introduced many layout test failures and crashes, bots exiting early
https://bugs.webkit.org/show_bug.cgi?id=164022
Reviewed by Xabier Rodriguez-Calvar.
* wtf/glib/GLibUtilities.h:
Added new macros to convert gulong to/from gpointer.
2016-12-14 Gavin Barraclough <barraclough@apple.com>
MarkedBlock::marksConveyLivenessDuringMarking should take into account collection scope
https://bugs.webkit.org/show_bug.cgi?id=165741
Unreviewed, re-landing this with fix (revert erroneous change to Options).
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/DataLog.cpp:
(WTF::initializeLogFileOnce):
(WTF::initializeLogFile):
(WTF::dataFile):
* wtf/DataLog.h:
* wtf/LockedPrintStream.cpp: Added.
(WTF::LockedPrintStream::LockedPrintStream):
(WTF::LockedPrintStream::~LockedPrintStream):
(WTF::LockedPrintStream::vprintf):
(WTF::LockedPrintStream::flush):
(WTF::LockedPrintStream::begin):
(WTF::LockedPrintStream::end):
* wtf/LockedPrintStream.h: Added.
* wtf/PrintStream.cpp:
(WTF::PrintStream::printfVariableFormat):
(WTF::PrintStream::begin):
(WTF::PrintStream::end):
* wtf/PrintStream.h:
(WTF::PrintStream::atomically):
(WTF::PrintStream::print):
(WTF::PrintStream::println):
(WTF::PrintStream::printImpl):
(WTF::>::unpack):
(WTF::FormatImpl::FormatImpl):
(WTF::FormatImpl::dump):
(WTF::format):
(WTF::printInternal):
* wtf/RecursiveLockAdapter.h: Added.
(WTF::RecursiveLockAdapter::RecursiveLockAdapter):
(WTF::RecursiveLockAdapter::lock):
(WTF::RecursiveLockAdapter::unlock):
(WTF::RecursiveLockAdapter::tryLock):
(WTF::RecursiveLockAdapter::isLocked):
* wtf/WordLock.cpp:
* wtf/WordLock.h:
2016-12-14 Gavin Barraclough <barraclough@apple.com>
MarkedBlock::marksConveyLivenessDuringMarking should take into account collection scope
https://bugs.webkit.org/show_bug.cgi?id=165741
Unreviewed rollout due to performance regression.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/DataLog.cpp:
(WTF::initializeLogFileOnce):
(WTF::initializeLogFile):
(WTF::dataFile):
* wtf/DataLog.h:
* wtf/LockedPrintStream.cpp: Removed.
* wtf/LockedPrintStream.h: Removed.
* wtf/PrintStream.cpp:
(WTF::PrintStream::printfVariableFormat): Deleted.
(WTF::PrintStream::begin): Deleted.
(WTF::PrintStream::end): Deleted.
* wtf/PrintStream.h:
(WTF::PrintStream::print):
(WTF::PrintStream::println):
(WTF::PrintStream::atomically): Deleted.
(WTF::PrintStream::printImpl): Deleted.
(): Deleted.
(WTF::>::unpack): Deleted.
(WTF::FormatImpl::FormatImpl): Deleted.
(WTF::FormatImpl::dump): Deleted.
(WTF::format): Deleted.
* wtf/RecursiveLockAdapter.h: Removed.
* wtf/WordLock.cpp:
* wtf/WordLock.h:
2016-12-13 JF Bastien <jfbastien@apple.com>
std::expected: fix rvalue forwarding issues
https://bugs.webkit.org/show_bug.cgi?id=165812
Reviewed by Mark Lam.
* wtf/Expected.h:
(WTF::UnexpectedType::UnexpectedType):
(WTF::ExpectedDetail::Base::Base):
(WTF::Expected::Expected):
2016-12-13 Chris Dumez <cdumez@apple.com>
Unreviewed, rolling out r209544.
Looks like r209489 did not cause the performance regression
after all
Reverted changeset:
"Unreviewed, rolling out r209489."
https://bugs.webkit.org/show_bug.cgi?id=165550
http://trac.webkit.org/changeset/209544
2016-12-13 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r209725.
https://bugs.webkit.org/show_bug.cgi?id=165811
"Broke ARMv7 builds" (Requested by msaboff on #webkit).
Reverted changeset:
"REGRESSION(r209653): speedometer crashes making virtual slow
path tailcalls"
https://bugs.webkit.org/show_bug.cgi?id=165748
http://trac.webkit.org/changeset/209725
2016-12-13 JF Bastien <jfbastien@apple.com>
[WTF] Turn tryMakeString(), makeString() into variadic templates
https://bugs.webkit.org/show_bug.cgi?id=147142
Reviewed by Mark Lam.
I wrote this patch while improving WebAssembly's error messages,
and only found this bug afterwards. My implementation does the
bare minimum to make this code variadic without changing
behavior. I think it's better to go with this baby step first, and
improve the code later.
Notable, for my WebAssembly patch I also taught the code to handle
integers and other types (including WebAssembly types). A
follow-up could rely on ADL magic to pretty-format these other
types.
* wtf/text/StringConcatenate.h:
(WTF::sumWithOverflow): This unconditionally does the sum for all
inputs, which the compiler is more likely to appreciate (because
it's the common case) compared to testing for overflow and bailing
on each addition
(WTF::are8Bit): are: the plural of is!
(WTF::makeStringAccumulator): accumulate strings
(WTF::tryMakeStringFromAdapters): a small helper which creates the string adapters
(WTF::tryMakeString): expose out of WTF, since it's part of this file's used API
(WTF::makeString): make it variadic
2016-12-13 Konstantin Tokarev <annulen@yandex.ru>
Unreviewed, silence -Wsuggest-attribute for GCC with pragmas
* wtf/PrintStream.cpp:
(WTF::PrintStream::printfVariableFormat):
2016-12-12 Michael Saboff <msaboff@apple.com>
REGRESSION(r209653): speedometer crashes making virtual slow path tailcalls
https://bugs.webkit.org/show_bug.cgi?id=165748
Reviewed by Filip Pizlo.
Rolling back in r209653, r209654, r209663, and r209673.
* wtf/Platform.h:
2016-12-12 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r209703.
https://bugs.webkit.org/show_bug.cgi?id=165749
Broke Apple builds (Requested by annulen|home on #webkit).
Reverted changeset:
"Unreviewed, use WTF_ATTRIBUTE_PRINTF instead of clang pragma"
http://trac.webkit.org/changeset/209703
2016-12-12 Konstantin Tokarev <annulen@yandex.ru>
Unreviewed, use WTF_ATTRIBUTE_PRINTF instead of clang pragma
* wtf/PrintStream.cpp:
(WTF::PrintStream::printfVariableFormat):
* wtf/PrintStream.h:
2016-12-11 Konstantin Tokarev <annulen@yandex.ru>
Unreviewed, guarded clang pragma with COMPILER(CLANG) to fix -Werror
* wtf/PrintStream.cpp:
(WTF::PrintStream::printfVariableFormat):
2016-12-11 Filip Pizlo <fpizlo@apple.com>
Change to use #pragma once (requested by Darin Adler).
* wtf/RecursiveLockAdapter.h:
2016-12-11 Filip Pizlo <fpizlo@apple.com>
Change to use #pragma once (requested by Darin Adler).
* wtf/LockedPrintStream.h:
2016-12-10 Filip Pizlo <fpizlo@apple.com>
MarkedBlock::marksConveyLivenessDuringMarking should take into account collection scope
https://bugs.webkit.org/show_bug.cgi?id=165741
Reviewed by Saam Barati.
To find this bug, I needed to seriously beef up our logging infrastructure.
It's now the case that:
dataLog(...);
will print its output atomically. This happens with some careful magic:
- dataFile() is now a LockedPrintStream that locks around print().
- The lock is a recursive lock via RecursiveLockAdapter<>, so if the dump methods end
up calling back into dataLog() then it just works. This is important: say the dump()
calls a getter that itself does logging, maybe because it's encountering badness and
wants to report it before crashing).
- The lock is a WordLock so that ParkingLot and Lock can keep using dataLog() for
debugging. We probably won't need to debug WordLock anytime soon - the algorithm is
so simple.
- LockedPrintStream::print(...) causes the print callbacks of its arguments to run on
the underlying PrintStream, so that you don't need to do recursive lock acquisition
on each individual argument and whatever printing it does recursively.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/DataLog.cpp:
(WTF::initializeLogFileOnce):
(WTF::initializeLogFile):
(WTF::dataFile):
* wtf/DataLog.h:
* wtf/LockedPrintStream.cpp: Added.
(WTF::LockedPrintStream::LockedPrintStream):
(WTF::LockedPrintStream::~LockedPrintStream):
(WTF::LockedPrintStream::vprintf):
(WTF::LockedPrintStream::flush):
(WTF::LockedPrintStream::begin):
(WTF::LockedPrintStream::end):
* wtf/LockedPrintStream.h: Added.
* wtf/PrintStream.cpp:
(WTF::PrintStream::printfVariableFormat):
(WTF::PrintStream::begin):
(WTF::PrintStream::end):
* wtf/PrintStream.h:
(WTF::PrintStream::atomically):
(WTF::PrintStream::print):
(WTF::PrintStream::println):
(WTF::PrintStream::printImpl):
(WTF::>::unpack):
(WTF::FormatImpl::FormatImpl):
(WTF::FormatImpl::dump):
(WTF::format):
(WTF::printInternal):
* wtf/RecursiveLockAdapter.h: Added.
(WTF::RecursiveLockAdapter::RecursiveLockAdapter):
(WTF::RecursiveLockAdapter::lock):
(WTF::RecursiveLockAdapter::unlock):
(WTF::RecursiveLockAdapter::tryLock):
(WTF::RecursiveLockAdapter::isLocked):
* wtf/WordLock.cpp:
* wtf/WordLock.h:
2016-12-11 Darin Adler <darin@apple.com>
Use std::vsnprintf instead of vasprintf
https://bugs.webkit.org/show_bug.cgi?id=165740
Reviewed by Sam Weinig.
* wtf/Platform.h: Remove HAVE_VASPRINTF.
* wtf/StringExtras.h: Change the vsnprintf workaround to be used only
in older versions of Visual Studio, since the problem it works around
was resolved in Visual Studio 2015.
2016-12-10 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r209653, r209654, r209663, and
r209673.
https://bugs.webkit.org/show_bug.cgi?id=165739
speedometer crashes (Requested by pizlo on #webkit).
Reverted changesets:
"JSVALUE64: Pass arguments in platform argument registers when
making JavaScript calls"
https://bugs.webkit.org/show_bug.cgi?id=160355
http://trac.webkit.org/changeset/209653
"Unreviewed build fix for 32 bit builds."
http://trac.webkit.org/changeset/209654
"Unreviewed build fix for the CLOOP after r209653"
http://trac.webkit.org/changeset/209663
"REGRESSION(r209653) Crash in CallFrameShuffler::snapshot()"
https://bugs.webkit.org/show_bug.cgi?id=165728
http://trac.webkit.org/changeset/209673
2016-12-10 Chris Dumez <cdumez@apple.com>
Avoid calling shrink() in the Vector destructor
https://bugs.webkit.org/show_bug.cgi?id=165675
Reviewed by Daniel Bates.
Avoid calling shrink() in the Vector destructor to avoid function call
overhead and unnecessarily reseting m_size to 0.
* wtf/Vector.h:
(WTF::Vector::~Vector):
(WTF::Vector::asanSetBufferSizeToFullCapacity):
(WTF::minCapacity>::asanSetBufferSizeToFullCapacity):
2016-12-09 Michael Saboff <msaboff@apple.com>
JSVALUE64: Pass arguments in platform argument registers when making JavaScript calls
https://bugs.webkit.org/show_bug.cgi?id=160355
Reviewed by Filip Pizlo.
Added a new build option ENABLE_VM_COUNTERS to enable JIT'able counters.
The default is for the option to be off.
* wtf/Platform.h:
Added ENABLE_VM_COUNTERS
2016-12-09 Geoffrey Garen <ggaren@apple.com>
Deploy OrdinalNumber in JSC::SourceCode
https://bugs.webkit.org/show_bug.cgi?id=165687
Reviewed by Michael Saboff.
* wtf/text/OrdinalNumber.h:
(WTF::OrdinalNumber::operator>): Added a >.
2016-12-09 Geoffrey Garen <ggaren@apple.com>
TextPosition and OrdinalNumber should be more like idiomatic numbers
https://bugs.webkit.org/show_bug.cgi?id=165678
Reviewed by Filip Pizlo.
* wtf/text/TextPosition.h:
(WTF::TextPosition::minimumPosition): Deleted. Just use the default
constructor. Other numbers use their default constructors to mean zero.
Any time you need a comment that says "used as a default value", that's
a pretty good indicator that it should be the default constructor.
2016-12-09 Geoffrey Garen <ggaren@apple.com>
Moved OrdinalNumber into its own file
https://bugs.webkit.org/show_bug.cgi?id=165663
Reviewed by Saam Barati.
* WTF.xcodeproj/project.pbxproj:
* wtf/text/OrdinalNumber.h: Copied from Source/WTF/wtf/text/TextPosition.h.
(WTF::TextPosition::TextPosition): Deleted.
(WTF::TextPosition::operator==): Deleted.
(WTF::TextPosition::operator!=): Deleted.
(WTF::TextPosition::minimumPosition): Deleted.
(WTF::TextPosition::belowRangePosition): Deleted.
* wtf/text/TextPosition.h:
(WTF::OrdinalNumber::fromZeroBasedInt): Deleted.
(WTF::OrdinalNumber::fromOneBasedInt): Deleted.
(WTF::OrdinalNumber::OrdinalNumber): Deleted.
(WTF::OrdinalNumber::zeroBasedInt): Deleted.
(WTF::OrdinalNumber::oneBasedInt): Deleted.
(WTF::OrdinalNumber::operator==): Deleted.
(WTF::OrdinalNumber::operator!=): Deleted.
(WTF::OrdinalNumber::first): Deleted.
(WTF::OrdinalNumber::beforeFirst): Deleted.
2016-12-08 David Kilzer <ddkilzer@apple.com>
Always check the return value of pthread_key_create()
<https://webkit.org/b/165274>
Reviewed by Darin Adler.
* wtf/ThreadIdentifierDataPthreads.cpp:
(WTF::ThreadIdentifierData::initializeOnce): Make the code more
readable by assigning a variable to the result of
pthread_key_create(). This matches the idiom used elsewhere.
2016-12-08 Keith Miller <keith_miller@apple.com>
Add 64-bit signed LEB decode method
https://bugs.webkit.org/show_bug.cgi?id=165630
Reviewed by Ryosuke Niwa.
Add int64 LEB decode and fix some 64-bit specific issues
with the decoder. There is also a fix where we would allow
LEBs with canonical length + 1 size that is fixed by this
patch.
* wtf/LEBDecoder.h:
(WTF::LEBDecoder::decodeUInt):
(WTF::LEBDecoder::decodeInt):
(WTF::LEBDecoder::decodeUInt32):
(WTF::LEBDecoder::decodeUInt64):
(WTF::LEBDecoder::decodeInt32):
(WTF::LEBDecoder::decodeInt64):
2016-12-08 Anders Carlsson <andersca@apple.com>
Defer sending Mach messages if the queue is full
https://bugs.webkit.org/show_bug.cgi?id=165622
rdar://problem/29518036
Reviewed by Brady Eidson.
Add new SPI.
* wtf/spi/darwin/XPCSPI.h:
2016-12-06 Filip Pizlo <fpizlo@apple.com>
Concurrent GC should be stable enough to land enabled on X86_64
https://bugs.webkit.org/show_bug.cgi?id=164990
Reviewed by Geoffrey Garen.
Adds the ability to say:
auto locker = holdLock(any type of lock)
Instead of having to say:
Locker<LockType> locker(locks of type LockType)
I think that we should use "auto locker = holdLock(lock)" as the default way that we acquire
locks unless we need to use a special locker type.
This also adds the ability to safepoint a lock. Safepointing a lock is basically a super fast
way of unlocking it fairly and then immediately relocking it - i.e. letting anyone who is
waiting to run without losing steam of there is noone waiting.
* wtf/Lock.cpp:
(WTF::LockBase::safepointSlow):
* wtf/Lock.h:
(WTF::LockBase::safepoint):
* wtf/LockAlgorithm.h:
(WTF::LockAlgorithm::safepointFast):
(WTF::LockAlgorithm::safepoint):
(WTF::LockAlgorithm::safepointSlow):
* wtf/Locker.h:
(WTF::AbstractLocker::AbstractLocker):
(WTF::Locker::tryLock):
(WTF::Locker::operator bool):
(WTF::Locker::Locker):
(WTF::Locker::operator=):
(WTF::holdLock):
(WTF::tryHoldLock):
2016-12-08 Chris Dumez <cdumez@apple.com>
Unreviewed, rolling out r209489.
Likely caused large regressions on JetStream, Sunspider and
Speedometer
Reverted changeset:
"Add system trace points for JavaScript VM entry/exit"
https://bugs.webkit.org/show_bug.cgi?id=165550
http://trac.webkit.org/changeset/209489
2016-12-07 Simon Fraser <simon.fraser@apple.com>
Add system trace points for JavaScript VM entry/exit
https://bugs.webkit.org/show_bug.cgi?id=165550
Reviewed by Tim Horton.
Add trace points for entry/exit into/out of the JS VM.
* wtf/SystemTracing.h:
2016-12-06 Alexey Proskuryakov <ap@apple.com>
Correct SDKROOT values in xcconfig files
https://bugs.webkit.org/show_bug.cgi?id=165487
rdar://problem/29539209
Reviewed by Dan Bernstein.
Fix suggested by Dan Bernstein.
* Configurations/DebugRelease.xcconfig:
2016-12-06 Michael Saboff <msaboff@apple.com>
REGRESSION(r209399): Causes crashes when dumping JIT disassembly
https://bugs.webkit.org/show_bug.cgi?id=165483
Reviewed by Geoffrey Garen.
Fixed the RELEASE_ASSERT() to check that the 6 character string is terminated by a null
character.
* wtf/SixCharacterHash.cpp:
(WTF::sixCharacterHashStringToInteger):
2016-12-04 Darin Adler <darin@apple.com>
Use ASCIICType more, and improve it a little bit
https://bugs.webkit.org/show_bug.cgi?id=165360
Reviewed by Sam Weinig.
* wtf/ASCIICType.h: Added declarations of all the functions to the top of the file,
so we have a list of what's available, not just a mix of that and the implementation.
* wtf/HexNumber.h:
(WTF::Internal::hexDigitsForMode): Moved lowerHexDigits and upperHexDigits
inside this function.
(WTF::appendByteAsHex): Use auto.
(WTF::placeByteAsHexCompressIfPossible): Ditto.
(WTF::placeByteAsHex): Ditto.
(WTF::appendUnsignedAsHex): Ditto.
(WTF::appendUnsigned64AsHex): Ditto.
(WTF::appendUnsignedAsHexFixedSize): Ditto.
(WTF::isHexDigit): Deleted.
(WTF::uncheckedHexDigit): Deleted.
(WTF::hexDigitValue): Deleted.
(WTF::uncheckedHexDigitValue): Deleted.
* wtf/SixCharacterHash.cpp:
(WTF::sixCharacterHashStringToInteger): Use isASCIIUpper, isASCIILower, and
isASCIIDigit. Also added some FIXMEs; for some reason this function uses
RELEASE_ASSERT to abort if the passed-in string is not six characters long,
and it's not clear to me why this is so critical to assert.
(WTF::integerToSixCharacterHashString): Moved the table inside this function,
obviating the need for a macro named TABLE.
* wtf/dtoa/bignum.cc:
(WTF::double_conversion::HexCharValue): Deleted.
(WTF::double_conversion::Bignum::AssignHexString): Use toASCIIHexValue.
* wtf/dtoa/double-conversion.cc:
(WTF::double_conversion::StringToDoubleConverter::StringToDouble): Use isASCIIDigit.
* wtf/text/StringBuilder.cpp:
(WTF::appendQuotedJSONStringInternal): Use upperNibbleToASCIIHexDigit and
lowerNibbleToASCIIHexDigit.
* wtf/text/StringImpl.cpp:
(WTF::StringImpl::convertToUppercaseWithoutLocale): Use toASCIIUpper.
Removed the workaround for a bug that was fixed in Visual Studio 2013.
2016-12-05 Joseph Pecoraro <pecoraro@apple.com>
REGRESSION(r208985): SafariForWebKitDevelopment Symbol Not Found looking for method with WTF::Optional
https://bugs.webkit.org/show_bug.cgi?id=165351
Reviewed by Yusuke Suzuki.
Include a slimmed down version of WTF::Optional which older versions
of Safari still depend on for a JavaScriptCore exported symbol.
To prevent misuse name it WTF::DeprecatedOptional and use it only in
the one instance it is needed.
* WTF.xcodeproj/project.pbxproj:
* wtf/DeprecatedOptional.h: Added.
(WTF::Optional::operator bool):
(WTF::Optional::value):
(WTF::Optional::asPtr):
2016-12-05 Konstantin Tokarev <annulen@yandex.ru>
Add __STDC_FORMAT_MACROS before inttypes.h is included
https://bugs.webkit.org/show_bug.cgi?id=165374
We need formatting macros like PRIu64 to be available in all places where
inttypes.h header is used. All these usages get inttypes.h definitions
via wtf/Assertions.h header, except SQLiteFileSystem.cpp where formatting
macros are not used anymore since r185129.
This patch fixes multiple build errors with MinGW and reduces number of
independent __STDC_FORMAT_MACROS uses in the code base.
Reviewed by Darin Adler.
* wtf/Assertions.h: Define __STDC_FORMAT_MACROS.
* wtf/StdLibExtras.h: Remove definition of PRId64 for Windows, as we
have __STDC_FORMAT_MACROS defined now.
2016-12-03 Yusuke Suzuki <utatane.tea@gmail.com>
Refactor SymbolImpl layout
https://bugs.webkit.org/show_bug.cgi?id=165247
Reviewed by Darin Adler.
This patch moves SymbolImpl initialization from StringImpl to SymbolImpl.
In SymbolImpl, we create the appropriate fields. At that time, these fields
should be aligned to the BufferSubstring StringImpl.
And we newly create the `m_flags` in SymbolImpl. Instead of using special
StringImpl::null(), we store s_flagIsNullSymbol flag here. In WTF, we have
the invariant that StringImpl::empty() is the only atomic empty string.
But StringImpl::null() breaks this invariant. Using a special flag is safer
way to represent the null Symbol `Symbol()`.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/StdLibExtras.h:
(WTF::roundUpToMultipleOfImpl0):
(WTF::roundUpToMultipleOfImpl):
(WTF::roundUpToMultipleOf):
* wtf/text/StringImpl.cpp:
(WTF::StringImpl::~StringImpl):
(WTF::StringImpl::createSymbol): Deleted.
(WTF::StringImpl::createNullSymbol): Deleted.
* wtf/text/StringImpl.h:
(WTF::StringImpl::isAtomic):
(WTF::StringImpl::StringImpl):
(WTF::StringImpl::requiresCopy):
(WTF::StringImpl::isNullSymbol): Deleted.
(WTF::StringImpl::symbolAwareHash): Deleted.
(WTF::StringImpl::existingSymbolAwareHash): Deleted.
(WTF::StringImpl::null): Deleted.
(WTF::StringImpl::extractFoldedStringInSymbol): Deleted.
(WTF::StringImpl::symbolRegistry): Deleted.
(WTF::StringImpl::hashForSymbol): Deleted.
* wtf/text/StringStatics.cpp:
(WTF::StringImpl::nextHashForSymbol): Deleted.
* wtf/text/SymbolImpl.cpp: Copied from Source/WTF/wtf/text/SymbolRegistry.cpp.
(WTF::SymbolImpl::nextHashForSymbol):
(WTF::SymbolImpl::create):
(WTF::SymbolImpl::createNullSymbol):
* wtf/text/SymbolImpl.h:
(WTF::SymbolImpl::hashForSymbol):
(WTF::SymbolImpl::symbolRegistry):
(WTF::SymbolImpl::isNullSymbol):
(WTF::SymbolImpl::extractFoldedString):
(WTF::SymbolImpl::SymbolImpl):
(WTF::StringImpl::symbolAwareHash):
(WTF::StringImpl::existingSymbolAwareHash):
* wtf/text/SymbolRegistry.cpp:
(WTF::SymbolRegistry::~SymbolRegistry):
(WTF::SymbolRegistry::symbolForKey):
(WTF::SymbolRegistry::keyForSymbol):
* wtf/text/UniquedStringImpl.h:
(WTF::UniquedStringImpl::UniquedStringImpl):
2016-12-01 Yusuke Suzuki <utatane.tea@gmail.com>
Introduce StringImpl::StaticStringImpl with constexpr constructor
https://bugs.webkit.org/show_bug.cgi?id=165093
Reviewed by Darin Adler.
This patch adds new class, StringImpl::StaticStringImpl.
By using this class, we can easily create static StringImpls.
This class has constexpr constructor. You can initialize instances
of this class as global static variables without invoking global
constructors.
We already have similar system, StaticASCIILiteral. But using it
requires some special perl script since we need to calculate
hash value. On the other hand, we can use StaticStringImpl without
any script supports since we implement constexpr hash function.
In the future, we will replace all the use of StaticASCIILiteral
with this StaticStringImpl.
We define empty / null strings as StaticStringImpl. And we make
StringImpl::empty() & StringImpl::null() inline functions.
* wtf/Hasher.h:
(WTF::StringHasher::hashWithTop8BitsMasked):
(WTF::StringHasher::hash):
(WTF::StringHasher::finalize):
(WTF::StringHasher::finalizeAndMaskTop8Bits):
(WTF::StringHasher::computeLiteralHash):
(WTF::StringHasher::computeLiteralHashAndMaskTop8Bits):
(WTF::StringHasher::avalancheBits3):
(WTF::StringHasher::avalancheBits2):
(WTF::StringHasher::avalancheBits1):
(WTF::StringHasher::avalancheBits0):
(WTF::StringHasher::avalancheBits):
(WTF::StringHasher::avoidZero):
(WTF::StringHasher::processPendingCharacter):
(WTF::StringHasher::calculateWithRemainingLastCharacter1):
(WTF::StringHasher::calculateWithRemainingLastCharacter0):
(WTF::StringHasher::calculateWithRemainingLastCharacter):
(WTF::StringHasher::calculate1):
(WTF::StringHasher::calculate0):
(WTF::StringHasher::calculate):
(WTF::StringHasher::computeLiteralHashImpl):
* wtf/text/StringImpl.cpp:
* wtf/text/StringImpl.h:
(WTF::StringImpl::StaticStringImpl::StaticStringImpl):
(WTF::StringImpl::null):
(WTF::StringImpl::empty):
* wtf/text/StringStatics.cpp:
(WTF::StringImpl::null): Deleted.
(WTF::StringImpl::empty): Deleted.
2016-11-30 Darin Adler <darin@apple.com>
Roll out StringBuilder changes from the previous patch.
They were a slowdown on a Kraken JSON test.
* wtf/text/StringBuilder.cpp:
* wtf/text/StringBuilder.h:
Roll out changes from below.
2016-11-30 Darin Adler <darin@apple.com>
Streamline and speed up tokenizer and segmented string classes
https://bugs.webkit.org/show_bug.cgi?id=165003
And do it without re-introducing:
REGRESSION (r209058): API test StringBuilderTest.Equal crashing
https://bugs.webkit.org/show_bug.cgi?id=165142
Reviewed by Sam Weinig.
* wtf/text/StringBuilder.cpp:
(WTF::StringBuilder::bufferCharacters<LChar>): Moved this here from
the header since it is only used inside the class. Also renamed from
getBufferCharacters.
(WTF::StringBuilder::bufferCharacters<UChar>): Ditto.
(WTF::StringBuilder::appendUninitializedUpconvert): Added. Helper
for the upconvert case in the 16-bit overload of StrinBuilder::append.
(WTF::StringBuilder::append): Changed to use appendUninitializedUpconvert.
(WTF::quotedJSONStringLength): Added. Used in new appendQuotedJSONString
implementation below that now correctly determines the size of what will
be appended by walking thorugh the string twice.
(WTF::appendQuotedJSONStringInternal): Moved the code that writes the
quote marks in here. Also made a few coding style tweaks.
(WTF::StringBuilder::appendQuotedJSONString): Rewrote to use a much
simpler algorithm that grows the string the same way the append function
does. The old code would use reserveCapacity in a way that was costly when
doing a lot of appends on the same string, and also allocated far too much
memory for normal use cases where characters did not need to be turned
into escape sequences.
* wtf/text/StringBuilder.h:
(WTF::StringBuilder::append): Tweaked style a bit, fixed a bug where the
m_is8Bit field wasn't set correctly in one case, optimized the function that
adds substrings for the case where this is the first append and the substring
happens to cover the entire string. Also clarified the assertions and removed
an unneeded check from that substring overload.
(WTF::equal): Reimplemented, using equalCommon. Added an overload of the equal
function just for the case where the arguments are StringBuilder, String.
This is needed because of the peculiar behavior of is8Bit in String, different
from any of our other string classes. I think we should consider changing
String::is8Bit to return true for null strings. We could then remove this
overload and probably remove other checks for null and zero length elsewhere
that are also needed only to avoid calling is8Bit on a null String.
2016-11-29 JF Bastien <jfbastien@apple.com>
WebAssembly JS API: improve Instance
https://bugs.webkit.org/show_bug.cgi?id=164757
Reviewed by Keith Miller.
* wtf/Expected.h:
(WTF::ExpectedDetail::destroy): silence a warning
2016-11-29 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r209058 and r209074.
https://bugs.webkit.org/show_bug.cgi?id=165188
These changes caused API test StringBuilderTest.Equal to crash
and/or fail. (Requested by ryanhaddad on #webkit).
Reverted changesets:
"Streamline and speed up tokenizer and segmented string
classes"
https://bugs.webkit.org/show_bug.cgi?id=165003
http://trac.webkit.org/changeset/209058
"REGRESSION (r209058): API test StringBuilderTest.Equal
crashing"
https://bugs.webkit.org/show_bug.cgi?id=165142
http://trac.webkit.org/changeset/209074
2016-11-29 Simon Fraser <simon.fraser@apple.com>
Allow TracePoint to take arbitrary data
https://bugs.webkit.org/show_bug.cgi?id=165182
Reviewed by Tim Horton.
Allow TracePoint() to take four numeric arguments, for arbitrary data.
#pragma once
* wtf/SystemTracing.h:
(WTF::TracePoint):
2016-11-29 Andy Estes <aestes@apple.com>
[Cocoa] Enable two clang warnings recommended by Xcode
https://bugs.webkit.org/show_bug.cgi?id=164498
Reviewed by Mark Lam.
* Configurations/Base.xcconfig: Enabled CLANG_WARN_INFINITE_RECURSION and CLANG_WARN_SUSPICIOUS_MOVE.
2016-11-29 Darin Adler <darin@apple.com>
REGRESSION (r209058): API test StringBuilderTest.Equal crashing
https://bugs.webkit.org/show_bug.cgi?id=165142
* wtf/text/StringBuilder.h: Added an overload of the equal function just
for the case where the arguments are StringBuilder, String. This is needed
because of the peculiar behavior of is8Bit in String, different from any of
our other string classes. I think we should consider changing String::is8Bit
to return true for null strings. We could then remove this overload and
probably remove other checks for null and zero length elsewhere that are
also needed only to avoid calling is8Bit on a null String.
2016-11-29 Wenson Hsieh <wenson_hsieh@apple.com>
Scroll snapping on Mac should use AppKit animations
https://bugs.webkit.org/show_bug.cgi?id=147261
<rdar://problem/29395293>
Reviewed by Brent Fulgham.
Introduce HAVE(NSSCROLLING_FILTERS), which is on for macOS El Capitan and later.
* wtf/Platform.h:
2016-11-28 Darin Adler <darin@apple.com>
Streamline and speed up tokenizer and segmented string classes
https://bugs.webkit.org/show_bug.cgi?id=165003
Reviewed by Sam Weinig.
* wtf/text/StringBuilder.cpp:
(WTF::StringBuilder::bufferCharacters<LChar>): Moved this here from
the header since it is only used inside the class. Also renamed from
getBufferCharacters.
(WTF::StringBuilder::bufferCharacters<UChar>): Ditto.
(WTF::StringBuilder::appendUninitializedUpconvert): Added. Helper
for the upconvert case in the 16-bit overload of StrinBuilder::append.
(WTF::StringBuilder::append): Changed to use appendUninitializedUpconvert.
(WTF::quotedJSONStringLength): Added. Used in new appendQuotedJSONString
implementation below that now correctly determines the size of what will
be appended by walking thorugh the string twice.
(WTF::appendQuotedJSONStringInternal): Moved the code that writes the
quote marks in here. Also made a few coding style tweaks.
(WTF::StringBuilder::appendQuotedJSONString): Rewrote to use a much
simpler algorithm that grows the string the same way the append function
does. The old code would use reserveCapacity in a way that was costly when
doing a lot of appends on the same string, and also allocated far too much
memory for normal use cases where characters did not need to be turned
into escape sequences.
* wtf/text/StringBuilder.h:
(WTF::StringBuilder::append): Tweaked style a bit, fixed a bug where the
m_is8Bit field wasn't set correctly in one case, optimized the function that
adds substrings for the case where this is the first append and the substring
happens to cover the entire string. Also clarified the assertions and removed
an unneeded check from that substring overload.
(WTF::equal): Reimplemented, using equalCommon.
2016-11-26 Yusuke Suzuki <utatane.tea@gmail.com>
[WTF] Import std::optional reference implementation as WTF::Optional
https://bugs.webkit.org/show_bug.cgi?id=164199
Reviewed by Saam Barati and Sam Weinig.
Import std::optional reference implementation offered by the C++17
original proposal paper. It has the same interface and functionality
to the C++17's one. Previous WTF::Optional lacks several functionalities.
The largest one is the correct constexpr constructors. This fact prevents
us from using Optional<literal type> in constexpr context in WebKit.
In WebKit, we do not allow global constructors. So only the constexpr
constructor is the way to use WTF::Optional in the static const
global variables. WTF::Optional is used in DOMJIT::Effect and
we would like to emit static const global variables that includes
this DOMJIT::Effect. That is the main motivation of this work.
This functionality allows the IDL code generator to emit DOMJIT
signatures as static const global variables.
We import the reference implementation one instead of LLVM libc++'s one.
This is because LLVM libc++'s one depends on many macro and type_traits
offered by libc++ implementation. And adopting it to WebKit requires
large modification compared to this reference implementation one.
Furthermore, it is difficult to compile libc++'s optional in old GCC and VC++.
It also requires some more modifications. To keep the thing simple,
we import the reference implementation one now. Once C++17 is released
and we update the compiler baseline, we can smoothly switch to the standard
library's std::optional.
We also add support for the environment that does not use exceptions to this
reference implementation.
And we also add valueOrCompute helper function. That keeps the extended
functionality that previous WTF::Optional has.
* wtf/CrossThreadQueue.h:
(WTF::CrossThreadQueue<DataType>::tryGetMessage):
* wtf/Expected.h:
(WTF::makeExpected):
* wtf/Forward.h:
* wtf/HashTraits.h:
(WTF::HashTraits<Ref<P>>::take):
* wtf/MainThread.cpp:
(WTF::initializeGCThreads):
(WTF::mayBeGCThread):
* wtf/MainThread.h:
* wtf/Optional.h:
(std::detail_::is_assignable::has_assign):
(std::detail_::has_overloaded_addressof::has_overload):
(std::detail_::static_addressof):
(std::detail_::convert):
(std::nullopt_t::nullopt_t):
(std::bad_optional_access::bad_optional_access):
(std::optional_base::optional_base):
(std::optional_base::~optional_base):
(std::constexpr_optional_base::constexpr_optional_base):
(std::optional::dataptr):
(std::optional::contained_val):
(std::optional::__NOEXCEPT_):
(std::optional::optional):
(std::optional::operator=):
(std::optional::emplace):
(std::optional::operator ->):
(std::optional::operator *):
(std::optional::value):
(std::optional::value_or):
(std::operator==):
(std::operator!=):
(std::operator<):
(std::operator>):
(std::operator<=):
(std::operator>=):
(std::__NOEXCEPT_):
(std::make_optional):
(std::hash<std::optional<T>>::operator()):
(WTF::NulloptTag::NulloptTag): Deleted.
(WTF::Optional::Optional): Deleted.
(WTF::Optional::~Optional): Deleted.
(WTF::Optional::operator=): Deleted.
(WTF::Optional::operator bool): Deleted.
(WTF::Optional::operator->): Deleted.
(WTF::Optional::operator*): Deleted.
(WTF::Optional::value): Deleted.
(WTF::Optional::valueOr): Deleted.
(WTF::Optional::valueOrCompute): Deleted.
(WTF::Optional::asPtr): Deleted.
(WTF::Optional::destroy): Deleted.
(WTF::operator==): Deleted.
(WTF::operator!=): Deleted.
(WTF::makeOptional): Deleted.
(WTF::printInternal): Deleted.
* wtf/text/StringView.cpp:
(WTF::StringView::GraphemeClusters::Iterator::Impl::Impl):
(WTF::StringView::GraphemeClusters::Iterator::Iterator):
* wtf/text/StringView.h:
2016-11-26 Simon Fraser <simon.fraser@apple.com>
Migrate some layout timer-related code from std::chrono to Seconds and MonotonicTime
https://bugs.webkit.org/show_bug.cgi?id=164992
Reviewed by Darin Adler.
Add Seconds::zero() as a nicer way to express Seconds(0).
* wtf/Seconds.h:
(WTF::Seconds::zero):
2016-11-26 Simon Fraser <simon.fraser@apple.com>
Add literals for various time units
https://bugs.webkit.org/show_bug.cgi?id=165074
Reviewed by Filip Pizlo.
Add _min, _s, _ms, _us and _ns literals for easy creation of Seconds from long double
and unsigned long long types (those allowed for custom literals).
Add minutes-related functions (there are one or two use cases in WebCore).
* wtf/Seconds.h:
(WTF::Seconds::minutes):
(WTF::Seconds::fromMinutes):
(WTF::Seconds::fromMilliseconds):
(WTF::Seconds::fromMicroseconds):
(WTF::Seconds::fromNanoseconds):
(WTF::operator _min):
(WTF::operator _s):
(WTF::operator _ms):
(WTF::operator _us):
(WTF::operator _ns):
2016-11-22 Darin Adler <darin@apple.com>
One more tiny bit of follow-up.
* wtf/text/TextBreakIterator.cpp:
(WTF::numCharactersInGraphemeClusters): Removed unneeded always-true check.
2016-11-22 Darin Adler <darin@apple.com>
Quick follow-up to previous patch.
* wtf/text/TextBreakIterator.cpp:
(WTF::numCharactersInGraphemeClusters): Removed incorrect assertion.
2016-11-22 Darin Adler <darin@apple.com>
Make normal case fast in the input element limitString function
https://bugs.webkit.org/show_bug.cgi?id=165023
Reviewed by Dan Bernstein.
* wtf/text/LineBreakIteratorPoolICU.h: Removed many unneeded includes.
Simplified the class a bit, removing some extra definitions.
(WTF::LineBreakIteratorPool::sharedPool): Use NeverDestroyed instead of new.
(WTF::LineBreakIteratorPool::makeLocaleWithBreakKeyword): Reimplemented in
a simpler way without using StringBuilder. Also updated for change to
LineBreakIteratorMode.
(WTF::LineBreakIteratorPool::put): Use uncheckedAppend since the code is
careful to only use the inline capacity in the vector.
* wtf/text/TextBreakIterator.cpp: Moved some includes in here from the header.
(WTF::mapLineIteratorModeToRules): Updated for change to LineBreakIteratorMode.
(WTF::openLineBreakIterator): Ditto.
(WTF::numGraphemeClusters): Added a fast path for all 8-bit strings; don't
use ICU for that case, even if there is a CR character in it.
(WTF::numCharactersInGraphemeClusters): Added a fast path for strings that are
short enough to entirely fit without even looking at the characters; that's a
case we likely hit all the time. Also added a fast path for all 8-bit strings.
* wtf/text/TextBreakIterator.h: Changed LineBreakIteratorMode to be an enum
class and not repeat UAX14 in the names of the modes. Initialize data members
in the class definition rather than the constructors.
2016-11-21 Mark Lam <mark.lam@apple.com>
Hasher::addCharacters() should be able to handle zero length strings.
https://bugs.webkit.org/show_bug.cgi?id=165024
Reviewed by Yusuke Suzuki.
Currently, it will fail to handle zero length strings if it has a pending
character. The fix is simply to return early if length is 0.
* wtf/Hasher.h:
(WTF::StringHasher::addCharacters):
2016-11-18 Jeremy Jones <jeremyj@apple.com>
Add runtime flag to enable pointer lock. Enable pointer lock feature for mac.
https://bugs.webkit.org/show_bug.cgi?id=163801
Reviewed by Simon Fraser.
* wtf/FeatureDefines.h: ENABLE_POINTER_LOCK true for Mac.
2016-11-17 Saam Barati <sbarati@apple.com>
Remove async/await compile time flag and enable tests
https://bugs.webkit.org/show_bug.cgi?id=164828
<rdar://problem/28639334>
Reviewed by Yusuke Suzuki.
* wtf/FeatureDefines.h:
2016-11-17 Yusuke Suzuki <utatane.tea@gmail.com>
[JSC] WTF::TemporaryChange with WTF::SetForScope
https://bugs.webkit.org/show_bug.cgi?id=164761
Reviewed by Saam Barati.
JavaScriptCore's bytecompiler/SetForScope.h is completely the same
to WTF::TemporaryChange. SetForScope sounds better name since it
says that this object works as Scope.
We rename WTF::TemporaryChange to WTF::SetForScope. And replace
all the use to this WTF::SetForScope.
* WTF.xcodeproj/project.pbxproj:
* wtf/SetForScope.h: Renamed from Source/WTF/wtf/TemporaryChange.h.
(WTF::SetForScope::SetForScope):
(WTF::SetForScope::~SetForScope):
2016-11-16 Yusuke Suzuki <utatane.tea@gmail.com>
[ES6][WebCore] Change ES6_MODULES compile time flag to runtime flag
https://bugs.webkit.org/show_bug.cgi?id=164827
Reviewed by Ryosuke Niwa.
* wtf/FeatureDefines.h:
2016-11-16 Carlos Alberto Lopez Perez <clopez@igalia.com>
[JSC] Build broken for 32-bit x86 after r208306 with GCC 4.9
https://bugs.webkit.org/show_bug.cgi?id=164588
Reviewed by Mark Lam.
Provide assembly for executing the cpuid instruction when compiling
in PIC mode with the GCC 4.9 EBX on 32-bit x86.
Note that the values returned by cpuid here are not used. The purpose
of calling this instruction is to force the CPU to complete and sync
any buffered modifications on registers, memory or flags before
fetching and executing the next instruction.
* wtf/Atomics.h:
(WTF::x86_cpuid):
2016-11-15 Filip Pizlo <fpizlo@apple.com>
Rename CONCURRENT_JIT/ConcurrentJIT to CONCURRENT_JS/ConcurrentJS
https://bugs.webkit.org/show_bug.cgi?id=164791
Reviewed by Geoffrey Garen.
Both the concurrent GC and the concurrent JIT rely on concurrency support in fundamental
JSC runtime components like JSValue. So, the thing that guards it should be a "feature"
called CONCURRENT_JS not CONCURRENT_JIT.
* wtf/Platform.h:
2016-11-15 Filip Pizlo <fpizlo@apple.com>
The concurrent GC should have a timeslicing controller
https://bugs.webkit.org/show_bug.cgi?id=164783
Reviewed by Geoffrey Garen.
* wtf/LockAlgorithm.h: Added some comments.
* wtf/Seconds.h: Added support for modulo. It's necessary for timeslicing.
(WTF::Seconds::operator%):
(WTF::Seconds::operator%=):
2016-11-11 Filip Pizlo <fpizlo@apple.com>
The GC should be optionally concurrent and disabled by default
https://bugs.webkit.org/show_bug.cgi?id=164454
Reviewed by Geoffrey Garen.
The reason why I went to such great pains to make WTF::Lock fit in two bits is that I
knew that I would eventually need to stuff one into some miscellaneous bits of the
JSCell header. That time has come, because the concurrent GC has numerous race
conditions in visitChildren that can be trivially fixed if each object just has an
internal lock. Some cell types might use it to simply protect their entire visitChildren
function and anything that mutates the fields it touches, while other cell types might
use it as a "lock of last resort" to handle corner cases of an otherwise wait-free or
lock-free algorithm. Right now, it's used to protect certain transformations involving
indexing storage.
To make this happen, I factored the WTF::Lock algorithm into a LockAlgorithm struct that
is templatized on lock type (uint8_t for WTF::Lock), the isHeldBit value (1 for
WTF::Lock), and the hasParkedBit value (2 for WTF::Lock). This could have been done as
a templatized Lock class that basically contains Atomic<LockType>. You could then make
any field into a lock by bitwise_casting it to TemplateLock<field type, bit1, bit2>. But
this felt too dirty, so instead, LockAlgorithm has static methods that take
Atomic<LockType>& as their first argument. I think that this makes it more natural to
project a LockAlgorithm onto an existing Atomic<> field. Sadly, some places have to cast
their non-Atomic<> field to Atomic<> in order for this to work. Like so many other things
we do, this just shows that the C++ style of labeling fields that are subject to atomic
ops as atomic is counterproductive. Maybe some day I'll change LockAlgorithm to use our
other Atomics API, which does not require Atomic<>.
WTF::Lock now uses LockAlgorithm. The slow paths are still outlined. I don't feel too
bad about the LockAlgorithm.h header being included in so many places because we change
that algorithm so infrequently.
Also, I added a hasElapsed(time) function. This function makes it so much more natural
to write timeslicing code, which the concurrent GC has to do a lot of.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/ListDump.h:
* wtf/Lock.cpp:
(WTF::LockBase::lockSlow):
(WTF::LockBase::unlockSlow):
(WTF::LockBase::unlockFairlySlow):
(WTF::LockBase::unlockSlowImpl): Deleted.
* wtf/Lock.h:
(WTF::LockBase::lock):
(WTF::LockBase::tryLock):
(WTF::LockBase::unlock):
(WTF::LockBase::unlockFairly):
(WTF::LockBase::isHeld):
(): Deleted.
* wtf/LockAlgorithm.h: Added.
(WTF::LockAlgorithm::lockFastAssumingZero):
(WTF::LockAlgorithm::lockFast):
(WTF::LockAlgorithm::lock):
(WTF::LockAlgorithm::tryLock):
(WTF::LockAlgorithm::unlockFastAssumingZero):
(WTF::LockAlgorithm::unlockFast):
(WTF::LockAlgorithm::unlock):
(WTF::LockAlgorithm::unlockFairly):
(WTF::LockAlgorithm::isLocked):
(WTF::LockAlgorithm::lockSlow):
(WTF::LockAlgorithm::unlockSlow):
* wtf/TimeWithDynamicClockType.cpp:
(WTF::hasElapsed):
* wtf/TimeWithDynamicClockType.h:
2016-11-14 JF Bastien <jfbastien@apple.com>
Expected: add missing `inline`
https://bugs.webkit.org/show_bug.cgi?id=164735
Reviewed by Yusuke Suzuki.
Free functions and full template specializations need to be
`inline`, or in a .cpp file, otherwise each .o creates a duplicate
symbol which makes the linker very sad.
* wtf/Expected.h:
(WTF::ExpectedDetail::Throw):
(WTF::makeExpected):
2016-11-14 Mark Lam <mark.lam@apple.com>
Build fix after r208690.
https://bugs.webkit.org/show_bug.cgi?id=164681
Not reviewed.
* wtf/FastMalloc.h:
2016-11-13 Mark Lam <mark.lam@apple.com>
Add debugging facility to limit the max single allocation size.
https://bugs.webkit.org/show_bug.cgi?id=164681
Reviewed by Keith Miller.
This is useful for simulating memory allocation failures on resource constraint
devices for testing purposes.
This facility is only conditionally compiled in on debug builds. It does not
have any burden on release builds at all. When in use, the max single allocation
size limit applies to individual allocations. For malloc (and similar), the
allocation will crash in FastMalloc if the requested size exceeds the set max
single allocation size. For tryMalloc (and similar), the allocation returns
nullptr if the requested size exceeds the set max single allocation size. The
max single allocation size is set to std::numeric_limit<size_t>::max() by default
(i.e. when not set and no limit is in effect).
Also fixed non-bmalloc versions of fastAlignedMalloc() to crash when allocation
fails.
* wtf/FastMalloc.cpp:
(WTF::fastSetMaxSingleAllocationSize):
(WTF::fastAlignedMalloc):
(WTF::tryFastAlignedMalloc):
(WTF::tryFastMalloc):
(WTF::fastMalloc):
(WTF::tryFastCalloc):
(WTF::fastCalloc):
(WTF::fastRealloc):
* wtf/FastMalloc.h:
2016-11-13 JF Bastien <jfbastien@apple.com>
Implement WTF::Expected
https://bugs.webkit.org/show_bug.cgi?id=164526
Reviewed by Yusuke Suzuki.
std::expected isn't in C++17, and may be in C++20. It's a nice
complement to std::any / std::optional because it's a type-tagged
union which has a single expected result but could also contain an
error.
This would be useful in the WebAssembly parser, for example.
Using this implementation will allow us to provide feedback to the
standards committee and guide std::expected's design before it
gets standardized. I've already sent a bunch of feedback to the
author based on my experience implementing this.
This could supplement WTF::Either and WTF::ExceptionOr.
* WTF.xcodeproj/project.pbxproj:
* wtf/Compiler.h: Add RELAXED_CONSTEXPR
* wtf/Expected.h: Added.
(WTF::UnexpectedType::UnexpectedType):
(WTF::UnexpectedType::value):
(WTF::operator==):
(WTF::operator!=):
(WTF::operator<):
(WTF::operator>):
(WTF::operator<=):
(WTF::operator>=):
(WTF::makeUnexpected):
(WTF::ExpectedDetail::Throw):
(WTF::ExpectedDetail::ConstexprBase::ConstexprBase):
(WTF::ExpectedDetail::Base::Base):
(WTF::ExpectedDetail::Base::~Base):
(WTF::Expected::Expected):
(WTF::Expected::operator=):
(WTF::Expected::swap):
(WTF::Expected::operator->):
(WTF::Expected::operator*):
(WTF::Expected::operator bool):
(WTF::Expected::hasValue):
(WTF::Expected::value):
(WTF::Expected::error):
(WTF::Expected::getUnexpected):
(WTF::Expected::valueOr):
(WTF::swap):
(WTF::makeExpected):
(WTF::makeExpectedFromError):
2016-11-11 Alex Christensen <achristensen@webkit.org>
Allow mutable lambdas in HashMap::ensure
https://bugs.webkit.org/show_bug.cgi?id=164642
Reviewed by Sam Weinig.
* wtf/HashMap.h:
(WTF::HashMapEnsureTranslator::translate):
(WTF::X>::removeIf):
2016-11-11 Beth Dakin <bdakin@apple.com>
Get touch bar code building for open source builds
https://bugs.webkit.org/show_bug.cgi?id=164610
Reviewed by Wenson Hsieh.
* wtf/Platform.h:
2016-11-10 JF Bastien <jfbastien@apple.com>
ASSERTION FAILED: length > offset encountered with wasm.yaml/wasm/js-api/test_Module.js.default-wasm
https://bugs.webkit.org/show_bug.cgi?id=164597
Reviewed by Keith Miller.
Decoding at end of file should fail, not assert.
* wtf/LEBDecoder.h:
(WTF::LEBDecoder::decodeUInt):
(WTF::LEBDecoder::decodeInt32):
2016-11-10 Alex Christensen <achristensen@webkit.org>
Remove unused CFURLCACHE code
https://bugs.webkit.org/show_bug.cgi?id=164551
Reviewed by Antti Koivisto.
* wtf/Platform.h:
2016-11-09 Alex Christensen <achristensen@webkit.org>
Allow RefPtrs of const ThreadSafeRefCounted types
https://bugs.webkit.org/show_bug.cgi?id=164548
Reviewed by Tim Horton.
* wtf/ThreadSafeRefCounted.h:
Make m_refCount mutable like we did with RefCounted in r203257.
2016-11-09 Chris Dumez <cdumez@apple.com>
[Mac] Stop using deprecated AppKit enumeration values
https://bugs.webkit.org/show_bug.cgi?id=164494
Reviewed by Darin Adler.
Stop using deprecated AppKit enumeration values.
* wtf/mac/AppKitCompatibilityDeclarations.h:
2016-11-05 Konstantin Tokarev <annulen@yandex.ru>
Fixed compilation of LLInt with MinGW
https://bugs.webkit.org/show_bug.cgi?id=164449
Reviewed by Michael Catanzaro.
MinGW uses LLIntAssembly.h with GNU assembler syntax, just like GCC on
other platforms.
* wtf/InlineASM.h: Define LOCAL_LABEL_STRING as .L#name for MinGW.
2016-11-05 Konstantin Tokarev <annulen@yandex.ru>
[MinGW] Fixed C99/C++11 format attributes in printf-like functions
https://bugs.webkit.org/show_bug.cgi?id=164448
Reviewed by Michael Catanzaro.
By default MinGW uses printf-like function provided in msvcrt.dll,
however they miss support for C99/C++11 format attributes. Use MinGW
implementations instead.
* wtf/Assertions.h: Use gnu_printf format in WTF_ATTRIBUTE_PRINTF
2016-11-05 Yusuke Suzuki <utatane.tea@gmail.com>
[JSCOnly] RunLoopGeneric should adopt MonotonicTime / WallTime change
https://bugs.webkit.org/show_bug.cgi?id=164447
Reviewed by Csaba Osztrogonác.
Build fix for JSCOnly.
* wtf/generic/RunLoopGeneric.cpp:
(WTF::RunLoop::TimerBase::ScheduledTask::create):
(WTF::RunLoop::TimerBase::ScheduledTask::ScheduledTask):
(WTF::RunLoop::TimerBase::ScheduledTask::scheduledTimePoint):
(WTF::RunLoop::TimerBase::ScheduledTask::updateReadyTime):
(WTF::RunLoop::populateTasks):
(WTF::RunLoop::dispatchAfter):
(WTF::RunLoop::TimerBase::start):
2016-11-04 Filip Pizlo <fpizlo@apple.com>
WTF::ParkingLot should stop using std::chrono because std::chrono::duration casts are prone to overflows
https://bugs.webkit.org/show_bug.cgi?id=152045
Reviewed by Andy Estes.
We used to use 'double' for all time measurements. Sometimes it was milliseconds,
sometimes it was seconds. Sometimes we measured a span of time, sometimes we spoke of time
since some epoch. When we spoke of time since epoch, we either used a monotonic clock or
a wall clock. The type - always 'double' - never told us what kind of time we had, even
though there were roughly six of them (sec interval, ms interval, sec since epoch on wall,
ms since epoch on wall, sec since epoch monotonic, ms since epoch monotonic).
At some point, we thought that it would be a good idea to replace these doubles with
std::chrono. But since replacing some things with std::chrono, we found it to be terribly
inconvenient:
- Outrageous API. I never want to say std::chrono::milliseconds(blah). I never want to say
std::chrono::steady_clock::timepoint. The syntax for duration_cast is ugly, and ideally
duration_cast would not even be a thing.
- No overflow protection. std::chrono uses integers by default and using anything else is
clumsy. But the integer math is done without regard for the rough edges of integer math,
so any cast between std::chrono types risks overflow. Any comparison risks overflow
because it may do conversions silently. We have even found bugs where some C++
implementations had more overflows than others, which ends up being a special kind of
hell. In many cases, the overflow also has nasal demons.
It's an error to represent time using integers. It would have been excusable back when
floating point math was not guaranteed to be supported on all platforms, but that would
have been a long time ago. Time is a continuous, infinite concept and it's a perfect fit
for floating point:
- Floating point preserves precision under multiplication in all but extreme cases, so
using floating point for time means that unit conversions are almost completely
lossless. This means that we don't have to think very hard about what units to use. In
this patch, we use seconds almost everywhere. We only convert at boundaries, like an API
boundary that wants something other than seconds.
- Floating point makes it easy to reason about infinity, which is something that time code
wants to do a lot. Example: when would you like to timeout? Infinity please! This is the
most elegant way of having an API support both a timeout variant and a no-timeout
variant.
- Floating point does well-understood things when math goes wrong, and these things are
pretty well optimized to match what a mathematician would do when computing with real
numbers represented using scientific notation with a finite number of significant
digits. This means that time math under floating point looks like normal math. On the
other hand, std::chrono time math looks like garbage because you have to always check
for multiple possible UB corners whenever you touch large integers. Integers that
represent time are very likely to be large and you don't have to do much to overflow
them. At this time, based on the number of bugs we have already seen due to chrono
overflows, I am not certain that we even understand what are all of the corner cases
that we should even check for.
This patch introduces a new set of timekeeping classes that are all based on double, and
all internally use seconds. These classes support algebraic typing. The classes are:
- Seconds: this is for measuring a duration.
- WallTime: time since epoch according to a wall clock (aka real time clock).
- MonotonicTime: time since epoch according to a monotonic clock.
- ClockType: enum that says either Wall or Monotonic.
- TimeWithDynamicClockType: a tuple of double and ClockType, which represents either a
wall time or a monotonic time.
All of these classes behave like C++ values and are cheap to copy around since they are
very nearly POD. This supports comprehensive conversions between the various time types.
Most of this is by way of algebra. Here are just some of the rules we recognize:
WallTime = WallTime + Seconds
Seconds = WallTime - WallTime
MonotonicTime = MonotonicTime + Seconds
etc...
We support negative, infinite, and NaN times because math.
We support conversions between MonotonicTime and WallTime, like:
WallTime wt = mt.approximateWallTime()
This is called this "approximate" because the only way to do it is to get the current time
on both clocks and convert relative to that.
Many of our APIs would be happy using whatever notion of time the user wanted to use. For
those APIs, which includes Condition and ParkingLot, we have TimeWithDynamicClockType. You
can automatically convert WallTime or MonotonicTime to TimeWithDynamicClockType. This
means that if you use a WallTime with Condition::waitUntil, then Condition's internal
logic for when it should wake up makes its decision based on the current WallTime - but if
you use MonotonicTime then waitUntil will make its decision based on current
MonotonicTime. This is a greater level of flexibility than chrono allowed, since chrono
did not have the concept of a dynamic clock type.
This patch does not include conversions between std::chrono and these new time classes,
because past experience shows that we're quite bad at getting conversions between
std::chrono and anything else right. Also, I didn't need such conversion code because this
patch only converts code that transitively touches ParkingLot and Condition. It was easy
to get all of that code onto the new time classes.
* WTF.xcodeproj/project.pbxproj:
* wtf/AutomaticThread.cpp:
(WTF::AutomaticThread::start):
* wtf/CMakeLists.txt:
* wtf/ClockType.cpp: Added.
(WTF::printInternal):
* wtf/ClockType.h: Added.
* wtf/Condition.h:
(WTF::ConditionBase::waitUntil):
(WTF::ConditionBase::waitFor):
(WTF::ConditionBase::wait):
(WTF::ConditionBase::waitUntilWallClockSeconds): Deleted.
(WTF::ConditionBase::waitUntilMonotonicClockSeconds): Deleted.
(WTF::ConditionBase::waitForSeconds): Deleted.
(WTF::ConditionBase::waitForSecondsImpl): Deleted.
(WTF::ConditionBase::waitForImpl): Deleted.
(WTF::ConditionBase::absoluteFromRelative): Deleted.
* wtf/CrossThreadQueue.h:
(WTF::CrossThreadQueue<DataType>::waitForMessage):
* wtf/CurrentTime.cpp:
(WTF::sleep):
* wtf/MessageQueue.h:
(WTF::MessageQueue::infiniteTime): Deleted.
* wtf/MonotonicTime.cpp: Added.
(WTF::MonotonicTime::now):
(WTF::MonotonicTime::approximateWallTime):
(WTF::MonotonicTime::dump):
(WTF::MonotonicTime::sleep):
* wtf/MonotonicTime.h: Added.
(WTF::MonotonicTime::MonotonicTime):
(WTF::MonotonicTime::fromRawDouble):
(WTF::MonotonicTime::infinity):
(WTF::MonotonicTime::secondsSinceEpoch):
(WTF::MonotonicTime::approximateMonotonicTime):
(WTF::MonotonicTime::operator bool):
(WTF::MonotonicTime::operator+):
(WTF::MonotonicTime::operator-):
(WTF::MonotonicTime::operator+=):
(WTF::MonotonicTime::operator-=):
(WTF::MonotonicTime::operator==):
(WTF::MonotonicTime::operator!=):
(WTF::MonotonicTime::operator<):
(WTF::MonotonicTime::operator>):
(WTF::MonotonicTime::operator<=):
(WTF::MonotonicTime::operator>=):
* wtf/ParkingLot.cpp:
(WTF::ParkingLot::parkConditionallyImpl):
(WTF::ParkingLot::unparkOne):
(WTF::ParkingLot::unparkOneImpl):
(WTF::ParkingLot::unparkCount):
* wtf/ParkingLot.h:
(WTF::ParkingLot::parkConditionally):
(WTF::ParkingLot::compareAndPark):
* wtf/Seconds.cpp: Added.
(WTF::Seconds::operator+):
(WTF::Seconds::operator-):
(WTF::Seconds::dump):
(WTF::Seconds::sleep):
* wtf/Seconds.h: Added.
(WTF::Seconds::Seconds):
(WTF::Seconds::value):
(WTF::Seconds::seconds):
(WTF::Seconds::milliseconds):
(WTF::Seconds::microseconds):
(WTF::Seconds::nanoseconds):
(WTF::Seconds::fromMilliseconds):
(WTF::Seconds::fromMicroseconds):
(WTF::Seconds::fromNanoseconds):
(WTF::Seconds::infinity):
(WTF::Seconds::operator bool):
(WTF::Seconds::operator+):
(WTF::Seconds::operator-):
(WTF::Seconds::operator*):
(WTF::Seconds::operator/):
(WTF::Seconds::operator+=):
(WTF::Seconds::operator-=):
(WTF::Seconds::operator*=):
(WTF::Seconds::operator/=):
(WTF::Seconds::operator==):
(WTF::Seconds::operator!=):
(WTF::Seconds::operator<):
(WTF::Seconds::operator>):
(WTF::Seconds::operator<=):
(WTF::Seconds::operator>=):
* wtf/TimeWithDynamicClockType.cpp: Added.
(WTF::TimeWithDynamicClockType::now):
(WTF::TimeWithDynamicClockType::nowWithSameClock):
(WTF::TimeWithDynamicClockType::wallTime):
(WTF::TimeWithDynamicClockType::monotonicTime):
(WTF::TimeWithDynamicClockType::approximateWallTime):
(WTF::TimeWithDynamicClockType::approximateMonotonicTime):
(WTF::TimeWithDynamicClockType::operator-):
(WTF::TimeWithDynamicClockType::operator<):
(WTF::TimeWithDynamicClockType::operator>):
(WTF::TimeWithDynamicClockType::operator<=):
(WTF::TimeWithDynamicClockType::operator>=):
(WTF::TimeWithDynamicClockType::dump):
(WTF::TimeWithDynamicClockType::sleep):
* wtf/TimeWithDynamicClockType.h: Added.
(WTF::TimeWithDynamicClockType::TimeWithDynamicClockType):
(WTF::TimeWithDynamicClockType::fromRawDouble):
(WTF::TimeWithDynamicClockType::secondsSinceEpoch):
(WTF::TimeWithDynamicClockType::clockType):
(WTF::TimeWithDynamicClockType::withSameClockAndRawDouble):
(WTF::TimeWithDynamicClockType::operator bool):
(WTF::TimeWithDynamicClockType::operator+):
(WTF::TimeWithDynamicClockType::operator-):
(WTF::TimeWithDynamicClockType::operator+=):
(WTF::TimeWithDynamicClockType::operator-=):
(WTF::TimeWithDynamicClockType::operator==):
(WTF::TimeWithDynamicClockType::operator!=):
* wtf/WallTime.cpp: Added.
(WTF::WallTime::now):
(WTF::WallTime::approximateMonotonicTime):
(WTF::WallTime::dump):
(WTF::WallTime::sleep):
* wtf/WallTime.h: Added.
(WTF::WallTime::WallTime):
(WTF::WallTime::fromRawDouble):
(WTF::WallTime::infinity):
(WTF::WallTime::secondsSinceEpoch):
(WTF::WallTime::approximateWallTime):
(WTF::WallTime::operator bool):
(WTF::WallTime::operator+):
(WTF::WallTime::operator-):
(WTF::WallTime::operator+=):
(WTF::WallTime::operator-=):
(WTF::WallTime::operator==):
(WTF::WallTime::operator!=):
(WTF::WallTime::operator<):
(WTF::WallTime::operator>):
(WTF::WallTime::operator<=):
(WTF::WallTime::operator>=):
* wtf/threads/BinarySemaphore.cpp:
(WTF::BinarySemaphore::wait):
* wtf/threads/BinarySemaphore.h:
2016-11-03 Filip Pizlo <fpizlo@apple.com>
DFG plays fast and loose with the shadow values of a Phi
https://bugs.webkit.org/show_bug.cgi?id=164309
Reviewed by Saam Barati.
Made this API use size rather than maxIndex as its initialization parameter, because that's
less confusing.
* wtf/IndexSparseSet.h:
(WTF::IndexSparseSet<OverflowHandler>::IndexSparseSet):
2016-11-03 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r208364.
https://bugs.webkit.org/show_bug.cgi?id=164402
broke the build (Requested by smfr on #webkit).
Reverted changeset:
"DFG plays fast and loose with the shadow values of a Phi"
https://bugs.webkit.org/show_bug.cgi?id=164309
http://trac.webkit.org/changeset/208364
2016-11-03 Filip Pizlo <fpizlo@apple.com>
DFG plays fast and loose with the shadow values of a Phi
https://bugs.webkit.org/show_bug.cgi?id=164309
Reviewed by Saam Barati.
Made this API use size rather than maxIndex as its initialization parameter, because that's
less confusing.
* wtf/IndexSparseSet.h:
(WTF::IndexSparseSet<OverflowHandler>::IndexSparseSet):
2016-11-03 Konstantin Tokarev <annulen@yandex.ru>
Fixes to build JSCOnly on macOS
https://bugs.webkit.org/show_bug.cgi?id=164379
Reviewed by Michael Catanzaro.
* wtf/Platform.h: JSCOnly port should not provide any PLATFORM() macro
2016-11-03 Brady Eidson <beidson@apple.com>
IndexedDB 2.0: Support binary keys.
<rdar://problem/28806927> and https://bugs.webkit.org/show_bug.cgi?id=164359
Reviewed by Alex Christensen.
* wtf/Hasher.h:
(WTF::StringHasher::hashMemory): Teach hashMemory() to handle buffers with odd lengths.
2016-11-02 Filip Pizlo <fpizlo@apple.com>
The GC should be in a thread
https://bugs.webkit.org/show_bug.cgi?id=163562
Reviewed by Geoffrey Garen and Andreas Kling.
This fixes some bugs and adds a few features.
* wtf/Atomics.h: The GC may do work on behalf of the JIT. If it does, the main thread needs to execute a cross-modifying code fence. This is cpuid on x86 and I believe it's isb on ARM. It would have been an isync on PPC and I think that isb is the ARM equivalent.
(WTF::arm_isb):
(WTF::crossModifyingCodeFence):
(WTF::x86_ortop):
(WTF::x86_cpuid):
* wtf/AutomaticThread.cpp: I accidentally had AutomaticThreadCondition inherit from ThreadSafeRefCounted<AutomaticThread> [sic]. This never crashed before because all of our prior AutomaticThreadConditions were immortal.
(WTF::AutomaticThread::AutomaticThread):
(WTF::AutomaticThread::~AutomaticThread):
(WTF::AutomaticThread::start):
* wtf/AutomaticThread.h:
* wtf/MainThread.cpp: Need to allow initializeGCThreads() to be called separately because it's now more than just a debugging thing.
(WTF::initializeGCThreads):
2016-11-02 Carlos Alberto Lopez Perez <clopez@igalia.com>
Clean wrong comment about compositing on the UI process.
https://bugs.webkit.org/show_bug.cgi?id=164339
Reviewed by Michael Catanzaro.
* wtf/Platform.h: The comment about compositing on the UI process
was added on r109302 but was not removed properly when the Qt port
was removed from trunk.
USE_PROTECTION_SPACE_AUTH_CALLBACK has nothing to do with it.
2016-11-02 Alex Christensen <achristensen@webkit.org>
Remove Battery Status API from the tree
https://bugs.webkit.org/show_bug.cgi?id=164213
Reviewed by Sam Weinig.
* wtf/FeatureDefines.h:
2016-11-02 Romain Bellessort <romain.bellessort@crf.canon.fr>
[Readable Streams API] Enable creation of ReadableByteStreamController
https://bugs.webkit.org/show_bug.cgi?id=164014
Reviewed by Youenn Fablet.
Added flag for the byte stream part of Readable Streams API.
* wtf/FeatureDefines.h:
2016-11-02 Per Arne Vollan <pvollan@apple.com>
[Win] Copy build results to AAS 'Program Files' folder.
https://bugs.webkit.org/show_bug.cgi?id=164273
Reviewed by Brent Fulgham.
The preferred location for the binaries is the AAS 'Program Files' folder.
* WTF.vcxproj/WTF.proj:
2016-10-29 Filip Pizlo <fpizlo@apple.com>
JSC should support SharedArrayBuffer
https://bugs.webkit.org/show_bug.cgi?id=163986
Reviewed by Keith Miller.
Adds some small things we need for SharedArrayBuffer.
* wtf/Atomics.h:
(WTF::Atomic::compareExchangeWeakRelaxed):
(WTF::Atomic::exchangeAdd):
(WTF::Atomic::exchangeAnd):
(WTF::Atomic::exchangeOr):
(WTF::Atomic::exchangeSub):
(WTF::Atomic::exchangeXor):
(WTF::atomicLoad):
(WTF::atomicStore):
(WTF::atomicCompareExchangeWeak):
(WTF::atomicCompareExchangeWeakRelaxed):
(WTF::atomicCompareExchangeStrong):
(WTF::atomicExchangeAdd):
(WTF::atomicExchangeAnd):
(WTF::atomicExchangeOr):
(WTF::atomicExchangeSub):
(WTF::atomicExchangeXor):
(WTF::atomicExchange):
(WTF::Atomic::exchangeAndAdd): Deleted.
(WTF::weakCompareAndSwap): Deleted.
We need to be able to do atomics operations on naked pointers. We also need to be able to do
all of the things that std::atomic does. This adds those things and renames
weakCompareAndSwap to atomicCompareExchangeWeakRelaxed so that we're using consistent
terminology.
* wtf/Bitmap.h:
(WTF::WordType>::concurrentTestAndSet): Renamed weakCompareAndSwap.
(WTF::WordType>::concurrentTestAndClear): Renamed weakCompareAndSwap.
* wtf/FastBitVector.h:
(WTF::FastBitVector::atomicSetAndCheck): Renamed weakCompareAndSwap.
* wtf/ParkingLot.cpp:
(WTF::ParkingLot::unparkOne):
(WTF::ParkingLot::unparkCount):
* wtf/ParkingLot.h:
Added unparkCount(), which lets you unpark some bounded number of threads and returns the
number of threads unparked. This is just a modest extension of unparkAll(). unparkAll() now
just calls unparkCount(ptr, UINT_MAX).
2016-10-30 Frederic Wang <fwang@igalia.com>
Use HarfBuzz ot-math API to parse the OpenType MATH table
https://bugs.webkit.org/show_bug.cgi?id=162671
Reviewed by Michael Catanzaro.
* wtf/Platform.h: By default, do not enable internal OpenType MATH parsing on GTK.
2016-10-25 Mark Lam <mark.lam@apple.com>
String.prototype.replace() should throw an OutOfMemoryError when using too much memory.
https://bugs.webkit.org/show_bug.cgi?id=163996
<rdar://problem/28263117>
Reviewed by Geoffrey Garen.
* wtf/Vector.h:
(WTF::minCapacity>::tryConstructAndAppend):
(WTF::minCapacity>::tryConstructAndAppendSlowCase):
- Added try versions of constructAndAppend() so that we can handle the failure
to allocate more gracefully.
2016-10-25 Konstantin Tokarev <annulen@yandex.ru>
Non-specialized version of deleteObject should not have template argument
https://bugs.webkit.org/show_bug.cgi?id=163943
Reviewed by Anders Carlsson.
Fixes compilation of GDIObject.h with MinGW
* wtf/win/GDIObject.h:
(WTF::deleteObject):
2016-10-24 Per Arne Vollan <pvollan@apple.com>
[Win] CMake build type is not set.
https://bugs.webkit.org/show_bug.cgi?id=163917
Reviewed by Alex Christensen.
The CMAKE_BUILD_TYPE variable should be set to Debug or Release.
* WTF.vcxproj/WTF.proj:
2016-10-23 Yusuke Suzuki <utatane.tea@gmail.com>
[DOMJIT] Add a way for DOMJIT::Patchpoint to express effects
https://bugs.webkit.org/show_bug.cgi?id=163657
Reviewed by Saam Barati.
Simplify nonEmptyRangesOverlap.
* wtf/MathExtras.h:
(WTF::nonEmptyRangesOverlap):
2016-10-23 Chris Dumez <cdumez@apple.com>
Another unreviewed attempt to fix the WatchOS / TvOS build after r207585.
<rdar://problem/28902292>
Disable USE_CFURLCONNECTION on newer WatchOS / TvOS.
* wtf/Platform.h:
2016-10-20 Keith Miller <keith_miller@apple.com>
Add support for WASM calls
https://bugs.webkit.org/show_bug.cgi?id=161727
Reviewed by Filip Pizlo and Michael Saboff.
Added a new decodeUInt64. Also, added WTF::LEBDecoder namespace.
* wtf/LEBDecoder.h:
(WTF::LEBDecoder::decodeUInt):
(WTF::LEBDecoder::decodeUInt32):
(WTF::LEBDecoder::decodeUInt64):
(WTF::LEBDecoder::decodeInt32):
(decodeUInt32): Deleted.
(decodeInt32): Deleted.
2016-10-20 Filip Pizlo <fpizlo@apple.com>
The tracking of the coarse-grain Heap state (allocating or not, collector or not, eden vs full) should respect the orthogonality between allocating and collecting
https://bugs.webkit.org/show_bug.cgi?id=163738
Reviewed by Geoffrey Garen.
There will soon be different kinds of GC threads, and WTF's "are you a GC thread" thing
should know about this.
* wtf/MainThread.cpp:
(WTF::initializeGCThreads):
(WTF::registerGCThread):
(WTF::mayBeGCThread):
* wtf/MainThread.h:
2016-10-19 Sam Weinig <sam@webkit.org>
Add convenience function that combines WTF::visit(...) with WTF::makeVisitor(...)
https://bugs.webkit.org/show_bug.cgi?id=163713
Reviewed by Dan Bernstein.
- Add WTF::switchOn which merges WTF::visit with WTF::makeVisitor in the following
way:
WTF::visit(WTF::makeVisitor(...), variant)
* wtf/Variant.h:
(WTF::switchOn):
2016-10-19 Alex Christensen <achristensen@webkit.org>
Revert r207151
https://bugs.webkit.org/show_bug.cgi?id=163675
Reviewed by Brent Fulgham.
* wtf/Platform.h:
* wtf/SchedulePair.h:
* wtf/SchedulePairMac.mm:
2016-10-19 Filip Pizlo <fpizlo@apple.com>
REGRESSION (r207480): 3 Dromaeo tests failing
https://bugs.webkit.org/show_bug.cgi?id=163633
Reviewed by Mark Lam.
It's a ParkingLot bug: if we timeout and get unparked at the same time, then the unparking
thread will clear our address eventually - but not immediately. This causes a nasty
assertion failure. The tricky thing is that when we detect this, we need to wait until that
unparking thread does the deed. Otherwise, they will still do it at some later time.
Alternatively, we could use some kind of versioning to detect this - increment the version
when you park, so that unparking threads will know if they are time travelers. That seems
more yucky.
I don't think it matters too much what we do here, so long as it's simple and correct, since
this requires a race that is rare enough that it didn't happen once in my testing, and I was
pretty thorough. For example, it didn't happen once in 15 runs of JetStream. The race is
rare because it requires the timeout to happen right as someone else is unparking. Since
it's so rare, its probably OK that the unparked thread waits just a tiny moment until the
unparking thread is done.
* wtf/ParkingLot.cpp:
(WTF::ParkingLot::parkConditionallyImpl):
(WTF::ParkingLot::unparkOneImpl):
2016-10-19 Filip Pizlo <fpizlo@apple.com>
Baseline JIT should use AutomaticThread
https://bugs.webkit.org/show_bug.cgi?id=163686
Reviewed by Geoffrey Garen.
Added a AutomaticThreadCondition::wait() method, so that if you really want to use one
common condition for your thread and something else, you can do it. This trivially works
if you only use notifyAll(), and behaves as you'd expect for notifyOne() (i.e. it's
dangerous, since you don't know who will wake up).
The Baseline JIT used the one-true-Condition idiom because it used notifyAll() in an
optimal way: there are just two threads talking to each other, so it wakes up at most one
thread and that thread is exactly the one you want woken up. Adding wait() means that I did
not have to change that code.
* wtf/AutomaticThread.cpp:
(WTF::AutomaticThreadCondition::wait):
* wtf/AutomaticThread.h:
2016-10-18 Filip Pizlo <fpizlo@apple.com>
DFG worklist should use AutomaticThread
https://bugs.webkit.org/show_bug.cgi?id=163615
Reviewed by Mark Lam.
This adds new functionality to AutomaticThread to support DFG::Worklist:
- AutomaticThread::threadDidStart/threadWillStop virtual methods called at the start and end
of a thread's lifetime. This allows Worklist to tie some resources to the life of the
thread, and also means that now those resources will naturally free up when the Worklist is
not in use.
- AutomaticThreadCondition::notifyOne(). This required changes to Condition::notifyOne(). We
need to know if the Condition woke up anyone. If it didn't, then we need to launch one of
our threads.
* wtf/AutomaticThread.cpp:
(WTF::AutomaticThreadCondition::notifyOne):
(WTF::AutomaticThread::ThreadScope::ThreadScope):
(WTF::AutomaticThread::ThreadScope::~ThreadScope):
(WTF::AutomaticThread::start):
(WTF::AutomaticThread::threadDidStart):
(WTF::AutomaticThread::threadWillStop):
* wtf/AutomaticThread.h:
* wtf/Condition.h:
(WTF::ConditionBase::notifyOne):
2016-10-18 Sam Weinig <sam@webkit.org>
Replace std::experimental::variant with WTF::Variant (or similar)
https://bugs.webkit.org/show_bug.cgi?id=163626
Reviewed by Chris Dumez.
Rename std::experimental::variant, Variant. Move helpers get/holds_alternative/etc.
into the WTF namespace.
* wtf/Forward.h:
* wtf/Variant.h:
2016-10-18 Filip Pizlo <fpizlo@apple.com>
WTF should make it easier to create threads that die automatically after inactivity
https://bugs.webkit.org/show_bug.cgi?id=163576
Reviewed by Andreas Kling.
For a long time now, I've been adding threads to WTF/JSC and each time I do this, I feel
guilty because those threads don't shut down when they are inactive. For example, in bug
163562, I need to add a new GC thread. There will be one of them per VM. This means that a
JSC API client that starts a lot of VMs will have a lot of threads. I don't think that's
good.
A common pattern for all of these threads is that they have some well-defined trigger that
causes them to run. This trigger has a lock, a condition variable, some logic that determines
if there is work to do, and then of course the logic for the thread's actual work. The thread
bodies usually look like this:
void Thingy::runThread()
{
for (;;) {
Work work;
{
LockHolder locker(m_lock);
while (!hasWork())
m_cond.wait(m_lock);
work = takeWork();
}
doWork(work);
}
}
If you look at ParallelHelperPool (the GC's threads) and DFG::Worklist (some of the JIT's
threads), you will see this pattern.
This change adds a new kind of thread, called AutomaticThread, that lets you write threads to
this pattern while getting automatic thread shutdown for free: instead of just waiting on a
condition variable, AutomaticThread will have a timeout that causes the thread to die. The
condition variable associated with AutomaticThread, called AutomaticThreadCondition, is smart
enough to restart any threads that have decided to stop due to inactivity. The inactivity
threshold is current just 1 second.
In this patch I only adopt AutomaticThread for ParallelHelperPool. I plan to adopt it in more
places soon.
* WTF.xcodeproj/project.pbxproj:
* wtf/AutomaticThread.cpp: Added.
(WTF::AutomaticThreadCondition::create):
(WTF::AutomaticThreadCondition::AutomaticThreadCondition):
(WTF::AutomaticThreadCondition::~AutomaticThreadCondition):
(WTF::AutomaticThreadCondition::notifyAll):
(WTF::AutomaticThreadCondition::add):
(WTF::AutomaticThreadCondition::remove):
(WTF::AutomaticThreadCondition::contains):
(WTF::AutomaticThread::AutomaticThread):
(WTF::AutomaticThread::~AutomaticThread):
(WTF::AutomaticThread::join):
(WTF::AutomaticThread::start):
* wtf/AutomaticThread.h: Added.
* wtf/CMakeLists.txt:
* wtf/ParallelHelperPool.cpp:
(WTF::ParallelHelperClient::ParallelHelperClient):
(WTF::ParallelHelperClient::~ParallelHelperClient):
(WTF::ParallelHelperClient::setTask):
(WTF::ParallelHelperClient::finish):
(WTF::ParallelHelperClient::doSomeHelping):
(WTF::ParallelHelperClient::runTask):
(WTF::ParallelHelperPool::ParallelHelperPool):
(WTF::ParallelHelperPool::~ParallelHelperPool):
(WTF::ParallelHelperPool::ensureThreads):
(WTF::ParallelHelperPool::doSomeHelping):
(WTF::ParallelHelperPool::Thread::Thread):
(WTF::ParallelHelperPool::didMakeWorkAvailable):
(WTF::ParallelHelperPool::helperThreadBody): Deleted.
(WTF::ParallelHelperPool::waitForClientWithTask): Deleted.
* wtf/ParallelHelperPool.h:
2016-10-18 Said Abou-Hallawa <sabouhallawa@apple.com>
SVGCSSParser: m_implicitShorthand value is not reset after adding the shorthand property
https://bugs.webkit.org/show_bug.cgi?id=116470
Reviewed by Simon Fraser.
* wtf/TemporaryChange.h:
(WTF::TemporaryChange::TemporaryChange):
Add a new constructor to make TemporaryChange work as a restorer. The
temporary change will happen after we construct the object.
2016-10-17 Simon Fraser <simon.fraser@apple.com>
Implement DOMRect/DOMRectReadOnly
https://bugs.webkit.org/show_bug.cgi?id=163464
Reviewed by Darin Adler.
Implement min()/max() in a way that follows Math.min/Math.max, which return
NaN if either argument is NaN.
* wtf/MathExtras.h:
(WTF::nanPropagatingMin):
(WTF::nanPropagatingMax):
2016-10-15 Sam Weinig <sam@webkit.org>
MessageEvent's source property should be a (DOMWindow or MessagePort)? rather than a EventTarget?
https://bugs.webkit.org/show_bug.cgi?id=163475
Reviewed by Simon Fraser.
* wtf/Variant.h:
Add missing return statement that was tripping up some compilers.
2016-10-12 Ryan Haddad <ryanhaddad@apple.com>
Unreviewed, rolling out r207225.
This change causes debug tests to exit early with crashes.
Reverted changeset:
"Optional's move-constructor and move-assignment operator
don't disengage the value being moved from"
https://bugs.webkit.org/show_bug.cgi?id=163309
http://trac.webkit.org/changeset/207225
2016-10-11 Sam Weinig <sam@webkit.org>
Optional's move-constructor and move-assignment operator don't disengage the value being moved from
https://bugs.webkit.org/show_bug.cgi?id=163309
Reviewed by Anders Carlsson.
* wtf/Optional.h:
(WTF::Optional::Optional):
(WTF::Optional::operator=):
Disengage 'other' on move-construction and move-assignment.
2016-10-08 Filip Pizlo <fpizlo@apple.com>
MarkedBlock should know what objects are live during marking
https://bugs.webkit.org/show_bug.cgi?id=162309
Reviewed by Geoffrey Garen.
This removes the atomicity mode, because it's not really used: it only affects the
concurrentBlah methods, but their only users turn on atomicity. This was useful because
previously, some binary Bitmap methods (like merge(const Bitmap&)) couldn't be used
effectively in the GC because some of the GC's bitmaps set the atomic mode and some didn't.
Removing this useless mode is the best solution.
Also added some new binary Bitmap methods: mergeAndClear(Bitmap& other) and
setAndClear(Bitmap& other). They perform their action on 'this' (either merge or set,
respectively) while also clearing the contents of 'other'. This is great for one of the GC
hot paths.
* wtf/Bitmap.h:
(WTF::WordType>::Bitmap):
(WTF::WordType>::get):
(WTF::WordType>::set):
(WTF::WordType>::testAndSet):
(WTF::WordType>::testAndClear):
(WTF::WordType>::concurrentTestAndSet):
(WTF::WordType>::concurrentTestAndClear):
(WTF::WordType>::clear):
(WTF::WordType>::clearAll):
(WTF::WordType>::nextPossiblyUnset):
(WTF::WordType>::findRunOfZeros):
(WTF::WordType>::count):
(WTF::WordType>::isEmpty):
(WTF::WordType>::isFull):
(WTF::WordType>::merge):
(WTF::WordType>::filter):
(WTF::WordType>::exclude):
(WTF::WordType>::forEachSetBit):
(WTF::WordType>::mergeAndClear):
(WTF::WordType>::setAndClear):
(WTF::=):
(WTF::WordType>::hash):
2016-10-11 Said Abou-Hallawa <sabouhallawa@apple.com>
Add SynchronizedFixedQueue class
https://bugs.webkit.org/show_bug.cgi?id=162478
Reviewed by Geoffrey Garen.
This class represents a simple producer/consumer worker. It facilitates
synchronizing enqueuing to and dequeuing from a fixed size-queue. It uses
a single lock and a single condition to synchronize all its members among
the working threads. This means a single thread is active at any time and
and the other threads are blocked waiting for the lock to be released. Or
they are sleeping waiting for the condition to be satisfied.
* WTF.xcodeproj/project.pbxproj:
* wtf/SynchronizedFixedQueue.h: Added.
(WTF::SynchronizedFixedQueue::SynchronizedFixedQueue):
(WTF::SynchronizedFixedQueue::open): Restore the queue to its original state.
(WTF::SynchronizedFixedQueue::close): Wake all the sleeping threads with a closing state.
(WTF::SynchronizedFixedQueue::isOpen): Does the queue accept new items?
(WTF::SynchronizedFixedQueue::enqueue): Enqueue an item into the queue.
(WTF::SynchronizedFixedQueue::dequeue): Dequeue an item form the queue.
2016-10-11 Alex Christensen <achristensen@webkit.org>
Remove dead networking code
https://bugs.webkit.org/show_bug.cgi?id=163263
Reviewed by Daniel Bates.
* wtf/Platform.h:
* wtf/SchedulePair.h:
* wtf/SchedulePairMac.mm:
2016-10-10 Zan Dobersek <zdobersek@igalia.com>
Add ENABLE_ENCRYPTED_MEDIA configuration option
https://bugs.webkit.org/show_bug.cgi?id=163219
Reviewed by Darin Adler.
* wtf/FeatureDefines.h:
If undefined, define the ENABLE_ENCRYPTED_MEDIA option to 0.
2016-10-10 Yusuke Suzuki <utatane.tea@gmail.com>
[DOMJIT] Implement Node accessors in DOMJIT
https://bugs.webkit.org/show_bug.cgi?id=163005
Reviewed by Filip Pizlo.
Add CAST_OFFSET. It is not necessary for JSCell thingy
since we don't use virtual member functions. However, it
is not true for WebCore DOM wrapped objects.
* wtf/StdLibExtras.h:
2016-10-07 Chris Dumez <cdumez@apple.com>
window.navigator.language incorrectly returns all lowercase string
https://bugs.webkit.org/show_bug.cgi?id=163096
Reviewed by Darin Adler.
Update platformUserPreferredLanguages() so that it no longer lowercases
the string it returns. On Mac, we rely on CFLocale which returns
BCP-47 language tags as per:
- https://developer.apple.com/reference/corefoundation/1666963-cflocale?language=objc
* wtf/PlatformUserPreferredLanguagesMac.mm:
(WTF::httpStyleLanguageCode):
* wtf/PlatformUserPreferredLanguagesUnix.cpp:
(WTF::platformLanguage):
2016-10-06 Brent Fulgham <bfulgham@apple.com>
[Win][Direct2D] Add Direct2D CMake rules
https://bugs.webkit.org/show_bug.cgi?id=162925
Reviewed by Brent Fulgham.
* wtf/Platform.h: Don't USE(CA) or USE(CG) if building
with Direct2D.
2016-10-05 Yusuke Suzuki <utatane.tea@gmail.com>
[DOMJIT] Add initial CheckDOM and CallDOM implementations
https://bugs.webkit.org/show_bug.cgi?id=162941
Reviewed by Filip Pizlo.
* wtf/Box.h:
(WTF::Box::Box):
2016-10-05 Zan Dobersek <zdobersek@igalia.com>
Rename ENABLE_ENCRYPTED_MEDIA_V2 to ENABLE_LEGACY_ENCRYPTED_MEDIA
https://bugs.webkit.org/show_bug.cgi?id=162903
Reviewed by Alex Christensen.
Rename build guards for the remaining implementation of the legacy EME API
to ENABLE_LEGACY_ENCRYPTED_MEDIA. This will allow for the future implementation
of the near-finished API to be guarded with the simple ENABLE_ENCRYPTED_MEDIA guards.
* wtf/FeatureDefines.h:
2016-10-04 Saam Barati <sbarati@apple.com>
String.prototype.toLowerCase should be a DFG/FTL intrinsic
https://bugs.webkit.org/show_bug.cgi?id=162887
Reviewed by Filip Pizlo and Yusuke Suzuki.
This patch exposes a new StringImpl function called convertToLowercaseWithoutLocaleStartingAtFailingIndex8Bit
which extracts slow path for the 8-bit part of convertToLowercaseWithoutLocale
into a helper function. I decided to extract this into its own function because
it may be the case that JSCs JITs will want to continue the operation
after it has already ensured that part of an 8-bit string is lower case.
* wtf/text/StringImpl.cpp:
(WTF::StringImpl::convertToLowercaseWithoutLocale):
(WTF::StringImpl::convertToLowercaseWithoutLocaleStartingAtFailingIndex8Bit):
* wtf/text/StringImpl.h:
* wtf/text/WTFString.cpp:
(WTF::String::convertToLowercaseWithoutLocaleStartingAtFailingIndex8Bit):
* wtf/text/WTFString.h:
2016-10-04 Chris Dumez <cdumez@apple.com>
Implement KeyboardEvent.code from the UI Event spec
https://bugs.webkit.org/show_bug.cgi?id=149584
Reviewed by Darin Adler.
Add build time flag to toggle support for the code attribute on
KeyboardEvent and only enable it on Mac for now, given that the
implementation is missing on other platforms.
* wtf/FeatureDefines.h:
2016-10-03 Chris Dumez <cdumez@apple.com>
Add support for KeyboardEvent.key attribute
https://bugs.webkit.org/show_bug.cgi?id=36267
Reviewed by Darin Adler.
Add compile time flag for the key attribute on KeyboardEvent and enable
it on Cocoa only.
* wtf/FeatureDefines.h:
2016-09-29 Sam Weinig <sam@webkit.org>
Add initial support for IDL union conversion
https://bugs.webkit.org/show_bug.cgi?id=161576
Reviewed by Chris Dumez.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
Add Brigand.h
* wtf/Brigand.h: Added.
Import a standalone copy of Edouard Alligand and Joel Falcou's
Brigand library for help with for help with list based meta programming
* wtf/StdLibExtras.h:
Add a new three new type traits, IsTemplate, IsBaseOfTemplate and RemoveCVAndReference.
- IsTemplate acts like std::is_class, but works with a generic base.
- IsBaseOfTemplate acts like std::is_base_of, but works with a generic base.
- RemoveCVAndReference combines std::remove_cv and std::remove_reference.
2016-09-30 Filip Pizlo <fpizlo@apple.com>
B3::moveConstants should be able to edit code to minimize the number of constants
https://bugs.webkit.org/show_bug.cgi?id=162764
Reviewed by Saam Barati.
I thought it would be a good idea to document the fact that dominator traversal happens in a
particular order for a reason.
* wtf/Dominators.h:
2016-09-29 Filip Pizlo <fpizlo@apple.com>
Air should have a way of expressing additional instruction flags
https://bugs.webkit.org/show_bug.cgi?id=162699
Reviewed by Mark Lam.
* wtf/CommaPrinter.h:
(WTF::CommaPrinter::CommaPrinter):
(WTF::CommaPrinter::dump):
(WTF::CommaPrinter::didPrint):
2016-09-30 Youenn Fablet <youenn@apple.com>
Add a way to go from a RefPtr<T> to Ref<const T>
https://bugs.webkit.org/show_bug.cgi?id=162683
Reviewed by Alex Christensen.
* wtf/RefPtr.h:
(WTF::RefPtr::releaseConstNonNull): Added.
2016-09-29 Mark Lam <mark.lam@apple.com>
Re-enable StringView life-cycle checking.
https://bugs.webkit.org/show_bug.cgi?id=160384
<rdar://problem/28479434>
Reviewed by Saam Barati.
Re-landing after slow running tests have been resolved.
* wtf/text/StringView.h:
2016-09-29 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r206563.
https://bugs.webkit.org/show_bug.cgi?id=162732
Caused stress/op_*.js.ftl-no-cjit tests to time out (Requested
by ryanhaddad on #webkit).
Reverted changeset:
"Re-enable StringView life-cycle checking."
https://bugs.webkit.org/show_bug.cgi?id=160384
http://trac.webkit.org/changeset/206563
2016-09-29 Fujii Hironori <Hironori.Fujii@sony.com>
Clang 3.9 reports a compilation warning about ENABLE_EXCEPTION_SCOPE_VERIFICATION
https://bugs.webkit.org/show_bug.cgi?id=162718
Reviewed by Alex Christensen.
Clang 3.9 reports a following compilation warning:
Source/JavaScriptCore/runtime/VM.h:656:5: warning: macro expansion producing 'defined' has undefined behavior [-Wexpansion-to-defined]
* wtf/Platform.h: Changed the definition of ENABLE_EXCEPTION_SCOPE_VERIFICATION not to use 'defined'.
2016-09-28 Mark Lam <mark.lam@apple.com>
Re-enable StringView life-cycle checking.
https://bugs.webkit.org/show_bug.cgi?id=160384
<rdar://problem/28479434>
Reviewed by Saam Barati.
* wtf/text/StringView.h:
2016-09-28 Filip Pizlo <fpizlo@apple.com>
The write barrier should be down with TSO
https://bugs.webkit.org/show_bug.cgi?id=162316
Reviewed by Geoffrey Garen.
Added clearRange(), which quickly clears a range of bits. This turned out to be useful for
a DFG optimization pass.
* wtf/FastBitVector.cpp:
(WTF::FastBitVector::clearRange):
* wtf/FastBitVector.h:
2016-09-28 Mark Lam <mark.lam@apple.com>
Fix race condition in StringView's UnderlyingString lifecycle management.
https://bugs.webkit.org/show_bug.cgi?id=162702
Reviewed by Geoffrey Garen.
There 2 relevant functions at play:
void StringView::setUnderlyingString(const StringImpl* string)
{
UnderlyingString* underlyingString;
if (!string)
underlyingString = nullptr;
else {
std::lock_guard<StaticLock> lock(underlyingStringsMutex);
auto result = underlyingStrings().add(string, nullptr);
if (result.isNewEntry)
result.iterator->value = new UnderlyingString(*string);
else
++result.iterator->value->refCount;
underlyingString = result.iterator->value; // Point P2.
}
adoptUnderlyingString(underlyingString); // Point P5.
}
... and ...
void StringView::adoptUnderlyingString(UnderlyingString* underlyingString)
{
if (m_underlyingString) {
// Point P0.
if (!--m_underlyingString->refCount) {
if (m_underlyingString->isValid) { // Point P1.
std::lock_guard<StaticLock> lock(underlyingStringsMutex);
underlyingStrings().remove(&m_underlyingString->string); // Point P3.
}
delete m_underlyingString; // Point P4.
}
}
m_underlyingString = underlyingString;
}
Imagine the following scenario:
1. Thread T1 has been using an UnderlyingString U1, and is now done with it.
T1 runs up to point P1 in adoptUnderlyingString(), and is blocked waiting for
the underlyingStringsMutex (which is currently being held by Thread T2).
2. Context switch to Thread T2.
T2 wants to use UnderlyingString U1, and runs up to point P2 in setUnderlyingString()
and releases the underlyingStringsMutex.
Note: T2 thinks it has successfully refCounted U1, and therefore U1 is safe to use.
3. Context switch to Thread T1.
T1 acquires the underlyingStringsMutex, and proceeds to remove it from the
underlyingStrings() map (see Point P3). It thinks it has successfully done so
and proceeds to delete U1 (see Point P4).
4. Context switch to Thread T2.
T2 proceeds to use U1 (see Point P5 in setUnderlyingString()).
Note: U1 has already been freed. This is a use after free.
The fix is to acquire the underlyingStringsMutex at Point P0 in adoptUnderlyingString()
instead of after P1. This ensures that the decrementing of the UnderlyingString
refCount and its removal from the underlyingStrings() map is done as an atomic unit.
Note: If you look in StringView.cpp, you see another setUnderlyingString() which
takes a StringView otherString. This version of setUnderlyingString() can only
be called from within the same thread that created the other StringView. As a
result, here, we are guaranteed that the UnderlyingString refCount is never zero,
and there's no other threat of another thread trying to delete the UnderlyingString
while we adopt it. Hence, we don't need to acquire the underlyingStringsMutex
here.
This race condition was found when running layout tests fetch/fetch-worker-crash.html
and storage/indexeddb/modern/opendatabase-versions.html when CHECK_STRINGVIEW_LIFETIME
is enabled. This issue resulted in those tests crashing due to a use-after-free.
* wtf/text/StringView.cpp:
(WTF::StringView::adoptUnderlyingString):
(WTF::StringView::setUnderlyingString):
2016-09-28 Brent Fulgham <bfulgham@apple.com>
Correct 'safeCast' implementation
https://bugs.webkit.org/show_bug.cgi?id=162679
<rdar://problem/28518189>
Reviewed by Zalan Bujtas.
* wtf/StdLibExtras.h:
(WTF::safeCast): Use a RELEASE_ASSERT.
2016-09-27 Don Olmstead <don.olmstead@am.sony.com>
[CMake] Add HAVE_LOCALTIME_R definition
https://bugs.webkit.org/show_bug.cgi?id=162636
Reviewed by Alex Christensen.
* wtf/DateMath.cpp:
(WTF::getLocalTime):
* wtf/GregorianDateTime.cpp:
(WTF::GregorianDateTime::setToCurrentLocalTime):
* wtf/Platform.h:
2016-09-27 JF Bastien <jfbastien@apple.com>
Speed up Heap::isMarkedConcurrently
https://bugs.webkit.org/show_bug.cgi?id=162095
Reviewed by Filip Pizlo.
Heap::isMarkedConcurrently had a load-load fence which is expensive on weak memory ISAs such as ARM.
This patch is fairly perf-neutral overall, but the GC's instrumentation reports:
GC:Eden is 93% average runtime after change
GC:Full is 76% average runtime after change
The fence was there because:
1. If the read of m_markingVersion in MarkedBlock::areMarksStale isn't what's expected then;
2. The read of m_marks in MarkedBlock::isMarked needs to observe the value that was stored *before* m_markingVersion was stored.
This ordering isn't guaranteed on ARM, which has a weak memory model.
There are 3 ways to guarantee this ordering:
A. Use a barrier instruction.
B. Use a load-acquire (new in ARMv8).
C. use ARM's address dependency rule, which C++ calls memory_order_consume.
In general:
A. is slow but orders all of memory in an intuitive manner.
B. is faster-ish and has the same property-ish.
C. should be faster still, but *only orders dependent loads*. This last part is critical! Consume isn't an all-out replacement for acquire (acquire is rather a superset of consume).
ARM explains the address dependency rule in their document "barrier litmus tests and cookbook":
> *Resolving by the use of barriers and address dependency*
>
> There is a rule within the ARM architecture that:
> Where the value returned by a read is used to compute the virtual address of a subsequent read or write (this is known as an address dependency), then these two memory accesses will be observed in program order. An address dependency exists even if the value read by the first read has no effect in changing the virtual address (as might be the case if the value returned is masked off before it is used, or if it had no effect on changing a predicted address value).
> This restriction applies only when the data value returned from one read is used as a data value to calculate the address of a subsequent read or write. This does not apply if the data value returned from one read is used to determine the condition code flags, and the values of the flags are used for condition code evaluation to determine the address of a subsequent reads, either through conditional execution or the evaluation of a branch. This is known as a control dependency.
> Where both a control and address dependency exist, the ordering behaviour is consistent with the address dependency.
C++'s memory_order_consume is unfortunately unimplemented by C++ compilers, and maybe unimplementable as spec'd. I'm working with interested folks in the committee to fix this situation: http://wg21.link/p0190r2
* wtf/Atomics.h:
(WTF::zeroWithConsumeDependency): a 0 which carries a dependency
(WTF::consumeLoad): pixie magic
2016-09-27 JF Bastien <jfbastien@apple.com>
Atomics.h on Windows: remove seq_cst hack
https://bugs.webkit.org/show_bug.cgi?id=162022
Reviewed by Mark Lam.
No need to force access to seq_cst, always inlining fixes the MSVC warning.
* wtf/Atomics.h:
(WTF::Atomic::compareExchangeWeak): remove seq_cst hack
(WTF::Atomic::compareExchangeStrong): remove seq_cst hack
(WTF::Atomic::exchangeAndAdd): remove seq_cst hack
(WTF::Atomic::exchange): remove seq_cst hack
2016-09-27 Don Olmstead <don.olmstead@am.sony.com>
[CMake] Use CMake to determine HAVE_* defines
https://bugs.webkit.org/show_bug.cgi?id=162368
Reviewed by Alex Christensen.
* wtf/Platform.h:
2016-09-20 Anders Carlsson <andersca@apple.com>
PlatformEvent::m_modifiers should be an OptionSet
https://bugs.webkit.org/show_bug.cgi?id=162326
Reviewed by Daniel Bates.
* wtf/OptionSet.h:
(WTF::OptionSet::operator!=):
(WTF::OptionSet::operator-):
2016-09-27 Jer Noble <jer.noble@apple.com>
Remove deprecated ENCRYPTED_MEDIA implementation.
https://bugs.webkit.org/show_bug.cgi?id=161010
Reviewed by Eric Carlson.
Remove ENABLE_ENCRYPTED_MEDIA.
* wtf/FeatureDefines.h:
2016-09-27 Youenn Fablet <youenn@apple.com>
[Fetch API] Use Ref<const T> in FetchBody::m_data variant
https://bugs.webkit.org/show_bug.cgi?id=162599
Reviewed by Alex Christensen.
Enabling to use DeferrableRefCounted<const T> by making m_refCount mutable.
* wtf/DeferrableRefCounted.h:
(WTF::DeferrableRefCountedBase::ref):
(WTF::DeferrableRefCountedBase::derefBase):
(WTF::DeferrableRefCounted::deref):
2016-09-26 Daniel Bates <dabates@apple.com>
Rename IOS_TEXT_AUTOSIZING to TEXT_AUTOSIZING
https://bugs.webkit.org/show_bug.cgi?id=162365
Reviewed by Simon Fraser.
* wtf/FeatureDefines.h:
2016-09-26 Benjamin Poulain <benjamin@webkit.org>
[JSC] Shrink the Math inline caches some more
https://bugs.webkit.org/show_bug.cgi?id=162485
Reviewed by Saam Barati.
* wtf/Bag.h:
Don't copy the arguments before initializing the nodes.
2016-09-26 Michael Catanzaro <mcatanzaro@igalia.com>
std::unique_ptr deleter functions should not check if pointer is null
https://bugs.webkit.org/show_bug.cgi?id=162558
Reviewed by Alex Christensen.
std::unique_ptr already does this before calling the deleter.
* wtf/efl/UniquePtrEfl.h:
* wtf/glib/GUniquePtr.h:
== Rolled over to ChangeLog-2016-09-26 ==