V8 Project
v8::internal::Object Class Reference

#include <objects.h>

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

Public Types

enum  StoreFromKeyed { MAY_BE_STORE_FROM_KEYED , CERTAINLY_NOT_STORE_FROM_KEYED }
 
enum  StorePropertyMode { NORMAL_PROPERTY , SUPER_PROPERTY }
 

Public Member Functions

bool IsObject () const
 
 INLINE (bool IsFixedArrayBase() const)
 
 INLINE (bool IsExternal() const)
 
 INLINE (bool IsAccessorInfo() const)
 
 INLINE (bool IsStruct() const)
 
 INLINE (bool IsSpecObject()) const
 
 INLINE (bool IsSpecFunction()) const
 
 INLINE (bool IsTemplateInfo()) const
 
 INLINE (bool IsNameDictionary() const)
 
 INLINE (bool IsSeededNumberDictionary() const)
 
 INLINE (bool IsUnseededNumberDictionary() const)
 
 INLINE (bool IsOrderedHashSet() const)
 
 INLINE (bool IsOrderedHashMap() const)
 
bool IsCallable () const
 
 INLINE (bool IsUndefined() const)
 
 INLINE (bool IsNull() const)
 
 INLINE (bool IsTheHole() const)
 
 INLINE (bool IsException() const)
 
 INLINE (bool IsUninitialized() const)
 
 INLINE (bool IsTrue() const)
 
 INLINE (bool IsFalse() const)
 
 INLINE (bool IsArgumentsMarker() const)
 
 INLINE (bool IsFiller() const)
 
double Number ()
 
 INLINE (bool IsNaN() const)
 
 INLINE (bool IsMinusZero() const)
 
bool ToInt32 (int32_t *value)
 
bool ToUint32 (uint32_t *value)
 
Representation OptimalRepresentation ()
 
bool FitsRepresentation (Representation representation)
 
Handle< HeapTypeOptimalType (Isolate *isolate, Representation representation)
 
bool HasValidElements ()
 
bool HasSpecificClassOf (String *name)
 
bool BooleanValue ()
 
ObjectGetHash ()
 
bool SameValue (Object *other)
 
bool SameValueZero (Object *other)
 
bool ToArrayIndex (uint32_t *index)
 
bool IsStringObjectWithCharacterAt (uint32_t index)
 
void VerifyApiCallResultType ()
 
void ShortPrint (FILE *out=stdout)
 
void ShortPrint (StringStream *accumulator)
 

Static Public Member Functions

static Handle< 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 kHeaderSize = 0
 

Private Member Functions

MapGetRootMap (Isolate *isolate)
 
 DISALLOW_IMPLICIT_CONSTRUCTORS (Object)
 

Friends

class LookupIterator
 
class PrototypeIterator
 

Detailed Description

Definition at line 993 of file objects.h.

Member Enumeration Documentation

◆ StoreFromKeyed

Enumerator
MAY_BE_STORE_FROM_KEYED 
CERTAINLY_NOT_STORE_FROM_KEYED 

Definition at line 1005 of file objects.h.

1005  {
1008  };
@ CERTAINLY_NOT_STORE_FROM_KEYED
Definition: objects.h:1007

◆ StorePropertyMode

Enumerator
NORMAL_PROPERTY 
SUPER_PROPERTY 

Definition at line 1010 of file objects.h.

Member Function Documentation

◆ AddDataProperty()

MaybeHandle< Object > v8::internal::Object::AddDataProperty ( LookupIterator it,
Handle< Object value,
PropertyAttributes  attributes,
StrictMode  strict_mode,
StoreFromKeyed  store_mode 
)
static

Definition at line 2968 of file objects.cc.

2972  {
2973  DCHECK(!it->GetReceiver()->IsJSProxy());
2974  if (!it->GetReceiver()->IsJSObject()) {
2975  // TODO(verwaest): Throw a TypeError with a more specific message.
2976  return WriteToReadOnlyProperty(it, value, strict_mode);
2977  }
2978 
2979  Handle<JSObject> receiver = it->GetStoreTarget();
2980 
2981  // If the receiver is a JSGlobalProxy, store on the prototype (JSGlobalObject)
2982  // instead. If the prototype is Null, the proxy is detached.
2983  if (receiver->IsJSGlobalProxy()) return value;
2984 
2985  // Possibly migrate to the most up-to-date map that will be able to store
2986  // |value| under it->name() with |attributes|.
2987  it->PrepareTransitionToDataProperty(value, attributes, store_mode);
2988  if (it->state() != LookupIterator::TRANSITION) {
2989  if (strict_mode == SLOPPY) return value;
2990 
2991  Handle<Object> args[1] = {it->name()};
2992  THROW_NEW_ERROR(it->isolate(),
2993  NewTypeError("object_not_extensible",
2994  HandleVector(args, arraysize(args))),
2995  Object);
2996  }
2997  it->ApplyTransitionToDataProperty();
2998 
2999  // TODO(verwaest): Encapsulate dictionary handling better.
3000  if (receiver->map()->is_dictionary_map()) {
3001  // TODO(verwaest): Probably should ensure this is done beforehand.
3002  it->InternalizeName();
3003  JSObject::AddSlowProperty(receiver, it->name(), value, attributes);
3004  } else {
3005  // Write the property value.
3006  it->WriteDataValue(value);
3007  }
3008 
3009  // Send the change record if there are observers.
3010  if (receiver->map()->is_observed() &&
3011  !it->name().is_identical_to(it->factory()->hidden_string())) {
3012  JSObject::EnqueueChangeRecord(receiver, "add", it->name(),
3013  it->factory()->the_hole_value());
3014  }
3015 
3016  return value;
3017 }
static void AddSlowProperty(Handle< JSObject > object, Handle< Name > name, Handle< Object > value, PropertyAttributes attributes)
Definition: objects.cc:1762
static void EnqueueChangeRecord(Handle< JSObject > object, const char *type, Handle< Name > name, Handle< Object > old_value)
Definition: objects.cc:1809
static MUST_USE_RESULT MaybeHandle< Object > WriteToReadOnlyProperty(LookupIterator *it, Handle< Object > value, StrictMode strict_mode)
Definition: objects.cc:2920
#define THROW_NEW_ERROR(isolate, call, T)
Definition: isolate.h:138
#define DCHECK(condition)
Definition: logging.h:205
#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 v8::internal::JSObject::AddSlowProperty(), arraysize, DCHECK, v8::internal::JSObject::EnqueueChangeRecord(), v8::internal::HandleVector(), v8::internal::SLOPPY, THROW_NEW_ERROR, and WriteToReadOnlyProperty().

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

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

◆ BooleanValue()

bool v8::internal::Object::BooleanValue ( )

Definition at line 87 of file objects.cc.

87  {
88  if (IsBoolean()) return IsTrue();
89  if (IsSmi()) return Smi::cast(this)->value() != 0;
90  if (IsUndefined() || IsNull()) return false;
91  if (IsUndetectableObject()) return false; // Undetectable object is false.
92  if (IsString()) return String::cast(this)->length() != 0;
93  if (IsHeapNumber()) return HeapNumber::cast(this)->HeapNumberBooleanValue();
94  return true;
95 }

◆ DISALLOW_IMPLICIT_CONSTRUCTORS()

v8::internal::Object::DISALLOW_IMPLICIT_CONSTRUCTORS ( Object  )
private

◆ FitsRepresentation()

bool v8::internal::Object::FitsRepresentation ( Representation  representation)
inline

Definition at line 1068 of file objects.h.

