summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-10-09 18:09:47 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2014-10-09 18:09:47 +0200
commit9eed22222c02653a88d1a78b435f8f974c004d97 (patch)
tree35faeb21c465c75dc40f897ff0ecb0495874dfca
parent9dd05f9bf449acc5645e868495b936af3aa40ca6 (diff)
parentdb84d1737cb70244eef271b91d1cea61c3e76963 (diff)
downloadqtscript-9eed22222c02653a88d1a78b435f8f974c004d97.tar.gz
Merge remote-tracking branch 'origin/5.4' into dev
Change-Id: I6999b1c1d74c31615d75adc6126fbf2799a98f51
-rw-r--r--.gitignore1
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateConstructor.cpp35
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/runtime/DateInstance.cpp5
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/runtime/DatePrototype.cpp12
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalData.cpp4
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalData.h18
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp8
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSImmediate.h6
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSONObject.cpp2
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSValue.cpp6
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSValue.h5
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/runtime/MathObject.cpp10
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/runtime/NumberPrototype.cpp10
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/runtime/StringPrototype.cpp6
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/wtf/DateMath.cpp144
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/wtf/DateMath.h60
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashTable.h13
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/wtf/MathExtras.h44
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h2
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/wtf/TypeTraits.h24
-rw-r--r--src/3rdparty/javascriptcore/JavaScriptCore/wtf/dtoa.cpp5
-rw-r--r--src/script/script.pro4
-rw-r--r--tests/auto/qscriptjstestsuite/expect_fail.txt6
-rw-r--r--tests/auto/qscriptv8testsuite/skip.txt1
24 files changed, 230 insertions, 201 deletions
diff --git a/.gitignore b/.gitignore
index ca8cd56..375ab18 100644
--- a/.gitignore
+++ b/.gitignore
@@ -69,7 +69,6 @@ bin/pixeltool*
bin/qmake*
bin/qdoc3*
bin/qt3to4*
-bin/qtdemo*
bin/qttracereplay*
bin/rcc*
bin/uic*
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;
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/DateMath.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/DateMath.cpp
index b9a0207..a2a4d30 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/DateMath.cpp
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/DateMath.cpp
@@ -74,7 +74,6 @@
#include "Assertions.h"
#include "ASCIICType.h"
#include "CurrentTime.h"
-#include "MathExtras.h"
#include "StringExtras.h"
#include <algorithm>
@@ -105,6 +104,8 @@ extern "C" struct tm * localtime(const time_t *timer);
#include "CallFrame.h"
#endif
+#include "MathExtras.h"
+
#define NaN std::numeric_limits<double>::quiet_NaN()
using namespace WTF;
@@ -377,6 +378,8 @@ int equivalentYearForDST(int year)
return year;
}
+#if !HAVE(TM_GMTOFF)
+
static int32_t calculateUTCOffset()
{
#if PLATFORM(BREWMP)
@@ -418,23 +421,15 @@ static int32_t calculateUTCOffset()
/*
* Get the DST offset for the time passed in.
*/
-static double calculateDSTOffsetSimple(double localTimeSeconds, double utcOffset)
+static double calculateDSTOffset(time_t localTime, double utcOffset)
{
- if (localTimeSeconds > maxUnixTime)
- localTimeSeconds = maxUnixTime;
- else if (localTimeSeconds < 0) // Go ahead a day to make localtime work (does not work with 0)
- localTimeSeconds += secondsPerDay;
-
//input is UTC so we have to shift back to local time to determine DST thus the + getUTCOffset()
- double offsetTime = (localTimeSeconds * msPerSecond) + utcOffset;
+ double offsetTime = (localTime * msPerSecond) + utcOffset;
// Offset from UTC but doesn't include DST obviously
int offsetHour = msToHours(offsetTime);
int offsetMinute = msToMinutes(offsetTime);
- // FIXME: time_t has a potential problem in 2038
- time_t localTime = static_cast<time_t>(localTimeSeconds);
-
tm localTM;
getLocalTime(&localTime, &localTM);
@@ -446,10 +441,12 @@ static double calculateDSTOffsetSimple(double localTimeSeconds, double utcOffset
return (diff * msPerSecond);
}
-// Get the DST offset, given a time in UTC
-static double calculateDSTOffset(double ms, double utcOffset)
+#endif
+
+// Returns combined offset in millisecond (UTC + DST).
+LocalTimeOffset calculateLocalTimeOffset(double ms)
{
- // On Mac OS X, the call to localtime (see calculateDSTOffsetSimple) will return historically accurate
+ // On Mac OS X, the call to localtime (see calculateDSTOffset) will return historically accurate
// DST information (e.g. New Zealand did not have DST from 1946 to 1974) however the JavaScript
// standard explicitly dictates that historical information should not be considered when
// determining DST. For this reason we shift away from years that localtime can handle but would
@@ -465,7 +462,23 @@ static double calculateDSTOffset(double ms, double utcOffset)
ms = (day * msPerDay) + msToMilliseconds(ms);
}
- return calculateDSTOffsetSimple(ms / msPerSecond, utcOffset);
+ double localTimeSeconds = ms / msPerSecond;
+ if (localTimeSeconds > maxUnixTime)
+ localTimeSeconds = maxUnixTime;
+ else if (localTimeSeconds < 0) // Go ahead a day to make localtime work (does not work with 0).
+ localTimeSeconds += secondsPerDay;
+ // FIXME: time_t has a potential problem in 2038.
+ time_t localTime = static_cast<time_t>(localTimeSeconds);
+
+#if HAVE(TM_GMTOFF)
+ tm localTM;
+ getLocalTime(&localTime, &localTM);
+ return LocalTimeOffset(localTM.tm_isdst, localTM.tm_gmtoff * msPerSecond);
+#else
+ double utcOffset = calculateUTCOffset();
+ double dstOffset = calculateDSTOffset(localTime, utcOffset);
+ return LocalTimeOffset(dstOffset, utcOffset + dstOffset);
+#endif
}
void initializeDates()
@@ -834,21 +847,19 @@ double parseDateFromNullTerminatedCharacters(const char* dateString)
bool haveTZ;
int offset;
double ms = parseDateFromNullTerminatedCharacters(dateString, haveTZ, offset);
- if (isnan(ms))
+ if (std::isnan(ms))
return NaN;
// fall back to local timezone
- if (!haveTZ) {
- double utcOffset = calculateUTCOffset();
- double dstOffset = calculateDSTOffset(ms, utcOffset);
- offset = static_cast<int>((utcOffset + dstOffset) / msPerMinute);
- }
+ if (!haveTZ)
+ offset = calculateLocalTimeOffset(ms).offset / msPerMinute;
+
return ms - (offset * msPerMinute);
}
double timeClip(double t)
{
- if (!isfinite(t))
+ if (!std::isfinite(t))
return NaN;
if (fabs(t) > maxECMAScriptTime)
return NaN;
@@ -859,14 +870,14 @@ double timeClip(double t)
#if USE(JSC)
namespace JSC {
-// Get the DST offset for the time passed in.
+// Get the combined UTC + DST offset for the time passed in.
//
// NOTE: The implementation relies on the fact that no time zones have
// more than one daylight savings offset change per month.
// If this function is called with NaN it returns NaN.
-static double getDSTOffset(ExecState* exec, double ms, double utcOffset)
+static LocalTimeOffset localTimeOffset(ExecState* exec, double ms)
{
- DSTOffsetCache& cache = exec->globalData().dstOffsetCache;
+ LocalTimeOffsetCache& cache = exec->globalData().localTimeOffsetCache;
double start = cache.start;
double end = cache.end;
@@ -878,7 +889,7 @@ static double getDSTOffset(ExecState* exec, double ms, double utcOffset)
double newEnd = end + cache.increment;
if (ms <= newEnd) {
- double endOffset = calculateDSTOffset(newEnd, utcOffset);
+ LocalTimeOffset endOffset = calculateLocalTimeOffset(newEnd);
if (cache.offset == endOffset) {
// If the offset at the end of the new interval still matches
// the offset in the cache, we grow the cached time interval
@@ -886,34 +897,33 @@ static double getDSTOffset(ExecState* exec, double ms, double utcOffset)
cache.end = newEnd;
cache.increment = msPerMonth;
return endOffset;
+ }
+ LocalTimeOffset offset = calculateLocalTimeOffset(ms);
+ if (offset == endOffset) {
+ // The offset at the given time is equal to the offset at the
+ // new end of the interval, so that means that we've just skipped
+ // the point in time where the DST offset change occurred. Updated
+ // the interval to reflect this and reset the increment.
+ cache.start = ms;
+ cache.end = newEnd;
+ cache.increment = msPerMonth;
} else {
- double offset = calculateDSTOffset(ms, utcOffset);
- if (offset == endOffset) {
- // The offset at the given time is equal to the offset at the
- // new end of the interval, so that means that we've just skipped
- // the point in time where the DST offset change occurred. Updated
- // the interval to reflect this and reset the increment.
- cache.start = ms;
- cache.end = newEnd;
- cache.increment = msPerMonth;
- } else {
- // The interval contains a DST offset change and the given time is
- // before it. Adjust the increment to avoid a linear search for
- // the offset change point and change the end of the interval.
- cache.increment /= 3;
- cache.end = ms;
- }
- // Update the offset in the cache and return it.
- cache.offset = offset;
- return offset;
+ // The interval contains a DST offset change and the given time is
+ // before it. Adjust the increment to avoid a linear search for
+ // the offset change point and change the end of the interval.
+ cache.increment /= 3;
+ cache.end = ms;
}
+ // Update the offset in the cache and return it.
+ cache.offset = offset;
+ return offset;
}
}
// Compute the DST offset for the time and shrink the cache interval
// to only contain the time. This allows fast repeated DST offset
// computations for the same time.
- double offset = calculateDSTOffset(ms, utcOffset);
+ LocalTimeOffset offset = calculateLocalTimeOffset(ms);
cache.offset = offset;
cache.start = ms;
cache.end = ms;
@@ -921,30 +931,14 @@ static double getDSTOffset(ExecState* exec, double ms, double utcOffset)
return offset;
}
-/*
- * Get the difference in milliseconds between this time zone and UTC (GMT)
- * NOT including DST.
- */
-double getUTCOffset(ExecState* exec)
-{
- double utcOffset = exec->globalData().cachedUTCOffset;
- if (!isnan(utcOffset))
- return utcOffset;
- exec->globalData().cachedUTCOffset = calculateUTCOffset();
- return exec->globalData().cachedUTCOffset;
-}
-
double gregorianDateTimeToMS(ExecState* exec, const GregorianDateTime& t, double milliSeconds, bool inputIsUTC)
{
double day = dateToDaysFrom1970(t.year + 1900, t.month, t.monthDay);
double ms = timeToMS(t.hour, t.minute, t.second, milliSeconds);
double result = (day * WTF::msPerDay) + ms;
- if (!inputIsUTC) { // convert to UTC
- double utcOffset = getUTCOffset(exec);
- result -= utcOffset;
- result -= getDSTOffset(exec, result, utcOffset);
- }
+ if (!inputIsUTC)
+ result -= localTimeOffset(exec, result).offset;
return result;
}
@@ -952,12 +946,10 @@ double gregorianDateTimeToMS(ExecState* exec, const GregorianDateTime& t, double
// input is UTC
void msToGregorianDateTime(ExecState* exec, double ms, bool outputIsUTC, GregorianDateTime& tm)
{
- double dstOff = 0.0;
- double utcOff = 0.0;
+ LocalTimeOffset localTime(false, 0);
if (!outputIsUTC) {
- utcOff = getUTCOffset(exec);
- dstOff = getDSTOffset(exec, ms, utcOff);
- ms += dstOff + utcOff;
+ localTime = localTimeOffset(exec, ms);
+ ms += localTime.offset;
}
const int year = msToYear(ms);
@@ -969,8 +961,8 @@ void msToGregorianDateTime(ExecState* exec, double ms, bool outputIsUTC, Gregori
tm.monthDay = dayInMonthFromDayInYear(tm.yearDay, isLeapYear(year));
tm.month = monthFromDayInYear(tm.yearDay, isLeapYear(year));
tm.year = year - 1900;
- tm.isDST = dstOff != 0.0;
- tm.utcOffset = static_cast<long>((dstOff + utcOff) / WTF::msPerSecond);
+ tm.isDST = localTime.isDST;
+ tm.utcOffset = localTime.offset / WTF::msPerSecond;
tm.timeZone = NULL;
}
@@ -980,15 +972,13 @@ double parseDateFromNullTerminatedCharacters(ExecState* exec, const char* dateSt
bool haveTZ;
int offset;
double ms = WTF::parseDateFromNullTerminatedCharacters(dateString, haveTZ, offset);
- if (isnan(ms))
+ if (std::isnan(ms))
return NaN;
// fall back to local timezone
- if (!haveTZ) {
- double utcOffset = getUTCOffset(exec);
- double dstOffset = getDSTOffset(exec, ms, utcOffset);
- offset = static_cast<int>((utcOffset + dstOffset) / WTF::msPerMinute);
- }
+ if (!haveTZ)
+ offset = calculateLocalTimeOffset(ms).offset / msPerMinute;
+
return ms - (offset * WTF::msPerMinute);
}
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/DateMath.h b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/DateMath.h
index 033d25e..15a19bd 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/DateMath.h
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/DateMath.h
@@ -50,6 +50,34 @@
#include <wtf/UnusedParam.h>
namespace WTF {
+
+struct LocalTimeOffset {
+ LocalTimeOffset()
+ : isDST(false)
+ , offset(0)
+ {
+ }
+
+ LocalTimeOffset(bool isDST, int offset)
+ : isDST(isDST)
+ , offset(offset)
+ {
+ }
+
+ bool operator==(const LocalTimeOffset& other)
+ {
+ return isDST == other.isDST && offset == other.offset;
+ }
+
+ bool operator!=(const LocalTimeOffset& other)
+ {
+ return isDST != other.isDST || offset != other.offset;
+ }
+
+ bool isDST;
+ int offset;
+};
+
void initializeDates();
int equivalentYearForDST(int year);
@@ -83,6 +111,9 @@ int dayInYear(double ms, int year);
int monthFromDayInYear(int dayInYear, bool leapYear);
int dayInMonthFromDayInYear(int dayInYear, bool leapYear);
+// Returns combined offset in millisecond (UTC + DST).
+LocalTimeOffset calculateLocalTimeOffset(double utcInMilliseconds);
+
} // namespace WTF
using WTF::dateToDaysFrom1970;
@@ -94,6 +125,8 @@ using WTF::msPerDay;
using WTF::msPerSecond;
using WTF::msToYear;
using WTF::secondsPerMinute;
+using WTF::LocalTimeOffset;
+using WTF::calculateLocalTimeOffset;
#if USE(JSC)
namespace JSC {
@@ -128,33 +161,6 @@ struct GregorianDateTime : Noncopyable {
delete [] timeZone;
}
- GregorianDateTime(ExecState* exec, const tm& inTm)
- : second(inTm.tm_sec)
- , minute(inTm.tm_min)
- , hour(inTm.tm_hour)
- , weekDay(inTm.tm_wday)
- , monthDay(inTm.tm_mday)
- , yearDay(inTm.tm_yday)
- , month(inTm.tm_mon)
- , year(inTm.tm_year)
- , isDST(inTm.tm_isdst)
- {
- UNUSED_PARAM(exec);
-#if HAVE(TM_GMTOFF)
- utcOffset = static_cast<int>(inTm.tm_gmtoff);
-#else
- utcOffset = static_cast<int>(getUTCOffset(exec) / WTF::msPerSecond + (isDST ? WTF::secondsPerHour : 0));
-#endif
-
-#if HAVE(TM_ZONE)
- int inZoneSize = strlen(inTm.tm_zone) + 1;
- timeZone = new char[inZoneSize];
- strncpy(timeZone, inTm.tm_zone, inZoneSize);
-#else
- timeZone = 0;
-#endif
- }
-
operator tm() const
{
tm ret;
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashTable.h b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashTable.h
index 42a9233..8149375 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashTable.h
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/HashTable.h
@@ -257,19 +257,20 @@ namespace WTF {
using std::swap;
-#if !COMPILER(MSVC) && !OS(QNX) && !defined(_LIBCPP_VERSION)
- // The Dinkumware C++ library (used by MSVC and QNX) and clang's libc++ have a swap for pairs defined.
+ // Work around MSVC's standard library, whose swap for pairs does not swap by component.
+ template<typename T> inline void hashTableSwap(T& a, T& b)
+ {
+ swap(a, b);
+ }
- // swap pairs by component, in case of pair members that specialize swap
- template<typename T, typename U> inline void swap(pair<T, U>& a, pair<T, U>& b)
+ template<typename T, typename U> inline void hashTableSwap(pair<T, U>& a, pair<T, U>& b)
{
swap(a.first, b.first);
swap(a.second, b.second);
}
-#endif
template<typename T, bool useSwap> struct Mover;
- template<typename T> struct Mover<T, true> { static void move(T& from, T& to) { swap(from, to); } };
+ template<typename T> struct Mover<T, true> { static void move(T& from, T& to) { hashTableSwap(from, to); } };
template<typename T> struct Mover<T, false> { static void move(T& from, T& to) { to = from; } };
template<typename Key, typename Value, typename HashFunctions> class IdentityHashTranslator {
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/MathExtras.h b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/MathExtras.h
index 81a1d8a..46b2241 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/MathExtras.h
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/MathExtras.h
@@ -28,7 +28,7 @@
#include <float.h>
#include <limits>
-#include <math.h>
+#include <cmath>
#include <stdlib.h>
#if OS(SOLARIS)
@@ -40,6 +40,18 @@
#include <machine/ieee.h>
#endif
+#if OS(QNX)
+// FIXME: Look into a way to have cmath import its functions into both the standard and global
+// namespace. For now, we include math.h since the QNX cmath header only imports its functions
+// into the standard namespace.
+#include <math.h>
+// These macros from math.h conflict with the real functions in the std namespace.
+#undef signbit
+#undef isnan
+#undef isinf
+#undef isfinite
+#endif
+
#ifndef M_PI
const double piDouble = 3.14159265358979323846;
const float piFloat = 3.14159265358979323846f;
@@ -67,20 +79,26 @@ inline double wtf_ceil(double x) { return copysign(ceil(x), x); }
#if OS(SOLARIS)
+namespace std {
+
#ifndef isfinite
inline bool isfinite(double x) { return finite(x) && !isnand(x); }
#endif
+#ifndef signbit
+inline bool signbit(double x) { return copysign(1.0, x) < 0; }
+#endif
#ifndef isinf
inline bool isinf(double x) { return !finite(x) && !isnand(x); }
#endif
-#ifndef signbit
-inline bool signbit(double x) { return x < 0.0; } // FIXME: Wrong for negative 0.
-#endif
+
+} // namespace std
#endif
#if OS(OPENBSD)
+namespace std {
+
#ifndef isfinite
inline bool isfinite(double x) { return finite(x); }
#endif
@@ -88,6 +106,8 @@ inline bool isfinite(double x) { return finite(x); }
inline bool signbit(double x) { struct ieee_double *p = (struct ieee_double *)&x; return p->dbl_sign; }
#endif
+} // namespace std
+
#endif
#if (COMPILER(MSVC) && _MSC_VER < 1800) || COMPILER(RVCT)
@@ -115,17 +135,23 @@ inline double trunc(double num) { return num > 0 ? floor(num) : ceil(num); }
#endif
-#if COMPILER(MSVC) && _MSC_VER < 1800
+#if COMPILER(MSVC)
+
+namespace std {
inline bool isinf(double num) { return !_finite(num) && !_isnan(num); }
inline bool isnan(double num) { return !!_isnan(num); }
+inline bool isfinite(double x) { return _finite(x); }
+#if _MSC_VER < 1800
inline bool signbit(double num) { return _copysign(1.0, num) < 0; }
+#endif
+
+} // namespace std
inline double nextafter(double x, double y) { return _nextafter(x, y); }
inline float nextafterf(float x, float y) { return x > y ? x - FLT_EPSILON : x + FLT_EPSILON; }
inline double copysign(double x, double y) { return _copysign(x, y); }
-inline int isfinite(double x) { return _finite(x); }
// Work around a bug in Win, where atan2(+-infinity, +-infinity) yields NaN instead of specific values.
inline double wtf_atan2(double x, double y)
@@ -151,10 +177,10 @@ inline double wtf_atan2(double x, double y)
}
// Work around a bug in the Microsoft CRT, where fmod(x, +-infinity) yields NaN instead of x.
-inline double wtf_fmod(double x, double y) { return (!isinf(x) && isinf(y)) ? x : fmod(x, y); }
+extern "C" inline double wtf_fmod(double x, double y) { return (!std::isinf(x) && std::isinf(y)) ? x : fmod(x, y); }
// Work around a bug in the Microsoft CRT, where pow(NaN, 0) yields NaN instead of 1.
-inline double wtf_pow(double x, double y) { return y == 0 ? 1 : pow(x, y); }
+extern "C" inline double wtf_pow(double x, double y) { return y == 0 ? 1 : pow(x, y); }
#define atan2(x, y) wtf_atan2(x, y)
#define fmod(x, y) wtf_fmod(x, y)
@@ -185,7 +211,7 @@ inline double wtf_pow(double x, double y)
{
// MinGW-w64 has a custom implementation for pow.
// This handles certain special cases that are different.
- if ((x == 0.0 || isinf(x)) && isfinite(y)) {
+ if ((x == 0.0 || std::isinf(x)) && std::isfinite(y)) {
double f;
if (modf(y, &f) != 0.0)
return ((x == 0.0) ^ (y > 0.0)) ? std::numeric_limits<double>::infinity() : 0.0;
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h
index 66a986a..cd60d43 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h
@@ -441,7 +441,7 @@
#endif
/* OS(FREEBSD) - FreeBSD */
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
#define WTF_OS_FREEBSD 1
#endif
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/TypeTraits.h b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/TypeTraits.h
index 7ba487f..3ef0f9f 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/TypeTraits.h
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/TypeTraits.h
@@ -26,6 +26,9 @@
#if (defined(__GLIBCXX__) && (__GLIBCXX__ >= 20070724) && defined(__GXX_EXPERIMENTAL_CXX0X__)) || (defined(_MSC_VER) && (_MSC_VER >= 1600))
#include <type_traits>
+#if defined(__GLIBCXX__) && (__GLIBCXX__ >= 20070724) && defined(__GXX_EXPERIMENTAL_CXX0X__)
+#include <tr1/memory>
+#endif
#endif
namespace WTF {
@@ -166,13 +169,21 @@ namespace WTF {
typedef T Type;
};
-#if (defined(__GLIBCXX__) && (__GLIBCXX__ >= 20070724) && defined(__GXX_EXPERIMENTAL_CXX0X__)) || (defined(_MSC_VER) && (_MSC_VER >= 1600))
-
+#if COMPILER(CLANG) || GCC_VERSION_AT_LEAST(4, 6, 0) || (defined(_MSC_VER) && (_MSC_VER >= 1400) && (_MSC_VER < 1600) && !defined(__INTEL_COMPILER))
+ // VC8 (VS2005) and later has __has_trivial_constructor and __has_trivial_destructor,
+ // but the implementation returns false for built-in types. We add the extra IsPod condition to
+ // work around this.
+ template <typename T> struct HasTrivialConstructor {
+ static const bool value = __has_trivial_constructor(T) || IsPod<RemoveConstVolatile<T> >::value;
+ };
+ template <typename T> struct HasTrivialDestructor {
+ static const bool value = __has_trivial_destructor(T) || IsPod<RemoveConstVolatile<T> >::value;
+ };
+#elif (defined(__GLIBCXX__) && (__GLIBCXX__ >= 20070724) && defined(__GXX_EXPERIMENTAL_CXX0X__)) || (defined(_MSC_VER) && (_MSC_VER >= 1600))
// GCC's libstdc++ 20070724 and later supports C++ TR1 type_traits in the std namespace.
// VC10 (VS2010) and later support C++ TR1 type_traits in the std::tr1 namespace.
template<typename T> struct HasTrivialConstructor : public std::tr1::has_trivial_constructor<T> { };
template<typename T> struct HasTrivialDestructor : public std::tr1::has_trivial_destructor<T> { };
-
#else
// This compiler doesn't provide type traits, so we provide basic HasTrivialConstructor
@@ -189,15 +200,8 @@ namespace WTF {
typedef IntegralConstant<bool, true> true_type;
typedef IntegralConstant<bool, false> false_type;
-#if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__INTEL_COMPILER)
- // VC8 (VS2005) and later have built-in compiler support for HasTrivialConstructor / HasTrivialDestructor,
- // but for some unexplained reason it doesn't work on built-in types.
- template <typename T> struct HasTrivialConstructor : public IntegralConstant<bool, __has_trivial_constructor(T)>{ };
- template <typename T> struct HasTrivialDestructor : public IntegralConstant<bool, __has_trivial_destructor(T)>{ };
-#else
template <typename T> struct HasTrivialConstructor : public false_type{ };
template <typename T> struct HasTrivialDestructor : public false_type{ };
-#endif
template <typename T> struct HasTrivialConstructor<T*> : public true_type{ };
template <typename T> struct HasTrivialDestructor<T*> : public true_type{ };
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/dtoa.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/dtoa.cpp
index 6289d04..97c6c8f 100644
--- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/dtoa.cpp
+++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/dtoa.cpp
@@ -147,12 +147,13 @@
#include <wtf/AlwaysInline.h>
#include <wtf/Assertions.h>
#include <wtf/FastMalloc.h>
-#include <wtf/MathExtras.h>
#include <wtf/Vector.h>
#include <wtf/Threading.h>
#include <stdio.h>
+#include <wtf/MathExtras.h>
+
#if COMPILER(MSVC)
#pragma warning(disable: 4244)
#pragma warning(disable: 4245)
@@ -2395,7 +2396,7 @@ void doubleToStringInJavaScriptFormat(double d, DtoaBuffer buffer, unsigned* res
ASSERT(buffer);
// avoid ever printing -NaN, in JS conceptually there is only one NaN value
- if (isnan(d)) {
+ if (std::isnan(d)) {
append(buffer, "NaN", 3);
if (resultLength)
*resultLength = 3;
diff --git a/src/script/script.pro b/src/script/script.pro
index 8cb2f62..e48abac 100644
--- a/src/script/script.pro
+++ b/src/script/script.pro
@@ -75,8 +75,4 @@ integrity {
CFLAGS += --diag_remark=236,82
}
-# WebKit doesn't compile in C++0x mode
-*-g++*:QMAKE_CXXFLAGS -= -std=c++0x -std=gnu++0x
-CONFIG -= c++11
-
TR_EXCLUDE = $$WEBKITDIR/*
diff --git a/tests/auto/qscriptjstestsuite/expect_fail.txt b/tests/auto/qscriptjstestsuite/expect_fail.txt
index 89aeee3..b15542e 100644
--- a/tests/auto/qscriptjstestsuite/expect_fail.txt
+++ b/tests/auto/qscriptjstestsuite/expect_fail.txt
@@ -145,6 +145,12 @@ ecma/Math/15.8.2.5.js | Math.atan2(Infinity, Infinity)
ecma/Math/15.8.2.5.js | Math.atan2(Infinity, -Infinity)
ecma/Math/15.8.2.5.js | Math.atan2(-Infinity, Infinity)
ecma/Math/15.8.2.5.js | Math.atan2(-Infinity, -Infinity)
+ecma/Math/15.8.2.17.js | Math.sqrt(-0)
+ecma/Math/15.8.2.17.js | Infinity/Math.sqrt(-0)
+
+[Q_CC_MINGW64]
+ecma/Expressions/11.4.7-02.js | -(-2147483648) == 2147483648 | QTBUG-32829
+ecma/TypeConversion/9.3.1-3.js | - -"0x80000000" | QTBUG-32829
[Q_OS_SOLARIS]
ecma/Expressions/11.13.2-2.js | VAR1 = -0; VAR2= Infinity; VAR2 /= VAR1
diff --git a/tests/auto/qscriptv8testsuite/skip.txt b/tests/auto/qscriptv8testsuite/skip.txt
index f5eec08..bbcdef8 100644
--- a/tests/auto/qscriptv8testsuite/skip.txt
+++ b/tests/auto/qscriptv8testsuite/skip.txt
@@ -29,6 +29,7 @@ to-precision | Unresolved failures on Mac OS X (Cocoa)
[Q_OS_WIN]
to-precision | Unresolved failures on Windows
+smi-negative-zero | Unresolved failure on Windows 8 (QTBUG-41321)
[Q_OS_LINUX]
smi-negative-zero | Unresolved sign failure for Ubuntu 11.10 x64 (QTBUG-23463)