V8 Project
v8::internal::JSProxy Class Reference

#include <objects.h>

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

Public Types

typedef FixedBodyDescriptor< kHandlerOffset, kPaddingOffset, kSizeBodyDescriptor
 
- Public Types inherited from v8::internal::JSReceiver
enum  DeleteMode { NORMAL_DELETION , STRICT_DELETION , FORCE_DELETION }
 
enum  KeyCollectionType { OWN_ONLY , INCLUDE_PROTOS }
 
- Public Types inherited from v8::internal::Object
enum  StoreFromKeyed { MAY_BE_STORE_FROM_KEYED , CERTAINLY_NOT_STORE_FROM_KEYED }
 
enum  StorePropertyMode { NORMAL_PROPERTY , SUPER_PROPERTY }
 

Public Member Functions

void InitializeBody (int object_size, Object *value)
 
 STATIC_ASSERT (kPaddingSize >=0)
 
- Public Member Functions inherited from v8::internal::JSReceiver
bool IsSimpleEnum ()
 
Stringclass_name ()
 
Stringconstructor_name ()
 
ObjectGetConstructor ()
 
ObjectGetIdentityHash ()
 
- 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 MUST_USE_RESULT MaybeHandle< ObjectGetPropertyWithHandler (Handle< JSProxy > proxy, Handle< Object > receiver, Handle< Name > name)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetElementWithHandler (Handle< JSProxy > proxy, Handle< Object > receiver, uint32_t index)
 
static MUST_USE_RESULT MaybeHandle< ObjectSetPropertyViaPrototypesWithHandler (Handle< JSProxy > proxy, Handle< Object > receiver, Handle< Name > name, Handle< Object > value, StrictMode strict_mode, bool *done)
 
static MUST_USE_RESULT Maybe< PropertyAttributesGetPropertyAttributesWithHandler (Handle< JSProxy > proxy, Handle< Object > receiver, Handle< Name > name)
 
static MUST_USE_RESULT Maybe< PropertyAttributesGetElementAttributeWithHandler (Handle< JSProxy > proxy, Handle< JSReceiver > receiver, uint32_t index)
 
static MUST_USE_RESULT MaybeHandle< ObjectSetPropertyWithHandler (Handle< JSProxy > proxy, Handle< Object > receiver, Handle< Name > name, Handle< Object > value, StrictMode strict_mode)
 
static void Fix (Handle< JSProxy > proxy)
 
static MUST_USE_RESULT MaybeHandle< ObjectCallTrap (Handle< JSProxy > proxy, const char *name, Handle< Object > derived_trap, int argc, Handle< Object > args[])
 
- Static Public Member Functions inherited from v8::internal::JSReceiver
static MUST_USE_RESULT MaybeHandle< ObjectSetElement (Handle< JSReceiver > object, uint32_t index, Handle< Object > value, PropertyAttributes attributes, StrictMode strict_mode)
 
static MUST_USE_RESULT Maybe< boolHasProperty (Handle< JSReceiver > object, Handle< Name > name)
 
static MUST_USE_RESULT Maybe< boolHasOwnProperty (Handle< JSReceiver >, Handle< Name > name)
 
static MUST_USE_RESULT Maybe< boolHasElement (Handle< JSReceiver > object, uint32_t index)
 
static MUST_USE_RESULT Maybe< boolHasOwnElement (Handle< JSReceiver > object, uint32_t index)
 
static MUST_USE_RESULT MaybeHandle< ObjectDeleteProperty (Handle< JSReceiver > object, Handle< Name > name, DeleteMode mode=NORMAL_DELETION)
 
static MUST_USE_RESULT MaybeHandle< ObjectDeleteElement (Handle< JSReceiver > object, uint32_t index, DeleteMode mode=NORMAL_DELETION)
 
static MUST_USE_RESULT Maybe< PropertyAttributesGetPropertyAttributes (Handle< JSReceiver > object, Handle< Name > name)
 
static MUST_USE_RESULT Maybe< PropertyAttributesGetPropertyAttributes (LookupIterator *it)
 
static MUST_USE_RESULT Maybe< PropertyAttributesGetOwnPropertyAttributes (Handle< JSReceiver > object, Handle< Name > name)
 
static MUST_USE_RESULT Maybe< PropertyAttributesGetElementAttribute (Handle< JSReceiver > object, uint32_t index)
 