1068  {
1069  if (FLAG_track_fields && representation.IsNone()) {
1070  return false;
1071  } else if (FLAG_track_fields && representation.IsSmi()) {
1072  return IsSmi();
1073  } else if (FLAG_track_double_fields && representation.IsDouble()) {
1074  return IsMutableHeapNumber() || IsNumber();
1075  } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) {
1076  return IsHeapObject();
1077  }
1078  return true;
1079  }

References v8::internal::Representation::IsDouble(), v8::internal::Representation::IsHeapObject(), v8::internal::Representation::IsNone(), and v8::internal::Representation::IsSmi().

Referenced by v8::internal::DescriptorArray::CanHoldValue().

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

◆ GetElement()

MaybeHandle< Object > v8::internal::Object::GetElement ( Isolate isolate,
Handle< Object object,
uint32_t  index 
)
inlinestatic

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

1115  {
1116  // GetElement can trigger a getter which can cause allocation.
1117  // This was not always the case. This DCHECK is here to catch
1118  // leftover incorrect uses.
1119  DCHECK(AllowHeapAllocation::IsAllowed());
1120  return Object::GetElementWithReceiver(isolate, object, object, index);
1121 }
static MUST_USE_RESULT MaybeHandle< Object > GetElementWithReceiver(Isolate *isolate, Handle< Object > object, Handle< Object > receiver, uint32_t index)
Definition: objects.cc:747

References DCHECK, and GetElementWithReceiver().

Referenced by v8::internal::CheckActivation(), v8::internal::JSObject::DefineAccessor(), v8::internal::JSObject::DeleteElement(), v8::internal::DropActivationsInActiveThread(), v8::internal::FunctionInfoListener::FunctionCode(), v8::internal::FunctionInfoListener::FunctionDone(), v8::internal::FunctionInfoListener::FunctionInfo(), v8::Object::Get(), v8::internal::Runtime::GetElementOrCharAt(), v8::internal::JSArrayBasedStruct< S >::GetField(), v8::StackTrace::GetFrame(), v8::internal::GetOldValue(), GetPropertyOrElement(), v8::internal::SharedInfoWrapper::IsInstance(), v8::internal::IterateElements(), v8::internal::RUNTIME_FUNCTION(), v8::internal::JSObject::SetElement(), v8::internal::TranslatePosition(), and v8::internal::LiveEdit::WrapSharedFunctionInfos().

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

◆ GetElementWithReceiver()

MaybeHandle< Object > v8::internal::Object::GetElementWithReceiver ( Isolate isolate,
Handle< Object object,
Handle< Object receiver,
uint32_t  index 
)
static

Definition at line 747 of file objects.cc.

750  {
751  if (object->IsUndefined()) {
752  // TODO(verwaest): Why is this check here?
753  UNREACHABLE();
754  return isolate->factory()->undefined_value();
755  }
756 
757  // Iterate up the prototype chain until an element is found or the null
758  // prototype is encountered.
759  for (PrototypeIterator iter(isolate, object,
760  object->IsJSProxy() || object->IsJSObject()
763  !iter.IsAtEnd(); iter.Advance()) {
764  if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) {
767  index);
768  }
769 
770  // Inline the case for JSObjects. Doing so significantly improves the
771  // performance of fetching elements where checking the prototype chain is
772  // necessary.
773  Handle<JSObject> js_object =
775 
776  // Check access rights if needed.
777  if (js_object->IsAccessCheckNeeded()) {
778  if (!isolate->MayIndexedAccess(js_object, index, v8::ACCESS_GET)) {
779  isolate->ReportFailedAccessCheck(js_object, v8::ACCESS_GET);
781  return isolate->factory()->undefined_value();
782  }
783  }
784 
785  if (js_object->HasIndexedInterceptor()) {
786  return JSObject::GetElementWithInterceptor(js_object, receiver, index);
787  }
788 
789  if (js_object->elements() != isolate->heap()->empty_fixed_array()) {
790  Handle<Object> result;
792  isolate, result,
793  js_object->GetElementsAccessor()->Get(receiver, js_object, index),
794  Object);
795  if (!result->IsTheHole()) return result;
796  }
797  }
798 
799  return isolate->factory()->undefined_value();
800 }
static Handle< T > cast(Handle< S > that)
Definition: handles.h:116
static MUST_USE_RESULT MaybeHandle< Object > GetElementWithInterceptor(Handle< JSObject > object, Handle< Object > receiver, uint32_t index)
Definition: objects.cc:12839
static MUST_USE_RESULT MaybeHandle< Object > GetElementWithHandler(Handle< JSProxy > proxy, Handle< Object > receiver, uint32_t index)
Definition: objects-inl.h:1146
friend class PrototypeIterator
Definition: objects.h:1227
Object * GetCurrent() const
Definition: prototype.h:62
#define ASSIGN_RETURN_ON_EXCEPTION(isolate, dst, call, T)
Definition: isolate.h:135
#define RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, T)
Definition: isolate.h:120
#define UNREACHABLE()
Definition: logging.h:30
@ ACCESS_GET
Definition: v8.h:3520

References v8::ACCESS_GET, ASSIGN_RETURN_ON_EXCEPTION, v8::internal::Handle< T >::cast(), v8::internal::Isolate::factory(), v8::internal::PrototypeIterator::GetCurrent(), v8::internal::JSProxy::GetElementWithHandler(), v8::internal::JSObject::GetElementWithInterceptor(), v8::internal::Isolate::heap(), v8::internal::PrototypeIterator::IsAtEnd(), v8::internal::Isolate::MayIndexedAccess(), v8::internal::Isolate::ReportFailedAccessCheck(), RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION, v8::internal::PrototypeIterator::START_AT_PROTOTYPE, v8::internal::PrototypeIterator::START_AT_RECEIVER, and UNREACHABLE.

Referenced by GetElement(), and v8::internal::JSObject::GetElementWithInterceptor().

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

◆ GetHash()

Object * v8::internal::Object::GetHash ( )

Definition at line 835 of file objects.cc.

835  {
836  // The object is either a number, a name, an odd-ball,
837  // a real JS object, or a Harmony proxy.
838  if (IsNumber()) {
840  return Smi::FromInt(hash & Smi::kMaxValue);
841  }
842  if (IsName()) {
843  uint32_t hash = Name::cast(this)->Hash();
844  return Smi::FromInt(hash);
845  }
846  if (IsOddball()) {
847  uint32_t hash = Oddball::cast(this)->to_string()->Hash();
848  return Smi::FromInt(hash);
849  }
850 
851  DCHECK(IsJSReceiver());
852  return JSReceiver::cast(this)->GetIdentityHash();
853 }
static const int kMaxValue
Definition: objects.h:1272
static Smi * FromInt(int value)
Definition: objects-inl.h:1321
uint32_t ComputeLongHash(uint64_t key)
Definition: utils.h:262
uint64_t double_to_uint64(double d)
Definition: double.h:14

References v8::internal::ComputeLongHash(), DCHECK, v8::internal::double_to_uint64(), v8::internal::Smi::FromInt(), v8::internal::Smi::kMaxValue, and Number().

Referenced by v8::internal::ObjectHashTableShape::HashForObject(), and v8::internal::OrderedHashTable< Derived, Iterator, entrysize >::Rehash().

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

◆ GetOrCreateHash()

Handle< Smi > v8::internal::Object::GetOrCreateHash ( Isolate isolate,
Handle< Object object 
)
static

Definition at line 856 of file objects.cc.

856  {
857  Handle<Object> hash(object->GetHash(), isolate);
858  if (hash->IsSmi()) return Handle<Smi>::cast(hash);
859 
860  DCHECK(object->IsJSReceiver());
862 }
static Handle< Smi > GetOrCreateIdentityHash(Handle< JSReceiver > object)
Definition: objects-inl.h:6704

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

