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/jit/qv4assembler_p.h | |
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/jit/qv4assembler_p.h')
-rw-r--r-- | src/qml/jit/qv4assembler_p.h | 182 |
1 files changed, 91 insertions, 91 deletions
diff --git a/src/qml/jit/qv4assembler_p.h b/src/qml/jit/qv4assembler_p.h index daa7816a2d..dd1209a026 100644 --- a/src/qml/jit/qv4assembler_p.h +++ b/src/qml/jit/qv4assembler_p.h @@ -60,8 +60,8 @@ QT_BEGIN_NAMESPACE -namespace QQmlJS { -namespace MASM { +namespace QV4 { +namespace JIT { #define OP(op) \ { isel_stringIfy(op), op, 0, 0, 0 } @@ -128,7 +128,7 @@ struct ExceptionCheck<void (*)(QV4::NoThrowContext *, A, B, C)> { class Assembler : public JSC::MacroAssembler { public: - Assembler(InstructionSelection *isel, V4IR::Function* function, QV4::ExecutableAllocator *executableAllocator, + Assembler(InstructionSelection *isel, IR::Function* function, QV4::ExecutableAllocator *executableAllocator, int maxArgCountForBuiltins); #if CPU(X86) @@ -317,7 +317,7 @@ public: class StackLayout { public: - StackLayout(V4IR::Function *function, int maxArgCountForBuiltins) + StackLayout(IR::Function *function, int maxArgCountForBuiltins) : calleeSavedRegCount(Assembler::calleeSavedRegisterCount + 1) , maxOutgoingArgumentCount(function->maxNumberOfArguments) , localCount(function->tempCount) @@ -427,7 +427,7 @@ public: ConstantTable(Assembler *as): _as(as) {} int add(const QV4::Primitive &v); - ImplicitAddress loadValueAddress(V4IR::Const *c, RegisterID baseReg); + ImplicitAddress loadValueAddress(IR::Const *c, RegisterID baseReg); ImplicitAddress loadValueAddress(const QV4::Primitive &v, RegisterID baseReg); void finalize(JSC::LinkBuffer &linkBuffer, InstructionSelection *isel); @@ -448,23 +448,23 @@ public: const char* functionName; }; struct PointerToValue { - PointerToValue(V4IR::Expr *value) + PointerToValue(IR::Expr *value) : value(value) {} - V4IR::Expr *value; + IR::Expr *value; }; struct PointerToString { explicit PointerToString(const QString &string) : string(string) {} QString string; }; struct Reference { - Reference(V4IR::Temp *value) : value(value) {} - V4IR::Temp *value; + Reference(IR::Temp *value) : value(value) {} + IR::Temp *value; }; struct ReentryBlock { - ReentryBlock(V4IR::BasicBlock *b) : block(b) {} - V4IR::BasicBlock *block; + ReentryBlock(IR::BasicBlock *b) : block(b) {} + IR::BasicBlock *block; }; void callAbsolute(const char* functionName, FunctionPtr function) { @@ -484,29 +484,29 @@ public: call(relativeCall.addr); } - void registerBlock(V4IR::BasicBlock*, V4IR::BasicBlock *nextBlock); - V4IR::BasicBlock *nextBlock() const { return _nextBlock; } - void jumpToBlock(V4IR::BasicBlock* current, V4IR::BasicBlock *target); - void addPatch(V4IR::BasicBlock* targetBlock, Jump targetJump); + void registerBlock(IR::BasicBlock*, IR::BasicBlock *nextBlock); + IR::BasicBlock *nextBlock() const { return _nextBlock; } + void jumpToBlock(IR::BasicBlock* current, IR::BasicBlock *target); + void addPatch(IR::BasicBlock* targetBlock, Jump targetJump); void addPatch(DataLabelPtr patch, Label target); - void addPatch(DataLabelPtr patch, V4IR::BasicBlock *target); - void generateCJumpOnNonZero(RegisterID reg, V4IR::BasicBlock *currentBlock, - V4IR::BasicBlock *trueBlock, V4IR::BasicBlock *falseBlock); + void addPatch(DataLabelPtr patch, IR::BasicBlock *target); + void generateCJumpOnNonZero(RegisterID reg, IR::BasicBlock *currentBlock, + IR::BasicBlock *trueBlock, IR::BasicBlock *falseBlock); void generateCJumpOnCompare(RelationalCondition cond, RegisterID left, TrustedImm32 right, - V4IR::BasicBlock *currentBlock, V4IR::BasicBlock *trueBlock, - V4IR::BasicBlock *falseBlock); + IR::BasicBlock *currentBlock, IR::BasicBlock *trueBlock, + IR::BasicBlock *falseBlock); void generateCJumpOnCompare(RelationalCondition cond, RegisterID left, RegisterID right, - V4IR::BasicBlock *currentBlock, V4IR::BasicBlock *trueBlock, - V4IR::BasicBlock *falseBlock); - Jump genTryDoubleConversion(V4IR::Expr *src, Assembler::FPRegisterID dest); - Assembler::Jump branchDouble(bool invertCondition, V4IR::AluOp op, V4IR::Expr *left, V4IR::Expr *right); + IR::BasicBlock *currentBlock, IR::BasicBlock *trueBlock, + IR::BasicBlock *falseBlock); + Jump genTryDoubleConversion(IR::Expr *src, Assembler::FPRegisterID dest); + Assembler::Jump branchDouble(bool invertCondition, IR::AluOp op, IR::Expr *left, IR::Expr *right); - Pointer loadTempAddress(RegisterID baseReg, V4IR::Temp *t); + Pointer loadTempAddress(RegisterID baseReg, IR::Temp *t); Pointer loadStringAddress(RegisterID reg, const QString &string); void loadStringRef(RegisterID reg, const QString &string); - Pointer stackSlotPointer(V4IR::Temp *t) const + Pointer stackSlotPointer(IR::Temp *t) const { - Q_ASSERT(t->kind == V4IR::Temp::StackSlot); + Q_ASSERT(t->kind == IR::Temp::StackSlot); Q_ASSERT(t->scope == 0); return Pointer(_stackLayout.stackSlotPointer(t->index)); @@ -517,20 +517,20 @@ public: { if (!arg.value) return; - if (V4IR::Temp *t = arg.value->asTemp()) { - if (t->kind == V4IR::Temp::PhysicalRegister) { + if (IR::Temp *t = arg.value->asTemp()) { + if (t->kind == IR::Temp::PhysicalRegister) { Pointer addr(_stackLayout.savedRegPointer(argumentNumber)); switch (t->type) { - case V4IR::BoolType: + case IR::BoolType: storeBool((RegisterID) t->index, addr); break; - case V4IR::SInt32Type: + case IR::SInt32Type: storeInt32((RegisterID) t->index, addr); break; - case V4IR::UInt32Type: + case IR::UInt32Type: storeUInt32((RegisterID) t->index, addr); break; - case V4IR::DoubleType: + case IR::DoubleType: storeDouble((FPRegisterID) t->index, addr); break; default: @@ -596,7 +596,7 @@ public: } #ifdef VALUE_FITS_IN_REGISTER - void loadArgumentInRegister(V4IR::Temp* temp, RegisterID dest, int argumentNumber) + void loadArgumentInRegister(IR::Temp* temp, RegisterID dest, int argumentNumber) { Q_UNUSED(argumentNumber); @@ -609,7 +609,7 @@ public: } } - void loadArgumentInRegister(V4IR::Const* c, RegisterID dest, int argumentNumber) + void loadArgumentInRegister(IR::Const* c, RegisterID dest, int argumentNumber) { Q_UNUSED(argumentNumber); @@ -617,7 +617,7 @@ public: move(TrustedImm64(v.val), dest); } - void loadArgumentInRegister(V4IR::Expr* expr, RegisterID dest, int argumentNumber) + void loadArgumentInRegister(IR::Expr* expr, RegisterID dest, int argumentNumber) { Q_UNUSED(argumentNumber); @@ -633,7 +633,7 @@ public: } } #else - void loadArgumentInRegister(V4IR::Expr*, RegisterID) + void loadArgumentInRegister(IR::Expr*, RegisterID) { assert(!"unimplemented: expression in loadArgument"); } @@ -701,15 +701,15 @@ public: } #endif - void storeReturnValue(V4IR::Temp *temp) + void storeReturnValue(IR::Temp *temp) { if (!temp) return; - if (temp->kind == V4IR::Temp::PhysicalRegister) { - if (temp->type == V4IR::DoubleType) + if (temp->kind == IR::Temp::PhysicalRegister) { + if (temp->type == IR::DoubleType) storeReturnValue((FPRegisterID) temp->index); - else if (temp->type == V4IR::UInt32Type) + else if (temp->type == IR::UInt32Type) storeUInt32ReturnValue((RegisterID) temp->index); else storeReturnValue((RegisterID) temp->index); @@ -804,9 +804,9 @@ public: poke(TrustedImmPtr(name), StackSlot); } - void loadDouble(V4IR::Temp* temp, FPRegisterID dest) + void loadDouble(IR::Temp* temp, FPRegisterID dest) { - if (temp->kind == V4IR::Temp::PhysicalRegister) { + if (temp->kind == IR::Temp::PhysicalRegister) { moveDouble((FPRegisterID) temp->index, dest); return; } @@ -814,9 +814,9 @@ public: loadDouble(ptr, dest); } - void storeDouble(FPRegisterID source, V4IR::Temp* temp) + void storeDouble(FPRegisterID source, IR::Temp* temp) { - if (temp->kind == V4IR::Temp::PhysicalRegister) { + if (temp->kind == IR::Temp::PhysicalRegister) { moveDouble(source, (FPRegisterID) temp->index); return; } @@ -856,12 +856,12 @@ public: template <typename Result, typename Source> void copyValue(Result result, Source source); template <typename Result> - void copyValue(Result result, V4IR::Expr* source); + void copyValue(Result result, IR::Expr* source); // The scratch register is used to calculate the temp address for the source. - void memcopyValue(Pointer target, V4IR::Temp *sourceTemp, RegisterID scratchRegister) + void memcopyValue(Pointer target, IR::Temp *sourceTemp, RegisterID scratchRegister) { - Q_ASSERT(sourceTemp->kind != V4IR::Temp::PhysicalRegister); + Q_ASSERT(sourceTemp->kind != IR::Temp::PhysicalRegister); Q_ASSERT(target.base != scratchRegister); JSC::MacroAssembler::loadDouble(loadTempAddress(scratchRegister, sourceTemp), FPGpr0); JSC::MacroAssembler::storeDouble(FPGpr0, target); @@ -885,7 +885,7 @@ public: #endif } - void storeValue(QV4::Primitive value, V4IR::Temp* temp); + void storeValue(QV4::Primitive value, IR::Temp* temp); void enterStandardStackFrame(); void leaveStandardStackFrame(); @@ -1042,8 +1042,8 @@ public: ImmRegBinOp inlineImmRegOp; }; - static const BinaryOperationInfo binaryOperations[QQmlJS::V4IR::LastAluOp + 1]; - static const BinaryOperationInfo &binaryOperation(V4IR::AluOp operation) + static const BinaryOperationInfo binaryOperations[IR::LastAluOp + 1]; + static const BinaryOperationInfo &binaryOperation(IR::AluOp operation) { return binaryOperations[operation]; } Jump inline_add32(Address addr, RegisterID reg) @@ -1187,9 +1187,9 @@ public: return Jump(); } - Pointer toAddress(RegisterID tmpReg, V4IR::Expr *e, int offset) + Pointer toAddress(RegisterID tmpReg, IR::Expr *e, int offset) { - if (V4IR::Const *c = e->asConst()) { + if (IR::Const *c = e->asConst()) { Address addr = _stackLayout.savedRegPointer(offset); Address tagAddr = addr; tagAddr.offset += 4; @@ -1200,9 +1200,9 @@ public: return Pointer(addr); } - V4IR::Temp *t = e->asTemp(); + IR::Temp *t = e->asTemp(); Q_ASSERT(t); - if (t->kind != V4IR::Temp::PhysicalRegister) + if (t->kind != IR::Temp::PhysicalRegister) return loadTempAddress(tmpReg, t); @@ -1221,9 +1221,9 @@ public: move(src, dest); } - void storeBool(RegisterID reg, V4IR::Temp *target) + void storeBool(RegisterID reg, IR::Temp *target) { - if (target->kind == V4IR::Temp::PhysicalRegister) { + if (target->kind == IR::Temp::PhysicalRegister) { move(reg, (RegisterID) target->index); } else { Pointer addr = loadTempAddress(ScratchRegister, target); @@ -1231,9 +1231,9 @@ public: } } - void storeBool(bool value, V4IR::Temp *target) { + void storeBool(bool value, IR::Temp *target) { TrustedImm32 trustedValue(value ? 1 : 0); - if (target->kind == V4IR::Temp::PhysicalRegister) { + if (target->kind == IR::Temp::PhysicalRegister) { move(trustedValue, (RegisterID) target->index); } else { move(trustedValue, ScratchRegister); @@ -1253,9 +1253,9 @@ public: store32(TrustedImm32(QV4::Primitive::fromInt32(0).tag), addr); } - void storeInt32(RegisterID reg, V4IR::Temp *target) + void storeInt32(RegisterID reg, IR::Temp *target) { - if (target->kind == V4IR::Temp::PhysicalRegister) { + if (target->kind == IR::Temp::PhysicalRegister) { move(reg, (RegisterID) target->index); } else { Pointer addr = loadTempAddress(ScratchRegister, target); @@ -1280,9 +1280,9 @@ public: done.link(this); } - void storeUInt32(RegisterID reg, V4IR::Temp *target) + void storeUInt32(RegisterID reg, IR::Temp *target) { - if (target->kind == V4IR::Temp::PhysicalRegister) { + if (target->kind == IR::Temp::PhysicalRegister) { move(reg, (RegisterID) target->index); } else { Pointer addr = loadTempAddress(ScratchRegister, target); @@ -1290,9 +1290,9 @@ public: } } - FPRegisterID toDoubleRegister(V4IR::Expr *e, FPRegisterID target = FPGpr0) + FPRegisterID toDoubleRegister(IR::Expr *e, FPRegisterID target = FPGpr0) { - if (V4IR::Const *c = e->asConst()) { + if (IR::Const *c = e->asConst()) { #if QT_POINTER_SIZE == 8 union { double d; @@ -1307,30 +1307,30 @@ public: return target; } - V4IR::Temp *t = e->asTemp(); + IR::Temp *t = e->asTemp(); Q_ASSERT(t); - if (t->kind == V4IR::Temp::PhysicalRegister) + if (t->kind == IR::Temp::PhysicalRegister) return (FPRegisterID) t->index; loadDouble(t, target); return target; } - RegisterID toBoolRegister(V4IR::Expr *e, RegisterID scratchReg) + RegisterID toBoolRegister(IR::Expr *e, RegisterID scratchReg) { return toInt32Register(e, scratchReg); } - RegisterID toInt32Register(V4IR::Expr *e, RegisterID scratchReg) + RegisterID toInt32Register(IR::Expr *e, RegisterID scratchReg) { - if (V4IR::Const *c = e->asConst()) { + if (IR::Const *c = e->asConst()) { move(TrustedImm32(convertToValue(c).int_32), scratchReg); return scratchReg; } - V4IR::Temp *t = e->asTemp(); + IR::Temp *t = e->asTemp(); Q_ASSERT(t); - if (t->kind == V4IR::Temp::PhysicalRegister) + if (t->kind == IR::Temp::PhysicalRegister) return (RegisterID) t->index; return toInt32Register(loadTempAddress(scratchReg, t), scratchReg); @@ -1342,16 +1342,16 @@ public: return scratchReg; } - RegisterID toUInt32Register(V4IR::Expr *e, RegisterID scratchReg) + RegisterID toUInt32Register(IR::Expr *e, RegisterID scratchReg) { - if (V4IR::Const *c = e->asConst()) { + if (IR::Const *c = e->asConst()) { move(TrustedImm32(unsigned(c->value)), scratchReg); return scratchReg; } - V4IR::Temp *t = e->asTemp(); + IR::Temp *t = e->asTemp(); Q_ASSERT(t); - if (t->kind == V4IR::Temp::PhysicalRegister) + if (t->kind == IR::Temp::PhysicalRegister) return (RegisterID) t->index; return toUInt32Register(loadTempAddress(scratchReg, t), scratchReg); @@ -1390,14 +1390,14 @@ public: ConstantTable &constantTable() { return _constTable; } Label exceptionReturnLabel; - V4IR::BasicBlock * catchBlock; + IR::BasicBlock * catchBlock; QVector<Jump> exceptionPropagationJumps; private: const StackLayout _stackLayout; ConstantTable _constTable; - V4IR::Function *_function; - QHash<V4IR::BasicBlock *, Label> _addrs; - QHash<V4IR::BasicBlock *, QVector<Jump> > _patches; + IR::Function *_function; + QHash<IR::BasicBlock *, Label> _addrs; + QHash<IR::BasicBlock *, QVector<Jump> > _patches; QList<CallToLink> _callsToLink; struct DataLabelPatch { @@ -1406,8 +1406,8 @@ private: }; QList<DataLabelPatch> _dataLabelPatches; - QHash<V4IR::BasicBlock *, QVector<DataLabelPtr> > _labelPatches; - V4IR::BasicBlock *_nextBlock; + QHash<IR::BasicBlock *, QVector<DataLabelPtr> > _labelPatches; + IR::BasicBlock *_nextBlock; QV4::ExecutableAllocator *_executableAllocator; InstructionSelection *_isel; @@ -1428,20 +1428,20 @@ void Assembler::copyValue(Result result, Source source) } template <typename Result> -void Assembler::copyValue(Result result, V4IR::Expr* source) +void Assembler::copyValue(Result result, IR::Expr* source) { - if (source->type == V4IR::BoolType) { + if (source->type == IR::BoolType) { RegisterID reg = toInt32Register(source, ScratchRegister); storeBool(reg, result); - } else if (source->type == V4IR::SInt32Type) { + } else if (source->type == IR::SInt32Type) { RegisterID reg = toInt32Register(source, ScratchRegister); storeInt32(reg, result); - } else if (source->type == V4IR::UInt32Type) { + } else if (source->type == IR::UInt32Type) { RegisterID reg = toUInt32Register(source, ScratchRegister); storeUInt32(reg, result); - } else if (source->type == V4IR::DoubleType) { + } else if (source->type == IR::DoubleType) { storeDouble(toDoubleRegister(source), result); - } else if (V4IR::Temp *temp = source->asTemp()) { + } else if (IR::Temp *temp = source->asTemp()) { #ifdef VALUE_FITS_IN_REGISTER Q_UNUSED(temp); @@ -1453,7 +1453,7 @@ void Assembler::copyValue(Result result, V4IR::Expr* source) loadDouble(temp, FPGpr0); storeDouble(FPGpr0, result); #endif - } else if (V4IR::Const *c = source->asConst()) { + } else if (IR::Const *c = source->asConst()) { QV4::Primitive v = convertToValue(c); storeValue(v, result); } else { @@ -1470,8 +1470,8 @@ template <> inline void prepareRelativeCall(const RelativeCall &relativeCall, As relativeCall.addr.base); } -} // end of namespace MASM -} // end of namespace QQmlJS +} // end of namespace JIT +} // end of namespace QV4 QT_END_NAMESPACE |