Skip to content

Commit

Permalink
Removed QDeclarativeJS::NodePool
Browse files Browse the repository at this point in the history
Change-Id: I69d39ef005900803f6c620ea8f1ca00d054dc8d2
Reviewed-on: http://codereview.qt.nokia.com/3757
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
  • Loading branch information
Roberto Raggi authored and Qt by Nokia committed Aug 30, 2011
1 parent e17010e commit 5f54b6c
Show file tree
Hide file tree
Showing 14 changed files with 409 additions and 555 deletions.
1 change: 0 additions & 1 deletion src/declarative/qml/parser/parser.pri
Expand Up @@ -8,7 +8,6 @@ HEADERS += \
$$PWD/qdeclarativejsgrammar_p.h \
$$PWD/qdeclarativejslexer_p.h \
$$PWD/qdeclarativejsmemorypool_p.h \
$$PWD/qdeclarativejsnodepool_p.h \
$$PWD/qdeclarativejsparser_p.h \
$$PWD/qdeclarativejsglobal_p.h \
$$PWD/qdeclarativejskeywords_p.h
Expand Down
375 changes: 188 additions & 187 deletions src/declarative/qml/parser/qdeclarativejs.g

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions src/declarative/qml/parser/qdeclarativejsast_p.h
Expand Up @@ -55,6 +55,7 @@

#include "qdeclarativejsastvisitor_p.h"
#include "qdeclarativejsglobal_p.h"
#include "qdeclarativejsmemorypool_p.h"

#include <QtCore/QString>

Expand Down Expand Up @@ -119,7 +120,7 @@ _T1 cast(_T2 *ast)
return 0;
}

