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/property_map.cpp

    r10701 r10744  
    2626#include "object.h"
    2727#include "protect.h"
    28 #include "reference_list.h"
     28#include "IdentifierSequencedSet.h"
    2929
    3030#include <algorithm>
     
    7575
    7676// lastIndexUsed is an ever-increasing index used to identify the order items
    77 // were inserted into the property map. It's vital that addEnumerablesToReferenceList
     77// were inserted into the property map. It's vital that getEnumerablePropertyNames
    7878// return the properties in the order they were added for compatibility with other
    7979// browsers' JavaScript implementations.
     
    567567}
    568568
    569 void PropertyMap::addEnumerablesToReferenceList(ReferenceList &list, ObjectImp *base) const
     569void PropertyMap::getEnumerablePropertyNames(IdentifierSequencedSet& propertyNames) const
    570570{
    571571    if (!_table) {
     
    573573        UString::Rep *key = _singleEntry.key;
    574574        if (key && !(_singleEntry.attributes & DontEnum))
    575             list.append(Reference(base, Identifier(key)));
     575            propertyNames.insert(Identifier(key));
    576576#endif
    577577        return;
     
    599599    qsort(sortedEnumerables, p - sortedEnumerables, sizeof(sortedEnumerables[0]), comparePropertyMapEntryIndices);
    600600
    601     // Put the keys of the sorted entries into the reference list.
     601    // Put the keys of the sorted entries into the list.
    602602    Entry **q = sortedEnumerables;
    603     while (q != p)
    604         list.append(Reference(base, Identifier((*q++)->key)));
     603    while (q != p) {
     604        propertyNames.insert(Identifier(q[0]->key));
     605        ++q;
     606    }
    605607
    606608    // Deallocate the buffer.
     
    609611}
    610612
    611 void PropertyMap::addSparseArrayPropertiesToReferenceList(ReferenceList &list, ObjectImp *base) const
     613void PropertyMap::getSparseArrayPropertyNames(IdentifierSequencedSet& propertyNames) const
    612614{
    613615    if (!_table) {
     
    619621            k.toUInt32(&fitsInUInt32);
    620622            if (fitsInUInt32)
    621                 list.append(Reference(base, Identifier(key)));
     623                propertyNames.insert(Identifier(key));
    622624        }
    623625#endif
     
    634636            k.toUInt32(&fitsInUInt32);
    635637            if (fitsInUInt32)
    636                 list.append(Reference(base, Identifier(key)));
     638                propertyNames.insert(Identifier(key));
    637639        }
    638640    }
Note: See TracChangeset for help on using the changeset viewer.