|
Lines 1637-1642
private:
Source/JavaScriptCore/dfg/DFGFixupPhase.cpp_sec1
|
| 1637 |
break; |
1637 |
break; |
| 1638 |
|
1638 |
|
| 1639 |
case SetLocal: |
1639 |
case SetLocal: |
|
|
1640 |
// NOTE: Any type checks we put here may get hoisted by fixupChecksInBlock(). So, if we |
| 1641 |
// add new type checking use kind for SetLocals, we need to modify that code as well. |
| 1642 |
|
| 1640 |
switch (variable->flushFormat()) { |
1643 |
switch (variable->flushFormat()) { |
| 1641 |
case FlushedJSValue: |
1644 |
case FlushedJSValue: |
| 1642 |
break; |
1645 |
break; |
|
Lines 2110-2117
private:
Source/JavaScriptCore/dfg/DFGFixupPhase.cpp_sec2
|
| 2110 |
return; |
2113 |
return; |
| 2111 |
ASSERT(block->isReachable); |
2114 |
ASSERT(block->isReachable); |
| 2112 |
m_block = block; |
2115 |
m_block = block; |
| 2113 |
for (m_indexInBlock = 0; m_indexInBlock < block->size(); ++m_indexInBlock) { |
2116 |
unsigned indexForChecks = UINT_MAX; |
| 2114 |
Node* node = block->at(m_indexInBlock); |
2117 |
NodeOrigin originForChecks; |
|
|
2118 |
for (unsigned indexInBlock = 0; indexInBlock < block->size(); ++indexInBlock) { |
| 2119 |
Node* node = block->at(indexInBlock); |
| 2120 |
|
| 2121 |
// If this is a node at which we could exit, then save its index. If nodes after this one |
| 2122 |
// cannot exit, then we will hoist checks to here. |
| 2123 |
if (node->origin.exitOK) { |
| 2124 |
indexForChecks = indexInBlock; |
| 2125 |
originForChecks = node->origin; |
| 2126 |
} |
| 2115 |
|
2127 |
|
| 2116 |
// First, try to relax the representational demands of each node, in order to have |
2128 |
// First, try to relax the representational demands of each node, in order to have |
| 2117 |
// fewer conversions. |
2129 |
// fewer conversions. |
|
Lines 2175-2195
private:
Source/JavaScriptCore/dfg/DFGFixupPhase.cpp_sec3
|
| 2175 |
node, |
2187 |
node, |
| 2176 |
[&] (Edge& edge) { |
2188 |
[&] (Edge& edge) { |
| 2177 |
Node* result = nullptr; |
2189 |
Node* result = nullptr; |
| 2178 |
|
2190 |
|
| 2179 |
switch (edge.useKind()) { |
2191 |
switch (edge.useKind()) { |
| 2180 |
case DoubleRepUse: |
2192 |
case DoubleRepUse: |
| 2181 |
case DoubleRepRealUse: |
2193 |
case DoubleRepRealUse: |
| 2182 |
case DoubleRepMachineIntUse: { |
2194 |
case DoubleRepMachineIntUse: { |
| 2183 |
if (edge->hasDoubleResult()) |
2195 |
if (edge->hasDoubleResult()) |
| 2184 |
return; |
2196 |
break; |
| 2185 |
|
2197 |
|
| 2186 |
if (edge->isNumberConstant()) { |
2198 |
if (edge->isNumberConstant()) { |
| 2187 |
result = m_insertionSet.insertNode( |
2199 |
result = m_insertionSet.insertNode( |
| 2188 |
m_indexInBlock, SpecBytecodeDouble, DoubleConstant, node->origin, |
2200 |
indexForChecks, SpecBytecodeDouble, DoubleConstant, node->origin, |
| 2189 |
OpInfo(m_graph.freeze(jsDoubleNumber(edge->asNumber())))); |
2201 |
OpInfo(m_graph.freeze(jsDoubleNumber(edge->asNumber())))); |
| 2190 |
} else if (edge->hasInt52Result()) { |
2202 |
} else if (edge->hasInt52Result()) { |
| 2191 |
result = m_insertionSet.insertNode( |
2203 |
result = m_insertionSet.insertNode( |
| 2192 |
m_indexInBlock, SpecInt52AsDouble, DoubleRep, node->origin, |
2204 |
indexForChecks, SpecInt52AsDouble, DoubleRep, node->origin, |
| 2193 |
Edge(edge.node(), Int52RepUse)); |
2205 |
Edge(edge.node(), Int52RepUse)); |
| 2194 |
} else { |
2206 |
} else { |
| 2195 |
UseKind useKind; |
2207 |
UseKind useKind; |
|
Lines 2201-2253
private:
Source/JavaScriptCore/dfg/DFGFixupPhase.cpp_sec4
|
| 2201 |
useKind = NotCellUse; |
2213 |
useKind = NotCellUse; |
| 2202 |
|
2214 |
|
| 2203 |
result = m_insertionSet.insertNode( |
2215 |
result = m_insertionSet.insertNode( |
| 2204 |
m_indexInBlock, SpecBytecodeDouble, DoubleRep, node->origin, |
2216 |
indexForChecks, SpecBytecodeDouble, DoubleRep, node->origin, |
| 2205 |
Edge(edge.node(), useKind)); |
2217 |
Edge(edge.node(), useKind)); |
| 2206 |
} |
2218 |
} |
|
|
2219 |
|
| 2220 |
edge.setNode(result); |
| 2207 |
break; |
2221 |
break; |
| 2208 |
} |
2222 |
} |
| 2209 |
|
2223 |
|
| 2210 |
case Int52RepUse: { |
2224 |
case Int52RepUse: { |
| 2211 |
if (edge->hasInt52Result()) |
2225 |
if (edge->hasInt52Result()) |
| 2212 |
return; |
2226 |
break; |
| 2213 |
|
2227 |
|
| 2214 |
if (edge->isMachineIntConstant()) { |
2228 |
if (edge->isMachineIntConstant()) { |
| 2215 |
result = m_insertionSet.insertNode( |
2229 |
result = m_insertionSet.insertNode( |
| 2216 |
m_indexInBlock, SpecMachineInt, Int52Constant, node->origin, |
2230 |
indexForChecks, SpecMachineInt, Int52Constant, node->origin, |
| 2217 |
OpInfo(edge->constant())); |
2231 |
OpInfo(edge->constant())); |
| 2218 |
} else if (edge->hasDoubleResult()) { |
2232 |
} else if (edge->hasDoubleResult()) { |
| 2219 |
result = m_insertionSet.insertNode( |
2233 |
result = m_insertionSet.insertNode( |
| 2220 |
m_indexInBlock, SpecMachineInt, Int52Rep, node->origin, |
2234 |
indexForChecks, SpecMachineInt, Int52Rep, node->origin, |
| 2221 |
Edge(edge.node(), DoubleRepMachineIntUse)); |
2235 |
Edge(edge.node(), DoubleRepMachineIntUse)); |
| 2222 |
} else if (edge->shouldSpeculateInt32ForArithmetic()) { |
2236 |
} else if (edge->shouldSpeculateInt32ForArithmetic()) { |
| 2223 |
result = m_insertionSet.insertNode( |
2237 |
result = m_insertionSet.insertNode( |
| 2224 |
m_indexInBlock, SpecInt32, Int52Rep, node->origin, |
2238 |
indexForChecks, SpecInt32, Int52Rep, node->origin, |
| 2225 |
Edge(edge.node(), Int32Use)); |
2239 |
Edge(edge.node(), Int32Use)); |
| 2226 |
} else { |
2240 |
} else { |
| 2227 |
result = m_insertionSet.insertNode( |
2241 |
result = m_insertionSet.insertNode( |
| 2228 |
m_indexInBlock, SpecMachineInt, Int52Rep, node->origin, |
2242 |
indexForChecks, SpecMachineInt, Int52Rep, node->origin, |
| 2229 |
Edge(edge.node(), MachineIntUse)); |
2243 |
Edge(edge.node(), MachineIntUse)); |
| 2230 |
} |
2244 |
} |
|
|
2245 |
|
| 2246 |
edge.setNode(result); |
| 2231 |
break; |
2247 |
break; |
| 2232 |
} |
2248 |
} |
| 2233 |
|
2249 |
|
| 2234 |
default: { |
2250 |
default: { |
| 2235 |
if (!edge->hasDoubleResult() && !edge->hasInt52Result()) |
2251 |
if (!edge->hasDoubleResult() && !edge->hasInt52Result()) |
| 2236 |
return; |
2252 |
break; |
| 2237 |
|
2253 |
|
| 2238 |
if (edge->hasDoubleResult()) { |
2254 |
if (edge->hasDoubleResult()) { |
| 2239 |
result = m_insertionSet.insertNode( |
2255 |
result = m_insertionSet.insertNode( |
| 2240 |
m_indexInBlock, SpecBytecodeDouble, ValueRep, node->origin, |
2256 |
indexForChecks, SpecBytecodeDouble, ValueRep, node->origin, |
| 2241 |
Edge(edge.node(), DoubleRepUse)); |
2257 |
Edge(edge.node(), DoubleRepUse)); |
| 2242 |
} else { |
2258 |
} else { |
| 2243 |
result = m_insertionSet.insertNode( |
2259 |
result = m_insertionSet.insertNode( |
| 2244 |
m_indexInBlock, SpecInt32 | SpecInt52AsDouble, ValueRep, |
2260 |
indexForChecks, SpecInt32 | SpecInt52AsDouble, ValueRep, |
| 2245 |
node->origin, Edge(edge.node(), Int52RepUse)); |
2261 |
node->origin, Edge(edge.node(), Int52RepUse)); |
| 2246 |
} |
2262 |
} |
|
|
2263 |
|
| 2264 |
edge.setNode(result); |
| 2247 |
break; |
2265 |
break; |
| 2248 |
} } |
2266 |
} } |
| 2249 |
|
2267 |
|
| 2250 |
edge.setNode(result); |
2268 |
// It's remotely possible that this node cannot do type checks, but we now have a |
|
|
2269 |
// type check on this node. We don't have to handle the general form of this |
| 2270 |
// problem. It only arises when ByteCodeParser emits an immediate SetLocal, rather |
| 2271 |
// than a delayed one. So, we only worry about those checks that we may have put on |
| 2272 |
// a SetLocal. Note that "indexForChecks != indexInBlock" is just another way of |
| 2273 |
// saying "!node->origin.exitOK". |
| 2274 |
if (indexForChecks != indexInBlock && mayHaveTypeCheck(edge.useKind())) { |
| 2275 |
UseKind knownUseKind = UntypedUse; |
| 2276 |
|
| 2277 |
switch (edge.useKind()) { |
| 2278 |
case Int32Use: |
| 2279 |
knownUseKind = KnownInt32Use; |
| 2280 |
break; |
| 2281 |
case CellUse: |
| 2282 |
knownUseKind = KnownCellUse; |
| 2283 |
break; |
| 2284 |
case BooleanUse: |
| 2285 |
knownUseKind = KnownBooleanUse; |
| 2286 |
break; |
| 2287 |
default: |
| 2288 |
DFG_CRASH(m_graph, node, "Bad use kind"); |
| 2289 |
break; |
| 2290 |
} |
| 2291 |
|
| 2292 |
m_insertionSet.insertNode( |
| 2293 |
indexForChecks, SpecNone, Check, |
| 2294 |
originForChecks.withSemantic(node->origin.semantic), edge); |
| 2295 |
|
| 2296 |
edge.setUseKind(knownUseKind); |
| 2297 |
} |
| 2251 |
}); |
2298 |
}); |
| 2252 |
} |
2299 |
} |
| 2253 |
|
2300 |
|