Changeset 27373 in webkit for trunk/JavaScriptCore/kjs/nodes.cpp


Ignore:
Timestamp:
Nov 1, 2007, 5:14:04 PM (18 years ago)
Author:
ggaren
Message:

JavaScriptCore:

Reviewed by Maciej Stachowiak.


In preparation for making List a simple stack-allocated Vector:

Removed all instances of List copying and/or assignment, and made List
inherit from Noncopyable.


Functions that used to return a List by copy now take List& out
parameters.


Layout tests and JS tests pass.

  • kjs/list.cpp: (KJS::List::slice): Replaced copyTail with a more generic slice alternative. (JavaScriptCore only calls slice(1), but WebCore calls slice(2)).

WebCore:

Reviewed by Maciej Stachowiak.


In preparation for making List a simple stack-allocated Vector:

Removed all instances of List copying, assignment, and/or storage.


Layout tests and JS tests pass.

  • bindings/js/kjs_window.cpp: (KJS::WindowFunc::callAsFunction): Stores a Vector of protected JSValue*'s instead of a List now. Converts to List on the fly when calling the timer function. This is slightly less efficient, but the common case is 0-2 arguments, so it's no biggie.

(HTML iBench shows no regression. PLT does not use JS timers.)


(KJS::ScheduledAction::execute): Uses the more efficient and non-copying
List::slice now.
(KJS::ScheduledAction::ScheduledAction): ditto

  • bindings/objc/WebScriptObject.mm: (getListFromNSArray): Takes a List out parameter now, to avoid copying.
File:
1 edited

Legend:

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

    r27339 r27373  
    5858  if (exec->hadException()) { \
    5959    handleException(exec); \
    60     return List(); \
     60    return; \
    6161  }
    6262
     
    611611
    612612// ECMA 11.2.4
    613 List ArgumentListNode::evaluateList(ExecState *exec)
    614 {
    615   List l;
    616 
     613void ArgumentListNode::evaluateList(ExecState* exec, List& list)
     614{
    617615  for (ArgumentListNode *n = this; n; n = n->next.get()) {
    618616    JSValue *v = n->expr->evaluate(exec);
    619617    KJS_CHECKEXCEPTIONLIST
    620     l.append(v);
     618    list.append(v);
    621619  }
    622 
    623   return l;
    624620}
    625621
     
    628624void ArgumentsNode::optimizeVariableAccess(FunctionBodyNode*, DeclarationStacks::NodeStack& nodeStack)
    629625{
    630     if (list)
    631         nodeStack.append(list.get());
     626    if (listNode)
     627        nodeStack.append(listNode.get());
    632628}
    633629
     
    656652  List argList;
    657653  if (args) {
    658     argList = args->evaluateList(exec);
     654    args->evaluateList(exec, argList);
    659655    KJS_CHECKEXCEPTIONVALUE
    660656  }
     
    694690  }
    695691
    696   List argList = args->evaluateList(exec);
     692  List argList;
     693  args->evaluateList(exec, argList);
    697694  KJS_CHECKEXCEPTIONVALUE
    698695
     
    742739      }
    743740     
    744       List argList = args->evaluateList(exec);
     741      List argList;
     742      args->evaluateList(exec, argList);
    745743      KJS_CHECKEXCEPTIONVALUE
    746744       
     
    777775        return throwError(exec, TypeError, "Object %s (result of expression %s) does not allow calls.", v, ident);
    778776     
    779     List argList = args->evaluateList(exec);
     777    List argList;
     778    args->evaluateList(exec, argList);
    780779    KJS_CHECKEXCEPTIONVALUE
    781780
     
    828827  }
    829828
    830   List argList = args->evaluateList(exec);
     829  List argList;
     830  args->evaluateList(exec, argList);
    831831  KJS_CHECKEXCEPTIONVALUE
    832832
     
    876876    return throwError(exec, TypeError, dotExprDoesNotAllowCallsString(), funcVal, base.get(), ident);
    877877
    878   List argList = args->evaluateList(exec);
     878  List argList;
     879  args->evaluateList(exec, argList);
    879880  KJS_CHECKEXCEPTIONVALUE
    880881
Note: See TracChangeset for help on using the changeset viewer.