NativeScript / ios-jsc

NativeScript for iOS using JavaScriptCore

Home Page:http://docs.nativescript.org/runtimes/ios

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Provide support for setting JSC options in {N} applications

mbektchiev opened this issue · comments

Is your feature request related to a problem? Please describe.
JSC has literally hundreds of options that can be used to control behavior and/or expose internal APIs. Currently there's no way to specify them in a {N} application while the Android runtime allows for tweaking its V8 engine's optionsapp/package.json. We'd like to have parity and allow users to control them.

Describe the solution you'd like
Read and respect the options written in the ios.jscFlags variable in app/package.json

Additional context

  • Many options' values have effect only during JSC's initialization phase, that's why a runtime interface seems unnecessary for now although it exists in C++ and can also be considered.
  • This feature replaces #732 as it will bring more control and flexibility.
  • All currently supported options by iOS runtime's version of WebKit are listed in JSC_OPTIONS macro definition in Options.h

With the current implementation you can set the JSC options by passing ios.jscFlags list of options in the following format "--=" separated by space. Here's an example how to set dumpOptions(dumps JSC options (0 = None, 1 = Overridden only, 2 = All, 3 = Verbose)):

{
    "ios": {
        "jscFlags": "--dumpOptions=2"
    }
}

If dumpOptions is set to 2, when starting the application through xCode, it should dump the values of all JSC options in the Target Output:

