Ignore:
Timestamp:
Oct 5, 2008, 11:00:58 PM (17 years ago)
Author:
[email protected]
Message:

2008-10-05 Cameron Zwarich <[email protected]>

Reviewed by Oliver Hunt.

Bug 21364: Remove the branch in op_ret for OptionalCalleeActivation and OptionalCalleeArguments
<https://bugs.webkit.org/show_bug.cgi?id=21364>

Use information from the parser to detect whether an activation is
needed or 'arguments' is used, and emit explicit instructions to tear
them off before op_ret. This allows a branch to be removed from op_ret
and simplifies some other code. This does cause a small change in the
behaviour of 'f.arguments'; it is no longer live when 'arguments' is not
mentioned in the lexical scope of the function.

It should now be easy to remove the OptionaCalleeActivation slot in the
call frame, but this will be done in a later patch.

JavaScriptCore:

  • VM/CTI.cpp: (JSC::CTI::privateCompileMainPass):
  • VM/CodeBlock.cpp: (JSC::CodeBlock::dump):
  • VM/CodeGenerator.cpp: (JSC::CodeGenerator::emitReturn):
  • VM/CodeGenerator.h:
  • VM/Machine.cpp: (JSC::Machine::unwindCallFrame): (JSC::Machine::privateExecute): (JSC::Machine::retrieveArguments): (JSC::Machine::cti_op_create_arguments): (JSC::Machine::cti_op_tear_off_activation): (JSC::Machine::cti_op_tear_off_arguments):
  • VM/Machine.h:
  • VM/Opcode.h:
  • kjs/Arguments.cpp: (JSC::Arguments::mark):
  • kjs/Arguments.h: (JSC::Arguments::isTornOff): (JSC::Arguments::Arguments): (JSC::Arguments::copyRegisters): (JSC::JSActivation::copyRegisters):
  • kjs/JSActivation.cpp: (JSC::JSActivation::argumentsGetter):
  • kjs/JSActivation.h:

LayoutTests:

  • fast/js/function-dot-arguments-expected.txt:
  • fast/js/resources/function-dot-arguments.js:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/JSActivation.cpp

    r37285 r37324  
    156156    JSActivation* thisObj = static_cast<JSActivation*>(slot.slotBase());
    157157
    158     JSValue* arguments;
    159158    if (thisObj->d()->functionBody->usesArguments()) {
    160159        PropertySlot slot;
    161160        thisObj->symbolTableGet(exec->propertyNames().arguments, slot);
    162         arguments = slot.getValue(exec, exec->propertyNames().arguments);
    163     } else {
    164         arguments = thisObj->d()->registers[RegisterFile::OptionalCalleeArguments].getJSValue();
    165         if (!arguments) {
    166             arguments = new (exec) Arguments(exec, thisObj);
    167             thisObj->d()->registers[RegisterFile::OptionalCalleeArguments] = arguments;
    168         }
    169         ASSERT(arguments->isObject(&Arguments::info));
     161        return slot.getValue(exec, exec->propertyNames().arguments);
    170162    }
     163
     164    Arguments* arguments = static_cast<Arguments*>(thisObj->d()->registers[RegisterFile::OptionalCalleeArguments].getJSValue());
     165    if (!arguments) {
     166        arguments = new (exec) Arguments(exec, &thisObj->registerAt(0));
     167        arguments->copyRegisters();
     168        thisObj->d()->registers[RegisterFile::OptionalCalleeArguments] = arguments;
     169    }
     170    ASSERT(arguments->isObject(&Arguments::info));
    171171
    172172    return arguments;
Note: See TracChangeset for help on using the changeset viewer.