diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-11-21 13:15:46 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-12-04 09:45:45 +0100 |
commit | fbcd0a22f643f0b0ec1404507d63bdf35cd9a195 (patch) | |
tree | b759029b5ca0f9db8d3bf1863ca319a92edb6baf /src/qml/jsruntime/qv4internalclass_p.h | |
parent | 5e8bee55aa78551c2d31b24228227c0bbbdc1d8d (diff) |
Move the vtable pointer from the object to the internal class
This saves one pointer per object, and willmake other optimizations
easier in the future.
Change-Id: I1324cad31998896b5dc76af3c8a7ee9d86283bfe
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4internalclass_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4internalclass_p.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4internalclass_p.h b/src/qml/jsruntime/qv4internalclass_p.h index 9586637b32..621a6abc99 100644 --- a/src/qml/jsruntime/qv4internalclass_p.h +++ b/src/qml/jsruntime/qv4internalclass_p.h @@ -53,6 +53,7 @@ struct String; struct ExecutionEngine; struct Object; struct Identifier; +struct ManagedVTable; struct PropertyHashData; struct PropertyHash @@ -198,9 +199,14 @@ struct InternalClassTransition union { Identifier *id; Object *prototype; + const ManagedVTable *vtable; }; int flags; - enum { ProtoChange = 0x100 }; + enum { + // range 0-0xff is reserved for attribute changes + ProtoChange = 0x100, + VTableChange = 0x200 + }; bool operator==(const InternalClassTransition &other) const { return id == other.id && flags == other.flags; } @@ -210,6 +216,8 @@ uint qHash(const QV4::InternalClassTransition &t, uint = 0); struct InternalClass { ExecutionEngine *engine; Object *prototype; + const ManagedVTable *vtable; + PropertyHash propertyTable; // id to valueIndex SharedInternalClassData<String *> nameMap; SharedInternalClassData<PropertyAttributes> propertyData; @@ -223,6 +231,7 @@ struct InternalClass { uint size; InternalClass *changePrototype(Object *proto); + InternalClass *changeVTable(const ManagedVTable *vt); InternalClass *addMember(StringRef string, PropertyAttributes data, uint *index = 0); InternalClass *addMember(String *string, PropertyAttributes data, uint *index = 0); InternalClass *changeMember(String *string, PropertyAttributes data, uint *index = 0); @@ -238,7 +247,7 @@ struct InternalClass { private: friend struct ExecutionEngine; - InternalClass(ExecutionEngine *engine) : engine(engine), prototype(0), m_sealed(0), m_frozen(0), size(0) {} + InternalClass(ExecutionEngine *engine); InternalClass(const InternalClass &other); }; |