Changeset 95205 in webkit
- Timestamp:
- Sep 15, 2011 11:47:20 AM (13 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r95201 r95205 1 2011-09-15 Gavin Barraclough <barraclough@apple.com> 2 3 devirtualize preventExtensions 4 https://bugs.webkit.org/show_bug.cgi?id=68176 5 6 Reviewed by Oliver Hunt. 7 8 This is virtual due to problems in JSFunction putting the prototype 9 property, but we can fix this problem a different way, just setting 10 the checkReadOnly flag to false in the put. 11 12 * runtime/JSFunction.cpp: 13 (JSC::JSFunction::getOwnPropertySlot): 14 * runtime/JSFunction.h: 15 * runtime/JSObject.h: 16 1 17 2011-09-15 Geoffrey Garen <ggaren@apple.com> 2 18 -
trunk/Source/JavaScriptCore/runtime/JSFunction.cpp
r94701 r95205 176 176 } 177 177 178 static inline WriteBarrierBase<Unknown>* createPrototypeProperty(JSGlobalData& globalData, JSGlobalObject* globalObject, JSFunction* function)179 {180 ASSERT(!function->isHostFunction());181 182 ExecState* exec = globalObject->globalExec();183 if (WriteBarrierBase<Unknown>* location = function->getDirectLocation(globalData, exec->propertyNames().prototype))184 return location;185 JSObject* prototype = constructEmptyObject(exec, globalObject->emptyObjectStructure());186 prototype->putDirect(globalData, exec->propertyNames().constructor, function, DontEnum);187 function->putDirect(globalData, exec->propertyNames().prototype, prototype, DontDelete | DontEnum);188 return function->getDirectLocation(exec->globalData(), exec->propertyNames().prototype);189 }190 191 void JSFunction::preventExtensions(JSGlobalData& globalData)192 {193 if (!isHostFunction())194 createPrototypeProperty(globalData, scope()->globalObject.get(), this);195 JSObject::preventExtensions(globalData);196 }197 198 178 bool JSFunction::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) 199 179 { … … 204 184 WriteBarrierBase<Unknown>* location = getDirectLocation(exec->globalData(), propertyName); 205 185 206 if (!location) 207 location = createPrototypeProperty(exec->globalData(), scope()->globalObject.get(), this); 186 if (!location) { 187 JSObject* prototype = constructEmptyObject(exec, globalObject()->emptyObjectStructure()); 188 prototype->putDirect(exec->globalData(), exec->propertyNames().constructor, this, DontEnum); 189 PutPropertySlot slot; 190 putDirect(exec->globalData(), exec->propertyNames().prototype, prototype, DontDelete | DontEnum, false, slot); 191 location = getDirectLocation(exec->globalData(), exec->propertyNames().prototype); 192 } 208 193 209 194 slot.setValue(this, location->get(), offsetForLocation(location)); -
trunk/Source/JavaScriptCore/runtime/JSFunction.h
r94929 r95205 149 149 bool isHostFunctionNonInline() const; 150 150 151 virtual void preventExtensions(JSGlobalData&);152 151 virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); 153 152 virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&); -
trunk/Source/JavaScriptCore/runtime/JSObject.h
r95167 r95205 212 212 void seal(JSGlobalData&); 213 213 void freeze(JSGlobalData&); 214 v irtual void preventExtensions(JSGlobalData&);214 void preventExtensions(JSGlobalData&); 215 215 bool isSealed(JSGlobalData& globalData) { return m_structure->isSealed(globalData); } 216 216 bool isFrozen(JSGlobalData& globalData) { return m_structure->isFrozen(globalData); }
Note: See TracChangeset
for help on using the changeset viewer.