aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2015-10-09 09:23:20 +0200
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2016-04-11 12:27:31 +0000
commit38b37b55d266e0a6c661288b5b6957472f31b536 (patch)
treef2e7a9475638568396f991e4463b877a4865d895 /src/qml
parent1e557d90b5acb21f87bb9d904d6a47190727d8aa (diff)
Convert second batch of runtime methods
Change-Id: I8b85b0398f758026cc8f8359f722c0d7f8544dbb Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/jit/qv4isel_masm.cpp28
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp28
-rw-r--r--src/qml/jsruntime/qv4runtimeapi_p.h42
-rw-r--r--src/qml/jsruntime/qv4vme_moth.cpp26
4 files changed, 69 insertions, 55 deletions
diff --git a/src/qml/jit/qv4isel_masm.cpp b/src/qml/jit/qv4isel_masm.cpp
index c68e55fb7a..03cf1f708f 100644
--- a/src/qml/jit/qv4isel_masm.cpp
+++ b/src/qml/jit/qv4isel_masm.cpp
@@ -476,7 +476,7 @@ void InstructionSelection::callBuiltinDeleteValue(IR::Expr *result)
void InstructionSelection::callBuiltinThrow(IR::Expr *arg)
{
- generateFunctionCall(Assembler::ReturnValueRegister, Runtime::throwException, Assembler::EngineRegister,
+ generateRuntimeCall(Assembler::ReturnValueRegister, throwException, Assembler::EngineRegister,
Assembler::PointerToValue(arg));
}
@@ -487,13 +487,13 @@ void InstructionSelection::callBuiltinReThrow()
void InstructionSelection::callBuiltinUnwindException(IR::Expr *result)
{
- generateFunctionCall(result, Runtime::unwindException, Assembler::EngineRegister);
+ generateRuntimeCall(result, unwindException, Assembler::EngineRegister);
}
void InstructionSelection::callBuiltinPushCatchScope(const QString &exceptionName)
{
- generateFunctionCall(Assembler::Void, Runtime::pushCatchScope, Assembler::EngineRegister, Assembler::StringToIndex(exceptionName));
+ generateRuntimeCall(Assembler::Void, pushCatchScope, Assembler::EngineRegister, Assembler::StringToIndex(exceptionName));
}
void InstructionSelection::callBuiltinForeachIteratorObject(IR::Expr *arg, IR::Expr *result)
@@ -501,7 +501,7 @@ void InstructionSelection::callBuiltinForeachIteratorObject(IR::Expr *arg, IR::E
Q_ASSERT(arg);
Q_ASSERT(result);
- generateFunctionCall(result, Runtime::foreachIterator, Assembler::EngineRegister, Assembler::PointerToValue(arg));
+ generateRuntimeCall(result, foreachIterator, Assembler::EngineRegister, Assembler::PointerToValue(arg));
}
void InstructionSelection::callBuiltinForeachNextPropertyname(IR::Expr *arg, IR::Expr *result)
@@ -509,24 +509,24 @@ void InstructionSelection::callBuiltinForeachNextPropertyname(IR::Expr *arg, IR:
Q_ASSERT(arg);
Q_ASSERT(result);
- generateFunctionCall(result, Runtime::foreachNextPropertyName, Assembler::Reference(arg));
+ generateRuntimeCall(result, foreachNextPropertyName, Assembler::Reference(arg));
}
void InstructionSelection::callBuiltinPushWithScope(IR::Expr *arg)
{
Q_ASSERT(arg);
- generateFunctionCall(Assembler::Void, Runtime::pushWithScope, Assembler::Reference(arg), Assembler::EngineRegister);
+ generateRuntimeCall(Assembler::Void, pushWithScope, Assembler::Reference(arg), Assembler::EngineRegister);
}
void InstructionSelection::callBuiltinPopScope()
{
- generateFunctionCall(Assembler::Void, Runtime::popScope, Assembler::EngineRegister);
+ generateRuntimeCall(Assembler::Void, popScope, Assembler::EngineRegister);
}
void InstructionSelection::callBuiltinDeclareVar(bool deletable, const QString &name)
{
- generateFunctionCall(Assembler::Void, Runtime::declareVar, Assembler::EngineRegister,
+ generateRuntimeCall(Assembler::Void, declareVar, Assembler::EngineRegister,
Assembler::TrustedImm32(deletable), Assembler::StringToIndex(name));
}
@@ -535,7 +535,7 @@ void InstructionSelection::callBuiltinDefineArray(IR::Expr *result, IR::ExprList
Q_ASSERT(result);
int length = prepareVariableArguments(args);
- generateFunctionCall(result, Runtime::arrayLiteral, Assembler::EngineRegister,
+ generateRuntimeCall(result, arrayLiteral, Assembler::EngineRegister,
baseAddressForCallArguments(), Assembler::TrustedImm32(length));
}
@@ -615,19 +615,19 @@ void InstructionSelection::callBuiltinDefineObjectLiteral(IR::Expr *result, int
it = it->next;
}
- generateFunctionCall(result, Runtime::objectLiteral, Assembler::EngineRegister,
+ generateRuntimeCall(result, objectLiteral, Assembler::EngineRegister,
baseAddressForCallArguments(), Assembler::TrustedImm32(classId),
Assembler::TrustedImm32(arrayValueCount), Assembler::TrustedImm32(arrayGetterSetterCount | (needSparseArray << 30)));
}
void InstructionSelection::callBuiltinSetupArgumentObject(IR::Expr *result)
{
- generateFunctionCall(result, Runtime::setupArgumentsObject, Assembler::EngineRegister);
+ generateRuntimeCall(result, setupArgumentsObject, Assembler::EngineRegister);
}
void InstructionSelection::callBuiltinConvertThisToObject()
{
- generateFunctionCall(Assembler::Void, Runtime::convertThisToObject, Assembler::EngineRegister);
+ generateRuntimeCall(Assembler::Void, convertThisToObject, Assembler::EngineRegister);
}
void InstructionSelection::callValue(IR::Expr *value, IR::ExprList *args, IR::Expr *result)
@@ -717,7 +717,7 @@ void InstructionSelection::loadString(const QString &str, IR::Expr *target)
void InstructionSelection::loadRegexp(IR::RegExp *sourceRegexp, IR::Expr *target)
{
int id = registerRegExp(sourceRegexp);
- generateFunctionCall(target, Runtime::regexpLiteral, Assembler::EngineRegister, Assembler::TrustedImm32(id));
+ generateRuntimeCall(target, regexpLiteral, Assembler::EngineRegister, Assembler::TrustedImm32(id));
}
void InstructionSelection::getActivationProperty(const IR::Name *name, IR::Expr *target)
@@ -740,7 +740,7 @@ void InstructionSelection::setActivationProperty(IR::Expr *source, const QString
void InstructionSelection::initClosure(IR::Closure *closure, IR::Expr *target)
{
int id = closure->value;
- generateFunctionCall(target, Runtime::closure, Assembler::EngineRegister, Assembler::TrustedImm32(id));
+ generateRuntimeCall(target, closure, Assembler::EngineRegister, Assembler::TrustedImm32(id));
}
void InstructionSelection::getProperty(IR::Expr *base, const QString &name, IR::Expr *target)
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index cbcc7f27ac..72cb0ad7f0 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -297,7 +297,7 @@ void RuntimeHelpers::numberToString(QString *result, double num, int radix)
result->prepend(QLatin1Char('-'));
}
-ReturnedValue Runtime::closure(ExecutionEngine *engine, int functionId)
+ReturnedValue Runtime::method_closure(ExecutionEngine *engine, int functionId)
{
QV4::Function *clos = engine->current->compilationUnit->runtimeFunctions[functionId];
Q_ASSERT(clos);
@@ -669,7 +669,7 @@ void Runtime::method_setElement(ExecutionEngine *engine, const Value &object, co
o->put(name, value);
}
-ReturnedValue Runtime::foreachIterator(ExecutionEngine *engine, const Value &in)
+ReturnedValue Runtime::method_foreachIterator(ExecutionEngine *engine, const Value &in)
{
Scope scope(engine);
ScopedObject o(scope, (Object *)0);
@@ -678,7 +678,7 @@ ReturnedValue Runtime::foreachIterator(ExecutionEngine *engine, const Value &in)
return engine->newForEachIteratorObject(o)->asReturnedValue();
}
-ReturnedValue Runtime::foreachNextPropertyName(const Value &foreach_iterator)
+ReturnedValue Runtime::method_foreachNextPropertyName(const Value &foreach_iterator)
{
Q_ASSERT(foreach_iterator.isObject());
@@ -1132,7 +1132,7 @@ ReturnedValue Runtime::method_constructPropertyLookup(ExecutionEngine *engine, u
}
-void Runtime::throwException(ExecutionEngine *engine, const Value &value)
+void Runtime::method_throwException(ExecutionEngine *engine, const Value &value)
{
if (!value.isEmpty())
engine->throwError(value);
@@ -1219,7 +1219,7 @@ QV4::ReturnedValue Runtime::method_typeofElement(ExecutionEngine *engine, const
return method_typeofValue(engine, prop);
}
-ReturnedValue Runtime::unwindException(ExecutionEngine *engine)
+ReturnedValue Runtime::method_unwindException(ExecutionEngine *engine)
{
if (!engine->hasException)
return Primitive::emptyValue().asReturnedValue();
@@ -1231,39 +1231,39 @@ ReturnedValue Runtime::unwindException(ExecutionEngine *engine)
*
* Instead the push/pop pair acts as a non local scope.
*/
-void Runtime::pushWithScope(const Value &o, ExecutionEngine *engine)
+void Runtime::method_pushWithScope(const Value &o, ExecutionEngine *engine)
{
engine->pushContext(engine->currentContext->newWithContext(o.toObject(engine)));
Q_ASSERT(engine->jsStackTop = engine->currentContext + 2);
}
-void Runtime::pushCatchScope(NoThrowEngine *engine, int exceptionVarNameIndex)
+void Runtime::method_pushCatchScope(NoThrowEngine *engine, int exceptionVarNameIndex)
{
ExecutionContext *c = engine->currentContext;
engine->pushContext(c->newCatchContext(c->d()->compilationUnit->runtimeStrings[exceptionVarNameIndex], engine->catchException(0)));
Q_ASSERT(engine->jsStackTop = engine->currentContext + 2);
}
-void Runtime::popScope(ExecutionEngine *engine)
+void Runtime::method_popScope(ExecutionEngine *engine)
{
Q_ASSERT(engine->jsStackTop = engine->currentContext + 2);
engine->popContext();
engine->jsStackTop -= 2;
}
-void Runtime::declareVar(ExecutionEngine *engine, bool deletable, int nameIndex)
+void Runtime::method_declareVar(ExecutionEngine *engine, bool deletable, int nameIndex)
{
Scope scope(engine);
ScopedString name(scope, engine->current->compilationUnit->runtimeStrings[nameIndex]);
engine->currentContext->createMutableBinding(name, deletable);
}
-ReturnedValue Runtime::arrayLiteral(ExecutionEngine *engine, Value *values, uint length)
+ReturnedValue Runtime::method_arrayLiteral(ExecutionEngine *engine, Value *values, uint length)
{
return engine->newArrayObject(values, length)->asReturnedValue();
}
-ReturnedValue Runtime::objectLiteral(ExecutionEngine *engine, const QV4::Value *args, int classId, int arrayValueCount, int arrayGetterSetterCountAndFlags)
+ReturnedValue Runtime::method_objectLiteral(ExecutionEngine *engine, const QV4::Value *args, int classId, int arrayValueCount, int arrayGetterSetterCountAndFlags)
{
Scope scope(engine);
QV4::InternalClass *klass = engine->current->compilationUnit->runtimeClasses[classId];
@@ -1305,7 +1305,7 @@ ReturnedValue Runtime::objectLiteral(ExecutionEngine *engine, const QV4::Value *
return o.asReturnedValue();
}
-QV4::ReturnedValue Runtime::setupArgumentsObject(ExecutionEngine *engine)
+QV4::ReturnedValue Runtime::method_setupArgumentsObject(ExecutionEngine *engine)
{
Q_ASSERT(engine->current->type == Heap::ExecutionContext::Type_CallContext);
QV4::CallContext *c = static_cast<QV4::CallContext *>(engine->currentContext);
@@ -1399,7 +1399,7 @@ ReturnedValue Runtime::getQmlContext(NoThrowEngine *engine)
return engine->qmlContext()->asReturnedValue();
}
-ReturnedValue Runtime::regexpLiteral(ExecutionEngine *engine, int id)
+ReturnedValue Runtime::method_regexpLiteral(ExecutionEngine *engine, int id)
{
return engine->current->compilationUnit->runtimeRegularExpressions[id].asReturnedValue();
}
@@ -1501,7 +1501,7 @@ QV4::ReturnedValue Runtime::getQmlSingleton(QV4::NoThrowEngine *engine, int name
return engine->qmlSingletonWrapper(name);
}
-void Runtime::convertThisToObject(ExecutionEngine *engine)
+void Runtime::method_convertThisToObject(ExecutionEngine *engine)
{
Value *t = &engine->current->callData->thisObject;
if (t->isObject())
diff --git a/src/qml/jsruntime/qv4runtimeapi_p.h b/src/qml/jsruntime/qv4runtimeapi_p.h
index 940e3ab400..871ed2b81d 100644
--- a/src/qml/jsruntime/qv4runtimeapi_p.h
+++ b/src/qml/jsruntime/qv4runtimeapi_p.h
@@ -86,6 +86,20 @@ struct Q_QML_PRIVATE_EXPORT Runtime {
, INIT_RUNTIME_METHOD(deleteMember)
, INIT_RUNTIME_METHOD(deleteMemberString)
, INIT_RUNTIME_METHOD(deleteName)
+ , INIT_RUNTIME_METHOD(throwException)
+ , INIT_RUNTIME_METHOD(unwindException)
+ , INIT_RUNTIME_METHOD(pushWithScope)
+ , INIT_RUNTIME_METHOD(pushCatchScope)
+ , INIT_RUNTIME_METHOD(popScope)
+ , INIT_RUNTIME_METHOD(closure)
+ , INIT_RUNTIME_METHOD(declareVar)
+ , INIT_RUNTIME_METHOD(setupArgumentsObject)
+ , INIT_RUNTIME_METHOD(convertThisToObject)
+ , INIT_RUNTIME_METHOD(arrayLiteral)
+ , INIT_RUNTIME_METHOD(objectLiteral)
+ , INIT_RUNTIME_METHOD(regexpLiteral)
+ , INIT_RUNTIME_METHOD(foreachIterator)
+ , INIT_RUNTIME_METHOD(foreachNextPropertyName)
{ }
// call
@@ -128,28 +142,28 @@ struct Q_QML_PRIVATE_EXPORT Runtime {
RUNTIME_METHOD(ReturnedValue, deleteName, (ExecutionEngine *engine, int nameIndex));
// exceptions & scopes
- static void throwException(ExecutionEngine *engine, const Value &value);
- static ReturnedValue unwindException(ExecutionEngine *engine);
- static void pushWithScope(const Value &o, ExecutionEngine *engine);
- static void pushCatchScope(NoThrowEngine *engine, int exceptionVarNameIndex);
- static void popScope(ExecutionEngine *engine);
+ RUNTIME_METHOD(void, throwException, (ExecutionEngine *engine, const Value &value));
+ RUNTIME_METHOD(ReturnedValue, unwindException, (ExecutionEngine *engine));
+ RUNTIME_METHOD(void, pushWithScope, (const Value &o, ExecutionEngine *engine));
+ RUNTIME_METHOD(void, pushCatchScope, (NoThrowEngine *engine, int exceptionVarNameIndex));
+ RUNTIME_METHOD(void, popScope, (ExecutionEngine *engine));
// closures
- static ReturnedValue closure(ExecutionEngine *engine, int functionId);
+ RUNTIME_METHOD(ReturnedValue, closure, (ExecutionEngine *engine, int functionId));
// function header
- static void declareVar(ExecutionEngine *engine, bool deletable, int nameIndex);
- static ReturnedValue setupArgumentsObject(ExecutionEngine *engine);
- static void convertThisToObject(ExecutionEngine *engine);
+ RUNTIME_METHOD(void, declareVar, (ExecutionEngine *engine, bool deletable, int nameIndex));
+ RUNTIME_METHOD(ReturnedValue, setupArgumentsObject, (ExecutionEngine *engine));
+ RUNTIME_METHOD(void, convertThisToObject, (ExecutionEngine *engine));
// literals
- static ReturnedValue arrayLiteral(ExecutionEngine *engine, Value *values, uint length);
- static ReturnedValue objectLiteral(ExecutionEngine *engine, const Value *args, int classId, int arrayValueCount, int arrayGetterSetterCountAndFlags);
- static ReturnedValue regexpLiteral(ExecutionEngine *engine, int id);
+ RUNTIME_METHOD(ReturnedValue, arrayLiteral, (ExecutionEngine *engine, Value *values, uint length));
+ RUNTIME_METHOD(ReturnedValue, objectLiteral, (ExecutionEngine *engine, const Value *args, int classId, int arrayValueCount, int arrayGetterSetterCountAndFlags));
+ RUNTIME_METHOD(ReturnedValue, regexpLiteral, (ExecutionEngine *engine, int id));
// foreach
- static ReturnedValue foreachIterator(ExecutionEngine *engine, const Value &in);
- static ReturnedValue foreachNextPropertyName(const Value &foreach_iterator);
+ RUNTIME_METHOD(ReturnedValue, foreachIterator, (ExecutionEngine *engine, const Value &in));
+ RUNTIME_METHOD(ReturnedValue, foreachNextPropertyName, (const Value &foreach_iterator));
// unary operators
typedef ReturnedValue (*UnaryOperation)(const Value &value);
diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp
index 57ebb10700..a4ec70aca0 100644
--- a/src/qml/jsruntime/qv4vme_moth.cpp
+++ b/src/qml/jsruntime/qv4vme_moth.cpp
@@ -451,7 +451,7 @@ QV4::ReturnedValue VME::run(ExecutionEngine *engine, const uchar *code
MOTH_END_INSTR(LoadRegExp)
MOTH_BEGIN_INSTR(LoadClosure)
- STOREVALUE(instr.result, Runtime::closure(engine, instr.value));
+ STOREVALUE(instr.result, engine->runtime.closure(engine, instr.value));
MOTH_END_INSTR(LoadClosure)
MOTH_BEGIN_INSTR(LoadName)
@@ -646,36 +646,36 @@ QV4::ReturnedValue VME::run(ExecutionEngine *engine, const uchar *code
MOTH_END_INSTR(SetExceptionHandler)
MOTH_BEGIN_INSTR(CallBuiltinThrow)
- Runtime::throwException(engine, VALUE(instr.arg));
+ engine->runtime.throwException(engine, VALUE(instr.arg));
CHECK_EXCEPTION;
MOTH_END_INSTR(CallBuiltinThrow)
MOTH_BEGIN_INSTR(CallBuiltinUnwindException)
- STOREVALUE(instr.result, Runtime::unwindException(engine));
+ STOREVALUE(instr.result, engine->runtime.unwindException(engine));
MOTH_END_INSTR(CallBuiltinUnwindException)
MOTH_BEGIN_INSTR(CallBuiltinPushCatchScope)
- Runtime::pushCatchScope(static_cast<QV4::NoThrowEngine*>(engine), instr.name);
+ engine->runtime.pushCatchScope(static_cast<QV4::NoThrowEngine*>(engine), instr.name);
context = engine->currentContext;
MOTH_END_INSTR(CallBuiltinPushCatchScope)
MOTH_BEGIN_INSTR(CallBuiltinPushScope)
- Runtime::pushWithScope(VALUE(instr.arg), engine);
+ engine->runtime.pushWithScope(VALUE(instr.arg), engine);
context = engine->currentContext;
CHECK_EXCEPTION;
MOTH_END_INSTR(CallBuiltinPushScope)
MOTH_BEGIN_INSTR(CallBuiltinPopScope)
- Runtime::popScope(engine);
+ engine->runtime.popScope(engine);
context = engine->currentContext;
MOTH_END_INSTR(CallBuiltinPopScope)
MOTH_BEGIN_INSTR(CallBuiltinForeachIteratorObject)
- STOREVALUE(instr.result, Runtime::foreachIterator(engine, VALUE(instr.arg)));
+ STOREVALUE(instr.result, engine->runtime.foreachIterator(engine, VALUE(instr.arg)));
MOTH_END_INSTR(CallBuiltinForeachIteratorObject)
MOTH_BEGIN_INSTR(CallBuiltinForeachNextPropertyName)
- STOREVALUE(instr.result, Runtime::foreachNextPropertyName(VALUE(instr.arg)));
+ STOREVALUE(instr.result, engine->runtime.foreachNextPropertyName(VALUE(instr.arg)));
MOTH_END_INSTR(CallBuiltinForeachNextPropertyName)
MOTH_BEGIN_INSTR(CallBuiltinDeleteMember)
@@ -715,26 +715,26 @@ QV4::ReturnedValue VME::run(ExecutionEngine *engine, const uchar *code
MOTH_END_INSTR(CallBuiltinTypeofValue)
MOTH_BEGIN_INSTR(CallBuiltinDeclareVar)
- Runtime::declareVar(engine, instr.isDeletable, instr.varName);
+ engine->runtime.declareVar(engine, instr.isDeletable, instr.varName);
MOTH_END_INSTR(CallBuiltinDeclareVar)
MOTH_BEGIN_INSTR(CallBuiltinDefineArray)
Q_ASSERT(instr.args + instr.argc <= stackSize);
QV4::Value *args = stack + instr.args;
- STOREVALUE(instr.result, Runtime::arrayLiteral(engine, args, instr.argc));
+ STOREVALUE(instr.result, engine->runtime.arrayLiteral(engine, args, instr.argc));
MOTH_END_INSTR(CallBuiltinDefineArray)
MOTH_BEGIN_INSTR(CallBuiltinDefineObjectLiteral)
QV4::Value *args = stack + instr.args;
- STOREVALUE(instr.result, Runtime::objectLiteral(engine, args, instr.internalClassId, instr.arrayValueCount, instr.arrayGetterSetterCountAndFlags));
+ STOREVALUE(instr.result, engine->runtime.objectLiteral(engine, args, instr.internalClassId, instr.arrayValueCount, instr.arrayGetterSetterCountAndFlags));
MOTH_END_INSTR(CallBuiltinDefineObjectLiteral)
MOTH_BEGIN_INSTR(CallBuiltinSetupArgumentsObject)
- STOREVALUE(instr.result, Runtime::setupArgumentsObject(engine));
+ STOREVALUE(instr.result, engine->runtime.setupArgumentsObject(engine));
MOTH_END_INSTR(CallBuiltinSetupArgumentsObject)
MOTH_BEGIN_INSTR(CallBuiltinConvertThisToObject)
- Runtime::convertThisToObject(engine);
+ engine->runtime.convertThisToObject(engine);
CHECK_EXCEPTION;
MOTH_END_INSTR(CallBuiltinConvertThisToObject)