Ignore:
Timestamp:
Sep 5, 2008, 9:59:53 PM (17 years ago)
Author:
Darin Adler
Message:

2008-09-05 Darin Adler <Darin Adler>

Reviewed by Cameron Zwarich.

1.007x as fast on SunSpider overall
1.081x as fast on SunSpider math-cordic

  • VM/JSPropertyNameIterator.cpp: Moved functions out of here.
  • VM/JSPropertyNameIterator.h: (KJS::JSPropertyNameIterator::JSPropertyNameIterator): Moved this into the header and marked it inline. (KJS::JSPropertyNameIterator::create): Ditto. (KJS::JSPropertyNameIterator::next): Ditto.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/VM/JSPropertyNameIterator.h

    r35830 r36125  
    3030#define JSPropertyNameIterator_h
    3131
    32 #include "JSCell.h"
     32#include "JSObject.h"
     33#include "JSString.h"
     34#include "PropertyNameArray.h"
    3335
    3436namespace KJS {
     
    6466    };
    6567
     68inline JSPropertyNameIterator::JSPropertyNameIterator(JSObject* object, Identifier* propertyNames, size_t numProperties)
     69    : m_object(object)
     70    , m_propertyNames(propertyNames)
     71    , m_position(propertyNames)
     72    , m_end(propertyNames + numProperties)
     73{
     74}
     75
     76inline JSPropertyNameIterator* JSPropertyNameIterator::create(ExecState* exec, JSValue* v)
     77{
     78    if (v->isUndefinedOrNull())
     79        return new (exec) JSPropertyNameIterator(0, 0, 0);
     80
     81    JSObject* o = v->toObject(exec);
     82    PropertyNameArray propertyNames(exec);
     83    o->getPropertyNames(exec, propertyNames);
     84    size_t numProperties = propertyNames.size();
     85    return new (exec) JSPropertyNameIterator(o, propertyNames.releaseIdentifiers(), numProperties);
     86}
     87
     88inline JSValue* JSPropertyNameIterator::next(ExecState* exec)
     89{
     90    while (m_position != m_end) {
     91        if (m_object->hasProperty(exec, *m_position))
     92            return jsOwnedString(exec, (*m_position++).ustring());
     93        m_position++;
     94    }
     95    invalidate();
     96    return 0;
     97}
     98
    6699} // namespace KJS
    67100
Note: See TracChangeset for help on using the changeset viewer.