static MUST_USE_RESULT Maybe< PropertyAttributesGetOwnElementAttribute (Handle< JSReceiver > object, uint32_t index)
 
static Handle< SmiGetOrCreateIdentityHash (Handle< JSReceiver > object)
 
static MUST_USE_RESULT MaybeHandle< FixedArrayGetKeys (Handle< JSReceiver > object, KeyCollectionType type)
 
- Static Public Member Functions inherited from v8::internal::HeapObject
static HeapObjectFromAddress (Address address)
 
static Object ** RawField (HeapObject *obj, int offset)
 
static void UpdateMapCodeCache (Handle< HeapObject > object, Handle< Name > name, Handle< Code > code)
 
- Static Public Member Functions inherited from v8::internal::Object
static Handle< ObjectNewStorageFor (Isolate *isolate, Handle< Object > object, Representation representation)
 
static Handle< ObjectWrapForRead (Isolate *isolate, Handle< Object > object, Representation representation)
 
static MaybeHandle< JSReceiverToObject (Isolate *isolate, Handle< Object > object)
 
static MaybeHandle< JSReceiverToObject (Isolate *isolate, Handle< Object > object, Handle< Context > context)
 
static MUST_USE_RESULT MaybeHandle< SmiToSmi (Isolate *isolate, Handle< Object > object)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetProperty (LookupIterator *it)
 
static MUST_USE_RESULT MaybeHandle< ObjectSetProperty (Handle< Object > object, Handle< Name > key, Handle< Object > value, StrictMode strict_mode, StoreFromKeyed store_mode=MAY_BE_STORE_FROM_KEYED)
 
static MUST_USE_RESULT MaybeHandle< ObjectSetProperty (LookupIterator *it, Handle< Object > value, StrictMode strict_mode, StoreFromKeyed store_mode, StorePropertyMode data_store_mode=NORMAL_PROPERTY)
 
static MUST_USE_RESULT MaybeHandle< ObjectWriteToReadOnlyProperty (LookupIterator *it, Handle< Object > value, StrictMode strict_mode)
 
static Handle< ObjectSetDataProperty (LookupIterator *it, Handle< Object > value)
 
static MUST_USE_RESULT MaybeHandle< ObjectAddDataProperty (LookupIterator *it, Handle< Object > value, PropertyAttributes attributes, StrictMode strict_mode, StoreFromKeyed store_mode)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetPropertyOrElement (Handle< Object > object, Handle< Name > key)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetProperty (Isolate *isolate, Handle< Object > object, const char *key)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetProperty (Handle< Object > object, Handle< Name > key)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetPropertyWithAccessor (Handle< Object > receiver, Handle< Name > name, Handle< JSObject > holder, Handle< Object > structure)
 
static MUST_USE_RESULT MaybeHandle< ObjectSetPropertyWithAccessor (Handle< Object > receiver, Handle< Name > name, Handle< Object > value, Handle< JSObject > holder, Handle< Object > structure, StrictMode strict_mode)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetPropertyWithDefinedGetter (Handle< Object > receiver, Handle< JSReceiver > getter)
 
static MUST_USE_RESULT MaybeHandle< ObjectSetPropertyWithDefinedSetter (Handle< Object > receiver, Handle< JSReceiver > setter, Handle< Object > value)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetElement (Isolate *isolate, Handle< Object > object, uint32_t index)
 
static MUST_USE_RESULT MaybeHandle< ObjectGetElementWithReceiver (Isolate *isolate, Handle< Object > object, Handle< Object > receiver, uint32_t index)
 
static Handle< SmiGetOrCreateHash (Isolate *isolate, Handle< Object > object)
 

Static Public Attributes

static const int kHandlerOffset = HeapObject::kHeaderSize
 
static const int kHashOffset = kHandlerOffset + kPointerSize
 
static const int kPaddingOffset = kHashOffset + kPointerSize
 
static const int kSize = JSObject::kHeaderSize
 
static const int kHeaderSize = kPaddingOffset
 
static const int kPaddingSize = kSize - kPaddingOffset
 
- Static Public Attributes inherited from v8::internal::HeapObject
static const int kMapOffset = Object::kHeaderSize
 
static const int kHeaderSize = kMapOffset + kPointerSize
 
- Static Public Attributes inherited from v8::internal::Object
static const int kHeaderSize = 0
 

Private Member Functions

MUST_USE_RESULT ObjectGetIdentityHash ()
 
 DISALLOW_IMPLICIT_CONSTRUCTORS (JSProxy)
 

