Ignore:
Timestamp:
Mar 4, 2012, 10:52:44 PM (13 years ago)
Author:
[email protected]
Message:

JIT heuristics should be hyperbolic
https://bugs.webkit.org/show_bug.cgi?id=80055
<rdar://problem/10922260>

Source/JavaScriptCore:

Reviewed by Oliver Hunt.

Added tracking of the amount of executable memory typically used for a bytecode
instruction. Modified the execution counter scheme to use this, and the amount
of free memory, to determine how long to wait before invoking the JIT.

The result is that even if we bomb the VM with more code than can fit in our
executable memory pool, we still keep running and almost never run out of
executable memory - which ensures that if we have to JIT something critical, then
we'll likely have enough memory to do so. This also does not regress performance
on the three main benchmarks.

  • CMakeLists.txt:
  • GNUmakefile.list.am:
  • JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • Target.pri:
  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::predictedMachineCodeSize):
(JSC):
(JSC::CodeBlock::usesOpcode):

  • bytecode/CodeBlock.h:

(CodeBlock):
(JSC::CodeBlock::checkIfJITThresholdReached):
(JSC::CodeBlock::dontJITAnytimeSoon):
(JSC::CodeBlock::jitAfterWarmUp):
(JSC::CodeBlock::jitSoon):
(JSC::CodeBlock::llintExecuteCounter):
(JSC::CodeBlock::counterValueForOptimizeAfterWarmUp):
(JSC::CodeBlock::counterValueForOptimizeAfterLongWarmUp):
(JSC::CodeBlock::addressOfJITExecuteCounter):
(JSC::CodeBlock::offsetOfJITExecuteCounter):
(JSC::CodeBlock::offsetOfJITExecutionActiveThreshold):
(JSC::CodeBlock::offsetOfJITExecutionTotalCount):
(JSC::CodeBlock::jitExecuteCounter):
(JSC::CodeBlock::checkIfOptimizationThresholdReached):
(JSC::CodeBlock::optimizeNextInvocation):
(JSC::CodeBlock::dontOptimizeAnytimeSoon):
(JSC::CodeBlock::optimizeAfterWarmUp):
(JSC::CodeBlock::optimizeAfterLongWarmUp):
(JSC::CodeBlock::optimizeSoon):

  • bytecode/ExecutionCounter.cpp: Added.

(JSC):
(JSC::ExecutionCounter::ExecutionCounter):
(JSC::ExecutionCounter::checkIfThresholdCrossedAndSet):
(JSC::ExecutionCounter::setNewThreshold):
(JSC::ExecutionCounter::deferIndefinitely):
(JSC::ExecutionCounter::applyMemoryUsageHeuristics):
(JSC::ExecutionCounter::applyMemoryUsageHeuristicsAndConvertToInt):
(JSC::ExecutionCounter::hasCrossedThreshold):
(JSC::ExecutionCounter::setThreshold):
(JSC::ExecutionCounter::reset):

  • bytecode/ExecutionCounter.h: Added.

(JSC):
(ExecutionCounter):
(JSC::ExecutionCounter::formattedTotalCount):

  • dfg/DFGOSRExitCompiler32_64.cpp:

(JSC::DFG::OSRExitCompiler::compileExit):

  • dfg/DFGOSRExitCompiler64.cpp:

(JSC::DFG::OSRExitCompiler::compileExit):

  • jit/ExecutableAllocator.cpp:

(JSC::DemandExecutableAllocator::allocateNewSpace):
(JSC::ExecutableAllocator::underMemoryPressure):
(JSC):
(JSC::ExecutableAllocator::memoryPressureMultiplier):

  • jit/ExecutableAllocator.h:
  • jit/ExecutableAllocatorFixedVMPool.cpp:

(JSC::ExecutableAllocator::memoryPressureMultiplier):
(JSC):

  • jit/JIT.cpp:

(JSC::JIT::privateCompile):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::jitCompileAndSetHeuristics):

  • llint/LowLevelInterpreter32_64.asm:
  • runtime/JSGlobalData.h:

(JSGlobalData):

  • runtime/Options.cpp:

(Options):
(JSC::Options::initializeOptions):

  • runtime/Options.h:

(Options):

  • wtf/SimpleStats.h: Added.

(WTF):
(SimpleStats):
(WTF::SimpleStats::SimpleStats):
(WTF::SimpleStats::add):
(WTF::SimpleStats::operator!):
(WTF::SimpleStats::count):
(WTF::SimpleStats::sum):
(WTF::SimpleStats::sumOfSquares):
(WTF::SimpleStats::mean):
(WTF::SimpleStats::variance):
(WTF::SimpleStats::standardDeviation):

Source/WebCore:

Reviewed by Oliver Hunt.

No new tests, since there's no new functionality.

  • ForwardingHeaders/wtf/SimpleStats.h: Added.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/Options.h

    r108444 r109705  
    3838extern unsigned maximumInliningDepth; // Depth of inline stack, so 1 = no inlining, 2 = one level, etc.
    3939
    40 extern int32_t executionCounterValueForJITAfterWarmUp;
    41 extern int32_t executionCounterValueForDontJITAnytimeSoon;
    42 extern int32_t executionCounterValueForJITSoon;
     40extern int32_t thresholdForJITAfterWarmUp;
     41extern int32_t thresholdForJITSoon;
    4342
    44 extern int32_t executionCounterValueForOptimizeAfterWarmUp;
    45 extern int32_t executionCounterValueForOptimizeAfterLongWarmUp;
    46 extern int32_t executionCounterValueForDontOptimizeAnytimeSoon;
    47 extern int32_t executionCounterValueForOptimizeSoon;
    48 extern int32_t executionCounterValueForOptimizeNextInvocation;
     43extern int32_t thresholdForOptimizeAfterWarmUp;
     44extern int32_t thresholdForOptimizeAfterLongWarmUp;
     45extern int32_t thresholdForOptimizeSoon;
     46extern int32_t thresholdForOptimizeNextInvocation;
    4947
    5048extern int32_t executionCounterIncrementForLoop;
Note: See TracChangeset for help on using the changeset viewer.