Commit 8c300972 authored by barraclough@apple.com's avatar barraclough@apple.com
Browse files

https://bugs.webkit.org/show_bug.cgi?id=120127

Remove JSObject::propertyIsEnumerable

Reviewed by Sam Weinig.

This method is just a wart - it contains unnecessary const-casting, function call overhead, and LOC.

* runtime/JSObject.cpp:
* runtime/JSObject.h:
    - remove propertyIsEnumerable
* runtime/ObjectPrototype.cpp:
(JSC::objectProtoFuncPropertyIsEnumerable):
    - Move implementation here using getOwnPropertyDescriptor directly.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154405 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent eefba76d
2013-08-21 Gavin Barraclough <barraclough@apple.com>
https://bugs.webkit.org/show_bug.cgi?id=120127
Remove JSObject::propertyIsEnumerable
Reviewed by Sam Weinig.
This method is just a wart - it contains unnecessary const-casting, function call overhead, and LOC.
* runtime/JSObject.cpp:
* runtime/JSObject.h:
- remove propertyIsEnumerable
* runtime/ObjectPrototype.cpp:
(JSC::objectProtoFuncPropertyIsEnumerable):
- Move implementation here using getOwnPropertyDescriptor directly.
2013-08-20 Filip Pizlo <fpizlo@apple.com>
 
DFG should inline new typedArray()
......
......@@ -1407,14 +1407,6 @@ bool JSObject::defaultHasInstance(ExecState* exec, JSValue value, JSValue proto)
return false;
}
bool JSObject::propertyIsEnumerable(ExecState* exec, const Identifier& propertyName) const
{
PropertyDescriptor descriptor;
if (!const_cast<JSObject*>(this)->getOwnPropertyDescriptor(exec, propertyName, descriptor))
return false;
return descriptor.enumerable();
}
bool JSObject::getPropertySpecificValue(ExecState* exec, PropertyName propertyName, JSCell*& specificValue) const
{
unsigned attributes;
......
......@@ -121,6 +121,10 @@ public:
static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
JS_EXPORT_PRIVATE static bool getOwnPropertySlotByIndex(JSObject*, ExecState*, unsigned propertyName, PropertySlot&);
// The key difference between this and getOwnPropertySlot is that getOwnPropertySlot
// currently returns incorrect results for the DOM window (wiith non-own properties)
// being returned. Once this is fixed we should migrate code & remove this method.
bool getOwnPropertyDescriptor(ExecState*, PropertyName, PropertyDescriptor&);
bool allowsAccessFrom(ExecState*);
......@@ -458,8 +462,6 @@ public:
void putDirectWithoutTransition(VM&, PropertyName, JSValue, unsigned attributes = 0);
void putDirectAccessor(ExecState*, PropertyName, JSValue, unsigned attributes);
bool propertyIsEnumerable(ExecState*, const Identifier& propertyName) const;
JS_EXPORT_PRIVATE bool hasProperty(ExecState*, PropertyName) const;
JS_EXPORT_PRIVATE bool hasProperty(ExecState*, unsigned propertyName) const;
bool hasOwnProperty(ExecState*, PropertyName) const;
......
......@@ -180,8 +180,12 @@ EncodedJSValue JSC_HOST_CALL objectProtoFuncLookupSetter(ExecState* exec)
EncodedJSValue JSC_HOST_CALL objectProtoFuncPropertyIsEnumerable(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue().toThis(exec, StrictMode);
return JSValue::encode(jsBoolean(thisValue.toObject(exec)->propertyIsEnumerable(exec, Identifier(exec, exec->argument(0).toString(exec)->value(exec)))));
JSObject* thisObject = exec->hostThisValue().toThis(exec, StrictMode).toObject(exec);
Identifier propertyName(exec, exec->argument(0).toString(exec)->value(exec));
PropertyDescriptor descriptor;
bool enumerable = thisObject->getOwnPropertyDescriptor(exec, propertyName, descriptor) && descriptor.enumerable();
return JSValue::encode(jsBoolean(enumerable));
}
// 15.2.4.3 Object.prototype.toLocaleString()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment