X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/9dae56ea45a0f5f8136a5c93d6f3a7f99399ca73..f9bf01c6616d5ddcf65b13b33cedf9e387ff7a63:/runtime/JSNumberCell.cpp?ds=inline diff --git a/runtime/JSNumberCell.cpp b/runtime/JSNumberCell.cpp index dd965d5..f1009b9 100644 --- a/runtime/JSNumberCell.cpp +++ b/runtime/JSNumberCell.cpp @@ -23,19 +23,19 @@ #include "config.h" #include "JSNumberCell.h" +#if USE(JSVALUE32) + #include "NumberObject.h" #include "UString.h" namespace JSC { -#if !USE(ALTERNATE_JSIMMEDIATE) - -JSValuePtr JSNumberCell::toPrimitive(ExecState*, PreferredPrimitiveType) const +JSValue JSNumberCell::toPrimitive(ExecState*, PreferredPrimitiveType) const { return const_cast(this); } -bool JSNumberCell::getPrimitiveNumber(ExecState*, double& number, JSValuePtr& value) +bool JSNumberCell::getPrimitiveNumber(ExecState*, double& number, JSValue& value) { number = m_value; value = this; @@ -54,15 +54,11 @@ double JSNumberCell::toNumber(ExecState*) const UString JSNumberCell::toString(ExecState*) const { - if (m_value == 0.0) // +0.0 or -0.0 - return "0"; return UString::from(m_value); } UString JSNumberCell::toThisString(ExecState*) const { - if (m_value == 0.0) // +0.0 or -0.0 - return "0"; return UString::from(m_value); } @@ -82,45 +78,36 @@ bool JSNumberCell::getUInt32(uint32_t& uint32) const return uint32 == m_value; } -bool JSNumberCell::getTruncatedInt32(int32_t& int32) const -{ - if (!(m_value >= -2147483648.0 && m_value < 2147483648.0)) - return false; - int32 = static_cast(m_value); - return true; -} - -bool JSNumberCell::getTruncatedUInt32(uint32_t& uint32) const -{ - if (!(m_value >= 0.0 && m_value < 4294967296.0)) - return false; - uint32 = static_cast(m_value); - return true; -} - -JSValuePtr JSNumberCell::getJSNumber() +JSValue JSNumberCell::getJSNumber() { return this; } -JSValuePtr jsNumberCell(ExecState* exec, double d) +JSValue jsNumberCell(ExecState* exec, double d) { return new (exec) JSNumberCell(exec, d); } -JSValuePtr jsNumberCell(JSGlobalData* globalData, double d) +JSValue jsNumberCell(JSGlobalData* globalData, double d) { return new (globalData) JSNumberCell(globalData, d); } -#else +} // namespace JSC -JSValuePtr jsNumberCell(ExecState*, double) +#else // USE(JSVALUE32) + +// Keep our exported symbols lists happy. +namespace JSC { + +JSValue jsNumberCell(ExecState*, double); + +JSValue jsNumberCell(ExecState*, double) { ASSERT_NOT_REACHED(); - return noValue(); + return JSValue(); } -#endif - } // namespace JSC + +#endif // USE(JSVALUE32)