Changeset 169005 in webkit


Ignore:
Timestamp:
May 17, 2014, 8:44:23 PM (11 years ago)
Author:
[email protected]
Message:

[ftlopt] InlineCallFrame::isCall should be an enumeration
https://bugs.webkit.org/show_bug.cgi?id=133034

Reviewed by Sam Weinig.

Once we start inlining getters and setters, we'll want InlineCallFrame to be able to tell
us that the inlined call was a getter call or a setter call. Initially I thought I would
have a new field called "kind" that would have components NormalCall, GetterCall, and
SetterCall. But that doesn't make sense, because for GetterCall and SetterCall, isCall
would have to be true. Hence, It makes more sense to have one enumeration that is Call,
Construct, GetterCall, or SetterCall. This patch is a first step towards this.

It's interesting that isClosureCall should probably still be separate, since getter and
setter inlining could inline closure calls.

  • bytecode/CodeBlock.h:

(JSC::baselineCodeBlockForInlineCallFrame):

  • bytecode/CodeOrigin.cpp:

(JSC::InlineCallFrame::dumpInContext):
(WTF::printInternal):

  • bytecode/CodeOrigin.h:

(JSC::InlineCallFrame::kindFor):
(JSC::InlineCallFrame::specializationKindFor):
(JSC::InlineCallFrame::InlineCallFrame):
(JSC::InlineCallFrame::specializationKind):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):

  • dfg/DFGOSRExitPreparation.cpp:

(JSC::DFG::prepareCodeOriginForOSRExit):

  • runtime/Arguments.h:

(JSC::Arguments::finishCreation):

