V8 Project
v8::Object Class Reference

A JavaScript object (ECMA-262, 4.3.3) More...

#include <v8.h>

+ Inheritance diagram for v8::Object:
+ Collaboration diagram for v8::Object:

Public Member Functions

bool Set (Handle< Value > key, Handle< Value > value)
 
bool Set (uint32_t index, Handle< Value > value)
 
bool ForceSet (Handle< Value > key, Handle< Value > value, PropertyAttribute attribs=None)
 
Local< ValueGet (Handle< Value > key)
 
Local< ValueGet (uint32_t index)
 
PropertyAttribute GetPropertyAttributes (Handle< Value > key)
 Gets the property attributes of a property which can be None or any combination of ReadOnly, DontEnum and DontDelete. More...
 
Local< ValueGetOwnPropertyDescriptor (Local< String > key)
 Returns Object.getOwnPropertyDescriptor as per ES5 section 15.2.3.3. More...
 
bool Has (Handle< Value > key)
 
bool Delete (Handle< Value > key)
 
bool ForceDelete (Handle< Value > key)
 
bool Has (uint32_t index)
 
bool Delete (uint32_t index)
 
bool SetAccessor (Handle< String > name, AccessorGetterCallback getter, AccessorSetterCallback setter=0, Handle< Value > data=Handle< Value >(), AccessControl settings=DEFAULT, PropertyAttribute attribute=None)
 
bool SetAccessor (Handle< Name > name, AccessorNameGetterCallback getter, AccessorNameSetterCallback setter=0, Handle< Value > data=Handle< Value >(), AccessControl settings=DEFAULT, PropertyAttribute attribute=None)
 
bool SetDeclaredAccessor (Local< Name > name, Local< DeclaredAccessorDescriptor > descriptor, PropertyAttribute attribute=None, AccessControl settings=DEFAULT)
 
void SetAccessorProperty (Local< Name > name, Local< Function > getter, Handle< Function > setter=Handle< Function >(), PropertyAttribute attribute=None, AccessControl settings=DEFAULT)
 
bool HasPrivate (Handle< Private > key)
 Functionality for private properties. More...
 
bool SetPrivate (Handle< Private > key, Handle< Value > value)
 
bool DeletePrivate (Handle< Private > key)
 
Local< ValueGetPrivate (Handle< Private > key)
 
Local< ArrayGetPropertyNames ()
 Returns an array containing the names of the enumerable properties of this object, including properties from prototype objects. More...
 
Local< ArrayGetOwnPropertyNames ()
 This function has the same functionality as GetPropertyNames but the returned array doesn't contain the names of properties from prototype objects. More...
 
Local< ValueGetPrototype ()
 Get the prototype object. More...
 
bool SetPrototype (Handle< Value > prototype)
 Set the prototype object. More...
 
Local< ObjectFindInstanceInPrototypeChain (Handle< FunctionTemplate > tmpl)
 Finds an instance of the given function template in the prototype chain. More...
 
Local< StringObjectProtoToString ()
 Call builtin Object.prototype.toString on this object. More...
 
Local< StringGetConstructorName ()
 Returns the name of the function invoked as a constructor for this object. More...
 
int InternalFieldCount ()
 Gets the number of internal fields for this Object. More...
 
Local< ValueGetInternalField (int index)
 Gets the value from an internal field. More...
 
void SetInternalField (int index, Handle< Value > value)
 Sets the value in an internal field. More...
 
void * GetAlignedPointerFromInternalField (int index)
 Gets a 2-byte-aligned native pointer from an internal field. More...
 
void SetAlignedPointerInInternalField (int index, void *value)
 Sets a 2-byte-aligned native pointer in an internal field. More...
 
bool HasOwnProperty (Handle< String > key)
 
bool HasRealNamedProperty (Handle< String > key)
 
bool HasRealIndexedProperty (uint32_t index)
 
bool HasRealNamedCallbackProperty (Handle< String > key)
 
Local< ValueGetRealNamedPropertyInPrototypeChain (Handle< String > key)
 If result.IsEmpty() no real property was located in the prototype chain. More...
 
Local< ValueGetRealNamedProperty (Handle< String > key)
 If result.IsEmpty() no real property was located on the object or in the prototype chain. More...
 
bool HasNamedLookupInterceptor ()
 Tests for a named lookup interceptor. More...
 
bool HasIndexedLookupInterceptor ()
 Tests for an index lookup interceptor. More...
 
void TurnOnAccessCheck ()
 Turns on access check on the object if the object is an instance of a template that has access check callbacks. More...
 
int GetIdentityHash ()
 Returns the identity hash for this object. More...
 
bool SetHiddenValue (Handle< String > key, Handle< Value > value)
 Access hidden properties on JavaScript objects. More...
 
Local< ValueGetHiddenValue (Handle< String > key)
 
bool DeleteHiddenValue (Handle< String > key)
 
bool IsDirty ()
 Returns true if this is an instance of an api function (one created from a function created from a function template) and has been modified since it was created. More...
 
Local< ObjectClone ()
 Clone this object with a fast but shallow copy. More...
 
Local< ContextCreationContext ()
 Returns the context in which the object was created. More...
 
void SetIndexedPropertiesToPixelData (uint8_t *data, int length)
 Set the backing store of the indexed properties to be managed by the embedding layer. More...
 
bool HasIndexedPropertiesInPixelData ()
 
uint8_t * GetIndexedPropertiesPixelData ()
 
int GetIndexedPropertiesPixelDataLength ()
 
void SetIndexedPropertiesToExternalArrayData (void *data, ExternalArrayType array_type, int number_of_elements)
 Set the backing store of the indexed properties to be managed by the embedding layer. More...
 
bool HasIndexedPropertiesInExternalArrayData ()
 
void * GetIndexedPropertiesExternalArrayData ()
 
ExternalArrayType GetIndexedPropertiesExternalArrayDataType ()
 
int GetIndexedPropertiesExternalArrayDataLength ()
 
bool IsCallable ()
 Checks whether a callback is set by the ObjectTemplate::SetCallAsFunctionHandler method. More...
 
Local< ValueCallAsFunction (Handle< Value > recv, int argc, Handle< Value > argv[])
 Call an Object as a function if a callback is set by the ObjectTemplate::SetCallAsFunctionHandler method. More...
 
Local< ValueCallAsConstructor (int argc, Handle< Value > argv[])
 Call an Object as a constructor if a callback is set by the ObjectTemplate::SetCallAsFunctionHandler method. More...
 
- Public Member Functions inherited from v8::Value
bool IsUndefined () const
 Returns true if this value is the undefined value. More...
 
bool IsNull () const
 Returns true if this value is the null value. More...
 
bool IsTrue () const
 Returns true if this value is true. More...
 
bool IsFalse () const
 Returns true if this value is false. More...
 
bool IsName () const
 Returns true if this value is a symbol or a string. More...
 
bool IsString () const
 Returns true if this value is an instance of the String type. More...
 
bool IsSymbol () const
 Returns true if this value is a symbol. More...
 
bool IsFunction () const
 Returns true if this value is a function. More...
 
bool IsArray () const
 Returns true if this value is an array. More...
 
bool IsObject () const
 Returns true if this value is an object. More...
 
bool IsBoolean () const
 Returns true if this value is boolean. More...
 
bool IsNumber () const
 Returns true if this value is a number. More...
 
bool IsExternal () const
 Returns true if this value is external. More...
 
bool IsInt32 () const
 Returns true if this value is a 32-bit signed integer. More...
 
bool IsUint32 () const
 Returns true if this value is a 32-bit unsigned integer. More...
 
bool IsDate () const
 Returns true if this value is a Date. More...
 
bool IsArgumentsObject () const
 Returns true if this value is an Arguments object. More...
 
bool IsBooleanObject () const
 Returns true if this value is a Boolean object. More...
 
bool IsNumberObject () const
 Returns true if this value is a Number object. More...
 
bool IsStringObject () const
 Returns true if this value is a String object. More...
 
bool IsSymbolObject () const
 Returns true if this value is a Symbol object. More...
 
bool IsNativeError () const
 Returns true if this value is a NativeError. More...
 
bool IsRegExp () const
 Returns true if this value is a RegExp. More...
 
bool IsGeneratorFunction () const
 Returns true if this value is a Generator function. More...
 
bool IsGeneratorObject () const
 Returns true if this value is a Generator object (iterator). More...
 
bool IsPromise () const
 Returns true if this value is a Promise. More...
 
bool IsMap () const
 Returns true if this value is a Map. More...
 
bool IsSet () const
 Returns true if this value is a Set. More...
 
bool IsWeakMap () const
 Returns true if this value is a WeakMap. More...
 
bool IsWeakSet () const
 Returns true if this value is a WeakSet. More...
 
bool IsArrayBuffer () const
 Returns true if this value is an ArrayBuffer. More...
 
bool IsArrayBufferView () const
 Returns true if this value is an ArrayBufferView. More...
 
bool IsTypedArray () const
 Returns true if this value is one of TypedArrays. More...
 
bool IsUint8Array () const
 Returns true if this value is an Uint8Array. More...
 
bool IsUint8ClampedArray () const
 Returns true if this value is an Uint8ClampedArray. More...
 
bool IsInt8Array () const
 Returns true if this value is an Int8Array. More...
 
bool IsUint16Array () const
 Returns true if this value is an Uint16Array. More...
 
bool IsInt16Array () const
 Returns true if this value is an Int16Array. More...
 
bool IsUint32Array () const
 Returns true if this value is an Uint32Array. More...
 
bool IsInt32Array () const
 Returns true if this value is an Int32Array. More...
 
bool IsFloat32Array () const
 Returns true if this value is a Float32Array. More...
 
bool IsFloat64Array () const
 Returns true if this value is a Float64Array. More...
 
bool IsDataView () const
 Returns true if this value is a DataView. More...
 
