Ignore:
Timestamp:
Oct 12, 2007, 7:43:04 AM (18 years ago)
Author:
oliver
Message:

Reviewed by Oliver.

  • kjs/array_object.cpp: (ArrayProtoFunc::callAsFunction): Implement the two mentioned optimizations.
File:
1 edited

Legend:

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

    r24820 r26475  
    536536  case Join: {
    537537    static HashSet<JSObject*> visitedElems;
    538     if (visitedElems.contains(thisObj))
    539         return jsString("");
    540     UString separator = ",";
    541     UString str = "";
    542 
    543     visitedElems.add(thisObj);
     538    static const UString empty("");
     539    static const UString comma(",");
     540    bool alreadyVisited = !visitedElems.add(thisObj).second;
     541    if (alreadyVisited)
     542        return jsString(empty);
     543    UString separator = comma;
     544    UString str = empty;
     545
    544546    if (id == Join && !args[0]->isUndefined())
    545547        separator = args[0]->toString(exec);
Note: See TracChangeset for help on using the changeset viewer.