Static Private Member Functions

static MUST_USE_RESULT MaybeHandle< ObjectSetElementWithHandler (Handle< JSProxy > proxy, Handle< JSReceiver > receiver, uint32_t index, Handle< Object > value, StrictMode strict_mode)
 
static MUST_USE_RESULT Maybe< boolHasPropertyWithHandler (Handle< JSProxy > proxy, Handle< Name > name)
 
static MUST_USE_RESULT Maybe< boolHasElementWithHandler (Handle< JSProxy > proxy, uint32_t index)
 
static MUST_USE_RESULT MaybeHandle< ObjectDeletePropertyWithHandler (Handle< JSProxy > proxy, Handle< Name > name, DeleteMode mode)
 
static MUST_USE_RESULT MaybeHandle< ObjectDeleteElementWithHandler (Handle< JSProxy > proxy, uint32_t index, DeleteMode mode)
 
static Handle< SmiGetOrCreateIdentityHash (Handle< JSProxy > proxy)
 

Friends

class JSReceiver
 

Additional Inherited Members

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

Detailed Description

Definition at line 9512 of file objects.h.

Member Typedef Documentation

◆ BodyDescriptor

Member Function Documentation

◆ CallTrap()

MaybeHandle< Object > v8::internal::JSProxy::CallTrap ( Handle< JSProxy proxy,
const char *  name,
Handle< Object derived_trap,
int  argc,
Handle< Object args[] 
)
static

Definition at line 3677 of file objects.cc.

3681  {
3682  Isolate* isolate = proxy->GetIsolate();
3683  Handle<Object> handler(proxy->handler(), isolate);
3684 
3685  Handle<String> trap_name = isolate->factory()->InternalizeUtf8String(name);
3686  Handle<Object> trap;
3688  isolate, trap,
3689  Object::GetPropertyOrElement(handler, trap_name),
3690  Object);
3691 
3692  if (trap->IsUndefined()) {
3693  if (derived.is_null()) {
3694  Handle<Object> args[] = { handler, trap_name };
3695  THROW_NEW_ERROR(isolate,
3696  NewTypeError("handler_trap_missing",
3697  HandleVector(args, arraysize(args))),
3698  Object);
3699  }
3700  trap = Handle<Object>(derived);
3701  }
3702 
3703  return Execution::Call(isolate, trap, handler, argc, argv);
3704 }
static MUST_USE_RESULT MaybeHandle< Object > GetPropertyOrElement(Handle< Object > object, Handle< Name > key)
Definition: objects-inl.h:1124
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
#define ASSIGN_RETURN_ON_EXCEPTION(isolate, dst, call, T)
Definition: isolate.h:135
#define THROW_NEW_ERROR(isolate, call, T)
Definition: isolate.h:138
#define arraysize(array)
Definition: macros.h:86
kSerializedDataOffset Object
Definition: objects-inl.h:5322
Vector< Handle< Object > > HandleVector(v8::internal::Handle< T > *elms, int length)
Definition: utils.h:1100

References arraysize, ASSIGN_RETURN_ON_EXCEPTION, v8::internal::Isolate::factory(), v8::internal::Object::GetPropertyOrElement(), v8::internal::HandleVector(), v8::internal::Handle< T >::is_null(), name, and THROW_NEW_ERROR.

Referenced by GetPropertyWithHandler().

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

◆ DeleteElementWithHandler()

MaybeHandle< Object > v8::internal::JSProxy::DeleteElementWithHandler ( Handle< JSProxy proxy,
uint32_t  index,
DeleteMode  mode 
)
staticprivate

Definition at line 3564 of file objects.cc.

3565  {
3566  Isolate* isolate = proxy->GetIsolate();
3567  Handle<String> name = isolate->factory()->Uint32ToString(index);
3569 }
static MUST_USE_RESULT MaybeHandle< Object > DeletePropertyWithHandler(Handle< JSProxy > proxy, Handle< Name > name, DeleteMode mode)
Definition: objects.cc:3532
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 mode(MIPS only)") DEFINE_BOOL(enable_always_align_csp

References DeletePropertyWithHandler(), v8::internal::Isolate::factory(), mode(), and name.

Referenced by v8::internal::JSReceiver::DeleteElement().

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

◆ DeletePropertyWithHandler()