Local< BooleanToBoolean () const
 
Local< NumberToNumber () const
 
Local< StringToString () const
 
Local< StringToDetailString () const
 
Local< ObjectToObject () const
 
Local< IntegerToInteger () const
 
Local< Uint32ToUint32 () const
 
Local< Int32ToInt32 () const
 
Local< Uint32ToArrayIndex () const
 Attempts to convert a string to an array index. More...
 
bool BooleanValue () const
 
double NumberValue () const
 
int64_t IntegerValue () const
 
uint32_t Uint32Value () const
 
int32_t Int32Value () const
 
bool Equals (Handle< Value > that) const
 JS ==. More...
 
bool StrictEquals (Handle< Value > that) const
 
bool SameValue (Handle< Value > that) const
 

Static Public Member Functions

static int InternalFieldCount (const PersistentBase< Object > &object)
 Same as above, but works for Persistents. More...
 
static void * GetAlignedPointerFromInternalField (const PersistentBase< Object > &object, int index)
 Same as above, but works for Persistents. More...
 
static Local< ObjectNew (Isolate *isolate)
 
static ObjectCast (Value *obj)
 
- Static Public Member Functions inherited from v8::Value
template<class T >
static ValueCast (T *value)
 

Private Member Functions

 Object ()
 
Local< ValueSlowGetInternalField (int index)
 
void * SlowGetAlignedPointerFromInternalField (int index)
 

Static Private Member Functions

static void CheckCast (Value *obj)
 

Detailed Description

A JavaScript object (ECMA-262, 4.3.3)

Definition at line 2283 of file v8.h.

Constructor & Destructor Documentation

◆ Object()

v8::Object::Object ( )
private

Member Function Documentation

◆ CallAsConstructor()

Local< v8::Value > v8::Object::CallAsConstructor ( int  argc,
Handle< Value argv[] 
)

Call an Object as a constructor if a callback is set by the ObjectTemplate::SetCallAsFunctionHandler method.

Note: This method behaves like the Function::NewInstance method.

Definition at line 4024 of file api.cc.

4025  {
4026  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
4027  ON_BAILOUT(isolate, "v8::Object::CallAsConstructor()",
4028  return Local<v8::Object>());
4029  LOG_API(isolate, "Object::CallAsConstructor");
4030  ENTER_V8(isolate);
4031  i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate);
4032  i::HandleScope scope(isolate);
4034  STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**));
4035  i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv);
4036  if (obj->IsJSFunction()) {
4038  EXCEPTION_PREAMBLE(isolate);
4039  i::Handle<i::Object> returned;
4040  has_pending_exception = !i::Execution::New(
4041  fun, argc, args).ToHandle(&returned);
4042  EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<v8::Object>());
4043  return Utils::ToLocal(scope.CloseAndEscape(
4044  i::Handle<i::JSObject>::cast(returned)));
4045  }
4046  EXCEPTION_PREAMBLE(isolate);
4047  i::Handle<i::Object> delegate;
4048  has_pending_exception = !i::Execution::TryGetConstructorDelegate(
4049  isolate, obj).ToHandle(&delegate);
4050  EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Object>());
4051  if (!delegate->IsUndefined()) {
4053  EXCEPTION_PREAMBLE(isolate);
4054  i::Handle<i::Object> returned;
4055  has_pending_exception = !i::Execution::Call(
4056  isolate, fun, obj, argc, args).ToHandle(&returned);
4057  EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<v8::Object>());
4058  DCHECK(!delegate->IsUndefined());
4059  return Utils::ToLocal(scope.CloseAndEscape(returned));
4060  }
4061  return Local<v8::Object>();
4062 }
#define ON_BAILOUT(isolate, location, code)
Definition: api.cc:60
#define LOG_API(isolate, expr)
Definition: api.cc:52
#define EXCEPTION_BAILOUT_CHECK(isolate, value)
Definition: api.cc:93
#define ENTER_V8(isolate)
Definition: api.cc:54
#define EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, value)
Definition: api.cc:88
#define EXCEPTION_PREAMBLE(isolate)
Definition: api.cc:67
static Local< Context > ToLocal(v8::internal::Handle< v8::internal::Context > obj)
static v8::internal::Handle< To > OpenHandle(v8::Local< From > handle)
Definition: api.h:288
static Handle< T > cast(Handle< S > that)
Definition: handles.h:116
#define DCHECK(condition)
Definition: logging.h:205
#define STATIC_ASSERT(test)
Definition: macros.h:311

References v8::internal::Handle< T >::cast(), v8::internal::HandleScope::CloseAndEscape(), DCHECK, ENTER_V8, EXCEPTION_BAILOUT_CHECK, EXCEPTION_BAILOUT_CHECK_DO_CALLBACK, EXCEPTION_PREAMBLE, LOG_API, ON_BAILOUT, v8::Utils::OpenHandle(), STATIC_ASSERT, and v8::Utils::ToLocal().

+ Here is the call graph for this function:

◆ CallAsFunction()

Local< v8::Value > v8::Object::CallAsFunction ( Handle< Value recv,
int  argc,
Handle< Value argv[] 
)

Call an Object as a function if a callback is set by the ObjectTemplate::SetCallAsFunctionHandler method.

Definition at line 3989 of file api.cc.

3991  {
3992  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3993  ON_BAILOUT(isolate, "v8::Object::CallAsFunction()",
3994  return Local<v8::Value>());
3995  LOG_API(isolate, "Object::CallAsFunction");
3996  ENTER_V8(isolate);
3997  i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate);
3998  i::HandleScope scope(isolate);
4000  i::Handle<i::Object> recv_obj = Utils::OpenHandle(*recv);
4001  STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**));
4002  i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv);
4004  if (obj->IsJSFunction()) {
4005  fun = i::Handle<i::JSFunction>::cast(obj);
4006  } else {
4007  EXCEPTION_PREAMBLE(isolate);
4008  i::Handle<i::Object> delegate;
4009  has_pending_exception = !i::Execution::TryGetFunctionDelegate(
4010  isolate, obj).ToHandle(&delegate);
4011  EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>());
4012  fun = i::Handle<i::JSFunction>::cast(delegate);
4013  recv_obj = obj;
4014  }
4015  EXCEPTION_PREAMBLE(isolate);
4016  i::Handle<i::Object> returned;
4017  has_pending_exception = !i::Execution::Call(
4018  isolate, fun, recv_obj, argc, args, true).ToHandle(&returned);
4019  EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<Value>());
4020  return Utils::ToLocal(scope.CloseAndEscape(returned));
4021 }

References v8::internal::Handle< T >::cast(), v8::internal::HandleScope::CloseAndEscape(), ENTER_V8, EXCEPTION_BAILOUT_CHECK, EXCEPTION_BAILOUT_CHECK_DO_CALLBACK, EXCEPTION_PREAMBLE, LOG_API, ON_BAILOUT, v8::Utils::OpenHandle(), STATIC_ASSERT, and v8::Utils::ToLocal().

+ Here is the call graph for this function:

◆ Cast()

Object * v8::Object::Cast ( v8::Value value)
inlinestatic

Definition at line 6654 of file v8.h.

6654  {
6655 #ifdef V8_ENABLE_CHECKS
6656  CheckCast(value);
6657 #endif
6658  return static_cast<Object*>(value);
6659 }
static void CheckCast(Value *obj)
Definition: api.cc:2706

◆ CheckCast()

void v8::Object::CheckCast ( Value obj)
staticprivate

Definition at line 2706 of file api.cc.

2706  {
2708  Utils::ApiCheck(obj->IsJSObject(),
2709  "v8::Object::Cast()",
2710  "Could not convert to object");
2711 }
static bool ApiCheck(bool condition, const char *location, const char *message)
Definition: api.h:177

References v8::Utils::ApiCheck(), and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ Clone()

Local< v8::Object > v8::Object::Clone ( )

Clone this object with a fast but shallow copy.

Values will point to the same values as the original object.

Definition at line 3733 of file api.cc.

3733  {
3734  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3735  ON_BAILOUT(isolate, "v8::Object::Clone()", return Local<Object>());
3736  ENTER_V8(isolate);
3738  EXCEPTION_PREAMBLE(isolate);
3739  i::Handle<i::JSObject> result = isolate->factory()->CopyJSObject(self);
3740  has_pending_exception = result.is_null();
3741  EXCEPTION_BAILOUT_CHECK(isolate, Local<Object>());
3742  return Utils::ToLocal(result);
3743 }
bool is_null() const
Definition: handles.h:124
Factory * factory()
Definition: isolate.h:982

References ENTER_V8, EXCEPTION_BAILOUT_CHECK, EXCEPTION_PREAMBLE, v8::internal::Isolate::factory(), v8::internal::Handle< T >::is_null(), ON_BAILOUT, v8::Utils::OpenHandle(), and v8::Utils::ToLocal().

+ Here is the call graph for this function:

◆ CreationContext()

Local< v8::Context > v8::Object::CreationContext ( )

Returns the context in which the object was created.

Definition at line 3746 of file api.cc.

3746  {
3747  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3748  ON_BAILOUT(isolate,
3749  "v8::Object::CreationContext()", return Local<v8::Context>());
3750  ENTER_V8(isolate);
3752  i::Context* context = self->GetCreationContext();
3753  return Utils::ToLocal(i::Handle<i::Context>(context));
3754 }

References ENTER_V8, ON_BAILOUT, v8::Utils::OpenHandle(), and v8::Utils::ToLocal().

+ Here is the call graph for this function:

◆ Delete() [1/2]

bool v8::Object::Delete ( v8::Handle< Value key)

Definition at line 3441 of file api.cc.

