#include "GetterSetter.h"
#include "JSObject.h"
-#include "Operations.h"
+#include "JSCInlines.h"
namespace JSC {
-unsigned PropertyDescriptor::defaultAttributes = (DontDelete << 1) - 1;
+unsigned PropertyDescriptor::defaultAttributes = DontDelete | DontEnum | ReadOnly;
bool PropertyDescriptor::writable() const
{
m_attributes &= ~ReadOnly; // FIXME: we should be able to ASSERT this!
GetterSetter* accessor = asGetterSetter(value);
- m_getter = accessor->getter() ? accessor->getter() : jsUndefined();
- m_setter = accessor->setter() ? accessor->setter() : jsUndefined();
+ m_getter = !accessor->isGetterNull() ? accessor->getter() : jsUndefined();
+ m_setter = !accessor->isSetterNull() ? accessor->setter() : jsUndefined();
m_seenAttributes = EnumerablePresent | ConfigurablePresent;
} else {
m_value = value;
}
}
+void PropertyDescriptor::setCustomDescriptor(unsigned attributes)
+{
+ m_attributes = attributes | Accessor | CustomAccessor;
+ m_attributes &= ~ReadOnly;
+ m_seenAttributes = EnumerablePresent | ConfigurablePresent;
+ setGetter(jsUndefined());
+ setSetter(jsUndefined());
+ m_value = JSValue();
+}
+
void PropertyDescriptor::setAccessorDescriptor(GetterSetter* accessor, unsigned attributes)
{
ASSERT(attributes & Accessor);
attributes &= ~ReadOnly; // FIXME: we should be able to ASSERT this!
m_attributes = attributes;
- m_getter = accessor->getter() ? accessor->getter() : jsUndefined();
- m_setter = accessor->setter() ? accessor->setter() : jsUndefined();
+ m_getter = !accessor->isGetterNull() ? accessor->getter() : jsUndefined();
+ m_setter = !accessor->isSetterNull() ? accessor->setter() : jsUndefined();
m_seenAttributes = EnumerablePresent | ConfigurablePresent;
}
return false;
double x = a.asNumber();
double y = b.asNumber();
- if (std::isnan(x))
- return std::isnan(y);
+ bool xIsNaN = std::isnan(x);
+ bool yIsNaN = std::isnan(y);
+ if (xIsNaN || yIsNaN)
+ return xIsNaN && yIsNaN;
return bitwise_cast<uint64_t>(x) == bitwise_cast<uint64_t>(y);
}
bool PropertyDescriptor::equalTo(ExecState* exec, const PropertyDescriptor& other) const
{
- if (!other.m_value == m_value ||
- !other.m_getter == m_getter ||
- !other.m_setter == m_setter)
+ if (other.m_value.isEmpty() != m_value.isEmpty()
+ || other.m_getter.isEmpty() != m_getter.isEmpty()
+ || other.m_setter.isEmpty() != m_setter.isEmpty())
return false;
return (!m_value || sameValue(exec, other.m_value, m_value))
&& (!m_getter || JSValue::strictEqual(exec, other.m_getter, m_getter))