Ignore:
Timestamp:
Sep 28, 2008, 8:04:08 PM (17 years ago)
Author:
[email protected]
Message:

2008-09-28 Cameron Zwarich <[email protected]>

Reviewed by Maciej Stachowiak.

Bug 21200: Allow direct access to 'arguments' without using op_resolve
<https://bugs.webkit.org/show_bug.cgi?id=21200>

Allow fast access to the 'arguments' object by adding an extra slot to
the callframe to store it.

  • JavaScriptCore.exp:
  • VM/CTI.cpp: (JSC::CTI::privateCompileMainPass):
  • VM/CodeBlock.cpp: (JSC::CodeBlock::dump):
  • VM/CodeGenerator.cpp: (JSC::CodeGenerator::CodeGenerator): (JSC::CodeGenerator::registerFor):
  • VM/CodeGenerator.h: (JSC::CodeGenerator::registerFor):
  • VM/Machine.cpp: (JSC::Machine::initializeCallFrame): (JSC::Machine::dumpRegisters): (JSC::Machine::privateExecute): (JSC::Machine::retrieveArguments): (JSC::Machine::cti_op_call_JSFunction): (JSC::Machine::cti_op_create_arguments): (JSC::Machine::cti_op_construct_JSConstruct):
  • VM/Machine.h:
  • VM/Opcode.h:
  • VM/RegisterFile.h: (JSC::RegisterFile::):
  • kjs/JSActivation.cpp: (JSC::JSActivation::mark): (JSC::JSActivation::argumentsGetter):
  • kjs/JSActivation.h: (JSC::JSActivation::JSActivationData::JSActivationData):
  • kjs/NodeInfo.h:
  • kjs/Parser.cpp: (JSC::Parser::didFinishParsing):
  • kjs/Parser.h: (JSC::Parser::parse):
  • kjs/grammar.y:
  • kjs/nodes.cpp: (JSC::ScopeNode::ScopeNode): (JSC::ProgramNode::ProgramNode): (JSC::ProgramNode::create): (JSC::EvalNode::EvalNode): (JSC::EvalNode::create): (JSC::FunctionBodyNode::FunctionBodyNode): (JSC::FunctionBodyNode::create):
  • kjs/nodes.h: (JSC::ScopeNode::usesArguments):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/VM/CodeGenerator.cpp

    r36976 r37050  
    293293    codeBlock->globalData = m_globalData;
    294294
     295    bool usesArguments = functionBody->usesArguments();
     296
    295297    const Node::FunctionStack& functionStack = functionBody->functionStack();
    296298    for (size_t i = 0; i < functionStack.size(); ++i) {
    297299        FuncDeclNode* funcDecl = functionStack[i].get();
    298300        const Identifier& ident = funcDecl->m_ident;
    299 
     301        if (ident == propertyNames().arguments)
     302            usesArguments = true;
    300303        m_functions.add(ident.ustring().rep());
    301304        emitNewFunction(addVar(ident, false), funcDecl);
     
    305308    for (size_t i = 0; i < varStack.size(); ++i) {
    306309        const Identifier& ident = varStack[i].first;
    307         if (ident == propertyNames().arguments)
     310        if (ident == propertyNames().arguments) {
     311            usesArguments = true;
    308312            continue;
     313        }
    309314        addVar(ident, varStack[i].second & DeclarationStacks::IsConstant);
     315    }
     316
     317    if (usesArguments) {
     318        emitOpcode(op_init_arguments);
     319        m_codeBlock->needsFullScopeChain = true;
     320        m_argumentsRegister.setIndex(RegisterFile::OptionalCalleeArguments);
     321        symbolTable->add(propertyNames().arguments.ustring().rep(), SymbolTableEntry(RegisterFile::OptionalCalleeArguments));
    310322    }
    311323
     
    367379RegisterID* CodeGenerator::registerFor(const Identifier& ident)
    368380{
    369     if (m_codeType == FunctionCode && ident == propertyNames().arguments)
    370         m_codeBlock->needsFullScopeChain = true;
    371 
    372381    if (ident == propertyNames().thisIdentifier)
    373382        return &m_thisRegister;
Note: See TracChangeset for help on using the changeset viewer.