V8 Project
v8::internal::FixedTypedArray< Traits > Class Template Reference

#include <objects.h>

+ Inheritance diagram for v8::internal::FixedTypedArray< Traits >:
+ Collaboration diagram for v8::internal::FixedTypedArray< Traits >:

Public Types

typedef Traits::ElementType ElementType
 
- Public Types inherited from v8::internal::Object
enum  StoreFromKeyed { MAY_BE_STORE_FROM_KEYED , CERTAINLY_NOT_STORE_FROM_KEYED }
 
enum  StorePropertyMode { NORMAL_PROPERTY , SUPER_PROPERTY }
 

Public Member Functions

ElementType get_scalar (int index)
 
void set (int index, ElementType value)
 
FixedTypedArray< Float64ArrayTraits >::ElementType get_scalar (int index)
 
void set (int index, Float64ArrayTraits::ElementType value)
 
uint8_t from_int (int value)
 
uint8_t from_double (double value)
 
float from_double (double value)
 
double from_double (double value)
 
- Public Member Functions inherited from v8::internal::FixedTypedArrayBase
int size ()
 
int TypedArraySize (InstanceType type)
 
void * DataPtr ()
 
int DataSize ()
 
- Public Member Functions inherited from v8::internal::FixedArrayBase
int length () const
 
void set_length (int value)
 
int synchronized_length () const
 
void synchronized_set_length (int value)
 
- Public Member Functions inherited from v8::internal::HeapObject
Mapmap () const
 
void set_map (Map *value)
 
void set_map_no_write_barrier (Map *value)
 
Mapsynchronized_map ()
 
MapWord synchronized_map_word () const
 
void synchronized_set_map (Map *value)
 
void synchronized_set_map_no_write_barrier (Map *value)
 
void synchronized_set_map_word (MapWord map_word)
 
MapWord map_word () const
 
void set_map_word (MapWord map_word)
 
HeapGetHeap () const
 
IsolateGetIsolate () const
 
Address address ()
 
void Iterate (ObjectVisitor *v)
 
void IterateBody (InstanceType type, int object_size, ObjectVisitor *v)
 
int Size ()
 
bool MayContainRawValues ()
 
int SizeFromMap (Map *map)
 
WriteBarrierMode GetWriteBarrierMode (const DisallowHeapAllocation &promise)
 
void HeapObjectShortPrint (OStream &os)
 
 STATIC_ASSERT (kMapOffset==Internals::kHeapObjectMapOffset)
 
- Public Member Functions inherited from v8::internal::Object
bool IsObject () const
 
 INLINE (bool IsFixedArrayBase() const)
 
 INLINE (bool IsExternal() const)
 
 INLINE (bool IsAccessorInfo() const)
 
 INLINE (bool IsStruct() const)
 
 INLINE (bool IsSpecObject()) const
 
 INLINE (bool IsSpecFunction()) const
 
 INLINE (bool IsTemplateInfo()) const
 
 INLINE (bool IsNameDictionary() const)
 
 INLINE (bool IsSeededNumberDictionary() const)
 
 INLINE (bool IsUnseededNumberDictionary() const)
 
 INLINE (bool IsOrderedHashSet() const)
 
 INLINE (bool IsOrderedHashMap() const)
 
bool IsCallable () const
 
 INLINE (bool IsUndefined() const)
 
 INLINE (bool IsNull() const)
 
 INLINE (bool IsTheHole() const)
 
 INLINE (bool IsException() const)
 
 INLINE (bool IsUninitialized() const)
 
 INLINE (bool IsTrue() const)
 
 INLINE (bool IsFalse() const)
 
 INLINE (bool IsArgumentsMarker() const)
 
 INLINE (bool IsFiller() const)
 
double Number ()
 
 INLINE (bool IsNaN() const)
 
 INLINE (bool IsMinusZero() const)
 
bool ToInt32 (int32_t *value)
 
bool ToUint32 (uint32_t *value)
 
Representation OptimalRepresentation ()
 
bool FitsRepresentation (Representation representation)
 
Handle< HeapTypeOptimalType (Isolate *isolate, Representation representation)
 
bool HasValidElements ()
 
bool HasSpecificClassOf (String *name)
 
bool BooleanValue ()
 
