return asInt32();
}
- inline double JSValue::uncheckedGetNumber() const
+ inline double JSValue::asNumber() const
{
ASSERT(isNumber());
return isInt32() ? asInt32() : asDouble();
}
- ALWAYS_INLINE JSValue JSValue::toJSNumber(ExecState* exec) const
- {
- return isNumber() ? asValue() : jsNumber(this->toNumber(exec));
- }
-
inline JSValue jsNaN()
{
- return JSValue(nonInlineNaN());
- }
-
- inline bool JSValue::getNumber(double& result) const
- {
- if (isInt32()) {
- result = asInt32();
- return true;
- }
- if (isDouble()) {
- result = asDouble();
- return true;
- }
- return false;
- }
-
- inline bool JSValue::getBoolean(bool& v) const
- {
- if (isTrue()) {
- v = true;
- return true;
- }
- if (isFalse()) {
- v = false;
- return true;
- }
-
- return false;
+ return JSValue(std::numeric_limits<double>::quiet_NaN());
}
inline JSValue::JSValue(char i)
else
u.asBits.tag = EmptyValueTag;
u.asBits.payload = reinterpret_cast<int32_t>(ptr);
-#if ENABLE(JSC_ZOMBIES)
- ASSERT(!isZombie());
-#endif
}
inline JSValue::JSValue(const JSCell* ptr)
else
u.asBits.tag = EmptyValueTag;
u.asBits.payload = reinterpret_cast<int32_t>(const_cast<JSCell*>(ptr));
-#if ENABLE(JSC_ZOMBIES)
- ASSERT(!isZombie());
-#endif
}
inline JSValue::operator bool() const
return u.asInt64 != other.u.asInt64;
}
+ inline bool JSValue::isEmpty() const
+ {
+ return tag() == EmptyValueTag;
+ }
+
inline bool JSValue::isUndefined() const
{
return tag() == UndefinedTag;
return isTrue() || isFalse();
}
- inline bool JSValue::getBoolean() const
+ inline bool JSValue::asBoolean() const
{
ASSERT(isBoolean());
return payload();
inline JSValue::JSValue(JSCell* ptr)
{
u.ptr = ptr;
-#if ENABLE(JSC_ZOMBIES)
- ASSERT(!isZombie());
-#endif
}
inline JSValue::JSValue(const JSCell* ptr)
{
u.ptr = const_cast<JSCell*>(ptr);
-#if ENABLE(JSC_ZOMBIES)
- ASSERT(!isZombie());
-#endif
}
inline JSValue::operator bool() const
return u.ptr != other.u.ptr;
}
+ inline bool JSValue::isEmpty() const
+ {
+ return u.asInt64 == ValueEmpty;
+ }
+
inline bool JSValue::isUndefined() const
{
- return asValue() == jsUndefined();
+ return asValue() == JSValue(JSUndefined);
}
inline bool JSValue::isNull() const
{
- return asValue() == jsNull();
+ return asValue() == JSValue(JSNull);
}
inline bool JSValue::isTrue() const
return asValue() == JSValue(JSFalse);
}
- inline bool JSValue::getBoolean() const
+ inline bool JSValue::asBoolean() const
{
- ASSERT(asValue() == jsBoolean(true) || asValue() == jsBoolean(false));
- return asValue() == jsBoolean(true);
+ ASSERT(isBoolean());
+ return asValue() == JSValue(JSTrue);
}
inline int32_t JSValue::asInt32() const
inline double JSValue::asDouble() const
{
+ ASSERT(isDouble());
return reinterpretIntptrToDouble(u.asInt64 - DoubleEncodeOffset);
}