Changeset 36871 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Sep 24, 2008, 3:19:05 PM (17 years ago)
Author:
[email protected]
Message:

2008-09-24 Kevin McCullough <[email protected]>

Reviewed by Geoff.

Bug 21031: Breakpoints in the condition of loops only breaks the first
time

  • kjs/nodes.cpp: (JSC::statementListEmitCode): We don't want to blindly emit a debug hook at the first line of loops, instead let the loop emit the debug hooks. (JSC::DoWhileNode::emitCode): (JSC::WhileNode::emitCode): (JSC::ForNode::emitCode): (JSC::ForInNode::emitCode):
  • kjs/nodes.h: (JSC::StatementNode::): (JSC::DoWhileNode::): (JSC::WhileNode::): (JSC::ForInNode::):
Location:
trunk/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r36865 r36871  
     12008-09-24  Kevin McCullough  <[email protected]>
     2
     3        Reviewed by Geoff.
     4
     5        Bug 21031: Breakpoints in the condition of loops only breaks the first
     6        time
     7        - Now when setting breakpoints in the condition of a loop (for, while,
     8        for in, and do while) will successfully break each time throught the
     9        loop.
     10        - For 'for' loops we need a little more complicated behavior that cannot
     11        be accomplished without some more significant changes:
     12        https://bugs.webkit.org/show_bug.cgi?id=21073
     13
     14        * kjs/nodes.cpp:
     15        (JSC::statementListEmitCode): We don't want to blindly emit a debug hook
     16        at the first line of loops, instead let the loop emit the debug hooks.
     17        (JSC::DoWhileNode::emitCode):
     18        (JSC::WhileNode::emitCode):
     19        (JSC::ForNode::emitCode):
     20        (JSC::ForInNode::emitCode):
     21        * kjs/nodes.h:
     22        (JSC::StatementNode::):
     23        (JSC::DoWhileNode::):
     24        (JSC::WhileNode::):
     25        (JSC::ForInNode::):
     26
    1272008-09-24  Geoffrey Garen  <[email protected]>
    228
  • trunk/JavaScriptCore/kjs/nodes.cpp

    r36821 r36871  
    10851085    for (StatementVector::iterator it = statements.begin(); it != end; ++it) {
    10861086        StatementNode* n = it->get();
    1087         generator.emitDebugHook(WillExecuteStatement, n->isDoWhile() ? n->lastLine() : n->firstLine(), n->lastLine());
     1087        if(!n->isLoop())
     1088            generator.emitDebugHook(WillExecuteStatement, n->firstLine(), n->lastLine());
    10881089        generator.emitNode(dst, n);
    10891090    }
     
    12121213    generator.emitLabel(topOfLoop.get());
    12131214
     1215    generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine());
     1216
    12141217    if (!m_statement->isBlock())
    12151218        generator.emitDebugHook(WillExecuteStatement, m_statement->firstLine(), m_statement->lastLine());
     
    12171220    RefPtr<LabelID> continueTarget = generator.newLabel();
    12181221    RefPtr<LabelID> breakTarget = generator.newLabel();
    1219    
     1222
    12201223    generator.pushJumpContext(&m_labelStack, continueTarget.get(), breakTarget.get(), true);
    12211224    RefPtr<RegisterID> result = generator.emitNode(dst, m_statement.get());
    12221225    generator.popJumpContext();
    1223    
     1226
    12241227    generator.emitLabel(continueTarget.get());
     1228    generator.emitDebugHook(WillExecuteStatement, m_expr->lineNo(), m_expr->lineNo());
    12251229    RegisterID* cond = generator.emitNode(m_expr.get());
    12261230    generator.emitJumpIfTrue(cond, topOfLoop.get());
     
    12431247    if (!m_statement->isBlock())
    12441248        generator.emitDebugHook(WillExecuteStatement, m_statement->firstLine(), m_statement->lastLine());
    1245     
     1249 
    12461250    generator.pushJumpContext(&m_labelStack, continueTarget.get(), breakTarget.get(), true);
    12471251    generator.emitNode(dst, m_statement.get());
     
    12491253
    12501254    generator.emitLabel(continueTarget.get());
     1255    generator.emitDebugHook(WillExecuteStatement, m_expr->lineNo(), m_expr->lineNo());
    12511256    RegisterID* cond = generator.emitNode(m_expr.get());
    12521257    generator.emitJumpIfTrue(cond, topOfLoop.get());
     
    12621267RegisterID* ForNode::emitCode(CodeGenerator& generator, RegisterID* dst)
    12631268{
     1269    generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine());
     1270
    12641271    if (m_expr1)
    12651272        generator.emitNode(ignoredResult(), m_expr1.get());
    1266    
     1273
    12671274    RefPtr<LabelID> topOfLoop = generator.newLabel();
    12681275    RefPtr<LabelID> beforeCondition = generator.newLabel();
     
    12911298
    12921299    generator.emitLabel(breakTarget.get());
     1300   
    12931301    return result.get();
    12941302}
     
    13721380    generator.emitNode(dst, m_statement.get());
    13731381    generator.popJumpContext();
     1382
     1383    generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine());
    13741384
    13751385    if (!m_statement->isBlock())
  • trunk/JavaScriptCore/kjs/nodes.h

    r36809 r36871  
    235235
    236236        virtual bool isBlock() const JSC_FAST_CALL { return false; }
    237         virtual bool isDoWhile() const JSC_FAST_CALL { return false; }
     237        virtual bool isLoop() const JSC_FAST_CALL { return false; }
    238238    protected:
    239239        LabelStack m_labelStack;
     
    19381938        virtual void streamTo(SourceStream&) const JSC_FAST_CALL;
    19391939
    1940         virtual bool isDoWhile() const JSC_FAST_CALL { return true; }
     1940        virtual bool isLoop() const JSC_FAST_CALL { return true; }
    19411941    private:
    19421942        RefPtr<StatementNode> m_statement;
     
    19561956        virtual void streamTo(SourceStream&) const JSC_FAST_CALL;
    19571957
     1958        virtual bool isLoop() const JSC_FAST_CALL { return true; }
    19581959    private:
    19591960        RefPtr<ExpressionNode> m_expr;
     
    19771978        virtual void streamTo(SourceStream&) const JSC_FAST_CALL;
    19781979
     1980        virtual bool isLoop() const JSC_FAST_CALL { return true; }
    19791981    private:
    19801982        RefPtr<ExpressionNode> m_expr1;
     
    19931995        virtual void streamTo(SourceStream&) const JSC_FAST_CALL;
    19941996
     1997        virtual bool isLoop() const JSC_FAST_CALL { return true; }
    19951998    private:
    19961999        Identifier m_ident;
Note: See TracChangeset for help on using the changeset viewer.