Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qv4engine.cpp File Reference

(8b6a9403bf2e04d34b9b07d2780186029fab99d0)

#include <qv4engine_p.h>
#include <private/qv4compileddata_p.h>
#include <private/qv4codegen_p.h>
#include <private/qqmljsdiagnosticmessage_p.h>
#include <QtCore/QTextStream>
#include <QDateTime>
#include <QDir>
#include <QFileInfo>
#include <QLoggingCategory>
#include <QtCore/QTimeZone>
#include <QtCore/qiterable.h>
#include <qv4qmlcontext_p.h>
#include <qv4value_p.h>
#include <qv4object_p.h>
#include <qv4objectproto_p.h>
#include <qv4objectiterator_p.h>
#include <qv4setiterator_p.h>
#include <qv4mapiterator_p.h>
#include <qv4arrayiterator_p.h>
#include <qv4arrayobject_p.h>
#include <qv4booleanobject_p.h>
#include <qv4globalobject_p.h>
#include <qv4errorobject_p.h>
#include <qv4functionobject_p.h>
#include "qv4function_p.h"
#include <qv4mathobject_p.h>
#include <qv4numberobject_p.h>
#include <qv4regexpobject_p.h>
#include <qv4regexp_p.h>
#include "qv4symbol_p.h"
#include "qv4setobject_p.h"
#include "qv4mapobject_p.h"
#include <qv4variantobject_p.h>
#include <qv4runtime_p.h>
#include <private/qv4mm_p.h>
#include <qv4argumentsobject_p.h>
#include <qv4dateobject_p.h>
#include <qv4jsonobject_p.h>
#include <qv4stringobject_p.h>
#include <qv4identifiertable_p.h>
#include "qv4debugging_p.h"
#include "qv4profiling_p.h"
#include "qv4executableallocator_p.h"
#include "qv4iterator_p.h"
#include "qv4stringiterator_p.h"
#include "qv4generatorobject_p.h"
#include "qv4reflect_p.h"
#include "qv4proxy_p.h"
#include "qv4stackframe_p.h"
#include "qv4stacklimits_p.h"
#include "qv4atomics_p.h"
#include "qv4urlobject_p.h"
#include "qv4sequenceobject_p.h"
#include "qv4qobjectwrapper_p.h"
#include "qv4qmetaobjectwrapper_p.h"
#include "qv4memberdata_p.h"
#include "qv4arraybuffer_p.h"
#include "qv4dataview_p.h"
#include "qv4promiseobject_p.h"
#include "qv4typedarray_p.h"
#include <private/qjsvalue_p.h>
#include <private/qqmltypewrapper_p.h>
#include <private/qqmlvaluetypewrapper_p.h>
#include <private/qqmlvaluetype_p.h>
#include <private/qqmllistwrapper_p.h>
#include <private/qqmllist_p.h>
#include <private/qqmltypeloader_p.h>
#include <private/qqmlbuiltinfunctions_p.h>
#include <private/qv4sqlerrors_p.h>
#include <qqmlfile.h>
#include <qmetatype.h>
#include <qsequentialiterable.h>
#include <private/qqmlengine_p.h>

Go to the source code of this file.

Classes

struct  JSArrayIterator
 
struct  QV4EngineRegistrationData
 

Typedefs

typedef QSet< QV4::Heap::Object * > V4ObjectSet
 

Enumerations

enum class  JSToQVariantConversionBehavior { Never , Safish , Aggressive }
 

Functions

QT_BEGIN_NAMESPACE DEFINE_BOOL_CONFIG_OPTION (disableDiskCache, QML_DISABLE_DISK_CACHE)
 
 DEFINE_BOOL_CONFIG_OPTION (forceDiskCache, QML_FORCE_DISK_CACHE)
 
ReturnedValue throwTypeError (const FunctionObject *b, const QV4::Value *, const QV4::Value *, int)
 
template<typename ReturnType >
ReturnType convertJSValueToVariantType (const QJSValue &value)
 
static QtMetaContainerPrivate::QMetaSequenceInterface emptySequenceInterface ()
 
static QtMetaContainerPrivate::QMetaSequenceInterface sequenceInterface ()
 
static QSequentialIterable jsvalueToSequence (const QJSValue &value)
 
static char * v4StackTrace (const ExecutionContext *context)
 
Q_QML_EXPORT char * qt_v4StackTrace (void *executionContext)
 
Q_QML_EXPORT char * qt_v4StackTraceForEngine (void *executionEngine)
 
static QVariant toVariant (const QV4::Value &value, QMetaType typeHint, JSToQVariantConversionBehavior conversionBehavior, V4ObjectSet *visitedObjects)
 
static QObjectqtObjectFromJS (const QV4::Value &value)
 
static QVariant objectToVariant (const QV4::Object *o, V4ObjectSet *visitedObjects=nullptr, JSToQVariantConversionBehavior behavior=JSToQVariantConversionBehavior::Safish)
 
static bool convertToNativeQObject (const QV4::Value &value, QMetaType targetType, void **result)
 
static QV4::ReturnedValue variantMapToJS (QV4::ExecutionEngine *v4, const QVariantMap &vmap)
 
