Ignore:
Timestamp:
Nov 20, 2002, 4:55:08 PM (23 years ago)
Author:
darin
Message:
  • created argument list objects only on demand for a 7.5% speedup
  • kjs/function.h: Change ActivationImp around.
  • kjs/function.cpp: (FunctionImp::call): Pass a pointer to the arguments list to avoid ref/unref. (FunctionImp::get): Get the function pointer from the context directly, not the activation object. (ArgumentsImp::ArgumentsImp): Add an overload that takes no arguments. (ActivationImp::ActivationImp): Store a context pointer and an arguments object pointer. (ActivationImp::get): Special case for arguments, create it and return it. (ActivationImp::put): Special case for arguments, can't be set. (ActivationImp::hasProperty): Special case for arguments, return true. (ActivationImp::deleteProperty): Special case for arguments, refuse to delete. (ActivationImp::mark): Mark the arguments object. (ActivationImp::createArgumentsObject): Do the work of actually creating it. (GlobalFuncImp::call): Use stack-based objects for the ContextImp and ExecState.
  • kjs/internal.h: Keep function and arguments pointer in the context.
  • kjs/internal.cpp: (ContextImp::ContextImp): Don't pass in the func and args when making an ActivationImp. (InterpreterImp::evaluate): Use stack-based objects here.
  • kjs/types.h: Add ArgumentList as a synonym for List, soon to be separate.
File:
1 edited

Legend:

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

    r2783 r2792  
    356356// ------------------------------ ContextImp -----------------------------------
    357357
    358 
    359358// ECMA 10.2
    360359ContextImp::ContextImp(Object &glob, ExecState *exec, Object &thisV, CodeType type,
    361                        ContextImp *_callingContext, FunctionImp *func, const List &args)
     360                       ContextImp *_callingContext, FunctionImp *func, const ArgumentList *args)
     361    : _function(func), _arguments(args)
    362362{
    363363  codeType = type;
     
    366366  // create and initialize activation object (ECMA 10.1.6)
    367367  if (type == FunctionCode || type == AnonymousCode ) {
    368     activation = Object(new ActivationImp(exec,func,args));
     368    activation = Object(new ActivationImp(exec));
    369369    variable = activation;
    370370  } else {
     
    782782  else {
    783783    // execute the code
    784     ExecState *exec1 = 0;
    785     ContextImp *ctx = new ContextImp(globalObj, exec1, thisObj);
    786     ExecState *newExec = new ExecState(m_interpreter,ctx);
    787 
    788     res = progNode->execute(newExec);
    789 
    790     delete newExec;
    791     delete ctx;
     784    ContextImp ctx(globalObj, 0, thisObj);
     785    ExecState newExec(m_interpreter,&ctx);
     786    res = progNode->execute(&newExec);
    792787  }
    793788
Note: See TracChangeset for help on using the changeset viewer.