Referenced by v8::internal::OrderedHashSet::Add(), v8::internal::ObjectHashTable::Put(), and v8::internal::OrderedHashMap::Put().

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

◆ GetProperty() [1/3]

MaybeHandle< Object > v8::internal::Object::GetProperty ( Handle< Object object,
Handle< Name key 
)
inlinestatic

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

1107  {
1108  LookupIterator it(object, name);
1109  return GetProperty(&it);
1110 }
friend class LookupIterator
Definition: objects.h:1226
static MUST_USE_RESULT MaybeHandle< Object > GetProperty(LookupIterator *it)
Definition: objects.cc:109
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 GetProperty(), LookupIterator, and name.

+ Here is the call graph for this function:

◆ GetProperty() [2/3]

MaybeHandle< Object > v8::internal::Object::GetProperty ( Isolate isolate,
Handle< Object object,
const char *  key 
)
inlinestatic

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

1135  {
1136  Handle<String> str = isolate->factory()->InternalizeUtf8String(name);
1137  DCHECK(!str.is_null());
1138 #ifdef DEBUG
1139  uint32_t index; // Assert that the name is not an array index.
1140  DCHECK(!str->AsArrayIndex(&index));
1141 #endif // DEBUG
1142  return GetProperty(object, str);
1143 }

References DCHECK, v8::internal::Isolate::factory(), GetProperty(), v8::internal::Handle< T >::is_null(), and name.

+ Here is the call graph for this function:

◆ GetProperty() [3/3]

MaybeHandle< Object > v8::internal::Object::GetProperty ( LookupIterator it)
static

Definition at line 109 of file objects.cc.

109  {
110  for (; it->IsFound(); it->Next()) {
111  switch (it->state()) {
112  case LookupIterator::NOT_FOUND:
113  case LookupIterator::TRANSITION:
114  UNREACHABLE();
115  case LookupIterator::JSPROXY:
116  return JSProxy::GetPropertyWithHandler(it->GetHolder<JSProxy>(),
117  it->GetReceiver(), it->name());
118  case LookupIterator::INTERCEPTOR: {
119  MaybeHandle<Object> maybe_result = JSObject::GetPropertyWithInterceptor(
120  it->GetHolder<JSObject>(), it->GetReceiver(), it->name());
121  if (!maybe_result.is_null()) return maybe_result;
122  if (it->isolate()->has_pending_exception()) return maybe_result;
123  break;
124  }
125  case LookupIterator::ACCESS_CHECK:
126  if (it->HasAccess(v8::ACCESS_GET)) break;
129  return GetPropertyWithAccessor(it->GetReceiver(), it->name(),
130  it->GetHolder<JSObject>(),
131  it->GetAccessors());
132  case LookupIterator::DATA:
133  return it->GetDataValue();
134  }
135  }
136  return it->factory()->undefined_value();
137 }
static MUST_USE_RESULT MaybeHandle< Object > GetPropertyWithInterceptor(Handle< JSObject > object, Handle< Object > receiver, Handle< Name > name)
Definition: objects.cc:13122
static MUST_USE_RESULT MaybeHandle< Object > GetPropertyWithFailedAccessCheck(LookupIterator *it)
Definition: objects.cc:587
static MUST_USE_RESULT MaybeHandle< Object > GetPropertyWithHandler(Handle< JSProxy > proxy, Handle< Object > receiver, Handle< Name > name)
Definition: objects.cc:397
static MUST_USE_RESULT MaybeHandle< Object > GetPropertyWithAccessor(Handle< Object > receiver, Handle< Name > name, Handle< JSObject > holder, Handle< Object > structure)
Definition: objects.cc:411

References v8::ACCESS_GET, v8::internal::ACCESSOR, GetPropertyWithAccessor(), v8::internal::JSObject::GetPropertyWithFailedAccessCheck(), v8::internal::JSProxy::GetPropertyWithHandler(), v8::internal::JSObject::GetPropertyWithInterceptor(), v8::internal::MaybeHandle< T >::is_null(), and UNREACHABLE.

Referenced by v8::internal::CallJsBuiltin(), v8::CallV8HeapFunction(), v8::internal::Isolate::CaptureSimpleStackTrace(), v8::internal::Debug::CheckBreakPoint(), v8::CheckConstructor(), v8::internal::CollectElementIndices(), v8::internal::JSObject::DefineAccessor(), v8::internal::Isolate::DoThrow(), v8::internal::anonymous_namespace{i18n.cc}::ExtractBooleanSetting(), v8::internal::anonymous_namespace{i18n.cc}::ExtractIntegerSetting(), v8::internal::anonymous_namespace{i18n.cc}::ExtractStringSetting(), v8::getBoolProperty(), v8::getIntProperty(), v8::internal::MessageImpl::GetJSON(), v8::internal::MessageHandler::GetMessage(), v8::Debug::GetMirror(), v8::internal::Script::GetNameOrSourceURL(), v8::internal::Runtime::GetObjectProperty(), v8::internal::GetOwnProperty(), GetProperty(), v8::GetPropertyByLookup(), GetPropertyOrElement(), v8::getStringProperty(), v8::internal::AstValue::Internalize(), v8::internal::Isolate::IsErrorObject(), v8::internal::LoadIC::Load(), v8::internal::LoadLookupSlotHelper(), v8::internal::Logger::LogRegExpSource(), v8::internal::Debug::MakeJSObject(), v8::internal::Debug::NotifyMessageHandler(), v8::internal::Debug::OnAfterCompile(), v8::internal::RUNTIME_FUNCTION(), v8::internal::JSProxy::SetPropertyViaPrototypesWithHandler(), v8::internal::Isolate::StackOverflow(), v8::TryCatch::StackTrace(), v8::internal::JSObjectWalkVisitor< ContextObject >::StructureWalk(), v8::internal::compiler::TEST_F(), and v8::internal::UnscopableLookup().

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

◆ GetPropertyOrElement()

MaybeHandle< Object > v8::internal::Object::GetPropertyOrElement ( Handle< Object object,
Handle< Name key 
)
inlinestatic

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

1125  {
1126  uint32_t index;
1127  Isolate* isolate = name->GetIsolate();
1128  if (name->AsArrayIndex(&index)) return GetElement(isolate, object, index);
1129  return GetProperty(object, name);
1130 }
static MUST_USE_RESULT MaybeHandle< Object > GetElement(Isolate *isolate, Handle< Object > object, uint32_t index)
Definition: objects-inl.h:1113

References GetElement(), GetProperty(), and name.

Referenced by v8::internal::JSProxy::CallTrap(), v8::Private::ForApi(), v8::internal::MaterializeClosure(), v8::internal::MaterializeLocalContext(), v8::internal::RUNTIME_FUNCTION(), v8::SymbolFor(), and v8::internal::UpdateStackLocalsFromMaterializedObject().

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

◆ GetPropertyWithAccessor()

MaybeHandle< Object > v8::internal::Object::GetPropertyWithAccessor ( Handle< Object receiver,
Handle< Name name,
Handle< JSObject holder,
Handle< Object structure 
)
static

Definition at line 411 of file objects.cc.

