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
qv4typedarray.cpp File Reference

(8b6a9403bf2e04d34b9b07d2780186029fab99d0)

#include "qv4typedarray_p.h"
#include "qv4arrayiterator_p.h"
#include "qv4arraybuffer_p.h"
#include "qv4symbol_p.h"
#include "qv4runtime_p.h"
#include <QtCore/qatomic.h>
#include <cmath>
+ Include dependency graph for qv4typedarray.cpp:

Go to the source code of this file.

Classes

struct  ClampedUInt8
 
struct  TypedArrayOwnPropertyKeyIterator
 

Functions

 DEFINE_OBJECT_VTABLE (IntrinsicTypedArrayCtor)
 
 DEFINE_OBJECT_VTABLE (IntrinsicTypedArrayPrototype)
 
 DEFINE_OBJECT_VTABLE (TypedArrayCtor)
 
 DEFINE_OBJECT_VTABLE (TypedArrayPrototype)
 
 DEFINE_OBJECT_VTABLE (TypedArray)
 
 Q_STATIC_ASSERT ((int) ExecutionEngine::NTypedArrayTypes==(int) NTypedArrayTypes)
 
static int toInt32 (Value v)
 
static double toDouble (Value v)
 
template<typename T >
ReturnedValue typeToValue (T t)
 
template<>
ReturnedValue typeToValue (ClampedUInt8 t)
 
template<typename T >
valueToType (Value value)
 
template<>
ClampedUInt8 valueToType (Value value)
 
template<>
float valueToType (Value value)
 
template<>
double valueToType (Value value)
 
template<typename T >
ReturnedValue read (const char *data)
 
template<typename T >
void write (char *data, Value value)
 
template<typename T >
ReturnedValue atomicAdd (char *data, Value v)
 
template<typename T >
ReturnedValue atomicAnd (char *data, Value v)
 
template<typename T >
ReturnedValue atomicExchange (char *data, Value v)
 
template<typename T >
ReturnedValue atomicOr (char *data, Value v)
 
template<typename T >
ReturnedValue atomicSub (char *data, Value v)
 
template<typename T >
ReturnedValue atomicXor (char *data, Value v)
 
template<typename T >
ReturnedValue atomicCompareExchange (char *data, Value expected, Value v)
 
template<typename T >
ReturnedValue atomicLoad (char *data)
 
template<typename T >
ReturnedValue atomicStore (char *data, Value v)
 
static TypedArraytypedArraySpeciesCreate (Scope &scope, const TypedArray *instance, uint len)
 
static bool validateTypedArray (const Object *o)
 

Variables

const TypedArrayOperations operations [NTypedArrayTypes]
 

Function Documentation

◆ atomicAdd()

template<typename T >
ReturnedValue atomicAdd ( char * data,
Value v )

Definition at line 111 of file qv4typedarray.cpp.

References QAtomicOps< X >::fetchAndAddOrdered(), and typeToValue().

+ Here is the call graph for this function:

◆ atomicAnd()

template<typename T >
ReturnedValue atomicAnd ( char * data,
Value v )

Definition at line 120 of file qv4typedarray.cpp.

References QAtomicOps< X >::fetchAndAndOrdered(), and typeToValue().

+ Here is the call graph for this function:

◆ atomicCompareExchange()

template<typename T >
ReturnedValue atomicCompareExchange ( char * data,
Value expected,
Value v )

Definition at line 165 of file qv4typedarray.cpp.

References expected, QAtomicOps< X >::testAndSetOrdered(), and typeToValue().

+ Here is the call graph for this function:

◆ atomicExchange()

template<typename T >
ReturnedValue atomicExchange ( char * data,
Value v )

Definition at line 129 of file qv4typedarray.cpp.

References QAtomicOps< X >::fetchAndStoreOrdered(), and typeToValue().

+ Here is the call graph for this function:

◆ atomicLoad()

template<typename T >
ReturnedValue atomicLoad ( char * data)

Definition at line 176 of file qv4typedarray.cpp.

References QAtomicOps< X >::loadRelaxed(), and typeToValue().

+ Here is the call graph for this function:

◆ atomicOr()

template<typename T >
ReturnedValue atomicOr ( char * data,
Value v )

Definition at line 138 of file qv4typedarray.cpp.

References QAtomicOps< X >::fetchAndOrOrdered(), and typeToValue().

+ Here is the call graph for this function:

◆ atomicStore()

template<typename T >
ReturnedValue atomicStore ( char * data,
Value v )

Definition at line 184 of file qv4typedarray.cpp.

References QAtomicOps< X >::storeRelaxed(), and typeToValue().

+ Here is the call graph for this function:

◆ atomicSub()

template<typename T >
ReturnedValue atomicSub ( char * data,
Value v )

Definition at line 147 of file qv4typedarray.cpp.

References QAtomicOps< X >::fetchAndSubOrdered(), and typeToValue().

+ Here is the call graph for this function:

◆ atomicXor()

template<typename T >
ReturnedValue atomicXor ( char * data,
Value v )

Definition at line 156 of file qv4typedarray.cpp.

