aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2014-11-11 16:07:54 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2014-11-12 12:13:54 +0100
commit9bad6eea0f30f6a6c1878c2773dc39071cb41584 (patch)
tree2306235d1db4f4abce697de2564a935229517bfd /src/qml
parent345a5ee67bf80f7c18869fe080bf7dd7cf4a0d90 (diff)
Change signature or runtime methods to take an engine pointer
This makes a lot more sense in the long term and is the more maintainable solution, once the GC starts moving objects around in memory Change-Id: I8f327c0f5b5b0af38c5fe1a217852ee8c4a5c2fc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/jit/qv4assembler.cpp19
-rw-r--r--src/qml/jit/qv4assembler_p.h21
-rw-r--r--src/qml/jit/qv4binop.cpp2
-rw-r--r--src/qml/jit/qv4isel_masm.cpp116
-rw-r--r--src/qml/jit/qv4targetplatform_p.h8
-rw-r--r--src/qml/jsruntime/qv4arraydata.cpp2
-rw-r--r--src/qml/jsruntime/qv4engine_p.h2
-rw-r--r--src/qml/jsruntime/qv4function.cpp2
-rw-r--r--src/qml/jsruntime/qv4function_p.h4
-rw-r--r--src/qml/jsruntime/qv4functionobject.cpp8
-rw-r--r--src/qml/jsruntime/qv4globalobject.cpp2
-rw-r--r--src/qml/jsruntime/qv4lookup.cpp44
-rw-r--r--src/qml/jsruntime/qv4lookup_p.h16
-rw-r--r--src/qml/jsruntime/qv4profiling_p.h10
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp372
-rw-r--r--src/qml/jsruntime/qv4runtime_p.h114
-rw-r--r--src/qml/jsruntime/qv4script.cpp4
-rw-r--r--src/qml/jsruntime/qv4vme_moth.cpp109
-rw-r--r--src/qml/jsruntime/qv4vme_moth_p.h4
19 files changed, 431 insertions, 428 deletions
diff --git a/src/qml/jit/qv4assembler.cpp b/src/qml/jit/qv4assembler.cpp
index 6e864efa38..afbdeeb10b 100644
--- a/src/qml/jit/qv4assembler.cpp
+++ b/src/qml/jit/qv4assembler.cpp
@@ -68,7 +68,7 @@ void CompilationUnit::linkBackendToEngine(ExecutionEngine *engine)
const CompiledData::Function *compiledFunction = data->functionAt(i);
QV4::Function *runtimeFunction = new QV4::Function(engine, this, compiledFunction,
- (ReturnedValue (*)(QV4::ExecutionContext *, const uchar *)) codeRefs[i].code().executableAddress());
+ (ReturnedValue (*)(QV4::ExecutionEngine *, const uchar *)) codeRefs[i].code().executableAddress());
runtimeFunctions[i] = runtimeFunction;
}
}
@@ -182,25 +182,24 @@ Assembler::Pointer Assembler::loadArgLocalAddress(RegisterID baseReg, IR::ArgLoc
{
int32_t offset = 0;
int scope = al->scope;
- RegisterID context = ContextRegister;
+ loadPtr(Address(EngineRegister, qOffsetOf(ExecutionEngine, current)), baseReg);
if (scope) {
- loadPtr(Address(ContextRegister, qOffsetOf(ExecutionContext::Data, outer)), baseReg);
+ loadPtr(Address(baseReg, qOffsetOf(ExecutionContext::Data, outer)), baseReg);
--scope;
- context = baseReg;
while (scope) {
- loadPtr(Address(context, qOffsetOf(ExecutionContext::Data, outer)), context);
+ loadPtr(Address(baseReg, qOffsetOf(ExecutionContext::Data, outer)), baseReg);
--scope;
}
}
switch (al->kind) {
case IR::ArgLocal::Formal:
case IR::ArgLocal::ScopedFormal: {
- loadPtr(Address(context, qOffsetOf(ExecutionContext::Data, callData)), baseReg);
+ loadPtr(Address(baseReg, qOffsetOf(ExecutionContext::Data, callData)), baseReg);
offset = sizeof(CallData) + (al->index - 1) * sizeof(Value);
} break;
case IR::ArgLocal::Local:
case IR::ArgLocal::ScopedLocal: {
- loadPtr(Address(context, qOffsetOf(CallContext::Data, locals)), baseReg);
+ loadPtr(Address(baseReg, qOffsetOf(CallContext::Data, locals)), baseReg);
offset = al->index * sizeof(Value);
} break;
default:
@@ -211,7 +210,8 @@ Assembler::Pointer Assembler::loadArgLocalAddress(RegisterID baseReg, IR::ArgLoc
Assembler::Pointer Assembler::loadStringAddress(RegisterID reg, const QString &string)
{
- loadPtr(Address(Assembler::ContextRegister, qOffsetOf(QV4::Heap::ExecutionContext, compilationUnit)), Assembler::ScratchRegister);
+ loadPtr(Address(Assembler::EngineRegister, qOffsetOf(QV4::ExecutionEngine, current)), Assembler::ScratchRegister);
+ loadPtr(Address(Assembler::ScratchRegister, qOffsetOf(QV4::Heap::ExecutionContext, compilationUnit)), Assembler::ScratchRegister);
loadPtr(Address(Assembler::ScratchRegister, qOffsetOf(QV4::CompiledData::CompilationUnit, runtimeStrings)), reg);
const int id = _isel->registerString(string);
return Pointer(reg, id * sizeof(QV4::String*));
@@ -219,7 +219,8 @@ Assembler::Pointer Assembler::loadStringAddress(RegisterID reg, const QString &s
void Assembler::loadStringRef(RegisterID reg, const QString &string)
{
- loadPtr(Address(Assembler::ContextRegister, qOffsetOf(QV4::Heap::ExecutionContext, compilationUnit)), reg);
+ loadPtr(Address(Assembler::EngineRegister, qOffsetOf(QV4::ExecutionEngine, current)), reg);
+ loadPtr(Address(reg, qOffsetOf(QV4::Heap::ExecutionContext, compilationUnit)), reg);
loadPtr(Address(reg, qOffsetOf(QV4::CompiledData::CompilationUnit, runtimeStrings)), reg);
const int id = _isel->registerString(string);
loadPtr(Address(reg, id * sizeof(QV4::String*)), reg);
diff --git a/src/qml/jit/qv4assembler_p.h b/src/qml/jit/qv4assembler_p.h
index 1de7da37b4..a4105550c6 100644
--- a/src/qml/jit/qv4assembler_p.h
+++ b/src/qml/jit/qv4assembler_p.h
@@ -101,27 +101,27 @@ struct ExceptionCheck {
};
// push_catch and pop context methods shouldn't check for exceptions
template <>
-struct ExceptionCheck<QV4::ExecutionContext *(*)(QV4::ExecutionContext *)> {
+struct ExceptionCheck<void (*)(QV4::ExecutionEngine *)> {
enum { NeedsCheck = 0 };
};
template <typename A>
-struct ExceptionCheck<QV4::ExecutionContext *(*)(QV4::ExecutionContext *, A)> {
+struct ExceptionCheck<void (*)(A, QV4::NoThrowEngine)> {
enum { NeedsCheck = 0 };
};
template <>
-struct ExceptionCheck<QV4::ReturnedValue (*)(QV4::NoThrowContext *)> {
+struct ExceptionCheck<QV4::ReturnedValue (*)(QV4::NoThrowEngine *)> {
enum { NeedsCheck = 0 };
};
template <typename A>
-struct ExceptionCheck<QV4::ReturnedValue (*)(QV4::NoThrowContext *, A)> {
+struct ExceptionCheck<QV4::ReturnedValue (*)(QV4::NoThrowEngine *, A)> {
enum { NeedsCheck = 0 };
};
template <typename A, typename B>
-struct ExceptionCheck<QV4::ReturnedValue (*)(QV4::NoThrowContext *, A, B)> {
+struct ExceptionCheck<QV4::ReturnedValue (*)(QV4::NoThrowEngine *, A, B)> {
enum { NeedsCheck = 0 };
};
template <typename A, typename B, typename C>
-struct ExceptionCheck<void (*)(QV4::NoThrowContext *, A, B, C)> {
+struct ExceptionCheck<void (*)(QV4::NoThrowEngine *, A, B, C)> {
enum { NeedsCheck = 0 };
};
@@ -797,8 +797,7 @@ public:
const RegisterInformation &fpRegistersToSave);
void checkException() {
- loadPtr(Address(ContextRegister, qOffsetOf(QV4::Heap::ExecutionContext, engine)), ScratchRegister);
- load32(Address(ScratchRegister, qOffsetOf(QV4::ExecutionEngine, hasException)), ScratchRegister);
+ load32(Address(EngineRegister, qOffsetOf(QV4::ExecutionEngine, hasException)), ScratchRegister);
Jump exceptionThrown = branch32(NotEqual, ScratchRegister, TrustedImm32(0));
if (catchBlock)
addPatch(catchBlock, exceptionThrown);
@@ -1226,7 +1225,8 @@ template <typename T> inline bool prepareCall(T &, Assembler *)
template <> inline bool prepareCall(RelativeCall &relativeCall, Assembler *as)
{
- as->loadPtr(Assembler::Address(Assembler::ContextRegister, qOffsetOf(QV4::Heap::ExecutionContext, lookups)),
+ as->loadPtr(Assembler::Address(Assembler::EngineRegister, qOffsetOf(QV4::ExecutionEngine, current)), Assembler::ScratchRegister);
+ as->loadPtr(Assembler::Address(Assembler::ScratchRegister, qOffsetOf(QV4::Heap::ExecutionContext, lookups)),
relativeCall.addr.base);
return true;
}
@@ -1236,7 +1236,8 @@ template <> inline bool prepareCall(LookupCall &lookupCall, Assembler *as)
// IMPORTANT! See generateLookupCall in qv4isel_masm_p.h for details!
// same as prepareCall(RelativeCall ....) : load the table from the context
- as->loadPtr(Assembler::Address(Assembler::ContextRegister, qOffsetOf(QV4::Heap::ExecutionContext, lookups)),
+ as->loadPtr(Assembler::Address(Assembler::EngineRegister, qOffsetOf(QV4::ExecutionEngine, current)), Assembler::ScratchRegister);
+ as->loadPtr(Assembler::Address(Assembler::ScratchRegister, qOffsetOf(QV4::Heap::ExecutionContext, lookups)),
lookupCall.addr.base);
// pre-calculate the indirect address for the lookupCall table:
if (lookupCall.addr.offset)
diff --git a/src/qml/jit/qv4binop.cpp b/src/qml/jit/qv4binop.cpp
index a2d4815cf2..0dce879fa1 100644
--- a/src/qml/jit/qv4binop.cpp
+++ b/src/qml/jit/qv4binop.cpp
@@ -125,7 +125,7 @@ void Binop::generate(IR::Expr *lhs, IR::Expr *rhs, IR::Expr *target)
Assembler::PointerToValue(rhs));
} else if (info.contextImplementation) {
as->generateFunctionCallImp(target, info.name, info.contextImplementation,
- Assembler::ContextRegister,
+ Assembler::EngineRegister,
Assembler::PointerToValue(lhs),
Assembler::PointerToValue(rhs));
} else {
diff --git a/src/qml/jit/qv4isel_masm.cpp b/src/qml/jit/qv4isel_masm.cpp
index 9ff33feff2..5c441a1edf 100644
--- a/src/qml/jit/qv4isel_masm.cpp
+++ b/src/qml/jit/qv4isel_masm.cpp
@@ -239,16 +239,15 @@ void InstructionSelection::run(int functionIndex)
_as->enterStandardStackFrame(regularRegistersToSave, fpRegistersToSave);
#ifdef ARGUMENTS_IN_REGISTERS
- _as->move(_as->registerForArgument(0), Assembler::ContextRegister);
+ _as->move(_as->registerForArgument(0), Assembler::EngineRegister);
#else
- _as->loadPtr(addressForArgument(0), Assembler::ContextRegister);
+ _as->loadPtr(addressForArgument(0), Assembler::EngineRegister);
#endif
const int locals = _as->stackLayout().calculateJSStackFrameSize();
- _as->loadPtr(Address(Assembler::ContextRegister, qOffsetOf(ExecutionContext::Data, engine)), Assembler::ScratchRegister);
- _as->loadPtr(Address(Assembler::ScratchRegister, qOffsetOf(ExecutionEngine, jsStackTop)), Assembler::LocalsRegister);
+ _as->loadPtr(Address(Assembler::EngineRegister, qOffsetOf(ExecutionEngine, jsStackTop)), Assembler::LocalsRegister);
_as->addPtr(Assembler::TrustedImm32(sizeof(QV4::Value)*locals), Assembler::LocalsRegister);
- _as->storePtr(Assembler::LocalsRegister, Address(Assembler::ScratchRegister, qOffsetOf(ExecutionEngine, jsStackTop)));
+ _as->storePtr(Assembler::LocalsRegister, Address(Assembler::EngineRegister, qOffsetOf(ExecutionEngine, jsStackTop)));
int lastLine = 0;
for (int i = 0, ei = _function->basicBlockCount(); i != ei; ++i) {
@@ -261,7 +260,8 @@ void InstructionSelection::run(int functionIndex)
foreach (IR::Stmt *s, _block->statements()) {
if (s->location.isValid()) {
if (int(s->location.startLine) != lastLine) {
- Assembler::Address lineAddr(Assembler::ContextRegister, qOffsetOf(QV4::ExecutionContext::Data, lineNumber));
+ _as->loadPtr(Address(Assembler::EngineRegister, qOffsetOf(QV4::ExecutionEngine, current)), Assembler::ScratchRegister);
+ Assembler::Address lineAddr(Assembler::ScratchRegister, qOffsetOf(QV4::ExecutionContext::Data, lineNumber));
_as->store32(Assembler::TrustedImm32(s->location.startLine), lineAddr);
lastLine = s->location.startLine;
}
@@ -307,12 +307,12 @@ void InstructionSelection::callBuiltinInvalid(IR::Name *func, IR::ExprList *args
if (useFastLookups && func->global) {
uint index = registerGlobalGetterLookup(*func->id);
generateFunctionCall(result, Runtime::callGlobalLookup,
- Assembler::ContextRegister,
+ Assembler::EngineRegister,
Assembler::TrustedImm32(index),
baseAddressForCallData());
} else {
generateFunctionCall(result, Runtime::callActivationProperty,
- Assembler::ContextRegister,
+ Assembler::EngineRegister,
Assembler::PointerToString(*func->id),
baseAddressForCallData());
}
@@ -321,7 +321,7 @@ void InstructionSelection::callBuiltinInvalid(IR::Name *func, IR::ExprList *args
void InstructionSelection::callBuiltinTypeofMember(IR::Expr *base, const QString &name,
IR::Expr *result)
{
- generateFunctionCall(result, Runtime::typeofMember, Assembler::ContextRegister,
+ generateFunctionCall(result, Runtime::typeofMember, Assembler::EngineRegister,
Assembler::PointerToValue(base), Assembler::PointerToString(name));
}
@@ -329,38 +329,38 @@ void InstructionSelection::callBuiltinTypeofSubscript(IR::Expr *base, IR::Expr *
IR::Expr *result)
{
generateFunctionCall(result, Runtime::typeofElement,
- Assembler::ContextRegister,
+ Assembler::EngineRegister,
Assembler::PointerToValue(base), Assembler::PointerToValue(index));
}
void InstructionSelection::callBuiltinTypeofName(const QString &name, IR::Expr *result)
{
- generateFunctionCall(result, Runtime::typeofName, Assembler::ContextRegister,
+ generateFunctionCall(result, Runtime::typeofName, Assembler::EngineRegister,
Assembler::PointerToString(name));
}
void InstructionSelection::callBuiltinTypeofValue(IR::Expr *value, IR::Expr *result)
{
- generateFunctionCall(result, Runtime::typeofValue, Assembler::ContextRegister,
+ generateFunctionCall(result, Runtime::typeofValue, Assembler::EngineRegister,
Assembler::PointerToValue(value));
}
void InstructionSelection::callBuiltinDeleteMember(IR::Expr *base, const QString &name, IR::Expr *result)
{
- generateFunctionCall(result, Runtime::deleteMember, Assembler::ContextRegister,
+ generateFunctionCall(result, Runtime::deleteMember, Assembler::EngineRegister,
Assembler::Reference(base), Assembler::PointerToString(name));
}
void InstructionSelection::callBuiltinDeleteSubscript(IR::Expr *base, IR::Expr *index,
IR::Expr *result)
{
- generateFunctionCall(result, Runtime::deleteElement, Assembler::ContextRegister,
+ generateFunctionCall(result, Runtime::deleteElement, Assembler::EngineRegister,
Assembler::Reference(base), Assembler::PointerToValue(index));
}
void InstructionSelection::callBuiltinDeleteName(const QString &name, IR::Expr *result)
{
- generateFunctionCall(result, Runtime::deleteName, Assembler::ContextRegister,
+ generateFunctionCall(result, Runtime::deleteName, Assembler::EngineRegister,
Assembler::PointerToString(name));
}
@@ -371,7 +371,7 @@ void InstructionSelection::callBuiltinDeleteValue(IR::Expr *result)
void InstructionSelection::callBuiltinThrow(IR::Expr *arg)
{
- generateFunctionCall(Assembler::ReturnValueRegister, Runtime::throwException, Assembler::ContextRegister,
+ generateFunctionCall(Assembler::ReturnValueRegister, Runtime::throwException, Assembler::EngineRegister,
Assembler::PointerToValue(arg));
}
@@ -382,13 +382,13 @@ void InstructionSelection::callBuiltinReThrow()
void InstructionSelection::callBuiltinUnwindException(IR::Expr *result)
{
- generateFunctionCall(result, Runtime::unwindException, Assembler::ContextRegister);
+ generateFunctionCall(result, Runtime::unwindException, Assembler::EngineRegister);
}
void InstructionSelection::callBuiltinPushCatchScope(const QString &exceptionName)
{
- generateFunctionCall(Assembler::ContextRegister, Runtime::pushCatchScope, Assembler::ContextRegister, Assembler::PointerToString(exceptionName));
+ generateFunctionCall(Assembler::Void, Runtime::pushCatchScope, Assembler::EngineRegister, Assembler::PointerToString(exceptionName));
}
void InstructionSelection::callBuiltinForeachIteratorObject(IR::Expr *arg, IR::Expr *result)
@@ -396,7 +396,7 @@ void InstructionSelection::callBuiltinForeachIteratorObject(IR::Expr *arg, IR::E
Q_ASSERT(arg);
Q_ASSERT(result);
- generateFunctionCall(result, Runtime::foreachIterator, Assembler::ContextRegister, Assembler::PointerToValue(arg));
+ generateFunctionCall(result, Runtime::foreachIterator, Assembler::EngineRegister, Assembler::PointerToValue(arg));
}
void InstructionSelection::callBuiltinForeachNextPropertyname(IR::Expr *arg, IR::Expr *result)
@@ -411,17 +411,17 @@ void InstructionSelection::callBuiltinPushWithScope(IR::Expr *arg)
{
Q_ASSERT(arg);
- generateFunctionCall(Assembler::ContextRegister, Runtime::pushWithScope, Assembler::Reference(arg), Assembler::ContextRegister);
+ generateFunctionCall(Assembler::Void, Runtime::pushWithScope, Assembler::Reference(arg), Assembler::EngineRegister);
}
void InstructionSelection::callBuiltinPopScope()
{
- generateFunctionCall(Assembler::ContextRegister, Runtime::popScope, Assembler::ContextRegister);
+ generateFunctionCall(Assembler::Void, Runtime::popScope, Assembler::EngineRegister);
}
void InstructionSelection::callBuiltinDeclareVar(bool deletable, const QString &name)
{
- generateFunctionCall(Assembler::Void, Runtime::declareVar, Assembler::ContextRegister,
+ generateFunctionCall(Assembler::Void, Runtime::declareVar, Assembler::EngineRegister,
Assembler::TrustedImm32(deletable), Assembler::PointerToString(name));
}
@@ -430,7 +430,7 @@ void InstructionSelection::callBuiltinDefineArray(IR::Expr *result, IR::ExprList
Q_ASSERT(result);
int length = prepareVariableArguments(args);
- generateFunctionCall(result, Runtime::arrayLiteral, Assembler::ContextRegister,
+ generateFunctionCall(result, Runtime::arrayLiteral, Assembler::EngineRegister,
baseAddressForCallArguments(), Assembler::TrustedImm32(length));
}
@@ -510,19 +510,19 @@ void InstructionSelection::callBuiltinDefineObjectLiteral(IR::Expr *result, int
it = it->next;
}
- generateFunctionCall(result, Runtime::objectLiteral, Assembler::ContextRegister,
+ generateFunctionCall(result, Runtime::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::ContextRegister);
+ generateFunctionCall(result, Runtime::setupArgumentsObject, Assembler::EngineRegister);
}
void InstructionSelection::callBuiltinConvertThisToObject()
{
- generateFunctionCall(Assembler::Void, Runtime::convertThisToObject, Assembler::ContextRegister);
+ generateFunctionCall(Assembler::Void, Runtime::convertThisToObject, Assembler::EngineRegister);
}
void InstructionSelection::callValue(IR::Expr *value, IR::ExprList *args, IR::Expr *result)
@@ -531,18 +531,19 @@ void InstructionSelection::callValue(IR::Expr *value, IR::ExprList *args, IR::Ex
prepareCallData(args, 0);
if (value->asConst())
- generateFunctionCall(result, Runtime::callValue, Assembler::ContextRegister,
+ generateFunctionCall(result, Runtime::callValue, Assembler::EngineRegister,
Assembler::PointerToValue(value),
baseAddressForCallData());
else
- generateFunctionCall(result, Runtime::callValue, Assembler::ContextRegister,
+ generateFunctionCall(result, Runtime::callValue, Assembler::EngineRegister,
Assembler::Reference(value),
baseAddressForCallData());
}
void InstructionSelection::loadThisObject(IR::Expr *temp)
{
- _as->loadPtr(Address(Assembler::ContextRegister, qOffsetOf(ExecutionContext::Data, callData)), Assembler::ScratchRegister);
+ _as->loadPtr(Address(Assembler::EngineRegister, qOffsetOf(QV4::ExecutionEngine, current)), Assembler::ScratchRegister);
+ _as->loadPtr(Address(Assembler::ScratchRegister, qOffsetOf(ExecutionContext::Data, callData)), Assembler::ScratchRegister);
#if defined(VALUE_FITS_IN_REGISTER)
_as->load64(Pointer(Assembler::ScratchRegister, qOffsetOf(CallData, thisObject)),
Assembler::ReturnValueRegister);
@@ -554,27 +555,27 @@ void InstructionSelection::loadThisObject(IR::Expr *temp)
void InstructionSelection::loadQmlIdArray(IR::Expr *temp)
{
- generateFunctionCall(temp, Runtime::getQmlIdArray, Assembler::ContextRegister);
+ generateFunctionCall(temp, Runtime::getQmlIdArray, Assembler::EngineRegister);
}
void InstructionSelection::loadQmlImportedScripts(IR::Expr *temp)
{
- generateFunctionCall(temp, Runtime::getQmlImportedScripts, Assembler::ContextRegister);
+ generateFunctionCall(temp, Runtime::getQmlImportedScripts, Assembler::EngineRegister);
}
void InstructionSelection::loadQmlContextObject(IR::Expr *temp)
{
- generateFunctionCall(temp, Runtime::getQmlContextObject, Assembler::ContextRegister);
+ generateFunctionCall(temp, Runtime::getQmlContextObject, Assembler::EngineRegister);
}
void InstructionSelection::loadQmlScopeObject(IR::Expr *temp)
{
- generateFunctionCall(temp, Runtime::getQmlScopeObject, Assembler::ContextRegister);
+ generateFunctionCall(temp, Runtime::getQmlScopeObject, Assembler::EngineRegister);
}
void InstructionSelection::loadQmlSingleton(const QString &name, IR::Expr *temp)
{
- generateFunctionCall(temp, Runtime::getQmlSingleton, Assembler::ContextRegister, Assembler::PointerToString(name));
+ generateFunctionCall(temp, Runtime::getQmlSingleton, Assembler::EngineRegister, Assembler::PointerToString(name));
}
void InstructionSelection::loadConst(IR::Const *sourceConst, IR::Expr *target)
@@ -621,30 +622,30 @@ 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::ContextRegister, Assembler::TrustedImm32(id));
+ generateFunctionCall(target, Runtime::regexpLiteral, Assembler::EngineRegister, Assembler::TrustedImm32(id));
}
void InstructionSelection::getActivationProperty(const IR::Name *name, IR::Expr *target)
{
if (useFastLookups && name->global) {
uint index = registerGlobalGetterLookup(*name->id);
- generateLookupCall(target, index, qOffsetOf(QV4::Lookup, globalGetter), Assembler::ContextRegister, Assembler::Void);
+ generateLookupCall(target, index, qOffsetOf(QV4::Lookup, globalGetter), Assembler::EngineRegister, Assembler::Void);
return;
}
- generateFunctionCall(target, Runtime::getActivationProperty, Assembler::ContextRegister, Assembler::PointerToString(*name->id));
+ generateFunctionCall(target, Runtime::getActivationProperty, Assembler::EngineRegister, Assembler::PointerToString(*name->id));
}
void InstructionSelection::setActivationProperty(IR::Expr *source, const QString &targetName)
{
// ### should use a lookup call here
generateFunctionCall(Assembler::Void, Runtime::setActivationProperty,
- Assembler::ContextRegister, Assembler::PointerToString(targetName), Assembler::PointerToValue(source));
+ Assembler::EngineRegister, Assembler::PointerToString(targetName), Assembler::PointerToValue(source));
}
void InstructionSelection::initClosure(IR::Closure *closure, IR::Expr *target)
{
int id = closure->value;
- generateFunctionCall(target, Runtime::closure, Assembler::ContextRegister, Assembler::TrustedImm32(id));
+ generateFunctionCall(target, Runtime::closure, Assembler::EngineRegister, Assembler::TrustedImm32(id));
}
void InstructionSelection::getProperty(IR::Expr *base, const QString &name, IR::Expr *target)
@@ -653,7 +654,7 @@ void InstructionSelection::getProperty(IR::Expr *base, const QString &name, IR::
uint index = registerGetterLookup(name);
generateLookupCall(target, index, qOffsetOf(QV4::Lookup, getter), Assembler::PointerToValue(base), Assembler::Void);
} else {
- generateFunctionCall(target, Runtime::getProperty, Assembler::ContextRegister,
+ generateFunctionCall(target, Runtime::getProperty, Assembler::EngineRegister,
Assembler::PointerToValue(base), Assembler::PointerToString(name));
}
}
@@ -661,12 +662,12 @@ void InstructionSelection::getProperty(IR::Expr *base, const QString &name, IR::
void InstructionSelection::getQObjectProperty(IR::Expr *base, int propertyIndex, bool captureRequired, bool isSingleton, int attachedPropertiesId, IR::Expr *target)
{
if (attachedPropertiesId != 0)
- generateFunctionCall(target, Runtime::getQmlAttachedProperty, Assembler::ContextRegister, Assembler::TrustedImm32(attachedPropertiesId), Assembler::TrustedImm32(propertyIndex));
+ generateFunctionCall(target, Runtime::getQmlAttachedProperty, Assembler::EngineRegister, Assembler::TrustedImm32(attachedPropertiesId), Assembler::TrustedImm32(propertyIndex));
else if (isSingleton)
- generateFunctionCall(target, Runtime::getQmlSingletonQObjectProperty, Assembler::ContextRegister, Assembler::PointerToValue(base), Assembler::TrustedImm32(propertyIndex),
+ generateFunctionCall(target, Runtime::getQmlSingletonQObjectProperty, Assembler::EngineRegister, Assembler::PointerToValue(base), Assembler::TrustedImm32(propertyIndex),
Assembler::TrustedImm32(captureRequired));
else
- generateFunctionCall(target, Runtime::getQmlQObjectProperty, Assembler::ContextRegister, Assembler::PointerToValue(base), Assembler::TrustedImm32(propertyIndex),
+ generateFunctionCall(target, Runtime::getQmlQObjectProperty, Assembler::EngineRegister, Assembler::PointerToValue(base), Assembler::TrustedImm32(propertyIndex),
Assembler::TrustedImm32(captureRequired));
}
@@ -679,7 +680,7 @@ void InstructionSelection::setProperty(IR::Expr *source, IR::Expr *targetBase,
Assembler::PointerToValue(targetBase),
Assembler::PointerToValue(source));
} else {
- generateFunctionCall(Assembler::Void, Runtime::setProperty, Assembler::ContextRegister,
+ generateFunctionCall(Assembler::Void, Runtime::setProperty, Assembler::EngineRegister,
Assembler::PointerToValue(targetBase), Assembler::PointerToString(targetName),
Assembler::PointerToValue(source));
}
@@ -687,7 +688,7 @@ void InstructionSelection::setProperty(IR::Expr *source, IR::Expr *targetBase,
void InstructionSelection::setQObjectProperty(IR::Expr *source, IR::Expr *targetBase, int propertyIndex)
{
- generateFunctionCall(Assembler::Void, Runtime::setQmlQObjectProperty, Assembler::ContextRegister, Assembler::PointerToValue(targetBase),
+ generateFunctionCall(Assembler::Void, Runtime::setQmlQObjectProperty, Assembler::EngineRegister, Assembler::PointerToValue(targetBase),
Assembler::TrustedImm32(propertyIndex), Assembler::PointerToValue(source));
}
@@ -701,7 +702,7 @@ void InstructionSelection::getElement(IR::Expr *base, IR::Expr *index, IR::Expr
return;
}
- generateFunctionCall(target, Runtime::getElement, Assembler::ContextRegister,
+ generateFunctionCall(target, Runtime::getElement, Assembler::EngineRegister,
Assembler::PointerToValue(base), Assembler::PointerToValue(index));
}
@@ -714,7 +715,7 @@ void InstructionSelection::setElement(IR::Expr *source, IR::Expr *targetBase, IR
Assembler::PointerToValue(source));
return;
}
- generateFunctionCall(Assembler::Void, Runtime::setElement, Assembler::ContextRegister,
+ generateFunctionCall(Assembler::Void, Runtime::setElement, Assembler::EngineRegister,
Assembler::PointerToValue(targetBase), Assembler::PointerToValue(targetIndex),
Assembler::PointerToValue(source));
}
@@ -888,11 +889,11 @@ void InstructionSelection::callProperty(IR::Expr *base, const QString &name, IR:
if (useFastLookups) {
uint index = registerGetterLookup(name);
generateFunctionCall(result, Runtime::callPropertyLookup,
- Assembler::ContextRegister,
+ Assembler::EngineRegister,
Assembler::TrustedImm32(index),
baseAddressForCallData());
} else {
- generateFunctionCall(result, Runtime::callProperty, Assembler::ContextRegister,
+ generateFunctionCall(result, Runtime::callProperty, Assembler::EngineRegister,
Assembler::PointerToString(name),
baseAddressForCallData());
}
@@ -904,7 +905,7 @@ void InstructionSelection::callSubscript(IR::Expr *base, IR::Expr *index, IR::Ex
Q_ASSERT(base != 0);
prepareCallData(args, base);
- generateFunctionCall(result, Runtime::callElement, Assembler::ContextRegister,
+ generateFunctionCall(result, Runtime::callElement, Assembler::EngineRegister,
Assembler::PointerToValue(index),
baseAddressForCallData());
}
@@ -1214,13 +1215,13 @@ void InstructionSelection::constructActivationProperty(IR::Name *func, IR::ExprL
if (useFastLookups && func->global) {
uint index = registerGlobalGetterLookup(*func->id);
generateFunctionCall(result, Runtime::constructGlobalLookup,
- Assembler::ContextRegister,
+ Assembler::EngineRegister,
Assembler::TrustedImm32(index), baseAddressForCallData());
return;
}
generateFunctionCall(result, Runtime::constructActivationProperty,
- Assembler::ContextRegister,
+ Assembler::EngineRegister,
Assembler::PointerToString(*func->id),
baseAddressForCallData());
}
@@ -1232,13 +1233,13 @@ void InstructionSelection::constructProperty(IR::Expr *base, const QString &name
if (useFastLookups) {
uint index = registerGetterLookup(name);
generateFunctionCall(result, Runtime::constructPropertyLookup,
- Assembler::ContextRegister,
+ Assembler::EngineRegister,
Assembler::TrustedImm32(index),
baseAddressForCallData());
return;
}
- generateFunctionCall(result, Runtime::constructProperty, Assembler::ContextRegister,
+ generateFunctionCall(result, Runtime::constructProperty, Assembler::EngineRegister,
Assembler::PointerToString(name),
baseAddressForCallData());
}
@@ -1249,7 +1250,7 @@ void InstructionSelection::constructValue(IR::Expr *value, IR::ExprList *args, I
prepareCallData(args, 0);
generateFunctionCall(result, Runtime::constructValue,
- Assembler::ContextRegister,
+ Assembler::EngineRegister,
Assembler::Reference(value),
baseAddressForCallData());
}
@@ -1340,7 +1341,7 @@ void InstructionSelection::visitCJump(IR::CJump *s)
// elimination (which isn't there either) would remove the whole else block.
if (opContext)
_as->generateFunctionCallImp(Assembler::ReturnValueRegister, opName, opContext,
- Assembler::ContextRegister,
+ Assembler::EngineRegister,
Assembler::PointerToValue(b->left),
Assembler::PointerToValue(b->right));
else
@@ -1466,7 +1467,8 @@ void InstructionSelection::visitRet(IR::Ret *s)
const int locals = _as->stackLayout().calculateJSStackFrameSize();
_as->subPtr(Assembler::TrustedImm32(sizeof(QV4::Value)*locals), Assembler::LocalsRegister);
- _as->loadPtr(Address(Assembler::ContextRegister, qOffsetOf(ExecutionContext::Data, engine)), Assembler::ScratchRegister);
+ _as->loadPtr(Address(Assembler::EngineRegister, qOffsetOf(QV4::ExecutionEngine, current)), Assembler::ScratchRegister);
+ _as->loadPtr(Address(Assembler::ScratchRegister, qOffsetOf(ExecutionContext::Data, engine)), Assembler::ScratchRegister);
_as->storePtr(Assembler::LocalsRegister, Address(Assembler::ScratchRegister, qOffsetOf(ExecutionEngine, jsStackTop)));
_as->leaveStandardStackFrame(regularRegistersToSave, fpRegistersToSave);
diff --git a/src/qml/jit/qv4targetplatform_p.h b/src/qml/jit/qv4targetplatform_p.h
index 17098d6aad..922f951e48 100644
--- a/src/qml/jit/qv4targetplatform_p.h
+++ b/src/qml/jit/qv4targetplatform_p.h
@@ -71,7 +71,7 @@ public:
static const JSC::MacroAssembler::RegisterID StackFrameRegister = JSC::X86Registers::ebp;
static const JSC::MacroAssembler::RegisterID StackPointerRegister = JSC::X86Registers::esp;
static const JSC::MacroAssembler::RegisterID LocalsRegister = JSC::X86Registers::edi;
- static const JSC::MacroAssembler::RegisterID ContextRegister = JSC::X86Registers::esi;
+ static const JSC::MacroAssembler::RegisterID EngineRegister = JSC::X86Registers::esi;
static const JSC::MacroAssembler::RegisterID ReturnValueRegister = JSC::X86Registers::eax;
static const JSC::MacroAssembler::RegisterID ScratchRegister = JSC::X86Registers::ecx;
static const JSC::MacroAssembler::FPRegisterID FPGpr0 = JSC::X86Registers::xmm0;
@@ -140,7 +140,7 @@ public:
static const JSC::MacroAssembler::RegisterID StackFrameRegister = JSC::X86Registers::ebp;
static const JSC::MacroAssembler::RegisterID StackPointerRegister = JSC::X86Registers::esp;
static const JSC::MacroAssembler::RegisterID LocalsRegister = JSC::X86Registers::r12;
- static const JSC::MacroAssembler::RegisterID ContextRegister = JSC::X86Registers::r14;
+ static const JSC::MacroAssembler::RegisterID EngineRegister = JSC::X86Registers::r14;
static const JSC::MacroAssembler::RegisterID ReturnValueRegister = JSC::X86Registers::eax;
static const JSC::MacroAssembler::RegisterID ScratchRegister = JSC::X86Registers::r10;
static const JSC::MacroAssembler::FPRegisterID FPGpr0 = JSC::X86Registers::xmm0;
@@ -205,7 +205,7 @@ public:
static const JSC::MacroAssembler::RegisterID StackFrameRegister = JSC::X86Registers::ebp;
static const JSC::MacroAssembler::RegisterID StackPointerRegister = JSC::X86Registers::esp;
static const JSC::MacroAssembler::RegisterID LocalsRegister = JSC::X86Registers::r12;
- static const JSC::MacroAssembler::RegisterID ContextRegister = JSC::X86Registers::r14;
+ static const JSC::MacroAssembler::RegisterID EngineRegister = JSC::X86Registers::r14;
static const JSC::MacroAssembler::RegisterID ReturnValueRegister = JSC::X86Registers::eax;
static const JSC::MacroAssembler::RegisterID ScratchRegister = JSC::X86Registers::r10;
static const JSC::MacroAssembler::FPRegisterID FPGpr0 = JSC::X86Registers::xmm0;
@@ -277,7 +277,7 @@ public:
#endif
static const JSC::MacroAssembler::RegisterID StackPointerRegister = JSC::ARMRegisters::r13;
static const JSC::MacroAssembler::RegisterID ScratchRegister = JSC::ARMRegisters::r6;
- static const JSC::MacroAssembler::RegisterID ContextRegister = JSC::ARMRegisters::r5;
+ static const JSC::MacroAssembler::RegisterID EngineRegister = JSC::ARMRegisters::r5;
static const JSC::MacroAssembler::RegisterID ReturnValueRegister = JSC::ARMRegisters::r0;
static const JSC::MacroAssembler::FPRegisterID FPGpr0 = JSC::ARMRegisters::d0;
static const JSC::MacroAssembler::FPRegisterID FPGpr1 = JSC::ARMRegisters::d1;
diff --git a/src/qml/jsruntime/qv4arraydata.cpp b/src/qml/jsruntime/qv4arraydata.cpp
index d7af678402..20e8e8a053 100644
--- a/src/qml/jsruntime/qv4arraydata.cpp
+++ b/src/qml/jsruntime/qv4arraydata.cpp
@@ -675,7 +675,7 @@ bool ArrayElementLessThan::operator()(Value v1, Value v2) const
callData->thisObject = Primitive::undefinedValue();
callData->args[0] = v1;
callData->args[1] = v2;
- result = Runtime::callValue(m_context, m_comparefn, callData);
+ result = Runtime::callValue(scope.engine, m_comparefn, callData);
return result->toNumber() < 0;
}
diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h
index 8399513d5d..203bfdb90c 100644
--- a/src/qml/jsruntime/qv4engine_p.h
+++ b/src/qml/jsruntime/qv4engine_p.h
@@ -117,8 +117,8 @@ private:
friend struct ExecutionContextSaver;
friend struct ExecutionContext;
friend struct Heap::ExecutionContext;
- ExecutionContext *current;
public:
+ ExecutionContext *current;
ExecutionContext *currentContext() const { return current; }
Value *jsStackTop;
diff --git a/src/qml/jsruntime/qv4function.cpp b/src/qml/jsruntime/qv4function.cpp
index 292244e32a..48be89b40a 100644
--- a/src/qml/jsruntime/qv4function.cpp
+++ b/src/qml/jsruntime/qv4function.cpp
@@ -44,7 +44,7 @@ QT_BEGIN_NAMESPACE
using namespace QV4;
Function::Function(ExecutionEngine *engine, CompiledData::CompilationUnit *unit, const CompiledData::Function *function,
- ReturnedValue (*codePtr)(ExecutionContext *, const uchar *))
+ ReturnedValue (*codePtr)(ExecutionEngine *, const uchar *))
: compiledFunction(function)
, compilationUnit(unit)
, code(codePtr)
diff --git a/src/qml/jsruntime/qv4function_p.h b/src/qml/jsruntime/qv4function_p.h
index 63bbb01e74..8edb8c6be8 100644
--- a/src/qml/jsruntime/qv4function_p.h
+++ b/src/qml/jsruntime/qv4function_p.h
@@ -44,14 +44,14 @@ struct Q_QML_EXPORT Function {
const CompiledData::Function *compiledFunction;
CompiledData::CompilationUnit *compilationUnit;
- ReturnedValue (*code)(ExecutionContext *, const uchar *);
+ ReturnedValue (*code)(ExecutionEngine *, const uchar *);
const uchar *codeData;
// first nArguments names in internalClass are the actual arguments
InternalClass *internalClass;
Function(ExecutionEngine *engine, CompiledData::CompilationUnit *unit, const CompiledData::Function *function,
- ReturnedValue (*codePtr)(ExecutionContext *, const uchar *));
+ ReturnedValue (*codePtr)(ExecutionEngine *, const uchar *));
~Function();
inline String *name() {
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp
index cd860f4c2b..622a2b8232 100644
--- a/src/qml/jsruntime/qv4functionobject.cpp
+++ b/src/qml/jsruntime/qv4functionobject.cpp
@@ -391,7 +391,7 @@ ReturnedValue ScriptFunction::construct(Managed *that, CallData *callData)
Scoped<CallContext> ctx(scope, context->newCallContext(f.getPointer(), callData));
ExecutionContextSaver ctxSaver(context);
- ScopedValue result(scope, Q_V4_PROFILE(v4, ctx, f->function()));
+ ScopedValue result(scope, Q_V4_PROFILE(v4, f->function()));
if (f->function()->compiledFunction->hasQmlDependencies())
QmlContextWrapper::registerQmlDependencies(v4, f->function()->compiledFunction);
@@ -418,7 +418,7 @@ ReturnedValue ScriptFunction::call(Managed *that, CallData *callData)
Scoped<CallContext> ctx(scope, context->newCallContext(f, callData));
ExecutionContextSaver ctxSaver(context);
- ScopedValue result(scope, Q_V4_PROFILE(v4, ctx, f->function()));
+ ScopedValue result(scope, Q_V4_PROFILE(v4, f->function()));
if (f->function()->compiledFunction->hasQmlDependencies())
QmlContextWrapper::registerQmlDependencies(ctx->d()->engine, f->function()->compiledFunction);
@@ -487,7 +487,7 @@ ReturnedValue SimpleScriptFunction::construct(Managed *that, CallData *callData)
}
Q_ASSERT(v4->currentContext()->d() == &ctx);
- Scoped<Object> result(scope, Q_V4_PROFILE(v4, reinterpret_cast<CallContext *>(&ctx), f->function()));
+ Scoped<Object> result(scope, Q_V4_PROFILE(v4, f->function()));
if (f->function()->compiledFunction->hasQmlDependencies())
QmlContextWrapper::registerQmlDependencies(v4, f->function()->compiledFunction);
@@ -524,7 +524,7 @@ ReturnedValue SimpleScriptFunction::call(Managed *that, CallData *callData)
}
Q_ASSERT(v4->currentContext()->d() == &ctx);
- ScopedValue result(scope, Q_V4_PROFILE(v4, reinterpret_cast<CallContext *>(&ctx), f->function()));
+ ScopedValue result(scope, Q_V4_PROFILE(v4, f->function()));
if (f->function()->compiledFunction->hasQmlDependencies())
QmlContextWrapper::registerQmlDependencies(v4, f->function()->compiledFunction);
diff --git a/src/qml/jsruntime/qv4globalobject.cpp b/src/qml/jsruntime/qv4globalobject.cpp
index fd20a628cf..5baee5f4aa 100644
--- a/src/qml/jsruntime/qv4globalobject.cpp
+++ b/src/qml/jsruntime/qv4globalobject.cpp
@@ -404,7 +404,7 @@ ReturnedValue EvalFunction::evalCall(CallData *callData, bool directCall)
ctx->d()->strictMode = strictMode();
ctx->d()->compilationUnit = function->compilationUnit;
- return function->code(ctx, function->codeData);
+ return function->code(ctx->engine(), function->codeData);
}
diff --git a/src/qml/jsruntime/qv4lookup.cpp b/src/qml/jsruntime/qv4lookup.cpp
index 2435c9b3ff..f69d2c2c2f 100644
--- a/src/qml/jsruntime/qv4lookup.cpp
+++ b/src/qml/jsruntime/qv4lookup.cpp
@@ -572,9 +572,9 @@ ReturnedValue Lookup::arrayLengthGetter(Lookup *l, const ValueRef object)
}
-ReturnedValue Lookup::globalGetterGeneric(Lookup *l, ExecutionContext *ctx)
+ReturnedValue Lookup::globalGetterGeneric(Lookup *l, ExecutionEngine *engine)
{
- Object *o = ctx->d()->engine->globalObject;
+ Object *o = engine->globalObject;
PropertyAttributes attrs;
ReturnedValue v = l->lookup(o, &attrs);
if (v != Primitive::emptyValue().asReturnedValue()) {
@@ -596,35 +596,35 @@ ReturnedValue Lookup::globalGetterGeneric(Lookup *l, ExecutionContext *ctx)
return v;
}
}
- Scope scope(ctx);
+ Scope scope(engine);
Scoped<String> n(scope, l->name);
- return ctx->engine()->throwReferenceError(n);
+ return engine->throwReferenceError(n);
}
-ReturnedValue Lookup::globalGetter0(Lookup *l, ExecutionContext *ctx)
+ReturnedValue Lookup::globalGetter0(Lookup *l, ExecutionEngine *engine)
{
- Object *o = ctx->d()->engine->globalObject;
+ Object *o = engine->globalObject;
if (l->classList[0] == o->internalClass())
return o->memberData()->data()[l->index].asReturnedValue();
l->globalGetter = globalGetterGeneric;
- return globalGetterGeneric(l, ctx);
+ return globalGetterGeneric(l, engine);
}
-ReturnedValue Lookup::globalGetter1(Lookup *l, ExecutionContext *ctx)
+ReturnedValue Lookup::globalGetter1(Lookup *l, ExecutionEngine *engine)
{
- Object *o = ctx->d()->engine->globalObject;
+ Object *o = engine->globalObject;
if (l->classList[0] == o->internalClass() &&
l->classList[1] == o->prototype()->internalClass())
return o->prototype()->memberData()->data()[l->index].asReturnedValue();
l->globalGetter = globalGetterGeneric;
- return globalGetterGeneric(l, ctx);
+ return globalGetterGeneric(l, engine);
}
-ReturnedValue Lookup::globalGetter2(Lookup *l, ExecutionContext *ctx)
+ReturnedValue Lookup::globalGetter2(Lookup *l, ExecutionEngine *engine)
{
- Object *o = ctx->d()->engine->globalObject;
+ Object *o = engine->globalObject;
if (l->classList[0] == o->internalClass()) {
o = o->prototype();
if (l->classList[1] == o->internalClass()) {
@@ -635,12 +635,12 @@ ReturnedValue Lookup::globalGetter2(Lookup *l, ExecutionContext *ctx)
}
}
l->globalGetter = globalGetterGeneric;
- return globalGetterGeneric(l, ctx);
+ return globalGetterGeneric(l, engine);
}
-ReturnedValue Lookup::globalGetterAccessor0(Lookup *l, ExecutionContext *ctx)
+ReturnedValue Lookup::globalGetterAccessor0(Lookup *l, ExecutionEngine *engine)
{
- Object *o = ctx->d()->engine->globalObject;
+ Object *o = engine->globalObject;
if (l->classList[0] == o->internalClass()) {
Scope scope(o->engine());
FunctionObject *getter = o->propertyAt(l->index)->getter();
@@ -652,12 +652,12 @@ ReturnedValue Lookup::globalGetterAccessor0(Lookup *l, ExecutionContext *ctx)
return getter->call(callData);
}
l->globalGetter = globalGetterGeneric;
- return globalGetterGeneric(l, ctx);
+ return globalGetterGeneric(l, engine);
}
-ReturnedValue Lookup::globalGetterAccessor1(Lookup *l, ExecutionContext *ctx)
+ReturnedValue Lookup::globalGetterAccessor1(Lookup *l, ExecutionEngine *engine)
{
- Object *o = ctx->d()->engine->globalObject;
+ Object *o = engine->globalObject;
if (l->classList[0] == o->internalClass() &&
l->classList[1] == o->prototype()->internalClass()) {
Scope scope(o->engine());
@@ -670,12 +670,12 @@ ReturnedValue Lookup::globalGetterAccessor1(Lookup *l, ExecutionContext *ctx)
return getter->call(callData);
}
l->globalGetter = globalGetterGeneric;
- return globalGetterGeneric(l, ctx);
+ return globalGetterGeneric(l, engine);
}
-ReturnedValue Lookup::globalGetterAccessor2(Lookup *l, ExecutionContext *ctx)
+ReturnedValue Lookup::globalGetterAccessor2(Lookup *l, ExecutionEngine *engine)
{
- Object *o = ctx->d()->engine->globalObject;
+ Object *o = engine->globalObject;
if (l->classList[0] == o->internalClass()) {
o = o->prototype();
if (l->classList[1] == o->internalClass()) {
@@ -693,7 +693,7 @@ ReturnedValue Lookup::globalGetterAccessor2(Lookup *l, ExecutionContext *ctx)
}
}
l->globalGetter = globalGetterGeneric;
- return globalGetterGeneric(l, ctx);
+ return globalGetterGeneric(l, engine);
}
void Lookup::setterGeneric(Lookup *l, const ValueRef object, const ValueRef value)
diff --git a/src/qml/jsruntime/qv4lookup_p.h b/src/qml/jsruntime/qv4lookup_p.h
index 8ff7e98d0f..a46e712606 100644
--- a/src/qml/jsruntime/qv4lookup_p.h
+++ b/src/qml/jsruntime/qv4lookup_p.h
@@ -50,7 +50,7 @@ struct Lookup {
ReturnedValue (*indexedGetter)(Lookup *l, const ValueRef object, const ValueRef index);
void (*indexedSetter)(Lookup *l, const ValueRef object, const ValueRef index, const ValueRef v);
ReturnedValue (*getter)(Lookup *l, const ValueRef object);
- ReturnedValue (*globalGetter)(Lookup *l, ExecutionContext *ctx);
+ ReturnedValue (*globalGetter)(Lookup *l, ExecutionEngine *engine);
void (*setter)(Lookup *l, const ValueRef object, const ValueRef v);
};
union {
@@ -99,13 +99,13 @@ struct Lookup {
static ReturnedValue stringLengthGetter(Lookup *l, const ValueRef object);
static ReturnedValue arrayLengthGetter(Lookup *l, const ValueRef object);
- static ReturnedValue globalGetterGeneric(Lookup *l, ExecutionContext *ctx);
- static ReturnedValue globalGetter0(Lookup *l, ExecutionContext *ctx);
- static ReturnedValue globalGetter1(Lookup *l, ExecutionContext *ctx);
- static ReturnedValue globalGetter2(Lookup *l, ExecutionContext *ctx);
- static ReturnedValue globalGetterAccessor0(Lookup *l, ExecutionContext *ctx);
- static ReturnedValue globalGetterAccessor1(Lookup *l, ExecutionContext *ctx);
- static ReturnedValue globalGetterAccessor2(Lookup *l, ExecutionContext *ctx);
+ static ReturnedValue globalGetterGeneric(Lookup *l, ExecutionEngine *engine);
+ static ReturnedValue globalGetter0(Lookup *l, ExecutionEngine *engine);
+ static ReturnedValue globalGetter1(Lookup *l, ExecutionEngine *engine);
+ static ReturnedValue globalGetter2(Lookup *l, ExecutionEngine *engine);
+ static ReturnedValue globalGetterAccessor0(Lookup *l, ExecutionEngine *engine);
+ static ReturnedValue globalGetterAccessor1(Lookup *l, ExecutionEngine *engine);
+ static ReturnedValue globalGetterAccessor2(Lookup *l, ExecutionEngine *engine);
static void setterGeneric(Lookup *l, const ValueRef object, const ValueRef value);
static void setterTwoClasses(Lookup *l, const ValueRef object, const ValueRef value);
diff --git a/src/qml/jsruntime/qv4profiling_p.h b/src/qml/jsruntime/qv4profiling_p.h
index 7c66ee0049..e6b6f7b1f3 100644
--- a/src/qml/jsruntime/qv4profiling_p.h
+++ b/src/qml/jsruntime/qv4profiling_p.h
@@ -120,11 +120,11 @@ private:
(engine->profiler->featuresEnabled & (1 << Profiling::FeatureMemoryAllocation)) ?\
engine->profiler->trackDealloc(pointer, size, type) : pointer)
-#define Q_V4_PROFILE(engine, ctx, function)\
+#define Q_V4_PROFILE(engine, function)\
(engine->profiler &&\
(engine->profiler->featuresEnabled & (1 << Profiling::FeatureFunctionCall)) ?\
- Profiling::FunctionCallProfiler::profileCall(engine->profiler, ctx, function) :\
- function->code(ctx, function->codeData))
+ Profiling::FunctionCallProfiler::profileCall(engine->profiler, engine, function) :\
+ function->code(engine, function->codeData))
class Q_QML_EXPORT Profiler : public QObject {
Q_OBJECT
@@ -182,10 +182,10 @@ public:
profiler->m_data.append(FunctionCall(function, startTime, profiler->m_timer.nsecsElapsed()));
}
- static ReturnedValue profileCall(Profiler *profiler, ExecutionContext *ctx, Function *function)
+ static ReturnedValue profileCall(Profiler *profiler, ExecutionEngine *engine, Function *function)
{
FunctionCallProfiler callProfiler(profiler, function);
- return function->code(ctx, function->codeData);
+ return function->code(engine, function->codeData);
}
Profiler *profiler;
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index abbb4911b2..771c388870 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -256,16 +256,16 @@ void RuntimeHelpers::numberToString(QString *result, double num, int radix)
result->prepend(QLatin1Char('-'));
}
-ReturnedValue Runtime::closure(ExecutionContext *ctx, int functionId)
+ReturnedValue Runtime::closure(ExecutionEngine *engine, int functionId)
{
- QV4::Function *clos = ctx->d()->compilationUnit->runtimeFunctions[functionId];
+ QV4::Function *clos = engine->currentContext()->d()->compilationUnit->runtimeFunctions[functionId];
Q_ASSERT(clos);
- return FunctionObject::createScriptFunction(ctx, clos)->asReturnedValue();
+ return FunctionObject::createScriptFunction(engine->currentContext(), clos)->asReturnedValue();
}
-ReturnedValue Runtime::deleteElement(ExecutionContext *ctx, const ValueRef base, const ValueRef index)
+ReturnedValue Runtime::deleteElement(ExecutionEngine *engine, const ValueRef base, const ValueRef index)
{
- Scope scope(ctx);
+ Scope scope(engine);
ScopedObject o(scope, base);
if (o) {
uint n = index->asArrayIndex();
@@ -274,34 +274,34 @@ ReturnedValue Runtime::deleteElement(ExecutionContext *ctx, const ValueRef base,
}
}
- ScopedString name(scope, index->toString(ctx));
- return Runtime::deleteMember(ctx, base, name.getPointer());
+ ScopedString name(scope, index->toString(engine));
+ return Runtime::deleteMember(engine, base, name.getPointer());
}
-ReturnedValue Runtime::deleteMember(ExecutionContext *ctx, const ValueRef base, String *name)
+ReturnedValue Runtime::deleteMember(ExecutionEngine *engine, const ValueRef base, String *name)
{
- Scope scope(ctx);
- ScopedObject obj(scope, base->toObject(ctx));
+ Scope scope(engine);
+ ScopedObject obj(scope, base->toObject(engine));
if (scope.engine->hasException)
return Encode::undefined();
return Encode(obj->deleteProperty(name));
}
-ReturnedValue Runtime::deleteName(ExecutionContext *ctx, String *name)
+ReturnedValue Runtime::deleteName(ExecutionEngine *engine, String *name)
{
- Scope scope(ctx);
- return Encode(ctx->deleteProperty(name));
+ Scope scope(engine);
+ return Encode(engine->currentContext()->deleteProperty(name));
}
-QV4::ReturnedValue Runtime::instanceof(ExecutionContext *ctx, const ValueRef left, const ValueRef right)
+QV4::ReturnedValue Runtime::instanceof(ExecutionEngine *engine, const ValueRef left, const ValueRef right)
{
// As nothing in this method can call into the memory manager, avoid using a Scope
// for performance reasons
- Scope scope(ctx);
+ Scope scope(engine);
ScopedFunctionObject f(scope, right->asFunctionObject());
if (!f)
- return ctx->engine()->throwTypeError();
+ return engine->throwTypeError();
if (f->subtype() == Heap::FunctionObject::BoundFunction)
f = static_cast<BoundFunction *>(f.getPointer())->target();
@@ -312,7 +312,7 @@ QV4::ReturnedValue Runtime::instanceof(ExecutionContext *ctx, const ValueRef lef
Object *o = QV4::Value::fromReturnedValue(f->protoProperty()).asObject();
if (!o)
- return ctx->engine()->throwTypeError();
+ return engine->throwTypeError();
while (v) {
v = v->prototype();
@@ -326,12 +326,12 @@ QV4::ReturnedValue Runtime::instanceof(ExecutionContext *ctx, const ValueRef lef
return Encode(false);
}
-QV4::ReturnedValue Runtime::in(ExecutionContext *ctx, const ValueRef left, const ValueRef right)
+QV4::ReturnedValue Runtime::in(ExecutionEngine *engine, const ValueRef left, const ValueRef right)
{
if (!right->isObject())
- return ctx->engine()->throwTypeError();
- Scope scope(ctx);
- ScopedString s(scope, left->toString(ctx));
+ return engine->throwTypeError();
+ Scope scope(engine);
+ ScopedString s(scope, left->toString(engine));
if (scope.hasException())
return Encode::undefined();
bool r = right->objectValue()->hasProperty(s.getPointer());
@@ -385,8 +385,7 @@ ReturnedValue RuntimeHelpers::objectDefaultValue(Object *object, int typeHint)
if (typeHint == NUMBER_HINT)
qSwap(meth1, meth2);
- ExecutionContext *ctx = engine->currentContext();
- Scope scope(ctx);
+ Scope scope(engine);
ScopedCallData callData(scope, 0);
callData->thisObject = object;
@@ -407,7 +406,7 @@ ReturnedValue RuntimeHelpers::objectDefaultValue(Object *object, int typeHint)
return r->asReturnedValue();
}
- return ctx->engine()->throwTypeError();
+ return engine->throwTypeError();
}
@@ -515,7 +514,7 @@ QV4::ReturnedValue RuntimeHelpers::addHelper(ExecutionEngine *engine, const Valu
return Encode(x + y);
}
-QV4::ReturnedValue Runtime::addString(QV4::ExecutionContext *ctx, const QV4::ValueRef left, const QV4::ValueRef right)
+QV4::ReturnedValue Runtime::addString(ExecutionEngine *engine, const QV4::ValueRef left, const QV4::ValueRef right)
{
Q_ASSERT(left->isString() || right->isString());
@@ -524,38 +523,38 @@ QV4::ReturnedValue Runtime::addString(QV4::ExecutionContext *ctx, const QV4::Val
return right->asReturnedValue();
if (!right->stringValue()->d()->length())
return left->asReturnedValue();
- return (ctx->engine()->memoryManager->alloc<String>(ctx->d()->engine, left->stringValue()->d(), right->stringValue()->d()))->asReturnedValue();
+ return (engine->memoryManager->alloc<String>(engine, left->stringValue()->d(), right->stringValue()->d()))->asReturnedValue();
}
- Scope scope(ctx);
+ Scope scope(engine);
ScopedValue pleft(scope, *left);
ScopedValue pright(scope, *right);
if (!pleft->isString())
- pleft = convert_to_string_add(ctx->engine(), left);
+ pleft = convert_to_string_add(engine, left);
if (!pright->isString())
- pright = convert_to_string_add(ctx->engine(), right);
+ pright = convert_to_string_add(engine, right);
if (scope.engine->hasException)
return Encode::undefined();
if (!pleft->stringValue()->d()->length())
return pright->asReturnedValue();
if (!pright->stringValue()->d()->length())
return pleft->asReturnedValue();
- return (ctx->engine()->memoryManager->alloc<String>(ctx->d()->engine, pleft->stringValue()->d(), pright->stringValue()->d()))->asReturnedValue();
+ return (engine->memoryManager->alloc<String>(engine, pleft->stringValue()->d(), pright->stringValue()->d()))->asReturnedValue();
}
-void Runtime::setProperty(ExecutionContext *ctx, const ValueRef object, String *name, const ValueRef value)
+void Runtime::setProperty(ExecutionEngine *engine, const ValueRef object, String *name, const ValueRef value)
{
- Scope scope(ctx);
- ScopedObject o(scope, object->toObject(ctx));
+ Scope scope(engine);
+ ScopedObject o(scope, object->toObject(engine));
if (!o)
return;
o->put(name, value);
}
-ReturnedValue Runtime::getElement(ExecutionContext *ctx, const ValueRef object, const ValueRef index)
+ReturnedValue Runtime::getElement(ExecutionEngine *engine, const ValueRef object, const ValueRef index)
{
- Scope scope(ctx);
+ Scope scope(engine);
uint idx = index->asArrayIndex();
Scoped<Object> o(scope, object);
@@ -572,7 +571,7 @@ ReturnedValue Runtime::getElement(ExecutionContext *ctx, const ValueRef object,
if (object->isNullOrUndefined()) {
QString message = QStringLiteral("Cannot read property '%1' of %2").arg(index->toQStringNoThrow()).arg(object->toQStringNoThrow());
- return ctx->engine()->throwTypeError(message);
+ return engine->throwTypeError(message);
}
o = RuntimeHelpers::convertToObject(scope.engine, object);
@@ -590,16 +589,16 @@ ReturnedValue Runtime::getElement(ExecutionContext *ctx, const ValueRef object,
return o->getIndexed(idx);
}
- ScopedString name(scope, index->toString(ctx));
+ ScopedString name(scope, index->toString(engine));
if (scope.hasException())
return Encode::undefined();
return o->get(name.getPointer());
}
-void Runtime::setElement(ExecutionContext *ctx, const ValueRef object, const ValueRef index, const ValueRef value)
+void Runtime::setElement(ExecutionEngine *engine, const ValueRef object, const ValueRef index, const ValueRef value)
{
- Scope scope(ctx);
- ScopedObject o(scope, object->toObject(ctx));
+ Scope scope(engine);
+ ScopedObject o(scope, object->toObject(engine));
if (scope.engine->hasException)
return;
@@ -616,17 +615,17 @@ void Runtime::setElement(ExecutionContext *ctx, const ValueRef object, const Val
return;
}
- ScopedString name(scope, index->toString(ctx));
+ ScopedString name(scope, index->toString(engine));
o->put(name.getPointer(), value);
}
-ReturnedValue Runtime::foreachIterator(ExecutionContext *ctx, const ValueRef in)
+ReturnedValue Runtime::foreachIterator(ExecutionEngine *engine, const ValueRef in)
{
- Scope scope(ctx);
+ Scope scope(engine);
Scoped<Object> o(scope, (Object *)0);
if (!in->isNullOrUndefined())
- o = in->toObject(ctx);
- return ctx->engine()->newForEachIteratorObject(o)->asReturnedValue();
+ o = in->toObject(engine);
+ return engine->newForEachIteratorObject(o)->asReturnedValue();
}
ReturnedValue Runtime::foreachNextPropertyName(const ValueRef foreach_iterator)
@@ -640,14 +639,14 @@ ReturnedValue Runtime::foreachNextPropertyName(const ValueRef foreach_iterator)
}
-void Runtime::setActivationProperty(ExecutionContext *ctx, String *name, const ValueRef value)
+void Runtime::setActivationProperty(ExecutionEngine *engine, String *name, const ValueRef value)
{
- ctx->setProperty(name, value);
+ engine->currentContext()->setProperty(name, value);
}
-ReturnedValue Runtime::getProperty(ExecutionContext *ctx, const ValueRef object, String *name)
+ReturnedValue Runtime::getProperty(ExecutionEngine *engine, const ValueRef object, String *name)
{
- Scope scope(ctx);
+ Scope scope(engine);
Scoped<Object> o(scope, object);
if (o)
@@ -655,7 +654,7 @@ ReturnedValue Runtime::getProperty(ExecutionContext *ctx, const ValueRef object,
if (object->isNullOrUndefined()) {
QString message = QStringLiteral("Cannot read property '%1' of %2").arg(name->toQString()).arg(object->toQStringNoThrow());
- return ctx->engine()->throwTypeError(message);
+ return engine->throwTypeError(message);
}
o = RuntimeHelpers::convertToObject(scope.engine, object);
@@ -664,9 +663,9 @@ ReturnedValue Runtime::getProperty(ExecutionContext *ctx, const ValueRef object,
return o->get(name);
}
-ReturnedValue Runtime::getActivationProperty(ExecutionContext *ctx, String *name)
+ReturnedValue Runtime::getActivationProperty(ExecutionEngine *engine, String *name)
{
- return ctx->getProperty(name);
+ return engine->currentContext()->getProperty(name);
}
#endif // V4_BOOTSTRAP
@@ -858,34 +857,34 @@ QV4::Bool Runtime::compareLessEqual(const QV4::ValueRef l, const QV4::ValueRef r
}
#ifndef V4_BOOTSTRAP
-Bool Runtime::compareInstanceof(ExecutionContext *ctx, const ValueRef left, const ValueRef right)
+Bool Runtime::compareInstanceof(ExecutionEngine *engine, const ValueRef left, const ValueRef right)
{
TRACE2(left, right);
- Scope scope(ctx);
- ScopedValue v(scope, Runtime::instanceof(ctx, left, right));
+ Scope scope(engine);
+ ScopedValue v(scope, Runtime::instanceof(engine, left, right));
return v->booleanValue();
}
-uint Runtime::compareIn(ExecutionContext *ctx, const ValueRef left, const ValueRef right)
+uint Runtime::compareIn(ExecutionEngine *engine, const ValueRef left, const ValueRef right)
{
TRACE2(left, right);
- Scope scope(ctx);
- ScopedValue v(scope, Runtime::in(ctx, left, right));
+ Scope scope(engine);
+ ScopedValue v(scope, Runtime::in(engine, left, right));
return v->booleanValue();
}
-ReturnedValue Runtime::callGlobalLookup(ExecutionContext *context, uint index, CallData *callData)
+ReturnedValue Runtime::callGlobalLookup(ExecutionEngine *engine, uint index, CallData *callData)
{
- Scope scope(context);
+ Scope scope(engine);
Q_ASSERT(callData->thisObject.isUndefined());
- Lookup *l = context->d()->lookups + index;
- Scoped<FunctionObject> o(scope, l->globalGetter(l, context));
+ Lookup *l = engine->currentContext()->d()->lookups + index;
+ Scoped<FunctionObject> o(scope, l->globalGetter(l, engine));
if (!o)
- return context->engine()->throwTypeError();
+ return engine->throwTypeError();
if (o.getPointer() == scope.engine->evalFunction && l->name->equals(scope.engine->id_eval))
return static_cast<EvalFunction *>(o.getPointer())->evalCall(callData, true);
@@ -894,14 +893,14 @@ ReturnedValue Runtime::callGlobalLookup(ExecutionContext *context, uint index, C
}
-ReturnedValue Runtime::callActivationProperty(ExecutionContext *context, String *name, CallData *callData)
+ReturnedValue Runtime::callActivationProperty(ExecutionEngine *engine, String *name, CallData *callData)
{
Q_ASSERT(callData->thisObject.isUndefined());
- Scope scope(context);
+ Scope scope(engine);
ScopedObject base(scope);
Object *baseObj = 0;
- ScopedValue func(scope, context->getPropertyAndBase(name, baseObj));
+ ScopedValue func(scope, engine->currentContext()->getPropertyAndBase(name, baseObj));
base.ptr->m = baseObj ? &baseObj->data : 0;
if (scope.engine->hasException)
return Encode::undefined();
@@ -915,7 +914,7 @@ ReturnedValue Runtime::callActivationProperty(ExecutionContext *context, String
if (base)
objectAsString = ScopedValue(scope, base.asReturnedValue())->toQStringNoThrow();
QString msg = QStringLiteral("Property '%1' of object %2 is not a function").arg(name->toQString()).arg(objectAsString);
- return context->engine()->throwTypeError(msg);
+ return engine->throwTypeError(msg);
}
if (o == scope.engine->evalFunction && name->equals(scope.engine->id_eval)) {
@@ -925,15 +924,15 @@ ReturnedValue Runtime::callActivationProperty(ExecutionContext *context, String
return o->call(callData);
}
-ReturnedValue Runtime::callProperty(ExecutionContext *context, String *name, CallData *callData)
+ReturnedValue Runtime::callProperty(ExecutionEngine *engine, String *name, CallData *callData)
{
- Scope scope(context);
+ Scope scope(engine);
Scoped<Object> baseObject(scope, callData->thisObject);
if (!baseObject) {
Q_ASSERT(!callData->thisObject.isEmpty());
if (callData->thisObject.isNullOrUndefined()) {
QString message = QStringLiteral("Cannot call method '%1' of %2").arg(name->toQString()).arg(callData->thisObject.toQStringNoThrow());
- return context->engine()->throwTypeError(message);
+ return engine->throwTypeError(message);
}
baseObject = RuntimeHelpers::convertToObject(scope.engine, ValueRef(&callData->thisObject));
@@ -945,28 +944,28 @@ ReturnedValue Runtime::callProperty(ExecutionContext *context, String *name, Cal
Scoped<FunctionObject> o(scope, baseObject->get(name));
if (!o) {
QString error = QStringLiteral("Property '%1' of object %2 is not a function").arg(name->toQString(), callData->thisObject.toQStringNoThrow());
- return context->engine()->throwTypeError(error);
+ return engine->throwTypeError(error);
}
return o->call(callData);
}
-ReturnedValue Runtime::callPropertyLookup(ExecutionContext *context, uint index, CallData *callData)
+ReturnedValue Runtime::callPropertyLookup(ExecutionEngine *engine, uint index, CallData *callData)
{
- Lookup *l = context->d()->lookups + index;
+ Lookup *l = engine->currentContext()->d()->lookups + index;
Value v;
v = l->getter(l, callData->thisObject);
if (!v.isObject())
- return context->engine()->throwTypeError();
+ return engine->throwTypeError();
return v.objectValue()->call(callData);
}
-ReturnedValue Runtime::callElement(ExecutionContext *context, const ValueRef index, CallData *callData)
+ReturnedValue Runtime::callElement(ExecutionEngine *engine, const ValueRef index, CallData *callData)
{
- Scope scope(context);
- ScopedObject baseObject(scope, callData->thisObject.toObject(context));
- ScopedString s(scope, index->toString(context));
+ Scope scope(engine);
+ ScopedObject baseObject(scope, callData->thisObject.toObject(engine));
+ ScopedString s(scope, index->toString(engine));
if (scope.engine->hasException)
return Encode::undefined();
@@ -974,186 +973,183 @@ ReturnedValue Runtime::callElement(ExecutionContext *context, const ValueRef ind
ScopedObject o(scope, baseObject->get(s.getPointer()));
if (!o)
- return context->engine()->throwTypeError();
+ return engine->throwTypeError();
return o->call(callData);
}
-ReturnedValue Runtime::callValue(ExecutionContext *context, const ValueRef func, CallData *callData)
+ReturnedValue Runtime::callValue(ExecutionEngine *engine, const ValueRef func, CallData *callData)
{
if (!func->isObject())
- return context->engine()->throwTypeError();
+ return engine->throwTypeError();
return func->objectValue()->call(callData);
}
-ReturnedValue Runtime::constructGlobalLookup(ExecutionContext *context, uint index, CallData *callData)
+ReturnedValue Runtime::constructGlobalLookup(ExecutionEngine *engine, uint index, CallData *callData)
{
- Scope scope(context);
+ Scope scope(engine);
Q_ASSERT(callData->thisObject.isUndefined());
- Lookup *l = context->d()->lookups + index;
- Scoped<Object> f(scope, l->globalGetter(l, context));
+ Lookup *l = engine->currentContext()->d()->lookups + index;
+ Scoped<Object> f(scope, l->globalGetter(l, engine));
if (!f)
- return context->engine()->throwTypeError();
+ return engine->throwTypeError();
return f->construct(callData);
}
-ReturnedValue Runtime::constructActivationProperty(ExecutionContext *context, String *name, CallData *callData)
+ReturnedValue Runtime::constructActivationProperty(ExecutionEngine *engine, String *name, CallData *callData)
{
- Scope scope(context);
- ScopedValue func(scope, context->getProperty(name));
+ Scope scope(engine);
+ ScopedValue func(scope, engine->currentContext()->getProperty(name));
if (scope.engine->hasException)
return Encode::undefined();
Object *f = func->asObject();
if (!f)
- return context->engine()->throwTypeError();
+ return engine->throwTypeError();
return f->construct(callData);
}
-ReturnedValue Runtime::constructValue(ExecutionContext *context, const ValueRef func, CallData *callData)
+ReturnedValue Runtime::constructValue(ExecutionEngine *engine, const ValueRef func, CallData *callData)
{
Object *f = func->asObject();
if (!f)
- return context->engine()->throwTypeError();
+ return engine->throwTypeError();
return f->construct(callData);
}
-ReturnedValue Runtime::constructProperty(ExecutionContext *context, String *name, CallData *callData)
+ReturnedValue Runtime::constructProperty(ExecutionEngine *engine, String *name, CallData *callData)
{
- Scope scope(context);
- ScopedObject thisObject(scope, callData->thisObject.toObject(context));
+ Scope scope(engine);
+ ScopedObject thisObject(scope, callData->thisObject.toObject(engine));
if (scope.engine->hasException)
return Encode::undefined();
Scoped<Object> f(scope, thisObject->get(name));
if (!f)
- return context->engine()->throwTypeError();
+ return engine->throwTypeError();
return f->construct(callData);
}
-ReturnedValue Runtime::constructPropertyLookup(ExecutionContext *context, uint index, CallData *callData)
+ReturnedValue Runtime::constructPropertyLookup(ExecutionEngine *engine, uint index, CallData *callData)
{
- Lookup *l = context->d()->lookups + index;
+ Lookup *l = engine->currentContext()->d()->lookups + index;
Value v;
v = l->getter(l, callData->thisObject);
if (!v.isObject())
- return context->engine()->throwTypeError();
+ return engine->throwTypeError();
return v.objectValue()->construct(callData);
}
-void Runtime::throwException(ExecutionContext *context, const ValueRef value)
+void Runtime::throwException(ExecutionEngine *engine, const ValueRef value)
{
if (!value->isEmpty())
- context->engine()->throwError(value);
+ engine->throwError(value);
}
-ReturnedValue Runtime::typeofValue(ExecutionContext *ctx, const ValueRef value)
+ReturnedValue Runtime::typeofValue(ExecutionEngine *engine, const ValueRef value)
{
- Scope scope(ctx);
+ Scope scope(engine);
ScopedString res(scope);
switch (value->type()) {
case Value::Undefined_Type:
- res = ctx->engine()->id_undefined;
+ res = engine->id_undefined;
break;
case Value::Null_Type:
- res = ctx->engine()->id_object;
+ res = engine->id_object;
break;
case Value::Boolean_Type:
- res = ctx->engine()->id_boolean;
+ res = engine->id_boolean;
break;
case Value::Managed_Type:
if (value->isString())
- res = ctx->engine()->id_string;
+ res = engine->id_string;
else if (value->objectValue()->asFunctionObject())
- res = ctx->engine()->id_function;
+ res = engine->id_function;
else
- res = ctx->engine()->id_object; // ### implementation-defined
+ res = engine->id_object; // ### implementation-defined
break;
default:
- res = ctx->engine()->id_number;
+ res = engine->id_number;
break;
}
return res.asReturnedValue();
}
-QV4::ReturnedValue Runtime::typeofName(ExecutionContext *context, String *name)
+QV4::ReturnedValue Runtime::typeofName(ExecutionEngine *engine, String *name)
{
- Scope scope(context);
- ScopedValue prop(scope, context->getProperty(name));
+ Scope scope(engine);
+ ScopedValue prop(scope, engine->currentContext()->getProperty(name));
// typeof doesn't throw. clear any possible exception
scope.engine->hasException = false;
- return Runtime::typeofValue(context, prop);
+ return Runtime::typeofValue(engine, prop);
}
-QV4::ReturnedValue Runtime::typeofMember(ExecutionContext *context, const ValueRef base, String *name)
+QV4::ReturnedValue Runtime::typeofMember(ExecutionEngine *engine, const ValueRef base, String *name)
{
- Scope scope(context);
- ScopedObject obj(scope, base->toObject(context));
+ Scope scope(engine);
+ ScopedObject obj(scope, base->toObject(engine));
if (scope.engine->hasException)
return Encode::undefined();
ScopedValue prop(scope, obj->get(name));
- return Runtime::typeofValue(context, prop);
+ return Runtime::typeofValue(engine, prop);
}
-QV4::ReturnedValue Runtime::typeofElement(ExecutionContext *context, const ValueRef base, const ValueRef index)
+QV4::ReturnedValue Runtime::typeofElement(ExecutionEngine *engine, const ValueRef base, const ValueRef index)
{
- Scope scope(context);
- ScopedString name(scope, index->toString(context));
- ScopedObject obj(scope, base->toObject(context));
+ Scope scope(engine);
+ ScopedString name(scope, index->toString(engine));
+ ScopedObject obj(scope, base->toObject(engine));
if (scope.engine->hasException)
return Encode::undefined();
ScopedValue prop(scope, obj->get(name.getPointer()));
- return Runtime::typeofValue(context, prop);
+ return Runtime::typeofValue(engine, prop);
}
-ExecutionContext *Runtime::pushWithScope(const ValueRef o, ExecutionContext *ctx)
+void Runtime::pushWithScope(const ValueRef o, NoThrowEngine *engine)
{
- Scope scope(ctx);
- ScopedObject obj(scope, o->toObject(ctx));
- return ctx->newWithContext(obj)->getPointer();
+ Scope scope(engine);
+ ScopedObject obj(scope, o->toObject(engine));
+ engine->currentContext()->newWithContext(obj);
}
-ReturnedValue Runtime::unwindException(ExecutionContext *ctx)
+ReturnedValue Runtime::unwindException(ExecutionEngine *engine)
{
- if (!ctx->engine()->hasException)
+ if (!engine->hasException)
return Primitive::emptyValue().asReturnedValue();
- return ctx->engine()->catchException(ctx, 0);
+ return engine->catchException(engine->currentContext(), 0);
}
-ExecutionContext *Runtime::pushCatchScope(ExecutionContext *ctx, String *exceptionVarName)
+void Runtime::pushCatchScope(NoThrowEngine *engine, String *exceptionVarName)
{
- Scope scope(ctx);
- ScopedValue v(scope, ctx->engine()->catchException(ctx, 0));
- return ctx->newCatchContext(exceptionVarName, v)->getPointer();
+ Scope scope(engine);
+ ScopedValue v(scope, engine->catchException(engine->currentContext(), 0));
+ engine->currentContext()->newCatchContext(exceptionVarName, v)->getPointer();
}
-ExecutionContext *Runtime::popScope(ExecutionContext *ctx)
+void Runtime::popScope(ExecutionEngine *engine)
{
- Scope scope(ctx->engine());
- ScopedContext c(scope, ctx->engine()->popContext());
- // ### GC?
- return c.getPointer();
+ engine->popContext();
}
-void Runtime::declareVar(ExecutionContext *ctx, bool deletable, String *name)
+void Runtime::declareVar(ExecutionEngine *engine, bool deletable, String *name)
{
- ctx->createMutableBinding(name, deletable);
+ engine->currentContext()->createMutableBinding(name, deletable);
}
-ReturnedValue Runtime::arrayLiteral(ExecutionContext *ctx, Value *values, uint length)
+ReturnedValue Runtime::arrayLiteral(ExecutionEngine *engine, Value *values, uint length)
{
- Scope scope(ctx);
- Scoped<ArrayObject> a(scope, ctx->engine()->newArrayObject());
+ Scope scope(engine);
+ Scoped<ArrayObject> a(scope, engine->newArrayObject());
if (length) {
a->arrayReserve(length);
@@ -1163,11 +1159,11 @@ ReturnedValue Runtime::arrayLiteral(ExecutionContext *ctx, Value *values, uint l
return a.asReturnedValue();
}
-ReturnedValue Runtime::objectLiteral(QV4::ExecutionContext *ctx, const QV4::Value *args, int classId, int arrayValueCount, int arrayGetterSetterCountAndFlags)
+ReturnedValue Runtime::objectLiteral(ExecutionEngine *engine, const QV4::Value *args, int classId, int arrayValueCount, int arrayGetterSetterCountAndFlags)
{
- Scope scope(ctx);
- QV4::InternalClass *klass = ctx->d()->compilationUnit->runtimeClasses[classId];
- Scoped<Object> o(scope, ctx->engine()->newObject(klass));
+ Scope scope(engine);
+ QV4::InternalClass *klass = engine->currentContext()->d()->compilationUnit->runtimeClasses[classId];
+ Scoped<Object> o(scope, engine->newObject(klass));
{
bool needSparseArray = arrayGetterSetterCountAndFlags >> 30;
@@ -1205,11 +1201,11 @@ ReturnedValue Runtime::objectLiteral(QV4::ExecutionContext *ctx, const QV4::Valu
return o.asReturnedValue();
}
-QV4::ReturnedValue Runtime::setupArgumentsObject(ExecutionContext *ctx)
+QV4::ReturnedValue Runtime::setupArgumentsObject(ExecutionEngine *engine)
{
- Q_ASSERT(ctx->d()->type >= Heap::ExecutionContext::Type_CallContext);
- CallContext *c = static_cast<CallContext *>(ctx);
- return (c->engine()->memoryManager->alloc<ArgumentsObject>(c))->asReturnedValue();
+ Q_ASSERT(engine->currentContext()->d()->type >= Heap::ExecutionContext::Type_CallContext);
+ CallContext *c = static_cast<CallContext *>(engine->currentContext());
+ return (engine->memoryManager->alloc<ArgumentsObject>(c))->asReturnedValue();
}
#endif // V4_BOOTSTRAP
@@ -1293,99 +1289,99 @@ unsigned Runtime::doubleToUInt(const double &d)
#ifndef V4_BOOTSTRAP
-ReturnedValue Runtime::regexpLiteral(ExecutionContext *ctx, int id)
+ReturnedValue Runtime::regexpLiteral(ExecutionEngine *engine, int id)
{
- return ctx->d()->compilationUnit->runtimeRegularExpressions[id].asReturnedValue();
+ return engine->currentContext()->d()->compilationUnit->runtimeRegularExpressions[id].asReturnedValue();
}
-ReturnedValue Runtime::getQmlIdArray(NoThrowContext *ctx)
+ReturnedValue Runtime::getQmlIdArray(NoThrowEngine *engine)
{
- Q_ASSERT(ctx->engine()->qmlContextObject()->getPointer()->as<QmlContextWrapper>());
- return static_cast<QmlContextWrapper *>(ctx->engine()->qmlContextObject()->getPointer())->idObjectsArray();
+ Q_ASSERT(engine->qmlContextObject()->getPointer()->as<QmlContextWrapper>());
+ return static_cast<QmlContextWrapper *>(engine->qmlContextObject()->getPointer())->idObjectsArray();
}
-ReturnedValue Runtime::getQmlContextObject(NoThrowContext *ctx)
+ReturnedValue Runtime::getQmlContextObject(NoThrowEngine *engine)
{
- QQmlContextData *context = QmlContextWrapper::callingContext(ctx->engine());
+ QQmlContextData *context = QmlContextWrapper::callingContext(engine);
if (!context)
return Encode::undefined();
- return QObjectWrapper::wrap(ctx->d()->engine, context->contextObject);
+ return QObjectWrapper::wrap(engine, context->contextObject);
}
-ReturnedValue Runtime::getQmlScopeObject(NoThrowContext *ctx)
+ReturnedValue Runtime::getQmlScopeObject(NoThrowEngine *engine)
{
- Scope scope(ctx);
- QV4::Scoped<QmlContextWrapper> c(scope, ctx->engine()->qmlContextObject(), Scoped<QmlContextWrapper>::Cast);
- return QObjectWrapper::wrap(ctx->d()->engine, c->getScopeObject());
+ Scope scope(engine);
+ QV4::Scoped<QmlContextWrapper> c(scope, engine->qmlContextObject(), Scoped<QmlContextWrapper>::Cast);
+ return QObjectWrapper::wrap(engine, c->getScopeObject());
}
-ReturnedValue Runtime::getQmlQObjectProperty(ExecutionContext *ctx, const ValueRef object, int propertyIndex, bool captureRequired)
+ReturnedValue Runtime::getQmlQObjectProperty(ExecutionEngine *engine, const ValueRef object, int propertyIndex, bool captureRequired)
{
- Scope scope(ctx);
+ Scope scope(engine);
QV4::Scoped<QObjectWrapper> wrapper(scope, object);
if (!wrapper) {
- ctx->engine()->throwTypeError(QStringLiteral("Cannot read property of null"));
+ engine->throwTypeError(QStringLiteral("Cannot read property of null"));
return Encode::undefined();
}
- return QV4::QObjectWrapper::getProperty(wrapper->object(), ctx, propertyIndex, captureRequired);
+ return QV4::QObjectWrapper::getProperty(wrapper->object(), engine->currentContext(), propertyIndex, captureRequired);
}
-QV4::ReturnedValue Runtime::getQmlAttachedProperty(ExecutionContext *ctx, int attachedPropertiesId, int propertyIndex)
+QV4::ReturnedValue Runtime::getQmlAttachedProperty(ExecutionEngine *engine, int attachedPropertiesId, int propertyIndex)
{
- Scope scope(ctx);
- QV4::Scoped<QmlContextWrapper> c(scope, ctx->engine()->qmlContextObject(), Scoped<QmlContextWrapper>::Cast);
+ Scope scope(engine);
+ QV4::Scoped<QmlContextWrapper> c(scope, engine->qmlContextObject(), Scoped<QmlContextWrapper>::Cast);
QObject *scopeObject = c->getScopeObject();
QObject *attachedObject = qmlAttachedPropertiesObjectById(attachedPropertiesId, scopeObject);
- QQmlEngine *qmlEngine = ctx->engine()->v8Engine->engine();
+ QQmlEngine *qmlEngine = engine->v8Engine->engine();
QQmlData::ensurePropertyCache(qmlEngine, attachedObject);
- return QV4::QObjectWrapper::getProperty(attachedObject, ctx, propertyIndex, /*captureRequired*/true);
+ return QV4::QObjectWrapper::getProperty(attachedObject, engine->currentContext(), propertyIndex, /*captureRequired*/true);
}
-ReturnedValue Runtime::getQmlSingletonQObjectProperty(ExecutionContext *ctx, const ValueRef object, int propertyIndex, bool captureRequired)
+ReturnedValue Runtime::getQmlSingletonQObjectProperty(ExecutionEngine *engine, const ValueRef object, int propertyIndex, bool captureRequired)
{
- Scope scope(ctx);
+ Scope scope(engine);
QV4::Scoped<QmlTypeWrapper> wrapper(scope, object);
if (!wrapper) {
scope.engine->throwTypeError(QStringLiteral("Cannot read property of null"));
return Encode::undefined();
}
- return QV4::QObjectWrapper::getProperty(wrapper->singletonObject(), ctx, propertyIndex, captureRequired);
+ return QV4::QObjectWrapper::getProperty(wrapper->singletonObject(), engine->currentContext(), propertyIndex, captureRequired);
}
-void Runtime::setQmlQObjectProperty(ExecutionContext *ctx, const ValueRef object, int propertyIndex, const ValueRef value)
+void Runtime::setQmlQObjectProperty(ExecutionEngine *engine, const ValueRef object, int propertyIndex, const ValueRef value)
{
- Scope scope(ctx);
+ Scope scope(engine);
QV4::Scoped<QObjectWrapper> wrapper(scope, object);
if (!wrapper) {
- ctx->engine()->throwTypeError(QStringLiteral("Cannot write property of null"));
+ engine->throwTypeError(QStringLiteral("Cannot write property of null"));
return;
}
- wrapper->setProperty(ctx, propertyIndex, value);
+ wrapper->setProperty(engine->currentContext(), propertyIndex, value);
}
-ReturnedValue Runtime::getQmlImportedScripts(NoThrowContext *ctx)
+ReturnedValue Runtime::getQmlImportedScripts(NoThrowEngine *engine)
{
- QQmlContextData *context = QmlContextWrapper::callingContext(ctx->engine());
+ QQmlContextData *context = QmlContextWrapper::callingContext(engine);
if (!context)
return Encode::undefined();
return context->importedScripts.value();
}
-QV4::ReturnedValue Runtime::getQmlSingleton(QV4::NoThrowContext *ctx, String *name)
+QV4::ReturnedValue Runtime::getQmlSingleton(QV4::NoThrowEngine *engine, String *name)
{
- return static_cast<QmlContextWrapper *>(ctx->engine()->qmlContextObject()->getPointer())->qmlSingletonWrapper(ctx->engine()->v8Engine, name);
+ return static_cast<QmlContextWrapper *>(engine->qmlContextObject()->getPointer())->qmlSingletonWrapper(engine->v8Engine, name);
}
-void Runtime::convertThisToObject(ExecutionContext *ctx)
+void Runtime::convertThisToObject(ExecutionEngine *engine)
{
- Value *t = &ctx->d()->callData->thisObject;
+ Value *t = &engine->currentContext()->d()->callData->thisObject;
if (t->isObject())
return;
if (t->isNullOrUndefined()) {
- *t = ctx->engine()->globalObject->asReturnedValue();
+ *t = engine->globalObject->asReturnedValue();
} else {
- *t = t->toObject(ctx)->asReturnedValue();
+ *t = t->toObject(engine)->asReturnedValue();
}
}
diff --git a/src/qml/jsruntime/qv4runtime_p.h b/src/qml/jsruntime/qv4runtime_p.h
index 3ba8a78bd0..ea76451760 100644
--- a/src/qml/jsruntime/qv4runtime_p.h
+++ b/src/qml/jsruntime/qv4runtime_p.h
@@ -82,67 +82,67 @@ enum TypeHint {
// This is a trick to tell the code generators that functions taking a NoThrowContext won't
// throw exceptions and therefore don't need a check after the call.
-struct NoThrowContext : public ExecutionContext
+struct NoThrowEngine : public ExecutionEngine
{
};
struct Q_QML_PRIVATE_EXPORT Runtime {
// call
- static ReturnedValue callGlobalLookup(ExecutionContext *context, uint index, CallData *callData);
- static ReturnedValue callActivationProperty(ExecutionContext *, String *name, CallData *callData);
- static ReturnedValue callProperty(ExecutionContext *context, String *name, CallData *callData);
- static ReturnedValue callPropertyLookup(ExecutionContext *context, uint index, CallData *callData);
- static ReturnedValue callElement(ExecutionContext *context, const ValueRef index, CallData *callData);
- static ReturnedValue callValue(ExecutionContext *context, const ValueRef func, CallData *callData);
+ static ReturnedValue callGlobalLookup(ExecutionEngine *engine, uint index, CallData *callData);
+ static ReturnedValue callActivationProperty(ExecutionEngine *engine, String *name, CallData *callData);
+ static ReturnedValue callProperty(ExecutionEngine *engine, String *name, CallData *callData);
+ static ReturnedValue callPropertyLookup(ExecutionEngine *engine, uint index, CallData *callData);
+ static ReturnedValue callElement(ExecutionEngine *engine, const ValueRef index, CallData *callData);
+ static ReturnedValue callValue(ExecutionEngine *engine, const ValueRef func, CallData *callData);
// construct
- static ReturnedValue constructGlobalLookup(ExecutionContext *context, uint index, CallData *callData);
- static ReturnedValue constructActivationProperty(ExecutionContext *, String *name, CallData *callData);
- static ReturnedValue constructProperty(ExecutionContext *context, String *name, CallData *callData);
- static ReturnedValue constructPropertyLookup(ExecutionContext *context, uint index, CallData *callData);
- static ReturnedValue constructValue(ExecutionContext *context, const ValueRef func, CallData *callData);
+ static ReturnedValue constructGlobalLookup(ExecutionEngine *engine, uint index, CallData *callData);
+ static ReturnedValue constructActivationProperty(ExecutionEngine *engine, String *name, CallData *callData);
+ static ReturnedValue constructProperty(ExecutionEngine *engine, String *name, CallData *callData);
+ static ReturnedValue constructPropertyLookup(ExecutionEngine *engine, uint index, CallData *callData);
+ static ReturnedValue constructValue(ExecutionEngine *engine, const ValueRef func, CallData *callData);
// set & get
- static void setActivationProperty(ExecutionContext *ctx, String *name, const ValueRef value);
- static void setProperty(ExecutionContext *ctx, const ValueRef object, String *name, const ValueRef value);
- static void setElement(ExecutionContext *ctx, const ValueRef object, const ValueRef index, const ValueRef value);
- static ReturnedValue getProperty(ExecutionContext *ctx, const ValueRef object, String *name);
- static ReturnedValue getActivationProperty(ExecutionContext *ctx, String *name);
- static ReturnedValue getElement(ExecutionContext *ctx, const ValueRef object, const ValueRef index);
+ static void setActivationProperty(ExecutionEngine *engine, String *name, const ValueRef value);
+ static void setProperty(ExecutionEngine *engine, const ValueRef object, String *name, const ValueRef value);
+ static void setElement(ExecutionEngine *engine, const ValueRef object, const ValueRef index, const ValueRef value);
+ static ReturnedValue getProperty(ExecutionEngine *engine, const ValueRef object, String *name);
+ static ReturnedValue getActivationProperty(ExecutionEngine *engine, String *name);
+ static ReturnedValue getElement(ExecutionEngine *engine, const ValueRef object, const ValueRef index);
// typeof
- static ReturnedValue typeofValue(ExecutionContext *ctx, const ValueRef val);
- static ReturnedValue typeofName(ExecutionContext *context, String *name);
- static ReturnedValue typeofMember(ExecutionContext* context, const ValueRef base, String *name);
- static ReturnedValue typeofElement(ExecutionContext* context, const ValueRef base, const ValueRef index);
+ static ReturnedValue typeofValue(ExecutionEngine *engine, const ValueRef val);
+ static ReturnedValue typeofName(ExecutionEngine *engine, String *name);
+ static ReturnedValue typeofMember(ExecutionEngine *engine, const ValueRef base, String *name);
+ static ReturnedValue typeofElement(ExecutionEngine *engine, const ValueRef base, const ValueRef index);
// delete
- static ReturnedValue deleteElement(ExecutionContext *ctx, const ValueRef base, const ValueRef index);
- static ReturnedValue deleteMember(ExecutionContext *ctx, const ValueRef base, String *name);
- static ReturnedValue deleteName(ExecutionContext *ctx, String *name);
+ static ReturnedValue deleteElement(ExecutionEngine *engine, const ValueRef base, const ValueRef index);
+ static ReturnedValue deleteMember(ExecutionEngine *engine, const ValueRef base, String *name);
+ static ReturnedValue deleteName(ExecutionEngine *engine, String *name);
// exceptions & scopes
- static void throwException(ExecutionContext*, const ValueRef value);
- static ReturnedValue unwindException(ExecutionContext *ctx);
- static ExecutionContext *pushWithScope(const ValueRef o, ExecutionContext *ctx);
- static ExecutionContext *pushCatchScope(ExecutionContext *ctx, String *exceptionVarName);
- static ExecutionContext *popScope(ExecutionContext *ctx);
+ static void throwException(ExecutionEngine *engine, const ValueRef value);
+ static ReturnedValue unwindException(ExecutionEngine *engine);
+ static void pushWithScope(const ValueRef o, NoThrowEngine *engine);
+ static void pushCatchScope(NoThrowEngine *engine, String *exceptionVarName);
+ static void popScope(ExecutionEngine *engine);
// closures
- static ReturnedValue closure(ExecutionContext *ctx, int functionId);
+ static ReturnedValue closure(ExecutionEngine *engine, int functionId);
// function header
- static void declareVar(ExecutionContext *ctx, bool deletable, String *name);
- static ReturnedValue setupArgumentsObject(ExecutionContext *ctx);
- static void convertThisToObject(ExecutionContext *ctx);
+ static void declareVar(ExecutionEngine *engine, bool deletable, String *name);
+ static ReturnedValue setupArgumentsObject(ExecutionEngine *engine);
+ static void convertThisToObject(ExecutionEngine *engine);
// literals
- static ReturnedValue arrayLiteral(ExecutionContext *ctx, Value *values, uint length);
- static ReturnedValue objectLiteral(ExecutionContext *ctx, const Value *args, int classId, int arrayValueCount, int arrayGetterSetterCountAndFlags);
- static ReturnedValue regexpLiteral(ExecutionContext *ctx, int id);
+ 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);
// foreach
- static ReturnedValue foreachIterator(ExecutionContext *ctx, const ValueRef in);
+ static ReturnedValue foreachIterator(ExecutionEngine *engine, const ValueRef in);
static ReturnedValue foreachNextPropertyName(const ValueRef foreach_iterator);
// unary operators
@@ -156,12 +156,12 @@ struct Q_QML_PRIVATE_EXPORT Runtime {
// binary operators
typedef ReturnedValue (*BinaryOperation)(const ValueRef left, const ValueRef right);
- typedef ReturnedValue (*BinaryOperationContext)(ExecutionContext *ctx, const ValueRef left, const ValueRef right);
+ typedef ReturnedValue (*BinaryOperationContext)(ExecutionEngine *engine, const ValueRef left, const ValueRef right);
- static ReturnedValue instanceof(ExecutionContext *ctx, const ValueRef left, const ValueRef right);
- static ReturnedValue in(ExecutionContext *ctx, const ValueRef left, const ValueRef right);
- static ReturnedValue add(ExecutionContext *ctx, const ValueRef left, const ValueRef right);
- static ReturnedValue addString(ExecutionContext *ctx, const ValueRef left, const ValueRef right);
+ static ReturnedValue instanceof(ExecutionEngine *engine, const ValueRef left, const ValueRef right);
+ static ReturnedValue in(ExecutionEngine *engine, const ValueRef left, const ValueRef right);
+ static ReturnedValue add(ExecutionEngine *engine, const ValueRef left, const ValueRef right);
+ static ReturnedValue addString(ExecutionEngine *engine, const ValueRef left, const ValueRef right);
static ReturnedValue bitOr(const ValueRef left, const ValueRef right);
static ReturnedValue bitXor(const ValueRef left, const ValueRef right);
static ReturnedValue bitAnd(const ValueRef left, const ValueRef right);
@@ -192,9 +192,9 @@ struct Q_QML_PRIVATE_EXPORT Runtime {
static Bool compareStrictEqual(const ValueRef left, const ValueRef right);
static Bool compareStrictNotEqual(const ValueRef left, const ValueRef right);
- typedef Bool (*CompareOperationContext)(ExecutionContext *ctx, const ValueRef left, const ValueRef right);
- static Bool compareInstanceof(ExecutionContext *ctx, const ValueRef left, const ValueRef right);
- static Bool compareIn(ExecutionContext *ctx, const ValueRef left, const ValueRef right);
+ typedef Bool (*CompareOperationContext)(ExecutionEngine *engine, const ValueRef left, const ValueRef right);
+ static Bool compareInstanceof(ExecutionEngine *engine, const ValueRef left, const ValueRef right);
+ static Bool compareIn(ExecutionEngine *engine, const ValueRef left, const ValueRef right);
// conversions
static Bool toBoolean(const ValueRef value);
@@ -205,15 +205,15 @@ struct Q_QML_PRIVATE_EXPORT Runtime {
static unsigned doubleToUInt(const double &d);
// qml
- static ReturnedValue getQmlIdArray(NoThrowContext *ctx);
- static ReturnedValue getQmlImportedScripts(NoThrowContext *ctx);
- static ReturnedValue getQmlContextObject(NoThrowContext *ctx);
- static ReturnedValue getQmlScopeObject(NoThrowContext *ctx);
- static ReturnedValue getQmlSingleton(NoThrowContext *ctx, String *name);
- static ReturnedValue getQmlAttachedProperty(ExecutionContext *ctx, int attachedPropertiesId, int propertyIndex);
- static ReturnedValue getQmlQObjectProperty(ExecutionContext *ctx, const ValueRef object, int propertyIndex, bool captureRequired);
- static ReturnedValue getQmlSingletonQObjectProperty(ExecutionContext *ctx, const ValueRef object, int propertyIndex, bool captureRequired);
- static void setQmlQObjectProperty(ExecutionContext *ctx, const ValueRef object, int propertyIndex, const ValueRef value);
+ static ReturnedValue getQmlIdArray(NoThrowEngine *ctx);
+ static ReturnedValue getQmlImportedScripts(NoThrowEngine *ctx);
+ static ReturnedValue getQmlContextObject(NoThrowEngine *ctx);
+ static ReturnedValue getQmlScopeObject(NoThrowEngine *ctx);
+ static ReturnedValue getQmlSingleton(NoThrowEngine *ctx, String *name);
+ static ReturnedValue getQmlAttachedProperty(ExecutionEngine *engine, int attachedPropertiesId, int propertyIndex);
+ static ReturnedValue getQmlQObjectProperty(ExecutionEngine *engine, const ValueRef object, int propertyIndex, bool captureRequired);
+ static ReturnedValue getQmlSingletonQObjectProperty(ExecutionEngine *engine, const ValueRef object, int propertyIndex, bool captureRequired);
+ static void setQmlQObjectProperty(ExecutionEngine *engine, const ValueRef object, int propertyIndex, const ValueRef value);
};
struct Q_QML_PRIVATE_EXPORT RuntimeHelpers {
@@ -325,7 +325,7 @@ inline ReturnedValue Runtime::bitAnd(const ValueRef left, const ValueRef right)
}
#ifndef V4_BOOTSTRAP
-inline ReturnedValue Runtime::add(ExecutionContext *ctx, const ValueRef left, const ValueRef right)
+inline ReturnedValue Runtime::add(ExecutionEngine *engine, const ValueRef left, const ValueRef right)
{
TRACE2(left, right);
@@ -334,7 +334,7 @@ inline ReturnedValue Runtime::add(ExecutionContext *ctx, const ValueRef left, co
if (left->isNumber() && right->isNumber())
return Primitive::fromDouble(left->asDouble() + right->asDouble()).asReturnedValue();
- return RuntimeHelpers::addHelper(ctx->engine(), left, right);
+ return RuntimeHelpers::addHelper(engine, left, right);
}
#endif // V4_BOOTSTRAP
diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp
index 71a8284ec1..956c48e74b 100644
--- a/src/qml/jsruntime/qv4script.cpp
+++ b/src/qml/jsruntime/qv4script.cpp
@@ -144,7 +144,7 @@ ReturnedValue QmlBindingWrapper::call(Managed *that, CallData *)
Scoped<CallContext> ctx(scope, This->d()->qmlContext);
std::fill(ctx->d()->locals, ctx->d()->locals + ctx->d()->function->varCount(), Primitive::undefinedValue());
engine->pushContext(ctx);
- ScopedValue result(scope, This->function()->code(ctx, This->function()->codeData));
+ ScopedValue result(scope, This->function()->code(engine, This->function()->codeData));
engine->popContext();
return result.asReturnedValue();
@@ -307,7 +307,7 @@ ReturnedValue Script::run()
scope->d()->lookups = vmFunction->compilationUnit->runtimeLookups;
scope->d()->compilationUnit = vmFunction->compilationUnit;
- return vmFunction->code(scope, vmFunction->codeData);
+ return vmFunction->code(engine, vmFunction->codeData);
} else {
ScopedObject qmlObj(valueScope, qml.value());
ScopedFunctionObject f(valueScope, engine->memoryManager->alloc<QmlBindingWrapper>(scope, vmFunction, qmlObj));
diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp
index bc711b4a23..37dcb3487b 100644
--- a/src/qml/jsruntime/qv4vme_moth.cpp
+++ b/src/qml/jsruntime/qv4vme_moth.cpp
@@ -150,7 +150,7 @@ Param traceParam(const Param &param)
if (engine->hasException) \
goto catchException
-QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
+QV4::ReturnedValue VME::run(ExecutionEngine *engine, const uchar *code
#ifdef MOTH_THREADED_INTERPRETER
, void ***storeJumpTable
#endif
@@ -177,8 +177,8 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
const uchar *exceptionHandler = 0;
+ QV4::ExecutionContext *context = engine->currentContext();
context->d()->lineNumber = -1;
- QV4::ExecutionEngine *engine = context->d()->engine;
#ifdef DO_TRACE_INSTR
qDebug("Starting VME with context=%p and code=%p", context, code);
@@ -249,28 +249,28 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
MOTH_END_INSTR(LoadRegExp)
MOTH_BEGIN_INSTR(LoadClosure)
- STOREVALUE(instr.result, Runtime::closure(context, instr.value));
+ STOREVALUE(instr.result, Runtime::closure(engine, instr.value));
MOTH_END_INSTR(LoadClosure)
MOTH_BEGIN_INSTR(LoadName)
TRACE(inline, "property name = %s", runtimeStrings[instr.name]->toQString().toUtf8().constData());
- STOREVALUE(instr.result, Runtime::getActivationProperty(context, runtimeStrings[instr.name]));
+ STOREVALUE(instr.result, Runtime::getActivationProperty(engine, runtimeStrings[instr.name]));
MOTH_END_INSTR(LoadName)
MOTH_BEGIN_INSTR(GetGlobalLookup)
TRACE(inline, "property name = %s", runtimeStrings[instr.name]->toQString().toUtf8().constData());
QV4::Lookup *l = context->d()->lookups + instr.index;
- STOREVALUE(instr.result, l->globalGetter(l, context));
+ STOREVALUE(instr.result, l->globalGetter(l, engine));
MOTH_END_INSTR(GetGlobalLookup)
MOTH_BEGIN_INSTR(StoreName)
TRACE(inline, "property name = %s", runtimeStrings[instr.name]->toQString().toUtf8().constData());
- Runtime::setActivationProperty(context, runtimeStrings[instr.name], VALUEPTR(instr.source));
+ Runtime::setActivationProperty(engine, runtimeStrings[instr.name], VALUEPTR(instr.source));
CHECK_EXCEPTION;
MOTH_END_INSTR(StoreName)
MOTH_BEGIN_INSTR(LoadElement)
- STOREVALUE(instr.result, Runtime::getElement(context, VALUEPTR(instr.base), VALUEPTR(instr.index)));
+ STOREVALUE(instr.result, Runtime::getElement(engine, VALUEPTR(instr.base), VALUEPTR(instr.index)));
MOTH_END_INSTR(LoadElement)
MOTH_BEGIN_INSTR(LoadElementLookup)
@@ -279,7 +279,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
MOTH_END_INSTR(LoadElementLookup)
MOTH_BEGIN_INSTR(StoreElement)
- Runtime::setElement(context, VALUEPTR(instr.base), VALUEPTR(instr.index), VALUEPTR(instr.source));
+ Runtime::setElement(engine, VALUEPTR(instr.base), VALUEPTR(instr.index), VALUEPTR(instr.source));
CHECK_EXCEPTION;
MOTH_END_INSTR(StoreElement)
@@ -290,7 +290,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
MOTH_END_INSTR(StoreElementLookup)
MOTH_BEGIN_INSTR(LoadProperty)
- STOREVALUE(instr.result, Runtime::getProperty(context, VALUEPTR(instr.base), runtimeStrings[instr.name]));
+ STOREVALUE(instr.result, Runtime::getProperty(engine, VALUEPTR(instr.base), runtimeStrings[instr.name]));
MOTH_END_INSTR(LoadProperty)
MOTH_BEGIN_INSTR(GetLookup)
@@ -299,7 +299,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
MOTH_END_INSTR(GetLookup)
MOTH_BEGIN_INSTR(StoreProperty)
- Runtime::setProperty(context, VALUEPTR(instr.base), runtimeStrings[instr.name], VALUEPTR(instr.source));
+ Runtime::setProperty(engine, VALUEPTR(instr.base), runtimeStrings[instr.name], VALUEPTR(instr.source));
CHECK_EXCEPTION;
MOTH_END_INSTR(StoreProperty)
@@ -310,20 +310,20 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
MOTH_END_INSTR(SetLookup)
MOTH_BEGIN_INSTR(StoreQObjectProperty)
- Runtime::setQmlQObjectProperty(context, VALUEPTR(instr.base), instr.propertyIndex, VALUEPTR(instr.source));
+ Runtime::setQmlQObjectProperty(engine, VALUEPTR(instr.base), instr.propertyIndex, VALUEPTR(instr.source));
CHECK_EXCEPTION;
MOTH_END_INSTR(StoreQObjectProperty)
MOTH_BEGIN_INSTR(LoadQObjectProperty)
- STOREVALUE(instr.result, Runtime::getQmlQObjectProperty(context, VALUEPTR(instr.base), instr.propertyIndex, instr.captureRequired));
+ STOREVALUE(instr.result, Runtime::getQmlQObjectProperty(engine, VALUEPTR(instr.base), instr.propertyIndex, instr.captureRequired));
MOTH_END_INSTR(LoadQObjectProperty)
MOTH_BEGIN_INSTR(LoadAttachedQObjectProperty)
- STOREVALUE(instr.result, Runtime::getQmlAttachedProperty(context, instr.attachedPropertiesId, instr.propertyIndex));
+ STOREVALUE(instr.result, Runtime::getQmlAttachedProperty(engine, instr.attachedPropertiesId, instr.propertyIndex));
MOTH_END_INSTR(LoadAttachedQObjectProperty)
MOTH_BEGIN_INSTR(LoadSingletonQObjectProperty)
- STOREVALUE(instr.result, Runtime::getQmlSingletonQObjectProperty(context, VALUEPTR(instr.base), instr.propertyIndex, instr.captureRequired));
+ STOREVALUE(instr.result, Runtime::getQmlSingletonQObjectProperty(engine, VALUEPTR(instr.base), instr.propertyIndex, instr.captureRequired));
MOTH_END_INSTR(LoadSingletonQObjectProperty)
MOTH_BEGIN_INSTR(Push)
@@ -352,7 +352,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
callData->tag = QV4::Value::Integer_Type;
callData->argc = instr.argc;
callData->thisObject = QV4::Primitive::undefinedValue();
- STOREVALUE(instr.result, Runtime::callValue(context, VALUEPTR(instr.dest), callData));
+ STOREVALUE(instr.result, Runtime::callValue(engine, VALUEPTR(instr.dest), callData));
MOTH_END_INSTR(CallValue)
MOTH_BEGIN_INSTR(CallProperty)
@@ -362,7 +362,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
callData->tag = QV4::Value::Integer_Type;
callData->argc = instr.argc;
callData->thisObject = VALUE(instr.base);
- STOREVALUE(instr.result, Runtime::callProperty(context, runtimeStrings[instr.name], callData));
+ STOREVALUE(instr.result, Runtime::callProperty(engine, runtimeStrings[instr.name], callData));
MOTH_END_INSTR(CallProperty)
MOTH_BEGIN_INSTR(CallPropertyLookup)
@@ -372,7 +372,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
callData->tag = QV4::Value::Integer_Type;
callData->argc = instr.argc;
callData->thisObject = VALUE(instr.base);
- STOREVALUE(instr.result, Runtime::callPropertyLookup(context, instr.lookupIndex, callData));
+ STOREVALUE(instr.result, Runtime::callPropertyLookup(engine, instr.lookupIndex, callData));
MOTH_END_INSTR(CallPropertyLookup)
MOTH_BEGIN_INSTR(CallElement)
@@ -381,7 +381,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
callData->tag = QV4::Value::Integer_Type;
callData->argc = instr.argc;
callData->thisObject = VALUE(instr.base);
- STOREVALUE(instr.result, Runtime::callElement(context, VALUEPTR(instr.index), callData));
+ STOREVALUE(instr.result, Runtime::callElement(engine, VALUEPTR(instr.index), callData));
MOTH_END_INSTR(CallElement)
MOTH_BEGIN_INSTR(CallActivationProperty)
@@ -391,7 +391,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
callData->tag = QV4::Value::Integer_Type;
callData->argc = instr.argc;
callData->thisObject = QV4::Primitive::undefinedValue();
- STOREVALUE(instr.result, Runtime::callActivationProperty(context, runtimeStrings[instr.name], callData));
+ STOREVALUE(instr.result, Runtime::callActivationProperty(engine, runtimeStrings[instr.name], callData));
MOTH_END_INSTR(CallActivationProperty)
MOTH_BEGIN_INSTR(CallGlobalLookup)
@@ -401,7 +401,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
callData->tag = QV4::Value::Integer_Type;
callData->argc = instr.argc;
callData->thisObject = QV4::Primitive::undefinedValue();
- STOREVALUE(instr.result, Runtime::callGlobalLookup(context, instr.index, callData));
+ STOREVALUE(instr.result, Runtime::callGlobalLookup(engine, instr.index, callData));
MOTH_END_INSTR(CallGlobalLookup)
MOTH_BEGIN_INSTR(SetExceptionHandler)
@@ -409,28 +409,31 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
MOTH_END_INSTR(SetExceptionHandler)
MOTH_BEGIN_INSTR(CallBuiltinThrow)
- Runtime::throwException(context, VALUEPTR(instr.arg));
+ Runtime::throwException(engine, VALUEPTR(instr.arg));
CHECK_EXCEPTION;
MOTH_END_INSTR(CallBuiltinThrow)
MOTH_BEGIN_INSTR(CallBuiltinUnwindException)
- STOREVALUE(instr.result, Runtime::unwindException(context));
+ STOREVALUE(instr.result, Runtime::unwindException(engine));
MOTH_END_INSTR(CallBuiltinUnwindException)
MOTH_BEGIN_INSTR(CallBuiltinPushCatchScope)
- context = Runtime::pushCatchScope(context, runtimeStrings[instr.name]);
+ Runtime::pushCatchScope(static_cast<QV4::NoThrowEngine*>(engine), runtimeStrings[instr.name]);
+ context = engine->currentContext();
MOTH_END_INSTR(CallBuiltinPushCatchScope)
MOTH_BEGIN_INSTR(CallBuiltinPushScope)
- context = Runtime::pushWithScope(VALUEPTR(instr.arg), context);
+ Runtime::pushWithScope(VALUEPTR(instr.arg), static_cast<QV4::NoThrowEngine*>(engine));
+ context = engine->currentContext();
MOTH_END_INSTR(CallBuiltinPushScope)
MOTH_BEGIN_INSTR(CallBuiltinPopScope)
- context = Runtime::popScope(context);
+ Runtime::popScope(engine);
+ context = engine->currentContext();
MOTH_END_INSTR(CallBuiltinPopScope)
MOTH_BEGIN_INSTR(CallBuiltinForeachIteratorObject)
- STOREVALUE(instr.result, Runtime::foreachIterator(context, VALUEPTR(instr.arg)));
+ STOREVALUE(instr.result, Runtime::foreachIterator(engine, VALUEPTR(instr.arg)));
MOTH_END_INSTR(CallBuiltinForeachIteratorObject)
MOTH_BEGIN_INSTR(CallBuiltinForeachNextPropertyName)
@@ -438,54 +441,54 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
MOTH_END_INSTR(CallBuiltinForeachNextPropertyName)
MOTH_BEGIN_INSTR(CallBuiltinDeleteMember)
- STOREVALUE(instr.result, Runtime::deleteMember(context, VALUEPTR(instr.base), runtimeStrings[instr.member]));
+ STOREVALUE(instr.result, Runtime::deleteMember(engine, VALUEPTR(instr.base), runtimeStrings[instr.member]));
MOTH_END_INSTR(CallBuiltinDeleteMember)
MOTH_BEGIN_INSTR(CallBuiltinDeleteSubscript)
- STOREVALUE(instr.result, Runtime::deleteElement(context, VALUEPTR(instr.base), VALUEPTR(instr.index)));
+ STOREVALUE(instr.result, Runtime::deleteElement(engine, VALUEPTR(instr.base), VALUEPTR(instr.index)));
MOTH_END_INSTR(CallBuiltinDeleteSubscript)
MOTH_BEGIN_INSTR(CallBuiltinDeleteName)
- STOREVALUE(instr.result, Runtime::deleteName(context, runtimeStrings[instr.name]));
+ STOREVALUE(instr.result, Runtime::deleteName(engine, runtimeStrings[instr.name]));
MOTH_END_INSTR(CallBuiltinDeleteName)
MOTH_BEGIN_INSTR(CallBuiltinTypeofMember)
- STOREVALUE(instr.result, Runtime::typeofMember(context, VALUEPTR(instr.base), runtimeStrings[instr.member]));
+ STOREVALUE(instr.result, Runtime::typeofMember(engine, VALUEPTR(instr.base), runtimeStrings[instr.member]));
MOTH_END_INSTR(CallBuiltinTypeofMember)
MOTH_BEGIN_INSTR(CallBuiltinTypeofSubscript)
- STOREVALUE(instr.result, Runtime::typeofElement(context, VALUEPTR(instr.base), VALUEPTR(instr.index)));
+ STOREVALUE(instr.result, Runtime::typeofElement(engine, VALUEPTR(instr.base), VALUEPTR(instr.index)));
MOTH_END_INSTR(CallBuiltinTypeofSubscript)
MOTH_BEGIN_INSTR(CallBuiltinTypeofName)
- STOREVALUE(instr.result, Runtime::typeofName(context, runtimeStrings[instr.name]));
+ STOREVALUE(instr.result, Runtime::typeofName(engine, runtimeStrings[instr.name]));
MOTH_END_INSTR(CallBuiltinTypeofName)
MOTH_BEGIN_INSTR(CallBuiltinTypeofValue)
- STOREVALUE(instr.result, Runtime::typeofValue(context, VALUEPTR(instr.value)));
+ STOREVALUE(instr.result, Runtime::typeofValue(engine, VALUEPTR(instr.value)));
MOTH_END_INSTR(CallBuiltinTypeofValue)
MOTH_BEGIN_INSTR(CallBuiltinDeclareVar)
- Runtime::declareVar(context, instr.isDeletable, runtimeStrings[instr.varName]);
+ Runtime::declareVar(engine, instr.isDeletable, runtimeStrings[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(context, args, instr.argc));
+ STOREVALUE(instr.result, 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(context, args, instr.internalClassId, instr.arrayValueCount, instr.arrayGetterSetterCountAndFlags));
+ STOREVALUE(instr.result, Runtime::objectLiteral(engine, args, instr.internalClassId, instr.arrayValueCount, instr.arrayGetterSetterCountAndFlags));
MOTH_END_INSTR(CallBuiltinDefineObjectLiteral)
MOTH_BEGIN_INSTR(CallBuiltinSetupArgumentsObject)
- STOREVALUE(instr.result, Runtime::setupArgumentsObject(context));
+ STOREVALUE(instr.result, Runtime::setupArgumentsObject(engine));
MOTH_END_INSTR(CallBuiltinSetupArgumentsObject)
MOTH_BEGIN_INSTR(CallBuiltinConvertThisToObject)
- Runtime::convertThisToObject(context);
+ Runtime::convertThisToObject(engine);
CHECK_EXCEPTION;
MOTH_END_INSTR(CallBuiltinConvertThisToObject)
@@ -495,7 +498,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
callData->tag = QV4::Value::Integer_Type;
callData->argc = instr.argc;
callData->thisObject = QV4::Primitive::undefinedValue();
- STOREVALUE(instr.result, Runtime::constructValue(context, VALUEPTR(instr.func), callData));
+ STOREVALUE(instr.result, Runtime::constructValue(engine, VALUEPTR(instr.func), callData));
MOTH_END_INSTR(CreateValue)
MOTH_BEGIN_INSTR(CreateProperty)
@@ -504,7 +507,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
callData->tag = QV4::Value::Integer_Type;
callData->argc = instr.argc;
callData->thisObject = VALUE(instr.base);
- STOREVALUE(instr.result, Runtime::constructProperty(context, runtimeStrings[instr.name], callData));
+ STOREVALUE(instr.result, Runtime::constructProperty(engine, runtimeStrings[instr.name], callData));
MOTH_END_INSTR(CreateProperty)
MOTH_BEGIN_INSTR(ConstructPropertyLookup)
@@ -513,7 +516,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
callData->tag = QV4::Value::Integer_Type;
callData->argc = instr.argc;
callData->thisObject = VALUE(instr.base);
- STOREVALUE(instr.result, Runtime::constructPropertyLookup(context, instr.index, callData));
+ STOREVALUE(instr.result, Runtime::constructPropertyLookup(engine, instr.index, callData));
MOTH_END_INSTR(ConstructPropertyLookup)
MOTH_BEGIN_INSTR(CreateActivationProperty)
@@ -523,7 +526,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
callData->tag = QV4::Value::Integer_Type;
callData->argc = instr.argc;
callData->thisObject = QV4::Primitive::undefinedValue();
- STOREVALUE(instr.result, Runtime::constructActivationProperty(context, runtimeStrings[instr.name], callData));
+ STOREVALUE(instr.result, Runtime::constructActivationProperty(engine, runtimeStrings[instr.name], callData));
MOTH_END_INSTR(CreateActivationProperty)
MOTH_BEGIN_INSTR(ConstructGlobalLookup)
@@ -533,7 +536,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
callData->tag = QV4::Value::Integer_Type;
callData->argc = instr.argc;
callData->thisObject = QV4::Primitive::undefinedValue();
- STOREVALUE(instr.result, Runtime::constructGlobalLookup(context, instr.index, callData));
+ STOREVALUE(instr.result, Runtime::constructGlobalLookup(engine, instr.index, callData));
MOTH_END_INSTR(ConstructGlobalLookup)
MOTH_BEGIN_INSTR(Jump)
@@ -592,7 +595,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
MOTH_END_INSTR(Binop)
MOTH_BEGIN_INSTR(Add)
- STOREVALUE(instr.result, Runtime::add(context, VALUEPTR(instr.lhs), VALUEPTR(instr.rhs)));
+ STOREVALUE(instr.result, Runtime::add(engine, VALUEPTR(instr.lhs), VALUEPTR(instr.rhs)));
MOTH_END_INSTR(Add)
MOTH_BEGIN_INSTR(BitAnd)
@@ -647,7 +650,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
MOTH_END_INSTR(Sub)
MOTH_BEGIN_INSTR(BinopContext)
- STOREVALUE(instr.result, instr.alu(context, VALUEPTR(instr.lhs), VALUEPTR(instr.rhs)));
+ STOREVALUE(instr.result, instr.alu(engine, VALUEPTR(instr.lhs), VALUEPTR(instr.rhs)));
MOTH_END_INSTR(BinopContext)
MOTH_BEGIN_INSTR(Ret)
@@ -672,23 +675,23 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
MOTH_END_INSTR(LoadThis)
MOTH_BEGIN_INSTR(LoadQmlIdArray)
- VALUE(instr.result) = Runtime::getQmlIdArray(static_cast<QV4::NoThrowContext*>(context));
+ VALUE(instr.result) = Runtime::getQmlIdArray(static_cast<QV4::NoThrowEngine*>(engine));
MOTH_END_INSTR(LoadQmlIdArray)
MOTH_BEGIN_INSTR(LoadQmlImportedScripts)
- VALUE(instr.result) = Runtime::getQmlImportedScripts(static_cast<QV4::NoThrowContext*>(context));
+ VALUE(instr.result) = Runtime::getQmlImportedScripts(static_cast<QV4::NoThrowEngine*>(engine));
MOTH_END_INSTR(LoadQmlImportedScripts)
MOTH_BEGIN_INSTR(LoadQmlContextObject)
- VALUE(instr.result) = Runtime::getQmlContextObject(static_cast<QV4::NoThrowContext*>(context));
+ VALUE(instr.result) = Runtime::getQmlContextObject(static_cast<QV4::NoThrowEngine*>(engine));
MOTH_END_INSTR(LoadContextObject)
MOTH_BEGIN_INSTR(LoadQmlScopeObject)
- VALUE(instr.result) = Runtime::getQmlScopeObject(static_cast<QV4::NoThrowContext*>(context));
+ VALUE(instr.result) = Runtime::getQmlScopeObject(static_cast<QV4::NoThrowEngine*>(engine));
MOTH_END_INSTR(LoadScopeObject)
MOTH_BEGIN_INSTR(LoadQmlSingleton)
- VALUE(instr.result) = Runtime::getQmlSingleton(static_cast<QV4::NoThrowContext*>(context), runtimeStrings[instr.name]);
+ VALUE(instr.result) = Runtime::getQmlSingleton(static_cast<QV4::NoThrowEngine*>(engine), runtimeStrings[instr.name]);
MOTH_END_INSTR(LoadQmlSingleton)
#ifdef MOTH_THREADED_INTERPRETER
@@ -725,13 +728,13 @@ void **VME::instructionJumpTable()
}
#endif
-QV4::ReturnedValue VME::exec(QV4::ExecutionContext *ctxt, const uchar *code)
+QV4::ReturnedValue VME::exec(ExecutionEngine *engine, const uchar *code)
{
VME vme;
- QV4::Debugging::Debugger *debugger = ctxt->engine()->debugger;
+ QV4::Debugging::Debugger *debugger = engine->debugger;
if (debugger)
debugger->enteringFunction();
- QV4::ReturnedValue retVal = vme.run(ctxt, code);
+ QV4::ReturnedValue retVal = vme.run(engine, code);
if (debugger)
debugger->leavingFunction(retVal);
return retVal;
diff --git a/src/qml/jsruntime/qv4vme_moth_p.h b/src/qml/jsruntime/qv4vme_moth_p.h
index 731fb0f9a9..859208cd34 100644
--- a/src/qml/jsruntime/qv4vme_moth_p.h
+++ b/src/qml/jsruntime/qv4vme_moth_p.h
@@ -45,14 +45,14 @@ namespace Moth {
class VME
{
public:
- static QV4::ReturnedValue exec(QV4::ExecutionContext *, const uchar *);
+ static QV4::ReturnedValue exec(QV4::ExecutionEngine *, const uchar *);
#ifdef MOTH_THREADED_INTERPRETER
static void **instructionJumpTable();
#endif
private:
- QV4::ReturnedValue run(QV4::ExecutionContext *, const uchar *code
+ QV4::ReturnedValue run(QV4::ExecutionEngine *, const uchar *code
#ifdef MOTH_THREADED_INTERPRETER
, void ***storeJumpTable = 0
#endif