Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Shrink Structure to 96 Bytes when addresses can be encoded in 36-bits
https://bugs.webkit.org/show_bug.cgi?id=240407 Reviewed by Yusuke Suzuki. We have 2% RAMification regression on iOS, which needs a memory performance improvement. To work towards resolving this regression, this patch is to reduce JS object's structure size from 112 bytes to 96 bytes for iOS systems. 1. We can reduce 36-bit addresses into 4 bytes when dealing with pointers that have 16-byte alignment. 2. StructureID can be removed from StructureIDBlob since we can directly compute the id by encoding the Structure pointer. CompactPtr and CompactRefPtr classes are introduced for pointers, which can achieve 8 bytes in MacOS and 4 bytes in iOS. * PerformanceTests/JetStream2/RexBench/OfflineAssembler/LowLevelInterpreter64.asm: * PerformanceTests/JetStream2/RexBench/OfflineAssembler/LowLevelInterpreter64.js: * PerformanceTests/JetStream2/RexBench/OfflineAssembler/expected.js: * PerformanceTests/RexBench/OfflineAssembler/LowLevelInterpreter64.asm: * PerformanceTests/RexBench/OfflineAssembler/LowLevelInterpreter64.js: * PerformanceTests/RexBench/OfflineAssembler/expected.js: * Source/JavaScriptCore/CMakeLists.txt: * Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj: * Source/JavaScriptCore/bytecode/GetByValHistory.h: (JSC::GetByValHistory::observe): * Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp: * Source/JavaScriptCore/ftl/FTLAbstractHeapRepository.cpp: (JSC::FTL::AbstractHeapRepository::AbstractHeapRepository): * Source/JavaScriptCore/ftl/FTLAbstractHeapRepository.h: * Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq): * Source/JavaScriptCore/heap/ConservativeRoots.cpp: (JSC::ConservativeRoots::genericAddPointer): (JSC::ConservativeRoots::genericAddSpan): * Source/JavaScriptCore/heap/ConservativeRoots.h: * Source/JavaScriptCore/heap/HeapSnapshot.h: * Source/JavaScriptCore/heap/HeapUtil.h: (JSC::HeapUtil::findGCObjectPointersForMarking): (JSC::HeapUtil::isPointerGCObjectJSCell): (JSC::HeapUtil::isValueGCObject): * Source/JavaScriptCore/heap/MarkedBlockSet.h: (JSC::MarkedBlockSet::add): (JSC::MarkedBlockSet::recomputeFilter): (JSC::MarkedBlockSet::filter const): * Source/JavaScriptCore/heap/TinyBloomFilter.h: (JSC::TinyBloomFilter<Bits>::TinyBloomFilter): (JSC::TinyBloomFilter<Bits>::add): (JSC::TinyBloomFilter<Bits>::ruleOut const): (JSC::TinyBloomFilter<Bits>::reset): (JSC::TinyBloomFilter::TinyBloomFilter): Deleted. (JSC::TinyBloomFilter::add): Deleted. (JSC::TinyBloomFilter::ruleOut const): Deleted. (JSC::TinyBloomFilter::reset): Deleted. * Source/JavaScriptCore/jit/AssemblyHelpers.cpp: (JSC::AssemblyHelpers::emitStoreStructureWithTypeInfo): (JSC::AssemblyHelpers::emitEncodeStructure): * Source/JavaScriptCore/jit/AssemblyHelpers.h: (JSC::AssemblyHelpers::emitStoreStructureWithTypeInfo): (JSC::AssemblyHelpers::loadCompactPtr): (JSC::AssemblyHelpers::branchCompactPtr): * Source/JavaScriptCore/jit/JITPropertyAccess.cpp: (JSC::JIT::generateOpGetFromScopeThunk): (JSC::JIT::emit_op_put_to_scope): * Source/JavaScriptCore/runtime/ClassInfo.h: (JSC::ClassInfo::offsetOfParentClass): Deleted. (JSC::ClassInfo::isSubClassOf const): Deleted. * Source/JavaScriptCore/runtime/SamplingProfiler.cpp: (JSC::SamplingProfiler::processUnverifiedStackTraces): * Source/JavaScriptCore/runtime/Structure.cpp: (JSC::Structure::Structure): * Source/JavaScriptCore/runtime/Structure.h: (JSC::Structure::id const): (JSC::Structure::typeInfoBlob const): (JSC::Structure::classInfoForCells const): (JSC::Structure::indexingModeIncludingHistoryOffset): (JSC::Structure::objectInitializationBlob const): Deleted. (JSC::Structure::idBlob const): Deleted. (JSC::Structure::structureIDOffset): Deleted. * Source/JavaScriptCore/runtime/StructureInlines.h: (JSC::Structure::get): (JSC::Structure::add): * Source/JavaScriptCore/runtime/TypeInfoBlob.h: Renamed from Source/JavaScriptCore/runtime/StructureIDBlob.h. (JSC::TypeInfoBlob::TypeInfoBlob): (JSC::TypeInfoBlob::operator=): (JSC::TypeInfoBlob::indexingModeIncludingHistory const): (JSC::TypeInfoBlob::fencedIndexingModeIncludingHistory): (JSC::TypeInfoBlob::setIndexingModeIncludingHistory): (JSC::TypeInfoBlob::type const): (JSC::TypeInfoBlob::inlineTypeFlags const): (JSC::TypeInfoBlob::typeInfo const): (JSC::TypeInfoBlob::blob const): (JSC::TypeInfoBlob::indexingModeIncludingHistoryOffset): * Source/JavaScriptCore/wasm/js/WebAssemblyFunction.cpp: (JSC::WebAssemblyFunction::jsCallEntrypointSlow): * Source/WTF/WTF.xcodeproj/project.pbxproj: * Source/WTF/wtf/CMakeLists.txt: * Source/WTF/wtf/CompactPtr.h: Added. (WTF::CompactPtr::CompactPtr): (WTF::CompactPtr::operator* const): (WTF::CompactPtr::operator-> const): (WTF::CompactPtr::operator! const): (WTF::CompactPtr::operator bool const): (WTF::CompactPtr::operator=): (WTF::CompactPtr::get const): (WTF::CompactPtr::set): (WTF::CompactPtr::exchange): (WTF::CompactPtr::swap): (WTF::CompactPtr::encode): (WTF::CompactPtr::encode const): (WTF::CompactPtr::decode const): (WTF::GetPtrHelper<CompactPtr<T>>::getPtr): (WTF::CompactPtrTraits::exchange): (WTF::CompactPtrTraits::swap): (WTF::CompactPtrTraits::unwrap): (WTF::CompactPtrTraits::hashTableDeletedValue): (WTF::CompactPtrTraits::isHashTableDeletedValue): * Source/WTF/wtf/CompactRefPtr.h: Copied from Source/JavaScriptCore/heap/HeapSnapshot.h. * Source/WTF/wtf/text/StringImpl.cpp: * Source/WTF/wtf/text/StringImpl.h: * Tools/TestWebKitAPI/CMakeLists.txt: * Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * Tools/TestWebKitAPI/Tests/WTF/AlignedRefLogger.h: Copied from Source/JavaScriptCore/heap/TinyBloomFilter.h. (TestWebKitAPI::DerivedAlignedRefLogger::DerivedAlignedRefLogger): * Tools/TestWebKitAPI/Tests/WTF/CompactPtr.cpp: Added. (TestWebKitAPI::TEST): * Tools/TestWebKitAPI/Tests/WTF/CompactRefPtr.cpp: Added. (TestWebKitAPI::TEST): (TestWebKitAPI::f1): (TestWebKitAPI::returnConstRefCountedRef): (TestWebKitAPI::returnRefCountedRef): (TestWebKitAPI::CompactRefPtrCheckingAlignedRefLogger::CompactRefPtrCheckingAlignedRefLogger): (TestWebKitAPI::loggerName): (TestWebKitAPI::CompactRefPtrCheckingAlignedRefLogger::ref): (TestWebKitAPI::CompactRefPtrCheckingAlignedRefLogger::deref): * Tools/TestWebKitAPI/Tests/WTF/JSONValue.cpp: (TestWebKitAPI::TEST): * Websites/browserbench.org/JetStream2.0/RexBench/OfflineAssembler/LowLevelInterpreter64.asm: * Websites/browserbench.org/JetStream2.0/RexBench/OfflineAssembler/LowLevelInterpreter64.js: * Websites/browserbench.org/JetStream2.0/RexBench/OfflineAssembler/expected.js: Canonical link: https://commits.webkit.org/251103@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@295008 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Yijia Huang
committed
May 29, 2022
1 parent
19a6ec1
commit 771382d
Showing
35 changed files
with
1,290 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.