diff options
author | Lars Knoll <lars.knoll@digia.com> | 2014-02-14 13:58:40 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-23 09:39:52 +0100 |
commit | cad3ba5fd44c09455c2492548865a8743386ea18 (patch) | |
tree | 9cbd5d37b414f0585dac61feac65f542e40c143e /src/qml/compiler/qv4isel_moth.cpp | |
parent | 7dbb49bdec6e74f9d1eb096d15bdeea0881c3704 (diff) |
Clean up our internal namespaces
QQmlJS::MASM -> QV4::JIT
QQmlJS::V4IR -> QV4::IR
Change-Id: I707e8990459114a699c200fe3c22cec3c8df1afc
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/compiler/qv4isel_moth.cpp')
-rw-r--r-- | src/qml/compiler/qv4isel_moth.cpp | 356 |
1 files changed, 178 insertions, 178 deletions
diff --git a/src/qml/compiler/qv4isel_moth.cpp b/src/qml/compiler/qv4isel_moth.cpp index 130725f3ed..ba4f2331a1 100644 --- a/src/qml/compiler/qv4isel_moth.cpp +++ b/src/qml/compiler/qv4isel_moth.cpp @@ -51,71 +51,71 @@ #undef USE_TYPE_INFO -using namespace QQmlJS; -using namespace QQmlJS::Moth; +using namespace QV4; +using namespace QV4::Moth; namespace { -inline QV4::BinOp aluOpFunction(V4IR::AluOp op) +inline QV4::BinOp aluOpFunction(IR::AluOp op) { switch (op) { - case V4IR::OpInvalid: + case IR::OpInvalid: return 0; - case V4IR::OpIfTrue: + case IR::OpIfTrue: return 0; - case V4IR::OpNot: + case IR::OpNot: return 0; - case V4IR::OpUMinus: + case IR::OpUMinus: return 0; - case V4IR::OpUPlus: + case IR::OpUPlus: return 0; - case V4IR::OpCompl: + case IR::OpCompl: return 0; - case V4IR::OpBitAnd: + case IR::OpBitAnd: return QV4::__qmljs_bit_and; - case V4IR::OpBitOr: + case IR::OpBitOr: return QV4::__qmljs_bit_or; - case V4IR::OpBitXor: + case IR::OpBitXor: return QV4::__qmljs_bit_xor; - case V4IR::OpAdd: + case IR::OpAdd: return 0; - case V4IR::OpSub: + case IR::OpSub: return QV4::__qmljs_sub; - case V4IR::OpMul: + case IR::OpMul: return QV4::__qmljs_mul; - case V4IR::OpDiv: + case IR::OpDiv: return QV4::__qmljs_div; - case V4IR::OpMod: + case IR::OpMod: return QV4::__qmljs_mod; - case V4IR::OpLShift: + case IR::OpLShift: return QV4::__qmljs_shl; - case V4IR::OpRShift: + case IR::OpRShift: return QV4::__qmljs_shr; - case V4IR::OpURShift: + case IR::OpURShift: return QV4::__qmljs_ushr; - case V4IR::OpGt: + case IR::OpGt: return QV4::__qmljs_gt; - case V4IR::OpLt: + case IR::OpLt: return QV4::__qmljs_lt; - case V4IR::OpGe: + case IR::OpGe: return QV4::__qmljs_ge; - case V4IR::OpLe: + case IR::OpLe: return QV4::__qmljs_le; - case V4IR::OpEqual: + case IR::OpEqual: return QV4::__qmljs_eq; - case V4IR::OpNotEqual: + case IR::OpNotEqual: return QV4::__qmljs_ne; - case V4IR::OpStrictEqual: + case IR::OpStrictEqual: return QV4::__qmljs_se; - case V4IR::OpStrictNotEqual: + case IR::OpStrictNotEqual: return QV4::__qmljs_sne; - case V4IR::OpInstanceof: + case IR::OpInstanceof: return 0; - case V4IR::OpIn: + case IR::OpIn: return 0; - case V4IR::OpAnd: + case IR::OpAnd: return 0; - case V4IR::OpOr: + case IR::OpOr: return 0; default: assert(!"Unknown AluOp"); @@ -123,32 +123,32 @@ inline QV4::BinOp aluOpFunction(V4IR::AluOp op) } }; -inline bool isNumberType(V4IR::Expr *e) +inline bool isNumberType(IR::Expr *e) { switch (e->type) { - case V4IR::SInt32Type: - case V4IR::UInt32Type: - case V4IR::DoubleType: + case IR::SInt32Type: + case IR::UInt32Type: + case IR::DoubleType: return true; default: return false; } } -inline bool isIntegerType(V4IR::Expr *e) +inline bool isIntegerType(IR::Expr *e) { switch (e->type) { - case V4IR::SInt32Type: - case V4IR::UInt32Type: + case IR::SInt32Type: + case IR::UInt32Type: return true; default: return false; } } -inline bool isBoolType(V4IR::Expr *e) +inline bool isBoolType(IR::Expr *e) { - return (e->type == V4IR::BoolType); + return (e->type == IR::BoolType); } /* @@ -168,14 +168,14 @@ inline bool isBoolType(V4IR::Expr *e) */ class AllocateStackSlots: protected ConvertTemps { - const QVector<V4IR::LifeTimeInterval> _intervals; - QVector<const V4IR::LifeTimeInterval *> _unhandled; - QVector<const V4IR::LifeTimeInterval *> _live; + const QVector<IR::LifeTimeInterval> _intervals; + QVector<const IR::LifeTimeInterval *> _unhandled; + QVector<const IR::LifeTimeInterval *> _live; QBitArray _slotIsInUse; - V4IR::Function *_function; + IR::Function *_function; public: - AllocateStackSlots(const QVector<V4IR::LifeTimeInterval> &intervals) + AllocateStackSlots(const QVector<IR::LifeTimeInterval> &intervals) : _intervals(intervals) , _slotIsInUse(intervals.size(), false) , _function(0) @@ -186,9 +186,9 @@ public: _unhandled.append(&_intervals.at(i)); } - void forFunction(V4IR::Function *function) + void forFunction(IR::Function *function) { - V4IR::Optimizer::showMeTheCode(function); + IR::Optimizer::showMeTheCode(function); _function = function; toStackSlots(function); @@ -217,18 +217,18 @@ protected: return -1; } - virtual void process(V4IR::Stmt *s) + virtual void process(IR::Stmt *s) { Q_ASSERT(s->id > 0); // qDebug("L%d statement %d:", _currentBasicBlock->index, s->id); - if (V4IR::Phi *phi = s->asPhi()) { + if (IR::Phi *phi = s->asPhi()) { visitPhi(phi); } else { // purge ranges no longer alive: for (int i = 0; i < _live.size(); ) { - const V4IR::LifeTimeInterval *lti = _live.at(i); + const IR::LifeTimeInterval *lti = _live.at(i); if (lti->end() < s->id) { // qDebug() << "\t - moving temp" << lti->temp().index << "to handled, freeing slot" << _stackSlotForTemp[lti->temp().index]; _live.remove(i); @@ -242,7 +242,7 @@ protected: // active new ranges: while (!_unhandled.isEmpty()) { - const V4IR::LifeTimeInterval *lti = _unhandled.last(); + const IR::LifeTimeInterval *lti = _unhandled.last(); if (lti->start() > s->id) break; // we're done Q_ASSERT(!_stackSlotForTemp.contains(lti->temp().index)); @@ -255,14 +255,14 @@ protected: s->accept(this); } - if (V4IR::Jump *jump = s->asJump()) { - V4IR::MoveMapping moves; - foreach (V4IR::Stmt *succStmt, jump->target->statements) { - if (V4IR::Phi *phi = succStmt->asPhi()) { + if (IR::Jump *jump = s->asJump()) { + IR::MoveMapping moves; + foreach (IR::Stmt *succStmt, jump->target->statements) { + if (IR::Phi *phi = succStmt->asPhi()) { forceActivation(*phi->targetTemp); for (int i = 0, ei = phi->d->incoming.size(); i != ei; ++i) { - V4IR::Expr *e = phi->d->incoming[i]; - if (V4IR::Temp *t = e->asTemp()) { + IR::Expr *e = phi->d->incoming[i]; + if (IR::Temp *t = e->asTemp()) { forceActivation(*t); } if (jump->target->in[i] == _currentBasicBlock) @@ -273,20 +273,20 @@ protected: } } moves.order(); - QList<V4IR::Move *> newMoves = moves.insertMoves(_currentBasicBlock, _function, true); - foreach (V4IR::Move *move, newMoves) + QList<IR::Move *> newMoves = moves.insertMoves(_currentBasicBlock, _function, true); + foreach (IR::Move *move, newMoves) move->accept(this); } } - void forceActivation(const V4IR::Temp &t) + void forceActivation(const IR::Temp &t) { if (_stackSlotForTemp.contains(t.index)) return; int i = _unhandled.size() - 1; for (; i >= 0; --i) { - const V4IR::LifeTimeInterval *lti = _unhandled[i]; + const IR::LifeTimeInterval *lti = _unhandled[i]; if (lti->temp() == t) { _live.append(lti); _unhandled.remove(i); @@ -299,14 +299,14 @@ protected: // qDebug() << "\t - force activating temp" << t.index << "on slot" << _stackSlotForTemp[t.index]; } - virtual void visitPhi(V4IR::Phi *phi) + virtual void visitPhi(IR::Phi *phi) { Q_UNUSED(phi); #if !defined(QT_NO_DEBUG) Q_ASSERT(_stackSlotForTemp.contains(phi->targetTemp->index)); Q_ASSERT(_slotIsInUse[_stackSlotForTemp[phi->targetTemp->index]]); - foreach (V4IR::Expr *e, phi->d->incoming) { - if (V4IR::Temp *t = e->asTemp()) + foreach (IR::Expr *e, phi->d->incoming) { + if (IR::Temp *t = e->asTemp()) Q_ASSERT(_stackSlotForTemp.contains(t->index)); } #endif // defined(QT_NO_DEBUG) @@ -314,7 +314,7 @@ protected: }; } // anonymous namespace -InstructionSelection::InstructionSelection(QQmlEnginePrivate *qmlEngine, QV4::ExecutableAllocator *execAllocator, V4IR::Module *module, QV4::Compiler::JSUnitGenerator *jsGenerator) +InstructionSelection::InstructionSelection(QQmlEnginePrivate *qmlEngine, QV4::ExecutableAllocator *execAllocator, IR::Module *module, QV4::Compiler::JSUnitGenerator *jsGenerator) : EvalInstructionSelection(execAllocator, module, jsGenerator) , qmlEngine(qmlEngine) , _block(0) @@ -332,11 +332,11 @@ InstructionSelection::~InstructionSelection() void InstructionSelection::run(int functionIndex) { - V4IR::Function *function = irModule->functions[functionIndex]; - V4IR::BasicBlock *block = 0, *nextBlock = 0; + IR::Function *function = irModule->functions[functionIndex]; + IR::BasicBlock *block = 0, *nextBlock = 0; - QHash<V4IR::BasicBlock *, QVector<ptrdiff_t> > patches; - QHash<V4IR::BasicBlock *, ptrdiff_t> addrs; + QHash<IR::BasicBlock *, QVector<ptrdiff_t> > patches; + QHash<IR::BasicBlock *, ptrdiff_t> addrs; int codeSize = 4096; uchar *codeStart = new uchar[codeSize]; @@ -353,7 +353,7 @@ void InstructionSelection::run(int functionIndex) qSwap(codeNext, _codeNext); qSwap(codeEnd, _codeEnd); - V4IR::Optimizer opt(_function); + IR::Optimizer opt(_function); opt.run(qmlEngine); if (opt.isInSSA()) { static const bool doStackSlotAllocation = @@ -370,16 +370,16 @@ void InstructionSelection::run(int functionIndex) ConvertTemps().toStackSlots(_function); } - QSet<V4IR::Jump *> removableJumps = opt.calculateOptionalJumps(); + QSet<IR::Jump *> removableJumps = opt.calculateOptionalJumps(); qSwap(_removableJumps, removableJumps); - V4IR::Stmt *cs = 0; + IR::Stmt *cs = 0; qSwap(_currentStatement, cs); int locals = frameSize(); assert(locals >= 0); - V4IR::BasicBlock *exceptionHandler = 0; + IR::BasicBlock *exceptionHandler = 0; Instruction::Push push; push.value = quint32(locals); @@ -411,7 +411,7 @@ void InstructionSelection::run(int functionIndex) exceptionHandler = _block->catchBlock; } - foreach (V4IR::Stmt *s, _block->statements) { + foreach (IR::Stmt *s, _block->statements) { _currentStatement = s; if (s->location.isValid()) { @@ -453,12 +453,12 @@ QV4::CompiledData::CompilationUnit *InstructionSelection::backendCompileStep() { compilationUnit->codeRefs.resize(irModule->functions.size()); int i = 0; - foreach (V4IR::Function *irFunction, irModule->functions) + foreach (IR::Function *irFunction, irModule->functions) compilationUnit->codeRefs[i++] = codeRefs[irFunction]; return compilationUnit; } -void InstructionSelection::callValue(V4IR::Temp *value, V4IR::ExprList *args, V4IR::Temp *result) +void InstructionSelection::callValue(IR::Temp *value, IR::ExprList *args, IR::Temp *result) { Instruction::CallValue call; prepareCallArgs(args, call.argc); @@ -468,8 +468,8 @@ void InstructionSelection::callValue(V4IR::Temp *value, V4IR::ExprList *args, V4 addInstruction(call); } -void InstructionSelection::callProperty(V4IR::Expr *base, const QString &name, V4IR::ExprList *args, - V4IR::Temp *result) +void InstructionSelection::callProperty(IR::Expr *base, const QString &name, IR::ExprList *args, + IR::Temp *result) { if (useFastLookups) { Instruction::CallPropertyLookup call; @@ -491,8 +491,8 @@ void InstructionSelection::callProperty(V4IR::Expr *base, const QString &name, V } } -void InstructionSelection::callSubscript(V4IR::Expr *base, V4IR::Expr *index, V4IR::ExprList *args, - V4IR::Temp *result) +void InstructionSelection::callSubscript(IR::Expr *base, IR::Expr *index, IR::ExprList *args, + IR::Temp *result) { // call the property on the loaded base Instruction::CallElement call; @@ -504,18 +504,18 @@ void InstructionSelection::callSubscript(V4IR::Expr *base, V4IR::Expr *index, V4 addInstruction(call); } -void InstructionSelection::convertType(V4IR::Temp *source, V4IR::Temp *target) +void InstructionSelection::convertType(IR::Temp *source, IR::Temp *target) { // FIXME: do something more useful with this info - if (target->type & V4IR::NumberType && !(source->type & V4IR::NumberType)) - unop(V4IR::OpUPlus, source, target); + if (target->type & IR::NumberType && !(source->type & IR::NumberType)) + unop(IR::OpUPlus, source, target); else copyValue(source, target); } -void InstructionSelection::constructActivationProperty(V4IR::Name *func, - V4IR::ExprList *args, - V4IR::Temp *result) +void InstructionSelection::constructActivationProperty(IR::Name *func, + IR::ExprList *args, + IR::Temp *result) { if (useFastLookups && func->global) { Instruction::ConstructGlobalLookup call; @@ -534,7 +534,7 @@ void InstructionSelection::constructActivationProperty(V4IR::Name *func, addInstruction(create); } -void InstructionSelection::constructProperty(V4IR::Temp *base, const QString &name, V4IR::ExprList *args, V4IR::Temp *result) +void InstructionSelection::constructProperty(IR::Temp *base, const QString &name, IR::ExprList *args, IR::Temp *result) { if (useFastLookups) { Instruction::ConstructPropertyLookup call; @@ -555,7 +555,7 @@ void InstructionSelection::constructProperty(V4IR::Temp *base, const QString &na addInstruction(create); } -void InstructionSelection::constructValue(V4IR::Temp *value, V4IR::ExprList *args, V4IR::Temp *result) +void InstructionSelection::constructValue(IR::Temp *value, IR::ExprList *args, IR::Temp *result) { Instruction::CreateValue create; create.func = getParam(value); @@ -565,42 +565,42 @@ void InstructionSelection::constructValue(V4IR::Temp *value, V4IR::ExprList *arg addInstruction(create); } -void InstructionSelection::loadThisObject(V4IR::Temp *temp) +void InstructionSelection::loadThisObject(IR::Temp *temp) { Instruction::LoadThis load; load.result = getResultParam(temp); addInstruction(load); } -void InstructionSelection::loadQmlIdArray(V4IR::Temp *temp) +void InstructionSelection::loadQmlIdArray(IR::Temp *temp) { Instruction::LoadQmlIdArray load; load.result = getResultParam(temp); addInstruction(load); } -void InstructionSelection::loadQmlImportedScripts(V4IR::Temp *temp) +void InstructionSelection::loadQmlImportedScripts(IR::Temp *temp) { Instruction::LoadQmlImportedScripts load; load.result = getResultParam(temp); addInstruction(load); } -void InstructionSelection::loadQmlContextObject(V4IR::Temp *temp) +void InstructionSelection::loadQmlContextObject(IR::Temp *temp) { Instruction::LoadQmlContextObject load; load.result = getResultParam(temp); addInstruction(load); } -void InstructionSelection::loadQmlScopeObject(V4IR::Temp *temp) +void InstructionSelection::loadQmlScopeObject(IR::Temp *temp) { Instruction::LoadQmlScopeObject load; load.result = getResultParam(temp); addInstruction(load); } -void InstructionSelection::loadQmlSingleton(const QString &name, V4IR::Temp *temp) +void InstructionSelection::loadQmlSingleton(const QString &name, IR::Temp *temp) { Instruction::LoadQmlSingleton load; load.result = getResultParam(temp); @@ -608,7 +608,7 @@ void InstructionSelection::loadQmlSingleton(const QString &name, V4IR::Temp *tem addInstruction(load); } -void InstructionSelection::loadConst(V4IR::Const *sourceConst, V4IR::Temp *targetTemp) +void InstructionSelection::loadConst(IR::Const *sourceConst, IR::Temp *targetTemp) { assert(sourceConst); @@ -618,7 +618,7 @@ void InstructionSelection::loadConst(V4IR::Const *sourceConst, V4IR::Temp *targe addInstruction(move); } -void InstructionSelection::loadString(const QString &str, V4IR::Temp *targetTemp) +void InstructionSelection::loadString(const QString &str, IR::Temp *targetTemp) { Instruction::LoadRuntimeString load; load.stringId = registerString(str); @@ -626,7 +626,7 @@ void InstructionSelection::loadString(const QString &str, V4IR::Temp *targetTemp addInstruction(load); } -void InstructionSelection::loadRegexp(V4IR::RegExp *sourceRegexp, V4IR::Temp *targetTemp) +void InstructionSelection::loadRegexp(IR::RegExp *sourceRegexp, IR::Temp *targetTemp) { Instruction::LoadRegExp load; load.regExpId = registerRegExp(sourceRegexp); @@ -634,7 +634,7 @@ void InstructionSelection::loadRegexp(V4IR::RegExp *sourceRegexp, V4IR::Temp *ta addInstruction(load); } -void InstructionSelection::getActivationProperty(const V4IR::Name *name, V4IR::Temp *temp) +void InstructionSelection::getActivationProperty(const IR::Name *name, IR::Temp *temp) { if (useFastLookups && name->global) { Instruction::GetGlobalLookup load; @@ -649,7 +649,7 @@ void InstructionSelection::getActivationProperty(const V4IR::Name *name, V4IR::T addInstruction(load); } -void InstructionSelection::setActivationProperty(V4IR::Expr *source, const QString &targetName) +void InstructionSelection::setActivationProperty(IR::Expr *source, const QString &targetName) { Instruction::StoreName store; store.source = getParam(source); @@ -657,7 +657,7 @@ void InstructionSelection::setActivationProperty(V4IR::Expr *source, const QStri addInstruction(store); } -void InstructionSelection::initClosure(V4IR::Closure *closure, V4IR::Temp *target) +void InstructionSelection::initClosure(IR::Closure *closure, IR::Temp *target) { int id = closure->value; Instruction::LoadClosure load; @@ -666,7 +666,7 @@ void InstructionSelection::initClosure(V4IR::Closure *closure, V4IR::Temp *targe addInstruction(load); } -void InstructionSelection::getProperty(V4IR::Expr *base, const QString &name, V4IR::Temp *target) +void InstructionSelection::getProperty(IR::Expr *base, const QString &name, IR::Temp *target) { if (useFastLookups) { Instruction::GetLookup load; @@ -683,7 +683,7 @@ void InstructionSelection::getProperty(V4IR::Expr *base, const QString &name, V4 addInstruction(load); } -void InstructionSelection::setProperty(V4IR::Expr *source, V4IR::Expr *targetBase, +void InstructionSelection::setProperty(IR::Expr *source, IR::Expr *targetBase, const QString &targetName) { if (useFastLookups) { @@ -701,7 +701,7 @@ void InstructionSelection::setProperty(V4IR::Expr *source, V4IR::Expr *targetBas addInstruction(store); } -void InstructionSelection::setQObjectProperty(V4IR::Expr *source, V4IR::Expr *targetBase, int propertyIndex) +void InstructionSelection::setQObjectProperty(IR::Expr *source, IR::Expr *targetBase, int propertyIndex) { Instruction::StoreQObjectProperty store; store.base = getParam(targetBase); @@ -710,7 +710,7 @@ void InstructionSelection::setQObjectProperty(V4IR::Expr *source, V4IR::Expr *ta addInstruction(store); } -void InstructionSelection::getQObjectProperty(V4IR::Expr *base, int propertyIndex, bool captureRequired, int attachedPropertiesId, V4IR::Temp *target) +void InstructionSelection::getQObjectProperty(IR::Expr *base, int propertyIndex, bool captureRequired, int attachedPropertiesId, IR::Temp *target) { if (attachedPropertiesId != 0) { Instruction::LoadAttachedQObjectProperty load; @@ -728,7 +728,7 @@ void InstructionSelection::getQObjectProperty(V4IR::Expr *base, int propertyInde } } -void InstructionSelection::getElement(V4IR::Expr *base, V4IR::Expr *index, V4IR::Temp *target) +void InstructionSelection::getElement(IR::Expr *base, IR::Expr *index, IR::Temp *target) { if (useFastLookups) { Instruction::LoadElementLookup load; @@ -746,8 +746,8 @@ void InstructionSelection::getElement(V4IR::Expr *base, V4IR::Expr *index, V4IR: addInstruction(load); } -void InstructionSelection::setElement(V4IR::Expr *source, V4IR::Expr *targetBase, - V4IR::Expr *targetIndex) +void InstructionSelection::setElement(IR::Expr *source, IR::Expr *targetBase, + IR::Expr *targetIndex) { if (useFastLookups) { Instruction::StoreElementLookup store; @@ -765,7 +765,7 @@ void InstructionSelection::setElement(V4IR::Expr *source, V4IR::Expr *targetBase addInstruction(store); } -void InstructionSelection::copyValue(V4IR::Temp *sourceTemp, V4IR::Temp *targetTemp) +void InstructionSelection::copyValue(IR::Temp *sourceTemp, IR::Temp *targetTemp) { Instruction::Move move; move.source = getParam(sourceTemp); @@ -774,7 +774,7 @@ void InstructionSelection::copyValue(V4IR::Temp *sourceTemp, V4IR::Temp *targetT addInstruction(move); } -void InstructionSelection::swapValues(V4IR::Temp *sourceTemp, V4IR::Temp *targetTemp) +void InstructionSelection::swapValues(IR::Temp *sourceTemp, IR::Temp *targetTemp) { Instruction::SwapTemps swap; swap.left = getParam(sourceTemp); @@ -782,12 +782,12 @@ void InstructionSelection::swapValues(V4IR::Temp *sourceTemp, V4IR::Temp *target addInstruction(swap); } -void InstructionSelection::unop(V4IR::AluOp oper, V4IR::Temp *sourceTemp, V4IR::Temp *targetTemp) +void InstructionSelection::unop(IR::AluOp oper, IR::Temp *sourceTemp, IR::Temp *targetTemp) { switch (oper) { - case V4IR::OpIfTrue: + case IR::OpIfTrue: Q_ASSERT(!"unreachable"); break; - case V4IR::OpNot: { + case IR::OpNot: { // ### enabling this fails in some cases, where apparently the value is not a bool at runtime if (0 && isBoolType(sourceTemp)) { Instruction::UNotBool unot; @@ -802,14 +802,14 @@ void InstructionSelection::unop(V4IR::AluOp oper, V4IR::Temp *sourceTemp, V4IR:: addInstruction(unot); return; } - case V4IR::OpUMinus: { + case IR::OpUMinus: { Instruction::UMinus uminus; uminus.source = getParam(sourceTemp); uminus.result = getResultParam(targetTemp); addInstruction(uminus); return; } - case V4IR::OpUPlus: { + case IR::OpUPlus: { if (isNumberType(sourceTemp)) { // use a move Instruction::Move move; @@ -825,7 +825,7 @@ void InstructionSelection::unop(V4IR::AluOp oper, V4IR::Temp *sourceTemp, V4IR:: addInstruction(uplus); return; } - case V4IR::OpCompl: { + case IR::OpCompl: { // ### enabling this fails in some cases, where apparently the value is not a int at runtime if (0 && isIntegerType(sourceTemp)) { Instruction::UComplInt unot; @@ -840,14 +840,14 @@ void InstructionSelection::unop(V4IR::AluOp oper, V4IR::Temp *sourceTemp, V4IR:: addInstruction(ucompl); return; } - case V4IR::OpIncrement: { + case IR::OpIncrement: { Instruction::Increment inc; inc.source = getParam(sourceTemp); inc.result = getResultParam(targetTemp); addInstruction(inc); return; } - case V4IR::OpDecrement: { + case IR::OpDecrement: { Instruction::Decrement dec; dec.source = getParam(sourceTemp); dec.result = getResultParam(targetTemp); @@ -860,14 +860,14 @@ void InstructionSelection::unop(V4IR::AluOp oper, V4IR::Temp *sourceTemp, V4IR:: Q_ASSERT(!"unreachable"); } -void InstructionSelection::binop(V4IR::AluOp oper, V4IR::Expr *leftSource, V4IR::Expr *rightSource, V4IR::Temp *target) +void InstructionSelection::binop(IR::AluOp oper, IR::Expr *leftSource, IR::Expr *rightSource, IR::Temp *target) { binopHelper(oper, leftSource, rightSource, target); } -Param InstructionSelection::binopHelper(V4IR::AluOp oper, V4IR::Expr *leftSource, V4IR::Expr *rightSource, V4IR::Temp *target) +Param InstructionSelection::binopHelper(IR::AluOp oper, IR::Expr *leftSource, IR::Expr *rightSource, IR::Temp *target) { - if (oper == V4IR::OpAdd) { + if (oper == IR::OpAdd) { Instruction::Add add; add.lhs = getParam(leftSource); add.rhs = getParam(rightSource); @@ -875,7 +875,7 @@ Param InstructionSelection::binopHelper(V4IR::AluOp oper, V4IR::Expr *leftSource addInstruction(add); return add.result; } - if (oper == V4IR::OpSub) { + if (oper == IR::OpSub) { Instruction::Sub sub; sub.lhs = getParam(leftSource); sub.rhs = getParam(rightSource); @@ -883,7 +883,7 @@ Param InstructionSelection::binopHelper(V4IR::AluOp oper, V4IR::Expr *leftSource addInstruction(sub); return sub.result; } - if (oper == V4IR::OpMul) { + if (oper == IR::OpMul) { Instruction::Mul mul; mul.lhs = getParam(leftSource); mul.rhs = getParam(rightSource); @@ -891,10 +891,10 @@ Param InstructionSelection::binopHelper(V4IR::AluOp oper, V4IR::Expr *leftSource addInstruction(mul); return mul.result; } - if (oper == V4IR::OpBitAnd) { + if (oper == IR::OpBitAnd) { if (leftSource->asConst()) qSwap(leftSource, rightSource); - if (V4IR::Const *c = rightSource->asConst()) { + if (IR::Const *c = rightSource->asConst()) { Instruction::BitAndConst bitAnd; bitAnd.lhs = getParam(leftSource); bitAnd.rhs = convertToValue(c).Value::toInt32(); @@ -909,10 +909,10 @@ Param InstructionSelection::binopHelper(V4IR::AluOp oper, V4IR::Expr *leftSource addInstruction(bitAnd); return bitAnd.result; } - if (oper == V4IR::OpBitOr) { + if (oper == IR::OpBitOr) { if (leftSource->asConst()) qSwap(leftSource, rightSource); - if (V4IR::Const *c = rightSource->asConst()) { + if (IR::Const *c = rightSource->asConst()) { Instruction::BitOrConst bitOr; bitOr.lhs = getParam(leftSource); bitOr.rhs = convertToValue(c).Value::toInt32(); @@ -927,10 +927,10 @@ Param InstructionSelection::binopHelper(V4IR::AluOp oper, V4IR::Expr *leftSource addInstruction(bitOr); return bitOr.result; } - if (oper == V4IR::OpBitXor) { + if (oper == IR::OpBitXor) { if (leftSource->asConst()) qSwap(leftSource, rightSource); - if (V4IR::Const *c = rightSource->asConst()) { + if (IR::Const *c = rightSource->asConst()) { Instruction::BitXorConst bitXor; bitXor.lhs = getParam(leftSource); bitXor.rhs = convertToValue(c).Value::toInt32(); @@ -945,8 +945,8 @@ Param InstructionSelection::binopHelper(V4IR::AluOp oper, V4IR::Expr *leftSource addInstruction(bitXor); return bitXor.result; } - if (oper == V4IR::OpRShift) { - if (V4IR::Const *c = rightSource->asConst()) { + if (oper == IR::OpRShift) { + if (IR::Const *c = rightSource->asConst()) { Instruction::ShrConst shr; shr.lhs = getParam(leftSource); shr.rhs = convertToValue(c).Value::toInt32() & 0x1f; @@ -961,8 +961,8 @@ Param InstructionSelection::binopHelper(V4IR::AluOp oper, V4IR::Expr *leftSource addInstruction(shr); return shr.result; } - if (oper == V4IR::OpLShift) { - if (V4IR::Const *c = rightSource->asConst()) { + if (oper == IR::OpLShift) { + if (IR::Const *c = rightSource->asConst()) { Instruction::ShlConst shl; shl.lhs = getParam(leftSource); shl.rhs = convertToValue(c).Value::toInt32() & 0x1f; @@ -978,11 +978,11 @@ Param InstructionSelection::binopHelper(V4IR::AluOp oper, V4IR::Expr *leftSource return shl.result; } - if (oper == V4IR::OpInstanceof || oper == V4IR::OpIn || oper == V4IR::OpAdd) { + if (oper == IR::OpInstanceof || oper == IR::OpIn || oper == IR::OpAdd) { Instruction::BinopContext binop; - if (oper == V4IR::OpInstanceof) + if (oper == IR::OpInstanceof) binop.alu = QV4::__qmljs_instanceof; - else if (oper == V4IR::OpIn) + else if (oper == IR::OpIn) binop.alu = QV4::__qmljs_in; else binop.alu = QV4::__qmljs_add; @@ -1004,7 +1004,7 @@ Param InstructionSelection::binopHelper(V4IR::AluOp oper, V4IR::Expr *leftSource } } -void InstructionSelection::prepareCallArgs(V4IR::ExprList *e, quint32 &argc, quint32 *args) +void InstructionSelection::prepareCallArgs(IR::ExprList *e, quint32 &argc, quint32 *args) { int argLocation = outgoingArgumentTempStart(); argc = 0; @@ -1014,7 +1014,7 @@ void InstructionSelection::prepareCallArgs(V4IR::ExprList *e, quint32 &argc, qui // We need to move all the temps into the function arg array assert(argLocation >= 0); while (e) { - if (V4IR::Const *c = e->expr->asConst()) { + if (IR::Const *c = e->expr->asConst()) { Instruction::MoveConst move; move.source = convertToValue(c).asReturnedValue(); move.result = Param::createTemp(argLocation); @@ -1032,7 +1032,7 @@ void InstructionSelection::prepareCallArgs(V4IR::ExprList *e, quint32 &argc, qui } } -void InstructionSelection::visitJump(V4IR::Jump *s) +void InstructionSelection::visitJump(IR::Jump *s) { if (s->target == _nextBlock) return; @@ -1046,12 +1046,12 @@ void InstructionSelection::visitJump(V4IR::Jump *s) _patches[s->target].append(loc); } -void InstructionSelection::visitCJump(V4IR::CJump *s) +void InstructionSelection::visitCJump(IR::CJump *s) { Param condition; - if (V4IR::Temp *t = s->cond->asTemp()) { + if (IR::Temp *t = s->cond->asTemp()) { condition = getResultParam(t); - } else if (V4IR::Binop *b = s->cond->asBinop()) { + } else if (IR::Binop *b = s->cond->asBinop()) { condition = binopHelper(b->op, b->left, b->right, /*target*/0); } else { Q_UNIMPLEMENTED(); @@ -1079,14 +1079,14 @@ void InstructionSelection::visitCJump(V4IR::CJump *s) } } -void InstructionSelection::visitRet(V4IR::Ret *s) +void InstructionSelection::visitRet(IR::Ret *s) { Instruction::Ret ret; ret.result = getParam(s->expr); addInstruction(ret); } -void InstructionSelection::callBuiltinInvalid(V4IR::Name *func, V4IR::ExprList *args, V4IR::Temp *result) +void InstructionSelection::callBuiltinInvalid(IR::Name *func, IR::ExprList *args, IR::Temp *result) { if (useFastLookups && func->global) { Instruction::CallGlobalLookup call; @@ -1105,8 +1105,8 @@ void InstructionSelection::callBuiltinInvalid(V4IR::Name *func, V4IR::ExprList * addInstruction(call); } -void InstructionSelection::callBuiltinTypeofMember(V4IR::Expr *base, const QString &name, - V4IR::Temp *result) +void InstructionSelection::callBuiltinTypeofMember(IR::Expr *base, const QString &name, + IR::Temp *result) { Instruction::CallBuiltinTypeofMember call; call.base = getParam(base); @@ -1115,8 +1115,8 @@ void InstructionSelection::callBuiltinTypeofMember(V4IR::Expr *base, const QStri addInstruction(call); } -void InstructionSelection::callBuiltinTypeofSubscript(V4IR::Expr *base, V4IR::Expr *index, - V4IR::Temp *result) +void InstructionSelection::callBuiltinTypeofSubscript(IR::Expr *base, IR::Expr *index, + IR::Temp *result) { Instruction::CallBuiltinTypeofSubscript call; call.base = getParam(base); @@ -1125,7 +1125,7 @@ void InstructionSelection::callBuiltinTypeofSubscript(V4IR::Expr *base, V4IR::Ex addInstruction(call); } -void InstructionSelection::callBuiltinTypeofName(const QString &name, V4IR::Temp *result) +void InstructionSelection::callBuiltinTypeofName(const QString &name, IR::Temp *result) { Instruction::CallBuiltinTypeofName call; call.name = registerString(name); @@ -1133,7 +1133,7 @@ void InstructionSelection::callBuiltinTypeofName(const QString &name, V4IR::Temp addInstruction(call); } -void InstructionSelection::callBuiltinTypeofValue(V4IR::Expr *value, V4IR::Temp *result) +void InstructionSelection::callBuiltinTypeofValue(IR::Expr *value, IR::Temp *result) { Instruction::CallBuiltinTypeofValue call; call.value = getParam(value); @@ -1141,7 +1141,7 @@ void InstructionSelection::callBuiltinTypeofValue(V4IR::Expr *value, V4IR::Temp addInstruction(call); } -void InstructionSelection::callBuiltinDeleteMember(V4IR::Temp *base, const QString &name, V4IR::Temp *result) +void InstructionSelection::callBuiltinDeleteMember(IR::Temp *base, const QString &name, IR::Temp *result) { Instruction::CallBuiltinDeleteMember call; call.base = getParam(base); @@ -1150,8 +1150,8 @@ void InstructionSelection::callBuiltinDeleteMember(V4IR::Temp *base, const QStri addInstruction(call); } -void InstructionSelection::callBuiltinDeleteSubscript(V4IR::Temp *base, V4IR::Expr *index, - V4IR::Temp *result) +void InstructionSelection::callBuiltinDeleteSubscript(IR::Temp *base, IR::Expr *index, + IR::Temp *result) { Instruction::CallBuiltinDeleteSubscript call; call.base = getParam(base); @@ -1160,7 +1160,7 @@ void InstructionSelection::callBuiltinDeleteSubscript(V4IR::Temp *base, V4IR::Ex addInstruction(call); } -void InstructionSelection::callBuiltinDeleteName(const QString &name, V4IR::Temp *result) +void InstructionSelection::callBuiltinDeleteName(const QString &name, IR::Temp *result) { Instruction::CallBuiltinDeleteName call; call.name = registerString(name); @@ -1168,7 +1168,7 @@ void InstructionSelection::callBuiltinDeleteName(const QString &name, V4IR::Temp addInstruction(call); } -void InstructionSelection::callBuiltinDeleteValue(V4IR::Temp *result) +void InstructionSelection::callBuiltinDeleteValue(IR::Temp *result) { Instruction::MoveConst move; move.source = QV4::Encode(false); @@ -1176,7 +1176,7 @@ void InstructionSelection::callBuiltinDeleteValue(V4IR::Temp *result) addInstruction(move); } -void InstructionSelection::callBuiltinThrow(V4IR::Expr *arg) +void InstructionSelection::callBuiltinThrow(IR::Expr *arg) { Instruction::CallBuiltinThrow call; call.arg = getParam(arg); @@ -1200,7 +1200,7 @@ void InstructionSelection::callBuiltinReThrow() } } -void InstructionSelection::callBuiltinUnwindException(V4IR::Temp *result) +void InstructionSelection::callBuiltinUnwindException(IR::Temp *result) { Instruction::CallBuiltinUnwindException call; call.result = getResultParam(result); @@ -1215,7 +1215,7 @@ void InstructionSelection::callBuiltinPushCatchScope(const QString &exceptionNam addInstruction(call); } -void InstructionSelection::callBuiltinForeachIteratorObject(V4IR::Temp *arg, V4IR::Temp *result) +void InstructionSelection::callBuiltinForeachIteratorObject(IR::Temp *arg, IR::Temp *result) { Instruction::CallBuiltinForeachIteratorObject call; call.arg = getParam(arg); @@ -1223,7 +1223,7 @@ void InstructionSelection::callBuiltinForeachIteratorObject(V4IR::Temp *arg, V4I addInstruction(call); } -void InstructionSelection::callBuiltinForeachNextPropertyname(V4IR::Temp *arg, V4IR::Temp *result) +void InstructionSelection::callBuiltinForeachNextPropertyname(IR::Temp *arg, IR::Temp *result) { Instruction::CallBuiltinForeachNextPropertyName call; call.arg = getParam(arg); @@ -1231,7 +1231,7 @@ void InstructionSelection::callBuiltinForeachNextPropertyname(V4IR::Temp *arg, V addInstruction(call); } -void InstructionSelection::callBuiltinPushWithScope(V4IR::Temp *arg) +void InstructionSelection::callBuiltinPushWithScope(IR::Temp *arg) { Instruction::CallBuiltinPushScope call; call.arg = getParam(arg); @@ -1252,7 +1252,7 @@ void InstructionSelection::callBuiltinDeclareVar(bool deletable, const QString & addInstruction(call); } -void InstructionSelection::callBuiltinDefineGetterSetter(V4IR::Temp *object, const QString &name, V4IR::Temp *getter, V4IR::Temp *setter) +void InstructionSelection::callBuiltinDefineGetterSetter(IR::Temp *object, const QString &name, IR::Temp *getter, IR::Temp *setter) { Instruction::CallBuiltinDefineGetterSetter call; call.object = getParam(object); @@ -1262,8 +1262,8 @@ void InstructionSelection::callBuiltinDefineGetterSetter(V4IR::Temp *object, con addInstruction(call); } -void InstructionSelection::callBuiltinDefineProperty(V4IR::Temp *object, const QString &name, - V4IR::Expr *value) +void InstructionSelection::callBuiltinDefineProperty(IR::Temp *object, const QString &name, + IR::Expr *value) { Instruction::CallBuiltinDefineProperty call; call.object = getParam(object); @@ -1272,7 +1272,7 @@ void InstructionSelection::callBuiltinDefineProperty(V4IR::Temp *object, const Q addInstruction(call); } -void InstructionSelection::callBuiltinDefineArray(V4IR::Temp *result, V4IR::ExprList *args) +void InstructionSelection::callBuiltinDefineArray(IR::Temp *result, IR::ExprList *args) { Instruction::CallBuiltinDefineArray call; prepareCallArgs(args, call.argc, &call.args); @@ -1280,19 +1280,19 @@ void InstructionSelection::callBuiltinDefineArray(V4IR::Temp *result, V4IR::Expr addInstruction(call); } -void InstructionSelection::callBuiltinDefineObjectLiteral(V4IR::Temp *result, V4IR::ExprList *args) +void InstructionSelection::callBuiltinDefineObjectLiteral(IR::Temp *result, IR::ExprList *args) { int argLocation = outgoingArgumentTempStart(); const int classId = registerJSClass(args); - V4IR::ExprList *it = args; + IR::ExprList *it = args; while (it) { it = it->next; bool isData = it->expr->asConst()->value; it = it->next; - if (V4IR::Const *c = it->expr->asConst()) { + if (IR::Const *c = it->expr->asConst()) { Instruction::MoveConst move; move.source = convertToValue(c).asReturnedValue(); move.result = Param::createTemp(argLocation); @@ -1325,7 +1325,7 @@ void InstructionSelection::callBuiltinDefineObjectLiteral(V4IR::Temp *result, V4 addInstruction(call); } -void InstructionSelection::callBuiltinSetupArgumentObject(V4IR::Temp *result) +void InstructionSelection::callBuiltinSetupArgumentObject(IR::Temp *result) { Instruction::CallBuiltinSetupArgumentsObject call; call.result = getResultParam(result); @@ -1333,7 +1333,7 @@ void InstructionSelection::callBuiltinSetupArgumentObject(V4IR::Temp *result) } -void QQmlJS::Moth::InstructionSelection::callBuiltinConvertThisToObject() +void QV4::Moth::InstructionSelection::callBuiltinConvertThisToObject() { Instruction::CallBuiltinConvertThisToObject call; addInstruction(call); @@ -1369,7 +1369,7 @@ ptrdiff_t InstructionSelection::addInstructionHelper(Instr::Type type, Instr &in void InstructionSelection::patchJumpAddresses() { - typedef QHash<V4IR::BasicBlock *, QVector<ptrdiff_t> >::ConstIterator PatchIt; + typedef QHash<IR::BasicBlock *, QVector<ptrdiff_t> >::ConstIterator PatchIt; for (PatchIt i = _patches.begin(), ei = _patches.end(); i != ei; ++i) { Q_ASSERT(_addrs.contains(i.key())); ptrdiff_t target = _addrs.value(i.key()); @@ -1395,19 +1395,19 @@ QByteArray InstructionSelection::squeezeCode() const return squeezed; } -Param InstructionSelection::getParam(V4IR::Expr *e) { +Param InstructionSelection::getParam(IR::Expr *e) { assert(e); - if (V4IR::Const *c = e->asConst()) { + if (IR::Const *c = e->asConst()) { int idx = jsUnitGenerator()->registerConstant(convertToValue(c).asReturnedValue()); return Param::createConstant(idx); - } else if (V4IR::Temp *t = e->asTemp()) { + } else if (IR::Temp *t = e->asTemp()) { switch (t->kind) { - case V4IR::Temp::Formal: - case V4IR::Temp::ScopedFormal: return Param::createArgument(t->index, t->scope); - case V4IR::Temp::Local: return Param::createLocal(t->index); - case V4IR::Temp::ScopedLocal: return Param::createScopedLocal(t->index, t->scope); - case V4IR::Temp::StackSlot: + case IR::Temp::Formal: + case IR::Temp::ScopedFormal: return Param::createArgument(t->index, t->scope); + case IR::Temp::Local: return Param::createLocal(t->index); + case IR::Temp::ScopedLocal: return Param::createScopedLocal(t->index, t->scope); + case IR::Temp::StackSlot: return Param::createTemp(t->index); default: Q_UNREACHABLE(); |