Changeset 10744 in webkit for trunk/JavaScriptCore/kjs/object.cpp


Ignore:
Timestamp:
Oct 5, 2005, 1:05:44 AM (20 years ago)
Author:
mjs
Message:

JavaScriptCore:

Reviewed by Eric.

  • fixed <rdar://problem/4260481> Remove Reference type from JavaScriptCore

Also fixed some bugs with for..in enumeration while I was at it. object
properties now come before prototype properties and duplicates
between object and prototype are listed only once.

  • JavaScriptCore.xcodeproj/project.pbxproj:
  • kjs/IdentifierSequencedSet.cpp: Added. (KJS::IdentifierSequencedSet::IdentifierSequencedSet): (KJS::IdentifierSequencedSet::deallocateVector): (KJS::IdentifierSequencedSet::~IdentifierSequencedSet): (KJS::IdentifierSequencedSet::insert):
  • kjs/IdentifierSequencedSet.h: Added. (KJS::IdentifierSequencedSetIterator::IdentifierSequencedSetIterator): (KJS::IdentifierSequencedSetIterator::operator*): (KJS::IdentifierSequencedSetIterator::operator->): (KJS::IdentifierSequencedSetIterator::operator++): (KJS::IdentifierSequencedSetIterator::operator==): (KJS::IdentifierSequencedSetIterator::operator!=): (KJS::IdentifierSequencedSet::begin): (KJS::IdentifierSequencedSet::end): (KJS::IdentifierSequencedSet::size):
  • kjs/array_instance.h:
  • kjs/array_object.cpp: (ArrayInstanceImp::getPropertyNames): (ArrayInstanceImp::setLength): (ArrayInstanceImp::pushUndefinedObjectsToEnd):
  • kjs/nodes.cpp: (ForInNode::execute):
  • kjs/nodes.h:
  • kjs/object.cpp: (KJS::ObjectImp::getPropertyNames):
  • kjs/object.h:
  • kjs/property_map.cpp: (KJS::PropertyMap::getEnumerablePropertyNames): (KJS::PropertyMap::getSparseArrayPropertyNames):
  • kjs/property_map.h:
  • kjs/protect.h:
  • kjs/protected_reference.h: Removed.
  • kjs/reference.cpp: Removed.
  • kjs/reference.h: Removed.
  • kjs/reference_list.cpp: Removed.
  • kjs/reference_list.h: Removed.
  • kjs/ustring.h: (KJS::UString::impl):
  • kxmlcore/HashSet.h:

LayoutTests:

Reviewed by Eric.

  • test case for some fixes I made to for..in enumeration. object properties now come before prototype properties and duplicates between object and prototype are listed only once.
  • fast/js/for-in-expected.txt: Added.
  • fast/js/for-in.html: Added.
File:
1 edited

Legend:

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

    r10728 r10744  
    2929#include "interpreter.h"
    3030#include "lookup.h"
    31 #include "reference_list.h"
     31#include "IdentifierSequencedSet.h"
    3232
    3333#include <assert.h>
     
    375375}
    376376
    377 ReferenceList ObjectImp::propList(ExecState *exec, bool recursive)
    378 {
    379   ReferenceList list;
    380   if (_proto->isObject() && recursive)
    381     list = static_cast<ObjectImp*>(_proto)->propList(exec,recursive);
    382 
    383   _prop.addEnumerablesToReferenceList(list, this);
     377void ObjectImp::getPropertyNames(ExecState *exec, IdentifierSequencedSet &propertyNames)
     378{
     379  _prop.getEnumerablePropertyNames(propertyNames);
    384380
    385381  // Add properties from the static hashtable of properties
     
    390386      const HashEntry *e = info->propHashTable->entries;
    391387      for (int i = 0; i < size; ++i, ++e) {
    392         if ( e->s && !(e->attr & DontEnum) )
    393           list.append(Reference(this, e->s)); /// ######### check for duplicates with the propertymap
     388        if (e->s && !(e->attr & DontEnum))
     389          propertyNames.insert(e->s);
    394390      }
    395391    }
     
    397393  }
    398394
    399   return list;
     395  if (_proto->isObject())
     396    static_cast<ObjectImp*>(_proto)->getPropertyNames(exec, propertyNames);
    400397}
    401398
Note: See TracChangeset for help on using the changeset viewer.