fourthTier: JSC's disassembly infrastructure should be able to disassemble the code that LLVM generates
https://bugs.webkit.org/show_bug.cgi?id=118148
Source/JavaScriptCore:
Reviewed by Anders Carlsson.
Oh boy. UDis86 cannot disassemble the AVX (or whatever it's called) stuff
that LLVM generates for floating point. So the right decision is to
switch to the LLVM disassembler, right? Wrong!! LLVM's disassembler
cannot disassemble the load-from-absolute-address-into-%rax instructions
that our JIT generates quite a lot of.
So, this keeps the UDis86 disassembler, but adds the LLVM disassembler,
and requires the caller of disassemble() to hint which one is likely to
be less wrong for the given code.
Maybe in the future LLVM will catch up to UDis86, but it's definitely not
there right now.
This now allows us to disassemble all of the code that LLVM generates.
- JavaScriptCore.xcodeproj/project.pbxproj:
- disassembler/Disassembler.cpp:
(JSC::disassemble):
- disassembler/Disassembler.h:
(JSC::tryToDisassemble):
(JSC):
- disassembler/LLVMDisassembler.cpp: Added.
(JSC):
(JSC::symbolLookupCallback):
(JSC::tryToDisassembleWithLLVM):
- disassembler/LLVMDisassembler.h: Added.
(JSC):
(JSC::tryToDisassembleWithLLVM):
- disassembler/UDis86Disassembler.cpp:
(JSC::tryToDisassembleWithUDis86):
- disassembler/UDis86Disassembler.h: Added.
(JSC):
(JSC::tryToDisassembleWithUDis86):
- disassembler/X86Disassembler.cpp: Added.
(JSC):
(JSC::tryToDisassemble):
- ftl/FTLAbbreviatedTypes.h:
- ftl/FTLCompile.cpp:
(JSC::FTL::compile):
- ftl/FTLJITCode.h:
- ftl/FTLJITFinalizer.h:
- ftl/FTLLLVMHeaders.h: Removed.
- ftl/FTLLink.cpp:
- runtime/InitializeThreading.cpp:
(JSC::initializeThreadingOnce):
(JSC):
Source/WTF:
Reviewed by Anders Carlsson.
We now use LLVM for two things: disassembler and FTL. Separate out the question
of whether we have LLVM (HAVE(LLVM)) from whether we want to use the LLVM
disassembler (USE(LLVM_DISASSEMBLER)) and whether we enable the FTL
(ENABLE(FTL_JIT)).
Also move the cruft for including LLVM headers into WTF since now we use it in
a bunch of places, not all related to FTL. There's no obvious place to put that
file in JSC so I put it in WTF.
- WTF.xcodeproj/project.pbxproj:
- wtf/LLVMHeaders.h: Copied from Source/JavaScriptCore/ftl/FTLLLVMHeaders.h.
- wtf/Platform.h: