FTL should be able to do some simple inline caches using LLVM patchpoints
authorfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Oct 2013 18:22:09 +0000 (18:22 +0000)
committerfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Oct 2013 18:22:09 +0000 (18:22 +0000)
commit89a546c861fd0b9adf64ce058507c87c75f17255
tree3cc299e5bac83679e6a969cee23f86d26027436d
parenta7abb2ef950818a7dd42a83b195b2a78b914942e
FTL should be able to do some simple inline caches using LLVM patchpoints
https://bugs.webkit.org/show_bug.cgi?id=123164

Source/JavaScriptCore:

Reviewed by Mark Hahnenberg.

This implements GetById inline caches in the FTL using llvm.webkit.patchpoint.

The idea is that we ask LLVM for a nop slide the size of a GetById inline
cache and then fill in the code after LLVM compilation is complete. For now, we
just use the system calling convention for the arguments and return. We also
still make some assumptions about registers that aren't correct. But, most of
the scaffolding is there and this will successfully patch an inline cache.

* JavaScriptCore.xcodeproj/project.pbxproj:
* assembler/AbstractMacroAssembler.h:
* assembler/LinkBuffer.cpp:
(JSC::LinkBuffer::finalizeCodeWithoutDisassembly):
(JSC::LinkBuffer::linkCode):
(JSC::LinkBuffer::allocate):
* assembler/LinkBuffer.h:
(JSC::LinkBuffer::LinkBuffer):
(JSC::LinkBuffer::link):
* ftl/FTLAbbreviations.h:
(JSC::FTL::constNull):
(JSC::FTL::buildCall):
* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLCompile.cpp:
(JSC::FTL::fixFunctionBasedOnStackMaps):
* ftl/FTLInlineCacheDescriptor.h: Added.
(JSC::FTL::InlineCacheDescriptor::InlineCacheDescriptor):
(JSC::FTL::GetByIdDescriptor::GetByIdDescriptor):
(JSC::FTL::GetByIdDescriptor::stackmapID):
(JSC::FTL::GetByIdDescriptor::codeOrigin):
(JSC::FTL::GetByIdDescriptor::uid):
* ftl/FTLInlineCacheSize.cpp: Added.
(JSC::FTL::sizeOfGetById):
(JSC::FTL::sizeOfPutById):
* ftl/FTLInlineCacheSize.h: Added.
* ftl/FTLIntrinsicRepository.h:
* ftl/FTLJITFinalizer.cpp:
(JSC::FTL::JITFinalizer::finalizeFunction):
* ftl/FTLJITFinalizer.h:
* ftl/FTLLocation.cpp:
(JSC::FTL::Location::directGPR):
* ftl/FTLLocation.h:
* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::LowerDFGToLLVM::compileGetById):
* ftl/FTLOutput.h:
(JSC::FTL::Output::call):
* ftl/FTLSlowPathCall.cpp: Added.
(JSC::FTL::callOperation):
* ftl/FTLSlowPathCall.h: Added.
(JSC::FTL::SlowPathCall::SlowPathCall):
(JSC::FTL::SlowPathCall::call):
(JSC::FTL::SlowPathCall::key):
* ftl/FTLSlowPathCallKey.cpp: Added.
(JSC::FTL::SlowPathCallKey::dump):
* ftl/FTLSlowPathCallKey.h: Added.
(JSC::FTL::SlowPathCallKey::SlowPathCallKey):
(JSC::FTL::SlowPathCallKey::usedRegisters):
(JSC::FTL::SlowPathCallKey::callTarget):
(JSC::FTL::SlowPathCallKey::offset):
(JSC::FTL::SlowPathCallKey::isEmptyValue):
(JSC::FTL::SlowPathCallKey::isDeletedValue):
(JSC::FTL::SlowPathCallKey::operator==):
(JSC::FTL::SlowPathCallKey::hash):
(JSC::FTL::SlowPathCallKeyHash::hash):
(JSC::FTL::SlowPathCallKeyHash::equal):
* ftl/FTLStackMaps.cpp:
(JSC::FTL::StackMaps::Location::directGPR):
* ftl/FTLStackMaps.h:
* ftl/FTLState.h:
* ftl/FTLThunks.cpp:
(JSC::FTL::slowPathCallThunkGenerator):
* ftl/FTLThunks.h:
(JSC::FTL::Thunks::getSlowPathCallThunk):
* jit/CCallHelpers.h:
(JSC::CCallHelpers::setupArguments):
* jit/GPRInfo.h:
* jit/JITInlineCacheGenerator.cpp:
(JSC::garbageStubInfo):
(JSC::JITInlineCacheGenerator::JITInlineCacheGenerator):
(JSC::JITByIdGenerator::finalize):
* jit/JITInlineCacheGenerator.h:
(JSC::JITByIdGenerator::slowPathBegin):
* jit/RegisterSet.cpp:
(JSC::RegisterSet::stackRegisters):
(JSC::RegisterSet::specialRegisters):
(JSC::RegisterSet::calleeSaveRegisters):
(JSC::RegisterSet::allGPRs):
(JSC::RegisterSet::allFPRs):
(JSC::RegisterSet::allRegisters):
(JSC::RegisterSet::dump):
* jit/RegisterSet.h:
(JSC::RegisterSet::exclude):
(JSC::RegisterSet::numberOfSetRegisters):
(JSC::RegisterSet::RegisterSet):
(JSC::RegisterSet::isEmptyValue):
(JSC::RegisterSet::isDeletedValue):
(JSC::RegisterSet::operator==):
(JSC::RegisterSet::hash):
(JSC::RegisterSetHash::hash):
(JSC::RegisterSetHash::equal):
* runtime/Options.h:

