aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4isel_moth.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2013-09-20 08:21:42 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2013-09-20 08:29:17 +0200
commitbbb78a92a910d32b2886af62c218db87325eb6ce (patch)
tree0e4b55352bb9f083826d0e80747982823f2894ed /src/qml/compiler/qv4isel_moth.cpp
parent4b5a7b15fc6d3650c8e9b7bf619804a0a953eeba (diff)
parent8ed38c70fd29680f7981d9d23581d46cf32139d0 (diff)
Merge branch 'dev' of ssh://codereview.qt-project.org/qt/qtdeclarative into HEAD
Conflicts: src/qml/compiler/qv4isel_masm.cpp src/qml/jsruntime/qv4script.cpp src/qml/qml/qml.pri src/qml/qml/qqmltypeloader_p.h Change-Id: Ia784d855a2131e3289454f12d841ca2c65be15c1
Diffstat (limited to 'src/qml/compiler/qv4isel_moth.cpp')
-rw-r--r--src/qml/compiler/qv4isel_moth.cpp100
1 files changed, 12 insertions, 88 deletions
diff --git a/src/qml/compiler/qv4isel_moth.cpp b/src/qml/compiler/qv4isel_moth.cpp
index 67433070f6..16ff43cd37 100644
--- a/src/qml/compiler/qv4isel_moth.cpp
+++ b/src/qml/compiler/qv4isel_moth.cpp
@@ -168,6 +168,8 @@ public:
private:
int allocateSlot(V4IR::Temp *t, V4IR::Stmt *currentStmt) {
+ Q_ASSERT(currentStmt->id > 0);
+
const V4IR::LifeTimeInterval &interval = _intervals[*t];
int idx = _hints.value(*t, -1);
if (idx != -1 && _activeSlots[idx] <= currentStmt->id) {
@@ -205,8 +207,9 @@ InstructionSelection::~InstructionSelection()
{
}
-void InstructionSelection::run(V4IR::Function *function)
+void InstructionSelection::run(int functionIndex)
{
+ V4IR::Function *function = irModule->functions[functionIndex];
V4IR::BasicBlock *block = 0, *nextBlock = 0;
QHash<V4IR::BasicBlock *, QVector<ptrdiff_t> > patches;
@@ -230,8 +233,10 @@ void InstructionSelection::run(V4IR::Function *function)
V4IR::Optimizer opt(_function);
opt.run();
StackSlotAllocator *stackSlotAllocator = 0;
- if (opt.isInSSA())
+ if (opt.isInSSA()) {
stackSlotAllocator = new StackSlotAllocator(opt.lifeRanges(), _function->tempCount);
+ opt.convertOutOfSSA();
+ }
qSwap(_stackSlotAllocator, stackSlotAllocator);
V4IR::Stmt *cs = 0;
qSwap(_currentStatement, cs);
@@ -257,21 +262,6 @@ void InstructionSelection::run(V4IR::Function *function)
if (s->location.isValid())
lineNumberMappings << _codeNext - _codeStart << s->location.startLine;
- if (opt.isInSSA() && s->asTerminator()) {
- foreach (const V4IR::Optimizer::SSADeconstructionMove &move,
- opt.ssaDeconstructionMoves(_block)) {
- if (V4IR::Const *c = move.source->asConst()) {
- loadConst(c, move.target);
- } else {
- Q_ASSERT(move.source->asTemp());
- if (move.needsConversion())
- convertType(move.source->asTemp(), move.target);
- else
- copyValue(move.source->asTemp(), move.target);
- }
- }
- }
-
s->accept(this);
}
}
@@ -496,10 +486,12 @@ void InstructionSelection::copyValue(V4IR::Temp *sourceTemp, V4IR::Temp *targetT
addInstruction(move);
}
-void InstructionSelection::swapValues(V4IR::Temp *, V4IR::Temp *)
+void InstructionSelection::swapValues(V4IR::Temp *sourceTemp, V4IR::Temp *targetTemp)
{
- // This is generated by the register allocator for the JIT, so it cannot end up here.
- Q_UNREACHABLE();
+ Instruction::SwapTemps swap;
+ swap.left = getParam(sourceTemp);
+ swap.right = getParam(targetTemp);
+ addInstruction(swap);
}
void InstructionSelection::unop(V4IR::AluOp oper, V4IR::Temp *sourceTemp, V4IR::Temp *targetTemp)
@@ -834,74 +826,6 @@ void InstructionSelection::callBuiltinDeleteValue(V4IR::Temp *result)
addInstruction(load);
}
-void InstructionSelection::callBuiltinPostDecrementMember(V4IR::Temp *base, const QString &name, V4IR::Temp *result)
-{
- Instruction::CallBuiltinPostDecMember call;
- call.base = getParam(base);
- call.member = registerString(name);
- call.result = getResultParam(result);
- addInstruction(call);
-}
-
-void InstructionSelection::callBuiltinPostDecrementSubscript(V4IR::Temp *base, V4IR::Temp *index, V4IR::Temp *result)
-{
- Instruction::CallBuiltinPostDecSubscript call;
- call.base = getParam(base);
- call.index = getParam(index);
- call.result = getResultParam(result);
- addInstruction(call);
-}
-
-void InstructionSelection::callBuiltinPostDecrementName(const QString &name, V4IR::Temp *result)
-{
- Instruction::CallBuiltinPostDecName call;
- call.name = registerString(name);
- call.result = getResultParam(result);
- addInstruction(call);
-}
-
-void InstructionSelection::callBuiltinPostDecrementValue(V4IR::Temp *value, V4IR::Temp *result)
-{
- Instruction::CallBuiltinPostDecValue call;
- call.value = getParam(value);
- call.result = getResultParam(result);
- addInstruction(call);
-}
-
-void InstructionSelection::callBuiltinPostIncrementMember(V4IR::Temp *base, const QString &name, V4IR::Temp *result)
-{
- Instruction::CallBuiltinPostIncMember call;
- call.base = getParam(base);
- call.member = registerString(name);
- call.result = getResultParam(result);
- addInstruction(call);
-}
-
-void InstructionSelection::callBuiltinPostIncrementSubscript(V4IR::Temp *base, V4IR::Temp *index, V4IR::Temp *result)
-{
- Instruction::CallBuiltinPostIncSubscript call;
- call.base = getParam(base);
- call.index = getParam(index);
- call.result = getResultParam(result);
- addInstruction(call);
-}
-
-void InstructionSelection::callBuiltinPostIncrementName(const QString &name, V4IR::Temp *result)
-{
- Instruction::CallBuiltinPostIncName call;
- call.name = registerString(name);
- call.result = getResultParam(result);
- addInstruction(call);
-}
-
-void InstructionSelection::callBuiltinPostIncrementValue(V4IR::Temp *value, V4IR::Temp *result)
-{
- Instruction::CallBuiltinPostIncValue call;
- call.value = getParam(value);
- call.result = getResultParam(result);
- addInstruction(call);
-}
-
void InstructionSelection::callBuiltinThrow(V4IR::Expr *arg)
{
Instruction::CallBuiltinThrow call;