MaybeHandle< Object > v8::internal::JSProxy::DeletePropertyWithHandler ( Handle< JSProxy proxy,
Handle< Name name,
DeleteMode  mode 
)
staticprivate

Definition at line 3532 of file objects.cc.

3533  {
3534  Isolate* isolate = proxy->GetIsolate();
3535 
3536  // TODO(rossberg): adjust once there is a story for symbols vs proxies.
3537  if (name->IsSymbol()) return isolate->factory()->false_value();
3538 
3539  Handle<Object> args[] = { name };
3540  Handle<Object> result;
3542  isolate, result,
3543  CallTrap(proxy,
3544  "delete",
3545  Handle<Object>(),
3546  arraysize(args),
3547  args),
3548  Object);
3549 
3550  bool result_bool = result->BooleanValue();
3551  if (mode == STRICT_DELETION && !result_bool) {
3552  Handle<Object> handler(proxy->handler(), isolate);
3553  Handle<String> trap_name = isolate->factory()->InternalizeOneByteString(
3554  STATIC_CHAR_VECTOR("delete"));
3555  Handle<Object> args[] = { handler, trap_name };
3556  THROW_NEW_ERROR(isolate, NewTypeError("handler_failed",
3557  HandleVector(args, arraysize(args))),
3558  Object);
3559  }
3560  return isolate->factory()->ToBoolean(result_bool);
3561 }
static MUST_USE_RESULT MaybeHandle< Object > CallTrap(Handle< JSProxy > proxy, const char *name, Handle< Object > derived_trap, int argc, Handle< Object > args[])
Definition: objects.cc:3677
#define STATIC_CHAR_VECTOR(x)
Definition: vector.h:154

Referenced by DeleteElementWithHandler(), and v8::internal::JSReceiver::DeleteProperty().

+ Here is the caller graph for this function:

◆ DISALLOW_IMPLICIT_CONSTRUCTORS()

v8::internal::JSProxy::DISALLOW_IMPLICIT_CONSTRUCTORS ( JSProxy  )
private

◆ Fix()

void v8::internal::JSProxy::Fix ( Handle< JSProxy proxy)
static

Definition at line 3655 of file objects.cc.

3655  {
3656  Isolate* isolate = proxy->GetIsolate();
3657 
3658  // Save identity hash.
3659  Handle<Object> hash(proxy->GetIdentityHash(), isolate);
3660 
3661  if (proxy->IsJSFunctionProxy()) {
3662  isolate->factory()->BecomeJSFunction(proxy);
3663  // Code will be set on the JavaScript side.
3664  } else {
3665  isolate->factory()->BecomeJSObject(proxy);
3666  }
3667  DCHECK(proxy->IsJSObject());
3668 
3669  // Inherit identity, if it was present.
3670  if (hash->IsSmi()) {
3672  Handle<Smi>::cast(hash));
3673  }
3674 }
static Handle< T > cast(Handle< S > that)
Definition: handles.h:116
static void SetIdentityHash(Handle< JSObject > object, Handle< Smi > hash)
Definition: objects.cc:4534
#define DCHECK(condition)
Definition: logging.h:205

References DCHECK, v8::internal::Isolate::factory(), and v8::internal::JSObject::SetIdentityHash().

Referenced by v8::internal::RUNTIME_FUNCTION().

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

◆ GetElementAttributeWithHandler()

Maybe< PropertyAttributes > v8::internal::JSProxy::GetElementAttributeWithHandler ( Handle< JSProxy proxy,
Handle< JSReceiver receiver,
uint32_t  index 
)
static

Definition at line 3647 of file objects.cc.

3648  {
3649  Isolate* isolate = proxy->GetIsolate();
3650  Handle<String> name = isolate->factory()->Uint32ToString(index);
3651  return GetPropertyAttributesWithHandler(proxy, receiver, name);
3652 }
static MUST_USE_RESULT Maybe< PropertyAttributes > GetPropertyAttributesWithHandler(Handle< JSProxy > proxy, Handle< Object > receiver, Handle< Name > name)
Definition: objects.cc:3572

References v8::internal::Isolate::factory(), and name.

Referenced by v8::internal::JSReceiver::GetElementAttribute(), v8::internal::JSObject::GetElementAttributeWithoutInterceptor(), and v8::internal::JSReceiver::GetOwnElementAttribute().

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

◆ GetElementWithHandler()

