aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/3rdparty/masm/stubs/Options.cpp2
-rw-r--r--src/qml/compiler/qv4isel_moth.cpp2
-rw-r--r--src/qml/compiler/qv4ssa.cpp8
-rw-r--r--src/qml/jit/qv4isel_masm.cpp4
-rw-r--r--src/qml/jit/qv4regalloc.cpp2
-rw-r--r--src/qml/jsruntime/qv4engine.cpp2
-rw-r--r--src/qml/memory/qv4mm.cpp49
-rw-r--r--src/qml/qml/qqmlglobal_p.h10
-rw-r--r--src/qml/qml/qqmlimport.cpp4
9 files changed, 52 insertions, 31 deletions
diff --git a/src/3rdparty/masm/stubs/Options.cpp b/src/3rdparty/masm/stubs/Options.cpp
index 3b13e32218..76da55c387 100644
--- a/src/3rdparty/masm/stubs/Options.cpp
+++ b/src/3rdparty/masm/stubs/Options.cpp
@@ -40,7 +40,7 @@ namespace JSC {
bool Options::showDisassembly()
{
- static bool showCode = !qgetenv("QV4_SHOW_ASM").isNull();
+ static const bool showCode = qEnvironmentVariableIsSet("QV4_SHOW_ASM");
return showCode;
}
diff --git a/src/qml/compiler/qv4isel_moth.cpp b/src/qml/compiler/qv4isel_moth.cpp
index ede1e6938f..0dae4d7696 100644
--- a/src/qml/compiler/qv4isel_moth.cpp
+++ b/src/qml/compiler/qv4isel_moth.cpp
@@ -350,7 +350,7 @@ void InstructionSelection::run(int functionIndex)
opt.run(qmlEngine, useTypeInference, /*peelLoops =*/ false);
if (opt.isInSSA()) {
static const bool doStackSlotAllocation =
- qgetenv("QV4_NO_INTERPRETER_STACK_SLOT_ALLOCATION").isEmpty();
+ qEnvironmentVariableIsEmpty("QV4_NO_INTERPRETER_STACK_SLOT_ALLOCATION");
if (doStackSlotAllocation) {
AllocateStackSlots(opt.lifeTimeIntervals()).forFunction(_function);
diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp
index 2b0383beec..449caeebb5 100644
--- a/src/qml/compiler/qv4ssa.cpp
+++ b/src/qml/compiler/qv4ssa.cpp
@@ -69,7 +69,7 @@ enum { DoVerification = 1 };
static void showMeTheCode(IR::Function *function, const char *marker)
{
- static bool showCode = !qgetenv("QV4_SHOW_IR").isNull();
+ static const bool showCode = qEnvironmentVariableIsSet("QV4_SHOW_IR");
if (showCode) {
qDebug() << marker;
QBuffer buf;
@@ -3899,7 +3899,7 @@ bool tryOptimizingComparison(Expr *&expr)
void cfg2dot(IR::Function *f, const QVector<LoopDetection::LoopInfo *> &loops = QVector<LoopDetection::LoopInfo *>())
{
- static bool showCode = !qgetenv("QV4_SHOW_IR").isNull();
+ static const bool showCode = qEnvironmentVariableIsSet("QV4_SHOW_IR");
if (!showCode)
return;
@@ -5198,7 +5198,7 @@ void Optimizer::run(QQmlEnginePrivate *qmlEngine, bool doTypeInference, bool pee
// showMeTheCode(function);
- static bool doSSA = qgetenv("QV4_NO_SSA").isEmpty();
+ static bool doSSA = qEnvironmentVariableIsEmpty("QV4_NO_SSA");
if (!function->hasTry && !function->hasWith && !function->module->debugMode && doSSA) {
// qout << "SSA for " << (function->name ? qPrintable(*function->name) : "<anonymous>") << endl;
@@ -5266,7 +5266,7 @@ void Optimizer::run(QQmlEnginePrivate *qmlEngine, bool doTypeInference, bool pee
verifyNoPointerSharing(function);
}
- static bool doOpt = qgetenv("QV4_NO_OPT").isEmpty();
+ static const bool doOpt = qEnvironmentVariableIsEmpty("QV4_NO_OPT");
if (doOpt) {
// qout << "Running SSA optimization..." << endl;
worklist.reset();
diff --git a/src/qml/jit/qv4isel_masm.cpp b/src/qml/jit/qv4isel_masm.cpp
index 782b0c8659..9696f59e7c 100644
--- a/src/qml/jit/qv4isel_masm.cpp
+++ b/src/qml/jit/qv4isel_masm.cpp
@@ -185,7 +185,7 @@ JSC::MacroAssemblerCodeRef Assembler::link(int *codeSize)
JSC::MacroAssemblerCodeRef codeRef;
- static bool showCode = !qgetenv("QV4_SHOW_ASM").isNull();
+ static const bool showCode = qEnvironmentVariableIsSet("QV4_SHOW_ASM");
if (showCode) {
QBuffer buf;
buf.open(QIODevice::WriteOnly);
@@ -275,7 +275,7 @@ void InstructionSelection::run(int functionIndex)
IR::Optimizer opt(_function);
opt.run(qmlEngine);
- static const bool withRegisterAllocator = qgetenv("QV4_NO_REGALLOC").isEmpty();
+ static const bool withRegisterAllocator = qEnvironmentVariableIsEmpty("QV4_NO_REGALLOC");
if (Assembler::RegAllocIsSupported && opt.isInSSA() && withRegisterAllocator) {
RegisterAllocator regalloc(Assembler::getRegisterInfo());
regalloc.run(_function, opt);
diff --git a/src/qml/jit/qv4regalloc.cpp b/src/qml/jit/qv4regalloc.cpp
index b9178c0ea0..e980f181c2 100644
--- a/src/qml/jit/qv4regalloc.cpp
+++ b/src/qml/jit/qv4regalloc.cpp
@@ -1323,7 +1323,7 @@ void RegisterAllocator::run(IR::Function *function, const Optimizer &opt)
if (DebugRegAlloc)
qDebug() << "*** Finished regalloc , result:";
- static bool showCode = !qgetenv("QV4_SHOW_IR").isNull();
+ static const bool showCode = qEnvironmentVariableIsSet("QV4_SHOW_IR");
if (showCode) {
QBuffer buf;
buf.open(QIODevice::WriteOnly);
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index 82d94f569e..e31d9b1481 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -218,7 +218,7 @@ ExecutionEngine::ExecutionEngine(EvalISelFactory *factory)
if (!factory) {
#ifdef V4_ENABLE_JIT
- static const bool forceMoth = !qgetenv("QV4_FORCE_INTERPRETER").isEmpty();
+ static const bool forceMoth = !qEnvironmentVariableIsEmpty("QV4_FORCE_INTERPRETER");
if (forceMoth)
factory = new Moth::ISelFactory;
else
diff --git a/src/qml/memory/qv4mm.cpp b/src/qml/memory/qv4mm.cpp
index 0887e43441..5181bf912b 100644
--- a/src/qml/memory/qv4mm.cpp
+++ b/src/qml/memory/qv4mm.cpp
@@ -70,6 +70,36 @@ using namespace WTF;
QT_BEGIN_NAMESPACE
+static uint maxShiftValue()
+{
+ static uint result = 0;
+ if (!result) {
+ result = 6;
+ if (Q_UNLIKELY(qEnvironmentVariableIsSet("QV4_MM_MAXBLOCK_SHIFT"))) {
+ bool ok;
+ const uint overrideValue = qgetenv("QV4_MM_MAXBLOCK_SHIFT").toUInt(&ok);
+ if (ok && overrideValue <= 11 && overrideValue > 0)
+ result = overrideValue;
+ }
+ }
+ return result;
+}
+
+static std::size_t maxChunkSizeValue()
+{
+ static std::size_t result = 0;
+ if (!result) {
+ result = 32 * 1024;
+ if (Q_UNLIKELY(qEnvironmentVariableIsSet("QV4_MM_MAX_CHUNK_SIZE"))) {
+ bool ok;
+ const std::size_t overrideValue = qgetenv("QV4_MM_MAX_CHUNK_SIZE").toUInt(&ok);
+ if (ok)
+ result = overrideValue;
+ }
+ }
+ return result;
+}
+
using namespace QV4;
struct MemoryManager::Data
@@ -120,11 +150,13 @@ struct MemoryManager::Data
Data()
: gcBlocked(false)
+ , aggressiveGC(!qEnvironmentVariableIsEmpty("QV4_MM_AGGRESSIVE_GC"))
+ , gcStats(!qEnvironmentVariableIsEmpty("QV4_MM_STATS"))
, engine(0)
, totalItems(0)
, totalAlloc(0)
- , maxShift(6)
- , maxChunkSize(32*1024)
+ , maxShift(maxShiftValue())
+ , maxChunkSize(maxChunkSizeValue())
, unmanagedHeapSize(0)
, unmanagedHeapSizeGCLimit(MIN_UNMANAGED_HEAPSIZE_GC_LIMIT)
, largeItems(0)
@@ -134,19 +166,6 @@ struct MemoryManager::Data
memset(nChunks, 0, sizeof(nChunks));
memset(availableItems, 0, sizeof(availableItems));
memset(allocCount, 0, sizeof(allocCount));
- aggressiveGC = !qgetenv("QV4_MM_AGGRESSIVE_GC").isEmpty();
- gcStats = !qgetenv("QV4_MM_STATS").isEmpty();
-
- QByteArray overrideMaxShift = qgetenv("QV4_MM_MAXBLOCK_SHIFT");
- bool ok;
- uint override = overrideMaxShift.toUInt(&ok);
- if (ok && override <= 11 && override > 0)
- maxShift = override;
-
- QByteArray maxChunkString = qgetenv("QV4_MM_MAX_CHUNK_SIZE");
- std::size_t tmpMaxChunkSize = maxChunkString.toUInt(&ok);
- if (ok)
- maxChunkSize = tmpMaxChunkSize;
}
~Data()
diff --git a/src/qml/qml/qqmlglobal_p.h b/src/qml/qml/qqmlglobal_p.h
index b7212648ab..23cfc24e7a 100644
--- a/src/qml/qml/qqmlglobal_p.h
+++ b/src/qml/qml/qqmlglobal_p.h
@@ -59,10 +59,12 @@ QT_BEGIN_NAMESPACE
{ \
static enum { Yes, No, Unknown } status = Unknown; \
if (status == Unknown) { \
- QByteArray v = qgetenv(#var); \
- bool value = !v.isEmpty() && v != "0" && v != "false"; \
- if (value) status = Yes; \
- else status = No; \
+ status = No; \
+ if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty(#var))) { \
+ const QByteArray v = qgetenv(#var); \
+ if (v != "0" && v != "false") \
+ status = Yes; \
+ } \
} \
return status == Yes; \
}
diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp
index 8f73732615..f6f8c6e51e 100644
--- a/src/qml/qml/qqmlimport.cpp
+++ b/src/qml/qml/qqmlimport.cpp
@@ -1562,8 +1562,8 @@ QQmlImportDatabase::QQmlImportDatabase(QQmlEngine *e)
addImportPath(installImportsPath);
// env import paths
- QByteArray envImportPath = qgetenv("QML2_IMPORT_PATH");
- if (!envImportPath.isEmpty()) {
+ if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty("QML2_IMPORT_PATH"))) {
+ const QByteArray envImportPath = qgetenv("QML2_IMPORT_PATH");
#if defined(Q_OS_WIN)
QLatin1Char pathSep(';');
#else