diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-05-24 08:28:08 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-05-24 08:28:08 +0000 |
commit | a4e969f4965059196ca948db781e52f7cfebf19e (patch) | |
tree | 6ca352808c8fdc52006a0f33f6ae3c593b23867d /Source/JavaScriptCore/runtime/PropertyDescriptor.cpp | |
parent | 41386e9cb918eed93b3f13648cbef387e371e451 (diff) | |
download | WebKitGtk-tarball-a4e969f4965059196ca948db781e52f7cfebf19e.tar.gz |
webkitgtk-2.12.3webkitgtk-2.12.3
Diffstat (limited to 'Source/JavaScriptCore/runtime/PropertyDescriptor.cpp')
-rw-r--r-- | Source/JavaScriptCore/runtime/PropertyDescriptor.cpp | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/Source/JavaScriptCore/runtime/PropertyDescriptor.cpp b/Source/JavaScriptCore/runtime/PropertyDescriptor.cpp index 1dd35605c..8e5681bc4 100644 --- a/Source/JavaScriptCore/runtime/PropertyDescriptor.cpp +++ b/Source/JavaScriptCore/runtime/PropertyDescriptor.cpp @@ -30,7 +30,7 @@ #include "GetterSetter.h" #include "JSObject.h" -#include "Operations.h" +#include "JSCInlines.h" namespace JSC { unsigned PropertyDescriptor::defaultAttributes = DontDelete | DontEnum | ReadOnly; @@ -106,8 +106,8 @@ void PropertyDescriptor::setDescriptor(JSValue value, unsigned attributes) 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; @@ -115,14 +115,24 @@ void PropertyDescriptor::setDescriptor(JSValue value, unsigned attributes) } } +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; } @@ -176,8 +186,10 @@ bool sameValue(ExecState* exec, JSValue a, JSValue b) 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); } @@ -220,7 +232,7 @@ unsigned PropertyDescriptor::attributesOverridingCurrent(const PropertyDescripto overrideMask |= DontDelete; if (isAccessorDescriptor()) overrideMask |= Accessor; - return (m_attributes & overrideMask) | (currentAttributes & ~overrideMask); + return (m_attributes & overrideMask) | (currentAttributes & ~overrideMask & ~CustomAccessor); } } |