ObjectGetHash ()
 
bool SameValue (Object *other)
 
bool SameValueZero (Object *other)
 
bool ToArrayIndex (uint32_t *index)
 
bool IsStringObjectWithCharacterAt (uint32_t index)
 
void VerifyApiCallResultType ()
 
void ShortPrint (FILE *out=stdout)
 
void ShortPrint (StringStream *accumulator)
 

Static Public Member Functions

static int ElementOffset (int index)
 
static int SizeFor (int length)
 
static Handle< Objectget (Handle< FixedTypedArray > array, int index)
 
static ElementType from_int (int value)
 
static ElementType from_double (double value)
 
static Handle< ObjectSetValue (Handle< FixedTypedArray< Traits > > array, uint32_t index, Handle< Object > value)
 
- Static Public Member Functions inherited from v8::internal::HeapObject
static HeapObjectFromAddress (Address address)
 
static Object ** RawField (HeapObject *obj, int offset)
 
static void UpdateMapCodeCache (Handle< HeapObject > object, Handle< Name > name, Handle< Code > code)
 
- Static Public Member Functions inherited from v8::internal::Object
static Handle< ObjectNewStorageFor (Isolate *isolate, Handle< Object > object, Representation representation)
 
static Handle< ObjectWrapForRead (Isolate *isolate, Handle< Object > object, Representation representation)
 
static MaybeHandle< JSReceiverToObject (Isolate *isolate, Handle< Object > object)
 
static MaybeHandle< JSReceiverToObject (Isolate *isolate, Handle< Object > object, Handle< Context > context)
 
static MUST_USE_RESULT MaybeHandle< SmiToSmi (Isolate *isolate, Handle< Object > object)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetProperty (LookupIterator *it)
 
static MUST_USE_RESULT MaybeHandle< ObjectSetProperty (Handle< Object > object, Handle< Name > key, Handle< Object > value, StrictMode strict_mode, StoreFromKeyed store_mode=MAY_BE_STORE_FROM_KEYED)
 
static MUST_USE_RESULT MaybeHandle< ObjectSetProperty (LookupIterator *it, Handle< Object > value, StrictMode strict_mode, StoreFromKeyed store_mode, StorePropertyMode data_store_mode=NORMAL_PROPERTY)
 
static MUST_USE_RESULT MaybeHandle< ObjectWriteToReadOnlyProperty (LookupIterator *it, Handle< Object > value, StrictMode strict_mode)
 
static Handle< ObjectSetDataProperty (LookupIterator *it, Handle< Object > value)
 
static MUST_USE_RESULT MaybeHandle< ObjectAddDataProperty (LookupIterator *it, Handle< Object > value, PropertyAttributes attributes, StrictMode strict_mode, StoreFromKeyed store_mode)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetPropertyOrElement (Handle< Object > object, Handle< Name > key)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetProperty (Isolate *isolate, Handle< Object > object, const char *key)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetProperty (Handle< Object > object, Handle< Name > key)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetPropertyWithAccessor (Handle< Object > receiver, Handle< Name > name, Handle< JSObject > holder, Handle< Object > structure)
 
static MUST_USE_RESULT MaybeHandle< ObjectSetPropertyWithAccessor (Handle< Object > receiver, Handle< Name > name, Handle< Object > value, Handle< JSObject > holder, Handle< Object > structure, StrictMode strict_mode)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetPropertyWithDefinedGetter (Handle< Object > receiver, Handle< JSReceiver > getter)
 
static MUST_USE_RESULT MaybeHandle< ObjectSetPropertyWithDefinedSetter (Handle< Object > receiver, Handle< JSReceiver > setter, Handle< Object > value)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetElement (Isolate *isolate, Handle< Object > object, uint32_t index)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetElementWithReceiver (Isolate *isolate, Handle< Object > object, Handle< Object > receiver, uint32_t index)
 
static Handle< SmiGetOrCreateHash (Isolate *isolate, Handle< Object > object)
 

Static Public Attributes

static const InstanceType kInstanceType = Traits::kInstanceType
 
- Static Public Attributes inherited from v8::internal::FixedTypedArrayBase
static const int kDataOffset = kHeaderSize
 
