aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4engine_p.h
diff options
context:
space:
mode:
authorMikhail Svetkin <mikhail.svetkin@qt.io>2019-06-27 13:43:04 +0200
committerMikhail Svetkin <mikhail.svetkin@qt.io>2019-06-28 12:50:29 +0200
commit239217239499017b4d6864f90ea7c23d31d608f6 (patch)
tree27e92dc98e845f9fbf2414d22907a598133adf28 /src/qml/jsruntime/qv4engine_p.h
parent2fbf9d0acf4b343c05ed0cec177a35d356a06b4b (diff)
Add environment variable for configure maxJSStackSize and maxGCStackSize
QMLEngine by default allocates 4 MB for javascript stack and garbage collection stack takes 2 MB. It is a lot of memory for platforms without virtual memory. Change-Id: I1575dd9584898dca33df66704f716c7b5a7c01c1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4engine_p.h')
-rw-r--r--src/qml/jsruntime/qv4engine_p.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h
index f8ac0e0268..ce25ab16b1 100644
--- a/src/qml/jsruntime/qv4engine_p.h
+++ b/src/qml/jsruntime/qv4engine_p.h
@@ -170,10 +170,6 @@ public:
WTF::BumpPointerAllocator *bumperPointerAllocator; // Used by Yarr Regex engine.
- enum {
- JSStackLimit = 4*1024*1024,
- GCStackLimit = 2*1024*1024
- };
WTF::PageAllocation *jsStack;
WTF::PageAllocation *gcStack;
@@ -641,6 +637,9 @@ public:
bool metaTypeFromJS(const Value *value, int type, void *data);
QV4::ReturnedValue metaTypeToJS(int type, const void *data);
+ int maxJSStackSize() const;
+ int maxGCStackSize() const;
+
bool checkStackLimits();
bool canJIT(Function *f = nullptr)
@@ -734,6 +733,9 @@ private:
QHash<QString, quint32> m_consoleCount;
QVector<Deletable *> m_extensionData;
+
+ int m_maxJSStackSize = 4 * 1024 * 1024;
+ int m_maxGCStackSize = 2 * 1024 * 1024;
};
#define CHECK_STACK_LIMITS(v4) if ((v4)->checkStackLimits()) return Encode::undefined(); \