References QAtomicOps< X >::fetchAndXorOrdered(), and typeToValue().

+ Here is the call graph for this function:

◆ DEFINE_OBJECT_VTABLE() [1/5]

DEFINE_OBJECT_VTABLE ( IntrinsicTypedArrayCtor )

◆ DEFINE_OBJECT_VTABLE() [2/5]

DEFINE_OBJECT_VTABLE ( IntrinsicTypedArrayPrototype )

◆ DEFINE_OBJECT_VTABLE() [3/5]

DEFINE_OBJECT_VTABLE ( TypedArray )

◆ DEFINE_OBJECT_VTABLE() [4/5]

DEFINE_OBJECT_VTABLE ( TypedArrayCtor )

◆ DEFINE_OBJECT_VTABLE() [5/5]

DEFINE_OBJECT_VTABLE ( TypedArrayPrototype )

◆ Q_STATIC_ASSERT()

Q_STATIC_ASSERT ( (int) ExecutionEngine::NTypedArrayTypes = =(int) NTypedArrayTypes)

◆ read()

template<typename T >
ReturnedValue read ( const char * data)

◆ toDouble()

◆ toInt32()

static int toInt32 ( Value v)
inlinestatic

Definition at line 23 of file qv4typedarray.cpp.

References Q_ASSERT.

Referenced by QQmlLocalStorage::openDatabaseSync(), QV4::Value::toUInt32(), and valueToType().

+ Here is the caller graph for this function:

◆ typedArraySpeciesCreate()

static TypedArray * typedArraySpeciesCreate ( Scope & scope,
const TypedArray * instance,
uint len )
static

Definition at line 782 of file qv4typedarray.cpp.

References QV4::Scope::alloc(), arguments, QV4::TypedArray::arrayType(), QV4::FunctionObject::callAsConstructor(), QV4::Scope::engine, QV4::Object::speciesConstructor(), QV4::ExecutionEngine::throwTypeError(), and QV4::ExecutionEngine::typedArrayCtors.

Referenced by QV4::IntrinsicTypedArrayPrototype::method_filter(), QV4::IntrinsicTypedArrayPrototype::method_map(), and QV4::IntrinsicTypedArrayPrototype::method_slice().

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

◆ typeToValue() [1/2]

template<>
ReturnedValue typeToValue ( ClampedUInt8 t)

Definition at line 49 of file qv4typedarray.cpp.

◆ typeToValue() [2/2]

template<typename T >
ReturnedValue typeToValue ( T t)

Definition at line 44 of file qv4typedarray.cpp.

Referenced by atomicAdd(), atomicAnd(), atomicCompareExchange(), atomicExchange(), atomicLoad(), atomicOr(), atomicStore(), atomicSub(), atomicXor(), and read().

+ Here is the caller graph for this function:

◆ validateTypedArray()

static bool validateTypedArray ( const Object * o)
static

Definition at line 1596 of file qv4typedarray.cpp.

References o.

Referenced by QV4::IntrinsicTypedArrayCtor::method_from(), and QV4::IntrinsicTypedArrayCtor::method_of().

+ Here is the caller graph for this function:

◆ valueToType() [1/4]

template<typename T >
T valueToType ( Value value)

Definition at line 54 of file qv4typedarray.cpp.

References Q_ASSERT, and toInt32().

+ Here is the call graph for this function:

◆ valueToType() [2/4]

template<>
ClampedUInt8 valueToType ( Value value)

Definition at line 62 of file qv4typedarray.cpp.

References d, Q_ASSERT, and qBound().

+ Here is the call graph for this function:

◆ valueToType() [3/4]

template<>
float valueToType ( Value value)

Definition at line 86 of file qv4typedarray.cpp.

References d, Q_ASSERT, and toDouble().

+ Here is the call graph for this function:

◆ valueToType() [4/4]

template<>
double valueToType ( Value value)

Definition at line 94 of file qv4typedarray.cpp.

References Q_ASSERT, and toDouble().

+ Here is the call graph for this function:

◆ write()

template<typename T >
void write ( char * data,
Value value )

Definition at line 105 of file qv4typedarray.cpp.

Variable Documentation

◆ operations

const TypedArrayOperations operations[NTypedArrayTypes]
Initial value:
= {
TypedArrayOperations::create<qint8>("Int8Array"),
TypedArrayOperations::create<quint8>("Uint8Array"),
TypedArrayOperations::createWithAtomics<qint16>("Int16Array"),
TypedArrayOperations::createWithAtomics<quint16>("Uint16Array"),
TypedArrayOperations::createWithAtomics<qint32>("Int32Array"),
TypedArrayOperations::createWithAtomics<quint32>("Uint32Array"),
TypedArrayOperations::create<ClampedUInt8>("Uint8ClampedArray"),
TypedArrayOperations::create<float>("Float32Array"),
TypedArrayOperations::create<double>("Float64Array")
}

Definition at line 221 of file qv4typedarray.cpp.

Referenced by QV4::Heap::TypedArrayCtor::init(), QV4::TypedArrayPrototype::init(), and QV4::TypedArrayCtor::virtualCallAsConstructor().