QString code = rewriteBinding(str);
m_expression = str.toUtf8();
- v8function = evalFunction(context(), obj, code, QString(), 0);
+ v4function = evalFunction(context(), obj, code, QString(), 0)->v4Value();
}
QQmlBinding::QQmlBinding(const QQmlScriptString &script, QObject *obj, QQmlContext *ctxt)
m_lineNumber = scriptPrivate->lineNumber;
m_columnNumber = scriptPrivate->columnNumber;
- v8function = evalFunction(context(), scopeObject(), code, QString(), m_lineNumber);
+ v4function = evalFunction(context(), scopeObject(), code, QString(), m_lineNumber)->v4Value();
}
QQmlBinding::QQmlBinding(const QString &str, QObject *obj, QQmlContextData *ctxt)
QString code = rewriteBinding(str);
m_expression = str.toUtf8();
- v8function = evalFunction(ctxt, obj, code, QString(), 0);
+ v4function = evalFunction(ctxt, obj, code, QString(), 0)->v4Value();
}
QQmlBinding::QQmlBinding(const QString &str, bool isRewritten, QObject *obj,
m_expression = str.toUtf8();
- v8function = evalFunction(ctxt, obj, code, url, m_lineNumber);
+ v4function = evalFunction(ctxt, obj, code, url, m_lineNumber)->v4Value();
}
/*!
QQmlAbstractExpression::setContext(ctxt);
setScopeObject(obj);
- v8function = qPersistentNew<v8::Function>(*(v8::Handle<v8::Function> *)functionPtr);
+ v4function = (*(v8::Handle<v8::Function> *)functionPtr)->v4Value();
}
QQmlBinding::~QQmlBinding()
{
- qPersistentDispose(v8function);
}
void QQmlBinding::setEvaluateFlags(EvaluateFlags flags)
bool isUndefined = false;
v8::Local<v8::Value> result =
- QQmlJavaScriptExpression::evaluate(context(), v8function, &isUndefined);
+ QQmlJavaScriptExpression::evaluate(context(), **v4function, &isUndefined);
trace.event("writing binding result");
bool isUndefined = false;
v8::Local<v8::Value> result =
- QQmlJavaScriptExpression::evaluate(context(), v8function, &isUndefined);
+ QQmlJavaScriptExpression::evaluate(context(), **v4function, &isUndefined);
ep->dereferenceScarceResources();
#include <private/qqmltrace_p.h>
#include <private/qqmlprofilerservice_p.h>
+#include <private/qv4object_p.h>
+
QT_BEGIN_NAMESPACE
QQmlAbstractBinding::VTable QV8Bindings_Binding_vtable = {
void QV8Bindings::refresh()
{
- int count = functions()->Length();
+ QV4::ArrayObject *f = functions();
+ int count = f ? f->arrayLength() : 0;
for (int ii = 0; ii < count; ++ii)
bindings[ii].refresh();
}
DeleteWatcher watcher(this);
ep->referenceScarceResources();
- v8::Local<v8::Value> result =
+ QV4::ArrayObject *f = parent->functions();
+ v8::Local<v8::Value> result = f ?
evaluate(context,
- v8::Handle<v8::Function>::Cast(parent->functions()->Get(instruction->value)),
- &isUndefined);
+ f->getIndexed(f->internalClass->engine->current, instruction->value),
+ &isUndefined)
+ : v8::Local<v8::Value>::New(QV4::Value::undefinedValue());
trace.event("writing V8 result");
bool needsErrorLocationData = false;
{
QV8Engine *engine = QQmlEnginePrivate::getV8Engine(context->engine);
- if (program->bindings.IsEmpty()) {
+ if (program->bindings->isDeleted()) {
v8::Local<v8::Script> script;
bool compileFailed = false;
{
if (!message.IsEmpty())
QQmlExpressionPrivate::exceptionToError(message, error);
QQmlEnginePrivate::get(engine->engine())->warning(error);
- program->bindings = qPersistentNew(v8::Array::New());
+ program->bindings = QV4::Value::nullValue();
}
}
if (!compileFailed) {
v8::Local<v8::Value> result = script->Run(engine->contextWrapper()->sharedContext());
if (result->IsArray()) {
- program->bindings = qPersistentNew(v8::Local<v8::Array>::Cast(result));
+ program->bindings = result->v4Value();
program->program.clear(); // We don't need the source anymore
}
}
}
- int bindingsCount = functions()->Length();
+ QV4::ArrayObject *f = functions();
+ int bindingsCount = f ? f->arrayLength() : 0;
if (bindingsCount) bindings = new QV8Bindings::Binding[bindingsCount];
setContext(context);
return program->cdata->name;
}
-v8::Persistent<v8::Array> &QV8Bindings::functions() const
+QV4::ArrayObject *QV8Bindings::functions() const
{
- return program->bindings;
+ return program->bindings->asArrayObject();
}