V4 handles a maximum of 32 temporary registers.
authorMartin Jones <martin.jones@nokia.com>
Thu, 1 Mar 2012 09:04:29 +0000 (19:04 +1000)
committerQt by Nokia <qt-info@nokia.com>
Fri, 2 Mar 2012 05:14:49 +0000 (06:14 +0100)
Drop back to V8 if there are more than 32 being used.

Change-Id: I11f6e84746d897cd9b6789a5e9e4d2848909de00
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
src/declarative/qml/v4/qv4compiler.cpp
src/declarative/qml/v4/qv4compiler_p_p.h

index 42e56d1..29023ae 100644 (file)
@@ -62,7 +62,7 @@ static bool qmlEnableV4 = true;
 
 using namespace QDeclarativeJS;
 QV4CompilerPrivate::QV4CompilerPrivate()
-: _function(0) , _block(0) , _discarded(false)
+    : _function(0) , _block(0) , _discarded(false), registerCount(0)
 {
 }
 
@@ -74,6 +74,7 @@ void QV4CompilerPrivate::trace(int line, int column)
     bytecode.clear();
 
     this->currentReg = _function->tempCount;
+    this->registerCount = qMax(this->registerCount, this->currentReg);
 
     foreach (IR::BasicBlock *bb, _function->basicBlocks) {
         if (! bb->isTerminated() && (bb->index + 1) < _function->basicBlocks.size())
@@ -1118,7 +1119,7 @@ bool QV4CompilerPrivate::compile(QDeclarativeJS::AST::Node *node)
         qerr << endl;
     }
 
-    if (discarded || subscriptionIds.count() > 0xFFFF || registeredStrings.count() > 0xFFFF)
+    if (discarded || subscriptionIds.count() > 0xFFFF || registeredStrings.count() > 0xFFFF || registerCount > 31)
         return false;
 
     return true;
index 85a7c36..c431406 100644 (file)
@@ -231,6 +231,7 @@ private:
     void discard() { _discarded = true; }
     bool _discarded;
     quint8 currentReg;
+    quint8 registerCount;
 
     bool usedSubscriptionIdsChanged;
     quint32 currentBlockMask;