- Static Public Attributes inherited from v8::internal::FixedArrayBase
static const int kLengthOffset = HeapObject::kHeaderSize
 
static const int kHeaderSize = kLengthOffset + kPointerSize
 
- Static Public Attributes inherited from v8::internal::HeapObject
static const int kMapOffset = Object::kHeaderSize
 
static const int kHeaderSize = kMapOffset + kPointerSize
 
- Static Public Attributes inherited from v8::internal::Object
static const int kHeaderSize = 0
 

Private Member Functions

 DISALLOW_IMPLICIT_CONSTRUCTORS (FixedTypedArray)
 

Additional Inherited Members

- Protected Member Functions inherited from v8::internal::HeapObject
void IteratePointers (ObjectVisitor *v, int start, int end)
 
void IteratePointer (ObjectVisitor *v, int offset)
 
void IterateNextCodeLink (ObjectVisitor *v, int offset)
 

Detailed Description

template<class Traits>
class v8::internal::FixedTypedArray< Traits >

Definition at line 4735 of file objects.h.

Member Typedef Documentation

◆ ElementType

template<class Traits >
typedef Traits::ElementType v8::internal::FixedTypedArray< Traits >::ElementType

Definition at line 4737 of file objects.h.

Member Function Documentation

◆ DISALLOW_IMPLICIT_CONSTRUCTORS()

template<class Traits >
v8::internal::FixedTypedArray< Traits >::DISALLOW_IMPLICIT_CONSTRUCTORS ( FixedTypedArray< Traits )
private

◆ ElementOffset()

template<class Traits >
static int v8::internal::FixedTypedArray< Traits >::ElementOffset ( int  index)
inlinestatic

Definition at line 4742 of file objects.h.

4742  {
4743  return kDataOffset + index * sizeof(ElementType);
4744  }
static const int kDataOffset
Definition: objects.h:4716
Traits::ElementType ElementType
Definition: objects.h:4737

◆ from_double() [1/4]

uint8_t v8::internal::FixedTypedArray< Uint8ClampedArrayTraits >::from_double ( double  value)
inline

Definition at line 4127 of file objects-inl.h.

4127  {
4128  if (value < 0) return 0;
4129  if (value > 0xFF) return 0xFF;
4130  return static_cast<uint8_t>(lrint(value));
4131 }

◆ from_double() [2/4]

float v8::internal::FixedTypedArray< Float32ArrayTraits >::from_double ( double  value)
inline

Definition at line 4135 of file objects-inl.h.

4135  {
4136  return static_cast<float>(value);
4137 }

◆ from_double() [3/4]

double v8::internal::FixedTypedArray< Float64ArrayTraits >::from_double ( double  value)
inline

Definition at line 4141 of file objects-inl.h.

4141  {
4142  return value;
4143 }

◆ from_double() [4/4]

template<class Traits >
Traits::ElementType v8::internal::FixedTypedArray< Traits >::from_double ( double  value)
inlinestatic

Definition at line 4120 of file objects-inl.h.

4121  {
4122  return static_cast<ElementType>(DoubleToInt32(value));
4123 }
int32_t DoubleToInt32(double x)

References v8::internal::DoubleToInt32().

+ Here is the call graph for this function:

◆ from_int() [1/2]

uint8_t v8::internal::FixedTypedArray< Uint8ClampedArrayTraits >::from_int ( int  value)
inline

Definition at line 4112 of file objects-inl.h.

4112  {
4113  if (value < 0) return 0;
4114  if (value > 0xFF) return 0xFF;
4115  return static_cast<uint8_t>(value);
4116 }

◆ from_int() [2/2]

template<class Traits >
Traits::ElementType v8::internal::FixedTypedArray< Traits >::from_int ( int  value)
inlinestatic

Definition at line 4106 of file objects-inl.h.

4106  {
4107  return static_cast<ElementType>(value);
4108 }

◆ get()

template<class Traits >
Handle< Object > v8::internal::FixedTypedArray< Traits >::get ( Handle< FixedTypedArray< Traits > >  array,
int  index 
)
inlinestatic

Definition at line 4147 of file objects-inl.h.

4149  {
4150  return Traits::ToHandle(array->GetIsolate(), array->get_scalar(index));
4151 }

◆ get_scalar() [1/2]

