Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[JSC] Add ProxyObjectLoad IC
https://bugs.webkit.org/show_bug.cgi?id=244362 Reviewed by Justin Michaud. This patch adds optimization for Proxy's [[Get]]. 1. This patch adds ProxyObjectLoad IC, which detects ProxyObject and calls @performProxyObjectGet JS function. This handles property lookup in handler / target significantly faster. And we can jump to ProxyObject [[Get]] path instead of going to C++ and going back to JS. 2. This patch adds GetByValWithThis IC, it means we thisGPR register handling is added to GetByVal IC too. And we start using it in Baseline, DFG, and FTL. This IC is added since @performProxyObjectGet needs this operation in a super faster way. Still, we have a lot of good optimization: DFG layer conversion from GetByValWithThis to GetByIdWithThis. Handling ProxyObjectLoad in DFG and inline @performProxyObjectGet. But for now, let's just do optimization via IC since it can make baseline speed faster in all JIT tiers. This improves Proxy [[Get]] significantly in microbenchmarks. And we observed 8% improvement in JetStream2 chai-wtb since it heavily uses Proxy. ToT Patched proxy-get 608.4166+-0.6237 ^ 147.8951+-1.1855 ^ definitely 4.1138x faster proxy-get-miss-handler 304.8690+-0.8261 ^ 48.4809+-0.1115 ^ definitely 6.2884x faster * JSTests/microbenchmarks/proxy-get-miss-handler.js: Added. * JSTests/microbenchmarks/proxy-get.js: Added. (get target): * Source/JavaScriptCore/CMakeLists.txt: * Source/JavaScriptCore/DerivedSources-input.xcfilelist: * Source/JavaScriptCore/DerivedSources.make: * Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj: * Source/JavaScriptCore/Sources.txt: * Source/JavaScriptCore/builtins/BuiltinNames.h: * Source/JavaScriptCore/builtins/ProxyHelpers.js: Added. (linkTimeConstant.performProxyObjectGet): * Source/JavaScriptCore/bytecode/AccessCase.cpp: (JSC::AccessCase::create): (JSC::AccessCase::guardedByStructureCheckSkippingConstantIdentifierCheck const): (JSC::AccessCase::requiresIdentifierNameMatch const): (JSC::AccessCase::requiresInt32PropertyCheck const): (JSC::AccessCase::needsScratchFPR const): (JSC::AccessCase::forEachDependentCell const): (JSC::AccessCase::doesCalls const): (JSC::AccessCase::canReplace const): (JSC::AccessCase::generateWithGuard): (JSC::AccessCase::generateImpl): (JSC::AccessCase::canBeShared): * Source/JavaScriptCore/bytecode/AccessCase.h: (JSC::SharedJITStubSet::Hash::Key::Key): (JSC::SharedJITStubSet::Hash::Key::operator==): (JSC::SharedJITStubSet::Searcher::Translator::equal): * Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.h: * Source/JavaScriptCore/bytecode/BytecodeList.rb: * Source/JavaScriptCore/bytecode/GetterSetterAccessCase.cpp: (JSC::GetterSetterAccessCase::emitDOMJITGetter): * Source/JavaScriptCore/bytecode/LinkTimeConstant.h: * Source/JavaScriptCore/bytecode/ModuleNamespaceAccessCase.cpp: (JSC::ModuleNamespaceAccessCase::emit): * Source/JavaScriptCore/bytecode/PolymorphicAccess.cpp: (JSC::AccessGenerationState::makeDefaultScratchAllocator): (JSC::PolymorphicAccess::regenerate): (WTF::printInternal): * Source/JavaScriptCore/bytecode/PolymorphicAccess.h: (JSC::AccessGenerationState::thisGPR const): Deleted. (JSC::AccessGenerationState::prototypeGPR const): Deleted. (JSC::AccessGenerationState::propertyGPR const): Deleted. * Source/JavaScriptCore/bytecode/ProxyObjectAccessCase.cpp: Added. (JSC::ProxyObjectAccessCase::ProxyObjectAccessCase): (JSC::ProxyObjectAccessCase::create): (JSC::ProxyObjectAccessCase::clone const): (JSC::ProxyObjectAccessCase::emit): (JSC::ProxyObjectAccessCase::dumpImpl const): * Source/JavaScriptCore/bytecode/ProxyObjectAccessCase.h: Added. * Source/JavaScriptCore/bytecode/Repatch.cpp: (JSC::appropriateOptimizingGetByFunction): (JSC::appropriateGetByFunction): (JSC::tryCacheGetBy): (JSC::resetGetBy): * Source/JavaScriptCore/bytecode/Repatch.h: * Source/JavaScriptCore/bytecode/StructureStubInfo.cpp: (JSC::StructureStubInfo::reset): (JSC::slowOperationFromUnlinkedStructureStubInfo): (JSC::StructureStubInfo::initializeFromUnlinkedStructureStubInfo): (JSC::StructureStubInfo::initializeFromDFGUnlinkedStructureStubInfo): (JSC::StructureStubInfo::checkConsistency): * Source/JavaScriptCore/bytecode/StructureStubInfo.h: (JSC::StructureStubInfo::thisValueIsInExtraGPR const): (JSC::StructureStubInfo::prototypeGPR const): (JSC::StructureStubInfo::propertyGPR const): (JSC::StructureStubInfo::propertyTagGPR const): * Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp: (JSC::BytecodeIntrinsicNode::emit_intrinsic_getByValWithThis): * Source/JavaScriptCore/dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * Source/JavaScriptCore/dfg/DFGJITCode.h: * Source/JavaScriptCore/dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::link): * Source/JavaScriptCore/dfg/DFGJITCompiler.h: (JSC::DFG::JITCompiler::addGetByValWithThis): * Source/JavaScriptCore/dfg/DFGOperations.cpp: * Source/JavaScriptCore/dfg/DFGOperations.h: * Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp: * Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compileGetByValWithThis): * Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compileGetByValWithThis): * Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileGetByValWithThis): * Source/JavaScriptCore/jit/BaselineJITRegisters.h: * Source/JavaScriptCore/jit/ICStats.h: * Source/JavaScriptCore/jit/IntrinsicEmitter.cpp: (JSC::IntrinsicGetterAccessCase::emitIntrinsicGetter): * Source/JavaScriptCore/jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::link): * Source/JavaScriptCore/jit/JIT.h: * Source/JavaScriptCore/jit/JITInlineCacheGenerator.cpp: (JSC::JITGetByValGenerator::finalize): (JSC::JITGetByValWithThisGenerator::JITGetByValWithThisGenerator): (JSC::JITGetByValWithThisGenerator::generateFastPath): (JSC::JITGetByValWithThisGenerator::generateEmptyPath): (JSC::JITGetByValWithThisGenerator::finalize): * Source/JavaScriptCore/jit/JITInlineCacheGenerator.h: (JSC::JITInlineCacheGenerator::JITInlineCacheGenerator): Deleted. (JSC::JITByIdGenerator::JITByIdGenerator): Deleted. (JSC::JITInByValGenerator::JITInByValGenerator): Deleted. * Source/JavaScriptCore/jit/JITOperations.cpp: (JSC::getByValWithThis): (JSC::JSC_DEFINE_JIT_OPERATION): * Source/JavaScriptCore/jit/JITOperations.h: * Source/JavaScriptCore/jit/JITPropertyAccess.cpp: (JSC::JIT::emit_op_get_by_val_with_this): (JSC::JIT::emitSlow_op_get_by_val_with_this): (JSC::JIT::slow_op_get_by_val_with_this_callSlowOperationThenCheckExceptionGenerator): * Source/JavaScriptCore/runtime/CommonSlowPaths.cpp: (JSC::JSC_DEFINE_COMMON_SLOW_PATH): * Source/JavaScriptCore/runtime/JSGlobalObject.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): (JSC::JSGlobalObject::init): * Source/JavaScriptCore/runtime/Operations.h: (JSC::getByValWithIndexAndThis): * Source/JavaScriptCore/runtime/ProxyObject.h: Canonical link: https://commits.webkit.org/254092@main
- Loading branch information