aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/v4
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2011-07-29 10:25:44 +0200
committerQt by Nokia <qt-info@nokia.com>2011-07-29 13:00:52 +0200
commitd410ad364ec0b8877797145c68a4d7c3c98ce1c0 (patch)
tree11862c21e5e465abe3275768918f82cbec2bc6e7 /src/declarative/qml/v4
parent43b783d09e0899165bbe964a175785ccdfedf6e5 (diff)
Merge the QJSEngine and QJSValue development branch into master.
This replaces the dependency to QtScript with two new builtin classes QJSValue and QJSEngine. This is still work in progress, development continues now in the master branch. Change-Id: I7f5487feb45c972f25a22b10cc81b9218b9805de Reviewed-on: http://codereview.qt.nokia.com/2299 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>
Diffstat (limited to 'src/declarative/qml/v4')
-rw-r--r--src/declarative/qml/v4/qdeclarativev4bindings.cpp44
-rw-r--r--src/declarative/qml/v4/qdeclarativev4irbuilder.cpp2
2 files changed, 21 insertions, 25 deletions
diff --git a/src/declarative/qml/v4/qdeclarativev4bindings.cpp b/src/declarative/qml/v4/qdeclarativev4bindings.cpp
index 29c9ce05c5..d93d930034 100644
--- a/src/declarative/qml/v4/qdeclarativev4bindings.cpp
+++ b/src/declarative/qml/v4/qdeclarativev4bindings.cpp
@@ -217,7 +217,6 @@ public:
typedef QDeclarativeNotifierEndpoint Subscription;
Subscription *subscriptions;
- QScriptDeclarativeClass::PersistentIdentifier *identifiers;
void run(Binding *, QDeclarativePropertyPrivate::WriteFlags flags);
@@ -240,20 +239,19 @@ public:
inline void subscribeId(QDeclarativeContextData *p, int idIndex, int subIndex);
inline void subscribe(QObject *o, int notifyIndex, int subIndex);
- inline static qint32 toInt32(qsreal n);
- static const qsreal D32;
- static quint32 toUint32(qsreal n);
+ inline static qint32 toInt32(qreal n);
+ static const qreal D32;
+ static quint32 toUint32(qreal n);
};
QDeclarativeV4BindingsPrivate::QDeclarativeV4BindingsPrivate()
-: subscriptions(0), identifiers(0), program(0), bindings(0)
+: subscriptions(0), program(0), bindings(0)
{
}
QDeclarativeV4BindingsPrivate::~QDeclarativeV4BindingsPrivate()
{
delete [] subscriptions; subscriptions = 0;
- delete [] identifiers; identifiers = 0;
}
int QDeclarativeV4BindingsPrivate::methodCount = -1;
@@ -508,8 +506,6 @@ void QDeclarativeV4BindingsPrivate::init()
{
if (program->subscriptions)
subscriptions = new QDeclarativeV4BindingsPrivate::Subscription[program->subscriptions];
- if (program->identifiers)
- identifiers = new QScriptDeclarativeClass::PersistentIdentifier[program->identifiers];
bindings = new QDeclarativeV4BindingsPrivate::Binding[program->bindings];
}
@@ -679,15 +675,15 @@ static void throwException(int id, QDeclarativeDelayedError *error,
QDeclarativeEnginePrivate::warning(context->engine, error->error);
}
-const qsreal QDeclarativeV4BindingsPrivate::D32 = 4294967296.0;
+const qreal QDeclarativeV4BindingsPrivate::D32 = 4294967296.0;
-qint32 QDeclarativeV4BindingsPrivate::toInt32(qsreal n)
+qint32 QDeclarativeV4BindingsPrivate::toInt32(qreal n)
{
if (qIsNaN(n) || qIsInf(n) || (n == 0))
return 0;
double sign = (n < 0) ? -1.0 : 1.0;
- qsreal abs_n = fabs(n);
+ qreal abs_n = fabs(n);
n = ::fmod(sign * ::floor(abs_n), D32);
const double D31 = D32 / 2.0;
@@ -701,13 +697,13 @@ qint32 QDeclarativeV4BindingsPrivate::toInt32(qsreal n)
return qint32 (n);
}
-inline quint32 QDeclarativeV4BindingsPrivate::toUint32(qsreal n)
+inline quint32 QDeclarativeV4BindingsPrivate::toUint32(qreal n)
{
if (qIsNaN(n) || qIsInf(n) || (n == 0))
return 0;
double sign = (n < 0) ? -1.0 : 1.0;
- qsreal abs_n = fabs(n);
+ qreal abs_n = fabs(n);
n = ::fmod(sign * ::floor(abs_n), D32);
@@ -1015,7 +1011,7 @@ void QDeclarativeV4BindingsPrivate::run(int instrIndex, quint32 &executedBlocks,
} else {
// Delegate the conversion. This is pretty fast and it doesn't require a QScriptEngine.
// Ideally we should just call the methods in the QScript namespace directly.
- QScriptValue tmp(*src.getstringptr());
+ QJSValue tmp(*src.getstringptr());
if (instr->unaryop.src == instr->unaryop.output) {
output.cleanupString();
MARK_CLEAN_REGISTER(instr->unaryop.output);
@@ -1035,7 +1031,7 @@ void QDeclarativeV4BindingsPrivate::run(int instrIndex, quint32 &executedBlocks,
} else {
// Delegate the conversion. This is pretty fast and it doesn't require a QScriptEngine.
// Ideally we should just call the methods in the QScript namespace directly.
- QScriptValue tmp(*src.getstringptr());
+ QJSValue tmp(*src.getstringptr());
if (instr->unaryop.src == instr->unaryop.output) {
output.cleanupString();
MARK_CLEAN_REGISTER(instr->unaryop.output);
@@ -1055,7 +1051,7 @@ void QDeclarativeV4BindingsPrivate::run(int instrIndex, quint32 &executedBlocks,
} else {
// Delegate the conversion. This is pretty fast and it doesn't require a QScriptEngine.
// Ideally we should just call the methods in the QScript namespace directly.
- QScriptValue tmp(*src.getstringptr());
+ QJSValue tmp(*src.getstringptr());
if (instr->unaryop.src == instr->unaryop.output) {
output.cleanupString();
MARK_CLEAN_REGISTER(instr->unaryop.output);
@@ -1103,7 +1099,7 @@ void QDeclarativeV4BindingsPrivate::run(int instrIndex, quint32 &executedBlocks,
QML_V4_BEGIN_INSTR(MathPIReal, unaryop)
{
- static const qsreal qmlPI = 2.0 * qAsin(1.0);
+ static const qreal qmlPI = 2.0 * qAsin(1.0);
Register &output = registers[instr->unaryop.output];
output.setqreal(qmlPI);
}
@@ -1480,16 +1476,16 @@ void QDeclarativeV4BindingsPrivate::run(int instrIndex, quint32 &executedBlocks,
executedBlocks |= instr->blockop.block;
QML_V4_END_INSTR(Block, blockop)
+ // XXX not applicable in v8
QML_V4_BEGIN_INSTR(InitString, initstring)
- if (!identifiers[instr->initstring.offset].identifier) {
- quint32 len = *(quint32 *)(data + instr->initstring.dataIdx);
- QChar *strdata = (QChar *)(data + instr->initstring.dataIdx + sizeof(quint32));
+// if (!identifiers[instr->initstring.offset].identifier) {
+// quint32 len = *(quint32 *)(data + instr->initstring.dataIdx);
+// QChar *strdata = (QChar *)(data + instr->initstring.dataIdx + sizeof(quint32));
- QString str = QString::fromRawData(strdata, len);
+// QString str = QString::fromRawData(strdata, len);
- // XXX not applicable in v8
- // identifiers[instr->initstring.offset] = engine->objectClass->createPersistentIdentifier(str);
- }
+// // identifiers[instr->initstring.offset] = engine->objectClass->createPersistentIdentifier(str);
+// }
QML_V4_END_INSTR(InitString, initstring)
QML_V4_BEGIN_INSTR(CleanupRegister, cleanup)
diff --git a/src/declarative/qml/v4/qdeclarativev4irbuilder.cpp b/src/declarative/qml/v4/qdeclarativev4irbuilder.cpp
index 34a59caf1a..bddfca18b4 100644
--- a/src/declarative/qml/v4/qdeclarativev4irbuilder.cpp
+++ b/src/declarative/qml/v4/qdeclarativev4irbuilder.cpp
@@ -436,7 +436,7 @@ bool QDeclarativeV4IRBuilder::visit(AST::IdentifierExpression *ast)
if (name.at(0) == QLatin1Char('u') && name.length() == 9 && name == QLatin1String("undefined")) {
_expr.code = _block->CONST(IR::UndefinedType, 0); // ### undefined value
- } else if(m_engine->v8engine.illegalNames().contains(name) ) {
+ } else if (m_engine->v8engine()->illegalNames().contains(name) ) {
if (qmlVerboseCompiler()) qWarning() << "*** illegal symbol:" << name;
return false;
} else if (const QDeclarativeParser::Object *obj = m_expression->ids.value(name)) {