Ignore:
Timestamp:
Dec 10, 2005, 11:05:22 AM (19 years ago)
Author:
darin
Message:

JavaScriptCore:

Reviewed by Maciej, landed by Darin.

  • kjs/array_object.cpp: (ArrayProtoFuncImp::callAsFunction): Added set of visited objects -- don't recurse if item is already in the set.

LayoutTests:

New layout test for http://bugzilla.opendarwin.org/show_bug.cgi?id=3539

  • fast/js/cyclic-ref-toString-expected.txt: Added.
  • fast/js/cyclic-ref-toString.html: Added.
File:
1 edited

Legend:

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

    r10857 r11519  
    3232#include "types.h"
    3333#include "value.h"
     34#include "HashSet.h"
    3435
    3536#include "array_object.lut.h"
     
    447448    // fall through
    448449  case Join: {
     450    static HashSet< ObjectImp*, PointerHash<ObjectImp*> > visitedElems;
     451    if (visitedElems.contains(thisObj))
     452      return jsString("");
    449453    UString separator = ",";
    450454    UString str = "";
    451455
     456    visitedElems.insert(thisObj);
    452457    if (!args[0]->isUndefined())
    453458      separator = args[0]->toString(exec);
     
    489494        break;
    490495    }
     496    visitedElems.remove(thisObj);
    491497    result = String(str);
    492498    break;
Note: See TracChangeset for help on using the changeset viewer.