MaybeHandle< Object > v8::internal::JSProxy::GetElementWithHandler ( Handle< JSProxy proxy,
Handle< Object receiver,
uint32_t  index 
)
inlinestatic

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

1148  {
1149  return GetPropertyWithHandler(
1150  proxy, receiver, proxy->GetIsolate()->factory()->Uint32ToString(index));
1151 }
static MUST_USE_RESULT MaybeHandle< Object > GetPropertyWithHandler(Handle< JSProxy > proxy, Handle< Object > receiver, Handle< Name > name)
Definition: objects.cc:397

References GetPropertyWithHandler().

Referenced by v8::internal::Object::GetElementWithReceiver().

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

◆ GetIdentityHash()

Object * v8::internal::JSProxy::GetIdentityHash ( )
private

Definition at line 4584 of file objects.cc.

4584  {
4585  return this->hash();
4586 }

◆ GetOrCreateIdentityHash()

Handle< Smi > v8::internal::JSProxy::GetOrCreateIdentityHash ( Handle< JSProxy proxy)
staticprivate

Definition at line 4589 of file objects.cc.

4589  {
4590  return GetOrCreateIdentityHashHelper(proxy);
4591 }
static Handle< Smi > GetOrCreateIdentityHashHelper(Handle< ProxyType > proxy)
Definition: objects.cc:4542

References v8::internal::GetOrCreateIdentityHashHelper().

Referenced by v8::internal::JSReceiver::GetOrCreateIdentityHash().

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

◆ GetPropertyAttributesWithHandler()

Maybe< PropertyAttributes > v8::internal::JSProxy::GetPropertyAttributesWithHandler ( Handle< JSProxy proxy,
Handle< Object receiver,
Handle< Name name 
)
static

Definition at line 3572 of file objects.cc.

3573  {
3574  Isolate* isolate = proxy->GetIsolate();
3575  HandleScope scope(isolate);
3576 
3577  // TODO(rossberg): adjust once there is a story for symbols vs proxies.
3578  if (name->IsSymbol()) return maybe(ABSENT);
3579 
3580  Handle<Object> args[] = { name };
3581  Handle<Object> result;
3583  isolate, result,
3584  proxy->CallTrap(proxy, "getPropertyDescriptor", Handle<Object>(),
3585  arraysize(args), args),
3586  Maybe<PropertyAttributes>());
3587 
3588  if (result->IsUndefined()) return maybe(ABSENT);
3589 
3590  Handle<Object> argv[] = { result };
3591  Handle<Object> desc;
3593  isolate, desc,
3594  Execution::Call(isolate, isolate->to_complete_property_descriptor(),
3595  result, arraysize(argv), argv),
3596  Maybe<PropertyAttributes>());
3597 
3598  // Convert result to PropertyAttributes.
3599  Handle<String> enum_n = isolate->factory()->InternalizeOneByteString(
3600  STATIC_CHAR_VECTOR("enumerable_"));
3601  Handle<Object> enumerable;
3602  ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, enumerable,
3603  Object::GetProperty(desc, enum_n),
3604  Maybe<PropertyAttributes>());
3605  Handle<String> conf_n = isolate->factory()->InternalizeOneByteString(
3606  STATIC_CHAR_VECTOR("configurable_"));
3607  Handle<Object> configurable;
3608  ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, configurable,
3609  Object::GetProperty(desc, conf_n),
3610  Maybe<PropertyAttributes>());
3611  Handle<String> writ_n = isolate->factory()->InternalizeOneByteString(
3612  STATIC_CHAR_VECTOR("writable_"));
3613  Handle<Object> writable;
3614  ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, writable,
3615  Object::GetProperty(desc, writ_n),
3616  Maybe<PropertyAttributes>());
3617  if (!writable->BooleanValue()) {
3618  Handle<String> set_n = isolate->factory()->InternalizeOneByteString(
3619  STATIC_CHAR_VECTOR("set_"));
3620  Handle<Object> setter;
3621  ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, setter,
3622  Object::GetProperty(desc, set_n),
3623  Maybe<PropertyAttributes>());
3624  writable = isolate->factory()->ToBoolean(!setter->IsUndefined());
3625  }
3626 
3627  if (configurable->IsFalse()) {
3628  Handle<Object> handler(proxy->handler(), isolate);
3629  Handle<String> trap = isolate->factory()->InternalizeOneByteString(
3630  STATIC_CHAR_VECTOR("getPropertyDescriptor"));
3631  Handle<Object> args[] = { handler, trap, name };
3632  Handle<Object> error;
3633  MaybeHandle<Object> maybe_error = isolate->factory()->NewTypeError(
3634  "proxy_prop_not_configurable", HandleVector(args, arraysize(args)));
3635  if (maybe_error.ToHandle(&error)) isolate->Throw(*error);
3636  return maybe(NONE);
3637  }
3638 
3639  int attributes = NONE;
3640  if (!enumerable->BooleanValue()) attributes |= DONT_ENUM;
3641  if (!configurable->BooleanValue()) attributes |= DONT_DELETE;
3642  if (!writable->BooleanValue()) attributes |= READ_ONLY;
3643  return maybe(static_cast<PropertyAttributes>(attributes));
3644 }
static MUST_USE_RESULT MaybeHandle< Object > GetProperty(LookupIterator *it)
Definition: objects.cc:109
#define ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, dst, call, value)
Definition: isolate.h:123
Maybe< T > maybe(T t)
Definition: v8.h:902
PropertyAttributes
@ DONT_ENUM
@ DONT_DELETE
@ ABSENT
@ NONE
@ READ_ONLY