static QV4::ReturnedValue variantToJS (QV4::ExecutionEngine *v4, const QVariant &value)
 
static QVariantMap objectToVariantMap (const QV4::Object *o, V4ObjectSet *visitedObjects, JSToQVariantConversionBehavior conversionBehvior)
 
static ExecutionEngine::DiskCacheOptions transFormDiskCache (const char *v)
 
static void freeze_recursive (QV4::ExecutionEngine *v4, QV4::Object *object)
 
template<typename Source >
bool convertToIterable (QMetaType metaType, void *data, Source *sequence)
 
 Q_GLOBAL_STATIC (QV4EngineRegistrationData, registrationData)
 

Variables

static QBasicAtomicInt engineSerial = Q_BASIC_ATOMIC_INITIALIZER(1)
 

Typedef Documentation

◆ V4ObjectSet

typedef QSet<QV4::Heap::Object *> V4ObjectSet

Definition at line 1484 of file qv4engine.cpp.

Enumeration Type Documentation

◆ JSToQVariantConversionBehavior

enum class JSToQVariantConversionBehavior
strong
Enumerator
Never 
Safish 
Aggressive 

Definition at line 1485 of file qv4engine.cpp.

Function Documentation

◆ convertJSValueToVariantType()

template<typename ReturnType >
ReturnType convertJSValueToVariantType ( const QJSValue & value)

Definition at line 122 of file qv4engine.cpp.

References QVariant::metaType(), QVariant::value(), and variant.

+ Here is the call graph for this function:

◆ convertToIterable()

template<typename Source >
bool convertToIterable ( QMetaType metaType,
void * data,
Source * sequence )

Definition at line 2474 of file qv4engine.cpp.

References QSequentialIterable::AtEnd, QVariant::data(), i, QV4::ExecutionEngine::metaTypeFromJS(), and QMetaType::view().

Referenced by QV4::ExecutionEngine::metaTypeFromJS().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ convertToNativeQObject()

static bool convertToNativeQObject ( const QV4::Value & value,
QMetaType targetType,
void ** result )
static

Definition at line 2823 of file qv4engine.cpp.

References className, QMetaType::flags(), QMetaType::IsPointer, QMetaType::metaObject(), QMetaType::name(), and qtObjectFromJS().

Referenced by QV4::ExecutionEngine::metaTypeFromJS().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DEFINE_BOOL_CONFIG_OPTION() [1/2]

QT_BEGIN_NAMESPACE DEFINE_BOOL_CONFIG_OPTION ( disableDiskCache ,
QML_DISABLE_DISK_CACHE  )

◆ DEFINE_BOOL_CONFIG_OPTION() [2/2]

DEFINE_BOOL_CONFIG_OPTION ( forceDiskCache ,
QML_FORCE_DISK_CACHE  )

◆ emptySequenceInterface()

static QtMetaContainerPrivate::QMetaSequenceInterface emptySequenceInterface ( )
static

Definition at line 142 of file qv4engine.cpp.

Referenced by jsvalueToSequence().

+ Here is the caller graph for this function:

◆ freeze_recursive()

static void freeze_recursive ( QV4::ExecutionEngine * v4,
QV4::Object * object )
static

Definition at line 2344 of file qv4engine.cpp.

References freeze_recursive(), i, QV4::Managed::internalClass(), QV4::Heap::Base::internalClass, QV4::Heap::InternalClass::isFrozen(), QV4::Heap::InternalClass::nameMap, o, QV4::ExecutionEngine::objectPrototype(), and QV4::Heap::InternalClass::size.

Referenced by freeze_recursive(), and QV4::ExecutionEngine::freezeObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ jsvalueToSequence()

static QSequentialIterable jsvalueToSequence ( const QJSValue & value)
static

Definition at line 278 of file qv4engine.cpp.

References emptySequenceInterface(), and sequenceInterface().

+ Here is the call graph for this function:

◆ objectToVariant()

static QVariant objectToVariant ( const QV4::Object * o,
V4ObjectSet * visitedObjects = nullptr,
JSToQVariantConversionBehavior behavior = JSToQVariantConversionBehavior::Safish )
static

Definition at line 1718 of file qv4engine.cpp.

References Aggressive, QJSValuePrivate::fromReturnedValue(), QVariant::fromValue(), list, o, objectToVariantMap(), Q_ASSERT, and toVariant().

Referenced by toVariant().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ objectToVariantMap()

static QVariantMap objectToVariantMap ( const QV4::Object * o,
V4ObjectSet * visitedObjects,
JSToQVariantConversionBehavior conversionBehvior )
static

Definition at line 1697 of file qv4engine.cpp.

References QV4::ObjectIterator::EnumerableOnly, QMap< Key, T >::insert(), it, map, o, and toVariant().

Referenced by objectToVariant(), and QV4::ExecutionEngine::variantMapFromJS().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Q_GLOBAL_STATIC()

Q_GLOBAL_STATIC ( QV4EngineRegistrationData ,
registrationData  )

◆ qt_v4StackTrace()

Q_QML_EXPORT char * qt_v4StackTrace ( void * executionContext)

