Ignore:
Timestamp:
Sep 27, 2012, 5:50:34 PM (13 years ago)
Author:
[email protected]
Message:

Fixed CallFrameClosure::resetCallFrame() to use the valid
range of argument index values.
https://bugs.webkit.org/show_bug.cgi?id=97836.

Reviewed by Gavin Barraclough.

  • interpreter/CallFrame.h:

(ExecState):

  • interpreter/CallFrameClosure.h:

(JSC::CallFrameClosure::resetCallFrame):

Location:
trunk/Source/JavaScriptCore/interpreter
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/interpreter/CallFrame.h

    r129453 r129827  
    191191        static int argumentOffsetIncludingThis(int argument) { return s_thisArgumentOffset - argument; }
    192192
     193        // In the following (argument() and setArgument()), the 'argument'
     194        // parameter is the index of the arguments of the target function of
     195        // this frame. The index starts at 0 for the first arg, 1 for the
     196        // second, etc.
     197        //
     198        // The arguments (in this case) do not include the 'this' value.
     199        // arguments(0) will not fetch the 'this' value. To get/set 'this',
     200        // use thisValue() and setThisValue() below.
     201
    193202        JSValue argument(size_t argument)
    194203        {
  • trunk/Source/JavaScriptCore/interpreter/CallFrameClosure.h

    r127202 r129827  
    5353    {
    5454        newCallFrame->setScope(scope);
    55         for (int i = argumentCountIncludingThis; i < parameterCountIncludingThis; ++i)
     55        // setArgument() takes an arg index that starts from 0 for the first
     56        // argument after the 'this' value. Since both argumentCountIncludingThis
     57        // and parameterCountIncludingThis includes the 'this' value, we need to
     58        // subtract 1 from them to make i a valid argument index for setArgument().
     59        for (int i = argumentCountIncludingThis-1; i < parameterCountIncludingThis-1; ++i)
    5660            newCallFrame->setArgument(i, jsUndefined());
    5761    }
Note: See TracChangeset for help on using the changeset viewer.