V8 Project
v8::NeanderArray Class Reference

#include <api.h>

+ Collaboration diagram for v8::NeanderArray:

Public Member Functions

 NeanderArray (v8::internal::Isolate *isolate)
 
 NeanderArray (v8::internal::Handle< v8::internal::Object > obj)
 
v8::internal::Handle< v8::internal::JSObjectvalue ()
 
void add (v8::internal::Handle< v8::internal::Object > value)
 
int length ()
 
v8::internal::Objectget (int index)
 
void set (int index, v8::internal::Object *value)
 

Private Attributes

NeanderObject obj_
 

Detailed Description

Definition at line 49 of file api.h.

Constructor & Destructor Documentation

◆ NeanderArray() [1/2]

v8::NeanderArray::NeanderArray ( v8::internal::Isolate isolate)
explicit

Definition at line 731 of file api.cc.

731  : obj_(isolate, 2) {
732  obj_.set(0, i::Smi::FromInt(0));
733 }
NeanderObject obj_
Definition: api.h:66
void set(int index, v8::internal::Object *value)
Definition: api.h:89
static Smi * FromInt(int value)
Definition: objects-inl.h:1321

References v8::internal::Smi::FromInt(), obj_, and v8::NeanderObject::set().

+ Here is the call graph for this function:

◆ NeanderArray() [2/2]

v8::NeanderArray::NeanderArray ( v8::internal::Handle< v8::internal::Object obj)
inlineexplicit

Definition at line 79 of file api.h.

80  : obj_(obj) { }

Member Function Documentation

◆ add()

void v8::NeanderArray::add ( v8::internal::Handle< v8::internal::Object value)

Definition at line 753 of file api.cc.

753  {
754  int length = this->length();
755  int size = obj_.size();
756  if (length == size - 1) {
757  i::Factory* factory = i::Isolate::Current()->factory();
758  i::Handle<i::FixedArray> new_elms = factory->NewFixedArray(2 * size);
759  for (int i = 0; i < length; i++)
760  new_elms->set(i + 1, get(i));
761  obj_.value()->set_elements(*new_elms);
762  }
763  obj_.set(length + 1, *value);
764  obj_.set(0, i::Smi::FromInt(length + 1));
765 }
int length()
Definition: api.cc:736
v8::internal::Object * get(int index)
Definition: api.cc:741
v8::internal::Handle< v8::internal::JSObject > value()
Definition: api.h:53
v8::internal::Handle< v8::internal::JSObject > value()
Definition: api.h:40
int size()
Definition: api.cc:726
enable harmony numeric enable harmony object literal extensions Optimize object size

References v8::internal::Smi::FromInt(), get(), length(), obj_, v8::NeanderObject::set(), v8::NeanderObject::size(), size, v8::NeanderObject::value(), and value().

Referenced by v8::V8::AddMessageListener(), v8::AddPropertyToTemplate(), and v8::TemplateSet().

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

◆ get()

i::Object * v8::NeanderArray::get ( int  index)

Definition at line 741 of file api.cc.

741  {
742  DCHECK(0 <= offset);
743  DCHECK(offset < length());
744  return obj_.get(offset + 1);
745 }
v8::internal::Object * get(int index)
Definition: api.h:83
#define DCHECK(condition)
Definition: logging.h:205

References DCHECK, v8::NeanderObject::get(), length(), and obj_.

Referenced by add(), v8::internal::AppendUniqueCallbacks(), v8::V8::RemoveMessageListeners(), and v8::internal::MessageHandler::ReportMessage().

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

◆ length()

int v8::NeanderArray::length ( )

Definition at line 736 of file api.cc.

736  {
737  return i::Smi::cast(obj_.get(0))->value();
738 }

References v8::NeanderObject::get(), and obj_.

Referenced by add(), v8::internal::Map::AppendCallbackDescriptors(), v8::internal::AccessorInfo::AppendUnique(), v8::internal::AppendUniqueCallbacks(), get(), v8::V8::RemoveMessageListeners(), v8::internal::MessageHandler::ReportMessage(), and set().

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

◆ set()

void v8::NeanderArray::set ( int  index,
v8::internal::Object value 
)

Definition at line 768 of file api.cc.

768  {
769  if (index < 0 || index >= this->length()) return;
770  obj_.set(index + 1, value);
771 }

References length(), obj_, v8::NeanderObject::set(), and value().

Referenced by v8::V8::RemoveMessageListeners().

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

◆ value()

v8::internal::Handle<v8::internal::JSObject> v8::NeanderArray::value ( )
inline

Definition at line 53 of file api.h.

53  {
54  return obj_.value();
55  }

References obj_, and v8::NeanderObject::value().

Referenced by add(), v8::AddPropertyToTemplate(), set(), and v8::TemplateSet().

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

Member Data Documentation

◆ obj_

NeanderObject v8::NeanderArray::obj_
private

Definition at line 66 of file api.h.

Referenced by add(), get(), length(), NeanderArray(), set(), and value().


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