commit | 5a101e5c55ed674dc2435cb84eb458bfbdc2b324 | [log] [tgz] |
---|---|---|
author | fpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc> | Tue May 22 19:20:05 2018 +0000 |
committer | fpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc> | Tue May 22 19:20:05 2018 +0000 |
tree | 40a1b0403fb93f5b778a725bc44914e696b57567 | |
parent | 8ce35507baa5ca67373730267523fb34807e47a7 [diff] |
Get rid of TLCs https://bugs.webkit.org/show_bug.cgi?id=185846 Rubber stamped by Geoffrey Garen. Source/JavaScriptCore: This removes support for thread-local caches from the GC in order to speed up allocation a bit. We added TLCs as part of Spectre mitigations, which we have since removed. We will want some kind of TLCs eventually, since they allow us to: - have a global GC, which may be a perf optimization at some point. - allocate objects from JIT threads, which we've been wanting to do for a while. This change keeps the most interesting aspect of TLCs, which is the LocalAllocator/BlockDirectory separation. This means that it ought to be easy to implement TLCs again in the future if we wanted this feature. This change removes the part of TLCs that causes a perf regression, namely that Allocator is an offset that requires a bounds check and lookup that makes the rest of the allocation fast path dependent on the load of the TLC. Now, Allocator is really just a LocalAllocator*, so you can directly use it to allocate. This removes two loads and a check from the allocation fast path. In hindsight, I probably could have made that whole thing more efficient, had I allowed us to have a statically known set of LocalAllocators. This would have removed the bounds check (one load and one branch) and it would have made it possible to CSE the load of the TLC data structure, since that would no longer resize. But that's a harder change that this patch, and we don't need it right now. While reviewing the allocation hot paths, I found that CreateThis had an unnecessary branch to check if the allocator is null. I removed that check. AssemblyHelpers::emitAllocate() does that check already. Previously, the TLC bounds check doubled as this check. This is a 1% speed-up on Octane and a 2.3% speed-up on TailBench. However, the Octane speed-up on my machine includes an 8% regexp speed-up. I've found that sometimes regexp speeds up or slows down by 8% depending on which path I build JSC from. Without that 8%, this is still an Octane speed-up due to 2-4% speed-ups in earley, boyer, raytrace, and splay. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * bytecode/ObjectAllocationProfileInlines.h: (JSC::ObjectAllocationProfile::initializeProfile): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileCreateThis): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileMakeRope): (JSC::FTL::DFG::LowerDFGToB3::compileMaterializeNewObject): (JSC::FTL::DFG::LowerDFGToB3::allocatePropertyStorageWithSizeImpl): (JSC::FTL::DFG::LowerDFGToB3::allocateHeapCell): (JSC::FTL::DFG::LowerDFGToB3::allocateObject): (JSC::FTL::DFG::LowerDFGToB3::allocatorForSize): * heap/Allocator.cpp: (JSC::Allocator::cellSize const): * heap/Allocator.h: (JSC::Allocator::Allocator): (JSC::Allocator::localAllocator const): (JSC::Allocator::operator== const): (JSC::Allocator::offset const): Deleted. * heap/AllocatorInlines.h: (JSC::Allocator::allocate const): (JSC::Allocator::tryAllocate const): Deleted. * heap/BlockDirectory.cpp: (JSC::BlockDirectory::BlockDirectory): (JSC::BlockDirectory::~BlockDirectory): * heap/BlockDirectory.h: (JSC::BlockDirectory::allocator const): Deleted. * heap/CompleteSubspace.cpp: (JSC::CompleteSubspace::allocateNonVirtual): (JSC::CompleteSubspace::allocatorForSlow): (JSC::CompleteSubspace::tryAllocateSlow): * heap/CompleteSubspace.h: * heap/Heap.cpp: (JSC::Heap::Heap): * heap/Heap.h: (JSC::Heap::threadLocalCacheLayout): Deleted. * heap/IsoSubspace.cpp: (JSC::IsoSubspace::IsoSubspace): (JSC::IsoSubspace::allocateNonVirtual): * heap/IsoSubspace.h: (JSC::IsoSubspace::allocatorForNonVirtual): * heap/LocalAllocator.cpp: (JSC::LocalAllocator::LocalAllocator): (JSC::LocalAllocator::~LocalAllocator): * heap/LocalAllocator.h: (JSC::LocalAllocator::cellSize const): (JSC::LocalAllocator::tlc const): Deleted. * heap/ThreadLocalCache.cpp: Removed. * heap/ThreadLocalCache.h: Removed. * heap/ThreadLocalCacheInlines.h: Removed. * heap/ThreadLocalCacheLayout.cpp: Removed. * heap/ThreadLocalCacheLayout.h: Removed. * jit/AssemblyHelpers.cpp: (JSC::AssemblyHelpers::emitAllocateWithNonNullAllocator): (JSC::AssemblyHelpers::emitAllocate): (JSC::AssemblyHelpers::emitAllocateVariableSized): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_create_this): * runtime/JSLock.cpp: (JSC::JSLock::didAcquireLock): * runtime/VM.cpp: (JSC::VM::VM): (JSC::VM::~VM): * runtime/VM.h: * runtime/VMEntryScope.cpp: (JSC::VMEntryScope::~VMEntryScope): * runtime/VMEntryScope.h: Source/WTF: * wtf/Platform.h: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@232074 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WebKit is a cross-platform web browser engine. On iOS and macOS, it powers Safari, Mail, iBooks, and many other applications.
Visit WebKit Feature Status page to see which Web API has been implemented, in development, or under consideration.
On macOS, download Safari Technology Preview to test the latest version of WebKit. On Linux, download Epiphany Technology Preview. On Windows, you'll have to build it yourself.
Once your bug is filed, you will receive email when it is updated at each stage in the bug life cycle. After the bug is considered fixed, you may be asked to download the latest nightly and confirm that the fix works for you.
On Windows, follow the instructions on our website.
Run the following command to clone WebKit's Git SVN repository:
git clone git://git.webkit.org/WebKit.git WebKit
If you want to be able to commit changes to the repository, or just want to check out branches that aren’t contained in WebKit.git, you will need track WebKit's Subversion repository. You can run the following command to configure this and other options of the new Git clone for WebKit development.
Tools/Scripts/webkit-patch setup-git-clone
For information about this, and other aspects of using Git with WebKit, read the wiki page.
If you don‘t want to use Git, run the following command to check out WebKit’s Subversion repository:
svn checkout https://svn.webkit.org/repository/webkit/trunk WebKit
Install Xcode and its command line tools if you haven't done so already:
xcode-select --install
Run the following command to build a debug build with debugging symbols and assertions:
Tools/Scripts/build-webkit --debug
For performance testing, and other purposes, use --release
instead.
You can open WebKit.xcworkspace
to build and debug WebKit within WebKit.
If you don't use a custom build location in Xcode preferences, you have to update the workspace settings to use WebKitBuild
directory. In menu bar, choose File > Workspace Settings, then click the Advanced button, select “Custom”, “Relative to Workspace”, and enter WebKitBuild
for both Products and Intermediates.
The first time after you install a new Xcode, you will need to run the following command to enable Xcode to build command line tools for iOS Simulator:
sudo Tools/Scripts/configure-xcode-for-ios-development
Without this step, you will see the error message: “target specifies product type ‘com.apple.product-type.tool’, but there’s no such product type for the ‘iphonesimulator’ platform.
” when building target JSCLLIntOffsetsExtractor
of project JavaScriptCore
.
Run the following command to build a debug build with debugging symbols and assertions for iOS:
Tools/Scripts/build-webkit --debug --ios-simulator.
For production builds:
cmake -DPORT=GTK -DCMAKE_BUILD_TYPE=RelWithDebInfo -GNinja ninja sudo ninja install
For development builds:
Tools/gtk/install-dependencies Tools/Scripts/update-webkitgtk-libs Tools/Scripts/build-webkit --gtk --debug
For more information on building WebKitGTK+, see the wiki page.
For production builds:
cmake -DPORT=WPE -DCMAKE_BUILD_TYPE=RelWithDebInfo -GNinja ninja sudo ninja install
For development builds:
Tools/wpe/install-dependencies Tools/Scripts/update-webkitwpe-libs Tools/Scripts/build-webkit --wpe --debug
For building WebKit on Windows, see the wiki page.
Run the following command to launch Safari with your local build of WebKit:
Tools/Scripts/run-safari --debug
The run-safari
script sets the DYLD_FRAMEWORK_PATH
environment variable to point to your build products, and then launches /Applications/Safari.app
. DYLD_FRAMEWORK_PATH
tells the system loader to prefer your build products over the frameworks installed in /System/Library/Frameworks
.
To run other applications with your local build of WebKit, run the following command:
Tools/Scripts/run-webkit-app <application-path>
Run the following command to launch iOS simulator with your local build of WebKit:
run-safari --debug --ios-simulator
In both cases, if you have built release builds instead, use --release
instead of --debug
.
If you have a development build, you can use the run-minibrowser script, e.g.:
run-minibrowser --debug --wpe
Pass one of --gtk
, --jsc-only
, or --wpe
to indicate the port to use.
Congratulations! You’re up and running. Now you can begin coding in WebKit and contribute your fixes and new features to the project. For details on submitting your code to the project, read Contributing Code.