LCOV - code coverage report
Current view: top level - src - objects.h (source / functions) Hit Total Coverage
Test: app.info Lines: 15 17 88.2 %
Date: 2019-04-19 Functions: 4 4 100.0 %

          Line data    Source code
       1             : // Copyright 2015 the V8 project authors. All rights reserved.
       2             : // Use of this source code is governed by a BSD-style license that can be
       3             : // found in the LICENSE file.
       4             : 
       5             : #ifndef V8_OBJECTS_H_
       6             : #define V8_OBJECTS_H_
       7             : 
       8             : #include <iosfwd>
       9             : #include <memory>
      10             : 
      11             : #include "include/v8-internal.h"
      12             : #include "include/v8.h"
      13             : #include "include/v8config.h"
      14             : #include "src/assert-scope.h"
      15             : #include "src/base/bits.h"
      16             : #include "src/base/build_config.h"
      17             : #include "src/base/flags.h"
      18             : #include "src/base/logging.h"
      19             : #include "src/checks.h"
      20             : #include "src/constants-arch.h"
      21             : #include "src/elements-kind.h"
      22             : #include "src/field-index.h"
      23             : #include "src/flags.h"
      24             : #include "src/message-template.h"
      25             : #include "src/objects-definitions.h"
      26             : #include "src/property-details.h"
      27             : #include "src/utils.h"
      28             : 
      29             : // Has to be the last include (doesn't have include guards):
      30             : #include "src/objects/object-macros.h"
      31             : 
      32             : //
      33             : // Most object types in the V8 JavaScript are described in this file.
      34             : //
      35             : // Inheritance hierarchy:
      36             : // - Object
      37             : //   - Smi          (immediate small integer)
      38             : //   - HeapObject   (superclass for everything allocated in the heap)
      39             : //     - JSReceiver  (suitable for property access)
      40             : //       - JSObject
      41             : //         - JSArray
      42             : //         - JSArrayBuffer
      43             : //         - JSArrayBufferView
      44             : //           - JSTypedArray
      45             : //           - JSDataView
      46             : //         - JSBoundFunction
      47             : //         - JSCollection
      48             : //           - JSSet
      49             : //           - JSMap
      50             : //         - JSStringIterator
      51             : //         - JSSetIterator
      52             : //         - JSMapIterator
      53             : //         - JSWeakCollection
      54             : //           - JSWeakMap
      55             : //           - JSWeakSet
      56             : //         - JSRegExp
      57             : //         - JSFunction
      58             : //         - JSGeneratorObject
      59             : //         - JSGlobalObject
      60             : //         - JSGlobalProxy
      61             : //         - JSValue
      62             : //           - JSDate
      63             : //         - JSMessageObject
      64             : //         - JSModuleNamespace
      65             : //         - JSV8BreakIterator     // If V8_INTL_SUPPORT enabled.
      66             : //         - JSCollator            // If V8_INTL_SUPPORT enabled.
      67             : //         - JSDateTimeFormat      // If V8_INTL_SUPPORT enabled.
      68             : //         - JSListFormat          // If V8_INTL_SUPPORT enabled.
      69             : //         - JSLocale              // If V8_INTL_SUPPORT enabled.
      70             : //         - JSNumberFormat        // If V8_INTL_SUPPORT enabled.
      71             : //         - JSPluralRules         // If V8_INTL_SUPPORT enabled.
      72             : //         - JSRelativeTimeFormat  // If V8_INTL_SUPPORT enabled.
      73             : //         - JSSegmentIterator     // If V8_INTL_SUPPORT enabled.
      74             : //         - JSSegmenter           // If V8_INTL_SUPPORT enabled.
      75             : //         - WasmExceptionObject
      76             : //         - WasmGlobalObject
      77             : //         - WasmInstanceObject
      78             : //         - WasmMemoryObject
      79             : //         - WasmModuleObject
      80             : //         - WasmTableObject
      81             : //       - JSProxy
      82             : //     - FixedArrayBase
      83             : //       - ByteArray
      84             : //       - BytecodeArray
      85             : //       - FixedArray
      86             : //         - FrameArray
      87             : //         - HashTable
      88             : //           - Dictionary
      89             : //           - StringTable
      90             : //           - StringSet
      91             : //           - CompilationCacheTable
      92             : //           - MapCache
      93             : //         - OrderedHashTable
      94             : //           - OrderedHashSet
      95             : //           - OrderedHashMap
      96             : //         - FeedbackMetadata
      97             : //         - TemplateList
      98             : //         - TransitionArray
      99             : //         - ScopeInfo
     100             : //         - ModuleInfo
     101             : //         - ScriptContextTable
     102             : //         - ClosureFeedbackCellArray
     103             : //       - FixedDoubleArray
     104             : //     - Name
     105             : //       - String
     106             : //         - SeqString
     107             : //           - SeqOneByteString
     108             : //           - SeqTwoByteString
     109             : //         - SlicedString
     110             : //         - ConsString
     111             : //         - ThinString
     112             : //         - ExternalString
     113             : //           - ExternalOneByteString
     114             : //           - ExternalTwoByteString
     115             : //         - InternalizedString
     116             : //           - SeqInternalizedString
     117             : //             - SeqOneByteInternalizedString
     118             : //             - SeqTwoByteInternalizedString
     119             : //           - ConsInternalizedString
     120             : //           - ExternalInternalizedString
     121             : //             - ExternalOneByteInternalizedString
     122             : //             - ExternalTwoByteInternalizedString
     123             : //       - Symbol
     124             : //     - Context
     125             : //       - NativeContext
     126             : //     - HeapNumber
     127             : //     - BigInt
     128             : //     - Cell
     129             : //     - DescriptorArray
     130             : //     - PropertyCell
     131             : //     - PropertyArray
     132             : //     - Code
     133             : //     - AbstractCode, a wrapper around Code or BytecodeArray
     134             : //     - Map
     135             : //     - Oddball
     136             : //     - Foreign
     137             : //     - SmallOrderedHashTable
     138             : //       - SmallOrderedHashMap
     139             : //       - SmallOrderedHashSet
     140             : //     - SharedFunctionInfo
     141             : //     - Struct
     142             : //       - AccessorInfo
     143             : //       - AsmWasmData
     144             : //       - PromiseReaction
     145             : //       - PromiseCapability
     146             : //       - AccessorPair
     147             : //       - AccessCheckInfo
     148             : //       - InterceptorInfo
     149             : //       - CallHandlerInfo
     150             : //       - EnumCache
     151             : //       - TemplateInfo
     152             : //         - FunctionTemplateInfo
     153             : //         - ObjectTemplateInfo
     154             : //       - Script
     155             : //       - DebugInfo
     156             : //       - BreakPoint
     157             : //       - BreakPointInfo
     158             : //       - StackFrameInfo
     159             : //       - StackTraceFrame
     160             : //       - SourcePositionTableWithFrameCache
     161             : //       - CodeCache
     162             : //       - PrototypeInfo
     163             : //       - Microtask
     164             : //         - CallbackTask
     165             : //         - CallableTask
     166             : //         - PromiseReactionJobTask
     167             : //           - PromiseFulfillReactionJobTask
     168             : //           - PromiseRejectReactionJobTask
     169             : //         - PromiseResolveThenableJobTask
     170             : //       - Module
     171             : //       - ModuleInfoEntry
     172             : //     - FeedbackCell
     173             : //     - FeedbackVector
     174             : //     - PreparseData
     175             : //     - UncompiledData
     176             : //       - UncompiledDataWithoutPreparseData
     177             : //       - UncompiledDataWithPreparseData
     178             : //
     179             : // Formats of Object::ptr_:
     180             : //  Smi:        [31 bit signed int] 0
     181             : //  HeapObject: [32 bit direct pointer] (4 byte aligned) | 01
     182             : 
     183             : namespace v8 {
     184             : namespace internal {
     185             : 
     186             : struct InliningPosition;
     187             : class PropertyDescriptorObject;
     188             : 
     189             : // SKIP_WRITE_BARRIER skips the write barrier.
     190             : // UPDATE_WEAK_WRITE_BARRIER skips the marking part of the write barrier and
     191             : // only performs the generational part.
     192             : // UPDATE_WRITE_BARRIER is doing the full barrier, marking and generational.
     193             : enum WriteBarrierMode {
     194             :   SKIP_WRITE_BARRIER,
     195             :   UPDATE_WEAK_WRITE_BARRIER,
     196             :   UPDATE_EPHEMERON_KEY_WRITE_BARRIER,
     197             :   UPDATE_WRITE_BARRIER
     198             : };
     199             : 
     200             : // PropertyNormalizationMode is used to specify whether to keep
     201             : // inobject properties when normalizing properties of a JSObject.
     202             : enum PropertyNormalizationMode {
     203             :   CLEAR_INOBJECT_PROPERTIES,
     204             :   KEEP_INOBJECT_PROPERTIES
     205             : };
     206             : 
     207             : 
     208             : // Indicates whether transitions can be added to a source map or not.
     209             : enum TransitionFlag {
     210             :   INSERT_TRANSITION,
     211             :   OMIT_TRANSITION
     212             : };
     213             : 
     214             : 
     215             : // Indicates whether the transition is simple: the target map of the transition
     216             : // either extends the current map with a new property, or it modifies the
     217             : // property that was added last to the current map.
     218             : enum SimpleTransitionFlag {
     219             :   SIMPLE_PROPERTY_TRANSITION,
     220             :   PROPERTY_TRANSITION,
     221             :   SPECIAL_TRANSITION
     222             : };
     223             : 
     224             : // Indicates whether we are only interested in the descriptors of a particular
     225             : // map, or in all descriptors in the descriptor array.
     226             : enum DescriptorFlag {
     227             :   ALL_DESCRIPTORS,
     228             :   OWN_DESCRIPTORS
     229             : };
     230             : 
     231             : // Instance size sentinel for objects of variable size.
     232             : const int kVariableSizeSentinel = 0;
     233             : 
     234             : // We may store the unsigned bit field as signed Smi value and do not
     235             : // use the sign bit.
     236             : const int kStubMajorKeyBits = 8;
     237             : const int kStubMinorKeyBits = kSmiValueSize - kStubMajorKeyBits - 1;
     238             : 
     239             : // Result of an abstract relational comparison of x and y, implemented according
     240             : // to ES6 section 7.2.11 Abstract Relational Comparison.
     241             : enum class ComparisonResult {
     242             :   kLessThan,     // x < y
     243             :   kEqual,        // x = y
     244             :   kGreaterThan,  // x > y
     245             :   kUndefined     // at least one of x or y was undefined or NaN
     246             : };
     247             : 
     248             : // (Returns false whenever {result} is kUndefined.)
     249             : bool ComparisonResultToBool(Operation op, ComparisonResult result);
     250             : 
     251             : enum class OnNonExistent { kThrowReferenceError, kReturnUndefined };
     252             : 
     253             : class AbstractCode;
     254             : class AccessorPair;
     255             : class AccessCheckInfo;
     256             : class AllocationSite;
     257             : class ByteArray;
     258             : class CachedTemplateObject;
     259             : class Cell;
     260             : class ClosureFeedbackCellArray;
     261             : class ConsString;
     262             : class DependentCode;
     263             : class ElementsAccessor;
     264             : class EnumCache;
     265             : class FixedArrayBase;
     266             : class FixedDoubleArray;
     267             : class FreeSpace;
     268             : class FunctionLiteral;
     269             : class FunctionTemplateInfo;
     270             : class JSAsyncGeneratorObject;
     271             : class JSGlobalProxy;
     272             : class JSPromise;
     273             : class JSProxy;
     274             : class JSProxyRevocableResult;
     275             : class KeyAccumulator;
     276             : class LayoutDescriptor;
     277             : class LookupIterator;
     278             : class FieldType;
     279             : class Module;
     280             : class ModuleInfoEntry;
     281             : class MutableHeapNumber;
     282             : class ObjectHashTable;
     283             : class ObjectTemplateInfo;
     284             : class ObjectVisitor;
     285             : class PreparseData;
     286             : class PropertyArray;
     287             : class PropertyCell;
     288             : class PropertyDescriptor;
     289             : class PrototypeInfo;
     290             : class ReadOnlyRoots;
     291             : class RegExpMatchInfo;
     292             : class RootVisitor;
     293             : class SafepointEntry;
     294             : class ScriptContextTable;
     295             : class SharedFunctionInfo;
     296             : class StringStream;
     297             : class Symbol;
     298             : class FeedbackCell;
     299             : class FeedbackMetadata;
     300             : class FeedbackVector;
     301             : class UncompiledData;
     302             : class TemplateInfo;
     303             : class TransitionArray;
     304             : class TemplateList;
     305             : class WasmInstanceObject;
     306             : class WasmMemoryObject;
     307             : template <typename T>
     308             : class ZoneForwardList;
     309             : 
     310             : #ifdef OBJECT_PRINT
     311             : #define DECL_PRINTER(Name) void Name##Print(std::ostream& os);  // NOLINT
     312             : #else
     313             : #define DECL_PRINTER(Name)
     314             : #endif
     315             : 
     316             : #define OBJECT_TYPE_LIST(V) \
     317             :   V(Smi)                    \
     318             :   V(LayoutDescriptor)       \
     319             :   V(HeapObject)             \
     320             :   V(Primitive)              \
     321             :   V(Number)                 \
     322             :   V(Numeric)
     323             : 
     324             : #define HEAP_OBJECT_ORDINARY_TYPE_LIST_BASE(V) \
     325             :   V(AbstractCode)                              \
     326             :   V(AccessCheckNeeded)                         \
     327             :   V(AllocationSite)                            \
     328             :   V(ArrayList)                                 \
     329             :   V(BigInt)                                    \
     330             :   V(BigIntWrapper)                             \
     331             :   V(ObjectBoilerplateDescription)              \
     332             :   V(Boolean)                                   \
     333             :   V(BooleanWrapper)                            \
     334             :   V(BreakPoint)                                \
     335             :   V(BreakPointInfo)                            \
     336             :   V(ByteArray)                                 \
     337             :   V(BytecodeArray)                             \
     338             :   V(CachedTemplateObject)                      \
     339             :   V(CallHandlerInfo)                           \
     340             :   V(Callable)                                  \
     341             :   V(Cell)                                      \
     342             :   V(ClassBoilerplate)                          \
     343             :   V(Code)                                      \
     344             :   V(CodeDataContainer)                         \
     345             :   V(CompilationCacheTable)                     \
     346             :   V(ConsString)                                \
     347             :   V(Constructor)                               \
     348             :   V(Context)                                   \
     349             :   V(CoverageInfo)                              \
     350             :   V(ClosureFeedbackCellArray)                  \
     351             :   V(DataHandler)                               \
     352             :   V(DeoptimizationData)                        \
     353             :   V(DependentCode)                             \
     354             :   V(DescriptorArray)                           \
     355             :   V(EmbedderDataArray)                         \
     356             :   V(EphemeronHashTable)                        \
     357             :   V(ExternalOneByteString)                     \
     358             :   V(ExternalString)                            \
     359             :   V(ExternalTwoByteString)                     \
     360             :   V(FeedbackCell)                              \
     361             :   V(FeedbackMetadata)                          \
     362             :   V(FeedbackVector)                            \
     363             :   V(Filler)                                    \
     364             :   V(FixedArray)                                \
     365             :   V(FixedArrayBase)                            \
     366             :   V(FixedArrayExact)                           \
     367             :   V(FixedBigInt64Array)                        \
     368             :   V(FixedBigUint64Array)                       \
     369             :   V(FixedDoubleArray)                          \
     370             :   V(FixedFloat32Array)                         \
     371             :   V(FixedFloat64Array)                         \
     372             :   V(FixedInt16Array)                           \
     373             :   V(FixedInt32Array)                           \
     374             :   V(FixedInt8Array)                            \
     375             :   V(FixedTypedArrayBase)                       \
     376             :   V(FixedUint16Array)                          \
     377             :   V(FixedUint32Array)                          \
     378             :   V(FixedUint8Array)                           \
     379             :   V(FixedUint8ClampedArray)                    \
     380             :   V(Foreign)                                   \
     381             :   V(FrameArray)                                \
     382             :   V(FreeSpace)                                 \
     383             :   V(Function)                                  \
     384             :   V(GlobalDictionary)                          \
     385             :   V(HandlerTable)                              \
     386             :   V(HeapNumber)                                \
     387             :   V(InternalizedString)                        \
     388             :   V(JSArgumentsObject)                         \
     389             :   V(JSArgumentsObjectWithLength)               \
     390             :   V(JSArray)                                   \
     391             :   V(JSArrayBuffer)                             \
     392             :   V(JSArrayBufferView)                         \
     393             :   V(JSArrayIterator)                           \
     394             :   V(JSAsyncFromSyncIterator)                   \
     395             :   V(JSAsyncFunctionObject)                     \
     396             :   V(JSAsyncGeneratorObject)                    \
     397             :   V(JSBoundFunction)                           \
     398             :   V(JSCollection)                              \
     399             :   V(JSContextExtensionObject)                  \
     400             :   V(JSDataView)                                \
     401             :   V(JSDate)                                    \
     402             :   V(JSError)                                   \
     403             :   V(JSFunction)                                \
     404             :   V(JSGeneratorObject)                         \
     405             :   V(JSGlobalObject)                            \
     406             :   V(JSGlobalProxy)                             \
     407             :   V(JSMap)                                     \
     408             :   V(JSMapIterator)                             \
     409             :   V(JSMessageObject)                           \
     410             :   V(JSModuleNamespace)                         \
     411             :   V(JSObject)                                  \
     412             :   V(JSPromise)                                 \
     413             :   V(JSProxy)                                   \
     414             :   V(JSReceiver)                                \
     415             :   V(JSRegExp)                                  \
     416             :   V(JSRegExpResult)                            \
     417             :   V(JSRegExpStringIterator)                    \
     418             :   V(JSSet)                                     \
     419             :   V(JSSetIterator)                             \
     420             :   V(JSSloppyArgumentsObject)                   \
     421             :   V(JSStringIterator)                          \
     422             :   V(JSTypedArray)                              \
     423             :   V(JSValue)                                   \
     424             :   V(JSWeakRef)                                 \
     425             :   V(JSWeakCollection)                          \
     426             :   V(JSFinalizationGroup)                       \
     427             :   V(JSFinalizationGroupCleanupIterator)        \
     428             :   V(JSWeakMap)                                 \
     429             :   V(JSWeakSet)                                 \
     430             :   V(LoadHandler)                               \
     431             :   V(Map)                                       \
     432             :   V(MapCache)                                  \
     433             :   V(Microtask)                                 \
     434             :   V(ModuleInfo)                                \
     435             :   V(MutableHeapNumber)                         \
     436             :   V(Name)                                      \
     437             :   V(NameDictionary)                            \
     438             :   V(NativeContext)                             \
     439             :   V(NormalizedMapCache)                        \
     440             :   V(NumberDictionary)                          \
     441             :   V(NumberWrapper)                             \
     442             :   V(ObjectHashSet)                             \
     443             :   V(ObjectHashTable)                           \
     444             :   V(Oddball)                                   \
     445             :   V(OrderedHashMap)                            \
     446             :   V(OrderedHashSet)                            \
     447             :   V(OrderedNameDictionary)                     \
     448             :   V(PreparseData)                              \
     449             :   V(PromiseReactionJobTask)                    \
     450             :   V(PropertyArray)                             \
     451             :   V(PropertyCell)                              \
     452             :   V(PropertyDescriptorObject)                  \
     453             :   V(RegExpMatchInfo)                           \
     454             :   V(ScopeInfo)                                 \
     455             :   V(ScriptContextTable)                        \
     456             :   V(ScriptWrapper)                             \
     457             :   V(SeqOneByteString)                          \
     458             :   V(SeqString)                                 \
     459             :   V(SeqTwoByteString)                          \
     460             :   V(SharedFunctionInfo)                        \
     461             :   V(SimpleNumberDictionary)                    \
     462             :   V(SlicedString)                              \
     463             :   V(SloppyArgumentsElements)                   \
     464             :   V(SmallOrderedHashMap)                       \
     465             :   V(SmallOrderedHashSet)                       \
     466             :   V(SmallOrderedNameDictionary)                \
     467             :   V(SourcePositionTableWithFrameCache)         \
     468             :   V(StoreHandler)                              \
     469             :   V(String)                                    \
     470             :   V(StringSet)                                 \
     471             :   V(StringTable)                               \
     472             :   V(StringWrapper)                             \
     473             :   V(Struct)                                    \
     474             :   V(Symbol)                                    \
     475             :   V(SymbolWrapper)                             \
     476             :   V(TemplateInfo)                              \
     477             :   V(TemplateList)                              \
     478             :   V(TemplateObjectDescription)                 \
     479             :   V(ThinString)                                \
     480             :   V(TransitionArray)                           \
     481             :   V(UncompiledData)                            \
     482             :   V(UncompiledDataWithPreparseData)            \
     483             :   V(UncompiledDataWithoutPreparseData)         \
     484             :   V(Undetectable)                              \
     485             :   V(UniqueName)                                \
     486             :   V(WasmExceptionObject)                       \
     487             :   V(WasmGlobalObject)                          \
     488             :   V(WasmInstanceObject)                        \
     489             :   V(WasmMemoryObject)                          \
     490             :   V(WasmModuleObject)                          \
     491             :   V(WasmTableObject)                           \
     492             :   V(WeakFixedArray)                            \
     493             :   V(WeakArrayList)                             \
     494             :   V(WeakCell)
     495             : 
     496             : #ifdef V8_INTL_SUPPORT
     497             : #define HEAP_OBJECT_ORDINARY_TYPE_LIST(V) \
     498             :   HEAP_OBJECT_ORDINARY_TYPE_LIST_BASE(V)  \
     499             :   V(JSV8BreakIterator)                    \
     500             :   V(JSCollator)                           \
     501             :   V(JSDateTimeFormat)                     \
     502             :   V(JSListFormat)                         \
     503             :   V(JSLocale)                             \
     504             :   V(JSNumberFormat)                       \
     505             :   V(JSPluralRules)                        \
     506             :   V(JSRelativeTimeFormat)                 \
     507             :   V(JSSegmentIterator)                    \
     508             :   V(JSSegmenter)
     509             : #else
     510             : #define HEAP_OBJECT_ORDINARY_TYPE_LIST(V) HEAP_OBJECT_ORDINARY_TYPE_LIST_BASE(V)
     511             : #endif  // V8_INTL_SUPPORT
     512             : 
     513             : #define HEAP_OBJECT_TEMPLATE_TYPE_LIST(V) \
     514             :   V(Dictionary)                           \
     515             :   V(HashTable)
     516             : 
     517             : #define HEAP_OBJECT_TYPE_LIST(V)    \
     518             :   HEAP_OBJECT_ORDINARY_TYPE_LIST(V) \
     519             :   HEAP_OBJECT_TEMPLATE_TYPE_LIST(V)
     520             : 
     521             : #define ODDBALL_LIST(V)                 \
     522             :   V(Undefined, undefined_value)         \
     523             :   V(Null, null_value)                   \
     524             :   V(TheHole, the_hole_value)            \
     525             :   V(Exception, exception)               \
     526             :   V(Uninitialized, uninitialized_value) \
     527             :   V(True, true_value)                   \
     528             :   V(False, false_value)                 \
     529             :   V(ArgumentsMarker, arguments_marker)  \
     530             :   V(OptimizedOut, optimized_out)        \
     531             :   V(StaleRegister, stale_register)
     532             : 
     533             : // The element types selection for CreateListFromArrayLike.
     534             : enum class ElementTypes { kAll, kStringAndSymbol };
     535             : 
     536             : // TODO(mythria): Move this to a better place.
     537             : ShouldThrow GetShouldThrow(Isolate* isolate, Maybe<ShouldThrow> should_throw);
     538             : 
     539             : // Object is the abstract superclass for all classes in the
     540             : // object hierarchy.
     541             : // Object does not use any virtual functions to avoid the
     542             : // allocation of the C++ vtable.
     543             : // There must only be a single data member in Object: the Address ptr,
     544             : // containing the tagged heap pointer that this Object instance refers to.
     545             : // For a design overview, see https://goo.gl/Ph4CGz.
     546             : class Object {
     547             :  public:
     548   533160971 :   constexpr Object() : ptr_(kNullAddress) {}
     549   447191985 :   explicit constexpr Object(Address ptr) : ptr_(ptr) {}
     550             : 
     551             :   // Make clang on Linux catch what MSVC complains about on Windows:
     552             :   operator bool() const = delete;
     553             : 
     554    82141055 :   bool operator==(const Object that) const { return this->ptr() == that.ptr(); }
     555    29390407 :   bool operator!=(const Object that) const { return this->ptr() != that.ptr(); }
     556             :   // Usage in std::set requires operator<.
     557     3381219 :   bool operator<(const Object that) const { return this->ptr() < that.ptr(); }
     558             : 
     559             :   // Returns the tagged "(heap) object pointer" representation of this object.
     560 57938761471 :   constexpr Address ptr() const { return ptr_; }
     561             : 
     562             :   // These operator->() overloads are required for handlified code.
     563             :   Object* operator->() { return this; }
     564             :   const Object* operator->() const { return this; }
     565             : 
     566             :   // Type testing.
     567             :   bool IsObject() const { return true; }
     568             : 
     569             : #define IS_TYPE_FUNCTION_DECL(Type) V8_INLINE bool Is##Type() const;
     570             :   OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DECL)
     571             :   HEAP_OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DECL)
     572             : #undef IS_TYPE_FUNCTION_DECL
     573             : 
     574             : // Oddball checks are faster when they are raw pointer comparisons, so the
     575             : // isolate/read-only roots overloads should be preferred where possible.
     576             : #define IS_TYPE_FUNCTION_DECL(Type, Value)            \
     577             :   V8_INLINE bool Is##Type(Isolate* isolate) const;    \
     578             :   V8_INLINE bool Is##Type(ReadOnlyRoots roots) const; \
     579             :   V8_INLINE bool Is##Type() const;
     580             :   ODDBALL_LIST(IS_TYPE_FUNCTION_DECL)
     581             : #undef IS_TYPE_FUNCTION_DECL
     582             : 
     583             :   V8_INLINE bool IsNullOrUndefined(Isolate* isolate) const;
     584             :   V8_INLINE bool IsNullOrUndefined(ReadOnlyRoots roots) const;
     585             :   V8_INLINE bool IsNullOrUndefined() const;
     586             : 
     587             :   enum class Conversion { kToNumber, kToNumeric };
     588             : 
     589             : #define RETURN_FAILURE(isolate, should_throw, call) \
     590             :   do {                                              \
     591             :     if ((should_throw) == kDontThrow) {             \
     592             :       return Just(false);                           \
     593             :     } else {                                        \
     594             :       isolate->Throw(*isolate->factory()->call);    \
     595             :       return Nothing<bool>();                       \
     596             :     }                                               \
     597             :   } while (false)
     598             : 
     599             : #define MAYBE_RETURN(call, value)         \
     600             :   do {                                    \
     601             :     if ((call).IsNothing()) return value; \
     602             :   } while (false)
     603             : 
     604             : #define MAYBE_RETURN_NULL(call) MAYBE_RETURN(call, MaybeHandle<Object>())
     605             : 
     606             : #define MAYBE_ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, dst, call) \
     607             :   do {                                                               \
     608             :     Isolate* __isolate__ = (isolate);                                \
     609             :     if (!(call).To(&dst)) {                                          \
     610             :       DCHECK(__isolate__->has_pending_exception());                  \
     611             :       return ReadOnlyRoots(__isolate__).exception();                 \
     612             :     }                                                                \
     613             :   } while (false)
     614             : 
     615             : #define DECL_STRUCT_PREDICATE(NAME, Name, name) V8_INLINE bool Is##Name() const;
     616             :   STRUCT_LIST(DECL_STRUCT_PREDICATE)
     617             : #undef DECL_STRUCT_PREDICATE
     618             : 
     619             :   // ES6, #sec-isarray.  NOT to be confused with %_IsArray.
     620             :   V8_INLINE
     621             :   V8_WARN_UNUSED_RESULT static Maybe<bool> IsArray(Handle<Object> object);
     622             : 
     623             :   V8_INLINE bool IsHashTableBase() const;
     624             :   V8_INLINE bool IsSmallOrderedHashTable() const;
     625             : 
     626             :   // Extract the number.
     627             :   inline double Number() const;
     628             :   V8_INLINE bool IsNaN() const;
     629             :   V8_INLINE bool IsMinusZero() const;
     630             :   V8_EXPORT_PRIVATE bool ToInt32(int32_t* value);
     631             :   inline bool ToUint32(uint32_t* value) const;
     632             : 
     633             :   inline Representation OptimalRepresentation();
     634             : 
     635             :   inline ElementsKind OptimalElementsKind();
     636             : 
     637             :   inline bool FitsRepresentation(Representation representation);
     638             : 
     639             :   inline bool FilterKey(PropertyFilter filter);
     640             : 
     641             :   Handle<FieldType> OptimalType(Isolate* isolate,
     642             :                                 Representation representation);
     643             : 
     644             :   V8_EXPORT_PRIVATE static Handle<Object> NewStorageFor(
     645             :       Isolate* isolate, Handle<Object> object, Representation representation);
     646             : 
     647             :   static Handle<Object> WrapForRead(Isolate* isolate, Handle<Object> object,
     648             :                                     Representation representation);
     649             : 
     650             :   // Returns true if the object is of the correct type to be used as a
     651             :   // implementation of a JSObject's elements.
     652             :   inline bool HasValidElements();
     653             : 
     654             :   // ECMA-262 9.2.
     655             :   V8_EXPORT_PRIVATE bool BooleanValue(Isolate* isolate);
     656             :   Object ToBoolean(Isolate* isolate);
     657             : 
     658             :   // ES6 section 7.2.11 Abstract Relational Comparison
     659             :   V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT static Maybe<ComparisonResult>
     660             :   Compare(Isolate* isolate, Handle<Object> x, Handle<Object> y);
     661             : 
     662             :   // ES6 section 7.2.12 Abstract Equality Comparison
     663             :   V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT static Maybe<bool> Equals(
     664             :       Isolate* isolate, Handle<Object> x, Handle<Object> y);
     665             : 
     666             :   // ES6 section 7.2.13 Strict Equality Comparison
     667             :   V8_EXPORT_PRIVATE bool StrictEquals(Object that);
     668             : 
     669             :   // ES6 section 7.1.13 ToObject
     670             :   // Convert to a JSObject if needed.
     671             :   // native_context is used when creating wrapper object.
     672             :   //
     673             :   // Passing a non-null method_name allows us to give a more informative
     674             :   // error message for those cases where ToObject is being called on
     675             :   // the receiver of a built-in method.
     676             :   V8_WARN_UNUSED_RESULT static inline MaybeHandle<JSReceiver> ToObject(
     677             :       Isolate* isolate, Handle<Object> object,
     678             :       const char* method_name = nullptr);
     679             :   V8_WARN_UNUSED_RESULT static MaybeHandle<JSReceiver> ToObjectImpl(
     680             :       Isolate* isolate, Handle<Object> object,
     681             :       const char* method_name = nullptr);
     682             : 
     683             :   // ES6 section 9.2.1.2, OrdinaryCallBindThis for sloppy callee.
     684             :   V8_WARN_UNUSED_RESULT static MaybeHandle<JSReceiver> ConvertReceiver(
     685             :       Isolate* isolate, Handle<Object> object);
     686             : 
     687             :   // ES6 section 7.1.14 ToPropertyKey
     688             :   V8_WARN_UNUSED_RESULT static inline MaybeHandle<Name> ToName(
     689             :       Isolate* isolate, Handle<Object> input);
     690             : 
     691             :   // ES6 section 7.1.1 ToPrimitive
     692             :   V8_WARN_UNUSED_RESULT static inline MaybeHandle<Object> ToPrimitive(
     693             :       Handle<Object> input, ToPrimitiveHint hint = ToPrimitiveHint::kDefault);
     694             : 
     695             :   // ES6 section 7.1.3 ToNumber
     696             :   V8_WARN_UNUSED_RESULT static inline MaybeHandle<Object> ToNumber(
     697             :       Isolate* isolate, Handle<Object> input);
     698             : 
     699             :   V8_WARN_UNUSED_RESULT static inline MaybeHandle<Object> ToNumeric(
     700             :       Isolate* isolate, Handle<Object> input);
     701             : 
     702             :   // ES6 section 7.1.4 ToInteger
     703             :   V8_WARN_UNUSED_RESULT static inline MaybeHandle<Object> ToInteger(
     704             :       Isolate* isolate, Handle<Object> input);
     705             : 
     706             :   // ES6 section 7.1.5 ToInt32
     707             :   V8_WARN_UNUSED_RESULT static inline MaybeHandle<Object> ToInt32(
     708             :       Isolate* isolate, Handle<Object> input);
     709             : 
     710             :   // ES6 section 7.1.6 ToUint32
     711             :   V8_WARN_UNUSED_RESULT inline static MaybeHandle<Object> ToUint32(
     712             :       Isolate* isolate, Handle<Object> input);
     713             : 
     714             :   // ES6 section 7.1.12 ToString
     715             :   V8_WARN_UNUSED_RESULT static inline MaybeHandle<String> ToString(
     716             :       Isolate* isolate, Handle<Object> input);
     717             : 
     718             :   V8_EXPORT_PRIVATE static Handle<String> NoSideEffectsToString(
     719             :       Isolate* isolate, Handle<Object> input);
     720             : 
     721             :   // ES6 section 7.1.14 ToPropertyKey
     722             :   V8_WARN_UNUSED_RESULT static inline MaybeHandle<Object> ToPropertyKey(
     723             :       Isolate* isolate, Handle<Object> value);
     724             : 
     725             :   // ES6 section 7.1.15 ToLength
     726             :   V8_WARN_UNUSED_RESULT static inline MaybeHandle<Object> ToLength(
     727             :       Isolate* isolate, Handle<Object> input);
     728             : 
     729             :   // ES6 section 7.1.17 ToIndex
     730             :   V8_WARN_UNUSED_RESULT static inline MaybeHandle<Object> ToIndex(
     731             :       Isolate* isolate, Handle<Object> input, MessageTemplate error_index);
     732             : 
     733             :   // ES6 section 7.3.9 GetMethod
     734             :   V8_WARN_UNUSED_RESULT static MaybeHandle<Object> GetMethod(
     735             :       Handle<JSReceiver> receiver, Handle<Name> name);
     736             : 
     737             :   // ES6 section 7.3.17 CreateListFromArrayLike
     738             :   V8_WARN_UNUSED_RESULT static MaybeHandle<FixedArray> CreateListFromArrayLike(
     739             :       Isolate* isolate, Handle<Object> object, ElementTypes element_types);
     740             : 
     741             :   // Get length property and apply ToLength.
     742             :   V8_WARN_UNUSED_RESULT static MaybeHandle<Object> GetLengthFromArrayLike(
     743             :       Isolate* isolate, Handle<JSReceiver> object);
     744             : 
     745             :   // ES6 section 12.5.6 The typeof Operator
     746             :   static Handle<String> TypeOf(Isolate* isolate, Handle<Object> object);
     747             : 
     748             :   // ES6 section 12.7 Additive Operators
     749             :   V8_WARN_UNUSED_RESULT static MaybeHandle<Object> Add(Isolate* isolate,
     750             :                                                        Handle<Object> lhs,
     751             :                                                        Handle<Object> rhs);
     752             : 
     753             :   // ES6 section 12.9 Relational Operators
     754             :   V8_WARN_UNUSED_RESULT static inline Maybe<bool> GreaterThan(Isolate* isolate,
     755             :                                                               Handle<Object> x,
     756             :                                                               Handle<Object> y);
     757             :   V8_WARN_UNUSED_RESULT static inline Maybe<bool> GreaterThanOrEqual(
     758             :       Isolate* isolate, Handle<Object> x, Handle<Object> y);
     759             :   V8_WARN_UNUSED_RESULT static inline Maybe<bool> LessThan(Isolate* isolate,
     760             :                                                            Handle<Object> x,
     761             :                                                            Handle<Object> y);
     762             :   V8_WARN_UNUSED_RESULT static inline Maybe<bool> LessThanOrEqual(
     763             :       Isolate* isolate, Handle<Object> x, Handle<Object> y);
     764             : 
     765             :   // ES6 section 7.3.19 OrdinaryHasInstance (C, O).
     766             :   V8_WARN_UNUSED_RESULT static MaybeHandle<Object> OrdinaryHasInstance(
     767             :       Isolate* isolate, Handle<Object> callable, Handle<Object> object);
     768             : 
     769             :   // ES6 section 12.10.4 Runtime Semantics: InstanceofOperator(O, C)
     770             :   V8_WARN_UNUSED_RESULT static MaybeHandle<Object> InstanceOf(
     771             :       Isolate* isolate, Handle<Object> object, Handle<Object> callable);
     772             : 
     773             :   V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT static MaybeHandle<Object>
     774             :   GetProperty(LookupIterator* it,
     775             :               OnNonExistent on_non_existent = OnNonExistent::kReturnUndefined);
     776             : 
     777             :   // ES6 [[Set]] (when passed kDontThrow)
     778             :   // Invariants for this and related functions (unless stated otherwise):
     779             :   // 1) When the result is Nothing, an exception is pending.
     780             :   // 2) When passed kThrowOnError, the result is never Just(false).
     781             :   // In some cases, an exception is thrown regardless of the ShouldThrow
     782             :   // argument.  These cases are either in accordance with the spec or not
     783             :   // covered by it (eg., concerning API callbacks).
     784             :   V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT static Maybe<bool> SetProperty(
     785             :       LookupIterator* it, Handle<Object> value, StoreOrigin store_origin,
     786             :       Maybe<ShouldThrow> should_throw = Nothing<ShouldThrow>());
     787             :   V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT static MaybeHandle<Object>
     788             :   SetProperty(Isolate* isolate, Handle<Object> object, Handle<Name> name,
     789             :               Handle<Object> value,
     790             :               StoreOrigin store_origin = StoreOrigin::kMaybeKeyed,
     791             :               Maybe<ShouldThrow> should_throw = Nothing<ShouldThrow>());
     792             :   V8_WARN_UNUSED_RESULT static inline MaybeHandle<Object> SetPropertyOrElement(
     793             :       Isolate* isolate, Handle<Object> object, Handle<Name> name,
     794             :       Handle<Object> value,
     795             :       Maybe<ShouldThrow> should_throw = Nothing<ShouldThrow>(),
     796             :       StoreOrigin store_origin = StoreOrigin::kMaybeKeyed);
     797             : 
     798             :   V8_WARN_UNUSED_RESULT static Maybe<bool> SetSuperProperty(
     799             :       LookupIterator* it, Handle<Object> value, StoreOrigin store_origin,
     800             :       Maybe<ShouldThrow> should_throw = Nothing<ShouldThrow>());
     801             : 
     802             :   V8_WARN_UNUSED_RESULT static Maybe<bool> CannotCreateProperty(
     803             :       Isolate* isolate, Handle<Object> receiver, Handle<Object> name,
     804             :       Handle<Object> value, Maybe<ShouldThrow> should_throw);
     805             :   V8_WARN_UNUSED_RESULT static Maybe<bool> WriteToReadOnlyProperty(
     806             :       LookupIterator* it, Handle<Object> value,
     807             :       Maybe<ShouldThrow> should_throw);
     808             :   V8_WARN_UNUSED_RESULT static Maybe<bool> WriteToReadOnlyProperty(
     809             :       Isolate* isolate, Handle<Object> receiver, Handle<Object> name,
     810             :       Handle<Object> value, ShouldThrow should_throw);
     811             :   V8_WARN_UNUSED_RESULT static Maybe<bool> RedefineIncompatibleProperty(
     812             :       Isolate* isolate, Handle<Object> name, Handle<Object> value,
     813             :       Maybe<ShouldThrow> should_throw);
     814             :   V8_WARN_UNUSED_RESULT static Maybe<bool> SetDataProperty(
     815             :       LookupIterator* it, Handle<Object> value);
     816             :   V8_WARN_UNUSED_RESULT static Maybe<bool> AddDataProperty(
     817             :       LookupIterator* it, Handle<Object> value, PropertyAttributes attributes,
     818             :       Maybe<ShouldThrow> should_throw, StoreOrigin store_origin);
     819             :   V8_WARN_UNUSED_RESULT static inline MaybeHandle<Object> GetPropertyOrElement(
     820             :       Isolate* isolate, Handle<Object> object, Handle<Name> name);
     821             :   V8_WARN_UNUSED_RESULT static inline MaybeHandle<Object> GetPropertyOrElement(
     822             :       Handle<Object> receiver, Handle<Name> name, Handle<JSReceiver> holder);
     823             :   V8_WARN_UNUSED_RESULT static inline MaybeHandle<Object> GetProperty(
     824             :       Isolate* isolate, Handle<Object> object, Handle<Name> name);
     825             : 
     826             :   V8_WARN_UNUSED_RESULT static MaybeHandle<Object> GetPropertyWithAccessor(
     827             :       LookupIterator* it);
     828             :   V8_WARN_UNUSED_RESULT static Maybe<bool> SetPropertyWithAccessor(
     829             :       LookupIterator* it, Handle<Object> value,
     830             :       Maybe<ShouldThrow> should_throw);
     831             : 
     832             :   V8_WARN_UNUSED_RESULT static MaybeHandle<Object> GetPropertyWithDefinedGetter(
     833             :       Handle<Object> receiver, Handle<JSReceiver> getter);
     834             :   V8_WARN_UNUSED_RESULT static Maybe<bool> SetPropertyWithDefinedSetter(
     835             :       Handle<Object> receiver, Handle<JSReceiver> setter, Handle<Object> value,
     836             :       Maybe<ShouldThrow> should_throw);
     837             : 
     838             :   V8_WARN_UNUSED_RESULT static inline MaybeHandle<Object> GetElement(
     839             :       Isolate* isolate, Handle<Object> object, uint32_t index);
     840             : 
     841             :   V8_WARN_UNUSED_RESULT static inline MaybeHandle<Object> SetElement(
     842             :       Isolate* isolate, Handle<Object> object, uint32_t index,
     843             :       Handle<Object> value, ShouldThrow should_throw);
     844             : 
     845             :   // Returns the permanent hash code associated with this object. May return
     846             :   // undefined if not yet created.
     847             :   inline Object GetHash();
     848             : 
     849             :   // Returns the permanent hash code associated with this object depending on
     850             :   // the actual object type. May create and store a hash code if needed and none
     851             :   // exists.
     852             :   V8_EXPORT_PRIVATE Smi GetOrCreateHash(Isolate* isolate);
     853             : 
     854             :   // Checks whether this object has the same value as the given one.  This
     855             :   // function is implemented according to ES5, section 9.12 and can be used
     856             :   // to implement the Object.is function.
     857             :   V8_EXPORT_PRIVATE bool SameValue(Object other);
     858             : 
     859             :   // A part of SameValue which handles Number vs. Number case.
     860             :   // Treats NaN == NaN and +0 != -0.
     861             :   inline static bool SameNumberValue(double number1, double number2);
     862             : 
     863             :   // Checks whether this object has the same value as the given one.
     864             :   // +0 and -0 are treated equal. Everything else is the same as SameValue.
     865             :   // This function is implemented according to ES6, section 7.2.4 and is used
     866             :   // by ES6 Map and Set.
     867             :   bool SameValueZero(Object other);
     868             : 
     869             :   // ES6 section 9.4.2.3 ArraySpeciesCreate (part of it)
     870             :   V8_WARN_UNUSED_RESULT static MaybeHandle<Object> ArraySpeciesConstructor(
     871             :       Isolate* isolate, Handle<Object> original_array);
     872             : 
     873             :   // ES6 section 7.3.20 SpeciesConstructor ( O, defaultConstructor )
     874             :   V8_WARN_UNUSED_RESULT static MaybeHandle<Object> SpeciesConstructor(
     875             :       Isolate* isolate, Handle<JSReceiver> recv,
     876             :       Handle<JSFunction> default_ctor);
     877             : 
     878             :   // Tries to convert an object to an array length. Returns true and sets the
     879             :   // output parameter if it succeeds.
     880             :   inline bool ToArrayLength(uint32_t* index) const;
     881             : 
     882             :   // Tries to convert an object to an array index. Returns true and sets the
     883             :   // output parameter if it succeeds. Equivalent to ToArrayLength, but does not
     884             :   // allow kMaxUInt32.
     885             :   V8_WARN_UNUSED_RESULT inline bool ToArrayIndex(uint32_t* index) const;
     886             : 
     887             :   // Returns true if the result of iterating over the object is the same
     888             :   // (including observable effects) as simply accessing the properties between 0
     889             :   // and length.
     890             :   bool IterationHasObservableEffects();
     891             : 
     892             :   //
     893             :   // The following GetHeapObjectXX methods mimic corresponding functionality
     894             :   // in MaybeObject. Having them here allows us to unify code that processes
     895             :   // ObjectSlots and MaybeObjectSlots.
     896             :   //
     897             : 
     898             :   // If this Object is a strong pointer to a HeapObject, returns true and
     899             :   // sets *result. Otherwise returns false.
     900             :   inline bool GetHeapObjectIfStrong(HeapObject* result) const;
     901             : 
     902             :   // If this Object is a strong pointer to a HeapObject (weak pointers are not
     903             :   // expected), returns true and sets *result. Otherwise returns false.
     904             :   inline bool GetHeapObject(HeapObject* result) const;
     905             : 
     906             :   // DCHECKs that this Object is a strong pointer to a HeapObject and returns
     907             :   // the HeapObject.
     908             :   inline HeapObject GetHeapObject() const;
     909             : 
     910             :   // Always returns false because Object is not expected to be a weak pointer
     911             :   // to a HeapObject.
     912             :   inline bool GetHeapObjectIfWeak(HeapObject* result) const {
     913             :     DCHECK(!HasWeakHeapObjectTag(ptr()));
     914             :     return false;
     915             :   }
     916             :   // Always returns false because Object is not expected to be a weak pointer
     917             :   // to a HeapObject.
     918             :   inline bool IsCleared() const { return false; }
     919             : 
     920             :   EXPORT_DECL_VERIFIER(Object)
     921             : 
     922             : #ifdef VERIFY_HEAP
     923             :   // Verify a pointer is a valid object pointer.
     924             :   static void VerifyPointer(Isolate* isolate, Object p);
     925             : #endif
     926             : 
     927             :   inline void VerifyApiCallResultType();
     928             : 
     929             :   // Prints this object without details.
     930             :   V8_EXPORT_PRIVATE void ShortPrint(FILE* out = stdout) const;
     931             : 
     932             :   // Prints this object without details to a message accumulator.
     933             :   V8_EXPORT_PRIVATE void ShortPrint(StringStream* accumulator) const;
     934             : 
     935             :   V8_EXPORT_PRIVATE void ShortPrint(std::ostream& os) const;  // NOLINT
     936             : 
     937             :   inline static Object cast(Object object) { return object; }
     938             :   inline static Object unchecked_cast(Object object) { return object; }
     939             : 
     940             :   // Layout description.
     941             :   static const int kHeaderSize = 0;  // Object does not take up any space.
     942             : 
     943             : #ifdef OBJECT_PRINT
     944             :   // For our gdb macros, we should perhaps change these in the future.
     945             :   V8_EXPORT_PRIVATE void Print() const;
     946             : 
     947             :   // Prints this object with details.
     948             :   V8_EXPORT_PRIVATE void Print(std::ostream& os) const;  // NOLINT
     949             : #else
     950          24 :   void Print() const { ShortPrint(); }
     951           0 :   void Print(std::ostream& os) const { ShortPrint(os); }  // NOLINT
     952             : #endif
     953             : 
     954             :   // For use with std::unordered_set.
     955             :   struct Hasher {
     956             :     size_t operator()(const Object o) const {
     957             :       return std::hash<v8::internal::Address>{}(o.ptr());
     958             :     }
     959             :   };
     960             : 
     961             :   // For use with std::map.
     962             :   struct Comparer {
     963             :     bool operator()(const Object a, const Object b) const {
     964           0 :       return a.ptr() < b.ptr();
     965             :     }
     966             :   };
     967             : 
     968             :  private:
     969             :   friend class CompressedObjectSlot;
     970             :   friend class FullObjectSlot;
     971             :   friend class LookupIterator;
     972             :   friend class StringStream;
     973             : 
     974             :   // Return the map of the root of object's prototype chain.
     975             :   Map GetPrototypeChainRootMap(Isolate* isolate) const;
     976             : 
     977             :   // Returns a non-SMI for JSReceivers, but returns the hash code for
     978             :   // simple objects.  This avoids a double lookup in the cases where
     979             :   // we know we will add the hash to the JSReceiver if it does not
     980             :   // already exist.
     981             :   //
     982             :   // Despite its size, this needs to be inlined for performance
     983             :   // reasons.
     984             :   static inline Object GetSimpleHash(Object object);
     985             : 
     986             :   // Helper for SetProperty and SetSuperProperty.
     987             :   // Return value is only meaningful if [found] is set to true on return.
     988             :   V8_WARN_UNUSED_RESULT static Maybe<bool> SetPropertyInternal(
     989             :       LookupIterator* it, Handle<Object> value, Maybe<ShouldThrow> should_throw,
     990             :       StoreOrigin store_origin, bool* found);
     991             : 
     992             :   V8_WARN_UNUSED_RESULT static MaybeHandle<Name> ConvertToName(
     993             :       Isolate* isolate, Handle<Object> input);
     994             :   V8_WARN_UNUSED_RESULT static MaybeHandle<Object> ConvertToPropertyKey(
     995             :       Isolate* isolate, Handle<Object> value);
     996             :   V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT static MaybeHandle<String>
     997             :   ConvertToString(Isolate* isolate, Handle<Object> input);
     998             :   V8_WARN_UNUSED_RESULT static MaybeHandle<Object> ConvertToNumberOrNumeric(
     999             :       Isolate* isolate, Handle<Object> input, Conversion mode);
    1000             :   V8_WARN_UNUSED_RESULT static MaybeHandle<Object> ConvertToInteger(
    1001             :       Isolate* isolate, Handle<Object> input);
    1002             :   V8_WARN_UNUSED_RESULT static MaybeHandle<Object> ConvertToInt32(
    1003             :       Isolate* isolate, Handle<Object> input);
    1004             :   V8_WARN_UNUSED_RESULT static MaybeHandle<Object> ConvertToUint32(
    1005             :       Isolate* isolate, Handle<Object> input);
    1006             :   V8_WARN_UNUSED_RESULT static MaybeHandle<Object> ConvertToLength(
    1007             :       Isolate* isolate, Handle<Object> input);
    1008             :   V8_WARN_UNUSED_RESULT static MaybeHandle<Object> ConvertToIndex(
    1009             :       Isolate* isolate, Handle<Object> input, MessageTemplate error_index);
    1010             : 
    1011             :   Address ptr_;
    1012             : };
    1013             : 
    1014             : V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, const Object& obj);
    1015             : 
    1016             : // In objects.h to be usable without objects-inl.h inclusion.
    1017 20965837754 : bool Object::IsSmi() const { return HAS_SMI_TAG(ptr()); }
    1018             : bool Object::IsHeapObject() const {
    1019             :   DCHECK_EQ(!IsSmi(), Internals::HasHeapObjectTag(ptr()));
    1020    31074069 :   return !IsSmi();
    1021             : }
    1022             : 
    1023             : struct Brief {
    1024             :   V8_EXPORT_PRIVATE explicit Brief(const Object v);
    1025             :   explicit Brief(const MaybeObject v);
    1026             :   // {value} is a tagged heap object reference (weak or strong), equivalent to
    1027             :   // a MaybeObject's payload. It has a plain Address type to keep #includes
    1028             :   // lightweight.
    1029             :   const Address value;
    1030             : };
    1031             : 
    1032             : V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, const Brief& v);
    1033             : 
    1034             : // Objects should never have the weak tag; this variant is for overzealous
    1035             : // checking.
    1036             : V8_INLINE static bool HasWeakHeapObjectTag(const Object value) {
    1037             :   return ((value->ptr() & kHeapObjectTagMask) == kWeakHeapObjectTag);
    1038             : }
    1039             : 
    1040             : // Heap objects typically have a map pointer in their first word.  However,
    1041             : // during GC other data (e.g. mark bits, forwarding addresses) is sometimes
    1042             : // encoded in the first word.  The class MapWord is an abstraction of the
    1043             : // value in a heap object's first word.
    1044             : class MapWord {
    1045             :  public:
    1046             :   // Normal state: the map word contains a map pointer.
    1047             : 
    1048             :   // Create a map word from a map pointer.
    1049             :   static inline MapWord FromMap(const Map map);
    1050             : 
    1051             :   // View this map word as a map pointer.
    1052             :   inline Map ToMap() const;
    1053             : 
    1054             :   // Scavenge collection: the map word of live objects in the from space
    1055             :   // contains a forwarding address (a heap object pointer in the to space).
    1056             : 
    1057             :   // True if this map word is a forwarding address for a scavenge
    1058             :   // collection.  Only valid during a scavenge collection (specifically,
    1059             :   // when all map words are heap object pointers, i.e. not during a full GC).
    1060             :   inline bool IsForwardingAddress() const;
    1061             : 
    1062             :   // Create a map word from a forwarding address.
    1063             :   static inline MapWord FromForwardingAddress(HeapObject object);
    1064             : 
    1065             :   // View this map word as a forwarding address.
    1066             :   inline HeapObject ToForwardingAddress();
    1067             : 
    1068             :   static inline MapWord FromRawValue(uintptr_t value) {
    1069             :     return MapWord(value);
    1070             :   }
    1071             : 
    1072             :   inline uintptr_t ToRawValue() {
    1073             :     return value_;
    1074             :   }
    1075             : 
    1076             :  private:
    1077             :   // HeapObject calls the private constructor and directly reads the value.
    1078             :   friend class HeapObject;
    1079             : 
    1080             :   explicit MapWord(Address value) : value_(value) {}
    1081             : 
    1082             :   Address value_;
    1083             : };
    1084             : 
    1085             : template <int start_offset, int end_offset, int size>
    1086             : class FixedBodyDescriptor;
    1087             : 
    1088             : template <int start_offset>
    1089             : class FlexibleBodyDescriptor;
    1090             : 
    1091             : template <int start_offset>
    1092             : class FlexibleWeakBodyDescriptor;
    1093             : 
    1094             : template <class ParentBodyDescriptor, class ChildBodyDescriptor>
    1095             : class SubclassBodyDescriptor;
    1096             : 
    1097             : enum EnsureElementsMode {
    1098             :   DONT_ALLOW_DOUBLE_ELEMENTS,
    1099             :   ALLOW_COPIED_DOUBLE_ELEMENTS,
    1100             :   ALLOW_CONVERTED_DOUBLE_ELEMENTS
    1101             : };
    1102             : 
    1103             : 
    1104             : // Indicator for one component of an AccessorPair.
    1105             : enum AccessorComponent {
    1106             :   ACCESSOR_GETTER,
    1107             :   ACCESSOR_SETTER
    1108             : };
    1109             : 
    1110             : enum class GetKeysConversion {
    1111             :   kKeepNumbers = static_cast<int>(v8::KeyConversionMode::kKeepNumbers),
    1112             :   kConvertToString = static_cast<int>(v8::KeyConversionMode::kConvertToString)
    1113             : };
    1114             : 
    1115             : enum class KeyCollectionMode {
    1116             :   kOwnOnly = static_cast<int>(v8::KeyCollectionMode::kOwnOnly),
    1117             :   kIncludePrototypes =
    1118             :       static_cast<int>(v8::KeyCollectionMode::kIncludePrototypes)
    1119             : };
    1120             : 
    1121             : // Utility superclass for stack-allocated objects that must be updated
    1122             : // on gc.  It provides two ways for the gc to update instances, either
    1123             : // iterating or updating after gc.
    1124             : class Relocatable {
    1125             :  public:
    1126             :   explicit inline Relocatable(Isolate* isolate);
    1127             :   inline virtual ~Relocatable();
    1128         415 :   virtual void IterateInstance(RootVisitor* v) {}
    1129       25794 :   virtual void PostGarbageCollection() { }
    1130             : 
    1131             :   static void PostGarbageCollectionProcessing(Isolate* isolate);
    1132             :   static int ArchiveSpacePerThread();
    1133             :   static char* ArchiveState(Isolate* isolate, char* to);
    1134             :   static char* RestoreState(Isolate* isolate, char* from);
    1135             :   static void Iterate(Isolate* isolate, RootVisitor* v);
    1136             :   static void Iterate(RootVisitor* v, Relocatable* top);
    1137             :   static char* Iterate(RootVisitor* v, char* t);
    1138             : 
    1139             :  private:
    1140             :   Isolate* isolate_;
    1141             :   Relocatable* prev_;
    1142             : };
    1143             : 
    1144             : // BooleanBit is a helper class for setting and getting a bit in an integer.
    1145             : class BooleanBit : public AllStatic {
    1146             :  public:
    1147             :   static inline bool get(int value, int bit_position) {
    1148    65031132 :     return (value & (1 << bit_position)) != 0;
    1149             :   }
    1150             : 
    1151             :   static inline int set(int value, int bit_position, bool v) {
    1152    17218049 :     if (v) {
    1153     8012892 :       value |= (1 << bit_position);
    1154             :     } else {
    1155    11179692 :       value &= ~(1 << bit_position);
    1156             :     }
    1157             :     return value;
    1158             :   }
    1159             : };
    1160             : 
    1161             : 
    1162             : }  // NOLINT, false-positive due to second-order macros.
    1163             : }  // NOLINT, false-positive due to second-order macros.
    1164             : 
    1165             : #include "src/objects/object-macros-undef.h"
    1166             : 
    1167             : #endif  // V8_OBJECTS_H_

Generated by: LCOV version 1.10