|
Lines 1740-1752
extern "C" void DFG_OPERATION triggerReo
Source/JavaScriptCore/dfg/DFGOperations.cpp_sec1
|
| 1740 |
|
1740 |
|
| 1741 |
// If I am my own replacement, then reoptimization has already been triggered. |
1741 |
// If I am my own replacement, then reoptimization has already been triggered. |
| 1742 |
// This can happen in recursive functions. |
1742 |
// This can happen in recursive functions. |
| 1743 |
if (codeBlock->replacement() == codeBlock) |
1743 |
if (codeBlock->replacement() == codeBlock) { |
|
|
1744 |
if (Options::verboseOSR()) |
| 1745 |
dataLog(*codeBlock, ": Not reoptimizing because we've already been jettisoned.\n"); |
| 1744 |
return; |
1746 |
return; |
| 1745 |
|
1747 |
} |
|
|
1748 |
|
| 1746 |
// Otherwise, the replacement must be optimized code. Use this as an opportunity |
1749 |
// Otherwise, the replacement must be optimized code. Use this as an opportunity |
| 1747 |
// to check our logic. |
1750 |
// to check our logic. |
| 1748 |
ASSERT(codeBlock->hasOptimizedReplacement()); |
1751 |
ASSERT(codeBlock->hasOptimizedReplacement()); |
| 1749 |
ASSERT(JITCode::isOptimizingJIT(codeBlock->replacement()->jitType())); |
1752 |
CodeBlock* optimizedCodeBlock = codeBlock->replacement(); |
|
|
1753 |
ASSERT(JITCode::isOptimizingJIT(optimizedCodeBlock->jitType())); |
| 1754 |
|
| 1755 |
// In order to trigger reoptimization, one of two things must have happened: |
| 1756 |
// 1) We exited more than some number of times. |
| 1757 |
// 2) We exited and got stuck in a loop, and now we're exiting again. |
| 1758 |
bool didExitABunch = optimizedCodeBlock->shouldReoptimizeNow(); |
| 1759 |
bool didGetStuckInLoop = |
| 1760 |
codeBlock->checkIfOptimizationThresholdReached() |
| 1761 |
&& optimizedCodeBlock->shouldReoptimizeFromLoopNow(); |
| 1762 |
|
| 1763 |
if (!didExitABunch && !didGetStuckInLoop) { |
| 1764 |
if (Options::verboseOSR()) |
| 1765 |
dataLog(*codeBlock, ": Not reoptimizing ", *optimizedCodeBlock, " because it either didn't exit enough or didn't loop enough after exit.\n"); |
| 1766 |
codeBlock->optimizeAfterLongWarmUp(); |
| 1767 |
return; |
| 1768 |
} |
| 1750 |
|
1769 |
|
| 1751 |
codeBlock->reoptimize(); |
1770 |
codeBlock->reoptimize(); |
| 1752 |
} |
1771 |
} |