Location:
branches/ftlopt/Source/JavaScriptCore
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/ftlopt/Source/JavaScriptCore/ChangeLog

    r168780 r169005  
     12014-05-17  Filip Pizlo  <[email protected]>
     2
     3        [ftlopt] InlineCallFrame::isCall should be an enumeration
     4        https://bugs.webkit.org/show_bug.cgi?id=133034
     5
     6        Reviewed by Sam Weinig.
     7       
     8        Once we start inlining getters and setters, we'll want InlineCallFrame to be able to tell
     9        us that the inlined call was a getter call or a setter call. Initially I thought I would
     10        have a new field called "kind" that would have components NormalCall, GetterCall, and
     11        SetterCall. But that doesn't make sense, because for GetterCall and SetterCall, isCall
     12        would have to be true. Hence, It makes more sense to have one enumeration that is Call,
     13        Construct, GetterCall, or SetterCall. This patch is a first step towards this.
     14       
     15        It's interesting that isClosureCall should probably still be separate, since getter and
     16        setter inlining could inline closure calls.
     17
     18        * bytecode/CodeBlock.h:
     19        (JSC::baselineCodeBlockForInlineCallFrame):
     20        * bytecode/CodeOrigin.cpp:
     21        (JSC::InlineCallFrame::dumpInContext):
     22        (WTF::printInternal):
     23        * bytecode/CodeOrigin.h:
     24        (JSC::InlineCallFrame::kindFor):
     25        (JSC::InlineCallFrame::specializationKindFor):
     26        (JSC::InlineCallFrame::InlineCallFrame):
     27        (JSC::InlineCallFrame::specializationKind):
     28        * dfg/DFGByteCodeParser.cpp:
     29        (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
     30        * dfg/DFGOSRExitPreparation.cpp:
     31        (JSC::DFG::prepareCodeOriginForOSRExit):
     32        * runtime/Arguments.h:
     33        (JSC::Arguments::finishCreation):
     34
    1352014-05-13  Filip Pizlo  <[email protected]>
    236
  • branches/ftlopt/Source/JavaScriptCore/bytecode/CodeBlock.h

    r168178 r169005  
    11961196    ExecutableBase* executable = inlineCallFrame->executable.get();
    11971197    RELEASE_ASSERT(executable->structure()->classInfo() == FunctionExecutable::info());
    1198     return static_cast<FunctionExecutable*>(executable)->baselineCodeBlockFor(inlineCallFrame->isCall ? CodeForCall : CodeForConstruct);
     1198    return static_cast<FunctionExecutable*>(executable)->baselineCodeBlockFor(inlineCallFrame->specializationKind());
    11991199}
    12001200
  • branches/ftlopt/Source/JavaScriptCore/bytecode/CodeOrigin.cpp

    r165522 r169005  
    11/*
    2  * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2012, 2013, 2014 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    179179    if (executable->isStrictMode())
    180180        out.print(" (StrictMode)");
    181     out.print(", bc#", caller.bytecodeIndex, ", ", specializationKind());
     181    out.print(", bc#", caller.bytecodeIndex, ", ", kind);
    182182    if (isClosureCall)
    183183        out.print(", closure call");
     
    196196} // namespace JSC
    197197
     198namespace WTF {
     199
     200void printInternal(PrintStream& out, JSC::InlineCallFrame::Kind kind)
     201{
     202    switch (kind) {
     203    case JSC::InlineCallFrame::Call:
     204        out.print("Call");
     205        return;
     206    case JSC::InlineCallFrame::Construct:
     207        out.print("Construct");
     208        return;
     209    }
     210    RELEASE_ASSERT_NOT_REACHED();
     211}
     212
     213} // namespace WTF
     214
  • branches/ftlopt/Source/JavaScriptCore/bytecode/CodeOrigin.h

    r167182 r169005  
    11/*
    2  * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2011, 2012, 2013, 2014 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    119119
    120120struct InlineCallFrame {
     121    enum Kind {
     122        Call,
     123        Construct,
     124    };
     125   
     126    static Kind kindFor(CodeSpecializationKind kind)
     127    {
     128        switch (kind) {
     129        case CodeForCall:
     130            return Call;
     131        case CodeForConstruct:
     132            return Construct;
     133        }
     134        RELEASE_ASSERT_NOT_REACHED();
     135        return Call;
     136    }
     137   
     138    static CodeSpecializationKind specializationKindFor(Kind kind)
     139    {
     140        switch (kind) {
     141        case Call:
     142            return CodeForCall;
     143        case Construct:
     144            return CodeForConstruct;
     145        }
     146        RELEASE_ASSERT_NOT_REACHED();
     147        return CodeForCall;
     148    }
     149   
    121150    Vector<ValueRecovery> arguments; // Includes 'this'.
    122151    WriteBarrier<ScriptExecutable> executable;
     
    125154    BitVector capturedVars; // Indexed by the machine call frame's variable numbering.
    126155    signed stackOffset : 30;
    127     bool isCall : 1;
     156    Kind kind : 1;
    128157    bool isClosureCall : 1; // If false then we know that callee/scope are constants and the DFG won't treat them as variables, i.e. they have to be recovered manually.
    129158    VirtualRegister argumentsRegister; // This is only set if the code uses arguments. The unmodified arguments register follows the unmodifiedArgumentsRegister() convention (see CodeBlock.h).
     
    134163    InlineCallFrame()
    135164        : stackOffset(0)
    136         , isCall(false)
     165        , kind(Call)
    137166        , isClosureCall(false)
    138167    {
    139168    }
    140169   
    141     CodeSpecializationKind specializationKind() const { return specializationFromIsCall(isCall); }
     170    CodeSpecializationKind specializationKind() const { return specializationKindFor(kind); }
    142171
    143172    JSFunction* calleeConstant() const
     
    210239namespace WTF {
    211240
     241void printInternal(PrintStream&, JSC::InlineCallFrame::Kind);
     242
    212243template<typename T> struct DefaultHash;
    213244template<> struct DefaultHash<JSC::CodeOrigin> {
  • branches/ftlopt/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp

    r168780 r169005  
    34363436        m_inlineCallFrame->caller = byteCodeParser->currentCodeOrigin();
    34373437        m_inlineCallFrame->arguments.resize(argumentCountIncludingThis); // Set the number of arguments including this, but don't configure the value recoveries, yet.
    3438         m_inlineCallFrame->isCall = isCall(kind);
     3438        m_inlineCallFrame->kind = InlineCallFrame::kindFor(kind);
    34393439       
    34403440        if (m_inlineCallFrame->caller.inlineCallFrame)
  • branches/ftlopt/Source/JavaScriptCore/dfg/DFGOSRExitPreparation.cpp

    r164229 r169005  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4646            static_cast<FunctionExecutable*>(codeOrigin.inlineCallFrame->executable.get());
    4747        CodeBlock* codeBlock = executable->baselineCodeBlockFor(
    48             codeOrigin.inlineCallFrame->isCall ? CodeForCall : CodeForConstruct);
     48            codeOrigin.inlineCallFrame->specializationKind());
    4949       
    5050        if (codeBlock->jitType() == JSC::JITCode::BaselineJIT)
  • branches/ftlopt/Source/JavaScriptCore/runtime/Arguments.h

    r167641 r169005  
    11/*
    22 *  Copyright (C) 1999-2000 Harri Porten ([email protected])
    3  *  Copyright (C) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
     3 *  Copyright (C) 2003, 2006, 2007, 2008, 2009, 2014 Apple Inc. All rights reserved.
    44 *  Copyright (C) 2007 Cameron Zwarich ([email protected])
    55 *  Copyright (C) 2007 Maks Orlovich
     
    322322    m_overrodeCaller = false;
    323323    m_isStrictMode = jsCast<FunctionExecutable*>(inlineCallFrame->executable.get())->isStrictMode();
    324     ASSERT(!jsCast<FunctionExecutable*>(inlineCallFrame->executable.get())->symbolTable(inlineCallFrame->isCall ? CodeForCall : CodeForConstruct)->slowArguments());
     324    ASSERT(!jsCast<FunctionExecutable*>(inlineCallFrame->executable.get())->symbolTable(inlineCallFrame->specializationKind())->slowArguments());
    325325
    326326    // The bytecode generator omits op_tear_off_activation in cases of no
Note: See TracChangeset for help on using the changeset viewer.