414  {
415  Isolate* isolate = name->GetIsolate();
416  DCHECK(!structure->IsForeign());
417  // api style callbacks.
418  if (structure->IsAccessorInfo()) {
419  Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(structure);
420  if (!info->IsCompatibleReceiver(*receiver)) {
421  Handle<Object> args[2] = { name, receiver };
422  THROW_NEW_ERROR(isolate,
423  NewTypeError("incompatible_method_receiver",
424  HandleVector(args, arraysize(args))),
425  Object);
426  }
427  if (structure->IsDeclaredAccessorInfo()) {
429  receiver,
431  isolate);
432  }
433 
434  Handle<ExecutableAccessorInfo> data =
437  v8::ToCData<v8::AccessorNameGetterCallback>(data->getter());
438  if (call_fun == NULL) return isolate->factory()->undefined_value();
439 
440  LOG(isolate, ApiNamedPropertyAccess("load", *holder, *name));
441  PropertyCallbackArguments args(isolate, data->data(), *receiver, *holder);
442  v8::Handle<v8::Value> result =
443  args.Call(call_fun, v8::Utils::ToLocal(name));
445  if (result.IsEmpty()) {
446  return isolate->factory()->undefined_value();
447  }
448  Handle<Object> return_value = v8::Utils::OpenHandle(*result);
449  return_value->VerifyApiCallResultType();
450  // Rebox handle before return.
451  return handle(*return_value, isolate);
452  }
453 
454  // __defineGetter__ callback
455  Handle<Object> getter(Handle<AccessorPair>::cast(structure)->getter(),
456  isolate);
457  if (getter->IsSpecFunction()) {
458  // TODO(rossberg): nicer would be to cast to some JSCallable here...
460  receiver, Handle<JSReceiver>::cast(getter));
461  }
462  // Getter is not a function.
463  return isolate->factory()->undefined_value();
464 }
bool IsEmpty() const
Returns true if the handle is empty.
Definition: v8.h:228
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 MUST_USE_RESULT MaybeHandle< Object > GetPropertyWithDefinedGetter(Handle< Object > receiver, Handle< JSReceiver > getter)
Definition: objects.cc:536
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
#define LOG(isolate, Call)
Definition: log.h:69
static Handle< Object > GetDeclaredAccessorProperty(Handle< Object > receiver, Handle< DeclaredAccessorInfo > info, Isolate *isolate)
Definition: objects.cc:329
Handle< T > handle(T *t, Isolate *isolate)
Definition: handles.h:146
void(* AccessorNameGetterCallback)(Local< Name > property, const PropertyCallbackInfo< Value > &info)
Definition: v8.h:2248

References arraysize, v8::internal::Handle< T >::cast(), DCHECK, v8::internal::Isolate::factory(), v8::internal::GetDeclaredAccessorProperty(), GetPropertyWithDefinedGetter(), v8::internal::handle(), v8::internal::HandleVector(), v8::Handle< T >::IsEmpty(), LOG, name, NULL, v8::Utils::OpenHandle(), RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION, THROW_NEW_ERROR, and v8::Utils::ToLocal().

Referenced by v8::internal::DebugGetProperty(), GetProperty(), and v8::internal::JSObject::GetPropertyWithFailedAccessCheck().

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

◆ GetPropertyWithDefinedGetter()

MaybeHandle< Object > v8::internal::Object::GetPropertyWithDefinedGetter ( Handle< Object receiver,
Handle< JSReceiver getter 
)
static

Definition at line 536 of file objects.cc.

538  {
539  Isolate* isolate = getter->GetIsolate();
540  Debug* debug = isolate->debug();
541  // Handle stepping into a getter if step into is active.
542  // TODO(rossberg): should this apply to getters that are function proxies?
543  if (debug->StepInActive() && getter->IsJSFunction()) {
544  debug->HandleStepIn(
545  Handle<JSFunction>::cast(getter), Handle<Object>::null(), 0, false);
546  }
547 
548  return Execution::Call(isolate, getter, receiver, 0, NULL, true);
549 }
static Handle< T > null()
Definition: handles.h:123

References v8::internal::Isolate::debug(), v8::internal::Debug::HandleStepIn(), NULL, and v8::internal::Debug::StepInActive().

Referenced by v8::internal::JSObject::GetElementWithCallback(), and GetPropertyWithAccessor().

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

◆ GetRootMap()

Map * v8::internal::Object::GetRootMap ( Isolate isolate)
private

Definition at line 803 of file objects.cc.

803  {
804  DisallowHeapAllocation no_alloc;
805  if (IsSmi()) {
806  Context* context = isolate->context()->native_context();
807  return context->number_function()->initial_map();
808  }
809 
810  HeapObject* heap_object = HeapObject::cast(this);
811 
812  // The object is either a number, a string, a boolean,
813  // a real JS object, or a Harmony proxy.
814  if (heap_object->IsJSReceiver()) {
815  return heap_object->map();
816  }
817  Context* context = isolate->context()->native_context();
818 
819  if (heap_object->IsHeapNumber()) {
820  return context->number_function()->initial_map();
821  }
822  if (heap_object->IsString()) {
823  return context->string_function()->initial_map();
824  }
825  if (heap_object->IsSymbol()) {
826  return context->symbol_function()->initial_map();
827  }
828  if (heap_object->IsBoolean()) {
829  return context->boolean_function()->initial_map();
830  }
831  return isolate->heap()->null_value()->map();
832 }
PerThreadAssertScopeDebugOnly< HEAP_ALLOCATION_ASSERT, false > DisallowHeapAllocation
Definition: assert-scope.h:110

References v8::internal::Isolate::context(), v8::internal::Isolate::heap(), v8::internal::HeapObject::map(), and v8::internal::Context::native_context().

Referenced by v8::internal::PrototypeIterator::AdvanceIgnoringProxies().

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

◆ HasSpecificClassOf()

bool v8::internal::Object::HasSpecificClassOf ( String name)
inline

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

1101  {
1102  return this->IsJSObject() && (JSObject::cast(this)->class_name() == name);
1103 }

References name.

◆ HasValidElements()

bool v8::internal::Object::HasValidElements ( )
inline

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

270  {
271  // Dictionary is covered under FixedArray.
272  return IsFixedArray() || IsFixedDoubleArray() || IsExternalArray() ||
273  IsFixedTypedArrayBase();
274 }

◆ INLINE() [1/23]

v8::internal::Object::INLINE ( bool IsAccessorInfo() const  )

◆ INLINE() [2/23]

v8::internal::Object::INLINE ( bool IsArgumentsMarker() const  )

◆ INLINE() [3/23]

v8::internal::Object::INLINE ( bool IsException() const  )

◆ INLINE() [4/23]

v8::internal::Object::INLINE ( bool IsExternal() const  )

◆ INLINE() [5/23]

v8::internal::Object::INLINE ( bool IsFalse() const  )

◆ INLINE() [6/23]

v8::internal::Object::INLINE ( bool IsFiller() const  )

◆ INLINE() [7/23]

v8::internal::Object::INLINE ( bool IsFixedArrayBase() const  )

◆ INLINE() [8/23]

v8::internal::Object::INLINE ( bool IsMinusZero() const  )

◆ INLINE() [9/23]

v8::internal::Object::INLINE ( bool IsNameDictionary() const  )

◆ INLINE() [10/23]

v8::internal::Object::INLINE ( bool IsNaN() const  )

◆ INLINE() [11/23]

v8::internal::Object::INLINE ( bool IsNull() const  )

◆ INLINE() [12/23]

v8::internal::Object::INLINE ( bool IsOrderedHashMap() const  )

◆ INLINE() [13/23]

v8::internal::Object::INLINE ( bool IsOrderedHashSet() const  )

◆ INLINE() [14/23]

v8::internal::Object::INLINE ( bool IsSeededNumberDictionary() const  )

◆ INLINE() [15/23]

v8::internal::Object::INLINE ( bool   IsSpecFunction()) const

◆ INLINE() [16/23]

v8::internal::Object::INLINE ( bool   IsSpecObject()) const

◆ INLINE() [17/23]

v8::internal::Object::INLINE ( bool IsStruct() const  )

