12013-11-16 Filip Pizlo <fpizlo@apple.com>
2
3 FTL should have an explicit notion of bytecode liveness
4 https://bugs.webkit.org/show_bug.cgi?id=124181
5
6 Reviewed by NOBODY (OOPS!).
7
8 This makes FTL OSR exit use bytecode liveness analysis to determine which variables
9 to include values for. The decision of how to get the values of variables is based on
10 forward propagation of MovHints and SetLocals.
11
12 This fixes a bunch of bugs (like https://bugs.webkit.org/show_bug.cgi?id=124138 but
13 also others that I noticed when I started writing more targetted tests) and allows us
14 to remove some sketchy code.
15
16 * CMakeLists.txt:
17 * GNUmakefile.list.am:
18 * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
19 * JavaScriptCore.xcodeproj/project.pbxproj:
20 * bytecode/BytecodeBasicBlock.h:
21 * bytecode/BytecodeLivenessAnalysis.cpp:
22 (JSC::isValidRegisterForLiveness):
23 (JSC::setForOperand):
24 (JSC::computeUsesForBytecodeOffset):
25 (JSC::computeDefsForBytecodeOffset):
26 (JSC::stepOverInstruction):
27 (JSC::computeLocalLivenessForBytecodeOffset):
28 (JSC::BytecodeLivenessAnalysis::runLivenessFixpoint):
29 (JSC::BytecodeLivenessAnalysis::operandIsLiveAtBytecodeOffset):
30 (JSC::getLivenessInfo):
31 (JSC::BytecodeLivenessAnalysis::getLivenessInfoAtBytecodeOffset):
32 (JSC::BytecodeLivenessAnalysis::computeFullLiveness):
33 * bytecode/BytecodeLivenessAnalysis.h:
34 * bytecode/BytecodeLivenessAnalysisInlines.h: Added.
35 (JSC::operandIsAlwaysLive):
36 (JSC::operandThatIsNotAlwaysLiveIsLive):
37 (JSC::operandIsLive):
38 * bytecode/CodeBlock.h:
39 (JSC::CodeBlock::captureCount):
40 (JSC::CodeBlock::captureStart):
41 (JSC::CodeBlock::captureEnd):
42 * bytecode/CodeOrigin.cpp:
43 (JSC::InlineCallFrame::dumpInContext):
44 * bytecode/FullBytecodeLiveness.h: Added.
45 (JSC::FullBytecodeLiveness::FullBytecodeLiveness):
46 (JSC::FullBytecodeLiveness::getOut):
47 (JSC::FullBytecodeLiveness::operandIsLive):
48 (JSC::FullBytecodeLiveness::getLiveness):
49 * dfg/DFGAvailability.cpp: Added.
50 (JSC::DFG::Availability::dump):
51 (JSC::DFG::Availability::dumpInContext):
52 * dfg/DFGAvailability.h: Added.
53 (JSC::DFG::Availability::Availability):
54 (JSC::DFG::Availability::unavailable):
55 (JSC::DFG::Availability::withFlush):
56 (JSC::DFG::Availability::withNode):
57 (JSC::DFG::Availability::withUnavailableNode):
58 (JSC::DFG::Availability::nodeIsUndecided):
59 (JSC::DFG::Availability::nodeIsUnavailable):
60 (JSC::DFG::Availability::hasNode):
61 (JSC::DFG::Availability::node):
62 (JSC::DFG::Availability::flushedAt):
63 (JSC::DFG::Availability::operator!):
64 (JSC::DFG::Availability::operator==):
65 (JSC::DFG::Availability::merge):
66 (JSC::DFG::Availability::mergeNodes):
67 (JSC::DFG::Availability::unavailableMarker):
68 * dfg/DFGBasicBlock.h:
69 * dfg/DFGByteCodeParser.cpp:
70 (JSC::DFG::ByteCodeParser::parseBlock):
71 * dfg/DFGDisassembler.cpp:
72 (JSC::DFG::Disassembler::Disassembler):
73 * dfg/DFGFlushFormat.cpp:
74 (WTF::printInternal):
75 * dfg/DFGFlushFormat.h:
76 (JSC::DFG::resultFor):
77 (JSC::DFG::useKindFor):
78 (JSC::DFG::dataFormatFor):
79 * dfg/DFGFlushedAt.cpp:
80 (JSC::DFG::FlushedAt::dump):
81 * dfg/DFGFlushedAt.h:
82 (JSC::DFG::FlushedAt::FlushedAt):
83 (JSC::DFG::FlushedAt::merge):
84 * dfg/DFGGraph.cpp:
85 (JSC::DFG::Graph::dump):
86 (JSC::DFG::Graph::livenessFor):
87 (JSC::DFG::Graph::isLiveInBytecode):
88 * dfg/DFGGraph.h:
89 (JSC::DFG::Graph::baselineCodeBlockFor):
90 * dfg/DFGOSRAvailabilityAnalysisPhase.cpp:
91 (JSC::DFG::OSRAvailabilityAnalysisPhase::run):
92 * dfg/DFGOSRAvailabilityAnalysisPhase.h:
93 * dfg/DFGPlan.cpp:
94 (JSC::DFG::Plan::compileInThreadImpl):
95 * dfg/DFGResurrectionForValidationPhase.cpp: Added.
96 (JSC::DFG::ResurrectionForValidationPhase::ResurrectionForValidationPhase):
97 (JSC::DFG::ResurrectionForValidationPhase::run):
98 (JSC::DFG::performResurrectionForValidation):
99 * dfg/DFGResurrectionForValidationPhase.h: Added.
100 * dfg/DFGSSAConversionPhase.cpp:
101 (JSC::DFG::SSAConversionPhase::run):
102 * dfg/DFGValueSource.h:
103 (JSC::DFG::ValueSource::forFlushFormat):
104 * dfg/DFGVariableAccessData.h:
105 * ftl/FTLExitValue.cpp:
106 (JSC::FTL::ExitValue::dumpInContext):
107 * ftl/FTLInlineCacheSize.cpp:
108 (JSC::FTL::sizeOfGetById):
109 * ftl/FTLLocation.cpp:
110 (JSC::FTL::Location::gpr):
111 (JSC::FTL::Location::fpr):
112 (JSC::FTL::Location::directGPR):
113 * ftl/FTLLowerDFGToLLVM.cpp:
114 (JSC::FTL::LowerDFGToLLVM::LowerDFGToLLVM):
115 (JSC::FTL::LowerDFGToLLVM::compileBlock):
116 (JSC::FTL::LowerDFGToLLVM::compileNode):
117 (JSC::FTL::LowerDFGToLLVM::compileSetLocal):
118 (JSC::FTL::LowerDFGToLLVM::compileZombieHint):
119 (JSC::FTL::LowerDFGToLLVM::compilePutById):
120 (JSC::FTL::LowerDFGToLLVM::compileInvalidationPoint):
121 (JSC::FTL::LowerDFGToLLVM::initializeOSRExitStateForBlock):
122 (JSC::FTL::LowerDFGToLLVM::appendOSRExit):
123 (JSC::FTL::LowerDFGToLLVM::emitOSRExitCall):
124 (JSC::FTL::LowerDFGToLLVM::buildExitArguments):
125 (JSC::FTL::LowerDFGToLLVM::addExitArgumentForNode):
126 (JSC::FTL::LowerDFGToLLVM::observeMovHint):
127 * ftl/FTLOutput.h:
128 (JSC::FTL::Output::alloca):
129 * ftl/FTLValueSource.cpp: Removed.
130 * ftl/FTLValueSource.h: Removed.
131 * llvm/LLVMAPIFunctions.h:
132 * runtime/DumpContext.cpp:
133 (JSC::DumpContext::DumpContext):
134 * runtime/DumpContext.h:
135 * runtime/Options.h:
136 * runtime/SymbolTable.h:
137 (JSC::SharedSymbolTable::captureStart):
138 (JSC::SharedSymbolTable::captureEnd):
139 (JSC::SharedSymbolTable::captureCount):
140