diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-02-09 14:16:12 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-02-09 14:16:12 +0100 |
commit | 03e12282df9aa1e1fb05a8b90f1cfc2e08764cec (patch) | |
tree | 52599cd0ab782b1768e23ad176f7618f98333cb6 /Source/JavaScriptCore/runtime/JSObject.cpp | |
parent | cd44dc59cdfc39534aef4d417e9f3c412e3be139 (diff) | |
download | qtwebkit-03e12282df9aa1e1fb05a8b90f1cfc2e08764cec.tar.gz |
Imported WebKit commit e09a82039aa4273ab318b71122e92d8e5f233525 (http://svn.webkit.org/repository/webkit/trunk@107223)
Diffstat (limited to 'Source/JavaScriptCore/runtime/JSObject.cpp')
-rw-r--r-- | Source/JavaScriptCore/runtime/JSObject.cpp | 100 |
1 files changed, 0 insertions, 100 deletions
diff --git a/Source/JavaScriptCore/runtime/JSObject.cpp b/Source/JavaScriptCore/runtime/JSObject.cpp index a443fda86..ba2d2a52a 100644 --- a/Source/JavaScriptCore/runtime/JSObject.cpp +++ b/Source/JavaScriptCore/runtime/JSObject.cpp @@ -361,106 +361,6 @@ const HashEntry* JSObject::findPropertyHashEntry(ExecState* exec, const Identifi 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()) |