◆ INLINE() [18/23]

v8::internal::Object::INLINE ( bool   IsTemplateInfo()) const

◆ INLINE() [19/23]

v8::internal::Object::INLINE ( bool IsTheHole() const  )

◆ INLINE() [20/23]

v8::internal::Object::INLINE ( bool IsTrue() const  )

◆ INLINE() [21/23]

v8::internal::Object::INLINE ( bool IsUndefined() const  )

◆ INLINE() [22/23]

v8::internal::Object::INLINE ( bool IsUninitialized() const  )

◆ INLINE() [23/23]

v8::internal::Object::INLINE ( bool IsUnseededNumberDictionary() const  )

◆ IsCallable()

bool v8::internal::Object::IsCallable ( ) const

Definition at line 98 of file objects.cc.

98  {
99  const Object* fun = this;
100  while (fun->IsJSFunctionProxy()) {
101  fun = JSFunctionProxy::cast(fun)->call_trap();
102  }
103  return fun->IsJSFunction() ||
104  (fun->IsHeapObject() &&
105  HeapObject::cast(fun)->map()->has_instance_call_handler());
106 }

◆ IsObject()

bool v8::internal::Object::IsObject ( ) const
inline

Definition at line 996 of file objects.h.

996 { return true; }

◆ IsStringObjectWithCharacterAt()

bool v8::internal::Object::IsStringObjectWithCharacterAt ( uint32_t  index)
inline

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

2135  {
2136  if (!this->IsJSValue()) return false;
2137 
2138  JSValue* js_value = JSValue::cast(this);
2139  if (!js_value->value()->IsString()) return false;
2140 
2141  String* str = String::cast(js_value->value());
2142  if (index >= static_cast<uint32_t>(str->length())) return false;
2143 
2144  return true;
2145 }

References v8::internal::String::length().

+ Here is the call graph for this function:

◆ NewStorageFor()

Handle< Object > v8::internal::Object::NewStorageFor ( Isolate isolate,
Handle< Object object,
Representation  representation 
)
inlinestatic

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

279  {
280  if (representation.IsSmi() && object->IsUninitialized()) {
281  return handle(Smi::FromInt(0), isolate);
282  }
283  if (!representation.IsDouble()) return object;
284  double value;
285  if (object->IsUninitialized()) {
286  value = 0;
287  } else if (object->IsMutableHeapNumber()) {
288  value = HeapNumber::cast(*object)->value();
289  } else {
290  value = object->Number();
291  }
292  return isolate->factory()->NewHeapNumber(value, MUTABLE);
293 }

References v8::internal::Isolate::factory(), v8::internal::Smi::FromInt(), v8::internal::handle(), v8::internal::Representation::IsDouble(), v8::internal::Representation::IsSmi(), and v8::internal::MUTABLE.

Referenced by v8::internal::JSObjectWalkVisitor< ContextObject >::StructureWalk().

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

◆ Number()

double v8::internal::Object::Number ( )
inline

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

1062  {
1063  DCHECK(IsNumber());
1064  return IsSmi()
1065  ? static_cast<double>(reinterpret_cast<Smi*>(this)->value())
1066  : reinterpret_cast<HeapNumber*>(this)->value();
1067 }

References DCHECK, and v8::internal::HeapNumber::value().

Referenced by v8::internal::BUILTIN(), v8::internal::CheckArrayAbuse(), v8::internal::CopyDictionaryToDoubleElements(), v8::internal::CopyObjectToDoubleElements(), v8::internal::JSDate::DoGetField(), v8::internal::V8HeapExplorer::ExtractElementReferences(), GetHash(), v8::internal::UnseededNumberDictionaryShape::HashForObject(), v8::internal::TypeImpl< Config >::IsInteger(), v8::internal::NumberDictionaryShape::IsMatch(), v8::Array::Length(), v8::internal::TypeImpl< Config >::BitsetType::Lub(), v8::internal::NumberToInt32(), v8::internal::NumberToUint32(), v8::internal::RUNTIME_FUNCTION(), SameValue(), SameValueZero(), v8::internal::SeededNumberDictionaryShape::SeededHashForObject(), v8::internal::DictionaryElementsAccessor::SetLengthWithoutNormalize(), v8::internal::JSObject::SlowReverseLookup(), and v8::internal::JSObject::WriteToField().

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

◆ OptimalRepresentation()

Representation v8::internal::Object::OptimalRepresentation ( )
inline

Definition at line 1052 of file objects.h.

1052  {
1053  if (!FLAG_track_fields) return Representation::Tagged();
1054  if (IsSmi()) {
1055  return Representation::Smi();
1056  } else if (FLAG_track_double_fields && IsHeapNumber()) {
1057  return Representation::Double();
1058  } else if (FLAG_track_computed_fields && IsUninitialized()) {
1059  return Representation::None();
1060  } else if (FLAG_track_heap_object_fields) {
1061  DCHECK(IsHeapObject());
1062  return Representation::HeapObject();
1063  } else {
1064  return Representation::Tagged();
1065  }
1066  }
static Representation Double()
static Representation Smi()
static Representation HeapObject()
static Representation Tagged()
static Representation None()

References DCHECK, v8::internal::Representation::Double(), v8::internal::Representation::HeapObject(), v8::internal::Representation::None(), v8::internal::Representation::Smi(), and v8::internal::Representation::Tagged().

+ Here is the call graph for this function:

◆ OptimalType()

Handle< HeapType > v8::internal::Object::OptimalType ( Isolate isolate,
Representation  representation 
)

Definition at line 47 of file objects.cc.

48  {
49  if (representation.IsNone()) return HeapType::None(isolate);
50  if (FLAG_track_field_types) {
51  if (representation.IsHeapObject() && IsHeapObject()) {
52  // We can track only JavaScript objects with stable maps.
53  Handle<Map> map(HeapObject::cast(this)->map(), isolate);
54  if (map->is_stable() &&
55  map->instance_type() >= FIRST_NONCALLABLE_SPEC_OBJECT_TYPE &&
56  map->instance_type() <= LAST_NONCALLABLE_SPEC_OBJECT_TYPE) {
57  return HeapType::Class(map, isolate);
58  }
59  }
60  }
61  return HeapType::Any(isolate);
62 }
static TypeHandle Class(i::Handle< i::Map > map, Region *region)
Definition: types.h:327
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 map
@ LAST_NONCALLABLE_SPEC_OBJECT_TYPE
Definition: objects.h:785
@ FIRST_NONCALLABLE_SPEC_OBJECT_TYPE
Definition: objects.h:784
@ None
Definition: v8.h:2211

References v8::internal::TypeImpl< Config >::Class(), v8::internal::FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, v8::internal::Representation::IsHeapObject(), v8::internal::Representation::IsNone(), v8::internal::LAST_NONCALLABLE_SPEC_OBJECT_TYPE, map, and v8::None.

+ Here is the call graph for this function:

◆ SameValue()

bool v8::internal::Object::SameValue ( Object other)

Definition at line 865 of file objects.cc.

865  {
866  if (other == this) return true;
867 
868  // The object is either a number, a name, an odd-ball,
869  // a real JS object, or a Harmony proxy.
870  if (IsNumber() && other->IsNumber()) {
871  double this_value = Number();
872  double other_value = other->Number();
873  bool equal = this_value == other_value;
874  // SameValue(NaN, NaN) is true.
875  if (!equal) return std::isnan(this_value) && std::isnan(other_value);
876  // SameValue(0.0, -0.0) is false.
877  return (this_value != 0) || ((1 / this_value) == (1 / other_value));
878  }
879  if (IsString() && other->IsString()) {
880  return String::cast(this)->Equals(String::cast(other));
881  }
882  return false;
883 }
int isnan(double x)