3441  {
3442  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3443  ON_BAILOUT(isolate, "v8::Object::Delete()", return false);
3444  ENTER_V8(isolate);
3445  i::HandleScope scope(isolate);
3447  i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
3448  EXCEPTION_PREAMBLE(isolate);
3450  has_pending_exception = !i::Runtime::DeleteObjectProperty(
3451  isolate, self, key_obj, i::JSReceiver::NORMAL_DELETION).ToHandle(&obj);
3452  EXCEPTION_BAILOUT_CHECK(isolate, false);
3453  return obj->IsTrue();
3454 }
static MUST_USE_RESULT MaybeHandle< Object > DeleteObjectProperty(Isolate *isolate, Handle< JSReceiver > object, Handle< Object > key, JSReceiver::DeleteMode mode)
Definition: runtime.cc:2328

References v8::internal::Runtime::DeleteObjectProperty(), ENTER_V8, EXCEPTION_BAILOUT_CHECK, EXCEPTION_PREAMBLE, v8::internal::JSReceiver::NORMAL_DELETION, ON_BAILOUT, and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ Delete() [2/2]

bool v8::Object::Delete ( uint32_t  index)

Definition at line 3484 of file api.cc.

3484  {
3485  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3486  ON_BAILOUT(isolate, "v8::Object::DeleteProperty()",
3487  return false);
3488  ENTER_V8(isolate);
3489  HandleScope scope(reinterpret_cast<Isolate*>(isolate));
3491 
3492  EXCEPTION_PREAMBLE(isolate);
3494  has_pending_exception =
3495  !i::JSReceiver::DeleteElement(self, index).ToHandle(&obj);
3496  EXCEPTION_BAILOUT_CHECK(isolate, false);
3497  return obj->IsTrue();
3498 }
static MUST_USE_RESULT MaybeHandle< Object > DeleteElement(Handle< JSReceiver > object, uint32_t index, DeleteMode mode=NORMAL_DELETION)
Definition: objects.cc:5002

References v8::internal::JSReceiver::DeleteElement(), ENTER_V8, EXCEPTION_BAILOUT_CHECK, EXCEPTION_PREAMBLE, ON_BAILOUT, and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ DeleteHiddenValue()

bool v8::Object::DeleteHiddenValue ( Handle< String key)

Definition at line 3800 of file api.cc.

3800  {
3801  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3802  ON_BAILOUT(isolate, "v8::DeleteHiddenValue()", return false);
3803  ENTER_V8(isolate);
3804  i::HandleScope scope(isolate);
3806  i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
3807  i::Handle<i::String> key_string =
3808  isolate->factory()->InternalizeString(key_obj);
3809  i::JSObject::DeleteHiddenProperty(self, key_string);
3810  return true;
3811 }
static void DeleteHiddenProperty(Handle< JSObject > object, Handle< Name > key)
Definition: objects.cc:4673

References v8::internal::JSObject::DeleteHiddenProperty(), ENTER_V8, v8::internal::Isolate::factory(), ON_BAILOUT, and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ DeletePrivate()

bool v8::Object::DeletePrivate ( v8::Handle< Private key)

Definition at line 3457 of file api.cc.

3457  {
3458  return Delete(v8::Handle<Value>(reinterpret_cast<Value*>(*key)));
3459 }
bool Delete(Handle< Value > key)
Definition: api.cc:3441

◆ FindInstanceInPrototypeChain()

Local< Object > v8::Object::FindInstanceInPrototypeChain ( v8::Handle< FunctionTemplate tmpl)

Finds an instance of the given function template in the prototype chain.

Definition at line 3310 of file api.cc.

3311  {
3312  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3313  ON_BAILOUT(isolate,
3314  "v8::Object::FindInstanceInPrototypeChain()",
3315  return Local<v8::Object>());
3316  ENTER_V8(isolate);
3317  i::PrototypeIterator iter(isolate, *Utils::OpenHandle(this),
3319  i::FunctionTemplateInfo* tmpl_info = *Utils::OpenHandle(*tmpl);
3320  while (!tmpl_info->IsTemplateFor(iter.GetCurrent())) {
3321  iter.Advance();
3322  if (iter.IsAtEnd()) {
3323  return Local<Object>();
3324  }
3325  }
3326  return Utils::ToLocal(
3327  i::handle(i::JSObject::cast(iter.GetCurrent()), isolate));
3328 }
bool IsTemplateFor(Object *object)
Definition: objects.cc:210
A class to uniformly access the prototype of any Object and walk its prototype chain.
Definition: prototype.h:25
Handle< T > handle(T *t, Isolate *isolate)
Definition: handles.h:146

References v8::internal::PrototypeIterator::Advance(), ENTER_V8, v8::internal::PrototypeIterator::GetCurrent(), v8::internal::handle(), v8::internal::PrototypeIterator::IsAtEnd(), v8::internal::FunctionTemplateInfo::IsTemplateFor(), ON_BAILOUT, v8::Utils::OpenHandle(), v8::internal::PrototypeIterator::START_AT_RECEIVER, and v8::Utils::ToLocal().

+ Here is the call graph for this function:

◆ ForceDelete()

bool v8::Object::ForceDelete ( v8::Handle< Value key)

Definition at line 3178 of file api.cc.

3178  {
3179  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3180  ON_BAILOUT(isolate, "v8::Object::ForceDelete()", return false);
3181  ENTER_V8(isolate);
3182  i::HandleScope scope(isolate);
3184  i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
3185 
3186  // When deleting a property on the global object using ForceDelete
3187  // deoptimize all functions as optimized code does not check for the hole
3188  // value with DontDelete properties. We have to deoptimize all contexts
3189  // because of possible cross-context inlined functions.
3190  if (self->IsJSGlobalProxy() || self->IsGlobalObject()) {
3192  }
3193 
3194  EXCEPTION_PREAMBLE(isolate);
3196  has_pending_exception = !i::Runtime::DeleteObjectProperty(
3197  isolate, self, key_obj, i::JSReceiver::FORCE_DELETION).ToHandle(&obj);
3198  EXCEPTION_BAILOUT_CHECK(isolate, false);
3199  return obj->IsTrue();
3200 }
static void DeoptimizeAll(Isolate *isolate)
Definition: deoptimizer.cc:437

References v8::internal::Runtime::DeleteObjectProperty(), v8::internal::Deoptimizer::DeoptimizeAll(), ENTER_V8, EXCEPTION_BAILOUT_CHECK, EXCEPTION_PREAMBLE, v8::internal::JSReceiver::FORCE_DELETION, ON_BAILOUT, and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ ForceSet()

bool v8::Object::ForceSet ( v8::Handle< Value key,
v8::Handle< Value value,
v8::PropertyAttribute  attribs = None 
)

Definition at line 3151 of file api.cc.

3153  {
3154  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3155  ON_BAILOUT(isolate, "v8::Object::ForceSet()", return false);
3156  ENTER_V8(isolate);
3157  i::HandleScope scope(isolate);
3159  i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
3160  i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
3161  EXCEPTION_PREAMBLE(isolate);
3162  has_pending_exception = i::Runtime::DefineObjectProperty(
3163  self,
3164  key_obj,
3165  value_obj,
3166  static_cast<PropertyAttributes>(attribs)).is_null();
3167  EXCEPTION_BAILOUT_CHECK(isolate, false);
3168  return true;
3169 }
static MUST_USE_RESULT MaybeHandle< Object > DefineObjectProperty(Handle< JSObject > object, Handle< Object > key, Handle< Object > value, PropertyAttributes attr)
Definition: runtime.cc:2277
PropertyAttributes

References v8::internal::Runtime::DefineObjectProperty(), ENTER_V8, EXCEPTION_BAILOUT_CHECK, EXCEPTION_PREAMBLE, ON_BAILOUT, and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ Get() [1/2]

Local< Value > v8::Object::Get ( v8::Handle< Value key)

Definition at line 3203 of file api.cc.

3203  {
3204  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3205  ON_BAILOUT(isolate, "v8::Object::Get()", return Local<v8::Value>());
3206  ENTER_V8(isolate);
3208  i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
3209  EXCEPTION_PREAMBLE(isolate);
3210  i::Handle<i::Object> result;
3211  has_pending_exception =
3212  !i::Runtime::GetObjectProperty(isolate, self, key_obj).ToHandle(&result);
3213  EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>());
3214  return Utils::ToLocal(result);
3215 }
static MUST_USE_RESULT MaybeHandle< Object > GetObjectProperty(Isolate *isolate, Handle< Object > object, Handle< Object > key)
Definition: runtime.cc:1912

References ENTER_V8, EXCEPTION_BAILOUT_CHECK, EXCEPTION_PREAMBLE, v8::internal::Runtime::GetObjectProperty(), ON_BAILOUT, v8::Utils::OpenHandle(), and v8::Utils::ToLocal().

+ Here is the call graph for this function:

◆ Get() [2/2]

Local< Value > v8::Object::Get ( uint32_t  index)

Definition at line 3218 of file api.cc.

3218  {
3219  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3220  ON_BAILOUT(isolate, "v8::Object::Get()", return Local<v8::Value>());
3221  ENTER_V8(isolate);
3223  EXCEPTION_PREAMBLE(isolate);
3224  i::Handle<i::Object> result;
3225  has_pending_exception =
3226  !i::Object::GetElement(isolate, self, index).ToHandle(&result);
3227  EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>());
3228  return Utils::ToLocal(result);
3229 }
static MUST_USE_RESULT MaybeHandle< Object > GetElement(Isolate *isolate, Handle< Object > object, uint32_t index)
Definition: objects-inl.h:1113

References ENTER_V8, EXCEPTION_BAILOUT_CHECK, EXCEPTION_PREAMBLE, v8::internal::Object::GetElement(), ON_BAILOUT, v8::Utils::OpenHandle(), and v8::Utils::ToLocal().

+ Here is the call graph for this function:

◆ GetAlignedPointerFromInternalField() [1/2]

