12016-03-06 Filip Pizlo <fpizlo@apple.com>
2
3 DFG should know how to speculate StringOrOther
4 https://bugs.webkit.org/show_bug.cgi?id=155094
5
6 Reviewed by NOBODY (OOPS!).
7
8 Any code that processes the regexp matches array was previously doing a relatively expensive
9 Branch(Untyped:). This introduces a new use kind called StringOrOther, which is perfect for
10 code that loops over the matches array and branches on the entries being non-empty.
11
12 To do this, I needed to introduce code into the FTL that creates new blocks. We still had that
13 awful FTL_NEW_BLOCK idiom since the only way to debug LLVM IR was to ascribe names to basic
14 blocks. B3 IR is inherently more debuggable since unlike LLVM, B3 knows how to always respect
15 code origin, and it knows how to print the code origin nicely in the dumps. So, rather than
16 continue using FTL_NEW_BLOCK(m_out, ("things")), I replaced all of that stuff with
17 m_out.newBlock(). It's much nicer that way.
18
19 This is a tiny speed-up on Octane/regexp at best. I was hoping for more. Oh well.
20
21 * bytecode/SpeculatedType.h:
22 (JSC::isStringSpeculation):
23 (JSC::isStringOrOtherSpeculation):
24 (JSC::isSymbolSpeculation):
25 * dfg/DFGFixupPhase.cpp:
26 (JSC::DFG::FixupPhase::fixupNode):
27 * dfg/DFGNode.h:
28 (JSC::DFG::Node::shouldSpeculateString):
29 (JSC::DFG::Node::shouldSpeculateStringOrOther):
30 (JSC::DFG::Node::shouldSpeculateStringObject):
31 * dfg/DFGSafeToExecute.h:
32 (JSC::DFG::SafeToExecuteEdge::operator()):
33 * dfg/DFGSpeculativeJIT.cpp:
34 (JSC::DFG::SpeculativeJIT::compileStringZeroLength):
35 (JSC::DFG::SpeculativeJIT::compileLogicalNotStringOrOther):
36 (JSC::DFG::SpeculativeJIT::emitStringBranch):
37 (JSC::DFG::SpeculativeJIT::emitStringOrOtherBranch):
38 (JSC::DFG::SpeculativeJIT::compileConstantStoragePointer):
39 (JSC::DFG::SpeculativeJIT::speculateObjectOrOther):
40 (JSC::DFG::SpeculativeJIT::speculateString):
41 (JSC::DFG::SpeculativeJIT::speculateStringOrOther):
42 (JSC::DFG::SpeculativeJIT::speculateStringIdentAndLoadStorage):
43 (JSC::DFG::SpeculativeJIT::speculate):
44 * dfg/DFGSpeculativeJIT.h:
45 * dfg/DFGSpeculativeJIT32_64.cpp:
46 (JSC::DFG::SpeculativeJIT::compileLogicalNot):
47 (JSC::DFG::SpeculativeJIT::emitBranch):
48 * dfg/DFGSpeculativeJIT64.cpp:
49 (JSC::DFG::SpeculativeJIT::compileLogicalNot):
50 (JSC::DFG::SpeculativeJIT::emitBranch):
51 * dfg/DFGUseKind.cpp:
52 (WTF::printInternal):
53 * dfg/DFGUseKind.h:
54 (JSC::DFG::typeFilterFor):
55 * ftl/FTLCapabilities.cpp:
56 (JSC::FTL::canCompile):
57 * ftl/FTLLowerDFGToB3.cpp:
58 (JSC::FTL::DFG::LowerDFGToB3::lower):
59 (JSC::FTL::DFG::LowerDFGToB3::compileDoubleRep):
60 (JSC::FTL::DFG::LowerDFGToB3::compileBooleanToNumber):
61 (JSC::FTL::DFG::LowerDFGToB3::compileToThis):
62 (JSC::FTL::DFG::LowerDFGToB3::compileArithMul):
63 (JSC::FTL::DFG::LowerDFGToB3::compileArithDiv):
64 (JSC::FTL::DFG::LowerDFGToB3::compileArithMod):
65 (JSC::FTL::DFG::LowerDFGToB3::compileArithMinOrMax):
66 (JSC::FTL::DFG::LowerDFGToB3::compileArithPow):
67 (JSC::FTL::DFG::LowerDFGToB3::compileArithRound):
68 (JSC::FTL::DFG::LowerDFGToB3::compileCheckStructure):
69 (JSC::FTL::DFG::LowerDFGToB3::compileArrayifyToStructure):
70 (JSC::FTL::DFG::LowerDFGToB3::compileGetById):
71 (JSC::FTL::DFG::LowerDFGToB3::compileGetIndexedPropertyStorage):
72 (JSC::FTL::DFG::LowerDFGToB3::compileGetTypedArrayByteOffset):
73 (JSC::FTL::DFG::LowerDFGToB3::compileGetByVal):
74 (JSC::FTL::DFG::LowerDFGToB3::compilePutByVal):
75 (JSC::FTL::DFG::LowerDFGToB3::compileArrayPush):
76 (JSC::FTL::DFG::LowerDFGToB3::compileArrayPop):
77 (JSC::FTL::DFG::LowerDFGToB3::compileCreateActivation):
78 (JSC::FTL::DFG::LowerDFGToB3::compileNewFunction):
79 (JSC::FTL::DFG::LowerDFGToB3::compileCreateDirectArguments):
80 (JSC::FTL::DFG::LowerDFGToB3::compileCopyRest):
81 (JSC::FTL::DFG::LowerDFGToB3::compileGetRestLength):
82 (JSC::FTL::DFG::LowerDFGToB3::compileNewArrayWithSize):
83 (JSC::FTL::DFG::LowerDFGToB3::compileNewTypedArray):
84 (JSC::FTL::DFG::LowerDFGToB3::compileToStringOrCallStringConstructor):
85 (JSC::FTL::DFG::LowerDFGToB3::compileToPrimitive):
86 (JSC::FTL::DFG::LowerDFGToB3::compileMakeRope):
87 (JSC::FTL::DFG::LowerDFGToB3::compileStringCharAt):
88 (JSC::FTL::DFG::LowerDFGToB3::compileStringCharCodeAt):
89 (JSC::FTL::DFG::LowerDFGToB3::compileStringFromCharCode):
90 (JSC::FTL::DFG::LowerDFGToB3::compileMultiGetByOffset):
91 (JSC::FTL::DFG::LowerDFGToB3::compileMultiPutByOffset):
92 (JSC::FTL::DFG::LowerDFGToB3::compileNotifyWrite):
93 (JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq):
94 (JSC::FTL::DFG::LowerDFGToB3::compileForwardVarargs):
95 (JSC::FTL::DFG::LowerDFGToB3::compileSwitch):
96 (JSC::FTL::DFG::LowerDFGToB3::compileIsString):
97 (JSC::FTL::DFG::LowerDFGToB3::compileIsObject):
98 (JSC::FTL::DFG::LowerDFGToB3::compileIsObjectOrNull):
99 (JSC::FTL::DFG::LowerDFGToB3::compileIsFunction):
100 (JSC::FTL::DFG::LowerDFGToB3::compileTypeOf):
101 (JSC::FTL::DFG::LowerDFGToB3::compileOverridesHasInstance):
102 (JSC::FTL::DFG::LowerDFGToB3::compileInstanceOf):
103 (JSC::FTL::DFG::LowerDFGToB3::compileHasIndexedProperty):
104 (JSC::FTL::DFG::LowerDFGToB3::compileHasStructureProperty):
105 (JSC::FTL::DFG::LowerDFGToB3::compileGetDirectPname):
106 (JSC::FTL::DFG::LowerDFGToB3::compileGetEnumeratorStructurePname):
107 (JSC::FTL::DFG::LowerDFGToB3::compileGetEnumeratorGenericPname):
108 (JSC::FTL::DFG::LowerDFGToB3::compileMaterializeNewObject):
109 (JSC::FTL::DFG::LowerDFGToB3::compileMaterializeCreateActivation):
110 (JSC::FTL::DFG::LowerDFGToB3::compileCheckWatchdogTimer):
111 (JSC::FTL::DFG::LowerDFGToB3::checkStructure):
112 (JSC::FTL::DFG::LowerDFGToB3::numberOrNotCellToInt32):
113 (JSC::FTL::DFG::LowerDFGToB3::checkInferredType):
114 (JSC::FTL::DFG::LowerDFGToB3::allocatePropertyStorageWithSizeImpl):
115 (JSC::FTL::DFG::LowerDFGToB3::loadVectorWithBarrier):
116 (JSC::FTL::DFG::LowerDFGToB3::copyBarrier):
117 (JSC::FTL::DFG::LowerDFGToB3::loadVectorReadOnly):
118 (JSC::FTL::DFG::LowerDFGToB3::compareEqObjectOrOtherToObject):
119 (JSC::FTL::DFG::LowerDFGToB3::nonSpeculativeCompare):
120 (JSC::FTL::DFG::LowerDFGToB3::stringsEqual):
121 (JSC::FTL::DFG::LowerDFGToB3::allocateCell):
122 (JSC::FTL::DFG::LowerDFGToB3::allocateVariableSizedObject):
123 (JSC::FTL::DFG::LowerDFGToB3::allocateBasicStorageAndGetEnd):
124 (JSC::FTL::DFG::LowerDFGToB3::allocateObject):
125 (JSC::FTL::DFG::LowerDFGToB3::allocateJSArray):
126 (JSC::FTL::DFG::LowerDFGToB3::boolify):
127 (JSC::FTL::DFG::LowerDFGToB3::equalNullOrUndefined):
128 (JSC::FTL::DFG::LowerDFGToB3::contiguousPutByValOutOfBounds):
129 (JSC::FTL::DFG::LowerDFGToB3::switchString):
130 (JSC::FTL::DFG::LowerDFGToB3::switchStringRecurse):
131 (JSC::FTL::DFG::LowerDFGToB3::buildTypeOf):
132 (JSC::FTL::DFG::LowerDFGToB3::doubleToInt32):
133 (JSC::FTL::DFG::LowerDFGToB3::sensibleDoubleToInt32):
134 (JSC::FTL::DFG::LowerDFGToB3::strictInt52ToJSValue):
135 (JSC::FTL::DFG::LowerDFGToB3::jsValueToStrictInt52):
136 (JSC::FTL::DFG::LowerDFGToB3::convertDoubleToInt32):
137 (JSC::FTL::DFG::LowerDFGToB3::speculate):
138 (JSC::FTL::DFG::LowerDFGToB3::speculateCellOrOther):
139 (JSC::FTL::DFG::LowerDFGToB3::speculateObjectOrOther):
140 (JSC::FTL::DFG::LowerDFGToB3::speculateString):
141 (JSC::FTL::DFG::LowerDFGToB3::speculateStringOrOther):
142 (JSC::FTL::DFG::LowerDFGToB3::speculateStringIdent):
143 (JSC::FTL::DFG::LowerDFGToB3::speculateStringOrStringObject):
144 (JSC::FTL::DFG::LowerDFGToB3::speculateRealNumber):
145 (JSC::FTL::DFG::LowerDFGToB3::speculateNotStringVar):
146 (JSC::FTL::DFG::LowerDFGToB3::emitStoreBarrier):
147 (JSC::FTL::DFG::LowerDFGToB3::callCheck):
148 * ftl/FTLOutput.cpp:
149 (JSC::FTL::Output::initialize):
150 (JSC::FTL::Output::newBlock):
151 (JSC::FTL::Output::check):
152 * ftl/FTLOutput.h:
153 (JSC::FTL::Output::setFrequency):
154 (JSC::FTL::Output::insertNewBlocksBefore):
155