Clean up our internal namespaces
authorLars Knoll <lars.knoll@digia.com>
Fri, 14 Feb 2014 12:58:40 +0000 (13:58 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Sun, 23 Feb 2014 08:39:52 +0000 (09:39 +0100)
QQmlJS::MASM -> QV4::JIT
QQmlJS::V4IR -> QV4::IR

Change-Id: I707e8990459114a699c200fe3c22cec3c8df1afc
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
42 files changed:
src/qml/compiler/qqmlcodegenerator.cpp
src/qml/compiler/qqmlcodegenerator_p.h
src/qml/compiler/qqmltypecompiler.cpp
src/qml/compiler/qv4codegen.cpp
src/qml/compiler/qv4codegen_p.h
src/qml/compiler/qv4compileddata.cpp
src/qml/compiler/qv4compileddata_p.h
src/qml/compiler/qv4compiler.cpp
src/qml/compiler/qv4compiler_p.h
src/qml/compiler/qv4instr_moth.cpp
src/qml/compiler/qv4instr_moth_p.h
src/qml/compiler/qv4isel_moth.cpp
src/qml/compiler/qv4isel_moth_p.h
src/qml/compiler/qv4isel_p.cpp
src/qml/compiler/qv4isel_p.h
src/qml/compiler/qv4isel_util_p.h
src/qml/compiler/qv4jsir.cpp
src/qml/compiler/qv4jsir_p.h
src/qml/compiler/qv4ssa.cpp
src/qml/compiler/qv4ssa_p.h
src/qml/jit/qv4assembler.cpp
src/qml/jit/qv4assembler_p.h
src/qml/jit/qv4binop.cpp
src/qml/jit/qv4binop_p.h
src/qml/jit/qv4isel_masm.cpp
src/qml/jit/qv4isel_masm_p.h
src/qml/jit/qv4regalloc.cpp
src/qml/jit/qv4regalloc_p.h
src/qml/jit/qv4unop.cpp
src/qml/jit/qv4unop_p.h
src/qml/jsruntime/qv4debugging.cpp
src/qml/jsruntime/qv4engine.cpp
src/qml/jsruntime/qv4engine_p.h
src/qml/jsruntime/qv4functionobject.cpp
src/qml/jsruntime/qv4script.cpp
src/qml/jsruntime/qv4vme_moth.cpp
src/qml/jsruntime/qv4vme_moth_p.h
src/qml/qml/qqmlcompiler.cpp
src/qml/qml/qqmlcompiler_p.h
src/qml/qml/qqmlcustomparser.cpp
tests/auto/qml/v4misc/tst_v4misc.cpp
tools/qmljs/main.cpp

index 57b7bb53df58b136b8e9fe6c3fd8dcd439b516bb..583cd110c92e633159008000c235eb857402acef 100644 (file)
@@ -66,7 +66,7 @@ using namespace QtQml;
         return false; \
     }
 
-void QmlObject::init(MemoryPool *pool, int typeNameIndex, int id, const AST::SourceLocation &loc)
+void QmlObject::init(QQmlJS::MemoryPool *pool, int typeNameIndex, int id, const QQmlJS::AST::SourceLocation &loc)
 {
     inheritedTypeNameIndex = typeNameIndex;
 
@@ -91,11 +91,11 @@ void QmlObject::dump(DebugStream &out)
     out << "}" << endl;
 }
 
-QString QmlObject::sanityCheckFunctionNames(const QList<CompiledFunctionOrExpression> &allFunctions, const QSet<QString> &illegalNames, AST::SourceLocation *errorLocation)
+QString QmlObject::sanityCheckFunctionNames(const QList<CompiledFunctionOrExpression> &allFunctions, const QSet<QString> &illegalNames, QQmlJS::AST::SourceLocation *errorLocation)
 {
     QSet<int> functionNames;
     for (Function *f = functions->first; f; f = f->next) {
-        AST::FunctionDeclaration *function = AST::cast<AST::FunctionDeclaration*>(allFunctions.at(f->index).node);
+        QQmlJS::AST::FunctionDeclaration *function = QQmlJS::AST::cast<QQmlJS::AST::FunctionDeclaration*>(allFunctions.at(f->index).node);
         Q_ASSERT(function);
         *errorLocation = function->identifierToken;
         QString name = function->name.toString();
@@ -125,7 +125,7 @@ QString QmlObject::appendSignal(Signal *signal)
     return QString(); // no error
 }
 
-QString QmlObject::appendProperty(QmlProperty *prop, const QString &propertyName, bool isDefaultProperty, const AST::SourceLocation &defaultToken, AST::SourceLocation *errorLocation)
+QString QmlObject::appendProperty(QmlProperty *prop, const QString &propertyName, bool isDefaultProperty, const QQmlJS::AST::SourceLocation &defaultToken, QQmlJS::AST::SourceLocation *errorLocation)
 {
     QmlObject *target = declarationsOverride;
     if (!target)
@@ -150,7 +150,7 @@ QString QmlObject::appendProperty(QmlProperty *prop, const QString &propertyName
     return QString(); // no error
 }
 
-void QmlObject::appendFunction(Function *f)
+void QmlObject::appendFunction(QtQml::Function *f)
 {
     QmlObject *target = declarationsOverride;
     if (!target)
@@ -200,7 +200,7 @@ QQmlCodeGenerator::QQmlCodeGenerator(const QSet<QString> &illegalNames)
 bool QQmlCodeGenerator::generateFromQml(const QString &code, const QUrl &url, const QString &urlString, ParsedQML *output)
 {
     this->url = url;
-    AST::UiProgram *program = 0;
+    QQmlJS::AST::UiProgram *program = 0;
     {
         QQmlJS::Lexer lexer(&output->jsParserEngine);
         lexer.setCode(code, /*line = */ 1);
@@ -210,7 +210,7 @@ bool QQmlCodeGenerator::generateFromQml(const QString &code, const QUrl &url, co
         if (! parser.parse() || !parser.diagnosticMessages().isEmpty()) {
 
             // Extract errors from the parser
-            foreach (const DiagnosticMessage &m, parser.diagnosticMessages()) {
+            foreach (const QQmlJS::DiagnosticMessage &m, parser.diagnosticMessages()) {
 
                 if (m.isWarning()) {
                     qWarning("%s:%d : %s", qPrintable(urlString), m.loc.startLine, qPrintable(m.message));
@@ -250,14 +250,14 @@ bool QQmlCodeGenerator::generateFromQml(const QString &code, const QUrl &url, co
     if (program->members->next) {
         QQmlError error;
         error.setDescription(QCoreApplication::translate("QQmlParser", "Unexpected object definition"));
-        AST::SourceLocation loc = program->members->next->firstSourceLocation();
+        QQmlJS::AST::SourceLocation loc = program->members->next->firstSourceLocation();
         error.setLine(loc.startLine);
         error.setColumn(loc.startColumn);
         errors << error;
         return false;
     }
 
-    AST::UiObjectDefinition *rootObject = AST::cast<AST::UiObjectDefinition*>(program->members->member);
+    QQmlJS::AST::UiObjectDefinition *rootObject = QQmlJS::AST::cast<QQmlJS::AST::UiObjectDefinition*>(program->members->member);
     Q_ASSERT(rootObject);
     output->indexOfRootObject = defineQMLObject(rootObject);
 
@@ -285,18 +285,18 @@ bool QQmlCodeGenerator::isSignalPropertyName(const QString &name)
     return false; // consists solely of underscores - invalid.
 }
 
-bool QQmlCodeGenerator::visit(AST::UiArrayMemberList *ast)
+bool QQmlCodeGenerator::visit(QQmlJS::AST::UiArrayMemberList *ast)
 {
-    return AST::Visitor::visit(ast);
+    return QQmlJS::AST::Visitor::visit(ast);
 }
 
-bool QQmlCodeGenerator::visit(AST::UiProgram *)
+bool QQmlCodeGenerator::visit(QQmlJS::AST::UiProgram *)
 {
     Q_ASSERT(!"should not happen");
     return false;
 }
 
-bool QQmlCodeGenerator::visit(AST::UiObjectDefinition *node)
+bool QQmlCodeGenerator::visit(QQmlJS::AST::UiObjectDefinition *node)
 {
     // The grammar can't distinguish between two different definitions here:
     //     Item { ... }
@@ -306,7 +306,7 @@ bool QQmlCodeGenerator::visit(AST::UiObjectDefinition *node)
     // and the latter is a binding to the font property with no type name but
     // only initializer.
 
-    AST::UiQualifiedId *lastId = node->qualifiedTypeNameId;
+    QQmlJS::AST::UiQualifiedId *lastId = node->qualifiedTypeNameId;
     while (lastId->next)
         lastId = lastId->next;
     bool isType = lastId->name.unicode()->isUpper();
@@ -320,31 +320,31 @@ bool QQmlCodeGenerator::visit(AST::UiObjectDefinition *node)
     return false;
 }
 
-bool QQmlCodeGenerator::visit(AST::UiObjectBinding *node)
+bool QQmlCodeGenerator::visit(QQmlJS::AST::UiObjectBinding *node)
 {
     int idx = defineQMLObject(node->qualifiedTypeNameId, node->qualifiedTypeNameId->firstSourceLocation(), node->initializer);
     appendBinding(node->qualifiedId, idx, node->hasOnToken);
     return false;
 }
 
-bool QQmlCodeGenerator::visit(AST::UiScriptBinding *node)
+bool QQmlCodeGenerator::visit(QQmlJS::AST::UiScriptBinding *node)
 {
     appendBinding(node->qualifiedId, node->statement);
     return false;
 }
 
-bool QQmlCodeGenerator::visit(AST::UiArrayBinding *node)
+bool QQmlCodeGenerator::visit(QQmlJS::AST::UiArrayBinding *node)
 {
     QmlObject *object = 0;
-    AST::UiQualifiedId *name = node->qualifiedId;
+    QQmlJS::AST::UiQualifiedId *name = node->qualifiedId;
     if (!resolveQualifiedId(&name, &object))
         return false;
 
     qSwap(_object, object);
 
-    AST::UiArrayMemberList *member = node->members;
+    QQmlJS::AST::UiArrayMemberList *member = node->members;
     while (member) {
-        AST::UiObjectDefinition *def = AST::cast<AST::UiObjectDefinition*>(member->member);
+        QQmlJS::AST::UiObjectDefinition *def = QQmlJS::AST::cast<QQmlJS::AST::UiObjectDefinition*>(member->member);
 
         int idx = defineQMLObject(def);
         appendBinding(name->identifierToken, registerString(name->name.toString()), idx, /*isListItem*/ true);
@@ -356,37 +356,37 @@ bool QQmlCodeGenerator::visit(AST::UiArrayBinding *node)
     return false;
 }
 
-bool QQmlCodeGenerator::visit(AST::UiHeaderItemList *list)
+bool QQmlCodeGenerator::visit(QQmlJS::AST::UiHeaderItemList *list)
 {
-    return AST::Visitor::visit(list);
+    return QQmlJS::AST::Visitor::visit(list);
 }
 
-bool QQmlCodeGenerator::visit(AST::UiObjectInitializer *ast)
+bool QQmlCodeGenerator::visit(QQmlJS::AST::UiObjectInitializer *ast)
 {
-    return AST::Visitor::visit(ast);
+    return QQmlJS::AST::Visitor::visit(ast);
 }
 
-bool QQmlCodeGenerator::visit(AST::UiObjectMemberList *ast)
+bool QQmlCodeGenerator::visit(QQmlJS::AST::UiObjectMemberList *ast)
 {
-    return AST::Visitor::visit(ast);
+    return QQmlJS::AST::Visitor::visit(ast);
 }
 
-bool QQmlCodeGenerator::visit(AST::UiParameterList *ast)
+bool QQmlCodeGenerator::visit(QQmlJS::AST::UiParameterList *ast)
 {
-    return AST::Visitor::visit(ast);
+    return QQmlJS::AST::Visitor::visit(ast);
 }
 
-bool QQmlCodeGenerator::visit(AST::UiQualifiedId *id)
+bool QQmlCodeGenerator::visit(QQmlJS::AST::UiQualifiedId *id)
 {
-    return AST::Visitor::visit(id);
+    return QQmlJS::AST::Visitor::visit(id);
 }
 
-void QQmlCodeGenerator::accept(AST::Node *node)
+void QQmlCodeGenerator::accept(QQmlJS::AST::Node *node)
 {
-    AST::Node::acceptChild(node, this);
+    QQmlJS::AST::Node::acceptChild(node, this);
 }
 
-int QQmlCodeGenerator::defineQMLObject(AST::UiQualifiedId *qualifiedTypeNameId, const AST::SourceLocation &location, AST::UiObjectInitializer *initializer, QmlObject *declarationsOverride)
+int QQmlCodeGenerator::defineQMLObject(QQmlJS::AST::UiQualifiedId *qualifiedTypeNameId, const QQmlJS::AST::SourceLocation &location, QQmlJS::AST::UiObjectInitializer *initializer, QmlObject *declarationsOverride)
 {
     QmlObject *obj = New<QmlObject>();
     _objects.append(obj);
@@ -406,7 +406,7 @@ int QQmlCodeGenerator::defineQMLObject(AST::UiQualifiedId *qualifiedTypeNameId,
 
     qSwap(_object, obj);
 
-    AST::SourceLocation loc;
+    QQmlJS::AST::SourceLocation loc;
     QString error = obj->sanityCheckFunctionNames(_functions, illegalNames, &loc);
     if (!error.isEmpty())
         recordError(loc, error);
@@ -414,7 +414,7 @@ int QQmlCodeGenerator::defineQMLObject(AST::UiQualifiedId *qualifiedTypeNameId,
     return objectIndex;
 }
 
-bool QQmlCodeGenerator::visit(AST::UiImport *node)
+bool QQmlCodeGenerator::visit(QQmlJS::AST::UiImport *node)
 {
     QString uri;
     QV4::CompiledData::Import *import = New<QV4::CompiledData::Import>();
@@ -506,7 +506,7 @@ bool QQmlCodeGenerator::visit(AST::UiImport *node)
     return false;
 }
 
-bool QQmlCodeGenerator::visit(AST::UiPragma *node)
+bool QQmlCodeGenerator::visit(QQmlJS::AST::UiPragma *node)
 {
     Pragma *pragma = New<Pragma>();
 
@@ -558,7 +558,7 @@ static QStringList astNodeToStringList(QQmlJS::AST::Node *node)
     return QStringList();
 }
 
-bool QQmlCodeGenerator::visit(AST::UiPublicMember *node)
+bool QQmlCodeGenerator::visit(QQmlJS::AST::UiPublicMember *node)
 {
     static const struct TypeNameToType {
         const char *name;
@@ -594,18 +594,18 @@ bool QQmlCodeGenerator::visit(AST::UiPublicMember *node)
     static const int propTypeNameToTypesCount = sizeof(propTypeNameToTypes) /
                                                 sizeof(propTypeNameToTypes[0]);
 
-    if (node->type == AST::UiPublicMember::Signal) {
+    if (node->type == QQmlJS::AST::UiPublicMember::Signal) {
         Signal *signal = New<Signal>();
         QString signalName = node->name.toString();
         signal->nameIndex = registerString(signalName);
 
-        AST::SourceLocation loc = node->typeToken;
+        QQmlJS::AST::SourceLocation loc = node->typeToken;
         signal->location.line = loc.startLine;
         signal->location.column = loc.startColumn;
 
         signal->parameters = New<PoolList<SignalParameter> >();
 
-        AST::UiParameterList *p = node->parameters;
+        QQmlJS::AST::UiParameterList *p = node->parameters;
         while (p) {
             const QStringRef &memberType = p->type;
 
@@ -740,7 +740,7 @@ bool QQmlCodeGenerator::visit(AST::UiPublicMember *node)
         const QString propName = name.toString();
         property->nameIndex = registerString(propName);
 
-        AST::SourceLocation loc = node->firstSourceLocation();
+        QQmlJS::AST::SourceLocation loc = node->firstSourceLocation();
         property->location.line = loc.startLine;
         property->location.column = loc.startColumn;
 
@@ -750,7 +750,7 @@ bool QQmlCodeGenerator::visit(AST::UiPublicMember *node)
             if (!node->statement && !node->binding)
                 COMPILE_EXCEPTION(loc, tr("No property alias location"));
 
-            AST::SourceLocation rhsLoc;
+            QQmlJS::AST::SourceLocation rhsLoc;
             if (node->binding)
                 rhsLoc = node->binding->firstSourceLocation();
             else if (node->statement)
@@ -762,7 +762,7 @@ bool QQmlCodeGenerator::visit(AST::UiPublicMember *node)
 
             QStringList alias;
 
-            if (AST::ExpressionStatement *stmt = AST::cast<AST::ExpressionStatement*>(node->statement)) {
+            if (QQmlJS::AST::ExpressionStatement *stmt = QQmlJS::AST::cast<QQmlJS::AST::ExpressionStatement*>(node->statement)) {
                 alias = astNodeToStringList(stmt->expression);
                 if (alias.isEmpty()) {
                     if (isStatementNodeScript(node->statement)) {
@@ -792,7 +792,7 @@ bool QQmlCodeGenerator::visit(AST::UiPublicMember *node)
             qSwap(_propertyDeclaration, property);
         }
 
-        AST::SourceLocation errorLocation;
+        QQmlJS::AST::SourceLocation errorLocation;
         QString error;
 
         if (illegalNames.contains(propName))
@@ -815,7 +815,7 @@ bool QQmlCodeGenerator::visit(AST::UiPublicMember *node)
         if (node->binding) {
             qSwap(_propertyDeclaration, property);
             // process QML-like initializers (e.g. property Object o: Object {})
-            AST::Node::accept(node->binding, this);
+            QQmlJS::AST::Node::accept(node->binding, this);
             qSwap(_propertyDeclaration, property);
         }
     }
@@ -823,13 +823,13 @@ bool QQmlCodeGenerator::visit(AST::UiPublicMember *node)
     return false;
 }
 
-bool QQmlCodeGenerator::visit(AST::UiSourceElement *node)
+bool QQmlCodeGenerator::visit(QQmlJS::AST::UiSourceElement *node)
 {
-    if (AST::FunctionDeclaration *funDecl = AST::cast<AST::FunctionDeclaration *>(node->sourceElement)) {
+    if (QQmlJS::AST::FunctionDeclaration *funDecl = QQmlJS::AST::cast<QQmlJS::AST::FunctionDeclaration *>(node->sourceElement)) {
         _functions << funDecl;
         Function *f = New<Function>();
         f->functionDeclaration = funDecl;
-        AST::SourceLocation loc = funDecl->identifierToken;
+        QQmlJS::AST::SourceLocation loc = funDecl->identifierToken;
         f->location.line = loc.startLine;
         f->location.column = loc.startColumn;
         f->index = _functions.size() - 1;
@@ -845,11 +845,11 @@ bool QQmlCodeGenerator::visit(AST::UiSourceElement *node)
     return false;
 }
 
-QString QQmlCodeGenerator::asString(AST::UiQualifiedId *node)
+QString QQmlCodeGenerator::asString(QQmlJS::AST::UiQualifiedId *node)
 {
     QString s;
 
-    for (AST::UiQualifiedId *it = node; it; it = it->next) {
+    for (QQmlJS::AST::UiQualifiedId *it = node; it; it = it->next) {
         s.append(it->name);
 
         if (it->next)
@@ -859,7 +859,7 @@ QString QQmlCodeGenerator::asString(AST::UiQualifiedId *node)
     return s;
 }
 
-QStringRef QQmlCodeGenerator::asStringRef(AST::Node *node)
+QStringRef QQmlCodeGenerator::asStringRef(QQmlJS::AST::Node *node)
 {
     if (!node)
         return QStringRef();
@@ -885,38 +885,38 @@ void QQmlCodeGenerator::extractVersion(QStringRef string, int *maj, int *min)
     }
 }
 
-QStringRef QQmlCodeGenerator::textRefAt(const AST::SourceLocation &first, const AST::SourceLocation &last) const
+QStringRef QQmlCodeGenerator::textRefAt(const QQmlJS::AST::SourceLocation &first, const QQmlJS::AST::SourceLocation &last) const
 {
     return QStringRef(&sourceCode, first.offset, last.offset + last.length - first.offset);
 }
 
-void QQmlCodeGenerator::setBindingValue(QV4::CompiledData::Binding *binding, AST::Statement *statement)
+void QQmlCodeGenerator::setBindingValue(QV4::CompiledData::Binding *binding, QQmlJS::AST::Statement *statement)
 {
-    AST::SourceLocation loc = statement->firstSourceLocation();
+    QQmlJS::AST::SourceLocation loc = statement->firstSourceLocation();
     binding->valueLocation.line = loc.startLine;
     binding->valueLocation.column = loc.startColumn;
     binding->type = QV4::CompiledData::Binding::Type_Invalid;
     if (_propertyDeclaration && (_propertyDeclaration->flags & QV4::CompiledData::Property::IsReadOnly))
         binding->flags |= QV4::CompiledData::Binding::InitializerForReadOnlyDeclaration;
 
-    if (AST::ExpressionStatement *stmt = AST::cast<AST::ExpressionStatement *>(statement)) {
-        AST::ExpressionNode *expr = stmt->expression;
-        if (AST::StringLiteral *lit = AST::cast<AST::StringLiteral *>(expr)) {
+    if (QQmlJS::AST::ExpressionStatement *stmt = QQmlJS::AST::cast<QQmlJS::AST::ExpressionStatement *>(statement)) {
+        QQmlJS::AST::ExpressionNode *expr = stmt->expression;
+        if (QQmlJS::AST::StringLiteral *lit = QQmlJS::AST::cast<QQmlJS::AST::StringLiteral *>(expr)) {
             binding->type = QV4::CompiledData::Binding::Type_String;
             binding->stringIndex = registerString(lit->value.toString());
-        } else if (expr->kind == AST::Node::Kind_TrueLiteral) {
+        } else if (expr->kind == QQmlJS::AST::Node::Kind_TrueLiteral) {
             binding->type = QV4::CompiledData::Binding::Type_Boolean;
             binding->value.b = true;
-        } else if (expr->kind == AST::Node::Kind_FalseLiteral) {
+        } else if (expr->kind == QQmlJS::AST::Node::Kind_FalseLiteral) {
             binding->type = QV4::CompiledData::Binding::Type_Boolean;
             binding->value.b = false;
-        } else if (AST::NumericLiteral *lit = AST::cast<AST::NumericLiteral *>(expr)) {
+        } else if (QQmlJS::AST::NumericLiteral *lit = QQmlJS::AST::cast<QQmlJS::AST::NumericLiteral *>(expr)) {
             binding->type = QV4::CompiledData::Binding::Type_Number;
             binding->value.d = lit->value;
         } else {
 
-            if (AST::UnaryMinusExpression *unaryMinus = AST::cast<AST::UnaryMinusExpression *>(expr)) {
-               if (AST::NumericLiteral *lit = AST::cast<AST::NumericLiteral *>(unaryMinus->expression)) {
+            if (QQmlJS::AST::UnaryMinusExpression *unaryMinus = QQmlJS::AST::cast<QQmlJS::AST::UnaryMinusExpression *>(expr)) {
+               if (QQmlJS::AST::NumericLiteral *lit = QQmlJS::AST::cast<QQmlJS::AST::NumericLiteral *>(unaryMinus->expression)) {
                    binding->type = QV4::CompiledData::Binding::Type_Number;
                    binding->value.d = -lit->value;
                }
@@ -933,7 +933,7 @@ void QQmlCodeGenerator::setBindingValue(QV4::CompiledData::Binding *binding, AST
     }
 }
 
-void QQmlCodeGenerator::appendBinding(AST::UiQualifiedId *name, AST::Statement *value)
+void QQmlCodeGenerator::appendBinding(QQmlJS::AST::UiQualifiedId *name, QQmlJS::AST::Statement *value)
 {
     QmlObject *object = 0;
     if (!resolveQualifiedId(&name, &object))
@@ -943,7 +943,7 @@ void QQmlCodeGenerator::appendBinding(AST::UiQualifiedId *name, AST::Statement *
     qSwap(_object, object);
 }
 
-void QQmlCodeGenerator::appendBinding(AST::UiQualifiedId *name, int objectIndex, bool isOnAssignment)
+void QQmlCodeGenerator::appendBinding(QQmlJS::AST::UiQualifiedId *name, int objectIndex, bool isOnAssignment)
 {
     QmlObject *object = 0;
     if (!resolveQualifiedId(&name, &object))
@@ -953,7 +953,7 @@ void QQmlCodeGenerator::appendBinding(AST::UiQualifiedId *name, int objectIndex,
     qSwap(_object, object);
 }
 
-void QQmlCodeGenerator::appendBinding(const AST::SourceLocation &nameLocation, quint32 propertyNameIndex, AST::Statement *value)
+void QQmlCodeGenerator::appendBinding(const QQmlJS::AST::SourceLocation &nameLocation, quint32 propertyNameIndex, QQmlJS::AST::Statement *value)
 {
     if (stringAt(propertyNameIndex) == QStringLiteral("id")) {
         setId(nameLocation, value);
@@ -972,7 +972,7 @@ void QQmlCodeGenerator::appendBinding(const AST::SourceLocation &nameLocation, q
     }
 }
 
-void QQmlCodeGenerator::appendBinding(const AST::SourceLocation &nameLocation, quint32 propertyNameIndex, int objectIndex, bool isListItem, bool isOnAssignment)
+void QQmlCodeGenerator::appendBinding(const QQmlJS::AST::SourceLocation &nameLocation, quint32 propertyNameIndex, int objectIndex, bool isListItem, bool isOnAssignment)
 {
     if (stringAt(propertyNameIndex) == QStringLiteral("id")) {
         recordError(nameLocation, tr("Invalid component id specification"));
@@ -1017,14 +1017,14 @@ QmlObject *QQmlCodeGenerator::bindingsTarget() const
     return _object;
 }
 
-bool QQmlCodeGenerator::setId(const AST::SourceLocation &idLocation, AST::Statement *value)
+bool QQmlCodeGenerator::setId(const QQmlJS::AST::SourceLocation &idLocation, QQmlJS::AST::Statement *value)
 {
-    AST::SourceLocation loc = value->firstSourceLocation();
+    QQmlJS::AST::SourceLocation loc = value->firstSourceLocation();
     QStringRef str;
 
-    AST::Node *node = value;
-    if (AST::ExpressionStatement *stmt = AST::cast<AST::ExpressionStatement *>(node)) {
-        if (AST::StringLiteral *lit = AST::cast<AST::StringLiteral *>(stmt->expression)) {
+    QQmlJS::AST::Node *node = value;
+    if (QQmlJS::AST::ExpressionStatement *stmt = QQmlJS::AST::cast<QQmlJS::AST::ExpressionStatement *>(node)) {
+        if (QQmlJS::AST::StringLiteral *lit = QQmlJS::AST::cast<QQmlJS::AST::StringLiteral *>(stmt->expression)) {
             str = lit->value;
             node = 0;
         } else
@@ -1065,9 +1065,9 @@ bool QQmlCodeGenerator::setId(const AST::SourceLocation &idLocation, AST::Statem
     return true;
 }
 
-bool QQmlCodeGenerator::resolveQualifiedId(AST::UiQualifiedId **nameToResolve, QmlObject **object)
+bool QQmlCodeGenerator::resolveQualifiedId(QQmlJS::AST::UiQualifiedId **nameToResolve, QmlObject **object)
 {
-    AST::UiQualifiedId *qualifiedIdElement = *nameToResolve;
+    QQmlJS::AST::UiQualifiedId *qualifiedIdElement = *nameToResolve;
 
     if (qualifiedIdElement->name == QStringLiteral("id") && qualifiedIdElement->next)
         COMPILE_EXCEPTION(qualifiedIdElement->identifierToken, tr( "Invalid use of id property"));
@@ -1103,7 +1103,7 @@ bool QQmlCodeGenerator::resolveQualifiedId(AST::UiQualifiedId **nameToResolve, Q
         else
             binding->type = QV4::CompiledData::Binding::Type_GroupProperty;
 
-        int objIndex = defineQMLObject(0, AST::SourceLocation(), 0, 0);
+        int objIndex = defineQMLObject(0, QQmlJS::AST::SourceLocation(), 0, 0);
         binding->value.objectIndex = objIndex;
 
         QString error = (*object)->appendBinding(binding, /*isListBinding*/false);
@@ -1121,7 +1121,7 @@ bool QQmlCodeGenerator::resolveQualifiedId(AST::UiQualifiedId **nameToResolve, Q
     return true;
 }
 
-void QQmlCodeGenerator::recordError(const AST::SourceLocation &location, const QString &description)
+void QQmlCodeGenerator::recordError(const QQmlJS::AST::SourceLocation &location, const QString &description)
 {
     QQmlError error;
     error.setUrl(url);
@@ -1155,7 +1155,7 @@ void QQmlCodeGenerator::collectTypeReferences()
     }
 }
 
-QQmlScript::LocationSpan QQmlCodeGenerator::location(AST::SourceLocation start, AST::SourceLocation end)
+QQmlScript::LocationSpan QQmlCodeGenerator::location(QQmlJS::AST::SourceLocation start, QQmlJS::AST::SourceLocation end)
 {
     QQmlScript::LocationSpan rv;
     rv.start.line = start.startLine;
@@ -1167,22 +1167,22 @@ QQmlScript::LocationSpan QQmlCodeGenerator::location(AST::SourceLocation start,
     return rv;
 }
 
-bool QQmlCodeGenerator::isStatementNodeScript(AST::Statement *statement)
+bool QQmlCodeGenerator::isStatementNodeScript(QQmlJS::AST::Statement *statement)
 {
-    if (AST::ExpressionStatement *stmt = AST::cast<AST::ExpressionStatement *>(statement)) {
-        AST::ExpressionNode *expr = stmt->expression;
-        if (AST::cast<AST::StringLiteral *>(expr))
+    if (QQmlJS::AST::ExpressionStatement *stmt = QQmlJS::AST::cast<QQmlJS::AST::ExpressionStatement *>(statement)) {
+        QQmlJS::AST::ExpressionNode *expr = stmt->expression;
+        if (QQmlJS::AST::cast<QQmlJS::AST::StringLiteral *>(expr))
             return false;
-        else if (expr->kind == AST::Node::Kind_TrueLiteral)
+        else if (expr->kind == QQmlJS::AST::Node::Kind_TrueLiteral)
             return false;
-        else if (expr->kind == AST::Node::Kind_FalseLiteral)
+        else if (expr->kind == QQmlJS::AST::Node::Kind_FalseLiteral)
             return false;
-        else if (AST::cast<AST::NumericLiteral *>(expr))
+        else if (QQmlJS::AST::cast<QQmlJS::AST::NumericLiteral *>(expr))
             return false;
         else {
 
-            if (AST::UnaryMinusExpression *unaryMinus = AST::cast<AST::UnaryMinusExpression *>(expr)) {
-               if (AST::cast<AST::NumericLiteral *>(unaryMinus->expression)) {
+            if (QQmlJS::AST::UnaryMinusExpression *unaryMinus = QQmlJS::AST::cast<QQmlJS::AST::UnaryMinusExpression *>(expr)) {
+               if (QQmlJS::AST::cast<QQmlJS::AST::NumericLiteral *>(unaryMinus->expression)) {
                    return false;
                }
             }
@@ -1341,7 +1341,8 @@ int QmlUnitGenerator::getStringId(const QString &str) const
     return jsUnitGenerator->getStringId(str);
 }
 
-JSCodeGen::JSCodeGen(const QString &fileName, const QString &sourceCode, V4IR::Module *jsModule, Engine *jsEngine, AST::UiProgram *qmlRoot, QQmlTypeNameCache *imports)
+JSCodeGen::JSCodeGen(const QString &fileName, const QString &sourceCode, IR::Module *jsModule, QQmlJS::Engine *jsEngine,
+                     QQmlJS::AST::UiProgram *qmlRoot, QQmlTypeNameCache *imports)
     : QQmlJS::Codegen(/*strict mode*/false)
     , sourceCode(sourceCode)
     , jsEngine(jsEngine)
@@ -1381,7 +1382,7 @@ QVector<int> JSCodeGen::generateJSCodeForFunctionsAndBindings(const QList<Compil
     scan.enterQmlScope(qmlRoot, QStringLiteral("context scope"));
     foreach (const CompiledFunctionOrExpression &f, functions) {
         Q_ASSERT(f.node != qmlRoot);
-        AST::FunctionDeclaration *function = AST::cast<AST::FunctionDeclaration*>(f.node);
+        QQmlJS::AST::FunctionDeclaration *function = QQmlJS::AST::cast<QQmlJS::AST::FunctionDeclaration*>(f.node);
 
         if (function)
             scan.enterQmlFunction(function);
@@ -1399,10 +1400,10 @@ QVector<int> JSCodeGen::generateJSCodeForFunctionsAndBindings(const QList<Compil
 
     for (int i = 0; i < functions.count(); ++i) {
         const CompiledFunctionOrExpression &qmlFunction = functions.at(i);
-        AST::Node *node = qmlFunction.node;
+        QQmlJS::AST::Node *node = qmlFunction.node;
         Q_ASSERT(node != qmlRoot);
 
-        AST::FunctionDeclaration *function = AST::cast<AST::FunctionDeclaration*>(node);
+        QQmlJS::AST::FunctionDeclaration *function = QQmlJS::AST::cast<QQmlJS::AST::FunctionDeclaration*>(node);
 
         QString name;
         if (function)
@@ -1412,21 +1413,21 @@ QVector<int> JSCodeGen::generateJSCodeForFunctionsAndBindings(const QList<Compil
         else
             name = QStringLiteral("%qml-expression-entry");
 
-        AST::SourceElements *body;
+        QQmlJS::AST::SourceElements *body;
         if (function)
             body = function->body ? function->body->elements : 0;
         else {
             // Synthesize source elements.
             QQmlJS::MemoryPool *pool = jsEngine->pool();
 
-            AST::Statement *stmt = node->statementCast();
+            QQmlJS::AST::Statement *stmt = node->statementCast();
             if (!stmt) {
                 Q_ASSERT(node->expressionCast());
-                AST::ExpressionNode *expr = node->expressionCast();
-                stmt = new (pool) AST::ExpressionStatement(expr);
+                QQmlJS::AST::ExpressionNode *expr = node->expressionCast();
+                stmt = new (pool) QQmlJS::AST::ExpressionStatement(expr);
             }
-            AST::SourceElement *element = new (pool) AST::StatementSourceElement(stmt);
-            body = new (pool) AST::SourceElements(element);
+            QQmlJS::AST::SourceElement *element = new (pool) QQmlJS::AST::StatementSourceElement(stmt);
+            body = new (pool) QQmlJS::AST::SourceElements(element);
             body = body->finish();
         }
 
@@ -1468,7 +1469,7 @@ QQmlPropertyData *JSCodeGen::lookupQmlCompliantProperty(QQmlPropertyCache *cache
     return pd;
 }
 
-static void initMetaObjectResolver(V4IR::MemberExpressionResolver *resolver, QQmlPropertyCache *metaObject);
+static void initMetaObjectResolver(IR::MemberExpressionResolver *resolver, QQmlPropertyCache *metaObject);
 
 enum MetaObjectResolverFlags {
     AllPropertiesAreFinal      = 0x1,
@@ -1477,11 +1478,11 @@ enum MetaObjectResolverFlags {
     ResolveTypeInformationOnly = 0x8
 };
 
-static void initMetaObjectResolver(V4IR::MemberExpressionResolver *resolver, QQmlPropertyCache *metaObject);
+static void initMetaObjectResolver(IR::MemberExpressionResolver *resolver, QQmlPropertyCache *metaObject);
 
-static V4IR::Type resolveQmlType(QQmlEnginePrivate *qmlEngine, V4IR::MemberExpressionResolver *resolver, V4IR::Member *member)
+static IR::Type resolveQmlType(QQmlEnginePrivate *qmlEngine, IR::MemberExpressionResolver *resolver, IR::Member *member)
 {
-    V4IR::Type result = V4IR::VarType;
+    IR::Type result = IR::VarType;
 
     QQmlType *type = static_cast<QQmlType*>(resolver->data);
 
@@ -1491,7 +1492,7 @@ static V4IR::Type resolveQmlType(QQmlEnginePrivate *qmlEngine, V4IR::MemberExpre
         if (ok) {
             member->setEnumValue(value);
             resolver->clear();
-            return V4IR::SInt32Type;
+            return IR::SInt32Type;
         }
     }
 
@@ -1513,7 +1514,7 @@ static V4IR::Type resolveQmlType(QQmlEnginePrivate *qmlEngine, V4IR::MemberExpre
     return result;
 }
 
-static void initQmlTypeResolver(V4IR::MemberExpressionResolver *resolver, QQmlType *qmlType)
+static void initQmlTypeResolver(IR::MemberExpressionResolver *resolver, QQmlType *qmlType)
 {
     resolver->resolveMember = &resolveQmlType;
     resolver->data = qmlType;
@@ -1521,9 +1522,9 @@ static void initQmlTypeResolver(V4IR::MemberExpressionResolver *resolver, QQmlTy
     resolver->flags = 0;
 }
 
-static V4IR::Type resolveImportNamespace(QQmlEnginePrivate *, V4IR::MemberExpressionResolver *resolver, V4IR::Member *member)
+static IR::Type resolveImportNamespace(QQmlEnginePrivate *, IR::MemberExpressionResolver *resolver, IR::Member *member)
 {
-    V4IR::Type result = V4IR::VarType;
+    IR::Type result = IR::VarType;
     QQmlTypeNameCache *typeNamespace = static_cast<QQmlTypeNameCache*>(resolver->extraData);
     void *importNamespace = resolver->data;
 
@@ -1532,14 +1533,14 @@ static V4IR::Type resolveImportNamespace(QQmlEnginePrivate *, V4IR::MemberExpres
         member->freeOfSideEffects = true;
         if (r.scriptIndex != -1) {
             // TODO: remember the index and replace with subscript later.
-            result = V4IR::VarType;
+            result = IR::VarType;
         } else if (r.type) {
             // TODO: Propagate singleton information, so that it is loaded
             // through the singleton getter in the run-time. Until then we
             // can't accelerate access :(
             if (!r.type->isSingleton()) {
                 initQmlTypeResolver(resolver, r.type);
-                return V4IR::QObjectType;
+                return IR::QObjectType;
             }
         } else {
             Q_ASSERT(false); // How can this happen?
@@ -1550,7 +1551,7 @@ static V4IR::Type resolveImportNamespace(QQmlEnginePrivate *, V4IR::MemberExpres
     return result;
 }
 
-static void initImportNamespaceResolver(V4IR::MemberExpressionResolver *resolver, QQmlTypeNameCache *imports, const void *importNamespace)
+static void initImportNamespaceResolver(IR::MemberExpressionResolver *resolver, QQmlTypeNameCache *imports, const void *importNamespace)
 {
     resolver->resolveMember = &resolveImportNamespace;
     resolver->data = const_cast<void*>(importNamespace);
@@ -1558,9 +1559,9 @@ static void initImportNamespaceResolver(V4IR::MemberExpressionResolver *resolver
     resolver->flags = 0;
 }
 
-static V4IR::Type resolveMetaObjectProperty(QQmlEnginePrivate *qmlEngine, V4IR::MemberExpressionResolver *resolver, V4IR::Member *member)
+static IR::Type resolveMetaObjectProperty(QQmlEnginePrivate *qmlEngine, IR::MemberExpressionResolver *resolver, IR::Member *member)
 {
-    V4IR::Type result = V4IR::VarType;
+    IR::Type result = IR::VarType;
     QQmlPropertyCache *metaObject = static_cast<QQmlPropertyCache*>(resolver->data);
 
     if (member->name->constData()->isUpper() && (resolver->flags & LookupsIncludeEnums)) {
@@ -1573,7 +1574,7 @@ static V4IR::Type resolveMetaObjectProperty(QQmlEnginePrivate *qmlEngine, V4IR::
             if (ok) {
                 member->setEnumValue(value);
                 resolver->clear();
-                return V4IR::SInt32Type;
+                return IR::SInt32Type;
             }
         }
     }
@@ -1606,24 +1607,24 @@ static V4IR::Type resolveMetaObjectProperty(QQmlEnginePrivate *qmlEngine, V4IR::
             // Enums cannot be mapped to IR types, they need to go through the run-time handling
             // of accepting strings that will then be converted to the right values.
             if (property->isEnum())
-                return V4IR::VarType;
+                return IR::VarType;
 
             switch (property->propType) {
-            case QMetaType::Bool: result = V4IR::BoolType; break;
-            case QMetaType::Int: result = V4IR::SInt32Type; break;
-            case QMetaType::Double: result = V4IR::DoubleType; break;
-            case QMetaType::QString: result = V4IR::StringType; break;
+            case QMetaType::Bool: result = IR::BoolType; break;
+            case QMetaType::Int: result = IR::SInt32Type; break;
+            case QMetaType::Double: result = IR::DoubleType; break;
+            case QMetaType::QString: result = IR::StringType; break;
             default:
                 if (property->isQObject()) {
                     if (QQmlPropertyCache *cache = qmlEngine->propertyCacheForType(property->propType)) {
                         initMetaObjectResolver(resolver, cache);
-                        return V4IR::QObjectType;
+                        return IR::QObjectType;
                     }
                 } else if (QQmlValueType *valueType = QQmlValueTypeFactory::valueType(property->propType)) {
                     if (QQmlPropertyCache *cache = qmlEngine->cache(valueType->metaObject())) {
                         initMetaObjectResolver(resolver, cache);
                         resolver->flags |= ResolveTypeInformationOnly;
-                        return V4IR::QObjectType;
+                        return IR::QObjectType;
                     }
                 }
                 break;
@@ -1634,7 +1635,7 @@ static V4IR::Type resolveMetaObjectProperty(QQmlEnginePrivate *qmlEngine, V4IR::
     return result;
 }
 
-static void initMetaObjectResolver(V4IR::MemberExpressionResolver *resolver, QQmlPropertyCache *metaObject)
+static void initMetaObjectResolver(IR::MemberExpressionResolver *resolver, QQmlPropertyCache *metaObject)
 {
     resolver->resolveMember = &resolveMetaObjectProperty;
     resolver->data = metaObject;
@@ -1649,19 +1650,19 @@ void JSCodeGen::beginFunctionBodyHook()
     _importedScriptsTemp = _block->newTemp();
     _idArrayTemp = _block->newTemp();
 
-    V4IR::Temp *temp = _block->TEMP(_contextObjectTemp);
+    IR::Temp *temp = _block->TEMP(_contextObjectTemp);
     initMetaObjectResolver(&temp->memberResolver, _contextObject);
-    move(temp, _block->NAME(V4IR::Name::builtin_qml_context_object, 0, 0));
+    move(temp, _block->NAME(IR::Name::builtin_qml_context_object, 0, 0));
 
     temp = _block->TEMP(_scopeObjectTemp);
     initMetaObjectResolver(&temp->memberResolver, _scopeObject);
-    move(temp, _block->NAME(V4IR::Name::builtin_qml_scope_object, 0, 0));
+    move(temp, _block->NAME(IR::Name::builtin_qml_scope_object, 0, 0));
 
-    move(_block->TEMP(_importedScriptsTemp), _block->NAME(V4IR::Name::builtin_qml_imported_scripts_object, 0, 0));
-    move(_block->TEMP(_idArrayTemp), _block->NAME(V4IR::Name::builtin_qml_id_array, 0, 0));
+    move(_block->TEMP(_importedScriptsTemp), _block->NAME(IR::Name::builtin_qml_imported_scripts_object, 0, 0));
+    move(_block->TEMP(_idArrayTemp), _block->NAME(IR::Name::builtin_qml_id_array, 0, 0));
 }
 
-V4IR::Expr *JSCodeGen::fallbackNameLookup(const QString &name, int line, int col)
+IR::Expr *JSCodeGen::fallbackNameLookup(const QString &name, int line, int col)
 {
     if (_disableAcceleratedLookups)
         return 0;
@@ -1683,8 +1684,8 @@ V4IR::Expr *JSCodeGen::fallbackNameLookup(const QString &name, int line, int col
     foreach (const IdMapping &mapping, _idObjects)
         if (name == mapping.name) {
             _function->idObjectDependencies.insert(mapping.idIndex);
-            V4IR::Expr *s = subscript(_block->TEMP(_idArrayTemp), _block->CONST(V4IR::SInt32Type, mapping.idIndex));
-            V4IR::Temp *result = _block->TEMP(_block->newTemp());
+            IR::Expr *s = subscript(_block->TEMP(_idArrayTemp), _block->CONST(IR::SInt32Type, mapping.idIndex));
+            IR::Temp *result = _block->TEMP(_block->newTemp());
             _block->MOVE(result, s);
             result = _block->TEMP(result->index);
             if (mapping.type) {
@@ -1699,13 +1700,13 @@ V4IR::Expr *JSCodeGen::fallbackNameLookup(const QString &name, int line, int col
         QQmlTypeNameCache::Result r = imports->query(name);
         if (r.isValid()) {
             if (r.scriptIndex != -1) {
-                return subscript(_block->TEMP(_importedScriptsTemp), _block->CONST(V4IR::SInt32Type, r.scriptIndex));
+                return subscript(_block->TEMP(_importedScriptsTemp), _block->CONST(IR::SInt32Type, r.scriptIndex));
             } else if (r.type) {
-                V4IR::Name *typeName = _block->NAME(name, line, col);
+                IR::Name *typeName = _block->NAME(name, line, col);
                 // Make sure the run-time loads this through the more efficient singleton getter.
                 typeName->qmlSingleton = r.type->isCompositeSingleton();
                 typeName->freeOfSideEffects = true;
-                V4IR::Temp *result = _block->TEMP(_block->newTemp());
+                IR::Temp *result = _block->TEMP(_block->newTemp());
                 _block->MOVE(result, typeName);
 
                 result = _block->TEMP(result->index);
@@ -1713,9 +1714,9 @@ V4IR::Expr *JSCodeGen::fallbackNameLookup(const QString &name, int line, int col
                 return result;
             } else {
                 Q_ASSERT(r.importNamespace);
-                V4IR::Name *namespaceName = _block->NAME(name, line, col);
+                IR::Name *namespaceName = _block->NAME(name, line, col);
                 namespaceName->freeOfSideEffects = true;
-                V4IR::Temp *result = _block->TEMP(_block->newTemp());
+                IR::Temp *result = _block->TEMP(_block->newTemp());
                 initImportNamespaceResolver(&result->memberResolver, imports, r.importNamespace);
 
                 _block->MOVE(result, namespaceName);
@@ -1730,9 +1731,9 @@ V4IR::Expr *JSCodeGen::fallbackNameLookup(const QString &name, int line, int col
         if (propertyExistsButForceNameLookup)
             return 0;
         if (pd) {
-            V4IR::Temp *base = _block->TEMP(_scopeObjectTemp);
+            IR::Temp *base = _block->TEMP(_scopeObjectTemp);
             initMetaObjectResolver(&base->memberResolver, _scopeObject);
-            return _block->MEMBER(base, _function->newString(name), pd, V4IR::Member::MemberOfQmlScopeObject);
+            return _block->MEMBER(base, _function->newString(name), pd, IR::Member::MemberOfQmlScopeObject);
         }
     }
 
@@ -1742,9 +1743,9 @@ V4IR::Expr *JSCodeGen::fallbackNameLookup(const QString &name, int line, int col
         if (propertyExistsButForceNameLookup)
             return 0;
         if (pd) {
-            V4IR::Temp *base = _block->TEMP(_contextObjectTemp);
+            IR::Temp *base = _block->TEMP(_contextObjectTemp);
             initMetaObjectResolver(&base->memberResolver, _contextObject);
-            return _block->MEMBER(base, _function->newString(name), pd, V4IR::Member::MemberOfQmlContextObject);
+            return _block->MEMBER(base, _function->newString(name), pd, IR::Member::MemberOfQmlContextObject);
         }
     }
 
@@ -1903,27 +1904,27 @@ bool SignalHandlerConverter::convertSignalHandlerExpressionsToFunctionDeclaratio
         QQmlJS::Engine &jsEngine = parsedQML->jsParserEngine;
         QQmlJS::MemoryPool *pool = jsEngine.pool();
 
-        AST::FormalParameterList *paramList = 0;
+        QQmlJS::AST::FormalParameterList *paramList = 0;
         foreach (const QString &param, parameters) {
             QStringRef paramNameRef = jsEngine.newStringRef(param);
 
             if (paramList)
-                paramList = new (pool) AST::FormalParameterList(paramList, paramNameRef);
+                paramList = new (pool) QQmlJS::AST::FormalParameterList(paramList, paramNameRef);
             else
-                paramList = new (pool) AST::FormalParameterList(paramNameRef);
+                paramList = new (pool) QQmlJS::AST::FormalParameterList(paramNameRef);
         }
 
         if (paramList)
             paramList = paramList->finish();
 
-        AST::Statement *statement = static_cast<AST::Statement*>(parsedQML->functions[binding->value.compiledScriptIndex].node);
-        AST::SourceElement *sourceElement = new (pool) AST::StatementSourceElement(statement);
-        AST::SourceElements *elements = new (pool) AST::SourceElements(sourceElement);
+        QQmlJS::AST::Statement *statement = static_cast<QQmlJS::AST::Statement*>(parsedQML->functions[binding->value.compiledScriptIndex].node);
+        QQmlJS::AST::SourceElement *sourceElement = new (pool) QQmlJS::AST::StatementSourceElement(statement);
+        QQmlJS::AST::SourceElements *elements = new (pool) QQmlJS::AST::SourceElements(sourceElement);
         elements = elements->finish();
 
-        AST::FunctionBody *body = new (pool) AST::FunctionBody(elements);
+        QQmlJS::AST::FunctionBody *body = new (pool) QQmlJS::AST::FunctionBody(elements);
 
-        AST::FunctionDeclaration *functionDeclaration = new (pool) AST::FunctionDeclaration(jsEngine.newStringRef(propertyName), paramList, body);
+        QQmlJS::AST::FunctionDeclaration *functionDeclaration = new (pool) QQmlJS::AST::FunctionDeclaration(jsEngine.newStringRef(propertyName), paramList, body);
 
         parsedQML->functions[binding->value.compiledScriptIndex] = functionDeclaration;
         binding->flags |= QV4::CompiledData::Binding::IsSignalHandlerExpression;
index 7c09b8bfa21d8e507a04d18c3f0c4d2850474fd9..d895dbaf332fc3b158c23b865ad52bcbb6d69e5a 100644 (file)
@@ -59,7 +59,7 @@ class QQmlTypeNameCache;
 
 namespace QtQml {
 
-using namespace QQmlJS;
+using namespace QV4;
 
 struct DebugStream
 {
@@ -169,7 +169,7 @@ struct Binding : public QV4::CompiledData::Binding
 
 struct Function
 {
-    AST::FunctionDeclaration *functionDeclaration;
+    QQmlJS::AST::FunctionDeclaration *functionDeclaration;
     QV4::CompiledData::Location location;
     int nameIndex;
     int index; // index in parsedQML::functions
@@ -182,11 +182,11 @@ struct CompiledFunctionOrExpression
         : node(0)
         , disableAcceleratedLookups(false)
     {}
-    CompiledFunctionOrExpression(AST::Node *n)
+    CompiledFunctionOrExpression(QQmlJS::AST::Node *n)
         : node(n)
         , disableAcceleratedLookups(false)
     {}
-    AST::Node *node; // FunctionDeclaration, Statement or Expression
+    QQmlJS::AST::Node *node; // FunctionDeclaration, Statement or Expression
     QString name;
     bool disableAcceleratedLookups;
 };
@@ -215,15 +215,15 @@ public:
     // specified object. Used for declarations inside group properties.
     QmlObject *declarationsOverride;
 
-    void init(QQmlJS::MemoryPool *pool, int typeNameIndex, int id, const AST::SourceLocation &location = AST::SourceLocation());
+    void init(QQmlJS::MemoryPool *pool, int typeNameIndex, int id, const QQmlJS::AST::SourceLocation &location = QQmlJS::AST::SourceLocation());
 
     void dump(DebugStream &out);
 
-    QString sanityCheckFunctionNames(const QList<CompiledFunctionOrExpression> &allFunctions, const QSet<QString> &illegalNames, AST::SourceLocation *errorLocation);
+    QString sanityCheckFunctionNames(const QList<CompiledFunctionOrExpression> &allFunctions, const QSet<QString> &illegalNames, QQmlJS::AST::SourceLocation *errorLocation);
 
     QString appendSignal(Signal *signal);
-    QString appendProperty(QmlProperty *prop, const QString &propertyName, bool isDefaultProperty, const AST::SourceLocation &defaultToken, AST::SourceLocation *errorLocation);
-    void appendFunction(Function *f);
+    QString appendProperty(QmlProperty *prop, const QString &propertyName, bool isDefaultProperty, const QQmlJS::AST::SourceLocation &defaultToken, QQmlJS::AST::SourceLocation *errorLocation);
+    void appendFunction(QtQml::Function *f);
 
     QString appendBinding(Binding *b, bool isListBinding);
 
@@ -256,10 +256,10 @@ struct ParsedQML
     {}
     QString code;
     QQmlJS::Engine jsParserEngine;
-    V4IR::Module jsModule;
+    QV4::IR::Module jsModule;
     QList<QV4::CompiledData::Import*> imports;
     QList<Pragma*> pragmas;
-    AST::UiProgram *program;
+    QQmlJS::AST::UiProgram *program;
     int indexOfRootObject;
     QList<QmlObject*> objects;
     QList<CompiledFunctionOrExpression> functions;
@@ -271,7 +271,7 @@ struct ParsedQML
 };
 
 // Doesn't really generate code per-se, but more the data structure
-struct Q_QML_EXPORT QQmlCodeGenerator : public AST::Visitor
+struct Q_QML_EXPORT QQmlCodeGenerator : public QQmlJS::AST::Visitor
 {
     Q_DECLARE_TR_FUNCTIONS(QQmlCodeGenerator)
 public:
@@ -280,71 +280,71 @@ public:
 
     static bool isSignalPropertyName(const QString &name);
 
-    using AST::Visitor::visit;
-    using AST::Visitor::endVisit;
-
-    virtual bool visit(AST::UiArrayMemberList *ast);
-    virtual bool visit(AST::UiImport *ast);
-    virtual bool visit(AST::UiPragma *ast);
-    virtual bool visit(AST::UiHeaderItemList *ast);
-    virtual bool visit(AST::UiObjectInitializer *ast);
-    virtual bool visit(AST::UiObjectMemberList *ast);
-    virtual bool visit(AST::UiParameterList *ast);
-    virtual bool visit(AST::UiProgram *);
-    virtual bool visit(AST::UiQualifiedId *ast);
-    virtual bool visit(AST::UiArrayBinding *ast);
-    virtual bool visit(AST::UiObjectBinding *ast);
-    virtual bool visit(AST::UiObjectDefinition *ast);
-    virtual bool visit(AST::UiPublicMember *ast);
-    virtual bool visit(AST::UiScriptBinding *ast);
-    virtual bool visit(AST::UiSourceElement *ast);
-
-    void accept(AST::Node *node);
+    using QQmlJS::AST::Visitor::visit;
+    using QQmlJS::AST::Visitor::endVisit;
+
+    virtual bool visit(QQmlJS::AST::UiArrayMemberList *ast);
+    virtual bool visit(QQmlJS::AST::UiImport *ast);
+    virtual bool visit(QQmlJS::AST::UiPragma *ast);
+    virtual bool visit(QQmlJS::AST::UiHeaderItemList *ast);
+    virtual bool visit(QQmlJS::AST::UiObjectInitializer *ast);
+    virtual bool visit(QQmlJS::AST::UiObjectMemberList *ast);
+    virtual bool visit(QQmlJS::AST::UiParameterList *ast);
+    virtual bool visit(QQmlJS::AST::UiProgram *);
+    virtual bool visit(QQmlJS::AST::UiQualifiedId *ast);
+    virtual bool visit(QQmlJS::AST::UiArrayBinding *ast);
+    virtual bool visit(QQmlJS::AST::UiObjectBinding *ast);
+    virtual bool visit(QQmlJS::AST::UiObjectDefinition *ast);
+    virtual bool visit(QQmlJS::AST::UiPublicMember *ast);
+    virtual bool visit(QQmlJS::AST::UiScriptBinding *ast);
+    virtual bool visit(QQmlJS::AST::UiSourceElement *ast);
+
+    void accept(QQmlJS::AST::Node *node);
 
     // returns index in _objects
-    int defineQMLObject(AST::UiQualifiedId *qualifiedTypeNameId, const AST::SourceLocation &location, AST::UiObjectInitializer *initializer, QmlObject *declarationsOverride = 0);
-    int defineQMLObject(AST::UiObjectDefinition *node, QmlObject *declarationsOverride = 0)
+    int defineQMLObject(QQmlJS::AST::UiQualifiedId *qualifiedTypeNameId, const QQmlJS::AST::SourceLocation &location, QQmlJS::AST::UiObjectInitializer *initializer, QmlObject *declarationsOverride = 0);
+    int defineQMLObject(QQmlJS::AST::UiObjectDefinition *node, QmlObject *declarationsOverride = 0)
     { return defineQMLObject(node->qualifiedTypeNameId, node->qualifiedTypeNameId->firstSourceLocation(), node->initializer, declarationsOverride); }
 
-    static QString asString(AST::UiQualifiedId *node);
-    QStringRef asStringRef(AST::Node *node);
+    static QString asString(QQmlJS::AST::UiQualifiedId *node);
+    QStringRef asStringRef(QQmlJS::AST::Node *node);
     static void extractVersion(QStringRef string, int *maj, int *min);
-    QStringRef textRefAt(const AST::SourceLocation &loc) const
+    QStringRef textRefAt(const QQmlJS::AST::SourceLocation &loc) const
     { return QStringRef(&sourceCode, loc.offset, loc.length); }
-    QStringRef textRefAt(const AST::SourceLocation &first,
-                         const AST::SourceLocation &last) const;
-    static QQmlScript::LocationSpan location(AST::UiQualifiedId *id)
+    QStringRef textRefAt(const QQmlJS::AST::SourceLocation &first,
+                         const QQmlJS::AST::SourceLocation &last) const;
+    static QQmlScript::LocationSpan location(QQmlJS::AST::UiQualifiedId *id)
     {
         return location(id->identifierToken, id->identifierToken);
     }
 
-    void setBindingValue(QV4::CompiledData::Binding *binding, AST::Statement *statement);
+    void setBindingValue(QV4::CompiledData::Binding *binding, QQmlJS::AST::Statement *statement);
 
-    void appendBinding(AST::UiQualifiedId *name, AST::Statement *value);
-    void appendBinding(AST::UiQualifiedId *name, int objectIndex, bool isOnAssignment = false);
-    void appendBinding(const AST::SourceLocation &nameLocation, quint32 propertyNameIndex, AST::Statement *value);
-    void appendBinding(const AST::SourceLocation &nameLocation, quint32 propertyNameIndex, int objectIndex, bool isListItem = false, bool isOnAssignment = false);
+    void appendBinding(QQmlJS::AST::UiQualifiedId *name, QQmlJS::AST::Statement *value);
+    void appendBinding(QQmlJS::AST::UiQualifiedId *name, int objectIndex, bool isOnAssignment = false);
+    void appendBinding(const QQmlJS::AST::SourceLocation &nameLocation, quint32 propertyNameIndex, QQmlJS::AST::Statement *value);
+    void appendBinding(const QQmlJS::AST::SourceLocation &nameLocation, quint32 propertyNameIndex, int objectIndex, bool isListItem = false, bool isOnAssignment = false);
 
     QmlObject *bindingsTarget() const;
 
-    bool setId(const AST::SourceLocation &idLocation, AST::Statement *value);
+    bool setId(const QQmlJS::AST::SourceLocation &idLocation, QQmlJS::AST::Statement *value);
 
     // resolves qualified name (font.pixelSize for example) and returns the last name along
     // with the object any right-hand-side of a binding should apply to.
-    bool resolveQualifiedId(AST::UiQualifiedId **nameToResolve, QmlObject **object);
+    bool resolveQualifiedId(QQmlJS::AST::UiQualifiedId **nameToResolve, QmlObject **object);
 
-    void recordError(const AST::SourceLocation &location, const QString &description);
+    void recordError(const QQmlJS::AST::SourceLocation &location, const QString &description);
 
     void collectTypeReferences();
 
-    static QQmlScript::LocationSpan location(AST::SourceLocation start, AST::SourceLocation end);
+    static QQmlScript::LocationSpan location(QQmlJS::AST::SourceLocation start, QQmlJS::AST::SourceLocation end);
 
     quint32 registerString(const QString &str) const { return jsGenerator->registerString(str); }
     template <typename _Tp> _Tp *New() { return pool->New<_Tp>(); }
 
     QString stringAt(int index) const { return jsGenerator->strings.at(index); }
 
-    static bool isStatementNodeScript(AST::Statement *statement);
+    static bool isStatementNodeScript(QQmlJS::AST::Statement *statement);
 
     QList<QQmlError> errors;
 
@@ -432,8 +432,8 @@ private:
 
 struct Q_QML_EXPORT JSCodeGen : public QQmlJS::Codegen
 {
-    JSCodeGen(const QString &fileName, const QString &sourceCode, V4IR::Module *jsModule,
-              QQmlJS::Engine *jsEngine, AST::UiProgram *qmlRoot, QQmlTypeNameCache *imports);
+    JSCodeGen(const QString &fileName, const QString &sourceCode, IR::Module *jsModule,
+              QQmlJS::Engine *jsEngine, QQmlJS::AST::UiProgram *qmlRoot, QQmlTypeNameCache *imports);
 
     struct IdMapping
     {
@@ -446,19 +446,19 @@ struct Q_QML_EXPORT JSCodeGen : public QQmlJS::Codegen
     void beginContextScope(const ObjectIdMapping &objectIds, QQmlPropertyCache *contextObject);
     void beginObjectScope(QQmlPropertyCache *scopeObject);
 
-    // Returns mapping from input functions to index in V4IR::Module::functions / compiledData->runtimeFunctions
+    // Returns mapping from input functions to index in IR::Module::functions / compiledData->runtimeFunctions
     QVector<int> generateJSCodeForFunctionsAndBindings(const QList<CompiledFunctionOrExpression> &functions);
 
 protected:
     virtual void beginFunctionBodyHook();
-    virtual V4IR::Expr *fallbackNameLookup(const QString &name, int line, int col);
+    virtual IR::Expr *fallbackNameLookup(const QString &name, int line, int col);
 
 private:
     QQmlPropertyData *lookupQmlCompliantProperty(QQmlPropertyCache *cache, const QString &name, bool *propertyExistsButForceNameLookup = 0);
 
     QString sourceCode;
     QQmlJS::Engine *jsEngine; // needed for memory pool
-    AST::UiProgram *qmlRoot;
+    QQmlJS::AST::UiProgram *qmlRoot;
     QQmlTypeNameCache *imports;
 
     bool _disableAcceleratedLookups;
index 090b4c06cbe7b9edd61051d75d7226801659b52b..868c80b47f13e257e432617af4f5340bb645e8d8 100644 (file)
@@ -203,7 +203,7 @@ bool QQmlTypeCompiler::compile()
 
     QV4::ExecutionEngine *v4 = engine->v4engine();
 
-    QScopedPointer<QQmlJS::EvalInstructionSelection> isel(v4->iselFactory->create(engine, v4->executableAllocator, &parsedQML->jsModule, &parsedQML->jsGenerator));
+    QScopedPointer<EvalInstructionSelection> isel(v4->iselFactory->create(engine, v4->executableAllocator, &parsedQML->jsModule, &parsedQML->jsGenerator));
     isel->setUseFastLookups(false);
     QV4::CompiledData::CompilationUnit *jsUnit = isel->compile(/*generated unit data*/false);
 
@@ -350,7 +350,7 @@ QHash<int, QByteArray> *QQmlTypeCompiler::customParserData()
     return &compiledData->customParserData;
 }
 
-MemoryPool *QQmlTypeCompiler::memoryPool()
+QQmlJS::MemoryPool *QQmlTypeCompiler::memoryPool()
 {
     return parsedQML->jsParserEngine.pool();
 }
@@ -688,7 +688,7 @@ bool QQmlPropertyCacheCreator::createMetaObject(int objectIndex, const QtQml::Qm
 
     // Dynamic slots
     for (const QtQml::Function *s = obj->firstFunction(); s; s = s->next) {
-        AST::FunctionDeclaration *astFunction = s->functionDeclaration;
+        QQmlJS::AST::FunctionDeclaration *astFunction = s->functionDeclaration;
 
         quint32 flags = QQmlPropertyData::IsFunction | QQmlPropertyData::IsVMEFunction;
 
@@ -702,7 +702,7 @@ bool QQmlPropertyCacheCreator::createMetaObject(int objectIndex, const QtQml::Qm
         // protect against overriding change signals or methods with properties.
 
         QList<QByteArray> parameterNames;
-        AST::FormalParameterList *param = astFunction->formals;
+        QQmlJS::AST::FormalParameterList *param = astFunction->formals;
         while (param) {
             parameterNames << param->name.toUtf8();
             param = param->next;
@@ -818,9 +818,9 @@ bool QQmlPropertyCacheCreator::createMetaObject(int objectIndex, const QtQml::Qm
 
     // Dynamic slot data - comes after the property data
     for (const QtQml::Function *s = obj->firstFunction(); s; s = s->next) {
-        AST::FunctionDeclaration *astFunction = s->functionDeclaration;
+        QQmlJS::AST::FunctionDeclaration *astFunction = s->functionDeclaration;
         int formalsCount = 0;
-        AST::FormalParameterList *param = astFunction->formals;
+        QQmlJS::AST::FormalParameterList *param = astFunction->formals;
         while (param) {
             formalsCount++;
             param = param->next;
@@ -1392,7 +1392,7 @@ const QQmlImports &QQmlPropertyValidator::imports() const
     return *compiler->imports();
 }
 
-AST::Node *QQmlPropertyValidator::astForBinding(int scriptIndex) const
+QQmlJS::AST::Node *QQmlPropertyValidator::astForBinding(int scriptIndex) const
 {
     // ####
     int reverseIndex = runtimeFunctionIndices.indexOf(scriptIndex);
index a920f1b41925652f23904e5238a7cdc8a86e018c..6685336b5f95ad294d4c9188c81fbef11f0a64a3 100644 (file)
@@ -60,6 +60,7 @@
 #undef CONST
 #endif
 
+using namespace QV4;
 using namespace QQmlJS;
 using namespace AST;
 
@@ -426,7 +427,7 @@ Codegen::Codegen(bool strict)
 void Codegen::generateFromProgram(const QString &fileName,
                                   const QString &sourceCode,
                                   Program *node,
-                                  V4IR::Module *module,
+                                  QV4::IR::Module *module,
                                   CompilationMode mode,
                                   const QStringList &inheritedLocals)
 {
@@ -448,7 +449,7 @@ void Codegen::generateFromProgram(const QString &fileName,
 void Codegen::generateFromFunctionExpression(const QString &fileName,
                                              const QString &sourceCode,
                                              AST::FunctionExpression *ast,
-                                             V4IR::Module *module)
+                                             QV4::IR::Module *module)
 {
     _module = module;
     _module->setFileName(fileName);
@@ -479,7 +480,7 @@ void Codegen::leaveEnvironment()
     _env = _env->parent;
 }
 
-void Codegen::enterLoop(Statement *node, V4IR::BasicBlock *startBlock, V4IR::BasicBlock *breakBlock, V4IR::BasicBlock *continueBlock)
+void Codegen::enterLoop(Statement *node, IR::BasicBlock *startBlock, IR::BasicBlock *breakBlock, IR::BasicBlock *continueBlock)
 {
     if (startBlock)
         startBlock->markAsGroupStart();
@@ -496,7 +497,7 @@ void Codegen::leaveLoop()
     delete current;
 }
 
-V4IR::Expr *Codegen::member(V4IR::Expr *base, const QString *name)
+IR::Expr *Codegen::member(IR::Expr *base, const QString *name)
 {
     if (hasError)
         return 0;
@@ -510,7 +511,7 @@ V4IR::Expr *Codegen::member(V4IR::Expr *base, const QString *name)
     }
 }
 
-V4IR::Expr *Codegen::subscript(V4IR::Expr *base, V4IR::Expr *index)
+IR::Expr *Codegen::subscript(IR::Expr *base, IR::Expr *index)
 {
     if (hasError)
         return 0;
@@ -531,7 +532,7 @@ V4IR::Expr *Codegen::subscript(V4IR::Expr *base, V4IR::Expr *index)
     return _block->SUBSCRIPT(base->asTemp(), index->asTemp());
 }
 
-V4IR::Expr *Codegen::argument(V4IR::Expr *expr)
+IR::Expr *Codegen::argument(IR::Expr *expr)
 {
     if (expr && ! expr->asTemp()) {
         const unsigned t = _block->newTemp();
@@ -542,7 +543,7 @@ V4IR::Expr *Codegen::argument(V4IR::Expr *expr)
 }
 
 // keeps references alive, converts other expressions to temps
-V4IR::Expr *Codegen::reference(V4IR::Expr *expr)
+IR::Expr *Codegen::reference(IR::Expr *expr)
 {
     if (hasError)
         return 0;
@@ -555,29 +556,29 @@ V4IR::Expr *Codegen::reference(V4IR::Expr *expr)
     return expr;
 }
 
-V4IR::Expr *Codegen::unop(V4IR::AluOp op, V4IR::Expr *expr)
+IR::Expr *Codegen::unop(IR::AluOp op, IR::Expr *expr)
 {
     if (hasError)
         return 0;
 
-    Q_ASSERT(op != V4IR::OpIncrement);
-    Q_ASSERT(op != V4IR::OpDecrement);
+    Q_ASSERT(op != IR::OpIncrement);
+    Q_ASSERT(op != IR::OpDecrement);
 
-    if (V4IR::Const *c = expr->asConst()) {
-        if (c->type == V4IR::NumberType) {
+    if (IR::Const *c = expr->asConst()) {
+        if (c->type == IR::NumberType) {
             switch (op) {
-            case V4IR::OpNot:
-                return _block->CONST(V4IR::BoolType, !c->value);
-            case V4IR::OpUMinus:
-                return _block->CONST(V4IR::NumberType, -c->value);
-            case V4IR::OpUPlus:
+            case IR::OpNot:
+                return _block->CONST(IR::BoolType, !c->value);
+            case IR::OpUMinus:
+                return _block->CONST(IR::NumberType, -c->value);
+            case IR::OpUPlus:
                 return expr;
-            case V4IR::OpCompl:
-                return _block->CONST(V4IR::NumberType, ~QV4::Primitive::toInt32(c->value));
-            case V4IR::OpIncrement:
-                return _block->CONST(V4IR::NumberType, c->value + 1);
-            case V4IR::OpDecrement:
-                return _block->CONST(V4IR::NumberType, c->value - 1);
+            case IR::OpCompl:
+                return _block->CONST(IR::NumberType, ~QV4::Primitive::toInt32(c->value));
+            case IR::OpIncrement:
+                return _block->CONST(IR::NumberType, c->value + 1);
+            case IR::OpDecrement:
+                return _block->CONST(IR::NumberType, c->value - 1);
             default:
                 break;
             }
@@ -592,56 +593,56 @@ V4IR::Expr *Codegen::unop(V4IR::AluOp op, V4IR::Expr *expr)
     return _block->UNOP(op, expr->asTemp());
 }
 
-V4IR::Expr *Codegen::binop(V4IR::AluOp op, V4IR::Expr *left, V4IR::Expr *right)
+IR::Expr *Codegen::binop(IR::AluOp op, IR::Expr *left, IR::Expr *right)
 {
     if (hasError)
         return 0;
 
-    if (V4IR::Const *c1 = left->asConst()) {
-        if (V4IR::Const *c2 = right->asConst()) {
-            if (c1->type == V4IR::NumberType && c2->type == V4IR::NumberType) {
+    if (IR::Const *c1 = left->asConst()) {
+        if (IR::Const *c2 = right->asConst()) {
+            if (c1->type == IR::NumberType && c2->type == IR::NumberType) {
                 switch (op) {
-                case V4IR::OpAdd: return _block->CONST(V4IR::NumberType, c1->value + c2->value);
-                case V4IR::OpAnd: return _block->CONST(V4IR::BoolType, c1->value ? c2->value : 0);
-                case V4IR::OpBitAnd: return _block->CONST(V4IR::NumberType, int(c1->value) & int(c2->value));
-                case V4IR::OpBitOr: return _block->CONST(V4IR::NumberType, int(c1->value) | int(c2->value));
-                case V4IR::OpBitXor: return _block->CONST(V4IR::NumberType, int(c1->value) ^ int(c2->value));
-                case V4IR::OpDiv: return _block->CONST(V4IR::NumberType, c1->value / c2->value);
-                case V4IR::OpEqual: return _block->CONST(V4IR::BoolType, c1->value == c2->value);
-                case V4IR::OpNotEqual: return _block->CONST(V4IR::BoolType, c1->value != c2->value);
-                case V4IR::OpStrictEqual: return _block->CONST(V4IR::BoolType, c1->value == c2->value);
-                case V4IR::OpStrictNotEqual: return _block->CONST(V4IR::BoolType, c1->value != c2->value);
-                case V4IR::OpGe: return _block->CONST(V4IR::BoolType, c1->value >= c2->value);
-                case V4IR::OpGt: return _block->CONST(V4IR::BoolType, c1->value > c2->value);
-                case V4IR::OpLe: return _block->CONST(V4IR::BoolType, c1->value <= c2->value);
-                case V4IR::OpLt: return _block->CONST(V4IR::BoolType, c1->value < c2->value);
-                case V4IR::OpLShift: return _block->CONST(V4IR::NumberType, QV4::Primitive::toInt32(c1->value) << (QV4::Primitive::toUInt32(c2->value) & 0x1f));
-                case V4IR::OpMod: return _block->CONST(V4IR::NumberType, std::fmod(c1->value, c2->value));
-                case V4IR::OpMul: return _block->CONST(V4IR::NumberType, c1->value * c2->value);
-                case V4IR::OpOr: return _block->CONST(V4IR::NumberType, c1->value ? c1->value : c2->value);
-                case V4IR::OpRShift: return _block->CONST(V4IR::NumberType, QV4::Primitive::toInt32(c1->value) >> (QV4::Primitive::toUInt32(c2->value) & 0x1f));
-                case V4IR::OpSub: return _block->CONST(V4IR::NumberType, c1->value - c2->value);
-                case V4IR::OpURShift: return _block->CONST(V4IR::NumberType,QV4::Primitive::toUInt32(c1->value) >> (QV4::Primitive::toUInt32(c2->value) & 0x1f));
-
-                case V4IR::OpInstanceof:
-                case V4IR::OpIn:
+                case IR::OpAdd: return _block->CONST(IR::NumberType, c1->value + c2->value);
+                case IR::OpAnd: return _block->CONST(IR::BoolType, c1->value ? c2->value : 0);
+                case IR::OpBitAnd: return _block->CONST(IR::NumberType, int(c1->value) & int(c2->value));
+                case IR::OpBitOr: return _block->CONST(IR::NumberType, int(c1->value) | int(c2->value));
+                case IR::OpBitXor: return _block->CONST(IR::NumberType, int(c1->value) ^ int(c2->value));
+                case IR::OpDiv: return _block->CONST(IR::NumberType, c1->value / c2->value);
+                case IR::OpEqual: return _block->CONST(IR::BoolType, c1->value == c2->value);
+                case IR::OpNotEqual: return _block->CONST(IR::BoolType, c1->value != c2->value);
+                case IR::OpStrictEqual: return _block->CONST(IR::BoolType, c1->value == c2->value);
+                case IR::OpStrictNotEqual: return _block->CONST(IR::BoolType, c1->value != c2->value);
+                case IR::OpGe: return _block->CONST(IR::BoolType, c1->value >= c2->value);
+                case IR::OpGt: return _block->CONST(IR::BoolType, c1->value > c2->value);
+                case IR::OpLe: return _block->CONST(IR::BoolType, c1->value <= c2->value);
+                case IR::OpLt: return _block->CONST(IR::BoolType, c1->value < c2->value);
+                case IR::OpLShift: return _block->CONST(IR::NumberType, QV4::Primitive::toInt32(c1->value) << (QV4::Primitive::toUInt32(c2->value) & 0x1f));
+                case IR::OpMod: return _block->CONST(IR::NumberType, std::fmod(c1->value, c2->value));
+                case IR::OpMul: return _block->CONST(IR::NumberType, c1->value * c2->value);
+                case IR::OpOr: return _block->CONST(IR::NumberType, c1->value ? c1->value : c2->value);
+                case IR::OpRShift: return _block->CONST(IR::NumberType, QV4::Primitive::toInt32(c1->value) >> (QV4::Primitive::toUInt32(c2->value) & 0x1f));
+                case IR::OpSub: return _block->CONST(IR::NumberType, c1->value - c2->value);
+                case IR::OpURShift: return _block->CONST(IR::NumberType,QV4::Primitive::toUInt32(c1->value) >> (QV4::Primitive::toUInt32(c2->value) & 0x1f));
+
+                case IR::OpInstanceof:
+                case IR::OpIn:
                     break;
 
-                case V4IR::OpIfTrue: // unary ops
-                case V4IR::OpNot:
-                case V4IR::OpUMinus:
-                case V4IR::OpUPlus:
-                case V4IR::OpCompl:
-                case V4IR::OpIncrement:
-                case V4IR::OpDecrement:
-                case V4IR::OpInvalid:
+                case IR::OpIfTrue: // unary ops
+                case IR::OpNot:
+                case IR::OpUMinus:
+                case IR::OpUPlus:
+                case IR::OpCompl:
+                case IR::OpIncrement:
+                case IR::OpDecrement:
+                case IR::OpInvalid:
                     break;
                 }
             }
         }
-    } else if (op == V4IR::OpAdd) {
-        if (V4IR::String *s1 = left->asString()) {
-            if (V4IR::String *s2 = right->asString()) {
+    } else if (op == IR::OpAdd) {
+        if (IR::String *s1 = left->asString()) {
+            if (IR::String *s2 = right->asString()) {
                 return _block->STRING(_function->newString(*s1->value + *s2->value));
             }
         }
@@ -665,7 +666,7 @@ V4IR::Expr *Codegen::binop(V4IR::AluOp op, V4IR::Expr *left, V4IR::Expr *right)
     return _block->BINOP(op, left, right);
 }
 
-V4IR::Expr *Codegen::call(V4IR::Expr *base, V4IR::ExprList *args)
+IR::Expr *Codegen::call(IR::Expr *base, IR::ExprList *args)
 {
     if (hasError)
         return 0;
@@ -673,14 +674,14 @@ V4IR::Expr *Codegen::call(V4IR::Expr *base, V4IR::ExprList *args)
     return _block->CALL(base, args);
 }
 
-void Codegen::move(V4IR::Expr *target, V4IR::Expr *source, V4IR::AluOp op)
+void Codegen::move(IR::Expr *target, IR::Expr *source, IR::AluOp op)
 {
     if (hasError)
         return;
 
     Q_ASSERT(target->isLValue());
 
-    if (op != V4IR::OpInvalid) {
+    if (op != IR::OpInvalid) {
         move(target, binop(op, target, source));
         return;
     }
@@ -699,7 +700,7 @@ void Codegen::move(V4IR::Expr *target, V4IR::Expr *source, V4IR::AluOp op)
     _block->MOVE(target, source);
 }
 
-void Codegen::cjump(V4IR::Expr *cond, V4IR::BasicBlock *iftrue, V4IR::BasicBlock *iffalse)
+void Codegen::cjump(IR::Expr *cond, IR::BasicBlock *iftrue, IR::BasicBlock *iffalse)
 {
     if (hasError)
         return;
@@ -751,7 +752,7 @@ void Codegen::statement(ExpressionNode *ast)
     }
 }
 
-void Codegen::condition(ExpressionNode *ast, V4IR::BasicBlock *iftrue, V4IR::BasicBlock *iffalse)
+void Codegen::condition(ExpressionNode *ast, IR::BasicBlock *iftrue, IR::BasicBlock *iffalse)
 {
     if (ast) {
         Result r(iftrue, iffalse);
@@ -832,7 +833,7 @@ void Codegen::sourceElements(SourceElements *ast)
 
 void Codegen::variableDeclaration(VariableDeclaration *ast)
 {
-    V4IR::Expr *initializer = 0;
+    IR::Expr *initializer = 0;
     if (!ast->expression)
         return;
     Result expr = expression(ast->expression);
@@ -1044,22 +1045,22 @@ bool Codegen::visit(ArrayLiteral *ast)
     if (hasError)
         return false;
 
-    V4IR::ExprList *args = 0;
-    V4IR::ExprList *current = 0;
+    IR::ExprList *args = 0;
+    IR::ExprList *current = 0;
     for (ElementList *it = ast->elements; it; it = it->next) {
         for (Elision *elision = it->elision; elision; elision = elision->next) {
-            V4IR::ExprList *arg = _function->New<V4IR::ExprList>();
+            IR::ExprList *arg = _function->New<IR::ExprList>();
             if (!current) {
                 args = arg;
             } else {
                 current->next = arg;
             }
             current = arg;
-            current->expr = _block->CONST(V4IR::MissingType, 0);
+            current->expr = _block->CONST(IR::MissingType, 0);
         }
         Result expr = expression(it->expression);
 
-        V4IR::ExprList *arg = _function->New<V4IR::ExprList>();
+        IR::ExprList *arg = _function->New<IR::ExprList>();
         if (!current) {
             args = arg;
         } else {
@@ -1067,7 +1068,7 @@ bool Codegen::visit(ArrayLiteral *ast)
         }
         current = arg;
 
-        V4IR::Expr *exp = *expr;
+        IR::Expr *exp = *expr;
         if (exp->asTemp() || exp->asConst()) {
             current->expr = exp;
         } else {
@@ -1077,18 +1078,18 @@ bool Codegen::visit(ArrayLiteral *ast)
         }
     }
     for (Elision *elision = ast->elision; elision; elision = elision->next) {
-        V4IR::ExprList *arg = _function->New<V4IR::ExprList>();
+        IR::ExprList *arg = _function->New<IR::ExprList>();
         if (!current) {
             args = arg;
         } else {
             current->next = arg;
         }
         current = arg;
-        current->expr = _block->CONST(V4IR::MissingType, 0);
+        current->expr = _block->CONST(IR::MissingType, 0);
     }
 
     const unsigned t = _block->newTemp();
-    move(_block->TEMP(t), _block->CALL(_block->NAME(V4IR::Name::builtin_define_array, 0, 0), args));
+    move(_block->TEMP(t), _block->CALL(_block->NAME(IR::Name::builtin_define_array, 0, 0), args));
     _expr.code = _block->TEMP(t);
     return false;
 }
@@ -1104,21 +1105,21 @@ bool Codegen::visit(ArrayMemberExpression *ast)
     return false;
 }
 
-static V4IR::AluOp baseOp(int op)
+static IR::AluOp baseOp(int op)
 {
     switch ((QSOperator::Op) op) {
-    case QSOperator::InplaceAnd: return V4IR::OpBitAnd;
-    case QSOperator::InplaceSub: return V4IR::OpSub;
-    case QSOperator::InplaceDiv: return V4IR::OpDiv;
-    case QSOperator::InplaceAdd: return V4IR::OpAdd;
-    case QSOperator::InplaceLeftShift: return V4IR::OpLShift;
-    case QSOperator::InplaceMod: return V4IR::OpMod;
-    case QSOperator::InplaceMul: return V4IR::OpMul;
-    case QSOperator::InplaceOr: return V4IR::OpBitOr;
-    case QSOperator::InplaceRightShift: return V4IR::OpRShift;
-    case QSOperator::InplaceURightShift: return V4IR::OpURShift;
-    case QSOperator::InplaceXor: return V4IR::OpBitXor;
-    default: return V4IR::OpInvalid;
+    case QSOperator::InplaceAnd: return IR::OpBitAnd;
+    case QSOperator::InplaceSub: return IR::OpSub;
+    case QSOperator::InplaceDiv: return IR::OpDiv;
+    case QSOperator::InplaceAdd: return IR::OpAdd;
+    case QSOperator::InplaceLeftShift: return IR::OpLShift;
+    case QSOperator::InplaceMod: return IR::OpMod;
+    case QSOperator::InplaceMul: return IR::OpMul;
+    case QSOperator::InplaceOr: return IR::OpBitOr;
+    case QSOperator::InplaceRightShift: return IR::OpRShift;
+    case QSOperator::InplaceURightShift: return IR::OpURShift;
+    case QSOperator::InplaceXor: return IR::OpBitXor;
+    default: return IR::OpInvalid;
     }
 }
 
@@ -1129,13 +1130,13 @@ bool Codegen::visit(BinaryExpression *ast)
 
     if (ast->op == QSOperator::And) {
         if (_expr.accept(cx)) {
-            V4IR::BasicBlock *iftrue = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
+            IR::BasicBlock *iftrue = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
             condition(ast->left, iftrue, _expr.iffalse);
             _block = iftrue;
             condition(ast->right, _expr.iftrue, _expr.iffalse);
         } else {
-            V4IR::BasicBlock *iftrue = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
-            V4IR::BasicBlock *endif = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
+            IR::BasicBlock *iftrue = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
+            IR::BasicBlock *endif = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
 
             const unsigned r = _block->newTemp();
 
@@ -1151,13 +1152,13 @@ bool Codegen::visit(BinaryExpression *ast)
         return false;
     } else if (ast->op == QSOperator::Or) {
         if (_expr.accept(cx)) {
-            V4IR::BasicBlock *iffalse = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
+            IR::BasicBlock *iffalse = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
             condition(ast->left, _expr.iftrue, iffalse);
             _block = iffalse;
             condition(ast->right, _expr.iftrue, _expr.iffalse);
         } else {
-            V4IR::BasicBlock *iffalse = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
-            V4IR::BasicBlock *endif = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
+            IR::BasicBlock *iffalse = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
+            IR::BasicBlock *endif = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
 
             const unsigned r = _block->newTemp();
             move(_block->TEMP(r), *expression(ast->left));
@@ -1172,7 +1173,7 @@ bool Codegen::visit(BinaryExpression *ast)
         return false;
     }
 
-    V4IR::Expr* left = *expression(ast->left);
+    IR::Expr* left = *expression(ast->left);
 
     switch (ast->op) {
     case QSOperator::Or:
@@ -1182,7 +1183,7 @@ bool Codegen::visit(BinaryExpression *ast)
     case QSOperator::Assign: {
         if (throwSyntaxErrorOnEvalOrArgumentsInStrictMode(left, ast->left->lastSourceLocation()))
             return false;
-        V4IR::Expr* right = *expression(ast->right);
+        IR::Expr* right = *expression(ast->right);
         if (!left->isLValue()) {
             throwReferenceError(ast->operatorToken, QStringLiteral("left-hand side of assignment operator is not an lvalue"));
             return false;
@@ -1212,7 +1213,7 @@ bool Codegen::visit(BinaryExpression *ast)
     case QSOperator::InplaceXor: {
         if (throwSyntaxErrorOnEvalOrArgumentsInStrictMode(left, ast->left->lastSourceLocation()))
             return false;
-        V4IR::Expr* right = *expression(ast->right);
+        IR::Expr* right = *expression(ast->right);
         if (!left->isLValue()) {
             throwSyntaxError(ast->operatorToken, QStringLiteral("left-hand side of inplace operator is not an lvalue"));
             return false;
@@ -1245,12 +1246,12 @@ bool Codegen::visit(BinaryExpression *ast)
             left = _block->TEMP(t);
         }
 
-        V4IR::Expr* right = *expression(ast->right);
+        IR::Expr* right = *expression(ast->right);
 
         if (_expr.accept(cx)) {
-            cjump(binop(V4IR::binaryOperator(ast->op), left, right), _expr.iftrue, _expr.iffalse);
+            cjump(binop(IR::binaryOperator(ast->op), left, right), _expr.iftrue, _expr.iffalse);
         } else {
-            V4IR::Expr *e = binop(V4IR::binaryOperator(ast->op), left, right);
+            IR::Expr *e = binop(IR::binaryOperator(ast->op), left, right);
             if (e->asConst() || e->asString())
                 _expr.code = e;
             else {
@@ -1279,9 +1280,9 @@ bool Codegen::visit(BinaryExpression *ast)
             left = _block->TEMP(t);
         }
 
-        V4IR::Expr* right = *expression(ast->right);
+        IR::Expr* right = *expression(ast->right);
 
-        V4IR::Expr *e = binop(V4IR::binaryOperator(ast->op), left, right);
+        IR::Expr *e = binop(IR::binaryOperator(ast->op), left, right);
         if (e->asConst() || e->asString())
             _expr.code = e;
         else {
@@ -1303,11 +1304,11 @@ bool Codegen::visit(CallExpression *ast)
         return false;
 
     Result base = expression(ast->base);
-    V4IR::ExprList *args = 0, **args_it = &args;
+    IR::ExprList *args = 0, **args_it = &args;
     for (ArgumentList *it = ast->arguments; it; it = it->next) {
         Result arg = expression(it->expression);
-        V4IR::Expr *actual = argument(*arg);
-        *args_it = _function->New<V4IR::ExprList>();
+        IR::Expr *actual = argument(*arg);
+        *args_it = _function->New<IR::ExprList>();
         (*args_it)->init(actual);
         args_it = &(*args_it)->next;
     }
@@ -1320,9 +1321,9 @@ bool Codegen::visit(ConditionalExpression *ast)
     if (hasError)
         return true;
 
-    V4IR::BasicBlock *iftrue = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
-    V4IR::BasicBlock *iffalse = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
-    V4IR::BasicBlock *endif = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
+    IR::BasicBlock *iftrue = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
+    IR::BasicBlock *iffalse = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
+    IR::BasicBlock *endif = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
 
     const unsigned t = _block->newTemp();
 
@@ -1348,16 +1349,16 @@ bool Codegen::visit(DeleteExpression *ast)
     if (hasError)
         return false;
 
-    V4IR::Expr* expr = *expression(ast->expression);
+    IR::Expr* expr = *expression(ast->expression);
     // Temporaries cannot be deleted
-    V4IR::Temp *t = expr->asTemp();
+    IR::Temp *t = expr->asTemp();
     if (t && t->index < static_cast<unsigned>(_env->members.size())) {
         // Trying to delete a function argument might throw.
         if (_function->isStrict) {
             throwSyntaxError(ast->deleteToken, QStringLiteral("Delete of an unqualified identifier in strict mode."));
             return false;
         }
-        _expr.code = _block->CONST(V4IR::BoolType, 0);
+        _expr.code = _block->CONST(IR::BoolType, 0);
         return false;
     }
     if (_function->isStrict && expr->asName()) {
@@ -1367,7 +1368,7 @@ bool Codegen::visit(DeleteExpression *ast)
 
     // [[11.4.1]] Return true if it's not a reference
     if (expr->asConst() || expr->asString()) {
-        _expr.code = _block->CONST(V4IR::BoolType, 1);
+        _expr.code = _block->CONST(IR::BoolType, 1);
         return false;
     }
 
@@ -1375,17 +1376,17 @@ bool Codegen::visit(DeleteExpression *ast)
     // perform the call to allow for side effects.
     if (expr->asCall()) {
         _block->EXP(expr);
-        _expr.code = _block->CONST(V4IR::BoolType, 1);
+        _expr.code = _block->CONST(IR::BoolType, 1);
         return false;
     }
     if (expr->asTemp() && expr->asTemp()->index >=  static_cast<unsigned>(_env->members.size())) {
-        _expr.code = _block->CONST(V4IR::BoolType, 1);
+        _expr.code = _block->CONST(IR::BoolType, 1);
         return false;
     }
 
-    V4IR::ExprList *args = _function->New<V4IR::ExprList>();
+    IR::ExprList *args = _function->New<IR::ExprList>();
     args->init(reference(expr));
-    _expr.code = call(_block->NAME(V4IR::Name::builtin_delete, ast->deleteToken.startLine, ast->deleteToken.startColumn), args);
+    _expr.code = call(_block->NAME(IR::Name::builtin_delete, ast->deleteToken.startLine, ast->deleteToken.startColumn), args);
     return false;
 }
 
@@ -1397,7 +1398,7 @@ bool Codegen::visit(FalseLiteral *)
     if (_expr.accept(cx)) {
         _block->JUMP(_expr.iffalse);
     } else {
-        _expr.code = _block->CONST(V4IR::BoolType, 0);
+        _expr.code = _block->CONST(IR::BoolType, 0);
     }
     return false;
 }
@@ -1422,14 +1423,14 @@ bool Codegen::visit(FunctionExpression *ast)
     return false;
 }
 
-V4IR::Expr *Codegen::identifier(const QString &name, int line, int col)
+IR::Expr *Codegen::identifier(const QString &name, int line, int col)
 {
     if (hasError)
         return 0;
 
     uint scope = 0;
     Environment *e = _env;
-    V4IR::Function *f = _function;
+    IR::Function *f = _function;
 
     while (f && e->parent) {
         if (f->insideWithOrCatch || (f->isNamedExpression && f->name == name))
@@ -1438,7 +1439,7 @@ V4IR::Expr *Codegen::identifier(const QString &name, int line, int col)
         int index = e->findMember(name);
         Q_ASSERT (index < e->members.size());
         if (index != -1) {
-            V4IR::Temp *t = _block->LOCAL(index, scope);
+            IR::Temp *t = _block->LOCAL(index, scope);
             if (name == QStringLiteral("arguments") || name == QStringLiteral("eval"))
                 t->isArgumentsOrEval = true;
             return t;
@@ -1456,7 +1457,7 @@ V4IR::Expr *Codegen::identifier(const QString &name, int line, int col)
     }
 
     // This hook allows implementing QML lookup semantics
-    if (V4IR::Expr *fallback = fallbackNameLookup(name, line, col))
+    if (IR::Expr *fallback = fallbackNameLookup(name, line, col))
         return fallback;
 
     if (!e->parent && (!f || !f->insideWithOrCatch) && _env->compilationMode != EvalCode && e->compilationMode != QmlBinding)
@@ -1467,7 +1468,7 @@ V4IR::Expr *Codegen::identifier(const QString &name, int line, int col)
 
 }
 
-V4IR::Expr *Codegen::fallbackNameLookup(const QString &name, int line, int col)
+IR::Expr *Codegen::fallbackNameLookup(const QString &name, int line, int col)
 {
     Q_UNUSED(name)
     Q_UNUSED(line)
@@ -1499,7 +1500,7 @@ bool Codegen::visit(NewExpression *ast)
         return false;
 
     Result base = expression(ast->expression);
-    V4IR::Expr *expr = *base;
+    IR::Expr *expr = *base;
     if (expr && !expr->asTemp() && !expr->asName() && !expr->asMember()) {
         const unsigned t = _block->newTemp();
         move(_block->TEMP(t), expr);
@@ -1515,18 +1516,18 @@ bool Codegen::visit(NewMemberExpression *ast)
         return false;
 
     Result base = expression(ast->base);
-    V4IR::Expr *expr = *base;
+    IR::Expr *expr = *base;
     if (expr && !expr->asTemp() && !expr->asName() && !expr->asMember()) {
         const unsigned t = _block->newTemp();
         move(_block->TEMP(t), expr);
         expr = _block->TEMP(t);
     }
 
-    V4IR::ExprList *args = 0, **args_it = &args;
+    IR::ExprList *args = 0, **args_it = &args;
     for (ArgumentList *it = ast->arguments; it; it = it->next) {
         Result arg = expression(it->expression);
-        V4IR::Expr *actual = argument(*arg);
-        *args_it = _function->New<V4IR::ExprList>();
+        IR::Expr *actual = argument(*arg);
+        *args_it = _function->New<IR::ExprList>();
         (*args_it)->init(actual);
         args_it = &(*args_it)->next;
     }
@@ -1543,7 +1544,7 @@ bool Codegen::visit(NotExpression *ast)
 
     Result expr = expression(ast->expression);
     const unsigned r = _block->newTemp();
-    move(_block->TEMP(r), unop(V4IR::OpNot, *expr));
+    move(_block->TEMP(r), unop(IR::OpNot, *expr));
     _expr.code = _block->TEMP(r);
     return false;
 }
@@ -1554,7 +1555,7 @@ bool Codegen::visit(NullExpression *)
         return false;
 
     if (_expr.accept(cx)) _block->JUMP(_expr.iffalse);
-    else _expr.code = _block->CONST(V4IR::NullType, 0);
+    else _expr.code = _block->CONST(IR::NullType, 0);
 
     return false;
 }
@@ -1568,7 +1569,7 @@ bool Codegen::visit(NumericLiteral *ast)
         if (ast->value) _block->JUMP(_expr.iftrue);
         else _block->JUMP(_expr.iffalse);
     } else {
-        _expr.code = _block->CONST(V4IR::NumberType, ast->value);
+        _expr.code = _block->CONST(IR::NumberType, ast->value);
     }
     return false;
 }
@@ -1580,7 +1581,7 @@ struct ObjectPropertyValue {
         , setter(-1)
     {}
 
-    V4IR::Expr *value;
+    IR::Expr *value;
     int getter; // index in _module->functions or -1 if not set
     int setter;
 
@@ -1627,10 +1628,10 @@ bool Codegen::visit(ObjectLiteral *ast)
         }
     }
 
-    V4IR::ExprList *args = 0;
+    IR::ExprList *args = 0;
 
     if (!valueMap.isEmpty()) {
-        V4IR::ExprList *current;
+        IR::ExprList *current;
         for (QMap<QString, ObjectPropertyValue>::iterator it = valueMap.begin(); it != valueMap.end(); ) {
             if (QV4::String::toArrayIndex(it.key()) != UINT_MAX) {
                 ++it;
@@ -1638,40 +1639,40 @@ bool Codegen::visit(ObjectLiteral *ast)
             }
 
             if (!args) {
-                args = _function->New<V4IR::ExprList>();
+                args = _function->New<IR::ExprList>();
                 current = args;
             } else {
-                current->next = _function->New<V4IR::ExprList>();
+                current->next = _function->New<IR::ExprList>();
                 current = current->next;
             }
 
             current->expr = _block->NAME(it.key(), 0, 0);
 
             if (it->value) {
-                current->next = _function->New<V4IR::ExprList>();
+                current->next = _function->New<IR::ExprList>();
                 current = current->next;
-                current->expr = _block->CONST(V4IR::BoolType, true);
+                current->expr = _block->CONST(IR::BoolType, true);
 
                 unsigned value = _block->newTemp();
                 move(_block->TEMP(value), it->value);
 
-                current->next = _function->New<V4IR::ExprList>();
+                current->next = _function->New<IR::ExprList>();
                 current = current->next;
                 current->expr = _block->TEMP(value);
             } else {
-                current->next = _function->New<V4IR::ExprList>();
+                current->next = _function->New<IR::ExprList>();
                 current = current->next;
-                current->expr = _block->CONST(V4IR::BoolType, false);
+                current->expr = _block->CONST(IR::BoolType, false);
 
                 unsigned getter = _block->newTemp();
                 unsigned setter = _block->newTemp();
-                move(_block->TEMP(getter), it->hasGetter() ? _block->CLOSURE(it->getter) : _block->CONST(V4IR::UndefinedType, 0));
-                move(_block->TEMP(setter), it->hasSetter() ? _block->CLOSURE(it->setter) : _block->CONST(V4IR::UndefinedType, 0));
+                move(_block->TEMP(getter), it->hasGetter() ? _block->CLOSURE(it->getter) : _block->CONST(IR::UndefinedType, 0));
+                move(_block->TEMP(setter), it->hasSetter() ? _block->CLOSURE(it->setter) : _block->CONST(IR::UndefinedType, 0));
 
-                current->next = _function->New<V4IR::ExprList>();
+                current->next = _function->New<IR::ExprList>();
                 current = current->next;
                 current->expr = _block->TEMP(getter);
-                current->next = _function->New<V4IR::ExprList>();
+                current->next = _function->New<IR::ExprList>();
                 current = current->next;
                 current->expr = _block->TEMP(setter);
             }
@@ -1681,7 +1682,7 @@ bool Codegen::visit(ObjectLiteral *ast)
     }
 
     const unsigned t = _block->newTemp();
-    move(_block->TEMP(t), _block->CALL(_block->NAME(V4IR::Name::builtin_define_object_literal,
+    move(_block->TEMP(t), _block->CALL(_block->NAME(IR::Name::builtin_define_object_literal,
          ast->firstSourceLocation().startLine, ast->firstSourceLocation().startColumn), args));
 
     // What's left are array entries
@@ -1690,13 +1691,13 @@ bool Codegen::visit(ObjectLiteral *ast)
         unsigned getter = 0;
         unsigned setter = 0;
         for (QMap<QString, ObjectPropertyValue>::const_iterator it = valueMap.constBegin(); it != valueMap.constEnd(); ++it) {
-            V4IR::ExprList *args = _function->New<V4IR::ExprList>();
-            V4IR::ExprList *current = args;
+            IR::ExprList *args = _function->New<IR::ExprList>();
+            IR::ExprList *current = args;
             current->expr = _block->TEMP(t);
-            current->next = _function->New<V4IR::ExprList>();
+            current->next = _function->New<IR::ExprList>();
             current = current->next;
             current->expr = _block->NAME(it.key(), 0, 0);
-            current->next = _function->New<V4IR::ExprList>();
+            current->next = _function->New<IR::ExprList>();
             current = current->next;
 
             if (it->value) {
@@ -1705,22 +1706,22 @@ bool Codegen::visit(ObjectLiteral *ast)
                 move(_block->TEMP(value), it->value);
                 // __qmljs_builtin_define_property(Value object, String *name, Value val, ExecutionContext *ctx)
                 current->expr = _block->TEMP(value);
-                _block->EXP(_block->CALL(_block->NAME(V4IR::Name::builtin_define_property, 0, 0), args));
+                _block->EXP(_block->CALL(_block->NAME(IR::Name::builtin_define_property, 0, 0), args));
             } else {
                 if (!getter) {
                     getter = _block->newTemp();
                     setter = _block->newTemp();
                 }
-                move(_block->TEMP(getter), it->hasGetter() ? _block->CLOSURE(it->getter) : _block->CONST(V4IR::UndefinedType, 0));
-                move(_block->TEMP(setter), it->hasSetter() ? _block->CLOSURE(it->setter) : _block->CONST(V4IR::UndefinedType, 0));
+                move(_block->TEMP(getter), it->hasGetter() ? _block->CLOSURE(it->getter) : _block->CONST(IR::UndefinedType, 0));
+                move(_block->TEMP(setter), it->hasSetter() ? _block->CLOSURE(it->setter) : _block->CONST(IR::UndefinedType, 0));
 
 
                 // __qmljs_builtin_define_getter_setter(Value object, String *name, Value getter, Value setter, ExecutionContext *ctx);
                 current->expr = _block->TEMP(getter);
-                current->next = _function->New<V4IR::ExprList>();
+                current->next = _function->New<IR::ExprList>();
                 current = current->next;
                 current->expr = _block->TEMP(setter);
-                _block->EXP(_block->CALL(_block->NAME(V4IR::Name::builtin_define_getter_setter, 0, 0), args));
+                _block->EXP(_block->CALL(_block->NAME(IR::Name::builtin_define_getter_setter, 0, 0), args));
             }
         }
     }
@@ -1743,10 +1744,10 @@ bool Codegen::visit(PostDecrementExpression *ast)
         return false;
 
     const unsigned oldValue = _block->newTemp();
-    move(_block->TEMP(oldValue), unop(V4IR::OpUPlus, *expr));
+    move(_block->TEMP(oldValue), unop(IR::OpUPlus, *expr));
 
     const unsigned  newValue = _block->newTemp();
-    move(_block->TEMP(newValue), binop(V4IR::OpSub, _block->TEMP(oldValue), _block->CONST(V4IR::NumberType, 1)));
+    move(_block->TEMP(newValue), binop(IR::OpSub, _block->TEMP(oldValue), _block->CONST(IR::NumberType, 1)));
     move(*expr, _block->TEMP(newValue));
 
     if (!_expr.accept(nx))
@@ -1769,10 +1770,10 @@ bool Codegen::visit(PostIncrementExpression *ast)
         return false;
 
     const unsigned oldValue = _block->newTemp();
-    move(_block->TEMP(oldValue), unop(V4IR::OpUPlus, *expr));
+    move(_block->TEMP(oldValue), unop(IR::OpUPlus, *expr));
 
     const unsigned  newValue = _block->newTemp();
-    move(_block->TEMP(newValue), binop(V4IR::OpAdd, _block->TEMP(oldValue), _block->CONST(V4IR::NumberType, 1)));
+    move(_block->TEMP(newValue), binop(IR::OpAdd, _block->TEMP(oldValue), _block->CONST(IR::NumberType, 1)));
     move(*expr, _block->TEMP(newValue));
 
     if (!_expr.accept(nx))
@@ -1794,7 +1795,7 @@ bool Codegen::visit(PreDecrementExpression *ast)
 
     if (throwSyntaxErrorOnEvalOrArgumentsInStrictMode(*expr, ast->decrementToken))
         return false;
-    V4IR::Expr *op = binop(V4IR::OpSub, *expr, _block->CONST(V4IR::NumberType, 1));
+    IR::Expr *op = binop(IR::OpSub, *expr, _block->CONST(IR::NumberType, 1));
     if (_expr.accept(nx)) {
         move(*expr, op);
     } else {
@@ -1819,7 +1820,7 @@ bool Codegen::visit(PreIncrementExpression *ast)
 
     if (throwSyntaxErrorOnEvalOrArgumentsInStrictMode(*expr, ast->incrementToken))
         return false;
-    V4IR::Expr *op = binop(V4IR::OpAdd, unop(V4IR::OpUPlus, *expr), _block->CONST(V4IR::NumberType, 1));
+    IR::Expr *op = binop(IR::OpAdd, unop(IR::OpUPlus, *expr), _block->CONST(IR::NumberType, 1));
     if (_expr.accept(nx)) {
         move(*expr, op);
     } else {
@@ -1865,7 +1866,7 @@ bool Codegen::visit(TildeExpression *ast)
 
     Result expr = expression(ast->expression);
     const unsigned t = _block->newTemp();
-    move(_block->TEMP(t), unop(V4IR::OpCompl, *expr));
+    move(_block->TEMP(t), unop(IR::OpCompl, *expr));
     _expr.code = _block->TEMP(t);
     return false;
 }
@@ -1878,7 +1879,7 @@ bool Codegen::visit(TrueLiteral *)
     if (_expr.accept(cx)) {
         _block->JUMP(_expr.iftrue);
     } else {
-        _expr.code = _block->CONST(V4IR::BoolType, 1);
+        _expr.code = _block->CONST(IR::BoolType, 1);
     }
     return false;
 }
@@ -1889,9 +1890,9 @@ bool Codegen::visit(TypeOfExpression *ast)
         return false;
 
     Result expr = expression(ast->expression);
-    V4IR::ExprList *args = _function->New<V4IR::ExprList>();
+    IR::ExprList *args = _function->New<IR::ExprList>();
     args->init(reference(*expr));
-    _expr.code = call(_block->NAME(V4IR::Name::builtin_typeof, ast->typeofToken.startLine, ast->typeofToken.startColumn), args);
+    _expr.code = call(_block->NAME(IR::Name::builtin_typeof, ast->typeofToken.startLine, ast->typeofToken.startColumn), args);
     return false;
 }
 
@@ -1902,7 +1903,7 @@ bool Codegen::visit(UnaryMinusExpression *ast)
 
     Result expr = expression(ast->expression);
     const unsigned t = _block->newTemp();
-    move(_block->TEMP(t), unop(V4IR::OpUMinus, *expr));
+    move(_block->TEMP(t), unop(IR::OpUMinus, *expr));
     _expr.code = _block->TEMP(t);
     return false;
 }
@@ -1914,7 +1915,7 @@ bool Codegen::visit(UnaryPlusExpression *ast)
 
     Result expr = expression(ast->expression);
     const unsigned t = _block->newTemp();
-    move(_block->TEMP(t), unop(V4IR::OpUPlus, *expr));
+    move(_block->TEMP(t), unop(IR::OpUPlus, *expr));
     _expr.code = _block->TEMP(t);
     return false;
 }
@@ -1925,7 +1926,7 @@ bool Codegen::visit(VoidExpression *ast)
         return false;
 
     statement(ast->expression);
-    _expr.code = _block->CONST(V4IR::UndefinedType, 0);
+    _expr.code = _block->CONST(IR::UndefinedType, 0);
     return false;
 }
 
@@ -1947,17 +1948,17 @@ int Codegen::defineFunction(const QString &name, AST::Node *ast,
 {
     Loop *loop = 0;
     qSwap(_loop, loop);
-    QStack<V4IR::BasicBlock *> exceptionHandlers;
+    QStack<IR::BasicBlock *> exceptionHandlers;
     qSwap(_exceptionHandlers, exceptionHandlers);
 
     ScopeAndFinally *scopeAndFinally = 0;
 
     enterEnvironment(ast);
-    V4IR::Function *function = _module->newFunction(name, _function);
+    IR::Function *function = _module->newFunction(name, _function);
     int functionIndex = _module->functions.count() - 1;
 
-    V4IR::BasicBlock *entryBlock = function->newBasicBlock(groupStartBlock(), 0);
-    V4IR::BasicBlock *exitBlock = function->newBasicBlock(groupStartBlock(), 0, V4IR::Function::DontInsertBlock);
+    IR::BasicBlock *entryBlock = function->newBasicBlock(groupStartBlock(), 0);
+    IR::BasicBlock *exitBlock = function->newBasicBlock(groupStartBlock(), 0, IR::Function::DontInsertBlock);
     function->hasDirectEval = _env->hasDirectEval || _env->compilationMode == EvalCode;
     function->usesArgumentsObject = _env->parent && (_env->usesArgumentsObject == Environment::ArgumentsObjectUsed);
     function->usesThis = _env->usesThis;
@@ -1979,7 +1980,7 @@ int Codegen::defineFunction(const QString &name, AST::Node *ast,
             const QString &local = it.key();
             function->LOCAL(local);
             (*it).index = t;
-            entryBlock->MOVE(entryBlock->LOCAL(t, 0), entryBlock->CONST(V4IR::UndefinedType, 0));
+            entryBlock->MOVE(entryBlock->LOCAL(t, 0), entryBlock->CONST(IR::UndefinedType, 0));
             ++t;
         }
     } else {
@@ -1993,27 +1994,27 @@ int Codegen::defineFunction(const QString &name, AST::Node *ast,
             }
         }
 
-        V4IR::ExprList *args = 0;
+        IR::ExprList *args = 0;
         for (Environment::MemberMap::const_iterator it = _env->members.constBegin(); it != _env->members.constEnd(); ++it) {
             const QString &local = it.key();
-            V4IR::ExprList *next = function->New<V4IR::ExprList>();
+            IR::ExprList *next = function->New<IR::ExprList>();
             next->expr = entryBlock->NAME(local, 0, 0);
             next->next = args;
             args = next;
         }
         if (args) {
-            V4IR::ExprList *next = function->New<V4IR::ExprList>();
-            next->expr = entryBlock->CONST(V4IR::BoolType, false); // ### Investigate removal of bool deletable
+            IR::ExprList *next = function->New<IR::ExprList>();
+            next->expr = entryBlock->CONST(IR::BoolType, false); // ### Investigate removal of bool deletable
             next->next = args;
             args = next;
 
-            entryBlock->EXP(entryBlock->CALL(entryBlock->NAME(V4IR::Name::builtin_declare_vars, 0, 0), args));
+            entryBlock->EXP(entryBlock->CALL(entryBlock->NAME(IR::Name::builtin_declare_vars, 0, 0), args));
         }
     }
 
     unsigned returnAddress = entryBlock->newTemp();
 
-    entryBlock->MOVE(entryBlock->TEMP(returnAddress), entryBlock->CONST(V4IR::UndefinedType, 0));
+    entryBlock->MOVE(entryBlock->TEMP(returnAddress), entryBlock->CONST(IR::UndefinedType, 0));
     exitBlock->RET(exitBlock->TEMP(returnAddress));
 
     qSwap(_function, function);
@@ -2041,12 +2042,12 @@ int Codegen::defineFunction(const QString &name, AST::Node *ast,
     }
     if (_function->usesArgumentsObject) {
         move(identifier(QStringLiteral("arguments"), ast->firstSourceLocation().startLine, ast->firstSourceLocation().startColumn),
-             _block->CALL(_block->NAME(V4IR::Name::builtin_setup_argument_object,
+             _block->CALL(_block->NAME(IR::Name::builtin_setup_argument_object,
                      ast->firstSourceLocation().startLine, ast->firstSourceLocation().startColumn), 0));
     }
     if (_function->usesThis && !_function->isStrict) {
         // make sure we convert this to an object
-        _block->EXP(_block->CALL(_block->NAME(V4IR::Name::builtin_convert_this_to_object,
+        _block->EXP(_block->CALL(_block->NAME(IR::Name::builtin_convert_this_to_object,
                 ast->firstSourceLocation().startLine, ast->firstSourceLocation().startColumn), 0));
     }
 
@@ -2198,9 +2199,9 @@ bool Codegen::visit(DoWhileStatement *ast)
     if (hasError)
         return true;
 
-    V4IR::BasicBlock *loopbody = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
-    V4IR::BasicBlock *loopcond = _function->newBasicBlock(loopbody, exceptionHandler());
-    V4IR::BasicBlock *loopend = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
+    IR::BasicBlock *loopbody = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
+    IR::BasicBlock *loopcond = _function->newBasicBlock(loopbody, exceptionHandler());
+    IR::BasicBlock *loopend = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
 
     enterLoop(ast, loopbody, loopend, loopcond);
 
@@ -2248,19 +2249,19 @@ bool Codegen::visit(ForEachStatement *ast)
     if (hasError)
         return true;
 
-    V4IR::BasicBlock *foreachin = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
-    V4IR::BasicBlock *foreachbody = _function->newBasicBlock(foreachin, exceptionHandler());
-    V4IR::BasicBlock *foreachend = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
+    IR::BasicBlock *foreachin = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
+    IR::BasicBlock *foreachbody = _function->newBasicBlock(foreachin, exceptionHandler());
+    IR::BasicBlock *foreachend = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
 
     enterLoop(ast, foreachin, foreachend, foreachin);
 
     int objectToIterateOn = _block->newTemp();
     move(_block->TEMP(objectToIterateOn), *expression(ast->expression));
-    V4IR::ExprList *args = _function->New<V4IR::ExprList>();
+    IR::ExprList *args = _function->New<IR::ExprList>();
     args->init(_block->TEMP(objectToIterateOn));
 
     int iterator = _block->newTemp();
-    move(_block->TEMP(iterator), _block->CALL(_block->NAME(V4IR::Name::builtin_foreach_iterator_object, 0, 0), args));
+    move(_block->TEMP(iterator), _block->CALL(_block->NAME(IR::Name::builtin_foreach_iterator_object, 0, 0), args));
 
     _block->JUMP(foreachin);
 
@@ -2272,12 +2273,12 @@ bool Codegen::visit(ForEachStatement *ast)
 
     _block = foreachin;
 
-    args = _function->New<V4IR::ExprList>();
+    args = _function->New<IR::ExprList>();
     args->init(_block->TEMP(iterator));
-    move(_block->TEMP(temp), _block->CALL(_block->NAME(V4IR::Name::builtin_foreach_next_property_name, 0, 0), args));
+    move(_block->TEMP(temp), _block->CALL(_block->NAME(IR::Name::builtin_foreach_next_property_name, 0, 0), args));
     int null = _block->newTemp();
-    move(_block->TEMP(null), _block->CONST(V4IR::NullType, 0));
-    cjump(_block->BINOP(V4IR::OpStrictNotEqual, _block->TEMP(temp), _block->TEMP(null)), foreachbody, foreachend);
+    move(_block->TEMP(null), _block->CONST(IR::NullType, 0));
+    cjump(_block->BINOP(IR::OpStrictNotEqual, _block->TEMP(temp), _block->TEMP(null)), foreachbody, foreachend);
     _block = foreachend;
 
     leaveLoop();
@@ -2289,10 +2290,10 @@ bool Codegen::visit(ForStatement *ast)
     if (hasError)
         return true;
 
-    V4IR::BasicBlock *forcond = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
-    V4IR::BasicBlock *forbody = _function->newBasicBlock(forcond, exceptionHandler());
-    V4IR::BasicBlock *forstep = _function->newBasicBlock(forcond, exceptionHandler());
-    V4IR::BasicBlock *forend = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
+    IR::BasicBlock *forcond = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
+    IR::BasicBlock *forbody = _function->newBasicBlock(forcond, exceptionHandler());
+    IR::BasicBlock *forstep = _function->newBasicBlock(forcond, exceptionHandler());
+    IR::BasicBlock *forend = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
 
     statement(ast->initialiser);
     _block->JUMP(forcond);
@@ -2325,9 +2326,9 @@ bool Codegen::visit(IfStatement *ast)
     if (hasError)
         return true;
 
-    V4IR::BasicBlock *iftrue = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
-    V4IR::BasicBlock *iffalse = ast->ko ? _function->newBasicBlock(groupStartBlock(), exceptionHandler()) : 0;
-    V4IR::BasicBlock *endif = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
+    IR::BasicBlock *iftrue = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
+    IR::BasicBlock *iffalse = ast->ko ? _function->newBasicBlock(groupStartBlock(), exceptionHandler()) : 0;
+    IR::BasicBlock *endif = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
 
     condition(ast->expression, iftrue, ast->ko ? iffalse : endif);
 
@@ -2372,7 +2373,7 @@ bool Codegen::visit(LabelledStatement *ast)
             AST::cast<AST::LocalForEachStatement *>(ast->statement)) {
         statement(ast->statement); // labelledStatement will be associated with the ast->statement's loop.
     } else {
-        V4IR::BasicBlock *breakBlock = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
+        IR::BasicBlock *breakBlock = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
         enterLoop(ast->statement, 0, breakBlock, /*continueBlock*/ 0);
         statement(ast->statement);
         _block->JUMP(breakBlock);
@@ -2388,9 +2389,9 @@ bool Codegen::visit(LocalForEachStatement *ast)
     if (hasError)
         return true;
 
-    V4IR::BasicBlock *foreachin = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
-    V4IR::BasicBlock *foreachbody = _function->newBasicBlock(foreachin, exceptionHandler());
-    V4IR::BasicBlock *foreachend = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
+    IR::BasicBlock *foreachin = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
+    IR::BasicBlock *foreachbody = _function->newBasicBlock(foreachin, exceptionHandler());
+    IR::BasicBlock *foreachend = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
 
     enterLoop(ast, foreachin, foreachend, foreachin);
 
@@ -2398,9 +2399,9 @@ bool Codegen::visit(LocalForEachStatement *ast)
 
     int iterator = _block->newTemp();
     move(_block->TEMP(iterator), *expression(ast->expression));
-    V4IR::ExprList *args = _function->New<V4IR::ExprList>();
+    IR::ExprList *args = _function->New<IR::ExprList>();
     args->init(_block->TEMP(iterator));
-    move(_block->TEMP(iterator), _block->CALL(_block->NAME(V4IR::Name::builtin_foreach_iterator_object, 0, 0), args));
+    move(_block->TEMP(iterator), _block->CALL(_block->NAME(IR::Name::builtin_foreach_iterator_object, 0, 0), args));
 
     _block->JUMP(foreachin);
 
@@ -2412,12 +2413,12 @@ bool Codegen::visit(LocalForEachStatement *ast)
 
     _block = foreachin;
 
-    args = _function->New<V4IR::ExprList>();
+    args = _function->New<IR::ExprList>();
     args->init(_block->TEMP(iterator));
-    move(_block->TEMP(temp), _block->CALL(_block->NAME(V4IR::Name::builtin_foreach_next_property_name, 0, 0), args));
+    move(_block->TEMP(temp), _block->CALL(_block->NAME(IR::Name::builtin_foreach_next_property_name, 0, 0), args));
     int null = _block->newTemp();
-    move(_block->TEMP(null), _block->CONST(V4IR::NullType, 0));
-    cjump(_block->BINOP(V4IR::OpStrictNotEqual, _block->TEMP(temp), _block->TEMP(null)), foreachbody, foreachend);
+    move(_block->TEMP(null), _block->CONST(IR::NullType, 0));
+    cjump(_block->BINOP(IR::OpStrictNotEqual, _block->TEMP(temp), _block->TEMP(null)), foreachbody, foreachend);
     _block = foreachend;
 
     leaveLoop();
@@ -2429,10 +2430,10 @@ bool Codegen::visit(LocalForStatement *ast)
     if (hasError)
         return true;
 
-    V4IR::BasicBlock *forcond = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
-    V4IR::BasicBlock *forbody = _function->newBasicBlock(forcond, exceptionHandler());
-    V4IR::BasicBlock *forstep = _function->newBasicBlock(forcond, exceptionHandler());
-    V4IR::BasicBlock *forend = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
+    IR::BasicBlock *forcond = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
+    IR::BasicBlock *forbody = _function->newBasicBlock(forcond, exceptionHandler());
+    IR::BasicBlock *forstep = _function->newBasicBlock(forcond, exceptionHandler());
+    IR::BasicBlock *forend = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
 
     variableDeclarationList(ast->declarations);
     _block->JUMP(forcond);
@@ -2484,15 +2485,15 @@ bool Codegen::visit(SwitchStatement *ast)
     if (hasError)
         return true;
 
-    V4IR::BasicBlock *switchend = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
+    IR::BasicBlock *switchend = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
 
     if (ast->block) {
         Result lhs = expression(ast->expression);
-        V4IR::BasicBlock *switchcond = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
+        IR::BasicBlock *switchcond = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
         _block->JUMP(switchcond);
-        V4IR::BasicBlock *previousBlock = 0;
+        IR::BasicBlock *previousBlock = 0;
 
-        QHash<Node *, V4IR::BasicBlock *> blockMap;
+        QHash<Node *, IR::BasicBlock *> blockMap;
 
         enterLoop(ast, 0, switchend, 0);
 
@@ -2547,18 +2548,18 @@ bool Codegen::visit(SwitchStatement *ast)
         for (CaseClauses *it = ast->block->clauses; it; it = it->next) {
             CaseClause *clause = it->clause;
             Result rhs = expression(clause->expression);
-            V4IR::BasicBlock *iftrue = blockMap[clause];
-            V4IR::BasicBlock *iffalse = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
-            cjump(binop(V4IR::OpStrictEqual, *lhs, *rhs), iftrue, iffalse);
+            IR::BasicBlock *iftrue = blockMap[clause];
+            IR::BasicBlock *iffalse = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
+            cjump(binop(IR::OpStrictEqual, *lhs, *rhs), iftrue, iffalse);
             _block = iffalse;
         }
 
         for (CaseClauses *it = ast->block->moreClauses; it; it = it->next) {
             CaseClause *clause = it->clause;
             Result rhs = expression(clause->expression);
-            V4IR::BasicBlock *iftrue = blockMap[clause];
-            V4IR::BasicBlock *iffalse = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
-            cjump(binop(V4IR::OpStrictEqual, *lhs, *rhs), iftrue, iffalse);
+            IR::BasicBlock *iftrue = blockMap[clause];
+            IR::BasicBlock *iffalse = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
+            cjump(binop(IR::OpStrictEqual, *lhs, *rhs), iftrue, iffalse);
             _block = iffalse;
         }
 
@@ -2580,9 +2581,9 @@ bool Codegen::visit(ThrowStatement *ast)
 
     Result expr = expression(ast->expression);
     move(_block->TEMP(_returnAddress), *expr);
-    V4IR::ExprList *throwArgs = _function->New<V4IR::ExprList>();
+    IR::ExprList *throwArgs = _function->New<IR::ExprList>();
     throwArgs->expr = _block->TEMP(_returnAddress);
-    _block->EXP(_block->CALL(_block->NAME(V4IR::Name::builtin_throw, /*line*/0, /*column*/0), throwArgs));
+    _block->EXP(_block->CALL(_block->NAME(IR::Name::builtin_throw, /*line*/0, /*column*/0), throwArgs));
     return false;
 }
 
@@ -2599,23 +2600,23 @@ bool Codegen::visit(TryStatement *ast)
         return false;
     }
 
-    V4IR::BasicBlock *surroundingExceptionHandler = exceptionHandler();
+    IR::BasicBlock *surroundingExceptionHandler = exceptionHandler();
 
     // We always need a finally body to clean up the exception handler
     // exceptions thrown in finally get catched by the surrounding catch block
-    V4IR::BasicBlock *finallyBody = 0;
-    V4IR::BasicBlock *catchBody = 0;
-    V4IR::BasicBlock *catchExceptionHandler = 0;
-    V4IR::BasicBlock *end = _function->newBasicBlock(groupStartBlock(), surroundingExceptionHandler, V4IR::Function::DontInsertBlock);
+    IR::BasicBlock *finallyBody = 0;
+    IR::BasicBlock *catchBody = 0;
+    IR::BasicBlock *catchExceptionHandler = 0;
+    IR::BasicBlock *end = _function->newBasicBlock(groupStartBlock(), surroundingExceptionHandler, IR::Function::DontInsertBlock);
 
     if (ast->finallyExpression)
-        finallyBody = _function->newBasicBlock(groupStartBlock(), surroundingExceptionHandler, V4IR::Function::DontInsertBlock);
+        finallyBody = _function->newBasicBlock(groupStartBlock(), surroundingExceptionHandler, IR::Function::DontInsertBlock);
 
     if (ast->catchExpression) {
         // exception handler for the catch body
-        catchExceptionHandler = _function->newBasicBlock(groupStartBlock(), 0, V4IR::Function::DontInsertBlock);
+        catchExceptionHandler = _function->newBasicBlock(groupStartBlock(), 0, IR::Function::DontInsertBlock);
         pushExceptionHandler(catchExceptionHandler);
-        catchBody =  _function->newBasicBlock(groupStartBlock(), catchExceptionHandler, V4IR::Function::DontInsertBlock);
+        catchBody =  _function->newBasicBlock(groupStartBlock(), catchExceptionHandler, IR::Function::DontInsertBlock);
         popExceptionHandler();
         pushExceptionHandler(catchBody);
     } else {
@@ -2623,7 +2624,7 @@ bool Codegen::visit(TryStatement *ast)
         pushExceptionHandler(finallyBody);
     }
 
-    V4IR::BasicBlock *tryBody = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
+    IR::BasicBlock *tryBody = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
     _block->JUMP(tryBody);
 
     ScopeAndFinally tcf(_scopeAndFinally, ast->finallyExpression);
@@ -2641,26 +2642,26 @@ bool Codegen::visit(TryStatement *ast)
         _block = catchBody;
 
         ++_function->insideWithOrCatch;
-        V4IR::ExprList *catchArgs = _function->New<V4IR::ExprList>();
+        IR::ExprList *catchArgs = _function->New<IR::ExprList>();
         catchArgs->init(_block->STRING(_function->newString(ast->catchExpression->name.toString())));
-        _block->EXP(_block->CALL(_block->NAME(V4IR::Name::builtin_push_catch_scope, 0, 0), catchArgs));
+        _block->EXP(_block->CALL(_block->NAME(IR::Name::builtin_push_catch_scope, 0, 0), catchArgs));
         {
             ScopeAndFinally scope(_scopeAndFinally, ScopeAndFinally::CatchScope);
             _scopeAndFinally = &scope;
             statement(ast->catchExpression->statement);
             _scopeAndFinally = scope.parent;
         }
-        _block->EXP(_block->CALL(_block->NAME(V4IR::Name::builtin_pop_scope, 0, 0), 0));
+        _block->EXP(_block->CALL(_block->NAME(IR::Name::builtin_pop_scope, 0, 0), 0));
         --_function->insideWithOrCatch;
         _block->JUMP(finallyBody ? finallyBody : end);
         popExceptionHandler();
 
         _function->insertBasicBlock(catchExceptionHandler);
-        catchExceptionHandler->EXP(catchExceptionHandler->CALL(catchExceptionHandler->NAME(V4IR::Name::builtin_pop_scope, 0, 0), 0));
+        catchExceptionHandler->EXP(catchExceptionHandler->CALL(catchExceptionHandler->NAME(IR::Name::builtin_pop_scope, 0, 0), 0));
         if (finallyBody || surroundingExceptionHandler)
             catchExceptionHandler->JUMP(finallyBody ? finallyBody : surroundingExceptionHandler);
         else
-            catchExceptionHandler->EXP(catchExceptionHandler->CALL(catchExceptionHandler->NAME(V4IR::Name::builtin_rethrow, 0, 0), 0));
+            catchExceptionHandler->EXP(catchExceptionHandler->CALL(catchExceptionHandler->NAME(IR::Name::builtin_rethrow, 0, 0), 0));
     }
 
     _scopeAndFinally = tcf.parent;
@@ -2670,14 +2671,14 @@ bool Codegen::visit(TryStatement *ast)
         _block = finallyBody;
 
         int hasException = _block->newTemp();
-        move(_block->TEMP(hasException), _block->CALL(_block->NAME(V4IR::Name::builtin_unwind_exception, /*line*/0, /*column*/0), 0));
+        move(_block->TEMP(hasException), _block->CALL(_block->NAME(IR::Name::builtin_unwind_exception, /*line*/0, /*column*/0), 0));
 
         if (ast->finallyExpression && ast->finallyExpression->statement)
             statement(ast->finallyExpression->statement);
 
-        V4IR::ExprList *arg = _function->New<V4IR::ExprList>();
+        IR::ExprList *arg = _function->New<IR::ExprList>();
         arg->expr = _block->TEMP(hasException);
-        _block->EXP(_block->CALL(_block->NAME(V4IR::Name::builtin_throw, /*line*/0, /*column*/0), arg));
+        _block->EXP(_block->CALL(_block->NAME(IR::Name::builtin_throw, /*line*/0, /*column*/0), arg));
         _block->JUMP(end);
     }
 
@@ -2697,7 +2698,7 @@ void Codegen::unwindException(Codegen::ScopeAndFinally *outest)
         case ScopeAndFinally::WithScope:
             // fall through
         case ScopeAndFinally::CatchScope:
-            _block->EXP(_block->CALL(_block->NAME(V4IR::Name::builtin_pop_scope, 0, 0)));
+            _block->EXP(_block->CALL(_block->NAME(IR::Name::builtin_pop_scope, 0, 0)));
             _scopeAndFinally = _scopeAndFinally->parent;
             --_function->insideWithOrCatch;
             break;
@@ -2728,9 +2729,9 @@ bool Codegen::visit(WhileStatement *ast)
     if (hasError)
         return true;
 
-    V4IR::BasicBlock *whilecond = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
-    V4IR::BasicBlock *whilebody = _function->newBasicBlock(whilecond, exceptionHandler());
-    V4IR::BasicBlock *whileend = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
+    IR::BasicBlock *whilecond = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
+    IR::BasicBlock *whilebody = _function->newBasicBlock(whilecond, exceptionHandler());
+    IR::BasicBlock *whileend = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
 
     enterLoop(ast, whilecond, whileend, whilecond);
 
@@ -2756,24 +2757,24 @@ bool Codegen::visit(WithStatement *ast)
     _function->hasWith = true;
 
     // need an exception handler for with to cleanup the with scope
-    V4IR::BasicBlock *withExceptionHandler = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
-    withExceptionHandler->EXP(withExceptionHandler->CALL(withExceptionHandler->NAME(V4IR::Name::builtin_pop_scope, 0, 0), 0));
+    IR::BasicBlock *withExceptionHandler = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
+    withExceptionHandler->EXP(withExceptionHandler->CALL(withExceptionHandler->NAME(IR::Name::builtin_pop_scope, 0, 0), 0));
     if (!exceptionHandler())
-        withExceptionHandler->EXP(withExceptionHandler->CALL(withExceptionHandler->NAME(V4IR::Name::builtin_rethrow, 0, 0), 0));
+        withExceptionHandler->EXP(withExceptionHandler->CALL(withExceptionHandler->NAME(IR::Name::builtin_rethrow, 0, 0), 0));
     else
         withExceptionHandler->JUMP(exceptionHandler());
 
     pushExceptionHandler(withExceptionHandler);
 
-    V4IR::BasicBlock *withBlock = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
+    IR::BasicBlock *withBlock = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
 
     _block->JUMP(withBlock);
     _block = withBlock;
     int withObject = _block->newTemp();
     _block->MOVE(_block->TEMP(withObject), *expression(ast->expression));
-    V4IR::ExprList *args = _function->New<V4IR::ExprList>();
+    IR::ExprList *args = _function->New<IR::ExprList>();
     args->init(_block->TEMP(withObject));
-    _block->EXP(_block->CALL(_block->NAME(V4IR::Name::builtin_push_with_scope, 0, 0), args));
+    _block->EXP(_block->CALL(_block->NAME(IR::Name::builtin_push_with_scope, 0, 0), args));
 
     ++_function->insideWithOrCatch;
     {
@@ -2783,10 +2784,10 @@ bool Codegen::visit(WithStatement *ast)
         _scopeAndFinally = scope.parent;
     }
     --_function->insideWithOrCatch;
-    _block->EXP(_block->CALL(_block->NAME(V4IR::Name::builtin_pop_scope, 0, 0), 0));
+    _block->EXP(_block->CALL(_block->NAME(IR::Name::builtin_pop_scope, 0, 0), 0));
     popExceptionHandler();
 
-    V4IR::BasicBlock *next = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
+    IR::BasicBlock *next = _function->newBasicBlock(groupStartBlock(), exceptionHandler());
     _block->JUMP(next);
     _block = next;
 
@@ -2829,14 +2830,14 @@ bool Codegen::visit(UiSourceElement *)
     return false;
 }
 
-bool Codegen::throwSyntaxErrorOnEvalOrArgumentsInStrictMode(V4IR::Expr *expr, const SourceLocation& loc)
+bool Codegen::throwSyntaxErrorOnEvalOrArgumentsInStrictMode(IR::Expr *expr, const SourceLocation& loc)
 {
     if (!_env->isStrict)
         return false;
-    if (V4IR::Name *n = expr->asName()) {
+    if (IR::Name *n = expr->asName()) {
         if (*n->id != QLatin1String("eval") && *n->id != QLatin1String("arguments"))
             return false;
-    } else if (V4IR::Temp *t = expr->asTemp()) {
+    } else if (IR::Temp *t = expr->asTemp()) {
         if (!t->isArgumentsOrEval)
             return false;
     } else {
index 32f1f1bfd4275028c1e05b62861b0a15536a9a00..37055171b181f61f7b66bdab68db829aa069670d 100644 (file)
@@ -81,20 +81,20 @@ public:
     void generateFromProgram(const QString &fileName,
                              const QString &sourceCode,
                              AST::Program *ast,
-                             V4IR::Module *module,
+                             QV4::IR::Module *module,
                              CompilationMode mode = GlobalCode,
                              const QStringList &inheritedLocals = QStringList());
     void generateFromFunctionExpression(const QString &fileName,
                              const QString &sourceCode,
                              AST::FunctionExpression *ast,
-                             V4IR::Module *module);
+                             QV4::IR::Module *module);
 
 protected:
     enum Format { ex, cx, nx };
     struct Result {
-        V4IR::Expr *code;
-        V4IR::BasicBlock *iftrue;
-        V4IR::BasicBlock *iffalse;
+        QV4::IR::Expr *code;
+        QV4::IR::BasicBlock *iftrue;
+        QV4::IR::BasicBlock *iffalse;
         Format format;
         Format requested;
 
@@ -105,15 +105,15 @@ protected:
             , format(ex)
             , requested(requested) {}
 
-        explicit Result(V4IR::BasicBlock *iftrue, V4IR::BasicBlock *iffalse)
+        explicit Result(QV4::IR::BasicBlock *iftrue, QV4::IR::BasicBlock *iffalse)
             : code(0)
             , iftrue(iftrue)
             , iffalse(iffalse)
             , format(ex)
             , requested(cx) {}
 
-        inline V4IR::Expr *operator*() const { Q_ASSERT(format == ex); return code; }
-        inline V4IR::Expr *operator->() const { Q_ASSERT(format == ex); return code; }
+        inline QV4::IR::Expr *operator*() const { Q_ASSERT(format == ex); return code; }
+        inline QV4::IR::Expr *operator->() const { Q_ASSERT(format == ex); return code; }
 
         bool accept(Format f)
         {
@@ -254,35 +254,35 @@ protected:
     struct Loop {
         AST::LabelledStatement *labelledStatement;
         AST::Statement *node;
-        V4IR::BasicBlock *groupStartBlock;
-        V4IR::BasicBlock *breakBlock;
-        V4IR::BasicBlock *continueBlock;
+        QV4::IR::BasicBlock *groupStartBlock;
+        QV4::IR::BasicBlock *breakBlock;
+        QV4::IR::BasicBlock *continueBlock;
         Loop *parent;
         ScopeAndFinally *scopeAndFinally;
 
-        Loop(AST::Statement *node, V4IR::BasicBlock *groupStartBlock, V4IR::BasicBlock *breakBlock, V4IR::BasicBlock *continueBlock, Loop *parent)
+        Loop(AST::Statement *node, QV4::IR::BasicBlock *groupStartBlock, QV4::IR::BasicBlock *breakBlock, QV4::IR::BasicBlock *continueBlock, Loop *parent)
             : labelledStatement(0), node(node), groupStartBlock(groupStartBlock), breakBlock(breakBlock), continueBlock(continueBlock), parent(parent) {}
     };
 
     void enterEnvironment(AST::Node *node);
     void leaveEnvironment();
 
-    void enterLoop(AST::Statement *node, V4IR::BasicBlock *startBlock, V4IR::BasicBlock *breakBlock, V4IR::BasicBlock *continueBlock);
+    void enterLoop(AST::Statement *node, QV4::IR::BasicBlock *startBlock, QV4::IR::BasicBlock *breakBlock, QV4::IR::BasicBlock *continueBlock);
     void leaveLoop();
-    V4IR::BasicBlock *groupStartBlock() const
+    QV4::IR::BasicBlock *groupStartBlock() const
     {
         for (Loop *it = _loop; it; it = it->parent)
             if (it->groupStartBlock)
                 return it->groupStartBlock;
         return 0;
     }
-    V4IR::BasicBlock *exceptionHandler() const
+    QV4::IR::BasicBlock *exceptionHandler() const
     {
         if (_exceptionHandlers.isEmpty())
             return 0;
         return _exceptionHandlers.top();
     }
-    void pushExceptionHandler(V4IR::BasicBlock *handler)
+    void pushExceptionHandler(QV4::IR::BasicBlock *handler)
     {
         handler->isExceptionHandler = true;
         _exceptionHandlers.push(handler);
@@ -293,15 +293,15 @@ protected:
         _exceptionHandlers.pop();
     }
 
-    V4IR::Expr *member(V4IR::Expr *base, const QString *name);
-    V4IR::Expr *subscript(V4IR::Expr *base, V4IR::Expr *index);
-    V4IR::Expr *argument(V4IR::Expr *expr);
-    V4IR::Expr *reference(V4IR::Expr *expr);
-    V4IR::Expr *unop(V4IR::AluOp op, V4IR::Expr *expr);
-    V4IR::Expr *binop(V4IR::AluOp op, V4IR::Expr *left, V4IR::Expr *right);
-    V4IR::Expr *call(V4IR::Expr *base, V4IR::ExprList *args);
-    void move(V4IR::Expr *target, V4IR::Expr *source, V4IR::AluOp op = V4IR::OpInvalid);
-    void cjump(V4IR::Expr *cond, V4IR::BasicBlock *iftrue, V4IR::BasicBlock *iffalse);
+    QV4::IR::Expr *member(QV4::IR::Expr *base, const QString *name);
+    QV4::IR::Expr *subscript(QV4::IR::Expr *base, QV4::IR::Expr *index);
+    QV4::IR::Expr *argument(QV4::IR::Expr *expr);
+    QV4::IR::Expr *reference(QV4::IR::Expr *expr);
+    QV4::IR::Expr *unop(QV4::IR::AluOp op, QV4::IR::Expr *expr);
+    QV4::IR::Expr *binop(QV4::IR::AluOp op, QV4::IR::Expr *left, QV4::IR::Expr *right);
+    QV4::IR::Expr *call(QV4::IR::Expr *base, QV4::IR::ExprList *args);
+    void move(QV4::IR::Expr *target, QV4::IR::Expr *source, QV4::IR::AluOp op = QV4::IR::OpInvalid);
+    void cjump(QV4::IR::Expr *cond, QV4::IR::BasicBlock *iftrue, QV4::IR::BasicBlock *iffalse);
 
     // Returns index in _module->functions
     int defineFunction(const QString &name, AST::Node *ast,
@@ -313,7 +313,7 @@ protected:
 
     void statement(AST::Statement *ast);
     void statement(AST::ExpressionNode *ast);
-    void condition(AST::ExpressionNode *ast, V4IR::BasicBlock *iftrue, V4IR::BasicBlock *iffalse);
+    void condition(AST::ExpressionNode *ast, QV4::IR::BasicBlock *iftrue, QV4::IR::BasicBlock *iffalse);
     Result expression(AST::ExpressionNode *ast);
     QString propertyName(AST::PropertyName *ast);
     Result sourceElement(AST::SourceElement *ast);
@@ -327,9 +327,9 @@ protected:
     void variableDeclaration(AST::VariableDeclaration *ast);
     void variableDeclarationList(AST::VariableDeclarationList *ast);
 
-    V4IR::Expr *identifier(const QString &name, int line = 0, int col = 0);
+    QV4::IR::Expr *identifier(const QString &name, int line = 0, int col = 0);
     // Hook provided to implement QML lookup semantics
-    virtual V4IR::Expr *fallbackNameLookup(const QString &name, int line, int col);
+    virtual QV4::IR::Expr *fallbackNameLookup(const QString &name, int line, int col);
     virtual void beginFunctionBodyHook() {}
 
     // nodes
@@ -436,7 +436,7 @@ protected:
     virtual bool visit(AST::UiScriptBinding *ast);
     virtual bool visit(AST::UiSourceElement *ast);
 
-    bool throwSyntaxErrorOnEvalOrArgumentsInStrictMode(V4IR::Expr* expr, const AST::SourceLocation &loc);
+    bool throwSyntaxErrorOnEvalOrArgumentsInStrictMode(QV4::IR::Expr* expr, const AST::SourceLocation &loc);
     virtual void throwSyntaxError(const AST::SourceLocation &loc, const QString &detail);
     virtual void throwReferenceError(const AST::SourceLocation &loc, const QString &detail);
 
@@ -447,10 +447,10 @@ protected:
     Result _expr;
     QString _property;
     UiMember _uiMember;
-    V4IR::Module *_module;
-    V4IR::Function *_function;
-    V4IR::BasicBlock *_block;
-    V4IR::BasicBlock *_exitBlock;
+    QV4::IR::Module *_module;
+    QV4::IR::Function *_function;
+    QV4::IR::BasicBlock *_block;
+    QV4::IR::BasicBlock *_exitBlock;
     unsigned _returnAddress;
     Environment *_env;
     Loop *_loop;
@@ -458,7 +458,7 @@ protected:
     ScopeAndFinally *_scopeAndFinally;
     QHash<AST::Node *, Environment *> _envMap;
     QHash<AST::FunctionExpression *, int> _functionMap;
-    QStack<V4IR::BasicBlock *> _exceptionHandlers;
+    QStack<QV4::IR::BasicBlock *> _exceptionHandlers;
     bool _strictMode;
 
     bool _fileNameIsUrl;
index aa8db06fd535df997783f8ff0c40ec0fd09e148e..acedcc05f7431cf275e8ad084ff49177460d351a 100644 (file)
@@ -80,11 +80,11 @@ QV4::Function *CompilationUnit::linkToEngine(ExecutionEngine *engine)
         const CompiledData::RegExp *re = data->regexpAt(i);
         int flags = 0;
         if (re->flags & CompiledData::RegExp::RegExp_Global)
-            flags |= QQmlJS::V4IR::RegExp::RegExp_Global;
+            flags |= IR::RegExp::RegExp_Global;
         if (re->flags & CompiledData::RegExp::RegExp_IgnoreCase)
-            flags |= QQmlJS::V4IR::RegExp::RegExp_IgnoreCase;
+            flags |= IR::RegExp::RegExp_IgnoreCase;
         if (re->flags & CompiledData::RegExp::RegExp_Multiline)
-            flags |= QQmlJS::V4IR::RegExp::RegExp_Multiline;
+            flags |= IR::RegExp::RegExp_Multiline;
         runtimeRegularExpressions[i] = engine->newRegExpObject(data->stringAt(re->stringIndex), flags);
     }
 
index 94ea4bdc9000959fbe6021ca6591fe5e77d7c11a..675282fb8c1de1d233e7036a9e188a9ef55e2943 100644 (file)
 
 QT_BEGIN_NAMESPACE
 
-namespace QQmlJS {
-namespace V4IR {
+namespace QV4 {
+namespace IR {
 struct Function;
 }
-}
-
-namespace QV4 {
 
 struct Function;
 struct ExecutionContext;
index bc47b815f2588c707f062678d194378117fef898..7be902f1c19c8452889fffab9c2fa3d2136ae3c6 100644 (file)
@@ -45,7 +45,7 @@
 #include <qv4engine_p.h>
 #include <private/qqmlpropertycache_p.h>
 
-QV4::Compiler::JSUnitGenerator::JSUnitGenerator(QQmlJS::V4IR::Module *module, int headerSize)
+QV4::Compiler::JSUnitGenerator::JSUnitGenerator(QV4::IR::Module *module, int headerSize)
     : irModule(module)
     , stringDataSize(0)
     , jsClassDataSize(0)
@@ -120,17 +120,17 @@ uint QV4::Compiler::JSUnitGenerator::registerGlobalGetterLookup(const QString &n
     return lookups.size() - 1;
 }
 
-int QV4::Compiler::JSUnitGenerator::registerRegExp(QQmlJS::V4IR::RegExp *regexp)
+int QV4::Compiler::JSUnitGenerator::registerRegExp(QV4::IR::RegExp *regexp)
 {
     CompiledData::RegExp re;
     re.stringIndex = registerString(*regexp->value);
 
     re.flags = 0;
-    if (regexp->flags & QQmlJS::V4IR::RegExp::RegExp_Global)
+    if (regexp->flags & QV4::IR::RegExp::RegExp_Global)
         re.flags |= CompiledData::RegExp::RegExp_Global;
-    if (regexp->flags & QQmlJS::V4IR::RegExp::RegExp_IgnoreCase)
+    if (regexp->flags & QV4::IR::RegExp::RegExp_IgnoreCase)
         re.flags |= CompiledData::RegExp::RegExp_IgnoreCase;
-    if (regexp->flags & QQmlJS::V4IR::RegExp::RegExp_Multiline)
+    if (regexp->flags & QV4::IR::RegExp::RegExp_Multiline)
         re.flags |= CompiledData::RegExp::RegExp_Multiline;
 
     regexps.append(re);
@@ -146,22 +146,22 @@ int QV4::Compiler::JSUnitGenerator::registerConstant(QV4::ReturnedValue v)
     return constants.size() - 1;
 }
 
-void QV4::Compiler::JSUnitGenerator::registerLineNumberMapping(QQmlJS::V4IR::Function *function, const QVector<uint> &mappings)
+void QV4::Compiler::JSUnitGenerator::registerLineNumberMapping(QV4::IR::Function *function, const QVector<uint> &mappings)
 {
     lineNumberMappingsPerFunction.insert(function, mappings);
 }
 
-int QV4::Compiler::JSUnitGenerator::registerJSClass(QQmlJS::V4IR::ExprList *args)
+int QV4::Compiler::JSUnitGenerator::registerJSClass(QV4::IR::ExprList *args)
 {
     // ### re-use existing class definitions.
 
     QList<CompiledData::JSClassMember> members;
 
-    QQmlJS::V4IR::ExprList *it = args;
+    QV4::IR::ExprList *it = args;
     while (it) {
         CompiledData::JSClassMember member;
 
-        QQmlJS::V4IR::Name *name = it->expr->asName();
+        QV4::IR::Name *name = it->expr->asName();
         it = it->next;
 
         const bool isData = it->expr->asConst()->value;
@@ -185,7 +185,7 @@ int QV4::Compiler::JSUnitGenerator::registerJSClass(QQmlJS::V4IR::ExprList *args
 QV4::CompiledData::Unit *QV4::Compiler::JSUnitGenerator::generateUnit(int *totalUnitSize)
 {
     registerString(irModule->fileName);
-    foreach (QQmlJS::V4IR::Function *f, irModule->functions) {
+    foreach (QV4::IR::Function *f, irModule->functions) {
         registerString(*f->name);
         for (int i = 0; i < f->formals.size(); ++i)
             registerString(*f->formals.at(i));
@@ -198,11 +198,11 @@ QV4::CompiledData::Unit *QV4::Compiler::JSUnitGenerator::generateUnit(int *total
 
     uint functionDataSize = 0;
     for (int i = 0; i < irModule->functions.size(); ++i) {
-        QQmlJS::V4IR::Function *f = irModule->functions.at(i);
+        QV4::IR::Function *f = irModule->functions.at(i);
         functionOffsets.insert(f, functionDataSize + unitSize + stringDataSize);
 
         int lineNumberMappingCount = 0;
-        QHash<QQmlJS::V4IR::Function *, QVector<uint> >::ConstIterator lineNumberMapping = lineNumberMappingsPerFunction.find(f);
+        QHash<QV4::IR::Function *, QVector<uint> >::ConstIterator lineNumberMapping = lineNumberMappingsPerFunction.find(f);
         if (lineNumberMapping != lineNumberMappingsPerFunction.constEnd())
             lineNumberMappingCount = lineNumberMapping->count() / 2;
 
@@ -263,7 +263,7 @@ QV4::CompiledData::Unit *QV4::Compiler::JSUnitGenerator::generateUnit(int *total
 
     char *f = data + unitSize + stringDataSize;
     for (int i = 0; i < irModule->functions.size(); ++i) {
-        QQmlJS::V4IR::Function *function = irModule->functions.at(i);
+        QV4::IR::Function *function = irModule->functions.at(i);
         if (function == irModule->rootFunction)
             unit->indexOfRootFunction = i;
 
@@ -302,7 +302,7 @@ QV4::CompiledData::Unit *QV4::Compiler::JSUnitGenerator::generateUnit(int *total
     return unit;
 }
 
-int QV4::Compiler::JSUnitGenerator::writeFunction(char *f, int index, QQmlJS::V4IR::Function *irFunction)
+int QV4::Compiler::JSUnitGenerator::writeFunction(char *f, int index, QV4::IR::Function *irFunction)
 {
     QV4::CompiledData::Function *function = (QV4::CompiledData::Function *)f;
 
@@ -330,7 +330,7 @@ int QV4::Compiler::JSUnitGenerator::writeFunction(char *f, int index, QQmlJS::V4
     currentOffset += function->nLocals * sizeof(quint32);
 
     function->nLineNumberMappingEntries = 0;
-    QHash<QQmlJS::V4IR::Function *, QVector<uint> >::ConstIterator lineNumberMapping = lineNumberMappingsPerFunction.find(irFunction);
+    QHash<QV4::IR::Function *, QVector<uint> >::ConstIterator lineNumberMapping = lineNumberMappingsPerFunction.find(irFunction);
     if (lineNumberMapping != lineNumberMappingsPerFunction.constEnd()) {
         function->nLineNumberMappingEntries = lineNumberMapping->count() / 2;
     }
@@ -393,14 +393,14 @@ int QV4::Compiler::JSUnitGenerator::writeFunction(char *f, int index, QQmlJS::V4
         *writtenDeps++ = id;
 
     writtenDeps = (quint32 *)(f + function->dependingContextPropertiesOffset);
-    for (QQmlJS::V4IR::PropertyDependencyMap::ConstIterator property = irFunction->contextObjectPropertyDependencies.constBegin(), end = irFunction->contextObjectPropertyDependencies.constEnd();
+    for (QV4::IR::PropertyDependencyMap::ConstIterator property = irFunction->contextObjectPropertyDependencies.constBegin(), end = irFunction->contextObjectPropertyDependencies.constEnd();
          property != end; ++property) {
         *writtenDeps++ = property.key(); // property index
         *writtenDeps++ = property.value(); // notify index
     }
 
     writtenDeps = (quint32 *)(f + function->dependingScopePropertiesOffset);
-    for (QQmlJS::V4IR::PropertyDependencyMap::ConstIterator property = irFunction->scopeObjectPropertyDependencies.constBegin(), end = irFunction->scopeObjectPropertyDependencies.constEnd();
+    for (QV4::IR::PropertyDependencyMap::ConstIterator property = irFunction->scopeObjectPropertyDependencies.constBegin(), end = irFunction->scopeObjectPropertyDependencies.constEnd();
          property != end; ++property) {
         *writtenDeps++ = property.key(); // property index
         *writtenDeps++ = property.value(); // notify index
index 6baefae7b7b356de3af70c01b72049a6134d2042..29cf82e2bc96529abb677debd3fc427fb1c16cb5 100644 (file)
@@ -60,9 +60,9 @@ struct JSClassMember;
 namespace Compiler {
 
 struct Q_QML_EXPORT JSUnitGenerator {
-    JSUnitGenerator(QQmlJS::V4IR::Module *module, int headerSize = -1);
+    JSUnitGenerator(IR::Module *module, int headerSize = -1);
 
-    QQmlJS::V4IR::Module *irModule;
+    IR::Module *irModule;
 
     int registerString(const QString &str);
     int getStringId(const QString &string) const;
@@ -73,26 +73,26 @@ struct Q_QML_EXPORT JSUnitGenerator {
     uint registerIndexedGetterLookup();
     uint registerIndexedSetterLookup();
 
-    int registerRegExp(QQmlJS::V4IR::RegExp *regexp);
+    int registerRegExp(IR::RegExp *regexp);
 
     int registerConstant(ReturnedValue v);
 
-    void registerLineNumberMapping(QQmlJS::V4IR::Function *function, const QVector<uint> &mappings);
+    void registerLineNumberMapping(IR::Function *function, const QVector<uint> &mappings);
 
-    int registerJSClass(QQmlJS::V4IR::ExprList *args);
+    int registerJSClass(IR::ExprList *args);
 
     QV4::CompiledData::Unit *generateUnit(int *totalUnitSize = 0);
     // Returns bytes written
-    int writeFunction(char *f, int index, QQmlJS::V4IR::Function *irFunction);
+    int writeFunction(char *f, int index, IR::Function *irFunction);
 
     QHash<QString, int> stringToId;
     QStringList strings;
     uint stringDataSize;
-    QHash<QQmlJS::V4IR::Function *, uint> functionOffsets;
+    QHash<IR::Function *, uint> functionOffsets;
     QList<CompiledData::Lookup> lookups;
     QVector<CompiledData::RegExp> regexps;
     QVector<ReturnedValue> constants;
-    QHash<QQmlJS::V4IR::Function *, QVector<uint> > lineNumberMappingsPerFunction;
+    QHash<IR::Function *, QVector<uint> > lineNumberMappingsPerFunction;
     QList<QList<CompiledData::JSClassMember> > jsClasses;
     uint jsClassDataSize;
     uint headerSize;
index ec68ede72df40f3591f9d78383902c01cdae9adc..5a36a969c0fb0b75c861f17facf099e9d8e21bf1 100644 (file)
@@ -41,8 +41,8 @@
 
 #include "qv4instr_moth_p.h"
 
-using namespace QQmlJS;
-using namespace QQmlJS::Moth;
+using namespace QV4;
+using namespace QV4::Moth;
 
 int Instr::size(Type type)
 {
index 89fcafe921253f46f3fb971405acd836e7762595..bca878d648f20f648fdef04bf17eefafccb6ddcc 100644 (file)
@@ -143,7 +143,7 @@ QT_BEGIN_NAMESPACE
 #  define MOTH_THREADED_INTERPRETER
 #endif
 
-#define MOTH_INSTR_ALIGN_MASK (Q_ALIGNOF(QQmlJS::Moth::Instr) - 1)
+#define MOTH_INSTR_ALIGN_MASK (Q_ALIGNOF(QV4::Moth::Instr) - 1)
 
 #ifdef MOTH_THREADED_INTERPRETER
 #  define MOTH_INSTR_HEADER void *code;
@@ -152,10 +152,10 @@ QT_BEGIN_NAMESPACE
 #endif
 
 #define MOTH_INSTR_ENUM(I, FMT)  I,
-#define MOTH_INSTR_SIZE(I, FMT) ((sizeof(QQmlJS::Moth::Instr::instr_##FMT) + MOTH_INSTR_ALIGN_MASK) & ~MOTH_INSTR_ALIGN_MASK)
+#define MOTH_INSTR_SIZE(I, FMT) ((sizeof(QV4::Moth::Instr::instr_##FMT) + MOTH_INSTR_ALIGN_MASK) & ~MOTH_INSTR_ALIGN_MASK)
 
 
-namespace QQmlJS {
+namespace QV4 {
 namespace Moth {
 
 struct Param {
@@ -839,7 +839,7 @@ class InstrData : public InstrMeta<InstrType>::DataType
 };
 
 } // namespace Moth
-} // namespace QQmlJS
+} // namespace QV4
 
 QT_END_NAMESPACE
 
index 130725f3ed021bd55c1870d9c8b1c56d390d1fdf..ba4f2331a1f62cb81e371976affe5142501d4393 100644 (file)
 
 #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();
index 41f839600fde019008b3c05ed731598fe6715adc..e2ba971e2602ad69b618ed033b4f431662463dc2 100644 (file)
@@ -51,7 +51,7 @@
 
 QT_BEGIN_NAMESPACE
 
-namespace QQmlJS {
+namespace QV4 {
 namespace Moth {
 
 struct CompilationUnit : public QV4::CompiledData::CompilationUnit
@@ -64,11 +64,11 @@ struct CompilationUnit : public QV4::CompiledData::CompilationUnit
 };
 
 class Q_QML_EXPORT InstructionSelection:
-        public V4IR::IRDecoder,
+        public IR::IRDecoder,
         public EvalInstructionSelection
 {
 public:
-    InstructionSelection(QQmlEnginePrivate *qmlEngine, QV4::ExecutableAllocator *execAllocator, V4IR::Module *module, QV4::Compiler::JSUnitGenerator *jsGenerator);
+    InstructionSelection(QQmlEnginePrivate *qmlEngine, QV4::ExecutableAllocator *execAllocator, IR::Module *module, QV4::Compiler::JSUnitGenerator *jsGenerator);
     ~InstructionSelection();
 
     virtual void run(int functionIndex);
@@ -76,66 +76,66 @@ public:
 protected:
     virtual QV4::CompiledData::CompilationUnit *backendCompileStep();
 
-    virtual void visitJump(V4IR::Jump *);
-    virtual void visitCJump(V4IR::CJump *);
-    virtual void visitRet(V4IR::Ret *);
-
-    virtual void callBuiltinInvalid(V4IR::Name *func, V4IR::ExprList *args, V4IR::Temp *result);
-    virtual void callBuiltinTypeofMember(V4IR::Expr *base, const QString &name, V4IR::Temp *result);
-    virtual void callBuiltinTypeofSubscript(V4IR::Expr *base, V4IR::Expr *index, V4IR::Temp *result);
-    virtual void callBuiltinTypeofName(const QString &name, V4IR::Temp *result);
-    virtual void callBuiltinTypeofValue(V4IR::Expr *value, V4IR::Temp *result);
-    virtual void callBuiltinDeleteMember(V4IR::Temp *base, const QString &name, V4IR::Temp *result);
-    virtual void callBuiltinDeleteSubscript(V4IR::Temp *base, V4IR::Expr *index, V4IR::Temp *result);
-    virtual void callBuiltinDeleteName(const QString &name, V4IR::Temp *result);
-    virtual void callBuiltinDeleteValue(V4IR::Temp *result);
-    virtual void callBuiltinThrow(V4IR::Expr *arg);
+    virtual void visitJump(IR::Jump *);
+    virtual void visitCJump(IR::CJump *);
+    virtual void visitRet(IR::Ret *);
+
+    virtual void callBuiltinInvalid(IR::Name *func, IR::ExprList *args, IR::Temp *result);
+    virtual void callBuiltinTypeofMember(IR::Expr *base, const QString &name, IR::Temp *result);
+    virtual void callBuiltinTypeofSubscript(IR::Expr *base, IR::Expr *index, IR::Temp *result);
+    virtual void callBuiltinTypeofName(const QString &name, IR::Temp *result);
+    virtual void callBuiltinTypeofValue(IR::Expr *value, IR::Temp *result);
+    virtual void callBuiltinDeleteMember(IR::Temp *base, const QString &name, IR::Temp *result);
+    virtual void callBuiltinDeleteSubscript(IR::Temp *base, IR::Expr *index, IR::Temp *result);
+    virtual void callBuiltinDeleteName(const QString &name, IR::Temp *result);
+    virtual void callBuiltinDeleteValue(IR::Temp *result);
+    virtual void callBuiltinThrow(IR::Expr *arg);
     virtual void callBuiltinReThrow();
-    virtual void callBuiltinUnwindException(V4IR::Temp *);
+    virtual void callBuiltinUnwindException(IR::Temp *);
     virtual void callBuiltinPushCatchScope(const QString &exceptionName);
-    virtual void callBuiltinForeachIteratorObject(V4IR::Temp *arg, V4IR::Temp *result);
-    virtual void callBuiltinForeachNextPropertyname(V4IR::Temp *arg, V4IR::Temp *result);
-    virtual void callBuiltinPushWithScope(V4IR::Temp *arg);
+    virtual void callBuiltinForeachIteratorObject(IR::Temp *arg, IR::Temp *result);
+    virtual void callBuiltinForeachNextPropertyname(IR::Temp *arg, IR::Temp *result);
+    virtual void callBuiltinPushWithScope(IR::Temp *arg);
     virtual void callBuiltinPopScope();
     virtual void callBuiltinDeclareVar(bool deletable, const QString &name);
-    virtual void callBuiltinDefineGetterSetter(V4IR::Temp *object, const QString &name, V4IR::Temp *getter, V4IR::Temp *setter);
-    virtual void callBuiltinDefineProperty(V4IR::Temp *object, const QString &name, V4IR::Expr *value);
-    virtual void callBuiltinDefineArray(V4IR::Temp *result, V4IR::ExprList *args);
-    virtual void callBuiltinDefineObjectLiteral(V4IR::Temp *result, V4IR::ExprList *args);
-    virtual void callBuiltinSetupArgumentObject(V4IR::Temp *result);
+    virtual void callBuiltinDefineGetterSetter(IR::Temp *object, const QString &name, IR::Temp *getter, IR::Temp *setter);
+    virtual void callBuiltinDefineProperty(IR::Temp *object, const QString &name, IR::Expr *value);
+    virtual void callBuiltinDefineArray(IR::Temp *result, IR::ExprList *args);
+    virtual void callBuiltinDefineObjectLiteral(IR::Temp *result, IR::ExprList *args);
+    virtual void callBuiltinSetupArgumentObject(IR::Temp *result);
     virtual void callBuiltinConvertThisToObject();
-    virtual void callValue(V4IR::Temp *value, V4IR::ExprList *args, V4IR::Temp *result);
-    virtual void callProperty(V4IR::Expr *base, const QString &name, V4IR::ExprList *args, V4IR::Temp *result);
-    virtual void callSubscript(V4IR::Expr *base, V4IR::Expr *index, V4IR::ExprList *args, V4IR::Temp *result);
-    virtual void convertType(V4IR::Temp *source, V4IR::Temp *target);
-    virtual void constructActivationProperty(V4IR::Name *func, V4IR::ExprList *args, V4IR::Temp *result);
-    virtual void constructProperty(V4IR::Temp *base, const QString &name, V4IR::ExprList *args, V4IR::Temp *result);
-    virtual void constructValue(V4IR::Temp *value, V4IR::ExprList *args, V4IR::Temp *result);
-    virtual void loadThisObject(V4IR::Temp *temp);
-    virtual void loadQmlIdArray(V4IR::Temp *temp);
-    virtual void loadQmlImportedScripts(V4IR::Temp *temp);
-    virtual void loadQmlContextObject(V4IR::Temp *temp);
-    virtual void loadQmlScopeObject(V4IR::Temp *temp);
-    virtual void loadQmlSingleton(const QString &name, V4IR::Temp *temp);
-    virtual void loadConst(V4IR::Const *sourceConst, V4IR::Temp *targetTemp);
-    virtual void loadString(const QString &str, V4IR::Temp *targetTemp);
-    virtual void loadRegexp(V4IR::RegExp *sourceRegexp, V4IR::Temp *targetTemp);
-    virtual void getActivationProperty(const V4IR::Name *name, V4IR::Temp *temp);
-    virtual void setActivationProperty(V4IR::Expr *source, const QString &targetName);
-    virtual void initClosure(V4IR::Closure *closure, V4IR::Temp *target);
-    virtual void getProperty(V4IR::Expr *base, const QString &name, V4IR::Temp *target);
-    virtual void setProperty(V4IR::Expr *source, V4IR::Expr *targetBase, const QString &targetName);
-    virtual void setQObjectProperty(V4IR::Expr *source, V4IR::Expr *targetBase, int propertyIndex);
-    virtual void getQObjectProperty(V4IR::Expr *base, int propertyIndex, bool captureRequired, int attachedPropertiesId, V4IR::Temp *target);
-    virtual void getElement(V4IR::Expr *base, V4IR::Expr *index, V4IR::Temp *target);
-    virtual void setElement(V4IR::Expr *source, V4IR::Expr *targetBase, V4IR::Expr *targetIndex);
-    virtual void copyValue(V4IR::Temp *sourceTemp, V4IR::Temp *targetTemp);
-    virtual void swapValues(V4IR::Temp *sourceTemp, V4IR::Temp *targetTemp);
-    virtual void unop(V4IR::AluOp oper, V4IR::Temp *sourceTemp, V4IR::Temp *targetTemp);
-    virtual void binop(V4IR::AluOp oper, V4IR::Expr *leftSource, V4IR::Expr *rightSource, V4IR::Temp *target);
+    virtual void callValue(IR::Temp *value, IR::ExprList *args, IR::Temp *result);
+    virtual void callProperty(IR::Expr *base, const QString &name, IR::ExprList *args, IR::Temp *result);
+    virtual void callSubscript(IR::Expr *base, IR::Expr *index, IR::ExprList *args, IR::Temp *result);
+    virtual void convertType(IR::Temp *source, IR::Temp *target);
+    virtual void constructActivationProperty(IR::Name *func, IR::ExprList *args, IR::Temp *result);
+    virtual void constructProperty(IR::Temp *base, const QString &name, IR::ExprList *args, IR::Temp *result);
+    virtual void constructValue(IR::Temp *value, IR::ExprList *args, IR::Temp *result);
+    virtual void loadThisObject(IR::Temp *temp);
+    virtual void loadQmlIdArray(IR::Temp *temp);
+    virtual void loadQmlImportedScripts(IR::Temp *temp);
+    virtual void loadQmlContextObject(IR::Temp *temp);
+    virtual void loadQmlScopeObject(IR::Temp *temp);
+    virtual void loadQmlSingleton(const QString &name, IR::Temp *temp);
+    virtual void loadConst(IR::Const *sourceConst, IR::Temp *targetTemp);
+    virtual void loadString(const QString &str, IR::Temp *targetTemp);
+    virtual void loadRegexp(IR::RegExp *sourceRegexp, IR::Temp *targetTemp);
+    virtual void getActivationProperty(const IR::Name *name, IR::Temp *temp);
+    virtual void setActivationProperty(IR::Expr *source, const QString &targetName);
+    virtual void initClosure(IR::Closure *closure, IR::Temp *target);
+    virtual void getProperty(IR::Expr *base, const QString &name, IR::Temp *target);
+    virtual void setProperty(IR::Expr *source, IR::Expr *targetBase, const QString &targetName);
+    virtual void setQObjectProperty(IR::Expr *source, IR::Expr *targetBase, int propertyIndex);
+    virtual void getQObjectProperty(IR::Expr *base, int propertyIndex, bool captureRequired, int attachedPropertiesId, IR::Temp *target);
+    virtual void getElement(IR::Expr *base, IR::Expr *index, IR::Temp *target);
+    virtual void setElement(IR::Expr *source, IR::Expr *targetBase, IR::Expr *targetIndex);
+    virtual void copyValue(IR::Temp *sourceTemp, IR::Temp *targetTemp);
+    virtual void swapValues(IR::Temp *sourceTemp, IR::Temp *targetTemp);
+    virtual void unop(IR::AluOp oper, IR::Temp *sourceTemp, IR::Temp *targetTemp);
+    virtual void binop(IR::AluOp oper, IR::Expr *leftSource, IR::Expr *rightSource, IR::Temp *target);
 
 private:
-    Param binopHelper(V4IR::AluOp oper, V4IR::Expr *leftSource, V4IR::Expr *rightSource, V4IR::Temp *target);
+    Param binopHelper(IR::AluOp oper, IR::Expr *leftSource, IR::Expr *rightSource, IR::Temp *target);
 
     struct Instruction {
 #define MOTH_INSTR_DATA_TYPEDEF(I, FMT) typedef InstrData<Instr::I> I;
@@ -145,9 +145,9 @@ private:
         Instruction();
     };
 
-    Param getParam(V4IR::Expr *e);
+    Param getParam(IR::Expr *e);
 
-    Param getResultParam(V4IR::Temp *result)
+    Param getResultParam(IR::Temp *result)
     {
         if (result)
             return getParam(result);
@@ -155,8 +155,8 @@ private:
             return Param::createTemp(scratchTempIndex());
     }
 
-    void simpleMove(V4IR::Move *);
-    void prepareCallArgs(V4IR::ExprList *, quint32 &, quint32 * = 0);
+    void simpleMove(IR::Move *);
+    void prepareCallArgs(IR::ExprList *, quint32 &, quint32 * = 0);
 
     int scratchTempIndex() const { return _function->tempCount; }
     int callDataStart() const { return scratchTempIndex() + 1; }
@@ -171,28 +171,28 @@ private:
 
     QQmlEnginePrivate *qmlEngine;
 
-    V4IR::BasicBlock *_block;
-    V4IR::BasicBlock *_nextBlock;
+    IR::BasicBlock *_block;
+    IR::BasicBlock *_nextBlock;
 
-    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;
 
     uchar *_codeStart;
     uchar *_codeNext;
     uchar *_codeEnd;
 
-    QSet<V4IR::Jump *> _removableJumps;
-    V4IR::Stmt *_currentStatement;
+    QSet<IR::Jump *> _removableJumps;
+    IR::Stmt *_currentStatement;
 
     CompilationUnit *compilationUnit;
-    QHash<V4IR::Function *, QByteArray> codeRefs;
+    QHash<IR::Function *, QByteArray> codeRefs;
 };
 
 class Q_QML_EXPORT ISelFactory: public EvalISelFactory
 {
 public:
     virtual ~ISelFactory() {}
-    virtual EvalInstructionSelection *create(QQmlEnginePrivate *qmlEngine, QV4::ExecutableAllocator *execAllocator, V4IR::Module *module, QV4::Compiler::JSUnitGenerator *jsGenerator)
+    virtual EvalInstructionSelection *create(QQmlEnginePrivate *qmlEngine, QV4::ExecutableAllocator *execAllocator, IR::Module *module, QV4::Compiler::JSUnitGenerator *jsGenerator)
     { return new InstructionSelection(qmlEngine, execAllocator, module, jsGenerator); }
     virtual bool jitCompileRegexps() const
     { return false; }
@@ -207,7 +207,7 @@ ptrdiff_t InstructionSelection::addInstruction(const InstrData<InstrT> &data)
 }
 
 } // namespace Moth
-} // namespace QQmlJS
+} // namespace QV4
 
 QT_END_NAMESPACE
 
index 644e06b59a5ea198868ba94ddfbebf882758852e..4c70c1ddd8bbb2ae191eee35b03926e61e31c6e9 100644 (file)
@@ -57,8 +57,8 @@ Q_GLOBAL_STATIC_WITH_ARGS(QTextStream, qout, (stderr, QIODevice::WriteOnly));
 #define qout *qout()
 } // anonymous namespace
 
-using namespace QQmlJS;
-using namespace QQmlJS::V4IR;
+using namespace QV4;
+using namespace QV4::IR;
 
 EvalInstructionSelection::EvalInstructionSelection(QV4::ExecutableAllocator *execAllocator, Module *module, QV4::Compiler::JSUnitGenerator *jsGenerator)
     : useFastLookups(true)
@@ -93,71 +93,71 @@ QV4::CompiledData::CompilationUnit *EvalInstructionSelection::compile(bool gener
     return unit;
 }
 
-void IRDecoder::visitMove(V4IR::Move *s)
+void IRDecoder::visitMove(IR::Move *s)
 {
-    if (V4IR::Name *n = s->target->asName()) {
+    if (IR::Name *n = s->target->asName()) {
         if (s->source->asTemp() || s->source->asConst()) {
             setActivationProperty(s->source, *n->id);
             return;
         }
-    } else if (V4IR::Temp *t = s->target->asTemp()) {
-        if (V4IR::Name *n = s->source->asName()) {
+    } else if (IR::Temp *t = s->target->asTemp()) {
+        if (IR::Name *n = s->source->asName()) {
             if (n->id && *n->id == QStringLiteral("this")) // TODO: `this' should be a builtin.
                 loadThisObject(t);
-            else if (n->builtin == V4IR::Name::builtin_qml_id_array)
+            else if (n->builtin == IR::Name::builtin_qml_id_array)
                 loadQmlIdArray(t);
-            else if (n->builtin == V4IR::Name::builtin_qml_context_object)
+            else if (n->builtin == IR::Name::builtin_qml_context_object)
                 loadQmlContextObject(t);
-            else if (n->builtin == V4IR::Name::builtin_qml_scope_object)
+            else if (n->builtin == IR::Name::builtin_qml_scope_object)
                 loadQmlScopeObject(t);
-            else if (n->builtin == V4IR::Name::builtin_qml_imported_scripts_object)
+            else if (n->builtin == IR::Name::builtin_qml_imported_scripts_object)
                 loadQmlImportedScripts(t);
             else if (n->qmlSingleton)
                 loadQmlSingleton(*n->id, t);
             else
                 getActivationProperty(n, t);
             return;
-        } else if (V4IR::Const *c = s->source->asConst()) {
+        } else if (IR::Const *c = s->source->asConst()) {
             loadConst(c, t);
             return;
-        } else if (V4IR::Temp *t2 = s->source->asTemp()) {
+        } else if (IR::Temp *t2 = s->source->asTemp()) {
             if (s->swap)
                 swapValues(t2, t);
             else
                 copyValue(t2, t);
             return;
-        } else if (V4IR::String *str = s->source->asString()) {
+        } else if (IR::String *str = s->source->asString()) {
             loadString(*str->value, t);
             return;
-        } else if (V4IR::RegExp *re = s->source->asRegExp()) {
+        } else if (IR::RegExp *re = s->source->asRegExp()) {
             loadRegexp(re, t);
             return;
-        } else if (V4IR::Closure *clos = s->source->asClosure()) {
+        } else if (IR::Closure *clos = s->source->asClosure()) {
             initClosure(clos, t);
             return;
-        } else if (V4IR::New *ctor = s->source->asNew()) {
+        } else if (IR::New *ctor = s->source->asNew()) {
             if (Name *func = ctor->base->asName()) {
                 constructActivationProperty(func, ctor->args, t);
                 return;
-            } else if (V4IR::Member *member = ctor->base->asMember()) {
+            } else if (IR::Member *member = ctor->base->asMember()) {
                 constructProperty(member->base->asTemp(), *member->name, ctor->args, t);
                 return;
-            } else if (V4IR::Temp *value = ctor->base->asTemp()) {
+            } else if (IR::Temp *value = ctor->base->asTemp()) {
                 constructValue(value, ctor->args, t);
                 return;
             }
-        } else if (V4IR::Member *m = s->source->asMember()) {
+        } else if (IR::Member *m = s->source->asMember()) {
             if (m->property) {
                 bool captureRequired = true;
 
-                Q_ASSERT(m->kind != V4IR::Member::MemberOfEnum);
+                Q_ASSERT(m->kind != IR::Member::MemberOfEnum);
                 const int attachedPropertiesId = m->attachedPropertiesIdOrEnumValue;
 
                 if (_function && attachedPropertiesId == 0 && !m->property->isConstant()) {
-                    if (m->kind == V4IR::Member::MemberOfQmlContextObject) {
+                    if (m->kind == IR::Member::MemberOfQmlContextObject) {
                         _function->contextObjectPropertyDependencies.insert(m->property->coreIndex, m->property->notifyIndex);
                         captureRequired = false;
-                    } else if (m->kind == V4IR::Member::MemberOfQmlScopeObject) {
+                    } else if (m->kind == IR::Member::MemberOfQmlScopeObject) {
                         _function->scopeObjectPropertyDependencies.insert(m->property->coreIndex, m->property->notifyIndex);
                         captureRequired = false;
                     }
@@ -168,18 +168,18 @@ void IRDecoder::visitMove(V4IR::Move *s)
                 getProperty(m->base, *m->name, t);
                 return;
             }
-        } else if (V4IR::Subscript *ss = s->source->asSubscript()) {
+        } else if (IR::Subscript *ss = s->source->asSubscript()) {
             getElement(ss->base->asTemp(), ss->index, t);
             return;
-        } else if (V4IR::Unop *u = s->source->asUnop()) {
-            if (V4IR::Temp *e = u->expr->asTemp()) {
+        } else if (IR::Unop *u = s->source->asUnop()) {
+            if (IR::Temp *e = u->expr->asTemp()) {
                 unop(u->op, e, t);
                 return;
             }
-        } else if (V4IR::Binop *b = s->source->asBinop()) {
+        } else if (IR::Binop *b = s->source->asBinop()) {
             binop(b->op, b->left, b->right, t);
             return;
-        } else if (V4IR::Call *c = s->source->asCall()) {
+        } else if (IR::Call *c = s->source->asCall()) {
             if (c->base->asName()) {
                 callBuiltin(c, t);
                 return;
@@ -189,19 +189,19 @@ void IRDecoder::visitMove(V4IR::Move *s)
             } else if (Subscript *ss = c->base->asSubscript()) {
                 callSubscript(ss->base, ss->index, c->args, t);
                 return;
-            } else if (V4IR::Temp *value = c->base->asTemp()) {
+            } else if (IR::Temp *value = c->base->asTemp()) {
                 callValue(value, c->args, t);
                 return;
             }
-        } else if (V4IR::Convert *c = s->source->asConvert()) {
+        } else if (IR::Convert *c = s->source->asConvert()) {
             Q_ASSERT(c->expr->asTemp());
             convertType(c->expr->asTemp(), t);
             return;
         }
-    } else if (V4IR::Member *m = s->target->asMember()) {
+    } else if (IR::Member *m = s->target->asMember()) {
         if (m->base->asTemp() || m->base->asConst()) {
             if (s->source->asTemp() || s->source->asConst()) {
-                Q_ASSERT(m->kind != V4IR::Member::MemberOfEnum);
+                Q_ASSERT(m->kind != IR::Member::MemberOfEnum);
                 const int attachedPropertiesId = m->attachedPropertiesIdOrEnumValue;
                 if (m->property && attachedPropertiesId == 0) {
                     setQObjectProperty(s->source, m->base, m->property->coreIndex);
@@ -212,7 +212,7 @@ void IRDecoder::visitMove(V4IR::Move *s)
                 }
             }
         }
-    } else if (V4IR::Subscript *ss = s->target->asSubscript()) {
+    } else if (IR::Subscript *ss = s->target->asSubscript()) {
         if (s->source->asTemp() || s->source->asConst()) {
             setElement(s->source, ss->base, ss->index);
             return;
@@ -221,7 +221,7 @@ void IRDecoder::visitMove(V4IR::Move *s)
 
     // For anything else...:
     Q_UNIMPLEMENTED();
-    s->dump(qout, V4IR::Stmt::MIR);
+    s->dump(qout, IR::Stmt::MIR);
     qout << endl;
     assert(!"TODO");
 }
@@ -230,9 +230,9 @@ IRDecoder::~IRDecoder()
 {
 }
 
-void IRDecoder::visitExp(V4IR::Exp *s)
+void IRDecoder::visitExp(IR::Exp *s)
 {
-    if (V4IR::Call *c = s->expr->asCall()) {
+    if (IR::Call *c = s->expr->asCall()) {
         // These are calls where the result is ignored.
         if (c->base->asName()) {
             callBuiltin(c, 0);
@@ -251,24 +251,24 @@ void IRDecoder::visitExp(V4IR::Exp *s)
     }
 }
 
-void IRDecoder::callBuiltin(V4IR::Call *call, V4IR::Temp *result)
+void IRDecoder::callBuiltin(IR::Call *call, IR::Temp *result)
 {
-    V4IR::Name *baseName = call->base->asName();
+    IR::Name *baseName = call->base->asName();
     assert(baseName != 0);
 
     switch (baseName->builtin) {
-    case V4IR::Name::builtin_invalid:
+    case IR::Name::builtin_invalid:
         callBuiltinInvalid(baseName, call->args, result);
         return;
 
-    case V4IR::Name::builtin_typeof: {
-        if (V4IR::Member *m = call->args->expr->asMember()) {
+    case IR::Name::builtin_typeof: {
+        if (IR::Member *m = call->args->expr->asMember()) {
             callBuiltinTypeofMember(m->base, *m->name, result);
             return;
-        } else if (V4IR::Subscript *ss = call->args->expr->asSubscript()) {
+        } else if (IR::Subscript *ss = call->args->expr->asSubscript()) {
             callBuiltinTypeofSubscript(ss->base, ss->index, result);
             return;
-        } else if (V4IR::Name *n = call->args->expr->asName()) {
+        } else if (IR::Name *n = call->args->expr->asName()) {
             callBuiltinTypeofName(*n->id, result);
             return;
         } else if (call->args->expr->asTemp() || call->args->expr->asConst()){
@@ -277,14 +277,14 @@ void IRDecoder::callBuiltin(V4IR::Call *call, V4IR::Temp *result)
         }
     } break;
 
-    case V4IR::Name::builtin_delete: {
-        if (V4IR::Member *m = call->args->expr->asMember()) {
+    case IR::Name::builtin_delete: {
+        if (IR::Member *m = call->args->expr->asMember()) {
             callBuiltinDeleteMember(m->base->asTemp(), *m->name, result);
             return;
-        } else if (V4IR::Subscript *ss = call->args->expr->asSubscript()) {
+        } else if (IR::Subscript *ss = call->args->expr->asSubscript()) {
             callBuiltinDeleteSubscript(ss->base->asTemp(), ss->index, result);
             return;
-        } else if (V4IR::Name *n = call->args->expr->asName()) {
+        } else if (IR::Name *n = call->args->expr->asName()) {
             callBuiltinDeleteName(*n->id, result);
             return;
         } else if (call->args->expr->asTemp()){
@@ -294,107 +294,107 @@ void IRDecoder::callBuiltin(V4IR::Call *call, V4IR::Temp *result)
         }
     } break;
 
-    case V4IR::Name::builtin_throw: {
-        V4IR::Expr *arg = call->args->expr;
+    case IR::Name::builtin_throw: {
+        IR::Expr *arg = call->args->expr;
         assert(arg->asTemp() || arg->asConst());
         callBuiltinThrow(arg);
     } return;
 
-    case V4IR::Name::builtin_rethrow: {
+    case IR::Name::builtin_rethrow: {
         callBuiltinReThrow();
     } return;
 
-    case V4IR::Name::builtin_unwind_exception: {
+    case IR::Name::builtin_unwind_exception: {
         callBuiltinUnwindException(result);
     } return;
 
-    case V4IR::Name::builtin_push_catch_scope: {
-        V4IR::String *s = call->args->expr->asString();
+    case IR::Name::builtin_push_catch_scope: {
+        IR::String *s = call->args->expr->asString();
         Q_ASSERT(s);
         callBuiltinPushCatchScope(*s->value);
     } return;
 
-    case V4IR::Name::builtin_foreach_iterator_object: {
-        V4IR::Temp *arg = call->args->expr->asTemp();
+    case IR::Name::builtin_foreach_iterator_object: {
+        IR::Temp *arg = call->args->expr->asTemp();
         assert(arg != 0);
         callBuiltinForeachIteratorObject(arg, result);
     } return;
 
-    case V4IR::Name::builtin_foreach_next_property_name: {
-        V4IR::Temp *arg = call->args->expr->asTemp();
+    case IR::Name::builtin_foreach_next_property_name: {
+        IR::Temp *arg = call->args->expr->asTemp();
         assert(arg != 0);
         callBuiltinForeachNextPropertyname(arg, result);
     } return;
-    case V4IR::Name::builtin_push_with_scope: {
-        V4IR::Temp *arg = call->args->expr->asTemp();
+    case IR::Name::builtin_push_with_scope: {
+        IR::Temp *arg = call->args->expr->asTemp();
         assert(arg != 0);
         callBuiltinPushWithScope(arg);
     } return;
 
-    case V4IR::Name::builtin_pop_scope:
+    case IR::Name::builtin_pop_scope:
         callBuiltinPopScope();
         return;
 
-    case V4IR::Name::builtin_declare_vars: {
+    case IR::Name::builtin_declare_vars: {
         if (!call->args)
             return;
-        V4IR::Const *deletable = call->args->expr->asConst();
-        assert(deletable->type == V4IR::BoolType);
-        for (V4IR::ExprList *it = call->args->next; it; it = it->next) {
-            V4IR::Name *arg = it->expr->asName();
+        IR::Const *deletable = call->args->expr->asConst();
+        assert(deletable->type == IR::BoolType);
+        for (IR::ExprList *it = call->args->next; it; it = it->next) {
+            IR::Name *arg = it->expr->asName();
             assert(arg != 0);
             callBuiltinDeclareVar(deletable->value != 0, *arg->id);
         }
     } return;
 
-    case V4IR::Name::builtin_define_getter_setter: {
+    case IR::Name::builtin_define_getter_setter: {
         if (!call->args)
             return;
-        V4IR::ExprList *args = call->args;
-        V4IR::Temp *object = args->expr->asTemp();
+        IR::ExprList *args = call->args;
+        IR::Temp *object = args->expr->asTemp();
         assert(object);
         args = args->next;
         assert(args);
-        V4IR::Name *name = args->expr->asName();
+        IR::Name *name = args->expr->asName();
         args = args->next;
         assert(args);
-        V4IR::Temp *getter = args->expr->asTemp();
+        IR::Temp *getter = args->expr->asTemp();
         args = args->next;
         assert(args);
-        V4IR::Temp *setter = args->expr->asTemp();
+        IR::Temp *setter = args->expr->asTemp();
 
         callBuiltinDefineGetterSetter(object, *name->id, getter, setter);
     } return;
 
-    case V4IR::Name::builtin_define_property: {
+    case IR::Name::builtin_define_property: {
         if (!call->args)
             return;
-        V4IR::ExprList *args = call->args;
-        V4IR::Temp *object = args->expr->asTemp();
+        IR::ExprList *args = call->args;
+        IR::Temp *object = args->expr->asTemp();
         assert(object);
         args = args->next;
         assert(args);
-        V4IR::Name *name = args->expr->asName();
+        IR::Name *name = args->expr->asName();
         args = args->next;
         assert(args);
-        V4IR::Expr *value = args->expr;
+        IR::Expr *value = args->expr;
 
         callBuiltinDefineProperty(object, *name->id, value);
     } return;
 
-    case V4IR::Name::builtin_define_array:
+    case IR::Name::builtin_define_array:
         callBuiltinDefineArray(result, call->args);
         return;
 
-    case V4IR::Name::builtin_define_object_literal:
+    case IR::Name::builtin_define_object_literal:
         callBuiltinDefineObjectLiteral(result, call->args);
         return;
 
-    case V4IR::Name::builtin_setup_argument_object:
+    case IR::Name::builtin_setup_argument_object:
         callBuiltinSetupArgumentObject(result);
         return;
 
-    case V4IR::Name::builtin_convert_this_to_object:
+    case IR::Name::builtin_convert_this_to_object:
         callBuiltinConvertThisToObject();
         return;
 
index 57222672b93b3c817f0538360c8db68c4de5eb74..bfe0adc4311d8c3dc7f51270893b9d2a81a19395 100644 (file)
@@ -55,16 +55,14 @@ QT_BEGIN_NAMESPACE
 class QQmlEnginePrivate;
 
 namespace QV4 {
+
 class ExecutableAllocator;
 struct Function;
-}
-
-namespace QQmlJS {
 
 class Q_QML_EXPORT EvalInstructionSelection
 {
 public:
-    EvalInstructionSelection(QV4::ExecutableAllocator *execAllocator, V4IR::Module *module, QV4::Compiler::JSUnitGenerator *jsGenerator);
+    EvalInstructionSelection(QV4::ExecutableAllocator *execAllocator, IR::Module *module, QV4::Compiler::JSUnitGenerator *jsGenerator);
     virtual ~EvalInstructionSelection() = 0;
 
     QV4::CompiledData::CompilationUnit *compile(bool generateUnitData = true);
@@ -77,8 +75,8 @@ public:
     uint registerGetterLookup(const QString &name) { return jsGenerator->registerGetterLookup(name); }
     uint registerSetterLookup(const QString &name) { return jsGenerator->registerSetterLookup(name); }
     uint registerGlobalGetterLookup(const QString &name) { return jsGenerator->registerGlobalGetterLookup(name); }
-    int registerRegExp(QQmlJS::V4IR::RegExp *regexp) { return jsGenerator->registerRegExp(regexp); }
-    int registerJSClass(QQmlJS::V4IR::ExprList *args) { return jsGenerator->registerJSClass(args); }
+    int registerRegExp(IR::RegExp *regexp) { return jsGenerator->registerRegExp(regexp); }
+    int registerJSClass(IR::ExprList *args) { return jsGenerator->registerJSClass(args); }
     QV4::Compiler::JSUnitGenerator *jsUnitGenerator() const { return jsGenerator; }
 
 protected:
@@ -89,93 +87,93 @@ protected:
     QV4::ExecutableAllocator *executableAllocator;
     QV4::Compiler::JSUnitGenerator *jsGenerator;
     QScopedPointer<QV4::Compiler::JSUnitGenerator> ownJSGenerator;
-    V4IR::Module *irModule;
+    IR::Module *irModule;
 };
 
 class Q_QML_EXPORT EvalISelFactory
 {
 public:
     virtual ~EvalISelFactory() = 0;
-    virtual EvalInstructionSelection *create(QQmlEnginePrivate *qmlEngine, QV4::ExecutableAllocator *execAllocator, V4IR::Module *module, QV4::Compiler::JSUnitGenerator *jsGenerator) = 0;
+    virtual EvalInstructionSelection *create(QQmlEnginePrivate *qmlEngine, QV4::ExecutableAllocator *execAllocator, IR::Module *module, QV4::Compiler::JSUnitGenerator *jsGenerator) = 0;
     virtual bool jitCompileRegexps() const = 0;
 };
 
-namespace V4IR {
-class Q_QML_EXPORT IRDecoder: protected V4IR::StmtVisitor
+namespace IR {
+class Q_QML_EXPORT IRDecoder: protected IR::StmtVisitor
 {
 public:
     IRDecoder() : _function(0) {}
     virtual ~IRDecoder() = 0;
 
-    virtual void visitPhi(V4IR::Phi *) {}
+    virtual void visitPhi(IR::Phi *) {}
 
 public: // visitor methods for StmtVisitor:
-    virtual void visitMove(V4IR::Move *s);
-    virtual void visitExp(V4IR::Exp *s);
+    virtual void visitMove(IR::Move *s);
+    virtual void visitExp(IR::Exp *s);
 
 public: // to implement by subclasses:
-    virtual void callBuiltinInvalid(V4IR::Name *func, V4IR::ExprList *args, V4IR::Temp *result) = 0;
-    virtual void callBuiltinTypeofMember(V4IR::Expr *base, const QString &name, V4IR::Temp *result) = 0;
-    virtual void callBuiltinTypeofSubscript(V4IR::Expr *base, V4IR::Expr *index, V4IR::Temp *result) = 0;
-    virtual void callBuiltinTypeofName(const QString &name, V4IR::Temp *result) = 0;
-    virtual void callBuiltinTypeofValue(V4IR::Expr *value, V4IR::Temp *result) = 0;
-    virtual void callBuiltinDeleteMember(V4IR::Temp *base, const QString &name, V4IR::Temp *result) = 0;
-    virtual void callBuiltinDeleteSubscript(V4IR::Temp *base, V4IR::Expr *index, V4IR::Temp *result) = 0;
-    virtual void callBuiltinDeleteName(const QString &name, V4IR::Temp *result) = 0;
-    virtual void callBuiltinDeleteValue(V4IR::Temp *result) = 0;
-    virtual void callBuiltinThrow(V4IR::Expr *arg) = 0;
+    virtual void callBuiltinInvalid(IR::Name *func, IR::ExprList *args, IR::Temp *result) = 0;
+    virtual void callBuiltinTypeofMember(IR::Expr *base, const QString &name, IR::Temp *result) = 0;
+    virtual void callBuiltinTypeofSubscript(IR::Expr *base, IR::Expr *index, IR::Temp *result) = 0;
+    virtual void callBuiltinTypeofName(const QString &name, IR::Temp *result) = 0;
+    virtual void callBuiltinTypeofValue(IR::Expr *value, IR::Temp *result) = 0;
+    virtual void callBuiltinDeleteMember(IR::Temp *base, const QString &name, IR::Temp *result) = 0;
+    virtual void callBuiltinDeleteSubscript(IR::Temp *base, IR::Expr *index, IR::Temp *result) = 0;
+    virtual void callBuiltinDeleteName(const QString &name, IR::Temp *result) = 0;
+    virtual void callBuiltinDeleteValue(IR::Temp *result) = 0;
+    virtual void callBuiltinThrow(IR::Expr *arg) = 0;
     virtual void callBuiltinReThrow() = 0;
-    virtual void callBuiltinUnwindException(V4IR::Temp *) = 0;
+    virtual void callBuiltinUnwindException(IR::Temp *) = 0;
     virtual void callBuiltinPushCatchScope(const QString &exceptionName) = 0;
-    virtual void callBuiltinForeachIteratorObject(V4IR::Temp *arg, V4IR::Temp *result) = 0;
-    virtual void callBuiltinForeachNextPropertyname(V4IR::Temp *arg, V4IR::Temp *result) = 0;
-    virtual void callBuiltinPushWithScope(V4IR::Temp *arg) = 0;
+    virtual void callBuiltinForeachIteratorObject(IR::Temp *arg, IR::Temp *result) = 0;
+    virtual void callBuiltinForeachNextPropertyname(IR::Temp *arg, IR::Temp *result) = 0;
+    virtual void callBuiltinPushWithScope(IR::Temp *arg) = 0;
     virtual void callBuiltinPopScope() = 0;
     virtual void callBuiltinDeclareVar(bool deletable, const QString &name) = 0;
-    virtual void callBuiltinDefineGetterSetter(V4IR::Temp *object, const QString &name, V4IR::Temp *getter, V4IR::Temp *setter) = 0;
-    virtual void callBuiltinDefineProperty(V4IR::Temp *object, const QString &name, V4IR::Expr *value) = 0;
-    virtual void callBuiltinDefineArray(V4IR::Temp *result, V4IR::ExprList *args) = 0;
-    virtual void callBuiltinDefineObjectLiteral(V4IR::Temp *result, V4IR::ExprList *args) = 0;
-    virtual void callBuiltinSetupArgumentObject(V4IR::Temp *result) = 0;
+    virtual void callBuiltinDefineGetterSetter(IR::Temp *object, const QString &name, IR::Temp *getter, IR::Temp *setter) = 0;
+    virtual void callBuiltinDefineProperty(IR::Temp *object, const QString &name, IR::Expr *value) = 0;
+    virtual void callBuiltinDefineArray(IR::Temp *result, IR::ExprList *args) = 0;
+    virtual void callBuiltinDefineObjectLiteral(IR::Temp *result, IR::ExprList *args) = 0;
+    virtual void callBuiltinSetupArgumentObject(IR::Temp *result) = 0;
     virtual void callBuiltinConvertThisToObject() = 0;
-    virtual void callValue(V4IR::Temp *value, V4IR::ExprList *args, V4IR::Temp *result) = 0;
-    virtual void callProperty(V4IR::Expr *base, const QString &name, V4IR::ExprList *args, V4IR::Temp *result) = 0;
-    virtual void callSubscript(V4IR::Expr *base, V4IR::Expr *index, V4IR::ExprList *args, V4IR::Temp *result) = 0;
-    virtual void convertType(V4IR::Temp *source, V4IR::Temp *target) = 0;
-    virtual void constructActivationProperty(V4IR::Name *func, V4IR::ExprList *args, V4IR::Temp *result) = 0;
-    virtual void constructProperty(V4IR::Temp *base, const QString &name, V4IR::ExprList *args, V4IR::Temp *result) = 0;
-    virtual void constructValue(V4IR::Temp *value, V4IR::ExprList *args, V4IR::Temp *result) = 0;
-    virtual void loadThisObject(V4IR::Temp *temp) = 0;
-    virtual void loadQmlIdArray(V4IR::Temp *temp) = 0;
-    virtual void loadQmlImportedScripts(V4IR::Temp *temp) = 0;
-    virtual void loadQmlContextObject(V4IR::Temp *temp) = 0;
-    virtual void loadQmlScopeObject(V4IR::Temp *temp) = 0;
-    virtual void loadQmlSingleton(const QString &name, V4IR::Temp *temp) = 0;
-    virtual void loadConst(V4IR::Const *sourceConst, V4IR::Temp *targetTemp) = 0;
-    virtual void loadString(const QString &str, V4IR::Temp *targetTemp) = 0;
-    virtual void loadRegexp(V4IR::RegExp *sourceRegexp, V4IR::Temp *targetTemp) = 0;
-    virtual void getActivationProperty(const V4IR::Name *name, V4IR::Temp *temp) = 0;
-    virtual void setActivationProperty(V4IR::Expr *source, const QString &targetName) = 0;
-    virtual void initClosure(V4IR::Closure *closure, V4IR::Temp *target) = 0;
-    virtual void getProperty(V4IR::Expr *base, const QString &name, V4IR::Temp *target) = 0;
-    virtual void getQObjectProperty(V4IR::Expr *base, int propertyIndex, bool captureRequired, int attachedPropertiesId, V4IR::Temp *targetTemp) = 0;
-    virtual void setProperty(V4IR::Expr *source, V4IR::Expr *targetBase, const QString &targetName) = 0;
-    virtual void setQObjectProperty(V4IR::Expr *source, V4IR::Expr *targetBase, int propertyIndex) = 0;
-    virtual void getElement(V4IR::Expr *base, V4IR::Expr *index, V4IR::Temp *target) = 0;
-    virtual void setElement(V4IR::Expr *source, V4IR::Expr *targetBase, V4IR::Expr *targetIndex) = 0;
-    virtual void copyValue(V4IR::Temp *sourceTemp, V4IR::Temp *targetTemp) = 0;
-    virtual void swapValues(V4IR::Temp *sourceTemp, V4IR::Temp *targetTemp) = 0;
-    virtual void unop(V4IR::AluOp oper, V4IR::Temp *sourceTemp, V4IR::Temp *targetTemp) = 0;
-    virtual void binop(V4IR::AluOp oper, V4IR::Expr *leftSource, V4IR::Expr *rightSource, V4IR::Temp *target) = 0;
+    virtual void callValue(IR::Temp *value, IR::ExprList *args, IR::Temp *result) = 0;
+    virtual void callProperty(IR::Expr *base, const QString &name, IR::ExprList *args, IR::Temp *result) = 0;
+    virtual void callSubscript(IR::Expr *base, IR::Expr *index, IR::ExprList *args, IR::Temp *result) = 0;
+    virtual void convertType(IR::Temp *source, IR::Temp *target) = 0;
+    virtual void constructActivationProperty(IR::Name *func, IR::ExprList *args, IR::Temp *result) = 0;
+    virtual void constructProperty(IR::Temp *base, const QString &name, IR::ExprList *args, IR::Temp *result) = 0;
+    virtual void constructValue(IR::Temp *value, IR::ExprList *args, IR::Temp *result) = 0;
+    virtual void loadThisObject(IR::Temp *temp) = 0;
+    virtual void loadQmlIdArray(IR::Temp *temp) = 0;
+    virtual void loadQmlImportedScripts(IR::Temp *temp) = 0;
+    virtual void loadQmlContextObject(IR::Temp *temp) = 0;
+    virtual void loadQmlScopeObject(IR::Temp *temp) = 0;
+    virtual void loadQmlSingleton(const QString &name, IR::Temp *temp) = 0;
+    virtual void loadConst(IR::Const *sourceConst, IR::Temp *targetTemp) = 0;
+    virtual void loadString(const QString &str, IR::Temp *targetTemp) = 0;
+    virtual void loadRegexp(IR::RegExp *sourceRegexp, IR::Temp *targetTemp) = 0;
+    virtual void getActivationProperty(const IR::Name *name, IR::Temp *temp) = 0;
+    virtual void setActivationProperty(IR::Expr *source, const QString &targetName) = 0;
+    virtual void initClosure(IR::Closure *closure, IR::Temp *target) = 0;
+    virtual void getProperty(IR::Expr *base, const QString &name, IR::Temp *target) = 0;
+    virtual void getQObjectProperty(IR::Expr *base, int propertyIndex, bool captureRequired, int attachedPropertiesId, IR::Temp *targetTemp) = 0;
+    virtual void setProperty(IR::Expr *source, IR::Expr *targetBase, const QString &targetName) = 0;
+    virtual void setQObjectProperty(IR::Expr *source, IR::Expr *targetBase, int propertyIndex) = 0;
+    virtual void getElement(IR::Expr *base, IR::Expr *index, IR::Temp *target) = 0;
+    virtual void setElement(IR::Expr *source, IR::Expr *targetBase, IR::Expr *targetIndex) = 0;
+    virtual void copyValue(IR::Temp *sourceTemp, IR::Temp *targetTemp) = 0;
+    virtual void swapValues(IR::Temp *sourceTemp, IR::Temp *targetTemp) = 0;
+    virtual void unop(IR::AluOp oper, IR::Temp *sourceTemp, IR::Temp *targetTemp) = 0;
+    virtual void binop(IR::AluOp oper, IR::Expr *leftSource, IR::Expr *rightSource, IR::Temp *target) = 0;
 
 protected:
-    virtual void callBuiltin(V4IR::Call *c, V4IR::Temp *result);
+    virtual void callBuiltin(IR::Call *c, IR::Temp *result);
 
-    V4IR::Function *_function; // subclass needs to set
+    IR::Function *_function; // subclass needs to set
 };
 } // namespace IR
 
-} // namespace QQmlJS
+} // namespace QV4
 
 QT_END_NAMESPACE
 
index 637746dce18533e3fdfd705605e4bcb75a2cf188..be1714f2dec44cde49d72616fbb5b668291abfb0 100644 (file)
@@ -47,7 +47,7 @@
 
 QT_BEGIN_NAMESPACE
 
-namespace QQmlJS {
+namespace QV4 {
 
 inline bool canConvertToSignedInteger(double value)
 {
@@ -63,43 +63,43 @@ inline bool canConvertToUnsignedInteger(double value)
     return uval == value && !(value == 0 && isNegative(value));
 }
 
-inline QV4::Primitive convertToValue(V4IR::Const *c)
+inline Primitive convertToValue(IR::Const *c)
 {
     switch (c->type) {
-    case V4IR::MissingType:
-        return QV4::Primitive::emptyValue();
-    case V4IR::NullType:
-        return QV4::Primitive::nullValue();
-    case V4IR::UndefinedType:
-        return QV4::Primitive::undefinedValue();
-    case V4IR::BoolType:
-        return QV4::Primitive::fromBoolean(c->value != 0);
-    case V4IR::SInt32Type:
-        return QV4::Primitive::fromInt32(int(c->value));
-    case V4IR::UInt32Type:
-        return QV4::Primitive::fromUInt32(unsigned(c->value));
-    case V4IR::DoubleType:
-        return QV4::Primitive::fromDouble(c->value);
-    case V4IR::NumberType: {
+    case IR::MissingType:
+        return Primitive::emptyValue();
+    case IR::NullType:
+        return Primitive::nullValue();
+    case IR::UndefinedType:
+        return Primitive::undefinedValue();
+    case IR::BoolType:
+        return Primitive::fromBoolean(c->value != 0);
+    case IR::SInt32Type:
+        return Primitive::fromInt32(int(c->value));
+    case IR::UInt32Type:
+        return Primitive::fromUInt32(unsigned(c->value));
+    case IR::DoubleType:
+        return Primitive::fromDouble(c->value);
+    case IR::NumberType: {
         int ival = (int)c->value;
         if (canConvertToSignedInteger(c->value)) {
-            return QV4::Primitive::fromInt32(ival);
+            return Primitive::fromInt32(ival);
         } else {
-            return QV4::Primitive::fromDouble(c->value);
+            return Primitive::fromDouble(c->value);
         }
     }
     default:
         Q_UNREACHABLE();
     }
     // unreachable, but the function must return something
-    return QV4::Primitive::undefinedValue();
+    return Primitive::undefinedValue();
 }
 
-class ConvertTemps: protected V4IR::StmtVisitor, protected V4IR::ExprVisitor
+class ConvertTemps: protected IR::StmtVisitor, protected IR::ExprVisitor
 {
-    void renumber(V4IR::Temp *t)
+    void renumber(IR::Temp *t)
     {
-        if (t->kind != V4IR::Temp::VirtualRegister)
+        if (t->kind != IR::Temp::VirtualRegister)
             return;
 
         int stackSlot = _stackSlotForTemp.value(t->index, -1);
@@ -108,20 +108,20 @@ class ConvertTemps: protected V4IR::StmtVisitor, protected V4IR::ExprVisitor
             _stackSlotForTemp[t->index] = stackSlot;
         }
 
-        t->kind = V4IR::Temp::StackSlot;
+        t->kind = IR::Temp::StackSlot;
         t->index = stackSlot;
     }
 
 protected:
     int _nextUnusedStackSlot;
     QHash<int, int> _stackSlotForTemp;
-    V4IR::BasicBlock *_currentBasicBlock;
+    IR::BasicBlock *_currentBasicBlock;
     virtual int allocateFreeSlot()
     {
         return _nextUnusedStackSlot++;
     }
 
-    virtual void process(V4IR::Stmt *s)
+    virtual void process(IR::Stmt *s)
     {
         s->accept(this);
     }
@@ -132,13 +132,13 @@ public:
         , _currentBasicBlock(0)
     {}
 
-    void toStackSlots(V4IR::Function *function)
+    void toStackSlots(IR::Function *function)
     {
         _stackSlotForTemp.reserve(function->tempCount);
 
-        foreach (V4IR::BasicBlock *bb, function->basicBlocks) {
+        foreach (IR::BasicBlock *bb, function->basicBlocks) {
             _currentBasicBlock = bb;
-            foreach (V4IR::Stmt *s, bb->statements)
+            foreach (IR::Stmt *s, bb->statements)
                 process(s);
         }
 
@@ -146,35 +146,35 @@ public:
     }
 
 protected:
-    virtual void visitConst(V4IR::Const *) {}
-    virtual void visitString(V4IR::String *) {}
-    virtual void visitRegExp(V4IR::RegExp *) {}
-    virtual void visitName(V4IR::Name *) {}
-    virtual void visitTemp(V4IR::Temp *e) { renumber(e); }
-    virtual void visitClosure(V4IR::Closure *) {}
-    virtual void visitConvert(V4IR::Convert *e) { e->expr->accept(this); }
-    virtual void visitUnop(V4IR::Unop *e) { e->expr->accept(this); }
-    virtual void visitBinop(V4IR::Binop *e) { e->left->accept(this); e->right->accept(this); }
-    virtual void visitCall(V4IR::Call *e) {
+    virtual void visitConst(IR::Const *) {}
+    virtual void visitString(IR::String *) {}
+    virtual void visitRegExp(IR::RegExp *) {}
+    virtual void visitName(IR::Name *) {}
+    virtual void visitTemp(IR::Temp *e) { renumber(e); }
+    virtual void visitClosure(IR::Closure *) {}
+    virtual void visitConvert(IR::Convert *e) { e->expr->accept(this); }
+    virtual void visitUnop(IR::Unop *e) { e->expr->accept(this); }
+    virtual void visitBinop(IR::Binop *e) { e->left->accept(this); e->right->accept(this); }
+    virtual void visitCall(IR::Call *e) {
         e->base->accept(this);
-        for (V4IR::ExprList *it = e->args; it; it = it->next)
+        for (IR::ExprList *it = e->args; it; it = it->next)
             it->expr->accept(this);
     }
-    virtual void visitNew(V4IR::New *e) {
+    virtual void visitNew(IR::New *e) {
         e->base->accept(this);
-        for (V4IR::ExprList *it = e->args; it; it = it->next)
+        for (IR::ExprList *it = e->args; it; it = it->next)
             it->expr->accept(this);
     }
-    virtual void visitSubscript(V4IR::Subscript *e) { e->base->accept(this); e->index->accept(this); }
-    virtual void visitMember(V4IR::Member *e) { e->base->accept(this); }
-    virtual void visitExp(V4IR::Exp *s) { s->expr->accept(this); }
-    virtual void visitMove(V4IR::Move *s) { s->target->accept(this); s->source->accept(this); }
-    virtual void visitJump(V4IR::Jump *) {}
-    virtual void visitCJump(V4IR::CJump *s) { s->cond->accept(this); }
-    virtual void visitRet(V4IR::Ret *s) { s->expr->accept(this); }
-    virtual void visitPhi(V4IR::Phi *) { Q_UNREACHABLE(); }
+    virtual void visitSubscript(IR::Subscript *e) { e->base->accept(this); e->index->accept(this); }
+    virtual void visitMember(IR::Member *e) { e->base->accept(this); }
+    virtual void visitExp(IR::Exp *s) { s->expr->accept(this); }
+    virtual void visitMove(IR::Move *s) { s->target->accept(this); s->source->accept(this); }
+    virtual void visitJump(IR::Jump *) {}
+    virtual void visitCJump(IR::CJump *s) { s->cond->accept(this); }
+    virtual void visitRet(IR::Ret *s) { s->expr->accept(this); }
+    virtual void visitPhi(IR::Phi *) { Q_UNREACHABLE(); }
 };
-} // namespace QQmlJS
+} // namespace QV4
 
 QT_END_NAMESPACE
 
index ea92bb468dfa13ff73300b7892d1f7f6f9aa2ac0..2683278b12cf99896063d964fcd74035b24c620b 100644 (file)
@@ -55,8 +55,8 @@
 
 QT_BEGIN_NAMESPACE
 
-namespace QQmlJS {
-namespace V4IR {
+namespace QV4 {
+namespace IR {
 
 QString typeName(Type t)
 {
@@ -154,7 +154,7 @@ AluOp binaryOperator(int op)
     }
 }
 
-struct RemoveSharedExpressions: V4IR::StmtVisitor, V4IR::ExprVisitor
+struct RemoveSharedExpressions: IR::StmtVisitor, IR::ExprVisitor
 {
     CloneExpr clone;
     QSet<Expr *> subexpressions; // contains all the non-cloned subexpressions in the given function
@@ -162,7 +162,7 @@ struct RemoveSharedExpressions: V4IR::StmtVisitor, V4IR::ExprVisitor
 
     RemoveSharedExpressions(): uniqueExpr(0) {}
 
-    void operator()(V4IR::Function *function)
+    void operator()(IR::Function *function)
     {
         subexpressions.clear();
 
@@ -185,7 +185,7 @@ struct RemoveSharedExpressions: V4IR::StmtVisitor, V4IR::ExprVisitor
         }
 
         subexpressions.insert(expr);
-        V4IR::Expr *e = expr;
+        IR::Expr *e = expr;
         qSwap(uniqueExpr, e);
         expr->accept(this);
         qSwap(uniqueExpr, e);
@@ -219,7 +219,7 @@ struct RemoveSharedExpressions: V4IR::StmtVisitor, V4IR::ExprVisitor
         s->expr = cleanup(s->expr);
     }
 
-    virtual void visitPhi(V4IR::Phi *) { Q_UNIMPLEMENTED(); }
+    virtual void visitPhi(IR::Phi *) { Q_UNIMPLEMENTED(); }
 
     // expressions
     virtual void visitConst(Const *) {}
@@ -248,14 +248,14 @@ struct RemoveSharedExpressions: V4IR::StmtVisitor, V4IR::ExprVisitor
     virtual void visitCall(Call *e)
     {
         e->base = cleanup(e->base);
-        for (V4IR::ExprList *it = e->args; it; it = it->next)
+        for (IR::ExprList *it = e->args; it; it = it->next)
             it->expr = cleanup(it->expr);
     }
 
     virtual void visitNew(New *e)
     {
         e->base = cleanup(e->base);
-        for (V4IR::ExprList *it = e->args; it; it = it->next)
+        for (IR::ExprList *it = e->args; it; it = it->next)
             it->expr = cleanup(it->expr);
     }
 
@@ -299,16 +299,16 @@ void Const::dump(QTextStream &out) const
     if (type != UndefinedType && type != NullType)
         out << dumpStart(this);
     switch (type) {
-    case QQmlJS::V4IR::UndefinedType:
+    case QV4::IR::UndefinedType:
         out << "undefined";
         break;
-    case QQmlJS::V4IR::NullType:
+    case QV4::IR::NullType:
         out << "null";
         break;
-    case QQmlJS::V4IR::BoolType:
+    case QV4::IR::BoolType:
         out << (value ? "true" : "false");
         break;
-    case QQmlJS::V4IR::MissingType:
+    case QV4::IR::MissingType:
         out << "missing";
         break;
     default:
@@ -417,35 +417,35 @@ static const char *builtin_to_string(Name::Builtin b)
         return "builtin_unwind_exception";
     case Name::builtin_push_catch_scope:
         return "builtin_push_catch_scope";
-    case V4IR::Name::builtin_foreach_iterator_object:
+    case IR::Name::builtin_foreach_iterator_object:
         return "builtin_foreach_iterator_object";
-    case V4IR::Name::builtin_foreach_next_property_name:
+    case IR::Name::builtin_foreach_next_property_name:
         return "builtin_foreach_next_property_name";
-    case V4IR::Name::builtin_push_with_scope:
+    case IR::Name::builtin_push_with_scope:
         return "builtin_push_with_scope";
-    case V4IR::Name::builtin_pop_scope:
+    case IR::Name::builtin_pop_scope:
         return "builtin_pop_scope";
-    case V4IR::Name::builtin_declare_vars:
+    case IR::Name::builtin_declare_vars:
         return "builtin_declare_vars";
-    case V4IR::Name::builtin_define_property:
+    case IR::Name::builtin_define_property:
         return "builtin_define_property";
-    case V4IR::Name::builtin_define_array:
+    case IR::Name::builtin_define_array:
         return "builtin_define_array";
-    case V4IR::Name::builtin_define_getter_setter:
+    case IR::Name::builtin_define_getter_setter:
         return "builtin_define_getter_setter";
-    case V4IR::Name::builtin_define_object_literal:
+    case IR::Name::builtin_define_object_literal:
         return "builtin_define_object_literal";
-    case V4IR::Name::builtin_setup_argument_object:
+    case IR::Name::builtin_setup_argument_object:
         return "builtin_setup_argument_object";
-    case V4IR::Name::builtin_convert_this_to_object:
+    case IR::Name::builtin_convert_this_to_object:
         return "builtin_convert_this_to_object";
-    case V4IR::Name::builtin_qml_id_array:
+    case IR::Name::builtin_qml_id_array:
         return "builtin_qml_id_array";
-    case V4IR::Name::builtin_qml_imported_scripts_object:
+    case IR::Name::builtin_qml_imported_scripts_object:
         return "builtin_qml_imported_scripts_object";
-    case V4IR::Name::builtin_qml_scope_object:
+    case IR::Name::builtin_qml_scope_object:
         return "builtin_qml_scope_object";
-    case V4IR::Name::builtin_qml_context_object:
+    case IR::Name::builtin_qml_context_object:
         return "builtin_qml_context_object";
     }
     return "builtin_(###FIXME)";
@@ -663,8 +663,8 @@ Function::~Function()
 {
     // destroy the Stmt::Data blocks manually, because memory pool cleanup won't
     // call the Stmt destructors.
-    foreach (V4IR::BasicBlock *b, basicBlocks)
-        foreach (V4IR::Stmt *s, b->statements)
+    foreach (IR::BasicBlock *b, basicBlocks)
+        foreach (IR::Stmt *s, b->statements)
             s->destroyData();
 
     qDeleteAll(basicBlocks);
@@ -969,7 +969,7 @@ ExprList *CloneExpr::clone(ExprList *list)
     if (! list)
         return 0;
 
-    ExprList *clonedList = block->function->New<V4IR::ExprList>();
+    ExprList *clonedList = block->function->New<IR::ExprList>();
     clonedList->init(clone(list->expr), clone(list->next));
     return clonedList;
 }
@@ -1041,6 +1041,6 @@ void CloneExpr::visitMember(Member *e)
 }
 
 } // end of namespace IR
-} // end of namespace QQmlJS
+} // end of namespace QV4
 
 QT_END_NAMESPACE
index 46aea546abdcd9364851dc1e8a875113aa56ef25..89b6da62780e370675a1baef9ffb45a1339f75ec 100644 (file)
@@ -81,7 +81,7 @@ namespace QV4 {
 struct ExecutionContext;
 }
 
-namespace QQmlJS {
+namespace QV4 {
 
 inline bool isNegative(double d)
 {
@@ -93,7 +93,7 @@ inline bool isNegative(double d)
 
 }
 
-namespace V4IR {
+namespace IR {
 
 struct BasicBlock;
 struct Function;
@@ -176,7 +176,7 @@ enum AluOp {
     LastAluOp = OpOr
 };
 AluOp binaryOperator(int op);
-const char *opname(V4IR::AluOp op);
+const char *opname(IR::AluOp op);
 
 enum Type {
     UnknownType   = 0,
@@ -618,7 +618,7 @@ struct Stmt {
 
     Data *d;
     int id;
-    AST::SourceLocation location;
+    QQmlJS::AST::SourceLocation location;
 
     Stmt(): d(0), id(-1) {}
     virtual ~Stmt()
@@ -740,7 +740,7 @@ struct Phi: Stmt {
 };
 
 struct Q_QML_EXPORT Module {
-    MemoryPool pool;
+    QQmlJS::MemoryPool pool;
     QVector<Function *> functions;
     Function *rootFunction;
     QString fileName;
@@ -764,7 +764,7 @@ typedef QHash<int, int> PropertyDependencyMap;
 
 struct Function {
     Module *module;
-    MemoryPool *pool;
+    QQmlJS::MemoryPool *pool;
     const QString *name;
     QVector<BasicBlock *> basicBlocks;
     int tempCount;
@@ -850,7 +850,7 @@ struct BasicBlock {
     QBitArray liveOut;
     int index;
     bool isExceptionHandler;
-    AST::SourceLocation nextLocation;
+    QQmlJS::AST::SourceLocation nextLocation;
 
     BasicBlock(Function *function, BasicBlock *containingLoop, BasicBlock *catcher)
         : function(function)
@@ -931,12 +931,12 @@ private:
     bool _groupStart;
 };
 
-class CloneExpr: protected V4IR::ExprVisitor
+class CloneExpr: protected IR::ExprVisitor
 {
 public:
-    explicit CloneExpr(V4IR::BasicBlock *block = 0);
+    explicit CloneExpr(IR::BasicBlock *block = 0);
 
-    void setBasicBlock(V4IR::BasicBlock *block);
+    void setBasicBlock(IR::BasicBlock *block);
 
     template <typename _Expr>
     _Expr *operator()(_Expr *expr)
@@ -985,7 +985,7 @@ public:
     }
 
 protected:
-    V4IR::ExprList *clone(V4IR::ExprList *list);
+    IR::ExprList *clone(IR::ExprList *list);
 
     virtual void visitConst(Const *);
     virtual void visitString(String *);
@@ -1002,13 +1002,13 @@ protected:
     virtual void visitMember(Member *);
 
 private:
-    V4IR::BasicBlock *block;
-    V4IR::Expr *cloned;
+    IR::BasicBlock *block;
+    IR::Expr *cloned;
 };
 
 } // end of namespace IR
 
-} // end of namespace QQmlJS
+} // end of namespace QV4
 
 QT_END_NAMESPACE
 
index 83d0f24e98128cc1073b1921df137a288cbb7131..e2c88c88f4a98e6e96c4d1bd7a4f7c6777f6215b 100644 (file)
 
 QT_USE_NAMESPACE
 
-using namespace QQmlJS;
-using namespace V4IR;
+using namespace QV4;
+using namespace IR;
 
 namespace {
 
 Q_GLOBAL_STATIC_WITH_ARGS(QTextStream, qout, (stderr, QIODevice::WriteOnly));
 #define qout *qout()
 
-void showMeTheCode(Function *function)
+void showMeTheCode(IR::Function *function)
 {
     static bool showCode = !qgetenv("QV4_SHOW_IR").isNull();
     if (showCode) {
@@ -244,7 +244,7 @@ public:
     }
 };
 
-inline bool unescapableTemp(Temp *t, Function *f)
+inline bool unescapableTemp(Temp *t, IR::Function *f)
 {
     switch (t->kind) {
     case Temp::Formal:
@@ -258,7 +258,7 @@ inline bool unescapableTemp(Temp *t, Function *f)
     }
 }
 
-inline Temp *unescapableTemp(Expr *e, Function *f)
+inline Temp *unescapableTemp(Expr *e, IR::Function *f)
 {
     Temp *t = e->asTemp();
     if (!t)
@@ -780,7 +780,7 @@ class VariableCollector: public StmtVisitor, ExprVisitor {
     QSet<Temp> killed;
 
     BasicBlock *currentBB;
-    Function *function;
+    IR::Function *function;
     bool isCollectable(Temp *t) const
     {
         Q_ASSERT(t->kind != Temp::PhysicalRegister && t->kind != Temp::StackSlot);
@@ -788,7 +788,7 @@ class VariableCollector: public StmtVisitor, ExprVisitor {
     }
 
 public:
-    VariableCollector(Function *function)
+    VariableCollector(IR::Function *function)
         : function(function)
     {
         _defsites.reserve(function->tempCount);
@@ -837,8 +837,8 @@ protected:
     virtual void visitConvert(Convert *e) { e->expr->accept(this); };
 
     virtual void visitConst(Const *) {}
-    virtual void visitString(String *) {}
-    virtual void visitRegExp(RegExp *) {}
+    virtual void visitString(IR::String *) {}
+    virtual void visitRegExp(IR::RegExp *) {}
     virtual void visitName(Name *) {}
     virtual void visitClosure(Closure *) {}
     virtual void visitUnop(Unop *e) { e->expr->accept(this); }
@@ -892,7 +892,7 @@ protected:
     }
 };
 
-void insertPhiNode(const Temp &a, BasicBlock *y, Function *f) {
+void insertPhiNode(const Temp &a, BasicBlock *y, IR::Function *f) {
 #if defined(SHOW_SSA)
     qout << "-> inserted phi node for variable ";
     a.dump(qout);
@@ -983,7 +983,7 @@ void insertPhiNode(const Temp &a, BasicBlock *y, Function *f) {
 //     mapping[t] = c
 class VariableRenamer: public StmtVisitor, public ExprVisitor
 {
-    Function *function;
+    IR::Function *function;
     unsigned tempCount;
 
     typedef QHash<unsigned, int> Mapping; // maps from existing/old temp number to the new and unique temp number.
@@ -1039,7 +1039,7 @@ class VariableRenamer: public StmtVisitor, public ExprVisitor
     QVector<TodoAction> todo;
 
 public:
-    VariableRenamer(Function *f)
+    VariableRenamer(IR::Function *f)
         : function(f)
         , tempCount(0)
         , processed(f->basicBlocks)
@@ -1216,8 +1216,8 @@ protected:
     virtual void visitRet(Ret *s) { s->expr->accept(this); }
 
     virtual void visitConst(Const *) {}
-    virtual void visitString(String *) {}
-    virtual void visitRegExp(RegExp *) {}
+    virtual void visitString(IR::String *) {}
+    virtual void visitRegExp(IR::RegExp *) {}
     virtual void visitName(Name *) {}
     virtual void visitClosure(Closure *) {}
     virtual void visitUnop(Unop *e) { e->expr->accept(this); }
@@ -1244,7 +1244,7 @@ protected:
     }
 };
 
-void convertToSSA(Function *function, const DominatorTree &df)
+void convertToSSA(IR::Function *function, const DominatorTree &df)
 {
 #ifdef SHOW_SSA
     qout << "Converting function ";
@@ -1311,7 +1311,7 @@ public:
     };
 
 private:
-    Function *function;
+    IR::Function *function;
     QHash<UntypedTemp, DefUse> _defUses;
     QHash<Stmt *, QList<Temp> > _usesPerStatement;
 
@@ -1344,7 +1344,7 @@ private:
     }
 
 public:
-    DefUsesCalculator(Function *function)
+    DefUsesCalculator(IR::Function *function)
         : function(function)
     {
         foreach (BasicBlock *bb, function->basicBlocks) {
@@ -1464,8 +1464,8 @@ protected:
     virtual void visitTemp(Temp *e) { addUse(e); }
 
     virtual void visitConst(Const *) {}
-    virtual void visitString(String *) {}
-    virtual void visitRegExp(RegExp *) {}
+    virtual void visitString(IR::String *) {}
+    virtual void visitRegExp(IR::RegExp *) {}
     virtual void visitName(Name *) {}
     virtual void visitClosure(Closure *) {}
     virtual void visitConvert(Convert *e) { e->expr->accept(this); }
@@ -1541,7 +1541,7 @@ class StatementWorklist
     QHash<Stmt*,Stmt**> ref;
 
 public:
-    StatementWorklist(Function *function)
+    StatementWorklist(IR::Function *function)
     {
         QVector<Stmt *> w;
         int stmtCount = 0;
@@ -1585,7 +1585,7 @@ public:
         *ref[oldStmt] = newStmt;
     }
 
-    void cleanup(Function *function)
+    void cleanup(IR::Function *function)
     {
         foreach (BasicBlock *bb, function->basicBlocks) {
             for (int i = 0; i < bb->statements.size();) {
@@ -1658,12 +1658,12 @@ public:
 class EliminateDeadCode: public ExprVisitor {
     DefUsesCalculator &_defUses;
     StatementWorklist &_worklist;
-    Function *function;
+    IR::Function *function;
     bool _sideEffect;
     QVector<Temp *> _collectedTemps;
 
 public:
-    EliminateDeadCode(DefUsesCalculator &defUses, StatementWorklist &worklist, Function *function)
+    EliminateDeadCode(DefUsesCalculator &defUses, StatementWorklist &worklist, IR::Function *function)
         : _defUses(defUses)
         , _worklist(worklist)
         , function(function)
@@ -1704,8 +1704,8 @@ private:
 
 protected:
     virtual void visitConst(Const *) {}
-    virtual void visitString(String *) {}
-    virtual void visitRegExp(RegExp *) {}
+    virtual void visitString(IR::String *) {}
+    virtual void visitRegExp(IR::RegExp *) {}
 
     virtual void visitName(Name *e)
     {
@@ -1841,8 +1841,8 @@ public:
 
 protected:
     virtual void visitConst(Const *) {}
-    virtual void visitString(String *) {}
-    virtual void visitRegExp(RegExp *) {}
+    virtual void visitString(IR::String *) {}
+    virtual void visitRegExp(IR::RegExp *) {}
     virtual void visitName(Name *) {}
     virtual void visitTemp(Temp *e) {
         if (theTemp == UntypedTemp(*e)) {
@@ -1892,7 +1892,7 @@ protected:
 
 class TypeInference: public StmtVisitor, public ExprVisitor {
     QQmlEnginePrivate *qmlEngine;
-    Function *function;
+    IR::Function *function;
     const DefUsesCalculator &_defUses;
     QHash<Temp, DiscoveredType> _tempTypes;
     QSet<Stmt *> _worklist;
@@ -1912,7 +1912,7 @@ public:
         , _ty(UnknownType)
     {}
 
-    void run(Function *f) {
+    void run(IR::Function *f) {
         function = f;
 
         // TODO: the worklist handling looks a bit inefficient... check if there is something better
@@ -2017,8 +2017,8 @@ protected:
         } else
             _ty = TypingResult(e->type);
     }
-    virtual void visitString(String *) { _ty = TypingResult(StringType); }
-    virtual void visitRegExp(RegExp *) { _ty = TypingResult(VarType); }
+    virtual void visitString(IR::String *) { _ty = TypingResult(StringType); }
+    virtual void visitRegExp(IR::RegExp *) { _ty = TypingResult(VarType); }
     virtual void visitName(Name *) { _ty = TypingResult(VarType); }
     virtual void visitTemp(Temp *e) {
         if (isAlwaysVar(e))
@@ -2207,7 +2207,7 @@ public:
         : _defUses(defUses)
     {}
 
-    void run(Function *f)
+    void run(IR::Function *f)
     {
         QVector<UntypedTemp> knownOk;
         QList<UntypedTemp> candidates = _defUses.defsUntyped();
@@ -2361,7 +2361,7 @@ void convertConst(Const *c, Type targetType)
 class TypePropagation: public StmtVisitor, public ExprVisitor {
     DefUsesCalculator &_defUses;
     Type _ty;
-    Function *_f;
+    IR::Function *_f;
 
     bool run(Expr *&e, Type requestedType = UnknownType, bool insertConversion = true) {
         qSwap(_ty, requestedType);
@@ -2412,7 +2412,7 @@ class TypePropagation: public StmtVisitor, public ExprVisitor {
 public:
     TypePropagation(DefUsesCalculator &defUses) : _defUses(defUses), _ty(UnknownType) {}
 
-    void run(Function *f) {
+    void run(IR::Function *f) {
         _f = f;
         foreach (BasicBlock *bb, f->basicBlocks) {
             _conversions.clear();
@@ -2423,7 +2423,7 @@ public:
             }
 
             foreach (const Conversion &conversion, _conversions) {
-                V4IR::Move *move = conversion.stmt->asMove();
+                IR::Move *move = conversion.stmt->asMove();
 
                 // Note: isel only supports move into member when source is a temp, so convert
                 // is not a supported source.
@@ -2497,8 +2497,8 @@ protected:
         }
     }
 
-    virtual void visitString(String *) {}
-    virtual void visitRegExp(RegExp *) {}
+    virtual void visitString(IR::String *) {}
+    virtual void visitRegExp(IR::RegExp *) {}
     virtual void visitName(Name *) {}
     virtual void visitTemp(Temp *) {}
     virtual void visitClosure(Closure *) {}
@@ -2605,7 +2605,7 @@ protected:
     }
 };
 
-void splitCriticalEdges(Function *f, DominatorTree &df)
+void splitCriticalEdges(IR::Function *f, DominatorTree &df)
 {
     for (int i = 0, ei = f->basicBlocks.size(); i != ei; ++i) {
         BasicBlock *bb = f->basicBlocks[i];
@@ -2687,7 +2687,7 @@ void splitCriticalEdges(Function *f, DominatorTree &df)
 // the same reason.
 class BlockScheduler
 {
-    Function *function;
+    IR::Function *function;
     const DominatorTree &dominatorTree;
 
     struct WorkForGroup
@@ -2793,7 +2793,7 @@ class BlockScheduler
     }
 
 public:
-    BlockScheduler(Function *function, const DominatorTree &dominatorTree)
+    BlockScheduler(IR::Function *function, const DominatorTree &dominatorTree)
         : function(function)
         , dominatorTree(dominatorTree)
         , emitted(function->basicBlocks)
@@ -2832,7 +2832,7 @@ void checkCriticalEdges(QVector<BasicBlock *> basicBlocks) {
 }
 #endif
 
-void cleanupBasicBlocks(Function *function, bool renumber)
+void cleanupBasicBlocks(IR::Function *function, bool renumber)
 {
     showMeTheCode(function);
 
@@ -2921,7 +2921,7 @@ inline Const *isConstPhi(Phi *phi)
     return 0;
 }
 
-static Expr *clone(Expr *e, Function *function) {
+static Expr *clone(Expr *e, IR::Function *function) {
     if (Temp *t = e->asTemp()) {
         return CloneExpr::cloneTemp(t, function);
     } else if (Const *c = e->asConst()) {
@@ -2937,12 +2937,12 @@ static Expr *clone(Expr *e, Function *function) {
 class ExprReplacer: public StmtVisitor, public ExprVisitor
 {
     DefUsesCalculator &_defUses;
-    Function* _function;
+    IR::Function* _function;
     Temp *_toReplace;
     Expr *_replacement;
 
 public:
-    ExprReplacer(DefUsesCalculator &defUses, Function *function)
+    ExprReplacer(DefUsesCalculator &defUses, IR::Function *function)
         : _defUses(defUses)
         , _function(function)
         , _toReplace(0)
@@ -2976,8 +2976,8 @@ public:
 
 protected:
     virtual void visitConst(Const *) {}
-    virtual void visitString(String *) {}
-    virtual void visitRegExp(RegExp *) {}
+    virtual void visitString(IR::String *) {}
+    virtual void visitRegExp(IR::RegExp *) {}
     virtual void visitName(Name *) {}
     virtual void visitTemp(Temp *) {}
     virtual void visitClosure(Closure *) {}
@@ -3045,7 +3045,7 @@ namespace {
 /// and removes unreachable staements from the worklist, so that optimiseSSA won't consider them
 /// anymore.
 /// Important: this assumes that there are no critical edges in the control-flow graph!
-void purgeBB(BasicBlock *bb, Function *func, DefUsesCalculator &defUses, StatementWorklist &W,
+void purgeBB(BasicBlock *bb, IR::Function *func, DefUsesCalculator &defUses, StatementWorklist &W,
              DominatorTree &df)
 {
     // TODO: change this to mark the block as deleted, but leave it alone so that other references
@@ -3186,7 +3186,7 @@ bool tryOptimizingComparison(Expr *&expr)
 }
 } // anonymous namespace
 
-void optimizeSSA(Function *function, DefUsesCalculator &defUses, DominatorTree &df)
+void optimizeSSA(IR::Function *function, DefUsesCalculator &defUses, DominatorTree &df)
 {
     StatementWorklist W(function);
     ExprReplacer replaceUses(defUses, function);
@@ -3485,13 +3485,13 @@ void optimizeSSA(Function *function, DefUsesCalculator &defUses, DominatorTree &
 }
 
 class InputOutputCollector: protected StmtVisitor, protected ExprVisitor {
-    Function *function;
+    IR::Function *function;
 
 public:
     QList<Temp> inputs;
     QList<Temp> outputs;
 
-    InputOutputCollector(Function *f): function(f) {}
+    InputOutputCollector(IR::Function *f): function(f) {}
 
     void collect(Stmt *s) {
         inputs.clear();
@@ -3501,8 +3501,8 @@ public:
 
 protected:
     virtual void visitConst(Const *) {}
-    virtual void visitString(String *) {}
-    virtual void visitRegExp(RegExp *) {}
+    virtual void visitString(IR::String *) {}
+    virtual void visitRegExp(IR::RegExp *) {}
     virtual void visitName(Name *) {}
     virtual void visitTemp(Temp *e) {
         if (unescapableTemp(e, function))
@@ -3564,7 +3564,7 @@ class LifeRanges {
     QVector<LifeTimeInterval> _sortedRanges;
 
 public:
-    LifeRanges(Function *function, const QHash<BasicBlock *, BasicBlock *> &startEndLoops)
+    LifeRanges(IR::Function *function, const QHash<BasicBlock *, BasicBlock *> &startEndLoops)
     {
         int id = 0;
         foreach (BasicBlock *bb, function->basicBlocks) {
@@ -3614,7 +3614,7 @@ public:
     }
 
 private:
-    void buildIntervals(BasicBlock *bb, BasicBlock *loopEnd, Function *function)
+    void buildIntervals(BasicBlock *bb, BasicBlock *loopEnd, IR::Function *function)
     {
         LiveRegs live;
         foreach (BasicBlock *successor, bb->out) {
@@ -3999,7 +3999,7 @@ QSet<Jump *> Optimizer::calculateOptionalJumps()
     return optional;
 }
 
-void Optimizer::showMeTheCode(Function *function)
+void Optimizer::showMeTheCode(IR::Function *function)
 {
     ::showMeTheCode(function);
 }
@@ -4084,14 +4084,14 @@ void MoveMapping::order()
     qSwap(_moves, output);
 }
 
-QList<V4IR::Move *> MoveMapping::insertMoves(BasicBlock *bb, Function *function, bool atEnd) const
+QList<IR::Move *> MoveMapping::insertMoves(BasicBlock *bb, IR::Function *function, bool atEnd) const
 {
-    QList<V4IR::Move *> newMoves;
+    QList<IR::Move *> newMoves;
     newMoves.reserve(_moves.size());
 
     int insertionPoint = atEnd ? bb->statements.size() - 1 : 0;
     foreach (const Move &m, _moves) {
-        V4IR::Move *move = function->New<V4IR::Move>();
+        IR::Move *move = function->New<IR::Move>();
         move->init(clone(m.to, function), clone(m.from, function));
         move->swap = m.needsSwap;
         bb->statements.insert(insertionPoint++, move);
index 95bed40a27c4550299505132d271e056b18612c7..0f04138b4159ecaf4b87efa462dc93b59a083659 100644 (file)
@@ -48,8 +48,8 @@ QT_BEGIN_NAMESPACE
 class QTextStream;
 class QQmlEnginePrivate;
 
-namespace QQmlJS {
-namespace V4IR {
+namespace QV4 {
+namespace IR {
 
 class Q_AUTOTEST_EXPORT LifeTimeInterval {
 public:
@@ -88,7 +88,7 @@ public:
 
     void setTemp(const Temp &temp) { this->_temp = temp; }
     Temp temp() const { return _temp; }
-    bool isFP() const { return _temp.type == V4IR::DoubleType; }
+    bool isFP() const { return _temp.type == IR::DoubleType; }
 
     void setFrom(Stmt *from);
     void addRange(int from, int to);
@@ -155,7 +155,7 @@ public:
 
     QVector<LifeTimeInterval> lifeRanges() const;
 
-    QSet<V4IR::Jump *> calculateOptionalJumps();
+    QSet<IR::Jump *> calculateOptionalJumps();
 
     static void showMeTheCode(Function *function);
 
@@ -188,7 +188,7 @@ class MoveMapping
 public:
     void add(Expr *from, Temp *to);
     void order();
-    QList<V4IR::Move *> insertMoves(BasicBlock *bb, Function *function, bool atEnd) const;
+    QList<IR::Move *> insertMoves(BasicBlock *bb, Function *function, bool atEnd) const;
 
     void dump() const;
 
@@ -198,12 +198,12 @@ private:
                     QList<Move> &swaps) const;
 };
 
-} // V4IR namespace
-} // QQmlJS namespace
+} // IR namespace
+} // QV4 namespace
 
 
-Q_DECLARE_TYPEINFO(QQmlJS::V4IR::LifeTimeInterval, Q_MOVABLE_TYPE);
-Q_DECLARE_TYPEINFO(QQmlJS::V4IR::LifeTimeInterval::Range, Q_PRIMITIVE_TYPE);
+Q_DECLARE_TYPEINFO(QV4::IR::LifeTimeInterval, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(QV4::IR::LifeTimeInterval::Range, Q_PRIMITIVE_TYPE);
 
 QT_END_NAMESPACE
 
index 0cf2b79ac85eed3a13583c1a634552ec21293871..0cede2a2f1618f6335c68c007e63b4fae8e92f62 100644 (file)
@@ -62,9 +62,8 @@
 #  include <udis86.h>
 #endif
 
-using namespace QQmlJS;
-using namespace QQmlJS::MASM;
 using namespace QV4;
+using namespace QV4::JIT;
 
 CompilationUnit::~CompilationUnit()
 {
@@ -142,7 +141,7 @@ const int Assembler::calleeSavedRegisterCount = sizeof(calleeSavedRegisters) / s
 
 const Assembler::VoidType Assembler::Void;
 
-Assembler::Assembler(InstructionSelection *isel, V4IR::Function* function, QV4::ExecutableAllocator *executableAllocator,
+Assembler::Assembler(InstructionSelection *isel, IR::Function* function, QV4::ExecutableAllocator *executableAllocator,
                      int maxArgCountForBuiltins)
     : _stackLayout(function, maxArgCountForBuiltins)
     , _constTable(this)
@@ -153,14 +152,14 @@ Assembler::Assembler(InstructionSelection *isel, V4IR::Function* function, QV4::
 {
 }
 
-void Assembler::registerBlock(V4IR::BasicBlock* block, V4IR::BasicBlock *nextBlock)
+void Assembler::registerBlock(IR::BasicBlock* block, IR::BasicBlock *nextBlock)
 {
     _addrs[block] = label();
     catchBlock = block->catchBlock;
     _nextBlock = nextBlock;
 }
 
-void Assembler::jumpToBlock(V4IR::BasicBlock* current, V4IR::BasicBlock *target)
+void Assembler::jumpToBlock(IR::BasicBlock* current, IR::BasicBlock *target)
 {
     Q_UNUSED(current);
 
@@ -168,7 +167,7 @@ void Assembler::jumpToBlock(V4IR::BasicBlock* current, V4IR::BasicBlock *target)
         _patches[target].append(jump());
 }
 
-void Assembler::addPatch(V4IR::BasicBlock* targetBlock, Jump targetJump)
+void Assembler::addPatch(IR::BasicBlock* targetBlock, Jump targetJump)
 {
     _patches[targetBlock].append(targetJump);
 }
@@ -181,20 +180,20 @@ void Assembler::addPatch(DataLabelPtr patch, Label target)
     _dataLabelPatches.append(p);
 }
 
-void Assembler::addPatch(DataLabelPtr patch, V4IR::BasicBlock *target)
+void Assembler::addPatch(DataLabelPtr patch, IR::BasicBlock *target)
 {
     _labelPatches[target].append(patch);
 }
 
-void Assembler::generateCJumpOnNonZero(RegisterID reg, V4IR::BasicBlock *currentBlock,
-                                       V4IR::BasicBlock *trueBlock, V4IR::BasicBlock *falseBlock)
+void Assembler::generateCJumpOnNonZero(RegisterID reg, IR::BasicBlock *currentBlock,
+                                       IR::BasicBlock *trueBlock, IR::BasicBlock *falseBlock)
 {
     generateCJumpOnCompare(NotEqual, reg, TrustedImm32(0), currentBlock, trueBlock, falseBlock);
 }
 
 void Assembler::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)
 {
     if (trueBlock == _nextBlock) {
         Jump target = branch32(invert(cond), left, right);
@@ -207,8 +206,8 @@ void Assembler::generateCJumpOnCompare(RelationalCondition cond, RegisterID left
 }
 
 void Assembler::generateCJumpOnCompare(RelationalCondition cond, RegisterID left, RegisterID right,
-                                       V4IR::BasicBlock *currentBlock,  V4IR::BasicBlock *trueBlock,
-                                       V4IR::BasicBlock *falseBlock)
+                                       IR::BasicBlock *currentBlock,  IR::BasicBlock *trueBlock,
+                                       IR::BasicBlock *falseBlock)
 {
     if (trueBlock == _nextBlock) {
         Jump target = branch32(invert(cond), left, right);
@@ -220,7 +219,7 @@ void Assembler::generateCJumpOnCompare(RelationalCondition cond, RegisterID left
     }
 }
 
-Assembler::Pointer Assembler::loadTempAddress(RegisterID baseReg, V4IR::Temp *t)
+Assembler::Pointer Assembler::loadTempAddress(RegisterID baseReg, IR::Temp *t)
 {
     int32_t offset = 0;
     int scope = t->scope;
@@ -235,17 +234,17 @@ Assembler::Pointer Assembler::loadTempAddress(RegisterID baseReg, V4IR::Temp *t)
         }
     }
     switch (t->kind) {
-    case V4IR::Temp::Formal:
-    case V4IR::Temp::ScopedFormal: {
+    case IR::Temp::Formal:
+    case IR::Temp::ScopedFormal: {
         loadPtr(Address(context, qOffsetOf(ExecutionContext, callData)), baseReg);
         offset = sizeof(CallData) + (t->index - 1) * sizeof(Value);
     } break;
-    case V4IR::Temp::Local:
-    case V4IR::Temp::ScopedLocal: {
+    case IR::Temp::Local:
+    case IR::Temp::ScopedLocal: {
         loadPtr(Address(context, qOffsetOf(CallContext, locals)), baseReg);
         offset = t->index * sizeof(Value);
     } break;
-    case V4IR::Temp::StackSlot: {
+    case IR::Temp::StackSlot: {
         return stackSlotPointer(t);
     } break;
     default:
@@ -270,7 +269,7 @@ void Assembler::loadStringRef(RegisterID reg, const QString &string)
     addPtr(TrustedImmPtr(id * sizeof(QV4::StringValue)), reg);
 }
 
-void Assembler::storeValue(QV4::Primitive value, V4IR::Temp* destination)
+void Assembler::storeValue(QV4::Primitive value, IR::Temp* destination)
 {
     Address addr = loadTempAddress(ScratchRegister, destination);
     storeValue(value, addr);
@@ -329,7 +328,7 @@ void Assembler::leaveStandardStackFrame()
 #define NULL_OP \
     { 0, 0, 0, 0, 0 }
 
-const Assembler::BinaryOperationInfo Assembler::binaryOperations[QQmlJS::V4IR::LastAluOp + 1] = {
+const Assembler::BinaryOperationInfo Assembler::binaryOperations[IR::LastAluOp + 1] = {
     NULL_OP, // OpInvalid
     NULL_OP, // OpIfTrue
     NULL_OP, // OpNot
@@ -374,32 +373,32 @@ const Assembler::BinaryOperationInfo Assembler::binaryOperations[QQmlJS::V4IR::L
 // Try to load the source expression into the destination FP register. This assumes that two
 // general purpose (integer) registers are available: the ScratchRegister and the
 // ReturnValueRegister. It returns a Jump if no conversion can be performed.
-Assembler::Jump Assembler::genTryDoubleConversion(V4IR::Expr *src, Assembler::FPRegisterID dest)
+Assembler::Jump Assembler::genTryDoubleConversion(IR::Expr *src, Assembler::FPRegisterID dest)
 {
     switch (src->type) {
-    case V4IR::DoubleType:
+    case IR::DoubleType:
         moveDouble(toDoubleRegister(src, dest), dest);
         return Assembler::Jump();
-    case V4IR::SInt32Type:
+    case IR::SInt32Type:
         convertInt32ToDouble(toInt32Register(src, Assembler::ScratchRegister),
                                   dest);
         return Assembler::Jump();
-    case V4IR::UInt32Type:
+    case IR::UInt32Type:
         convertUInt32ToDouble(toUInt32Register(src, Assembler::ScratchRegister),
                                    dest, Assembler::ReturnValueRegister);
         return Assembler::Jump();
-    case V4IR::BoolType:
+    case IR::BoolType:
         // TODO?
         return jump();
     default:
         break;
     }
 
-    V4IR::Temp *sourceTemp = src->asTemp();
+    IR::Temp *sourceTemp = src->asTemp();
     Q_ASSERT(sourceTemp);
 
     // It's not a number type, so it cannot be in a register.
-    Q_ASSERT(sourceTemp->kind != V4IR::Temp::PhysicalRegister || sourceTemp->type == V4IR::BoolType);
+    Q_ASSERT(sourceTemp->kind != IR::Temp::PhysicalRegister || sourceTemp->type == IR::BoolType);
 
     Assembler::Pointer tagAddr = loadTempAddress(Assembler::ScratchRegister, sourceTemp);
     tagAddr.offset += 4;
@@ -430,17 +429,17 @@ Assembler::Jump Assembler::genTryDoubleConversion(V4IR::Expr *src, Assembler::FP
 
 #ifndef QT_NO_DEBUG
 namespace {
-inline bool isPregOrConst(V4IR::Expr *e)
+inline bool isPregOrConst(IR::Expr *e)
 {
-    if (V4IR::Temp *t = e->asTemp())
-        return t->kind == V4IR::Temp::PhysicalRegister;
+    if (IR::Temp *t = e->asTemp())
+        return t->kind == IR::Temp::PhysicalRegister;
     return e->asConst() != 0;
 }
 } // anonymous namespace
 #endif
 
-Assembler::Jump Assembler::branchDouble(bool invertCondition, V4IR::AluOp op,
-                                                   V4IR::Expr *left, V4IR::Expr *right)
+Assembler::Jump Assembler::branchDouble(bool invertCondition, IR::AluOp op,
+                                                   IR::Expr *left, IR::Expr *right)
 {
     Q_ASSERT(isPregOrConst(left));
     Q_ASSERT(isPregOrConst(right));
@@ -448,14 +447,14 @@ Assembler::Jump Assembler::branchDouble(bool invertCondition, V4IR::AluOp op,
 
     Assembler::DoubleCondition cond;
     switch (op) {
-    case V4IR::OpGt: cond = Assembler::DoubleGreaterThan; break;
-    case V4IR::OpLt: cond = Assembler::DoubleLessThan; break;
-    case V4IR::OpGe: cond = Assembler::DoubleGreaterThanOrEqual; break;
-    case V4IR::OpLe: cond = Assembler::DoubleLessThanOrEqual; break;
-    case V4IR::OpEqual:
-    case V4IR::OpStrictEqual: cond = Assembler::DoubleEqual; break;
-    case V4IR::OpNotEqual:
-    case V4IR::OpStrictNotEqual: cond = Assembler::DoubleNotEqualOrUnordered; break; // No, the inversion of DoubleEqual is NOT DoubleNotEqual.
+    case IR::OpGt: cond = Assembler::DoubleGreaterThan; break;
+    case IR::OpLt: cond = Assembler::DoubleLessThan; break;
+    case IR::OpGe: cond = Assembler::DoubleGreaterThanOrEqual; break;
+    case IR::OpLe: cond = Assembler::DoubleLessThanOrEqual; break;
+    case IR::OpEqual:
+    case IR::OpStrictEqual: cond = Assembler::DoubleEqual; break;
+    case IR::OpNotEqual:
+    case IR::OpStrictNotEqual: cond = Assembler::DoubleNotEqualOrUnordered; break; // No, the inversion of DoubleEqual is NOT DoubleNotEqual.
     default:
         Q_UNREACHABLE();
     }
index daa7816a2d157f5eba5f305089782c02dcc56cf2..dd1209a0263202f9639232b6d4ae77b85523bdd4 100644 (file)
@@ -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
 
index 02762db65b578626498dd051919a6382a671adba..473f260be744cd7e4cbcd82a39e1ed2eaf14bfb5 100644 (file)
 using namespace QV4;
 using namespace JIT;
 
-using namespace QQmlJS;
-using namespace MASM;
-
 namespace {
-inline bool isPregOrConst(V4IR::Expr *e)
+inline bool isPregOrConst(IR::Expr *e)
 {
-    if (V4IR::Temp *t = e->asTemp())
-        return t->kind == V4IR::Temp::PhysicalRegister;
+    if (IR::Temp *t = e->asTemp())
+        return t->kind == IR::Temp::PhysicalRegister;
     return e->asConst() != 0;
 }
 } // anonymous namespace
 
-void Binop::generate(V4IR::Expr *lhs, V4IR::Expr *rhs, V4IR::Temp *target)
+void Binop::generate(IR::Expr *lhs, IR::Expr *rhs, IR::Temp *target)
 {
-    if (op != V4IR::OpMod
-            && lhs->type == V4IR::DoubleType && rhs->type == V4IR::DoubleType
+    if (op != IR::OpMod
+            && lhs->type == IR::DoubleType && rhs->type == IR::DoubleType
             && isPregOrConst(lhs) && isPregOrConst(rhs)) {
         doubleBinop(lhs, rhs, target);
         return;
     }
-    if (lhs->type == V4IR::SInt32Type && rhs->type == V4IR::SInt32Type) {
+    if (lhs->type == IR::SInt32Type && rhs->type == IR::SInt32Type) {
         if (int32Binop(lhs, rhs, target))
             return;
     }
 
     Assembler::Jump done;
-    if (lhs->type != V4IR::StringType && rhs->type != V4IR::StringType)
+    if (lhs->type != IR::StringType && rhs->type != IR::StringType)
         done = genInlineBinop(lhs, rhs, target);
 
     // TODO: inline var===null and var!==null
     Assembler::BinaryOperationInfo info = Assembler::binaryOperation(op);
 
-    if (op == V4IR::OpAdd &&
-            (lhs->type == V4IR::StringType || rhs->type == V4IR::StringType)) {
+    if (op == IR::OpAdd &&
+            (lhs->type == IR::StringType || rhs->type == IR::StringType)) {
         const Assembler::BinaryOperationInfo stringAdd = OPCONTEXT(__qmljs_add_string);
         info = stringAdd;
     }
@@ -102,30 +99,30 @@ void Binop::generate(V4IR::Expr *lhs, V4IR::Expr *rhs, V4IR::Temp *target)
 
 }
 
-void Binop::doubleBinop(V4IR::Expr *lhs, V4IR::Expr *rhs, V4IR::Temp *target)
+void Binop::doubleBinop(IR::Expr *lhs, IR::Expr *rhs, IR::Temp *target)
 {
     Q_ASSERT(lhs->asConst() == 0 || rhs->asConst() == 0);
     Q_ASSERT(isPregOrConst(lhs));
     Q_ASSERT(isPregOrConst(rhs));
     Assembler::FPRegisterID targetReg;
-    if (target->kind == V4IR::Temp::PhysicalRegister)
+    if (target->kind == IR::Temp::PhysicalRegister)
         targetReg = (Assembler::FPRegisterID) target->index;
     else
         targetReg = Assembler::FPGpr0;
 
     switch (op) {
-    case V4IR::OpAdd:
+    case IR::OpAdd:
         as->addDouble(as->toDoubleRegister(lhs), as->toDoubleRegister(rhs),
                        targetReg);
         break;
-    case V4IR::OpMul:
+    case IR::OpMul:
         as->mulDouble(as->toDoubleRegister(lhs), as->toDoubleRegister(rhs),
                        targetReg);
         break;
-    case V4IR::OpSub:
+    case IR::OpSub:
 #if CPU(X86) || CPU(X86_64)
-        if (V4IR::Temp *rightTemp = rhs->asTemp()) {
-            if (rightTemp->kind == V4IR::Temp::PhysicalRegister && rightTemp->index == targetReg) {
+        if (IR::Temp *rightTemp = rhs->asTemp()) {
+            if (rightTemp->kind == IR::Temp::PhysicalRegister && rightTemp->index == targetReg) {
                 as->moveDouble(targetReg, Assembler::FPGpr0);
                 as->moveDouble(as->toDoubleRegister(lhs, targetReg), targetReg);
                 as->subDouble(Assembler::FPGpr0, targetReg);
@@ -133,7 +130,7 @@ void Binop::doubleBinop(V4IR::Expr *lhs, V4IR::Expr *rhs, V4IR::Temp *target)
             }
         } else if (rhs->asConst() && targetReg == Assembler::FPGpr0) {
             Q_ASSERT(lhs->asTemp());
-            Q_ASSERT(lhs->asTemp()->kind == V4IR::Temp::PhysicalRegister);
+            Q_ASSERT(lhs->asTemp()->kind == IR::Temp::PhysicalRegister);
             as->moveDouble(as->toDoubleRegister(lhs, targetReg), targetReg);
             Assembler::FPRegisterID reg = (Assembler::FPRegisterID) lhs->asTemp()->index;
             as->moveDouble(as->toDoubleRegister(rhs, reg), reg);
@@ -145,10 +142,10 @@ void Binop::doubleBinop(V4IR::Expr *lhs, V4IR::Expr *rhs, V4IR::Temp *target)
         as->subDouble(as->toDoubleRegister(lhs), as->toDoubleRegister(rhs),
                        targetReg);
         break;
-    case V4IR::OpDiv:
+    case IR::OpDiv:
 #if CPU(X86) || CPU(X86_64)
-        if (V4IR::Temp *rightTemp = rhs->asTemp()) {
-            if (rightTemp->kind == V4IR::Temp::PhysicalRegister && rightTemp->index == targetReg) {
+        if (IR::Temp *rightTemp = rhs->asTemp()) {
+            if (rightTemp->kind == IR::Temp::PhysicalRegister && rightTemp->index == targetReg) {
                 as->moveDouble(targetReg, Assembler::FPGpr0);
                 as->moveDouble(as->toDoubleRegister(lhs, targetReg), targetReg);
                 as->divDouble(Assembler::FPGpr0, targetReg);
@@ -156,7 +153,7 @@ void Binop::doubleBinop(V4IR::Expr *lhs, V4IR::Expr *rhs, V4IR::Temp *target)
             }
         } else if (rhs->asConst() && targetReg == Assembler::FPGpr0) {
             Q_ASSERT(lhs->asTemp());
-            Q_ASSERT(lhs->asTemp()->kind == V4IR::Temp::PhysicalRegister);
+            Q_ASSERT(lhs->asTemp()->kind == IR::Temp::PhysicalRegister);
             as->moveDouble(as->toDoubleRegister(lhs, targetReg), targetReg);
             Assembler::FPRegisterID reg = (Assembler::FPRegisterID) lhs->asTemp()->index;
             as->moveDouble(as->toDoubleRegister(rhs, reg), reg);
@@ -168,7 +165,7 @@ void Binop::doubleBinop(V4IR::Expr *lhs, V4IR::Expr *rhs, V4IR::Temp *target)
                        targetReg);
         break;
     default: {
-        Q_ASSERT(target->type == V4IR::BoolType);
+        Q_ASSERT(target->type == IR::BoolType);
         Assembler::Jump trueCase = as->branchDouble(false, op, lhs, rhs);
         as->storeBool(false, target);
         Assembler::Jump done = as->jump();
@@ -178,25 +175,25 @@ void Binop::doubleBinop(V4IR::Expr *lhs, V4IR::Expr *rhs, V4IR::Temp *target)
     } return;
     }
 
-    if (target->kind != V4IR::Temp::PhysicalRegister)
+    if (target->kind != IR::Temp::PhysicalRegister)
         as->storeDouble(Assembler::FPGpr0, target);
 }
 
 
-bool Binop::int32Binop(V4IR::Expr *leftSource, V4IR::Expr *rightSource, V4IR::Temp *target)
+bool Binop::int32Binop(IR::Expr *leftSource, IR::Expr *rightSource, IR::Temp *target)
 {
-    Q_ASSERT(leftSource->type == V4IR::SInt32Type);
+    Q_ASSERT(leftSource->type == IR::SInt32Type);
     Assembler::RegisterID targetReg;
-    if (target->kind == V4IR::Temp::PhysicalRegister)
+    if (target->kind == IR::Temp::PhysicalRegister)
         targetReg = (Assembler::RegisterID) target->index;
     else
         targetReg = Assembler::ReturnValueRegister;
 
     switch (op) {
-    case V4IR::OpBitAnd: {
-        Q_ASSERT(rightSource->type == V4IR::SInt32Type);
-        if (rightSource->asTemp() && rightSource->asTemp()->kind == V4IR::Temp::PhysicalRegister
-                && target->kind == V4IR::Temp::PhysicalRegister
+    case IR::OpBitAnd: {
+        Q_ASSERT(rightSource->type == IR::SInt32Type);
+        if (rightSource->asTemp() && rightSource->asTemp()->kind == IR::Temp::PhysicalRegister
+                && target->kind == IR::Temp::PhysicalRegister
                 && target->index == rightSource->asTemp()->index) {
             as->and32(as->toInt32Register(leftSource, Assembler::ScratchRegister),
                        (Assembler::RegisterID) target->index);
@@ -208,10 +205,10 @@ bool Binop::int32Binop(V4IR::Expr *leftSource, V4IR::Expr *rightSource, V4IR::Te
                    targetReg);
         as->storeInt32(targetReg, target);
     } return true;
-    case V4IR::OpBitOr: {
-        Q_ASSERT(rightSource->type == V4IR::SInt32Type);
-        if (rightSource->asTemp() && rightSource->asTemp()->kind == V4IR::Temp::PhysicalRegister
-                && target->kind == V4IR::Temp::PhysicalRegister
+    case IR::OpBitOr: {
+        Q_ASSERT(rightSource->type == IR::SInt32Type);
+        if (rightSource->asTemp() && rightSource->asTemp()->kind == IR::Temp::PhysicalRegister
+                && target->kind == IR::Temp::PhysicalRegister
                 && target->index == rightSource->asTemp()->index) {
             as->or32(as->toInt32Register(leftSource, Assembler::ScratchRegister),
                        (Assembler::RegisterID) target->index);
@@ -223,10 +220,10 @@ bool Binop::int32Binop(V4IR::Expr *leftSource, V4IR::Expr *rightSource, V4IR::Te
                   targetReg);
         as->storeInt32(targetReg, target);
     } return true;
-    case V4IR::OpBitXor: {
-        Q_ASSERT(rightSource->type == V4IR::SInt32Type);
-        if (rightSource->asTemp() && rightSource->asTemp()->kind == V4IR::Temp::PhysicalRegister
-                && target->kind == V4IR::Temp::PhysicalRegister
+    case IR::OpBitXor: {
+        Q_ASSERT(rightSource->type == IR::SInt32Type);
+        if (rightSource->asTemp() && rightSource->asTemp()->kind == IR::Temp::PhysicalRegister
+                && target->kind == IR::Temp::PhysicalRegister
                 && target->index == rightSource->asTemp()->index) {
             as->xor32(as->toInt32Register(leftSource, Assembler::ScratchRegister),
                        (Assembler::RegisterID) target->index);
@@ -238,10 +235,10 @@ bool Binop::int32Binop(V4IR::Expr *leftSource, V4IR::Expr *rightSource, V4IR::Te
                    targetReg);
         as->storeInt32(targetReg, target);
     } return true;
-    case V4IR::OpLShift: {
-        Q_ASSERT(rightSource->type == V4IR::SInt32Type);
+    case IR::OpLShift: {
+        Q_ASSERT(rightSource->type == IR::SInt32Type);
 
-        if (V4IR::Const *c = rightSource->asConst()) {
+        if (IR::Const *c = rightSource->asConst()) {
             as->lshift32(as->toInt32Register(leftSource, Assembler::ReturnValueRegister),
                           Assembler::TrustedImm32(int(c->value) & 0x1f), targetReg);
         } else {
@@ -253,10 +250,10 @@ bool Binop::int32Binop(V4IR::Expr *leftSource, V4IR::Expr *rightSource, V4IR::Te
         }
         as->storeInt32(targetReg, target);
     } return true;
-    case V4IR::OpRShift: {
-        Q_ASSERT(rightSource->type == V4IR::SInt32Type);
+    case IR::OpRShift: {
+        Q_ASSERT(rightSource->type == IR::SInt32Type);
 
-        if (V4IR::Const *c = rightSource->asConst()) {
+        if (IR::Const *c = rightSource->asConst()) {
             as->rshift32(as->toInt32Register(leftSource, Assembler::ReturnValueRegister),
                           Assembler::TrustedImm32(int(c->value) & 0x1f), targetReg);
         } else {
@@ -267,10 +264,10 @@ bool Binop::int32Binop(V4IR::Expr *leftSource, V4IR::Expr *rightSource, V4IR::Te
         }
         as->storeInt32(targetReg, target);
     } return true;
-    case V4IR::OpURShift:
-        Q_ASSERT(rightSource->type == V4IR::SInt32Type);
+    case IR::OpURShift:
+        Q_ASSERT(rightSource->type == IR::SInt32Type);
 
-        if (V4IR::Const *c = rightSource->asConst()) {
+        if (IR::Const *c = rightSource->asConst()) {
             as->urshift32(as->toInt32Register(leftSource, Assembler::ReturnValueRegister),
                            Assembler::TrustedImm32(int(c->value) & 0x1f), targetReg);
         } else {
@@ -281,11 +278,11 @@ bool Binop::int32Binop(V4IR::Expr *leftSource, V4IR::Expr *rightSource, V4IR::Te
         }
         as->storeUInt32(targetReg, target);
         return true;
-    case V4IR::OpAdd: {
-        Q_ASSERT(rightSource->type == V4IR::SInt32Type);
+    case IR::OpAdd: {
+        Q_ASSERT(rightSource->type == IR::SInt32Type);
 
         Assembler::RegisterID targetReg;
-        if (target->kind == V4IR::Temp::PhysicalRegister)
+        if (target->kind == IR::Temp::PhysicalRegister)
             targetReg = (Assembler::RegisterID) target->index;
         else
             targetReg = Assembler::ReturnValueRegister;
@@ -295,11 +292,11 @@ bool Binop::int32Binop(V4IR::Expr *leftSource, V4IR::Expr *rightSource, V4IR::Te
                    targetReg);
         as->storeInt32(targetReg, target);
     } return true;
-    case V4IR::OpSub: {
-        Q_ASSERT(rightSource->type == V4IR::SInt32Type);
+    case IR::OpSub: {
+        Q_ASSERT(rightSource->type == IR::SInt32Type);
 
-        if (rightSource->asTemp() && rightSource->asTemp()->kind == V4IR::Temp::PhysicalRegister
-                && target->kind == V4IR::Temp::PhysicalRegister
+        if (rightSource->asTemp() && rightSource->asTemp()->kind == IR::Temp::PhysicalRegister
+                && target->kind == IR::Temp::PhysicalRegister
                 && target->index == rightSource->asTemp()->index) {
             Assembler::RegisterID targetReg = (Assembler::RegisterID) target->index;
             as->move(targetReg, Assembler::ScratchRegister);
@@ -310,7 +307,7 @@ bool Binop::int32Binop(V4IR::Expr *leftSource, V4IR::Expr *rightSource, V4IR::Te
         }
 
         Assembler::RegisterID targetReg;
-        if (target->kind == V4IR::Temp::PhysicalRegister)
+        if (target->kind == IR::Temp::PhysicalRegister)
             targetReg = (Assembler::RegisterID) target->index;
         else
             targetReg = Assembler::ReturnValueRegister;
@@ -319,11 +316,11 @@ bool Binop::int32Binop(V4IR::Expr *leftSource, V4IR::Expr *rightSource, V4IR::Te
         as->sub32(as->toInt32Register(rightSource, Assembler::ScratchRegister), targetReg);
         as->storeInt32(targetReg, target);
     } return true;
-    case V4IR::OpMul: {
-        Q_ASSERT(rightSource->type == V4IR::SInt32Type);
+    case IR::OpMul: {
+        Q_ASSERT(rightSource->type == IR::SInt32Type);
 
         Assembler::RegisterID targetReg;
-        if (target->kind == V4IR::Temp::PhysicalRegister)
+        if (target->kind == IR::Temp::PhysicalRegister)
             targetReg = (Assembler::RegisterID) target->index;
         else
             targetReg = Assembler::ReturnValueRegister;
@@ -338,17 +335,17 @@ bool Binop::int32Binop(V4IR::Expr *leftSource, V4IR::Expr *rightSource, V4IR::Te
     }
 }
 
-static inline Assembler::FPRegisterID getFreeFPReg(V4IR::Expr *shouldNotOverlap, unsigned hint)
+static inline Assembler::FPRegisterID getFreeFPReg(IR::Expr *shouldNotOverlap, unsigned hint)
 {
-    if (V4IR::Temp *t = shouldNotOverlap->asTemp())
-        if (t->type == V4IR::DoubleType)
-            if (t->kind == V4IR::Temp::PhysicalRegister)
+    if (IR::Temp *t = shouldNotOverlap->asTemp())
+        if (t->type == IR::DoubleType)
+            if (t->kind == IR::Temp::PhysicalRegister)
                 if (t->index == hint)
                     return Assembler::FPRegisterID(hint + 1);
     return Assembler::FPRegisterID(hint);
 }
 
-Assembler::Jump Binop::genInlineBinop(V4IR::Expr *leftSource, V4IR::Expr *rightSource, V4IR::Temp *target)
+Assembler::Jump Binop::genInlineBinop(IR::Expr *leftSource, IR::Expr *rightSource, IR::Temp *target)
 {
     Assembler::Jump done;
 
@@ -361,7 +358,7 @@ Assembler::Jump Binop::genInlineBinop(V4IR::Expr *leftSource, V4IR::Expr *rightS
     // Note: FPGPr0 can still not be used, because uint32->double conversion uses it as a scratch
     //       register.
     switch (op) {
-    case V4IR::OpAdd: {
+    case IR::OpAdd: {
         Assembler::FPRegisterID lReg = getFreeFPReg(rightSource, 2);
         Assembler::FPRegisterID rReg = getFreeFPReg(leftSource, 4);
         Assembler::Jump leftIsNoDbl = as->genTryDoubleConversion(leftSource, lReg);
@@ -376,7 +373,7 @@ Assembler::Jump Binop::genInlineBinop(V4IR::Expr *leftSource, V4IR::Expr *rightS
         if (rightIsNoDbl.isSet())
             rightIsNoDbl.link(as);
     } break;
-    case V4IR::OpMul: {
+    case IR::OpMul: {
         Assembler::FPRegisterID lReg = getFreeFPReg(rightSource, 2);
         Assembler::FPRegisterID rReg = getFreeFPReg(leftSource, 4);
         Assembler::Jump leftIsNoDbl = as->genTryDoubleConversion(leftSource, lReg);
@@ -391,7 +388,7 @@ Assembler::Jump Binop::genInlineBinop(V4IR::Expr *leftSource, V4IR::Expr *rightS
         if (rightIsNoDbl.isSet())
             rightIsNoDbl.link(as);
     } break;
-    case V4IR::OpSub: {
+    case IR::OpSub: {
         Assembler::FPRegisterID lReg = getFreeFPReg(rightSource, 2);
         Assembler::FPRegisterID rReg = getFreeFPReg(leftSource, 4);
         Assembler::Jump leftIsNoDbl = as->genTryDoubleConversion(leftSource, lReg);
@@ -406,7 +403,7 @@ Assembler::Jump Binop::genInlineBinop(V4IR::Expr *leftSource, V4IR::Expr *rightS
         if (rightIsNoDbl.isSet())
             rightIsNoDbl.link(as);
     } break;
-    case V4IR::OpDiv: {
+    case IR::OpDiv: {
         Assembler::FPRegisterID lReg = getFreeFPReg(rightSource, 2);
         Assembler::FPRegisterID rReg = getFreeFPReg(leftSource, 4);
         Assembler::Jump leftIsNoDbl = as->genTryDoubleConversion(leftSource, lReg);
index 06e0a8b68a12ea2fc793a848ca60c99b86d63d61..d29b370f37db4e735e185648001bd421b6193087 100644 (file)
@@ -52,18 +52,18 @@ namespace QV4 {
 namespace JIT {
 
 struct Binop {
-    Binop(QQmlJS::MASM::Assembler *assembler, QQmlJS::V4IR::AluOp operation)
+    Binop(Assembler *assembler, IR::AluOp operation)
         : as(assembler)
         , op(operation)
     {}
 
-    void generate(QQmlJS::V4IR::Expr *lhs, QQmlJS::V4IR::Expr *rhs, QQmlJS::V4IR::Temp *target);
-    void doubleBinop(QQmlJS::V4IR::Expr *lhs, QQmlJS::V4IR::Expr *rhs, QQmlJS::V4IR::Temp *target);
-    bool int32Binop(QQmlJS::V4IR::Expr *leftSource, QQmlJS::V4IR::Expr *rightSource, QQmlJS::V4IR::Temp *target);
-    QQmlJS::MASM::Assembler::Jump genInlineBinop(QQmlJS::V4IR::Expr *leftSource, QQmlJS::V4IR::Expr *rightSource, QQmlJS::V4IR::Temp *target);
+    void generate(IR::Expr *lhs, IR::Expr *rhs, IR::Temp *target);
+    void doubleBinop(IR::Expr *lhs, IR::Expr *rhs, IR::Temp *target);
+    bool int32Binop(IR::Expr *leftSource, IR::Expr *rightSource, IR::Temp *target);
+    Assembler::Jump genInlineBinop(IR::Expr *leftSource, IR::Expr *rightSource, IR::Temp *target);
 
-    QQmlJS::MASM::Assembler *as;
-    QQmlJS::V4IR::AluOp op;
+    Assembler *as;
+    IR::AluOp op;
 };
 
 }
index 26ef359b05751b43e432f09ea4554994e18c88c3..035d0fec762960adae921c9ad93f6e099d3df1f9 100644 (file)
 #  include <udis86.h>
 #endif
 
-using namespace QQmlJS;
-using namespace QQmlJS::MASM;
 using namespace QV4;
+using namespace QV4::JIT;
 
 
 namespace {
-inline bool isPregOrConst(V4IR::Expr *e)
+inline bool isPregOrConst(IR::Expr *e)
 {
-    if (V4IR::Temp *t = e->asTemp())
-        return t->kind == V4IR::Temp::PhysicalRegister;
+    if (IR::Temp *t = e->asTemp())
+        return t->kind == IR::Temp::PhysicalRegister;
     return e->asConst() != 0;
 }
 } // anonymous namespace
@@ -97,10 +96,10 @@ JSC::MacroAssemblerCodeRef Assembler::link(int *codeSize)
     Label endOfCode = label();
 
     {
-        QHashIterator<V4IR::BasicBlock *, QVector<Jump> > it(_patches);
+        QHashIterator<IR::BasicBlock *, QVector<Jump> > it(_patches);
         while (it.hasNext()) {
             it.next();
-            V4IR::BasicBlock *block = it.key();
+            IR::BasicBlock *block = it.key();
             Label target = _addrs.value(block);
             assert(target.isSet());
             foreach (Jump jump, it.value())
@@ -125,10 +124,10 @@ JSC::MacroAssemblerCodeRef Assembler::link(int *codeSize)
         linkBuffer.link(jump, linkBuffer.locationOf(exceptionReturnLabel));
 
     {
-        QHashIterator<V4IR::BasicBlock *, QVector<DataLabelPtr> > it(_labelPatches);
+        QHashIterator<IR::BasicBlock *, QVector<DataLabelPtr> > it(_labelPatches);
         while (it.hasNext()) {
             it.next();
-            V4IR::BasicBlock *block = it.key();
+            IR::BasicBlock *block = it.key();
             Label target = _addrs.value(block);
             assert(target.isSet());
             foreach (DataLabelPtr label, it.value())
@@ -192,7 +191,7 @@ JSC::MacroAssemblerCodeRef Assembler::link(int *codeSize)
     return codeRef;
 }
 
-InstructionSelection::InstructionSelection(QQmlEnginePrivate *qmlEngine, QV4::ExecutableAllocator *execAllocator, V4IR::Module *module, Compiler::JSUnitGenerator *jsGenerator)
+InstructionSelection::InstructionSelection(QQmlEnginePrivate *qmlEngine, QV4::ExecutableAllocator *execAllocator, IR::Module *module, Compiler::JSUnitGenerator *jsGenerator)
     : EvalInstructionSelection(execAllocator, module, jsGenerator)
     , _block(0)
     , _as(0)
@@ -273,11 +272,11 @@ static QVector<int> getFpRegisters()
 
 void InstructionSelection::run(int functionIndex)
 {
-    V4IR::Function *function = irModule->functions[functionIndex];
+    IR::Function *function = irModule->functions[functionIndex];
     QVector<Lookup> lookups;
     qSwap(_function, function);
 
-    V4IR::Optimizer opt(_function);
+    IR::Optimizer opt(_function);
     opt.run(qmlEngine);
 
 #ifdef REGALLOC_IS_SUPPORTED
@@ -292,8 +291,8 @@ void InstructionSelection::run(int functionIndex)
             opt.convertOutOfSSA();
         ConvertTemps().toStackSlots(_function);
     }
-    V4IR::Optimizer::showMeTheCode(_function);
-    QSet<V4IR::Jump *> removableJumps = opt.calculateOptionalJumps();
+    IR::Optimizer::showMeTheCode(_function);
+    QSet<IR::Jump *> removableJumps = opt.calculateOptionalJumps();
     qSwap(_removableJumps, removableJumps);
 
     Assembler* oldAssembler = _as;
@@ -315,11 +314,11 @@ void InstructionSelection::run(int functionIndex)
 
     int lastLine = -1;
     for (int i = 0, ei = _function->basicBlocks.size(); i != ei; ++i) {
-        V4IR::BasicBlock *nextBlock = (i < ei - 1) ? _function->basicBlocks[i + 1] : 0;
+        IR::BasicBlock *nextBlock = (i < ei - 1) ? _function->basicBlocks[i + 1] : 0;
         _block = _function->basicBlocks[i];
         _as->registerBlock(_block, nextBlock);
 
-        foreach (V4IR::Stmt *s, _block->statements) {
+        foreach (IR::Stmt *s, _block->statements) {
             if (s->location.isValid()) {
                 if (int(s->location.startLine) != lastLine) {
                     Assembler::Address lineAddr(Assembler::ContextRegister, qOffsetOf(QV4::ExecutionContext, lineNumber));
@@ -358,7 +357,7 @@ QV4::CompiledData::CompilationUnit *InstructionSelection::backendCompileStep()
     return compilationUnit;
 }
 
-void InstructionSelection::callBuiltinInvalid(V4IR::Name *func, V4IR::ExprList *args, V4IR::Temp *result)
+void InstructionSelection::callBuiltinInvalid(IR::Name *func, IR::ExprList *args, IR::Temp *result)
 {
     prepareCallData(args, 0);
 
@@ -376,58 +375,58 @@ void InstructionSelection::callBuiltinInvalid(V4IR::Name *func, V4IR::ExprList *
     }
 }
 
-void InstructionSelection::callBuiltinTypeofMember(V4IR::Expr *base, const QString &name,
-                                                   V4IR::Temp *result)
+void InstructionSelection::callBuiltinTypeofMember(IR::Expr *base, const QString &name,
+                                                   IR::Temp *result)
 {
     generateFunctionCall(result, __qmljs_builtin_typeof_member, Assembler::ContextRegister,
                          Assembler::PointerToValue(base), Assembler::PointerToString(name));
 }
 
-void InstructionSelection::callBuiltinTypeofSubscript(V4IR::Expr *base, V4IR::Expr *index,
-                                                      V4IR::Temp *result)
+void InstructionSelection::callBuiltinTypeofSubscript(IR::Expr *base, IR::Expr *index,
+                                                      IR::Temp *result)
 {
     generateFunctionCall(result, __qmljs_builtin_typeof_element,
                          Assembler::ContextRegister,
                          Assembler::PointerToValue(base), Assembler::PointerToValue(index));
 }
 
-void InstructionSelection::callBuiltinTypeofName(const QString &name, V4IR::Temp *result)
+void InstructionSelection::callBuiltinTypeofName(const QString &name, IR::Temp *result)
 {
     generateFunctionCall(result, __qmljs_builtin_typeof_name, Assembler::ContextRegister,
                          Assembler::PointerToString(name));
 }
 
-void InstructionSelection::callBuiltinTypeofValue(V4IR::Expr *value, V4IR::Temp *result)
+void InstructionSelection::callBuiltinTypeofValue(IR::Expr *value, IR::Temp *result)
 {
     generateFunctionCall(result, __qmljs_builtin_typeof, Assembler::ContextRegister,
                          Assembler::PointerToValue(value));
 }
 
-void InstructionSelection::callBuiltinDeleteMember(V4IR::Temp *base, const QString &name, V4IR::Temp *result)
+void InstructionSelection::callBuiltinDeleteMember(IR::Temp *base, const QString &name, IR::Temp *result)
 {
     generateFunctionCall(result, __qmljs_delete_member, Assembler::ContextRegister,
                          Assembler::Reference(base), Assembler::PointerToString(name));
 }
 
-void InstructionSelection::callBuiltinDeleteSubscript(V4IR::Temp *base, V4IR::Expr *index,
-                                                      V4IR::Temp *result)
+void InstructionSelection::callBuiltinDeleteSubscript(IR::Temp *base, IR::Expr *index,
+                                                      IR::Temp *result)
 {
     generateFunctionCall(result, __qmljs_delete_subscript, Assembler::ContextRegister,
                          Assembler::Reference(base), Assembler::PointerToValue(index));
 }
 
-void InstructionSelection::callBuiltinDeleteName(const QString &name, V4IR::Temp *result)
+void InstructionSelection::callBuiltinDeleteName(const QString &name, IR::Temp *result)
 {
     generateFunctionCall(result, __qmljs_delete_name, Assembler::ContextRegister,
                          Assembler::PointerToString(name));
 }
 
-void InstructionSelection::callBuiltinDeleteValue(V4IR::Temp *result)
+void InstructionSelection::callBuiltinDeleteValue(IR::Temp *result)
 {
     _as->storeValue(Primitive::fromBoolean(false), result);
 }
 
-void InstructionSelection::callBuiltinThrow(V4IR::Expr *arg)
+void InstructionSelection::callBuiltinThrow(IR::Expr *arg)
 {
     generateFunctionCall(Assembler::ReturnValueRegister, __qmljs_throw, Assembler::ContextRegister,
                          Assembler::PointerToValue(arg));
@@ -438,7 +437,7 @@ void InstructionSelection::callBuiltinReThrow()
     _as->jumpToExceptionHandler();
 }
 
-void InstructionSelection::callBuiltinUnwindException(V4IR::Temp *result)
+void InstructionSelection::callBuiltinUnwindException(IR::Temp *result)
 {
     generateFunctionCall(result, __qmljs_builtin_unwind_exception, Assembler::ContextRegister);
 
@@ -450,7 +449,7 @@ void InstructionSelection::callBuiltinPushCatchScope(const QString &exceptionNam
     generateFunctionCall(Assembler::ContextRegister, __qmljs_builtin_push_catch_scope, Assembler::ContextRegister, s);
 }
 
-void InstructionSelection::callBuiltinForeachIteratorObject(V4IR::Temp *arg, V4IR::Temp *result)
+void InstructionSelection::callBuiltinForeachIteratorObject(IR::Temp *arg, IR::Temp *result)
 {
     Q_ASSERT(arg);
     Q_ASSERT(result);
@@ -458,7 +457,7 @@ void InstructionSelection::callBuiltinForeachIteratorObject(V4IR::Temp *arg, V4I
     generateFunctionCall(result, __qmljs_foreach_iterator_object, Assembler::ContextRegister, Assembler::Reference(arg));
 }
 
-void InstructionSelection::callBuiltinForeachNextPropertyname(V4IR::Temp *arg, V4IR::Temp *result)
+void InstructionSelection::callBuiltinForeachNextPropertyname(IR::Temp *arg, IR::Temp *result)
 {
     Q_ASSERT(arg);
     Q_ASSERT(result);
@@ -466,7 +465,7 @@ void InstructionSelection::callBuiltinForeachNextPropertyname(V4IR::Temp *arg, V
     generateFunctionCall(result, __qmljs_foreach_next_property_name, Assembler::Reference(arg));
 }
 
-void InstructionSelection::callBuiltinPushWithScope(V4IR::Temp *arg)
+void InstructionSelection::callBuiltinPushWithScope(IR::Temp *arg)
 {
     Q_ASSERT(arg);
 
@@ -484,7 +483,7 @@ void InstructionSelection::callBuiltinDeclareVar(bool deletable, const QString &
                          Assembler::TrustedImm32(deletable), Assembler::PointerToString(name));
 }
 
-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)
 {
     Q_ASSERT(object);
     Q_ASSERT(getter);
@@ -493,8 +492,8 @@ void InstructionSelection::callBuiltinDefineGetterSetter(V4IR::Temp *object, con
                          Assembler::Reference(object), Assembler::PointerToString(name), Assembler::PointerToValue(getter), Assembler::PointerToValue(setter));
 }
 
-void InstructionSelection::callBuiltinDefineProperty(V4IR::Temp *object, const QString &name,
-                                                     V4IR::Expr *value)
+void InstructionSelection::callBuiltinDefineProperty(IR::Temp *object, const QString &name,
+                                                     IR::Expr *value)
 {
     Q_ASSERT(object);
     Q_ASSERT(value->asTemp() || value->asConst());
@@ -505,7 +504,7 @@ void InstructionSelection::callBuiltinDefineProperty(V4IR::Temp *object, const Q
                          Assembler::PointerToValue(value));
 }
 
-void InstructionSelection::callBuiltinDefineArray(V4IR::Temp *result, V4IR::ExprList *args)
+void InstructionSelection::callBuiltinDefineArray(IR::Temp *result, IR::ExprList *args)
 {
     Q_ASSERT(result);
 
@@ -514,7 +513,7 @@ void InstructionSelection::callBuiltinDefineArray(V4IR::Temp *result, V4IR::Expr
                          baseAddressForCallArguments(), Assembler::TrustedImm32(length));
 }
 
-void InstructionSelection::callBuiltinDefineObjectLiteral(V4IR::Temp *result, V4IR::ExprList *args)
+void InstructionSelection::callBuiltinDefineObjectLiteral(IR::Temp *result, IR::ExprList *args)
 {
     Q_ASSERT(result);
 
@@ -522,7 +521,7 @@ void InstructionSelection::callBuiltinDefineObjectLiteral(V4IR::Temp *result, V4
 
     const int classId = registerJSClass(args);
 
-    V4IR::ExprList *it = args;
+    IR::ExprList *it = args;
     while (it) {
         it = it->next;
 
@@ -543,7 +542,7 @@ void InstructionSelection::callBuiltinDefineObjectLiteral(V4IR::Temp *result, V4
                          baseAddressForCallArguments(), Assembler::TrustedImm32(classId));
 }
 
-void InstructionSelection::callBuiltinSetupArgumentObject(V4IR::Temp *result)
+void InstructionSelection::callBuiltinSetupArgumentObject(IR::Temp *result)
 {
     generateFunctionCall(result, __qmljs_builtin_setup_arguments_object, Assembler::ContextRegister);
 }
@@ -553,7 +552,7 @@ void InstructionSelection::callBuiltinConvertThisToObject()
     generateFunctionCall(Assembler::Void, __qmljs_builtin_convert_this_to_object, Assembler::ContextRegister);
 }
 
-void InstructionSelection::callValue(V4IR::Temp *value, V4IR::ExprList *args, V4IR::Temp *result)
+void InstructionSelection::callValue(IR::Temp *value, IR::ExprList *args, IR::Temp *result)
 {
     Q_ASSERT(value);
 
@@ -563,7 +562,7 @@ void InstructionSelection::callValue(V4IR::Temp *value, V4IR::ExprList *args, V4
                          baseAddressForCallData());
 }
 
-void InstructionSelection::loadThisObject(V4IR::Temp *temp)
+void InstructionSelection::loadThisObject(IR::Temp *temp)
 {
     _as->loadPtr(Address(Assembler::ContextRegister, qOffsetOf(ExecutionContext, callData)), Assembler::ScratchRegister);
 #if defined(VALUE_FITS_IN_REGISTER)
@@ -575,45 +574,45 @@ void InstructionSelection::loadThisObject(V4IR::Temp *temp)
 #endif
 }
 
-void InstructionSelection::loadQmlIdArray(V4IR::Temp *temp)
+void InstructionSelection::loadQmlIdArray(IR::Temp *temp)
 {
     generateFunctionCall(temp, __qmljs_get_id_array, Assembler::ContextRegister);
 }
 
-void InstructionSelection::loadQmlImportedScripts(V4IR::Temp *temp)
+void InstructionSelection::loadQmlImportedScripts(IR::Temp *temp)
 {
     generateFunctionCall(temp, __qmljs_get_imported_scripts, Assembler::ContextRegister);
 }
 
-void InstructionSelection::loadQmlContextObject(V4IR::Temp *temp)
+void InstructionSelection::loadQmlContextObject(IR::Temp *temp)
 {
     generateFunctionCall(temp, __qmljs_get_context_object, Assembler::ContextRegister);
 }
 
-void InstructionSelection::loadQmlScopeObject(V4IR::Temp *temp)
+void InstructionSelection::loadQmlScopeObject(IR::Temp *temp)
 {
     generateFunctionCall(temp, __qmljs_get_scope_object, Assembler::ContextRegister);
 }
 
-void InstructionSelection::loadQmlSingleton(const QString &name, V4IR::Temp *temp)
+void InstructionSelection::loadQmlSingleton(const QString &name, IR::Temp *temp)
 {
     generateFunctionCall(temp, __qmljs_get_qml_singleton, Assembler::ContextRegister, Assembler::PointerToString(name));
 }
 
-void InstructionSelection::loadConst(V4IR::Const *sourceConst, V4IR::Temp *targetTemp)
+void InstructionSelection::loadConst(IR::Const *sourceConst, IR::Temp *targetTemp)
 {
-    if (targetTemp->kind == V4IR::Temp::PhysicalRegister) {
-        if (targetTemp->type == V4IR::DoubleType) {
-            Q_ASSERT(sourceConst->type == V4IR::DoubleType);
+    if (targetTemp->kind == IR::Temp::PhysicalRegister) {
+        if (targetTemp->type == IR::DoubleType) {
+            Q_ASSERT(sourceConst->type == IR::DoubleType);
             _as->toDoubleRegister(sourceConst, (Assembler::FPRegisterID) targetTemp->index);
-        } else if (targetTemp->type == V4IR::SInt32Type) {
-            Q_ASSERT(sourceConst->type == V4IR::SInt32Type);
+        } else if (targetTemp->type == IR::SInt32Type) {
+            Q_ASSERT(sourceConst->type == IR::SInt32Type);
             _as->toInt32Register(sourceConst, (Assembler::RegisterID) targetTemp->index);
-        } else if (targetTemp->type == V4IR::UInt32Type) {
-            Q_ASSERT(sourceConst->type == V4IR::UInt32Type);
+        } else if (targetTemp->type == IR::UInt32Type) {
+            Q_ASSERT(sourceConst->type == IR::UInt32Type);
             _as->toUInt32Register(sourceConst, (Assembler::RegisterID) targetTemp->index);
-        } else if (targetTemp->type == V4IR::BoolType) {
-            Q_ASSERT(sourceConst->type == V4IR::BoolType);
+        } else if (targetTemp->type == IR::BoolType) {
+            Q_ASSERT(sourceConst->type == IR::BoolType);
             _as->move(Assembler::TrustedImm32(convertToValue(sourceConst).int_32),
                       (Assembler::RegisterID) targetTemp->index);
         } else {
@@ -624,7 +623,7 @@ void InstructionSelection::loadConst(V4IR::Const *sourceConst, V4IR::Temp *targe
     }
 }
 
-void InstructionSelection::loadString(const QString &str, V4IR::Temp *targetTemp)
+void InstructionSelection::loadString(const QString &str, IR::Temp *targetTemp)
 {
     Pointer srcAddr = _as->loadStringAddress(Assembler::ReturnValueRegister, str);
     _as->loadPtr(srcAddr, Assembler::ReturnValueRegister);
@@ -638,13 +637,13 @@ void InstructionSelection::loadString(const QString &str, V4IR::Temp *targetTemp
 #endif
 }
 
-void InstructionSelection::loadRegexp(V4IR::RegExp *sourceRegexp, V4IR::Temp *targetTemp)
+void InstructionSelection::loadRegexp(IR::RegExp *sourceRegexp, IR::Temp *targetTemp)
 {
     int id = registerRegExp(sourceRegexp);
     generateFunctionCall(targetTemp, __qmljs_lookup_runtime_regexp, Assembler::ContextRegister, Assembler::TrustedImm32(id));
 }
 
-void InstructionSelection::getActivationProperty(const V4IR::Name *name, V4IR::Temp *temp)
+void InstructionSelection::getActivationProperty(const IR::Name *name, IR::Temp *temp)
 {
     if (useFastLookups && name->global) {
         uint index = registerGlobalGetterLookup(*name->id);
@@ -654,20 +653,20 @@ void InstructionSelection::getActivationProperty(const V4IR::Name *name, V4IR::T
     generateFunctionCall(temp, __qmljs_get_activation_property, Assembler::ContextRegister, Assembler::PointerToString(*name->id));
 }
 
-void InstructionSelection::setActivationProperty(V4IR::Expr *source, const QString &targetName)
+void InstructionSelection::setActivationProperty(IR::Expr *source, const QString &targetName)
 {
     // ### should use a lookup call here
     generateFunctionCall(Assembler::Void, __qmljs_set_activation_property,
                          Assembler::ContextRegister, Assembler::PointerToString(targetName), Assembler::PointerToValue(source));
 }
 
-void InstructionSelection::initClosure(V4IR::Closure *closure, V4IR::Temp *target)
+void InstructionSelection::initClosure(IR::Closure *closure, IR::Temp *target)
 {
     int id = closure->value;
     generateFunctionCall(target, __qmljs_init_closure, Assembler::ContextRegister, Assembler::TrustedImm32(id));
 }
 
-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) {
         uint index = registerGetterLookup(name);
@@ -678,7 +677,7 @@ void InstructionSelection::getProperty(V4IR::Expr *base, const QString &name, V4
     }
 }
 
-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)
         generateFunctionCall(target, __qmljs_get_attached_property, Assembler::ContextRegister, Assembler::TrustedImm32(attachedPropertiesId), Assembler::TrustedImm32(propertyIndex));
@@ -687,7 +686,7 @@ void InstructionSelection::getQObjectProperty(V4IR::Expr *base, int propertyInde
                              Assembler::TrustedImm32(captureRequired));
 }
 
-void InstructionSelection::setProperty(V4IR::Expr *source, V4IR::Expr *targetBase,
+void InstructionSelection::setProperty(IR::Expr *source, IR::Expr *targetBase,
                                        const QString &targetName)
 {
     if (useFastLookups) {
@@ -702,13 +701,13 @@ void InstructionSelection::setProperty(V4IR::Expr *source, V4IR::Expr *targetBas
     }
 }
 
-void InstructionSelection::setQObjectProperty(V4IR::Expr *source, V4IR::Expr *targetBase, int propertyIndex)
+void InstructionSelection::setQObjectProperty(IR::Expr *source, IR::Expr *targetBase, int propertyIndex)
 {
     generateFunctionCall(Assembler::Void, __qmljs_set_qobject_property, Assembler::ContextRegister, Assembler::PointerToValue(targetBase),
                          Assembler::TrustedImm32(propertyIndex), Assembler::PointerToValue(source));
 }
 
-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) {
         uint lookup = registerIndexedGetterLookup();
@@ -722,7 +721,7 @@ void InstructionSelection::getElement(V4IR::Expr *base, V4IR::Expr *index, V4IR:
                          Assembler::PointerToValue(base), Assembler::PointerToValue(index));
 }
 
-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) {
         uint lookup = registerIndexedSetterLookup();
@@ -736,14 +735,14 @@ void InstructionSelection::setElement(V4IR::Expr *source, V4IR::Expr *targetBase
                          Assembler::PointerToValue(source));
 }
 
-void InstructionSelection::copyValue(V4IR::Temp *sourceTemp, V4IR::Temp *targetTemp)
+void InstructionSelection::copyValue(IR::Temp *sourceTemp, IR::Temp *targetTemp)
 {
     if (*sourceTemp == *targetTemp)
         return;
 
-    if (sourceTemp->kind == V4IR::Temp::PhysicalRegister) {
-        if (targetTemp->kind == V4IR::Temp::PhysicalRegister) {
-            if (sourceTemp->type == V4IR::DoubleType)
+    if (sourceTemp->kind == IR::Temp::PhysicalRegister) {
+        if (targetTemp->kind == IR::Temp::PhysicalRegister) {
+            if (sourceTemp->type == IR::DoubleType)
                 _as->moveDouble((Assembler::FPRegisterID) sourceTemp->index,
                                 (Assembler::FPRegisterID) targetTemp->index);
             else
@@ -752,16 +751,16 @@ void InstructionSelection::copyValue(V4IR::Temp *sourceTemp, V4IR::Temp *targetT
             return;
         } else {
             switch (sourceTemp->type) {
-            case V4IR::DoubleType:
+            case IR::DoubleType:
                 _as->storeDouble((Assembler::FPRegisterID) sourceTemp->index, targetTemp);
                 break;
-            case V4IR::SInt32Type:
+            case IR::SInt32Type:
                 _as->storeInt32((Assembler::RegisterID) sourceTemp->index, targetTemp);
                 break;
-            case V4IR::UInt32Type:
+            case IR::UInt32Type:
                 _as->storeUInt32((Assembler::RegisterID) sourceTemp->index, targetTemp);
                 break;
-            case V4IR::BoolType:
+            case IR::BoolType:
                 _as->storeBool((Assembler::RegisterID) sourceTemp->index, targetTemp);
                 break;
             default:
@@ -770,22 +769,22 @@ void InstructionSelection::copyValue(V4IR::Temp *sourceTemp, V4IR::Temp *targetT
             }
             return;
         }
-    } else if (targetTemp->kind == V4IR::Temp::PhysicalRegister) {
+    } else if (targetTemp->kind == IR::Temp::PhysicalRegister) {
         switch (targetTemp->type) {
-        case V4IR::DoubleType:
-            Q_ASSERT(sourceTemp->type == V4IR::DoubleType);
+        case IR::DoubleType:
+            Q_ASSERT(sourceTemp->type == IR::DoubleType);
             _as->toDoubleRegister(sourceTemp, (Assembler::FPRegisterID) targetTemp->index);
             return;
-        case V4IR::BoolType:
-            Q_ASSERT(sourceTemp->type == V4IR::BoolType);
+        case IR::BoolType:
+            Q_ASSERT(sourceTemp->type == IR::BoolType);
             _as->toInt32Register(sourceTemp, (Assembler::RegisterID) targetTemp->index);
             return;
-        case V4IR::SInt32Type:
-            Q_ASSERT(sourceTemp->type == V4IR::SInt32Type);
+        case IR::SInt32Type:
+            Q_ASSERT(sourceTemp->type == IR::SInt32Type);
             _as->toInt32Register(sourceTemp, (Assembler::RegisterID) targetTemp->index);
             return;
-        case V4IR::UInt32Type:
-            Q_ASSERT(sourceTemp->type == V4IR::UInt32Type);
+        case IR::UInt32Type:
+            Q_ASSERT(sourceTemp->type == IR::UInt32Type);
             _as->toUInt32Register(sourceTemp, (Assembler::RegisterID) targetTemp->index);
             return;
         default:
@@ -799,13 +798,13 @@ void InstructionSelection::copyValue(V4IR::Temp *sourceTemp, V4IR::Temp *targetT
                       Assembler::ScratchRegister);
 }
 
-void InstructionSelection::swapValues(V4IR::Temp *sourceTemp, V4IR::Temp *targetTemp)
+void InstructionSelection::swapValues(IR::Temp *sourceTemp, IR::Temp *targetTemp)
 {
-    if (sourceTemp->kind == V4IR::Temp::PhysicalRegister) {
-        if (targetTemp->kind == V4IR::Temp::PhysicalRegister) {
+    if (sourceTemp->kind == IR::Temp::PhysicalRegister) {
+        if (targetTemp->kind == IR::Temp::PhysicalRegister) {
             Q_ASSERT(sourceTemp->type == targetTemp->type);
 
-            if (sourceTemp->type == V4IR::DoubleType) {
+            if (sourceTemp->type == IR::DoubleType) {
                 _as->moveDouble((Assembler::FPRegisterID) targetTemp->index, Assembler::FPGpr0);
                 _as->moveDouble((Assembler::FPRegisterID) sourceTemp->index,
                                 (Assembler::FPRegisterID) targetTemp->index);
@@ -816,8 +815,8 @@ void InstructionSelection::swapValues(V4IR::Temp *sourceTemp, V4IR::Temp *target
             }
             return;
         }
-    } else if (sourceTemp->kind == V4IR::Temp::StackSlot) {
-        if (targetTemp->kind == V4IR::Temp::StackSlot) {
+    } else if (sourceTemp->kind == IR::Temp::StackSlot) {
+        if (targetTemp->kind == IR::Temp::StackSlot) {
             // Note: a swap for two stack-slots can involve different types.
 #if CPU(X86_64)
             _as->load64(_as->stackSlotPointer(targetTemp), Assembler::ReturnValueRegister);
@@ -840,15 +839,15 @@ void InstructionSelection::swapValues(V4IR::Temp *sourceTemp, V4IR::Temp *target
         }
     }
 
-    V4IR::Temp *stackTemp = sourceTemp->kind == V4IR::Temp::StackSlot ? sourceTemp : targetTemp;
-    V4IR::Temp *registerTemp = sourceTemp->kind == V4IR::Temp::PhysicalRegister ? sourceTemp
+    IR::Temp *stackTemp = sourceTemp->kind == IR::Temp::StackSlot ? sourceTemp : targetTemp;
+    IR::Temp *registerTemp = sourceTemp->kind == IR::Temp::PhysicalRegister ? sourceTemp
                                                                                 : targetTemp;
     Assembler::Pointer addr = _as->stackSlotPointer(stackTemp);
-    if (registerTemp->type == V4IR::DoubleType) {
+    if (registerTemp->type == IR::DoubleType) {
         _as->loadDouble(addr, Assembler::FPGpr0);
         _as->storeDouble((Assembler::FPRegisterID) registerTemp->index, addr);
         _as->moveDouble(Assembler::FPGpr0, (Assembler::FPRegisterID) registerTemp->index);
-    } else if (registerTemp->type == V4IR::UInt32Type) {
+    } else if (registerTemp->type == IR::UInt32Type) {
         _as->toUInt32Register(addr, Assembler::ScratchRegister);
         _as->storeUInt32((Assembler::RegisterID) registerTemp->index, addr);
         _as->move(Assembler::ScratchRegister, (Assembler::RegisterID) registerTemp->index);
@@ -859,10 +858,10 @@ void InstructionSelection::swapValues(V4IR::Temp *sourceTemp, V4IR::Temp *target
             addr.offset += 4;
             quint32 tag;
             switch (registerTemp->type) {
-            case V4IR::BoolType:
+            case IR::BoolType:
                 tag = QV4::Value::_Boolean_Type;
                 break;
-            case V4IR::SInt32Type:
+            case IR::SInt32Type:
                 tag = QV4::Value::_Integer_Type;
                 break;
             default:
@@ -880,21 +879,21 @@ void InstructionSelection::swapValues(V4IR::Temp *sourceTemp, V4IR::Temp *target
 #define setOpContext(op, opName, operation) \
     do { opContext = operation; opName = isel_stringIfy(operation); } while (0)
 
-void InstructionSelection::unop(V4IR::AluOp oper, V4IR::Temp *sourceTemp, V4IR::Temp *targetTemp)
+void InstructionSelection::unop(IR::AluOp oper, IR::Temp *sourceTemp, IR::Temp *targetTemp)
 {
     QV4::JIT::Unop unop(_as, oper);
     unop.generate(sourceTemp, targetTemp);
 }
 
 
-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)
 {
     QV4::JIT::Binop binop(_as, oper);
     binop.generate(leftSource, rightSource, target);
 }
 
-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)
 {
     assert(base != 0);
 
@@ -914,8 +913,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)
 {
     assert(base != 0);
 
@@ -925,19 +924,19 @@ void InstructionSelection::callSubscript(V4IR::Expr *base, V4IR::Expr *index, V4
                          baseAddressForCallData());
 }
 
-void InstructionSelection::convertType(V4IR::Temp *source, V4IR::Temp *target)
+void InstructionSelection::convertType(IR::Temp *source, IR::Temp *target)
 {
     switch (target->type) {
-    case V4IR::DoubleType:
+    case IR::DoubleType:
         convertTypeToDouble(source, target);
         break;
-    case V4IR::BoolType:
+    case IR::BoolType:
         convertTypeToBool(source, target);
         break;
-    case V4IR::SInt32Type:
+    case IR::SInt32Type:
         convertTypeToSInt32(source, target);
         break;
-    case V4IR::UInt32Type:
+    case IR::UInt32Type:
         convertTypeToUInt32(source, target);
         break;
     default:
@@ -946,33 +945,33 @@ void InstructionSelection::convertType(V4IR::Temp *source, V4IR::Temp *target)
     }
 }
 
-void InstructionSelection::convertTypeSlowPath(V4IR::Temp *source, V4IR::Temp *target)
+void InstructionSelection::convertTypeSlowPath(IR::Temp *source, IR::Temp *target)
 {
-    Q_ASSERT(target->type != V4IR::BoolType);
+    Q_ASSERT(target->type != IR::BoolType);
 
-    if (target->type & V4IR::NumberType)
-        unop(V4IR::OpUPlus, source, target);
+    if (target->type & IR::NumberType)
+        unop(IR::OpUPlus, source, target);
     else
         copyValue(source, target);
 }
 
-void InstructionSelection::convertTypeToDouble(V4IR::Temp *source, V4IR::Temp *target)
+void InstructionSelection::convertTypeToDouble(IR::Temp *source, IR::Temp *target)
 {
     switch (source->type) {
-    case V4IR::SInt32Type:
-    case V4IR::BoolType:
-    case V4IR::NullType:
+    case IR::SInt32Type:
+    case IR::BoolType:
+    case IR::NullType:
         convertIntToDouble(source, target);
         break;
-    case V4IR::UInt32Type:
+    case IR::UInt32Type:
         convertUIntToDouble(source, target);
         break;
-    case V4IR::UndefinedType:
+    case IR::UndefinedType:
         _as->loadDouble(_as->loadTempAddress(Assembler::ScratchRegister, source), Assembler::FPGpr0);
         _as->storeDouble(Assembler::FPGpr0, target);
         break;
-    case V4IR::StringType:
-    case V4IR::VarType: {
+    case IR::StringType:
+    case IR::VarType: {
         // load the tag:
         Assembler::Pointer tagAddr = _as->loadTempAddress(Assembler::ScratchRegister, source);
         tagAddr.offset += 4;
@@ -1002,7 +1001,7 @@ void InstructionSelection::convertTypeToDouble(V4IR::Temp *source, V4IR::Temp *t
         // it is a double:
         isDbl.link(_as);
         Assembler::Pointer addr2 = _as->loadTempAddress(Assembler::ScratchRegister, source);
-        if (target->kind == V4IR::Temp::StackSlot) {
+        if (target->kind == IR::Temp::StackSlot) {
 #if QT_POINTER_SIZE == 8
             _as->load64(addr2, Assembler::ScratchRegister);
             _as->store64(Assembler::ScratchRegister, _as->stackSlotPointer(target));
@@ -1023,19 +1022,19 @@ void InstructionSelection::convertTypeToDouble(V4IR::Temp *source, V4IR::Temp *t
     }
 }
 
-void InstructionSelection::convertTypeToBool(V4IR::Temp *source, V4IR::Temp *target)
+void InstructionSelection::convertTypeToBool(IR::Temp *source, IR::Temp *target)
 {
     switch (source->type) {
-    case V4IR::SInt32Type:
-    case V4IR::UInt32Type:
+    case IR::SInt32Type:
+    case IR::UInt32Type:
         convertIntToBool(source, target);
         break;
-    case V4IR::DoubleType: {
+    case IR::DoubleType: {
         // The source is in a register if the register allocator is used. If the register
         // allocator was not used, then that means that we can use any register for to
         // load the double into.
         Assembler::FPRegisterID reg;
-        if (source->kind == V4IR::Temp::PhysicalRegister)
+        if (source->kind == IR::Temp::PhysicalRegister)
             reg = (Assembler::FPRegisterID) source->index;
         else
             reg = _as->toDoubleRegister(source, (Assembler::FPRegisterID) 1);
@@ -1052,12 +1051,12 @@ void InstructionSelection::convertTypeToBool(V4IR::Temp *source, V4IR::Temp *tar
         // done:
         done.link(_as);
     } break;
-    case V4IR::UndefinedType:
-    case V4IR::NullType:
+    case IR::UndefinedType:
+    case IR::NullType:
         _as->storeBool(false, target);
         break;
-    case V4IR::StringType:
-    case V4IR::VarType:
+    case IR::StringType:
+    case IR::VarType:
     default:
         generateFunctionCall(Assembler::ReturnValueRegister, __qmljs_to_boolean,
                              Assembler::PointerToValue(source));
@@ -1066,10 +1065,10 @@ void InstructionSelection::convertTypeToBool(V4IR::Temp *source, V4IR::Temp *tar
     }
 }
 
-void InstructionSelection::convertTypeToSInt32(V4IR::Temp *source, V4IR::Temp *target)
+void InstructionSelection::convertTypeToSInt32(IR::Temp *source, IR::Temp *target)
 {
     switch (source->type) {
-    case V4IR::VarType: {
+    case IR::VarType: {
 
 #if QT_POINTER_SIZE == 8
         Assembler::Pointer addr = _as->loadTempAddress(Assembler::ScratchRegister, source);
@@ -1096,7 +1095,7 @@ void InstructionSelection::convertTypeToSInt32(V4IR::Temp *source, V4IR::Temp *t
 
         isInt.link(_as);
         success.link(_as);
-        if (target->kind == V4IR::Temp::StackSlot) {
+        if (target->kind == IR::Temp::StackSlot) {
             Assembler::Pointer targetAddr = _as->stackSlotPointer(target);
             _as->store32(Assembler::ReturnValueRegister, targetAddr);
             targetAddr.offset += 4;
@@ -1114,7 +1113,7 @@ void InstructionSelection::convertTypeToSInt32(V4IR::Temp *source, V4IR::Temp *t
         // check if it's an int32:
         Assembler::Jump fallback = _as->branch32(Assembler::NotEqual, Assembler::ReturnValueRegister,
                                                 Assembler::TrustedImm32(Value::_Integer_Type));
-        if (target->kind == V4IR::Temp::StackSlot) {
+        if (target->kind == IR::Temp::StackSlot) {
             _as->load32(addr, Assembler::ScratchRegister);
             Assembler::Pointer targetAddr = _as->stackSlotPointer(target);
             _as->store32(Assembler::ScratchRegister, targetAddr);
@@ -1135,7 +1134,7 @@ void InstructionSelection::convertTypeToSInt32(V4IR::Temp *source, V4IR::Temp *t
 #endif
 
     } break;
-    case V4IR::DoubleType: {
+    case IR::DoubleType: {
         Assembler::Jump success =
                 _as->branchTruncateDoubleToInt32(_as->toDoubleRegister(source),
                                                  Assembler::ReturnValueRegister,
@@ -1145,18 +1144,18 @@ void InstructionSelection::convertTypeToSInt32(V4IR::Temp *source, V4IR::Temp *t
         success.link(_as);
         _as->storeInt32(Assembler::ReturnValueRegister, target);
     } break;
-    case V4IR::UInt32Type:
+    case IR::UInt32Type:
         _as->storeInt32(_as->toUInt32Register(source, Assembler::ReturnValueRegister), target);
         break;
-    case V4IR::NullType:
-    case V4IR::UndefinedType:
+    case IR::NullType:
+    case IR::UndefinedType:
         _as->move(Assembler::TrustedImm32(0), Assembler::ReturnValueRegister);
         _as->storeInt32(Assembler::ReturnValueRegister, target);
         break;
-    case V4IR::BoolType:
+    case IR::BoolType:
         _as->storeInt32(_as->toInt32Register(source, Assembler::ReturnValueRegister), target);
         break;
-    case V4IR::StringType:
+    case IR::StringType:
     default:
         generateFunctionCall(Assembler::ReturnValueRegister, __qmljs_value_to_int32,
                              _as->loadTempAddress(Assembler::ScratchRegister, source));
@@ -1165,10 +1164,10 @@ void InstructionSelection::convertTypeToSInt32(V4IR::Temp *source, V4IR::Temp *t
     } // switch (source->type)
 }
 
-void InstructionSelection::convertTypeToUInt32(V4IR::Temp *source, V4IR::Temp *target)
+void InstructionSelection::convertTypeToUInt32(IR::Temp *source, IR::Temp *target)
 {
     switch (source->type) {
-    case V4IR::VarType: {
+    case IR::VarType: {
         // load the tag:
         Assembler::Pointer tagAddr = _as->loadTempAddress(Assembler::ScratchRegister, source);
         tagAddr.offset += 4;
@@ -1189,7 +1188,7 @@ void InstructionSelection::convertTypeToUInt32(V4IR::Temp *source, V4IR::Temp *t
 
         intDone.link(_as);
     } break;
-    case V4IR::DoubleType: {
+    case IR::DoubleType: {
         Assembler::FPRegisterID reg = _as->toDoubleRegister(source);
         Assembler::Jump success =
                 _as->branchTruncateDoubleToUint32(reg, Assembler::ReturnValueRegister,
@@ -1199,18 +1198,18 @@ void InstructionSelection::convertTypeToUInt32(V4IR::Temp *source, V4IR::Temp *t
         success.link(_as);
         _as->storeUInt32(Assembler::ReturnValueRegister, target);
     } break;
-    case V4IR::NullType:
-    case V4IR::UndefinedType:
+    case IR::NullType:
+    case IR::UndefinedType:
         _as->move(Assembler::TrustedImm32(0), Assembler::ReturnValueRegister);
         _as->storeUInt32(Assembler::ReturnValueRegister, target);
         break;
-    case V4IR::StringType:
+    case IR::StringType:
         generateFunctionCall(Assembler::ReturnValueRegister, __qmljs_value_to_uint32,
                              Assembler::PointerToValue(source));
         _as->storeUInt32(Assembler::ReturnValueRegister, target);
         break;
-    case V4IR::SInt32Type:
-    case V4IR::BoolType:
+    case IR::SInt32Type:
+    case IR::BoolType:
         _as->storeUInt32(_as->toInt32Register(source, Assembler::ReturnValueRegister), target);
         break;
     default:
@@ -1218,7 +1217,7 @@ void InstructionSelection::convertTypeToUInt32(V4IR::Temp *source, V4IR::Temp *t
     } // switch (source->type)
 }
 
-void InstructionSelection::constructActivationProperty(V4IR::Name *func, V4IR::ExprList *args, V4IR::Temp *result)
+void InstructionSelection::constructActivationProperty(IR::Name *func, IR::ExprList *args, IR::Temp *result)
 {
     assert(func != 0);
     prepareCallData(args, 0);
@@ -1238,7 +1237,7 @@ void InstructionSelection::constructActivationProperty(V4IR::Name *func, V4IR::E
 }
 
 
-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)
 {
     prepareCallData(args, base);
     if (useFastLookups) {
@@ -1255,7 +1254,7 @@ void InstructionSelection::constructProperty(V4IR::Temp *base, const QString &na
                          baseAddressForCallData());
 }
 
-void InstructionSelection::constructValue(V4IR::Temp *value, V4IR::ExprList *args, V4IR::Temp *result)
+void InstructionSelection::constructValue(IR::Temp *value, IR::ExprList *args, IR::Temp *result)
 {
     assert(value != 0);
 
@@ -1266,20 +1265,20 @@ void InstructionSelection::constructValue(V4IR::Temp *value, V4IR::ExprList *arg
                          baseAddressForCallData());
 }
 
-void InstructionSelection::visitJump(V4IR::Jump *s)
+void InstructionSelection::visitJump(IR::Jump *s)
 {
     if (!_removableJumps.contains(s))
         _as->jumpToBlock(_block, s->target);
 }
 
-void InstructionSelection::visitCJump(V4IR::CJump *s)
+void InstructionSelection::visitCJump(IR::CJump *s)
 {
-    if (V4IR::Temp *t = s->cond->asTemp()) {
+    if (IR::Temp *t = s->cond->asTemp()) {
         Assembler::RegisterID reg;
-        if (t->kind == V4IR::Temp::PhysicalRegister) {
-            Q_ASSERT(t->type == V4IR::BoolType);
+        if (t->kind == IR::Temp::PhysicalRegister) {
+            Q_ASSERT(t->type == IR::BoolType);
             reg = (Assembler::RegisterID) t->index;
-        } else if (t->kind == V4IR::Temp::StackSlot && t->type == V4IR::BoolType) {
+        } else if (t->kind == IR::Temp::StackSlot && t->type == IR::BoolType) {
             reg = Assembler::ReturnValueRegister;
             _as->toInt32Register(t, reg);
         } else {
@@ -1302,23 +1301,23 @@ void InstructionSelection::visitCJump(V4IR::CJump *s)
 
         _as->generateCJumpOnNonZero(reg, _block, s->iftrue, s->iffalse);
         return;
-    } else if (V4IR::Const *c = s->cond->asConst()) {
+    } else if (IR::Const *c = s->cond->asConst()) {
         // TODO: SSA optimization for constant condition evaluation should remove this.
         // See also visitCJump() in RegAllocInfo.
         generateFunctionCall(Assembler::ReturnValueRegister, __qmljs_to_boolean,
                              Assembler::PointerToValue(c));
         _as->generateCJumpOnNonZero(Assembler::ReturnValueRegister, _block, s->iftrue, s->iffalse);
         return;
-    } else if (V4IR::Binop *b = s->cond->asBinop()) {
-        if (b->left->type == V4IR::DoubleType && b->right->type == V4IR::DoubleType
+    } else if (IR::Binop *b = s->cond->asBinop()) {
+        if (b->left->type == IR::DoubleType && b->right->type == IR::DoubleType
                 && visitCJumpDouble(b->op, b->left, b->right, s->iftrue, s->iffalse))
             return;
 
-        if (b->op == V4IR::OpStrictEqual || b->op == V4IR::OpStrictNotEqual) {
+        if (b->op == IR::OpStrictEqual || b->op == IR::OpStrictNotEqual) {
             visitCJumpStrict(b, s->iftrue, s->iffalse);
             return;
         }
-        if (b->op == V4IR::OpEqual || b->op == V4IR::OpNotEqual) {
+        if (b->op == IR::OpEqual || b->op == IR::OpNotEqual) {
             visitCJumpEqual(b, s->iftrue, s->iffalse);
             return;
         }
@@ -1328,16 +1327,16 @@ void InstructionSelection::visitCJump(V4IR::CJump *s)
         const char *opName = 0;
         switch (b->op) {
         default: Q_UNREACHABLE(); assert(!"todo"); break;
-        case V4IR::OpGt: setOp(op, opName, __qmljs_cmp_gt); break;
-        case V4IR::OpLt: setOp(op, opName, __qmljs_cmp_lt); break;
-        case V4IR::OpGe: setOp(op, opName, __qmljs_cmp_ge); break;
-        case V4IR::OpLe: setOp(op, opName, __qmljs_cmp_le); break;
-        case V4IR::OpEqual: setOp(op, opName, __qmljs_cmp_eq); break;
-        case V4IR::OpNotEqual: setOp(op, opName, __qmljs_cmp_ne); break;
-        case V4IR::OpStrictEqual: setOp(op, opName, __qmljs_cmp_se); break;
-        case V4IR::OpStrictNotEqual: setOp(op, opName, __qmljs_cmp_sne); break;
-        case V4IR::OpInstanceof: setOpContext(op, opName, __qmljs_cmp_instanceof); break;
-        case V4IR::OpIn: setOpContext(op, opName, __qmljs_cmp_in); break;
+        case IR::OpGt: setOp(op, opName, __qmljs_cmp_gt); break;
+        case IR::OpLt: setOp(op, opName, __qmljs_cmp_lt); break;
+        case IR::OpGe: setOp(op, opName, __qmljs_cmp_ge); break;
+        case IR::OpLe: setOp(op, opName, __qmljs_cmp_le); break;
+        case IR::OpEqual: setOp(op, opName, __qmljs_cmp_eq); break;
+        case IR::OpNotEqual: setOp(op, opName, __qmljs_cmp_ne); break;
+        case IR::OpStrictEqual: setOp(op, opName, __qmljs_cmp_se); break;
+        case IR::OpStrictNotEqual: setOp(op, opName, __qmljs_cmp_sne); break;
+        case IR::OpInstanceof: setOpContext(op, opName, __qmljs_cmp_instanceof); break;
+        case IR::OpIn: setOpContext(op, opName, __qmljs_cmp_in); break;
         } // switch
 
         // TODO: in SSA optimization, do constant expression evaluation.
@@ -1361,12 +1360,12 @@ void InstructionSelection::visitCJump(V4IR::CJump *s)
     Q_UNREACHABLE();
 }
 
-void InstructionSelection::visitRet(V4IR::Ret *s)
+void InstructionSelection::visitRet(IR::Ret *s)
 {
     if (!s) {
         // this only happens if the method doesn't have a return statement and can
         // only exit through an exception
-    } else if (V4IR::Temp *t = s->expr->asTemp()) {
+    } else if (IR::Temp *t = s->expr->asTemp()) {
 #if CPU(X86) || CPU(ARM)
 
 #  if CPU(X86)
@@ -1377,12 +1376,12 @@ void InstructionSelection::visitRet(V4IR::Ret *s)
         Assembler::RegisterID highReg = JSC::ARMRegisters::r1;
 #  endif
 
-        if (t->kind == V4IR::Temp::PhysicalRegister) {
+        if (t->kind == IR::Temp::PhysicalRegister) {
             switch (t->type) {
-            case V4IR::DoubleType:
+            case IR::DoubleType:
                 _as->moveDoubleToInts((Assembler::FPRegisterID) t->index, lowReg, highReg);
                 break;
-            case V4IR::UInt32Type: {
+            case IR::UInt32Type: {
                 Assembler::RegisterID srcReg = (Assembler::RegisterID) t->index;
                 Assembler::Jump intRange = _as->branch32(Assembler::GreaterThanOrEqual, srcReg, Assembler::TrustedImm32(0));
                 _as->convertUInt32ToDouble(srcReg, Assembler::FPGpr0, Assembler::ReturnValueRegister);
@@ -1393,11 +1392,11 @@ void InstructionSelection::visitRet(V4IR::Ret *s)
                 _as->move(Assembler::TrustedImm32(QV4::Value::_Integer_Type), highReg);
                 done.link(_as);
             } break;
-            case V4IR::SInt32Type:
+            case IR::SInt32Type:
                 _as->move((Assembler::RegisterID) t->index, lowReg);
                 _as->move(Assembler::TrustedImm32(QV4::Value::_Integer_Type), highReg);
                 break;
-            case V4IR::BoolType:
+            case IR::BoolType:
                 _as->move((Assembler::RegisterID) t->index, lowReg);
                 _as->move(Assembler::TrustedImm32(QV4::Value::_Boolean_Type), highReg);
                 break;
@@ -1411,14 +1410,14 @@ void InstructionSelection::visitRet(V4IR::Ret *s)
             _as->load32(addr, highReg);
         }
 #else
-        if (t->kind == V4IR::Temp::PhysicalRegister) {
-            if (t->type == V4IR::DoubleType) {
+        if (t->kind == IR::Temp::PhysicalRegister) {
+            if (t->type == IR::DoubleType) {
                 _as->moveDoubleTo64((Assembler::FPRegisterID) t->index,
                                     Assembler::ReturnValueRegister);
                 _as->move(Assembler::TrustedImm64(QV4::Value::NaNEncodeMask),
                           Assembler::ScratchRegister);
                 _as->xor64(Assembler::ScratchRegister, Assembler::ReturnValueRegister);
-            } else if (t->type == V4IR::UInt32Type) {
+            } else if (t->type == IR::UInt32Type) {
                 Assembler::RegisterID srcReg = (Assembler::RegisterID) t->index;
                 Assembler::Jump intRange = _as->branch32(Assembler::GreaterThanOrEqual, srcReg, Assembler::TrustedImm32(0));
                 _as->convertUInt32ToDouble(srcReg, Assembler::FPGpr0, Assembler::ReturnValueRegister);
@@ -1436,10 +1435,10 @@ void InstructionSelection::visitRet(V4IR::Ret *s)
                 _as->zeroExtend32ToPtr((Assembler::RegisterID) t->index, Assembler::ReturnValueRegister);
                 quint64 tag;
                 switch (t->type) {
-                case V4IR::SInt32Type:
+                case IR::SInt32Type:
                     tag = QV4::Value::_Integer_Type;
                     break;
-                case V4IR::BoolType:
+                case IR::BoolType:
                     tag = QV4::Value::_Boolean_Type;
                     break;
                 default:
@@ -1453,7 +1452,7 @@ void InstructionSelection::visitRet(V4IR::Ret *s)
             _as->copyValue(Assembler::ReturnValueRegister, t);
         }
 #endif
-    } else if (V4IR::Const *c = s->expr->asConst()) {
+    } else if (IR::Const *c = s->expr->asConst()) {
         QV4::Primitive retVal = convertToValue(c);
 #if CPU(X86)
         _as->move(Assembler::TrustedImm32(retVal.int_32), JSC::X86Registers::eax);
@@ -1480,19 +1479,19 @@ void InstructionSelection::visitRet(V4IR::Ret *s)
     _as->ret();
 }
 
-int InstructionSelection::prepareVariableArguments(V4IR::ExprList* args)
+int InstructionSelection::prepareVariableArguments(IR::ExprList* args)
 {
     int argc = 0;
-    for (V4IR::ExprList *it = args; it; it = it->next) {
+    for (IR::ExprList *it = args; it; it = it->next) {
         ++argc;
     }
 
     int i = 0;
-    for (V4IR::ExprList *it = args; it; it = it->next, ++i) {
-        V4IR::Expr *arg = it->expr;
+    for (IR::ExprList *it = args; it; it = it->next, ++i) {
+        IR::Expr *arg = it->expr;
         Q_ASSERT(arg != 0);
         Pointer dst(_as->stackLayout().argumentAddressForCall(i));
-        if (arg->asTemp() && arg->asTemp()->kind != V4IR::Temp::PhysicalRegister)
+        if (arg->asTemp() && arg->asTemp()->kind != IR::Temp::PhysicalRegister)
             _as->memcopyValue(dst, arg->asTemp(), Assembler::ScratchRegister);
         else
             _as->copyValue(dst, arg);
@@ -1501,10 +1500,10 @@ int InstructionSelection::prepareVariableArguments(V4IR::ExprList* args)
     return argc;
 }
 
-int InstructionSelection::prepareCallData(V4IR::ExprList* args, V4IR::Expr *thisObject)
+int InstructionSelection::prepareCallData(IR::ExprList* args, IR::Expr *thisObject)
 {
     int argc = 0;
-    for (V4IR::ExprList *it = args; it; it = it->next) {
+    for (IR::ExprList *it = args; it; it = it->next) {
         ++argc;
     }
 
@@ -1519,11 +1518,11 @@ int InstructionSelection::prepareCallData(V4IR::ExprList* args, V4IR::Expr *this
         _as->copyValue(p, thisObject);
 
     int i = 0;
-    for (V4IR::ExprList *it = args; it; it = it->next, ++i) {
-        V4IR::Expr *arg = it->expr;
+    for (IR::ExprList *it = args; it; it = it->next, ++i) {
+        IR::Expr *arg = it->expr;
         Q_ASSERT(arg != 0);
         Pointer dst(_as->stackLayout().argumentAddressForCall(i));
-        if (arg->asTemp() && arg->asTemp()->kind != V4IR::Temp::PhysicalRegister)
+        if (arg->asTemp() && arg->asTemp()->kind != IR::Temp::PhysicalRegister)
             _as->memcopyValue(dst, arg->asTemp(), Assembler::ScratchRegister);
         else
             _as->copyValue(dst, arg);
@@ -1551,7 +1550,7 @@ int Assembler::ConstantTable::add(const Primitive &v)
     return idx;
 }
 
-Assembler::ImplicitAddress Assembler::ConstantTable::loadValueAddress(V4IR::Const *c,
+Assembler::ImplicitAddress Assembler::ConstantTable::loadValueAddress(IR::Const *c,
                                                                       RegisterID baseReg)
 {
     return loadValueAddress(convertToValue(c), baseReg);
@@ -1575,8 +1574,8 @@ void Assembler::ConstantTable::finalize(JSC::LinkBuffer &linkBuffer, Instruction
         linkBuffer.patch(label, tablePtr);
 }
 
-bool InstructionSelection::visitCJumpDouble(V4IR::AluOp op, V4IR::Expr *left, V4IR::Expr *right,
-                                            V4IR::BasicBlock *iftrue, V4IR::BasicBlock *iffalse)
+bool InstructionSelection::visitCJumpDouble(IR::AluOp op, IR::Expr *left, IR::Expr *right,
+                                            IR::BasicBlock *iftrue, IR::BasicBlock *iffalse)
 {
     if (!isPregOrConst(left) || !isPregOrConst(right))
         return false;
@@ -1592,49 +1591,49 @@ bool InstructionSelection::visitCJumpDouble(V4IR::AluOp op, V4IR::Expr *left, V4
     return true;
 }
 
-void InstructionSelection::visitCJumpStrict(V4IR::Binop *binop, V4IR::BasicBlock *trueBlock,
-                                            V4IR::BasicBlock *falseBlock)
+void InstructionSelection::visitCJumpStrict(IR::Binop *binop, IR::BasicBlock *trueBlock,
+                                            IR::BasicBlock *falseBlock)
 {
-    Q_ASSERT(binop->op == V4IR::OpStrictEqual || binop->op == V4IR::OpStrictNotEqual);
+    Q_ASSERT(binop->op == IR::OpStrictEqual || binop->op == IR::OpStrictNotEqual);
 
-    if (visitCJumpStrictNullUndefined(V4IR::NullType, binop, trueBlock, falseBlock))
+    if (visitCJumpStrictNullUndefined(IR::NullType, binop, trueBlock, falseBlock))
         return;
-    if (visitCJumpStrictNullUndefined(V4IR::UndefinedType, binop, trueBlock, falseBlock))
+    if (visitCJumpStrictNullUndefined(IR::UndefinedType, binop, trueBlock, falseBlock))
         return;
     if (visitCJumpStrictBool(binop, trueBlock, falseBlock))
         return;
 
-    V4IR::Expr *left = binop->left;
-    V4IR::Expr *right = binop->right;
+    IR::Expr *left = binop->left;
+    IR::Expr *right = binop->right;
 
     _as->generateFunctionCallImp(Assembler::ReturnValueRegister, "__qmljs_cmp_se", __qmljs_cmp_se,
                                  Assembler::PointerToValue(left), Assembler::PointerToValue(right));
-    _as->generateCJumpOnCompare(binop->op == V4IR::OpStrictEqual ? Assembler::NotEqual : Assembler::Equal,
+    _as->generateCJumpOnCompare(binop->op == IR::OpStrictEqual ? Assembler::NotEqual : Assembler::Equal,
                                 Assembler::ReturnValueRegister, Assembler::TrustedImm32(0),
                                 _block, trueBlock, falseBlock);
 }
 
 // Only load the non-null temp.
-bool InstructionSelection::visitCJumpStrictNullUndefined(V4IR::Type nullOrUndef, V4IR::Binop *binop,
-                                                         V4IR::BasicBlock *trueBlock,
-                                                         V4IR::BasicBlock *falseBlock)
+bool InstructionSelection::visitCJumpStrictNullUndefined(IR::Type nullOrUndef, IR::Binop *binop,
+                                                         IR::BasicBlock *trueBlock,
+                                                         IR::BasicBlock *falseBlock)
 {
-    Q_ASSERT(nullOrUndef == V4IR::NullType || nullOrUndef == V4IR::UndefinedType);
+    Q_ASSERT(nullOrUndef == IR::NullType || nullOrUndef == IR::UndefinedType);
 
-    V4IR::Expr *varSrc = 0;
-    if (binop->left->type == V4IR::VarType && binop->right->type == nullOrUndef)
+    IR::Expr *varSrc = 0;
+    if (binop->left->type == IR::VarType && binop->right->type == nullOrUndef)
         varSrc = binop->left;
-    else if (binop->left->type == nullOrUndef && binop->right->type == V4IR::VarType)
+    else if (binop->left->type == nullOrUndef && binop->right->type == IR::VarType)
         varSrc = binop->right;
     if (!varSrc)
         return false;
 
-    if (varSrc->asTemp() && varSrc->asTemp()->kind == V4IR::Temp::PhysicalRegister) {
+    if (varSrc->asTemp() && varSrc->asTemp()->kind == IR::Temp::PhysicalRegister) {
         _as->jumpToBlock(_block, falseBlock);
         return true;
     }
 
-    if (V4IR::Const *c = varSrc->asConst()) {
+    if (IR::Const *c = varSrc->asConst()) {
         if (c->type == nullOrUndef)
             _as->jumpToBlock(_block, trueBlock);
         else
@@ -1642,7 +1641,7 @@ bool InstructionSelection::visitCJumpStrictNullUndefined(V4IR::Type nullOrUndef,
         return true;
     }
 
-    V4IR::Temp *t = varSrc->asTemp();
+    IR::Temp *t = varSrc->asTemp();
     Q_ASSERT(t);
 
     Assembler::Pointer tagAddr = _as->loadTempAddress(Assembler::ScratchRegister, t);
@@ -1650,22 +1649,22 @@ bool InstructionSelection::visitCJumpStrictNullUndefined(V4IR::Type nullOrUndef,
     const Assembler::RegisterID tagReg = Assembler::ScratchRegister;
     _as->load32(tagAddr, tagReg);
 
-    Assembler::RelationalCondition cond = binop->op == V4IR::OpStrictEqual ? Assembler::Equal
+    Assembler::RelationalCondition cond = binop->op == IR::OpStrictEqual ? Assembler::Equal
                                                                            : Assembler::NotEqual;
-    const Assembler::TrustedImm32 tag(nullOrUndef == V4IR::NullType ? int(QV4::Value::_Null_Type)
+    const Assembler::TrustedImm32 tag(nullOrUndef == IR::NullType ? int(QV4::Value::_Null_Type)
                                                                     : int(QV4::Value::Undefined_Type));
     _as->generateCJumpOnCompare(cond, tagReg, tag, _block, trueBlock, falseBlock);
     return true;
 }
 
-bool InstructionSelection::visitCJumpStrictBool(V4IR::Binop *binop, V4IR::BasicBlock *trueBlock,
-                                                V4IR::BasicBlock *falseBlock)
+bool InstructionSelection::visitCJumpStrictBool(IR::Binop *binop, IR::BasicBlock *trueBlock,
+                                                IR::BasicBlock *falseBlock)
 {
-    V4IR::Expr *boolSrc = 0, *otherSrc = 0;
-    if (binop->left->type == V4IR::BoolType) {
+    IR::Expr *boolSrc = 0, *otherSrc = 0;
+    if (binop->left->type == IR::BoolType) {
         boolSrc = binop->left;
         otherSrc = binop->right;
-    } else if (binop->right->type == V4IR::BoolType) {
+    } else if (binop->right->type == IR::BoolType) {
         boolSrc = binop->right;
         otherSrc = binop->left;
     } else {
@@ -1673,24 +1672,24 @@ bool InstructionSelection::visitCJumpStrictBool(V4IR::Binop *binop, V4IR::BasicB
         return false;
     }
 
-    Assembler::RelationalCondition cond = binop->op == V4IR::OpStrictEqual ? Assembler::Equal
+    Assembler::RelationalCondition cond = binop->op == IR::OpStrictEqual ? Assembler::Equal
                                                                            : Assembler::NotEqual;
 
-    if (otherSrc->type == V4IR::BoolType) { // both are boolean
+    if (otherSrc->type == IR::BoolType) { // both are boolean
         Assembler::RegisterID one = _as->toBoolRegister(boolSrc, Assembler::ReturnValueRegister);
         Assembler::RegisterID two = _as->toBoolRegister(otherSrc, Assembler::ScratchRegister);
         _as->generateCJumpOnCompare(cond, one, two, _block, trueBlock, falseBlock);
         return true;
     }
 
-    if (otherSrc->type != V4IR::VarType) {
+    if (otherSrc->type != IR::VarType) {
         _as->jumpToBlock(_block, falseBlock);
         return true;
     }
 
-    V4IR::Temp *otherTemp = otherSrc->asTemp();
+    IR::Temp *otherTemp = otherSrc->asTemp();
     Q_ASSERT(otherTemp); // constants cannot have "var" type
-    Q_ASSERT(otherTemp->kind != V4IR::Temp::PhysicalRegister);
+    Q_ASSERT(otherTemp->kind != IR::Temp::PhysicalRegister);
 
     Assembler::Pointer otherAddr = _as->loadTempAddress(Assembler::ReturnValueRegister, otherTemp);
     otherAddr.offset += 4; // tag address
@@ -1699,7 +1698,7 @@ bool InstructionSelection::visitCJumpStrictBool(V4IR::Binop *binop, V4IR::BasicB
     _as->load32(otherAddr, Assembler::ScratchRegister);
     Assembler::Jump noBool = _as->branch32(Assembler::NotEqual, Assembler::ScratchRegister,
                                            Assembler::TrustedImm32(QV4::Value::_Boolean_Type));
-    if (binop->op == V4IR::OpStrictEqual)
+    if (binop->op == IR::OpStrictEqual)
         _as->addPatch(falseBlock, noBool);
     else
         _as->addPatch(trueBlock, noBool);
@@ -1713,26 +1712,26 @@ bool InstructionSelection::visitCJumpStrictBool(V4IR::Binop *binop, V4IR::BasicB
     return true;
 }
 
-bool InstructionSelection::visitCJumpNullUndefined(V4IR::Type nullOrUndef, V4IR::Binop *binop,
-                                                         V4IR::BasicBlock *trueBlock,
-                                                         V4IR::BasicBlock *falseBlock)
+bool InstructionSelection::visitCJumpNullUndefined(IR::Type nullOrUndef, IR::Binop *binop,
+                                                         IR::BasicBlock *trueBlock,
+                                                         IR::BasicBlock *falseBlock)
 {
-    Q_ASSERT(nullOrUndef == V4IR::NullType || nullOrUndef == V4IR::UndefinedType);
+    Q_ASSERT(nullOrUndef == IR::NullType || nullOrUndef == IR::UndefinedType);
 
-    V4IR::Expr *varSrc = 0;
-    if (binop->left->type == V4IR::VarType && binop->right->type == nullOrUndef)
+    IR::Expr *varSrc = 0;
+    if (binop->left->type == IR::VarType && binop->right->type == nullOrUndef)
         varSrc = binop->left;
-    else if (binop->left->type == nullOrUndef && binop->right->type == V4IR::VarType)
+    else if (binop->left->type == nullOrUndef && binop->right->type == IR::VarType)
         varSrc = binop->right;
     if (!varSrc)
         return false;
 
-    if (varSrc->asTemp() && varSrc->asTemp()->kind == V4IR::Temp::PhysicalRegister) {
+    if (varSrc->asTemp() && varSrc->asTemp()->kind == IR::Temp::PhysicalRegister) {
         _as->jumpToBlock(_block, falseBlock);
         return true;
     }
 
-    if (V4IR::Const *c = varSrc->asConst()) {
+    if (IR::Const *c = varSrc->asConst()) {
         if (c->type == nullOrUndef)
             _as->jumpToBlock(_block, trueBlock);
         else
@@ -1740,7 +1739,7 @@ bool InstructionSelection::visitCJumpNullUndefined(V4IR::Type nullOrUndef, V4IR:
         return true;
     }
 
-    V4IR::Temp *t = varSrc->asTemp();
+    IR::Temp *t = varSrc->asTemp();
     Q_ASSERT(t);
 
     Assembler::Pointer tagAddr = _as->loadTempAddress(Assembler::ScratchRegister, t);
@@ -1748,7 +1747,7 @@ bool InstructionSelection::visitCJumpNullUndefined(V4IR::Type nullOrUndef, V4IR:
     const Assembler::RegisterID tagReg = Assembler::ScratchRegister;
     _as->load32(tagAddr, tagReg);
 
-    if (binop->op == V4IR::OpNotEqual)
+    if (binop->op == IR::OpNotEqual)
         qSwap(trueBlock, falseBlock);
     Assembler::Jump isNull = _as->branch32(Assembler::Equal, tagReg, Assembler::TrustedImm32(int(QV4::Value::_Null_Type)));
     Assembler::Jump isUndefined = _as->branch32(Assembler::Equal, tagReg, Assembler::TrustedImm32(int(QV4::Value::Undefined_Type)));
@@ -1760,20 +1759,20 @@ bool InstructionSelection::visitCJumpNullUndefined(V4IR::Type nullOrUndef, V4IR:
 }
 
 
-void InstructionSelection::visitCJumpEqual(V4IR::Binop *binop, V4IR::BasicBlock *trueBlock,
-                                            V4IR::BasicBlock *falseBlock)
+void InstructionSelection::visitCJumpEqual(IR::Binop *binop, IR::BasicBlock *trueBlock,
+                                            IR::BasicBlock *falseBlock)
 {
-    Q_ASSERT(binop->op == V4IR::OpEqual || binop->op == V4IR::OpNotEqual);
+    Q_ASSERT(binop->op == IR::OpEqual || binop->op == IR::OpNotEqual);
 
-    if (visitCJumpNullUndefined(V4IR::NullType, binop, trueBlock, falseBlock))
+    if (visitCJumpNullUndefined(IR::NullType, binop, trueBlock, falseBlock))
         return;
 
-    V4IR::Expr *left = binop->left;
-    V4IR::Expr *right = binop->right;
+    IR::Expr *left = binop->left;
+    IR::Expr *right = binop->right;
 
     _as->generateFunctionCallImp(Assembler::ReturnValueRegister, "__qmljs_cmp_eq", __qmljs_cmp_eq,
                                  Assembler::PointerToValue(left), Assembler::PointerToValue(right));
-    _as->generateCJumpOnCompare(binop->op == V4IR::OpEqual ? Assembler::NotEqual : Assembler::Equal,
+    _as->generateCJumpOnCompare(binop->op == IR::OpEqual ? Assembler::NotEqual : Assembler::Equal,
                                 Assembler::ReturnValueRegister, Assembler::TrustedImm32(0),
                                 _block, trueBlock, falseBlock);
 }
index b6af38588746966a4abe2a10f13e5582adb8e129..69317cb062350b6dc7a2bbe356d66068abb71360 100644 (file)
 
 QT_BEGIN_NAMESPACE
 
-namespace QQmlJS {
-namespace MASM {
+namespace QV4 {
+namespace JIT {
 
 class Q_QML_EXPORT InstructionSelection:
-        protected V4IR::IRDecoder,
+        protected IR::IRDecoder,
         public EvalInstructionSelection
 {
 public:
-    InstructionSelection(QQmlEnginePrivate *qmlEngine, QV4::ExecutableAllocator *execAllocator, V4IR::Module *module, QV4::Compiler::JSUnitGenerator *jsGenerator);
+    InstructionSelection(QQmlEnginePrivate *qmlEngine, QV4::ExecutableAllocator *execAllocator, IR::Module *module, QV4::Compiler::JSUnitGenerator *jsGenerator);
     ~InstructionSelection();
 
     virtual void run(int functionIndex);
@@ -76,56 +76,56 @@ public:
 protected:
     virtual QV4::CompiledData::CompilationUnit *backendCompileStep();
 
-    virtual void callBuiltinInvalid(V4IR::Name *func, V4IR::ExprList *args, V4IR::Temp *result);
-    virtual void callBuiltinTypeofMember(V4IR::Expr *base, const QString &name, V4IR::Temp *result);
-    virtual void callBuiltinTypeofSubscript(V4IR::Expr *base, V4IR::Expr *index, V4IR::Temp *result);
-    virtual void callBuiltinTypeofName(const QString &name, V4IR::Temp *result);
-    virtual void callBuiltinTypeofValue(V4IR::Expr *value, V4IR::Temp *result);
-    virtual void callBuiltinDeleteMember(V4IR::Temp *base, const QString &name, V4IR::Temp *result);
-    virtual void callBuiltinDeleteSubscript(V4IR::Temp *base, V4IR::Expr *index, V4IR::Temp *result);
-    virtual void callBuiltinDeleteName(const QString &name, V4IR::Temp *result);
-    virtual void callBuiltinDeleteValue(V4IR::Temp *result);
-    virtual void callBuiltinThrow(V4IR::Expr *arg);
+    virtual void callBuiltinInvalid(IR::Name *func, IR::ExprList *args, IR::Temp *result);
+    virtual void callBuiltinTypeofMember(IR::Expr *base, const QString &name, IR::Temp *result);
+    virtual void callBuiltinTypeofSubscript(IR::Expr *base, IR::Expr *index, IR::Temp *result);
+    virtual void callBuiltinTypeofName(const QString &name, IR::Temp *result);
+    virtual void callBuiltinTypeofValue(IR::Expr *value, IR::Temp *result);
+    virtual void callBuiltinDeleteMember(IR::Temp *base, const QString &name, IR::Temp *result);
+    virtual void callBuiltinDeleteSubscript(IR::Temp *base, IR::Expr *index, IR::Temp *result);
+    virtual void callBuiltinDeleteName(const QString &name, IR::Temp *result);
+    virtual void callBuiltinDeleteValue(IR::Temp *result);
+    virtual void callBuiltinThrow(IR::Expr *arg);
     virtual void callBuiltinReThrow();
-    virtual void callBuiltinUnwindException(V4IR::Temp *);
+    virtual void callBuiltinUnwindException(IR::Temp *);
     virtual void callBuiltinPushCatchScope(const QString &exceptionName);
-    virtual void callBuiltinForeachIteratorObject(V4IR::Temp *arg, V4IR::Temp *result);
-    virtual void callBuiltinForeachNextPropertyname(V4IR::Temp *arg, V4IR::Temp *result);
-    virtual void callBuiltinPushWithScope(V4IR::Temp *arg);
+    virtual void callBuiltinForeachIteratorObject(IR::Temp *arg, IR::Temp *result);
+    virtual void callBuiltinForeachNextPropertyname(IR::Temp *arg, IR::Temp *result);
+    virtual void callBuiltinPushWithScope(IR::Temp *arg);
     virtual void callBuiltinPopScope();
     virtual void callBuiltinDeclareVar(bool deletable, const QString &name);
-    virtual void callBuiltinDefineGetterSetter(V4IR::Temp *object, const QString &name, V4IR::Temp *getter, V4IR::Temp *setter);
-    virtual void callBuiltinDefineProperty(V4IR::Temp *object, const QString &name, V4IR::Expr *value);
-    virtual void callBuiltinDefineArray(V4IR::Temp *result, V4IR::ExprList *args);
-    virtual void callBuiltinDefineObjectLiteral(V4IR::Temp *result, V4IR::ExprList *args);
-    virtual void callBuiltinSetupArgumentObject(V4IR::Temp *result);
+    virtual void callBuiltinDefineGetterSetter(IR::Temp *object, const QString &name, IR::Temp *getter, IR::Temp *setter);
+    virtual void callBuiltinDefineProperty(IR::Temp *object, const QString &name, IR::Expr *value);
+    virtual void callBuiltinDefineArray(IR::Temp *result, IR::ExprList *args);
+    virtual void callBuiltinDefineObjectLiteral(IR::Temp *result, IR::ExprList *args);
+    virtual void callBuiltinSetupArgumentObject(IR::Temp *result);
     virtual void callBuiltinConvertThisToObject();
-    virtual void callValue(V4IR::Temp *value, V4IR::ExprList *args, V4IR::Temp *result);
-    virtual void callProperty(V4IR::Expr *base, const QString &name, V4IR::ExprList *args, V4IR::Temp *result);
-    virtual void callSubscript(V4IR::Expr *base, V4IR::Expr *index, V4IR::ExprList *args, V4IR::Temp *result);
-    virtual void convertType(V4IR::Temp *source, V4IR::Temp *target);
-    virtual void loadThisObject(V4IR::Temp *temp);
-    virtual void loadQmlIdArray(V4IR::Temp *temp);
-    virtual void loadQmlImportedScripts(V4IR::Temp *temp);
-    virtual void loadQmlContextObject(V4IR::Temp *temp);
-    virtual void loadQmlScopeObject(V4IR::Temp *temp);
-    virtual void loadQmlSingleton(const QString &name, V4IR::Temp *temp);
-    virtual void loadConst(V4IR::Const *sourceConst, V4IR::Temp *targetTemp);
-    virtual void loadString(const QString &str, V4IR::Temp *targetTemp);
-    virtual void loadRegexp(V4IR::RegExp *sourceRegexp, V4IR::Temp *targetTemp);
-    virtual void getActivationProperty(const V4IR::Name *name, V4IR::Temp *temp);
-    virtual void setActivationProperty(V4IR::Expr *source, const QString &targetName);
-    virtual void initClosure(V4IR::Closure *closure, V4IR::Temp *target);
-    virtual void getProperty(V4IR::Expr *base, const QString &name, V4IR::Temp *target);
-    virtual void setProperty(V4IR::Expr *source, V4IR::Expr *targetBase, const QString &targetName);
-    virtual void setQObjectProperty(V4IR::Expr *source, V4IR::Expr *targetBase, int propertyIndex);
-    virtual void getQObjectProperty(V4IR::Expr *base, int propertyIndex, bool captureRequired, int attachedPropertiesId, V4IR::Temp *target);
-    virtual void getElement(V4IR::Expr *base, V4IR::Expr *index, V4IR::Temp *target);
-    virtual void setElement(V4IR::Expr *source, V4IR::Expr *targetBase, V4IR::Expr *targetIndex);
-    virtual void copyValue(V4IR::Temp *sourceTemp, V4IR::Temp *targetTemp);
-    virtual void swapValues(V4IR::Temp *sourceTemp, V4IR::Temp *targetTemp);
-    virtual void unop(V4IR::AluOp oper, V4IR::Temp *sourceTemp, V4IR::Temp *targetTemp);
-    virtual void binop(V4IR::AluOp oper, V4IR::Expr *leftSource, V4IR::Expr *rightSource, V4IR::Temp *target);
+    virtual void callValue(IR::Temp *value, IR::ExprList *args, IR::Temp *result);
+    virtual void callProperty(IR::Expr *base, const QString &name, IR::ExprList *args, IR::Temp *result);
+    virtual void callSubscript(IR::Expr *base, IR::Expr *index, IR::ExprList *args, IR::Temp *result);
+    virtual void convertType(IR::Temp *source, IR::Temp *target);
+    virtual void loadThisObject(IR::Temp *temp);
+    virtual void loadQmlIdArray(IR::Temp *temp);
+    virtual void loadQmlImportedScripts(IR::Temp *temp);
+    virtual void loadQmlContextObject(IR::Temp *temp);
+    virtual void loadQmlScopeObject(IR::Temp *temp);
+    virtual void loadQmlSingleton(const QString &name, IR::Temp *temp);
+    virtual void loadConst(IR::Const *sourceConst, IR::Temp *targetTemp);
+    virtual void loadString(const QString &str, IR::Temp *targetTemp);
+    virtual void loadRegexp(IR::RegExp *sourceRegexp, IR::Temp *targetTemp);
+    virtual void getActivationProperty(const IR::Name *name, IR::Temp *temp);
+    virtual void setActivationProperty(IR::Expr *source, const QString &targetName);
+    virtual void initClosure(IR::Closure *closure, IR::Temp *target);
+    virtual void getProperty(IR::Expr *base, const QString &name, IR::Temp *target);
+    virtual void setProperty(IR::Expr *source, IR::Expr *targetBase, const QString &targetName);
+    virtual void setQObjectProperty(IR::Expr *source, IR::Expr *targetBase, int propertyIndex);
+    virtual void getQObjectProperty(IR::Expr *base, int propertyIndex, bool captureRequired, int attachedPropertiesId, IR::Temp *target);
+    virtual void getElement(IR::Expr *base, IR::Expr *index, IR::Temp *target);
+    virtual void setElement(IR::Expr *source, IR::Expr *targetBase, IR::Expr *targetIndex);
+    virtual void copyValue(IR::Temp *sourceTemp, IR::Temp *targetTemp);
+    virtual void swapValues(IR::Temp *sourceTemp, IR::Temp *targetTemp);
+    virtual void unop(IR::AluOp oper, IR::Temp *sourceTemp, IR::Temp *targetTemp);
+    virtual void binop(IR::AluOp oper, IR::Expr *leftSource, IR::Expr *rightSource, IR::Temp *target);
 
     typedef Assembler::Address Address;
     typedef Assembler::Pointer Pointer;
@@ -150,34 +150,34 @@ protected:
         return _as->stackLayout().callDataAddress();
     }
 
-    virtual void constructActivationProperty(V4IR::Name *func, V4IR::ExprList *args, V4IR::Temp *result);
-    virtual void constructProperty(V4IR::Temp *base, const QString &name, V4IR::ExprList *args, V4IR::Temp *result);
-    virtual void constructValue(V4IR::Temp *value, V4IR::ExprList *args, V4IR::Temp *result);
+    virtual void constructActivationProperty(IR::Name *func, IR::ExprList *args, IR::Temp *result);
+    virtual void constructProperty(IR::Temp *base, const QString &name, IR::ExprList *args, IR::Temp *result);
+    virtual void constructValue(IR::Temp *value, IR::ExprList *args, IR::Temp *result);
 
-    virtual void visitJump(V4IR::Jump *);
-    virtual void visitCJump(V4IR::CJump *);
-    virtual void visitRet(V4IR::Ret *);
+    virtual void visitJump(IR::Jump *);
+    virtual void visitCJump(IR::CJump *);
+    virtual void visitRet(IR::Ret *);
 
-    bool visitCJumpDouble(V4IR::AluOp op, V4IR::Expr *left, V4IR::Expr *right,
-                          V4IR::BasicBlock *iftrue, V4IR::BasicBlock *iffalse);
-    void visitCJumpStrict(V4IR::Binop *binop, V4IR::BasicBlock *trueBlock, V4IR::BasicBlock *falseBlock);
-    bool visitCJumpStrictNullUndefined(V4IR::Type nullOrUndef, V4IR::Binop *binop,
-                                       V4IR::BasicBlock *trueBlock, V4IR::BasicBlock *falseBlock);
-    bool visitCJumpStrictBool(V4IR::Binop *binop, V4IR::BasicBlock *trueBlock, V4IR::BasicBlock *falseBlock);
-    bool visitCJumpNullUndefined(V4IR::Type nullOrUndef, V4IR::Binop *binop,
-                                 V4IR::BasicBlock *trueBlock, V4IR::BasicBlock *falseBlock);
-    void visitCJumpEqual(V4IR::Binop *binop, V4IR::BasicBlock *trueBlock, V4IR::BasicBlock *falseBlock);
+    bool visitCJumpDouble(IR::AluOp op, IR::Expr *left, IR::Expr *right,
+                          IR::BasicBlock *iftrue, IR::BasicBlock *iffalse);
+    void visitCJumpStrict(IR::Binop *binop, IR::BasicBlock *trueBlock, IR::BasicBlock *falseBlock);
+    bool visitCJumpStrictNullUndefined(IR::Type nullOrUndef, IR::Binop *binop,
+                                       IR::BasicBlock *trueBlock, IR::BasicBlock *falseBlock);
+    bool visitCJumpStrictBool(IR::Binop *binop, IR::BasicBlock *trueBlock, IR::BasicBlock *falseBlock);
+    bool visitCJumpNullUndefined(IR::Type nullOrUndef, IR::Binop *binop,
+                                 IR::BasicBlock *trueBlock, IR::BasicBlock *falseBlock);
+    void visitCJumpEqual(IR::Binop *binop, IR::BasicBlock *trueBlock, IR::BasicBlock *falseBlock);
 
 private:
-    void convertTypeSlowPath(V4IR::Temp *source, V4IR::Temp *target);
-    void convertTypeToDouble(V4IR::Temp *source, V4IR::Temp *target);
-    void convertTypeToBool(V4IR::Temp *source, V4IR::Temp *target);
-    void convertTypeToSInt32(V4IR::Temp *source, V4IR::Temp *target);
-    void convertTypeToUInt32(V4IR::Temp *source, V4IR::Temp *target);
+    void convertTypeSlowPath(IR::Temp *source, IR::Temp *target);
+    void convertTypeToDouble(IR::Temp *source, IR::Temp *target);
+    void convertTypeToBool(IR::Temp *source, IR::Temp *target);
+    void convertTypeToSInt32(IR::Temp *source, IR::Temp *target);
+    void convertTypeToUInt32(IR::Temp *source, IR::Temp *target);
 
-    void convertIntToDouble(V4IR::Temp *source, V4IR::Temp *target)
+    void convertIntToDouble(IR::Temp *source, IR::Temp *target)
     {
-        if (target->kind == V4IR::Temp::PhysicalRegister) {
+        if (target->kind == IR::Temp::PhysicalRegister) {
             _as->convertInt32ToDouble(_as->toInt32Register(source, Assembler::ScratchRegister),
                                       (Assembler::FPRegisterID) target->index);
         } else {
@@ -187,12 +187,12 @@ private:
         }
     }
 
-    void convertUIntToDouble(V4IR::Temp *source, V4IR::Temp *target)
+    void convertUIntToDouble(IR::Temp *source, IR::Temp *target)
     {
         Assembler::RegisterID tmpReg = Assembler::ScratchRegister;
         Assembler::RegisterID reg = _as->toInt32Register(source, tmpReg);
 
-        if (target->kind == V4IR::Temp::PhysicalRegister) {
+        if (target->kind == IR::Temp::PhysicalRegister) {
             _as->convertUInt32ToDouble(reg, (Assembler::FPRegisterID) target->index, tmpReg);
         } else {
             _as->convertUInt32ToDouble(_as->toUInt32Register(source, tmpReg),
@@ -201,9 +201,9 @@ private:
         }
     }
 
-    void convertIntToBool(V4IR::Temp *source, V4IR::Temp *target)
+    void convertIntToBool(IR::Temp *source, IR::Temp *target)
     {
-        Assembler::RegisterID reg = target->kind == V4IR::Temp::PhysicalRegister
+        Assembler::RegisterID reg = target->kind == IR::Temp::PhysicalRegister
                 ? (Assembler::RegisterID) target->index
                 : Assembler::ScratchRegister;
 
@@ -218,8 +218,8 @@ private:
     #define generateFunctionCall(t, function, ...) \
         _as->generateFunctionCallImp(t, isel_stringIfy(function), function, __VA_ARGS__)
 
-    int prepareVariableArguments(V4IR::ExprList* args);
-    int prepareCallData(V4IR::ExprList* args, V4IR::Expr *thisObject);
+    int prepareVariableArguments(IR::ExprList* args);
+    int prepareCallData(IR::ExprList* args, IR::Expr *thisObject);
 
     template <typename Retval, typename Arg1, typename Arg2, typename Arg3>
     void generateLookupCall(Retval retval, uint index, uint getterSetterOffset, Arg1 arg1, Arg2 arg2, Arg3 arg3)
@@ -245,8 +245,8 @@ private:
         generateLookupCall(retval, index, getterSetterOffset, arg1, arg2, Assembler::VoidType());
     }
 
-    V4IR::BasicBlock *_block;
-    QSet<V4IR::Jump *> _removableJumps;
+    IR::BasicBlock *_block;
+    QSet<IR::Jump *> _removableJumps;
     Assembler* _as;
 
     CompilationUnit *compilationUnit;
@@ -257,14 +257,14 @@ class Q_QML_EXPORT ISelFactory: public EvalISelFactory
 {
 public:
     virtual ~ISelFactory() {}
-    virtual EvalInstructionSelection *create(QQmlEnginePrivate *qmlEngine, QV4::ExecutableAllocator *execAllocator, V4IR::Module *module, QV4::Compiler::JSUnitGenerator *jsGenerator)
+    virtual EvalInstructionSelection *create(QQmlEnginePrivate *qmlEngine, QV4::ExecutableAllocator *execAllocator, IR::Module *module, QV4::Compiler::JSUnitGenerator *jsGenerator)
     { return new InstructionSelection(qmlEngine, execAllocator, module, jsGenerator); }
     virtual bool jitCompileRegexps() const
     { return true; }
 };
 
-} // end of namespace MASM
-} // end of namespace QQmlJS
+} // end of namespace JIT
+} // end of namespace QV4
 
 QT_END_NAMESPACE
 
index cc9ce4fc9601d1f43cf9ab87c4a91929547ea3a9..4ff03611fa9b2177c8a8f218676a0f7dc2c56479 100644 (file)
@@ -63,10 +63,10 @@ QT_BEGIN_NAMESPACE
 
 Q_DECLARE_TYPEINFO(Use, Q_MOVABLE_TYPE);
 
-using namespace QQmlJS::V4IR;
+using namespace QV4::IR;
 
-namespace QQmlJS {
-namespace MASM {
+namespace QV4 {
+namespace JIT {
 
 class RegAllocInfo: public IRDecoder
 {
@@ -95,7 +95,7 @@ class RegAllocInfo: public IRDecoder
 public:
     RegAllocInfo(): _currentStmt(0) {}
 
-    void collect(Function *function)
+    void collect(IR::Function *function)
     {
         foreach (BasicBlock *bb, function->basicBlocks) {
             foreach (Stmt *s, bb->statements) {
@@ -194,33 +194,33 @@ public:
 #endif // DEBUG_REGALLOC
 
 protected: // IRDecoder
-    virtual void callBuiltinInvalid(V4IR::Name *, V4IR::ExprList *, V4IR::Temp *) {}
-    virtual void callBuiltinTypeofMember(V4IR::Expr *, const QString &, V4IR::Temp *) {}
-    virtual void callBuiltinTypeofSubscript(V4IR::Expr *, V4IR::Expr *, V4IR::Temp *) {}
-    virtual void callBuiltinTypeofName(const QString &, V4IR::Temp *) {}
-    virtual void callBuiltinTypeofValue(V4IR::Expr *, V4IR::Temp *) {}
-    virtual void callBuiltinDeleteMember(V4IR::Temp *, const QString &, V4IR::Temp *) {}
-    virtual void callBuiltinDeleteSubscript(V4IR::Temp *, V4IR::Expr *, V4IR::Temp *) {}
-    virtual void callBuiltinDeleteName(const QString &, V4IR::Temp *) {}
-    virtual void callBuiltinDeleteValue(V4IR::Temp *) {}
-    virtual void callBuiltinThrow(V4IR::Expr *) {}
+    virtual void callBuiltinInvalid(IR::Name *, IR::ExprList *, IR::Temp *) {}
+    virtual void callBuiltinTypeofMember(IR::Expr *, const QString &, IR::Temp *) {}
+    virtual void callBuiltinTypeofSubscript(IR::Expr *, IR::Expr *, IR::Temp *) {}
+    virtual void callBuiltinTypeofName(const QString &, IR::Temp *) {}
+    virtual void callBuiltinTypeofValue(IR::Expr *, IR::Temp *) {}
+    virtual void callBuiltinDeleteMember(IR::Temp *, const QString &, IR::Temp *) {}
+    virtual void callBuiltinDeleteSubscript(IR::Temp *, IR::Expr *, IR::Temp *) {}
+    virtual void callBuiltinDeleteName(const QString &, IR::Temp *) {}
+    virtual void callBuiltinDeleteValue(IR::Temp *) {}
+    virtual void callBuiltinThrow(IR::Expr *) {}
     virtual void callBuiltinReThrow() {}
-    virtual void callBuiltinUnwindException(V4IR::Temp *) {}
+    virtual void callBuiltinUnwindException(IR::Temp *) {}
     virtual void callBuiltinPushCatchScope(const QString &) {};
-    virtual void callBuiltinForeachIteratorObject(V4IR::Temp *, V4IR::Temp *) {}
-    virtual void callBuiltinForeachNextProperty(V4IR::Temp *, V4IR::Temp *) {}
-    virtual void callBuiltinForeachNextPropertyname(V4IR::Temp *, V4IR::Temp *) {}
-    virtual void callBuiltinPushWithScope(V4IR::Temp *) {}
+    virtual void callBuiltinForeachIteratorObject(IR::Temp *, IR::Temp *) {}
+    virtual void callBuiltinForeachNextProperty(IR::Temp *, IR::Temp *) {}
+    virtual void callBuiltinForeachNextPropertyname(IR::Temp *, IR::Temp *) {}
+    virtual void callBuiltinPushWithScope(IR::Temp *) {}
     virtual void callBuiltinPopScope() {}
     virtual void callBuiltinDeclareVar(bool , const QString &) {}
-    virtual void callBuiltinDefineGetterSetter(V4IR::Temp *, const QString &, V4IR::Temp *, V4IR::Temp *) {}
-    virtual void callBuiltinDefineProperty(V4IR::Temp *, const QString &, V4IR::Expr *) {}
-    virtual void callBuiltinDefineArray(V4IR::Temp *, V4IR::ExprList *) {}
-    virtual void callBuiltinDefineObjectLiteral(V4IR::Temp *, V4IR::ExprList *) {}
-    virtual void callBuiltinSetupArgumentObject(V4IR::Temp *) {}
+    virtual void callBuiltinDefineGetterSetter(IR::Temp *, const QString &, IR::Temp *, IR::Temp *) {}
+    virtual void callBuiltinDefineProperty(IR::Temp *, const QString &, IR::Expr *) {}
+    virtual void callBuiltinDefineArray(IR::Temp *, IR::ExprList *) {}
+    virtual void callBuiltinDefineObjectLiteral(IR::Temp *, IR::ExprList *) {}
+    virtual void callBuiltinSetupArgumentObject(IR::Temp *) {}
     virtual void callBuiltinConvertThisToObject() {}
 
-    virtual void callValue(V4IR::Temp *value, V4IR::ExprList *args, V4IR::Temp *result)
+    virtual void callValue(IR::Temp *value, IR::ExprList *args, IR::Temp *result)
     {
         addDef(result);
         addUses(value, Use::CouldHaveRegister);
@@ -228,8 +228,8 @@ protected: // IRDecoder
         addCall();
     }
 
-    virtual void callProperty(V4IR::Expr *base, const QString &name, V4IR::ExprList *args,
-                              V4IR::Temp *result)
+    virtual void callProperty(IR::Expr *base, const QString &name, IR::ExprList *args,
+                              IR::Temp *result)
     {
         Q_UNUSED(name)
 
@@ -239,8 +239,8 @@ protected: // IRDecoder
         addCall();
     }
 
-    virtual void callSubscript(V4IR::Expr *base, V4IR::Expr *index, V4IR::ExprList *args,
-                               V4IR::Temp *result)
+    virtual void callSubscript(IR::Expr *base, IR::Expr *index, IR::ExprList *args,
+                               IR::Temp *result)
     {
         addDef(result);
         addUses(base->asTemp(), Use::CouldHaveRegister);
@@ -249,7 +249,7 @@ protected: // IRDecoder
         addCall();
     }
 
-    virtual void convertType(V4IR::Temp *source, V4IR::Temp *target)
+    virtual void convertType(IR::Temp *source, IR::Temp *target)
     {
         addDef(target);
 
@@ -320,14 +320,14 @@ protected: // IRDecoder
             addHint(target, source);
     }
 
-    virtual void constructActivationProperty(V4IR::Name *, V4IR::ExprList *args, V4IR::Temp *result)
+    virtual void constructActivationProperty(IR::Name *, IR::ExprList *args, IR::Temp *result)
     {
         addDef(result);
         addUses(args, Use::CouldHaveRegister);
         addCall();
     }
 
-    virtual void constructProperty(V4IR::Temp *base, const QString &, V4IR::ExprList *args, V4IR::Temp *result)
+    virtual void constructProperty(IR::Temp *base, const QString &, IR::ExprList *args, IR::Temp *result)
     {
         addDef(result);
         addUses(base, Use::CouldHaveRegister);
@@ -335,7 +335,7 @@ protected: // IRDecoder
         addCall();
     }
 
-    virtual void constructValue(V4IR::Temp *value, V4IR::ExprList *args, V4IR::Temp *result)
+    virtual void constructValue(IR::Temp *value, IR::ExprList *args, IR::Temp *result)
     {
         addDef(result);
         addUses(value, Use::CouldHaveRegister);
@@ -343,18 +343,18 @@ protected: // IRDecoder
         addCall();
     }
 
-    virtual void loadThisObject(V4IR::Temp *temp)
+    virtual void loadThisObject(IR::Temp *temp)
     {
         addDef(temp);
     }
 
-    virtual void loadQmlIdArray(V4IR::Temp *temp)
+    virtual void loadQmlIdArray(IR::Temp *temp)
     {
         addDef(temp);
         addCall();
     }
 
-    virtual void loadQmlImportedScripts(V4IR::Temp *temp)
+    virtual void loadQmlImportedScripts(IR::Temp *temp)
     {
         addDef(temp);
         addCall();
@@ -382,21 +382,21 @@ protected: // IRDecoder
         addCall();
     }
 
-    virtual void loadConst(V4IR::Const *sourceConst, V4IR::Temp *targetTemp)
+    virtual void loadConst(IR::Const *sourceConst, IR::Temp *targetTemp)
     {
         Q_UNUSED(sourceConst);
 
         addDef(targetTemp);
     }
 
-    virtual void loadString(const QString &str, V4IR::Temp *targetTemp)
+    virtual void loadString(const QString &str, IR::Temp *targetTemp)
     {
         Q_UNUSED(str);
 
         addDef(targetTemp);
     }
 
-    virtual void loadRegexp(V4IR::RegExp *sourceRegexp, V4IR::Temp *targetTemp)
+    virtual void loadRegexp(IR::RegExp *sourceRegexp, IR::Temp *targetTemp)
     {
         Q_UNUSED(sourceRegexp);
 
@@ -404,19 +404,19 @@ protected: // IRDecoder
         addCall();
     }
 
-    virtual void getActivationProperty(const V4IR::Name *, V4IR::Temp *temp)
+    virtual void getActivationProperty(const IR::Name *, IR::Temp *temp)
     {
         addDef(temp);
         addCall();
     }
 
-    virtual void setActivationProperty(V4IR::Expr *source, const QString &)
+    virtual void setActivationProperty(IR::Expr *source, const QString &)
     {
         addUses(source->asTemp(), Use::CouldHaveRegister);
         addCall();
     }
 
-    virtual void initClosure(V4IR::Closure *closure, V4IR::Temp *target)
+    virtual void initClosure(IR::Closure *closure, IR::Temp *target)
     {
         Q_UNUSED(closure);
 
@@ -424,35 +424,35 @@ protected: // IRDecoder
         addCall();
     }
 
-    virtual void getProperty(V4IR::Expr *base, const QString &, V4IR::Temp *target)
+    virtual void getProperty(IR::Expr *base, const QString &, IR::Temp *target)
     {
         addDef(target);
         addUses(base->asTemp(), Use::CouldHaveRegister);
         addCall();
     }
 
-    virtual void setProperty(V4IR::Expr *source, V4IR::Expr *targetBase, const QString &)
+    virtual void setProperty(IR::Expr *source, IR::Expr *targetBase, const QString &)
     {
         addUses(source->asTemp(), Use::CouldHaveRegister);
         addUses(targetBase->asTemp(), Use::CouldHaveRegister);
         addCall();
     }
 
-    virtual void setQObjectProperty(V4IR::Expr *source, V4IR::Expr *targetBase, int /*propertyIndex*/)
+    virtual void setQObjectProperty(IR::Expr *source, IR::Expr *targetBase, int /*propertyIndex*/)
     {
         addUses(source->asTemp(), Use::CouldHaveRegister);
         addUses(targetBase->asTemp(), Use::CouldHaveRegister);
         addCall();
     }
 
-    virtual void getQObjectProperty(V4IR::Expr *base, int /*propertyIndex*/, bool /*captureRequired*/, int /*attachedPropertiesId*/, V4IR::Temp *target)
+    virtual void getQObjectProperty(IR::Expr *base, int /*propertyIndex*/, bool /*captureRequired*/, int /*attachedPropertiesId*/, IR::Temp *target)
     {
         addDef(target);
         addUses(base->asTemp(), Use::CouldHaveRegister);
         addCall();
     }
 
-    virtual void getElement(V4IR::Expr *base, V4IR::Expr *index, V4IR::Temp *target)
+    virtual void getElement(IR::Expr *base, IR::Expr *index, IR::Temp *target)
     {
         addDef(target);
         addUses(base->asTemp(), Use::CouldHaveRegister);
@@ -460,7 +460,7 @@ protected: // IRDecoder
         addCall();
     }
 
-    virtual void setElement(V4IR::Expr *source, V4IR::Expr *targetBase, V4IR::Expr *targetIndex)
+    virtual void setElement(IR::Expr *source, IR::Expr *targetBase, IR::Expr *targetIndex)
     {
         addUses(source->asTemp(), Use::CouldHaveRegister);
         addUses(targetBase->asTemp(), Use::CouldHaveRegister);
@@ -468,14 +468,14 @@ protected: // IRDecoder
         addCall();
     }
 
-    virtual void copyValue(V4IR::Temp *sourceTemp, V4IR::Temp *targetTemp)
+    virtual void copyValue(IR::Temp *sourceTemp, IR::Temp *targetTemp)
     {
         addDef(targetTemp);
         addUses(sourceTemp, Use::CouldHaveRegister);
         addHint(targetTemp, sourceTemp);
     }
 
-    virtual void swapValues(V4IR::Temp *, V4IR::Temp *)
+    virtual void swapValues(IR::Temp *, IR::Temp *)
     {
         // Inserted by the register allocator, so it cannot occur here.
         Q_UNREACHABLE();
@@ -486,7 +486,7 @@ protected: // IRDecoder
         addDef(targetTemp);
 
         bool needsCall = true;
-        if (oper == OpNot && sourceTemp->type == V4IR::BoolType && targetTemp->type == V4IR::BoolType)
+        if (oper == OpNot && sourceTemp->type == IR::BoolType && targetTemp->type == IR::BoolType)
             needsCall = false;
 
 #if 0 // TODO: change masm to generate code
@@ -561,8 +561,8 @@ protected: // IRDecoder
         }
     }
 
-    virtual void visitJump(V4IR::Jump *) {}
-    virtual void visitCJump(V4IR::CJump *s)
+    virtual void visitJump(IR::Jump *) {}
+    virtual void visitCJump(IR::CJump *s)
     {
         if (Temp *t = s->cond->asTemp()) {
 #if 0 // TODO: change masm to generate code
@@ -582,10 +582,10 @@ protected: // IRDecoder
         }
     }
 
-    virtual void visitRet(V4IR::Ret *s)
+    virtual void visitRet(IR::Ret *s)
     { addUses(s->expr->asTemp(), Use::CouldHaveRegister); }
 
-    virtual void visitPhi(V4IR::Phi *s)
+    virtual void visitPhi(IR::Phi *s)
     {
         addDef(s->targetTemp, true);
         foreach (Expr *e, s->d->incoming) {
@@ -597,7 +597,7 @@ protected: // IRDecoder
     }
 
 protected:
-    virtual void callBuiltin(V4IR::Call *c, V4IR::Temp *result)
+    virtual void callBuiltin(IR::Call *c, IR::Temp *result)
     {
         addDef(result);
         addUses(c->base->asTemp(), Use::CouldHaveRegister);
@@ -656,26 +656,26 @@ private:
     }
 };
 
-} // MASM namespace
-} // MOTH namespace
+} // JIT namespace
+} // QV4 namespace
 QT_END_NAMESPACE
 
 QT_USE_NAMESPACE
 
-using namespace QT_PREPEND_NAMESPACE(QQmlJS::MASM);
-using namespace QT_PREPEND_NAMESPACE(QQmlJS::V4IR);
-using namespace QT_PREPEND_NAMESPACE(QQmlJS);
+using namespace QT_PREPEND_NAMESPACE(QV4::JIT);
+using namespace QT_PREPEND_NAMESPACE(QV4::IR);
+using namespace QT_PREPEND_NAMESPACE(QV4);
 
 namespace {
 class ResolutionPhase: protected StmtVisitor, protected ExprVisitor {
     const QVector<LifeTimeInterval> &_intervals;
     QVector<const LifeTimeInterval *> _unprocessed;
-    Function *_function;
+    IR::Function *_function;
 #if !defined(QT_NO_DEBUG)
     RegAllocInfo *_info;
 #endif
-    const QHash<V4IR::Temp, int> &_assignedSpillSlots;
-    QHash<V4IR::Temp, const LifeTimeInterval *> _intervalForTemp;
+    const QHash<IR::Temp, int> &_assignedSpillSlots;
+    QHash<IR::Temp, const LifeTimeInterval *> _intervalForTemp;
     const QVector<int> &_intRegs;
     const QVector<int> &_fpRegs;
 
@@ -687,8 +687,8 @@ class ResolutionPhase: protected StmtVisitor, protected ExprVisitor {
     QHash<BasicBlock *, QList<const LifeTimeInterval *> > _liveAtEnd;
 
 public:
-    ResolutionPhase(const QVector<LifeTimeInterval> &intervals, Function *function, RegAllocInfo *info,
-                    const QHash<V4IR::Temp, int> &assignedSpillSlots,
+    ResolutionPhase(const QVector<LifeTimeInterval> &intervals, IR::Function *function, RegAllocInfo *info,
+                    const QHash<IR::Temp, int> &assignedSpillSlots,
                     const QVector<int> &intRegs, const QVector<int> &fpRegs)
         : _intervals(intervals)
         , _function(function)
@@ -1041,8 +1041,8 @@ protected:
     }
 
     virtual void visitConst(Const *) {}
-    virtual void visitString(String *) {}
-    virtual void visitRegExp(RegExp *) {}
+    virtual void visitString(IR::String *) {}
+    virtual void visitRegExp(IR::RegExp *) {}
     virtual void visitName(Name *) {}
     virtual void visitClosure(Closure *) {}
     virtual void visitConvert(Convert *e) { e->expr->accept(this); }
@@ -1084,7 +1084,7 @@ RegisterAllocator::~RegisterAllocator()
 {
 }
 
-void RegisterAllocator::run(Function *function, const Optimizer &opt)
+void RegisterAllocator::run(IR::Function *function, const Optimizer &opt)
 {
     _activeSpillSlots.resize(function->tempCount);
 
@@ -1141,7 +1141,7 @@ static inline LifeTimeInterval createFixedInterval(int reg, bool isFP, int range
 {
     Temp t;
     t.init(Temp::PhysicalRegister, reg, 0);
-    t.type = isFP ? V4IR::DoubleType : V4IR::SInt32Type;
+    t.type = isFP ? IR::DoubleType : IR::SInt32Type;
     LifeTimeInterval i;
     i.setTemp(t);
     i.setReg(reg);
index c6dfa9f11aa94c679747218cfce972fcefaa8e3c..030fb4bf509f3ddfc85c9852ac9663aa998ccfda 100644 (file)
 
 QT_BEGIN_NAMESPACE
 
-namespace QQmlJS {
-namespace MASM {
+namespace QV4 {
+namespace JIT {
 
 class RegAllocInfo;
 
 class RegisterAllocator
 {
-    typedef V4IR::LifeTimeInterval LifeTimeInterval;
+    typedef IR::LifeTimeInterval LifeTimeInterval;
 
     QVector<int> _normalRegisters;
     QVector<int> _fpRegisters;
@@ -66,8 +66,8 @@ class RegisterAllocator
 
     QVector<LifeTimeInterval> _unhandled, _active, _inactive, _handled;
 
-    QHash<V4IR::Temp, int> _lastAssignedRegister;
-    QHash<V4IR::Temp, int> _assignedSpillSlots;
+    QHash<IR::Temp, int> _lastAssignedRegister;
+    QHash<IR::Temp, int> _assignedSpillSlots;
     QVector<int> _activeSpillSlots;
 
     Q_DISABLE_COPY(RegisterAllocator)
@@ -76,7 +76,7 @@ public:
     RegisterAllocator(const QVector<int> &normalRegisters, const QVector<int> &fpRegisters);
     ~RegisterAllocator();
 
-    void run(V4IR::Function *function, const V4IR::Optimizer &opt);
+    void run(IR::Function *function, const IR::Optimizer &opt);
 
 private:
     void prepareRanges();
@@ -87,17 +87,17 @@ private:
                              int lastUse) const;
     int nextIntersection(const LifeTimeInterval &current, const LifeTimeInterval &another,
                          const int position) const;
-    int nextUse(const V4IR::Temp &t, int startPosition) const;
+    int nextUse(const IR::Temp &t, int startPosition) const;
     void split(LifeTimeInterval &current, int beforePosition, bool skipOptionalRegisterUses =false);
     void splitInactiveAtEndOfLifetimeHole(int reg, bool isFPReg, int position);
-    void assignSpillSlot(const V4IR::Temp &t, int startPos, int endPos);
-    void resolve(V4IR::Function *function, const V4IR::Optimizer &opt);
+    void assignSpillSlot(const IR::Temp &t, int startPos, int endPos);
+    void resolve(IR::Function *function, const IR::Optimizer &opt);
 
     void dump() const;
 };
 
-} // end of namespace MASM
-} // end of namespace QQmlJS
+} // end of namespace JIT
+} // end of namespace QV4
 
 QT_END_NAMESPACE
 
index 02a6f63a00471302371e81edf75a07826cc52984..514002adf55dd1309439dd3f7cde3546723009e6 100644 (file)
 using namespace QV4;
 using namespace JIT;
 
-using namespace QQmlJS;
-using namespace MASM;
-
 #define stringIfyx(s) #s
 #define stringIfy(s) stringIfyx(s)
 #define setOp(operation) \
     do { call = operation; name = stringIfy(operation); } while (0)
 
-void Unop::generate(QQmlJS::V4IR::Temp *source, QQmlJS::V4IR::Temp *target)
+void Unop::generate(IR::Temp *source, IR::Temp *target)
 {
     UnaryOpName call = 0;
     const char *name = 0;
     switch (op) {
-    case V4IR::OpNot:
+    case IR::OpNot:
         generateNot(source, target);
         return;
-    case V4IR::OpUMinus:
+    case IR::OpUMinus:
         generateUMinus(source, target);
         return;
-    case V4IR::OpUPlus: setOp(__qmljs_uplus); break;
-    case V4IR::OpCompl:
+    case IR::OpUPlus: setOp(__qmljs_uplus); break;
+    case IR::OpCompl:
         generateCompl(source, target);
         return;
-    case V4IR::OpIncrement: setOp(__qmljs_increment); break;
-    case V4IR::OpDecrement: setOp(__qmljs_decrement); break;
+    case IR::OpIncrement: setOp(__qmljs_increment); break;
+    case IR::OpDecrement: setOp(__qmljs_decrement); break;
     default:
         Q_UNREACHABLE();
     } // switch
@@ -80,16 +77,16 @@ void Unop::generate(QQmlJS::V4IR::Temp *source, QQmlJS::V4IR::Temp *target)
     }
 }
 
-void Unop::generateUMinus(V4IR::Temp *source, V4IR::Temp *target)
+void Unop::generateUMinus(IR::Temp *source, IR::Temp *target)
 {
-    if (source->type == V4IR::SInt32Type) {
+    if (source->type == IR::SInt32Type) {
         Assembler::RegisterID tReg = Assembler::ScratchRegister;
-        if (target->kind == V4IR::Temp::PhysicalRegister)
+        if (target->kind == IR::Temp::PhysicalRegister)
             tReg = (Assembler::RegisterID) target->index;
         Assembler::RegisterID sReg = as->toInt32Register(source, tReg);
         as->move(sReg, tReg);
         as->neg32(tReg);
-        if (target->kind != V4IR::Temp::PhysicalRegister)
+        if (target->kind != IR::Temp::PhysicalRegister)
             as->storeInt32(tReg, target);
         return;
     }
@@ -97,27 +94,27 @@ void Unop::generateUMinus(V4IR::Temp *source, V4IR::Temp *target)
     as->generateFunctionCallImp(target, "__qmljs_uminus", __qmljs_uminus, Assembler::PointerToValue(source));
 }
 
-void Unop::generateNot(V4IR::Temp *source, V4IR::Temp *target)
+void Unop::generateNot(IR::Temp *source, IR::Temp *target)
 {
-    if (source->type == V4IR::BoolType) {
+    if (source->type == IR::BoolType) {
         Assembler::RegisterID tReg = Assembler::ScratchRegister;
-        if (target->kind == V4IR::Temp::PhysicalRegister)
+        if (target->kind == IR::Temp::PhysicalRegister)
             tReg = (Assembler::RegisterID) target->index;
         as->xor32(Assembler::TrustedImm32(0x1), as->toInt32Register(source, tReg), tReg);
-        if (target->kind != V4IR::Temp::PhysicalRegister)
+        if (target->kind != IR::Temp::PhysicalRegister)
             as->storeBool(tReg, target);
         return;
-    } else if (source->type == V4IR::SInt32Type) {
+    } else if (source->type == IR::SInt32Type) {
         Assembler::RegisterID tReg = Assembler::ScratchRegister;
-        if (target->kind == V4IR::Temp::PhysicalRegister)
+        if (target->kind == IR::Temp::PhysicalRegister)
             tReg = (Assembler::RegisterID) target->index;
         as->compare32(Assembler::Equal,
                       as->toInt32Register(source, Assembler::ScratchRegister), Assembler::TrustedImm32(0),
                       tReg);
-        if (target->kind != V4IR::Temp::PhysicalRegister)
+        if (target->kind != IR::Temp::PhysicalRegister)
             as->storeBool(tReg, target);
         return;
-    } else if (source->type == V4IR::DoubleType) {
+    } else if (source->type == IR::DoubleType) {
         // ###
     }
     // ## generic implementation testing for int/bool
@@ -125,14 +122,14 @@ void Unop::generateNot(V4IR::Temp *source, V4IR::Temp *target)
     as->generateFunctionCallImp(target, "__qmljs_not", __qmljs_not, Assembler::PointerToValue(source));
 }
 
-void Unop::generateCompl(V4IR::Temp *source, V4IR::Temp *target)
+void Unop::generateCompl(IR::Temp *source, IR::Temp *target)
 {
-    if (source->type == V4IR::SInt32Type) {
+    if (source->type == IR::SInt32Type) {
         Assembler::RegisterID tReg = Assembler::ScratchRegister;
-        if (target->kind == V4IR::Temp::PhysicalRegister)
+        if (target->kind == IR::Temp::PhysicalRegister)
             tReg = (Assembler::RegisterID) target->index;
         as->xor32(Assembler::TrustedImm32(0xffffffff), as->toInt32Register(source, tReg), tReg);
-        if (target->kind != V4IR::Temp::PhysicalRegister)
+        if (target->kind != IR::Temp::PhysicalRegister)
             as->storeInt32(tReg, target);
         return;
     }
index 0ce81c582867f73eeca315f9b27652e55069f5ff..a8c62182ad2b77f47f8fbb58e438d70dd1c311c4 100644 (file)
@@ -48,29 +48,25 @@ QT_BEGIN_NAMESPACE
 
 #if ENABLE(ASSEMBLER)
 
-namespace QQmlJS {
-namespace MASM {
-class Assembler;
-}
-}
-
 namespace QV4 {
 namespace JIT {
 
+class Assembler;
+
 struct Unop {
-    Unop(QQmlJS::MASM::Assembler *assembler, QQmlJS::V4IR::AluOp operation)
+    Unop(Assembler *assembler, IR::AluOp operation)
         : as(assembler)
         , op(operation)
     {}
 
-    void generate(QQmlJS::V4IR::Temp *source, QQmlJS::V4IR::Temp *target);
+    void generate(IR::Temp *source, IR::Temp *target);
 
-    void generateUMinus(QQmlJS::V4IR::Temp *source, QQmlJS::V4IR::Temp *target);
-    void generateNot(QQmlJS::V4IR::Temp *source, QQmlJS::V4IR::Temp *target);
-    void generateCompl(QQmlJS::V4IR::Temp *source, QQmlJS::V4IR::Temp *target);
+    void generateUMinus(IR::Temp *source, IR::Temp *target);
+    void generateNot(IR::Temp *source, IR::Temp *target);
+    void generateCompl(IR::Temp *source, IR::Temp *target);
 
-    QQmlJS::MASM::Assembler *as;
-    QQmlJS::V4IR::AluOp op;
+    Assembler *as;
+    IR::AluOp op;
 };
 
 }
index 9ab1622fee9b6fc54118acdfa620164b959e8458..dade6272067a70419d9b5c1cd89500f322b624cc 100644 (file)
@@ -648,14 +648,14 @@ void Debugger::applyPendingBreakPoints()
 void Debugger::setBreakOnInstruction(Function *function, qptrdiff codeOffset, bool onoff)
 {
     uchar *codePtr = const_cast<uchar *>(function->codeData) + codeOffset;
-    QQmlJS::Moth::Instr::instr_debug *debug = reinterpret_cast<QQmlJS::Moth::Instr::instr_debug *>(codePtr);
+    Moth::Instr::instr_debug *debug = reinterpret_cast<Moth::Instr::instr_debug *>(codePtr);
     debug->breakPoint = onoff;
 }
 
 bool Debugger::hasBreakOnInstruction(Function *function, qptrdiff codeOffset)
 {
     uchar *codePtr = const_cast<uchar *>(function->codeData) + codeOffset;
-    QQmlJS::Moth::Instr::instr_debug *debug = reinterpret_cast<QQmlJS::Moth::Instr::instr_debug *>(codePtr);
+    Moth::Instr::instr_debug *debug = reinterpret_cast<Moth::Instr::instr_debug *>(codePtr);
     return debug->breakPoint;
 }
 
index 3cf705c584bd3e0b54567641f3d5a4072ff8778f..885186e86b0eaa4cf02de2bf0187cc8b2a0f5166 100644 (file)
@@ -159,7 +159,7 @@ quintptr getStackLimit()
 }
 
 
-ExecutionEngine::ExecutionEngine(QQmlJS::EvalISelFactory *factory)
+ExecutionEngine::ExecutionEngine(EvalISelFactory *factory)
     : current(0)
     , memoryManager(new QV4::MemoryManager)
     , executableAllocator(new QV4::ExecutableAllocator)
@@ -186,11 +186,11 @@ ExecutionEngine::ExecutionEngine(QQmlJS::EvalISelFactory *factory)
 #ifdef V4_ENABLE_JIT
         static const bool forceMoth = !qgetenv("QV4_FORCE_INTERPRETER").isEmpty();
         if (forceMoth)
-            factory = new QQmlJS::Moth::ISelFactory;
+            factory = new Moth::ISelFactory;
         else
-            factory = new QQmlJS::MASM::ISelFactory;
+            factory = new JIT::ISelFactory;
 #else // !V4_ENABLE_JIT
-        factory = new QQmlJS::Moth::ISelFactory;
+        factory = new Moth::ISelFactory;
 #endif // V4_ENABLE_JIT
     }
     iselFactory.reset(factory);
@@ -428,7 +428,7 @@ void ExecutionEngine::enableDebugger()
 {
     Q_ASSERT(!debugger);
     debugger = new Debugging::Debugger(this);
-    iselFactory.reset(new QQmlJS::Moth::ISelFactory);
+    iselFactory.reset(new Moth::ISelFactory);
 }
 
 void ExecutionEngine::enableProfiler()
@@ -558,12 +558,12 @@ Returned<DateObject> *ExecutionEngine::newDateObject(const QDateTime &dt)
 
 Returned<RegExpObject> *ExecutionEngine::newRegExpObject(const QString &pattern, int flags)
 {
-    bool global = (flags & QQmlJS::V4IR::RegExp::RegExp_Global);
+    bool global = (flags & IR::RegExp::RegExp_Global);
     bool ignoreCase = false;
     bool multiline = false;
-    if (flags & QQmlJS::V4IR::RegExp::RegExp_IgnoreCase)
+    if (flags & IR::RegExp::RegExp_IgnoreCase)
         ignoreCase = true;
-    if (flags & QQmlJS::V4IR::RegExp::RegExp_Multiline)
+    if (flags & IR::RegExp::RegExp_Multiline)
         multiline = true;
 
     Scope scope(this);
index 7598bfb65a4f5cb28cb2f68e02c3981e0636589b..d8ac750e75413973be07026d6178bc05db706645 100644 (file)
@@ -138,7 +138,7 @@ public:
     MemoryManager *memoryManager;
     ExecutableAllocator *executableAllocator;
     ExecutableAllocator *regExpAllocator;
-    QScopedPointer<QQmlJS::EvalISelFactory> iselFactory;
+    QScopedPointer<EvalISelFactory> iselFactory;
 
 
     Value *jsStackLimit;
@@ -291,7 +291,7 @@ public:
     // bookkeeping.
     MultiplyWrappedQObjectMap *m_multiplyWrappedQObjects;
 
-    ExecutionEngine(QQmlJS::EvalISelFactory *iselFactory = 0);
+    ExecutionEngine(EvalISelFactory *iselFactory = 0);
     ~ExecutionEngine();
 
     void enableDebugger();
index fb87822a5a81ef61f2cd5fe944eeef88b677610b..07ec94a58d1bc93ec1fc9682a19d8334c72e5047 100644 (file)
@@ -274,13 +274,13 @@ ReturnedValue FunctionCtor::construct(Managed *that, CallData *callData)
     if (!fe)
         return v4->currentContext()->throwSyntaxError(QLatin1String("Parse error"));
 
-    QQmlJS::V4IR::Module module(v4->debugger != 0);
+    IR::Module module(v4->debugger != 0);
 
     QQmlJS::RuntimeCodegen cg(v4->currentContext(), f->strictMode);
     cg.generateFromFunctionExpression(QString(), function, fe, &module);
 
     QV4::Compiler::JSUnitGenerator jsGenerator(&module);
-    QScopedPointer<QQmlJS::EvalInstructionSelection> isel(v4->iselFactory->create(QQmlEnginePrivate::get(v4), v4->executableAllocator, &module, &jsGenerator));
+    QScopedPointer<EvalInstructionSelection> isel(v4->iselFactory->create(QQmlEnginePrivate::get(v4), v4->executableAllocator, &module, &jsGenerator));
     QV4::CompiledData::CompilationUnit *compilationUnit = isel->compile();
     QV4::Function *vmf = compilationUnit->linkToEngine(v4);
 
index 7d9419530434e708ad57fc7214625c1811efaf3d..cb5424b0ee65fe6c8013946803fe8d5e823c4569 100644 (file)
@@ -191,7 +191,7 @@ void Script::parse()
 
     MemoryManager::GCBlocker gcBlocker(v4->memoryManager);
 
-    V4IR::Module module(v4->debugger != 0);
+    IR::Module module(v4->debugger != 0);
 
     QQmlJS::Engine ee, *engine = &ee;
     Lexer lexer(engine);
@@ -308,7 +308,7 @@ CompiledData::CompilationUnit *Script::precompile(ExecutionEngine *engine, const
     using namespace QQmlJS;
     using namespace QQmlJS::AST;
 
-    QQmlJS::V4IR::Module module(engine->debugger != 0);
+    IR::Module module(engine->debugger != 0);
 
     QQmlJS::Engine ee;
     QQmlJS::Lexer lexer(&ee);
@@ -356,7 +356,7 @@ CompiledData::CompilationUnit *Script::precompile(ExecutionEngine *engine, const
     }
 
     Compiler::JSUnitGenerator jsGenerator(&module);
-    QScopedPointer<QQmlJS::EvalInstructionSelection> isel(engine->iselFactory->create(QQmlEnginePrivate::get(engine), engine->executableAllocator, &module, &jsGenerator));
+    QScopedPointer<EvalInstructionSelection> isel(engine->iselFactory->create(QQmlEnginePrivate::get(engine), engine->executableAllocator, &module, &jsGenerator));
     isel->setUseFastLookups(false);
     return isel->compile();
 }
index df8e3632fbd4f5155ea5975db3678c4d95cc1403..3c44063606a8e1c463ac3833f889f2c54703da9e 100644 (file)
@@ -58,8 +58,8 @@
 #  define TRACE(n, str, ...)
 #endif // DO_TRACE_INSTR
 
-using namespace QQmlJS;
-using namespace QQmlJS::Moth;
+using namespace QV4;
+using namespace QV4::Moth;
 
 #define MOTH_BEGIN_INSTR_COMMON(I) { \
     const InstrMeta<(int)Instr::I>::DataType &instr = InstrMeta<(int)Instr::I>::data(*genericInstr); \
index 8d0822f16f6bfcb54a1ab7a3e4b897284b7cb3e6..711163cde01f1c54ef728a02f7a7d1f183f5e63a 100644 (file)
@@ -47,7 +47,7 @@
 
 QT_BEGIN_NAMESPACE
 
-namespace QQmlJS {
+namespace QV4 {
 namespace Moth {
 
 class VME
@@ -68,7 +68,7 @@ private:
 };
 
 } // namespace Moth
-} // namespace QQmlJS
+} // namespace QV4
 
 QT_END_NAMESPACE
 
index c71c7432a8ae5178c0367f15ce5a1a2f1365c09e..b26b5530a324846c58bb4a4c6be5c61dd86f5a51 100644 (file)
@@ -807,7 +807,7 @@ bool QQmlCompiler::compile(QQmlEngine *engine,
     this->unit = unit;
     this->unitRoot = root;
     this->output = out;
-    this->jsModule.reset(new QQmlJS::V4IR::Module(enginePrivate->v4engine()->debugger));
+    this->jsModule.reset(new IR::Module(enginePrivate->v4engine()->debugger));
     this->jsModule->isQmlModule = true;
 
     // Compile types
@@ -933,7 +933,7 @@ void QQmlCompiler::compileTree(QQmlScript::Object *tree)
     if (!jsModule->functions.isEmpty()) {
         QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine);
         QV4::Compiler::JSUnitGenerator jsUnitGenerator(jsModule.data());
-        QScopedPointer<QQmlJS::EvalInstructionSelection> isel(v4->iselFactory->create(enginePrivate, v4->executableAllocator, jsModule.data(), &jsUnitGenerator));
+        QScopedPointer<EvalInstructionSelection> isel(v4->iselFactory->create(enginePrivate, v4->executableAllocator, jsModule.data(), &jsUnitGenerator));
         isel->setUseFastLookups(false);
         QV4::CompiledData::CompilationUnit *jsUnit = isel->compile(/*generated unit data*/true);
         output->compilationUnit = jsUnit;
@@ -1051,7 +1051,7 @@ bool QQmlCompiler::buildObject(QQmlScript::Object *obj, const BindingContext &ct
     // Must do id property first.  This is to ensure that the id given to any
     // id reference created matches the order in which the objects are
     // instantiated
-    for (Property *prop = obj->properties.first(); prop; prop = obj->properties.next(prop)) {
+    for (QQmlScript::Property *prop = obj->properties.first(); prop; prop = obj->properties.next(prop)) {
         if (prop->name() == id_string) {
             COMPILE_CHECK(buildProperty(prop, obj, objCtxt));
             break;
@@ -1059,12 +1059,12 @@ bool QQmlCompiler::buildObject(QQmlScript::Object *obj, const BindingContext &ct
     }
 
     // Merge
-    Property *defaultProperty = 0;
-    Property *skipProperty = 0;
+    QQmlScript::Property *defaultProperty = 0;
+    QQmlScript::Property *skipProperty = 0;
     if (obj->defaultProperty) {
         defaultProperty = obj->defaultProperty;
 
-        Property *explicitProperty = 0;
+        QQmlScript::Property *explicitProperty = 0;
 
         QString defaultPropertyName = obj->metatype->defaultPropertyName();
         if (!defaultPropertyName.isEmpty()) {
@@ -1072,7 +1072,7 @@ bool QQmlCompiler::buildObject(QQmlScript::Object *obj, const BindingContext &ct
             QHashedStringRef r(*s);
 
             if (obj->propertiesHashField.test(r.hash())) {
-                for (Property *ep = obj->properties.first(); ep; ep = obj->properties.next(ep)) {
+                for (QQmlScript::Property *ep = obj->properties.first(); ep; ep = obj->properties.next(ep)) {
                     if (ep->name() == r) {
                         explicitProperty = ep;
                         break;
@@ -1089,9 +1089,9 @@ bool QQmlCompiler::buildObject(QQmlScript::Object *obj, const BindingContext &ct
             skipProperty = explicitProperty; // We merge the values into defaultProperty
 
             // Find the correct insertion point
-            Value *insertPos = 0;
+            QQmlScript::Value *insertPos = 0;
 
-            for (Value *v = defaultProperty->values.first(); v; v = Property::ValueList::next(v)) {
+            for (QQmlScript::Value *v = defaultProperty->values.first(); v; v = QQmlScript::Property::ValueList::next(v)) {
                 if (!(v->location.start < explicitProperty->values.first()->location.start))
                     break;
                 insertPos = v;
@@ -1106,7 +1106,7 @@ bool QQmlCompiler::buildObject(QQmlScript::Object *obj, const BindingContext &ct
         cp = output->types.at(obj->type).type->customParser();
 
     // Build all explicit properties specified
-    for (Property *prop = obj->properties.first(); prop; prop = obj->properties.next(prop)) {
+    for (QQmlScript::Property *prop = obj->properties.first(); prop; prop = obj->properties.next(prop)) {
 
         if (prop == skipProperty)
             continue;
@@ -1144,7 +1144,7 @@ bool QQmlCompiler::buildObject(QQmlScript::Object *obj, const BindingContext &ct
 
     // Build the default property
     if (defaultProperty)  {
-        Property *prop = defaultProperty;
+        QQmlScript::Property *prop = defaultProperty;
 
         bool canDefer = false;
         if (isCustomParser) {
@@ -1282,7 +1282,7 @@ void QQmlCompiler::genObject(QQmlScript::Object *obj, bool parentToSuper)
 
 void QQmlCompiler::genObjectBody(QQmlScript::Object *obj)
 {
-    for (Property *prop = obj->scriptStringProperties.first(); prop; prop = Object::PropertyList::next(prop)) {
+    for (QQmlScript::Property *prop = obj->scriptStringProperties.first(); prop; prop = QQmlScript::Object::PropertyList::next(prop)) {
         Q_ASSERT(prop->scriptStringScope != -1);
         const QString &script = prop->values.first()->value.asScript();
         Instruction::StoreScriptString ss;
@@ -1299,7 +1299,7 @@ void QQmlCompiler::genObjectBody(QQmlScript::Object *obj)
     }
 
     bool seenDefer = false;
-    for (Property *prop = obj->valueProperties.first(); prop; prop = Object::PropertyList::next(prop)) {
+    for (QQmlScript::Property *prop = obj->valueProperties.first(); prop; prop = QQmlScript::Object::PropertyList::next(prop)) {
         if (prop->isDeferred) {
             seenDefer = true;
             continue;
@@ -1321,7 +1321,7 @@ void QQmlCompiler::genObjectBody(QQmlScript::Object *obj)
         dinit.listStackSize = compileState->listDepth.maxDepth();
         output->addInstruction(dinit);
 
-        for (Property *prop = obj->valueProperties.first(); prop; prop = Object::PropertyList::next(prop)) {
+        for (QQmlScript::Property *prop = obj->valueProperties.first(); prop; prop = QQmlScript::Object::PropertyList::next(prop)) {
             if (!prop->isDeferred)
                 continue;
             genValueProperty(prop, obj);
@@ -1333,11 +1333,11 @@ void QQmlCompiler::genObjectBody(QQmlScript::Object *obj)
         output->instruction(deferIdx)->defer.deferCount = output->nextInstructionIndex() - nextInstructionIndex;
     }
 
-    for (Property *prop = obj->signalProperties.first(); prop; prop = Object::PropertyList::next(prop)) {
+    for (QQmlScript::Property *prop = obj->signalProperties.first(); prop; prop = QQmlScript::Object::PropertyList::next(prop)) {
 
         QQmlScript::Value *v = prop->values.first();
 
-        if (v->type == Value::SignalObject) {
+        if (v->type == QQmlScript::Value::SignalObject) {
 
             genObject(v->object);
 
@@ -1346,7 +1346,7 @@ void QQmlCompiler::genObjectBody(QQmlScript::Object *obj)
             assign.signal = output->indexForString(prop->name().toString());
             output->addInstruction(assign);
 
-        } else if (v->type == Value::SignalExpression) {
+        } else if (v->type == QQmlScript::Value::SignalExpression) {
 
             Instruction::StoreSignal store;
             store.runtimeFunctionIndex = compileState->jsCompileData[v->signalData.signalScopeObject].runtimeFunctionIndices.at(v->signalData.functionIndex);
@@ -1363,7 +1363,7 @@ void QQmlCompiler::genObjectBody(QQmlScript::Object *obj)
 
     }
 
-    for (Property *prop = obj->attachedProperties.first(); prop; prop = Object::PropertyList::next(prop)) {
+    for (QQmlScript::Property *prop = obj->attachedProperties.first(); prop; prop = QQmlScript::Object::PropertyList::next(prop)) {
         Instruction::FetchAttached fetch;
         fetch.id = prop->index;
         fetch.line = prop->location.start.line;
@@ -1375,7 +1375,7 @@ void QQmlCompiler::genObjectBody(QQmlScript::Object *obj)
         output->addInstruction(pop);
     }
 
-    for (Property *prop = obj->groupedProperties.first(); prop; prop = Object::PropertyList::next(prop)) {
+    for (QQmlScript::Property *prop = obj->groupedProperties.first(); prop; prop = QQmlScript::Object::PropertyList::next(prop)) {
         Instruction::FetchObject fetch;
         fetch.property = prop->index;
         fetch.line = prop->location.start.line;
@@ -1399,25 +1399,25 @@ void QQmlCompiler::genObjectBody(QQmlScript::Object *obj)
         output->addInstruction(pop);
     }
 
-    for (Property *prop = obj->valueTypeProperties.first(); prop; prop = Object::PropertyList::next(prop)) {
+    for (QQmlScript::Property *prop = obj->valueTypeProperties.first(); prop; prop = QQmlScript::Object::PropertyList::next(prop)) {
         if (!prop->isAlias)
             genValueTypeProperty(obj, prop);
     }
 
-    for (Property *prop = obj->valueProperties.first(); prop; prop = Object::PropertyList::next(prop)) {
+    for (QQmlScript::Property *prop = obj->valueProperties.first(); prop; prop = QQmlScript::Object::PropertyList::next(prop)) {
         if (prop->isDeferred)
             continue;
         if (prop->isAlias)
             genValueProperty(prop, obj);
     }
 
-    for (Property *prop = obj->valueTypeProperties.first(); prop; prop = Object::PropertyList::next(prop)) {
+    for (QQmlScript::Property *prop = obj->valueTypeProperties.first(); prop; prop = QQmlScript::Object::PropertyList::next(prop)) {
         if (prop->isAlias)
             genValueTypeProperty(obj, prop);
     }
 }
 
-void QQmlCompiler::genValueTypeProperty(QQmlScript::Object *obj,QQmlScript::Property *prop)
+void QQmlCompiler::genValueTypeProperty(QQmlScript::Object *obj, QQmlScript::Property *prop)
 {
     Instruction::FetchValueType fetch;
     fetch.property = prop->index;
@@ -1427,7 +1427,7 @@ void QQmlCompiler::genValueTypeProperty(QQmlScript::Object *obj,QQmlScript::Prop
     if (obj->type == -1 || output->types.at(obj->type).component) {
         // We only have to do this if this is a composite type.  If it is a builtin
         // type it can't possibly already have bindings that need to be cleared.
-        for (Property *vprop = prop->value->valueProperties.first(); vprop; vprop = Object::PropertyList::next(vprop)) {
+        for (QQmlScript::Property *vprop = prop->value->valueProperties.first(); vprop; vprop = QQmlScript::Object::PropertyList::next(vprop)) {
             if (!vprop->values.isEmpty()) {
                 Q_ASSERT(vprop->index >= 0 && vprop->index < 32);
                 fetch.bindingSkipList |= (1 << vprop->index);
@@ -1437,7 +1437,7 @@ void QQmlCompiler::genValueTypeProperty(QQmlScript::Object *obj,QQmlScript::Prop
 
     output->addInstruction(fetch);
 
-    for (Property *vprop = prop->value->valueProperties.first(); vprop; vprop = Object::PropertyList::next(vprop)) {
+    for (QQmlScript::Property *vprop = prop->value->valueProperties.first(); vprop; vprop = QQmlScript::Object::PropertyList::next(vprop)) {
         genPropertyAssignment(vprop, prop->value, prop);
     }
 
@@ -1513,7 +1513,7 @@ bool QQmlCompiler::buildComponent(QQmlScript::Object *obj,
     compileState->objectDepth.push();
 
     // Find, check and set the "id" property (if any)
-    Property *idProp = 0;
+    QQmlScript::Property *idProp = 0;
     if (obj->properties.isMany() ||
        (obj->properties.isOne() && obj->properties.first()->name() != id_string))
         COMPILE_EXCEPTION(obj->properties.first(), tr("Component elements may not contain properties other than id"));
@@ -1606,7 +1606,7 @@ bool QQmlCompiler::buildSubObject(QQmlScript::Object *obj, const BindingContext
     Q_ASSERT(ctxt.isSubContext()); // sub-objects must always be in a binding
                                    // sub-context
 
-    for (Property *prop = obj->properties.first(); prop; prop = obj->properties.next(prop)) {
+    for (QQmlScript::Property *prop = obj->properties.first(); prop; prop = obj->properties.next(prop)) {
         if (isSignalPropertyName(prop->name())) {
             COMPILE_CHECK(buildSignal(prop, obj, ctxt));
         } else {
@@ -1738,9 +1738,9 @@ bool QQmlCompiler::buildSignal(QQmlScript::Property *prop, QQmlScript::Object *o
 
         if (prop->values.first()->object) {
             COMPILE_CHECK(buildObject(prop->values.first()->object, ctxt));
-            prop->values.first()->type = Value::SignalObject;
+            prop->values.first()->type = QQmlScript::Value::SignalObject;
         } else {
-            prop->values.first()->type = Value::SignalExpression;
+            prop->values.first()->type = QQmlScript::Value::SignalExpression;
 
             if (!prop->values.first()->value.isScript())
                 COMPILE_EXCEPTION(prop, tr("Cannot assign a value to a signal (expecting a script to be run)"));
@@ -1923,7 +1923,7 @@ bool QQmlCompiler::buildPropertyInNamespace(QQmlImportNamespace *ns,
     if (!nsProp->value)
         COMPILE_EXCEPTION(nsProp, tr("Invalid use of namespace"));
 
-    for (Property *prop = nsProp->value->properties.first(); prop; prop = nsProp->value->properties.next(prop)) {
+    for (QQmlScript::Property *prop = nsProp->value->properties.first(); prop; prop = nsProp->value->properties.next(prop)) {
 
         if (!isAttachedPropertyName(prop->name()))
             COMPILE_EXCEPTION(prop, tr("Expected type name"));
@@ -1970,9 +1970,9 @@ void QQmlCompiler::genListProperty(QQmlScript::Property *prop,
     fetch.type = listType;
     output->addInstruction(fetch);
 
-    for (Value *v = prop->values.first(); v; v = Property::ValueList::next(v)) {
+    for (QQmlScript::Value *v = prop->values.first(); v; v = QQmlScript::Property::ValueList::next(v)) {
 
-        if (v->type == Value::CreatedObject) {
+        if (v->type == QQmlScript::Value::CreatedObject) {
 
             genObject(v->object);
             if (listTypeIsInterface) {
@@ -1984,7 +1984,7 @@ void QQmlCompiler::genListProperty(QQmlScript::Property *prop,
                 output->addInstruction(store);
             }
 
-        } else if (v->type == Value::PropertyBinding) {
+        } else if (v->type == QQmlScript::Value::PropertyBinding) {
 
             genBindingAssignment(v, prop, obj);
 
@@ -2000,13 +2000,13 @@ void QQmlCompiler::genPropertyAssignment(QQmlScript::Property *prop,
                                         QQmlScript::Object *obj,
                                         QQmlScript::Property *valueTypeProperty)
 {
-    for (Value *v = prop->values.first(); v; v = Property::ValueList::next(v)) {
+    for (QQmlScript::Value *v = prop->values.first(); v; v = QQmlScript::Property::ValueList::next(v)) {
 
-        Q_ASSERT(v->type == Value::CreatedObject ||
-                 v->type == Value::PropertyBinding ||
-                 v->type == Value::Literal);
+        Q_ASSERT(v->type == QQmlScript::Value::CreatedObject ||
+                 v->type == QQmlScript::Value::PropertyBinding ||
+                 v->type == QQmlScript::Value::Literal);
 
-        if (v->type == Value::CreatedObject) {
+        if (v->type == QQmlScript::Value::CreatedObject) {
 
             genObject(v->object);
 
@@ -2040,11 +2040,11 @@ void QQmlCompiler::genPropertyAssignment(QQmlScript::Property *prop,
                 output->addInstruction(store);
 
             }
-        } else if (v->type == Value::PropertyBinding) {
+        } else if (v->type == QQmlScript::Value::PropertyBinding) {
 
             genBindingAssignment(v, prop, obj, valueTypeProperty);
 
-        } else if (v->type == Value::Literal) {
+        } else if (v->type == QQmlScript::Value::Literal) {
 
             genLiteralAssignment(prop, v);
 
@@ -2052,12 +2052,12 @@ void QQmlCompiler::genPropertyAssignment(QQmlScript::Property *prop,
 
     }
 
-    for (Value *v = prop->onValues.first(); v; v = Property::ValueList::next(v)) {
+    for (QQmlScript::Value *v = prop->onValues.first(); v; v = QQmlScript::Property::ValueList::next(v)) {
 
-        Q_ASSERT(v->type == Value::ValueSource ||
-                 v->type == Value::ValueInterceptor);
+        Q_ASSERT(v->type == QQmlScript::Value::ValueSource ||
+                 v->type == QQmlScript::Value::ValueInterceptor);
 
-        if (v->type == Value::ValueSource) {
+        if (v->type == QQmlScript::Value::ValueSource) {
             genObject(v->object, valueTypeProperty?true:false);
 
             Instruction::StoreValueSource store;
@@ -2069,7 +2069,7 @@ void QQmlCompiler::genPropertyAssignment(QQmlScript::Property *prop,
             store.castValue = valueType->propertyValueSourceCast();
             output->addInstruction(store);
 
-        } else if (v->type == Value::ValueInterceptor) {
+        } else if (v->type == QQmlScript::Value::ValueInterceptor) {
             genObject(v->object, valueTypeProperty?true:false);
 
             Instruction::StoreValueInterceptor store;
@@ -2101,7 +2101,7 @@ bool QQmlCompiler::buildIdProperty(QQmlScript::Property *prop,
     if (compileState->ids.value(val))
         COMPILE_EXCEPTION(prop, tr("id is not unique"));
 
-    prop->values.first()->type = Value::Id;
+    prop->values.first()->type = QQmlScript::Value::Id;
 
     obj->id = val;
     addId(val, obj);
@@ -2186,7 +2186,7 @@ bool QQmlCompiler::buildGroupedProperty(QQmlScript::Property *prop,
         if (prop->type >= 0 && valueType) {
             if (!prop->values.isEmpty()) {
                 // Only error if we are assigning values, and not e.g. a property interceptor
-                for (Property *dotProp = prop->value->properties.first(); dotProp; dotProp = prop->value->properties.next(dotProp)) {
+                for (QQmlScript::Property *dotProp = prop->value->properties.first(); dotProp; dotProp = prop->value->properties.next(dotProp)) {
                     if (!dotProp->values.isEmpty()) {
                         if (prop->values.first()->location < prop->value->location) {
                             COMPILE_EXCEPTION(prop->value, tr( "Property has already been assigned a value"));
@@ -2202,7 +2202,7 @@ bool QQmlCompiler::buildGroupedProperty(QQmlScript::Property *prop,
             }
 
             if (prop->isAlias) {
-                for (Property *vtProp = prop->value->properties.first(); vtProp; vtProp = prop->value->properties.next(vtProp)) {
+                for (QQmlScript::Property *vtProp = prop->value->properties.first(); vtProp; vtProp = prop->value->properties.next(vtProp)) {
                     vtProp->isAlias = true;
                 }
             }
@@ -2214,14 +2214,14 @@ bool QQmlCompiler::buildGroupedProperty(QQmlScript::Property *prop,
             // assignment to the value type as a whole. Therefore we need to look
             // for (and build) assignments to the entire value type before looking
             // for any onValue assignments.
-            for (Value *v = prop->values.first(); v; v = Property::ValueList::next(v)) {
+            for (QQmlScript::Value *v = prop->values.first(); v; v = QQmlScript::Property::ValueList::next(v)) {
                 if (v->object) {
                     COMPILE_EXCEPTION(v->object, tr("Objects cannot be assigned to value types"));
                 }
                 COMPILE_CHECK(buildPropertyLiteralAssignment(prop, obj, v, ctxt));
             }
 
-            for (Value *v = prop->onValues.first(); v; v = Property::ValueList::next(v)) {
+            for (QQmlScript::Value *v = prop->onValues.first(); v; v = QQmlScript::Property::ValueList::next(v)) {
                 Q_ASSERT(v->object);
                 COMPILE_CHECK(buildPropertyOnAssignment(prop, obj, obj, v, ctxt));
             }
@@ -2262,7 +2262,7 @@ bool QQmlCompiler::buildValueTypeProperty(QObject *type,
         COMPILE_EXCEPTION(obj, tr("Invalid property use"));
     obj->metatype = enginePrivate->cache(type);
 
-    for (Property *prop = obj->properties.first(); prop; prop = obj->properties.next(prop)) {
+    for (QQmlScript::Property *prop = obj->properties.first(); prop; prop = obj->properties.next(prop)) {
 
         QQmlPropertyData *d = property(obj, prop->name());
         if (d == 0)
@@ -2293,7 +2293,7 @@ bool QQmlCompiler::buildValueTypeProperty(QObject *type,
                     COMPILE_CHECK(testQualifiedEnumAssignment(prop, obj, value, &isEnumAssignment));
 
                 if (isEnumAssignment) {
-                    value->type = Value::Literal;
+                    value->type = QQmlScript::Value::Literal;
                 } else {
                     JSBindingReference *reference = pool->New<JSBindingReference>();
                     reference->expression = value->value;
@@ -2302,15 +2302,15 @@ bool QQmlCompiler::buildValueTypeProperty(QObject *type,
                     reference->bindingContext = ctxt;
                     reference->bindingContext.owner++;
                     addBindingReference(reference);
-                    value->type = Value::PropertyBinding;
+                    value->type = QQmlScript::Value::PropertyBinding;
                 }
             } else  {
                 COMPILE_CHECK(testLiteralAssignment(prop, value));
-                value->type = Value::Literal;
+                value->type = QQmlScript::Value::Literal;
             }
         }
 
-        for (Value *v = prop->onValues.first(); v; v = Property::ValueList::next(v)) {
+        for (QQmlScript::Value *v = prop->onValues.first(); v; v = QQmlScript::Property::ValueList::next(v)) {
             Q_ASSERT(v->object);
 
             COMPILE_CHECK(buildPropertyOnAssignment(prop, obj, baseObj, v, ctxt));
@@ -2343,9 +2343,9 @@ bool QQmlCompiler::buildListProperty(QQmlScript::Property *prop,
     bool listTypeIsInterface = QQmlMetaType::isInterface(listType);
 
     bool assignedBinding = false;
-    for (Value *v = prop->values.first(); v; v = Property::ValueList::next(v)) {
+    for (QQmlScript::Value *v = prop->values.first(); v; v = QQmlScript::Property::ValueList::next(v)) {
         if (v->object) {
-            v->type = Value::CreatedObject;
+            v->type = QQmlScript::Value::CreatedObject;
             COMPILE_CHECK(buildObject(v->object, ctxt));
 
             // We check object coercian here.  We check interface assignment
@@ -2399,7 +2399,7 @@ bool QQmlCompiler::buildPropertyAssignment(QQmlScript::Property *prop,
     if (prop->values.isMany())
         COMPILE_EXCEPTION(prop->values.first(), tr( "Cannot assign multiple values to a singular property") );
 
-    for (Value *v = prop->values.first(); v; v = Property::ValueList::next(v)) {
+    for (QQmlScript::Value *v = prop->values.first(); v; v = QQmlScript::Property::ValueList::next(v)) {
         if (v->object) {
 
             COMPILE_CHECK(buildPropertyObjectAssignment(prop, obj, v, ctxt));
@@ -2411,7 +2411,7 @@ bool QQmlCompiler::buildPropertyAssignment(QQmlScript::Property *prop,
         }
     }
 
-    for (Value *v = prop->onValues.first(); v; v = Property::ValueList::next(v)) {
+    for (QQmlScript::Value *v = prop->onValues.first(); v; v = QQmlScript::Property::ValueList::next(v)) {
         Q_ASSERT(v->object);
         COMPILE_CHECK(buildPropertyOnAssignment(prop, obj, obj, v, ctxt));
     }
@@ -2436,14 +2436,14 @@ bool QQmlCompiler::buildPropertyObjectAssignment(QQmlScript::Property *prop,
         // Assigning an object to an interface ptr property
         COMPILE_CHECK(buildObject(v->object, ctxt));
 
-        v->type = Value::CreatedObject;
+        v->type = QQmlScript::Value::CreatedObject;
 
     } else if (prop->type == QMetaType::QVariant) {
 
         // Assigning an object to a QVariant
         COMPILE_CHECK(buildObject(v->object, ctxt));
 
-        v->type = Value::CreatedObject;
+        v->type = QQmlScript::Value::CreatedObject;
     } else {
         // Normally buildObject() will set this up, but we need the static
         // meta object earlier to test for assignability.  It doesn't matter
@@ -2472,15 +2472,15 @@ bool QQmlCompiler::buildPropertyObjectAssignment(QQmlScript::Property *prop,
             // Simple assignment
             COMPILE_CHECK(buildObject(v->object, ctxt));
 
-            v->type = Value::CreatedObject;
+            v->type = QQmlScript::Value::CreatedObject;
         } else if (propertyMetaObject && propertyMetaObject->metaObject() == &QQmlComponent::staticMetaObject) {
             // Automatic "Component" insertion
             QQmlScript::Object *root = v->object;
-            QQmlScript::Object *component = pool->New<Object>();
+            QQmlScript::Object *component = pool->New<QQmlScript::Object>();
             component->type = componentTypeRef();
             component->metatype = enginePrivate->cache(&QQmlComponent::staticMetaObject);
             component->location = root->location;
-            QQmlScript::Value *componentValue = pool->New<Value>();
+            QQmlScript::Value *componentValue = pool->New<QQmlScript::Value>();
             componentValue->object = root;
             component->getDefaultProperty()->addValue(componentValue);
             v->object = component;
@@ -2536,7 +2536,7 @@ bool QQmlCompiler::buildPropertyOnAssignment(QQmlScript::Property *prop,
 
         if (isPropertyInterceptor && baseObj->synthdata.isEmpty())
             buildDynamicMeta(baseObj, ForceCreation);
-        v->type = isPropertyValue ? Value::ValueSource : Value::ValueInterceptor;
+        v->type = isPropertyValue ? QQmlScript::Value::ValueSource : QQmlScript::Value::ValueInterceptor;
     } else {
         COMPILE_EXCEPTION(v, tr("\"%1\" cannot operate on \"%2\"").arg(elementName(v->object)).arg(prop->name().toString()));
     }
@@ -2559,7 +2559,7 @@ bool QQmlCompiler::buildPropertyLiteralAssignment(QQmlScript::Property *prop,
             bool isEnumAssignment = false;
             COMPILE_CHECK(testQualifiedEnumAssignment(prop, obj, v, &isEnumAssignment));
             if (isEnumAssignment) {
-                v->type = Value::Literal;
+                v->type = QQmlScript::Value::Literal;
                 return true;
             }
         }
@@ -2572,7 +2572,7 @@ bool QQmlCompiler::buildPropertyLiteralAssignment(QQmlScript::Property *prop,
 
         COMPILE_CHECK(testLiteralAssignment(prop, v));
 
-        v->type = Value::Literal;
+        v->type = QQmlScript::Value::Literal;
     }
 
     return true;
@@ -2618,7 +2618,7 @@ bool QQmlCompiler::testQualifiedEnumAssignment(QQmlScript::Property *prop,
         bool ok;
         int enumval = evaluateEnum(typeName.toString(), enumValue.toUtf8(), &ok);
         if (ok) {
-            v->type = Value::Literal;
+            v->type = QQmlScript::Value::Literal;
             v->value = QQmlScript::Variant((double)enumval);
             *isAssignment = true;
         }
@@ -2660,7 +2660,7 @@ bool QQmlCompiler::testQualifiedEnumAssignment(QQmlScript::Property *prop,
     if (!ok)
         return true;
 
-    v->type = Value::Literal;
+    v->type = QQmlScript::Value::Literal;
     v->value = QQmlScript::Variant((double)value);
     *isAssignment = true;
 
@@ -2671,7 +2671,7 @@ QQmlBinding::Identifier QQmlCompiler::bindingIdentifier(const Variant &value, co
 {
     JSBindingReference *reference = pool->New<JSBindingReference>();
     reference->expression = value;
-    reference->property = pool->New<Property>();
+    reference->property = pool->New<QQmlScript::Property>();
     reference->property->setName(name);
     reference->value = 0;
     reference->bindingContext = QQmlCompilerTypes::BindingContext(customParser->object);
@@ -2712,7 +2712,7 @@ bool QQmlCompiler::checkDynamicMeta(QQmlScript::Object *obj)
     QHashField methodNames;
 
     // Check properties
-    for (Object::DynamicProperty *p = obj->dynamicProperties.first(); p; p = obj->dynamicProperties.next(p)) {
+    for (QQmlScript::Object::DynamicProperty *p = obj->dynamicProperties.first(); p; p = obj->dynamicProperties.next(p)) {
         const QQmlScript::Object::DynamicProperty &prop = *p;
 
         if (prop.isDefaultProperty) {
@@ -2722,7 +2722,7 @@ bool QQmlCompiler::checkDynamicMeta(QQmlScript::Object *obj)
         }
 
         if (propNames.testAndSet(prop.name.hash())) {
-            for (Object::DynamicProperty *p2 = obj->dynamicProperties.first(); p2 != p;
+            for (QQmlScript::Object::DynamicProperty *p2 = obj->dynamicProperties.first(); p2 != p;
                  p2 = obj->dynamicProperties.next(p2)) {
                 if (p2->name == prop.name) {
                     COMPILE_EXCEPTION_LOCATION(prop.nameLocation.line,
@@ -2745,11 +2745,11 @@ bool QQmlCompiler::checkDynamicMeta(QQmlScript::Object *obj)
         }
     }
 
-    for (Object::DynamicSignal *s = obj->dynamicSignals.first(); s; s = obj->dynamicSignals.next(s)) {
+    for (QQmlScript::Object::DynamicSignal *s = obj->dynamicSignals.first(); s; s = obj->dynamicSignals.next(s)) {
         const QQmlScript::Object::DynamicSignal &currSig = *s;
 
         if (methodNames.testAndSet(currSig.name.hash())) {
-            for (Object::DynamicSignal *s2 = obj->dynamicSignals.first(); s2 != s;
+            for (QQmlScript::Object::DynamicSignal *s2 = obj->dynamicSignals.first(); s2 != s;
                  s2 = obj->dynamicSignals.next(s2)) {
                 if (s2->name == currSig.name)
                     COMPILE_EXCEPTION(&currSig, tr("Duplicate signal name"));
@@ -2762,16 +2762,16 @@ bool QQmlCompiler::checkDynamicMeta(QQmlScript::Object *obj)
             COMPILE_EXCEPTION(&currSig, tr("Illegal signal name"));
     }
 
-    for (Object::DynamicSlot *s = obj->dynamicSlots.first(); s; s = obj->dynamicSlots.next(s)) {
+    for (QQmlScript::Object::DynamicSlot *s = obj->dynamicSlots.first(); s; s = obj->dynamicSlots.next(s)) {
         const QQmlScript::Object::DynamicSlot &currSlot = *s;
 
         if (methodNames.testAndSet(currSlot.name.hash())) {
-            for (Object::DynamicSignal *s2 = obj->dynamicSignals.first(); s2;
+            for (QQmlScript::Object::DynamicSignal *s2 = obj->dynamicSignals.first(); s2;
                  s2 = obj->dynamicSignals.next(s2)) {
                 if (s2->name == currSlot.name)
                     COMPILE_EXCEPTION(&currSlot, tr("Duplicate method name"));
             }
-            for (Object::DynamicSlot *s2 = obj->dynamicSlots.first(); s2 != s;
+            for (QQmlScript::Object::DynamicSlot *s2 = obj->dynamicSlots.first(); s2 != s;
                  s2 = obj->dynamicSlots.next(s2)) {
                 if (s2->name == currSlot.name)
                     COMPILE_EXCEPTION(&currSlot, tr("Duplicate method name"));
@@ -2789,13 +2789,13 @@ bool QQmlCompiler::checkDynamicMeta(QQmlScript::Object *obj)
 
 bool QQmlCompiler::mergeDynamicMetaProperties(QQmlScript::Object *obj)
 {
-    for (Object::DynamicProperty *p = obj->dynamicProperties.first(); p;
+    for (QQmlScript::Object::DynamicProperty *p = obj->dynamicProperties.first(); p;
          p = obj->dynamicProperties.next(p)) {
 
-        if (!p->defaultValue || p->type == Object::DynamicProperty::Alias)
+        if (!p->defaultValue || p->type == QQmlScript::Object::DynamicProperty::Alias)
             continue;
 
-        Property *property = 0;
+        QQmlScript::Property *property = 0;
         if (p->isDefaultProperty) {
             property = obj->getDefaultProperty();
         } else {
@@ -2849,29 +2849,29 @@ bool QQmlCompiler::buildDynamicMeta(QQmlScript::Object *obj, DynamicMetaMode mod
     Q_ASSERT(obj->synthCache == 0);
 
     struct TypeData {
-        Object::DynamicProperty::Type dtype;
+        QQmlScript::Object::DynamicProperty::Type dtype;
         int metaType;
     } builtinTypes[] = {
-        { Object::DynamicProperty::Var, qMetaTypeId<QJSValue>() },
-        { Object::DynamicProperty::Variant, QMetaType::QVariant },
-        { Object::DynamicProperty::Int, QMetaType::Int },
-        { Object::DynamicProperty::Bool, QMetaType::Bool },
-        { Object::DynamicProperty::Real, QMetaType::Double },
-        { Object::DynamicProperty::String, QMetaType::QString },
-        { Object::DynamicProperty::Url, QMetaType::QUrl },
-        { Object::DynamicProperty::Color, QMetaType::QColor },
-        { Object::DynamicProperty::Font, QMetaType::QFont },
-        { Object::DynamicProperty::Time, QMetaType::QTime },
-        { Object::DynamicProperty::Date, QMetaType::QDate },
-        { Object::DynamicProperty::DateTime, QMetaType::QDateTime },
-        { Object::DynamicProperty::Rect, QMetaType::QRectF },
-        { Object::DynamicProperty::Point, QMetaType::QPointF },
-        { Object::DynamicProperty::Size, QMetaType::QSizeF },
-        { Object::DynamicProperty::Vector2D, QMetaType::QVector2D },
-        { Object::DynamicProperty::Vector3D, QMetaType::QVector3D },
-        { Object::DynamicProperty::Vector4D, QMetaType::QVector4D },
-        { Object::DynamicProperty::Matrix4x4, QMetaType::QMatrix4x4 },
-        { Object::DynamicProperty::Quaternion, QMetaType::QQuaternion }
+        { QQmlScript::Object::DynamicProperty::Var, qMetaTypeId<QJSValue>() },
+        { QQmlScript::Object::DynamicProperty::Variant, QMetaType::QVariant },
+        { QQmlScript::Object::DynamicProperty::Int, QMetaType::Int },
+        { QQmlScript::Object::DynamicProperty::Bool, QMetaType::Bool },
+        { QQmlScript::Object::DynamicProperty::Real, QMetaType::Double },
+        { QQmlScript::Object::DynamicProperty::String, QMetaType::QString },
+        { QQmlScript::Object::DynamicProperty::Url, QMetaType::QUrl },
+        { QQmlScript::Object::DynamicProperty::Color, QMetaType::QColor },
+        { QQmlScript::Object::DynamicProperty::Font, QMetaType::QFont },
+        { QQmlScript::Object::DynamicProperty::Time, QMetaType::QTime },
+        { QQmlScript::Object::DynamicProperty::Date, QMetaType::QDate },
+        { QQmlScript::Object::DynamicProperty::DateTime, QMetaType::QDateTime },
+        { QQmlScript::Object::DynamicProperty::Rect, QMetaType::QRectF },
+        { QQmlScript::Object::DynamicProperty::Point, QMetaType::QPointF },
+        { QQmlScript::Object::DynamicProperty::Size, QMetaType::QSizeF },
+        { QQmlScript::Object::DynamicProperty::Vector2D, QMetaType::QVector2D },
+        { QQmlScript::Object::DynamicProperty::Vector3D, QMetaType::QVector3D },
+        { QQmlScript::Object::DynamicProperty::Vector4D, QMetaType::QVector4D },
+        { QQmlScript::Object::DynamicProperty::Matrix4x4, QMetaType::QMatrix4x4 },
+        { QQmlScript::Object::DynamicProperty::Quaternion, QMetaType::QQuaternion }
     };
     static const int builtinTypeCount = sizeof(builtinTypes) / sizeof(TypeData);
 
@@ -2906,12 +2906,12 @@ bool QQmlCompiler::buildDynamicMeta(QQmlScript::Object *obj, DynamicMetaMode mod
     int aliasCount = 0;
     int varPropCount = 0;
 
-    for (Object::DynamicProperty *p = obj->dynamicProperties.first(); p;
+    for (QQmlScript::Object::DynamicProperty *p = obj->dynamicProperties.first(); p;
          p = obj->dynamicProperties.next(p)) {
 
-        if (p->type == Object::DynamicProperty::Alias)
+        if (p->type == QQmlScript::Object::DynamicProperty::Alias)
             aliasCount++;
-        else if (p->type == Object::DynamicProperty::Var)
+        else if (p->type == QQmlScript::Object::DynamicProperty::Var)
             varPropCount++;
 
         if (p->name.isLatin1()) {
@@ -2925,14 +2925,14 @@ bool QQmlCompiler::buildDynamicMeta(QQmlScript::Object *obj, DynamicMetaMode mod
             COMPILE_EXCEPTION(p, tr("Cannot override FINAL property"));
     }
 
-    for (Object::DynamicSignal *s = obj->dynamicSignals.first(); s; s = obj->dynamicSignals.next(s)) {
+    for (QQmlScript::Object::DynamicSignal *s = obj->dynamicSignals.first(); s; s = obj->dynamicSignals.next(s)) {
         if (s->name.isLatin1()) {
             s->nameIndex = cStringNameCount;
             cStringNameCount += s->name.length();
         }
     }
 
-    for (Object::DynamicSlot *s = obj->dynamicSlots.first(); s; s = obj->dynamicSlots.next(s)) {
+    for (QQmlScript::Object::DynamicSlot *s = obj->dynamicSlots.first(); s; s = obj->dynamicSlots.next(s)) {
         if (s->name.isLatin1()) {
             s->nameIndex = cStringNameCount;
             cStringNameCount += s->name.length();
@@ -2944,7 +2944,7 @@ bool QQmlCompiler::buildDynamicMeta(QQmlScript::Object *obj, DynamicMetaMode mod
         cache->_dynamicStringData.resize(cStringNameCount);
         cStringData = cache->_dynamicStringData.data();
 
-        for (Object::DynamicProperty *p = obj->dynamicProperties.first(); p;
+        for (QQmlScript::Object::DynamicProperty *p = obj->dynamicProperties.first(); p;
              p = obj->dynamicProperties.next(p)) {
 
             if (p->nameIndex == -1) continue;
@@ -2956,7 +2956,7 @@ bool QQmlCompiler::buildDynamicMeta(QQmlScript::Object *obj, DynamicMetaMode mod
             *myData++ = 'g'; *myData++ = 'e'; *myData++ = 'd';
         }
 
-        for (Object::DynamicSlot *s = obj->dynamicSlots.first(); s; s = obj->dynamicSlots.next(s)) {
+        for (QQmlScript::Object::DynamicSlot *s = obj->dynamicSlots.first(); s; s = obj->dynamicSlots.next(s)) {
 
             if (s->nameIndex == -1) continue;
 
@@ -2965,7 +2965,7 @@ bool QQmlCompiler::buildDynamicMeta(QQmlScript::Object *obj, DynamicMetaMode mod
                 *myData++ = s->name.at(ii).unicode();
         }
 
-        for (Object::DynamicSignal *s = obj->dynamicSignals.first(); s;
+        for (QQmlScript::Object::DynamicSignal *s = obj->dynamicSignals.first(); s;
              s = obj->dynamicSignals.next(s)) {
 
             if (s->nameIndex == -1) continue;
@@ -3017,13 +3017,13 @@ bool QQmlCompiler::buildDynamicMeta(QQmlScript::Object *obj, DynamicMetaMode mod
         if (ii == NSS_Var && varPropCount == 0) continue;
         else if (ii == NSS_Alias && aliasCount == 0) continue;
 
-        for (Object::DynamicProperty *p = obj->dynamicProperties.first(); p;
+        for (QQmlScript::Object::DynamicProperty *p = obj->dynamicProperties.first(); p;
              p = obj->dynamicProperties.next(p)) {
 
-            if ((ii == NSS_Normal && (p->type == Object::DynamicProperty::Alias ||
-                                      p->type == Object::DynamicProperty::Var)) ||
-                ((ii == NSS_Var) && (p->type != Object::DynamicProperty::Var)) ||
-                ((ii == NSS_Alias) && (p->type != Object::DynamicProperty::Alias)))
+            if ((ii == NSS_Normal && (p->type == QQmlScript::Object::DynamicProperty::Alias ||
+                                      p->type == QQmlScript::Object::DynamicProperty::Var)) ||
+                ((ii == NSS_Var) && (p->type != QQmlScript::Object::DynamicProperty::Var)) ||
+                ((ii == NSS_Alias) && (p->type != QQmlScript::Object::DynamicProperty::Alias)))
                 continue;
 
             quint32 flags = QQmlPropertyData::IsSignal | QQmlPropertyData::IsFunction |
@@ -3043,7 +3043,7 @@ bool QQmlCompiler::buildDynamicMeta(QQmlScript::Object *obj, DynamicMetaMode mod
     }
 
     // Dynamic signals
-    for (Object::DynamicSignal *s = obj->dynamicSignals.first(); s; s = obj->dynamicSignals.next(s)) {
+    for (QQmlScript::Object::DynamicSignal *s = obj->dynamicSignals.first(); s; s = obj->dynamicSignals.next(s)) {
         int paramCount = s->parameterNames.count();
 
         QList<QByteArray> names;
@@ -3059,7 +3059,7 @@ bool QQmlCompiler::buildDynamicMeta(QQmlScript::Object *obj, DynamicMetaMode mod
                     names.append(s->parameterNames.at(i).toString().toUtf8());
                 } else {
                     // lazily resolved type
-                    Q_ASSERT(s->parameterTypes.at(i) == Object::DynamicProperty::Custom);
+                    Q_ASSERT(s->parameterTypes.at(i) == QQmlScript::Object::DynamicProperty::Custom);
                     QQmlType *qmltype = 0;
                     if (!unit->imports().resolveType(s->parameterTypeNames.at(i).toString(), &qmltype, 0, 0, 0))
                         COMPILE_EXCEPTION(s, tr("Invalid signal parameter type: %1").arg(s->parameterTypeNames.at(i).toString()));
@@ -3110,7 +3110,7 @@ bool QQmlCompiler::buildDynamicMeta(QQmlScript::Object *obj, DynamicMetaMode mod
 
 
     // Dynamic slots
-    for (Object::DynamicSlot *s = obj->dynamicSlots.first(); s; s = obj->dynamicSlots.next(s)) {
+    for (QQmlScript::Object::DynamicSlot *s = obj->dynamicSlots.first(); s; s = obj->dynamicSlots.next(s)) {
         int paramCount = s->parameterNames.count();
 
         quint32 flags = QQmlPropertyData::IsFunction | QQmlPropertyData::IsVMEFunction;
@@ -3137,11 +3137,11 @@ bool QQmlCompiler::buildDynamicMeta(QQmlScript::Object *obj, DynamicMetaMode mod
 
     // Dynamic properties (except var and aliases)
     int effectiveSignalIndex = cache->signalHandlerIndexCacheStart;
-    for (Object::DynamicProperty *p = obj->dynamicProperties.first(); p;
+    for (QQmlScript::Object::DynamicProperty *p = obj->dynamicProperties.first(); p;
          p = obj->dynamicProperties.next(p)) {
 
-        if (p->type == Object::DynamicProperty::Alias ||
-            p->type == Object::DynamicProperty::Var)
+        if (p->type == QQmlScript::Object::DynamicProperty::Alias ||
+            p->type == QQmlScript::Object::DynamicProperty::Var)
             continue;
 
         int propertyType = 0;
@@ -3152,11 +3152,11 @@ bool QQmlCompiler::buildDynamicMeta(QQmlScript::Object *obj, DynamicMetaMode mod
             propertyType = builtinTypes[p->type].metaType;
             vmePropertyType = propertyType;
 
-            if (p->type == Object::DynamicProperty::Variant)
+            if (p->type == QQmlScript::Object::DynamicProperty::Variant)
                 propertyFlags |= QQmlPropertyData::IsQVariant;
         } else {
-            Q_ASSERT(p->type == Object::DynamicProperty::CustomList ||
-                     p->type == Object::DynamicProperty::Custom);
+            Q_ASSERT(p->type == QQmlScript::Object::DynamicProperty::CustomList ||
+                     p->type == QQmlScript::Object::DynamicProperty::Custom);
 
             QQmlType *qmltype = 0;
             if (!unit->imports().resolveType(p->customType.toString(), &qmltype, 0, 0, 0))
@@ -3170,7 +3170,7 @@ bool QQmlCompiler::buildDynamicMeta(QQmlScript::Object *obj, DynamicMetaMode mod
 
                 QQmlCompiledData *data = tdata->compiledData();
 
-                if (p->type == Object::DynamicProperty::Custom) {
+                if (p->type == QQmlScript::Object::DynamicProperty::Custom) {
                     propertyType = data->metaTypeId;
                     vmePropertyType = QMetaType::QObjectStar;
                 } else {
@@ -3180,7 +3180,7 @@ bool QQmlCompiler::buildDynamicMeta(QQmlScript::Object *obj, DynamicMetaMode mod
 
                 tdata->release();
             } else {
-                if (p->type == Object::DynamicProperty::Custom) {
+                if (p->type == QQmlScript::Object::DynamicProperty::Custom) {
                     propertyType = qmltype->typeId();
                     vmePropertyType = QMetaType::QObjectStar;
                 } else {
@@ -3189,13 +3189,13 @@ bool QQmlCompiler::buildDynamicMeta(QQmlScript::Object *obj, DynamicMetaMode mod
                 }
             }
 
-            if (p->type == Object::DynamicProperty::Custom)
+            if (p->type == QQmlScript::Object::DynamicProperty::Custom)
                 propertyFlags |= QQmlPropertyData::IsQObjectDerived;
             else
                 propertyFlags |= QQmlPropertyData::IsQList;
         }
 
-        if (!p->isReadOnly && p->type != Object::DynamicProperty::CustomList)
+        if (!p->isReadOnly && p->type != QQmlScript::Object::DynamicProperty::CustomList)
             propertyFlags |= QQmlPropertyData::IsWritable;
 
         if (p->nameIndex != -1) {
@@ -3219,10 +3219,10 @@ bool QQmlCompiler::buildDynamicMeta(QQmlScript::Object *obj, DynamicMetaMode mod
     }
 
     // Now do var properties
-    for (Object::DynamicProperty *p = obj->dynamicProperties.first(); p && varPropCount;
+    for (QQmlScript::Object::DynamicProperty *p = obj->dynamicProperties.first(); p && varPropCount;
          p = obj->dynamicProperties.next(p)) {
 
-        if (p->type != Object::DynamicProperty::Var)
+        if (p->type != QQmlScript::Object::DynamicProperty::Var)
             continue;
 
         quint32 propertyFlags = QQmlPropertyData::IsVarProperty;
@@ -3254,7 +3254,7 @@ bool QQmlCompiler::buildDynamicMeta(QQmlScript::Object *obj, DynamicMetaMode mod
     ((QQmlVMEMetaData *)dynamicData.data())->aliasCount = aliasCount;
 
     // Dynamic slot data - comes after the property data
-    for (Object::DynamicSlot *s = obj->dynamicSlots.first(); s; s = obj->dynamicSlots.next(s)) {
+    for (QQmlScript::Object::DynamicSlot *s = obj->dynamicSlots.first(); s; s = obj->dynamicSlots.next(s)) {
         VMD::MethodData methodData = { /*runtimeFunctionIndex*/ 0, // To be filled in later
                                        s->parameterNames.count(),
                                        s->location.start.line };
@@ -3296,10 +3296,10 @@ bool QQmlCompiler::buildDynamicMetaAliases(QQmlScript::Object *obj)
     int effectivePropertyIndex = cache->propertyIndexCacheStart + cache->propertyIndexCache.count();
     int effectiveAliasIndex = 0;
 
-    for (Object::DynamicProperty *p = obj->dynamicProperties.first(); p;
+    for (QQmlScript::Object::DynamicProperty *p = obj->dynamicProperties.first(); p;
          p = obj->dynamicProperties.next(p)) {
 
-        if (p->type != Object::DynamicProperty::Alias)
+        if (p->type != QQmlScript::Object::DynamicProperty::Alias)
             continue;
 
         if (!p->defaultValue)
@@ -3465,7 +3465,7 @@ bool QQmlCompiler::buildBinding(QQmlScript::Value *value,
     reference->value = value;
     reference->bindingContext = ctxt;
     addBindingReference(reference);
-    value->type = Value::PropertyBinding;
+    value->type = QQmlScript::Value::PropertyBinding;
 
     return true;
 }
@@ -3503,7 +3503,7 @@ bool QQmlCompiler::buildLiteralBinding(QQmlScript::Value *v,
                         reference->text = text;
                         reference->n = n;
                         v->bindingReference = reference;
-                        v->type = Value::PropertyBinding;
+                        v->type = QQmlScript::Value::PropertyBinding;
                         return true;
                     }
 
@@ -3532,7 +3532,7 @@ bool QQmlCompiler::buildLiteralBinding(QQmlScript::Value *v,
                         reference->comment = comment;
                         reference->n = n;
                         v->bindingReference = reference;
-                        v->type = Value::PropertyBinding;
+                        v->type = QQmlScript::Value::PropertyBinding;
                         return true;
                     }
 
@@ -3614,7 +3614,7 @@ int QQmlCompiler::genContextCache()
 
     QVector<QQmlContextData::ObjectIdMapping> cache(compileState->ids.count());
     int i = 0;
-    for (Object *o = compileState->ids.first(); o; o = compileState->ids.next(o), ++i)
+    for (QQmlScript::Object *o = compileState->ids.first(); o; o = compileState->ids.next(o), ++i)
         cache[i] = QQmlContextData::ObjectIdMapping(o->id, o->idIndex);
 
     output->contextCaches.append(cache);
@@ -3635,7 +3635,7 @@ bool QQmlCompiler::completeComponentBuild()
     if (componentStats)
         componentStats->componentStat.ids = compileState->ids.count();
 
-    for (Object *aliasObject = compileState->aliasingObjects.first(); aliasObject;
+    for (QQmlScript::Object *aliasObject = compileState->aliasingObjects.first(); aliasObject;
          aliasObject = compileState->aliasingObjects.next(aliasObject))
         COMPILE_CHECK(buildDynamicMetaAliases(aliasObject));
 
@@ -3677,7 +3677,7 @@ bool QQmlCompiler::completeComponentBuild()
         JSCodeGen::ObjectIdMapping idMapping;
         if (compileState->ids.count() > 0) {
             idMapping.reserve(compileState->ids.count());
-            for (Object *o = compileState->ids.first(); o; o = compileState->ids.next(o)) {
+            for (QQmlScript::Object *o = compileState->ids.first(); o; o = compileState->ids.next(o)) {
                 JSCodeGen::IdMapping m;
                 m.name = o->id;
                 m.idIndex = o->idIndex;
index 2ce850da5df1a0381338a13ee00147a73a0c744e..5a96580f7808481dfd63de3eb595007ca77154e7 100644 (file)
@@ -491,7 +491,7 @@ private:
     int cachedComponentTypeRef;
     int cachedTranslationContextIndex;
 
-    QScopedPointer<QQmlJS::V4IR::Module> jsModule;
+    QScopedPointer<IR::Module> jsModule;
 
     // Compiler component statistics.  Only collected if QML_COMPILER_STATS=1
     struct ComponentStat
index 004d9f435a74c279a42d865115aa58bdb7c1c34d..e976000c9ec3aa9ef9da64def696ae69520293b5 100644 (file)
@@ -101,7 +101,7 @@ QQmlCustomParserNodePrivate::fromObject(QQmlScript::Object *root)
         rootNode.d->name = root->typeReference->name;
     rootNode.d->location = root->location.start;
 
-    for (Property *p = root->properties.first(); p; p = root->properties.next(p)) {
+    for (QQmlScript::Property *p = root->properties.first(); p; p = root->properties.next(p)) {
         rootNode.d->properties << fromProperty(p);
     }
 
@@ -347,7 +347,7 @@ QQmlBinding::Identifier QQmlCustomParser::bindingIdentifier(const QV4::CompiledD
     return compiler->bindingIdentifier(binding, this);
 }
 
-AST::Node *QQmlCustomParser::astForBinding(int scriptIndex) const
+QQmlJS::AST::Node *QQmlCustomParser::astForBinding(int scriptIndex) const
 {
     return compiler->astForBinding(scriptIndex);
 }
index da2b793b71b5fbcb652db23f7497b829fcb4ada5..79ccdc9a4b736bf5817cc2065296f9999dc05d2d 100644 (file)
@@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
 extern Q_CORE_EXPORT QBasicAtomicInt qt_qhash_seed; // from qhash.cpp
 QT_END_NAMESPACE
 
-using namespace QT_PREPEND_NAMESPACE(QQmlJS::V4IR);
+using namespace QT_PREPEND_NAMESPACE(QV4::IR);
 
 void tst_v4misc::initTestCase()
 {
index c5c94773b974257dbba81102bee0330a57b47622..f13f42881ce6c312a615dd3e4742a67dfade1b10 100644 (file)
@@ -174,12 +174,12 @@ int main(int argc, char *argv[])
     switch (mode) {
     case use_masm:
     case use_moth: {
-        QQmlJS::EvalISelFactory* iSelFactory = 0;
+        QV4::EvalISelFactory* iSelFactory = 0;
         if (mode == use_moth) {
-            iSelFactory = new QQmlJS::Moth::ISelFactory;
+            iSelFactory = new QV4::Moth::ISelFactory;
 #ifdef V4_ENABLE_JIT
         } else {
-            iSelFactory = new QQmlJS::MASM::ISelFactory;
+            iSelFactory = new QV4::JIT::ISelFactory;
 #endif // V4_ENABLE_JIT
         }