static void* v8::Object::GetAlignedPointerFromInternalField ( const PersistentBase< Object > &  object,
int  index 
)
inlinestatic

Same as above, but works for Persistents.

Definition at line 2435 of file v8.h.

2436  {
2437  return object.val_->GetAlignedPointerFromInternalField(index);
2438  }

◆ GetAlignedPointerFromInternalField() [2/2]

void * v8::Object::GetAlignedPointerFromInternalField ( int  index)
inline

Gets a 2-byte-aligned native pointer from an internal field.

This field must have been set by SetAlignedPointerInInternalField, everything else leads to undefined behavior.

Definition at line 6445 of file v8.h.

6445  {
6446 #ifndef V8_ENABLE_CHECKS
6447  typedef internal::Object O;
6448  typedef internal::Internals I;
6449  O* obj = *reinterpret_cast<O**>(this);
6450  // Fast path: If the object is a plain JSObject, which is the common case, we
6451  // know where to find the internal fields and can return the value directly.
6452  if (V8_LIKELY(I::GetInstanceType(obj) == I::kJSObjectType)) {
6453  int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * index);
6454  return I::ReadField<void*>(obj, offset);
6455  }
6456 #endif
6458 }
void * SlowGetAlignedPointerFromInternalField(int index)
Definition: api.cc:5020
const int kApiPointerSize
Definition: v8.h:5732
kSerializedDataOffset Object
Definition: objects-inl.h:5322
#define I(name, number_of_args, result_size)
Definition: runtime.cc:9248
#define V8_LIKELY(condition)
Definition: v8config.h:343

References I, v8::internal::kApiPointerSize, and V8_LIKELY.

◆ GetConstructorName()

Local< String > v8::Object::GetConstructorName ( )

Returns the name of the function invoked as a constructor for this object.

Definition at line 3430 of file api.cc.

3430  {
3431  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3432  ON_BAILOUT(isolate, "v8::Object::GetConstructorName()",
3433  return Local<v8::String>());
3434  ENTER_V8(isolate);
3436  i::Handle<i::String> name(self->constructor_name());
3437  return Utils::ToLocal(name);
3438 }
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in name

References ENTER_V8, name, ON_BAILOUT, v8::Utils::OpenHandle(), and v8::Utils::ToLocal().

+ Here is the call graph for this function:

◆ GetHiddenValue()

v8::Local< v8::Value > v8::Object::GetHiddenValue ( Handle< String key)

Definition at line 3785 of file api.cc.

3785  {
3786  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3787  ON_BAILOUT(isolate, "v8::Object::GetHiddenValue()",
3788  return Local<v8::Value>());
3789  ENTER_V8(isolate);
3791  i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
3792  i::Handle<i::String> key_string =
3793  isolate->factory()->InternalizeString(key_obj);
3794  i::Handle<i::Object> result(self->GetHiddenProperty(key_string), isolate);
3795  if (result->IsTheHole()) return v8::Local<v8::Value>();
3796  return Utils::ToLocal(result);
3797 }
A light-weight stack-allocated object handle.
Definition: v8.h:334

References ENTER_V8, v8::internal::Isolate::factory(), ON_BAILOUT, v8::Utils::OpenHandle(), and v8::Utils::ToLocal().

+ Here is the call graph for this function:

◆ GetIdentityHash()

int v8::Object::GetIdentityHash ( )

Returns the identity hash for this object.

The current implementation uses a hidden property on the object to store the identity hash.

The return value will never be 0. Also, it is not guaranteed to be unique.

Definition at line 3757 of file api.cc.

3757  {
3758  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3759  ON_BAILOUT(isolate, "v8::Object::GetIdentityHash()", return 0);
3760  ENTER_V8(isolate);
3761  i::HandleScope scope(isolate);
3763  return i::JSReceiver::GetOrCreateIdentityHash(self)->value();
3764 }
static Handle< Smi > GetOrCreateIdentityHash(Handle< JSReceiver > object)
Definition: objects-inl.h:6704

References ENTER_V8, v8::internal::JSReceiver::GetOrCreateIdentityHash(), ON_BAILOUT, and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ GetIndexedPropertiesExternalArrayData()

void * v8::Object::GetIndexedPropertiesExternalArrayData ( )

Definition at line 3936 of file api.cc.

3936  {
3938  ON_BAILOUT(self->GetIsolate(),
3939  "v8::GetIndexedPropertiesExternalArrayData()",
3940  return NULL);
3941  if (self->HasExternalArrayElements()) {
3942  return i::ExternalArray::cast(self->elements())->external_pointer();
3943  } else {
3944  return NULL;
3945  }
3946 }
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL

References NULL, ON_BAILOUT, and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ GetIndexedPropertiesExternalArrayDataLength()

int v8::Object::GetIndexedPropertiesExternalArrayDataLength ( )

Definition at line 3966 of file api.cc.

3966  {
3968  ON_BAILOUT(self->GetIsolate(),
3969  "v8::GetIndexedPropertiesExternalArrayDataLength()",
3970  return 0);
3971  if (self->HasExternalArrayElements()) {
3972  return i::ExternalArray::cast(self->elements())->length();
3973  } else {
3974  return -1;
3975  }
3976 }

References ON_BAILOUT, and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ GetIndexedPropertiesExternalArrayDataType()

ExternalArrayType v8::Object::GetIndexedPropertiesExternalArrayDataType ( )

Definition at line 3949 of file api.cc.

3949  {
3951  ON_BAILOUT(self->GetIsolate(),
3952  "v8::GetIndexedPropertiesExternalArrayDataType()",
3953  return static_cast<ExternalArrayType>(-1));
3954  switch (self->elements()->map()->instance_type()) {
3955 #define INSTANCE_TYPE_TO_ARRAY_TYPE(Type, type, TYPE, ctype, size) \
3956  case i::EXTERNAL_##TYPE##_ARRAY_TYPE: \
3957  return kExternal##Type##Array;
3959 #undef INSTANCE_TYPE_TO_ARRAY_TYPE
3960  default:
3961  return static_cast<ExternalArrayType>(-1);
3962  }
3963 }
#define INSTANCE_TYPE_TO_ARRAY_TYPE(Type, type, TYPE, ctype, size)
ExternalArrayType
Definition: v8.h:2217
#define TYPED_ARRAYS(V)
Definition: objects.h:4433

References INSTANCE_TYPE_TO_ARRAY_TYPE, ON_BAILOUT, v8::Utils::OpenHandle(), and TYPED_ARRAYS.

+ Here is the call graph for this function:

◆ GetIndexedPropertiesPixelData()

uint8_t * v8::Object::GetIndexedPropertiesPixelData ( )

Definition at line 3879 of file api.cc.

3879  {
3881  ON_BAILOUT(self->GetIsolate(), "v8::GetIndexedPropertiesPixelData()",
3882  return NULL);
3883  if (self->HasExternalUint8ClampedElements()) {
3884  return i::ExternalUint8ClampedArray::cast(self->elements())->
3885  external_uint8_clamped_pointer();
3886  } else {
3887  return NULL;
3888  }
3889 }

References NULL, ON_BAILOUT, and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ GetIndexedPropertiesPixelDataLength()

int v8::Object::GetIndexedPropertiesPixelDataLength ( )

Definition at line 3892 of file api.cc.

3892  {
3894  ON_BAILOUT(self->GetIsolate(), "v8::GetIndexedPropertiesPixelDataLength()",
3895  return -1);
3896  if (self->HasExternalUint8ClampedElements()) {
3897  return i::ExternalUint8ClampedArray::cast(self->elements())->length();
3898  } else {
3899  return -1;
3900  }
3901 }

References ON_BAILOUT, and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ GetInternalField()

Local< Value > v8::Object::GetInternalField ( int  index)
inline

Gets the value from an internal field.

Definition at line 6426 of file v8.h.

6426  {
6427 #ifndef V8_ENABLE_CHECKS
6428  typedef internal::Object O;
6429  typedef internal::HeapObject HO;
6430  typedef internal::Internals I;
6431  O* obj = *reinterpret_cast<O**>(this);
6432  // Fast path: If the object is a plain JSObject, which is the common case, we
6433  // know where to find the internal fields and can return the value directly.
6434  if (I::GetInstanceType(obj) == I::kJSObjectType) {
6435  int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * index);
6436  O* value = I::ReadField<O*>(obj, offset);
6437  O** result = HandleScope::CreateHandle(reinterpret_cast<HO*>(obj), value);
6438  return Local<Value>(reinterpret_cast<Value*>(result));
6439  }
6440 #endif
6441  return SlowGetInternalField(index);
6442 }
static internal::Object ** CreateHandle(internal::Isolate *isolate, internal::Object *value)
Definition: api.cc:579
Local< Value > SlowGetInternalField(int index)
Definition: api.cc:5001

References v8::HandleScope::CreateHandle(), I, and v8::internal::kApiPointerSize.

+ Here is the call graph for this function:

◆ GetOwnPropertyDescriptor()

Local< Value > v8::Object::GetOwnPropertyDescriptor ( Local< String key)

Returns Object.getOwnPropertyDescriptor as per ES5 section 15.2.3.3.

Definition at line 3262 of file api.cc.

3262  {
3263  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3264  ON_BAILOUT(isolate, "v8::Object::GetOwnPropertyDescriptor()",
3265  return Local<Value>());
3266  ENTER_V8(isolate);
3268  i::Handle<i::Name> key_name = Utils::OpenHandle(*key);
3269  i::Handle<i::Object> args[] = { obj, key_name };
3270  EXCEPTION_PREAMBLE(isolate);
3271  i::Handle<i::Object> result;
3272  has_pending_exception = !CallV8HeapFunction(
3273  "ObjectGetOwnPropertyDescriptor",
3274  isolate->factory()->undefined_value(),
3275  arraysize(args),
3276  args).ToHandle(&result);
3277  EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>());
3278  return Utils::ToLocal(result);
3279 }
#define arraysize(array)
Definition: macros.h:86
static MUST_USE_RESULT i::MaybeHandle< i::Object > CallV8HeapFunction(const char *name, i::Handle< i::Object > recv, int argc, i::Handle< i::Object > argv[])
Definition: api.cc:2112

