diff options
author | Lars Knoll <lars.knoll@digia.com> | 2014-11-11 16:07:54 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2014-11-12 12:13:54 +0100 |
commit | 9bad6eea0f30f6a6c1878c2773dc39071cb41584 (patch) | |
tree | 2306235d1db4f4abce697de2564a935229517bfd /src/qml/jit | |
parent | 345a5ee67bf80f7c18869fe080bf7dd7cf4a0d90 (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/jit')
-rw-r--r-- | src/qml/jit/qv4assembler.cpp | 19 | ||||
-rw-r--r-- | src/qml/jit/qv4assembler_p.h | 21 | ||||
-rw-r--r-- | src/qml/jit/qv4binop.cpp | 2 | ||||
-rw-r--r-- | src/qml/jit/qv4isel_masm.cpp | 116 | ||||
-rw-r--r-- | src/qml/jit/qv4targetplatform_p.h | 8 |
5 files changed, 85 insertions, 81 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; |