Changeset 222871 in webkit for trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
- Timestamp:
- Oct 4, 2017, 1:00:01 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
r222827 r222871 2321 2321 } 2322 2322 2323 auto CodeBlock::updateOSRExitCounterAndCheckIfNeedToReoptimize(DFG::OSRExitState& exitState) -> OptimizeAction 2324 { 2325 DFG::OSRExitBase& exit = exitState.exit; 2326 if (!exitKindMayJettison(exit.m_kind)) { 2327 // FIXME: We may want to notice that we're frequently exiting 2328 // at an op_catch that we didn't compile an entrypoint for, and 2329 // then trigger a reoptimization of this CodeBlock: 2330 // https://bugs.webkit.org/show_bug.cgi?id=175842 2331 return OptimizeAction::None; 2332 } 2333 2334 exit.m_count++; 2335 m_osrExitCounter++; 2336 2337 CodeBlock* baselineCodeBlock = exitState.baselineCodeBlock; 2338 ASSERT(baselineCodeBlock == baselineAlternative()); 2339 if (UNLIKELY(baselineCodeBlock->jitExecuteCounter().hasCrossedThreshold())) 2340 return OptimizeAction::ReoptimizeNow; 2341 2342 // We want to figure out if there's a possibility that we're in a loop. For the outermost 2343 // code block in the inline stack, we handle this appropriately by having the loop OSR trigger 2344 // check the exit count of the replacement of the CodeBlock from which we are OSRing. The 2345 // problem is the inlined functions, which might also have loops, but whose baseline versions 2346 // don't know where to look for the exit count. Figure out if those loops are severe enough 2347 // that we had tried to OSR enter. If so, then we should use the loop reoptimization trigger. 2348 // Otherwise, we should use the normal reoptimization trigger. 2349 2350 bool didTryToEnterInLoop = false; 2351 for (InlineCallFrame* inlineCallFrame = exit.m_codeOrigin.inlineCallFrame; inlineCallFrame; inlineCallFrame = inlineCallFrame->directCaller.inlineCallFrame) { 2352 if (inlineCallFrame->baselineCodeBlock->ownerScriptExecutable()->didTryToEnterInLoop()) { 2353 didTryToEnterInLoop = true; 2354 break; 2355 } 2356 } 2357 2358 uint32_t exitCountThreshold = didTryToEnterInLoop 2359 ? exitCountThresholdForReoptimizationFromLoop() 2360 : exitCountThresholdForReoptimization(); 2361 2362 if (m_osrExitCounter > exitCountThreshold) 2363 return OptimizeAction::ReoptimizeNow; 2364 2365 // Too few fails. Adjust the execution counter such that the target is to only optimize after a while. 2366 baselineCodeBlock->m_jitExecuteCounter.setNewThresholdForOSRExit(exitState.activeThreshold, exitState.memoryUsageAdjustedThreshold); 2367 return OptimizeAction::None; 2368 } 2369 2323 2370 void CodeBlock::optimizeNextInvocation() 2324 2371 {
Note:
See TracChangeset
for help on using the changeset viewer.