Changeset 169815 in webkit for trunk/Source/JavaScriptCore/runtime/JSObject.h
- Timestamp:
- Jun 11, 2014, 11:40:13 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/runtime/JSObject.h
r169703 r169815 32 32 #include "CommonIdentifiers.h" 33 33 #include "CopyWriteBarrier.h" 34 #include "CustomGetterSetter.h" 34 35 #include "DeferGC.h" 35 36 #include "Heap.h" … … 958 959 bool putDirectInternal(VM&, PropertyName, JSValue, unsigned attr, PutPropertySlot&, JSCell*); 959 960 960 bool inlineGetOwnPropertySlot( ExecState*,VM&, Structure&, PropertyName, PropertySlot&);961 bool inlineGetOwnPropertySlot(VM&, Structure&, PropertyName, PropertySlot&); 961 962 JS_EXPORT_PRIVATE void fillGetterPropertySlot(PropertySlot&, JSValue, unsigned, PropertyOffset); 962 JS_EXPORT_PRIVATE void fillCustomGetterPropertySlot(PropertySlot&, JSValue, unsigned);963 void fillCustomGetterPropertySlot(PropertySlot&, JSValue, unsigned, Structure&); 963 964 964 965 const HashTableValue* findPropertyHashEntry(VM&, PropertyName) const; … … 973 974 unsigned getNewVectorLength(unsigned desiredLength); 974 975 975 bool getOwnPropertySlotSlow(ExecState*, PropertyName, PropertySlot&);976 977 976 ArrayStorage* constructConvertedArrayStorageWithoutCopyingElements(VM&, unsigned neededLength); 978 977 … … 1213 1212 } 1214 1213 1215 ALWAYS_INLINE bool JSObject::inlineGetOwnPropertySlot( ExecState* exec,VM& vm, Structure& structure, PropertyName propertyName, PropertySlot& slot)1214 ALWAYS_INLINE bool JSObject::inlineGetOwnPropertySlot(VM& vm, Structure& structure, PropertyName propertyName, PropertySlot& slot) 1216 1215 { 1217 1216 unsigned attributes; 1218 1217 JSCell* specific; 1219 1218 PropertyOffset offset = structure.get(vm, propertyName, attributes, specific); 1220 if (LIKELY(isValidOffset(offset))) { 1221 JSValue value = getDirect(offset); 1222 if (structure.hasGetterSetterProperties() && value.isGetterSetter()) 1223 fillGetterPropertySlot(slot, value, attributes, offset); 1224 else if (structure.hasCustomGetterSetterProperties() && value.isCustomGetterSetter()) 1225 fillCustomGetterPropertySlot(slot, value, attributes); 1226 else 1227 slot.setValue(this, attributes, value, offset); 1228 return true; 1229 } 1230 1231 return getOwnPropertySlotSlow(exec, propertyName, slot); 1232 } 1233 1234 inline bool JSObject::getOwnPropertySlotSlow(ExecState* exec, PropertyName propertyName, PropertySlot& slot) 1235 { 1236 unsigned i = propertyName.asIndex(); 1237 if (i != PropertyName::NotAnIndex) 1238 return getOwnPropertySlotByIndex(this, exec, i, slot); 1239 return false; 1219 if (!isValidOffset(offset)) 1220 return false; 1221 1222 JSValue value = getDirect(offset); 1223 if (structure.hasGetterSetterProperties() && value.isGetterSetter()) 1224 fillGetterPropertySlot(slot, value, attributes, offset); 1225 else if (structure.hasCustomGetterSetterProperties() && value.isCustomGetterSetter()) 1226 fillCustomGetterPropertySlot(slot, value, attributes, structure); 1227 else 1228 slot.setValue(this, attributes, value, offset); 1229 1230 return true; 1231 } 1232 1233 ALWAYS_INLINE void JSObject::fillCustomGetterPropertySlot(PropertySlot& slot, JSValue customGetterSetter, unsigned attributes, Structure& structure) 1234 { 1235 if (structure.isDictionary()) { 1236 slot.setCustom(this, attributes, jsCast<CustomGetterSetter*>(customGetterSetter)->getter()); 1237 return; 1238 } 1239 slot.setCacheableCustom(this, attributes, jsCast<CustomGetterSetter*>(customGetterSetter)->getter()); 1240 1240 } 1241 1241 … … 1247 1247 VM& vm = exec->vm(); 1248 1248 Structure& structure = *object->structure(vm); 1249 return object->inlineGetOwnPropertySlot(exec, vm, structure, propertyName, slot); 1249 if (object->inlineGetOwnPropertySlot(vm, structure, propertyName, slot)) 1250 return true; 1251 unsigned index = propertyName.asIndex(); 1252 if (index != PropertyName::NotAnIndex) 1253 return getOwnPropertySlotByIndex(object, exec, index, slot); 1254 return false; 1250 1255 } 1251 1256 … … 1253 1258 { 1254 1259 if (!TypeInfo::overridesGetOwnPropertySlot(inlineTypeFlags())) 1255 return asObject(this)->inlineGetOwnPropertySlot( exec,vm, structure, propertyName, slot);1260 return asObject(this)->inlineGetOwnPropertySlot(vm, structure, propertyName, slot); 1256 1261 return structure.classInfo()->methodTable.getOwnPropertySlot(this, exec, propertyName, slot); 1257 1262 } … … 1262 1267 { 1263 1268 VM& vm = exec->vm(); 1269 auto& structureIDTable = vm.heap.structureIDTable(); 1264 1270 JSObject* object = this; 1265 1271 while (true) { 1266 Structure& structure = * object->structure(vm);1272 Structure& structure = *structureIDTable.get(object->structureID()); 1267 1273 if (object->fastGetOwnPropertySlot(exec, vm, structure, propertyName, slot)) 1268 1274 return true; 1269 1275 JSValue prototype = structure.storedPrototype(); 1270 1276 if (!prototype.isObject()) 1271 return false;1277 break; 1272 1278 object = asObject(prototype); 1273 1279 } 1280 1281 unsigned index = propertyName.asIndex(); 1282 if (index != PropertyName::NotAnIndex) 1283 return getPropertySlot(exec, index, slot); 1284 return false; 1274 1285 } 1275 1286 … … 1277 1288 { 1278 1289 VM& vm = exec->vm(); 1290 auto& structureIDTable = vm.heap.structureIDTable(); 1279 1291 JSObject* object = this; 1280 1292 while (true) { 1281 Structure& structure = * object->structure(vm);1293 Structure& structure = *structureIDTable.get(object->structureID()); 1282 1294 if (structure.classInfo()->methodTable.getOwnPropertySlotByIndex(object, exec, propertyName, slot)) 1283 1295 return true;
Note:
See TracChangeset
for help on using the changeset viewer.