Rename the V4 instructions to match the new type system.
Change-Id: I640ab52c024a29179e816e29a12f0a36813d18c6
Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
void setUndefined() { dataType = UndefinedType; }
void setNull() { dataType = NullType; }
- void setNaN() { setqreal(qSNaN()); }
+ void setNaN() { setnumber(qSNaN()); }
bool isUndefined() const { return dataType == UndefinedType; }
void setQObject(QObject *o) { qobjectValue = o; dataType = QObjectStarType; }
QObject *getQObject() const { return qobjectValue; }
- void setqreal(qreal v) { qrealValue = v; dataType = QRealType; }
- qreal getqreal() const { return qrealValue; }
- qreal &getqrealref() { return qrealValue; }
+ void setnumber(double v) { numberValue = v; dataType = NumberType; }
+ double getnumber() const { return numberValue; }
+ double &getnumberref() { return numberValue; }
void setint(int v) { intValue = v; dataType = IntType; }
int getint() const { return intValue; }
Type dataType; // Type of data
union {
QObject *qobjectValue;
- qreal qrealValue;
+ double numberValue;
int intValue;
bool boolValue;
void *data[sizeof(QVariant)];
sub->disconnect();
}
-// Conversion functions - these MUST match the QtScript expression path
-inline static qreal toReal(Register *reg, int type, bool *ok = 0)
-{
- if (ok) *ok = true;
-
- if (type == QMetaType::QReal) {
- return reg->getqreal();
- } else if (type == qMetaTypeId<QVariant>()) {
- return reg->getvariantptr()->toReal();
- } else {
- if (ok) *ok = false;
- return 0;
- }
-}
-
-inline static QString toString(Register *reg, int type, bool *ok = 0)
-{
- if (ok) *ok = true;
-
- if (type == QMetaType::QReal) {
- return QString::number(reg->getqreal());
- } else if (type == QMetaType::Int) {
- return QString::number(reg->getint());
- } else if (type == qMetaTypeId<QVariant>()) {
- return reg->getvariantptr()->toString();
- } else if (type == QMetaType::QString) {
- return *reg->getstringptr();
- } else {
- if (ok) *ok = false;
- return QString();
- }
-}
-
-inline static bool toBool(Register *reg, int type, bool *ok = 0)
-{
- if (ok) *ok = true;
-
- if (type == QMetaType::Bool) {
- return reg->getbool();
- } else if (type == qMetaTypeId<QVariant>()) {
- return reg->getvariantptr()->toBool();
- } else {
- if (ok) *ok = false;
- return false;
- }
-}
-
-inline static QUrl toUrl(Register *reg, int type, QQmlContextData *context, bool *ok = 0)
-{
- if (ok) *ok = true;
-
- QUrl base;
- if (type == qMetaTypeId<QVariant>()) {
- QVariant *var = reg->getvariantptr();
- int vt = var->type();
- if (vt == QVariant::Url) {
- base = var->toUrl();
- } else if (vt == QVariant::ByteArray) {
- // Preserve any valid percent-encoded octets supplied by the source
- base.setEncodedUrl(var->toByteArray(), QUrl::TolerantMode);
- } else if (vt == QVariant::String) {
- base.setEncodedUrl(var->toString().toUtf8(), QUrl::TolerantMode);
- } else {
- if (ok) *ok = false;
- return QUrl();
- }
- } else if (type == QMetaType::QString) {
- base.setEncodedUrl(reg->getstringptr()->toUtf8(), QUrl::TolerantMode);
- } else {
- if (ok) *ok = false;
- return QUrl();
- }
-
- if (!base.isEmpty() && base.isRelative())
- return context->url.resolved(base);
- else
- return base;
-}
-
static bool testCompareVariants(const QVariant &qtscriptRaw, const QVariant &v4)
{
QVariant qtscript = qtscriptRaw;
case QMetaType::Int:
v4value = result.getint();
break;
- case QMetaType::QReal:
- v4value = result.getqreal();
+ case QMetaType::Double:
+ v4value = result.getnumber();
break;
default:
if (resultType == QQmlMetaType::QQuickAnchorLineMetaTypeId()) {
QQmlEnginePrivate::warning(context->engine, error->error);
}
-const qreal QV4Bindings::D32 = 4294967296.0;
+const double QV4Bindings::D32 = 4294967296.0;
-qint32 QV4Bindings::toInt32(qreal n)
+qint32 QV4Bindings::toInt32(double n)
{
if (qIsNaN(n) || qIsInf(n) || (n == 0))
return 0;
double sign = (n < 0) ? -1.0 : 1.0;
- qreal abs_n = fabs(n);
+ double abs_n = fabs(n);
n = ::fmod(sign * ::floor(abs_n), D32);
const double D31 = D32 / 2.0;
return qint32 (n);
}
-inline quint32 QV4Bindings::toUint32(qreal n)
+inline quint32 QV4Bindings::toUint32(double n)
{
if (qIsNaN(n) || qIsInf(n) || (n == 0))
return 0;
double sign = (n < 0) ? -1.0 : 1.0;
- qreal abs_n = fabs(n);
+ double abs_n = fabs(n);
n = ::fmod(sign * ::floor(abs_n), D32);
}
QML_V4_END_INSTR(UnaryNot, unaryop)
- QML_V4_BEGIN_INSTR(UnaryMinusReal, unaryop)
+ QML_V4_BEGIN_INSTR(UnaryMinusNumber, unaryop)
{
- registers[instr->unaryop.output].setqreal(-registers[instr->unaryop.src].getqreal());
+ registers[instr->unaryop.output].setnumber(-registers[instr->unaryop.src].getnumber());
}
- QML_V4_END_INSTR(UnaryMinusReal, unaryop)
+ QML_V4_END_INSTR(UnaryMinusNumber, unaryop)
QML_V4_BEGIN_INSTR(UnaryMinusInt, unaryop)
{
}
QML_V4_END_INSTR(UnaryMinusInt, unaryop)
- QML_V4_BEGIN_INSTR(UnaryPlusReal, unaryop)
+ QML_V4_BEGIN_INSTR(UnaryPlusNumber, unaryop)
{
- registers[instr->unaryop.output].setqreal(+registers[instr->unaryop.src].getqreal());
+ registers[instr->unaryop.output].setnumber(+registers[instr->unaryop.src].getnumber());
}
- QML_V4_END_INSTR(UnaryPlusReal, unaryop)
+ QML_V4_END_INSTR(UnaryPlusNumber, unaryop)
QML_V4_BEGIN_INSTR(UnaryPlusInt, unaryop)
{
}
QML_V4_END_INSTR(ConvertBoolToInt, unaryop)
- QML_V4_BEGIN_INSTR(ConvertBoolToReal, unaryop)
+ QML_V4_BEGIN_INSTR(ConvertBoolToNumber, unaryop)
{
const Register &src = registers[instr->unaryop.src];
Register &output = registers[instr->unaryop.output];
if (src.isUndefined()) output.setUndefined();
- else output.setqreal(src.getbool());
+ else output.setnumber(src.getbool());
}
- QML_V4_END_INSTR(ConvertBoolToReal, unaryop)
+ QML_V4_END_INSTR(ConvertBoolToNumber, unaryop)
QML_V4_BEGIN_INSTR(ConvertBoolToString, unaryop)
{
}
QML_V4_END_INSTR(ConvertIntToBool, unaryop)
- QML_V4_BEGIN_INSTR(ConvertIntToReal, unaryop)
+ QML_V4_BEGIN_INSTR(ConvertIntToNumber, unaryop)
{
const Register &src = registers[instr->unaryop.src];
Register &output = registers[instr->unaryop.output];
if (src.isUndefined()) output.setUndefined();
- else output.setqreal(qreal(src.getint()));
+ else output.setnumber(double(src.getint()));
}
- QML_V4_END_INSTR(ConvertIntToReal, unaryop)
+ QML_V4_END_INSTR(ConvertIntToNumber, unaryop)
QML_V4_BEGIN_INSTR(ConvertIntToString, unaryop)
{
}
QML_V4_END_INSTR(ConvertIntToString, unaryop)
- QML_V4_BEGIN_INSTR(ConvertRealToBool, unaryop)
+ QML_V4_BEGIN_INSTR(ConvertNumberToBool, unaryop)
{
const Register &src = registers[instr->unaryop.src];
Register &output = registers[instr->unaryop.output];
if (src.isUndefined()) output.setUndefined();
- else output.setbool(src.getqreal() != 0);
+ else output.setbool(src.getnumber() != 0);
}
- QML_V4_END_INSTR(ConvertRealToBool, unaryop)
+ QML_V4_END_INSTR(ConvertNumberToBool, unaryop)
- QML_V4_BEGIN_INSTR(ConvertRealToInt, unaryop)
+ QML_V4_BEGIN_INSTR(ConvertNumberToInt, unaryop)
{
const Register &src = registers[instr->unaryop.src];
Register &output = registers[instr->unaryop.output];
if (src.isUndefined()) output.setUndefined();
- else output.setint(toInt32(src.getqreal()));
+ else output.setint(toInt32(src.getnumber()));
}
- QML_V4_END_INSTR(ConvertRealToInt, unaryop)
+ QML_V4_END_INSTR(ConvertNumberToInt, unaryop)
- QML_V4_BEGIN_INSTR(ConvertRealToString, unaryop)
+ QML_V4_BEGIN_INSTR(ConvertNumberToString, unaryop)
{
const Register &src = registers[instr->unaryop.src];
Register &output = registers[instr->unaryop.output];
if (src.isUndefined()) {
output.setUndefined();
} else {
- new (output.getstringptr()) QString(QString::number(src.getqreal()));
+ new (output.getstringptr()) QString(QString::number(src.getnumber()));
STRING_REGISTER(instr->unaryop.output);
}
}
- QML_V4_END_INSTR(ConvertRealToString, unaryop)
+ QML_V4_END_INSTR(ConvertNumberToString, unaryop)
QML_V4_BEGIN_INSTR(ConvertStringToBool, unaryop)
{
}
QML_V4_END_INSTR(ConvertStringToInt, unaryop)
- QML_V4_BEGIN_INSTR(ConvertStringToReal, unaryop)
+ QML_V4_BEGIN_INSTR(ConvertStringToNumber, unaryop)
{
const Register &src = registers[instr->unaryop.src];
Register &output = registers[instr->unaryop.output];
output.cleanupString();
MARK_CLEAN_REGISTER(instr->unaryop.output);
}
- output.setqreal(tmp.toNumber());
+ output.setnumber(tmp.toNumber());
}
}
- QML_V4_END_INSTR(ConvertStringToReal, unaryop)
+ QML_V4_END_INSTR(ConvertStringToNumber, unaryop)
QML_V4_BEGIN_INSTR(ConvertStringToUrl, unaryop)
{
}
QML_V4_END_INSTR(ResolveUrl, unaryop)
- QML_V4_BEGIN_INSTR(MathSinReal, unaryop)
+ QML_V4_BEGIN_INSTR(MathSinNumber, unaryop)
{
const Register &src = registers[instr->unaryop.src];
Register &output = registers[instr->unaryop.output];
if (src.isUndefined()) output.setUndefined();
- else output.setqreal(qSin(src.getqreal()));
+ else output.setnumber(qSin(src.getnumber()));
}
- QML_V4_END_INSTR(MathSinReal, unaryop)
+ QML_V4_END_INSTR(MathSinNumber, unaryop)
- QML_V4_BEGIN_INSTR(MathCosReal, unaryop)
+ QML_V4_BEGIN_INSTR(MathCosNumber, unaryop)
{
const Register &src = registers[instr->unaryop.src];
Register &output = registers[instr->unaryop.output];
if (src.isUndefined()) output.setUndefined();
- else output.setqreal(qCos(src.getqreal()));
+ else output.setnumber(qCos(src.getnumber()));
}
- QML_V4_END_INSTR(MathCosReal, unaryop)
+ QML_V4_END_INSTR(MathCosNumber, unaryop)
- QML_V4_BEGIN_INSTR(MathAbsReal, unaryop)
+ QML_V4_BEGIN_INSTR(MathAbsNumber, unaryop)
{
const Register &src = registers[instr->unaryop.src];
Register &output = registers[instr->unaryop.output];
if (src.isUndefined()) output.setUndefined();
- else output.setqreal(qAbs(src.getqreal()));
+ else output.setnumber(qAbs(src.getnumber()));
}
- QML_V4_END_INSTR(MathAbsReal, unaryop)
+ QML_V4_END_INSTR(MathAbsNumber, unaryop)
- QML_V4_BEGIN_INSTR(MathRoundReal, unaryop)
+ QML_V4_BEGIN_INSTR(MathRoundNumber, unaryop)
{
const Register &src = registers[instr->unaryop.src];
Register &output = registers[instr->unaryop.output];
if (src.isUndefined()) output.setUndefined();
- else output.setint(qRound(src.getqreal()));
+ else output.setint(qRound(src.getnumber()));
}
- QML_V4_END_INSTR(MathRoundReal, unaryop)
+ QML_V4_END_INSTR(MathRoundNumber, unaryop)
- QML_V4_BEGIN_INSTR(MathFloorReal, unaryop)
+ QML_V4_BEGIN_INSTR(MathFloorNumber, unaryop)
{
const Register &src = registers[instr->unaryop.src];
Register &output = registers[instr->unaryop.output];
if (src.isUndefined()) output.setUndefined();
- else output.setint(qFloor(src.getqreal()));
+ else output.setint(qFloor(src.getnumber()));
}
- QML_V4_END_INSTR(MathFloorReal, unaryop)
+ QML_V4_END_INSTR(MathFloorNumber, unaryop)
- QML_V4_BEGIN_INSTR(MathCeilReal, unaryop)
+ QML_V4_BEGIN_INSTR(MathCeilNumber, unaryop)
{
const Register &src = registers[instr->unaryop.src];
Register &output = registers[instr->unaryop.output];
if (src.isUndefined()) output.setUndefined();
- else output.setint(qCeil(src.getqreal()));
+ else output.setint(qCeil(src.getnumber()));
}
- QML_V4_END_INSTR(MathCeilReal, unaryop)
+ QML_V4_END_INSTR(MathCeilNumber, unaryop)
- QML_V4_BEGIN_INSTR(MathPIReal, unaryop)
+ QML_V4_BEGIN_INSTR(MathPINumber, unaryop)
{
- static const qreal qmlPI = 2.0 * qAsin(1.0);
+ static const double qmlPI = 2.0 * qAsin(1.0);
Register &output = registers[instr->unaryop.output];
- output.setqreal(qmlPI);
+ output.setnumber(qmlPI);
}
- QML_V4_END_INSTR(MathPIReal, unaryop)
+ QML_V4_END_INSTR(MathPINumber, unaryop)
QML_V4_BEGIN_INSTR(LoadNull, null_value)
registers[instr->null_value.reg].setNull();
QML_V4_END_INSTR(LoadNull, null_value)
- QML_V4_BEGIN_INSTR(LoadReal, real_value)
- registers[instr->real_value.reg].setqreal(instr->real_value.value);
- QML_V4_END_INSTR(LoadReal, real_value)
+ QML_V4_BEGIN_INSTR(LoadNumber, number_value)
+ registers[instr->number_value.reg].setnumber(instr->number_value.value);
+ QML_V4_END_INSTR(LoadNumber, number_value)
QML_V4_BEGIN_INSTR(LoadInt, int_value)
registers[instr->int_value.reg].setint(instr->int_value.value);
}
QML_V4_END_INSTR(BitXorInt, binaryop)
- QML_V4_BEGIN_INSTR(AddReal, binaryop)
+ QML_V4_BEGIN_INSTR(AddNumber, binaryop)
{
- registers[instr->binaryop.output].setqreal(registers[instr->binaryop.left].getqreal() +
- registers[instr->binaryop.right].getqreal());
+ registers[instr->binaryop.output].setnumber(registers[instr->binaryop.left].getnumber() +
+ registers[instr->binaryop.right].getnumber());
}
- QML_V4_END_INSTR(AddReal, binaryop)
+ QML_V4_END_INSTR(AddNumber, binaryop)
QML_V4_BEGIN_INSTR(AddString, binaryop)
{
}
QML_V4_END_INSTR(AddString, binaryop)
- QML_V4_BEGIN_INSTR(SubReal, binaryop)
+ QML_V4_BEGIN_INSTR(SubNumber, binaryop)
{
- registers[instr->binaryop.output].setqreal(registers[instr->binaryop.left].getqreal() -
- registers[instr->binaryop.right].getqreal());
+ registers[instr->binaryop.output].setnumber(registers[instr->binaryop.left].getnumber() -
+ registers[instr->binaryop.right].getnumber());
}
- QML_V4_END_INSTR(SubReal, binaryop)
+ QML_V4_END_INSTR(SubNumber, binaryop)
- QML_V4_BEGIN_INSTR(MulReal, binaryop)
+ QML_V4_BEGIN_INSTR(MulNumber, binaryop)
{
- registers[instr->binaryop.output].setqreal(registers[instr->binaryop.left].getqreal() *
- registers[instr->binaryop.right].getqreal());
+ registers[instr->binaryop.output].setnumber(registers[instr->binaryop.left].getnumber() *
+ registers[instr->binaryop.right].getnumber());
}
- QML_V4_END_INSTR(MulReal, binaryop)
+ QML_V4_END_INSTR(MulNumber, binaryop)
- QML_V4_BEGIN_INSTR(DivReal, binaryop)
+ QML_V4_BEGIN_INSTR(DivNumber, binaryop)
{
- registers[instr->binaryop.output].setqreal(registers[instr->binaryop.left].getqreal() /
- registers[instr->binaryop.right].getqreal());
+ registers[instr->binaryop.output].setnumber(registers[instr->binaryop.left].getnumber() /
+ registers[instr->binaryop.right].getnumber());
}
- QML_V4_END_INSTR(DivReal, binaryop)
+ QML_V4_END_INSTR(DivNumber, binaryop)
- QML_V4_BEGIN_INSTR(ModReal, binaryop)
+ QML_V4_BEGIN_INSTR(ModNumber, binaryop)
{
Register &target = registers[instr->binaryop.output];
const Register &left = registers[instr->binaryop.left];
const Register &right = registers[instr->binaryop.right];
- if (QMetaType::QReal == QMetaType::Float)
- target.setqreal(::fmodf(left.getqreal(), right.getqreal()));
- else
- target.setqreal(::fmod(left.getqreal(), right.getqreal()));
+ target.setnumber(::fmod(left.getnumber(), right.getnumber()));
}
QML_V4_END_INSTR(ModInt, binaryop)
}
QML_V4_END_INSTR(URShiftInt, binaryop)
- QML_V4_BEGIN_INSTR(GtReal, binaryop)
+ QML_V4_BEGIN_INSTR(GtNumber, binaryop)
{
- registers[instr->binaryop.output].setbool(registers[instr->binaryop.left].getqreal() >
- registers[instr->binaryop.right].getqreal());
+ registers[instr->binaryop.output].setbool(registers[instr->binaryop.left].getnumber() >
+ registers[instr->binaryop.right].getnumber());
}
- QML_V4_END_INSTR(GtReal, binaryop)
+ QML_V4_END_INSTR(GtNumber, binaryop)
- QML_V4_BEGIN_INSTR(LtReal, binaryop)
+ QML_V4_BEGIN_INSTR(LtNumber, binaryop)
{
- registers[instr->binaryop.output].setbool(registers[instr->binaryop.left].getqreal() <
- registers[instr->binaryop.right].getqreal());
+ registers[instr->binaryop.output].setbool(registers[instr->binaryop.left].getnumber() <
+ registers[instr->binaryop.right].getnumber());
}
- QML_V4_END_INSTR(LtReal, binaryop)
+ QML_V4_END_INSTR(LtNumber, binaryop)
- QML_V4_BEGIN_INSTR(GeReal, binaryop)
+ QML_V4_BEGIN_INSTR(GeNumber, binaryop)
{
- registers[instr->binaryop.output].setbool(registers[instr->binaryop.left].getqreal() >=
- registers[instr->binaryop.right].getqreal());
+ registers[instr->binaryop.output].setbool(registers[instr->binaryop.left].getnumber() >=
+ registers[instr->binaryop.right].getnumber());
}
- QML_V4_END_INSTR(GeReal, binaryop)
+ QML_V4_END_INSTR(GeNumber, binaryop)
- QML_V4_BEGIN_INSTR(LeReal, binaryop)
+ QML_V4_BEGIN_INSTR(LeNumber, binaryop)
{
- registers[instr->binaryop.output].setbool(registers[instr->binaryop.left].getqreal() <=
- registers[instr->binaryop.right].getqreal());
+ registers[instr->binaryop.output].setbool(registers[instr->binaryop.left].getnumber() <=
+ registers[instr->binaryop.right].getnumber());
}
- QML_V4_END_INSTR(LeReal, binaryop)
+ QML_V4_END_INSTR(LeNumber, binaryop)
- QML_V4_BEGIN_INSTR(EqualReal, binaryop)
+ QML_V4_BEGIN_INSTR(EqualNumber, binaryop)
{
- registers[instr->binaryop.output].setbool(registers[instr->binaryop.left].getqreal() ==
- registers[instr->binaryop.right].getqreal());
+ registers[instr->binaryop.output].setbool(registers[instr->binaryop.left].getnumber() ==
+ registers[instr->binaryop.right].getnumber());
}
- QML_V4_END_INSTR(EqualReal, binaryop)
+ QML_V4_END_INSTR(EqualNumber, binaryop)
- QML_V4_BEGIN_INSTR(NotEqualReal, binaryop)
+ QML_V4_BEGIN_INSTR(NotEqualNumber, binaryop)
{
- registers[instr->binaryop.output].setbool(registers[instr->binaryop.left].getqreal() !=
- registers[instr->binaryop.right].getqreal());
+ registers[instr->binaryop.output].setbool(registers[instr->binaryop.left].getnumber() !=
+ registers[instr->binaryop.right].getnumber());
}
- QML_V4_END_INSTR(NotEqualReal, binaryop)
+ QML_V4_END_INSTR(NotEqualNumber, binaryop)
- QML_V4_BEGIN_INSTR(StrictEqualReal, binaryop)
+ QML_V4_BEGIN_INSTR(StrictEqualNumber, binaryop)
{
- registers[instr->binaryop.output].setbool(registers[instr->binaryop.left].getqreal() ==
- registers[instr->binaryop.right].getqreal());
+ registers[instr->binaryop.output].setbool(registers[instr->binaryop.left].getnumber() ==
+ registers[instr->binaryop.right].getnumber());
}
- QML_V4_END_INSTR(StrictEqualReal, binaryop)
+ QML_V4_END_INSTR(StrictEqualNumber, binaryop)
- QML_V4_BEGIN_INSTR(StrictNotEqualReal, binaryop)
+ QML_V4_BEGIN_INSTR(StrictNotEqualNumber, binaryop)
{
- registers[instr->binaryop.output].setbool(registers[instr->binaryop.left].getqreal() !=
- registers[instr->binaryop.right].getqreal());
+ registers[instr->binaryop.output].setbool(registers[instr->binaryop.left].getnumber() !=
+ registers[instr->binaryop.right].getnumber());
}
- QML_V4_END_INSTR(StrictNotEqualReal, binaryop)
+ QML_V4_END_INSTR(StrictNotEqualNumber, binaryop)
QML_V4_BEGIN_INSTR(GtString, binaryop)
{
}
QML_V4_END_INSTR(StrictNotEqualObject, binaryop)
- QML_V4_BEGIN_INSTR(MathMaxReal, binaryop)
+ QML_V4_BEGIN_INSTR(MathMaxNumber, binaryop)
{
const Register &left = registers[instr->binaryop.left];
const Register &right = registers[instr->binaryop.right];
Register &output = registers[instr->binaryop.output];
if (left.isUndefined() || right.isUndefined()) output.setUndefined();
- else output.setqreal(qMax(left.getqreal(), right.getqreal()));
+ else output.setnumber(qMax(left.getnumber(), right.getnumber()));
}
- QML_V4_END_INSTR(MathMaxReal, binaryop)
+ QML_V4_END_INSTR(MathMaxNumber, binaryop)
- QML_V4_BEGIN_INSTR(MathMinReal, binaryop)
+ QML_V4_BEGIN_INSTR(MathMinNumber, binaryop)
{
const Register &left = registers[instr->binaryop.left];
const Register &right = registers[instr->binaryop.right];
Register &output = registers[instr->binaryop.output];
if (left.isUndefined() || right.isUndefined()) output.setUndefined();
- else output.setqreal(qMin(left.getqreal(), right.getqreal()));
+ else output.setnumber(qMin(left.getnumber(), right.getnumber()));
}
- QML_V4_END_INSTR(MathMinReal, binaryop)
+ QML_V4_END_INSTR(MathMinNumber, binaryop)
QML_V4_BEGIN_INSTR(NewString, construct)
{
inline void subscribeId(QQmlContextData *p, int idIndex, int subIndex);
inline void subscribe(QObject *o, int notifyIndex, int subIndex);
- inline static qint32 toInt32(qreal n);
- static const qreal D32;
- static quint32 toUint32(qreal n);
+ inline static qint32 toInt32(double n);
+ static const double D32;
+ static quint32 toUint32(double n);
};
gen(i);
} break;
- case IR::RealType: {
- Instr::LoadReal i;
+ case IR::NumberType: {
+ Instr::LoadNumber i;
i.reg = currentReg;
i.value = e->value;
gen(i);
QQmlRegisterType regType;
switch (propTy) {
- case QMetaType::QReal:
- regType = QRealType;
+ case QMetaType::Double:
+ regType = NumberType;
break;
case QMetaType::Bool:
regType = BoolType;
} break;
case IR::OpUMinus:
- if (e->expr->type == IR::RealType) {
- Instr::UnaryMinusReal i;
+ if (e->expr->type == IR::NumberType) {
+ Instr::UnaryMinusNumber i;
i.output = currentReg;
i.src = src;
gen(i);
} else if (e->expr->type == IR::IntType) {
- convertToReal(e->expr, currentReg);
- Instr::UnaryMinusReal i;
+ convertToNumber(e->expr, currentReg);
+ Instr::UnaryMinusNumber i;
i.output = currentReg;
i.src = src;
gen(i);
break;
case IR::OpUPlus:
- if (e->expr->type == IR::RealType) {
- Instr::UnaryPlusReal i;
+ if (e->expr->type == IR::NumberType) {
+ Instr::UnaryPlusNumber i;
i.output = currentReg;
i.src = src;
gen(i);
} else if (e->expr->type == IR::IntType) {
- convertToReal(e->expr, currentReg);
- Instr::UnaryPlusReal i;
+ convertToNumber(e->expr, currentReg);
+ Instr::UnaryPlusNumber i;
i.output = currentReg;
i.src = src;
gen(i);
} // switch
}
-void QV4CompilerPrivate::convertToReal(IR::Expr *expr, int reg)
+void QV4CompilerPrivate::convertToNumber(IR::Expr *expr, int reg)
{
- if (expr->type == IR::RealType)
+ if (expr->type == IR::NumberType)
return;
switch (expr->type) {
case IR::BoolType: {
- Instr::ConvertBoolToReal i;
+ Instr::ConvertBoolToNumber i;
i.output = i.src = reg;
gen(i);
} break;
case IR::IntType: {
- Instr::ConvertIntToReal i;
+ Instr::ConvertIntToNumber i;
i.output = i.src = reg;
gen(i);
} break;
- case IR::RealType:
+ case IR::NumberType:
// nothing to do
return;
// nothing to do
return;
- case IR::RealType: {
- Instr::ConvertRealToInt i;
+ case IR::NumberType: {
+ Instr::ConvertNumberToInt i;
i.output = i.src = reg;
gen(i);
} break;
gen(i);
} break;
- case IR::RealType: {
- Instr::ConvertRealToBool i;
+ case IR::NumberType: {
+ Instr::ConvertNumberToBool i;
i.output = i.src = reg;
gen(i);
} return;
case IR::OpAdd:
if (e->type == IR::StringType)
return V4Instr::AddString;
- return V4Instr::AddReal;
+ return V4Instr::AddNumber;
case IR::OpSub:
- return V4Instr::SubReal;
+ return V4Instr::SubNumber;
case IR::OpMul:
- return V4Instr::MulReal;
+ return V4Instr::MulNumber;
case IR::OpDiv:
- return V4Instr::DivReal;
+ return V4Instr::DivNumber;
case IR::OpMod:
- return V4Instr::ModReal;
+ return V4Instr::ModNumber;
case IR::OpLShift:
return V4Instr::LShiftInt;
case IR::OpGt:
if (e->left->type == IR::StringType)
return V4Instr::GtString;
- return V4Instr::GtReal;
+ return V4Instr::GtNumber;
case IR::OpLt:
if (e->left->type == IR::StringType)
return V4Instr::LtString;
- return V4Instr::LtReal;
+ return V4Instr::LtNumber;
case IR::OpGe:
if (e->left->type == IR::StringType)
return V4Instr::GeString;
- return V4Instr::GeReal;
+ return V4Instr::GeNumber;
case IR::OpLe:
if (e->left->type == IR::StringType)
return V4Instr::LeString;
- return V4Instr::LeReal;
+ return V4Instr::LeNumber;
case IR::OpEqual:
if (e->left->type == IR::ObjectType || e->right->type == IR::ObjectType)
return V4Instr::EqualObject;
if (e->left->type == IR::StringType)
return V4Instr::EqualString;
- return V4Instr::EqualReal;
+ return V4Instr::EqualNumber;
case IR::OpNotEqual:
if (e->left->type == IR::ObjectType || e->right->type == IR::ObjectType)
return V4Instr::NotEqualObject;
if (e->left->type == IR::StringType)
return V4Instr::NotEqualString;
- return V4Instr::NotEqualReal;
+ return V4Instr::NotEqualNumber;
case IR::OpStrictEqual:
if (e->left->type == IR::ObjectType || e->right->type == IR::ObjectType)
return V4Instr::StrictEqualObject;
if (e->left->type == IR::StringType)
return V4Instr::StrictEqualString;
- return V4Instr::StrictEqualReal;
+ return V4Instr::StrictEqualNumber;
case IR::OpStrictNotEqual:
if (e->left->type == IR::ObjectType || e->right->type == IR::ObjectType)
return V4Instr::StrictNotEqualObject;
if (e->left->type == IR::StringType)
return V4Instr::StrictNotEqualString;
- return V4Instr::StrictNotEqualReal;
+ return V4Instr::StrictNotEqualNumber;
case IR::OpAnd:
case IR::OpOr:
case IR::OpAdd:
if (e->type != IR::StringType) {
- convertToReal(e->left, left);
- convertToReal(e->right, right);
+ convertToNumber(e->left, left);
+ convertToNumber(e->right, right);
}
break;
case IR::OpMul:
case IR::OpDiv:
case IR::OpMod:
- convertToReal(e->left, left);
- convertToReal(e->right, right);
+ convertToNumber(e->left, left);
+ convertToNumber(e->right, right);
break;
case IR::OpGt:
case IR::OpStrictEqual:
case IR::OpStrictNotEqual:
if (e->left->type >= IR::FirstNumberType) {
- convertToReal(e->left, left);
- convertToReal(e->right, right);
+ convertToNumber(e->left, left);
+ convertToNumber(e->right, right);
}
break;
{
if (IR::Name *name = call->base->asName()) {
IR::Expr *arg = call->onlyArgument();
- if (arg != 0 && arg->type == IR::RealType) {
+ if (arg != 0 && arg->type == IR::NumberType) {
traceExpression(arg, currentReg);
switch (name->builtin) {
break;
case IR::MathSinBultinFunction: {
- Instr::MathSinReal i;
+ Instr::MathSinNumber i;
i.output = i.src = currentReg;
gen(i);
} return;
case IR::MathCosBultinFunction: {
- Instr::MathCosReal i;
+ Instr::MathCosNumber i;
i.output = i.src = currentReg;
gen(i);
} return;
case IR::MathAbsBuiltinFunction: {
- Instr::MathAbsReal i;
+ Instr::MathAbsNumber i;
i.output = i.src = currentReg;
gen(i);
} return;
case IR::MathRoundBultinFunction: {
- Instr::MathRoundReal i;
+ Instr::MathRoundNumber i;
i.output = i.src = currentReg;
gen(i);
} return;
case IR::MathFloorBultinFunction: {
- Instr::MathFloorReal i;
+ Instr::MathFloorNumber i;
i.output = i.src = currentReg;
gen(i);
} return;
case IR::MathCeilBuiltinFunction: {
- Instr::MathCeilReal i;
+ Instr::MathCeilNumber i;
i.output = i.src = currentReg;
gen(i);
} return;
IR::Expr *arg1 = call->args->expr;
IR::Expr *arg2 = call->args->next->expr;
- if (arg1 != 0 && arg1->type == IR::RealType &&
- arg2 != 0 && arg2->type == IR::RealType) {
+ if (arg1 != 0 && arg1->type == IR::NumberType &&
+ arg2 != 0 && arg2->type == IR::NumberType) {
traceExpression(arg1, currentReg);
traceExpression(arg2, currentReg + 1);
if (name->builtin == IR::MathMaxBuiltinFunction) {
- Instr::MathMaxReal i;
+ Instr::MathMaxNumber i;
i.left = currentReg;
i.right = currentReg + 1;
i.output = currentReg;
gen(i);
return;
} else if (name->builtin == IR::MathMinBuiltinFunction) {
- Instr::MathMinReal i;
+ Instr::MathMinNumber i;
i.left = currentReg;
i.right = currentReg + 1;
i.output = currentReg;
if (targetTy == IR::BoolType) {
switch (sourceTy) {
case IR::IntType: opcode = V4Instr::ConvertIntToBool; break;
- case IR::RealType: opcode = V4Instr::ConvertRealToBool; break;
+ case IR::NumberType: opcode = V4Instr::ConvertNumberToBool; break;
case IR::StringType: opcode = V4Instr::ConvertStringToBool; break;
case IR::UrlType: opcode = V4Instr::ConvertUrlToBool; break;
case IR::ColorType: opcode = V4Instr::ConvertColorToBool; break;
} else if (targetTy == IR::IntType) {
switch (sourceTy) {
case IR::BoolType: opcode = V4Instr::ConvertBoolToInt; break;
- case IR::RealType: {
+ case IR::NumberType: {
if (s->isMoveForReturn)
- opcode = V4Instr::MathRoundReal;
+ opcode = V4Instr::MathRoundNumber;
else
- opcode = V4Instr::ConvertRealToInt;
+ opcode = V4Instr::ConvertNumberToInt;
break;
}
case IR::StringType: opcode = V4Instr::ConvertStringToInt; break;
default: break;
} // switch
- } else if (targetTy == IR::RealType) {
+ } else if (targetTy == IR::NumberType) {
switch (sourceTy) {
- case IR::BoolType: opcode = V4Instr::ConvertBoolToReal; break;
- case IR::IntType: opcode = V4Instr::ConvertIntToReal; break;
- case IR::StringType: opcode = V4Instr::ConvertStringToReal; break;
+ case IR::BoolType: opcode = V4Instr::ConvertBoolToNumber; break;
+ case IR::IntType: opcode = V4Instr::ConvertIntToNumber; break;
+ case IR::StringType: opcode = V4Instr::ConvertStringToNumber; break;
default: break;
} // switch
} else if (targetTy == IR::StringType) {
switch (sourceTy) {
case IR::BoolType: opcode = V4Instr::ConvertBoolToString; break;
case IR::IntType: opcode = V4Instr::ConvertIntToString; break;
- case IR::RealType: opcode = V4Instr::ConvertRealToString; break;
+ case IR::NumberType: opcode = V4Instr::ConvertNumberToString; break;
case IR::UrlType: opcode = V4Instr::ConvertUrlToString; break;
case IR::ColorType: opcode = V4Instr::ConvertColorToString; break;
default: break;
switch (sourceTy) {
case IR::BoolType: gen(V4Instr::ConvertBoolToString, convToString); sourceTy = IR::StringType; break;
case IR::IntType: gen(V4Instr::ConvertIntToString, convToString); sourceTy = IR::StringType; break;
- case IR::RealType: gen(V4Instr::ConvertRealToString, convToString); sourceTy = IR::StringType; break;
+ case IR::NumberType: gen(V4Instr::ConvertNumberToString, convToString); sourceTy = IR::StringType; break;
case IR::ColorType: gen(V4Instr::ConvertColorToString, convToString); sourceTy = IR::StringType; break;
default: break;
} // switch
case IR::IntType:
test.regType = QMetaType::Int;
break;
- case IR::RealType:
- test.regType = QMetaType::QReal;
+ case IR::NumberType:
+ test.regType = QMetaType::Double;
break;
default:
discard();
QByteArray buildSignalTable() const;
QByteArray buildExceptionData() const;
- void convertToReal(QQmlJS::IR::Expr *expr, int reg);
+ void convertToNumber(QQmlJS::IR::Expr *expr, int reg);
void convertToInt(QQmlJS::IR::Expr *expr, int reg);
void convertToBool(QQmlJS::IR::Expr *expr, int reg);
quint8 instructionOpcode(QQmlJS::IR::Binop *e);
case V4Instr::UnaryNot:
INSTR_DUMP << "\t" << "UnaryNot" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
break;
- case V4Instr::UnaryMinusReal:
- INSTR_DUMP << "\t" << "UnaryMinusReal" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
+ case V4Instr::UnaryMinusNumber:
+ INSTR_DUMP << "\t" << "UnaryMinusNumber" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
break;
case V4Instr::UnaryMinusInt:
INSTR_DUMP << "\t" << "UnaryMinusInt" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
break;
- case V4Instr::UnaryPlusReal:
- INSTR_DUMP << "\t" << "UnaryPlusReal" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
+ case V4Instr::UnaryPlusNumber:
+ INSTR_DUMP << "\t" << "UnaryPlusNumber" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
break;
case V4Instr::UnaryPlusInt:
INSTR_DUMP << "\t" << "UnaryPlusInt" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
case V4Instr::ConvertBoolToInt:
INSTR_DUMP << "\t" << "ConvertBoolToInt" << "\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
break;
- case V4Instr::ConvertBoolToReal:
- INSTR_DUMP << "\t" << "ConvertBoolToReal" << "\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
+ case V4Instr::ConvertBoolToNumber:
+ INSTR_DUMP << "\t" << "ConvertBoolToNumber" << "\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
break;
case V4Instr::ConvertBoolToString:
INSTR_DUMP << "\t" << "ConvertBoolToString" << "\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
case V4Instr::ConvertIntToBool:
INSTR_DUMP << "\t" << "ConvertIntToBool" << "\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
break;
- case V4Instr::ConvertIntToReal:
- INSTR_DUMP << "\t" << "ConvertIntToReal" << "\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
+ case V4Instr::ConvertIntToNumber:
+ INSTR_DUMP << "\t" << "ConvertIntToNumber" << "\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
break;
case V4Instr::ConvertIntToString:
INSTR_DUMP << "\t" << "ConvertIntToString" << "\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
break;
- case V4Instr::ConvertRealToBool:
- INSTR_DUMP << "\t" << "ConvertRealToBool" << "\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
+ case V4Instr::ConvertNumberToBool:
+ INSTR_DUMP << "\t" << "ConvertNumberToBool" << "\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
break;
- case V4Instr::ConvertRealToInt:
- INSTR_DUMP << "\t" << "ConvertRealToInt" << "\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
+ case V4Instr::ConvertNumberToInt:
+ INSTR_DUMP << "\t" << "ConvertNumberToInt" << "\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
break;
- case V4Instr::ConvertRealToString:
- INSTR_DUMP << "\t" << "ConvertRealToString" << "\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
+ case V4Instr::ConvertNumberToString:
+ INSTR_DUMP << "\t" << "ConvertNumberToString" << "\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
break;
case V4Instr::ConvertStringToBool:
INSTR_DUMP << "\t" << "ConvertStringToBool" << "\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
case V4Instr::ConvertStringToInt:
INSTR_DUMP << "\t" << "ConvertStringToInt" << "\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
break;
- case V4Instr::ConvertStringToReal:
- INSTR_DUMP << "\t" << "ConvertStringToReal" << "\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
+ case V4Instr::ConvertStringToNumber:
+ INSTR_DUMP << "\t" << "ConvertStringToNumber" << "\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
break;
case V4Instr::ConvertStringToUrl:
INSTR_DUMP << "\t" << "ConvertStringToUrl" << "\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
case V4Instr::ResolveUrl:
INSTR_DUMP << "\t" << "ResolveUrl" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
break;
- case V4Instr::MathSinReal:
- INSTR_DUMP << "\t" << "MathSinReal" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
+ case V4Instr::MathSinNumber:
+ INSTR_DUMP << "\t" << "MathSinNumber" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
break;
- case V4Instr::MathCosReal:
- INSTR_DUMP << "\t" << "MathCosReal" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
+ case V4Instr::MathCosNumber:
+ INSTR_DUMP << "\t" << "MathCosNumber" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
break;
- case V4Instr::MathAbsReal:
- INSTR_DUMP << "\t" << "MathAbsReal" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
+ case V4Instr::MathAbsNumber:
+ INSTR_DUMP << "\t" << "MathAbsNumber" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
break;
- case V4Instr::MathRoundReal:
- INSTR_DUMP << "\t" << "MathRoundReal" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
+ case V4Instr::MathRoundNumber:
+ INSTR_DUMP << "\t" << "MathRoundNumber" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
break;
- case V4Instr::MathFloorReal:
- INSTR_DUMP << "\t" << "MathFloorReal" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
+ case V4Instr::MathFloorNumber:
+ INSTR_DUMP << "\t" << "MathFloorNumber" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
break;
- case V4Instr::MathCeilReal:
- INSTR_DUMP << "\t" << "MathCeilReal" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
+ case V4Instr::MathCeilNumber:
+ INSTR_DUMP << "\t" << "MathCeilNumber" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
break;
- case V4Instr::MathPIReal:
- INSTR_DUMP << "\t" << "MathPIReal" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
+ case V4Instr::MathPINumber:
+ INSTR_DUMP << "\t" << "MathPINumber" << "\t\t" << "Input_Reg(" << i->unaryop.src << ") -> Output_Reg(" << i->unaryop.output << ")";
break;
case V4Instr::LoadNull:
INSTR_DUMP << "\t" << "LoadNull" << "\t\t" << "Constant(null) -> Output_Reg(" << i->null_value.reg << ")";
break;
- case V4Instr::LoadReal:
- INSTR_DUMP << "\t" << "LoadReal" << "\t\t" << "Constant(" << i->real_value.value << ") -> Output_Reg(" << i->real_value.reg << ")";
+ case V4Instr::LoadNumber:
+ INSTR_DUMP << "\t" << "LoadNumber" << "\t\t" << "Constant(" << i->number_value.value << ") -> Output_Reg(" << i->number_value.reg << ")";
break;
case V4Instr::LoadInt:
INSTR_DUMP << "\t" << "LoadInt" << "\t\t\t" << "Constant(" << i->int_value.value << ") -> Output_Reg(" << i->int_value.reg << ")";
case V4Instr::BitXorInt:
INSTR_DUMP << "\t" << "BitXorInt" << "\t\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
break;
- case V4Instr::AddReal:
- INSTR_DUMP << "\t" << "AddReal" << "\t\t\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
+ case V4Instr::AddNumber:
+ INSTR_DUMP << "\t" << "AddNumber" << "\t\t\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
break;
case V4Instr::AddString:
INSTR_DUMP << "\t" << "AddString" << "\t\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
break;
- case V4Instr::SubReal:
- INSTR_DUMP << "\t" << "SubReal" << "\t\t\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
+ case V4Instr::SubNumber:
+ INSTR_DUMP << "\t" << "SubNumber" << "\t\t\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
break;
- case V4Instr::MulReal:
- INSTR_DUMP << "\t" << "MulReal" << "\t\t\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
+ case V4Instr::MulNumber:
+ INSTR_DUMP << "\t" << "MulNumber" << "\t\t\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
break;
- case V4Instr::DivReal:
- INSTR_DUMP << "\t" << "DivReal" << "\t\t\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
+ case V4Instr::DivNumber:
+ INSTR_DUMP << "\t" << "DivNumber" << "\t\t\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
break;
- case V4Instr::ModReal:
- INSTR_DUMP << "\t" << "ModReal" << "\t\t\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
+ case V4Instr::ModNumber:
+ INSTR_DUMP << "\t" << "ModNumber" << "\t\t\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
break;
case V4Instr::LShiftInt:
INSTR_DUMP << "\t" << "LShiftInt" << "\t\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
case V4Instr::URShiftInt:
INSTR_DUMP << "\t" << "URShiftInt" << "\t\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
break;
- case V4Instr::GtReal:
- INSTR_DUMP << "\t" << "GtReal" << "\t\t\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
+ case V4Instr::GtNumber:
+ INSTR_DUMP << "\t" << "GtNumber" << "\t\t\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
break;
- case V4Instr::LtReal:
- INSTR_DUMP << "\t" << "LtReal" << "\t\t\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
+ case V4Instr::LtNumber:
+ INSTR_DUMP << "\t" << "LtNumber" << "\t\t\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
break;
- case V4Instr::GeReal:
- INSTR_DUMP << "\t" << "GeReal" << "\t\t\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
+ case V4Instr::GeNumber:
+ INSTR_DUMP << "\t" << "GeNumber" << "\t\t\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
break;
- case V4Instr::LeReal:
- INSTR_DUMP << "\t" << "LeReal" << "\t\t\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
+ case V4Instr::LeNumber:
+ INSTR_DUMP << "\t" << "LeNumber" << "\t\t\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
break;
- case V4Instr::EqualReal:
- INSTR_DUMP << "\t" << "EqualReal" << "\t\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
+ case V4Instr::EqualNumber:
+ INSTR_DUMP << "\t" << "EqualNumber" << "\t\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
break;
- case V4Instr::NotEqualReal:
- INSTR_DUMP << "\t" << "NotEqualReal" << "\t\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
+ case V4Instr::NotEqualNumber:
+ INSTR_DUMP << "\t" << "NotEqualNumber" << "\t\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
break;
- case V4Instr::StrictEqualReal:
- INSTR_DUMP << "\t" << "StrictEqualReal" << "\t\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
+ case V4Instr::StrictEqualNumber:
+ INSTR_DUMP << "\t" << "StrictEqualNumber" << "\t\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
break;
- case V4Instr::StrictNotEqualReal:
- INSTR_DUMP << "\t" << "StrictNotEqualReal" << "\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
+ case V4Instr::StrictNotEqualNumber:
+ INSTR_DUMP << "\t" << "StrictNotEqualNumber" << "\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
break;
case V4Instr::GtString:
INSTR_DUMP << "\t" << "GtString" << "\t\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
case V4Instr::StrictNotEqualObject:
INSTR_DUMP << "\t" << "StrictNotEqualObject" << "\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
break;
- case V4Instr::MathMaxReal:
- INSTR_DUMP << "\t" << "MathMaxReal" << "\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
+ case V4Instr::MathMaxNumber:
+ INSTR_DUMP << "\t" << "MathMaxNumber" << "\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
break;
- case V4Instr::MathMinReal:
- INSTR_DUMP << "\t" << "MathMinReal" << "\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
+ case V4Instr::MathMinNumber:
+ INSTR_DUMP << "\t" << "MathMinNumber" << "\t" << "Input_Reg(" << i->binaryop.left << ") Input_Reg(" << i->binaryop.right << ") -> Output_Reg(" << i->binaryop.output << ")";
break;
case V4Instr::NewString:
INSTR_DUMP << "\t" << "NewString" << "\t\t" << "Register(" << i->construct.reg << ")";
F(LoadModuleObject, load) \
F(LoadAttached, attached) \
F(UnaryNot, unaryop) \
- F(UnaryMinusReal, unaryop) \
+ F(UnaryMinusNumber, unaryop) \
F(UnaryMinusInt, unaryop) \
- F(UnaryPlusReal, unaryop) \
+ F(UnaryPlusNumber, unaryop) \
F(UnaryPlusInt, unaryop) \
F(ConvertBoolToInt, unaryop) \
- F(ConvertBoolToReal, unaryop) \
+ F(ConvertBoolToNumber, unaryop) \
F(ConvertBoolToString, unaryop) \
F(ConvertIntToBool, unaryop) \
- F(ConvertIntToReal, unaryop) \
+ F(ConvertIntToNumber, unaryop) \
F(ConvertIntToString, unaryop) \
- F(ConvertRealToBool, unaryop) \
- F(ConvertRealToInt, unaryop) \
- F(ConvertRealToString, unaryop) \
+ F(ConvertNumberToBool, unaryop) \
+ F(ConvertNumberToInt, unaryop) \
+ F(ConvertNumberToString, unaryop) \
F(ConvertStringToBool, unaryop) \
F(ConvertStringToInt, unaryop) \
- F(ConvertStringToReal, unaryop) \
+ F(ConvertStringToNumber, unaryop) \
F(ConvertStringToUrl, unaryop) \
F(ConvertStringToColor, unaryop) \
F(ConvertUrlToBool, unaryop) \
F(ConvertObjectToBool, unaryop) \
F(ConvertNullToObject, unaryop) \
F(ResolveUrl, unaryop) \
- F(MathSinReal, unaryop) \
- F(MathCosReal, unaryop) \
- F(MathAbsReal, unaryop) \
- F(MathRoundReal, unaryop) \
- F(MathFloorReal, unaryop) \
- F(MathCeilReal, unaryop) \
- F(MathPIReal, unaryop) \
+ F(MathSinNumber, unaryop) \
+ F(MathCosNumber, unaryop) \
+ F(MathAbsNumber, unaryop) \
+ F(MathRoundNumber, unaryop) \
+ F(MathFloorNumber, unaryop) \
+ F(MathCeilNumber, unaryop) \
+ F(MathPINumber, unaryop) \
F(LoadNull, null_value) \
- F(LoadReal, real_value) \
+ F(LoadNumber, number_value) \
F(LoadInt, int_value) \
F(LoadBool, bool_value) \
F(LoadString, string_value) \
F(BitAndInt, binaryop) \
F(BitOrInt, binaryop) \
F(BitXorInt, binaryop) \
- F(AddReal, binaryop) \
+ F(AddNumber, binaryop) \
F(AddString, binaryop) \
- F(SubReal, binaryop) \
- F(MulReal, binaryop) \
- F(DivReal, binaryop) \
- F(ModReal, binaryop) \
+ F(SubNumber, binaryop) \
+ F(MulNumber, binaryop) \
+ F(DivNumber, binaryop) \
+ F(ModNumber, binaryop) \
F(LShiftInt, binaryop) \
F(RShiftInt, binaryop) \
F(URShiftInt, binaryop) \
- F(GtReal, binaryop) \
- F(LtReal, binaryop) \
- F(GeReal, binaryop) \
- F(LeReal, binaryop) \
- F(EqualReal, binaryop) \
- F(NotEqualReal, binaryop) \
- F(StrictEqualReal, binaryop) \
- F(StrictNotEqualReal, binaryop) \
+ F(GtNumber, binaryop) \
+ F(LtNumber, binaryop) \
+ F(GeNumber, binaryop) \
+ F(LeNumber, binaryop) \
+ F(EqualNumber, binaryop) \
+ F(NotEqualNumber, binaryop) \
+ F(StrictEqualNumber, binaryop) \
+ F(StrictNotEqualNumber, binaryop) \
F(GtString, binaryop) \
F(LtString, binaryop) \
F(GeString, binaryop) \
F(NotEqualObject, binaryop) \
F(StrictEqualObject, binaryop) \
F(StrictNotEqualObject, binaryop) \
- F(MathMaxReal, binaryop) \
- F(MathMinReal, binaryop) \
+ F(MathMaxNumber, binaryop) \
+ F(MathMinNumber, binaryop) \
F(NewString, construct) \
F(NewUrl, construct) \
F(CleanupRegister, cleanup) \
qint8 reg;
};
- struct instr_real_value {
+ struct instr_number_value {
QML_V4_INSTR_HEADER
qint8 reg;
- qreal value; // XXX Makes the instruction 12 bytes
+ double value; // XXX Makes the instruction 12 bytes
};
struct instr_int_value {
instr_copy copy;
instr_construct construct;
instr_null_value null_value;
- instr_real_value real_value;
+ instr_number_value number_value;
instr_int_value int_value;
instr_bool_value bool_value;
instr_string_value string_value;
case ObjectType: return "object";
case BoolType: return "bool";
case IntType: return "int";
- case RealType: return "qreal";
- case RealNaNType: return "NaN";
+ case NumberType: return "number";
default: return "invalid";
}
}
builtin = MathMinBuiltinFunction;
} else if (id->length() == 7 && *id == QLatin1String("Math.PI")) {
builtin = MathPIBuiltinConstant;
- this->type = RealType;
+ this->type = NumberType;
}
}
case OpUMinus:
case OpUPlus:
case OpCompl:
- return maxType(expr->type, RealType);
+ return maxType(expr->type, NumberType);
default:
break;
case OpAdd:
if (left->type == StringType)
return StringType;
- return RealType;
+ return NumberType;
case OpSub:
case OpMul:
case OpDiv:
case OpMod:
- return RealType;
+ return NumberType;
case OpLShift:
case OpRShift:
case MathAbsBuiltinFunction: //### type could also be Int if input was Int
case MathMaxBuiltinFunction:
case MathMinBuiltinFunction:
- return RealType;
+ return NumberType;
case MathRoundBultinFunction:
case MathFloorBultinFunction:
FirstNumberType,
BoolType = FirstNumberType,
IntType,
- RealType,
- RealNaNType
+ NumberType
};
Type maxType(IR::Type left, IR::Type right);
case QMetaType::Int:
return IR::IntType;
- case QMetaType::QReal:
- return IR::RealType;
+ case QMetaType::Double:
+ return IR::NumberType;
case QMetaType::QString:
return IR::StringType;
_expr.format = ExprResult::cx;
_block->JUMP(ast->value ? _expr.iftrue : _expr.iffalse);
} else {
- _expr.code = _block->CONST(IR::RealType, ast->value);
+ _expr.code = _block->CONST(IR::NumberType, ast->value);
}
return false;
}
if (left.type() == IR::StringType && right.type() == IR::StringType) {
binop(ast, left, right);
} else if (left.isValid() && right.isValid()) {
- implicitCvt(left, IR::RealType);
- implicitCvt(right, IR::RealType);
+ implicitCvt(left, IR::NumberType);
+ implicitCvt(right, IR::NumberType);
binop(ast, left, right);
}
} break;
}
} else if ((left.type() == IR::StringType && right.type() >= IR::FirstNumberType) ||
(left.type() >= IR::FirstNumberType && right.type() == IR::StringType)) {
- implicitCvt(left, IR::RealType);
- implicitCvt(right, IR::RealType);
+ implicitCvt(left, IR::NumberType);
+ implicitCvt(right, IR::NumberType);
binop(ast, left, right);
} else if (left.isValid() && right.isValid()) {
binop(ast, left, right);
IR::Type t = maxType(left.type(), right.type());
if (t >= IR::FirstNumberType) {
- implicitCvt(left, IR::RealType);
- implicitCvt(right, IR::RealType);
+ implicitCvt(left, IR::NumberType);
+ implicitCvt(right, IR::NumberType);
IR::Expr *code = _block->BINOP(IR::binaryOperator(ast->op), left, right);
_expr.code = _block->TEMP(code->type);
case QQmlJS::IR::StringType:
case QQmlJS::IR::BoolType:
case QQmlJS::IR::IntType:
- case QQmlJS::IR::RealType:
- case QQmlJS::IR::RealNaNType:
+ case QQmlJS::IR::NumberType:
return true;
default:
UndefinedType,
NullType,
QObjectStarType,
- QRealType,
+ NumberType,
IntType,
BoolType,