Skip to content
  • oliver@apple.com's avatar
    Exception stack unwinding doesn't handle inline callframes correctly · 49a2c14b
    oliver@apple.com authored
    https://bugs.webkit.org/show_bug.cgi?id=113952
    
    Reviewed by Geoffrey Garen.
    
    Source/JavaScriptCore:
    
    The basic problem here is that the exception stack unwinding was
    attempting to be "clever" and avoid doing a correct stack walk
    as it "knew" inline callframes couldn't have exception handlers.
    
    This used to be safe as the exception handling machinery was
    designed to fail gently and just claim that no handler existed.
    This was "safe" and even "correct" inasmuch as we currently
    don't run any code with exception handlers through the dfg.
    
    This patch fixes the logic by simply making everything uniformly
    use the safe stack walking machinery, and making the correct
    boundary checks occur everywhere that they should.
    
    * bytecode/CodeBlock.cpp:
    (JSC::CodeBlock::findClosureCallForReturnPC):
    (JSC::CodeBlock::bytecodeOffset):
    * interpreter/Interpreter.cpp:
    (JSC):
    (JSC::Interpreter::dumpRegisters):
    (JSC::Interpreter::unwindCallFrame):
    (JSC::getCallerInfo):
    (JSC::Interpreter::getStackTrace):
    (JSC::Interpreter::retrieveCallerFromVMCode):
    
    LayoutTests:
    
    Yay tests!
    
    * fast/js/js-correct-exception-handler-expected.txt: Added.
    * fast/js/js-correct-exception-handler.html: Added.
    * fast/js/script-tests/js-correct-exception-handler.js: Added.
    (throwEventually):
    (f.g):
    (f):
    (test):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@147670 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    49a2c14b