aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4regexp_p.h
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2023-12-19 15:13:55 +0100
committerUlf Hermann <ulf.hermann@qt.io>2024-02-13 13:07:45 +0100
commitece699ddc4d1e1682e39bb0a05346134b8bebee1 (patch)
treec9e0740f9c0a07067974499dbac520f7580bf239 /src/qml/jsruntime/qv4regexp_p.h
parent8a0787f3bbed226785c842e1fd273a5b6dc06a32 (diff)
RegExp: Do on demand JIT compilation
JIT compiling means that we need to obtain executable memory for the jitted code. That has a non-neglibile cost (in addition to the runtime cost of compiling the pattern). Thus, only compile the pattern if we suspect it to be worthwhile: - when we called match multiple times - or when the string we match against is quite large We also assume that the JIT generally works, and thus discard the bytecode immediately before jitting – if the JIT fails once (either to compile, or with offset failure), we recompile the bytecode and never JIT this pattern again. Amends commit 04820be3011395bd5cb13dea8f81c9b9bca4da8f. Change-Id: I7aed4c0fdd85f1c69bc16cb2caa384aeabd62af2 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> Reviewed-by: Semih Yavuz <semih.yavuz@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4regexp_p.h')
-rw-r--r--src/qml/jsruntime/qv4regexp_p.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4regexp_p.h b/src/qml/jsruntime/qv4regexp_p.h
index 1b70354caa..8a178dd2f6 100644
--- a/src/qml/jsruntime/qv4regexp_p.h
+++ b/src/qml/jsruntime/qv4regexp_p.h
@@ -66,6 +66,8 @@ struct RegExp : Base {
int subPatternCount;
uint flags;
bool valid;
+ bool jitFailed;
+ quint8 matchCount;
QString flagsAsString() const;
int captureCount() const { return subPatternCount + 1; }