References ABSENT, v8::maybe(), and name.

Referenced by v8::internal::JSReceiver::GetPropertyAttributes().

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

◆ GetPropertyWithHandler()

MaybeHandle< Object > v8::internal::JSProxy::GetPropertyWithHandler ( Handle< JSProxy proxy,
Handle< Object receiver,
Handle< Name name 
)
static

Definition at line 397 of file objects.cc.

399  {
400  Isolate* isolate = proxy->GetIsolate();
401 
402  // TODO(rossberg): adjust once there is a story for symbols vs proxies.
403  if (name->IsSymbol()) return isolate->factory()->undefined_value();
404 
405  Handle<Object> args[] = { receiver, name };
406  return CallTrap(
407  proxy, "get", isolate->derived_get_trap(), arraysize(args), args);
408 }

References arraysize, CallTrap(), v8::internal::Isolate::factory(), and name.

Referenced by GetElementWithHandler(), and v8::internal::Object::GetProperty().

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

◆ HasElementWithHandler()

Maybe< bool > v8::internal::JSProxy::HasElementWithHandler ( Handle< JSProxy proxy,
uint32_t  index 
)
inlinestaticprivate

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

1166  {
1167  Isolate* isolate = proxy->GetIsolate();
1168  Handle<String> name = isolate->factory()->Uint32ToString(index);
1169  return HasPropertyWithHandler(proxy, name);
1170 }
static MUST_USE_RESULT Maybe< bool > HasPropertyWithHandler(Handle< JSProxy > proxy, Handle< Name > name)
Definition: objects.cc:3392

References v8::internal::Isolate::factory(), HasPropertyWithHandler(), and name.

Referenced by v8::internal::JSReceiver::HasElement(), and v8::internal::JSReceiver::HasOwnElement().

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

◆ HasPropertyWithHandler()

Maybe< bool > v8::internal::JSProxy::HasPropertyWithHandler ( Handle< JSProxy proxy,
Handle< Name name 
)
staticprivate

Definition at line 3392 of file objects.cc.

3393  {
3394  Isolate* isolate = proxy->GetIsolate();
3395 
3396  // TODO(rossberg): adjust once there is a story for symbols vs proxies.
3397  if (name->IsSymbol()) return maybe(false);
3398 
3399  Handle<Object> args[] = { name };
3400  Handle<Object> result;
3402  isolate, result, CallTrap(proxy, "has", isolate->derived_has_trap(),
3403  arraysize(args), args),
3404  Maybe<bool>());
3405 
3406  return maybe(result->BooleanValue());
3407 }

References arraysize, ASSIGN_RETURN_ON_EXCEPTION_VALUE, v8::maybe(), and name.

Referenced by HasElementWithHandler(), v8::internal::JSReceiver::HasOwnProperty(), and v8::internal::JSReceiver::HasProperty().

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

◆ InitializeBody()

void v8::internal::JSProxy::InitializeBody ( int  object_size,
Object value 
)
inline

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

6021  {
6022  DCHECK(!value->IsHeapObject() || !GetHeap()->InNewSpace(value));
6023  for (int offset = kHeaderSize; offset < object_size; offset += kPointerSize) {
6024  WRITE_FIELD(this, offset, value);
6025  }
6026 }
Heap * GetHeap() const
Definition: objects-inl.h:1379
static const int kHeaderSize
Definition: objects.h:9578
const int kPointerSize
Definition: globals.h:129
#define WRITE_FIELD(p, offset, value)
Definition: objects-inl.h:1190

