Changeset 36125 in webkit for trunk/JavaScriptCore


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.
Location:
trunk/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r36124 r36125  
    112008-09-05  Darin Adler  <[email protected]>
    22
    3         Reviewed by Geoff Garen.
     3        Reviewed by Cameron Zwarich.
     4
     5        - https://bugs.webkit.org/show_bug.cgi?id=20681
     6          JSPropertyNameIterator functions need to be inlined
     7
     8        1.007x as fast on SunSpider overall
     9        1.081x as fast on SunSpider math-cordic
     10
     11        * VM/JSPropertyNameIterator.cpp: Moved functions out of here.
     12        * VM/JSPropertyNameIterator.h:
     13        (KJS::JSPropertyNameIterator::JSPropertyNameIterator): Moved
     14        this into the header and marked it inline.
     15        (KJS::JSPropertyNameIterator::create): Ditto.
     16        (KJS::JSPropertyNameIterator::next): Ditto.
     17
     182008-09-05  Darin Adler  <[email protected]>
     19
     20        Reviewed by Geoffrey Garen.
    421
    522        - fix https://bugs.webkit.org/show_bug.cgi?id=20673
     
    724
    825        1.007x as fast on SunSpider overall
    9         1.167x as fast on SunSpider string/fasta
     26        1.167x as fast on SunSpider string-fasta
    1027
    1128        * JavaScriptCore.exp: Updated.
  • trunk/JavaScriptCore/VM/JSPropertyNameIterator.cpp

    r35830 r36125  
    3030#include "JSPropertyNameIterator.h"
    3131
    32 #include "JSObject.h"
    33 #include "JSString.h"
    34 #include "PropertyNameArray.h"
    35 #include "identifier.h"
    36 
    3732namespace KJS {
    3833
    3934ASSERT_CLASS_FITS_IN_CELL(JSPropertyNameIterator);
    40 
    41 JSPropertyNameIterator* JSPropertyNameIterator::create(ExecState* exec, JSValue* v)
    42 {
    43     if (v->isUndefinedOrNull())
    44         return new (exec) JSPropertyNameIterator(0, 0, 0);
    45 
    46     JSObject* o = v->toObject(exec);
    47     PropertyNameArray propertyNames(exec);
    48     o->getPropertyNames(exec, propertyNames);
    49     size_t numProperties = propertyNames.size();
    50     return new (exec) JSPropertyNameIterator(o, propertyNames.releaseIdentifiers(), numProperties);
    51 }
    52 
    53 JSPropertyNameIterator::JSPropertyNameIterator(JSObject* object, Identifier* propertyNames, size_t numProperties)
    54     : m_object(object)
    55     , m_propertyNames(propertyNames)
    56     , m_position(propertyNames)
    57     , m_end(propertyNames + numProperties)
    58 {
    59 }
    6035
    6136JSPropertyNameIterator::~JSPropertyNameIterator()
     
    10782}
    10883
    109 JSValue* JSPropertyNameIterator::next(ExecState* exec)
    110 {
    111     while (m_position != m_end) {
    112         if (m_object->hasProperty(exec, *m_position))
    113             return jsOwnedString(exec, (*m_position++).ustring());;
    114         m_position++;
    115     }
    116     invalidate();
    117     return 0;
    118 }
    119 
    12084void JSPropertyNameIterator::invalidate()
    12185{
  • 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.