WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
More win build fix
77451.6.patch (text/plain), 42.59 KB, created by
Gavin Barraclough
on 2012-02-04 18:27:32 PST
(
hide
)
Description:
More win build fix
Filename:
MIME Type:
Creator:
Gavin Barraclough
Created:
2012-02-04 18:27:32 PST
Size:
42.59 KB
patch
obsolete
>Index: Source/JavaScriptCore/ChangeLog >=================================================================== >--- Source/JavaScriptCore/ChangeLog (revision 106512) >+++ Source/JavaScriptCore/ChangeLog (working copy) >@@ -1,3 +1,45 @@ >+2012-02-01 Gavin Barraclough <barraclough@apple.com> >+ >+ Remove JSObject defineGetter/defineSetter lookupGetter/lookupSetter >+ https://bugs.webkit.org/show_bug.cgi?id=77451 >+ >+ Reviewed by Sam Weinig. >+ >+ These can now all be implemented in terms of defineOwnProperty & getPropertyDescriptor. >+ Also remove initializeGetterSetterProperty, since this is equivalent to putDirectAccessor. >+ >+ * JavaScriptCore.exp: >+ * debugger/DebuggerActivation.cpp: >+ (JSC::DebuggerActivation::defineOwnProperty): >+ * debugger/DebuggerActivation.h: >+ (DebuggerActivation): >+ * runtime/ClassInfo.h: >+ (MethodTable): >+ (JSC): >+ * runtime/JSBoundFunction.cpp: >+ (JSC::JSBoundFunction::finishCreation): >+ * runtime/JSCell.cpp: >+ (JSC): >+ * runtime/JSCell.h: >+ (JSCell): >+ * runtime/JSFunction.cpp: >+ (JSC::JSFunction::getOwnPropertySlot): >+ (JSC::JSFunction::getOwnPropertyDescriptor): >+ * runtime/JSGlobalObject.cpp: >+ (JSC::JSGlobalObject::defineOwnProperty): >+ (JSC): >+ * runtime/JSGlobalObject.h: >+ (JSGlobalObject): >+ * runtime/JSObject.cpp: >+ (JSC): >+ * runtime/JSObject.h: >+ (JSObject): >+ * runtime/ObjectPrototype.cpp: >+ (JSC::objectProtoFuncDefineGetter): >+ (JSC::objectProtoFuncDefineSetter): >+ (JSC::objectProtoFuncLookupGetter): >+ (JSC::objectProtoFuncLookupSetter): >+ > 2012-02-01 Gavin Barraclough <barraclough@apple.com> > > calling function on catch block scope containing an eval result in wrong this value being passed >Index: Source/JavaScriptCore/JavaScriptCore.exp >=================================================================== >--- Source/JavaScriptCore/JavaScriptCore.exp (revision 106511) >+++ Source/JavaScriptCore/JavaScriptCore.exp (working copy) >@@ -168,12 +168,11 @@ __ZN3JSC13SamplingFlags7s_flagsE > __ZN3JSC13StatementNode6setLocEii > __ZN3JSC14ExecutableBase6s_infoE > __ZN3JSC14JSGlobalObject10globalExecEv >-__ZN3JSC14JSGlobalObject12defineGetterEPNS_8JSObjectEPNS_9ExecStateERKNS_10IdentifierES2_j >-__ZN3JSC14JSGlobalObject12defineSetterEPNS_8JSObjectEPNS_9ExecStateERKNS_10IdentifierES2_j > __ZN3JSC14JSGlobalObject13clearRareDataEPNS_6JSCellE > __ZN3JSC14JSGlobalObject13visitChildrenEPNS_6JSCellERNS_11SlotVisitorE > __ZN3JSC14JSGlobalObject16addStaticGlobalsEPNS0_18GlobalPropertyInfoEi > __ZN3JSC14JSGlobalObject16putDirectVirtualEPNS_8JSObjectEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueEj >+__ZN3JSC14JSGlobalObject17defineOwnPropertyEPNS_8JSObjectEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorEb > __ZN3JSC14JSGlobalObject18getOwnPropertySlotEPNS_6JSCellEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE > __ZN3JSC14JSGlobalObject24getOwnPropertyDescriptorEPNS_8JSObjectEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE > __ZN3JSC14JSGlobalObject25s_globalObjectMethodTableE >@@ -315,10 +314,6 @@ __ZN3JSC8DebuggerD2Ev > __ZN3JSC8JSObject10putByIndexEPNS_6JSCellEPNS_9ExecStateEjNS_7JSValueE > __ZN3JSC8JSObject11hasInstanceEPS0_PNS_9ExecStateENS_7JSValueES4_ > __ZN3JSC8JSObject12defaultValueEPKS0_PNS_9ExecStateENS_22PreferredPrimitiveTypeE >-__ZN3JSC8JSObject12defineGetterEPS0_PNS_9ExecStateERKNS_10IdentifierES1_j >-__ZN3JSC8JSObject12defineSetterEPS0_PNS_9ExecStateERKNS_10IdentifierES1_j >-__ZN3JSC8JSObject12lookupGetterEPNS_9ExecStateERKNS_10IdentifierE >-__ZN3JSC8JSObject12lookupSetterEPNS_9ExecStateERKNS_10IdentifierE > __ZN3JSC8JSObject12toThisObjectEPNS_6JSCellEPNS_9ExecStateE > __ZN3JSC8JSObject13visitChildrenEPNS_6JSCellERNS_11SlotVisitorE > __ZN3JSC8JSObject14deletePropertyEPNS_6JSCellEPNS_9ExecStateERKNS_10IdentifierE >Index: Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def >=================================================================== >--- Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def (revision 106511) >+++ Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def (working copy) >@@ -135,11 +135,8 @@ EXPORTS > ?decrement@RefCountedLeakCounter@WTF@@QAEXXZ > ?defaultAttributes@PropertyDescriptor@JSC@@0IA > ?defaultValue@JSObject@JSC@@SA?AVJSValue@2@PBV12@PAVExecState@2@W4PreferredPrimitiveType@2@@Z >- ?defineGetter@JSGlobalObject@JSC@@SAXPAVJSObject@2@PAVExecState@2@ABVIdentifier@2@0I@Z >- ?defineGetter@JSObject@JSC@@SAXPAV12@PAVExecState@2@ABVIdentifier@2@0I@Z >+ ?defineOwnProperty@JSGlobalObject@JSC@@SA_NPAVJSObject@2@PAVExecState@2@ABVIdentifier@2@AAVPropertyDescriptor@2@_N@Z > ?defineOwnProperty@JSObject@JSC@@SA_NPAV12@PAVExecState@2@ABVIdentifier@2@AAVPropertyDescriptor@2@_N@Z >- ?defineSetter@JSGlobalObject@JSC@@SAXPAVJSObject@2@PAVExecState@2@ABVIdentifier@2@0I@Z >- ?defineSetter@JSObject@JSC@@SAXPAV12@PAVExecState@2@ABVIdentifier@2@0I@Z > ?deleteOwnedPtr@WTF@@YAXPAUHBITMAP__@@@Z > ?deleteOwnedPtr@WTF@@YAXPAUHBRUSH__@@@Z > ?deleteOwnedPtr@WTF@@YAXPAUHDC__@@@Z >@@ -178,7 +175,7 @@ EXPORTS > ?fastRealloc@WTF@@YAPAXPAXI@Z > ?fastStrDup@WTF@@YAPADPBD@Z > ?fastZeroedMalloc@WTF@@YAPAXI@Z >- ?fillGetterPropertySlot@JSObject@JSC@@QAEXAAVPropertySlot@2@PAV?$WriteBarrierBase@W4Unknown@JSC@@@2@@Z >+ ?fillGetterPropertySlot@JSObject@JSC@@AAEXAAVPropertySlot@2@PAV?$WriteBarrierBase@W4Unknown@JSC@@@2@@Z > ?finalize@WeakHandleOwner@JSC@@UAEXV?$Handle@W4Unknown@JSC@@@2@PAX@Z > ?finishCreation@DateInstance@JSC@@IAEXAAVJSGlobalData@2@N@Z > ?finishCreation@InternalFunction@JSC@@IAEXAAVJSGlobalData@2@ABVIdentifier@2@@Z >Index: Source/JavaScriptCore/debugger/DebuggerActivation.cpp >=================================================================== >--- Source/JavaScriptCore/debugger/DebuggerActivation.cpp (revision 106511) >+++ Source/JavaScriptCore/debugger/DebuggerActivation.cpp (working copy) >@@ -101,16 +101,10 @@ bool DebuggerActivation::getOwnPropertyD > return thisObject->m_activation->methodTable()->getOwnPropertyDescriptor(thisObject->m_activation.get(), exec, propertyName, descriptor); > } > >-void DebuggerActivation::defineGetter(JSObject* object, ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes) >+bool DebuggerActivation::defineOwnProperty(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, bool shouldThrow) > { > DebuggerActivation* thisObject = jsCast<DebuggerActivation*>(object); >- thisObject->m_activation->methodTable()->defineGetter(thisObject->m_activation.get(), exec, propertyName, getterFunction, attributes); >-} >- >-void DebuggerActivation::defineSetter(JSObject* object, ExecState* exec, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes) >-{ >- DebuggerActivation* thisObject = jsCast<DebuggerActivation*>(object); >- thisObject->m_activation->methodTable()->defineSetter(thisObject->m_activation.get(), exec, propertyName, setterFunction, attributes); >+ return thisObject->m_activation->methodTable()->defineOwnProperty(thisObject->m_activation.get(), exec, propertyName, descriptor, shouldThrow); > } > > } // namespace JSC >Index: Source/JavaScriptCore/debugger/DebuggerActivation.h >=================================================================== >--- Source/JavaScriptCore/debugger/DebuggerActivation.h (revision 106511) >+++ Source/JavaScriptCore/debugger/DebuggerActivation.h (working copy) >@@ -49,8 +49,7 @@ namespace JSC { > static bool deleteProperty(JSCell*, ExecState*, const Identifier& propertyName); > static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode); > static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); >- static void defineGetter(JSObject*, ExecState*, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes); >- static void defineSetter(JSObject*, ExecState*, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes); >+ static bool defineOwnProperty(JSObject*, ExecState*, const Identifier& propertyName, PropertyDescriptor&, bool shouldThrow); > > JS_EXPORTDATA static const ClassInfo s_info; > >Index: Source/JavaScriptCore/runtime/ClassInfo.h >=================================================================== >--- Source/JavaScriptCore/runtime/ClassInfo.h (revision 106511) >+++ Source/JavaScriptCore/runtime/ClassInfo.h (working copy) >@@ -66,12 +66,6 @@ namespace JSC { > typedef JSObject* (*ToThisObjectFunctionPtr)(JSCell*, ExecState*); > ToThisObjectFunctionPtr toThisObject; > >- typedef void (*DefineGetterFunctionPtr)(JSObject*, ExecState*, const Identifier&, JSObject*, unsigned); >- DefineGetterFunctionPtr defineGetter; >- >- typedef void (*DefineSetterFunctionPtr)(JSObject*, ExecState*, const Identifier&, JSObject*, unsigned); >- DefineSetterFunctionPtr defineSetter; >- > typedef JSValue (*DefaultValueFunctionPtr)(const JSObject*, ExecState*, PreferredPrimitiveType); > DefaultValueFunctionPtr defaultValue; > >@@ -128,8 +122,6 @@ struct MemberCheck##member { \ > &ClassName::getOwnPropertySlot, \ > &ClassName::getOwnPropertySlotByIndex, \ > &ClassName::toThisObject, \ >- &ClassName::defineGetter, \ >- &ClassName::defineSetter, \ > &ClassName::defaultValue, \ > &ClassName::getOwnPropertyNames, \ > &ClassName::getPropertyNames, \ >Index: Source/JavaScriptCore/runtime/JSBoundFunction.cpp >=================================================================== >--- Source/JavaScriptCore/runtime/JSBoundFunction.cpp (revision 106511) >+++ Source/JavaScriptCore/runtime/JSBoundFunction.cpp (working copy) >@@ -26,6 +26,7 @@ > #include "config.h" > #include "JSBoundFunction.h" > >+#include "GetterSetter.h" > #include "JSGlobalObject.h" > > namespace JSC { >@@ -111,8 +112,8 @@ void JSBoundFunction::finishCreation(Exe > Base::finishCreation(exec, executable, length, name); > ASSERT(inherits(&s_info)); > >- initializeGetterSetterProperty(exec, exec->propertyNames().arguments, globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor); >- initializeGetterSetterProperty(exec, exec->propertyNames().caller, globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor); >+ putDirectAccessor(exec->globalData(), exec->propertyNames().arguments, globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor); >+ putDirectAccessor(exec->globalData(), exec->propertyNames().caller, globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor); > } > > void JSBoundFunction::visitChildren(JSCell* cell, SlotVisitor& visitor) >Index: Source/JavaScriptCore/runtime/JSCell.cpp >=================================================================== >--- Source/JavaScriptCore/runtime/JSCell.cpp (revision 106511) >+++ Source/JavaScriptCore/runtime/JSCell.cpp (working copy) >@@ -158,16 +158,6 @@ void slowValidateCell(JSCell* cell) > ASSERT_GC_OBJECT_LOOKS_VALID(cell); > } > >-void JSCell::defineGetter(JSObject*, ExecState*, const Identifier&, JSObject*, unsigned) >-{ >- ASSERT_NOT_REACHED(); >-} >- >-void JSCell::defineSetter(JSObject*, ExecState*, const Identifier&, JSObject*, unsigned) >-{ >- ASSERT_NOT_REACHED(); >-} >- > JSValue JSCell::defaultValue(const JSObject*, ExecState*, PreferredPrimitiveType) > { > ASSERT_NOT_REACHED(); >Index: Source/JavaScriptCore/runtime/JSCell.h >=================================================================== >--- Source/JavaScriptCore/runtime/JSCell.h (revision 106511) >+++ Source/JavaScriptCore/runtime/JSCell.h (working copy) >@@ -152,8 +152,6 @@ namespace JSC { > static bool getOwnPropertySlotByIndex(JSCell*, ExecState*, unsigned propertyName, PropertySlot&); > > // Dummy implementations of override-able static functions for classes to put in their MethodTable >- static NO_RETURN_DUE_TO_ASSERT void defineGetter(JSObject*, ExecState*, const Identifier&, JSObject*, unsigned); >- static NO_RETURN_DUE_TO_ASSERT void defineSetter(JSObject*, ExecState*, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes = 0); > static JSValue defaultValue(const JSObject*, ExecState*, PreferredPrimitiveType); > static NO_RETURN_DUE_TO_ASSERT void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode); > static NO_RETURN_DUE_TO_ASSERT void getPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode); >Index: Source/JavaScriptCore/runtime/JSFunction.cpp >=================================================================== >--- Source/JavaScriptCore/runtime/JSFunction.cpp (revision 106511) >+++ Source/JavaScriptCore/runtime/JSFunction.cpp (working copy) >@@ -30,6 +30,7 @@ > #include "CallFrame.h" > #include "ExceptionHelpers.h" > #include "FunctionPrototype.h" >+#include "GetterSetter.h" > #include "JSArray.h" > #include "JSGlobalObject.h" > #include "JSNotAnObject.h" >@@ -219,7 +220,7 @@ bool JSFunction::getOwnPropertySlot(JSCe > if (thisObject->jsExecutable()->isStrictMode()) { > bool result = Base::getOwnPropertySlot(thisObject, exec, propertyName, slot); > if (!result) { >- thisObject->initializeGetterSetterProperty(exec, propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor); >+ thisObject->putDirectAccessor(exec->globalData(), propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor); > result = Base::getOwnPropertySlot(thisObject, exec, propertyName, slot); > ASSERT(result); > } >@@ -238,7 +239,7 @@ bool JSFunction::getOwnPropertySlot(JSCe > if (thisObject->jsExecutable()->isStrictMode()) { > bool result = Base::getOwnPropertySlot(thisObject, exec, propertyName, slot); > if (!result) { >- thisObject->initializeGetterSetterProperty(exec, propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor); >+ thisObject->putDirectAccessor(exec->globalData(), propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor); > result = Base::getOwnPropertySlot(thisObject, exec, propertyName, slot); > ASSERT(result); > } >@@ -267,7 +268,7 @@ bool JSFunction::getOwnPropertyDescripto > if (thisObject->jsExecutable()->isStrictMode()) { > bool result = Base::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor); > if (!result) { >- thisObject->initializeGetterSetterProperty(exec, propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor); >+ thisObject->putDirectAccessor(exec->globalData(), propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor); > result = Base::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor); > ASSERT(result); > } >@@ -286,7 +287,7 @@ bool JSFunction::getOwnPropertyDescripto > if (thisObject->jsExecutable()->isStrictMode()) { > bool result = Base::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor); > if (!result) { >- thisObject->initializeGetterSetterProperty(exec, propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor); >+ thisObject->putDirectAccessor(exec->globalData(), propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor); > result = Base::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor); > ASSERT(result); > } >Index: Source/JavaScriptCore/runtime/JSGlobalObject.cpp >=================================================================== >--- Source/JavaScriptCore/runtime/JSGlobalObject.cpp (revision 106511) >+++ Source/JavaScriptCore/runtime/JSGlobalObject.cpp (working copy) >@@ -171,21 +171,16 @@ void JSGlobalObject::putDirectVirtual(JS > } > } > >-void JSGlobalObject::defineGetter(JSObject* object, ExecState* exec, const Identifier& propertyName, JSObject* getterFunc, unsigned attributes) >+bool JSGlobalObject::defineOwnProperty(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, bool shouldThrow) > { > JSGlobalObject* thisObject = jsCast<JSGlobalObject*>(object); > PropertySlot slot; >- if (!thisObject->symbolTableGet(propertyName, slot)) >- JSVariableObject::defineGetter(thisObject, exec, propertyName, getterFunc, attributes); >+ // silently ignore attempts to add accessors aliasing vars. >+ if (descriptor.isAccessorDescriptor() && thisObject->symbolTableGet(propertyName, slot)) >+ return false; >+ return Base::defineOwnProperty(thisObject, exec, propertyName, descriptor, shouldThrow); > } > >-void JSGlobalObject::defineSetter(JSObject* object, ExecState* exec, const Identifier& propertyName, JSObject* setterFunc, unsigned attributes) >-{ >- JSGlobalObject* thisObject = jsCast<JSGlobalObject*>(object); >- PropertySlot slot; >- if (!thisObject->symbolTableGet(propertyName, slot)) >- JSVariableObject::defineSetter(thisObject, exec, propertyName, setterFunc, attributes); >-} > > static inline JSObject* lastInPrototypeChain(JSObject* object) > { >Index: Source/JavaScriptCore/runtime/JSGlobalObject.h >=================================================================== >--- Source/JavaScriptCore/runtime/JSGlobalObject.h (revision 106511) >+++ Source/JavaScriptCore/runtime/JSGlobalObject.h (working copy) >@@ -206,6 +206,7 @@ namespace JSC { > > JS_EXPORT_PRIVATE static void defineGetter(JSObject*, ExecState*, const Identifier& propertyName, JSObject* getterFunc, unsigned attributes); > JS_EXPORT_PRIVATE static void defineSetter(JSObject*, ExecState*, const Identifier& propertyName, JSObject* setterFunc, unsigned attributes); >+ JS_EXPORT_PRIVATE static bool defineOwnProperty(JSObject*, ExecState*, const Identifier& propertyName, PropertyDescriptor&, bool shouldThrow); > > // We use this in the code generator as we perform symbol table > // lookups prior to initializing the properties >Index: Source/JavaScriptCore/runtime/JSObject.cpp >=================================================================== >--- Source/JavaScriptCore/runtime/JSObject.cpp (revision 106511) >+++ Source/JavaScriptCore/runtime/JSObject.cpp (working copy) >@@ -361,106 +361,6 @@ const HashEntry* JSObject::findPropertyH > return 0; > } > >-void JSObject::defineGetter(JSObject* thisObject, ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes) >-{ >- if (propertyName == exec->propertyNames().underscoreProto) { >- // Defining a getter for __proto__ is silently ignored. >- return; >- } >- >- JSValue object = thisObject->getDirect(exec->globalData(), propertyName); >- if (object && object.isGetterSetter()) { >- ASSERT(thisObject->structure()->hasGetterSetterProperties()); >- asGetterSetter(object)->setGetter(exec->globalData(), getterFunction); >- return; >- } >- >- JSGlobalData& globalData = exec->globalData(); >- PutPropertySlot slot; >- GetterSetter* getterSetter = GetterSetter::create(exec); >- thisObject->putDirectInternal<PutModeDefineOwnProperty>(globalData, propertyName, getterSetter, attributes | Accessor, slot, 0); >- >- // putDirect will change our Structure if we add a new property. For >- // getters and setters, though, we also need to change our Structure >- // if we override an existing non-getter or non-setter. >- if (slot.type() != PutPropertySlot::NewProperty) >- thisObject->setStructure(exec->globalData(), Structure::attributeChangeTransition(globalData, thisObject->structure(), propertyName, attributes | Accessor)); >- >- thisObject->structure()->setHasGetterSetterProperties(true); >- getterSetter->setGetter(globalData, getterFunction); >-} >- >-void JSObject::initializeGetterSetterProperty(ExecState* exec, const Identifier& propertyName, GetterSetter* getterSetter, unsigned attributes) >-{ >- // Set an inital property on an object; the property must not already exist & the attribute flags must be set correctly. >- ASSERT(structure()->get(exec->globalData(), propertyName) == WTF::notFound); >- ASSERT(static_cast<bool>(attributes & Accessor)); >- >- JSGlobalData& globalData = exec->globalData(); >- PutPropertySlot slot; >- putDirectInternal<PutModeDefineOwnProperty>(globalData, propertyName, getterSetter, attributes, slot, 0); >- >- // putDirect will change our Structure if we add a new property. For >- // getters and setters, though, we also need to change our Structure >- // if we override an existing non-getter or non-setter. >- if (slot.type() != PutPropertySlot::NewProperty) >- setStructure(exec->globalData(), Structure::attributeChangeTransition(globalData, structure(), propertyName, attributes)); >- >- structure()->setHasGetterSetterProperties(true); >-} >- >-void JSObject::defineSetter(JSObject* thisObject, ExecState* exec, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes) >-{ >- if (propertyName == exec->propertyNames().underscoreProto) { >- // Defining a setter for __proto__ is silently ignored. >- return; >- } >- >- JSValue object = thisObject->getDirect(exec->globalData(), propertyName); >- if (object && object.isGetterSetter()) { >- ASSERT(thisObject->structure()->hasGetterSetterProperties()); >- asGetterSetter(object)->setSetter(exec->globalData(), setterFunction); >- return; >- } >- >- PutPropertySlot slot; >- GetterSetter* getterSetter = GetterSetter::create(exec); >- thisObject->putDirectInternal<PutModeDefineOwnProperty>(exec->globalData(), propertyName, getterSetter, attributes | Accessor, slot, 0); >- >- // putDirect will change our Structure if we add a new property. For >- // getters and setters, though, we also need to change our Structure >- // if we override an existing non-getter or non-setter. >- if (slot.type() != PutPropertySlot::NewProperty) >- thisObject->setStructure(exec->globalData(), Structure::attributeChangeTransition(exec->globalData(), thisObject->structure(), propertyName, attributes | Accessor)); >- >- thisObject->structure()->setHasGetterSetterProperties(true); >- getterSetter->setSetter(exec->globalData(), setterFunction); >-} >- >-JSValue JSObject::lookupGetter(ExecState* exec, const Identifier& propertyName) >-{ >- PropertyDescriptor descriptor; >- if (!getPropertyDescriptor(exec, propertyName, descriptor)) >- return jsUndefined(); >- >- if (!descriptor.getterPresent()) >- return jsUndefined(); >- >- return descriptor.getter(); >-} >- >-JSValue JSObject::lookupSetter(ExecState* exec, const Identifier& propertyName) >-{ >- PropertyDescriptor descriptor; >- if (!getPropertyDescriptor(exec, propertyName, descriptor)) >- return jsUndefined(); >- >- if (!descriptor.setterPresent()) >- return jsUndefined(); >- >- return descriptor.setter(); >-} >- > bool JSObject::hasInstance(JSObject*, ExecState* exec, JSValue value, JSValue proto) > { > if (!value.isObject()) >Index: Source/JavaScriptCore/runtime/JSObject.h >=================================================================== >--- Source/JavaScriptCore/runtime/JSObject.h (revision 106512) >+++ Source/JavaScriptCore/runtime/JSObject.h (working copy) >@@ -192,13 +192,6 @@ namespace JSC { > void putDirectOffset(JSGlobalData& globalData, size_t offset, JSValue value) { propertyStorage()[offset].set(globalData, this, value); } > void putUndefinedAtDirectOffset(size_t offset) { propertyStorage()[offset].setUndefined(); } > >- JS_EXPORT_PRIVATE void fillGetterPropertySlot(PropertySlot&, WriteBarrierBase<Unknown>* location); >- void initializeGetterSetterProperty(ExecState*, const Identifier&, GetterSetter*, unsigned attributes); >- >- JS_EXPORT_PRIVATE static void defineGetter(JSObject*, ExecState*, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes = 0); >- JS_EXPORT_PRIVATE static void defineSetter(JSObject*, ExecState*, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes = 0); >- JS_EXPORT_PRIVATE JSValue lookupGetter(ExecState*, const Identifier& propertyName); >- JS_EXPORT_PRIVATE JSValue lookupSetter(ExecState*, const Identifier& propertyName); > JS_EXPORT_PRIVATE static bool defineOwnProperty(JSObject*, ExecState*, const Identifier& propertyName, PropertyDescriptor&, bool shouldThrow); > > bool isGlobalObject() const; >@@ -296,6 +289,7 @@ namespace JSC { > bool putDirectInternal(JSGlobalData&, const Identifier& propertyName, JSValue, unsigned attr, PutPropertySlot&, JSCell*); > > bool inlineGetOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&); >+ JS_EXPORT_PRIVATE void fillGetterPropertySlot(PropertySlot&, WriteBarrierBase<Unknown>* location); > > const HashEntry* findPropertyHashEntry(ExecState*, const Identifier& propertyName) const; > Structure* createInheritorID(JSGlobalData&); >Index: Source/JavaScriptCore/runtime/ObjectPrototype.cpp >=================================================================== >--- Source/JavaScriptCore/runtime/ObjectPrototype.cpp (revision 106511) >+++ Source/JavaScriptCore/runtime/ObjectPrototype.cpp (working copy) >@@ -146,10 +146,17 @@ EncodedJSValue JSC_HOST_CALL objectProto > if (exec->hadException()) > return JSValue::encode(jsUndefined()); > >+ JSValue get = exec->argument(1); > CallData callData; >- if (getCallData(exec->argument(1), callData) == CallTypeNone) >+ if (getCallData(get, callData) == CallTypeNone) > return throwVMError(exec, createSyntaxError(exec, "invalid getter usage")); >- thisObject->methodTable()->defineGetter(thisObject, exec, Identifier(exec, exec->argument(0).toString(exec)->value(exec)), asObject(exec->argument(1)), 0); >+ >+ PropertyDescriptor descriptor; >+ descriptor.setGetter(get); >+ descriptor.setEnumerable(true); >+ descriptor.setConfigurable(true); >+ thisObject->methodTable()->defineOwnProperty(thisObject, exec, Identifier(exec, exec->argument(0).toString(exec)->value(exec)), descriptor, false); >+ > return JSValue::encode(jsUndefined()); > } > >@@ -159,10 +166,17 @@ EncodedJSValue JSC_HOST_CALL objectProto > if (exec->hadException()) > return JSValue::encode(jsUndefined()); > >+ JSValue set = exec->argument(1); > CallData callData; >- if (getCallData(exec->argument(1), callData) == CallTypeNone) >+ if (getCallData(set, callData) == CallTypeNone) > return throwVMError(exec, createSyntaxError(exec, "invalid setter usage")); >- thisObject->methodTable()->defineSetter(thisObject, exec, Identifier(exec, exec->argument(0).toString(exec)->value(exec)), asObject(exec->argument(1)), 0); >+ >+ PropertyDescriptor descriptor; >+ descriptor.setSetter(set); >+ descriptor.setEnumerable(true); >+ descriptor.setConfigurable(true); >+ thisObject->methodTable()->defineOwnProperty(thisObject, exec, Identifier(exec, exec->argument(0).toString(exec)->value(exec)), descriptor, false); >+ > return JSValue::encode(jsUndefined()); > } > >@@ -172,7 +186,12 @@ EncodedJSValue JSC_HOST_CALL objectProto > if (exec->hadException()) > return JSValue::encode(jsUndefined()); > >- return JSValue::encode(thisObject->lookupGetter(exec, Identifier(exec, exec->argument(0).toString(exec)->value(exec)))); >+ PropertyDescriptor descriptor; >+ if (thisObject->getPropertyDescriptor(exec, Identifier(exec, exec->argument(0).toString(exec)->value(exec)), descriptor) >+ && descriptor.getterPresent()) >+ return JSValue::encode(descriptor.getter()); >+ >+ return JSValue::encode(jsUndefined()); > } > > EncodedJSValue JSC_HOST_CALL objectProtoFuncLookupSetter(ExecState* exec) >@@ -181,7 +200,12 @@ EncodedJSValue JSC_HOST_CALL objectProto > if (exec->hadException()) > return JSValue::encode(jsUndefined()); > >- return JSValue::encode(thisObject->lookupSetter(exec, Identifier(exec, exec->argument(0).toString(exec)->value(exec)))); >+ PropertyDescriptor descriptor; >+ if (thisObject->getPropertyDescriptor(exec, Identifier(exec, exec->argument(0).toString(exec)->value(exec)), descriptor) >+ && descriptor.setterPresent()) >+ return JSValue::encode(descriptor.setter()); >+ >+ return JSValue::encode(jsUndefined()); > } > > EncodedJSValue JSC_HOST_CALL objectProtoFuncPropertyIsEnumerable(ExecState* exec) >Index: Source/WebCore/ChangeLog >=================================================================== >--- Source/WebCore/ChangeLog (revision 106497) >+++ Source/WebCore/ChangeLog (working copy) >@@ -1,3 +1,28 @@ >+2012-02-01 Gavin Barraclough <barraclough@apple.com> >+ >+ Remove JSObject defineGetter/defineSetter lookupGetter/lookupSetter >+ https://bugs.webkit.org/show_bug.cgi?id=77451 >+ >+ Reviewed by Sam Weinig. >+ >+ These can now all be implemented in terms of defineOwnProperty & getPropertyDescriptor. >+ Also remove initializeGetterSetterProperty, since this is equivalent to putDirectAccessor. >+ >+ * bindings/js/JSDOMWindowCustom.cpp: >+ (WebCore): >+ (WebCore::JSDOMWindow::defineOwnProperty): >+ * bindings/js/JSDOMWindowShell.cpp: >+ (WebCore): >+ * bindings/js/JSDOMWindowShell.h: >+ (JSDOMWindowShell): >+ * bindings/js/JSLocationCustom.cpp: >+ (WebCore::JSLocation::defineOwnProperty): >+ (WebCore::JSLocationPrototype::defineOwnProperty): >+ * bindings/scripts/CodeGeneratorJS.pm: >+ (GenerateHeader): >+ * page/DOMWindow.idl: >+ * page/Location.idl: >+ > 2012-02-01 Ryosuke Niwa <rniwa@webkit.org> > > Gcc build fix after r106482. >Index: Source/WebCore/bindings/js/JSDOMWindowCustom.cpp >=================================================================== >--- Source/WebCore/bindings/js/JSDOMWindowCustom.cpp (revision 106497) >+++ Source/WebCore/bindings/js/JSDOMWindowCustom.cpp (working copy) >@@ -388,35 +388,17 @@ void JSDOMWindow::getOwnPropertyNames(JS > Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode); > } > >-void JSDOMWindow::defineGetter(JSObject* object, ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes) >-{ >- JSDOMWindow* thisObject = jsCast<JSDOMWindow*>(object); >- // Only allow defining getters by frames in the same origin. >- if (!thisObject->allowsAccessFrom(exec)) >- return; >- >- // Don't allow shadowing location using defineGetter. >- if (propertyName == "location") >- return; >- >- Base::defineGetter(thisObject, exec, propertyName, getterFunction, attributes); >-} >- >-void JSDOMWindow::defineSetter(JSObject* object, ExecState* exec, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes) >-{ >- JSDOMWindow* thisObject = jsCast<JSDOMWindow*>(object); >- // Only allow defining setters by frames in the same origin. >- if (!thisObject->allowsAccessFrom(exec)) >- return; >- Base::defineSetter(thisObject, exec, propertyName, setterFunction, attributes); >-} >- > bool JSDOMWindow::defineOwnProperty(JSC::JSObject* object, JSC::ExecState* exec, const JSC::Identifier& propertyName, JSC::PropertyDescriptor& descriptor, bool shouldThrow) > { > JSDOMWindow* thisObject = jsCast<JSDOMWindow*>(object); > // Only allow defining properties in this way by frames in the same origin, as it allows setters to be introduced. > if (!thisObject->allowsAccessFrom(exec)) > return false; >+ >+ // Don't allow shadowing location using accessor properties. >+ if (descriptor.isAccessorDescriptor() && propertyName == "location") >+ return false; >+ > return Base::defineOwnProperty(thisObject, exec, propertyName, descriptor, shouldThrow); > } > >Index: Source/WebCore/bindings/js/JSDOMWindowShell.cpp >=================================================================== >--- Source/WebCore/bindings/js/JSDOMWindowShell.cpp (revision 106497) >+++ Source/WebCore/bindings/js/JSDOMWindowShell.cpp (working copy) >@@ -139,18 +139,6 @@ void JSDOMWindowShell::getOwnPropertyNam > thisObject->window()->methodTable()->getOwnPropertyNames(thisObject->window(), exec, propertyNames, mode); > } > >-void JSDOMWindowShell::defineGetter(JSObject* object, ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes) >-{ >- JSDOMWindowShell* thisObject = jsCast<JSDOMWindowShell*>(object); >- thisObject->window()->methodTable()->defineGetter(thisObject->window(), exec, propertyName, getterFunction, attributes); >-} >- >-void JSDOMWindowShell::defineSetter(JSObject* object, ExecState* exec, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes) >-{ >- JSDOMWindowShell* thisObject = jsCast<JSDOMWindowShell*>(object); >- thisObject->window()->methodTable()->defineSetter(thisObject->window(), exec, propertyName, setterFunction, attributes); >-} >- > > // ---- > // JSDOMWindow methods >Index: Source/WebCore/bindings/js/JSDOMWindowShell.h >=================================================================== >--- Source/WebCore/bindings/js/JSDOMWindowShell.h (revision 106497) >+++ Source/WebCore/bindings/js/JSDOMWindowShell.h (working copy) >@@ -86,8 +86,6 @@ namespace WebCore { > static bool deleteProperty(JSC::JSCell*, JSC::ExecState*, const JSC::Identifier& propertyName); > static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode); > static void getPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode); >- static void defineGetter(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction, unsigned attributes); >- static void defineSetter(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* setterFunction, unsigned attributes); > static bool defineOwnProperty(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&, bool shouldThrow); > > RefPtr<DOMWrapperWorld> m_world; >Index: Source/WebCore/bindings/js/JSLocationCustom.cpp >=================================================================== >--- Source/WebCore/bindings/js/JSLocationCustom.cpp (revision 106497) >+++ Source/WebCore/bindings/js/JSLocationCustom.cpp (working copy) >@@ -170,11 +170,11 @@ void JSLocation::getOwnPropertyNames(JSO > Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode); > } > >-void JSLocation::defineGetter(JSObject* object, ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes) >+bool JSLocation::defineOwnProperty(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, bool throwException) > { >- if (propertyName == exec->propertyNames().toString || propertyName == exec->propertyNames().valueOf) >- return; >- Base::defineGetter(object, exec, propertyName, getterFunction, attributes); >+ if (descriptor.isAccessorDescriptor() && (propertyName == exec->propertyNames().toString || propertyName == exec->propertyNames().valueOf)) >+ return false; >+ return Base::defineOwnProperty(object, exec, propertyName, descriptor, throwException); > } > > void JSLocation::setHref(ExecState* exec, JSValue value) >@@ -281,11 +281,11 @@ bool JSLocationPrototype::putDelegate(Ex > return (propertyName == exec->propertyNames().toString || propertyName == exec->propertyNames().valueOf); > } > >-void JSLocationPrototype::defineGetter(JSObject* object, ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes) >+bool JSLocationPrototype::defineOwnProperty(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, bool throwException) > { >- if (propertyName == exec->propertyNames().toString || propertyName == exec->propertyNames().valueOf) >- return; >- Base::defineGetter(object, exec, propertyName, getterFunction, attributes); >+ if (descriptor.isAccessorDescriptor() && (propertyName == exec->propertyNames().toString || propertyName == exec->propertyNames().valueOf)) >+ return false; >+ return Base::defineOwnProperty(object, exec, propertyName, descriptor, throwException); > } > > } // namespace WebCore >Index: Source/WebCore/bindings/scripts/CodeGeneratorJS.pm >=================================================================== >--- Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (revision 106497) >+++ Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (working copy) >@@ -828,20 +828,14 @@ sub GenerateHeader > $structureFlags{"JSC::OverridesGetPropertyNames"} = 1; > } > >- # Custom defineProperty function exists on DOMWindow >- push(@headerContent, " static bool defineOwnProperty(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&, bool shouldThrow);\n") if $interfaceName eq "DOMWindow"; >- > # Custom getOwnPropertyNames function > if ($dataNode->extendedAttributes->{"CustomGetPropertyNames"} || $dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasCustomIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}) { > push(@headerContent, " static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode mode = JSC::ExcludeDontEnumProperties);\n"); > $structureFlags{"JSC::OverridesGetPropertyNames"} = 1; > } > >- # Custom defineGetter function >- push(@headerContent, " static void defineGetter(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction, unsigned attributes);\n") if $dataNode->extendedAttributes->{"CustomDefineGetter"}; >- >- # Custom defineSetter function >- push(@headerContent, " static void defineSetter(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* setterFunction, unsigned attributes);\n") if $dataNode->extendedAttributes->{"CustomDefineSetter"}; >+ # Custom defineOwnProperty function >+ push(@headerContent, " static bool defineOwnProperty(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&, bool shouldThrow);\n") if $dataNode->extendedAttributes->{"CustomDefineOwnProperty"}; > > # Override toBoolean to return false for objects that want to 'MasqueradesAsUndefined'. > if ($dataNode->extendedAttributes->{"MasqueradesAsUndefined"}) { >@@ -1063,8 +1057,8 @@ sub GenerateHeader > push(@headerContent, " bool putDelegate(JSC::ExecState*, const JSC::Identifier&, JSC::JSValue, JSC::PutPropertySlot&);\n"); > } > >- # Custom defineGetter function >- push(@headerContent, " static void defineGetter(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction, unsigned attributes);\n") if $dataNode->extendedAttributes->{"CustomPrototypeDefineGetter"}; >+ # Custom defineOwnProperty function >+ push(@headerContent, " static bool defineOwnProperty(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&, bool shouldThrow);\n") if $dataNode->extendedAttributes->{"CustomPrototypeDefineOwnProperty"}; > > push(@headerContent, "\nprivate:\n"); > push(@headerContent, " ${className}Prototype(JSC::JSGlobalData& globalData, JSC::JSGlobalObject*, JSC::Structure* structure) : JSC::JSNonFinalObject(globalData, structure) { }\n"); >Index: Source/WebCore/page/DOMWindow.idl >=================================================================== >--- Source/WebCore/page/DOMWindow.idl (revision 106497) >+++ Source/WebCore/page/DOMWindow.idl (working copy) >@@ -28,8 +28,7 @@ module window { > > interface [ > CheckDomainSecurity, >- CustomDefineGetter, >- CustomDefineSetter, >+ CustomDefineOwnProperty, > CustomDeleteProperty, > CustomGetOwnPropertySlot, > CustomGetPropertyNames, >Index: Source/WebCore/page/Location.idl >=================================================================== >--- Source/WebCore/page/Location.idl (revision 106497) >+++ Source/WebCore/page/Location.idl (working copy) >@@ -37,9 +37,9 @@ module window { > GenerateIsReachable=ImplFrame, > CustomDeleteProperty, > CustomGetPropertyNames, >- CustomDefineGetter, >+ CustomDefineOwnProperty, > DelegatingPrototypePutFunction, >- CustomPrototypeDefineGetter, >+ CustomPrototypeDefineOwnProperty, > OmitConstructor > ] Location { > #if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP >Index: Source/WebKit/qt/ChangeLog >=================================================================== >--- Source/WebKit/qt/ChangeLog (revision 106497) >+++ Source/WebKit/qt/ChangeLog (working copy) >@@ -1,3 +1,16 @@ >+2012-02-01 Gavin Barraclough <barraclough@apple.com> >+ >+ Remove JSObject defineGetter/defineSetter lookupGetter/lookupSetter >+ https://bugs.webkit.org/show_bug.cgi?id=77451 >+ >+ Reviewed by Sam Weinig. >+ >+ These can now all be implemented in terms of defineOwnProperty & getPropertyDescriptor. >+ Also remove initializeGetterSetterProperty, since this is equivalent to putDirectAccessor. >+ >+ * Api/qwebframe.cpp: >+ (QWebFramePrivate::addQtSenderToGlobalObject): >+ > 2012-02-01 Alexis Menard <alexis.menard@openbossa.org> > > CSSStyleDeclaration.getPropertyPriority() fails for CSS shorthand properties with 'important' priority >Index: Source/WebKit/qt/Api/qwebframe.cpp >=================================================================== >--- Source/WebKit/qt/Api/qwebframe.cpp (revision 106497) >+++ Source/WebKit/qt/Api/qwebframe.cpp (working copy) >@@ -69,6 +69,7 @@ > #include "PlatformWheelEvent.h" > #include "PrintContext.h" > #if USE(JSC) >+#include "PropertyDescriptor.h" > #include "PutPropertySlot.h" > #endif > #include "RenderLayer.h" >@@ -518,8 +519,12 @@ void QWebFramePrivate::addQtSenderToGlob > JSObjectRef function = JSObjectMakeFunctionWithCallback(context, propertyName.get(), qtSenderCallback); > > // JSC public API doesn't support setting a Getter for a property of a given object, https://bugs.webkit.org/show_bug.cgi?id=61374. >- window->methodTable()->defineGetter(window, exec, propertyName.get()->identifier(&exec->globalData()), ::toJS(function), >- JSC::ReadOnly | JSC::DontEnum | JSC::DontDelete); >+ JSC::PropertyDescriptor descriptor; >+ descriptor.setGetter(::toJS(function)); >+ descriptor.setSetter(JSC::jsUndefined()); >+ descriptor.setEnumerable(false); >+ descriptor.setConfigurable(false); >+ window->methodTable()->defineOwnProperty(window, exec, propertyName.get()->identifier(&exec->globalData()), descriptor, false); > } > #endif >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 77451
:
124769
|
124861
|
124864
|
124876
|
125039
|
125510
|
125564