Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (154336 => 154337)
--- trunk/Source/_javascript_Core/ChangeLog 2013-08-20 17:09:03 UTC (rev 154336)
+++ trunk/Source/_javascript_Core/ChangeLog 2013-08-20 17:12:33 UTC (rev 154337)
@@ -1,5 +1,29 @@
2013-08-20 Gavin Barraclough <[email protected]>
+ https://bugs.webkit.org/show_bug.cgi?id=120067
+ Remove getPropertyDescriptor
+
+ Reviewed by Oliver Hunt.
+
+ This is used by lookupGetter/lookupSetter - this can easily bee replaced by getPropertySlot.
+ Since we'll be getting the GetterSetter from the slot in the setter case, rename isGetter() to isAccessor().
+
+ * runtime/JSObject.cpp:
+ * runtime/JSObject.h:
+ - remove getPropertyDescriptor
+ * runtime/ObjectPrototype.cpp:
+ (JSC::objectProtoFuncLookupGetter):
+ (JSC::objectProtoFuncLookupSetter):
+ - replace call to getPropertyDescriptor with getPropertySlot
+ * runtime/PropertyDescriptor.h:
+ * runtime/PropertySlot.h:
+ (JSC::PropertySlot::isAccessor):
+ (JSC::PropertySlot::isCacheableGetter):
+ (JSC::PropertySlot::getterSetter):
+ - rename isGetter() to isAccessor()
+
+2013-08-20 Gavin Barraclough <[email protected]>
+
https://bugs.webkit.org/show_bug.cgi?id=120054
Remove some dead code following getOwnPropertyDescriptor cleanup
Modified: trunk/Source/_javascript_Core/runtime/JSObject.cpp (154336 => 154337)
--- trunk/Source/_javascript_Core/runtime/JSObject.cpp 2013-08-20 17:09:03 UTC (rev 154336)
+++ trunk/Source/_javascript_Core/runtime/JSObject.cpp 2013-08-20 17:12:33 UTC (rev 154337)
@@ -2383,19 +2383,6 @@
GET_OWN_PROPERTY_DESCRIPTOR_IMPL(JSObject)
-bool JSObject::getPropertyDescriptor(ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
-{
- JSObject* object = this;
- while (true) {
- if (object->methodTable()->getOwnPropertyDescriptor(object, exec, propertyName, descriptor))
- return true;
- JSValue prototype = object->prototype();
- if (!prototype.isObject())
- return false;
- object = asObject(prototype);
- }
-}
-
static bool putDescriptor(ExecState* exec, JSObject* target, PropertyName propertyName, PropertyDescriptor& descriptor, unsigned attributes, const PropertyDescriptor& oldDescriptor)
{
if (descriptor.isGenericDescriptor() || descriptor.isDataDescriptor()) {
Modified: trunk/Source/_javascript_Core/runtime/JSObject.h (154336 => 154337)
--- trunk/Source/_javascript_Core/runtime/JSObject.h 2013-08-20 17:09:03 UTC (rev 154336)
+++ trunk/Source/_javascript_Core/runtime/JSObject.h 2013-08-20 17:12:33 UTC (rev 154337)
@@ -123,7 +123,6 @@
bool fastGetOwnPropertySlot(ExecState*, PropertyName, PropertySlot&);
bool getPropertySlot(ExecState*, PropertyName, PropertySlot&);
bool getPropertySlot(ExecState*, unsigned propertyName, PropertySlot&);
- JS_EXPORT_PRIVATE bool getPropertyDescriptor(ExecState*, PropertyName, PropertyDescriptor&);
static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
JS_EXPORT_PRIVATE static bool getOwnPropertySlotByIndex(JSObject*, ExecState*, unsigned propertyName, PropertySlot&);
Modified: trunk/Source/_javascript_Core/runtime/ObjectPrototype.cpp (154336 => 154337)
--- trunk/Source/_javascript_Core/runtime/ObjectPrototype.cpp 2013-08-20 17:09:03 UTC (rev 154336)
+++ trunk/Source/_javascript_Core/runtime/ObjectPrototype.cpp 2013-08-20 17:12:33 UTC (rev 154337)
@@ -22,6 +22,7 @@
#include "ObjectPrototype.h"
#include "Error.h"
+#include "GetterSetter.h"
#include "JSFunction.h"
#include "JSString.h"
#include "JSStringBuilder.h"
@@ -155,10 +156,10 @@
if (exec->hadException())
return JSValue::encode(jsUndefined());
- PropertyDescriptor descriptor;
- if (thisObject->getPropertyDescriptor(exec, Identifier(exec, exec->argument(0).toString(exec)->value(exec)), descriptor)
- && descriptor.getterPresent())
- return JSValue::encode(descriptor.getter());
+ PropertySlot slot(thisObject);
+ if (thisObject->getPropertySlot(exec, Identifier(exec, exec->argument(0).toString(exec)->value(exec)), slot)
+ && slot.isAccessor())
+ return JSValue::encode(slot.getterSetter()->getter());
return JSValue::encode(jsUndefined());
}
@@ -169,10 +170,10 @@
if (exec->hadException())
return JSValue::encode(jsUndefined());
- PropertyDescriptor descriptor;
- if (thisObject->getPropertyDescriptor(exec, Identifier(exec, exec->argument(0).toString(exec)->value(exec)), descriptor)
- && descriptor.setterPresent())
- return JSValue::encode(descriptor.setter());
+ PropertySlot slot(thisObject);
+ if (thisObject->getPropertySlot(exec, Identifier(exec, exec->argument(0).toString(exec)->value(exec)), slot)
+ && slot.isAccessor())
+ return JSValue::encode(slot.getterSetter()->setter());
return JSValue::encode(jsUndefined());
}
Modified: trunk/Source/_javascript_Core/runtime/PropertyDescriptor.h (154336 => 154337)
--- trunk/Source/_javascript_Core/runtime/PropertyDescriptor.h 2013-08-20 17:09:03 UTC (rev 154336)
+++ trunk/Source/_javascript_Core/runtime/PropertyDescriptor.h 2013-08-20 17:12:33 UTC (rev 154337)
@@ -94,7 +94,7 @@
/* Workaround, JSDOMWindow::getOwnPropertySlot searches the prototype chain. :-( */ \
if (slot.slotBase() != object && slot.slotBase() && slot.slotBase()->methodTable()->toThis(slot.slotBase(), exec, NotStrictMode) != object) \
return false; \
- if (slot.isGetter()) \
+ if (slot.isAccessor()) \
descriptor.setAccessorDescriptor(slot.getterSetter(), slot.attributes()); \
else \
descriptor.setDescriptor(slot.getValue(exec, propertyName), slot.attributes()); \
Modified: trunk/Source/_javascript_Core/runtime/PropertySlot.h (154336 => 154337)
--- trunk/Source/_javascript_Core/runtime/PropertySlot.h 2013-08-20 17:09:03 UTC (rev 154336)
+++ trunk/Source/_javascript_Core/runtime/PropertySlot.h 2013-08-20 17:12:33 UTC (rev 154337)
@@ -69,10 +69,10 @@
bool isCacheable() const { return m_offset != invalidOffset; }
bool isValue() const { return m_propertyType == TypeValue; }
- bool isGetter() const { return m_propertyType == TypeGetter; }
+ bool isAccessor() const { return m_propertyType == TypeGetter; }
bool isCustom() const { return m_propertyType == TypeCustom; }
bool isCacheableValue() const { return isCacheable() && isValue(); }
- bool isCacheableGetter() const { return isCacheable() && isGetter(); }
+ bool isCacheableGetter() const { return isCacheable() && isAccessor(); }
bool isCacheableCustom() const { return isCacheable() && isCustom(); }
unsigned attributes() const { return m_attributes; }
@@ -85,7 +85,7 @@
GetterSetter* getterSetter() const
{
- ASSERT(isGetter());
+ ASSERT(isAccessor());
return m_data.getter.getterSetter;
}