V8 Project
v8::internal::ExternalUint8ClampedArray Class Reference

#include <objects.h>

+ Inheritance diagram for v8::internal::ExternalUint8ClampedArray:
+ Collaboration diagram for v8::internal::ExternalUint8ClampedArray:

Public Member Functions

uint8_t * external_uint8_clamped_pointer ()
 
uint8_t get_scalar (int index)
 
void set (int index, uint8_t value)
 
- Public Member Functions inherited from v8::internal::ExternalArray
bool is_the_hole (int index)
 
 DECL_ACCESSORS (external_pointer, void) static const int kMaxLength=0x3fffffff
 
- 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 Handle< Objectget (Handle< ExternalUint8ClampedArray > array, int index)
 
static Handle< ObjectSetValue (Handle< ExternalUint8ClampedArray > 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)
 

Private Member Functions

 DISALLOW_IMPLICIT_CONSTRUCTORS (ExternalUint8ClampedArray)
 

Additional Inherited Members

- 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 }
 
- Static Public Attributes inherited from v8::internal::ExternalArray
static const int kExternalPointerOffset
 
static const int kHeaderSize = kExternalPointerOffset + kPointerSize
 
static const int kAlignedSize = OBJECT_POINTER_ALIGN(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
 
- 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

Definition at line 4489 of file objects.h.

Member Function Documentation

◆ DISALLOW_IMPLICIT_CONSTRUCTORS()

v8::internal::ExternalUint8ClampedArray::DISALLOW_IMPLICIT_CONSTRUCTORS ( ExternalUint8ClampedArray  )
private

◆ external_uint8_clamped_pointer()

uint8_t * v8::internal::ExternalUint8ClampedArray::external_uint8_clamped_pointer ( )
inline

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

3799  {
3800  return reinterpret_cast<uint8_t*>(external_pointer());
3801 }

Referenced by get_scalar(), and set().

+ Here is the caller graph for this function:

◆ get()

Handle< Object > v8::internal::ExternalUint8ClampedArray::get ( Handle< ExternalUint8ClampedArray array,
int  index 
)
inlinestatic

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

3813  {
3814  return Handle<Smi>(Smi::FromInt(array->get_scalar(index)),
3815  array->GetIsolate());
3816 }
static Smi * FromInt(int value)
Definition: objects-inl.h:1321

References v8::internal::Smi::FromInt().

+ Here is the call graph for this function:

◆ get_scalar()

uint8_t v8::internal::ExternalUint8ClampedArray::get_scalar ( int  index)
inline

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

3804  {
3805  DCHECK((index >= 0) && (index < this->length()));
3806  uint8_t* ptr = external_uint8_clamped_pointer();
3807  return ptr[index];
3808 }
#define DCHECK(condition)
Definition: logging.h:205

References DCHECK, external_uint8_clamped_pointer(), and v8::internal::FixedArrayBase::length().

+ Here is the call graph for this function:

◆ set()

void v8::internal::ExternalUint8ClampedArray::set ( int  index,
uint8_t  value 
)
inline

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

3819  {
3820  DCHECK((index >= 0) && (index < this->length()));
3821  uint8_t* ptr = external_uint8_clamped_pointer();
3822  ptr[index] = value;
3823 }

References DCHECK, external_uint8_clamped_pointer(), and v8::internal::FixedArrayBase::length().

+ Here is the call graph for this function:

◆ SetValue()

Handle< Object > v8::internal::ExternalUint8ClampedArray::SetValue ( Handle< ExternalUint8ClampedArray array,
uint32_t  index,
Handle< Object value 
)
static

Definition at line 14408 of file objects.cc.

14411  {
14412  uint8_t clamped_value = 0;
14413  if (index < static_cast<uint32_t>(array->length())) {
14414  if (value->IsSmi()) {
14415  int int_value = Handle<Smi>::cast(value)->value();
14416  if (int_value < 0) {
14417  clamped_value = 0;
14418  } else if (int_value > 255) {
14419  clamped_value = 255;
14420  } else {
14421  clamped_value = static_cast<uint8_t>(int_value);
14422  }
14423  } else if (value->IsHeapNumber()) {
14424  double double_value = Handle<HeapNumber>::cast(value)->value();
14425  if (!(double_value > 0)) {
14426  // NaN and less than zero clamp to zero.
14427  clamped_value = 0;
14428  } else if (double_value > 255) {
14429  // Greater than 255 clamp to 255.
14430  clamped_value = 255;
14431  } else {
14432  // Other doubles are rounded to the nearest integer.
14433  clamped_value = static_cast<uint8_t>(lrint(double_value));
14434  }
14435  } else {
14436  // Clamp undefined to zero (default). All other types have been
14437  // converted to a number type further up in the call chain.
14438  DCHECK(value->IsUndefined());
14439  }
14440  array->set(index, clamped_value);
14441  }
14442  return handle(Smi::FromInt(clamped_value), array->GetIsolate());
14443 }
static Handle< T > cast(Handle< S > that)
Definition: handles.h:116
Handle< T > handle(T *t, Isolate *isolate)
Definition: handles.h:146

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

+ Here is the call graph for this function:

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