diff options
author | Lars Knoll <lars.knoll@qt.io> | 2017-08-03 08:57:03 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2017-08-03 10:22:00 +0000 |
commit | ef5d5a989a344ba812a91b365cd54ace65f27f26 (patch) | |
tree | 0a74d146d7e69005c1181188882b4893b5850f2b /src/qml/jsruntime/qv4runtime.cpp | |
parent | 1f8ab5fa975b2ec9172090f5665bb77cc5630584 (diff) |
Get rid of the compilation unit related members in ExecutionContext
And change the signature for VME::exec to take the QV4::Function
that should be executed. This is in preparation to being able
to run functions that will not need to allocate an execution
context on their own.
Change-Id: I34538a8723006f4ec24583805e88a66e750100c3
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4runtime.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4runtime.cpp | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp index b9ea73f6a8..cbe55fe080 100644 --- a/src/qml/jsruntime/qv4runtime.cpp +++ b/src/qml/jsruntime/qv4runtime.cpp @@ -308,7 +308,7 @@ void RuntimeHelpers::numberToString(QString *result, double num, int radix) ReturnedValue Runtime::method_closure(ExecutionEngine *engine, int functionId) { - QV4::Function *clos = static_cast<CompiledData::CompilationUnit*>(engine->current->compilationUnit)->runtimeFunctions[functionId]; + QV4::Function *clos = static_cast<CompiledData::CompilationUnit*>(engine->current->v4Function->compilationUnit)->runtimeFunctions[functionId]; Q_ASSERT(clos); return FunctionObject::createScriptFunction(engine->currentContext, clos)->asReturnedValue(); } @@ -331,7 +331,7 @@ ReturnedValue Runtime::method_deleteElement(ExecutionEngine *engine, const Value ReturnedValue Runtime::method_deleteMember(ExecutionEngine *engine, const Value &base, int nameIndex) { Scope scope(engine); - ScopedString name(scope, engine->current->compilationUnit->runtimeStrings[nameIndex]); + ScopedString name(scope, engine->current->v4Function->compilationUnit->runtimeStrings[nameIndex]); return method_deleteMemberString(engine, base, name); } @@ -347,7 +347,7 @@ ReturnedValue Runtime::method_deleteMemberString(ExecutionEngine *engine, const ReturnedValue Runtime::method_deleteName(ExecutionEngine *engine, int nameIndex) { Scope scope(engine); - ScopedString name(scope, engine->current->compilationUnit->runtimeStrings[nameIndex]); + ScopedString name(scope, engine->current->v4Function->compilationUnit->runtimeStrings[nameIndex]); return Encode(engine->currentContext->deleteProperty(name)); } @@ -592,7 +592,7 @@ QV4::ReturnedValue Runtime::method_addString(ExecutionEngine *engine, const Valu void Runtime::method_setProperty(ExecutionEngine *engine, const Value &object, int nameIndex, const Value &value) { Scope scope(engine); - ScopedString name(scope, engine->current->compilationUnit->runtimeStrings[nameIndex]); + ScopedString name(scope, engine->current->v4Function->compilationUnit->runtimeStrings[nameIndex]); ScopedObject o(scope, object.toObject(engine)); if (!o) return; @@ -743,14 +743,14 @@ ReturnedValue Runtime::method_foreachNextPropertyName(const Value &foreach_itera void Runtime::method_setActivationProperty(ExecutionEngine *engine, int nameIndex, const Value &value) { Scope scope(engine); - ScopedString name(scope, engine->current->compilationUnit->runtimeStrings[nameIndex]); + ScopedString name(scope, engine->current->v4Function->compilationUnit->runtimeStrings[nameIndex]); engine->currentContext->setProperty(name, value); } ReturnedValue Runtime::method_getProperty(ExecutionEngine *engine, const Value &object, int nameIndex) { Scope scope(engine); - ScopedString name(scope, engine->current->compilationUnit->runtimeStrings[nameIndex]); + ScopedString name(scope, engine->current->v4Function->compilationUnit->runtimeStrings[nameIndex]); ScopedObject o(scope, object); if (o) @@ -770,7 +770,7 @@ ReturnedValue Runtime::method_getProperty(ExecutionEngine *engine, const Value & ReturnedValue Runtime::method_getActivationProperty(ExecutionEngine *engine, int nameIndex) { Scope scope(engine); - ScopedString name(scope, engine->current->compilationUnit->runtimeStrings[nameIndex]); + ScopedString name(scope, engine->current->v4Function->compilationUnit->runtimeStrings[nameIndex]); return engine->currentContext->getProperty(name); } @@ -1005,12 +1005,12 @@ ReturnedValue Runtime::method_callGlobalLookup(ExecutionEngine *engine, uint ind Scope scope(engine); Q_ASSERT(callData->thisObject.isUndefined()); - Lookup *l = engine->current->lookups + index; + Lookup *l = engine->current->v4Function->compilationUnit->runtimeLookups + index; ScopedFunctionObject o(scope, l->globalGetter(l, engine)); if (!o) return engine->throwTypeError(); - ScopedString name(scope, engine->current->compilationUnit->runtimeStrings[l->nameIndex]); + ScopedString name(scope, engine->current->v4Function->compilationUnit->runtimeStrings[l->nameIndex]); if (o->d() == scope.engine->evalFunction()->d() && name->equals(scope.engine->id_eval())) { static_cast<EvalFunction *>(o.getPointer())->evalCall(scope, callData, true); } else { @@ -1025,7 +1025,7 @@ ReturnedValue Runtime::method_callActivationProperty(ExecutionEngine *engine, in { Q_ASSERT(callData->thisObject.isUndefined()); Scope scope(engine); - ScopedString name(scope, engine->current->compilationUnit->runtimeStrings[nameIndex]); + ScopedString name(scope, engine->current->v4Function->compilationUnit->runtimeStrings[nameIndex]); ScopedObject base(scope); ScopedValue func(scope, engine->currentContext->getPropertyAndBase(name, base.getRef())); @@ -1056,7 +1056,7 @@ ReturnedValue Runtime::method_callActivationProperty(ExecutionEngine *engine, in ReturnedValue Runtime::method_callProperty(ExecutionEngine *engine, int nameIndex, CallData *callData) { Scope scope(engine); - ScopedString name(scope, engine->current->compilationUnit->runtimeStrings[nameIndex]); + ScopedString name(scope, engine->current->v4Function->compilationUnit->runtimeStrings[nameIndex]); ScopedObject baseObject(scope, callData->thisObject); if (!baseObject) { Q_ASSERT(!callData->thisObject.isEmpty()); @@ -1084,7 +1084,7 @@ ReturnedValue Runtime::method_callProperty(ExecutionEngine *engine, int nameInde ReturnedValue Runtime::method_callPropertyLookup(ExecutionEngine *engine, uint index, CallData *callData) { - Lookup *l = engine->current->lookups + index; + Lookup *l = engine->current->v4Function->compilationUnit->runtimeLookups + index; Value v; v = l->getter(l, engine, callData->thisObject); Object *o = v.objectValue(); @@ -1130,7 +1130,7 @@ ReturnedValue Runtime::method_constructGlobalLookup(ExecutionEngine *engine, uin Scope scope(engine); Q_ASSERT(callData->thisObject.isUndefined()); - Lookup *l = engine->current->lookups + index; + Lookup *l = engine->current->v4Function->compilationUnit->runtimeLookups + index; ScopedObject f(scope, l->globalGetter(l, engine)); if (f) { f->construct(scope, callData); @@ -1144,7 +1144,7 @@ ReturnedValue Runtime::method_constructGlobalLookup(ExecutionEngine *engine, uin ReturnedValue Runtime::method_constructActivationProperty(ExecutionEngine *engine, int nameIndex, CallData *callData) { Scope scope(engine); - ScopedString name(scope, engine->current->compilationUnit->runtimeStrings[nameIndex]); + ScopedString name(scope, engine->current->v4Function->compilationUnit->runtimeStrings[nameIndex]); ScopedValue func(scope, engine->currentContext->getProperty(name)); if (scope.engine->hasException) return Encode::undefined(); @@ -1172,7 +1172,7 @@ ReturnedValue Runtime::method_constructProperty(ExecutionEngine *engine, int nam { Scope scope(engine); ScopedObject thisObject(scope, callData->thisObject.toObject(engine)); - ScopedString name(scope, engine->current->compilationUnit->runtimeStrings[nameIndex]); + ScopedString name(scope, engine->current->v4Function->compilationUnit->runtimeStrings[nameIndex]); if (scope.engine->hasException) return Encode::undefined(); @@ -1188,7 +1188,7 @@ ReturnedValue Runtime::method_constructProperty(ExecutionEngine *engine, int nam ReturnedValue Runtime::method_constructPropertyLookup(ExecutionEngine *engine, uint index, CallData *callData) { - Lookup *l = engine->current->lookups + index; + Lookup *l = engine->current->v4Function->compilationUnit->runtimeLookups + index; Value v; v = l->getter(l, engine, callData->thisObject); Object *o = v.objectValue(); @@ -1239,7 +1239,7 @@ ReturnedValue Runtime::method_typeofValue(ExecutionEngine *engine, const Value & QV4::ReturnedValue Runtime::method_typeofName(ExecutionEngine *engine, int nameIndex) { Scope scope(engine); - ScopedString name(scope, engine->current->compilationUnit->runtimeStrings[nameIndex]); + ScopedString name(scope, engine->current->v4Function->compilationUnit->runtimeStrings[nameIndex]); ScopedValue prop(scope, engine->currentContext->getProperty(name)); // typeof doesn't throw. clear any possible exception scope.engine->hasException = false; @@ -1271,7 +1271,7 @@ void Runtime::method_pushCatchScope(NoThrowEngine *engine, int exceptionVarNameI { engine->jsAlloca(1); // keep this symmetric with pushWithScope ExecutionContext *c = engine->currentContext; - engine->pushContext(c->newCatchContext(c->d()->compilationUnit->runtimeStrings[exceptionVarNameIndex], engine->catchException(0))); + engine->pushContext(c->newCatchContext(engine->current->v4Function->compilationUnit->runtimeStrings[exceptionVarNameIndex], engine->catchException(0))); Q_ASSERT(engine->jsStackTop == engine->currentContext + 2); } @@ -1285,7 +1285,7 @@ void Runtime::method_popScope(NoThrowEngine *engine) void Runtime::method_declareVar(ExecutionEngine *engine, bool deletable, int nameIndex) { Scope scope(engine); - ScopedString name(scope, engine->current->compilationUnit->runtimeStrings[nameIndex]); + ScopedString name(scope, engine->current->v4Function->compilationUnit->runtimeStrings[nameIndex]); engine->currentContext->createMutableBinding(name, deletable); } @@ -1297,7 +1297,7 @@ ReturnedValue Runtime::method_arrayLiteral(ExecutionEngine *engine, Value *value ReturnedValue Runtime::method_objectLiteral(ExecutionEngine *engine, const QV4::Value *args, int classId, int arrayValueCount, int arrayGetterSetterCountAndFlags) { Scope scope(engine); - QV4::InternalClass *klass = static_cast<CompiledData::CompilationUnit*>(engine->current->compilationUnit)->runtimeClasses[classId]; + QV4::InternalClass *klass = static_cast<CompiledData::CompilationUnit*>(engine->current->v4Function->compilationUnit)->runtimeClasses[classId]; ScopedObject o(scope, engine->newObject(klass, engine->objectPrototype())); { @@ -1409,7 +1409,7 @@ ReturnedValue Runtime::method_getQmlContext(NoThrowEngine *engine) ReturnedValue Runtime::method_regexpLiteral(ExecutionEngine *engine, int id) { - return static_cast<CompiledData::CompilationUnit*>(engine->current->compilationUnit)->runtimeRegularExpressions[id].asReturnedValue(); + return static_cast<CompiledData::CompilationUnit*>(engine->current->v4Function->compilationUnit)->runtimeRegularExpressions[id].asReturnedValue(); } ReturnedValue Runtime::method_getQmlScopeObjectProperty(ExecutionEngine *engine, const Value &context, int propertyIndex, bool captureRequired) @@ -1462,7 +1462,7 @@ ReturnedValue Runtime::method_getQmlImportedScripts(NoThrowEngine *engine) QV4::ReturnedValue Runtime::method_getQmlSingleton(QV4::NoThrowEngine *engine, int nameIndex) { Scope scope(engine); - ScopedString name(scope, engine->current->compilationUnit->runtimeStrings[nameIndex]); + ScopedString name(scope, engine->current->v4Function->compilationUnit->runtimeStrings[nameIndex]); return engine->qmlSingletonWrapper(name); } |