aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4runtime_p.h
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2016-05-09 13:29:18 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2016-05-09 12:32:28 +0000
commitf7463a2ae6dd8e9267f99cc88af495281405905a (patch)
treef10c068d75b37e51b483436ab8944465da017037 /src/qml/jsruntime/qv4runtime_p.h
parent4b982c744f538a24e21a2af146c45f93d27dd1cb (diff)
De-inline static methods of struct Runtime.
They are accessed via function pointer, so, inlining them does not have any effect. Move the implementation into qv4runtime.cpp, fixing MinGW-errors: qtdeclarative/src/qml/jsruntime/qv4runtime_p.h:144:22: error: 'static QV4::ReturnedValue QV4::Runtime::method_uPlus(const QV4::Value&)' redeclared without dllimport attribute after being referenced with dll linkage [-Werror] inline ReturnedValue Runtime::method_uPlus(const Value &value) ^ qtdeclarative/src/qml/jsruntime/qv4runtime_p.h:157:22: error: 'static QV4::ReturnedValue QV4::Runtime::method_uMinus(const QV4::Value&)' redeclared without dllimport attribute after being referenced with dll linkage [-Werror] inline ReturnedValue Runtime::method_uMinus(const Value &value) ^ qtdeclarative/src/qml/jsruntime/qv4runtime_p.h:170:22: error: 'static QV4::ReturnedValue QV4::Runtime::method_complement(const QV4::Value&)' redeclared without dllimport attribute after being referenced with dll linkage [-Werror] inline ReturnedValue Runtime::method_complement(const Value &value) Task-number: QTBUG-53222 Change-Id: I5a9bd162e0b1f52c66cd6a8efbf407fcd46d7fc7 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/jsruntime/qv4runtime_p.h')
-rw-r--r--src/qml/jsruntime/qv4runtime_p.h343
1 files changed, 0 insertions, 343 deletions
diff --git a/src/qml/jsruntime/qv4runtime_p.h b/src/qml/jsruntime/qv4runtime_p.h
index ffae55995f..807fbe2f0e 100644
--- a/src/qml/jsruntime/qv4runtime_p.h
+++ b/src/qml/jsruntime/qv4runtime_p.h
@@ -140,349 +140,6 @@ inline double RuntimeHelpers::toNumber(const Value &value)
{
return value.toNumber();
}
-
-inline ReturnedValue Runtime::method_uPlus(const Value &value)
-{
- TRACE1(value);
-
- if (value.isNumber())
- return value.asReturnedValue();
- if (value.integerCompatible())
- return Encode(value.int_32());
-
- double n = value.toNumberImpl();
- return Encode(n);
-}
-
-inline ReturnedValue Runtime::method_uMinus(const Value &value)
-{
- TRACE1(value);
-
- // +0 != -0, so we need to convert to double when negating 0
- if (value.isInteger() && value.integerValue())
- return Encode(-value.integerValue());
- else {
- double n = RuntimeHelpers::toNumber(value);
- return Encode(-n);
- }
-}
-
-inline ReturnedValue Runtime::method_complement(const Value &value)
-{
- TRACE1(value);
-
- int n = value.toInt32();
- return Encode((int)~n);
-}
-
-inline ReturnedValue Runtime::method_uNot(const Value &value)
-{
- TRACE1(value);
-
- bool b = value.toBoolean();
- return Encode(!b);
-}
-
-// binary operators
-inline ReturnedValue Runtime::method_bitOr(const Value &left, const Value &right)
-{
- TRACE2(left, right);
-
- int lval = left.toInt32();
- int rval = right.toInt32();
- return Encode(lval | rval);
-}
-
-inline ReturnedValue Runtime::method_bitXor(const Value &left, const Value &right)
-{
- TRACE2(left, right);
-
- int lval = left.toInt32();
- int rval = right.toInt32();
- return Encode(lval ^ rval);
-}
-
-inline ReturnedValue Runtime::method_bitAnd(const Value &left, const Value &right)
-{
- TRACE2(left, right);
-
- int lval = left.toInt32();
- int rval = right.toInt32();
- return Encode(lval & rval);
-}
-
-#ifndef V4_BOOTSTRAP
-inline ReturnedValue Runtime::method_add(ExecutionEngine *engine, const Value &left, const Value &right)
-{
- TRACE2(left, right);
-
- if (Q_LIKELY(left.isInteger() && right.isInteger()))
- return add_int32(left.integerValue(), right.integerValue());
- if (left.isNumber() && right.isNumber())
- return Primitive::fromDouble(left.asDouble() + right.asDouble()).asReturnedValue();
-
- return RuntimeHelpers::addHelper(engine, left, right);
-}
-#endif // V4_BOOTSTRAP
-
-inline ReturnedValue Runtime::method_sub(const Value &left, const Value &right)
-{
- TRACE2(left, right);
-
- if (Q_LIKELY(left.isInteger() && right.isInteger()))
- return sub_int32(left.integerValue(), right.integerValue());
-
- double lval = left.isNumber() ? left.asDouble() : left.toNumberImpl();
- double rval = right.isNumber() ? right.asDouble() : right.toNumberImpl();
-
- return Primitive::fromDouble(lval - rval).asReturnedValue();
-}
-
-inline ReturnedValue Runtime::method_mul(const Value &left, const Value &right)
-{
- TRACE2(left, right);
-
- if (Q_LIKELY(left.isInteger() && right.isInteger()))
- return mul_int32(left.integerValue(), right.integerValue());
-
- double lval = left.isNumber() ? left.asDouble() : left.toNumberImpl();
- double rval = right.isNumber() ? right.asDouble() : right.toNumberImpl();
-
- return Primitive::fromDouble(lval * rval).asReturnedValue();
-}
-
-inline ReturnedValue Runtime::method_div(const Value &left, const Value &right)
-{
- TRACE2(left, right);
-
- if (Value::integerCompatible(left, right)) {
- int lval = left.integerValue();
- int rval = right.integerValue();
- if (rval != 0 && (lval % rval == 0))
- return Encode(int(lval / rval));
- else
- return Encode(double(lval) / rval);
- }
-
- double lval = left.toNumber();
- double rval = right.toNumber();
- return Primitive::fromDouble(lval / rval).asReturnedValue();
-}
-
-inline ReturnedValue Runtime::method_mod(const Value &left, const Value &right)
-{
- TRACE2(left, right);
-
- if (Value::integerCompatible(left, right) && right.integerValue() != 0) {
- int intRes = left.integerValue() % right.integerValue();
- if (intRes != 0 || left.integerValue() >= 0)
- return Encode(intRes);
- }
-
- double lval = RuntimeHelpers::toNumber(left);
- double rval = RuntimeHelpers::toNumber(right);
- return Primitive::fromDouble(std::fmod(lval, rval)).asReturnedValue();
-}
-
-inline ReturnedValue Runtime::method_shl(const Value &left, const Value &right)
-{
- TRACE2(left, right);
-
- int lval = left.toInt32();
- int rval = right.toInt32() & 0x1f;
- return Encode((int)(lval << rval));
-}
-
-inline ReturnedValue Runtime::method_shr(const Value &left, const Value &right)
-{
- TRACE2(left, right);
-
- int lval = left.toInt32();
- unsigned rval = right.toUInt32() & 0x1f;
- return Encode((int)(lval >> rval));
-}
-
-inline ReturnedValue Runtime::method_ushr(const Value &left, const Value &right)
-{
- TRACE2(left, right);
-
- unsigned lval = left.toUInt32();
- unsigned rval = right.toUInt32() & 0x1f;
- uint res = lval >> rval;
-
- return Encode(res);
-}
-
-inline ReturnedValue Runtime::method_greaterThan(const Value &left, const Value &right)
-{
- TRACE2(left, right);
-
- bool r = method_compareGreaterThan(left, right);
- return Encode(r);
-}
-
-inline ReturnedValue Runtime::method_lessThan(const Value &left, const Value &right)
-{
- TRACE2(left, right);
-
- bool r = method_compareLessThan(left, right);
- return Encode(r);
-}
-
-inline ReturnedValue Runtime::method_greaterEqual(const Value &left, const Value &right)
-{
- TRACE2(left, right);
-
- bool r = method_compareGreaterEqual(left, right);
- return Encode(r);
-}
-
-inline ReturnedValue Runtime::method_lessEqual(const Value &left, const Value &right)
-{
- TRACE2(left, right);
-
- bool r = method_compareLessEqual(left, right);
- return Encode(r);
-}
-
-inline Bool Runtime::method_compareEqual(const Value &left, const Value &right)
-{
- TRACE2(left, right);
-
- if (left.rawValue() == right.rawValue())
- // NaN != NaN
- return !left.isNaN();
-
- if (left.type() == right.type()) {
- if (!left.isManaged())
- return false;
- if (left.isString() == right.isString())
- return left.cast<Managed>()->isEqualTo(right.cast<Managed>());
- }
-
- return RuntimeHelpers::equalHelper(left, right);
-}
-
-inline ReturnedValue Runtime::method_equal(const Value &left, const Value &right)
-{
- TRACE2(left, right);
-
- bool r = method_compareEqual(left, right);
- return Encode(r);
-}
-
-inline ReturnedValue Runtime::method_notEqual(const Value &left, const Value &right)
-{
- TRACE2(left, right);
-
- bool r = !method_compareEqual(left, right);
- return Encode(r);
-}
-
-inline ReturnedValue Runtime::method_strictEqual(const Value &left, const Value &right)
-{
- TRACE2(left, right);
-
- bool r = RuntimeHelpers::strictEqual(left, right);
- return Encode(r);
-}
-
-inline ReturnedValue Runtime::method_strictNotEqual(const Value &left, const Value &right)
-{
- TRACE2(left, right);
-
- bool r = ! RuntimeHelpers::strictEqual(left, right);
- return Encode(r);
-}
-
-inline Bool Runtime::method_compareNotEqual(const Value &left, const Value &right)
-{
- TRACE2(left, right);
-
- return !Runtime::method_compareEqual(left, right);
-}
-
-inline Bool Runtime::method_compareStrictEqual(const Value &left, const Value &right)
-{
- TRACE2(left, right);
-
- return RuntimeHelpers::strictEqual(left, right);
-}
-
-inline Bool Runtime::method_compareStrictNotEqual(const Value &left, const Value &right)
-{
- TRACE2(left, right);
-
- return ! RuntimeHelpers::strictEqual(left, right);
-}
-
-inline Bool Runtime::method_toBoolean(const Value &value)
-{
- return value.toBoolean();
-}
-
-inline ReturnedValue Runtime::method_accessQmlScopeObjectQRealProperty(const Value &context,
- QQmlAccessors *accessors)
-{
-#ifndef V4_BOOTSTRAP
- const QmlContext &c = static_cast<const QmlContext &>(context);
- qreal rv = 0;
- accessors->read(c.d()->qml->scopeObject, &rv);
- return QV4::Encode(rv);
-#else
- Q_UNUSED(context);
- Q_UNUSED(accessors);
- return QV4::Encode::undefined();
-#endif
-}
-
-inline ReturnedValue Runtime::method_accessQmlScopeObjectIntProperty(const Value &context,
- QQmlAccessors *accessors)
-{
-#ifndef V4_BOOTSTRAP
- const QmlContext &c = static_cast<const QmlContext &>(context);
- int rv = 0;
- accessors->read(c.d()->qml->scopeObject, &rv);
- return QV4::Encode(rv);
-#else
- Q_UNUSED(context);
- Q_UNUSED(accessors);
- return QV4::Encode::undefined();
-#endif
-}
-
-inline ReturnedValue Runtime::method_accessQmlScopeObjectBoolProperty(const Value &context,
- QQmlAccessors *accessors)
-{
-#ifndef V4_BOOTSTRAP
- const QmlContext &c = static_cast<const QmlContext &>(context);
- bool rv = false;
- accessors->read(c.d()->qml->scopeObject, &rv);
- return QV4::Encode(rv);
-#else
- Q_UNUSED(context);
- Q_UNUSED(accessors);
- return QV4::Encode::undefined();
-#endif
-}
-
-inline ReturnedValue Runtime::method_accessQmlScopeObjectQStringProperty(ExecutionEngine *engine,
- const Value &context,
- QQmlAccessors *accessors)
-{
-#ifndef V4_BOOTSTRAP
- const QmlContext &c = static_cast<const QmlContext &>(context);
- QString rv;
- accessors->read(c.d()->qml->scopeObject, &rv);
- return QV4::Encode(engine->newString(rv));
-#else
- Q_UNUSED(engine);
- Q_UNUSED(context);
- Q_UNUSED(accessors);
- return QV4::Encode::undefined();
-#endif
-}
-
} // namespace QV4
QT_END_NAMESPACE