References v8::internal::equal, and Number().

+ Here is the call graph for this function:

◆ SameValueZero()

bool v8::internal::Object::SameValueZero ( Object other)

Definition at line 886 of file objects.cc.

886  {
887  if (other == this) return true;
888 
889  // The object is either a number, a name, an odd-ball,
890  // a real JS object, or a Harmony proxy.
891  if (IsNumber() && other->IsNumber()) {
892  double this_value = Number();
893  double other_value = other->Number();
894  // +0 == -0 is true
895  return this_value == other_value
896  || (std::isnan(this_value) && std::isnan(other_value));
897  }
898  if (IsString() && other->IsString()) {
899  return String::cast(this)->Equals(String::cast(other));
900  }
901  return false;
902 }

References Number().

Referenced by v8::internal::OrderedHashTable< Derived, Iterator, entrysize >::FindEntry().

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

◆ SetDataProperty()

Handle< Object > v8::internal::Object::SetDataProperty ( LookupIterator it,
Handle< Object value 
)
static

Definition at line 2933 of file objects.cc.

2934  {
2935  // Proxies are handled on the WithHandler path. Other non-JSObjects cannot
2936  // have own properties.
2937  Handle<JSObject> receiver = Handle<JSObject>::cast(it->GetReceiver());
2938 
2939  // Store on the holder which may be hidden behind the receiver.
2940  DCHECK(it->HolderIsReceiverOrHiddenPrototype());
2941 
2942  // Old value for the observation change record.
2943  // Fetch before transforming the object since the encoding may become
2944  // incompatible with what's cached in |it|.
2945  bool is_observed =
2946  receiver->map()->is_observed() &&
2947  !it->name().is_identical_to(it->factory()->hidden_string());
2948  MaybeHandle<Object> maybe_old;
2949  if (is_observed) maybe_old = it->GetDataValue();
2950 
2951  // Possibly migrate to the most up-to-date map that will be able to store
2952  // |value| under it->name().
2953  it->PrepareForDataProperty(value);
2954 
2955  // Write the property value.
2956  it->WriteDataValue(value);
2957 
2958  // Send the change record if there are observers.
2959  if (is_observed && !value->SameValue(*maybe_old.ToHandleChecked())) {
2960  JSObject::EnqueueChangeRecord(receiver, "update", it->name(),
2961  maybe_old.ToHandleChecked());
2962  }
2963 
2964  return value;
2965 }

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

Referenced by v8::internal::OrderedHashTable< OrderedHashSet, JSSetIterator, 1 >::Rehash(), and SetProperty().

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

◆ SetProperty() [1/2]

MaybeHandle< Object > v8::internal::Object::SetProperty ( Handle< Object object,
Handle< Name key,
Handle< Object value,
StrictMode  strict_mode,
StoreFromKeyed  store_mode = MAY_BE_STORE_FROM_KEYED 
)
static

◆ SetProperty() [2/2]

MaybeHandle< Object > v8::internal::Object::SetProperty ( LookupIterator it,
Handle< Object value,
StrictMode  strict_mode,
StoreFromKeyed  store_mode,
StorePropertyMode  data_store_mode = NORMAL_PROPERTY 
)
static

Definition at line 2807 of file objects.cc.

2811  {
2812  // Make sure that the top context does not change when doing callbacks or
2813  // interceptor calls.
2814  AssertNoContextChange ncc(it->isolate());
2815 
2816  bool done = false;
2817  for (; it->IsFound(); it->Next()) {
2818  switch (it->state()) {
2819  case LookupIterator::NOT_FOUND:
2820  UNREACHABLE();
2821 
2822  case LookupIterator::ACCESS_CHECK:
2823  // TODO(verwaest): Remove the distinction. This is mostly bogus since we
2824  // don't know whether we'll want to fetch attributes or call a setter
2825  // until we find the property.
2826  if (it->HasAccess(v8::ACCESS_SET)) break;
2828  strict_mode);
2829 
2830  case LookupIterator::JSPROXY:
2831  if (it->HolderIsReceiverOrHiddenPrototype()) {
2832  return JSProxy::SetPropertyWithHandler(it->GetHolder<JSProxy>(),
2833  it->GetReceiver(), it->name(),
2834  value, strict_mode);
2835  } else {
2836  // TODO(verwaest): Use the MaybeHandle to indicate result.
2837  bool has_result = false;
2838  MaybeHandle<Object> maybe_result =
2840  it->GetHolder<JSProxy>(), it->GetReceiver(), it->name(),
2841  value, strict_mode, &has_result);
2842  if (has_result) return maybe_result;
2843  done = true;
2844  }
2845  break;
2846 
2847  case LookupIterator::INTERCEPTOR:
2848  if (it->HolderIsReceiverOrHiddenPrototype()) {
2849  MaybeHandle<Object> maybe_result =
2851  if (!maybe_result.is_null()) return maybe_result;
2852  if (it->isolate()->has_pending_exception()) return maybe_result;
2853  } else {
2854  Maybe<PropertyAttributes> maybe_attributes =
2856  it->GetHolder<JSObject>(), it->GetReceiver(), it->name());
2857  if (!maybe_attributes.has_value) return MaybeHandle<Object>();
2858  done = maybe_attributes.value != ABSENT;
2859  if (done && (maybe_attributes.value & READ_ONLY) != 0) {
2860  return WriteToReadOnlyProperty(it, value, strict_mode);
2861  }
2862  }
2863  break;
2864 
2866  if (it->property_details().IsReadOnly()) {
2867  return WriteToReadOnlyProperty(it, value, strict_mode);
2868  }
2869  if (it->HolderIsReceiverOrHiddenPrototype() ||
2870  !it->GetAccessors()->IsDeclaredAccessorInfo()) {
2871  return SetPropertyWithAccessor(it->GetReceiver(), it->name(), value,
2872  it->GetHolder<JSObject>(),
2873  it->GetAccessors(), strict_mode);
2874  }
2875  done = true;
2876  break;
2877 
2878  case LookupIterator::DATA:
2879  if (it->property_details().IsReadOnly()) {
2880  return WriteToReadOnlyProperty(it, value, strict_mode);
2881  }
2882  if (it->HolderIsReceiverOrHiddenPrototype()) {
2883  return SetDataProperty(it, value);
2884  }
2885  done = true;
2886  break;
2887 
2888  case LookupIterator::TRANSITION:
2889  done = true;
2890  break;
2891  }
2892 
2893  if (done) break;
2894  }
2895 
2896  // If the receiver is the JSGlobalObject, the store was contextual. In case
2897  // the property did not exist yet on the global object itself, we have to
2898  // throw a reference error in strict mode.
2899  if (it->GetReceiver()->IsJSGlobalObject() && strict_mode == STRICT) {
2900  Handle<Object> args[1] = {it->name()};
2901  THROW_NEW_ERROR(it->isolate(),
2902  NewReferenceError("not_defined", HandleVector(args, 1)),
2903  Object);
2904  }
2905 
2906  if (data_store_mode == SUPER_PROPERTY) {
2907  if (strict_mode == STRICT) {
2908  Handle<Object> args[1] = {it->name()};
2909  THROW_NEW_ERROR(it->isolate(),
2910  NewReferenceError("not_defined", HandleVector(args, 1)),
2911  Object);
2912  }
2913  return value;
2914  }
2915 
2916  return AddDataProperty(it, value, NONE, strict_mode, store_mode);
2917 }
static MUST_USE_RESULT MaybeHandle< Object > SetPropertyWithInterceptor(LookupIterator *it, Handle< Object > value)
Definition: objects.cc:2773
static MUST_USE_RESULT Maybe< PropertyAttributes > GetPropertyAttributesWithInterceptor(Handle< JSObject > holder, Handle< Object > receiver, Handle< Name > name)
Definition: objects.cc:3940
static MUST_USE_RESULT MaybeHandle< Object > SetPropertyWithFailedAccessCheck(LookupIterator *it, Handle< Object > value, StrictMode strict_mode)
Definition: objects.cc:626
static MUST_USE_RESULT MaybeHandle< Object > SetPropertyViaPrototypesWithHandler(Handle< JSProxy > proxy, Handle< Object > receiver, Handle< Name > name, Handle< Object > value, StrictMode strict_mode, bool *done)
Definition: objects.cc:3434
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
static MUST_USE_RESULT MaybeHandle< Object > AddDataProperty(LookupIterator *it, Handle< Object > value, PropertyAttributes attributes, StrictMode strict_mode, StoreFromKeyed store_mode)
Definition: objects.cc:2968
static MUST_USE_RESULT MaybeHandle< Object > SetPropertyWithAccessor(Handle< Object > receiver, Handle< Name > name, Handle< Object > value, Handle< JSObject > holder, Handle< Object > structure, StrictMode strict_mode)
Definition: objects.cc:478
static Handle< Object > SetDataProperty(LookupIterator *it, Handle< Object > value)
Definition: objects.cc:2933
@ ACCESS_SET
Definition: v8.h:3521
@ ABSENT
@ NONE
@ READ_ONLY