class QML_PARSER_EXPORT Node
class QML_PARSER_EXPORT Node: public Managed
{
public:
enum Kind {
Expand Down Expand Up @@ -2138,11 +2139,11 @@ class QML_PARSER_EXPORT UiImport: public Node
QDECLARATIVEJS_DECLARE_AST_NODE(UiImport)

UiImport(const QStringRef &fileName)
: fileName(fileName), importUri(0), importId(0)
: fileName(fileName), importUri(0)
{ kind = K; }

UiImport(UiQualifiedId *uri)
: fileName(0), importUri(uri), importId(0)
: importUri(uri)
{ kind = K; }

virtual SourceLocation firstSourceLocation() const
Expand Down Expand Up @@ -2342,13 +2343,13 @@ class QML_PARSER_EXPORT UiPublicMember: public UiObjectMember

UiPublicMember(const QStringRef &memberType,
const QStringRef &name)
: type(Property), typeModifier(0), memberType(memberType), name(name), statement(0), binding(0), isDefaultMember(false), isReadonlyMember(false), parameters(0)
: type(Property), memberType(memberType), name(name), statement(0), binding(0), isDefaultMember(false), isReadonlyMember(false), parameters(0)
{ kind = K; }

UiPublicMember(const QStringRef &memberType,
const QStringRef &name,
Statement *statement)
: type(Property), typeModifier(0), memberType(memberType), name(name), statement(statement), binding(0), isDefaultMember(false), isReadonlyMember(false), parameters(0)
: type(Property), memberType(memberType), name(name), statement(statement), binding(0), isDefaultMember(false), isReadonlyMember(false), parameters(0)
{ kind = K; }

virtual SourceLocation firstSourceLocation() const
Expand Down
27 changes: 3 additions & 24 deletions src/declarative/qml/parser/qdeclarativejsengine_p.cpp
Expand Up @@ -40,9 +40,7 @@
****************************************************************************/

#include "qdeclarativejsengine_p.h"

#include "qdeclarativejsglobal_p.h"
#include "qdeclarativejsnodepool_p.h"

#include <qnumeric.h>
#include <QHash>
Expand All @@ -52,22 +50,6 @@ QT_QML_BEGIN_NAMESPACE

namespace QDeclarativeJS {

NodePool::NodePool(const QString &fileName, Engine *engine)
: m_fileName(fileName), m_engine(engine)
{
m_engine->setNodePool(this);
}

NodePool::~NodePool()
{
}

Code *NodePool::createCompiledCode(AST::Node *, CompilationUnit &)
{
Q_ASSERT(0);
return 0;
}

static int toDigit(char c)
{
if ((c >= '0') && (c <= '9'))
Expand Down Expand Up @@ -140,7 +122,7 @@ double integerFromString(const QString &str, int radix)


Engine::Engine()
: _lexer(0), _nodePool(0)
: _lexer(0)
{ }

Engine::~Engine()
Expand All @@ -161,11 +143,8 @@ Lexer *Engine::lexer() const
void Engine::setLexer(Lexer *lexer)
{ _lexer = lexer; }

NodePool *Engine::nodePool() const
{ return _nodePool; }

void Engine::setNodePool(NodePool *nodePool)
{ _nodePool = nodePool; }
MemoryPool *Engine::pool()
{ return &_pool; }

QStringRef Engine::midRef(int position, int size)
{ return _code.midRef(position, size); }
Expand Down
8 changes: 4 additions & 4 deletions src/declarative/qml/parser/qdeclarativejsengine_p.h
Expand Up @@ -55,6 +55,7 @@

#include "qdeclarativejsglobal_p.h"
#include "qdeclarativejsastfwd_p.h"
#include "qdeclarativejsmemorypool_p.h"

#include <QString>
#include <QSet>
Expand All @@ -64,7 +65,7 @@ QT_QML_BEGIN_NAMESPACE
namespace QDeclarativeJS {

class Lexer;
class NodePool;
class MemoryPool;

class QML_PARSER_EXPORT DiagnosticMessage
{
Expand All @@ -91,7 +92,7 @@ class QML_PARSER_EXPORT DiagnosticMessage
class QML_PARSER_EXPORT Engine
{
Lexer *_lexer;
NodePool *_nodePool;
MemoryPool _pool;
QList<AST::SourceLocation> _comments;
QString _extraCode;
QString _code;
Expand All @@ -108,8 +109,7 @@ class QML_PARSER_EXPORT Engine
Lexer *lexer() const;
void setLexer(Lexer *lexer);

NodePool *nodePool() const;
void setNodePool(NodePool *nodePool);
MemoryPool *pool();

QStringRef midRef(int position, int size);

Expand Down
3 changes: 2 additions & 1 deletion src/declarative/qml/parser/qdeclarativejslexer.cpp
Expand Up @@ -41,7 +41,8 @@

#include "qdeclarativejslexer_p.h"
#include "qdeclarativejsengine_p.h"
#include "qdeclarativejsnodepool_p.h"
#include "qdeclarativejsmemorypool_p.h"

#include <private/qdeclarativeutils_p.h>
#include <QtCore/QCoreApplication>
#include <QtCore/QVarLengthArray>
Expand Down
15 changes: 14 additions & 1 deletion src/declarative/qml/parser/qdeclarativejsmemorypool_p.h
Expand Up @@ -93,7 +93,6 @@ class QML_PARSER_EXPORT MemoryPool : public QSharedData

m_storage = reinterpret_cast<char**>(qRealloc(m_storage, sizeof(char*) * (1 + m_blockIndex)));
m_currentBlock = m_storage[m_blockIndex] = reinterpret_cast<char*>(qMalloc(m_currentBlockSize));
::memset(m_currentBlock, 0, m_currentBlockSize);

m_currentIndex = (8 - quintptr(m_currentBlock)) & 7; // ensure first chunk is 64-bit aligned
Q_ASSERT(m_currentIndex + bytes <= m_currentBlockSize);
Expand Down Expand Up @@ -126,6 +125,20 @@ class QML_PARSER_EXPORT MemoryPool : public QSharedData
Q_DISABLE_COPY(MemoryPool)
};

class QML_PARSER_EXPORT Managed
{
Managed(const Managed &other);
void operator = (const Managed &other);

public:
Managed() {}
~Managed() {}

void *operator new(size_t size, MemoryPool *pool) { return pool->allocate(size); }
void operator delete(void *) {}
void operator delete(void *, MemoryPool *) {}
};

} // namespace QDeclarativeJS

QT_QML_END_NAMESPACE
Expand Down
139 changes: 0 additions & 139 deletions src/declarative/qml/parser/qdeclarativejsnodepool_p.h

This file was deleted.

0 comments on commit 5f54b6c

Please sign in to comment.