References DCHECK, v8::internal::kPointerSize, and WRITE_FIELD.

◆ SetElementWithHandler()

MaybeHandle< Object > v8::internal::JSProxy::SetElementWithHandler ( Handle< JSProxy proxy,
Handle< JSReceiver receiver,
uint32_t  index,
Handle< Object value,
StrictMode  strict_mode 
)
inlinestaticprivate

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

1158  {
1159  Isolate* isolate = proxy->GetIsolate();
1160  Handle<String> name = isolate->factory()->Uint32ToString(index);
1161  return SetPropertyWithHandler(proxy, receiver, name, value, strict_mode);
1162 }
static MUST_USE_RESULT MaybeHandle< Object > SetPropertyWithHandler(Handle< JSProxy > proxy, Handle< Object > receiver, Handle< Name > name, Handle< Object > value, StrictMode strict_mode)
Definition: objects.cc:3410

References v8::internal::Isolate::factory(), name, and SetPropertyWithHandler().

Referenced by v8::internal::JSReceiver::SetElement().

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

◆ SetPropertyViaPrototypesWithHandler()

MaybeHandle< Object > v8::internal::JSProxy::SetPropertyViaPrototypesWithHandler ( Handle< JSProxy proxy,
Handle< Object receiver,
Handle< Name name,
Handle< Object value,
StrictMode  strict_mode,
bool done 
)
static

Definition at line 3434 of file objects.cc.

3436  {
3437  Isolate* isolate = proxy->GetIsolate();
3438  Handle<Object> handler(proxy->handler(), isolate); // Trap might morph proxy.
3439 
3440  // TODO(rossberg): adjust once there is a story for symbols vs proxies.
3441  if (name->IsSymbol()) {
3442  *done = false;
3443  return isolate->factory()->the_hole_value();
3444  }
3445 
3446  *done = true; // except where redefined...
3447  Handle<Object> args[] = { name };
3448  Handle<Object> result;
3450  isolate, result,
3451  CallTrap(proxy,
3452  "getPropertyDescriptor",
3453  Handle<Object>(),
3454  arraysize(args),
3455  args),
3456  Object);
3457 
3458  if (result->IsUndefined()) {
3459  *done = false;
3460  return isolate->factory()->the_hole_value();
3461  }
3462 
3463  // Emulate [[GetProperty]] semantics for proxies.
3464  Handle<Object> argv[] = { result };
3465  Handle<Object> desc;
3467  isolate, desc,
3468  Execution::Call(isolate,
3469  isolate->to_complete_property_descriptor(),
3470  result,
3471  arraysize(argv),
3472  argv),
3473  Object);
3474 
3475  // [[GetProperty]] requires to check that all properties are configurable.
3476  Handle<String> configurable_name =
3477  isolate->factory()->InternalizeOneByteString(
3478  STATIC_CHAR_VECTOR("configurable_"));
3479  Handle<Object> configurable =
3480  Object::GetProperty(desc, configurable_name).ToHandleChecked();
3481  DCHECK(configurable->IsBoolean());
3482  if (configurable->IsFalse()) {
3483  Handle<String> trap = isolate->factory()->InternalizeOneByteString(
3484  STATIC_CHAR_VECTOR("getPropertyDescriptor"));
3485  Handle<Object> args[] = { handler, trap, name };
3486  THROW_NEW_ERROR(isolate, NewTypeError("proxy_prop_not_configurable",
3487  HandleVector(args, arraysize(args))),
3488  Object);
3489  }
3490  DCHECK(configurable->IsTrue());
3491 
3492  // Check for DataDescriptor.
3493  Handle<String> hasWritable_name =
3494  isolate->factory()->InternalizeOneByteString(
3495  STATIC_CHAR_VECTOR("hasWritable_"));
3496  Handle<Object> hasWritable =
3497  Object::GetProperty(desc, hasWritable_name).ToHandleChecked();
3498  DCHECK(hasWritable->IsBoolean());
3499  if (hasWritable->IsTrue()) {
3500  Handle<String> writable_name = isolate->factory()->InternalizeOneByteString(
3501  STATIC_CHAR_VECTOR("writable_"));
3502  Handle<Object> writable =
3503  Object::GetProperty(desc, writable_name).ToHandleChecked();
3504  DCHECK(writable->IsBoolean());
3505  *done = writable->IsFalse();
3506  if (!*done) return isolate->factory()->the_hole_value();
3507  if (strict_mode == SLOPPY) return value;
3508  Handle<Object> args[] = { name, receiver };
3509  THROW_NEW_ERROR(isolate, NewTypeError("strict_read_only_property",
3510  HandleVector(args, arraysize(args))),
3511  Object);
3512  }
3513 
3514  // We have an AccessorDescriptor.
3515  Handle<String> set_name =
3516  isolate->factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("set_"));
3517  Handle<Object> setter = Object::GetProperty(desc, set_name).ToHandleChecked();
3518  if (!setter->IsUndefined()) {
3519  // TODO(rossberg): nicer would be to cast to some JSCallable here...
3521  receiver, Handle<JSReceiver>::cast(setter), value);
3522  }
3523 
3524  if (strict_mode == SLOPPY) return value;
3525  Handle<Object> args2[] = { name, proxy };
3526  THROW_NEW_ERROR(isolate, NewTypeError("no_setter_in_callback",
3527  HandleVector(args2, arraysize(args2))),
3528  Object);
3529 }
static MUST_USE_RESULT MaybeHandle< Object > SetPropertyWithDefinedSetter(Handle< Object > receiver, Handle< JSReceiver > setter, Handle< Object > value)
Definition: objects.cc:552

