Changeset 179015 in webkit


Ignore:
Timestamp:
Jan 23, 2015 11:52:25 AM (9 years ago)
Author:
msaboff@apple.com
Message:

Immediate crash when setting JS breakpoint
https://bugs.webkit.org/show_bug.cgi?id=140811

Reviewed by Mark Lam.

When the DFG stack layout phase doesn't allocate a register for the scope register,
it incorrectly sets the scope register in the code block to a bad value, one with
an offset of 0. Changed it so that we set the code block's scope register to the
invalid VirtualRegister instead.

No tests needed as adding the ASSERT in setScopeRegister() was used to find the bug.
We crash with that ASSERT in testapi and likely many other tests as well.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::CodeBlock):

  • bytecode/CodeBlock.h:

(JSC::CodeBlock::setScopeRegister):
(JSC::CodeBlock::scopeRegister):
Added ASSERTs to catch any future improper setting of the code block's scope register.

  • dfg/DFGStackLayoutPhase.cpp:

(JSC::DFG::StackLayoutPhase::run):

Location:
trunk/Source/JavaScriptCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r178984 r179015  
     12015-01-23  Michael Saboff  <msaboff@apple.com>
     2
     3        Immediate crash when setting JS breakpoint
     4        https://bugs.webkit.org/show_bug.cgi?id=140811
     5
     6        Reviewed by Mark Lam.
     7
     8        When the DFG stack layout phase doesn't allocate a register for the scope register,
     9        it incorrectly sets the scope register in the code block to a bad value, one with
     10        an offset of 0.  Changed it so that we set the code block's scope register to the
     11        invalid VirtualRegister instead.
     12
     13        No tests needed as adding the ASSERT in setScopeRegister() was used to find the bug.
     14        We crash with that ASSERT in testapi and likely many other tests as well.
     15
     16        * bytecode/CodeBlock.cpp:
     17        (JSC::CodeBlock::CodeBlock):
     18        * bytecode/CodeBlock.h:
     19        (JSC::CodeBlock::setScopeRegister):
     20        (JSC::CodeBlock::scopeRegister):
     21        Added ASSERTs to catch any future improper setting of the code block's scope register.
     22
     23        * dfg/DFGStackLayoutPhase.cpp:
     24        (JSC::DFG::StackLayoutPhase::run):
     25
    1262015-01-22  Mark Hahnenberg  <mhahnenb@gmail.com>
    227
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r178926 r179015  
    16641664{
    16651665    ASSERT(m_heap->isDeferred());
    1666    
     1666    ASSERT(m_scopeRegister.isLocal());
     1667
    16671668    if (SymbolTable* symbolTable = other.symbolTable())
    16681669        m_symbolTable.set(*m_vm, m_ownerExecutable.get(), symbolTable);
     
    17201721{
    17211722    ASSERT(m_heap->isDeferred());
     1723    ASSERT(m_scopeRegister.isLocal());
    17221724
    17231725    bool didCloneSymbolTable = false;
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.h

    r178693 r179015  
    325325    void setScopeRegister(VirtualRegister scopeRegister)
    326326    {
     327        ASSERT(scopeRegister.isLocal() || !scopeRegister.isValid());
    327328        m_scopeRegister = scopeRegister;
    328329    }
     
    330331    VirtualRegister scopeRegister() const
    331332    {
    332         ASSERT(m_scopeRegister.isValid());
    333333        return m_scopeRegister;
    334334    }
  • trunk/Source/JavaScriptCore/dfg/DFGStackLayoutPhase.cpp

    r176479 r179015  
    170170       
    171171        if (codeBlock()->scopeRegister().isValid()) {
    172             codeBlock()->setScopeRegister(
    173                 virtualRegisterForLocal(allocation[codeBlock()->scopeRegister().toLocal()]));
     172            unsigned scopeRegisterAllocation = allocation[codeBlock()->scopeRegister().toLocal()];
     173            codeBlock()->setScopeRegister(scopeRegisterAllocation == UINT_MAX ? VirtualRegister() : virtualRegisterForLocal(scopeRegisterAllocation));
    174174        }
    175175
Note: See TracChangeset for help on using the changeset viewer.