References arraysize, v8::CallV8HeapFunction(), ENTER_V8, EXCEPTION_BAILOUT_CHECK, EXCEPTION_PREAMBLE, v8::internal::Isolate::factory(), ON_BAILOUT, v8::Utils::OpenHandle(), and v8::Utils::ToLocal().

+ Here is the call graph for this function:

◆ GetOwnPropertyNames()

Local< Array > v8::Object::GetOwnPropertyNames ( )

This function has the same functionality as GetPropertyNames but the returned array doesn't contain the names of properties from prototype objects.

Definition at line 3353 of file api.cc.

3353  {
3354  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3355  ON_BAILOUT(isolate, "v8::Object::GetOwnPropertyNames()",
3356  return Local<v8::Array>());
3357  ENTER_V8(isolate);
3358  i::HandleScope scope(isolate);
3360  EXCEPTION_PREAMBLE(isolate);
3362  has_pending_exception = !i::JSReceiver::GetKeys(
3363  self, i::JSReceiver::OWN_ONLY).ToHandle(&value);
3364  EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Array>());
3365  // Because we use caching to speed up enumeration it is important
3366  // to never change the result of the basic enumeration function so
3367  // we clone the result.
3368  i::Handle<i::FixedArray> elms = isolate->factory()->CopyFixedArray(value);
3369  i::Handle<i::JSArray> result =
3370  isolate->factory()->NewJSArrayWithElements(elms);
3371  return Utils::ToLocal(scope.CloseAndEscape(result));
3372 }
static MUST_USE_RESULT MaybeHandle< FixedArray > GetKeys(Handle< JSReceiver > object, KeyCollectionType type)
Definition: objects.cc:5797

References v8::internal::HandleScope::CloseAndEscape(), ENTER_V8, EXCEPTION_BAILOUT_CHECK, EXCEPTION_PREAMBLE, v8::internal::Isolate::factory(), v8::internal::JSReceiver::GetKeys(), ON_BAILOUT, v8::Utils::OpenHandle(), v8::internal::JSReceiver::OWN_ONLY, and v8::Utils::ToLocal().

+ Here is the call graph for this function:

◆ GetPrivate()

Local< Value > v8::Object::GetPrivate ( v8::Handle< Private key)

Definition at line 3232 of file api.cc.

3232  {
3233  return Get(v8::Handle<Value>(reinterpret_cast<Value*>(*key)));
3234 }
Local< Value > Get(Handle< Value > key)
Definition: api.cc:3203

◆ GetPropertyAttributes()

PropertyAttribute v8::Object::GetPropertyAttributes ( v8::Handle< Value key)

Gets the property attributes of a property which can be None or any combination of ReadOnly, DontEnum and DontDelete.

Returns None when the property doesn't exist.

Definition at line 3237 of file api.cc.

3237  {
3238  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3239  ON_BAILOUT(isolate, "v8::Object::GetPropertyAttributes()",
3240  return static_cast<PropertyAttribute>(NONE));
3241  ENTER_V8(isolate);
3242  i::HandleScope scope(isolate);
3244  i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
3245  if (!key_obj->IsName()) {
3246  EXCEPTION_PREAMBLE(isolate);
3247  has_pending_exception = !i::Execution::ToString(
3248  isolate, key_obj).ToHandle(&key_obj);
3249  EXCEPTION_BAILOUT_CHECK(isolate, static_cast<PropertyAttribute>(NONE));
3250  }
3251  i::Handle<i::Name> key_name = i::Handle<i::Name>::cast(key_obj);
3252  EXCEPTION_PREAMBLE(isolate);
3253  Maybe<PropertyAttributes> result =
3254  i::JSReceiver::GetPropertyAttributes(self, key_name);
3255  has_pending_exception = !result.has_value;
3256  EXCEPTION_BAILOUT_CHECK(isolate, static_cast<PropertyAttribute>(NONE));
3257  if (result.value == ABSENT) return static_cast<PropertyAttribute>(NONE);
3258  return static_cast<PropertyAttribute>(result.value);
3259 }
static MUST_USE_RESULT Maybe< PropertyAttributes > GetPropertyAttributes(Handle< JSReceiver > object, Handle< Name > name)
Definition: objects-inl.h:6670
PropertyAttribute
Definition: v8.h:2210
@ ABSENT
@ NONE

References ABSENT, v8::internal::Handle< T >::cast(), ENTER_V8, EXCEPTION_BAILOUT_CHECK, EXCEPTION_PREAMBLE, v8::internal::JSReceiver::GetPropertyAttributes(), v8::Maybe< T >::has_value, NONE, ON_BAILOUT, v8::Utils::OpenHandle(), and v8::Maybe< T >::value.

+ Here is the call graph for this function:

◆ GetPropertyNames()

Local< Array > v8::Object::GetPropertyNames ( )

Returns an array containing the names of the enumerable properties of this object, including properties from prototype objects.

The array returned by this method contains the same values as would be enumerated by a for-in statement over this object.

Definition at line 3331 of file api.cc.

3331  {
3332  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3333  ON_BAILOUT(isolate, "v8::Object::GetPropertyNames()",
3334  return Local<v8::Array>());
3335  ENTER_V8(isolate);
3336  i::HandleScope scope(isolate);
3338  EXCEPTION_PREAMBLE(isolate);
3340  has_pending_exception = !i::JSReceiver::GetKeys(
3341  self, i::JSReceiver::INCLUDE_PROTOS).ToHandle(&value);
3342  EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Array>());
3343  // Because we use caching to speed up enumeration it is important
3344  // to never change the result of the basic enumeration function so
3345  // we clone the result.
3346  i::Handle<i::FixedArray> elms = isolate->factory()->CopyFixedArray(value);
3347  i::Handle<i::JSArray> result =
3348  isolate->factory()->NewJSArrayWithElements(elms);
3349  return Utils::ToLocal(scope.CloseAndEscape(result));
3350 }

References v8::internal::HandleScope::CloseAndEscape(), ENTER_V8, EXCEPTION_BAILOUT_CHECK, EXCEPTION_PREAMBLE, v8::internal::Isolate::factory(), v8::internal::JSReceiver::GetKeys(), v8::internal::JSReceiver::INCLUDE_PROTOS, ON_BAILOUT, v8::Utils::OpenHandle(), and v8::Utils::ToLocal().

+ Here is the call graph for this function:

◆ GetPrototype()

Local< Value > v8::Object::GetPrototype ( )

Get the prototype object.

This does not skip objects marked to be skipped by proto and it does not consult the security handler.

Definition at line 3282 of file api.cc.

3282  {
3283  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3284  ON_BAILOUT(isolate, "v8::Object::GetPrototype()", return Local<v8::Value>());
3285  ENTER_V8(isolate);
3287  i::PrototypeIterator iter(isolate, self);
3289 }
Object * GetCurrent() const
Definition: prototype.h:62

References ENTER_V8, v8::internal::PrototypeIterator::GetCurrent(), ON_BAILOUT, v8::Utils::OpenHandle(), and v8::Utils::ToLocal().

+ Here is the call graph for this function:

◆ GetRealNamedProperty()

Local< Value > v8::Object::GetRealNamedProperty ( Handle< String key)

If result.IsEmpty() no real property was located on the object or in the prototype chain.

This means interceptors in the prototype chain are not called.

Definition at line 3695 of file api.cc.

3695  {
3696  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3697  ON_BAILOUT(isolate, "v8::Object::GetRealNamedProperty()",
3698  return Local<Value>());
3699  ENTER_V8(isolate);
3700  i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this);
3701  i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
3702  i::LookupIterator it(self_obj, key_obj,
3703  i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR);
3704  return GetPropertyByLookup(&it);
3705 }
static Local< Value > GetPropertyByLookup(i::LookupIterator *it)
Definition: api.cc:3665

References ENTER_V8, v8::GetPropertyByLookup(), ON_BAILOUT, and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ GetRealNamedPropertyInPrototypeChain()

Local< Value > v8::Object::GetRealNamedPropertyInPrototypeChain ( Handle< String key)

If result.IsEmpty() no real property was located in the prototype chain.

This means interceptors in the prototype chain are not called.

Definition at line 3677 of file api.cc.

3678  {
3679  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3680  ON_BAILOUT(isolate,
3681  "v8::Object::GetRealNamedPropertyInPrototypeChain()",
3682  return Local<Value>());
3683  ENTER_V8(isolate);
3684  i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this);
3685  i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
3686  i::PrototypeIterator iter(isolate, self_obj);
3687  if (iter.IsAtEnd()) return Local<Value>();
3689  i::LookupIterator it(self_obj, key_obj, i::Handle<i::JSReceiver>::cast(proto),
3690  i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR);
3691  return GetPropertyByLookup(&it);
3692 }

References ENTER_V8, v8::internal::PrototypeIterator::GetCurrent(), v8::GetPropertyByLookup(), v8::internal::PrototypeIterator::IsAtEnd(), ON_BAILOUT, and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ Has() [1/2]

bool v8::Object::Has ( v8::Handle< Value key)

Definition at line 3462 of file api.cc.

3462  {
3463  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3464  ON_BAILOUT(isolate, "v8::Object::Has()", return false);
3465  ENTER_V8(isolate);
3467  i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
3468  EXCEPTION_PREAMBLE(isolate);
3470  has_pending_exception = !i::Runtime::HasObjectProperty(
3471  isolate, self, key_obj).ToHandle(&obj);
3472  EXCEPTION_BAILOUT_CHECK(isolate, false);
3473  return obj->IsTrue();
3474 }
static MUST_USE_RESULT MaybeHandle< Object > HasObjectProperty(Isolate *isolate, Handle< JSReceiver > object, Handle< Object > key)
Definition: runtime.cc:1891

