aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/jsapi/qjsengine.cpp2
-rw-r--r--src/qml/jsapi/qjsvalue.cpp24
-rw-r--r--src/qml/jsapi/qjsvalueiterator.cpp6
-rw-r--r--src/qml/jsruntime/qv4argumentsobject.cpp4
-rw-r--r--src/qml/jsruntime/qv4arrayobject.cpp2
-rw-r--r--src/qml/jsruntime/qv4context.cpp55
-rw-r--r--src/qml/jsruntime/qv4context_p.h20
-rw-r--r--src/qml/jsruntime/qv4debugging.cpp18
-rw-r--r--src/qml/jsruntime/qv4engine.cpp30
-rw-r--r--src/qml/jsruntime/qv4engine_p.h9
-rw-r--r--src/qml/jsruntime/qv4errorobject.cpp6
-rw-r--r--src/qml/jsruntime/qv4functionobject.cpp46
-rw-r--r--src/qml/jsruntime/qv4functionobject_p.h2
-rw-r--r--src/qml/jsruntime/qv4globalobject.cpp2
-rw-r--r--src/qml/jsruntime/qv4include.cpp6
-rw-r--r--src/qml/jsruntime/qv4internalclass.cpp5
-rw-r--r--src/qml/jsruntime/qv4jsonobject.cpp2
-rw-r--r--src/qml/jsruntime/qv4lookup.cpp4
-rw-r--r--src/qml/jsruntime/qv4managed.cpp8
-rw-r--r--src/qml/jsruntime/qv4managed_p.h2
-rw-r--r--src/qml/jsruntime/qv4object.cpp22
-rw-r--r--src/qml/jsruntime/qv4objectproto.cpp4
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp18
-rw-r--r--src/qml/jsruntime/qv4regexpobject.cpp2
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp4
-rw-r--r--src/qml/jsruntime/qv4scopedvalue_p.h4
-rw-r--r--src/qml/jsruntime/qv4script.cpp8
-rw-r--r--src/qml/jsruntime/qv4sequenceobject.cpp6
-rw-r--r--src/qml/jsruntime/qv4serialize.cpp2
-rw-r--r--src/qml/jsruntime/qv4stringobject.cpp10
-rw-r--r--src/qml/jsruntime/qv4value.cpp6
-rw-r--r--src/qml/qml/qqmlcomponent.cpp2
-rw-r--r--src/qml/qml/qqmlcontextwrapper.cpp18
-rw-r--r--src/qml/qml/qqmljavascriptexpression.cpp6
-rw-r--r--src/qml/qml/qqmllistwrapper.cpp4
-rw-r--r--src/qml/qml/qqmltypeloader.cpp2
-rw-r--r--src/qml/qml/qqmltypewrapper.cpp14
-rw-r--r--src/qml/qml/qqmlvaluetypewrapper.cpp10
-rw-r--r--src/qml/qml/qqmlvmemetaobject.cpp2
-rw-r--r--src/qml/qml/qqmlxmlhttprequest.cpp16
-rw-r--r--src/qml/qml/v8/qv8engine.cpp6
-rw-r--r--src/qml/types/qqmldelegatemodel.cpp8
-rw-r--r--src/qml/types/qquickworkerscript.cpp6
43 files changed, 214 insertions, 219 deletions
diff --git a/src/qml/jsapi/qjsengine.cpp b/src/qml/jsapi/qjsengine.cpp
index cb050c2518..a19c358231 100644
--- a/src/qml/jsapi/qjsengine.cpp
+++ b/src/qml/jsapi/qjsengine.cpp
@@ -261,7 +261,7 @@ void QJSEngine::collectGarbage()
QJSValue QJSEngine::evaluate(const QString& program, const QString& fileName, int lineNumber)
{
QV4::Scope scope(d->m_v4Engine);
- QV4::ExecutionContext *ctx = d->m_v4Engine->current;
+ QV4::ExecutionContext *ctx = d->m_v4Engine->currentContext();
QV4::ScopedValue result(scope);
QV4::Script script(ctx, program, fileName, lineNumber);
diff --git a/src/qml/jsapi/qjsvalue.cpp b/src/qml/jsapi/qjsvalue.cpp
index f0e92ebd4d..d7a1cef3ba 100644
--- a/src/qml/jsapi/qjsvalue.cpp
+++ b/src/qml/jsapi/qjsvalue.cpp
@@ -383,7 +383,7 @@ double QJSValue::toNumber() const
if (d->value.isEmpty())
return __qmljs_string_to_number(d->string);
- QV4::ExecutionContext *ctx = d->engine ? d->engine->current : 0;
+ QV4::ExecutionContext *ctx = d->engine ? d->engine->currentContext() : 0;
double dbl = d->value.toNumber();
if (ctx && ctx->engine->hasException) {
ctx->catchException();
@@ -409,7 +409,7 @@ bool QJSValue::toBool() const
if (d->value.isEmpty())
return d->string.length() > 0;
- QV4::ExecutionContext *ctx = d->engine ? d->engine->current : 0;
+ QV4::ExecutionContext *ctx = d->engine ? d->engine->currentContext() : 0;
bool b = d->value.toBoolean();
if (ctx && ctx->engine->hasException) {
ctx->catchException();
@@ -435,7 +435,7 @@ qint32 QJSValue::toInt() const
if (d->value.isEmpty())
return QV4::Primitive::toInt32(__qmljs_string_to_number(d->string));
- QV4::ExecutionContext *ctx = d->engine ? d->engine->current : 0;
+ QV4::ExecutionContext *ctx = d->engine ? d->engine->currentContext() : 0;
qint32 i = d->value.toInt32();
if (ctx && ctx->engine->hasException) {
ctx->catchException();
@@ -461,7 +461,7 @@ quint32 QJSValue::toUInt() const
if (d->value.isEmpty())
return QV4::Primitive::toUInt32(__qmljs_string_to_number(d->string));
- QV4::ExecutionContext *ctx = d->engine ? d->engine->current : 0;
+ QV4::ExecutionContext *ctx = d->engine ? d->engine->currentContext() : 0;
quint32 u = d->value.toUInt32();
if (ctx && ctx->engine->hasException) {
ctx->catchException();
@@ -536,7 +536,7 @@ QJSValue QJSValue::call(const QJSValueList &args)
}
ScopedValue result(scope);
- QV4::ExecutionContext *ctx = engine->current;
+ QV4::ExecutionContext *ctx = engine->currentContext();
result = f->call(callData);
if (scope.hasException())
result = ctx->catchException();
@@ -590,7 +590,7 @@ QJSValue QJSValue::callWithInstance(const QJSValue &instance, const QJSValueList
}
ScopedValue result(scope);
- QV4::ExecutionContext *ctx = engine->current;
+ QV4::ExecutionContext *ctx = engine->currentContext();
result = f->call(callData);
if (scope.hasException())
result = ctx->catchException();
@@ -636,7 +636,7 @@ QJSValue QJSValue::callAsConstructor(const QJSValueList &args)
}
ScopedValue result(scope);
- QV4::ExecutionContext *ctx = engine->current;
+ QV4::ExecutionContext *ctx = engine->currentContext();
result = f->construct(callData);
if (scope.hasException())
result = ctx->catchException();
@@ -859,7 +859,7 @@ QJSValue QJSValue::property(const QString& name) const
return property(idx);
s->makeIdentifier();
- QV4::ExecutionContext *ctx = engine->current;
+ QV4::ExecutionContext *ctx = engine->currentContext();
QV4::ScopedValue result(scope);
result = o->get(s);
if (scope.hasException())
@@ -891,7 +891,7 @@ QJSValue QJSValue::property(quint32 arrayIndex) const
if (!o)
return QJSValue();
- QV4::ExecutionContext *ctx = engine->current;
+ QV4::ExecutionContext *ctx = engine->currentContext();
QV4::ScopedValue result(scope);
result = arrayIndex == UINT_MAX ? o->get(engine->id_uintMax) : o->getIndexed(arrayIndex);
if (scope.hasException())
@@ -933,7 +933,7 @@ void QJSValue::setProperty(const QString& name, const QJSValue& value)
return;
}
- QV4::ExecutionContext *ctx = engine->current;
+ QV4::ExecutionContext *ctx = engine->currentContext();
s->makeIdentifier();
QV4::ScopedValue v(scope, value.d->getValue(engine));
o->put(s, v);
@@ -964,7 +964,7 @@ void QJSValue::setProperty(quint32 arrayIndex, const QJSValue& value)
if (!o)
return;
- QV4::ExecutionContext *ctx = engine->current;
+ QV4::ExecutionContext *ctx = engine->currentContext();
QV4::ScopedValue v(scope, value.d->getValue(engine));
if (arrayIndex != UINT_MAX)
o->putIndexed(arrayIndex, v);
@@ -997,7 +997,7 @@ void QJSValue::setProperty(quint32 arrayIndex, const QJSValue& value)
bool QJSValue::deleteProperty(const QString &name)
{
ExecutionEngine *engine = d->engine;
- ExecutionContext *ctx = engine->current;
+ ExecutionContext *ctx = engine->currentContext();
Scope scope(engine);
ScopedObject o(scope, d->value.asObject());
if (!o)
diff --git a/src/qml/jsapi/qjsvalueiterator.cpp b/src/qml/jsapi/qjsvalueiterator.cpp
index 245b75b384..ed011ef691 100644
--- a/src/qml/jsapi/qjsvalueiterator.cpp
+++ b/src/qml/jsapi/qjsvalueiterator.cpp
@@ -59,7 +59,7 @@ QJSValueIteratorPrivate::QJSValueIteratorPrivate(const QJSValue &v)
QV4::Scope scope(e);
QV4::ScopedObject o(scope, jsp->value);
- iterator = e->newForEachIteratorObject(e->current, o)->asReturnedValue();
+ iterator = e->newForEachIteratorObject(e->currentContext(), o)->asReturnedValue();
currentName = (QV4::String *)0;
nextName = (QV4::String *)0;
@@ -198,7 +198,7 @@ QJSValue QJSValueIterator::value() const
QV4::Scoped<QV4::ForEachIteratorObject> it(scope, d_ptr->iterator.value());
QV4::ScopedObject o(scope, it->it.object);
- QV4::ExecutionContext *ctx = engine->current;
+ QV4::ExecutionContext *ctx = engine->currentContext();
QV4::ScopedValue v(scope);
if (!!d_ptr->currentName) {
QV4::ScopedString n(scope, d_ptr->currentName);
@@ -237,7 +237,7 @@ QJSValueIterator& QJSValueIterator::operator=(QJSValue& object)
QJSValuePrivate *jsp = QJSValuePrivate::get(object);
QV4::Scope scope(v4);
QV4::ScopedObject o(scope, jsp->value);
- d_ptr->iterator = v4->newForEachIteratorObject(v4->current, o)->asReturnedValue();
+ d_ptr->iterator = v4->newForEachIteratorObject(v4->currentContext(), o)->asReturnedValue();
QV4::Scoped<QV4::ForEachIteratorObject> it(scope, d_ptr->iterator.value());
it->it.flags = QV4::ObjectIterator::NoFlags;
it->it.next(d_ptr->nextName, &d_ptr->nextIndex, &d_ptr->nextAttributes);
diff --git a/src/qml/jsruntime/qv4argumentsobject.cpp b/src/qml/jsruntime/qv4argumentsobject.cpp
index 3ec11cce49..629c255b48 100644
--- a/src/qml/jsruntime/qv4argumentsobject.cpp
+++ b/src/qml/jsruntime/qv4argumentsobject.cpp
@@ -215,7 +215,7 @@ ReturnedValue ArgumentsGetterFunction::call(Managed *getter, CallData *callData)
Scoped<ArgumentsGetterFunction> g(scope, static_cast<ArgumentsGetterFunction *>(getter));
Scoped<ArgumentsObject> o(scope, callData->thisObject.as<ArgumentsObject>());
if (!o)
- return v4->current->throwTypeError();
+ return v4->currentContext()->throwTypeError();
Q_ASSERT(g->index < static_cast<unsigned>(o->context->callData->argc));
return o->context->argument(g->index);
@@ -230,7 +230,7 @@ ReturnedValue ArgumentsSetterFunction::call(Managed *setter, CallData *callData)
Scoped<ArgumentsSetterFunction> s(scope, static_cast<ArgumentsSetterFunction *>(setter));
Scoped<ArgumentsObject> o(scope, callData->thisObject.as<ArgumentsObject>());
if (!o)
- return v4->current->throwTypeError();
+ return v4->currentContext()->throwTypeError();
Q_ASSERT(s->index < static_cast<unsigned>(o->context->callData->argc));
o->context->callData->args[s->index] = callData->argc ? callData->args[0].asReturnedValue() : Encode::undefined();
diff --git a/src/qml/jsruntime/qv4arrayobject.cpp b/src/qml/jsruntime/qv4arrayobject.cpp
index 39b9b9eb60..a8bc774e29 100644
--- a/src/qml/jsruntime/qv4arrayobject.cpp
+++ b/src/qml/jsruntime/qv4arrayobject.cpp
@@ -65,7 +65,7 @@ ReturnedValue ArrayCtor::construct(Managed *m, CallData *callData)
len = callData->args[0].asArrayLength(&ok);
if (!ok)
- return v4->current->throwRangeError(callData->args[0]);
+ return v4->currentContext()->throwRangeError(callData->args[0]);
if (len < 0x1000)
a->arrayReserve(len);
diff --git a/src/qml/jsruntime/qv4context.cpp b/src/qml/jsruntime/qv4context.cpp
index f9b63ac12a..05a0e66e09 100644
--- a/src/qml/jsruntime/qv4context.cpp
+++ b/src/qml/jsruntime/qv4context.cpp
@@ -76,9 +76,7 @@ const ManagedVTable ExecutionContext::static_vtbl =
CallContext *ExecutionContext::newCallContext(FunctionObject *function, CallData *callData)
{
CallContext *c = static_cast<CallContext *>(engine->memoryManager->allocManaged(requiredMemoryForExecutionContect(function, callData->argc)));
- new (c) CallContext(engine, this, Type_CallContext);
-
- engine->current = c;
+ new (c) CallContext(engine, Type_CallContext);
c->function = function;
c->realArgumentCount = callData->argc;
@@ -112,22 +110,20 @@ CallContext *ExecutionContext::newCallContext(FunctionObject *function, CallData
WithContext *ExecutionContext::newWithContext(ObjectRef with)
{
- WithContext *w = new (engine->memoryManager) WithContext(this, with);
- engine->current = w;
+ WithContext *w = new (engine->memoryManager) WithContext(engine, with);
return w;
}
CatchContext *ExecutionContext::newCatchContext(const StringRef exceptionVarName, const ValueRef exceptionValue)
{
- CatchContext *c = new (engine->memoryManager) CatchContext(this, exceptionVarName, exceptionValue);
- engine->current = c;
+ CatchContext *c = new (engine->memoryManager) CatchContext(engine, exceptionVarName, exceptionValue);
return c;
}
CallContext *ExecutionContext::newQmlContext(FunctionObject *f, ObjectRef qml)
{
CallContext *c = static_cast<CallContext *>(engine->memoryManager->allocManaged(requiredMemoryForExecutionContect(f, 0)));
- new (c) CallContext(this, qml, f);
+ new (c) CallContext(engine, qml, f);
return c;
}
@@ -192,45 +188,38 @@ unsigned int ExecutionContext::variableCount() const
}
-GlobalContext::GlobalContext(ExecutionEngine *eng, ExecutionContext *parent)
- : ExecutionContext(eng, Type_GlobalContext, parent)
+GlobalContext::GlobalContext(ExecutionEngine *eng)
+ : ExecutionContext(eng, Type_GlobalContext)
{
- if (!parent) {
- callData = reinterpret_cast<CallData *>(this + 1);
- callData->tag = QV4::Value::_Integer_Type;
- callData->argc = 0;
- callData->thisObject = eng->globalObject;
- callData->args[0] = Encode::undefined();
- }
- global = 0;
+ global = eng->globalObject;
}
-WithContext::WithContext(ExecutionContext *p, ObjectRef with)
- : ExecutionContext(p->engine, Type_WithContext, p)
+WithContext::WithContext(ExecutionEngine *engine, ObjectRef with)
+ : ExecutionContext(engine, Type_WithContext)
{
- callData = p->callData;
- outer = p;
- lookups = p->lookups;
- compilationUnit = p->compilationUnit;
+ callData = parent->callData;
+ outer = parent;
+ lookups = parent->lookups;
+ compilationUnit = parent->compilationUnit;
withObject = with.getPointer();
}
-CatchContext::CatchContext(ExecutionContext *p, const StringRef exceptionVarName, const ValueRef exceptionValue)
- : ExecutionContext(p->engine, Type_CatchContext, p)
+CatchContext::CatchContext(ExecutionEngine *engine, const StringRef exceptionVarName, const ValueRef exceptionValue)
+ : ExecutionContext(engine, Type_CatchContext)
{
- strictMode = p->strictMode;
- callData = p->callData;
- outer = p;
- lookups = p->lookups;
- compilationUnit = p->compilationUnit;
+ strictMode = parent->strictMode;
+ callData = parent->callData;
+ outer = parent;
+ lookups = parent->lookups;
+ compilationUnit = parent->compilationUnit;
this->exceptionVarName = exceptionVarName;
this->exceptionValue = exceptionValue;
}
-CallContext::CallContext(ExecutionContext *parentContext, ObjectRef qml, FunctionObject *function)
- : ExecutionContext(parentContext->engine, Type_QmlContext, parentContext)
+CallContext::CallContext(ExecutionEngine *engine, ObjectRef qml, FunctionObject *function)
+ : ExecutionContext(engine, Type_QmlContext)
{
this->function = function;
callData = reinterpret_cast<CallData *>(this + 1);
diff --git a/src/qml/jsruntime/qv4context_p.h b/src/qml/jsruntime/qv4context_p.h
index f2650b20cf..4eb89ad905 100644
--- a/src/qml/jsruntime/qv4context_p.h
+++ b/src/qml/jsruntime/qv4context_p.h
@@ -80,19 +80,20 @@ struct Q_QML_EXPORT ExecutionContext : public Managed
Type_QmlContext = 0x6
};
- ExecutionContext(ExecutionEngine *engine, ContextType t, ExecutionContext *parent)
+ ExecutionContext(ExecutionEngine *engine, ContextType t)
: Managed(engine->executionContextClass)
{
this->type = t;
strictMode = false;
this->engine = engine;
- this->parent = parent;
+ this->parent = engine->currentContext();
outer = 0;
lookups = 0;
compilationUnit = 0;
currentEvalCode = 0;
interpreterInstructionPointer = 0;
lineNumber = -1;
+ engine->current = this;
}
ContextType type;
@@ -159,36 +160,34 @@ struct Q_QML_EXPORT ExecutionContext : public Managed
struct CallContext : public ExecutionContext
{
- CallContext(ExecutionEngine *engine, ExecutionContext *parent, ContextType t = Type_SimpleCallContext)
- : ExecutionContext(engine, t, parent)
+ CallContext(ExecutionEngine *engine, ContextType t = Type_SimpleCallContext)
+ : ExecutionContext(engine, t)
{
function = 0;
locals = 0;
activation = 0;
}
- CallContext(ExecutionContext *parentContext, ObjectRef qml, QV4::FunctionObject *function);
+ CallContext(ExecutionEngine *engine, ObjectRef qml, QV4::FunctionObject *function);
FunctionObject *function;
int realArgumentCount;
SafeValue *locals;
Object *activation;
- void initQmlContext(ExecutionContext *parentContext, ObjectRef qml, QV4::FunctionObject *function);
-
inline ReturnedValue argument(int i);
bool needsOwnArguments() const;
};
struct GlobalContext : public ExecutionContext
{
- GlobalContext(ExecutionEngine *engine, ExecutionContext *parent = 0);
+ GlobalContext(ExecutionEngine *engine);
Object *global;
};
struct CatchContext : public ExecutionContext
{
- CatchContext(ExecutionContext *p, const StringRef exceptionVarName, const ValueRef exceptionValue);
+ CatchContext(ExecutionEngine *engine, const StringRef exceptionVarName, const ValueRef exceptionValue);
SafeString exceptionVarName;
SafeValue exceptionValue;
@@ -196,7 +195,7 @@ struct CatchContext : public ExecutionContext
struct WithContext : public ExecutionContext
{
- WithContext(ExecutionContext *p, ObjectRef with);
+ WithContext(ExecutionEngine *engine, ObjectRef with);
Object *withObject;
};
@@ -220,6 +219,7 @@ inline void ExecutionEngine::pushContext(CallContext *context)
inline ExecutionContext *ExecutionEngine::popContext()
{
+ Q_ASSERT(current->parent);
current = current->parent;
return current;
}
diff --git a/src/qml/jsruntime/qv4debugging.cpp b/src/qml/jsruntime/qv4debugging.cpp
index e14ea252fb..4170b6817f 100644
--- a/src/qml/jsruntime/qv4debugging.cpp
+++ b/src/qml/jsruntime/qv4debugging.cpp
@@ -185,7 +185,7 @@ void Debugger::resume(Speed speed)
if (speed == StepOver)
setTemporaryBreakPointOnNextLine();
if (speed == StepOut)
- m_temporaryBreakPoints = TemporaryBreakPoint(getFunction(), m_engine->current);
+ m_temporaryBreakPoints = TemporaryBreakPoint(getFunction(), m_engine->currentContext());
m_stepping = speed;
m_runningCondition.wakeAll();
@@ -293,7 +293,7 @@ void Debugger::collectArgumentsInContext(Collector *collector, int frameNr, int
if (frameNr < 0)
return;
- CallContext *ctxt = findScope(findContext(engine->current, frameNr), scopeNr);
+ CallContext *ctxt = findScope(findContext(engine->currentContext(), frameNr), scopeNr);
if (!ctxt)
return;
@@ -340,7 +340,7 @@ void Debugger::collectLocalsInContext(Collector *collector, int frameNr, int sco
if (frameNr < 0)
return;
- CallContext *ctxt = findScope(findContext(engine->current, frameNr), scopeNr);
+ CallContext *ctxt = findScope(findContext(engine->currentContext(), frameNr), scopeNr);
if (!ctxt)
return;
@@ -387,7 +387,7 @@ bool Debugger::collectThisInContext(Debugger::Collector *collector, int frame)
bool myRun()
{
- ExecutionContext *ctxt = findContext(engine->current, frameNr);
+ ExecutionContext *ctxt = findContext(engine->currentContext(), frameNr);
while (ctxt) {
if (CallContext *cCtxt = ctxt->asCallContext())
if (cCtxt->activation)
@@ -456,7 +456,7 @@ QVector<ExecutionContext::ContextType> Debugger::getScopeTypes(int frame) const
if (state() != Paused)
return types;
- CallContext *sctxt = findContext(m_engine->current, frame);
+ CallContext *sctxt = findContext(m_engine->currentContext(), frame);
if (!sctxt || sctxt->type < ExecutionContext::Type_SimpleCallContext)
return types;
CallContext *ctxt = static_cast<CallContext *>(sctxt);
@@ -500,7 +500,7 @@ void Debugger::maybeBreakAtInstruction(const uchar *code, bool breakPointHit)
m_pauseRequested = false;
pauseAndWait(PauseRequest);
} else if (breakPointHit) {
- if (m_stepping == StepOver && m_temporaryBreakPoints.context == m_engine->current)
+ if (m_stepping == StepOver && m_temporaryBreakPoints.context == m_engine->currentContext())
pauseAndWait(Step);
else if (reallyHitTheBreakPoint(state.fileName, state.lineNumber))
pauseAndWait(BreakPoint);
@@ -528,7 +528,7 @@ void Debugger::leavingFunction(const ReturnedValue &retVal)
QMutexLocker locker(&m_lock);
if ((m_stepping == StepOut || m_stepping == StepOver)
- && temporaryBreakPointInFunction(m_engine->current)) {
+ && temporaryBreakPointInFunction(m_engine->currentContext())) {
clearTemporaryBreakPoints();
m_stepping = NotStepping;
m_stopForStepping = true;
@@ -552,7 +552,7 @@ void Debugger::aboutToThrow()
Function *Debugger::getFunction() const
{
- ExecutionContext *context = m_engine->current;
+ ExecutionContext *context = m_engine->currentContext();
if (CallContext *callCtx = context->asCallContext())
return callCtx->function->function;
else {
@@ -595,7 +595,7 @@ void Debugger::setTemporaryBreakPointOnNextLine()
if (pcs.isEmpty())
return;
- m_temporaryBreakPoints = TemporaryBreakPoint(function, m_engine->current);
+ m_temporaryBreakPoints = TemporaryBreakPoint(function, m_engine->currentContext());
m_temporaryBreakPoints.codeOffsets.reserve(pcs.size());
for (QList<qptrdiff>::const_iterator i = pcs.begin(), ei = pcs.end(); i != ei; ++i) {
// note: we do set a breakpoint on the current line, because there could be a loop where
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index b3d3214732..dc8c0da321 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -136,6 +136,7 @@ ExecutionEngine::ExecutionEngine(QQmlJS::EvalISelFactory *factory)
: memoryManager(new QV4::MemoryManager)
, executableAllocator(new QV4::ExecutableAllocator)
, regExpAllocator(new QV4::ExecutableAllocator)
+ , current(0)
, bumperPointerAllocator(new WTF::BumpPointerAllocator)
, jsStack(new WTF::PageAllocation)
, debugger(0)
@@ -405,8 +406,11 @@ void ExecutionEngine::initRootContext()
{
rootContext = static_cast<GlobalContext *>(memoryManager->allocManaged(sizeof(GlobalContext) + sizeof(CallData)));
new (rootContext) GlobalContext(this);
- current = rootContext;
- current->parent = 0;
+ rootContext->callData = reinterpret_cast<CallData *>(rootContext + 1);
+ rootContext->callData->tag = QV4::Value::_Integer_Type;
+ rootContext->callData->argc = 0;
+ rootContext->callData->thisObject = globalObject;
+ rootContext->callData->args[0] = Encode::undefined();
}
InternalClass *ExecutionEngine::newClass(const InternalClass &other)
@@ -416,13 +420,11 @@ InternalClass *ExecutionEngine::newClass(const InternalClass &other)
ExecutionContext *ExecutionEngine::pushGlobalContext()
{
- GlobalContext *g = new (memoryManager) GlobalContext(this, current);
- ExecutionContext *oldNext = g->next;
- memcpy(g, rootContext, sizeof(GlobalContext));
- g->next = oldNext;
- current = g;
+ GlobalContext *g = new (memoryManager) GlobalContext(this);
+ g->callData = rootContext->callData;
- return current;
+ Q_ASSERT(currentContext() == g);
+ return g;
}
Returned<FunctionObject> *ExecutionEngine::newBuiltinFunction(ExecutionContext *scope, const StringRef name, ReturnedValue (*code)(CallContext *))
@@ -610,7 +612,7 @@ Returned<Object> *ExecutionEngine::newForEachIteratorObject(ExecutionContext *ct
Returned<Object> *ExecutionEngine::qmlContextObject() const
{
- ExecutionContext *ctx = current;
+ ExecutionContext *ctx = currentContext();
if (ctx->type == QV4::ExecutionContext::Type_SimpleCallContext && !ctx->outer)
ctx = ctx->parent;
@@ -656,7 +658,7 @@ QVector<StackFrame> ExecutionEngine::stackTrace(int frameLimit) const
QVector<StackFrame> stack;
- QV4::ExecutionContext *c = current;
+ QV4::ExecutionContext *c = currentContext();
while (c && frameLimit) {
CallContext *callCtx = c->asCallContext();
if (callCtx && callCtx->function) {
@@ -710,7 +712,7 @@ QUrl ExecutionEngine::resolvedUrl(const QString &file)
return src;
QUrl base;
- QV4::ExecutionContext *c = current;
+ QV4::ExecutionContext *c = currentContext();
while (c) {
CallContext *callCtx = c->asCallContext();
if (callCtx && callCtx->function) {
@@ -766,7 +768,7 @@ void ExecutionEngine::markObjects()
setter->mark(this);
}
- ExecutionContext *c = current;
+ ExecutionContext *c = currentContext();
while (c) {
c->mark(this);
c = c->parent;
@@ -902,8 +904,8 @@ ReturnedValue ExecutionEngine::throwException(const ValueRef value)
ReturnedValue ExecutionEngine::catchException(ExecutionContext *catchingContext, StackTrace *trace)
{
Q_ASSERT(hasException);
- while (current != catchingContext)
- popContext();
+ Q_UNUSED(catchingContext);
+ Q_ASSERT(currentContext() == catchingContext);
if (trace)
*trace = exceptionStackTrace;
exceptionStackTrace.clear();
diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h
index 67a70772ee..ecb5f2b4d5 100644
--- a/src/qml/jsruntime/qv4engine_p.h
+++ b/src/qml/jsruntime/qv4engine_p.h
@@ -111,11 +111,12 @@ class RegExp;
class RegExpCache;
struct QmlExtensions;
struct Exception;
+struct ExecutionContextSaver;
#define CHECK_STACK_LIMITS(v4) \
if ((v4->jsStackTop <= v4->jsStackLimit) && (reinterpret_cast<quintptr>(&v4) >= v4->cStackLimit || v4->recheckCStackLimits())) {} \
else \
- return v4->current->throwRangeError(QStringLiteral("Maximum call stack size exceeded."))
+ return v4->currentContext()->throwRangeError(QStringLiteral("Maximum call stack size exceeded."))
struct Q_QML_EXPORT ExecutionEngine
@@ -125,7 +126,13 @@ struct Q_QML_EXPORT ExecutionEngine
ExecutableAllocator *regExpAllocator;
QScopedPointer<QQmlJS::EvalISelFactory> iselFactory;
+private:
+ friend struct ExecutionContextSaver;
+ friend struct ExecutionContext;
ExecutionContext *current;
+public:
+ ExecutionContext *currentContext() const { return current; }
+
GlobalContext *rootContext;
SafeValue *jsStackTop;
diff --git a/src/qml/jsruntime/qv4errorobject.cpp b/src/qml/jsruntime/qv4errorobject.cpp
index d5b4975b72..cf5c06dd41 100644
--- a/src/qml/jsruntime/qv4errorobject.cpp
+++ b/src/qml/jsruntime/qv4errorobject.cpp
@@ -77,7 +77,6 @@ ErrorObject::ErrorObject(InternalClass *ic)
, stack(0)
{
type = Type_ErrorObject;
- setVTable(&static_vtbl);
Scope scope(engine());
ScopedValue protectThis(scope, this);
@@ -91,7 +90,6 @@ ErrorObject::ErrorObject(InternalClass *ic, const ValueRef message, ErrorType t)
, stack(0)
{
type = Type_ErrorObject;
- setVTable(&static_vtbl);
subtype = t;
Scope scope(engine());
@@ -116,7 +114,6 @@ ErrorObject::ErrorObject(InternalClass *ic, const QString &message, ErrorObject:
, stack(0)
{
type = Type_ErrorObject;
- setVTable(&static_vtbl);
subtype = t;
Scope scope(engine());
@@ -141,7 +138,6 @@ ErrorObject::ErrorObject(InternalClass *ic, const QString &message, const QStrin
, stack(0)
{
type = Type_ErrorObject;
- setVTable(&static_vtbl);
subtype = t;
Scope scope(engine());
@@ -207,13 +203,11 @@ DEFINE_MANAGED_VTABLE(SyntaxErrorObject);
SyntaxErrorObject::SyntaxErrorObject(ExecutionEngine *engine, const ValueRef msg)
: ErrorObject(engine->syntaxErrorClass, msg, SyntaxError)
{
- setVTable(&static_vtbl);
}
SyntaxErrorObject::SyntaxErrorObject(ExecutionEngine *engine, const QString &msg, const QString &fileName, int lineNumber, int columnNumber)
: ErrorObject(engine->syntaxErrorClass, msg, fileName, lineNumber, columnNumber, SyntaxError)
{
- setVTable(&static_vtbl);
}
EvalErrorObject::EvalErrorObject(ExecutionEngine *engine, const ValueRef message)
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp
index b9318e73a1..6e5c137e0b 100644
--- a/src/qml/jsruntime/qv4functionobject.cpp
+++ b/src/qml/jsruntime/qv4functionobject.cpp
@@ -247,7 +247,7 @@ ReturnedValue FunctionCtor::construct(Managed *that, CallData *callData)
{
FunctionCtor *f = static_cast<FunctionCtor *>(that);
ExecutionEngine *v4 = f->internalClass->engine;
- ExecutionContext *ctx = v4->current;
+ ExecutionContext *ctx = v4->currentContext();
QString arguments;
QString body;
if (callData->argc > 0) {
@@ -271,16 +271,16 @@ ReturnedValue FunctionCtor::construct(Managed *that, CallData *callData)
const bool parsed = parser.parseExpression();
if (!parsed)
- return v4->current->throwSyntaxError(QLatin1String("Parse error"));
+ return v4->currentContext()->throwSyntaxError(QLatin1String("Parse error"));
using namespace QQmlJS::AST;
FunctionExpression *fe = QQmlJS::AST::cast<FunctionExpression *>(parser.rootNode());
if (!fe)
- return v4->current->throwSyntaxError(QLatin1String("Parse error"));
+ return v4->currentContext()->throwSyntaxError(QLatin1String("Parse error"));
QQmlJS::V4IR::Module module(v4->debugger != 0);
- QQmlJS::RuntimeCodegen cg(v4->current, f->strictMode);
+ QQmlJS::RuntimeCodegen cg(v4->currentContext(), f->strictMode);
cg.generateFromFunctionExpression(QString(), function, fe, &module);
QV4::Compiler::JSUnitGenerator jsGenerator(&module);
@@ -447,7 +447,7 @@ ReturnedValue ScriptFunction::construct(Managed *that, CallData *callData)
InternalClass *ic = f->internalClassForConstructor();
ScopedObject obj(scope, v4->newObject(ic));
- ExecutionContext *context = v4->current;
+ ExecutionContext *context = v4->currentContext();
callData->thisObject = obj.asReturnedValue();
ExecutionContext *ctx = context->newCallContext(f.getPointer(), callData);
@@ -469,7 +469,7 @@ ReturnedValue ScriptFunction::call(Managed *that, CallData *callData)
return Encode::undefined();
CHECK_STACK_LIMITS(v4);
- ExecutionContext *context = v4->current;
+ ExecutionContext *context = v4->currentContext();
Scope scope(context);
CallContext *ctx = context->newCallContext(f, callData);
@@ -529,9 +529,10 @@ ReturnedValue SimpleScriptFunction::construct(Managed *that, CallData *callData)
InternalClass *ic = f->internalClassForConstructor();
callData->thisObject = v4->newObject(ic);
- ExecutionContext *context = v4->current;
+ ExecutionContext *context = v4->currentContext();
+ ExecutionContextSaver ctxSaver(context);
- CallContext ctx(v4, context);
+ CallContext ctx(v4);
ctx.strictMode = f->strictMode;
ctx.callData = callData;
ctx.function = f.getPointer();
@@ -543,12 +544,11 @@ ReturnedValue SimpleScriptFunction::construct(Managed *that, CallData *callData)
callData->args[callData->argc] = Encode::undefined();
++callData->argc;
}
- v4->pushContext(&ctx);
+ Q_ASSERT(v4->currentContext() == &ctx);
if (f->function->compiledFunction->hasQmlDependencies())
QmlContextWrapper::registerQmlDependencies(v4, f->function->compiledFunction);
- ExecutionContextSaver ctxSaver(context);
Scoped<Object> result(scope, f->function->code(&ctx, f->function->codeData));
if (!result)
@@ -566,9 +566,10 @@ ReturnedValue SimpleScriptFunction::call(Managed *that, CallData *callData)
SimpleScriptFunction *f = static_cast<SimpleScriptFunction *>(that);
Scope scope(v4);
- ExecutionContext *context = v4->current;
+ ExecutionContext *context = v4->currentContext();
+ ExecutionContextSaver ctxSaver(context);
- CallContext ctx(v4, context);
+ CallContext ctx(v4);
ctx.strictMode = f->strictMode;
ctx.callData = callData;
ctx.function = f;
@@ -580,12 +581,11 @@ ReturnedValue SimpleScriptFunction::call(Managed *that, CallData *callData)
callData->args[callData->argc] = Encode::undefined();
++callData->argc;
}
- v4->current = &ctx;
+ Q_ASSERT(v4->currentContext() == &ctx);
if (f->function->compiledFunction->hasQmlDependencies())
QmlContextWrapper::registerQmlDependencies(v4, f->function->compiledFunction);
- ExecutionContextSaver ctxSaver(context);
return f->function->code(&ctx, f->function->codeData);
}
@@ -603,7 +603,7 @@ BuiltinFunction::BuiltinFunction(ExecutionContext *scope, const StringRef name,
ReturnedValue BuiltinFunction::construct(Managed *f, CallData *)
{
- return f->internalClass->engine->current->throwTypeError();
+ return f->internalClass->engine->currentContext()->throwTypeError();
}
ReturnedValue BuiltinFunction::call(Managed *that, CallData *callData)
@@ -614,14 +614,14 @@ ReturnedValue BuiltinFunction::call(Managed *that, CallData *callData)
return Encode::undefined();
CHECK_STACK_LIMITS(v4);
- ExecutionContext *context = v4->current;
+ ExecutionContext *context = v4->currentContext();
+ ExecutionContextSaver ctxSaver(context);
- CallContext ctx(v4, context);
+ CallContext ctx(v4);
ctx.strictMode = f->scope->strictMode; // ### needed? scope or parent context?
ctx.callData = callData;
- v4->pushContext(&ctx);
+ Q_ASSERT(v4->currentContext() == &ctx);
- ExecutionContextSaver ctxSaver(context);
return f->code(&ctx);
}
@@ -633,14 +633,14 @@ ReturnedValue IndexedBuiltinFunction::call(Managed *that, CallData *callData)
return Encode::undefined();
CHECK_STACK_LIMITS(v4);
- ExecutionContext *context = v4->current;
+ ExecutionContext *context = v4->currentContext();
+ ExecutionContextSaver ctxSaver(context);
- CallContext ctx(v4, context);
+ CallContext ctx(v4);
ctx.strictMode = f->scope->strictMode; // ### needed? scope or parent context?
ctx.callData = callData;
- v4->pushContext(&ctx);
+ Q_ASSERT(v4->currentContext() == &ctx);
- ExecutionContextSaver ctxSaver(context);
return f->code(&ctx, f->index);
}
diff --git a/src/qml/jsruntime/qv4functionobject_p.h b/src/qml/jsruntime/qv4functionobject_p.h
index e0ee720033..96534cb68c 100644
--- a/src/qml/jsruntime/qv4functionobject_p.h
+++ b/src/qml/jsruntime/qv4functionobject_p.h
@@ -202,7 +202,7 @@ struct IndexedBuiltinFunction: FunctionObject
static ReturnedValue construct(Managed *m, CallData *)
{
- return m->engine()->current->throwTypeError();
+ return m->engine()->currentContext()->throwTypeError();
}
static ReturnedValue call(Managed *that, CallData *callData);
diff --git a/src/qml/jsruntime/qv4globalobject.cpp b/src/qml/jsruntime/qv4globalobject.cpp
index d4c4dbfa31..fa8af8ed5d 100644
--- a/src/qml/jsruntime/qv4globalobject.cpp
+++ b/src/qml/jsruntime/qv4globalobject.cpp
@@ -380,7 +380,7 @@ ReturnedValue EvalFunction::evalCall(CallData *callData, bool directCall)
return Encode::undefined();
ExecutionEngine *v4 = engine();
- ExecutionContext *parentContext = v4->current;
+ ExecutionContext *parentContext = v4->currentContext();
ExecutionContextSaver ctxSaver(parentContext);
ExecutionContext *ctx = parentContext;
diff --git a/src/qml/jsruntime/qv4include.cpp b/src/qml/jsruntime/qv4include.cpp
index 8f2548064a..d0e0e9413b 100644
--- a/src/qml/jsruntime/qv4include.cpp
+++ b/src/qml/jsruntime/qv4include.cpp
@@ -108,7 +108,7 @@ void QV4Include::callback(const QV4::ValueRef callback, const QV4::ValueRef stat
if (!f)
return;
- QV4::ExecutionContext *ctx = v4->current;
+ QV4::ExecutionContext *ctx = v4->currentContext();
QV4::ScopedCallData callData(scope, 1);
callData->thisObject = v4->globalObject->asReturnedValue();
callData->args[0] = status;
@@ -153,7 +153,7 @@ void QV4Include::finished()
QV4::ScopedObject qmlglobal(scope, m_qmlglobal.value());
QV4::Script script(v4, qmlglobal, code, m_url.toString());
- QV4::ExecutionContext *ctx = v4->current;
+ QV4::ExecutionContext *ctx = v4->currentContext();
QV4::ScopedString status(scope, v4->newString(QStringLiteral("status")));
script.parse();
if (!scope.engine->hasException)
@@ -220,7 +220,7 @@ QV4::ReturnedValue QV4Include::method_include(QV4::CallContext *ctx)
QV4::Script script(v4, qmlcontextobject, code, url.toString());
- QV4::ExecutionContext *ctx = v4->current;
+ QV4::ExecutionContext *ctx = v4->currentContext();
script.parse();
if (!v4->hasException)
script.run();
diff --git a/src/qml/jsruntime/qv4internalclass.cpp b/src/qml/jsruntime/qv4internalclass.cpp
index 729ed12884..29ede3d104 100644
--- a/src/qml/jsruntime/qv4internalclass.cpp
+++ b/src/qml/jsruntime/qv4internalclass.cpp
@@ -297,7 +297,8 @@ void InternalClass::removeMember(Object *object, Identifier *id)
}
// create a new class and add it to the tree
- object->internalClass = engine->emptyClass->changePrototype(prototype);
+ object->internalClass = engine->emptyClass->changeVTable(vtable);
+ object->internalClass = object->internalClass->changePrototype(prototype);
for (uint i = 0; i < size; ++i) {
if (i == propIdx)
continue;
@@ -330,6 +331,7 @@ InternalClass *InternalClass::sealed()
return m_sealed;
m_sealed = engine->emptyClass;
+ m_sealed = m_sealed->changeVTable(vtable);
m_sealed = m_sealed->changePrototype(prototype);
for (uint i = 0; i < size; ++i) {
PropertyAttributes attrs = propertyData.at(i);
@@ -347,6 +349,7 @@ InternalClass *InternalClass::frozen()
return m_frozen;
m_frozen = engine->emptyClass;
+ m_frozen = m_frozen->changeVTable(vtable);
m_frozen = m_frozen->changePrototype(prototype);
for (uint i = 0; i < size; ++i) {
PropertyAttributes attrs = propertyData.at(i);
diff --git a/src/qml/jsruntime/qv4jsonobject.cpp b/src/qml/jsruntime/qv4jsonobject.cpp
index 458b46b36e..2383709b4f 100644
--- a/src/qml/jsruntime/qv4jsonobject.cpp
+++ b/src/qml/jsruntime/qv4jsonobject.cpp
@@ -960,7 +960,7 @@ ReturnedValue JsonObject::method_stringify(CallContext *ctx)
ReturnedValue JsonObject::fromJsonValue(ExecutionEngine *engine, const QJsonValue &value)
{
if (value.isString())
- return engine->current->engine->newString(value.toString())->asReturnedValue();
+ return engine->currentContext()->engine->newString(value.toString())->asReturnedValue();
else if (value.isDouble())
return Encode(value.toDouble());
else if (value.isBool())
diff --git a/src/qml/jsruntime/qv4lookup.cpp b/src/qml/jsruntime/qv4lookup.cpp
index 29926e929f..a870cdac61 100644
--- a/src/qml/jsruntime/qv4lookup.cpp
+++ b/src/qml/jsruntime/qv4lookup.cpp
@@ -87,7 +87,7 @@ ReturnedValue Lookup::getterGeneric(QV4::Lookup *l, const ValueRef object)
switch (object->type()) {
case Value::Undefined_Type:
case Value::Null_Type:
- return engine->current->throwTypeError();
+ return engine->currentContext()->throwTypeError();
case Value::Boolean_Type:
proto = engine->booleanClass->prototype;
break;
@@ -446,7 +446,7 @@ void Lookup::setterGeneric(Lookup *l, const ValueRef object, const ValueRef valu
Scope scope(l->name->engine());
ScopedObject o(scope, object);
if (!o) {
- o = __qmljs_convert_to_object(scope.engine->current, object);
+ o = __qmljs_convert_to_object(scope.engine->currentContext(), object);
if (!o) // type error
return;
ScopedString s(scope, l->name);
diff --git a/src/qml/jsruntime/qv4managed.cpp b/src/qml/jsruntime/qv4managed.cpp
index 9b52abb9ac..fef7489110 100644
--- a/src/qml/jsruntime/qv4managed.cpp
+++ b/src/qml/jsruntime/qv4managed.cpp
@@ -184,22 +184,22 @@ void Managed::setVTable(const ManagedVTable *vt)
ReturnedValue Managed::construct(Managed *m, CallData *)
{
- return m->engine()->current->throwTypeError();
+ return m->engine()->currentContext()->throwTypeError();
}
ReturnedValue Managed::call(Managed *m, CallData *)
{
- return m->engine()->current->throwTypeError();
+ return m->engine()->currentContext()->throwTypeError();
}
ReturnedValue Managed::getLookup(Managed *m, Lookup *)
{
- return m->engine()->current->throwTypeError();
+ return m->engine()->currentContext()->throwTypeError();
}
void Managed::setLookup(Managed *m, Lookup *, const ValueRef)
{
- m->engine()->current->throwTypeError();
+ m->engine()->currentContext()->throwTypeError();
}
bool Managed::isEqualTo(Managed *, Managed *)
diff --git a/src/qml/jsruntime/qv4managed_p.h b/src/qml/jsruntime/qv4managed_p.h
index 388c71df5f..cee0614bab 100644
--- a/src/qml/jsruntime/qv4managed_p.h
+++ b/src/qml/jsruntime/qv4managed_p.h
@@ -158,7 +158,7 @@ protected:
Managed(InternalClass *internal)
: _data(0), internalClass(internal)
{
- Q_ASSERT(internalClass->vtable);
+ Q_ASSERT(!internalClass || internalClass->vtable);
inUse = 1; extensible = 1;
}
diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp
index e2b3b6ef62..106525d412 100644
--- a/src/qml/jsruntime/qv4object.cpp
+++ b/src/qml/jsruntime/qv4object.cpp
@@ -168,8 +168,8 @@ void Object::putValue(Property *pd, PropertyAttributes attrs, const ValueRef val
return;
reject:
- if (engine()->current->strictMode)
- engine()->current->throwTypeError();
+ if (engine()->currentContext()->strictMode)
+ engine()->currentContext()->throwTypeError();
}
void Object::defineDefaultProperty(const StringRef name, ValueRef value)
@@ -720,7 +720,7 @@ void Object::internalPut(const StringRef name, const ValueRef value)
bool ok;
uint l = value->asArrayLength(&ok);
if (!ok) {
- engine()->current->throwRangeError(value);
+ engine()->currentContext()->throwRangeError(value);
return;
}
ok = setArrayLength(l);
@@ -768,11 +768,11 @@ void Object::internalPut(const StringRef name, const ValueRef value)
}
reject:
- if (engine()->current->strictMode) {
+ if (engine()->currentContext()->strictMode) {
QString message = QStringLiteral("Cannot assign to read-only property \"");
message += name->toQString();
message += QLatin1Char('\"');
- engine()->current->throwTypeError(message);
+ engine()->currentContext()->throwTypeError(message);
}
}
@@ -843,8 +843,8 @@ void Object::internalPutIndexed(uint index, const ValueRef value)
return;
reject:
- if (engine()->current->strictMode)
- engine()->current->throwTypeError();
+ if (engine()->currentContext()->strictMode)
+ engine()->currentContext()->throwTypeError();
}
// Section 8.12.7
@@ -866,8 +866,8 @@ bool Object::internalDeleteProperty(const StringRef name)
memmove(memberData + memberIdx, memberData + memberIdx + 1, (internalClass->size - memberIdx)*sizeof(Property));
return true;
}
- if (engine()->current->strictMode)
- engine()->current->throwTypeError();
+ if (engine()->currentContext()->strictMode)
+ engine()->currentContext()->throwTypeError();
return false;
}
@@ -896,8 +896,8 @@ bool Object::internalDeleteIndexedProperty(uint index)
return true;
}
- if (engine()->current->strictMode)
- engine()->current->throwTypeError();
+ if (engine()->currentContext()->strictMode)
+ engine()->currentContext()->throwTypeError();
return false;
}
diff --git a/src/qml/jsruntime/qv4objectproto.cpp b/src/qml/jsruntime/qv4objectproto.cpp
index a39b3d91e0..7ca790b970 100644
--- a/src/qml/jsruntime/qv4objectproto.cpp
+++ b/src/qml/jsruntime/qv4objectproto.cpp
@@ -92,14 +92,14 @@ ReturnedValue ObjectCtor::construct(Managed *that, CallData *callData)
obj->setPrototype(proto.getPointer());
return obj.asReturnedValue();
}
- return __qmljs_to_object(v4->current, ValueRef(&callData->args[0]));
+ return __qmljs_to_object(v4->currentContext(), ValueRef(&callData->args[0]));
}
ReturnedValue ObjectCtor::call(Managed *m, CallData *callData)
{
if (!callData->argc || callData->args[0].isUndefined() || callData->args[0].isNull())
return m->engine()->newObject()->asReturnedValue();
- return __qmljs_to_object(m->engine()->current, ValueRef(&callData->args[0]));
+ return __qmljs_to_object(m->engine()->currentContext(), ValueRef(&callData->args[0]));
}
void ObjectPrototype::init(ExecutionEngine *v4, ObjectRef ctor)
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
index 6696be94e3..61f92a0f5c 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -668,7 +668,7 @@ QV4::ReturnedValue QObjectWrapper::get(Managed *m, const StringRef name, bool *h
QObjectWrapper *that = static_cast<QObjectWrapper*>(m);
ExecutionEngine *v4 = m->engine();
QQmlContextData *qmlContext = QV4::QmlContextWrapper::callingContext(v4);
- return that->getQmlProperty(v4->current, qmlContext, name.getPointer(), IgnoreRevision, hasProperty, /*includeImports*/ true);
+ return that->getQmlProperty(v4->currentContext(), qmlContext, name.getPointer(), IgnoreRevision, hasProperty, /*includeImports*/ true);
}
void QObjectWrapper::put(Managed *m, const StringRef name, const ValueRef value)
@@ -680,10 +680,10 @@ void QObjectWrapper::put(Managed *m, const StringRef name, const ValueRef value)
return;
QQmlContextData *qmlContext = QV4::QmlContextWrapper::callingContext(v4);
- if (!setQmlProperty(v4->current, qmlContext, that->m_object, name.getPointer(), QV4::QObjectWrapper::IgnoreRevision, value)) {
+ if (!setQmlProperty(v4->currentContext(), qmlContext, that->m_object, name.getPointer(), QV4::QObjectWrapper::IgnoreRevision, value)) {
QString error = QLatin1String("Cannot assign to non-existent property \"") +
name->toQString() + QLatin1Char('\"');
- v4->current->throwError(error);
+ v4->currentContext()->throwError(error);
}
}
@@ -763,7 +763,7 @@ struct QObjectSlotDispatcher : public QtPrivate::QSlotObjectBase
Q_ASSERT(v4);
QV4::Scope scope(v4);
QV4::ScopedFunctionObject f(scope, This->function.value());
- QV4::ExecutionContext *ctx = v4->current;
+ QV4::ExecutionContext *ctx = v4->currentContext();
QV4::ScopedCallData callData(scope, argCount);
callData->thisObject = This->thisObject.isUndefined() ? v4->globalObject->asReturnedValue() : This->thisObject.value();
@@ -1337,7 +1337,7 @@ static QV4::ReturnedValue CallPrecise(QObject *object, const QQmlPropertyData &d
if (returnType == QMetaType::UnknownType) {
QString typeName = QString::fromLatin1(unknownTypeError);
QString error = QString::fromLatin1("Unknown method return type: %1").arg(typeName);
- return QV8Engine::getV4(engine)->current->throwError(error);
+ return QV8Engine::getV4(engine)->currentContext()->throwError(error);
}
if (data.hasArguments()) {
@@ -1351,12 +1351,12 @@ static QV4::ReturnedValue CallPrecise(QObject *object, const QQmlPropertyData &d
if (!args) {
QString typeName = QString::fromLatin1(unknownTypeError);
QString error = QString::fromLatin1("Unknown method parameter type: %1").arg(typeName);
- return QV8Engine::getV4(engine)->current->throwError(error);
+ return QV8Engine::getV4(engine)->currentContext()->throwError(error);
}
if (args[0] > callArgs->argc) {
QString error = QLatin1String("Insufficient arguments");
- return QV8Engine::getV4(engine)->current->throwError(error);
+ return QV8Engine::getV4(engine)->currentContext()->throwError(error);
}
return CallMethod(object, data.coreIndex, returnType, args[0], args + 1, engine, callArgs);
@@ -1455,7 +1455,7 @@ static QV4::ReturnedValue CallOverloaded(QObject *object, const QQmlPropertyData
candidate = RelatedMethod(object, candidate, dummy);
}
- return QV8Engine::getV4(engine)->current->throwError(error);
+ return QV8Engine::getV4(engine)->currentContext()->throwError(error);
}
}
@@ -1782,7 +1782,7 @@ ReturnedValue QObjectMethod::call(Managed *m, CallData *callData)
ReturnedValue QObjectMethod::callInternal(CallData *callData)
{
- ExecutionContext *context = engine()->current;
+ ExecutionContext *context = engine()->currentContext();
if (m_index == DestroyMethod)
return method_destroy(context, callData->args, callData->argc);
else if (m_index == ToStringMethod)
diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp
index 3b69c92c3e..468fb34d76 100644
--- a/src/qml/jsruntime/qv4regexpobject.cpp
+++ b/src/qml/jsruntime/qv4regexpobject.cpp
@@ -242,7 +242,7 @@ RegExpCtor::RegExpCtor(ExecutionContext *scope)
ReturnedValue RegExpCtor::construct(Managed *m, CallData *callData)
{
- ExecutionContext *ctx = m->engine()->current;
+ ExecutionContext *ctx = m->engine()->currentContext();
Scope scope(ctx);
ScopedValue r(scope, callData->argument(0));
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index 62923b90f9..011607f0ba 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -314,7 +314,7 @@ QV4::ReturnedValue __qmljs_instanceof(ExecutionContext *ctx, const ValueRef left
Scoped<Object> o(scope, f->protoProperty());
if (!o) {
- scope.engine->current->throwTypeError();
+ scope.engine->currentContext()->throwTypeError();
return Encode(false);
}
@@ -389,7 +389,7 @@ ReturnedValue __qmljs_object_default_value(Object *object, int typeHint)
if (typeHint == NUMBER_HINT)
qSwap(meth1, meth2);
- ExecutionContext *ctx = engine->current;
+ ExecutionContext *ctx = engine->currentContext();
Scope scope(ctx);
ScopedCallData callData(scope, 0);
callData->thisObject = object;
diff --git a/src/qml/jsruntime/qv4scopedvalue_p.h b/src/qml/jsruntime/qv4scopedvalue_p.h
index d56e705eb5..21f45745cb 100644
--- a/src/qml/jsruntime/qv4scopedvalue_p.h
+++ b/src/qml/jsruntime/qv4scopedvalue_p.h
@@ -231,7 +231,7 @@ struct Scoped
Scoped(const Scope &scope, const Value &v, _Convert)
{
ptr = scope.engine->jsStackTop++;
- ptr->val = value_convert<T>(scope.engine->current, v);
+ ptr->val = value_convert<T>(scope.engine->currentContext(), v);
#ifndef QT_NO_DEBUG
++scope.size;
#endif
@@ -278,7 +278,7 @@ struct Scoped
Scoped(const Scope &scope, const ReturnedValue &v, _Convert)
{
ptr = scope.engine->jsStackTop++;
- ptr->val = value_convert<T>(scope.engine->current, QV4::Value::fromReturnedValue(v));
+ ptr->val = value_convert<T>(scope.engine->currentContext(), QV4::Value::fromReturnedValue(v));
#ifndef QT_NO_DEBUG
++scope.size;
#endif
diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp
index c1f86f9c83..4fd0569627 100644
--- a/src/qml/jsruntime/qv4script.cpp
+++ b/src/qml/jsruntime/qv4script.cpp
@@ -77,7 +77,7 @@ QmlBindingWrapper::QmlBindingWrapper(ExecutionContext *scope, Function *f, Objec
defineReadonlyProperty(scope->engine->id_length, Primitive::fromInt32(1));
- qmlContext = scope->engine->current->newQmlContext(this, qml);
+ qmlContext = scope->engine->currentContext()->newQmlContext(this, qml);
scope->engine->popContext();
}
@@ -97,7 +97,7 @@ QmlBindingWrapper::QmlBindingWrapper(ExecutionContext *scope, ObjectRef qml)
defineReadonlyProperty(scope->engine->id_length, Primitive::fromInt32(1));
- qmlContext = scope->engine->current->newQmlContext(this, qml);
+ qmlContext = scope->engine->currentContext()->newQmlContext(this, qml);
scope->engine->popContext();
}
@@ -242,7 +242,7 @@ void Script::parse()
if (!vmFunction) {
// ### FIX file/line number
Scoped<Object> error(valueScope, v4->newSyntaxErrorObject(QStringLiteral("Syntax error")));
- v4->current->throwError(error);
+ v4->currentContext()->throwError(error);
}
}
@@ -377,7 +377,7 @@ QV4::ReturnedValue Script::evaluate(ExecutionEngine *engine, const QString &scr
QV4::Scope scope(engine);
QV4::Script qmlScript(engine, scopeObject, script, QString());
- QV4::ExecutionContext *ctx = engine->current;
+ QV4::ExecutionContext *ctx = engine->currentContext();
qmlScript.parse();
QV4::ScopedValue result(scope);
if (!scope.engine->hasException)
diff --git a/src/qml/jsruntime/qv4sequenceobject.cpp b/src/qml/jsruntime/qv4sequenceobject.cpp
index 13896320ed..8b0e31cb71 100644
--- a/src/qml/jsruntime/qv4sequenceobject.cpp
+++ b/src/qml/jsruntime/qv4sequenceobject.cpp
@@ -206,7 +206,7 @@ public:
{
/* Qt containers have int (rather than uint) allowable indexes. */
if (index > INT_MAX) {
- generateWarning(engine()->current, QLatin1String("Index out of range during indexed get"));
+ generateWarning(engine()->currentContext(), QLatin1String("Index out of range during indexed get"));
if (hasProperty)
*hasProperty = false;
return Encode::undefined();
@@ -237,7 +237,7 @@ public:
/* Qt containers have int (rather than uint) allowable indexes. */
if (index > INT_MAX) {
- generateWarning(engine()->current, QLatin1String("Index out of range during indexed set"));
+ generateWarning(engine()->currentContext(), QLatin1String("Index out of range during indexed set"));
return;
}
@@ -275,7 +275,7 @@ public:
{
/* Qt containers have int (rather than uint) allowable indexes. */
if (index > INT_MAX) {
- generateWarning(engine()->current, QLatin1String("Index out of range during indexed query"));
+ generateWarning(engine()->currentContext(), QLatin1String("Index out of range during indexed query"));
return QV4::Attr_Invalid;
}
if (m_isReference) {
diff --git a/src/qml/jsruntime/qv4serialize.cpp b/src/qml/jsruntime/qv4serialize.cpp
index 06a2603280..ee325db4c2 100644
--- a/src/qml/jsruntime/qv4serialize.cpp
+++ b/src/qml/jsruntime/qv4serialize.cpp
@@ -279,7 +279,7 @@ void Serialize::serialize(QByteArray &data, const QV4::ValueRef v, QV8Engine *en
s = properties->getIndexed(ii);
serialize(data, s, engine);
- QV4::ExecutionContext *ctx = v4->current;
+ QV4::ExecutionContext *ctx = v4->currentContext();
str = s;
val = o->get(str);
if (scope.hasException())
diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp
index 57c59fe9f6..d468fb6b83 100644
--- a/src/qml/jsruntime/qv4stringobject.cpp
+++ b/src/qml/jsruntime/qv4stringobject.cpp
@@ -125,13 +125,13 @@ bool StringObject::deleteIndexedProperty(Managed *m, uint index)
Scope scope(v4);
Scoped<StringObject> o(scope, m->asStringObject());
if (!o) {
- v4->current->throwTypeError();
+ v4->currentContext()->throwTypeError();
return false;
}
if (index < static_cast<uint>(o->value.stringValue()->toQString().length())) {
- if (v4->current->strictMode)
- v4->current->throwTypeError();
+ if (v4->currentContext()->strictMode)
+ v4->currentContext()->throwTypeError();
return false;
}
return true;
@@ -181,7 +181,7 @@ ReturnedValue StringCtor::construct(Managed *m, CallData *callData)
Scope scope(v4);
ScopedValue value(scope);
if (callData->argc)
- value = callData->args[0].toString(v4->current);
+ value = callData->args[0].toString(v4->currentContext());
else
value = v4->newString(QString());
return Encode(v4->newStringObject(value));
@@ -193,7 +193,7 @@ ReturnedValue StringCtor::call(Managed *m, CallData *callData)
Scope scope(v4);
ScopedValue value(scope);
if (callData->argc)
- value = callData->args[0].toString(v4->current);
+ value = callData->args[0].toString(v4->currentContext());
else
value = v4->newString(QString());
return value.asReturnedValue();
diff --git a/src/qml/jsruntime/qv4value.cpp b/src/qml/jsruntime/qv4value.cpp
index 4ae570c8dc..30f7e8cdb0 100644
--- a/src/qml/jsruntime/qv4value.cpp
+++ b/src/qml/jsruntime/qv4value.cpp
@@ -90,7 +90,7 @@ double Value::toNumberImpl() const
if (isString())
return __qmljs_string_to_number(stringValue()->toQString());
{
- ExecutionContext *ctx = objectValue()->internalClass->engine->current;
+ ExecutionContext *ctx = objectValue()->internalClass->engine->currentContext();
Scope scope(ctx);
ScopedValue prim(scope, __qmljs_to_primitive(ValueRef::fromRawValue(this), NUMBER_HINT));
return prim->toNumber();
@@ -121,7 +121,7 @@ QString Value::toQStringNoThrow() const
if (isString())
return stringValue()->toQString();
{
- ExecutionContext *ctx = objectValue()->internalClass->engine->current;
+ ExecutionContext *ctx = objectValue()->internalClass->engine->currentContext();
Scope scope(ctx);
ScopedValue ex(scope);
bool caughtException = false;
@@ -174,7 +174,7 @@ QString Value::toQString() const
if (isString())
return stringValue()->toQString();
{
- ExecutionContext *ctx = objectValue()->internalClass->engine->current;
+ ExecutionContext *ctx = objectValue()->internalClass->engine->currentContext();
Scope scope(ctx);
ScopedValue prim(scope, __qmljs_to_primitive(ValueRef::fromRawValue(this), STRING_HINT));
return prim->toQString();
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp
index ffdc808e32..4a71c1a7e0 100644
--- a/src/qml/qml/qqmlcomponent.cpp
+++ b/src/qml/qml/qqmlcomponent.cpp
@@ -1546,7 +1546,7 @@ void QmlIncubatorObject::statusChanged(QQmlIncubator::Status s)
QV4::ScopedFunctionObject f(scope, m_statusChanged);
if (f) {
- QV4::ExecutionContext *ctx = scope.engine->current;
+ QV4::ExecutionContext *ctx = scope.engine->currentContext();
QV4::ScopedCallData callData(scope, 1);
callData->thisObject = this;
callData->args[0] = QV4::Primitive::fromUInt32(s);
diff --git a/src/qml/qml/qqmlcontextwrapper.cpp b/src/qml/qml/qqmlcontextwrapper.cpp
index 2814b2bbcf..b3c2105e68 100644
--- a/src/qml/qml/qqmlcontextwrapper.cpp
+++ b/src/qml/qml/qqmlcontextwrapper.cpp
@@ -137,7 +137,7 @@ ReturnedValue QmlContextWrapper::get(Managed *m, const StringRef name, bool *has
QV4::Scope scope(v4);
QmlContextWrapper *resource = m->as<QmlContextWrapper>();
if (!resource)
- return v4->current->throwTypeError();
+ return v4->currentContext()->throwTypeError();
// In V8 the JS global object would come _before_ the QML global object,
// so simulate that here.
@@ -246,7 +246,7 @@ ReturnedValue QmlContextWrapper::get(Managed *m, const StringRef name, bool *has
// Search scope object
if (scopeObject) {
bool hasProp = false;
- QV4::ScopedValue result(scope, QV4::QObjectWrapper::getQmlProperty(v4->current, context, scopeObject,
+ QV4::ScopedValue result(scope, QV4::QObjectWrapper::getQmlProperty(v4->currentContext(), context, scopeObject,
name.getPointer(), QV4::QObjectWrapper::CheckRevision, &hasProp));
if (hasProp) {
if (hasProperty)
@@ -260,7 +260,7 @@ ReturnedValue QmlContextWrapper::get(Managed *m, const StringRef name, bool *has
// Search context object
if (context->contextObject) {
bool hasProp = false;
- result = QV4::QObjectWrapper::getQmlProperty(v4->current, context, context->contextObject, name.getPointer(), QV4::QObjectWrapper::CheckRevision, &hasProp);
+ result = QV4::QObjectWrapper::getQmlProperty(v4->currentContext(), context, context->contextObject, name.getPointer(), QV4::QObjectWrapper::CheckRevision, &hasProp);
if (hasProp) {
if (hasProperty)
*hasProperty = true;
@@ -284,7 +284,7 @@ void QmlContextWrapper::put(Managed *m, const StringRef name, const ValueRef val
return;
QV4::Scoped<QmlContextWrapper> wrapper(scope, m->as<QmlContextWrapper>());
if (!wrapper) {
- v4->current->throwTypeError();
+ v4->currentContext()->throwTypeError();
return;
}
@@ -292,8 +292,8 @@ void QmlContextWrapper::put(Managed *m, const StringRef name, const ValueRef val
if (wrapper && wrapper->readOnly) {
QString error = QLatin1String("Invalid write to global property \"") + name->toQString() +
QLatin1Char('"');
- Scoped<String> e(scope, v4->current->engine->newString(error));
- v4->current->throwError(e);
+ Scoped<String> e(scope, v4->currentContext()->engine->newString(error));
+ v4->currentContext()->throwError(e);
return;
}
@@ -327,13 +327,13 @@ void QmlContextWrapper::put(Managed *m, const StringRef name, const ValueRef val
// Search scope object
if (scopeObject &&
- QV4::QObjectWrapper::setQmlProperty(v4->current, context, scopeObject, name.getPointer(), QV4::QObjectWrapper::CheckRevision, value))
+ QV4::QObjectWrapper::setQmlProperty(v4->currentContext(), context, scopeObject, name.getPointer(), QV4::QObjectWrapper::CheckRevision, value))
return;
scopeObject = 0;
// Search context object
if (context->contextObject &&
- QV4::QObjectWrapper::setQmlProperty(v4->current, context, context->contextObject, name.getPointer(), QV4::QObjectWrapper::CheckRevision, value))
+ QV4::QObjectWrapper::setQmlProperty(v4->currentContext(), context, context->contextObject, name.getPointer(), QV4::QObjectWrapper::CheckRevision, value))
return;
context = context->parent;
@@ -344,7 +344,7 @@ void QmlContextWrapper::put(Managed *m, const StringRef name, const ValueRef val
if (wrapper->readOnly) {
QString error = QLatin1String("Invalid write to global property \"") + name->toQString() +
QLatin1Char('"');
- v4->current->throwError(error);
+ v4->currentContext()->throwError(error);
return;
}
diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp
index 3fd0003656..499ade1ca5 100644
--- a/src/qml/qml/qqmljavascriptexpression.cpp
+++ b/src/qml/qml/qqmljavascriptexpression.cpp
@@ -155,7 +155,7 @@ QV4::ReturnedValue QQmlJavaScriptExpression::evaluate(QQmlContextData *context,
QV4::ExecutionEngine *v4 = QV8Engine::getV4(ep->v8engine());
QV4::Scope scope(v4);
QV4::ScopedValue result(scope, QV4::Primitive::undefinedValue());
- QV4::ExecutionContext *ctx = v4->current;
+ QV4::ExecutionContext *ctx = v4->currentContext();
callData->thisObject = v4->globalObject;
if (scopeObject()) {
QV4::ScopedValue value(scope, QV4::QObjectWrapper::wrap(ctx->engine, scopeObject()));
@@ -294,7 +294,7 @@ QQmlJavaScriptExpression::evalFunction(QQmlContextData *ctxt, QObject *scopeObje
QQmlEnginePrivate *ep = QQmlEnginePrivate::get(engine);
QV4::ExecutionEngine *v4 = QV8Engine::getV4(ep->v8engine());
- QV4::ExecutionContext *ctx = v4->current;
+ QV4::ExecutionContext *ctx = v4->currentContext();
QV4::Scope scope(v4);
QV4::ScopedObject qmlScopeObject(scope, QV4::QmlContextWrapper::qmlScope(ep->v8engine(), ctxt, scopeObject));
@@ -328,7 +328,7 @@ QV4::ReturnedValue QQmlJavaScriptExpression::qmlBinding(QQmlContextData *ctxt, Q
QQmlEnginePrivate *ep = QQmlEnginePrivate::get(engine);
QV4::ExecutionEngine *v4 = QV8Engine::getV4(ep->v8engine());
- QV4::ExecutionContext *ctx = v4->current;
+ QV4::ExecutionContext *ctx = v4->currentContext();
QV4::Scope scope(v4);
QV4::ScopedObject qmlScopeObject(scope, QV4::QmlContextWrapper::qmlScope(ep->v8engine(), ctxt, qmlScope));
diff --git a/src/qml/qml/qqmllistwrapper.cpp b/src/qml/qml/qqmllistwrapper.cpp
index 2b3fcd8349..7b975c2cc8 100644
--- a/src/qml/qml/qqmllistwrapper.cpp
+++ b/src/qml/qml/qqmllistwrapper.cpp
@@ -106,7 +106,7 @@ ReturnedValue QmlListWrapper::get(Managed *m, const StringRef name, bool *hasPro
QV4::ExecutionEngine *v4 = m->engine();
QmlListWrapper *w = m->as<QmlListWrapper>();
if (!w)
- return v4->current->throwTypeError();
+ return v4->currentContext()->throwTypeError();
if (name->equals(v4->id_length) && !w->object.isNull()) {
quint32 count = w->property.count ? w->property.count(&w->property) : 0;
@@ -127,7 +127,7 @@ ReturnedValue QmlListWrapper::getIndexed(Managed *m, uint index, bool *hasProper
QV4::ExecutionEngine *e = m->engine();
QmlListWrapper *w = m->as<QmlListWrapper>();
if (!w)
- return e->current->throwTypeError();
+ return e->currentContext()->throwTypeError();
quint32 count = w->property.count ? w->property.count(&w->property) : 0;
if (index < count && w->property.at)
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp
index 911761d9fd..de100fd4fe 100644
--- a/src/qml/qml/qqmltypeloader.cpp
+++ b/src/qml/qml/qqmltypeloader.cpp
@@ -2806,7 +2806,7 @@ QV4::PersistentValue QQmlScriptData::scriptValueForContext(QQmlContextData *pare
QV4::ScopedValue qmlglobal(scope, QV4::QmlContextWrapper::qmlScope(v8engine, ctxt, 0));
QV4::QmlContextWrapper::takeContextOwnership(qmlglobal);
- QV4::ExecutionContext *ctx = QV8Engine::getV4(v8engine)->current;
+ QV4::ExecutionContext *ctx = QV8Engine::getV4(v8engine)->currentContext();
m_program->qml = qmlglobal;
m_program->run();
if (scope.engine->hasException) {
diff --git a/src/qml/qml/qqmltypewrapper.cpp b/src/qml/qml/qqmltypewrapper.cpp
index db594e1b5b..9c350a54a5 100644
--- a/src/qml/qml/qqmltypewrapper.cpp
+++ b/src/qml/qml/qqmltypewrapper.cpp
@@ -126,7 +126,7 @@ ReturnedValue QmlTypeWrapper::get(Managed *m, const StringRef name, bool *hasPro
Scoped<QmlTypeWrapper> w(scope, m->as<QmlTypeWrapper>());
if (!w)
- return v4->current->throwTypeError();
+ return v4->currentContext()->throwTypeError();
if (hasProperty)
@@ -165,7 +165,7 @@ ReturnedValue QmlTypeWrapper::get(Managed *m, const StringRef name, bool *hasPro
}
// check for property.
- return QV4::QObjectWrapper::getQmlProperty(v4->current, context, qobjectSingleton, name.getPointer(), QV4::QObjectWrapper::IgnoreRevision, hasProperty);
+ return QV4::QObjectWrapper::getQmlProperty(v4->currentContext(), context, qobjectSingleton, name.getPointer(), QV4::QObjectWrapper::IgnoreRevision, hasProperty);
} else if (!siinfo->scriptApi(e).isUndefined()) {
// NOTE: if used in a binding, changes will not trigger re-evaluation since non-NOTIFYable.
QV4::ScopedObject o(scope, QJSValuePrivate::get(siinfo->scriptApi(e))->getValue(v4));
@@ -188,7 +188,7 @@ ReturnedValue QmlTypeWrapper::get(Managed *m, const StringRef name, bool *hasPro
} else if (w->object) {
QObject *ao = qmlAttachedPropertiesObjectById(type->attachedPropertiesId(), object);
if (ao)
- return QV4::QObjectWrapper::getQmlProperty(v4->current, context, ao, name.getPointer(), QV4::QObjectWrapper::IgnoreRevision, hasProperty);
+ return QV4::QObjectWrapper::getQmlProperty(v4->currentContext(), context, ao, name.getPointer(), QV4::QObjectWrapper::IgnoreRevision, hasProperty);
// Fall through to base implementation
}
@@ -236,7 +236,7 @@ void QmlTypeWrapper::put(Managed *m, const StringRef name, const ValueRef value)
if (v4->hasException)
return;
if (!w) {
- v4->current->throwTypeError();
+ v4->currentContext()->throwTypeError();
return;
}
@@ -249,7 +249,7 @@ void QmlTypeWrapper::put(Managed *m, const StringRef name, const ValueRef value)
QObject *object = w->object;
QObject *ao = qmlAttachedPropertiesObjectById(type->attachedPropertiesId(), object);
if (ao)
- QV4::QObjectWrapper::setQmlProperty(v4->current, context, ao, name.getPointer(), QV4::QObjectWrapper::IgnoreRevision, value);
+ QV4::QObjectWrapper::setQmlProperty(v4->currentContext(), context, ao, name.getPointer(), QV4::QObjectWrapper::IgnoreRevision, value);
} else if (type && type->isSingleton()) {
QQmlEngine *e = v8engine->engine();
QQmlType::SingletonInstanceInfo *siinfo = type->singletonInstanceInfo();
@@ -257,12 +257,12 @@ void QmlTypeWrapper::put(Managed *m, const StringRef name, const ValueRef value)
QObject *qobjectSingleton = siinfo->qobjectApi(e);
if (qobjectSingleton) {
- QV4::QObjectWrapper::setQmlProperty(v4->current, context, qobjectSingleton, name.getPointer(), QV4::QObjectWrapper::IgnoreRevision, value);
+ QV4::QObjectWrapper::setQmlProperty(v4->currentContext(), context, qobjectSingleton, name.getPointer(), QV4::QObjectWrapper::IgnoreRevision, value);
} else if (!siinfo->scriptApi(e).isUndefined()) {
QV4::ScopedObject apiprivate(scope, QJSValuePrivate::get(siinfo->scriptApi(e))->value);
if (!apiprivate) {
QString error = QLatin1String("Cannot assign to read-only property \"") + name->toQString() + QLatin1Char('\"');
- v4->current->throwError(error);
+ v4->currentContext()->throwError(error);
return;
} else {
apiprivate->put(name, value);
diff --git a/src/qml/qml/qqmlvaluetypewrapper.cpp b/src/qml/qml/qqmlvaluetypewrapper.cpp
index 341daf2391..50d7cbcc5e 100644
--- a/src/qml/qml/qqmlvaluetypewrapper.cpp
+++ b/src/qml/qml/qqmlvaluetypewrapper.cpp
@@ -209,7 +209,7 @@ PropertyAttributes QmlValueTypeWrapper::query(const Managed *m, StringRef name)
const QmlValueTypeWrapper *r = m->as<const QmlValueTypeWrapper>();
QV4::ExecutionEngine *v4 = m->engine();
if (!r) {
- v4->current->throwTypeError();
+ v4->currentContext()->throwTypeError();
return PropertyAttributes();
}
@@ -273,7 +273,7 @@ ReturnedValue QmlValueTypeWrapper::get(Managed *m, const StringRef name, bool *h
QmlValueTypeWrapper *r = m->as<QmlValueTypeWrapper>();
QV4::ExecutionEngine *v4 = m->engine();
if (!r)
- return v4->current->throwTypeError();
+ return v4->currentContext()->throwTypeError();
// Note: readReferenceValue() can change the reference->type.
if (r->objectType == QmlValueTypeWrapper::Reference) {
@@ -306,7 +306,7 @@ ReturnedValue QmlValueTypeWrapper::get(Managed *m, const StringRef name, bool *h
if (result->isFunction()) {
// calling a Q_INVOKABLE function of a value type
QQmlContextData *qmlContext = QV4::QmlContextWrapper::callingContext(v4);
- return QV4::QObjectWrapper::getQmlProperty(v4->current, qmlContext, r->type, name.getPointer(), QV4::QObjectWrapper::IgnoreRevision);
+ return QV4::QObjectWrapper::getQmlProperty(v4->currentContext(), qmlContext, r->type, name.getPointer(), QV4::QObjectWrapper::IgnoreRevision);
}
#define VALUE_TYPE_LOAD(metatype, cpptype, constructor) \
@@ -339,7 +339,7 @@ void QmlValueTypeWrapper::put(Managed *m, const StringRef name, const ValueRef v
Scoped<QmlValueTypeWrapper> r(scope, m->as<QmlValueTypeWrapper>());
if (!r) {
- v4->current->throwTypeError();
+ v4->currentContext()->throwTypeError();
return;
}
@@ -365,7 +365,7 @@ void QmlValueTypeWrapper::put(Managed *m, const StringRef name, const ValueRef v
// assigning a JS function to a non-var-property is not allowed.
QString error = QLatin1String("Cannot assign JavaScript function to value-type property");
Scoped<String> e(scope, r->v8->toString(error));
- v4->current->throwError(e);
+ v4->currentContext()->throwError(e);
return;
}
diff --git a/src/qml/qml/qqmlvmemetaobject.cpp b/src/qml/qml/qqmlvmemetaobject.cpp
index 4b34792421..ebe72b2ff6 100644
--- a/src/qml/qml/qqmlvmemetaobject.cpp
+++ b/src/qml/qml/qqmlvmemetaobject.cpp
@@ -956,7 +956,7 @@ int QQmlVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a)
callData->args[ii] = ep->v8engine()->fromVariant(*(QVariant *)a[ii + 1]);
QV4::ScopedValue result(scope);
- QV4::ExecutionContext *ctx = function->engine()->current;
+ QV4::ExecutionContext *ctx = function->engine()->currentContext();
result = function->call(callData);
if (scope.hasException()) {
QQmlError error = QV4::ExecutionEngine::catchExceptionAsQmlError(ctx);
diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp
index e31b1c414a..ad231d0769 100644
--- a/src/qml/qml/qqmlxmlhttprequest.cpp
+++ b/src/qml/qml/qqmlxmlhttprequest.cpp
@@ -906,7 +906,7 @@ ReturnedValue NamedNodeMap::getIndexed(Managed *m, uint index, bool *hasProperty
QV4::ExecutionEngine *v4 = m->engine();
NamedNodeMap *r = m->as<NamedNodeMap>();
if (!r)
- return v4->current->throwTypeError();
+ return v4->currentContext()->throwTypeError();
QV8Engine *engine = v4->v8Engine;
@@ -925,7 +925,7 @@ ReturnedValue NamedNodeMap::get(Managed *m, const StringRef name, bool *hasPrope
NamedNodeMap *r = m->as<NamedNodeMap>();
QV4::ExecutionEngine *v4 = m->engine();
if (!r)
- return v4->current->throwTypeError();
+ return v4->currentContext()->throwTypeError();
name->makeIdentifier();
if (name->equals(v4->id_length))
@@ -961,7 +961,7 @@ ReturnedValue NodeList::getIndexed(Managed *m, uint index, bool *hasProperty)
QV4::ExecutionEngine *v4 = m->engine();
NodeList *r = m->as<NodeList>();
if (!r)
- return v4->current->throwTypeError();
+ return v4->currentContext()->throwTypeError();
QV8Engine *engine = v4->v8Engine;
@@ -980,7 +980,7 @@ ReturnedValue NodeList::get(Managed *m, const StringRef name, bool *hasProperty)
QV4::ExecutionEngine *v4 = m->engine();
NodeList *r = m->as<NodeList>();
if (!r)
- return v4->current->throwTypeError();
+ return v4->currentContext()->throwTypeError();
name->makeIdentifier();
@@ -1535,7 +1535,7 @@ const QByteArray &QQmlXMLHttpRequest::rawResponseBody() const
void QQmlXMLHttpRequest::dispatchCallbackImpl(const ValueRef me)
{
- ExecutionContext *ctx = v4->current;
+ ExecutionContext *ctx = v4->currentContext();
QV4::Scope scope(v4);
Scoped<Object> o(scope, me);
if (!o) {
@@ -1560,7 +1560,7 @@ void QQmlXMLHttpRequest::dispatchCallbackImpl(const ValueRef me)
s = v4->newString(QStringLiteral("ActivationObject"));
Scoped<Object> activationObject(scope, o->get(s));
if (!activationObject) {
- v4->current->throwError(QStringLiteral("QQmlXMLHttpRequest: internal error: empty ActivationObject"));
+ v4->currentContext()->throwError(QStringLiteral("QQmlXMLHttpRequest: internal error: empty ActivationObject"));
return;
}
@@ -1580,7 +1580,7 @@ void QQmlXMLHttpRequest::dispatchCallbackImpl(const ValueRef me)
void QQmlXMLHttpRequest::dispatchCallback(const ValueRef me)
{
- ExecutionContext *ctx = v4->current;
+ ExecutionContext *ctx = v4->currentContext();
dispatchCallbackImpl(me);
if (v4->hasException) {
QQmlError error = QV4::ExecutionEngine::catchExceptionAsQmlError(ctx);
@@ -1656,7 +1656,7 @@ struct QQmlXMLHttpRequestCtor : public FunctionObject
Scope scope(that->engine());
Scoped<QQmlXMLHttpRequestCtor> ctor(scope, that->as<QQmlXMLHttpRequestCtor>());
if (!ctor)
- return that->engine()->current->throwTypeError();
+ return that->engine()->currentContext()->throwTypeError();
QV8Engine *engine = that->engine()->v8Engine;
QQmlXMLHttpRequest *r = new QQmlXMLHttpRequest(engine, engine->networkAccessManager());
diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp
index d0fc1b1295..e41a91ecdb 100644
--- a/src/qml/qml/v8/qv8engine.cpp
+++ b/src/qml/qml/v8/qv8engine.cpp
@@ -256,7 +256,7 @@ QV4::ReturnedValue QV8Engine::fromVariant(const QVariant &variant)
case QMetaType::Double:
return QV4::Encode(*reinterpret_cast<const double*>(ptr));
case QMetaType::QString:
- return m_v4Engine->current->engine->newString(*reinterpret_cast<const QString*>(ptr))->asReturnedValue();
+ return m_v4Engine->currentContext()->engine->newString(*reinterpret_cast<const QString*>(ptr))->asReturnedValue();
case QMetaType::Float:
return QV4::Encode(*reinterpret_cast<const float*>(ptr));
case QMetaType::Short:
@@ -667,7 +667,7 @@ QV4::ReturnedValue QV8Engine::metaTypeToJS(int type, const void *data)
case QMetaType::Double:
return QV4::Encode(*reinterpret_cast<const double*>(data));
case QMetaType::QString:
- return m_v4Engine->current->engine->newString(*reinterpret_cast<const QString*>(data))->asReturnedValue();
+ return m_v4Engine->currentContext()->engine->newString(*reinterpret_cast<const QString*>(data))->asReturnedValue();
case QMetaType::Float:
return QV4::Encode(*reinterpret_cast<const float*>(data));
case QMetaType::Short:
@@ -750,7 +750,7 @@ bool QV8Engine::metaTypeFromJS(const QV4::ValueRef value, int type, void *data)
if (value->isUndefined() || value->isNull())
*reinterpret_cast<QString*>(data) = QString();
else
- *reinterpret_cast<QString*>(data) = value->toString(m_v4Engine->current)->toQString();
+ *reinterpret_cast<QString*>(data) = value->toString(m_v4Engine->currentContext())->toQString();
return true;
case QMetaType::Float:
*reinterpret_cast<float*>(data) = value->toNumber();
diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp
index 19e2a40d47..7276c0e5c6 100644
--- a/src/qml/types/qqmldelegatemodel.cpp
+++ b/src/qml/types/qqmldelegatemodel.cpp
@@ -76,7 +76,7 @@ struct DelegateModelGroupFunction: QV4::FunctionObject
static QV4::ReturnedValue construct(QV4::Managed *m, QV4::CallData *)
{
- return m->engine()->current->throwTypeError();
+ return m->engine()->currentContext()->throwTypeError();
}
static QV4::ReturnedValue call(QV4::Managed *that, QV4::CallData *callData)
@@ -86,7 +86,7 @@ struct DelegateModelGroupFunction: QV4::FunctionObject
QV4::Scoped<DelegateModelGroupFunction> f(scope, that, QV4::Scoped<DelegateModelGroupFunction>::Cast);
QV4::Scoped<QQmlDelegateModelItemObject> o(scope, callData->thisObject);
if (!o)
- return v4->current->throwTypeError(QStringLiteral("Not a valid VisualData object"));
+ return v4->currentContext()->throwTypeError(QStringLiteral("Not a valid VisualData object"));
QV4::ScopedValue v(scope, callData->argument(0));
return f->code(o->item, f->flag, v);
@@ -3197,7 +3197,7 @@ public:
QV4::Scope scope(v4);
QV4::Scoped<QQmlDelegateModelGroupChangeArray> array(scope, m->as<QQmlDelegateModelGroupChangeArray>());
if (!array)
- return v4->current->throwTypeError();
+ return v4->currentContext()->throwTypeError();
if (index >= array->count()) {
if (hasProperty)
@@ -3221,7 +3221,7 @@ public:
{
QQmlDelegateModelGroupChangeArray *array = m->as<QQmlDelegateModelGroupChangeArray>();
if (!array)
- return m->engine()->current->throwTypeError();
+ return m->engine()->currentContext()->throwTypeError();
if (name->equals(m->engine()->id_length)) {
if (hasProperty)
diff --git a/src/qml/types/qquickworkerscript.cpp b/src/qml/types/qquickworkerscript.cpp
index 7607febe01..53e45e2003 100644
--- a/src/qml/types/qquickworkerscript.cpp
+++ b/src/qml/types/qquickworkerscript.cpp
@@ -252,7 +252,7 @@ QV4::ReturnedValue QQuickWorkerScriptEnginePrivate::WorkerEngine::sendFunction(i
QV4::Scope scope(v4);
QV4::ScopedFunctionObject f(scope, createsend.value());
- QV4::ExecutionContext *ctx = v4->current;
+ QV4::ExecutionContext *ctx = v4->currentContext();
QV4::ScopedValue v(scope);
QV4::ScopedCallData callData(scope, 1);
@@ -356,7 +356,7 @@ void QQuickWorkerScriptEnginePrivate::processMessage(int id, const QByteArray &d
QV4::ExecutionEngine *v4 = QV8Engine::getV4(workerEngine);
QV4::Scope scope(v4);
QV4::ScopedFunctionObject f(scope, workerEngine->onmessage.value());
- QV4::ExecutionContext *ctx = v4->current;
+ QV4::ExecutionContext *ctx = v4->currentContext();
QV4::ScopedValue value(scope, QV4::Serialize::deserialize(data, workerEngine));
@@ -398,7 +398,7 @@ void QQuickWorkerScriptEnginePrivate::processLoad(int id, const QUrl &url)
QV4::Script program(v4, activation, sourceCode, url.toString());
- QV4::ExecutionContext *ctx = v4->current;
+ QV4::ExecutionContext *ctx = v4->currentContext();
program.parse();
if (!v4->hasException)
program.run();