Changeset 222009 in webkit for trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
- Timestamp:
- Sep 13, 2017, 9:21:05 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
r221849 r222009 2321 2321 } 2322 2322 2323 auto CodeBlock::updateOSRExitCounterAndCheckIfNeedToReoptimize(DFG::OSRExitState& exitState) -> OptimizeAction2324 {2325 DFG::OSRExitBase& exit = exitState.exit;2326 if (!exitKindMayJettison(exit.m_kind)) {2327 // FIXME: We may want to notice that we're frequently exiting2328 // at an op_catch that we didn't compile an entrypoint for, and2329 // then trigger a reoptimization of this CodeBlock:2330 // https://bugs.webkit.org/show_bug.cgi?id=1758422331 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 outermost2343 // code block in the inline stack, we handle this appropriately by having the loop OSR trigger2344 // check the exit count of the replacement of the CodeBlock from which we are OSRing. The2345 // problem is the inlined functions, which might also have loops, but whose baseline versions2346 // don't know where to look for the exit count. Figure out if those loops are severe enough2347 // 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 = didTryToEnterInLoop2359 ? 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 2370 2323 void CodeBlock::optimizeNextInvocation() 2371 2324 {
Note:
See TracChangeset
for help on using the changeset viewer.