References ABSENT, v8::ACCESS_SET, v8::internal::ACCESSOR, AddDataProperty(), v8::internal::JSObject::GetPropertyAttributesWithInterceptor(), v8::internal::HandleVector(), v8::Maybe< T >::has_value, v8::internal::MaybeHandle< T >::is_null(), NONE, READ_ONLY, SetDataProperty(), v8::internal::JSProxy::SetPropertyViaPrototypesWithHandler(), SetPropertyWithAccessor(), v8::internal::JSObject::SetPropertyWithFailedAccessCheck(), v8::internal::JSProxy::SetPropertyWithHandler(), v8::internal::JSObject::SetPropertyWithInterceptor(), v8::internal::STRICT, SUPER_PROPERTY, THROW_NEW_ERROR, UNREACHABLE, v8::Maybe< T >::value, and WriteToReadOnlyProperty().

+ Here is the call graph for this function:

◆ SetPropertyWithAccessor()

MaybeHandle< Object > v8::internal::Object::SetPropertyWithAccessor ( Handle< Object receiver,
Handle< Name name,
Handle< Object value,
Handle< JSObject holder,
Handle< Object structure,
StrictMode  strict_mode 
)
static

Definition at line 478 of file objects.cc.

480  {
481  Isolate* isolate = name->GetIsolate();
482 
483  // We should never get here to initialize a const with the hole
484  // value since a const declaration would conflict with the setter.
485  DCHECK(!structure->IsForeign());
486  if (structure->IsExecutableAccessorInfo()) {
487  // Don't call executable accessor setters with non-JSObject receivers.
488  if (!receiver->IsJSObject()) return value;
489  // api style callbacks
490  ExecutableAccessorInfo* info = ExecutableAccessorInfo::cast(*structure);
491  if (!info->IsCompatibleReceiver(*receiver)) {
492  Handle<Object> args[2] = { name, receiver };
493  THROW_NEW_ERROR(isolate,
494  NewTypeError("incompatible_method_receiver",
495  HandleVector(args, arraysize(args))),
496  Object);
497  }
498  Object* call_obj = info->setter();
500  v8::ToCData<v8::AccessorNameSetterCallback>(call_obj);
501  if (call_fun == NULL) return value;
502  LOG(isolate, ApiNamedPropertyAccess("store", *holder, *name));
503  PropertyCallbackArguments args(isolate, info->data(), *receiver, *holder);
504  args.Call(call_fun,
506  v8::Utils::ToLocal(value));
508  return value;
509  }
510 
511  if (structure->IsAccessorPair()) {
512  Handle<Object> setter(AccessorPair::cast(*structure)->setter(), isolate);
513  if (setter->IsSpecFunction()) {
514  // TODO(rossberg): nicer would be to cast to some JSCallable here...
516  receiver, Handle<JSReceiver>::cast(setter), value);
517  } else {
518  if (strict_mode == SLOPPY) return value;
519  Handle<Object> args[2] = { name, holder };
521  isolate, NewTypeError("no_setter_in_callback", HandleVector(args, 2)),
522  Object);
523  }
524  }
525 
526  // TODO(dcarney): Handle correctly.
527  if (structure->IsDeclaredAccessorInfo()) {
528  return value;
529  }
530 
531  UNREACHABLE();
532  return MaybeHandle<Object>();
533 }
static MUST_USE_RESULT MaybeHandle< Object > SetPropertyWithDefinedSetter(Handle< Object > receiver, Handle< JSReceiver > setter, Handle< Object > value)
Definition: objects.cc:552
void(* AccessorNameSetterCallback)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< void > &info)
Definition: v8.h:2257

References arraysize, DCHECK, v8::internal::HandleVector(), v8::internal::AccessorInfo::IsCompatibleReceiver(), LOG, name, NULL, RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION, SetPropertyWithDefinedSetter(), v8::internal::SLOPPY, THROW_NEW_ERROR, v8::Utils::ToLocal(), and UNREACHABLE.

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

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

◆ SetPropertyWithDefinedSetter()

MaybeHandle< Object > v8::internal::Object::SetPropertyWithDefinedSetter ( Handle< Object receiver,
Handle< JSReceiver setter,
Handle< Object value 
)
static

Definition at line 552 of file objects.cc.

555  {
556  Isolate* isolate = setter->GetIsolate();
557 
558  Debug* debug = isolate->debug();
559  // Handle stepping into a setter if step into is active.
560  // TODO(rossberg): should this apply to getters that are function proxies?
561  if (debug->StepInActive() && setter->IsJSFunction()) {
562  debug->HandleStepIn(
563  Handle<JSFunction>::cast(setter), Handle<Object>::null(), 0, false);
564  }
565 
566  Handle<Object> argv[] = { value };
567  RETURN_ON_EXCEPTION(isolate, Execution::Call(isolate, setter, receiver,
568  arraysize(argv), argv, true),
569  Object);
570  return value;
571 }
#define RETURN_ON_EXCEPTION(isolate, call, T)
Definition: isolate.h:165

References arraysize, v8::internal::Isolate::debug(), v8::internal::Debug::HandleStepIn(), RETURN_ON_EXCEPTION, and v8::internal::Debug::StepInActive().

Referenced by v8::internal::Dictionary< UnseededNumberDictionary, UnseededNumberDictionaryShape, uint32_t >::DeleteProperty(), v8::internal::JSObject::SetElementWithCallback(), and SetPropertyWithAccessor().

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

◆ ShortPrint() [1/2]

◆ ShortPrint() [2/2]

void v8::internal::Object::ShortPrint ( StringStream *  accumulator)

Definition at line 911 of file objects.cc.

911  {
912  OStringStream os;
913  os << Brief(this);
914  accumulator->Add(os.c_str());
915 }

References v8::internal::OStringStream::c_str().

+ Here is the call graph for this function:

◆ ToArrayIndex()

bool v8::internal::Object::ToArrayIndex ( uint32_t index)
inline

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