FixedTypedArray< Float64ArrayTraits >::ElementType v8::internal::FixedTypedArray< Float64ArrayTraits >::get_scalar ( int  index)
inline

Definition at line 4082 of file objects-inl.h.

4082  {
4083  DCHECK((index >= 0) && (index < this->length()));
4084  return READ_DOUBLE_FIELD(this, ElementOffset(index));
4085 }
static int ElementOffset(int index)
Definition: objects.h:4742
#define DCHECK(condition)
Definition: logging.h:205
#define READ_DOUBLE_FIELD(p, offset)
Definition: objects-inl.h:1220

References DCHECK, and READ_DOUBLE_FIELD.

◆ get_scalar() [2/2]

template<class Traits >
Traits::ElementType v8::internal::FixedTypedArray< Traits >::get_scalar ( int  index)
inline

Definition at line 4072 of file objects-inl.h.

4072  {
4073  DCHECK((index >= 0) && (index < this->length()));
4074  ElementType* ptr = reinterpret_cast<ElementType*>(
4075  FIELD_ADDR(this, kDataOffset));
4076  return ptr[index];
4077 }
#define FIELD_ADDR(p, offset)
Definition: objects-inl.h:1173

References DCHECK, and FIELD_ADDR.

◆ set() [1/2]

template<class Traits >
void v8::internal::FixedTypedArray< Traits >::set ( int  index,
ElementType  value 
)
inline

Definition at line 4089 of file objects-inl.h.

4089  {
4090  DCHECK((index >= 0) && (index < this->length()));
4091  ElementType* ptr = reinterpret_cast<ElementType*>(
4092  FIELD_ADDR(this, kDataOffset));
4093  ptr[index] = value;
4094 }

References DCHECK, and FIELD_ADDR.

◆ set() [2/2]

void v8::internal::FixedTypedArray< Float64ArrayTraits >::set ( int  index,
Float64ArrayTraits::ElementType  value 
)
inline

Definition at line 4098 of file objects-inl.h.

4099  {
4100  DCHECK((index >= 0) && (index < this->length()));
4101  WRITE_DOUBLE_FIELD(this, ElementOffset(index), value);
4102 }
#define WRITE_DOUBLE_FIELD(p, offset, value)
Definition: objects-inl.h:1240

References DCHECK, and WRITE_DOUBLE_FIELD.

◆ SetValue()

template<class Traits >
Handle< Object > v8::internal::FixedTypedArray< Traits >::SetValue ( Handle< FixedTypedArray< Traits > >  array,
uint32_t  index,
Handle< Object value 
)
static

Definition at line 4155 of file objects-inl.h.

4158  {
4159  ElementType cast_value = Traits::defaultValue();
4160  if (index < static_cast<uint32_t>(array->length())) {
4161  if (value->IsSmi()) {
4162  int int_value = Handle<Smi>::cast(value)->value();
4163  cast_value = from_int(int_value);
4164  } else if (value->IsHeapNumber()) {
4165  double double_value = Handle<HeapNumber>::cast(value)->value();
4166  cast_value = from_double(double_value);
4167  } else {
4168  // Clamp undefined to the default value. All other types have been
4169  // converted to a number type further up in the call chain.
4170  DCHECK(value->IsUndefined());
4171  }
4172  array->set(index, cast_value);
4173  }
4174  return Traits::ToHandle(array->GetIsolate(), cast_value);
4175 }
static ElementType from_int(int value)
Definition: objects-inl.h:4106
static ElementType from_double(double value)
Definition: objects-inl.h:4120
static Handle< T > cast(Handle< S > that)
Definition: handles.h:116

References v8::internal::Handle< T >::cast(), and DCHECK.

+ Here is the call graph for this function:

◆ SizeFor()

template<class Traits >
static int v8::internal::FixedTypedArray< Traits >::SizeFor ( int  length)
inlinestatic

Definition at line 4746 of file objects.h.

4746  {
4747  return ElementOffset(length);
4748  }

Member Data Documentation

◆ kInstanceType

template<class Traits >
const InstanceType v8::internal::FixedTypedArray< Traits >::kInstanceType = Traits::kInstanceType
static

Definition at line 4738 of file objects.h.


The documentation for this class was generated from the following files: