Changeset 156374 in webkit


Ignore:
Timestamp:
Sep 24, 2013 4:52:57 PM (11 years ago)
Author:
mark.lam@apple.com
Message:

Change JSC debug hooks to pass a CallFrame* instead of a DebuggerCallFrame.
https://bugs.webkit.org/show_bug.cgi?id=121867.

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

  1. Removed the need for passing the line and column info to the debug hook callbacks. We now get the line and column info from the CallFrame.
  1. Simplify BytecodeGenerator::emitDebugHook() to only take 1 line number argument. The caller can determine whether to pass in the first or last line number of the block of source code as appropriate. Note: we still need to pass in the line and column info to emitDebugHook() because it uses this info to emit expression info which is later used by the StackVisitor to determine the line and column info for its "pc".
  1. Pass the exceptionValue explicitly to the exception() debug hook callback. It should not be embedded in the CallFrame / DebuggerCallFrame.
  1. Change the op_debug opcode size to 2 (from 5) since we've removing 3 arg values. Update the LLINT and JIT code to handle this.
  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::dumpBytecode):
(JSC::CodeBlock::CodeBlock):

  • bytecode/Opcode.h:

(JSC::padOpcodeName):

  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::emitDebugHook):

  • bytecompiler/BytecodeGenerator.h:
  • bytecompiler/NodesCodegen.cpp:

(JSC::ConstStatementNode::emitBytecode):
(JSC::EmptyStatementNode::emitBytecode):
(JSC::DebuggerStatementNode::emitBytecode):
(JSC::ExprStatementNode::emitBytecode):
(JSC::VarStatementNode::emitBytecode):
(JSC::IfElseNode::emitBytecode):
(JSC::DoWhileNode::emitBytecode):
(JSC::WhileNode::emitBytecode):
(JSC::ForNode::emitBytecode):
(JSC::ForInNode::emitBytecode):
(JSC::ContinueNode::emitBytecode):
(JSC::BreakNode::emitBytecode):
(JSC::ReturnNode::emitBytecode):
(JSC::WithNode::emitBytecode):
(JSC::SwitchNode::emitBytecode):
(JSC::LabelNode::emitBytecode):
(JSC::ThrowNode::emitBytecode):
(JSC::TryNode::emitBytecode):
(JSC::ProgramNode::emitBytecode):
(JSC::EvalNode::emitBytecode):
(JSC::FunctionBodyNode::emitBytecode):

  • debugger/Debugger.h:
  • debugger/DebuggerCallFrame.cpp:

(JSC::LineAndColumnFunctor::operator()):
(JSC::LineAndColumnFunctor::line):
(JSC::LineAndColumnFunctor::column):
(JSC::DebuggerCallFrame::DebuggerCallFrame):
(JSC::DebuggerCallFrame::clear):

  • debugger/DebuggerCallFrame.h:

(JSC::DebuggerCallFrame::line):
(JSC::DebuggerCallFrame::column):

  • interpreter/Interpreter.cpp:

(JSC::unwindCallFrame):
(JSC::UnwindFunctor::UnwindFunctor):
(JSC::UnwindFunctor::operator()):
(JSC::Interpreter::unwind):
(JSC::Interpreter::debug):

  • interpreter/Interpreter.h:
  • jit/JITOpcodes.cpp:

(JSC::JIT::emit_op_debug):

  • jit/JITOpcodes32_64.cpp:

(JSC::JIT::emit_op_debug):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::LLINT_SLOW_PATH_DECL):

  • llint/LowLevelInterpreter.asm:

Source/WebCore:

No new tests.

  • bindings/js/ScriptDebugServer.cpp:

(WebCore::ScriptDebugServer::createCallFrame):
(WebCore::ScriptDebugServer::updateCallFrameAndPauseIfNeeded):
(WebCore::ScriptDebugServer::callEvent):
(WebCore::ScriptDebugServer::atStatement):
(WebCore::ScriptDebugServer::returnEvent):
(WebCore::ScriptDebugServer::exception):
(WebCore::ScriptDebugServer::willExecuteProgram):
(WebCore::ScriptDebugServer::didExecuteProgram):
(WebCore::ScriptDebugServer::didReachBreakpoint):

  • bindings/js/ScriptDebugServer.h:
  • bindings/js/WorkerScriptDebugServer.cpp:

(WebCore::WorkerScriptDebugServer::willExecuteProgram):

  • bindings/js/WorkerScriptDebugServer.h:

Source/WebKit/mac:

  • WebView/WebScriptDebugDelegate.mm:

(-[WebScriptCallFrame _initWithGlobalObject:debuggerCallFrame:exceptionValue:JSC::]):
(-[WebScriptCallFrame exception]):

  • WebView/WebScriptDebugger.h:
  • WebView/WebScriptDebugger.mm:

(WebScriptDebugger::exception):

Location:
trunk/Source
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r156371 r156374  
     12013-09-24  Mark Lam  <mark.lam@apple.com>
     2
     3        Change JSC debug hooks to pass a CallFrame* instead of a DebuggerCallFrame.
     4        https://bugs.webkit.org/show_bug.cgi?id=121867.
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        1. Removed the need for passing the line and column info to the debug hook
     9           callbacks. We now get the line and column info from the CallFrame.
     10
     11        2. Simplify BytecodeGenerator::emitDebugHook() to only take 1 line number
     12           argument. The caller can determine whether to pass in the first or last
     13           line number of the block of source code as appropriate.
     14           Note: we still need to pass in the line and column info to emitDebugHook()
     15           because it uses this info to emit expression info which is later used by
     16           the StackVisitor to determine the line and column info for its "pc".
     17
     18        3. Pass the exceptionValue explicitly to the exception() debug hook
     19           callback. It should not be embedded in the CallFrame / DebuggerCallFrame.
     20
     21        4. Change the op_debug opcode size to 2 (from 5) since we've removing 3 arg
     22           values. Update the LLINT and JIT code to handle this.
     23
     24        * bytecode/CodeBlock.cpp:
     25        (JSC::CodeBlock::dumpBytecode):
     26        (JSC::CodeBlock::CodeBlock):
     27        * bytecode/Opcode.h:
     28        (JSC::padOpcodeName):
     29        * bytecompiler/BytecodeGenerator.cpp:
     30        (JSC::BytecodeGenerator::emitDebugHook):
     31        * bytecompiler/BytecodeGenerator.h:
     32        * bytecompiler/NodesCodegen.cpp:
     33        (JSC::ConstStatementNode::emitBytecode):
     34        (JSC::EmptyStatementNode::emitBytecode):
     35        (JSC::DebuggerStatementNode::emitBytecode):
     36        (JSC::ExprStatementNode::emitBytecode):
     37        (JSC::VarStatementNode::emitBytecode):
     38        (JSC::IfElseNode::emitBytecode):
     39        (JSC::DoWhileNode::emitBytecode):
     40        (JSC::WhileNode::emitBytecode):
     41        (JSC::ForNode::emitBytecode):
     42        (JSC::ForInNode::emitBytecode):
     43        (JSC::ContinueNode::emitBytecode):
     44        (JSC::BreakNode::emitBytecode):
     45        (JSC::ReturnNode::emitBytecode):
     46        (JSC::WithNode::emitBytecode):
     47        (JSC::SwitchNode::emitBytecode):
     48        (JSC::LabelNode::emitBytecode):
     49        (JSC::ThrowNode::emitBytecode):
     50        (JSC::TryNode::emitBytecode):
     51        (JSC::ProgramNode::emitBytecode):
     52        (JSC::EvalNode::emitBytecode):
     53        (JSC::FunctionBodyNode::emitBytecode):
     54        * debugger/Debugger.h:
     55        * debugger/DebuggerCallFrame.cpp:
     56        (JSC::LineAndColumnFunctor::operator()):
     57        (JSC::LineAndColumnFunctor::line):
     58        (JSC::LineAndColumnFunctor::column):
     59        (JSC::DebuggerCallFrame::DebuggerCallFrame):
     60        (JSC::DebuggerCallFrame::clear):
     61        * debugger/DebuggerCallFrame.h:
     62        (JSC::DebuggerCallFrame::line):
     63        (JSC::DebuggerCallFrame::column):
     64        * interpreter/Interpreter.cpp:
     65        (JSC::unwindCallFrame):
     66        (JSC::UnwindFunctor::UnwindFunctor):
     67        (JSC::UnwindFunctor::operator()):
     68        (JSC::Interpreter::unwind):
     69        (JSC::Interpreter::debug):
     70        * interpreter/Interpreter.h:
     71        * jit/JITOpcodes.cpp:
     72        (JSC::JIT::emit_op_debug):
     73        * jit/JITOpcodes32_64.cpp:
     74        (JSC::JIT::emit_op_debug):
     75        * jit/JITStubs.cpp:
     76        (JSC::DEFINE_STUB_FUNCTION):
     77        * llint/LLIntSlowPaths.cpp:
     78        (JSC::LLInt::LLINT_SLOW_PATH_DECL):
     79        * llint/LowLevelInterpreter.asm:
     80
    1812013-09-24  Filip Pizlo  <fpizlo@apple.com>
    282
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r156300 r156374  
    13261326        case op_debug: {
    13271327            int debugHookID = (++it)->u.operand;
    1328             int firstLine = (++it)->u.operand;
    1329             int lastLine = (++it)->u.operand;
    1330             int column = (++it)->u.operand;
    13311328            printLocationAndOp(out, exec, location, it, "debug");
    1332             out.printf("%s, %d, %d, %d", debugHookName(debugHookID), firstLine, lastLine, column);
     1329            out.printf("%s", debugHookName(debugHookID));
    13331330            break;
    13341331        }
     
    18721869                instructions[i + 5].u.structure.set(*vm(), ownerExecutable, op.structure);
    18731870            instructions[i + 6].u.pointer = reinterpret_cast<void*>(op.operand);
    1874             break;
    1875         }
    1876 
    1877         case op_debug: {
    1878             instructions[i + 4] = columnNumberForBytecodeOffset(i);
    18791871            break;
    18801872        }
  • trunk/Source/JavaScriptCore/bytecode/Opcode.h

    r153221 r156374  
    181181    macro(op_throw_static_error, 3) \
    182182    \
    183     macro(op_debug, 5) \
     183    macro(op_debug, 2) \
    184184    macro(op_profile_will_call, 2) \
    185185    macro(op_profile_did_call, 2) \
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

    r156079 r156374  
    18591859}
    18601860
    1861 void BytecodeGenerator::emitDebugHook(DebugHookID debugHookID, unsigned firstLine, unsigned lastLine, unsigned charOffset, unsigned lineStart)
     1861void BytecodeGenerator::emitDebugHook(DebugHookID debugHookID, unsigned line, unsigned charOffset, unsigned lineStart)
    18621862{
    18631863#if ENABLE(DEBUG_WITH_BREAKPOINT)
     
    18681868        return;
    18691869#endif
    1870     JSTextPosition divot(firstLine, charOffset, lineStart);
     1870    JSTextPosition divot(line, charOffset, lineStart);
    18711871    emitExpressionInfo(divot, divot, divot);
    1872     unsigned charPosition = charOffset - m_scopeNode->source().startOffset();
    18731872    emitOpcode(op_debug);
    18741873    instructions().append(debugHookID);
    1875     instructions().append(firstLine);
    1876     instructions().append(lastLine);
    1877     instructions().append(charPosition);
    18781874}
    18791875
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h

    r155711 r156374  
    406406        void emitPopScope();
    407407
    408         void emitDebugHook(DebugHookID, unsigned firstLine, unsigned lastLine, unsigned charOffset, unsigned lineStart);
     408        void emitDebugHook(DebugHookID, unsigned line, unsigned charOffset, unsigned lineStart);
    409409
    410410        int scopeDepth() { return m_localScopeDepth + m_finallyDepth; }
  • trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp

    r155724 r156374  
    14451445void ConstStatementNode::emitBytecode(BytecodeGenerator& generator, RegisterID*)
    14461446{
    1447     generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine(), startOffset(), lineStartOffset());
     1447    generator.emitDebugHook(WillExecuteStatement, firstLine(), startOffset(), lineStartOffset());
    14481448    generator.emitNode(m_next);
    14491449}
     
    14881488void EmptyStatementNode::emitBytecode(BytecodeGenerator& generator, RegisterID*)
    14891489{
    1490     generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine(), startOffset(), lineStartOffset());
     1490    generator.emitDebugHook(WillExecuteStatement, firstLine(), startOffset(), lineStartOffset());
    14911491}
    14921492
     
    14951495void DebuggerStatementNode::emitBytecode(BytecodeGenerator& generator, RegisterID*)
    14961496{
    1497     generator.emitDebugHook(DidReachBreakpoint, firstLine(), lastLine(), startOffset(), lineStartOffset());
     1497    generator.emitDebugHook(DidReachBreakpoint, lastLine(), startOffset(), lineStartOffset());
    14981498}
    14991499
     
    15031503{
    15041504    ASSERT(m_expr);
    1505     generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine(), startOffset(), lineStartOffset());
     1505    generator.emitDebugHook(WillExecuteStatement, firstLine(), startOffset(), lineStartOffset());
    15061506    generator.emitNode(dst, m_expr);
    15071507}
     
    15121512{
    15131513    ASSERT(m_expr);
    1514     generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine(), startOffset(), lineStartOffset());
     1514    generator.emitDebugHook(WillExecuteStatement, firstLine(), startOffset(), lineStartOffset());
    15151515    generator.emitNode(m_expr);
    15161516}
     
    15571557void IfElseNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
    15581558{
    1559     generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine(), startOffset(), lineStartOffset());
     1559    generator.emitDebugHook(WillExecuteStatement, firstLine(), startOffset(), lineStartOffset());
    15601560   
    15611561    RefPtr<Label> beforeThen = generator.newLabel();
     
    15941594    generator.emitLabel(topOfLoop.get());
    15951595    generator.emitLoopHint();
    1596     generator.emitDebugHook(WillExecuteStatement, lastLine(), lastLine(), startOffset(), lineStartOffset());
     1596    generator.emitDebugHook(WillExecuteStatement, lastLine(), startOffset(), lineStartOffset());
    15971597
    15981598    generator.emitNode(dst, m_statement);
    15991599
    16001600    generator.emitLabel(scope->continueTarget());
    1601     generator.emitDebugHook(WillExecuteStatement, lastLine(), lastLine(), startOffset(), lineStartOffset());
     1601    generator.emitDebugHook(WillExecuteStatement, lastLine(), startOffset(), lineStartOffset());
    16021602    generator.emitNodeInConditionContext(m_expr, topOfLoop.get(), scope->breakTarget(), FallThroughMeansFalse);
    16031603
     
    16121612    RefPtr<Label> topOfLoop = generator.newLabel();
    16131613
    1614     generator.emitDebugHook(WillExecuteStatement, m_expr->lineNo(), m_expr->lineNo(), m_expr->startOffset(), m_expr->lineStartOffset());
     1614    generator.emitDebugHook(WillExecuteStatement, m_expr->lineNo(), m_expr->startOffset(), m_expr->lineStartOffset());
    16151615    generator.emitNodeInConditionContext(m_expr, topOfLoop.get(), scope->breakTarget(), FallThroughMeansTrue);
    16161616
     
    16211621
    16221622    generator.emitLabel(scope->continueTarget());
    1623     generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine(), startOffset(), lineStartOffset());
     1623    generator.emitDebugHook(WillExecuteStatement, firstLine(), startOffset(), lineStartOffset());
    16241624
    16251625    generator.emitNodeInConditionContext(m_expr, topOfLoop.get(), scope->breakTarget(), FallThroughMeansFalse);
     
    16341634    LabelScopePtr scope = generator.newLabelScope(LabelScope::Loop);
    16351635
    1636     generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine(), startOffset(), lineStartOffset());
     1636    generator.emitDebugHook(WillExecuteStatement, firstLine(), startOffset(), lineStartOffset());
    16371637
    16381638    if (m_expr1)
     
    16491649
    16501650    generator.emitLabel(scope->continueTarget());
    1651     generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine(), startOffset(), lineStartOffset());
     1651    generator.emitDebugHook(WillExecuteStatement, firstLine(), startOffset(), lineStartOffset());
    16521652    if (m_expr3)
    16531653        generator.emitNode(generator.ignoredResult(), m_expr3);
     
    16721672    }
    16731673
    1674     generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine(), startOffset(), lineStartOffset());
     1674    generator.emitDebugHook(WillExecuteStatement, firstLine(), startOffset(), lineStartOffset());
    16751675
    16761676    RefPtr<RegisterID> base = generator.newTemporary();
     
    17331733    generator.emitLabel(scope->continueTarget());
    17341734    generator.emitNextPropertyName(propertyName, base.get(), i.get(), size.get(), iter.get(), loopStart.get());
    1735     generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine(), startOffset(), lineStartOffset());
     1735    generator.emitDebugHook(WillExecuteStatement, firstLine(), startOffset(), lineStartOffset());
    17361736    generator.emitLabel(scope->breakTarget());
    17371737}
     
    17551755void ContinueNode::emitBytecode(BytecodeGenerator& generator, RegisterID*)
    17561756{
    1757     generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine(), startOffset(), lineStartOffset());
     1757    generator.emitDebugHook(WillExecuteStatement, firstLine(), startOffset(), lineStartOffset());
    17581758   
    17591759    LabelScope* scope = generator.continueTarget(m_ident);
     
    17821782void BreakNode::emitBytecode(BytecodeGenerator& generator, RegisterID*)
    17831783{
    1784     generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine(), startOffset(), lineStartOffset());
     1784    generator.emitDebugHook(WillExecuteStatement, firstLine(), startOffset(), lineStartOffset());
    17851785   
    17861786    LabelScope* scope = generator.breakTarget(m_ident);
     
    17951795void ReturnNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
    17961796{
    1797     generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine(), startOffset(), lineStartOffset());
     1797    generator.emitDebugHook(WillExecuteStatement, firstLine(), startOffset(), lineStartOffset());
    17981798    ASSERT(generator.codeType() == FunctionCode);
    17991799
     
    18071807    }
    18081808
    1809     generator.emitDebugHook(WillLeaveCallFrame, firstLine(), lastLine(), startOffset(), lineStartOffset());
     1809    generator.emitDebugHook(WillLeaveCallFrame, lastLine(), startOffset(), lineStartOffset());
    18101810    generator.emitReturn(returnRegister.get());
    18111811}
     
    18151815void WithNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
    18161816{
    1817     generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine(), startOffset(), lineStartOffset());
     1817    generator.emitDebugHook(WillExecuteStatement, firstLine(), startOffset(), lineStartOffset());
    18181818
    18191819    RefPtr<RegisterID> scope = generator.emitNode(m_expr);
     
    19891989void SwitchNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
    19901990{
    1991     generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine(), startOffset(), lineStartOffset());
     1991    generator.emitDebugHook(WillExecuteStatement, firstLine(), startOffset(), lineStartOffset());
    19921992   
    19931993    LabelScopePtr scope = generator.newLabelScope(LabelScope::Switch);
     
    20032003void LabelNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
    20042004{
    2005     generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine(), startOffset(), lineStartOffset());
     2005    generator.emitDebugHook(WillExecuteStatement, firstLine(), startOffset(), lineStartOffset());
    20062006
    20072007    ASSERT(!generator.breakTarget(m_name));
     
    20172017void ThrowNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
    20182018{
    2019     generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine(), startOffset(), lineStartOffset());
     2019    generator.emitDebugHook(WillExecuteStatement, firstLine(), startOffset(), lineStartOffset());
    20202020
    20212021    if (dst == generator.ignoredResult())
     
    20332033    // optimizer knows they may be jumped to from anywhere.
    20342034
    2035     generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine(), startOffset(), lineStartOffset());
     2035    generator.emitDebugHook(WillExecuteStatement, firstLine(), startOffset(), lineStartOffset());
    20362036
    20372037    ASSERT(m_catchBlock || m_finallyBlock);
     
    21012101void ProgramNode::emitBytecode(BytecodeGenerator& generator, RegisterID*)
    21022102{
    2103     generator.emitDebugHook(WillExecuteProgram, startLine(), startLine(), startStartOffset(), startLineStartOffset());
     2103    generator.emitDebugHook(WillExecuteProgram, startLine(), startStartOffset(), startLineStartOffset());
    21042104
    21052105    RefPtr<RegisterID> dstRegister = generator.newTemporary();
     
    21072107    emitStatementsBytecode(generator, dstRegister.get());
    21082108
    2109     generator.emitDebugHook(DidExecuteProgram, lastLine(), lastLine(), startOffset(), lineStartOffset());
     2109    generator.emitDebugHook(DidExecuteProgram, lastLine(), startOffset(), lineStartOffset());
    21102110    generator.emitEnd(dstRegister.get());
    21112111}
     
    21152115void EvalNode::emitBytecode(BytecodeGenerator& generator, RegisterID*)
    21162116{
    2117     generator.emitDebugHook(WillExecuteProgram, startLine(), startLine(), startStartOffset(), startLineStartOffset());
     2117    generator.emitDebugHook(WillExecuteProgram, startLine(), startStartOffset(), startLineStartOffset());
    21182118
    21192119    RefPtr<RegisterID> dstRegister = generator.newTemporary();
     
    21212121    emitStatementsBytecode(generator, dstRegister.get());
    21222122
    2123     generator.emitDebugHook(DidExecuteProgram, lastLine(), lastLine(), startOffset(), lineStartOffset());
     2123    generator.emitDebugHook(DidExecuteProgram, lastLine(), startOffset(), lineStartOffset());
    21242124    generator.emitEnd(dstRegister.get());
    21252125}
     
    21292129void FunctionBodyNode::emitBytecode(BytecodeGenerator& generator, RegisterID*)
    21302130{
    2131     generator.emitDebugHook(DidEnterCallFrame, startLine(), startLine(), startStartOffset(), startLineStartOffset());
     2131    generator.emitDebugHook(DidEnterCallFrame, startLine(), startStartOffset(), startLineStartOffset());
    21322132    emitStatementsBytecode(generator, generator.ignoredResult());
    21332133
     
    21462146        RegisterID* r0 = generator.isConstructor() ? generator.thisRegister() : generator.emitLoad(0, jsUndefined());
    21472147        ASSERT((startOffset() -  1) >= lineStartOffset());
    2148         generator.emitDebugHook(WillLeaveCallFrame, lastLine(), lastLine(), startOffset() - 1, lineStartOffset());
     2148        generator.emitDebugHook(WillLeaveCallFrame, lastLine(), startOffset() - 1, lineStartOffset());
    21492149        generator.emitReturn(r0);
    21502150        return;
  • trunk/Source/JavaScriptCore/debugger/Debugger.h

    r155622 r156374  
    3434class SourceProvider;
    3535
     36typedef ExecState CallFrame;
     37
    3638class JS_EXPORT_PRIVATE Debugger {
    3739public:
     
    4345    virtual void sourceParsed(ExecState*, SourceProvider*, int errorLineNumber, const WTF::String& errorMessage) = 0;
    4446
    45     virtual void exception(const DebuggerCallFrame&, bool) = 0;
    46     virtual void atStatement(const DebuggerCallFrame&) = 0;
    47     virtual void callEvent(const DebuggerCallFrame&) = 0;
    48     virtual void returnEvent(const DebuggerCallFrame&) = 0;
     47    virtual void exception(CallFrame*, JSValue exceptionValue, bool hasHandler) = 0;
     48    virtual void atStatement(CallFrame*) = 0;
     49    virtual void callEvent(CallFrame*) = 0;
     50    virtual void returnEvent(CallFrame*) = 0;
    4951
    50     virtual void willExecuteProgram(const DebuggerCallFrame&) = 0;
    51     virtual void didExecuteProgram(const DebuggerCallFrame&) = 0;
    52     virtual void didReachBreakpoint(const DebuggerCallFrame&) = 0;
     52    virtual void willExecuteProgram(CallFrame*) = 0;
     53    virtual void didExecuteProgram(CallFrame*) = 0;
     54    virtual void didReachBreakpoint(CallFrame*) = 0;
    5355
    5456    void recompileAllJSFunctions(VM*);
  • trunk/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp

    r155622 r156374  
    3535#include "Operations.h"
    3636#include "Parser.h"
     37#include "StackVisitor.h"
    3738
    3839namespace JSC {
     40
     41class LineAndColumnFunctor {
     42public:
     43    StackVisitor::Status operator()(StackVisitor& visitor)
     44    {
     45        visitor->computeLineAndColumn(m_line, m_column);
     46        return StackVisitor::Done;
     47    }
     48
     49    unsigned line() const { return m_line; }
     50    unsigned column() const { return m_column; }
     51
     52private:
     53    unsigned m_line;
     54    unsigned m_column;
     55};
     56
     57DebuggerCallFrame::DebuggerCallFrame(CallFrame* callFrame)
     58    : m_callFrame(callFrame)
     59{
     60    LineAndColumnFunctor functor;
     61    m_callFrame->iterate(functor);
     62    m_line = functor.line();
     63    m_column = functor.column();
     64}
    3965
    4066intptr_t DebuggerCallFrame::sourceId() const
     
    115141{
    116142    m_callFrame = 0;
    117     m_exception = JSValue();
    118143}
    119144
  • trunk/Source/JavaScriptCore/debugger/DebuggerCallFrame.h

    r155622 r156374  
    3838    enum Type { ProgramType, FunctionType };
    3939
    40     DebuggerCallFrame(CallFrame* callFrame, int line, int column)
    41         : m_callFrame(callFrame)
    42         , m_line(line)
    43         , m_column(column)
    44     {
    45     }
    46 
    47     DebuggerCallFrame(CallFrame* callFrame, int line, int column, JSValue exception)
    48         : m_callFrame(callFrame)
    49         , m_line(line)
    50         , m_column(column)
    51         , m_exception(exception)
    52     {
    53     }
     40    JS_EXPORT_PRIVATE explicit DebuggerCallFrame(CallFrame*);
    5441
    5542    CallFrame* callFrame() const { return m_callFrame; }
    5643    JS_EXPORT_PRIVATE intptr_t sourceId() const;
    57     int line() const { return m_line; }
    58     int column() const { return m_column; }
     44    unsigned line() const { return m_line; }
     45    unsigned column() const { return m_column; }
    5946    JSGlobalObject* dynamicGlobalObject() const { return m_callFrame->dynamicGlobalObject(); }
    6047    JSScope* scope() const { return m_callFrame->scope(); }
     
    6451    JS_EXPORT_PRIVATE JSObject* thisObject() const;
    6552    JS_EXPORT_PRIVATE JSValue evaluate(const String&, JSValue& exception) const;
    66     JSValue exception() const { return m_exception; }
    6753
    6854    void clear();
     
    7056private:
    7157    CallFrame* m_callFrame;
    72     int m_line;
    73     int m_column;
    74     JSValue m_exception;
     58    unsigned m_line;
     59    unsigned m_column;
    7560};
    7661
  • trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp

    r156242 r156374  
    390390}
    391391
    392 static bool unwindCallFrame(StackVisitor& visitor, JSValue exceptionValue)
     392static bool unwindCallFrame(StackVisitor& visitor)
    393393{
    394394    CallFrame* callFrame = visitor->callFrame();
     
    398398
    399399    if (Debugger* debugger = callFrame->dynamicGlobalObject()->debugger()) {
    400         int line = codeBlock->ownerExecutable()->lastLine();
    401         DebuggerCallFrame debuggerCallFrame(callFrame, line, 0, exceptionValue);
    402400        if (callFrame->callee())
    403             debugger->returnEvent(debuggerCallFrame);
     401            debugger->returnEvent(callFrame);
    404402        else
    405             debugger->didExecuteProgram(debuggerCallFrame);
     403            debugger->didExecuteProgram(callFrame);
    406404    }
    407405
     
    604602class UnwindFunctor {
    605603public:
    606     UnwindFunctor(CallFrame*& callFrame, JSValue& exceptionValue, bool isTermination, CodeBlock*& codeBlock, HandlerInfo*& handler)
     604    UnwindFunctor(CallFrame*& callFrame, bool isTermination, CodeBlock*& codeBlock, HandlerInfo*& handler)
    607605        : m_callFrame(callFrame)
    608         , m_exceptionValue(exceptionValue)
    609606        , m_isTermination(isTermination)
    610607        , m_codeBlock(codeBlock)
     
    621618
    622619        if (m_isTermination || !(m_handler = m_codeBlock->handlerForBytecodeOffset(bytecodeOffset))) {
    623             if (!unwindCallFrame(visitor, m_exceptionValue)) {
     620            if (!unwindCallFrame(visitor)) {
    624621                if (LegacyProfiler* profiler = vm.enabledProfiler())
    625622                    profiler->exceptionUnwind(m_callFrame);
     
    634631private:
    635632    CallFrame*& m_callFrame;
    636     JSValue& m_exceptionValue;
    637633    bool m_isTermination;
    638634    CodeBlock*& m_codeBlock;
     
    667663        // frames.
    668664        // https://bugs.webkit.org/show_bug.cgi?id=121754
    669         unsigned bytecodeOffset = callFrame->bytecodeOffset();
    670         int line = codeBlock->lineNumberForBytecodeOffset(bytecodeOffset);
    671         int column = codeBlock->columnNumberForBytecodeOffset(bytecodeOffset);
    672         DebuggerCallFrame debuggerCallFrame(callFrame, line, column, exceptionValue);
    673665
    674666        bool hasHandler;
     
    681673        }
    682674
    683         debugger->exception(debuggerCallFrame, hasHandler);
     675        debugger->exception(callFrame, exceptionValue, hasHandler);
    684676    }
    685677
     
    688680    VM& vm = callFrame->vm();
    689681    ASSERT(callFrame == vm.topCallFrame);
    690     UnwindFunctor functor(callFrame, exceptionValue, isTermination, codeBlock, handler);
     682    UnwindFunctor functor(callFrame, isTermination, codeBlock, handler);
    691683    callFrame->iterate(functor);
    692684    if (!handler)
     
    12611253}
    12621254
    1263 NEVER_INLINE void Interpreter::debug(CallFrame* callFrame, DebugHookID debugHookID, int firstLine, int lastLine, int column)
     1255NEVER_INLINE void Interpreter::debug(CallFrame* callFrame, DebugHookID debugHookID)
    12641256{
    12651257    Debugger* debugger = callFrame->dynamicGlobalObject()->debugger();
     
    12691261    switch (debugHookID) {
    12701262        case DidEnterCallFrame:
    1271             debugger->callEvent(DebuggerCallFrame(callFrame, firstLine, column));
     1263            debugger->callEvent(callFrame);
    12721264            return;
    12731265        case WillLeaveCallFrame:
    1274             debugger->returnEvent(DebuggerCallFrame(callFrame, lastLine, column));
     1266            debugger->returnEvent(callFrame);
    12751267            return;
    12761268        case WillExecuteStatement:
    1277             debugger->atStatement(DebuggerCallFrame(callFrame, firstLine, column));
     1269            debugger->atStatement(callFrame);
    12781270            return;
    12791271        case WillExecuteProgram:
    1280             debugger->willExecuteProgram(DebuggerCallFrame(callFrame, firstLine, column));
     1272            debugger->willExecuteProgram(callFrame);
    12811273            return;
    12821274        case DidExecuteProgram:
    1283             debugger->didExecuteProgram(DebuggerCallFrame(callFrame, lastLine, column));
     1275            debugger->didExecuteProgram(callFrame);
    12841276            return;
    12851277        case DidReachBreakpoint:
    1286             debugger->didReachBreakpoint(DebuggerCallFrame(callFrame, lastLine, column));
     1278            debugger->didReachBreakpoint(callFrame);
    12871279            return;
    12881280    }
  • trunk/Source/JavaScriptCore/interpreter/Interpreter.h

    r156242 r156374  
    240240
    241241        NEVER_INLINE HandlerInfo* unwind(CallFrame*&, JSValue&);
    242         NEVER_INLINE void debug(CallFrame*, DebugHookID, int firstLine, int lastLine, int column);
     242        NEVER_INLINE void debug(CallFrame*, DebugHookID);
    243243        JSString* stackTraceAsString(ExecState*, Vector<StackFrame>);
    244244
  • trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp

    r155711 r156374  
    758758    JITStubCall stubCall(this, cti_op_debug);
    759759    stubCall.addArgument(TrustedImm32(currentInstruction[1].u.operand));
    760     stubCall.addArgument(TrustedImm32(currentInstruction[2].u.operand));
    761     stubCall.addArgument(TrustedImm32(currentInstruction[3].u.operand));
    762     stubCall.addArgument(TrustedImm32(currentInstruction[4].u.operand));
    763760    stubCall.call();
    764761#endif
  • trunk/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp

    r155711 r156374  
    10841084    JITStubCall stubCall(this, cti_op_debug);
    10851085    stubCall.addArgument(Imm32(currentInstruction[1].u.operand));
    1086     stubCall.addArgument(Imm32(currentInstruction[2].u.operand));
    1087     stubCall.addArgument(Imm32(currentInstruction[3].u.operand));
    1088     stubCall.addArgument(Imm32(currentInstruction[4].u.operand));
    10891086    stubCall.call();
    10901087#endif
  • trunk/Source/JavaScriptCore/jit/JITStubs.cpp

    r156242 r156374  
    21482148
    21492149    int debugHookID = stackFrame.args[0].int32();
    2150     int firstLine = stackFrame.args[1].int32();
    2151     int lastLine = stackFrame.args[2].int32();
    2152     int column = stackFrame.args[3].int32();
    2153 
    2154     stackFrame.vm->interpreter->debug(callFrame, static_cast<DebugHookID>(debugHookID), firstLine, lastLine, column);
     2150    stackFrame.vm->interpreter->debug(callFrame, static_cast<DebugHookID>(debugHookID));
    21552151}
    21562152
  • trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp

    r156242 r156374  
    12401240    LLINT_BEGIN();
    12411241    int debugHookID = pc[1].u.operand;
    1242     int firstLine = pc[2].u.operand;
    1243     int lastLine = pc[3].u.operand;
    1244     int column = pc[4].u.operand;
    1245 
    1246     vm.interpreter->debug(exec, static_cast<DebugHookID>(debugHookID), firstLine, lastLine, column);
     1242    vm.interpreter->debug(exec, static_cast<DebugHookID>(debugHookID));
    12471243   
    12481244    LLINT_END();
  • trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm

    r155711 r156374  
    796796    traceExecution()
    797797    callSlowPath(_llint_slow_path_debug)
    798     dispatch(5)
     798    dispatch(2)
    799799
    800800
  • trunk/Source/WebCore/ChangeLog

    r156372 r156374  
     12013-09-24  Mark Lam  <mark.lam@apple.com>
     2
     3        Change JSC debug hooks to pass a CallFrame* instead of a DebuggerCallFrame.
     4        https://bugs.webkit.org/show_bug.cgi?id=121867.
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        No new tests.
     9
     10        * bindings/js/ScriptDebugServer.cpp:
     11        (WebCore::ScriptDebugServer::createCallFrame):
     12        (WebCore::ScriptDebugServer::updateCallFrameAndPauseIfNeeded):
     13        (WebCore::ScriptDebugServer::callEvent):
     14        (WebCore::ScriptDebugServer::atStatement):
     15        (WebCore::ScriptDebugServer::returnEvent):
     16        (WebCore::ScriptDebugServer::exception):
     17        (WebCore::ScriptDebugServer::willExecuteProgram):
     18        (WebCore::ScriptDebugServer::didExecuteProgram):
     19        (WebCore::ScriptDebugServer::didReachBreakpoint):
     20        * bindings/js/ScriptDebugServer.h:
     21        * bindings/js/WorkerScriptDebugServer.cpp:
     22        (WebCore::WorkerScriptDebugServer::willExecuteProgram):
     23        * bindings/js/WorkerScriptDebugServer.h:
     24
    1252013-09-24  Andreas Kling  <akling@apple.com>
    226
  • trunk/Source/WebCore/bindings/js/ScriptDebugServer.cpp

    r155736 r156374  
    430430}
    431431
    432 void ScriptDebugServer::createCallFrame(const DebuggerCallFrame& debuggerCallFrame)
    433 {
    434     intptr_t sourceId = debuggerCallFrame.sourceId();
     432void ScriptDebugServer::createCallFrame(CallFrame* callFrame)
     433{
     434    DebuggerCallFrame debuggerCallFrame(callFrame);
    435435    m_currentCallFrame = JavaScriptCallFrame::create(debuggerCallFrame, m_currentCallFrame);
     436    intptr_t sourceId = m_currentCallFrame->sourceID();
    436437    if (m_lastExecutedSourceId != sourceId) {
    437438        m_lastExecutedLine = -1;
     
    440441}
    441442
    442 void ScriptDebugServer::updateCallFrameAndPauseIfNeeded(const DebuggerCallFrame& debuggerCallFrame)
     443void ScriptDebugServer::updateCallFrameAndPauseIfNeeded(CallFrame* callFrame)
    443444{
    444445    // ASSERT(m_currentCallFrame);
     
    446447        return;
    447448
    448     m_currentCallFrame->update(debuggerCallFrame);
    449     pauseIfNeeded(debuggerCallFrame.dynamicGlobalObject());
     449    m_currentCallFrame->update(DebuggerCallFrame(callFrame));
     450    pauseIfNeeded(callFrame->dynamicGlobalObject());
    450451}
    451452
     
    493494}
    494495
    495 void ScriptDebugServer::callEvent(const DebuggerCallFrame& debuggerCallFrame)
     496void ScriptDebugServer::callEvent(CallFrame* callFrame)
    496497{
    497498    if (!m_paused) {
    498         createCallFrame(debuggerCallFrame);
    499         pauseIfNeeded(debuggerCallFrame.dynamicGlobalObject());
    500     }
    501 }
    502 
    503 void ScriptDebugServer::atStatement(const DebuggerCallFrame& debuggerCallFrame)
     499        createCallFrame(callFrame);
     500        pauseIfNeeded(callFrame->dynamicGlobalObject());
     501    }
     502}
     503
     504void ScriptDebugServer::atStatement(CallFrame* callFrame)
    504505{
    505506    if (!m_paused)
    506         updateCallFrameAndPauseIfNeeded(debuggerCallFrame);
    507 }
    508 
    509 void ScriptDebugServer::returnEvent(const DebuggerCallFrame& debuggerCallFrame)
     507        updateCallFrameAndPauseIfNeeded(callFrame);
     508}
     509
     510void ScriptDebugServer::returnEvent(CallFrame* callFrame)
    510511{
    511512    if (m_paused)
    512513        return;
    513514
    514     updateCallFrameAndPauseIfNeeded(debuggerCallFrame);
     515    updateCallFrameAndPauseIfNeeded(callFrame);
    515516
    516517    // detach may have been called during pauseIfNeeded
     
    524525}
    525526
    526 void ScriptDebugServer::exception(const DebuggerCallFrame& debuggerCallFrame, bool hasHandler)
     527void ScriptDebugServer::exception(CallFrame* callFrame, JSValue, bool hasHandler)
    527528{
    528529    if (m_paused)
     
    532533        m_pauseOnNextStatement = true;
    533534
    534     updateCallFrameAndPauseIfNeeded(debuggerCallFrame);
    535 }
    536 
    537 void ScriptDebugServer::willExecuteProgram(const DebuggerCallFrame& debuggerCallFrame)
     535    updateCallFrameAndPauseIfNeeded(callFrame);
     536}
     537
     538void ScriptDebugServer::willExecuteProgram(CallFrame* callFrame)
    538539{
    539540    if (!m_paused) {
    540         createCallFrame(debuggerCallFrame);
    541         pauseIfNeeded(debuggerCallFrame.dynamicGlobalObject());
    542     }
    543 }
    544 
    545 void ScriptDebugServer::didExecuteProgram(const DebuggerCallFrame& debuggerCallFrame)
     541        createCallFrame(callFrame);
     542        pauseIfNeeded(callFrame->dynamicGlobalObject());
     543    }
     544}
     545
     546void ScriptDebugServer::didExecuteProgram(CallFrame* callFrame)
    546547{
    547548    if (m_paused)
    548549        return;
    549550
    550     updateCallFrameAndPauseIfNeeded(debuggerCallFrame);
     551    updateCallFrameAndPauseIfNeeded(callFrame);
    551552
    552553    // Treat stepping over the end of a program like stepping out.
     
    561562}
    562563
    563 void ScriptDebugServer::didReachBreakpoint(const DebuggerCallFrame& debuggerCallFrame)
     564void ScriptDebugServer::didReachBreakpoint(CallFrame* callFrame)
    564565{
    565566    if (m_paused)
     
    567568
    568569    m_pauseOnNextStatement = true;
    569     updateCallFrameAndPauseIfNeeded(debuggerCallFrame);
     570    updateCallFrameAndPauseIfNeeded(callFrame);
    570571}
    571572
  • trunk/Source/WebCore/bindings/js/ScriptDebugServer.h

    r155736 r156374  
    136136    void dispatchFailedToParseSource(const ListenerSet& listeners, JSC::SourceProvider*, int errorLine, const String& errorMessage);
    137137
    138     void createCallFrame(const JSC::DebuggerCallFrame&);
    139     void updateCallFrameAndPauseIfNeeded(const JSC::DebuggerCallFrame&);
     138    void createCallFrame(JSC::CallFrame*);
     139    void updateCallFrameAndPauseIfNeeded(JSC::CallFrame*);
    140140    void pauseIfNeeded(JSC::JSGlobalObject* dynamicGlobalObject);
    141141
    142     virtual void detach(JSC::JSGlobalObject*);
     142    virtual void detach(JSC::JSGlobalObject*) OVERRIDE;
    143143
    144     virtual void sourceParsed(JSC::ExecState*, JSC::SourceProvider*, int errorLine, const String& errorMsg);
    145     virtual void callEvent(const JSC::DebuggerCallFrame&);
    146     virtual void atStatement(const JSC::DebuggerCallFrame&);
    147     virtual void returnEvent(const JSC::DebuggerCallFrame&);
    148     virtual void exception(const JSC::DebuggerCallFrame&, bool hasHandler);
    149     virtual void willExecuteProgram(const JSC::DebuggerCallFrame&);
    150     virtual void didExecuteProgram(const JSC::DebuggerCallFrame&);
    151     virtual void didReachBreakpoint(const JSC::DebuggerCallFrame&);
     144    virtual void sourceParsed(JSC::ExecState*, JSC::SourceProvider*, int errorLine, const String& errorMsg) OVERRIDE;
     145    virtual void callEvent(JSC::CallFrame*) OVERRIDE;
     146    virtual void atStatement(JSC::CallFrame*) OVERRIDE;
     147    virtual void returnEvent(JSC::CallFrame*) OVERRIDE;
     148    virtual void exception(JSC::CallFrame*, JSC::JSValue exceptionValue, bool hasHandler) OVERRIDE;
     149    virtual void willExecuteProgram(JSC::CallFrame*) OVERRIDE;
     150    virtual void didExecuteProgram(JSC::CallFrame*) OVERRIDE;
     151    virtual void didReachBreakpoint(JSC::CallFrame*) OVERRIDE;
    152152
    153153    typedef Vector<ScriptBreakpoint> BreakpointsInLine;
  • trunk/Source/WebCore/bindings/js/WorkerScriptDebugServer.cpp

    r155622 r156374  
    6161}
    6262
    63 void WorkerScriptDebugServer::willExecuteProgram(const JSC::DebuggerCallFrame& debuggerCallFrame)
     63void WorkerScriptDebugServer::willExecuteProgram(JSC::CallFrame* callFrame)
    6464{
    6565    if (!m_paused)
    66         createCallFrame(debuggerCallFrame);
     66        createCallFrame(callFrame);
    6767}
    6868
  • trunk/Source/WebCore/bindings/js/WorkerScriptDebugServer.h

    r155622 r156374  
    4040class WorkerGlobalScope;
    4141
    42 class WorkerScriptDebugServer : public ScriptDebugServer {
     42class WorkerScriptDebugServer FINAL : public ScriptDebugServer {
    4343    WTF_MAKE_NONCOPYABLE(WorkerScriptDebugServer);
    4444public:
     
    5454
    5555private:
    56     virtual ListenerSet* getListenersForGlobalObject(JSC::JSGlobalObject*) { return &m_listeners; }
    57     virtual void didPause(JSC::JSGlobalObject*) { }
    58     virtual void didContinue(JSC::JSGlobalObject*) { }
     56    virtual ListenerSet* getListenersForGlobalObject(JSC::JSGlobalObject*) OVERRIDE { return &m_listeners; }
     57    virtual void didPause(JSC::JSGlobalObject*) OVERRIDE { }
     58    virtual void didContinue(JSC::JSGlobalObject*) OVERRIDE { }
    5959
    60     virtual bool isContentScript(JSC::ExecState*) { return false; }
     60    virtual bool isContentScript(JSC::ExecState*) OVERRIDE { return false; }
    6161
    62     virtual void willExecuteProgram(const JSC::DebuggerCallFrame&);
     62    virtual void willExecuteProgram(JSC::CallFrame*) OVERRIDE;
    6363
    64     virtual void runEventLoopWhilePaused();
     64    virtual void runEventLoopWhilePaused() OVERRIDE;
    6565
    6666    WorkerGlobalScope* m_workerGlobalScope;
  • trunk/Source/WebKit/mac/ChangeLog

    r156350 r156374  
     12013-09-24  Mark Lam  <mark.lam@apple.com>
     2
     3        Change JSC debug hooks to pass a CallFrame* instead of a DebuggerCallFrame.
     4        https://bugs.webkit.org/show_bug.cgi?id=121867.
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        * WebView/WebScriptDebugDelegate.mm:
     9        (-[WebScriptCallFrame _initWithGlobalObject:debuggerCallFrame:exceptionValue:JSC::]):
     10        (-[WebScriptCallFrame exception]):
     11        * WebView/WebScriptDebugger.h:
     12        * WebView/WebScriptDebugger.mm:
     13        (WebScriptDebugger::exception):
     14
    1152013-09-24  Enrica Casucci  <enrica@apple.com>
    216
  • trunk/Source/WebKit/mac/WebView/WebScriptDebugDelegate.mm

    r156245 r156374  
    6464    WebScriptObject        *globalObject;   // the global object's proxy (not retained)
    6565    DebuggerCallFrame* debuggerCallFrame;
     66    JSC::JSValue exceptionValue;
    6667}
    6768@end
     
    8687@implementation WebScriptCallFrame (WebScriptDebugDelegateInternal)
    8788
    88 - (WebScriptCallFrame *)_initWithGlobalObject:(WebScriptObject *)globalObj debuggerCallFrame:(const DebuggerCallFrame&)debuggerCallFrame
     89- (WebScriptCallFrame *)_initWithGlobalObject:(WebScriptObject *)globalObj debuggerCallFrame:(const DebuggerCallFrame&)debuggerCallFrame exceptionValue:(JSC::JSValue)exceptionValue
    8990{
    9091    if ((self = [super init])) {
     
    9293        _private->globalObject = globalObj;
    9394        _private->debuggerCallFrame = new DebuggerCallFrame(debuggerCallFrame);
     95        _private->exceptionValue = exceptionValue;
    9496    }
    9597    return self;
     
    161163        return nil;
    162164
    163     JSC::JSValue exception = _private->debuggerCallFrame->exception();
     165    JSC::JSValue exception = _private->exceptionValue;
    164166    return exception ? [self _convertValueToObjcValue:exception] : nil;
    165167}
  • trunk/Source/WebKit/mac/WebView/WebScriptDebugger.h

    r156245 r156374  
    4949@class WebScriptCallFrame;
    5050
    51 class WebScriptDebugger : public JSC::Debugger {
     51class WebScriptDebugger FINAL : public JSC::Debugger {
    5252public:
    5353    WebScriptDebugger(JSC::JSGlobalObject*);
     
    5656
    5757private:
    58     virtual void sourceParsed(JSC::ExecState*, JSC::SourceProvider*, int errorLine, const WTF::String& errorMsg);
    59     virtual void callEvent(const JSC::DebuggerCallFrame&) { }
    60     virtual void atStatement(const JSC::DebuggerCallFrame&) { }
    61     virtual void returnEvent(const JSC::DebuggerCallFrame&) { }
    62     virtual void exception(const JSC::DebuggerCallFrame&, bool hasHandler);
    63     virtual void willExecuteProgram(const JSC::DebuggerCallFrame&) { }
    64     virtual void didExecuteProgram(const JSC::DebuggerCallFrame&) { }
    65     virtual void didReachBreakpoint(const JSC::DebuggerCallFrame&) { }
     58    virtual void sourceParsed(JSC::ExecState*, JSC::SourceProvider*, int errorLine, const WTF::String& errorMsg) OVERRIDE;
     59    virtual void callEvent(JSC::CallFrame*) OVERRIDE { }
     60    virtual void atStatement(JSC::CallFrame*) OVERRIDE { }
     61    virtual void returnEvent(JSC::CallFrame*) OVERRIDE { }
     62    virtual void exception(JSC::CallFrame*, JSC::JSValue exceptionValue, bool hasHandler) OVERRIDE;
     63    virtual void willExecuteProgram(JSC::CallFrame*) OVERRIDE { }
     64    virtual void didExecuteProgram(JSC::CallFrame*) OVERRIDE { }
     65    virtual void didReachBreakpoint(JSC::CallFrame*) OVERRIDE { }
    6666
    6767    bool m_callingDelegate;
  • trunk/Source/WebKit/mac/WebView/WebScriptDebugger.mm

    r156245 r156374  
    4747
    4848@interface WebScriptCallFrame (WebScriptDebugDelegateInternal)
    49 - (WebScriptCallFrame *)_initWithGlobalObject:(WebScriptObject *)globalObj debuggerCallFrame:(const DebuggerCallFrame&)debuggerCallFrame;
     49- (WebScriptCallFrame *)_initWithGlobalObject:(WebScriptObject *)globalObj debuggerCallFrame:(const DebuggerCallFrame&)debuggerCallFrame exceptionValue:(JSC::JSValue)exceptionValue;
    5050@end
    5151
     
    117117}
    118118
    119 void WebScriptDebugger::exception(const DebuggerCallFrame& debuggerCallFrame, bool hasHandler)
     119void WebScriptDebugger::exception(JSC::CallFrame* callFrame, JSC::JSValue exceptionValue, bool hasHandler)
    120120{
    121121    if (m_callingDelegate)
     
    124124    m_callingDelegate = true;
    125125
    126     WebFrame *webFrame = toWebFrame(debuggerCallFrame.dynamicGlobalObject());
     126    WebFrame *webFrame = toWebFrame(callFrame->dynamicGlobalObject());
    127127    WebView *webView = [webFrame webView];
    128     RetainPtr<WebScriptCallFrame> callFrame = adoptNS([[WebScriptCallFrame alloc] _initWithGlobalObject:core(webFrame)->script().windowScriptObject() debuggerCallFrame:debuggerCallFrame]);
     128    DebuggerCallFrame debuggerCallFrame(callFrame);
     129    RetainPtr<WebScriptCallFrame> webCallFrame = adoptNS([[WebScriptCallFrame alloc] _initWithGlobalObject:core(webFrame)->script().windowScriptObject() debuggerCallFrame:debuggerCallFrame exceptionValue:exceptionValue]);
    129130
    130131    WebScriptDebugDelegateImplementationCache* cache = WebViewGetScriptDebugDelegateImplementations(webView);
    131132    if (cache->exceptionWasRaisedFunc) {
    132133        if (cache->exceptionWasRaisedExpectsHasHandlerFlag)
    133             CallScriptDebugDelegate(cache->exceptionWasRaisedFunc, webView, @selector(webView:exceptionWasRaised:hasHandler:sourceId:line:forWebFrame:), callFrame.get(), hasHandler, debuggerCallFrame.sourceId(), debuggerCallFrame.line(), webFrame);
     134            CallScriptDebugDelegate(cache->exceptionWasRaisedFunc, webView, @selector(webView:exceptionWasRaised:hasHandler:sourceId:line:forWebFrame:), webCallFrame.get(), hasHandler, debuggerCallFrame.sourceId(), debuggerCallFrame.line(), webFrame);
    134135        else
    135             CallScriptDebugDelegate(cache->exceptionWasRaisedFunc, webView, @selector(webView:exceptionWasRaised:sourceId:line:forWebFrame:), callFrame.get(), debuggerCallFrame.sourceId(), debuggerCallFrame.line(), webFrame);
     136            CallScriptDebugDelegate(cache->exceptionWasRaisedFunc, webView, @selector(webView:exceptionWasRaised:sourceId:line:forWebFrame:), webCallFrame.get(), debuggerCallFrame.sourceId(), debuggerCallFrame.line(), webFrame);
    136137    }
    137138
Note: See TracChangeset for help on using the changeset viewer.