aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/parser/qdeclarativejsengine_p.h
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2011-07-15 17:46:43 +1000
committerQt by Nokia <qt-info@nokia.com>2011-08-30 13:18:28 +0200
commitc742d2d12122e752a74da3e3f26dff28ff967b9d (patch)
tree0ba053e34da0681a5a61fa6d36602ffdabef6e0e /src/declarative/qml/parser/qdeclarativejsengine_p.h
parent3f7ea11f9f9a0ecb2bc571237f8f3523447883f7 (diff)
Improve performance of the QML front-end
Introduced a new lexer and a more efficient representation of the AST. Instead of creating unique name ids, we simply use QStringRef(s). Change-Id: I403472fa2bb74d2c87dd6314065306499677a3bf Authored-by: Roberto Raggi Reviewed-on: http://codereview.qt.nokia.com/3750 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
Diffstat (limited to 'src/declarative/qml/parser/qdeclarativejsengine_p.h')
-rw-r--r--src/declarative/qml/parser/qdeclarativejsengine_p.h63
1 files changed, 10 insertions, 53 deletions
diff --git a/src/declarative/qml/parser/qdeclarativejsengine_p.h b/src/declarative/qml/parser/qdeclarativejsengine_p.h
index fd07f3fe3c..56c6be4ca8 100644
--- a/src/declarative/qml/parser/qdeclarativejsengine_p.h
+++ b/src/declarative/qml/parser/qdeclarativejsengine_p.h
@@ -62,55 +62,10 @@
QT_QML_BEGIN_NAMESPACE
namespace QDeclarativeJS {
-class QML_PARSER_EXPORT NameId
-{
- QString _text;
-
-public:
- NameId(const QChar *u, int s)
- : _text(u, s)
- { }
-
- const QString &asString() const
- { return _text; }
-
- bool operator == (const NameId &other) const
- { return _text == other._text; }
-
- bool operator != (const NameId &other) const
- { return _text != other._text; }
-
- bool operator < (const NameId &other) const
- { return _text < other._text; }
-};
-
-uint qHash(const QDeclarativeJS::NameId &id);
-
-} // end of namespace QDeclarativeJS
-
-namespace QDeclarativeJS {
class Lexer;
class NodePool;
-namespace Ecma {
-
-class QML_PARSER_EXPORT RegExp
-{
-public:
- enum RegExpFlag {
- Global = 0x01,
- IgnoreCase = 0x02,
- Multiline = 0x04
- };
-
-public:
- static int flagFromChar(const QChar &);
- static QString flagsToString(int flags);
-};
-
-} // end of namespace Ecma
-
class QML_PARSER_EXPORT DiagnosticMessage
{
public:
@@ -137,27 +92,29 @@ class QML_PARSER_EXPORT Engine
{
Lexer *_lexer;
NodePool *_nodePool;
- QSet<NameId> _literals;
- QList<QDeclarativeJS::AST::SourceLocation> _comments;
+ QList<AST::SourceLocation> _comments;
+ QString _extraCode;
+ QString _code;
public:
Engine();
~Engine();
- QSet<NameId> literals() const;
+ void setCode(const QString &code);
void addComment(int pos, int len, int line, int col);
- QList<QDeclarativeJS::AST::SourceLocation> comments() const;
-
- NameId *intern(const QChar *u, int s);
-
- static QString toString(NameId *id);
+ QList<AST::SourceLocation> comments() const;
Lexer *lexer() const;
void setLexer(Lexer *lexer);
NodePool *nodePool() const;
void setNodePool(NodePool *nodePool);
+
+ QStringRef midRef(int position, int size);
+
+ QStringRef newStringRef(const QString &s);
+ QStringRef newStringRef(const QChar *chars, int size);
};
} // end of namespace QDeclarativeJS