Changeset 10076 in webkit for trunk/JavaScriptCore/kjs/array_object.cpp
- Timestamp:
- Aug 6, 2005, 11:17:49 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/array_object.cpp
r9932 r10076 71 71 } 72 72 73 bool ArrayInstanceImp::getOwnProperty(ExecState *exec, const Identifier& propertyName, Value& result) const 73 Value ArrayInstanceImp::lengthGetter(ExecState *exec, const Identifier& propertyName, const PropertySlot& slot) 74 { 75 return Number(static_cast<ArrayInstanceImp *>(slot.slotBase())->length); 76 } 77 78 bool ArrayInstanceImp::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot) 74 79 { 75 80 if (propertyName == lengthPropertyName) { 76 result = Number(length);81 slot.setCustom(this, lengthGetter); 77 82 return true; 78 83 } … … 87 92 if (!v || v == UndefinedImp::staticUndefined) 88 93 return false; 89 90 result = Value(v);94 95 slot.setValueSlot(this, &storage[index]); 91 96 return true; 92 97 } 93 98 } 94 99 95 return ObjectImp::getOwnProperty (exec, propertyName, result);96 } 97 98 bool ArrayInstanceImp::getOwnProperty (ExecState *exec, unsigned index, Value& result) const100 return ObjectImp::getOwnPropertySlot(exec, propertyName, slot); 101 } 102 103 bool ArrayInstanceImp::getOwnPropertySlot(ExecState *exec, unsigned index, PropertySlot& slot) 99 104 { 100 105 if (index >= length) … … 104 109 if (!v || v == UndefinedImp::staticUndefined) 105 110 return false; 106 107 result = Value(v);111 112 slot.setValueSlot(this, &storage[index]); 108 113 return true; 109 114 } 110 111 return ObjectImp::getOwnProperty (exec, Identifier::from(index), result);115 116 return ObjectImp::getOwnPropertySlot(exec, index, slot); 112 117 } 113 118 … … 147 152 assert(index >= sparseArrayCutoff); 148 153 ObjectImp::put(exec, Identifier::from(index), value, attr); 149 }150 151 bool ArrayInstanceImp::hasOwnProperty(ExecState *exec, const Identifier &propertyName) const152 {153 if (propertyName == lengthPropertyName)154 return true;155 156 bool ok;157 unsigned index = propertyName.toArrayIndex(&ok);158 if (ok) {159 if (index >= length)160 return false;161 if (index < storageLength) {162 ValueImp *v = storage[index];163 return v && v != UndefinedImp::staticUndefined;164 }165 }166 167 return ObjectImp::hasOwnProperty(exec, propertyName);168 }169 170 bool ArrayInstanceImp::hasOwnProperty(ExecState *exec, unsigned index) const171 {172 if (index >= length)173 return false;174 if (index < storageLength) {175 ValueImp *v = storage[index];176 return v && v != UndefinedImp::staticUndefined;177 }178 179 return ObjectImp::hasOwnProperty(exec, Identifier::from(index));180 154 } 181 155 … … 429 403 } 430 404 431 bool ArrayPrototypeImp::getOwnProperty (ExecState *exec, const Identifier& propertyName, Value& result) const432 { 433 return lookupGetOwnFunction<ArrayProtoFuncImp, ArrayInstanceImp>(exec, propertyName, &arrayTable, this, result);405 bool ArrayPrototypeImp::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot) 406 { 407 return getStaticFunctionSlot<ArrayProtoFuncImp, ArrayInstanceImp>(exec, &arrayTable, this, propertyName, slot); 434 408 } 435 409
Note:
See TracChangeset
for help on using the changeset viewer.