diff options
Diffstat (limited to 'src/3rdparty/javascriptcore/JavaScriptCore/runtime')
13 files changed, 63 insertions, 64 deletions
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateConstructor.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateConstructor.cpp index e9a5c29..885d8a1 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateConstructor.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateConstructor.cpp @@ -30,7 +30,6 @@ #include "JSString.h" #include "ObjectPrototype.h" #include "PrototypeFunction.h" -#include <math.h> #include <time.h> #include <wtf/DateMath.h> #include <wtf/MathExtras.h> @@ -89,13 +88,13 @@ JSObject* constructDate(ExecState* exec, const ArgList& args) value = primitive.toNumber(exec); } } else { - if (isnan(args.at(0).toNumber(exec)) - || isnan(args.at(1).toNumber(exec)) - || (numArgs >= 3 && isnan(args.at(2).toNumber(exec))) - || (numArgs >= 4 && isnan(args.at(3).toNumber(exec))) - || (numArgs >= 5 && isnan(args.at(4).toNumber(exec))) - || (numArgs >= 6 && isnan(args.at(5).toNumber(exec))) - || (numArgs >= 7 && isnan(args.at(6).toNumber(exec)))) + if (std::isnan(args.at(0).toNumber(exec)) + || std::isnan(args.at(1).toNumber(exec)) + || (numArgs >= 3 && std::isnan(args.at(2).toNumber(exec))) + || (numArgs >= 4 && std::isnan(args.at(3).toNumber(exec))) + || (numArgs >= 5 && std::isnan(args.at(4).toNumber(exec))) + || (numArgs >= 6 && std::isnan(args.at(5).toNumber(exec))) + || (numArgs >= 7 && std::isnan(args.at(6).toNumber(exec)))) value = NaN; else { GregorianDateTime t; @@ -129,10 +128,8 @@ ConstructType DateConstructor::getConstructData(ConstructData& constructData) // ECMA 15.9.2 static JSValue JSC_HOST_CALL callDate(ExecState* exec, JSObject*, JSValue, const ArgList&) { - time_t localTime = time(0); - tm localTM; - getLocalTime(&localTime, &localTM); - GregorianDateTime ts(exec, localTM); + GregorianDateTime ts; + msToGregorianDateTime(exec, currentTimeMS(), false, ts); DateConversionBuffer date; DateConversionBuffer time; formatDate(ts, date); @@ -159,13 +156,13 @@ static JSValue JSC_HOST_CALL dateNow(ExecState* exec, JSObject*, JSValue, const static JSValue JSC_HOST_CALL dateUTC(ExecState* exec, JSObject*, JSValue, const ArgList& args) { int n = args.size(); - if (isnan(args.at(0).toNumber(exec)) - || isnan(args.at(1).toNumber(exec)) - || (n >= 3 && isnan(args.at(2).toNumber(exec))) - || (n >= 4 && isnan(args.at(3).toNumber(exec))) - || (n >= 5 && isnan(args.at(4).toNumber(exec))) - || (n >= 6 && isnan(args.at(5).toNumber(exec))) - || (n >= 7 && isnan(args.at(6).toNumber(exec)))) + if (std::isnan(args.at(0).toNumber(exec)) + || std::isnan(args.at(1).toNumber(exec)) + || (n >= 3 && std::isnan(args.at(2).toNumber(exec))) + || (n >= 4 && std::isnan(args.at(3).toNumber(exec))) + || (n >= 5 && std::isnan(args.at(4).toNumber(exec))) + || (n >= 6 && std::isnan(args.at(5).toNumber(exec))) + || (n >= 7 && std::isnan(args.at(6).toNumber(exec)))) return jsNaN(exec); GregorianDateTime t; diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateInstance.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateInstance.cpp index 77a92be..506067a 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateInstance.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateInstance.cpp @@ -24,7 +24,6 @@ #include "JSGlobalObject.h" -#include <math.h> #include <wtf/DateMath.h> #include <wtf/MathExtras.h> @@ -49,7 +48,7 @@ DateInstance::DateInstance(ExecState* exec, double time) const GregorianDateTime* DateInstance::calculateGregorianDateTime(ExecState* exec) const { double milli = internalNumber(); - if (isnan(milli)) + if (std::isnan(milli)) return 0; if (!m_data) @@ -65,7 +64,7 @@ const GregorianDateTime* DateInstance::calculateGregorianDateTime(ExecState* exe const GregorianDateTime* DateInstance::calculateGregorianDateTimeUTC(ExecState* exec) const { double milli = internalNumber(); - if (isnan(milli)) + if (std::isnan(milli)) return 0; if (!m_data) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/DatePrototype.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/DatePrototype.cpp index ca9d4ea..fe24ecf 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/DatePrototype.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/DatePrototype.cpp @@ -299,7 +299,7 @@ static bool fillStructuresUsingTimeArgs(ExecState* exec, const ArgList& args, in // milliseconds if (idx < numArgs) { double millis = args.at(idx).toNumber(exec); - ok = isfinite(millis); + ok = std::isfinite(millis); milliseconds += millis; } else milliseconds += *ms; @@ -736,7 +736,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetMilliSeconds(ExecState* exec, JSObject*, J DateInstance* thisDateObj = asDateInstance(thisValue); double milli = thisDateObj->internalNumber(); - if (isnan(milli)) + if (std::isnan(milli)) return jsNaN(exec); double secs = floor(milli / msPerSecond); @@ -751,7 +751,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCMilliseconds(ExecState* exec, JSObject* DateInstance* thisDateObj = asDateInstance(thisValue); double milli = thisDateObj->internalNumber(); - if (isnan(milli)) + if (std::isnan(milli)) return jsNaN(exec); double secs = floor(milli / msPerSecond); @@ -793,7 +793,7 @@ static JSValue setNewValueFromTimeArgs(ExecState* exec, JSValue thisValue, const DateInstance* thisDateObj = asDateInstance(thisValue); double milli = thisDateObj->internalNumber(); - if (args.isEmpty() || isnan(milli)) { + if (args.isEmpty() || std::isnan(milli)) { JSValue result = jsNaN(exec); thisDateObj->setInternalValue(result); return result; @@ -837,7 +837,7 @@ static JSValue setNewValueFromDateArgs(ExecState* exec, JSValue thisValue, const double ms = 0; GregorianDateTime gregorianDateTime; - if (numArgsToUse == 3 && isnan(milli)) + if (numArgsToUse == 3 && std::isnan(milli)) msToGregorianDateTime(exec, 0, true, gregorianDateTime); else { ms = milli - floor(milli / msPerSecond) * msPerSecond; @@ -960,7 +960,7 @@ JSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState* exec, JSObject*, JSValue t double ms = 0; GregorianDateTime gregorianDateTime; - if (isnan(milli)) + if (std::isnan(milli)) // Based on ECMA 262 B.2.5 (setYear) // the time must be reset to +0 if it is NaN. msToGregorianDateTime(exec, 0, true, gregorianDateTime); diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalData.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalData.cpp index 1c25c16..f90d495 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalData.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalData.cpp @@ -143,7 +143,6 @@ JSGlobalData::JSGlobalData(bool isShared) , functionCodeBlockBeingReparsed(0) , firstStringifierToMark(0) , markStack(jsArrayVPtr) - , cachedUTCOffset(NaN) #ifndef NDEBUG , mainThreadOnly(false) #endif @@ -259,8 +258,7 @@ JSGlobalData::ClientData::~ClientData() void JSGlobalData::resetDateCache() { - cachedUTCOffset = NaN; - dstOffsetCache.reset(); + localTimeOffsetCache.reset(); cachedDateString = UString(); dateInstanceCache.reset(); } diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalData.h b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalData.h index e38a2bc..6431978 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalData.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalData.h @@ -39,6 +39,7 @@ #include "SmallStrings.h" #include "TimeoutChecker.h" #include "WeakRandom.h" +#include <wtf/DateMath.h> #include <wtf/Forward.h> #include <wtf/HashMap.h> #include <wtf/RefCounted.h> @@ -63,21 +64,23 @@ namespace JSC { struct HashTable; struct Instruction; - struct DSTOffsetCache { - DSTOffsetCache() + struct LocalTimeOffsetCache { + LocalTimeOffsetCache() + : start(0.0) + , end(-1.0) + , increment(0.0) { - reset(); } - + void reset() { - offset = 0.0; + offset = LocalTimeOffset(); start = 0.0; end = -1.0; increment = 0.0; } - double offset; + LocalTimeOffset offset; double start; double end; double increment; @@ -180,8 +183,7 @@ namespace JSC { MarkStack markStack; - double cachedUTCOffset; - DSTOffsetCache dstOffsetCache; + LocalTimeOffsetCache localTimeOffsetCache; UString cachedDateString; double cachedDateStringValue; diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp index 0bc1274..2e2853e 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp @@ -309,9 +309,9 @@ JSValue JSC_HOST_CALL globalFuncParseInt(ExecState* exec, JSObject*, JSValue, co if (value.isDouble()) { double d = value.asDouble(); - if (isfinite(d)) + if (std::isfinite(d)) return jsNumber(exec, (d > 0) ? floor(d) : ceil(d)); - if (isnan(d) || isinf(d)) + if (std::isnan(d) || std::isinf(d)) return jsNaN(exec); return jsNumber(exec, 0); } @@ -326,13 +326,13 @@ JSValue JSC_HOST_CALL globalFuncParseFloat(ExecState* exec, JSObject*, JSValue, JSValue JSC_HOST_CALL globalFuncIsNaN(ExecState* exec, JSObject*, JSValue, const ArgList& args) { - return jsBoolean(isnan(args.at(0).toNumber(exec))); + return jsBoolean(std::isnan(args.at(0).toNumber(exec))); } JSValue JSC_HOST_CALL globalFuncIsFinite(ExecState* exec, JSObject*, JSValue, const ArgList& args) { double n = args.at(0).toNumber(exec); - return jsBoolean(!isnan(n) && !isinf(n)); + return jsBoolean(!std::isnan(n) && !std::isinf(n)); } JSValue JSC_HOST_CALL globalFuncDecodeURI(ExecState* exec, JSObject*, JSValue, const ArgList& args) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSImmediate.h b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSImmediate.h index 06548ce..ae0e9c0 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSImmediate.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSImmediate.h @@ -26,11 +26,13 @@ #if !USE(JSVALUE32_64) +#include "JSValue.h" + #include <wtf/Assertions.h> #include <wtf/AlwaysInline.h> #include <wtf/MathExtras.h> #include <wtf/StdLibExtras.h> -#include "JSValue.h" + #include <limits> #include <limits.h> #include <stdarg.h> @@ -490,7 +492,7 @@ namespace JSC { const int intVal = static_cast<int>(d); // Check for data loss from conversion to int. - if (intVal != d || (!intVal && signbit(d))) + if (intVal != d || (!intVal && std::signbit(d))) return fromNumberOutsideIntegerRange(d); return from(intVal); diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSONObject.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSONObject.cpp index daacbdb..608af9d 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSONObject.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSONObject.cpp @@ -399,7 +399,7 @@ Stringifier::StringifyResult Stringifier::appendStringifiedValue(StringBuilder& double numericValue; if (value.getNumber(numericValue)) { - if (!isfinite(numericValue)) + if (!std::isfinite(numericValue)) builder.append("null"); else builder.append(UString::from(numericValue)); diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSValue.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSValue.cpp index 502312c..9108cfe 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSValue.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSValue.cpp @@ -43,7 +43,7 @@ double JSValue::toInteger(ExecState* exec) const if (isInt32()) return asInt32(); double d = toNumber(exec); - return isnan(d) ? 0.0 : trunc(d); + return std::isnan(d) ? 0.0 : trunc(d); } double JSValue::toIntegerPreserveNaN(ExecState* exec) const @@ -141,7 +141,7 @@ int32_t toInt32SlowCase(double d, bool& ok) if (d >= -D32 / 2 && d < D32 / 2) return static_cast<int32_t>(d); - if (isnan(d) || isinf(d)) { + if (std::isnan(d) || std::isinf(d)) { ok = false; return 0; } @@ -161,7 +161,7 @@ uint32_t toUInt32SlowCase(double d, bool& ok) if (d >= 0.0 && d < D32) return static_cast<uint32_t>(d); - if (isnan(d) || isinf(d)) { + if (std::isnan(d) || std::isinf(d)) { ok = false; return 0; } diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSValue.h b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSValue.h index 6da921f..501ab5e 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSValue.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSValue.h @@ -25,7 +25,6 @@ #include "CallData.h" #include "ConstructData.h" -#include <math.h> #include <stddef.h> // for size_t #include <stdint.h> #include <wtf/AlwaysInline.h> @@ -612,7 +611,7 @@ namespace JSC { inline JSValue::JSValue(ExecState* exec, double d) { const int32_t asInt32 = static_cast<int32_t>(d); - if (asInt32 != d || (!asInt32 && signbit(d))) { // true for -0.0 + if (asInt32 != d || (!asInt32 && std::signbit(d))) { // true for -0.0 u.asDouble = d; return; } @@ -693,7 +692,7 @@ namespace JSC { inline JSValue::JSValue(JSGlobalData* globalData, double d) { const int32_t asInt32 = static_cast<int32_t>(d); - if (asInt32 != d || (!asInt32 && signbit(d))) { // true for -0.0 + if (asInt32 != d || (!asInt32 && std::signbit(d))) { // true for -0.0 u.asDouble = d; return; } diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/MathObject.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/MathObject.cpp index 807cfe7..023fe13 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/MathObject.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/MathObject.cpp @@ -29,6 +29,8 @@ #include <wtf/RandomNumber.h> #include <wtf/RandomNumberSeed.h> +using std::signbit; + namespace JSC { ASSERT_CLASS_FITS_IN_CELL(MathObject); @@ -168,7 +170,7 @@ JSValue JSC_HOST_CALL mathProtoFuncMax(ExecState* exec, JSObject*, JSValue, cons double result = -Inf; for (unsigned k = 0; k < argsCount; ++k) { double val = args.at(k).toNumber(exec); - if (isnan(val)) { + if (std::isnan(val)) { result = NaN; break; } @@ -184,7 +186,7 @@ JSValue JSC_HOST_CALL mathProtoFuncMin(ExecState* exec, JSObject*, JSValue, cons double result = +Inf; for (unsigned k = 0; k < argsCount; ++k) { double val = args.at(k).toNumber(exec); - if (isnan(val)) { + if (std::isnan(val)) { result = NaN; break; } @@ -201,9 +203,9 @@ JSValue JSC_HOST_CALL mathProtoFuncPow(ExecState* exec, JSObject*, JSValue, cons double arg = args.at(0).toNumber(exec); double arg2 = args.at(1).toNumber(exec); - if (isnan(arg2)) + if (std::isnan(arg2)) return jsNaN(exec); - if (isinf(arg2) && fabs(arg) == 1) + if (std::isinf(arg2) && fabs(arg) == 1) return jsNaN(exec); return jsNumber(exec, pow(arg, arg2)); } diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/NumberPrototype.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/NumberPrototype.cpp index 67210fa..584a57f 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/NumberPrototype.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/NumberPrototype.cpp @@ -157,7 +157,7 @@ JSValue JSC_HOST_CALL numberProtoFuncToString(ExecState* exec, JSObject*, JSValu char s[2048 + 3]; const char* lastCharInString = s + sizeof(s) - 1; double x = v.uncheckedGetNumber(); - if (isnan(x) || isinf(x)) + if (std::isnan(x) || std::isinf(x)) return jsString(exec, UString::from(x)); bool isNegative = x < 0.0; @@ -233,7 +233,7 @@ JSValue JSC_HOST_CALL numberProtoFuncToFixed(ExecState* exec, JSObject*, JSValue int f = static_cast<int>(df); double x = v.uncheckedGetNumber(); - if (isnan(x)) + if (std::isnan(x)) return jsNontrivialString(exec, "NaN"); UString s; @@ -319,7 +319,7 @@ JSValue JSC_HOST_CALL numberProtoFuncToExponential(ExecState* exec, JSObject*, J double x = v.uncheckedGetNumber(); - if (isnan(x) || isinf(x)) + if (std::isnan(x) || std::isinf(x)) return jsString(exec, UString::from(x)); JSValue fractionalDigitsValue = args.at(0); @@ -345,7 +345,7 @@ JSValue JSC_HOST_CALL numberProtoFuncToExponential(ExecState* exec, JSObject*, J decimalAdjust = static_cast<int>(logx); } - if (isnan(x)) + if (std::isnan(x)) return jsNontrivialString(exec, "NaN"); if (x == -0.0) // (-0.0).toExponential() should print as 0 instead of -0 @@ -391,7 +391,7 @@ JSValue JSC_HOST_CALL numberProtoFuncToPrecision(ExecState* exec, JSObject*, JSV double doublePrecision = args.at(0).toIntegerPreserveNaN(exec); double x = v.uncheckedGetNumber(); - if (args.at(0).isUndefined() || isnan(x) || isinf(x)) + if (args.at(0).isUndefined() || std::isnan(x) || std::isinf(x)) return jsString(exec, v.toString(exec)); UString s; diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/StringPrototype.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/StringPrototype.cpp index d002e07..6c6a094 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/StringPrototype.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/StringPrototype.cpp @@ -480,7 +480,7 @@ JSValue JSC_HOST_CALL stringProtoFuncLastIndexOf(ExecState* exec, JSObject*, JSV dpos = len; #if OS(SYMBIAN) // Work around for broken NaN compare operator - else if (isnan(dpos)) + else if (std::isnan(dpos)) dpos = len; #endif return jsNumber(exec, s.rfind(u2, static_cast<int>(dpos))); @@ -680,9 +680,9 @@ JSValue JSC_HOST_CALL stringProtoFuncSubstring(ExecState* exec, JSObject*, JSVal double start = a0.toNumber(exec); double end = a1.toNumber(exec); - if (isnan(start)) + if (std::isnan(start)) start = 0; - if (isnan(end)) + if (std::isnan(end)) end = 0; if (start < 0) start = 0; |