References ENTER_V8, EXCEPTION_BAILOUT_CHECK, EXCEPTION_PREAMBLE, v8::internal::Runtime::HasObjectProperty(), ON_BAILOUT, and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ Has() [2/2]

bool v8::Object::Has ( uint32_t  index)

Definition at line 3501 of file api.cc.

3501  {
3502  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3503  ON_BAILOUT(isolate, "v8::Object::HasProperty()", return false);
3505  EXCEPTION_PREAMBLE(isolate);
3506  Maybe<bool> maybe = i::JSReceiver::HasElement(self, index);
3507  has_pending_exception = !maybe.has_value;
3508  EXCEPTION_BAILOUT_CHECK(isolate, false);
3509  return maybe.value;
3510 }
static MUST_USE_RESULT Maybe< bool > HasElement(Handle< JSReceiver > object, uint32_t index)
Definition: objects-inl.h:6718
Maybe< T > maybe(T t)
Definition: v8.h:902

References EXCEPTION_BAILOUT_CHECK, EXCEPTION_PREAMBLE, v8::internal::JSReceiver::HasElement(), v8::maybe(), ON_BAILOUT, and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ HasIndexedLookupInterceptor()

bool v8::Object::HasIndexedLookupInterceptor ( )

Tests for an index lookup interceptor.

Definition at line 3657 of file api.cc.

3657  {
3658  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3659  ON_BAILOUT(isolate, "v8::Object::HasIndexedLookupInterceptor()",
3660  return false);
3661  return Utils::OpenHandle(this)->HasIndexedInterceptor();
3662 }

References ON_BAILOUT, and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ HasIndexedPropertiesInExternalArrayData()

bool v8::Object::HasIndexedPropertiesInExternalArrayData ( )

Definition at line 3927 of file api.cc.

3927  {
3929  ON_BAILOUT(self->GetIsolate(),
3930  "v8::HasIndexedPropertiesInExternalArrayData()",
3931  return false);
3932  return self->HasExternalArrayElements();
3933 }

References ON_BAILOUT, and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ HasIndexedPropertiesInPixelData()

bool v8::Object::HasIndexedPropertiesInPixelData ( )

Definition at line 3871 of file api.cc.

3871  {
3873  ON_BAILOUT(self->GetIsolate(), "v8::HasIndexedPropertiesInPixelData()",
3874  return false);
3875  return self->HasExternalUint8ClampedElements();
3876 }

References ON_BAILOUT, and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ HasNamedLookupInterceptor()

bool v8::Object::HasNamedLookupInterceptor ( )

Tests for a named lookup interceptor.

Definition at line 3649 of file api.cc.

3649  {
3650  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3651  ON_BAILOUT(isolate, "v8::Object::HasNamedLookupInterceptor()",
3652  return false);
3653  return Utils::OpenHandle(this)->HasNamedInterceptor();
3654 }

References ON_BAILOUT, and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ HasOwnProperty()

bool v8::Object::HasOwnProperty ( Handle< String key)

Definition at line 3595 of file api.cc.

3595  {
3596  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3597  ON_BAILOUT(isolate, "v8::Object::HasOwnProperty()",
3598  return false);
3599  EXCEPTION_PREAMBLE(isolate);
3601  Utils::OpenHandle(*key));
3602  has_pending_exception = !maybe.has_value;
3603  EXCEPTION_BAILOUT_CHECK(isolate, false);
3604  return maybe.value;
3605 }
static MUST_USE_RESULT Maybe< bool > HasOwnProperty(Handle< JSReceiver >, Handle< Name > name)
Definition: objects-inl.h:6658

References EXCEPTION_BAILOUT_CHECK, EXCEPTION_PREAMBLE, v8::internal::JSReceiver::HasOwnProperty(), v8::maybe(), ON_BAILOUT, and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ HasPrivate()

bool v8::Object::HasPrivate ( v8::Handle< Private key)

Functionality for private properties.

This is an experimental feature, use at your own risk. Note: Private properties are inherited. Do not rely on this, since it may change.

Definition at line 3477 of file api.cc.

3477  {
3478  // TODO(rossberg): this should use HasOwnProperty, but we'd need to
3479  // generalise that to a (noy yet existant) Name argument first.
3480  return Has(v8::Handle<Value>(reinterpret_cast<Value*>(*key)));
3481 }
bool Has(Handle< Value > key)
Definition: api.cc:3462

◆ HasRealIndexedProperty()

bool v8::Object::HasRealIndexedProperty ( uint32_t  index)

Definition at line 3621 of file api.cc.

3621  {
3622  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3623  ON_BAILOUT(isolate, "v8::Object::HasRealIndexedProperty()",
3624  return false);
3625  EXCEPTION_PREAMBLE(isolate);
3626  Maybe<bool> maybe =
3628  has_pending_exception = !maybe.has_value;
3629  EXCEPTION_BAILOUT_CHECK(isolate, false);
3630  return maybe.value;
3631 }
static MUST_USE_RESULT Maybe< bool > HasRealElementProperty(Handle< JSObject > object, uint32_t index)
Definition: objects.cc:13214

References EXCEPTION_BAILOUT_CHECK, EXCEPTION_PREAMBLE, v8::internal::JSObject::HasRealElementProperty(), v8::maybe(), ON_BAILOUT, and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ HasRealNamedCallbackProperty()

bool v8::Object::HasRealNamedCallbackProperty ( Handle< String key)

Definition at line 3634 of file api.cc.

3634  {
3635  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3636  ON_BAILOUT(isolate,
3637  "v8::Object::HasRealNamedCallbackProperty()",
3638  return false);
3639  ENTER_V8(isolate);
3640  EXCEPTION_PREAMBLE(isolate);
3642  Utils::OpenHandle(this), Utils::OpenHandle(*key));
3643  has_pending_exception = !maybe.has_value;
3644  EXCEPTION_BAILOUT_CHECK(isolate, false);
3645  return maybe.value;
3646 }
static MUST_USE_RESULT Maybe< bool > HasRealNamedCallbackProperty(Handle< JSObject > object, Handle< Name > key)
Definition: objects.cc:13243

References ENTER_V8, EXCEPTION_BAILOUT_CHECK, EXCEPTION_PREAMBLE, v8::internal::JSObject::HasRealNamedCallbackProperty(), v8::maybe(), ON_BAILOUT, and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ HasRealNamedProperty()

bool v8::Object::HasRealNamedProperty ( Handle< String key)

Definition at line 3608 of file api.cc.

3608  {
3609  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3610  ON_BAILOUT(isolate, "v8::Object::HasRealNamedProperty()",
3611  return false);
3612  EXCEPTION_PREAMBLE(isolate);
3614  Utils::OpenHandle(this), Utils::OpenHandle(*key));
3615  has_pending_exception = !maybe.has_value;
3616  EXCEPTION_BAILOUT_CHECK(isolate, false);
3617  return maybe.value;
3618 }
static MUST_USE_RESULT Maybe< bool > HasRealNamedProperty(Handle< JSObject > object, Handle< Name > key)
Definition: objects.cc:13205

References EXCEPTION_BAILOUT_CHECK, EXCEPTION_PREAMBLE, v8::internal::JSObject::HasRealNamedProperty(), v8::maybe(), ON_BAILOUT, and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ InternalFieldCount() [1/2]

int v8::Object::InternalFieldCount ( )

Gets the number of internal fields for this Object.

Definition at line 4986 of file api.cc.

4986  {
4988  return obj->GetInternalFieldCount();
4989 }

References v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ InternalFieldCount() [2/2]

static int v8::Object::InternalFieldCount ( const PersistentBase< Object > &  object)
inlinestatic

Same as above, but works for Persistents.

Definition at line 2416 of file v8.h.

2417  {
2418  return object.val_->InternalFieldCount();
2419  }

◆ IsCallable()

bool v8::Object::IsCallable ( )

Checks whether a callback is set by the ObjectTemplate::SetCallAsFunctionHandler method.

When an Object is callable this method returns true.

Definition at line 3979 of file api.cc.

3979  {
3980  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3981  ON_BAILOUT(isolate, "v8::Object::IsCallable()", return false);
3982  ENTER_V8(isolate);
3983  i::HandleScope scope(isolate);
3985  return obj->IsCallable();
3986 }

References ENTER_V8, ON_BAILOUT, and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ IsDirty()

bool v8::Object::IsDirty ( )

Returns true if this is an instance of an api function (one created from a function created from a function template) and has been modified since it was created.

Note that this method is conservative and may return true for objects that haven't actually been modified.

Definition at line 3728 of file api.cc.

3728  {
3729  return Utils::OpenHandle(this)->IsDirty();
3730 }

References v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ New()

Local< v8::Object > v8::Object::New ( Isolate isolate)
static

Definition at line 5610 of file api.cc.

5610  {
5611  i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
5612  LOG_API(i_isolate, "Object::New");
5613  ENTER_V8(i_isolate);
5615  i_isolate->factory()->NewJSObject(i_isolate->object_function());
5616  return Utils::ToLocal(obj);
5617 }

References ENTER_V8, v8::internal::Isolate::factory(), LOG_API, and v8::Utils::ToLocal().

Referenced by v8::internal::StatisticsExtension::GetCounters().

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

◆ ObjectProtoToString()

Local< String > v8::Object::ObjectProtoToString ( )

Call builtin Object.prototype.toString on this object.

This is different from Value::ToString() that may call user-defined toString function. This one does not.

Definition at line 3375 of file api.cc.

