aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4compileddata_p.h
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2013-08-16 12:36:13 +0200
committerLars Knoll <lars.knoll@digia.com>2013-08-16 16:51:10 +0200
commit85e6b8e9e7e158b5cb4238c2dd5e28406bc913e2 (patch)
tree60607ebe1834a8378375421e946d62fe0e90c1ea /src/qml/compiler/qv4compileddata_p.h
parentd017fe9b38c74d2cc2fa754af3bf9e32357f149c (diff)
Cleanup: Store lookup tables inside the CompilationUnit
The size of each lookup is fixed, so it's easier to include in the unit itself. Change-Id: I66135efe4056eb0b4d7ff312eaa347fe98d8887f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/compiler/qv4compileddata_p.h')
-rw-r--r--src/qml/compiler/qv4compileddata_p.h36
1 files changed, 21 insertions, 15 deletions
diff --git a/src/qml/compiler/qv4compileddata_p.h b/src/qml/compiler/qv4compileddata_p.h
index 0c5bf15c02..7b27d08405 100644
--- a/src/qml/compiler/qv4compileddata_p.h
+++ b/src/qml/compiler/qv4compileddata_p.h
@@ -80,6 +80,20 @@ struct RegExp
static int calculateSize() { return sizeof(RegExp); }
};
+struct Lookup
+{
+ enum Type {
+ Type_Getter = 0x0,
+ Type_Setter = 0x1,
+ Type_GlobalGetter = 2
+ };
+
+ quint32 type_and_flags;
+ quint32 nameIndex;
+
+ static int calculateSize() { return sizeof(Lookup); }
+};
+
static const char magic_str[] = "qv4cdata";
struct Unit
@@ -121,7 +135,13 @@ struct Unit
return reinterpret_cast<const RegExp*>(reinterpret_cast<const char *>(this) + offsetToRegexpTable + index * sizeof(RegExp));
}
- static int calculateSize(uint nStrings, uint nFunctions, uint nRegExps) { return (sizeof(Unit) + (nStrings + nFunctions ) * sizeof(uint) + nRegExps * RegExp::calculateSize() + 7) & ~7; }
+ static int calculateSize(uint nStrings, uint nFunctions, uint nRegExps,
+ uint nLookups) {
+ return (sizeof(Unit)
+ + (nStrings + nFunctions) * sizeof(uint)
+ + nRegExps * RegExp::calculateSize()
+ + nLookups * Lookup::calculateSize()
+ + 7) & ~7; }
};
struct Function
@@ -176,20 +196,6 @@ struct String
}
};
-struct Lookup
-{
- enum Type {
- Type_Getter = 0x0,
- Type_Setter = 0x1,
- Type_GlobalGetter = 2
- };
-
- quint32 type_and_flags;
- quint32 nameIndex;
-
- static int calculateSize() { return sizeof(Lookup); }
-};
-
// Qml data structures
struct Value