Ignore:
Timestamp:
Jan 23, 2015, 11:52:25 AM (10 years ago)
Author:
[email protected]
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):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.