Source/WTF:

Reviewed by Mark Hahnenberg.

This needed some better bitvector support, like merging (|=), excluding (&=~),
hashing, and bit counting.

* wtf/BitVector.cpp:
(WTF::BitVector::setSlow):
(WTF::BitVector::excludeSlow):
(WTF::BitVector::bitCountSlow):
(WTF::BitVector::equalsSlowCase):
(WTF::BitVector::hashSlowCase):
(WTF::BitVector::dump):
* wtf/BitVector.h:
(WTF::BitVector::merge):
(WTF::BitVector::exclude):
(WTF::BitVector::bitCount):
(WTF::BitVector::BitVector):
(WTF::BitVector::isEmptyValue):
(WTF::BitVector::isDeletedValue):
(WTF::BitVector::isEmptyOrDeletedValue):
(WTF::BitVector::operator==):
(WTF::BitVector::hash):
(WTF::BitVectorHash::hash):
(WTF::BitVectorHash::equal):
* wtf/HashTraits.h:
(WTF::CustomHashTraits::constructDeletedValue):
(WTF::CustomHashTraits::isDeletedValue):
(WTF::CustomHashTraits::emptyValue):
(WTF::CustomHashTraits::isEmptyValue):
* wtf/StdLibExtras.h:
(WTF::bitCount):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@157872 268f45cc-cd09-0410-ab3c-d52691b4dbfc
39 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
Source/JavaScriptCore/assembler/AbstractMacroAssembler.h
Source/JavaScriptCore/assembler/LinkBuffer.cpp
Source/JavaScriptCore/assembler/LinkBuffer.h
Source/JavaScriptCore/ftl/FTLAbbreviations.h
Source/JavaScriptCore/ftl/FTLCapabilities.cpp
Source/JavaScriptCore/ftl/FTLCompile.cpp
Source/JavaScriptCore/ftl/FTLInlineCacheDescriptor.h [new file with mode: 0644]
Source/JavaScriptCore/ftl/FTLInlineCacheSize.cpp [new file with mode: 0644]
Source/JavaScriptCore/ftl/FTLInlineCacheSize.h [new file with mode: 0644]
Source/JavaScriptCore/ftl/FTLIntrinsicRepository.h
Source/JavaScriptCore/ftl/FTLJITFinalizer.cpp
Source/JavaScriptCore/ftl/FTLJITFinalizer.h
Source/JavaScriptCore/ftl/FTLLocation.cpp
Source/JavaScriptCore/ftl/FTLLocation.h
Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp
Source/JavaScriptCore/ftl/FTLOutput.h
Source/JavaScriptCore/ftl/FTLSlowPathCall.cpp [new file with mode: 0644]
Source/JavaScriptCore/ftl/FTLSlowPathCall.h [new file with mode: 0644]
Source/JavaScriptCore/ftl/FTLSlowPathCallKey.cpp [new file with mode: 0644]
Source/JavaScriptCore/ftl/FTLSlowPathCallKey.h [new file with mode: 0644]
Source/JavaScriptCore/ftl/FTLStackMaps.cpp
Source/JavaScriptCore/ftl/FTLStackMaps.h
Source/JavaScriptCore/ftl/FTLState.h
Source/JavaScriptCore/ftl/FTLThunks.cpp
Source/JavaScriptCore/ftl/FTLThunks.h
Source/JavaScriptCore/jit/CCallHelpers.h
Source/JavaScriptCore/jit/GPRInfo.h
Source/JavaScriptCore/jit/JITInlineCacheGenerator.cpp
Source/JavaScriptCore/jit/JITInlineCacheGenerator.h
Source/JavaScriptCore/jit/RegisterSet.cpp
Source/JavaScriptCore/jit/RegisterSet.h
Source/JavaScriptCore/runtime/Options.h
Source/WTF/ChangeLog
Source/WTF/wtf/BitVector.cpp
Source/WTF/wtf/BitVector.h
Source/WTF/wtf/HashTraits.h
Source/WTF/wtf/StdLibExtras.h