References arraysize, ASSIGN_RETURN_ON_EXCEPTION, DCHECK, v8::internal::Isolate::factory(), v8::internal::Object::GetProperty(), v8::internal::HandleVector(), name, v8::internal::SLOPPY, STATIC_CHAR_VECTOR, and THROW_NEW_ERROR.

Referenced by v8::internal::JSObject::SetElementWithCallbackSetterInPrototypes(), and v8::internal::Object::SetProperty().

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

◆ SetPropertyWithHandler()

MaybeHandle< Object > v8::internal::JSProxy::SetPropertyWithHandler ( Handle< JSProxy proxy,
Handle< Object receiver,
Handle< Name name,
Handle< Object value,
StrictMode  strict_mode 
)
static

Definition at line 3410 of file objects.cc.

3414  {
3415  Isolate* isolate = proxy->GetIsolate();
3416 
3417  // TODO(rossberg): adjust once there is a story for symbols vs proxies.
3418  if (name->IsSymbol()) return value;
3419 
3420  Handle<Object> args[] = { receiver, name, value };
3422  isolate,
3423  CallTrap(proxy,
3424  "set",
3425  isolate->derived_set_trap(),
3426  arraysize(args),
3427  args),
3428  Object);
3429 
3430  return value;
3431 }
#define RETURN_ON_EXCEPTION(isolate, call, T)
Definition: isolate.h:165

References arraysize, name, and RETURN_ON_EXCEPTION.

Referenced by SetElementWithHandler(), and v8::internal::Object::SetProperty().

+ Here is the caller graph for this function:

◆ STATIC_ASSERT()

v8::internal::JSProxy::STATIC_ASSERT ( kPaddingSize >=  0)

Friends And Related Function Documentation

◆ JSReceiver

friend class JSReceiver
friend

Definition at line 9588 of file objects.h.

Member Data Documentation

◆ kHandlerOffset

const int v8::internal::JSProxy::kHandlerOffset = HeapObject::kHeaderSize
static

Definition at line 9574 of file objects.h.

◆ kHashOffset

const int v8::internal::JSProxy::kHashOffset = kHandlerOffset + kPointerSize
static

Definition at line 9575 of file objects.h.

◆ kHeaderSize

const int v8::internal::JSProxy::kHeaderSize = kPaddingOffset
static

Definition at line 9578 of file objects.h.

◆ kPaddingOffset

const int v8::internal::JSProxy::kPaddingOffset = kHashOffset + kPointerSize
static

Definition at line 9576 of file objects.h.

◆ kPaddingSize

const int v8::internal::JSProxy::kPaddingSize = kSize - kPaddingOffset
static

Definition at line 9579 of file objects.h.

◆ kSize

const int v8::internal::JSProxy::kSize = JSObject::kHeaderSize
static

Definition at line 9577 of file objects.h.

Referenced by v8::internal::StaticVisitorBase::GetVisitorId().


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