Changeset 146548 in webkit


Ignore:
Timestamp:
Mar 21, 2013 6:17:09 PM (11 years ago)
Author:
fpizlo@apple.com
Message:

JSC profiler should have an at-a-glance report of the success of DFG optimization
https://bugs.webkit.org/show_bug.cgi?id=112988

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::handleCall):
(JSC::DFG::ByteCodeParser::handleGetById):
(JSC::DFG::ByteCodeParser::parseBlock):

  • profiler/ProfilerCompilation.cpp:

(JSC::Profiler::Compilation::Compilation):
(JSC::Profiler::Compilation::toJS):

  • profiler/ProfilerCompilation.h:

(JSC::Profiler::Compilation::noticeInlinedGetById):
(JSC::Profiler::Compilation::noticeInlinedPutById):
(JSC::Profiler::Compilation::noticeInlinedCall):
(Compilation):

  • runtime/CommonIdentifiers.h:

Tools:

  • Scripts/display-profiler-output:
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r146505 r146548  
     12013-03-21  Filip Pizlo  <fpizlo@apple.com>
     2
     3        JSC profiler should have an at-a-glance report of the success of DFG optimization
     4        https://bugs.webkit.org/show_bug.cgi?id=112988
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        * dfg/DFGByteCodeParser.cpp:
     9        (JSC::DFG::ByteCodeParser::handleCall):
     10        (JSC::DFG::ByteCodeParser::handleGetById):
     11        (JSC::DFG::ByteCodeParser::parseBlock):
     12        * profiler/ProfilerCompilation.cpp:
     13        (JSC::Profiler::Compilation::Compilation):
     14        (JSC::Profiler::Compilation::toJS):
     15        * profiler/ProfilerCompilation.h:
     16        (JSC::Profiler::Compilation::noticeInlinedGetById):
     17        (JSC::Profiler::Compilation::noticeInlinedPutById):
     18        (JSC::Profiler::Compilation::noticeInlinedCall):
     19        (Compilation):
     20        * runtime/CommonIdentifiers.h:
     21
    1222013-03-21  Mark Lam  <mark.lam@apple.com>
    223
  • trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp

    r146382 r146548  
    12311231            addToGraph(Phantom, callTarget);
    12321232            emitArgumentPhantoms(registerOffset, argumentCountIncludingThis, kind);
     1233            if (m_graph.m_compilation)
     1234                m_graph.m_compilation->noticeInlinedCall();
    12331235            return;
    12341236        }
    1235     } else if (handleInlining(usesResult, callTarget, resultOperand, callLinkStatus, registerOffset, argumentCountIncludingThis, nextOffset, kind))
     1237    } else if (handleInlining(usesResult, callTarget, resultOperand, callLinkStatus, registerOffset, argumentCountIncludingThis, nextOffset, kind)) {
     1238        if (m_graph.m_compilation)
     1239            m_graph.m_compilation->noticeInlinedCall();
    12361240        return;
     1241    }
    12371242   
    12381243    addCall(interpreter, currentInstruction, op);
     
    17181723    if (prediction == SpecNone)
    17191724        addToGraph(ForceOSRExit);
     1725    else if (m_graph.m_compilation)
     1726        m_graph.m_compilation->noticeInlinedGetById();
    17201727   
    17211728    Node* originalBaseForBaselineJIT = base;
     
    25962603                m_currentIndex,
    25972604                m_codeBlock->identifier(identifierNumber));
    2598             if (!putByIdStatus.isSet())
     2605            bool canCountAsInlined = true;
     2606            if (!putByIdStatus.isSet()) {
    25992607                addToGraph(ForceOSRExit);
     2608                canCountAsInlined = false;
     2609            }
    26002610           
    26012611            bool hasExitSite = m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, BadCache);
     
    26852695                else
    26862696                    addToGraph(PutById, OpInfo(identifierNumber), base, value);
    2687             }
     2697                canCountAsInlined = false;
     2698            }
     2699           
     2700            if (canCountAsInlined && m_graph.m_compilation)
     2701                m_graph.m_compilation->noticeInlinedPutById();
    26882702
    26892703            NEXT_OPCODE(op_put_by_id);
  • trunk/Source/JavaScriptCore/profiler/ProfilerCompilation.cpp

    r141050 r146548  
    11/*
    2  * Copyright (C) 2012 Apple Inc. All rights reserved.
     2 * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3838    : m_bytecodes(bytecodes)
    3939    , m_kind(kind)
     40    , m_numInlinedGetByIds(0)
     41    , m_numInlinedPutByIds(0)
     42    , m_numInlinedCalls(0)
    4043{
    4144}
     
    125128    result->putDirect(exec->globalData(), exec->propertyNames().osrExits, exits);
    126129   
     130    result->putDirect(exec->globalData(), exec->propertyNames().numInlinedGetByIds, jsNumber(m_numInlinedGetByIds));
     131    result->putDirect(exec->globalData(), exec->propertyNames().numInlinedPutByIds, jsNumber(m_numInlinedPutByIds));
     132    result->putDirect(exec->globalData(), exec->propertyNames().numInlinedCalls, jsNumber(m_numInlinedCalls));
     133   
    127134    return result;
    128135}
  • trunk/Source/JavaScriptCore/profiler/ProfilerCompilation.h

    r140718 r146548  
    11/*
    2  * Copyright (C) 2012 Apple Inc. All rights reserved.
     2 * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    5656    const ProfiledBytecodes& profiledBytecodesAt(unsigned i) const { return m_profiledBytecodes[i]; }
    5757   
     58    void noticeInlinedGetById() { m_numInlinedGetByIds++; }
     59    void noticeInlinedPutById() { m_numInlinedPutByIds++; }
     60    void noticeInlinedCall() { m_numInlinedCalls++; }
     61   
    5862    Bytecodes* bytecodes() const { return m_bytecodes; }
    5963    CompilationKind kind() const { return m_kind; }
     
    7478    Vector<OSRExitSite> m_osrExitSites;
    7579    SegmentedVector<OSRExit> m_osrExits;
     80    unsigned m_numInlinedGetByIds;
     81    unsigned m_numInlinedPutByIds;
     82    unsigned m_numInlinedCalls;
    7683};
    7784
  • trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h

    r146071 r146548  
    7474    macro(name) \
    7575    macro(now) \
     76    macro(numInlinedGetByIds) \
     77    macro(numInlinedPutByIds) \
     78    macro(numInlinedCalls) \
    7679    macro(Object) \
    7780    macro(opcode) \
  • trunk/Tools/ChangeLog

    r146546 r146548  
     12013-03-21  Filip Pizlo  <fpizlo@apple.com>
     2
     3        JSC profiler should have an at-a-glance report of the success of DFG optimization
     4        https://bugs.webkit.org/show_bug.cgi?id=112988
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        * Scripts/display-profiler-output:
     9
    1102013-03-21  Dirk Pranke  <dpranke@chromium.org>
    211
  • trunk/Tools/Scripts/display-profiler-output

    r139021 r146548  
    11#!/usr/bin/env ruby
    22
    3 # Copyright (C) 2012 Apple Inc. All rights reserved.
     3# Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
    44#
    55# Redistribution and use in source and binary forms, with or without
     
    326326
    327327class Compilation
    328     attr_accessor :bytecode, :engine, :descriptions, :counters, :compilationIndex, :osrExits, :profiledBytecodes
     328    attr_accessor :bytecode, :engine, :descriptions, :counters, :compilationIndex
     329    attr_accessor :osrExits, :profiledBytecodes, :numInlinedGetByIds, :numInlinedPutByIds
     330    attr_accessor :numInlinedCalls
    329331   
    330332    def initialize(json)
     
    376378            @profiledBytecodes << ProfiledBytecodes.new(subJson)
    377379        }
     380        @numInlinedGetByIds = json["numInlinedGetByIds"]
     381        @numInlinedPutByIds = json["numInlinedPutByIds"]
     382        @numInlinedCalls = json["numInlinedCalls"]
    378383    end
    379384   
     
    508513        exitCountCols = 7
    509514        remaining -= exitCountCols + 1
     515       
     516        recentOptsCols = 12
     517        remaining -= recentOptsCols + 1
    510518    end
    511519   
     
    526534        print(" " + center("Inlines", inlinesCols))
    527535        print(" " + center("#Exits", exitCountCols))
     536        print(" " + center("Last Opts", recentOptsCols))
    528537    end
    529538    if sourceCols
     
    541550        print(" " + (" " * compilationsCols))
    542551        print(" " + center("Src/Total", inlinesCols))
     552        print(" " + (" " * exitCountCols))
     553        print(" " + center("Get/Put/Call", recentOptsCols))
    543554    end
    544555    puts
     
    565576            print(" " + center(bytecode.sourceMachineInlineSites.to_s + "/" + bytecode.totalMachineInlineSites.to_s, inlinesCols))
    566577            print(" " + center(bytecode.totalExitCount.to_s, exitCountCols))
     578            lastCompilation = bytecode.compilations[-1]
     579            if lastCompilation
     580                optData = [lastCompilation.numInlinedGetByIds,
     581                           lastCompilation.numInlinedPutByIds,
     582                           lastCompilation.numInlinedCalls]
     583            else
     584                optData = ["N/A"]
     585            end
     586            print(" " + center(optData.join('/'), recentOptsCols))
    567587        end
    568588        if sourceCols
     
    827847           
    828848            puts("Compilation #{compilation}:")
     849            puts("    Num inlined: GetByIds: #{compilation.numInlinedGetByIds}  PutByIds: #{compilation.numInlinedPutByIds}  Calls: #{compilation.numInlinedCalls}")
    829850            puts(center("Actual Counts", actualCountCols) + " " + center("Source Counts", sourceCountCols) + " " + center("Disassembly in #{compilation.engine}", screenWidth - 1 - sourceCountCols - 1 - actualCountCols))
    830851            puts((" " * actualCountCols) + " " + center("Base/DFG", sourceCountCols))
Note: See TracChangeset for help on using the changeset viewer.