All JSC options:
   validateOptions=false
   dumpOptions=2 (default: 0)
   configFile=""
   useLLInt=true
   useJIT=false (default: true)
   useBaselineJIT=true
   useDFGJIT=true
   useRegExpJIT=true
   useDOMJIT=true
   reportMustSucceedExecutableAllocations=false
   maxPerThreadStackUsage=4194304
   softReservedZoneSize=131072
   reservedZoneSize=65536
   crashIfCantAllocateJITMemory=false
   jitMemoryReservationSize=0
   useSeparatedWXHeap=false
   forceCodeBlockLiveness=false
   forceICFailure=false
   repatchCountForCoolDown=8
   initialCoolDownCount=20
   repatchBufferingCountdown=8
   dumpGeneratedBytecodes=false
   dumpBytecodeLivenessResults=false
   validateBytecode=false
   forceDebuggerBytecodeGeneration=false
   dumpBytecodesBeforeGeneratorification=false
   useFunctionDotArguments=true
   useTailCalls=true
   optimizeRecursiveTailCalls=true
   alwaysUseShadowChicken=false
   shadowChickenLogSize=1000
   shadowChickenMaxTailDeletedFramesSize=128
   dumpDisassembly=false
   asyncDisassembly=false
   dumpDFGDisassembly=false
   dumpFTLDisassembly=false
   dumpAllDFGNodes=false
   bytecodeRangeToJITCompile=<null>
   bytecodeRangeToDFGCompile=<null>
   bytecodeRangeToFTLCompile=<null>
   jitWhitelist=""
   dfgWhitelist=""
   ftlWhitelist=""
   dumpSourceAtDFGTime=false
   dumpBytecodeAtDFGTime=false
   dumpGraphAfterParsing=false
   dumpGraphAtEachPhase=false
   dumpDFGGraphAtEachPhase=false
   dumpDFGFTLGraphAtEachPhase=false
   dumpB3GraphAtEachPhase=false
   dumpAirGraphAtEachPhase=false
   verboseDFGBytecodeParsing=false
   safepointBeforeEachPhase=true
   verboseCompilation=false
   verboseFTLCompilation=false
   logCompilationChanges=false
   useProbeOSRExit=false
   printEachOSRExit=false
   validateGraph=false
   validateGraphAtEachPhase=false
   verboseValidationFailure=false
   verboseOSR=false
   verboseDFGOSRExit=false
   verboseFTLOSRExit=false
   verboseCallLink=false
   verboseCompilationQueue=false
   reportCompileTimes=false
   reportBaselineCompileTimes=false
   reportDFGCompileTimes=false
   reportFTLCompileTimes=false
   reportTotalCompileTimes=false
   reportParseTimes=false
   reportBytecodeCompileTimes=false
   verboseExitProfile=false
   verboseCFA=false
   verboseDFGFailure=false
   verboseFTLToJSThunk=false
   verboseFTLFailure=false
   alwaysComputeHash=false
   testTheFTL=false
   verboseSanitizeStack=false
   useGenerationalGC=true
   useConcurrentBarriers=true
   useConcurrentGC=true
   collectContinuously=false
   collectContinuouslyPeriodMS=1
   forceFencedBarrier=false
   verboseVisitRace=false
   optimizeParallelSlotVisitorsForStoppedMutator=false
   largeHeapSize=33554432
   smallHeapSize=1048576
   smallHeapRAMFraction=0.8 (default: 0.25)
   smallHeapGrowthFactor=2
   mediumHeapRAMFraction=0.9 (default: 0.5)
   mediumHeapGrowthFactor=1.5
   largeHeapGrowthFactor=1.24
   miniVMHeapGrowthFactor=1.27
   criticalGCMemoryThreshold=0.8
   minimumMutatorUtilization=0
   maximumMutatorUtilization=0.6 (default: 0.7)
   epsilonMutatorUtilization=0.01
   concurrentGCMaxHeadroom=1.4 (default: 1.5)
   concurrentGCPeriodMS=2
   useStochasticMutatorScheduler=false (default: true)
   minimumGCPauseMS=1 (default: 0.3)
   gcPauseScale=0.3
   gcIncrementBytes=10000
   gcIncrementMaxBytes=100000
   gcIncrementScale=0
   scribbleFreeCells=false
   sizeClassProgression=1.4
   largeAllocationCutoff=100000
   dumpSizeClasses=false
   useBumpAllocator=true
   stealEmptyBlocksFromOtherAllocators=true
   tradeDestructorBlocks=true
   eagerlyUpdateTopCallFrame=false
   useOSREntryToDFG=true
   useOSREntryToFTL=true
   useFTLJIT=false (default: true)
   useFTLTBAA=true
   validateFTLOSRExitLiveness=false
   defaultB3OptLevel=2
   b3AlwaysFailsBeforeCompile=false
   b3AlwaysFailsBeforeLink=false
   ftlCrashes=false
   clobberAllRegsInFTLICSlowPath=true
   enableJITDebugAssertions=true
   useAccessInlining=true
   maxAccessVariantListSize=8
   usePolyvariantDevirtualization=true
   usePolymorphicAccessInlining=true
   usePolymorphicCallInlining=true
   usePolymorphicCallInliningForNonStubStatus=false
   maxPolymorphicCallVariantListSize=15
   maxPolymorphicCallVariantListSizeForTopTier=5
   maxPolymorphicCallVariantListSizeForWebAssemblyToJS=5
   maxPolymorphicCallVariantsForInlining=5
   frequentCallThreshold=2
   minimumCallToKnownRate=0.51
   createPreHeaders=true
   useMovHintRemoval=true
   usePutStackSinking=true
   useObjectAllocationSinking=true
   useArityFixupInlining=true
   logExecutableAllocation=false
   useConcurrentJIT=true
   numberOfDFGCompilerThreads=2
   numberOfFTLCompilerThreads=1
   priorityDeltaOfDFGCompilerThreads=0
   priorityDeltaOfFTLCompilerThreads=0
   priorityDeltaOfWasmCompilerThreads=0
   useProfiler=false
   disassembleBaselineForProfiler=true
   useArchitectureSpecificOptimizations=true
   breakOnThrow=false
   maximumOptimizationCandidateInstructionCount=100000
   maximumFunctionForCallInlineCandidateInstructionCount=190
   maximumFunctionForClosureCallInlineCandidateInstructionCount=100
   maximumFunctionForConstructInlineCandidateInstructionCount=100
   maximumFTLCandidateInstructionCount=20000
   maximumInliningDepth=5
   maximumInliningRecursion=2
   maximumInliningCallerSize=10000
   maximumVarargsForInlining=100
   usePolyvariantCallInlining=true
   usePolyvariantByIdInlining=true
   useMaximalFlushInsertionPhase=false
   maximumBinaryStringSwitchCaseLength=50
   maximumBinaryStringSwitchTotalLength=2000
   jitPolicyScale=1
   forceEagerCompilation=false
   thresholdForJITAfterWarmUp=500
   thresholdForJITSoon=100
   thresholdForOptimizeAfterWarmUp=1000
   thresholdForOptimizeAfterLongWarmUp=1000
   thresholdForOptimizeSoon=1000
   executionCounterIncrementForLoop=1
   executionCounterIncrementForEntry=15
   thresholdForFTLOptimizeAfterWarmUp=100000
   thresholdForFTLOptimizeSoon=1000
   ftlTierUpCounterIncrementForLoop=1
   ftlTierUpCounterIncrementForReturn=15
   ftlOSREntryFailureCountForReoptimization=15
   ftlOSREntryRetryThreshold=100
   evalThresholdMultiplier=10
   maximumEvalCacheableSourceLength=256
   randomizeExecutionCountsBetweenCheckpoints=false
   maximumExecutionCountsBetweenCheckpointsForBaseline=1000
   maximumExecutionCountsBetweenCheckpointsForUpperTiers=50000
   likelyToTakeSlowCaseMinimumCount=20
   couldTakeSlowCaseMinimumCount=10
   osrExitCountForReoptimization=100
   osrExitCountForReoptimizationFromLoop=5
   reoptimizationRetryCounterMax=21 (default: 0)
   minimumOptimizationDelay=1
   maximumOptimizationDelay=5
   desiredProfileLivenessRate=0.75
   desiredProfileFullnessRate=0.35
   doubleVoteRatioForDoubleFormat=2
   structureCheckVoteRatioForHoisting=1
   checkArrayVoteRatioForHoisting=1
   maximumDirectCallStackSize=200
   minimumNumberOfScansBetweenRebalance=100
   numberOfGCMarkers=8
   useParallelMarkingConstraintSolver=true
   opaqueRootMergeThreshold=1000
   minHeapUtilization=0.8
   minMarkedBlockUtilization=0.9
   slowPathAllocsBetweenGCs=0
   percentCPUPerMBForFullTimer=0.0003125
   percentCPUPerMBForEdenTimer=0.0025
   collectionTimerMaxPercentCPU=0.05
   forceWeakRandomSeed=false
   forcedWeakRandomSeed=0
   useZombieMode=false
   useImmortalObjects=false
   sweepSynchronously=false
   maxSingleAllocationSize=0
   logGC=None
   useGC=true
   gcAtEnd=false
   forceGCSlowPaths=false
   gcMaxHeapSize=0
   forceRAMSize=0
   recordGCPauseTimes=false
   logHeapStatisticsAtExit=false
   forceCodeBlockToJettisonDueToOldAge=false
   useEagerCodeBlockJettisonTiming=false
   useTypeProfiler=false
   useControlFlowProfiler=false
   useSamplingProfiler=false
   sampleInterval=1000
   collectSamplingProfilerDataForJSCShell=false
   samplingProfilerTopFunctionsCount=12
   samplingProfilerTopBytecodesCount=40
   samplingProfilerPath=""
   sampleCCode=false
   alwaysGeneratePCToCodeOriginMap=false
   verifyHeap=false
   numberOfGCCyclesToRecordForVerification=3
   exceptionStackTraceLimit=100
   defaultErrorStackTraceLimit=100
   useExceptionFuzz=false
   fireExceptionFuzzAt=0
   validateDFGExceptionHandling=true (default: false)
   dumpSimulatedThrows=false
   validateExceptionChecks=false
   unexpectedExceptionStackTraceLimit=100
   useExecutableAllocationFuzz=false
   fireExecutableAllocationFuzzAt=0
   fireExecutableAllocationFuzzAtOrAfter=0
   verboseExecutableAllocationFuzz=false
   useOSRExitFuzz=false
   fireOSRExitFuzzAtStatic=0
   fireOSRExitFuzzAt=0
   fireOSRExitFuzzAtOrAfter=0
   logPhaseTimes=false
   rareBlockPenalty=0.001
   airLinearScanVerbose=false
   airLinearScanSpillsEverything=false
   airForceBriggsAllocator=false
   airForceIRCAllocator=false
   airRandomizeRegs=false
   coalesceSpillSlots=true
   logAirRegisterPressure=false
   useB3TailDup=true
   maxB3TailDupBlockSize=3
   maxB3TailDupBlockSuccessors=3
   useDollarVM=false
   functionOverrides=""
   useSigillCrashAnalyzer=true (default: false)
   watchdog=0
   usePollingTraps=false
   useMachForExceptions=false (default: true)
   useICStats=false
   prototypeHitCountForLLIntCaching=2
   dumpCompiledRegExpPatterns=false
   dumpModuleRecord=false
   dumpModuleLoadingState=false
   exposeInternalModuleLoader=false
   useSuperSampler=false
   useSourceProviderCache=true
   useCodeCache=true
   useWebAssembly=false (default: true)
   enableSpectreMitigations=true
   enableSpectreGadgets=false
   usePoisoning=true
   zeroStackFrame=false
   useAsyncIterator=true
   failToCompileWebAssemblyCode=false
   webAssemblyPartialCompileLimit=5000
   webAssemblyBBQOptimizationLevel=1
   webAssemblyOMGOptimizationLevel=2
   useBBQTierUpChecks=true
   webAssemblyOMGTierUpCount=5000
   webAssemblyLoopDecrement=15
   webAssemblyFunctionEntryDecrement=1
   useWebAssemblyFastMemory=false
   logWebAssemblyMemory=false
   webAssemblyFastMemoryRedzonePages=128
   crashIfWebAssemblyCantFastMemory=false
   maxNumWebAssemblyFastMemories=4
   useFastTLSForWasmContext=false (default: true)
   useWebAssemblyStreamingApi=false
   useCallICsForWebAssemblyToJSCalls=true
   useEagerWebAssemblyModuleHashing=false
   useObjectRestSpread=true
   useBigInt=false
   useIntlNumberFormatToParts=false
   useIntlPluralRules=false
   useArrayAllocationProfiling=true
   forcePolyProto=false
   forceMiniVMMode=false
   useTracePoints=false

Seems that options apply (tried with logGC) but can't see any log in terminal or Console app, only if I open the project in Xcode. Where is expected to see the output of these options?

Automation tests should be added after merging #1093