12014-05-20 Filip Pizlo <fpizlo@apple.com>
2
3 [ftlopt] DFG bytecode parser should turn GetById with nothing but a Getter stub as stuff+handleCall, and handleCall should be allowed to inline if it wants to
4 https://bugs.webkit.org/show_bug.cgi?id=133105
5
6 Reviewed by NOBODY (OOPS!).
7
8 - GetByIdStatus now knows about getters and can report intelligent things about them.
9 As is usually the case with how we do these things, GetByIdStatus knows more about
10 getters than the DFG can actually handle: it'll report details about polymorphic
11 getter calls even though the DFG won't be able to handle those. This is fine; the DFG
12 will see those statuses and bail to a generic slow path.
13
14 - The DFG::ByteCodeParser now knows how to set up and do handleCall() for a getter call.
15 This can, and usually does, result in inlining of getters!
16
17 - CodeOrigin and OSR exit know about inlined getter calls. When you OSR out of an
18 inlined getter, we set the return PC to a getter return thunk that fixes up the stack.
19 We use the usual offset-true-return-PC trick, where OSR exit places the true return PC
20 of the getter's caller as a phony argument that only the thunk knows how to find.
21
22 - Removed a bunch of dead monomorphic chain support from StructureStubInfo.
23
24 - A large chunk of this change is dragging GetGetterSetterByOffset, GetGetter, and
25 GetSetter through the DFG and FTL. GetGetterSetterByOffset is like GetByOffset except
26 that we know that we're returning a GetterSetter cell. GetGetter and GetSetter extract
27 the getter, or setter, from the GetterSetter.
28
29 Still testing the performance impact.
30
31 * bytecode/CodeBlock.cpp:
32 (JSC::CodeBlock::printGetByIdCacheStatus):
33 (JSC::CodeBlock::findStubInfo):
34 * bytecode/CodeBlock.h:
35 * bytecode/CodeOrigin.cpp:
36 (WTF::printInternal):
37 * bytecode/CodeOrigin.h:
38 (JSC::InlineCallFrame::specializationKindFor):
39 * bytecode/GetByIdStatus.cpp:
40 (JSC::GetByIdStatus::computeFor):
41 (JSC::GetByIdStatus::computeForStubInfo):
42 (JSC::GetByIdStatus::makesCalls):
43 (JSC::GetByIdStatus::computeForChain): Deleted.
44 * bytecode/GetByIdStatus.h:
45 (JSC::GetByIdStatus::makesCalls): Deleted.
46 * bytecode/GetByIdVariant.cpp:
47 (JSC::GetByIdVariant::~GetByIdVariant):
48 (JSC::GetByIdVariant::GetByIdVariant):
49 (JSC::GetByIdVariant::operator=):
50 (JSC::GetByIdVariant::dumpInContext):
51 * bytecode/GetByIdVariant.h:
52 (JSC::GetByIdVariant::GetByIdVariant):
53 (JSC::GetByIdVariant::callLinkStatus):
54 * bytecode/PolymorphicGetByIdList.cpp:
55 (JSC::GetByIdAccess::fromStructureStubInfo):
56 (JSC::PolymorphicGetByIdList::from):
57 * bytecode/SpeculatedType.h:
58 * bytecode/StructureStubInfo.cpp:
59 (JSC::StructureStubInfo::deref):
60 (JSC::StructureStubInfo::visitWeakReferences):
61 * bytecode/StructureStubInfo.h:
62 (JSC::isGetByIdAccess):
63 (JSC::StructureStubInfo::initGetByIdChain): Deleted.
64 * dfg/DFGAbstractHeap.h:
65 * dfg/DFGAbstractInterpreterInlines.h:
66 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
67 * dfg/DFGByteCodeParser.cpp:
68 (JSC::DFG::ByteCodeParser::addCall):
69 (JSC::DFG::ByteCodeParser::handleCall):
70 (JSC::DFG::ByteCodeParser::handleInlining):
71 (JSC::DFG::ByteCodeParser::handleGetByOffset):
72 (JSC::DFG::ByteCodeParser::handleGetById):
73 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
74 (JSC::DFG::ByteCodeParser::parse):
75 * dfg/DFGCSEPhase.cpp:
76 (JSC::DFG::CSEPhase::getGetterSetterByOffsetLoadElimination):
77 (JSC::DFG::CSEPhase::getInternalFieldLoadElimination):
78 (JSC::DFG::CSEPhase::performNodeCSE):
79 (JSC::DFG::CSEPhase::getTypedArrayByteOffsetLoadElimination): Deleted.
80 * dfg/DFGClobberize.h:
81 (JSC::DFG::clobberize):
82 * dfg/DFGFixupPhase.cpp:
83 (JSC::DFG::FixupPhase::fixupNode):
84 * dfg/DFGJITCompiler.cpp:
85 (JSC::DFG::JITCompiler::linkFunction):
86 * dfg/DFGNode.h:
87 (JSC::DFG::Node::hasStorageAccessData):
88 * dfg/DFGNodeType.h:
89 * dfg/DFGOSRExitCompilerCommon.cpp:
90 (JSC::DFG::reifyInlinedCallFrames):
91 * dfg/DFGPredictionPropagationPhase.cpp:
92 (JSC::DFG::PredictionPropagationPhase::propagate):
93 * dfg/DFGSafeToExecute.h:
94 (JSC::DFG::safeToExecute):
95 * dfg/DFGSpeculativeJIT32_64.cpp:
96 (JSC::DFG::SpeculativeJIT::compile):
97 * dfg/DFGSpeculativeJIT64.cpp:
98 (JSC::DFG::SpeculativeJIT::compile):
99 * ftl/FTLAbstractHeapRepository.cpp:
100 * ftl/FTLAbstractHeapRepository.h:
101 * ftl/FTLCapabilities.cpp:
102 (JSC::FTL::canCompile):
103 * ftl/FTLLink.cpp:
104 (JSC::FTL::link):
105 * ftl/FTLLowerDFGToLLVM.cpp:
106 (JSC::FTL::LowerDFGToLLVM::compileNode):
107 (JSC::FTL::LowerDFGToLLVM::compileGetGetter):
108 (JSC::FTL::LowerDFGToLLVM::compileGetSetter):
109 * jit/AccessorCallJITStubRoutine.h:
110 * jit/JIT.cpp:
111 (JSC::JIT::assertStackPointerOffset):
112 (JSC::JIT::privateCompile):
113 * jit/JIT.h:
114 * jit/JITPropertyAccess.cpp:
115 (JSC::JIT::emit_op_get_by_id):
116 * jit/ThunkGenerators.cpp:
117 (JSC::arityFixupGenerator):
118 (JSC::baselineGetterReturnThunkGenerator):
119 (JSC::baselineSetterReturnThunkGenerator):
120 (JSC::arityFixup): Deleted.
121 * jit/ThunkGenerators.h:
122 * runtime/CommonSlowPaths.cpp:
123 (JSC::setupArityCheckData):
124 * tests/stress/exit-from-getter.js: Added.
125 * tests/stress/poly-chain-getter.js: Added.
126 (Cons):
127 (foo):
128 (test):
129 * tests/stress/poly-chain-then-getter.js: Added.
130 (Cons1):
131 (Cons2):
132 (foo):
133 (test):
134 * tests/stress/poly-getter-combo.js: Added.
135 (Cons1):
136 (Cons2):
137 (foo):
138 (test):
139 (.test):
140 * tests/stress/poly-getter-then-chain.js: Added.
141 (Cons1):
142 (Cons2):
143 (foo):
144 (test):
145 * tests/stress/poly-getter-then-self.js: Added.
146 (foo):
147 (test):
148 (.test):
149 * tests/stress/poly-self-getter.js: Added.
150 (foo):
151 (test):
152 (getter):
153 * tests/stress/poly-self-then-getter.js: Added.
154 (foo):
155 (test):
156 * tests/stress/weird-getter-counter.js: Added.
157 (foo):
158 (test):
159