diff options
author | Lars Knoll <[email protected]> | 2013-10-27 22:32:19 +0100 |
---|---|---|
committer | The Qt Project <[email protected]> | 2013-10-29 14:06:06 +0100 |
commit | 9880e64efa25c1924b95068693ff8664e2f2e121 (patch) | |
tree | d9b577e90e1383645bc796d298d6781be204fe2d /src/qml/compiler/qv4compileddata_p.h | |
parent | 9b18946f22b8fc15a1223378112a53b2089380cf (diff) |
Add a constant table to the compiled data
This will help simplifying and speeding up the moth generated
code.
Change-Id: I1b87c4b25dbfa6ce2e8a0b77e526f7fc063b0de2
Reviewed-by: Simon Hausmann <[email protected]>
Diffstat (limited to 'src/qml/compiler/qv4compileddata_p.h')
-rw-r--r-- | src/qml/compiler/qv4compileddata_p.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/qml/compiler/qv4compileddata_p.h b/src/qml/compiler/qv4compileddata_p.h index 2c0a46f3c5..eda9751980 100644 --- a/src/qml/compiler/qv4compileddata_p.h +++ b/src/qml/compiler/qv4compileddata_p.h @@ -160,6 +160,8 @@ struct Unit uint offsetToLookupTable; uint regexpTableSize; uint offsetToRegexpTable; + uint constantTableSize; + uint offsetToConstantTable; uint jsClassTableSize; uint offsetToJSClassTable; qint32 indexOfRootFunction; @@ -186,6 +188,9 @@ struct Unit const RegExp *regexpAt(int index) const { return reinterpret_cast<const RegExp*>(reinterpret_cast<const char *>(this) + offsetToRegexpTable + index * sizeof(RegExp)); } + const QV4::SafeValue *constants() const { + return reinterpret_cast<const QV4::SafeValue*>(reinterpret_cast<const char *>(this) + offsetToConstantTable); + } const JSClassMember *jsClassAt(int idx, int *nMembers) const { const uint *offsetTable = reinterpret_cast<const uint *>(reinterpret_cast<const char *>(this) + offsetToJSClassTable); @@ -196,11 +201,12 @@ struct Unit return reinterpret_cast<const JSClassMember*>(ptr + sizeof(JSClass)); } - static int calculateSize(uint headerSize, uint nStrings, uint nFunctions, uint nRegExps, + static int calculateSize(uint headerSize, uint nStrings, uint nFunctions, uint nRegExps, uint nConstants, uint nLookups, uint nClasses) { return (headerSize + (nStrings + nFunctions + nClasses) * sizeof(uint) + nRegExps * RegExp::calculateSize() + + nConstants * sizeof(QV4::ReturnedValue) + nLookups * Lookup::calculateSize() + 7) & ~7; } }; |