Definition at line 1286 of file qv4engine.cpp.

References v4StackTrace().

+ Here is the call graph for this function:

◆ qt_v4StackTraceForEngine()

Q_QML_EXPORT char * qt_v4StackTraceForEngine ( void * executionEngine)

Definition at line 1291 of file qv4engine.cpp.

References engine, and v4StackTrace().

+ Here is the call graph for this function:

◆ qtObjectFromJS()

static QObject * qtObjectFromJS ( const QV4::Value & value)
static

Definition at line 2850 of file qv4engine.cpp.

References QVariant::constData(), QVariant::d, QVariant::Private::data, QV4::Managed::engine(), QVariant::userType(), variant, and wrapper().

Referenced by convertToNativeQObject(), and QV4::ExecutionEngine::metaTypeFromJS().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sequenceInterface()

static QtMetaContainerPrivate::QMetaSequenceInterface sequenceInterface ( )
static

Definition at line 164 of file qv4engine.cpp.

References JSArrayIterator::data, QV4::Object::DoNotThrow, QJSValuePrivate::engine(), QV4::Scope::engine, QString::fromLatin1(), QV4::ExecutionEngine::fromVariant(), JSArrayIterator::index, other(), pos, property, toInt(), and toVariant().

Referenced by jsvalueToSequence().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ throwTypeError()

ReturnedValue throwTypeError ( const FunctionObject * b,
const QV4::Value * ,
const QV4::Value * ,
int  )

Definition at line 115 of file qv4engine.cpp.

◆ toVariant()

static QVariant toVariant ( const QV4::Value & value,
QMetaType typeHint,
JSToQVariantConversionBehavior conversionBehavior,
V4ObjectSet * visitedObjects )
static

Definition at line 1499 of file qv4engine.cpp.

References QLatin1StringView::arg(), QV4::Value::as(), QV4::StaticValue::asReturnedValue(), QString::at(), QMetaType::canConvert(), QVariant::constData(), QVariant::convert(), QQmlValueTypeProvider::createValueType(), d, QV4::DateObject::dateTimeToDate(), QMetaType::flags(), QJSValuePrivate::fromReturnedValue(), QMetaType::fromType(), QString::fromUtf8(), QVariant::fromValue(), i, QMetaType::isValid(), QVariant::isValid(), list, QVariant::metaType(), QMetaType::name(), Never, QString::number(), o, objectToVariant(), QMetaType::PointerToQObject, Q_ASSERT, qWarning, QString::size(), str, QV4::Value::stringValue(), QV4::symbol(), QV4::JsonObject::toJsonArray(), QV4::JsonObject::toJsonObject(), QV4::JsonObject::toJsonValue(), toVariant(), QV4::SequencePrototype::toVariant(), and wrapper().

Referenced by QV4::Heap::DECLARE_HEAP_OBJECT(), QV4::Heap::DECLARE_HEAP_OBJECT(), objectToVariant(), objectToVariantMap(), DynamicRoleModelNodeMetaObject::propertyWritten(), QQuickTableViewPrivate::qaim(), QQmlSettingsPrivate::readProperty(), sequenceInterface(), QQmlListAccessor::setList(), QQuickItemView::setModel(), QQuickPathView::setModel(), QQuickRepeater::setModel(), QQuick3DRepeater::setModel(), QQuickComboBox::setModel(), QQuickTreeViewPrivate::setModelImpl(), QQuickTableViewPrivate::syncModel(), toVariant(), and DynamicRoleModelNode::updateValues().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ transFormDiskCache()

static ExecutionEngine::DiskCacheOptions transFormDiskCache ( const char * v)
static

Definition at line 2210 of file qv4engine.cpp.

References QByteArray(), and qWarning.

Referenced by QV4::ExecutionEngine::diskCacheOptions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ v4StackTrace()

static char * v4StackTrace ( const ExecutionContext * context)
inlinestatic

Definition at line 1265 of file qv4engine.cpp.

References context, fileName, i, QUrl::isLocalFile(), qAbs(), qstrdup(), str, QUrl::toLocalFile(), QUrl::toString(), and url.

Referenced by qt_v4StackTrace(), and qt_v4StackTraceForEngine().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ variantMapToJS()

static QV4::ReturnedValue variantMapToJS ( QV4::ExecutionEngine * v4,
const QVariantMap & vmap )
static

Definition at line 1989 of file qv4engine.cpp.

References QSet< T >::constBegin(), it, QV4::ExecutionEngine::newIdentifier(), QV4::ExecutionEngine::newObject(), o, and variantToJS().

Referenced by QV4::ExecutionEngine::fromData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ variantToJS()

static QV4::ReturnedValue variantToJS ( QV4::ExecutionEngine * v4,
const QVariant & value )
static

Definition at line 1494 of file qv4engine.cpp.

References QV4::ExecutionEngine::metaTypeToJS().

Referenced by variantMapToJS().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ engineSerial

QBasicAtomicInt engineSerial = Q_BASIC_ATOMIC_INITIALIZER(1)
static

Definition at line 109 of file qv4engine.cpp.

Referenced by QV4::ExecutionEngine::ExecutionEngine().