Changeset 36125 in webkit for trunk/JavaScriptCore
- Timestamp:
- Sep 5, 2008, 9:59:53 PM (17 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r36124 r36125 1 1 2008-09-05 Darin Adler <[email protected]> 2 2 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 18 2008-09-05 Darin Adler <[email protected]> 19 20 Reviewed by Geoffrey Garen. 4 21 5 22 - fix https://bugs.webkit.org/show_bug.cgi?id=20673 … … 7 24 8 25 1.007x as fast on SunSpider overall 9 1.167x as fast on SunSpider string /fasta26 1.167x as fast on SunSpider string-fasta 10 27 11 28 * JavaScriptCore.exp: Updated. -
trunk/JavaScriptCore/VM/JSPropertyNameIterator.cpp
r35830 r36125 30 30 #include "JSPropertyNameIterator.h" 31 31 32 #include "JSObject.h"33 #include "JSString.h"34 #include "PropertyNameArray.h"35 #include "identifier.h"36 37 32 namespace KJS { 38 33 39 34 ASSERT_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 }60 35 61 36 JSPropertyNameIterator::~JSPropertyNameIterator() … … 107 82 } 108 83 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 120 84 void JSPropertyNameIterator::invalidate() 121 85 { -
trunk/JavaScriptCore/VM/JSPropertyNameIterator.h
r35830 r36125 30 30 #define JSPropertyNameIterator_h 31 31 32 #include "JSCell.h" 32 #include "JSObject.h" 33 #include "JSString.h" 34 #include "PropertyNameArray.h" 33 35 34 36 namespace KJS { … … 64 66 }; 65 67 68 inline 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 76 inline 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 88 inline 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 66 99 } // namespace KJS 67 100
Note:
See TracChangeset
for help on using the changeset viewer.