Changeset 88587 in webkit for trunk/Source/JavaScriptCore/API


Ignore:
Timestamp:
Jun 10, 2011, 7:03:00 PM (14 years ago)
Author:
[email protected]
Message:

https://bugs.webkit.org/show_bug.cgi?id=16777
Eliminate JSC::NaN and JSC::Inf

Reviewed by Sam Weinig.

There's no good reason for -K-J-S- JSC to have its own NAN and infinity constants.
The ones in std::numeric_limits are perfectly good.

Remove JSC::Inf, JSC::NaN, switch some cases of (isnan
isinf) to !isfinite.

Source/JavaScriptCore:

  • API/JSCallbackObjectFunctions.h:

(JSC::::toNumber):

  • API/JSValueRef.cpp:

(JSValueMakeNumber):
(JSValueToNumber):

(JSC::CachedTranscendentalFunction::initialize):

  • runtime/DateConstructor.cpp:

(JSC::constructDate):

  • runtime/DateInstanceCache.h:

(JSC::DateInstanceData::DateInstanceData):
(JSC::DateInstanceCache::reset):

  • runtime/JSCell.cpp:
  • runtime/JSCell.h:

(JSC::JSCell::JSValue::getPrimitiveNumber):
(JSC::JSCell::JSValue::toNumber):

  • runtime/JSGlobalData.cpp:

(JSC::JSGlobalData::JSGlobalData):
(JSC::JSGlobalData::resetDateCache):

  • runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::reset):

  • runtime/JSGlobalObjectFunctions.cpp:

(JSC::globalFuncParseInt):
(JSC::globalFuncIsFinite):

  • runtime/JSNotAnObject.cpp:

(JSC::JSNotAnObject::toNumber):

  • runtime/JSValue.cpp:
  • runtime/JSValue.h:
  • runtime/JSValueInlineMethods.h:

(JSC::jsNaN):

  • runtime/MathObject.cpp:

(JSC::mathProtoFuncMax):
(JSC::mathProtoFuncMin):

  • runtime/NumberConstructor.cpp:

(JSC::numberConstructorNegInfinity):
(JSC::numberConstructorPosInfinity):

  • runtime/NumberPrototype.cpp:

(JSC::numberProtoFuncToExponential):
(JSC::numberProtoFuncToFixed):
(JSC::numberProtoFuncToPrecision):
(JSC::numberProtoFuncToString):

  • runtime/UString.cpp:
  • wtf/DecimalNumber.h:

(WTF::DecimalNumber::DecimalNumber):

  • wtf/dtoa.cpp:

(WTF::dtoa):

Source/WebCore:

  • bindings/js/JSDataViewCustom.cpp:

(WebCore::getDataViewMember):

Location:
trunk/Source/JavaScriptCore/API
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h

    r87588 r88587  
    445445    // primitive
    446446    if (exec->hadException())
    447         return NaN;
     447        return std::numeric_limits<double>::quiet_NaN();
    448448    JSContextRef ctx = toRef(exec);
    449449    JSObjectRef thisRef = toRef(this);
     
    464464            double dValue;
    465465            if (value)
    466                 return toJS(exec, value).getNumber(dValue) ? dValue : NaN;
     466                return toJS(exec, value).getNumber(dValue) ? dValue : std::numeric_limits<double>::quiet_NaN();
    467467        }
    468468           
  • trunk/Source/JavaScriptCore/API/JSValueRef.cpp

    r79132 r88587  
    218218    // but an external NaN might not.
    219219    if (isnan(value))
    220         value = NaN;
     220        value = std::numeric_limits<double>::quiet_NaN();
    221221
    222222    return toRef(exec, jsNumber(value));
     
    277277            *exception = toRef(exec, exec->exception());
    278278        exec->clearException();
    279         number = NaN;
     279        number = std::numeric_limits<double>::quiet_NaN();
    280280    }
    281281    return number;
Note: See TracChangeset for help on using the changeset viewer.