Ignore:
Timestamp:
Jan 27, 2017, 5:04:06 PM (8 years ago)
Author:
[email protected]
Message:

Make the CLI for the sampling profiler better for inlined call site indices
https://bugs.webkit.org/show_bug.cgi?id=167482

Reviewed by Mark Lam.

This patches changes the command line interface for the sampling
profiler to also dump the machine frame that the semantic code
origin is in if the semantic code origin is inlined. This helps
when doing performance work because it's helpful to know the
context that an inlined frame is in. Before, we used to just
say it was in the baseline JIT if it didn't have its own optimized
compile. Now, we can tell that its inlined into a DFG or FTL frame.

  • inspector/agents/InspectorScriptProfilerAgent.cpp:

(Inspector::buildSamples):

  • runtime/Options.h:
  • runtime/SamplingProfiler.cpp:

(JSC::SamplingProfiler::processUnverifiedStackTraces):
(JSC::SamplingProfiler::reportTopFunctions):
(JSC::SamplingProfiler::reportTopBytecodes):

  • runtime/SamplingProfiler.h:

(JSC::SamplingProfiler::StackFrame::CodeLocation::hasCodeBlockHash):
(JSC::SamplingProfiler::StackFrame::CodeLocation::hasBytecodeIndex):
(JSC::SamplingProfiler::StackFrame::CodeLocation::hasExpressionInfo):
(JSC::SamplingProfiler::StackFrame::hasExpressionInfo):
(JSC::SamplingProfiler::StackFrame::lineNumber):
(JSC::SamplingProfiler::StackFrame::columnNumber):
(JSC::SamplingProfiler::StackFrame::hasBytecodeIndex): Deleted.
(JSC::SamplingProfiler::StackFrame::hasCodeBlockHash): Deleted.

File:
1 edited

Legend:

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

    r206525 r211316  
    8181        ExecutableBase* executable { nullptr };
    8282        JSObject* callee { nullptr };
    83         // These attempt to be expression-level line and column number.
    84         unsigned lineNumber { std::numeric_limits<unsigned>::max() };
    85         unsigned columnNumber { std::numeric_limits<unsigned>::max() };
    86         unsigned bytecodeIndex { std::numeric_limits<unsigned>::max() };
    87         CodeBlockHash codeBlockHash;
    88         JITCode::JITType jitType { JITCode::None };
    89 
    90         bool hasExpressionInfo() const
     83
     84        struct CodeLocation {
     85            bool hasCodeBlockHash() const
     86            {
     87                return codeBlockHash.isSet();
     88            }
     89
     90            bool hasBytecodeIndex() const
     91            {
     92                return bytecodeIndex != std::numeric_limits<unsigned>::max();
     93            }
     94
     95            bool hasExpressionInfo() const
     96            {
     97                return lineNumber != std::numeric_limits<unsigned>::max()
     98                    && columnNumber != std::numeric_limits<unsigned>::max();
     99            }
     100
     101            // These attempt to be expression-level line and column number.
     102            unsigned lineNumber { std::numeric_limits<unsigned>::max() };
     103            unsigned columnNumber { std::numeric_limits<unsigned>::max() };
     104            unsigned bytecodeIndex { std::numeric_limits<unsigned>::max() };
     105            CodeBlockHash codeBlockHash;
     106            JITCode::JITType jitType { JITCode::None };
     107        };
     108
     109        CodeLocation semanticLocation;
     110        std::optional<std::pair<CodeLocation, Strong<CodeBlock>>> machineLocation; // This is non-null if we were inlined. It represents the machine frame we were inlined into.
     111
     112        bool hasExpressionInfo() const { return semanticLocation.hasExpressionInfo(); }
     113        unsigned lineNumber() const
    91114        {
    92             return lineNumber != std::numeric_limits<unsigned>::max()
    93                 && columnNumber != std::numeric_limits<unsigned>::max();
     115            ASSERT(hasExpressionInfo());
     116            return semanticLocation.lineNumber;
    94117        }
    95 
    96         bool hasBytecodeIndex() const
     118        unsigned columnNumber() const
    97119        {
    98             return bytecodeIndex != std::numeric_limits<unsigned>::max();
    99         }
    100 
    101         bool hasCodeBlockHash() const
    102         {
    103             return codeBlockHash.isSet();
     120            ASSERT(hasExpressionInfo());
     121            return semanticLocation.columnNumber;
    104122        }
    105123
Note: See TracChangeset for help on using the changeset viewer.