aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2013-04-12 15:51:47 +0200
committerLars Knoll <lars.knoll@digia.com>2013-04-12 17:30:58 +0200
commitcaddc2a7b4f0b6433462d2b4660a2d9ac26585fd (patch)
tree2d0ecd417db42439ee5a40d4c7be478aa8b1d916 /src
parent1cdcfa500ac971727d57db8edcb41abe38516e5a (diff)
Fix build of the rest of v4vm against WTF/JSC update
* Add missing functions to our WTF stubs * Some of the math functions wrapped with MathExtras.h are back in the std:: namespace they belong to Change-Id: I9da43e8344ab8c95edc8db19f44ccdbd91b4ac70 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/masm/stubs/wtf/PassOwnPtr.h4
-rw-r--r--src/3rdparty/masm/stubs/wtf/Vector.h11
-rw-r--r--src/v4/qv4dateobject.cpp4
-rw-r--r--src/v4/qv4globalobject.cpp2
-rw-r--r--src/v4/qv4jsonobject.cpp2
-rw-r--r--src/v4/qv4value.cpp14
6 files changed, 25 insertions, 12 deletions
diff --git a/src/3rdparty/masm/stubs/wtf/PassOwnPtr.h b/src/3rdparty/masm/stubs/wtf/PassOwnPtr.h
index f9b84e7b57..601d278c16 100644
--- a/src/3rdparty/masm/stubs/wtf/PassOwnPtr.h
+++ b/src/3rdparty/masm/stubs/wtf/PassOwnPtr.h
@@ -54,6 +54,10 @@ struct OwnPtr : public QScopedPointer<T>
: QScopedPointer<T>(ptr.leakRef())
{}
+ OwnPtr(const OwnPtr<T>& other)
+ : QScopedPointer<T>(const_cast<OwnPtr<T> &>(other).take())
+ {}
+
OwnPtr& operator=(const OwnPtr<T>& other)
{
this->reset(const_cast<OwnPtr<T> &>(other).take());
diff --git a/src/3rdparty/masm/stubs/wtf/Vector.h b/src/3rdparty/masm/stubs/wtf/Vector.h
index 1feea851e1..39742d8ab0 100644
--- a/src/3rdparty/masm/stubs/wtf/Vector.h
+++ b/src/3rdparty/masm/stubs/wtf/Vector.h
@@ -46,9 +46,13 @@
#include <wtf/NotFound.h>
#include <qalgorithms.h>
+enum WTF_UnusedOverflowMode {
+ UnsafeVectorOverflow
+};
+
namespace WTF {
-template <typename T, int capacity = 1>
+template <typename T, int capacity = 1, int overflowMode = UnsafeVectorOverflow>
class Vector : public std::vector<T> {
public:
Vector() {}
@@ -64,6 +68,8 @@ public:
using std::vector<T>::insert;
+ inline void reserveInitialCapacity(size_t size) { this->reserve(size); }
+
inline void insert(size_t position, T value)
{ this->insert(this->begin() + position, value); }
@@ -73,6 +79,9 @@ public:
inline void shrink(size_t size)
{ this->erase(this->begin() + size, this->end()); }
+ inline void shrinkToFit()
+ { this->shrink_to_fit(); }
+
inline void remove(size_t position)
{ this->erase(this->begin() + position); }
diff --git a/src/v4/qv4dateobject.cpp b/src/v4/qv4dateobject.cpp
index a8e7e8c252..ed74c72274 100644
--- a/src/v4/qv4dateobject.cpp
+++ b/src/v4/qv4dateobject.cpp
@@ -1268,7 +1268,7 @@ Value DatePrototype::method_toISOString(SimpleCallContext *ctx)
ctx->throwTypeError();
double t = self->value.asDouble();
- if (!isfinite(t))
+ if (!std::isfinite(t))
ctx->throwRangeError(ctx->thisObject);
QString result;
@@ -1304,7 +1304,7 @@ Value DatePrototype::method_toJSON(SimpleCallContext *ctx)
Value O = __qmljs_to_object(ctx, ctx->thisObject);
Value tv = __qmljs_to_primitive(O, ctx, NUMBER_HINT);
- if (tv.isNumber() && !isfinite(tv.toNumber(ctx)))
+ if (tv.isNumber() && !std::isfinite(tv.toNumber(ctx)))
return Value::nullValue();
FunctionObject *toIso = O.objectValue()->get(ctx, ctx->engine->newString(QStringLiteral("toISOString"))).asFunctionObject();
diff --git a/src/v4/qv4globalobject.cpp b/src/v4/qv4globalobject.cpp
index be243cca12..3396ec3b19 100644
--- a/src/v4/qv4globalobject.cpp
+++ b/src/v4/qv4globalobject.cpp
@@ -649,7 +649,7 @@ Value GlobalFunctions::method_isFinite(SimpleCallContext *context)
return Value::fromBoolean(true);
double d = v.toNumber(context);
- return Value::fromBoolean(isfinite(d));
+ return Value::fromBoolean(std::isfinite(d));
}
/// decodeURI [15.1.3.1]
diff --git a/src/v4/qv4jsonobject.cpp b/src/v4/qv4jsonobject.cpp
index 5282b7ea5c..fd7eacab3d 100644
--- a/src/v4/qv4jsonobject.cpp
+++ b/src/v4/qv4jsonobject.cpp
@@ -736,7 +736,7 @@ QString Stringify::Str(const QString &key, Value value)
if (value.isNumber()) {
double d = value.toNumber(ctx);
- return isfinite(d) ? value.toString(ctx)->toQString() : QStringLiteral("null");
+ return std::isfinite(d) ? value.toString(ctx)->toQString() : QStringLiteral("null");
}
if (Object *o = value.asObject()) {
diff --git a/src/v4/qv4value.cpp b/src/v4/qv4value.cpp
index 7ced70dda1..78769bd487 100644
--- a/src/v4/qv4value.cpp
+++ b/src/v4/qv4value.cpp
@@ -60,11 +60,11 @@ int Value::toUInt16(ExecutionContext *ctx) const
if ((number >= 0 && number < D16))
return static_cast<ushort>(number);
- if (!isfinite(number))
+ if (!std::isfinite(number))
return +0;
double d = ::floor(::fabs(number));
- if (signbit(number))
+ if (std::signbit(number))
d = -d;
number = ::fmod(d , D16);
@@ -114,11 +114,11 @@ int Value::toInt32(double number)
return static_cast<int>(number);
- if (!isfinite(number))
+ if (!std::isfinite(number))
return 0;
double d = ::floor(::fabs(number));
- if (signbit(number))
+ if (std::signbit(number))
d = -d;
number = ::fmod(d , D32);
@@ -137,11 +137,11 @@ unsigned int Value::toUInt32(double number)
if ((number >= 0 && number < D32))
return static_cast<uint>(number);
- if (!isfinite(number))
+ if (!std::isfinite(number))
return +0;
double d = ::floor(::fabs(number));
- if (signbit(number))
+ if (std::signbit(number))
d = -d;
number = ::fmod(d , D32);
@@ -159,7 +159,7 @@ double Value::toInteger(double number)
else if (! number || isinf(number))
return number;
const double v = floor(fabs(number));
- return signbit(number) ? -v : v;
+ return std::signbit(number) ? -v : v;
}
Value Value::property(ExecutionContext *ctx, String *name) const