Changeset 14951 in webkit for trunk/JavaScriptCore/kjs
- Timestamp:
- Jun 21, 2006, 2:09:19 PM (19 years ago)
- Location:
- trunk/JavaScriptCore/kjs
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/array_instance.h
r12317 r14951 40 40 virtual bool deleteProperty(ExecState *exec, const Identifier &propertyName); 41 41 virtual bool deleteProperty(ExecState *exec, unsigned propertyName); 42 virtual ReferenceList propList(ExecState *exec, bool recursive);42 virtual void getPropertyList(ExecState*, ReferenceList& propertyList, bool recursive); 43 43 44 44 virtual void mark(); -
trunk/JavaScriptCore/kjs/array_object.cpp
r14821 r14951 199 199 } 200 200 201 ReferenceList ArrayInstance::propList(ExecState *exec, bool recursive) 202 { 203 ReferenceList properties = JSObject::propList(exec,recursive); 204 201 void ArrayInstance::getPropertyList(ExecState* exec, ReferenceList& propertyList, bool recursive) 202 { 205 203 // avoid fetching this every time through the loop 206 204 JSValue *undefined = jsUndefined(); … … 210 208 JSValue *imp = storage[i]; 211 209 if (imp && imp != undefined) { 212 propert ies.append(Reference(this, i));213 } 214 } 215 return properties;210 propertyList.append(Reference(this, i)); 211 } 212 } 213 return JSObject::getPropertyList(exec, propertyList, recursive); 216 214 } 217 215 -
trunk/JavaScriptCore/kjs/interpreter.cpp
r14913 r14951 421 421 } 422 422 423 Completion Interpreter::evaluate(const UString& sourceURL, int startingLineNumber, const UString& code, JSValue* )424 { 425 return evaluate(sourceURL, startingLineNumber, code.data(), code.size() );423 Completion Interpreter::evaluate(const UString& sourceURL, int startingLineNumber, const UString& code, JSValue* thisV) 424 { 425 return evaluate(sourceURL, startingLineNumber, code.data(), code.size(), thisV); 426 426 } 427 427 -
trunk/JavaScriptCore/kjs/nodes.cpp
r14893 r14951 1859 1859 JSObject *v; 1860 1860 Completion c; 1861 ReferenceList prop List;1861 ReferenceList propertyList; 1862 1862 1863 1863 if (varDecl) { … … 1878 1878 KJS_CHECKEXCEPTION 1879 1879 v = e->toObject(exec); 1880 propList = v->propList(exec);1881 1882 ReferenceListIterator propIt = prop List.begin();1883 1884 while (propIt != prop List.end()) {1880 v->getPropertyList(exec, propertyList); 1881 1882 ReferenceListIterator propIt = propertyList.begin(); 1883 1884 while (propIt != propertyList.end()) { 1885 1885 Identifier name = propIt->getPropertyName(exec); 1886 1886 if (!v->hasProperty(exec, name)) { -
trunk/JavaScriptCore/kjs/object.cpp
r13821 r14951 237 237 obj = this; 238 238 while (true) { 239 intattributes;239 unsigned attributes; 240 240 if (JSValue *gs = obj->_prop.get(propertyName, attributes)) { 241 241 if (attributes & GetterSetter) { … … 278 278 bool JSObject::canPut(ExecState *, const Identifier &propertyName) const 279 279 { 280 intattributes;280 unsigned attributes; 281 281 282 282 // Don't look in the prototype here. We can always put an override … … 305 305 bool JSObject::deleteProperty(ExecState */*exec*/, const Identifier &propertyName) 306 306 { 307 intattributes;307 unsigned attributes; 308 308 JSValue *v = _prop.get(propertyName, attributes); 309 309 if (v) { … … 453 453 bool JSObject::propertyIsEnumerable(ExecState*, const Identifier& propertyName) const 454 454 { 455 intattributes;455 unsigned attributes; 456 456 457 457 if (!getPropertyAttributes(propertyName, attributes)) … … 461 461 } 462 462 463 bool JSObject::getPropertyAttributes(const Identifier& propertyName, int& attributes) const463 bool JSObject::getPropertyAttributes(const Identifier& propertyName, unsigned& attributes) const 464 464 { 465 465 if (_prop.get(propertyName, attributes)) … … 476 476 } 477 477 478 ReferenceList JSObject::propList(ExecState *exec, bool recursive) 479 { 480 ReferenceList list; 481 if (_proto->isObject() && recursive) 482 list = static_cast<JSObject*>(_proto)->propList(exec,recursive); 483 484 _prop.addEnumerablesToReferenceList(list, this); 478 void JSObject::getPropertyList(ExecState *exec, ReferenceList& propertyList, bool recursive) 479 { 480 _prop.addEnumerablesToReferenceList(propertyList, this); 485 481 486 482 // Add properties from the static hashtable of properties … … 492 488 for (int i = 0; i < size; ++i, ++e) { 493 489 if ( e->s && !(e->attr & DontEnum) ) 494 list.append(Reference(this, e->s)); /// ######### check for duplicates with the propertymap490 propertyList.append(Reference(this, e->s)); /// ######### check for duplicates with the propertymap 495 491 } 496 492 } 497 493 info = info->parentClass; 498 494 } 499 500 return list;495 if (_proto->isObject() && recursive) 496 static_cast<JSObject*>(_proto)->getPropertyList(exec, propertyList, recursive); 501 497 } 502 498 -
trunk/JavaScriptCore/kjs/object.h
r14256 r14951 457 457 * @return A List of References to properties of the object. 458 458 **/ 459 virtual ReferenceList propList(ExecState *exec, bool recursive = true);459 virtual void getPropertyList(ExecState *exec, ReferenceList& propertyList, bool recursive = true); 460 460 461 461 /** … … 478 478 void setInternalValue(JSValue *v); 479 479 480 JSValue *toPrimitive(ExecState *exec, JSType preferredType = UnspecifiedType) const;481 bool toBoolean(ExecState *exec) const;482 double toNumber(ExecState *exec) const;483 UString toString(ExecState *exec) const;484 JSObject *toObject(ExecState *exec) const;480 virtual JSValue *toPrimitive(ExecState *exec, JSType preferredType = UnspecifiedType) const; 481 virtual bool toBoolean(ExecState *exec) const; 482 virtual double toNumber(ExecState *exec) const; 483 virtual UString toString(ExecState *exec) const; 484 virtual JSObject *toObject(ExecState *exec) const; 485 485 486 bool getPropertyAttributes(const Identifier& propertyName, int& attributes) const;486 bool getPropertyAttributes(const Identifier& propertyName, unsigned& attributes) const; 487 487 488 488 // Returns whether the object should be treated as undefined when doing equality comparisons -
trunk/JavaScriptCore/kjs/property_map.cpp
r14256 r14951 160 160 } 161 161 162 JSValue *PropertyMap::get(const Identifier &name, int&attributes) const162 JSValue *PropertyMap::get(const Identifier &name, unsigned &attributes) const 163 163 { 164 164 assert(!name.isNull()); -
trunk/JavaScriptCore/kjs/property_map.h
r14256 r14951 77 77 void remove(const Identifier &name); 78 78 JSValue *get(const Identifier &name) const; 79 JSValue *get(const Identifier &name, int&attributes) const;79 JSValue *get(const Identifier &name, unsigned &attributes) const; 80 80 JSValue **getLocation(const Identifier &name); 81 81 -
trunk/JavaScriptCore/kjs/scope_chain.cpp
r13960 r14951 43 43 for (ScopeChainIterator scopeIter = begin(); scopeIter != scopeEnd; ++scopeIter) { 44 44 JSObject* o = *scopeIter; 45 ReferenceList propList = o->propList(exec, false); 46 ReferenceListIterator propEnd = propList.end(); 45 ReferenceList propertyList; 46 o->getPropertyList(exec, propertyList, false); 47 ReferenceListIterator propEnd = propertyList.end(); 47 48 48 49 fprintf(stderr, "----- [scope %p] -----\n", o); 49 for (ReferenceListIterator propIter = prop List.begin(); propIter != propEnd; propIter++) {50 for (ReferenceListIterator propIter = propertyList.begin(); propIter != propEnd; propIter++) { 50 51 Identifier name = propIter->getPropertyName(exec); 51 52 fprintf(stderr, "%s, ", name.ascii()); -
trunk/JavaScriptCore/kjs/string_object.cpp
r14821 r14951 95 95 } 96 96 97 ReferenceList StringInstance::propList(ExecState *exec, bool recursive) 98 { 99 ReferenceList properties = JSObject::propList(exec,recursive); 100 97 void StringInstance::getPropertyList(ExecState *exec, ReferenceList& propertyList, bool recursive) 98 { 101 99 //### FIXME: should avoid duplicates with prototype 102 100 UString str = internalValue()->toString(exec); 103 101 for (int i = 0; i < str.size(); i++) 104 propert ies.append(Reference(this, i));105 return properties;102 propertyList.append(Reference(this, i)); 103 return JSObject::getPropertyList(exec, propertyList, recursive); 106 104 } 107 105 -
trunk/JavaScriptCore/kjs/string_object.h
r13821 r14951 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 ReferenceList propList(ExecState *exec, bool recursive);37 virtual void getPropertyList(ExecState *exec, ReferenceList& propertyList, bool recursive); 38 38 39 39 virtual const ClassInfo *classInfo() const { return &info; } -
trunk/JavaScriptCore/kjs/ustring.h
r14734 r14951 193 193 static unsigned computeHash(const char *); 194 194 195 void ref() { ++rc; }195 Rep* ref() { ++rc; return this; } 196 196 void deref() { if (--rc == 0) destroy(); } 197 197
Note:
See TracChangeset
for help on using the changeset viewer.