|
Lines 57-62
public:
Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp_sec1
|
| 57 |
, m_localsBoolean(OperandsLike, state.graph.m_blocks[0]->variablesAtHead) |
57 |
, m_localsBoolean(OperandsLike, state.graph.m_blocks[0]->variablesAtHead) |
| 58 |
, m_locals32(OperandsLike, state.graph.m_blocks[0]->variablesAtHead) |
58 |
, m_locals32(OperandsLike, state.graph.m_blocks[0]->variablesAtHead) |
| 59 |
, m_locals64(OperandsLike, state.graph.m_blocks[0]->variablesAtHead) |
59 |
, m_locals64(OperandsLike, state.graph.m_blocks[0]->variablesAtHead) |
|
|
60 |
, m_valueSources(OperandsLike, state.graph.m_blocks[0]->variablesAtHead) |
| 60 |
, m_state(state.graph) |
61 |
, m_state(state.graph) |
| 61 |
{ |
62 |
{ |
| 62 |
} |
63 |
} |
|
Lines 151-158
private:
Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp_sec2
|
| 151 |
|
152 |
|
| 152 |
void transferAndCheckArguments() |
153 |
void transferAndCheckArguments() |
| 153 |
{ |
154 |
{ |
| 154 |
// FIXME: Set up the OSR story here. |
155 |
// While checking arguments, everything is in the stack. |
| 155 |
// https://bugs.webkit.org/show_bug.cgi?id=113623 |
156 |
for (unsigned i = size(); i--;) |
|
|
157 |
m_valueSources[i] = ValueSource(ValueInJSStack); |
| 156 |
|
158 |
|
| 157 |
for (int i = 0; i < m_graph.m_codeBlock->numParameters(); ++i) { |
159 |
for (int i = 0; i < m_graph.m_codeBlock->numParameters(); ++i) { |
| 158 |
Node* node = m_graph.m_arguments[i]; |
160 |
Node* node = m_graph.m_arguments[i]; |
|
Lines 170-176
private:
Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp_sec3
|
| 170 |
if (variable->shouldUnboxIfPossible()) { |
172 |
if (variable->shouldUnboxIfPossible()) { |
| 171 |
RELEASE_ASSERT(!variable->shouldUseDoubleFormat()); |
173 |
RELEASE_ASSERT(!variable->shouldUseDoubleFormat()); |
| 172 |
|
174 |
|
| 173 |
SpeculatedType prediction = variable->prediction(); |
175 |
SpeculatedType prediction = variable->argumentAwarePrediction(); |
| 174 |
|
176 |
|
| 175 |
if (isInt32Speculation(prediction)) { |
177 |
if (isInt32Speculation(prediction)) { |
| 176 |
speculateBackward(BadType, jsValue, node, isNotInt32(jsValue)); |
178 |
speculateBackward(BadType, jsValue, node, isNotInt32(jsValue)); |
|
Lines 216-228
private:
Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp_sec4
|
| 216 |
// make IR dumps easier to read. |
218 |
// make IR dumps easier to read. |
| 217 |
m_out.appendTo(lowBlock, m_nextLowBlock); |
219 |
m_out.appendTo(lowBlock, m_nextLowBlock); |
| 218 |
|
220 |
|
| 219 |
// FIXME: We should track the OSR situation here. |
221 |
for (unsigned i = m_valueSources.size(); i--;) { |
| 220 |
// https://bugs.webkit.org/show_bug.cgi?id=113623 |
222 |
Node* node = m_highBlock->variablesAtHead[i]; |
|
|
223 |
if (!node) { |
| 224 |
m_valueSources[i] = ValueSource(SourceIsDead); |
| 225 |
continue; |
| 226 |
} |
| 227 |
|
| 228 |
VariableAccessData* variable = node->variableAccessData(); |
| 229 |
SpeculatedType prediction = variable->argumentAwarePrediction(); |
| 230 |
|
| 231 |
if (variable->isArgumentsAlias()) { |
| 232 |
m_valueSources[i] = ValueSource(ArgumentsSource); |
| 233 |
continue; |
| 234 |
} |
| 235 |
|
| 236 |
if (!node->shouldGenerate()) { |
| 237 |
m_valueSources[i] = ValueSource(SourceIsDead); |
| 238 |
continue; |
| 239 |
} |
| 240 |
|
| 241 |
if (m_flushedLocalOps.contains(node)) { |
| 242 |
// This value will have been flushed to the JSStack in some form or |
| 243 |
// another. |
| 244 |
|
| 245 |
if (variable->shouldUnboxIfPossible()) { |
| 246 |
if (variable->shouldUseDoubleFormat()) { |
| 247 |
m_valueSources[i] = ValueSource(DoubleInJSStack); |
| 248 |
continue; |
| 249 |
} |
| 250 |
|
| 251 |
if (isInt32Speculation(prediction)) { |
| 252 |
m_valueSources[i] = ValueSource(Int32InJSStack); |
| 253 |
continue; |
| 254 |
} |
| 255 |
} |
| 256 |
|
| 257 |
m_valueSources[i] = ValueSource(ValueInJSStack); |
| 258 |
continue; |
| 259 |
} |
| 260 |
|
| 261 |
if (variable->shouldUnboxIfPossible()) { |
| 262 |
if (variable->shouldUseDoubleFormat()) { |
| 263 |
m_valueSources[i] = ValueSource(ValueInLocals); |
| 264 |
continue; |
| 265 |
} |
| 266 |
|
| 267 |
if (isInt32Speculation(prediction)) { |
| 268 |
m_valueSources[i] = ValueSource(Int32InLocals); |
| 269 |
continue; |
| 270 |
} |
| 271 |
|
| 272 |
if (isBooleanSpeculation(prediction)) { |
| 273 |
m_valueSources[i] = ValueSource(BooleanInLocals); |
| 274 |
continue; |
| 275 |
} |
| 276 |
} |
| 277 |
|
| 278 |
m_valueSources[i] = ValueSource(ValueInLocals); |
| 279 |
} |
| 221 |
|
280 |
|
| 222 |
m_int32Values.clear(); |
281 |
m_int32Values.clear(); |
| 223 |
m_jsValueValues.clear(); |
282 |
m_jsValueValues.clear(); |
| 224 |
m_booleanValues.clear(); |
283 |
m_booleanValues.clear(); |
| 225 |
m_storageValues.clear(); |
284 |
m_storageValues.clear(); |
|
|
285 |
m_timeToLive.clear(); |
| 226 |
|
286 |
|
| 227 |
m_state.reset(); |
287 |
m_state.reset(); |
| 228 |
m_state.beginBasicBlock(m_highBlock); |
288 |
m_state.beginBasicBlock(m_highBlock); |
|
Lines 240-248
private:
Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp_sec5
|
| 240 |
|
300 |
|
| 241 |
bool shouldExecuteEffects = m_state.startExecuting(m_node); |
301 |
bool shouldExecuteEffects = m_state.startExecuting(m_node); |
| 242 |
|
302 |
|
| 243 |
if (!m_node->shouldGenerate()) |
|
|
| 244 |
return; // FIXME: Implement OSR magic here. https://bugs.webkit.org/show_bug.cgi?id=113623 |
| 245 |
|
| 246 |
m_direction = (m_node->flags() & NodeExitsForward) ? ForwardSpeculation : BackwardSpeculation; |
303 |
m_direction = (m_node->flags() & NodeExitsForward) ? ForwardSpeculation : BackwardSpeculation; |
| 247 |
|
304 |
|
| 248 |
switch (m_node->op()) { |
305 |
switch (m_node->op()) { |
|
Lines 258-263
private:
Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp_sec6
|
| 258 |
case SetLocal: |
315 |
case SetLocal: |
| 259 |
compileSetLocal(); |
316 |
compileSetLocal(); |
| 260 |
break; |
317 |
break; |
|
|
318 |
case MovHint: |
| 319 |
compileMovHint(); |
| 320 |
break; |
| 321 |
case ZombieHint: |
| 322 |
compileZombieHint(); |
| 323 |
break; |
| 261 |
case MovHintAndCheck: |
324 |
case MovHintAndCheck: |
| 262 |
compileMovHintAndCheck(); |
325 |
compileMovHintAndCheck(); |
| 263 |
break; |
326 |
break; |
|
Lines 352-357
private:
Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp_sec7
|
| 352 |
break; |
415 |
break; |
| 353 |
} |
416 |
} |
| 354 |
|
417 |
|
|
|
418 |
DFG_NODE_DO_TO_CHILDREN(m_graph, m_node, use); |
| 419 |
|
| 420 |
if (m_node->hasResult()) |
| 421 |
m_timeToLive.add(m_node, m_node->adjustedRefCount()); |
| 422 |
|
| 355 |
if (shouldExecuteEffects) |
423 |
if (shouldExecuteEffects) |
| 356 |
m_state.executeEffects(nodeIndex); |
424 |
m_state.executeEffects(nodeIndex); |
| 357 |
} |
425 |
} |
|
Lines 368-375
private:
Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp_sec8
|
| 368 |
|
436 |
|
| 369 |
void compileGetLocal() |
437 |
void compileGetLocal() |
| 370 |
{ |
438 |
{ |
|
|
439 |
// GetLocal is one of the few nodes that may be left behind, with !shouldGenerate(). |
| 440 |
if (!m_node->shouldGenerate()) |
| 441 |
return; |
| 442 |
|
| 371 |
VariableAccessData* variable = m_node->variableAccessData(); |
443 |
VariableAccessData* variable = m_node->variableAccessData(); |
| 372 |
SpeculatedType prediction = variable->prediction(); |
444 |
SpeculatedType prediction = variable->argumentAwarePrediction(); |
| 373 |
AbstractValue& value = m_state.variables().operand(variable->local()); |
445 |
AbstractValue& value = m_state.variables().operand(variable->local()); |
| 374 |
|
446 |
|
| 375 |
if (prediction == SpecNone) { |
447 |
if (prediction == SpecNone) { |
|
Lines 420-432
private:
Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp_sec9
|
| 420 |
|
492 |
|
| 421 |
void compileSetLocal() |
493 |
void compileSetLocal() |
| 422 |
{ |
494 |
{ |
|
|
495 |
observeMovHint(m_node); |
| 496 |
|
| 423 |
VariableAccessData* variable = m_node->variableAccessData(); |
497 |
VariableAccessData* variable = m_node->variableAccessData(); |
| 424 |
SpeculatedType prediction = variable->prediction(); |
498 |
SpeculatedType prediction = variable->argumentAwarePrediction(); |
| 425 |
bool needsFlushing = m_flushedLocalOps.contains(m_node); |
499 |
bool needsFlushing = m_flushedLocalOps.contains(m_node); |
| 426 |
|
500 |
|
| 427 |
// FIXME: Handle the MovHint for OSR. |
|
|
| 428 |
// https://bugs.webkit.org/show_bug.cgi?id=113623 |
| 429 |
|
| 430 |
if (variable->shouldUnboxIfPossible()) { |
501 |
if (variable->shouldUnboxIfPossible()) { |
| 431 |
if (variable->shouldUseDoubleFormat()) { |
502 |
if (variable->shouldUseDoubleFormat()) { |
| 432 |
// FIXME: implement doubles in FTL. |
503 |
// FIXME: implement doubles in FTL. |
|
Lines 438-458
private:
Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp_sec10
|
| 438 |
if (isInt32Speculation(prediction)) { |
509 |
if (isInt32Speculation(prediction)) { |
| 439 |
LValue value = lowInt32(m_node->child1()); |
510 |
LValue value = lowInt32(m_node->child1()); |
| 440 |
m_out.set(value, m_locals32.operand(variable->local())); |
511 |
m_out.set(value, m_locals32.operand(variable->local())); |
| 441 |
if (needsFlushing) |
512 |
if (needsFlushing) { |
| 442 |
m_out.store32(value, payloadFor(variable->local())); |
513 |
m_out.store32(value, payloadFor(variable->local())); |
|
|
514 |
m_valueSources[variable->local()] = ValueSource(Int32InJSStack); |
| 515 |
} |
| 443 |
return; |
516 |
return; |
| 444 |
} |
517 |
} |
| 445 |
if (isCellSpeculation(prediction)) { |
518 |
if (isCellSpeculation(prediction)) { |
| 446 |
LValue value = lowCell(m_node->child1()); |
519 |
LValue value = lowCell(m_node->child1()); |
| 447 |
m_out.set(value, m_locals64.operand(variable->local())); |
520 |
m_out.set(value, m_locals64.operand(variable->local())); |
| 448 |
if (needsFlushing) |
521 |
if (needsFlushing) { |
| 449 |
m_out.store64(value, addressFor(variable->local())); |
522 |
m_out.store64(value, addressFor(variable->local())); |
|
|
523 |
m_valueSources[variable->local()] = ValueSource(CellInJSStack); |
| 524 |
} |
| 450 |
return; |
525 |
return; |
| 451 |
} |
526 |
} |
| 452 |
if (isBooleanSpeculation(prediction)) { |
527 |
if (isBooleanSpeculation(prediction)) { |
| 453 |
m_out.set(lowBoolean(m_node->child1()), m_localsBoolean.operand(variable->local())); |
528 |
m_out.set(lowBoolean(m_node->child1()), m_localsBoolean.operand(variable->local())); |
| 454 |
if (needsFlushing) |
529 |
if (needsFlushing) { |
| 455 |
m_out.store64(lowJSValue(m_node->child1()), addressFor(variable->local())); |
530 |
m_out.store64(lowJSValue(m_node->child1()), addressFor(variable->local())); |
|
|
531 |
m_valueSources[variable->local()] = ValueSource(ValueInJSStack); |
| 532 |
} |
| 456 |
return; |
533 |
return; |
| 457 |
} |
534 |
} |
| 458 |
} |
535 |
} |
|
Lines 460-477
private:
Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp_sec11
|
| 460 |
LValue value = lowJSValue(m_node->child1()); |
537 |
LValue value = lowJSValue(m_node->child1()); |
| 461 |
if (variable->isCaptured()) { |
538 |
if (variable->isCaptured()) { |
| 462 |
m_out.store64(value, addressFor(variable->local())); |
539 |
m_out.store64(value, addressFor(variable->local())); |
|
|
540 |
m_valueSources[variable->local()] = ValueSource(ValueInJSStack); |
| 463 |
return; |
541 |
return; |
| 464 |
} |
542 |
} |
| 465 |
|
543 |
|
| 466 |
m_out.set(value, m_locals64.operand(variable->local())); |
544 |
m_out.set(value, m_locals64.operand(variable->local())); |
| 467 |
if (needsFlushing) |
545 |
if (needsFlushing) { |
| 468 |
m_out.store64(value, addressFor(variable->local())); |
546 |
m_out.store64(value, addressFor(variable->local())); |
|
|
547 |
m_valueSources[variable->local()] = ValueSource(ValueInJSStack); |
| 548 |
} |
| 549 |
} |
| 550 |
|
| 551 |
void compileMovHint() |
| 552 |
{ |
| 553 |
observeMovHint(m_node); |
| 554 |
} |
| 555 |
|
| 556 |
void compileZombieHint() |
| 557 |
{ |
| 558 |
VariableAccessData* data = m_node->variableAccessData(); |
| 559 |
m_lastSetOperand = data->local(); |
| 560 |
m_valueSources[data->local()] = ValueSource(SourceIsDead); |
| 469 |
} |
561 |
} |
| 470 |
|
562 |
|
| 471 |
void compileMovHintAndCheck() |
563 |
void compileMovHintAndCheck() |
| 472 |
{ |
564 |
{ |
| 473 |
// FIXME: Handle the MovHint for OSR. |
565 |
observeMovHint(m_node); |
| 474 |
// https://bugs.webkit.org/show_bug.cgi?id=113623 |
|
|
| 475 |
speculate(m_node->child1()); |
566 |
speculate(m_node->child1()); |
| 476 |
} |
567 |
} |
| 477 |
|
568 |
|
|
Lines 865-870
private:
Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp_sec12
|
| 865 |
} |
956 |
} |
| 866 |
} |
957 |
} |
| 867 |
|
958 |
|
|
|
959 |
void use(Node*, Edge edge) |
| 960 |
{ |
| 961 |
HashMap<Node*, unsigned>::iterator iter = m_timeToLive->find(edge.node()); |
| 962 |
ASSERT(iter != m_timeToLive->end()); |
| 963 |
ASSERT(iter->value); |
| 964 |
iter->value--; |
| 965 |
} |
| 966 |
|
| 967 |
void observeMovHint(Node* node) |
| 968 |
{ |
| 969 |
ASSERT(node->containsMovHint()); |
| 970 |
ASSERT(node->op() != ZombieHint); |
| 971 |
|
| 972 |
int operand = node->local(); |
| 973 |
|
| 974 |
m_lastSetOperand = operand; |
| 975 |
m_valueSources[operand] = ValueSource(node->child1().node()); |
| 976 |
} |
| 977 |
|
| 868 |
void speculateBackward(ExitKind, LValue, Node*, LValue failCondition) |
978 |
void speculateBackward(ExitKind, LValue, Node*, LValue failCondition) |
| 869 |
{ |
979 |
{ |
| 870 |
LBasicBlock failCase = m_out.newBlock(); |
980 |
LBasicBlock failCase = m_out.newBlock(); |
|
Lines 1165-1175
private:
Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp_sec13
|
| 1165 |
HashMap<Node*, LValue> m_jsValueValues; |
1275 |
HashMap<Node*, LValue> m_jsValueValues; |
| 1166 |
HashMap<Node*, LValue> m_booleanValues; |
1276 |
HashMap<Node*, LValue> m_booleanValues; |
| 1167 |
HashMap<Node*, LValue> m_storageValues; |
1277 |
HashMap<Node*, LValue> m_storageValues; |
|
|
1278 |
HashMap<Node*, unsigned> m_timeToLive; |
| 1168 |
|
1279 |
|
| 1169 |
Operands<LValue> m_localsBoolean; |
1280 |
Operands<LValue> m_localsBoolean; |
| 1170 |
Operands<LValue> m_locals32; |
1281 |
Operands<LValue> m_locals32; |
| 1171 |
Operands<LValue> m_locals64; |
1282 |
Operands<LValue> m_locals64; |
| 1172 |
|
1283 |
|
|
|
1284 |
Operands<ValueSource> m_valueSources; |
| 1285 |
|
| 1173 |
AbstractState m_state; |
1286 |
AbstractState m_state; |
| 1174 |
BasicBlock* m_highBlock; |
1287 |
BasicBlock* m_highBlock; |
| 1175 |
BasicBlock* m_nextHighBlock; |
1288 |
BasicBlock* m_nextHighBlock; |