Type_CallContext = 0x5,
Type_QmlContext = 0x6
};
- struct EvalCode
- {
- Function *function;
- EvalCode *next;
- };
- struct Data : Managed::Data {
- Data(ExecutionEngine *engine, ContextType t)
- : Managed::Data(engine->executionContextClass)
- , type(t)
- , strictMode(false)
- , engine(engine)
- , parent(engine->currentContext())
- , outer(0)
- , lookups(0)
- , compilationUnit(0)
- , lineNumber(-1)
- {
- engine->current = reinterpret_cast<ExecutionContext *>(this);
- }
- ContextType type;
- bool strictMode;
-
- CallData *callData;
-
- ExecutionEngine *engine;
- ExecutionContext *parent;
- ExecutionContext *outer;
- Lookup *lookups;
- CompiledData::CompilationUnit *compilationUnit;
-
- int lineNumber;
+ inline ExecutionContext(ExecutionEngine *engine, ContextType t);
- };
- V4_MANAGED(Managed)
- Q_MANAGED_TYPE(ExecutionContext)
+ ContextType type;
+ bool strictMode;
+
+ CallData *callData;
- ExecutionContext(ExecutionEngine *engine, ContextType t)
- : Managed(engine->executionContextClass)
+ ExecutionEngine *engine;
+ ExecutionContext *parent;
+ ExecutionContext *outer;
+ Lookup *lookups;
+ CompiledData::CompilationUnit *compilationUnit;
- EvalCode *currentEvalCode;
+
+ int lineNumber;
+
+};
+
+struct CallContext : ExecutionContext {
+ CallContext(ExecutionEngine *engine, ContextType t = Type_SimpleCallContext)
+ : ExecutionContext(engine, t)
{
- d()->type = t;
- d()->strictMode = false;
- d()->engine = engine;
- d()->parent = engine->currentContext();
- d()->outer = 0;
- d()->lookups = 0;
- d()->compilationUnit = 0;
- d()->lineNumber = -1;
- engine->current = this;
+ function = 0;
+ locals = 0;
+ activation = 0;
}
+ CallContext(ExecutionEngine *engine, QV4::Object *qml, QV4::FunctionObject *function);
- HeapObject *newCallContext(FunctionObject *f, CallData *callData);
- WithContext *newWithContext(Object *with);
- CatchContext *newCatchContext(String *exceptionVarName, const ValueRef exceptionValue);
- CallContext *newQmlContext(FunctionObject *f, Object *qml);
+ FunctionObject *function;
+ int realArgumentCount;
+ Value *locals;
+ Object *activation;
+};
- void createMutableBinding(String *name, bool deletable);
+struct GlobalContext : ExecutionContext {
+ GlobalContext(ExecutionEngine *engine);
+ Object *global;
+};
+
+struct CatchContext : ExecutionContext {
+ CatchContext(ExecutionEngine *engine, QV4::String *exceptionVarName, const ValueRef exceptionValue);
+ StringValue exceptionVarName;
+ Value exceptionValue;
+};
+
+struct WithContext : ExecutionContext {
+ WithContext(ExecutionEngine *engine, QV4::Object *with);
+ Object *withObject;
+};
- ReturnedValue throwError(const QV4::ValueRef value);
- ReturnedValue throwError(const QString &message);
- ReturnedValue throwSyntaxError(const QString &message);
- ReturnedValue throwSyntaxError(const QString &message, const QString &fileName, int lineNumber, int column);
- ReturnedValue throwTypeError();
- ReturnedValue throwTypeError(const QString &message);
- ReturnedValue throwReferenceError(const ValueRef value);
- ReturnedValue throwReferenceError(const QString &value, const QString &fileName, int lineNumber, int column);
- ReturnedValue throwRangeError(const ValueRef value);
- ReturnedValue throwRangeError(const QString &message);
- ReturnedValue throwURIError(const ValueRef msg);
- ReturnedValue throwUnimplemented(const QString &message);
+
+}
+
+struct Q_QML_EXPORT ExecutionContext : public Managed
+{
+ enum {
+ IsExecutionContext = true
+ };
+
+ V4_MANAGED(ExecutionContext, Managed)
+ Q_MANAGED_TYPE(ExecutionContext)
+
+ Heap::CallContext *newCallContext(FunctionObject *f, CallData *callData);
+ Heap::WithContext *newWithContext(Object *with);
+ Heap::CatchContext *newCatchContext(String *exceptionVarName, const ValueRef exceptionValue);
+ Heap::CallContext *newQmlContext(FunctionObject *f, Object *qml);
+
+ void createMutableBinding(String *name, bool deletable);
void setProperty(String *name, const ValueRef value);
ReturnedValue getProperty(String *name);
inline CallContext *asCallContext();
inline const CallContext *asCallContext() const;
- static void markObjects(Managed *m, ExecutionEngine *e);
+ static void markObjects(Heap::Base *m, ExecutionEngine *e);
};
- , currentEvalCode(0)
+inline
+Heap::ExecutionContext::ExecutionContext(ExecutionEngine *engine, ContextType t)
+ : Heap::Base(engine->executionContextClass)
+ , type(t)
+ , strictMode(false)
+ , engine(engine)
+ , parent(engine->currentContext()->d())
+ , outer(0)
+ , lookups(0)
+ , compilationUnit(0)
+ , lineNumber(-1)
+{
+ // ### GC
+ engine->current = reinterpret_cast<QV4::ExecutionContext *>(this);
+}
+
+
struct CallContext : public ExecutionContext
{
- struct Data : ExecutionContext::Data {
- Data(ExecutionEngine *engine, ContextType t = Type_SimpleCallContext)
- : ExecutionContext::Data(engine, t)
- {
- function = 0;
- locals = 0;
- activation = 0;
- }
- Data(ExecutionEngine *engine, Object *qml, QV4::FunctionObject *function);
-
- FunctionObject *function;
- int realArgumentCount;
- Value *locals;
- Object *activation;
- };
- V4_MANAGED(ExecutionContext)
+ V4_MANAGED(CallContext, ExecutionContext)
// formals are in reverse order
- String * const *formals() const;
+ Identifier * const *formals() const;
unsigned int formalCount() const;
- String * const *variables() const;
+ Identifier * const *variables() const;
unsigned int variableCount() const;
inline ReturnedValue argument(int i);
inline void ExecutionEngine::pushContext(CallContext *context)
{
- context->d()->parent = current;
+ Q_ASSERT(current && current->d() && context && context->d());
+ context->d()->parent = current->d();
current = context;
- current->d()->currentEvalCode = 0;
}
inline ExecutionContext *ExecutionEngine::popContext()
void InternalClass::destroy()
{
- if (!engine)
- return;
- engine = 0;
-
- propertyTable.~PropertyHash();
- nameMap.~SharedInternalClassData<Identifier *>();
- propertyData.~SharedInternalClassData<PropertyAttributes>();
+ QList<InternalClass *> destroyStack;
+ destroyStack.append(this);
- if (m_sealed)
- m_sealed->destroy();
-
- if (m_frozen)
- m_frozen->destroy();
-
- for (QHash<Transition, InternalClass *>::ConstIterator it = transitions.begin(), end = transitions.end();
- it != end; ++it)
- it.value()->destroy();
-
- transitions.clear();
+ while (!destroyStack.isEmpty()) {
+ InternalClass *next = destroyStack.takeLast();
+ if (!next->engine)
+ continue;
+ next->engine = 0;
+ next->propertyTable.~PropertyHash();
- next->nameMap.~SharedInternalClassData<String *>();
++ next->nameMap.~SharedInternalClassData<Identifier *>();
+ next->propertyData.~SharedInternalClassData<PropertyAttributes>();
+ if (next->m_sealed)
+ destroyStack.append(next->m_sealed);
+ if (next->m_frozen)
+ destroyStack.append(next->m_frozen);
+ destroyStack.append(next->transitions.values());
+ next->transitions.clear();
+ }
}
struct InternalClassPoolVisitor
protected:
virtual void load();
- virtual void componentComplete();
+ void componentComplete() Q_DECL_OVERRIDE;
virtual void pixmapChange();
+ void itemChange(ItemChange change, const ItemChangeData &value) Q_DECL_OVERRIDE;
QQuickImageBase(QQuickImageBasePrivate &dd, QQuickItem *parent);
private Q_SLOTS:
void renderTypeChanged();
protected:
- void mousePressEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *event);
- virtual void itemChange(ItemChange change, const ItemChangeData &value);
- virtual void geometryChanged(const QRectF &newGeometry,
- const QRectF &oldGeometry);
- virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *);
-
- void updatePolish();
-
- void hoverEnterEvent(QHoverEvent *event);
- void hoverMoveEvent(QHoverEvent *event);
- void hoverLeaveEvent(QHoverEvent *event);
+ void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void itemChange(ItemChange change, const ItemChangeData &value) Q_DECL_OVERRIDE;
+ void geometryChanged(const QRectF &newGeometry,
+ const QRectF &oldGeometry) Q_DECL_OVERRIDE;
+ QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) Q_DECL_OVERRIDE;
+
+ void updatePolish() Q_DECL_OVERRIDE;
+
+ void hoverEnterEvent(QHoverEvent *event) Q_DECL_OVERRIDE;
+ void hoverMoveEvent(QHoverEvent *event) Q_DECL_OVERRIDE;
+ void hoverLeaveEvent(QHoverEvent *event) Q_DECL_OVERRIDE;
+ void invalidateFontCaches();
private Q_SLOTS:
void q_imagesLoaded();
QRectF cursorRectangle() const;
#ifndef QT_NO_IM
- QVariant inputMethodQuery(Qt::InputMethodQuery property) const;
+ QVariant inputMethodQuery(Qt::InputMethodQuery property) const Q_DECL_OVERRIDE;
- Q_INVOKABLE QVariant inputMethodQuery(Qt::InputMethodQuery query, QVariant argument) const;
+ Q_REVISION(4) Q_INVOKABLE QVariant inputMethodQuery(Qt::InputMethodQuery query, QVariant argument) const;
#endif
qreal contentWidth() const;
private:
void markDirtyNodesForRange(int start, int end, int charDelta);
void updateTotalLines();
+ void invalidateFontCaches();
protected:
- virtual void geometryChanged(const QRectF &newGeometry,
- const QRectF &oldGeometry);
+ void geometryChanged(const QRectF &newGeometry,
+ const QRectF &oldGeometry) Q_DECL_OVERRIDE;
- bool event(QEvent *);
- void keyPressEvent(QKeyEvent *);
- void keyReleaseEvent(QKeyEvent *);
- void focusInEvent(QFocusEvent *event);
- void focusOutEvent(QFocusEvent *event);
+ bool event(QEvent *) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE;
+ void keyReleaseEvent(QKeyEvent *) Q_DECL_OVERRIDE;
+ void focusInEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
+ void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
- void hoverEnterEvent(QHoverEvent *event);
- void hoverMoveEvent(QHoverEvent *event);
- void hoverLeaveEvent(QHoverEvent *event);
+ void hoverEnterEvent(QHoverEvent *event) Q_DECL_OVERRIDE;
+ void hoverMoveEvent(QHoverEvent *event) Q_DECL_OVERRIDE;
+ void hoverLeaveEvent(QHoverEvent *event) Q_DECL_OVERRIDE;
// mouse filter?
- void mousePressEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *event);
- void mouseDoubleClickEvent(QMouseEvent *event);
- void mouseMoveEvent(QMouseEvent *event);
+ void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
#ifndef QT_NO_IM
- void inputMethodEvent(QInputMethodEvent *e);
+ void inputMethodEvent(QInputMethodEvent *e) Q_DECL_OVERRIDE;
#endif
- QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *updatePaintNodeData);
+ QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *updatePaintNodeData) Q_DECL_OVERRIDE;
+ void updatePolish();
friend class QQuickTextUtil;
friend class QQuickTextDocument;
bool hasAcceptableInput() const;
#ifndef QT_NO_IM
- QVariant inputMethodQuery(Qt::InputMethodQuery property) const;
+ QVariant inputMethodQuery(Qt::InputMethodQuery property) const Q_DECL_OVERRIDE;
- Q_INVOKABLE QVariant inputMethodQuery(Qt::InputMethodQuery query, QVariant argument) const;
+ Q_REVISION(3) Q_INVOKABLE QVariant inputMethodQuery(Qt::InputMethodQuery query, QVariant argument) const;
#endif
- QRectF boundingRect() const;
- QRectF clipRect() const;
+ QRectF boundingRect() const Q_DECL_OVERRIDE;
+ QRectF clipRect() const Q_DECL_OVERRIDE;
bool canPaste() const;
void canPasteChanged();
void canUndoChanged();
void canRedoChanged();
-#ifndef QT_NO_IM
void inputMethodComposingChanged();
-#endif
void effectiveHorizontalAlignmentChanged();
void contentSizeChanged();
-#ifndef QT_NO_IM
void inputMethodHintsChanged();
-#endif
void renderTypeChanged();
+ private:
+ void invalidateFontCaches();
+
protected:
- virtual void geometryChanged(const QRectF &newGeometry,
- const QRectF &oldGeometry);
-
- void mousePressEvent(QMouseEvent *event);
- void mouseMoveEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *event);
- void mouseDoubleClickEvent(QMouseEvent *event);
- void keyPressEvent(QKeyEvent* ev);
+ void geometryChanged(const QRectF &newGeometry,
+ const QRectF &oldGeometry) Q_DECL_OVERRIDE;
+
+ void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent* ev) Q_DECL_OVERRIDE;
#ifndef QT_NO_IM
- void inputMethodEvent(QInputMethodEvent *);
+ void inputMethodEvent(QInputMethodEvent *) Q_DECL_OVERRIDE;
#endif
- void mouseUngrabEvent();
- bool event(QEvent *e);
- void focusOutEvent(QFocusEvent *event);
- void focusInEvent(QFocusEvent *event);
- void timerEvent(QTimerEvent *event);
- QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data);
+ void mouseUngrabEvent() Q_DECL_OVERRIDE;
+ bool event(QEvent *e) Q_DECL_OVERRIDE;
+ void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
+ void focusInEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
+ QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data) Q_DECL_OVERRIDE;
+ void updatePolish();
public Q_SLOTS:
void selectAll();