2116  {
2117  if (IsSmi()) {
2118  int value = Smi::cast(this)->value();
2119  if (value < 0) return false;
2120  *index = value;
2121  return true;
2122  }
2123  if (IsHeapNumber()) {
2124  double value = HeapNumber::cast(this)->value();
2125  uint32_t uint_value = static_cast<uint32_t>(value);
2126  if (value == static_cast<double>(uint_value)) {
2127  *index = uint_value;
2128  return true;
2129  }
2130  }
2131  return false;
2132 }

Referenced by v8::internal::ComputeObjectLiteralMap(), v8::internal::JSObject::SetDictionaryElement(), v8::internal::JSObject::SetFastDoubleElement(), v8::internal::JSObject::SetFastElement(), v8::internal::JSObject::ShouldConvertToFastElements(), and v8::internal::JSObject::TransitionElementsKind().

+ Here is the caller graph for this function:

◆ ToInt32()

bool v8::internal::Object::ToInt32 ( int32_t *  value)

Definition at line 175 of file objects.cc.

175  {
176  if (IsSmi()) {
177  *value = Smi::cast(this)->value();
178  return true;
179  }
180  if (IsHeapNumber()) {
181  double num = HeapNumber::cast(this)->value();
182  if (FastI2D(FastD2I(num)) == num) {
183  *value = FastD2I(num);
184  return true;
185  }
186  }
187  return false;
188 }
double FastI2D(int x)
Definition: conversions.h:64
int FastD2I(double x)
Definition: conversions.h:57

References v8::internal::FastD2I(), and v8::internal::FastI2D().

+ Here is the call graph for this function:

◆ ToObject() [1/2]

MaybeHandle< JSReceiver > v8::internal::Object::ToObject ( Isolate isolate,
Handle< Object object 
)
inlinestatic

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

1095  {
1096  return ToObject(
1097  isolate, object, handle(isolate->context()->native_context(), isolate));
1098 }
static MaybeHandle< JSReceiver > ToObject(Isolate *isolate, Handle< Object > object)
Definition: objects-inl.h:1094

References v8::internal::Isolate::context(), v8::internal::handle(), and v8::internal::Context::native_context().

Referenced by v8::BooleanObject::New(), v8::StringObject::New(), v8::NumberObject::New(), v8::SymbolObject::New(), and v8::internal::RUNTIME_FUNCTION().

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

◆ ToObject() [2/2]

MaybeHandle< JSReceiver > v8::internal::Object::ToObject ( Isolate isolate,
Handle< Object object,
Handle< Context context 
)
static

Definition at line 65 of file objects.cc.

67  {
68  if (object->IsJSReceiver()) return Handle<JSReceiver>::cast(object);
69  Handle<JSFunction> constructor;
70  if (object->IsNumber()) {
71  constructor = handle(native_context->number_function(), isolate);
72  } else if (object->IsBoolean()) {
73  constructor = handle(native_context->boolean_function(), isolate);
74  } else if (object->IsString()) {
75  constructor = handle(native_context->string_function(), isolate);
76  } else if (object->IsSymbol()) {
77  constructor = handle(native_context->symbol_function(), isolate);
78  } else {
79  return MaybeHandle<JSReceiver>();
80  }
81  Handle<JSObject> result = isolate->factory()->NewJSObject(constructor);
82  Handle<JSValue>::cast(result)->set_value(*object);
83  return result;
84 }

References v8::internal::Handle< T >::cast(), v8::internal::Isolate::factory(), and v8::internal::handle().

+ Here is the call graph for this function:

◆ ToSmi()

MaybeHandle< Smi > v8::internal::Object::ToSmi ( Isolate isolate,
Handle< Object object 
)
inlinestatic

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

1081  {
1082  if (object->IsSmi()) return Handle<Smi>::cast(object);
1083  if (object->IsHeapNumber()) {
1084  double value = Handle<HeapNumber>::cast(object)->value();
1085  int int_value = FastD2I(value);
1086  if (value == FastI2D(int_value) && Smi::IsValid(int_value)) {
1087  return handle(Smi::FromInt(int_value), isolate);
1088  }
1089  }
1090  return Handle<Smi>();
1091 }
static bool IsValid(intptr_t value)
Definition: objects-inl.h:1334

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

Referenced by v8::internal::KeyedStoreIC::GetStoreMode(), v8::internal::KeyedLoadIC::Load(), v8::internal::ElementsAccessorBase< ElementsAccessorSubclass, ElementsTraitsParam >::SetLengthImpl(), and v8::internal::KeyedStoreIC::Store().

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

◆ ToUint32()

bool v8::internal::Object::ToUint32 ( uint32_t value)

Definition at line 191 of file objects.cc.

191  {
192  if (IsSmi()) {
193  int num = Smi::cast(this)->value();
194  if (num >= 0) {
195  *value = static_cast<uint32_t>(num);
196  return true;
197  }
198  }
199  if (IsHeapNumber()) {
200  double num = HeapNumber::cast(this)->value();
201  if (num >= 0 && FastUI2D(FastD2UI(num)) == num) {
202  *value = FastD2UI(num);
203  return true;
204  }
205  }
206  return false;
207 }
unsigned int FastD2UI(double x)
double FastUI2D(unsigned x)
Definition: conversions.h:72

References v8::internal::FastD2UI(), and v8::internal::FastUI2D().

+ Here is the call graph for this function:

◆ VerifyApiCallResultType()

void v8::internal::Object::VerifyApiCallResultType ( )
inline

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

2148  {
2149 #if ENABLE_EXTRA_CHECKS
2150  if (!(IsSmi() ||
2151  IsString() ||
2152  IsSymbol() ||
2153  IsSpecObject() ||
2154  IsHeapNumber() ||
2155  IsUndefined() ||
2156  IsTrue() ||
2157  IsFalse() ||
2158  IsNull())) {
2159  FATAL("API call returned invalid object");
2160  }
2161 #endif // ENABLE_EXTRA_CHECKS
2162 }
#define FATAL(msg)
Definition: logging.h:26

References FATAL.

Referenced by v8::internal::HandleApiCallAsFunctionOrConstructor(), and v8::internal::HandleApiCallHelper().

+ Here is the caller graph for this function:

◆ WrapForRead()

Handle< Object > v8::internal::Object::WrapForRead ( Isolate isolate,
Handle< Object object,
Representation  representation 
)
inlinestatic

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

298  {
299  DCHECK(!object->IsUninitialized());
300  if (!representation.IsDouble()) {
301  DCHECK(object->FitsRepresentation(representation));
302  return object;
303  }
304  return isolate->factory()->NewHeapNumber(HeapNumber::cast(*object)->value());
305 }

References DCHECK, v8::internal::Isolate::factory(), and v8::internal::Representation::IsDouble().

Referenced by v8::internal::JSObject::FastPropertyAt(), and v8::internal::RUNTIME_FUNCTION().

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

◆ WriteToReadOnlyProperty()

MaybeHandle< Object > v8::internal::Object::WriteToReadOnlyProperty ( LookupIterator it,
Handle< Object value,
StrictMode  strict_mode 
)
static

Definition at line 2920 of file objects.cc.

2922  {
2923  if (strict_mode != STRICT) return value;
2924 
2925  Handle<Object> args[] = {it->name(), it->GetReceiver()};
2926  THROW_NEW_ERROR(it->isolate(),
2927  NewTypeError("strict_read_only_property",
2928  HandleVector(args, arraysize(args))),
2929  Object);
2930 }

References arraysize, v8::internal::HandleVector(), v8::internal::STRICT, and THROW_NEW_ERROR.

Referenced by AddDataProperty(), and SetProperty().

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

Friends And Related Function Documentation

◆ LookupIterator

◆ PrototypeIterator

friend class PrototypeIterator
friend

Definition at line 1227 of file objects.h.

Member Data Documentation

◆ kHeaderSize


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