3375  {
3376  i::Isolate* i_isolate = Utils::OpenHandle(this)->GetIsolate();
3377  Isolate* isolate = reinterpret_cast<Isolate*>(i_isolate);
3378  ON_BAILOUT(i_isolate, "v8::Object::ObjectProtoToString()",
3379  return Local<v8::String>());
3380  ENTER_V8(i_isolate);
3382 
3383  i::Handle<i::Object> name(self->class_name(), i_isolate);
3384 
3385  // Native implementation of Object.prototype.toString (v8natives.js):
3386  // var c = %_ClassOf(this);
3387  // if (c === 'Arguments') c = 'Object';
3388  // return "[object " + c + "]";
3389 
3390  if (!name->IsString()) {
3391  return v8::String::NewFromUtf8(isolate, "[object ]");
3392  } else {
3394  if (i::String::Equals(class_name,
3395  i_isolate->factory()->Arguments_string())) {
3396  return v8::String::NewFromUtf8(isolate, "[object Object]");
3397  } else {
3398  const char* prefix = "[object ";
3399  Local<String> str = Utils::ToLocal(class_name);
3400  const char* postfix = "]";
3401 
3402  int prefix_len = i::StrLength(prefix);
3403  int str_len = str->Utf8Length();
3404  int postfix_len = i::StrLength(postfix);
3405 
3406  int buf_len = prefix_len + str_len + postfix_len;
3407  i::ScopedVector<char> buf(buf_len);
3408 
3409  // Write prefix.
3410  char* ptr = buf.start();
3411  i::MemCopy(ptr, prefix, prefix_len * v8::internal::kCharSize);
3412  ptr += prefix_len;
3413 
3414  // Write real content.
3415  str->WriteUtf8(ptr, str_len);
3416  ptr += str_len;
3417 
3418  // Write postfix.
3419  i::MemCopy(ptr, postfix, postfix_len * v8::internal::kCharSize);
3420 
3421  // Copy the buffer into a heap-allocated string and return it.
3422  Local<String> result = v8::String::NewFromUtf8(
3423  isolate, buf.start(), String::kNormalString, buf_len);
3424  return result;
3425  }
3426  }
3427 }
@ kNormalString
Definition: v8.h:1963
static Local< String > NewFromUtf8(Isolate *isolate, const char *data, NewStringType type=kNormalString, int length=-1)
Allocates a new string from UTF-8 data.
Definition: api.cc:5447
bool Equals(String *other)
Definition: objects-inl.h:3336
const int kCharSize
Definition: globals.h:122
int StrLength(const char *string)
Definition: vector.h:147
void MemCopy(void *dest, const void *src, size_t size)
Definition: utils.h:350

References v8::internal::Handle< T >::cast(), ENTER_V8, v8::internal::String::Equals(), v8::internal::Isolate::factory(), v8::Value::IsString(), v8::internal::kCharSize, v8::String::kNormalString, v8::internal::MemCopy(), name, v8::String::NewFromUtf8(), ON_BAILOUT, v8::Utils::OpenHandle(), v8::internal::Vector< T >::start(), v8::internal::StrLength(), and v8::Utils::ToLocal().

+ Here is the call graph for this function:

◆ Set() [1/2]

bool v8::Object::Set ( v8::Handle< Value key,
v8::Handle< Value value 
)

Definition at line 3119 of file api.cc.

3119  {
3120  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3121  ON_BAILOUT(isolate, "v8::Object::Set()", return false);
3122  ENTER_V8(isolate);
3123  i::HandleScope scope(isolate);
3125  i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
3126  i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
3127  EXCEPTION_PREAMBLE(isolate);
3128  has_pending_exception =
3129  i::Runtime::SetObjectProperty(isolate, self, key_obj, value_obj,
3130  i::SLOPPY).is_null();
3131  EXCEPTION_BAILOUT_CHECK(isolate, false);
3132  return true;
3133 }
static MUST_USE_RESULT MaybeHandle< Object > SetObjectProperty(Isolate *isolate, Handle< Object > object, Handle< Object > key, Handle< Object > value, StrictMode strict_mode)
Definition: runtime.cc:2181

References ENTER_V8, EXCEPTION_BAILOUT_CHECK, EXCEPTION_PREAMBLE, ON_BAILOUT, v8::Utils::OpenHandle(), v8::internal::Runtime::SetObjectProperty(), and v8::internal::SLOPPY.

+ Here is the call graph for this function:

◆ Set() [2/2]

bool v8::Object::Set ( uint32_t  index,
v8::Handle< Value value 
)

Definition at line 3136 of file api.cc.

3136  {
3137  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3138  ON_BAILOUT(isolate, "v8::Object::Set()", return false);
3139  ENTER_V8(isolate);
3140  i::HandleScope scope(isolate);
3142  i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
3143  EXCEPTION_PREAMBLE(isolate);
3144  has_pending_exception = i::JSObject::SetElement(
3145  self, index, value_obj, NONE, i::SLOPPY).is_null();
3146  EXCEPTION_BAILOUT_CHECK(isolate, false);
3147  return true;
3148 }
static MUST_USE_RESULT MaybeHandle< Object > SetElement(Handle< JSObject > object, uint32_t index, Handle< Object > value, PropertyAttributes attributes, StrictMode strict_mode, bool check_prototype=true, SetPropertyMode set_mode=SET_PROPERTY)
Definition: objects.cc:12336

References ENTER_V8, EXCEPTION_BAILOUT_CHECK, EXCEPTION_PREAMBLE, NONE, ON_BAILOUT, v8::Utils::OpenHandle(), v8::internal::JSObject::SetElement(), and v8::internal::SLOPPY.

+ Here is the call graph for this function:

◆ SetAccessor() [1/2]

bool v8::Object::SetAccessor ( Handle< Name name,
AccessorNameGetterCallback  getter,
AccessorNameSetterCallback  setter = 0,
v8::Handle< Value data = Handle<Value>(),
AccessControl  settings = DEFAULT,
PropertyAttribute  attribute = None 
)

Definition at line 3552 of file api.cc.

3557  {
3558  return ObjectSetAccessor(
3559  this, name, getter, setter, data, settings, attributes);
3560 }
static bool ObjectSetAccessor(Object *obj, Handle< Name > name, Getter getter, Setter setter, Data data, AccessControl settings, PropertyAttribute attributes)
Definition: api.cc:3514

References name, and v8::ObjectSetAccessor().

+ Here is the call graph for this function:

◆ SetAccessor() [2/2]

bool v8::Object::SetAccessor ( Handle< String name,
AccessorGetterCallback  getter,
AccessorSetterCallback  setter = 0,
v8::Handle< Value data = Handle<Value>(),
AccessControl  settings = DEFAULT,
PropertyAttribute  attribute = None 
)

Definition at line 3541 of file api.cc.

3546  {
3547  return ObjectSetAccessor(
3548  this, name, getter, setter, data, settings, attributes);
3549 }

References name, and v8::ObjectSetAccessor().

+ Here is the call graph for this function:

◆ SetAccessorProperty()

void v8::Object::SetAccessorProperty ( Local< Name name,
Local< Function getter,
Handle< Function setter = Handle<Function>(),
PropertyAttribute  attribute = None,
AccessControl  settings = DEFAULT 
)

Definition at line 3573 of file api.cc.

3577  {
3578  // TODO(verwaest): Remove |settings|.
3579  DCHECK_EQ(v8::DEFAULT, settings);
3580  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3581  ON_BAILOUT(isolate, "v8::Object::SetAccessorProperty()", return);
3582  ENTER_V8(isolate);
3583  i::HandleScope scope(isolate);
3584  i::Handle<i::Object> getter_i = v8::Utils::OpenHandle(*getter);
3585  i::Handle<i::Object> setter_i = v8::Utils::OpenHandle(*setter, true);
3586  if (setter_i.is_null()) setter_i = isolate->factory()->null_value();
3589  getter_i,
3590  setter_i,
3591  static_cast<PropertyAttributes>(attribute));
3592 }
static MaybeHandle< Object > DefineAccessor(Handle< JSObject > object, Handle< Name > name, Handle< Object > getter, Handle< Object > setter, PropertyAttributes attributes)
Definition: objects.cc:6095
#define DCHECK_EQ(v1, v2)
Definition: logging.h:206
@ DEFAULT
Definition: v8.h:2273

References DCHECK_EQ, v8::DEFAULT, v8::internal::JSObject::DefineAccessor(), ENTER_V8, v8::internal::Isolate::factory(), v8::internal::Handle< T >::is_null(), name, ON_BAILOUT, and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ SetAlignedPointerInInternalField()

void v8::Object::SetAlignedPointerInInternalField ( int  index,
void *  value 
)

Sets a 2-byte-aligned native pointer in an internal field.

To retrieve such a field, GetAlignedPointerFromInternalField must be used, everything else leads to undefined behavior.

Definition at line 5028 of file api.cc.

5028  {
5030  const char* location = "v8::Object::SetAlignedPointerInInternalField()";
5031  if (!InternalFieldOK(obj, index, location)) return;
5032  obj->SetInternalField(index, EncodeAlignedAsSmi(value, location));
5034 }
void * GetAlignedPointerFromInternalField(int index)
Gets a 2-byte-aligned native pointer from an internal field.
Definition: v8.h:6445
static i::Smi * EncodeAlignedAsSmi(void *value, const char *location)
Definition: api.cc:644
static bool InternalFieldOK(i::Handle< i::JSObject > obj, int index, const char *location)
Definition: api.cc:4992

References DCHECK_EQ, v8::EncodeAlignedAsSmi(), v8::InternalFieldOK(), and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ SetDeclaredAccessor()

bool v8::Object::SetDeclaredAccessor ( Local< Name name,
Local< DeclaredAccessorDescriptor descriptor,
PropertyAttribute  attribute = None,
AccessControl  settings = DEFAULT 
)

Definition at line 3563 of file api.cc.

3566  {
3567  void* null = NULL;
3568  return ObjectSetAccessor(
3569  this, name, descriptor, null, null, settings, attributes);
3570 }

