Changeset 15385 in webkit for trunk/JavaScriptCore
- Timestamp:
- Jul 12, 2006, 3:01:06 AM (19 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/API/JSCallbackObject.cpp
r15384 r15385 288 288 } 289 289 290 void JSCallbackObject::getPropertyList(ExecState* exec, ReferenceList& propertyList, bool recursive) 291 { 292 JSContextRef context = toRef(exec); 290 void JSCallbackObject::getPropertyList(ReferenceList& propertyList, bool recursive) 291 { 293 292 JSObjectRef thisRef = toRef(this); 294 293 295 294 for (JSClassRef jsClass = m_class; jsClass; jsClass = jsClass->parent) { 296 295 if (JSObjectAddPropertiesToListCallback addPropertiesToList = jsClass->callbacks.addPropertiesToList) 297 addPropertiesToList( context, thisRef, toRef(&propertyList), toRef(exec->exceptionSlot()));296 addPropertiesToList(thisRef, toRef(&propertyList)); 298 297 299 298 if (__JSClass::StaticValuesTable* staticValues = jsClass->staticValues) { … … 320 319 } 321 320 322 JSObject::getPropertyList( exec,propertyList, recursive);321 JSObject::getPropertyList(propertyList, recursive); 323 322 } 324 323 -
trunk/JavaScriptCore/API/JSCallbackObject.h
r15384 r15385 61 61 virtual JSValue* callAsFunction(ExecState*, JSObject* thisObj, const List &args); 62 62 63 virtual void getPropertyList( ExecState*,ReferenceList& propertyList, bool recursive);63 virtual void getPropertyList(ReferenceList& propertyList, bool recursive); 64 64 65 65 virtual bool toBoolean(ExecState*) const; -
trunk/JavaScriptCore/API/JSObjectRef.cpp
r15376 r15385 272 272 }; 273 273 274 JSPropertyEnumeratorRef JSObjectCreatePropertyEnumerator(JSContextRef context, JSObjectRef object) 275 { 276 JSLock lock; 277 ExecState* exec = toJS(context); 274 JSPropertyEnumeratorRef JSObjectCreatePropertyEnumerator(JSObjectRef object) 275 { 276 JSLock lock; 278 277 JSObject* jsObject = toJS(object); 279 278 280 279 JSPropertyEnumeratorRef enumerator = new __JSPropertyEnumerator(); 281 jsObject->getPropertyList(e xec, enumerator->list);280 jsObject->getPropertyList(enumerator->list); 282 281 enumerator->iterator = enumerator->list.begin(); 283 282 -
trunk/JavaScriptCore/API/JSObjectRef.h
r15384 r15385 156 156 @typedef JSObjectAddPropertiesToListCallback 157 157 @abstract The callback invoked when adding an object's properties to a property list. 158 @param context The current execution context.159 158 @param object The JSObject whose properties need to be added to propertyList. 160 159 @param propertyList A JavaScript property list that will be used to enumerate object's properties. 161 @param exception A pointer to a JSValueRef in which to return an exception, if any.162 160 @discussion If you named your function GetPropertyList, you would declare it like this: 163 161 164 void AddPropertiesToList(JS ContextRef context, JSObjectRef object, JSPropertyListRef propertyList, JSValueRef* exception);162 void AddPropertiesToList(JSObjectRef object, JSPropertyListRef propertyList); 165 163 166 164 Use JSPropertyListAdd to add properties to propertyList. … … 169 167 */ 170 168 typedef void 171 (*JSObjectAddPropertiesToListCallback) (JS ContextRef context, JSObjectRef object, JSPropertyListRef propertyList, JSValueRef* exception);169 (*JSObjectAddPropertiesToListCallback) (JSObjectRef object, JSPropertyListRef propertyList); 172 170 173 171 /*! … … 261 259 @field setProperty The callback invoked when setting the value of a given property. 262 260 @field deleteProperty The callback invoked when deleting a given property. 263 @field getPropertyList The callback invoked when adding an object's properties to a property list.261 @field addPropertiesToList The callback invoked when adding an object's properties to a property list. 264 262 @field callAsFunction The callback invoked when an object is called as a function. 265 263 @field hasInstance The callback invoked when an object is used in an 'instanceof' expression. … … 507 505 @function 508 506 @abstract Creates an enumerator for an object's properties. 509 @param context The execution context to use.510 507 @param object The object whose properties you want to enumerate. 511 508 @result A JSPropertyEnumerator with a list of object's properties. Ownership follows the Create Rule. 512 509 */ 513 JSPropertyEnumeratorRef JSObjectCreatePropertyEnumerator(JS ContextRef context, JSObjectRef object);510 JSPropertyEnumeratorRef JSObjectCreatePropertyEnumerator(JSObjectRef object); 514 511 /*! 515 512 @function -
trunk/JavaScriptCore/API/testapi.c
r15384 r15385 163 163 } 164 164 165 static void MyObject_ getPropertyList(JSContextRef context, JSObjectRef object, JSPropertyListRef propertyList, JSValueRef* exception)165 static void MyObject_addPropertiesToList(JSObjectRef object, JSPropertyListRef propertyList) 166 166 { 167 167 UNUSED_PARAM(context); … … 246 246 MyObject_setProperty, 247 247 MyObject_deleteProperty, 248 MyObject_ getPropertyList,248 MyObject_addPropertiesToList, 249 249 MyObject_callAsFunction, 250 250 MyObject_callAsConstructor, … … 538 538 JSObjectSetProperty(context, o, jsOneIString, JSValueMakeNumber(1), kJSPropertyAttributeNone); 539 539 JSObjectSetProperty(context, o, jsCFIString, JSValueMakeNumber(1), kJSPropertyAttributeDontEnum); 540 JSPropertyEnumeratorRef enumerator = JSObjectCreatePropertyEnumerator( context,o);540 JSPropertyEnumeratorRef enumerator = JSObjectCreatePropertyEnumerator(o); 541 541 int count = 0; 542 542 while (JSPropertyEnumeratorGetNextName(enumerator)) -
trunk/JavaScriptCore/ChangeLog
r15384 r15385 1 2006-07-12 Geoffrey Garen <[email protected]> 2 3 Reviewed by Maciej. 4 5 - Removed context and exception parameters from JSObjectGetPropertyEnumerator, 6 removing the spurious use of ExecState inside JavaScriptCore that made 7 us think this was necessary in the first place. 8 9 (StringInstance::getPropertyList): Use getString instead of toString because 10 we know we're dealing with a string -- we put it there in the first place. 11 While we're at it, store the string's size instead of retrieving it each time 12 through the loop, to avoid the unnecessary killing of puppies. 13 * kjs/string_object.h: 14 1 15 2006-07-12 Maciej Stachowiak <[email protected]> 2 16 -
trunk/JavaScriptCore/JavaScriptCore.exp
r15376 r15385 187 187 __ZN3KJS8JSObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE 188 188 __ZN3KJS8JSObject14deletePropertyEPNS_9ExecStateEj 189 __ZN3KJS8JSObject15getPropertyListE PNS_9ExecStateERNS_13ReferenceListEb189 __ZN3KJS8JSObject15getPropertyListERNS_13ReferenceListEb 190 190 __ZN3KJS8JSObject18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE 191 191 __ZN3KJS8JSObject22fillGetterPropertySlotERNS_12PropertySlotEPPNS_7JSValueE -
trunk/JavaScriptCore/kjs/array_instance.h
r14951 r15385 40 40 virtual bool deleteProperty(ExecState *exec, const Identifier &propertyName); 41 41 virtual bool deleteProperty(ExecState *exec, unsigned propertyName); 42 virtual void getPropertyList( ExecState*,ReferenceList& propertyList, bool recursive);42 virtual void getPropertyList(ReferenceList& propertyList, bool recursive); 43 43 44 44 virtual void mark(); -
trunk/JavaScriptCore/kjs/array_object.cpp
r15225 r15385 200 200 } 201 201 202 void ArrayInstance::getPropertyList( ExecState* exec,ReferenceList& propertyList, bool recursive)202 void ArrayInstance::getPropertyList(ReferenceList& propertyList, bool recursive) 203 203 { 204 204 // avoid fetching this every time through the loop … … 212 212 } 213 213 } 214 return JSObject::getPropertyList( exec,propertyList, recursive);214 return JSObject::getPropertyList(propertyList, recursive); 215 215 } 216 216 -
trunk/JavaScriptCore/kjs/nodes.cpp
r15225 r15385 1879 1879 KJS_CHECKEXCEPTION 1880 1880 v = e->toObject(exec); 1881 v->getPropertyList( exec,propertyList);1881 v->getPropertyList(propertyList); 1882 1882 1883 1883 ReferenceListIterator propIt = propertyList.begin(); -
trunk/JavaScriptCore/kjs/object.cpp
r15224 r15385 476 476 } 477 477 478 void JSObject::getPropertyList( ExecState *exec,ReferenceList& propertyList, bool recursive)478 void JSObject::getPropertyList(ReferenceList& propertyList, bool recursive) 479 479 { 480 480 _prop.addEnumerablesToReferenceList(propertyList, this); … … 494 494 } 495 495 if (_proto->isObject() && recursive) 496 static_cast<JSObject*>(_proto)->getPropertyList( exec,propertyList, recursive);496 static_cast<JSObject*>(_proto)->getPropertyList(propertyList, recursive); 497 497 } 498 498 -
trunk/JavaScriptCore/kjs/object.h
r15310 r15385 457 457 * @return A List of References to properties of the object. 458 458 **/ 459 virtual void getPropertyList( ExecState *exec,ReferenceList& propertyList, bool recursive = true);459 virtual void getPropertyList(ReferenceList& propertyList, bool recursive = true); 460 460 461 461 /** -
trunk/JavaScriptCore/kjs/scope_chain.cpp
r15225 r15385 38 38 #ifndef NDEBUG 39 39 40 void ScopeChain::print( ExecState* exec)40 void ScopeChain::print() 41 41 { 42 42 ScopeChainIterator scopeEnd = end(); … … 44 44 JSObject* o = *scopeIter; 45 45 ReferenceList propertyList; 46 o->getPropertyList( exec,propertyList, false);46 o->getPropertyList(propertyList, false); 47 47 ReferenceListIterator propEnd = propertyList.end(); 48 48 -
trunk/JavaScriptCore/kjs/scope_chain.h
r13960 r15385 83 83 84 84 #ifndef NDEBUG 85 void print( ExecState*);85 void print(); 86 86 #endif 87 87 -
trunk/JavaScriptCore/kjs/string_object.cpp
r14951 r15385 95 95 } 96 96 97 void StringInstance::getPropertyList( ExecState *exec,ReferenceList& propertyList, bool recursive)97 void StringInstance::getPropertyList(ReferenceList& propertyList, bool recursive) 98 98 { 99 99 //### FIXME: should avoid duplicates with prototype 100 UString str = internalValue()->toString(exec);101 for (int i = 0; i < s tr.size(); i++)100 int size = internalValue()->getString().size(); 101 for (int i = 0; i < size; i++) 102 102 propertyList.append(Reference(this, i)); 103 return JSObject::getPropertyList( exec,propertyList, recursive);103 return JSObject::getPropertyList(propertyList, recursive); 104 104 } 105 105 -
trunk/JavaScriptCore/kjs/string_object.h
r14951 r15385 35 35 virtual void put(ExecState *exec, const Identifier &propertyName, JSValue *value, int attr = None); 36 36 virtual bool deleteProperty(ExecState *exec, const Identifier &propertyName); 37 virtual void getPropertyList( ExecState *exec,ReferenceList& propertyList, bool recursive);37 virtual void getPropertyList(ReferenceList& propertyList, bool recursive); 38 38 39 39 virtual const ClassInfo *classInfo() const { return &info; }
Note:
See TracChangeset
for help on using the changeset viewer.