Changeset 47620 in webkit for trunk/JavaScriptCore/runtime


Ignore:
Timestamp:
Aug 20, 2009, 9:21:01 PM (16 years ago)
Author:
[email protected]
Message:

REGRESSION: fast/profiler/call.html is crashing occasionally
https://bugs.webkit.org/show_bug.cgi?id=28476

Reviewed by Gavin Barraclough.

Using the codeblock for information about how many parameters and
locals a function has is unsafe in certain circumstances. The
basic scenario is all function code being cleared in response to
the debugger or profiler being enabled, and then an activation is
marked before its associated function is re-executed.

To deal with this scenario we store the variable count of a function
directly in the FunctionExecutable, and then use that information.

Location:
trunk/JavaScriptCore/runtime
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/Arguments.h

    r47412 r47620  
    116116    {
    117117        function = callFrame->callee();
    118    
    119         CodeBlock* codeBlock = &function->executable()->generatedBytecode();
    120         int numParameters = codeBlock->m_numParameters;
     118
     119        int numParameters = function->executable()->parameterCount();
    121120        argc = callFrame->argumentCount();
    122121
    123122        if (argc <= numParameters)
    124             argv = callFrame->registers() - RegisterFile::CallFrameHeaderSize - numParameters + 1; // + 1 to skip "this"
     123            argv = callFrame->registers() - RegisterFile::CallFrameHeaderSize - numParameters;
    125124        else
    126             argv = callFrame->registers() - RegisterFile::CallFrameHeaderSize - numParameters - argc + 1; // + 1 to skip "this"
     125            argv = callFrame->registers() - RegisterFile::CallFrameHeaderSize - numParameters - argc;
    127126
    128127        argc -= 1; // - 1 to skip "this"
    129         firstParameterIndex = -RegisterFile::CallFrameHeaderSize - numParameters + 1; // + 1 to skip "this"
     128        firstParameterIndex = -RegisterFile::CallFrameHeaderSize - numParameters;
    130129    }
    131130
  • trunk/JavaScriptCore/runtime/Executable.cpp

    r47597 r47620  
    8888    m_numParameters = m_codeBlock->m_numParameters;
    8989    ASSERT(m_numParameters);
     90    m_numVariables = m_codeBlock->m_numVars;
    9091
    9192    body()->destroyData();
  • trunk/JavaScriptCore/runtime/Executable.h

    r47597 r47620  
    202202            , m_codeBlock(0)
    203203            , m_name(name)
     204            , m_numVariables(0)
    204205        {
    205206            m_node = body;
     
    228229        bool usesArguments() const { return body()->usesArguments(); }
    229230        size_t parameterCount() const { return body()->parameterCount(); }
     231        size_t variableCount() const { return m_numVariables; }
    230232        UString paramString() const { return body()->paramString(); }
    231233
     
    249251        CodeBlock* m_codeBlock;
    250252        const Identifier& m_name;
     253        size_t m_numVariables;
    251254
    252255#if ENABLE(JIT)
  • trunk/JavaScriptCore/runtime/JSActivation.cpp

    r47412 r47620  
    5858        return;
    5959
    60     size_t numParametersMinusThis = d()->functionExecutable->generatedBytecode().m_numParameters - 1;
     60    size_t numParametersMinusThis = d()->functionExecutable->parameterCount();
    6161
    6262    size_t count = numParametersMinusThis;
    6363    markStack.appendValues(registerArray, count);
    6464
    65     size_t numVars = d()->functionExecutable->generatedBytecode().m_numVars;
     65    size_t numVars = d()->functionExecutable->variableCount();
    6666
    6767    // Skip the call frame, which sits between the parameters and vars.
Note: See TracChangeset for help on using the changeset viewer.