References name, NULL, and v8::ObjectSetAccessor().

+ Here is the call graph for this function:

◆ SetHiddenValue()

bool v8::Object::SetHiddenValue ( Handle< String key,
Handle< Value value 
)

Access hidden properties on JavaScript objects.

These properties are hidden from the executing JavaScript and only accessible through the V8 C++ API. Hidden properties introduced by V8 internally (for example the identity hash) are prefixed with "v8::".

Definition at line 3767 of file api.cc.

3768  {
3769  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3770  ON_BAILOUT(isolate, "v8::Object::SetHiddenValue()", return false);
3771  if (value.IsEmpty()) return DeleteHiddenValue(key);
3772  ENTER_V8(isolate);
3773  i::HandleScope scope(isolate);
3775  i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
3776  i::Handle<i::String> key_string =
3777  isolate->factory()->InternalizeString(key_obj);
3778  i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
3779  i::Handle<i::Object> result =
3780  i::JSObject::SetHiddenProperty(self, key_string, value_obj);
3781  return *result == *self;
3782 }
bool DeleteHiddenValue(Handle< String > key)
Definition: api.cc:3800
static Handle< Object > SetHiddenProperty(Handle< JSObject > object, Handle< Name > key, Handle< Object > value)
Definition: objects.cc:4627

References ENTER_V8, v8::internal::Isolate::factory(), v8::Handle< T >::IsEmpty(), ON_BAILOUT, v8::Utils::OpenHandle(), and v8::internal::JSObject::SetHiddenProperty().

+ Here is the call graph for this function:

◆ SetIndexedPropertiesToExternalArrayData()

void v8::Object::SetIndexedPropertiesToExternalArrayData ( void *  data,
ExternalArrayType  array_type,
int  number_of_elements 
)

Set the backing store of the indexed properties to be managed by the embedding layer.

Access to the indexed properties will follow the rules spelled out for the CanvasArray subtypes in the WebGL specification. Note: The embedding program still owns the data and needs to ensure that the backing store is preserved while V8 has a reference.

Definition at line 3904 of file api.cc.

3907  {
3908  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3909  ON_BAILOUT(isolate, "v8::SetIndexedPropertiesToExternalArrayData()", return);
3910  ENTER_V8(isolate);
3911  i::HandleScope scope(isolate);
3912  if (!Utils::ApiCheck(length >= 0 && length <= i::ExternalArray::kMaxLength,
3913  "v8::Object::SetIndexedPropertiesToExternalArrayData()",
3914  "length exceeds max acceptable value")) {
3915  return;
3916  }
3918  if (!Utils::ApiCheck(!self->IsJSArray(),
3919  "v8::Object::SetIndexedPropertiesToExternalArrayData()",
3920  "JSArray is not supported")) {
3921  return;
3922  }
3923  PrepareExternalArrayElements(self, data, array_type, length);
3924 }
void PrepareExternalArrayElements(i::Handle< i::JSObject > object, void *data, ExternalArrayType array_type, int length)
Definition: api.cc:3831

References v8::Utils::ApiCheck(), ENTER_V8, ON_BAILOUT, v8::Utils::OpenHandle(), and v8::anonymous_namespace{api.cc}::PrepareExternalArrayElements().

+ Here is the call graph for this function:

◆ SetIndexedPropertiesToPixelData()

void v8::Object::SetIndexedPropertiesToPixelData ( uint8_t *  data,
int  length 
)

Set the backing store of the indexed properties to be managed by the embedding layer.

Access to the indexed properties will follow the rules spelled out in CanvasPixelArray. Note: The embedding program still owns the data and needs to ensure that the backing store is preserved while V8 has a reference.

Definition at line 3850 of file api.cc.

3850  {
3851  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3852  ON_BAILOUT(isolate, "v8::SetElementsToPixelData()", return);
3853  ENTER_V8(isolate);
3854  i::HandleScope scope(isolate);
3855  if (!Utils::ApiCheck(length >= 0 &&
3856  length <= i::ExternalUint8ClampedArray::kMaxLength,
3857  "v8::Object::SetIndexedPropertiesToPixelData()",
3858  "length exceeds max acceptable value")) {
3859  return;
3860  }
3862  if (!Utils::ApiCheck(!self->IsJSArray(),
3863  "v8::Object::SetIndexedPropertiesToPixelData()",
3864  "JSArray is not supported")) {
3865  return;
3866  }
3868 }
@ kExternalUint8ClampedArray
Definition: v8.h:2226

References v8::Utils::ApiCheck(), ENTER_V8, v8::kExternalUint8ClampedArray, ON_BAILOUT, v8::Utils::OpenHandle(), and v8::anonymous_namespace{api.cc}::PrepareExternalArrayElements().

+ Here is the call graph for this function:

◆ SetInternalField()

void v8::Object::SetInternalField ( int  index,
v8::Handle< Value value 
)

Sets the value in an internal field.

Definition at line 5010 of file api.cc.

5010  {
5012  const char* location = "v8::Object::SetInternalField()";
5013  if (!InternalFieldOK(obj, index, location)) return;
5015  obj->SetInternalField(index, *val);
5016  DCHECK_EQ(value, GetInternalField(index));
5017 }
Local< Value > GetInternalField(int index)
Gets the value from an internal field.
Definition: v8.h:6426

References DCHECK_EQ, v8::InternalFieldOK(), and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ SetPrivate()

bool v8::Object::SetPrivate ( v8::Handle< Private key,
v8::Handle< Value value 
)

Definition at line 3172 of file api.cc.

3172  {
3173  return ForceSet(v8::Handle<Value>(reinterpret_cast<Value*>(*key)),
3174  value, DontEnum);
3175 }
bool ForceSet(Handle< Value > key, Handle< Value > value, PropertyAttribute attribs=None)
Definition: api.cc:3151
@ DontEnum
Definition: v8.h:2213

References v8::DontEnum.

◆ SetPrototype()

bool v8::Object::SetPrototype ( Handle< Value prototype)

Set the prototype object.

This does not skip objects marked to be skipped by proto and it does not consult the security handler.

Definition at line 3292 of file api.cc.

3292  {
3293  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3294  ON_BAILOUT(isolate, "v8::Object::SetPrototype()", return false);
3295  ENTER_V8(isolate);
3297  i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
3298  // We do not allow exceptions thrown while setting the prototype
3299  // to propagate outside.
3300  TryCatch try_catch;
3301  EXCEPTION_PREAMBLE(isolate);
3302  i::MaybeHandle<i::Object> result =
3303  i::JSObject::SetPrototype(self, value_obj, false);
3304  has_pending_exception = result.is_null();
3305  EXCEPTION_BAILOUT_CHECK(isolate, false);
3306  return true;
3307 }
static MUST_USE_RESULT MaybeHandle< Object > SetPrototype(Handle< JSObject > object, Handle< Object > value, bool from_javascript)
Definition: objects.cc:11658
bool is_null() const
Definition: handles.h:66

References ENTER_V8, EXCEPTION_BAILOUT_CHECK, EXCEPTION_PREAMBLE, v8::internal::MaybeHandle< T >::is_null(), ON_BAILOUT, v8::Utils::OpenHandle(), and v8::internal::JSObject::SetPrototype().

+ Here is the call graph for this function:

◆ SlowGetAlignedPointerFromInternalField()

void * v8::Object::SlowGetAlignedPointerFromInternalField ( int  index)
private

Definition at line 5020 of file api.cc.

5020  {
5022  const char* location = "v8::Object::GetAlignedPointerFromInternalField()";
5023  if (!InternalFieldOK(obj, index, location)) return NULL;
5024  return DecodeSmiToAligned(obj->GetInternalField(index), location);
5025 }
static void * DecodeSmiToAligned(i::Object *value, const char *location)
Definition: api.cc:638

References v8::DecodeSmiToAligned(), v8::InternalFieldOK(), NULL, and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ SlowGetInternalField()

Local< Value > v8::Object::SlowGetInternalField ( int  index)
private

Definition at line 5001 of file api.cc.

5001  {
5003  const char* location = "v8::Object::GetInternalField()";
5004  if (!InternalFieldOK(obj, index, location)) return Local<Value>();
5005  i::Handle<i::Object> value(obj->GetInternalField(index), obj->GetIsolate());
5006  return Utils::ToLocal(value);
5007 }

References v8::InternalFieldOK(), v8::Utils::OpenHandle(), and v8::Utils::ToLocal().

+ Here is the call graph for this function:

◆ TurnOnAccessCheck()

void v8::Object::TurnOnAccessCheck ( )

Turns on access check on the object if the object is an instance of a template that has access check callbacks.

If an object has no access check info, the object cannot be accessed by anyone.

Definition at line 3711 of file api.cc.

3711  {
3712  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3713  ON_BAILOUT(isolate, "v8::Object::TurnOnAccessCheck()", return);
3714  ENTER_V8(isolate);
3715  i::HandleScope scope(isolate);
3717 
3718  // When turning on access checks for a global object deoptimize all functions
3719  // as optimized code does not always handle access checks.
3721 
3722  i::Handle<i::Map> new_map = i::Map::Copy(i::Handle<i::Map>(obj->map()));
3723  new_map->set_is_access_check_needed(true);
3724  i::JSObject::MigrateToMap(obj, new_map);
3725 }
static void DeoptimizeGlobalObject(JSObject *object)
Definition: deoptimizer.cc:470
static void MigrateToMap(Handle< JSObject > object, Handle< Map > new_map)
Definition: objects.cc:1886
static Handle< Map > Copy(Handle< Map > map)
Definition: objects.cc:6664

References v8::internal::Map::Copy(), v8::internal::Deoptimizer::DeoptimizeGlobalObject(), ENTER_V8, v8::internal::JSObject::MigrateToMap(), ON_BAILOUT, and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

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