Changeset 97015 in webkit for trunk/Source/JavaScriptCore/runtime/JSFunction.cpp
- Timestamp:
- Oct 8, 2011, 2:31:32 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/runtime/JSFunction.cpp
r97006 r97015 205 205 bool JSFunction::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) 206 206 { 207 if (isHostFunction()) 208 return Base::getOwnPropertySlot(exec, propertyName, slot); 207 return getOwnPropertySlot(this, exec, propertyName, slot); 208 } 209 210 bool JSFunction::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) 211 { 212 JSFunction* thisObject = static_cast<JSFunction*>(cell); 213 if (thisObject->isHostFunction()) 214 return Base::getOwnPropertySlot(thisObject, exec, propertyName, slot); 209 215 210 216 if (propertyName == exec->propertyNames().prototype) { 211 WriteBarrierBase<Unknown>* location = getDirectLocation(exec->globalData(), propertyName);217 WriteBarrierBase<Unknown>* location = thisObject->getDirectLocation(exec->globalData(), propertyName); 212 218 213 219 if (!location) { 214 JSObject* prototype = constructEmptyObject(exec, globalObject()->emptyObjectStructure());215 prototype->putDirect(exec->globalData(), exec->propertyNames().constructor, this , DontEnum);220 JSObject* prototype = constructEmptyObject(exec, thisObject->globalObject()->emptyObjectStructure()); 221 prototype->putDirect(exec->globalData(), exec->propertyNames().constructor, thisObject, DontEnum); 216 222 PutPropertySlot slot; 217 putDirect(exec->globalData(), exec->propertyNames().prototype, prototype, DontDelete | DontEnum, false, slot);218 location = getDirectLocation(exec->globalData(), exec->propertyNames().prototype);219 } 220 221 slot.setValue(this , location->get(),offsetForLocation(location));223 thisObject->putDirect(exec->globalData(), exec->propertyNames().prototype, prototype, DontDelete | DontEnum, false, slot); 224 location = thisObject->getDirectLocation(exec->globalData(), exec->propertyNames().prototype); 225 } 226 227 slot.setValue(thisObject, location->get(), thisObject->offsetForLocation(location)); 222 228 } 223 229 224 230 if (propertyName == exec->propertyNames().arguments) { 225 if ( jsExecutable()->isStrictMode()) {231 if (thisObject->jsExecutable()->isStrictMode()) { 226 232 throwTypeError(exec, StrictModeArgumentsAccessError); 227 233 slot.setValue(jsNull()); … … 229 235 } 230 236 231 slot.setCacheableCustom(this , argumentsGetter);237 slot.setCacheableCustom(thisObject, argumentsGetter); 232 238 return true; 233 239 } 234 240 235 241 if (propertyName == exec->propertyNames().length) { 236 slot.setCacheableCustom(this , lengthGetter);242 slot.setCacheableCustom(thisObject, lengthGetter); 237 243 return true; 238 244 } 239 245 240 246 if (propertyName == exec->propertyNames().caller) { 241 if ( jsExecutable()->isStrictMode()) {247 if (thisObject->jsExecutable()->isStrictMode()) { 242 248 throwTypeError(exec, StrictModeCallerAccessError); 243 249 slot.setValue(jsNull()); 244 250 return true; 245 251 } 246 slot.setCacheableCustom(this , callerGetter);247 return true; 248 } 249 250 return Base::getOwnPropertySlot( exec, propertyName, slot);252 slot.setCacheableCustom(thisObject, callerGetter); 253 return true; 254 } 255 256 return Base::getOwnPropertySlot(thisObject, exec, propertyName, slot); 251 257 } 252 258
Note:
See TracChangeset
for help on using the changeset viewer.