Ignore:
Timestamp:
Feb 12, 2009, 8:10:31 PM (16 years ago)
Author:
[email protected]
Message:

JavaScriptCore:

2009-02-12 Horia Olaru <[email protected]>

Reviewed by Oliver Hunt.

https://bugs.webkit.org/show_bug.cgi?id=23400

When throwing an exception within an eval argument string, the dst parameter was
modified in the functions below and the return value for eval was altered. Changed
the emitNode call in JSC::ThrowNode::emitBytecode to use a temporary register
to store its results instead of dst. The JSC::FunctionCallResolveNode::emitBytecode
would load the function within the dst registry, also altering the result returned
by eval. Replaced it with another temporary.

  • parser/Nodes.cpp: (JSC::FunctionCallResolveNode::emitBytecode): (JSC::ThrowNode::emitBytecode):

LayoutTests:

2009-02-12 Horia Olaru <[email protected]>

Reviewed by Oliver Hunt.

https://bugs.webkit.org/show_bug.cgi?id=23400

Added a modified version of the test Chris Brichford attached to the bug.
Will test return values of various eval function calls, including some which
throw and catch errors in the string to evaluate.

  • fast/js/eval-throw-return-expected.txt: Added.
  • fast/js/eval-throw-return.html: Added.
  • fast/js/resources/eval-throw-return.js: Added. (throwFunc): (throwOnReturn): (twoFunc):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/parser/Nodes.cpp

    r40086 r40962  
    641641    }
    642642
    643     RefPtr<RegisterID> func = generator.tempDestination(dst);
     643    RefPtr<RegisterID> func = generator.newTemporary();
    644644    RefPtr<RegisterID> thisRegister = generator.newTemporary();
    645645    int identifierStart = divot() - startOffset();
     
    22942294    if (dst == generator.ignoredResult())
    22952295        dst = 0;
    2296     RefPtr<RegisterID> expr = generator.emitNode(dst, m_expr.get());
     2296    RefPtr<RegisterID> expr = generator.emitNode(m_expr.get());
    22972297    generator.emitExpressionInfo(divot(), startOffset(), endOffset());
    22982298    generator.emitThrow(expr.get());
    2299     return dst;
     2299    return 0;
    23002300}
    23012301
Note: See TracChangeset for help on using the changeset viewer.