}
-#define CAST_ACCESSOR(type) \
- type* type::cast(Object* object) { \
- SLOW_ASSERT(object->Is##type()); \
- return reinterpret_cast<type*>(object); \
+// TODO(svenpanne) We use const_cast here and at a few other places to break our
+// dependency cycle between the cast methods and the predicates. This can be
+// removed when the predicates are const-correct, too.
+#define CAST_ACCESSOR(type) \
+ type* type::cast(Object* object) { \
+ SLOW_ASSERT(object->Is##type()); \
+ return reinterpret_cast<type*>(object); \
+ } \
+ const type* type::cast(const Object* object) { \
+ SLOW_ASSERT(const_cast<Object*>(object)->Is##type()); \
+ return reinterpret_cast<const type*>(object); \
}
}
+bool Object::IsWeakHashTable() {
+ return IsHashTable();
+}
+
+
bool Object::IsDictionary() {
return IsHashTable() &&
this != HeapObject::cast(this)->GetHeap()->string_table();
}
+bool Object::IsNameDictionary() {
+ return IsDictionary();
+}
+
+
+bool Object::IsSeededNumberDictionary() {
+ return IsDictionary();
+}
+
+
+bool Object::IsUnseededNumberDictionary() {
+ return IsDictionary();
+}
+
+
bool Object::IsStringTable() {
return IsHashTable();
}
}
+bool Object::IsOrderedHashSet() {
+ return IsOrderedHashTable();
+}
+
+
+bool Object::IsOrderedHashMap() {
+ return IsOrderedHashTable();
+}
+
+
bool Object::IsPrimitive() {
return IsOddball() || IsNumber() || IsString();
}
}
-FixedArrayBase* FixedArrayBase::cast(Object* object) {
- ASSERT(object->IsFixedArrayBase());
- return reinterpret_cast<FixedArrayBase*>(object);
-}
-
-
Object* FixedArray::get(int index) {
SLOW_ASSERT(index >= 0 && index < this->length());
return READ_FIELD(this, kHeaderSize + index * kPointerSize);
// Cast operations
-CAST_ACCESSOR(FixedArray)
-CAST_ACCESSOR(FixedDoubleArray)
-CAST_ACCESSOR(FixedTypedArrayBase)
+CAST_ACCESSOR(AccessorInfo)
+CAST_ACCESSOR(ByteArray)
+CAST_ACCESSOR(Cell)
+CAST_ACCESSOR(Code)
+CAST_ACCESSOR(CodeCacheHashTable)
+CAST_ACCESSOR(CompilationCacheTable)
+CAST_ACCESSOR(ConsString)
CAST_ACCESSOR(ConstantPoolArray)
-CAST_ACCESSOR(DescriptorArray)
CAST_ACCESSOR(DeoptimizationInputData)
CAST_ACCESSOR(DeoptimizationOutputData)
CAST_ACCESSOR(DependentCode)
-CAST_ACCESSOR(StringTable)
-CAST_ACCESSOR(JSFunctionResultCache)
-CAST_ACCESSOR(NormalizedMapCache)
-CAST_ACCESSOR(ScopeInfo)
-CAST_ACCESSOR(CompilationCacheTable)
-CAST_ACCESSOR(CodeCacheHashTable)
-CAST_ACCESSOR(PolymorphicCodeCacheHashTable)
-CAST_ACCESSOR(MapCache)
-CAST_ACCESSOR(String)
-CAST_ACCESSOR(SeqString)
-CAST_ACCESSOR(SeqOneByteString)
-CAST_ACCESSOR(SeqTwoByteString)
-CAST_ACCESSOR(SlicedString)
-CAST_ACCESSOR(ConsString)
-CAST_ACCESSOR(ExternalString)
+CAST_ACCESSOR(DescriptorArray)
+CAST_ACCESSOR(ExternalArray)
CAST_ACCESSOR(ExternalAsciiString)
+CAST_ACCESSOR(ExternalFloat32Array)
+CAST_ACCESSOR(ExternalFloat64Array)
+CAST_ACCESSOR(ExternalInt16Array)
+CAST_ACCESSOR(ExternalInt32Array)
+CAST_ACCESSOR(ExternalInt8Array)
+CAST_ACCESSOR(ExternalString)
CAST_ACCESSOR(ExternalTwoByteString)
-CAST_ACCESSOR(Symbol)
-CAST_ACCESSOR(Name)
-CAST_ACCESSOR(JSReceiver)
-CAST_ACCESSOR(JSObject)
-CAST_ACCESSOR(Smi)
-CAST_ACCESSOR(HeapObject)
-CAST_ACCESSOR(HeapNumber)
-CAST_ACCESSOR(Oddball)
-CAST_ACCESSOR(Cell)
-CAST_ACCESSOR(PropertyCell)
-CAST_ACCESSOR(SharedFunctionInfo)
-CAST_ACCESSOR(Map)
-CAST_ACCESSOR(JSFunction)
+CAST_ACCESSOR(ExternalUint16Array)
+CAST_ACCESSOR(ExternalUint32Array)
+CAST_ACCESSOR(ExternalUint8Array)
+CAST_ACCESSOR(ExternalUint8ClampedArray)
+CAST_ACCESSOR(FixedArray)
+CAST_ACCESSOR(FixedArrayBase)
+CAST_ACCESSOR(FixedDoubleArray)
+CAST_ACCESSOR(FixedTypedArrayBase)
+CAST_ACCESSOR(Foreign)
+CAST_ACCESSOR(FreeSpace)
CAST_ACCESSOR(GlobalObject)
-CAST_ACCESSOR(JSGlobalProxy)
-CAST_ACCESSOR(JSGlobalObject)
-CAST_ACCESSOR(JSBuiltinsObject)
-CAST_ACCESSOR(Code)
+CAST_ACCESSOR(HeapNumber)
+CAST_ACCESSOR(HeapObject)
CAST_ACCESSOR(JSArray)
CAST_ACCESSOR(JSArrayBuffer)
CAST_ACCESSOR(JSArrayBufferView)
-CAST_ACCESSOR(JSTypedArray)
+CAST_ACCESSOR(JSBuiltinsObject)
CAST_ACCESSOR(JSDataView)
-CAST_ACCESSOR(JSRegExp)
-CAST_ACCESSOR(JSProxy)
+CAST_ACCESSOR(JSDate)
+CAST_ACCESSOR(JSFunction)
CAST_ACCESSOR(JSFunctionProxy)
-CAST_ACCESSOR(JSSet)
+CAST_ACCESSOR(JSFunctionResultCache)
+CAST_ACCESSOR(JSGeneratorObject)
+CAST_ACCESSOR(JSGlobalObject)
+CAST_ACCESSOR(JSGlobalProxy)
CAST_ACCESSOR(JSMap)
-CAST_ACCESSOR(JSSetIterator)
CAST_ACCESSOR(JSMapIterator)
+CAST_ACCESSOR(JSMessageObject)
+CAST_ACCESSOR(JSModule)
+CAST_ACCESSOR(JSObject)
+CAST_ACCESSOR(JSProxy)
+CAST_ACCESSOR(JSReceiver)
+CAST_ACCESSOR(JSRegExp)
+CAST_ACCESSOR(JSSet)
+CAST_ACCESSOR(JSSetIterator)
+CAST_ACCESSOR(JSTypedArray)
+CAST_ACCESSOR(JSValue)
CAST_ACCESSOR(JSWeakMap)
CAST_ACCESSOR(JSWeakSet)
-CAST_ACCESSOR(Foreign)
-CAST_ACCESSOR(ByteArray)
-CAST_ACCESSOR(FreeSpace)
-CAST_ACCESSOR(ExternalArray)
-CAST_ACCESSOR(ExternalInt8Array)
-CAST_ACCESSOR(ExternalUint8Array)
-CAST_ACCESSOR(ExternalInt16Array)
-CAST_ACCESSOR(ExternalUint16Array)
-CAST_ACCESSOR(ExternalInt32Array)
-CAST_ACCESSOR(ExternalUint32Array)
-CAST_ACCESSOR(ExternalFloat32Array)
-CAST_ACCESSOR(ExternalFloat64Array)
-CAST_ACCESSOR(ExternalUint8ClampedArray)
+CAST_ACCESSOR(Map)
+CAST_ACCESSOR(MapCache)
+CAST_ACCESSOR(Name)
+CAST_ACCESSOR(NameDictionary)
+CAST_ACCESSOR(NormalizedMapCache)
+CAST_ACCESSOR(Object)
+CAST_ACCESSOR(ObjectHashTable)
+CAST_ACCESSOR(Oddball)
+CAST_ACCESSOR(OrderedHashMap)
+CAST_ACCESSOR(OrderedHashSet)
+CAST_ACCESSOR(PolymorphicCodeCacheHashTable)
+CAST_ACCESSOR(PropertyCell)
+CAST_ACCESSOR(ScopeInfo)
+CAST_ACCESSOR(SeededNumberDictionary)
+CAST_ACCESSOR(SeqOneByteString)
+CAST_ACCESSOR(SeqString)
+CAST_ACCESSOR(SeqTwoByteString)
+CAST_ACCESSOR(SharedFunctionInfo)
+CAST_ACCESSOR(SlicedString)
+CAST_ACCESSOR(Smi)
+CAST_ACCESSOR(String)
+CAST_ACCESSOR(StringTable)
CAST_ACCESSOR(Struct)
-CAST_ACCESSOR(AccessorInfo)
+CAST_ACCESSOR(Symbol)
+CAST_ACCESSOR(UnseededNumberDictionary)
+CAST_ACCESSOR(WeakHashTable)
+
template <class Traits>
FixedTypedArray<Traits>* FixedTypedArray<Traits>::cast(Object* object) {
SLOW_ASSERT(object->IsHeapObject() &&
- HeapObject::cast(object)->map()->instance_type() ==
- Traits::kInstanceType);
+ HeapObject::cast(object)->map()->instance_type() ==
+ Traits::kInstanceType);
+ return reinterpret_cast<FixedTypedArray<Traits>*>(object);
+}
+
+
+template <class Traits>
+const FixedTypedArray<Traits>*
+FixedTypedArray<Traits>::cast(const Object* object) {
+ SLOW_ASSERT(const_cast<Object*>(object)->IsHeapObject() &&
+ HeapObject::cast(object)->map()->instance_type() ==
+ Traits::kInstanceType);
return reinterpret_cast<FixedTypedArray<Traits>*>(object);
}
template <typename Derived, typename Shape, typename Key>
HashTable<Derived, Shape, Key>*
HashTable<Derived, Shape, Key>::cast(Object* obj) {
- ASSERT(obj->IsHashTable());
+ SLOW_ASSERT(obj->IsHashTable());
return reinterpret_cast<HashTable*>(obj);
}
+template <typename Derived, typename Shape, typename Key>
+const HashTable<Derived, Shape, Key>*
+HashTable<Derived, Shape, Key>::cast(const Object* obj) {
+ SLOW_ASSERT(const_cast<Object*>(obj)->IsHashTable());
+ return reinterpret_cast<const HashTable*>(obj);
+}
+
+
SMI_ACCESSORS(FixedArrayBase, length, kLengthOffset)
SYNCHRONIZED_SMI_ACCESSORS(FixedArrayBase, length, kLengthOffset)
return continuation() == kGeneratorExecuting;
}
-JSGeneratorObject* JSGeneratorObject::cast(Object* obj) {
- ASSERT(obj->IsJSGeneratorObject());
- ASSERT(HeapObject::cast(obj)->Size() == JSGeneratorObject::kSize);
- return reinterpret_cast<JSGeneratorObject*>(obj);
-}
-
-
ACCESSORS(JSModule, context, Object, kContextOffset)
ACCESSORS(JSModule, scope_info, ScopeInfo, kScopeInfoOffset)
-JSModule* JSModule::cast(Object* obj) {
- ASSERT(obj->IsJSModule());
- ASSERT(HeapObject::cast(obj)->Size() == JSModule::kSize);
- return reinterpret_cast<JSModule*>(obj);
-}
-
-
ACCESSORS(JSValue, value, Object, kValueOffset)
-JSValue* JSValue::cast(Object* obj) {
- ASSERT(obj->IsJSValue());
- ASSERT(HeapObject::cast(obj)->Size() == JSValue::kSize);
- return reinterpret_cast<JSValue*>(obj);
-}
-
-
ACCESSORS(JSDate, value, Object, kValueOffset)
ACCESSORS(JSDate, cache_stamp, Object, kCacheStampOffset)
ACCESSORS(JSDate, year, Object, kYearOffset)
ACCESSORS(JSDate, sec, Object, kSecOffset)
-JSDate* JSDate::cast(Object* obj) {
- ASSERT(obj->IsJSDate());
- ASSERT(HeapObject::cast(obj)->Size() == JSDate::kSize);
- return reinterpret_cast<JSDate*>(obj);
-}
-
-
ACCESSORS(JSMessageObject, type, String, kTypeOffset)
ACCESSORS(JSMessageObject, arguments, JSArray, kArgumentsOffset)
ACCESSORS(JSMessageObject, script, Object, kScriptOffset)
SMI_ACCESSORS(JSMessageObject, end_position, kEndPositionOffset)
-JSMessageObject* JSMessageObject::cast(Object* obj) {
- ASSERT(obj->IsJSMessageObject());
- ASSERT(HeapObject::cast(obj)->Size() == JSMessageObject::kSize);
- return reinterpret_cast<JSMessageObject*>(obj);
-}
-
-
INT_ACCESSORS(Code, instruction_size, kInstructionSizeOffset)
INT_ACCESSORS(Code, prologue_offset, kPrologueOffset)
ACCESSORS(Code, relocation_info, ByteArray, kRelocationInfoOffset)
inline void set_##name(type* value, \
WriteBarrierMode mode = UPDATE_WRITE_BARRIER); \
+
+#define DECLARE_CAST(type) \
+ INLINE(static type* cast(Object* object)); \
+ INLINE(static const type* cast(const Object* object));
+
+
class AccessorPair;
class AllocationSite;
class AllocationSiteCreationContext;
INLINE(bool IsSpecObject());
INLINE(bool IsSpecFunction());
INLINE(bool IsTemplateInfo());
+ INLINE(bool IsNameDictionary());
+ INLINE(bool IsSeededNumberDictionary());
+ INLINE(bool IsUnseededNumberDictionary());
+ INLINE(bool IsOrderedHashSet());
+ INLINE(bool IsOrderedHashMap());
bool IsCallable();
// Oddball testing.
// Prints this object without details to a message accumulator.
void ShortPrint(StringStream* accumulator);
- // Casting: This cast is only needed to satisfy macros in objects-inl.h.
- static Object* cast(Object* value) { return value; }
+ DECLARE_CAST(Object)
// Layout description.
static const int kHeaderSize = 0; // Object does not take up any space.
// Returns whether value can be represented in a Smi.
static inline bool IsValid(intptr_t value);
- // Casting.
- static inline Smi* cast(Object* object);
+ DECLARE_CAST(Smi)
// Dispatched behavior.
void SmiPrint(FILE* out = stdout);
Handle<Name> name,
Handle<Code> code);
- // Casting.
- static inline HeapObject* cast(Object* obj);
+ DECLARE_CAST(HeapObject)
// Return the write barrier mode for this. Callers of this function
// must be able to present a reference to an DisallowHeapAllocation
inline double value();
inline void set_value(double value);
- // Casting.
- static inline HeapNumber* cast(Object* obj);
+ DECLARE_CAST(HeapNumber)
// Dispatched behavior.
bool HeapNumberBooleanValue();
OMIT_EXTENSIBILITY_CHECK
};
- // Casting.
- static inline JSReceiver* cast(Object* obj);
+ DECLARE_CAST(JSReceiver)
// Implementation of [[Put]], ECMA-262 5th edition, section 8.12.5.
MUST_USE_RESULT static MaybeHandle<Object> SetProperty(
static Handle<Object> GetDataProperty(Handle<JSObject> object,
Handle<Name> key);
- // Casting.
- static inline JSObject* cast(Object* obj);
+ DECLARE_CAST(JSObject)
// Dispatched behavior.
void JSObjectShortPrint(StringStream* accumulator);
inline int synchronized_length() const;
inline void synchronized_set_length(int value);
- inline static FixedArrayBase* cast(Object* object);
+ DECLARE_CAST(FixedArrayBase)
// Layout description.
// Length is smi tagged when it is stored.
return HeapObject::RawField(this, OffsetOfElementAt(index));
}
- // Casting.
- static inline FixedArray* cast(Object* obj);
+ DECLARE_CAST(FixedArray)
// Maximal allowed size, in bytes, of a single FixedArray.
// Prevents overflowing size computations, as well as extreme memory
inline static double hole_nan_as_double();
inline static double canonical_not_the_hole_nan_as_double();
- // Casting.
- static inline FixedDoubleArray* cast(Object* obj);
+ DECLARE_CAST(FixedDoubleArray)
// Maximal allowed size, in bytes, of a single FixedDoubleArray.
// Prevents overflowing size computations, as well as extreme memory
return offset;
}
- // Casting.
- static inline ConstantPoolArray* cast(Object* obj);
+ DECLARE_CAST(ConstantPoolArray)
// Garbage collection support.
Object** RawFieldOfElementAt(int index) {
int number_of_descriptors,
int slack = 0);
- // Casting.
- static inline DescriptorArray* cast(Object* obj);
+ DECLARE_CAST(DescriptorArray)
// Constant for denoting key was not found.
static const int kNotFound = -1;
void IteratePrefix(ObjectVisitor* visitor);
void IterateElements(ObjectVisitor* visitor);
- // Casting.
- static inline HashTable* cast(Object* obj);
+ DECLARE_CAST(HashTable)
// Compute the probe offset (quadratic probing).
INLINE(static uint32_t GetProbeOffset(uint32_t n)) {
uint16_t c1,
uint16_t c2);
- // Casting.
- static inline StringTable* cast(Object* obj);
+ DECLARE_CAST(StringTable)
private:
template <bool seq_ascii> friend class JsonParser;
Object* Lookup(FixedArray* key);
static Handle<MapCache> Put(
Handle<MapCache> map_cache, Handle<FixedArray> key, Handle<Map> value);
- static inline MapCache* cast(Object* obj);
+ DECLARE_CAST(MapCache)
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(MapCache);
typedef HashTable<Derived, Shape, Key> DerivedHashTable;
public:
- static inline Dictionary* cast(Object* obj) {
- return reinterpret_cast<Dictionary*>(obj);
- }
-
// Returns the value at entry.
Object* ValueAt(int entry) {
return this->get(DerivedHashTable::EntryToIndex(entry) + 1);
NameDictionary, NameDictionaryShape, Handle<Name> > DerivedDictionary;
public:
- static inline NameDictionary* cast(Object* obj) {
- ASSERT(obj->IsDictionary());
- return reinterpret_cast<NameDictionary*>(obj);
- }
+ DECLARE_CAST(NameDictionary)
// Copies enumerable keys to preallocated fixed array.
void CopyEnumKeysTo(FixedArray* storage);
SeededNumberDictionaryShape,
uint32_t> {
public:
- static SeededNumberDictionary* cast(Object* obj) {
- ASSERT(obj->IsDictionary());
- return reinterpret_cast<SeededNumberDictionary*>(obj);
- }
+ DECLARE_CAST(SeededNumberDictionary)
// Type specific at put (default NONE attributes is used when adding).
MUST_USE_RESULT static Handle<SeededNumberDictionary> AtNumberPut(
UnseededNumberDictionaryShape,
uint32_t> {
public:
- static UnseededNumberDictionary* cast(Object* obj) {
- ASSERT(obj->IsDictionary());
- return reinterpret_cast<UnseededNumberDictionary*>(obj);
- }
+ DECLARE_CAST(UnseededNumberDictionary)
// Type specific at put (default NONE attributes is used when adding).
MUST_USE_RESULT static Handle<UnseededNumberDictionary> AtNumberPut(
typedef HashTable<
ObjectHashTable, ObjectHashTableShape, Handle<Object> > DerivedHashTable;
public:
- static inline ObjectHashTable* cast(Object* obj) {
- ASSERT(obj->IsHashTable());
- return reinterpret_cast<ObjectHashTable*>(obj);
- }
+ DECLARE_CAST(ObjectHashTable)
// Attempt to shrink hash table after removal of key.
MUST_USE_RESULT static inline Handle<ObjectHashTable> Shrink(
class OrderedHashSet: public OrderedHashTable<
OrderedHashSet, JSSetIterator, 1> {
public:
- static OrderedHashSet* cast(Object* obj) {
- ASSERT(obj->IsOrderedHashTable());
- return reinterpret_cast<OrderedHashSet*>(obj);
- }
+ DECLARE_CAST(OrderedHashSet)
bool Contains(Handle<Object> key);
static Handle<OrderedHashSet> Add(
class OrderedHashMap:public OrderedHashTable<
OrderedHashMap, JSMapIterator, 2> {
public:
- static OrderedHashMap* cast(Object* obj) {
- ASSERT(obj->IsOrderedHashTable());
- return reinterpret_cast<OrderedHashMap*>(obj);
- }
+ DECLARE_CAST(OrderedHashMap)
Object* Lookup(Handle<Object> key);
static Handle<OrderedHashMap> Put(
typedef HashTable<
WeakHashTable, WeakHashTableShape<2>, Handle<Object> > DerivedHashTable;
public:
- static inline WeakHashTable* cast(Object* obj) {
- ASSERT(obj->IsHashTable());
- return reinterpret_cast<WeakHashTable*>(obj);
- }
+ DECLARE_CAST(WeakHashTable)
// Looks up the value associated with the given key. The hole value is
// returned in case the key is not present.
inline int finger_index();
inline void set_finger_index(int finger_index);
- // Casting
- static inline JSFunctionResultCache* cast(Object* obj);
+ DECLARE_CAST(JSFunctionResultCache)
DECLARE_VERIFIER(JSFunctionResultCache)
};
// routines.
class ScopeInfo : public FixedArray {
public:
- static inline ScopeInfo* cast(Object* object);
+ DECLARE_CAST(ScopeInfo)
// Return the type of this scope.
ScopeType scope_type();
void Clear();
- // Casting
- static inline NormalizedMapCache* cast(Object* obj);
+ DECLARE_CAST(NormalizedMapCache)
+
static inline bool IsNormalizedMapCache(Object* obj);
DECLARE_VERIFIER(NormalizedMapCache)
// Returns a pointer to the ByteArray object for a given data start address.
static inline ByteArray* FromDataStartAddress(Address address);
- // Casting.
- static inline ByteArray* cast(Object* obj);
+ DECLARE_CAST(ByteArray)
// Dispatched behavior.
inline int ByteArraySize() {
inline int Size() { return size(); }
- // Casting.
- static inline FreeSpace* cast(Object* obj);
+ DECLARE_CAST(FreeSpace)
// Dispatched behavior.
DECLARE_PRINTER(FreeSpace)
// external array.
DECL_ACCESSORS(external_pointer, void) // Pointer to the data store.
- // Casting.
- static inline ExternalArray* cast(Object* obj);
+ DECLARE_CAST(ExternalArray)
// Maximal acceptable length for an external array.
static const int kMaxLength = 0x3fffffff;
uint32_t index,
Handle<Object> value);
- // Casting.
- static inline ExternalUint8ClampedArray* cast(Object* obj);
+ DECLARE_CAST(ExternalUint8ClampedArray)
// Dispatched behavior.
DECLARE_PRINTER(ExternalUint8ClampedArray)
uint32_t index,
Handle<Object> value);
- // Casting.
- static inline ExternalInt8Array* cast(Object* obj);
+ DECLARE_CAST(ExternalInt8Array)
// Dispatched behavior.
DECLARE_PRINTER(ExternalInt8Array)
uint32_t index,
Handle<Object> value);
- // Casting.
- static inline ExternalUint8Array* cast(Object* obj);
+ DECLARE_CAST(ExternalUint8Array)
// Dispatched behavior.
DECLARE_PRINTER(ExternalUint8Array)
uint32_t index,
Handle<Object> value);
- // Casting.
- static inline ExternalInt16Array* cast(Object* obj);
+ DECLARE_CAST(ExternalInt16Array)
// Dispatched behavior.
DECLARE_PRINTER(ExternalInt16Array)
uint32_t index,
Handle<Object> value);
- // Casting.
- static inline ExternalUint16Array* cast(Object* obj);
+ DECLARE_CAST(ExternalUint16Array)
// Dispatched behavior.
DECLARE_PRINTER(ExternalUint16Array)
uint32_t index,
Handle<Object> value);
- // Casting.
- static inline ExternalInt32Array* cast(Object* obj);
+ DECLARE_CAST(ExternalInt32Array)
// Dispatched behavior.
DECLARE_PRINTER(ExternalInt32Array)
uint32_t index,
Handle<Object> value);
- // Casting.
- static inline ExternalUint32Array* cast(Object* obj);
+ DECLARE_CAST(ExternalUint32Array)
// Dispatched behavior.
DECLARE_PRINTER(ExternalUint32Array)
uint32_t index,
Handle<Object> value);
- // Casting.
- static inline ExternalFloat32Array* cast(Object* obj);
+ DECLARE_CAST(ExternalFloat32Array)
// Dispatched behavior.
DECLARE_PRINTER(ExternalFloat32Array)
uint32_t index,
Handle<Object> value);
- // Casting.
- static inline ExternalFloat64Array* cast(Object* obj);
+ DECLARE_CAST(ExternalFloat64Array)
// Dispatched behavior.
DECLARE_PRINTER(ExternalFloat64Array)
class FixedTypedArrayBase: public FixedArrayBase {
public:
- // Casting:
- static inline FixedTypedArrayBase* cast(Object* obj);
+ DECLARE_CAST(FixedTypedArrayBase)
static const int kDataOffset = kHeaderSize;
typedef typename Traits::ElementType ElementType;
static const InstanceType kInstanceType = Traits::kInstanceType;
- // Casting:
- static inline FixedTypedArray<Traits>* cast(Object* obj);
+ DECLARE_CAST(FixedTypedArray<Traits>)
static inline int ElementOffset(int index) {
return kDataOffset + index * sizeof(ElementType);
int deopt_entry_count,
PretenureFlag pretenure);
- // Casting.
- static inline DeoptimizationInputData* cast(Object* obj);
+ DECLARE_CAST(DeoptimizationInputData)
#ifdef ENABLE_DISASSEMBLER
void DeoptimizationInputDataPrint(FILE* out);
int number_of_deopt_points,
PretenureFlag pretenure);
- // Casting.
- static inline DeoptimizationOutputData* cast(Object* obj);
+ DECLARE_CAST(DeoptimizationOutputData)
#if defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER)
void DeoptimizationOutputDataPrint(FILE* out);
int SourcePosition(Address pc);
int SourceStatementPosition(Address pc);
- // Casting.
- static inline Code* cast(Object* obj);
+ DECLARE_CAST(Code)
// Dispatched behavior.
int CodeSize() { return SizeFor(body_size()); }
inline Object* object_at(int i);
inline void clear_at(int i);
inline void copy(int from, int to);
- static inline DependentCode* cast(Object* object);
+ DECLARE_CAST(DependentCode)
static DependentCode* ForObject(Handle<HeapObject> object,
DependencyGroup group);
inobject_properties();
}
- // Casting.
- static inline Map* cast(Object* obj);
+ DECLARE_CAST(Map)
// Code cache operations.
class Struct: public HeapObject {
public:
inline void InitializeBody(int object_size);
- static inline Struct* cast(Object* that);
+ DECLARE_CAST(Struct)
};
// [value]: the boxed contents.
DECL_ACCESSORS(value, Object)
- static inline Box* cast(Object* obj);
+ DECLARE_CAST(Box)
// Dispatched behavior.
DECLARE_PRINTER(Box)
// the 'flags' field.
DECL_BOOLEAN_ACCESSORS(is_shared_cross_origin)
- static inline Script* cast(Object* obj);
+ DECLARE_CAST(Script)
// If script source is an external string, check that the underlying
// resource is accessible. Otherwise, always return true.
void ResetForNewContext(int new_ic_age);
- // Casting.
- static inline SharedFunctionInfo* cast(Object* obj);
+ DECLARE_CAST(SharedFunctionInfo)
// Constants.
static const int kDontAdaptArgumentsSentinel = -1;
inline int stack_handler_index() const;
inline void set_stack_handler_index(int stack_handler_index);
- // Casting.
- static inline JSGeneratorObject* cast(Object* obj);
+ DECLARE_CAST(JSGeneratorObject)
// Dispatched behavior.
DECLARE_PRINTER(JSGeneratorObject)
// [scope_info]: Scope info.
DECL_ACCESSORS(scope_info, ScopeInfo)
- // Casting.
- static inline JSModule* cast(Object* obj);
+ DECLARE_CAST(JSModule)
// Dispatched behavior.
DECLARE_PRINTER(JSModule)
// Prints the name of the function using PrintF.
void PrintName(FILE* out = stdout);
- // Casting.
- static inline JSFunction* cast(Object* obj);
+ DECLARE_CAST(JSFunction)
// Iterates the objects, including code objects indirectly referenced
// through pointers to the first instruction in the code object.
// [hash]: The hash code property (undefined if not initialized yet).
DECL_ACCESSORS(hash, Object)
- // Casting.
- static inline JSGlobalProxy* cast(Object* obj);
+ DECLARE_CAST(JSGlobalProxy)
inline bool IsDetachedFrom(GlobalObject* global);
// Retrieve the property cell used to store a property.
PropertyCell* GetPropertyCell(LookupResult* result);
- // Casting.
- static inline GlobalObject* cast(Object* obj);
+ DECLARE_CAST(GlobalObject)
// Layout description.
static const int kBuiltinsOffset = JSObject::kHeaderSize;
// JavaScript global object.
class JSGlobalObject: public GlobalObject {
public:
- // Casting.
- static inline JSGlobalObject* cast(Object* obj);
+ DECLARE_CAST(JSGlobalObject)
// Ensure that the global object has a cell for the given property name.
static Handle<PropertyCell> EnsurePropertyCell(Handle<JSGlobalObject> global,
inline Code* javascript_builtin_code(Builtins::JavaScript id);
inline void set_javascript_builtin_code(Builtins::JavaScript id, Code* value);
- // Casting.
- static inline JSBuiltinsObject* cast(Object* obj);
+ DECLARE_CAST(JSBuiltinsObject)
// Dispatched behavior.
DECLARE_PRINTER(JSBuiltinsObject)
// [value]: the object being wrapped.
DECL_ACCESSORS(value, Object)
- // Casting.
- static inline JSValue* cast(Object* obj);
+ DECLARE_CAST(JSValue)
// Dispatched behavior.
DECLARE_PRINTER(JSValue)
// moment when chached fields were cached.
DECL_ACCESSORS(cache_stamp, Object)
- // Casting.
- static inline JSDate* cast(Object* obj);
+ DECLARE_CAST(JSDate)
// Returns the date field with the specified index.
// See FieldIndex for the list of date fields.
inline int end_position() const;
inline void set_end_position(int value);
- // Casting.
- static inline JSMessageObject* cast(Object* obj);
+ DECLARE_CAST(JSMessageObject)
// Dispatched behavior.
DECLARE_PRINTER(JSMessageObject)
}
}
- static inline JSRegExp* cast(Object* obj);
+ DECLARE_CAST(JSRegExp)
// Dispatched behavior.
DECLARE_VERIFIER(JSRegExp)
JSRegExp::Flags flags, Handle<FixedArray> value);
void Remove(Object* value);
- static inline CompilationCacheTable* cast(Object* obj);
+ DECLARE_CAST(CompilationCacheTable)
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheTable);
// Remove an object from the cache with the provided internal index.
void RemoveByIndex(Object* name, Code* code, int index);
- static inline CodeCache* cast(Object* obj);
+ DECLARE_CAST(CodeCache)
// Dispatched behavior.
DECLARE_PRINTER(CodeCache)
int GetIndex(Name* name, Code::Flags flags);
void RemoveByIndex(int index);
- static inline CodeCacheHashTable* cast(Object* obj);
+ DECLARE_CAST(CodeCacheHashTable)
// Initial size of the fixed array backing the hash table.
static const int kInitialSize = 64;
// Returns an undefined value if the entry is not found.
Handle<Object> Lookup(MapHandleList* maps, Code::Flags flags);
- static inline PolymorphicCodeCache* cast(Object* obj);
+ DECLARE_CAST(PolymorphicCodeCache)
// Dispatched behavior.
DECLARE_PRINTER(PolymorphicCodeCache)
int code_kind,
Handle<Code> code);
- static inline PolymorphicCodeCacheHashTable* cast(Object* obj);
+ DECLARE_CAST(PolymorphicCodeCacheHashTable)
static const int kInitialSize = 64;
private:
inline bool matches_inlined_type_change_checksum(int checksum);
- static inline TypeFeedbackInfo* cast(Object* obj);
+ DECLARE_CAST(TypeFeedbackInfo)
// Dispatched behavior.
DECLARE_PRINTER(TypeFeedbackInfo)
DECLARE_PRINTER(AllocationSite)
DECLARE_VERIFIER(AllocationSite)
- static inline AllocationSite* cast(Object* obj);
+ DECLARE_CAST(AllocationSite)
static inline AllocationSiteMode GetMode(
ElementsKind boilerplate_elements_kind);
static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to);
DECLARE_PRINTER(AllocationMemento)
DECLARE_VERIFIER(AllocationMemento)
- static inline AllocationMemento* cast(Object* obj);
+ DECLARE_CAST(AllocationMemento)
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationMemento);
inline int aliased_context_slot() const;
inline void set_aliased_context_slot(int count);
- static inline AliasedArgumentsEntry* cast(Object* obj);
+ DECLARE_CAST(AliasedArgumentsEntry)
// Dispatched behavior.
DECLARE_PRINTER(AliasedArgumentsEntry)
// Conversion.
inline bool AsArrayIndex(uint32_t* index);
- // Casting.
- static inline Name* cast(Object* obj);
+ DECLARE_CAST(Name)
DECLARE_PRINTER(Name)
// [is_private]: whether this is a private symbol.
DECL_BOOLEAN_ACCESSORS(is_private)
- // Casting.
- static inline Symbol* cast(Object* obj);
+ DECLARE_CAST(Symbol)
// Dispatched behavior.
DECLARE_PRINTER(Symbol)
// Conversion.
inline bool AsArrayIndex(uint32_t* index);
- // Casting.
- static inline String* cast(Object* obj);
+ DECLARE_CAST(String)
void PrintOn(FILE* out);
// The SeqString abstract class captures sequential string values.
class SeqString: public String {
public:
- // Casting.
- static inline SeqString* cast(Object* obj);
+ DECLARE_CAST(SeqString)
// Layout description.
static const int kHeaderSize = String::kSize;
inline uint8_t* GetChars();
- // Casting
- static inline SeqOneByteString* cast(Object* obj);
+ DECLARE_CAST(SeqOneByteString)
// Garbage collection support. This method is called by the
// garbage collector to compute the actual size of an AsciiString
// For regexp code.
const uint16_t* SeqTwoByteStringGetData(unsigned start);
- // Casting
- static inline SeqTwoByteString* cast(Object* obj);
+ DECLARE_CAST(SeqTwoByteString)
// Garbage collection support. This method is called by the
// garbage collector to compute the actual size of a TwoByteString
// Dispatched behavior.
uint16_t ConsStringGet(int index);
- // Casting.
- static inline ConsString* cast(Object* obj);
+ DECLARE_CAST(ConsString)
// Layout description.
static const int kFirstOffset = POINTER_SIZE_ALIGN(String::kSize);
// Dispatched behavior.
uint16_t SlicedStringGet(int index);
- // Casting.
- static inline SlicedString* cast(Object* obj);
+ DECLARE_CAST(SlicedString)
// Layout description.
static const int kParentOffset = POINTER_SIZE_ALIGN(String::kSize);
// API. Therefore, ExternalStrings should not be used internally.
class ExternalString: public String {
public:
- // Casting
- static inline ExternalString* cast(Object* obj);
+ DECLARE_CAST(ExternalString)
// Layout description.
static const int kResourceOffset = POINTER_SIZE_ALIGN(String::kSize);
// Dispatched behavior.
inline uint16_t ExternalAsciiStringGet(int index);
- // Casting.
- static inline ExternalAsciiString* cast(Object* obj);
+ DECLARE_CAST(ExternalAsciiString)
// Garbage collection support.
inline void ExternalAsciiStringIterateBody(ObjectVisitor* v);
// For regexp code.
inline const uint16_t* ExternalTwoByteStringGetData(unsigned start);
- // Casting.
- static inline ExternalTwoByteString* cast(Object* obj);
+ DECLARE_CAST(ExternalTwoByteString)
// Garbage collection support.
inline void ExternalTwoByteStringIterateBody(ObjectVisitor* v);
inline byte kind();
inline void set_kind(byte kind);
- // Casting.
- static inline Oddball* cast(Object* obj);
+ DECLARE_CAST(Oddball)
// Dispatched behavior.
DECLARE_VERIFIER(Oddball)
// [value]: value of the global property.
DECL_ACCESSORS(value, Object)
- // Casting.
- static inline Cell* cast(Object* obj);
+ DECLARE_CAST(Cell)
static inline Cell* FromValueAddress(Address value) {
Object* result = FromAddress(value - kValueOffset);
static void AddDependentCompilationInfo(Handle<PropertyCell> cell,
CompilationInfo* info);
- // Casting.
- static inline PropertyCell* cast(Object* obj);
+ DECLARE_CAST(PropertyCell)
inline Address TypeAddress() {
return address() + kTypeOffset;
// [hash]: The hash code property (undefined if not initialized yet).
DECL_ACCESSORS(hash, Object)
- // Casting.
- static inline JSProxy* cast(Object* obj);
+ DECLARE_CAST(JSProxy)
MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithHandler(
Handle<JSProxy> proxy,
// [construct_trap]: The construct trap.
DECL_ACCESSORS(construct_trap, Object)
- // Casting.
- static inline JSFunctionProxy* cast(Object* obj);
+ DECLARE_CAST(JSFunctionProxy)
// Dispatched behavior.
DECLARE_PRINTER(JSFunctionProxy)
// [set]: the backing hash set containing keys.
DECL_ACCESSORS(table, Object)
- // Casting.
- static inline JSSet* cast(Object* obj);
+ DECLARE_CAST(JSSet)
// Dispatched behavior.
DECLARE_PRINTER(JSSet)
// [table]: the backing hash table mapping keys to values.
DECL_ACCESSORS(table, Object)
- // Casting.
- static inline JSMap* cast(Object* obj);
+ DECLARE_CAST(JSMap)
// Dispatched behavior.
DECLARE_PRINTER(JSMap)
DECLARE_PRINTER(JSSetIterator)
DECLARE_VERIFIER(JSSetIterator)
- // Casting.
- static inline JSSetIterator* cast(Object* obj);
+ DECLARE_CAST(JSSetIterator)
static Handle<Object> ValueForKind(
Handle<JSSetIterator> iterator,
DECLARE_PRINTER(JSMapIterator)
DECLARE_VERIFIER(JSMapIterator)
- // Casting.
- static inline JSMapIterator* cast(Object* obj);
+ DECLARE_CAST(JSMapIterator)
static Handle<Object> ValueForKind(
Handle<JSMapIterator> iterator,
// The JSWeakMap describes EcmaScript Harmony weak maps
class JSWeakMap: public JSWeakCollection {
public:
- // Casting.
- static inline JSWeakMap* cast(Object* obj);
+ DECLARE_CAST(JSWeakMap)
// Dispatched behavior.
DECLARE_PRINTER(JSWeakMap)
// The JSWeakSet describes EcmaScript Harmony weak sets
class JSWeakSet: public JSWeakCollection {
public:
- // Casting.
- static inline JSWeakSet* cast(Object* obj);
+ DECLARE_CAST(JSWeakSet)
// Dispatched behavior.
DECLARE_PRINTER(JSWeakSet)
// [weak_first_array]: weak linked list of views.
DECL_ACCESSORS(weak_first_view, Object)
- // Casting.
- static inline JSArrayBuffer* cast(Object* obj);
+ DECLARE_CAST(JSArrayBuffer)
// Neutering. Only neuters the buffer, not associated typed arrays.
void Neuter();
// [weak_next]: linked list of typed arrays over the same array buffer.
DECL_ACCESSORS(weak_next, Object)
- // Casting.
- static inline JSArrayBufferView* cast(Object* obj);
+ DECLARE_CAST(JSArrayBufferView)
DECLARE_VERIFIER(JSArrayBufferView)
// Neutering. Only neuters this typed array.
void Neuter();
- // Casting.
- static inline JSTypedArray* cast(Object* obj);
+ DECLARE_CAST(JSTypedArray)
ExternalArrayType type();
size_t element_size();
// Only neuters this DataView
void Neuter();
- // Casting.
- static inline JSDataView* cast(Object* obj);
+ DECLARE_CAST(JSDataView)
// Dispatched behavior.
DECLARE_PRINTER(JSDataView)
inline Address foreign_address();
inline void set_foreign_address(Address value);
- // Casting.
- static inline Foreign* cast(Object* obj);
+ DECLARE_CAST(Foreign)
// Dispatched behavior.
inline void ForeignIterateBody(ObjectVisitor* v);
static inline void SetContent(Handle<JSArray> array,
Handle<FixedArrayBase> storage);
- // Casting.
- static inline JSArray* cast(Object* obj);
+ DECLARE_CAST(JSArray)
// Ensures that the fixed array backing the JSArray has at
// least the stated size.
// Checks whether the given receiver is compatible with this accessor.
inline bool IsCompatibleReceiver(Object* receiver);
- static inline AccessorInfo* cast(Object* obj);
+ DECLARE_CAST(AccessorInfo)
// Dispatched behavior.
DECLARE_VERIFIER(AccessorInfo)
public:
DECL_ACCESSORS(serialized_data, ByteArray)
- static inline DeclaredAccessorDescriptor* cast(Object* obj);
+ DECLARE_CAST(DeclaredAccessorDescriptor)
static Handle<DeclaredAccessorDescriptor> Create(
Isolate* isolate,
public:
DECL_ACCESSORS(descriptor, DeclaredAccessorDescriptor)
- static inline DeclaredAccessorInfo* cast(Object* obj);
+ DECLARE_CAST(DeclaredAccessorInfo)
// Dispatched behavior.
DECLARE_PRINTER(DeclaredAccessorInfo)
DECL_ACCESSORS(setter, Object)
DECL_ACCESSORS(data, Object)
- static inline ExecutableAccessorInfo* cast(Object* obj);
+ DECLARE_CAST(ExecutableAccessorInfo)
// Dispatched behavior.
DECLARE_PRINTER(ExecutableAccessorInfo)
inline bool all_can_read();
inline bool all_can_write();
- static inline AccessorPair* cast(Object* obj);
+ DECLARE_CAST(AccessorPair)
static Handle<AccessorPair> Copy(Handle<AccessorPair> pair);
DECL_ACCESSORS(indexed_callback, Object)
DECL_ACCESSORS(data, Object)
- static inline AccessCheckInfo* cast(Object* obj);
+ DECLARE_CAST(AccessCheckInfo)
// Dispatched behavior.
DECLARE_PRINTER(AccessCheckInfo)
DECL_ACCESSORS(enumerator, Object)
DECL_ACCESSORS(data, Object)
- static inline InterceptorInfo* cast(Object* obj);
+ DECLARE_CAST(InterceptorInfo)
// Dispatched behavior.
DECLARE_PRINTER(InterceptorInfo)
DECL_ACCESSORS(callback, Object)
DECL_ACCESSORS(data, Object)
- static inline CallHandlerInfo* cast(Object* obj);
+ DECLARE_CAST(CallHandlerInfo)
// Dispatched behavior.
DECLARE_PRINTER(CallHandlerInfo)
DECL_BOOLEAN_ACCESSORS(remove_prototype)
DECL_BOOLEAN_ACCESSORS(do_not_cache)
- static inline FunctionTemplateInfo* cast(Object* obj);
+ DECLARE_CAST(FunctionTemplateInfo)
// Dispatched behavior.
DECLARE_PRINTER(FunctionTemplateInfo)
DECL_ACCESSORS(constructor, Object)
DECL_ACCESSORS(internal_field_count, Object)
- static inline ObjectTemplateInfo* cast(Object* obj);
+ DECLARE_CAST(ObjectTemplateInfo)
// Dispatched behavior.
DECLARE_PRINTER(ObjectTemplateInfo)
DECL_ACCESSORS(receiver, Object)
DECL_ACCESSORS(args, Object)
- static inline SignatureInfo* cast(Object* obj);
+ DECLARE_CAST(SignatureInfo)
// Dispatched behavior.
DECLARE_PRINTER(SignatureInfo)
public:
DECL_ACCESSORS(types, Object)
- static inline TypeSwitchInfo* cast(Object* obj);
+ DECLARE_CAST(TypeSwitchInfo)
// Dispatched behavior.
DECLARE_PRINTER(TypeSwitchInfo)
// Get the number of break points for this function.
int GetBreakPointCount();
- static inline DebugInfo* cast(Object* obj);
+ DECLARE_CAST(DebugInfo)
// Dispatched behavior.
DECLARE_PRINTER(DebugInfo)
// Get the number of break points for this code position.
int GetBreakPointCount();
- static inline BreakPointInfo* cast(Object* obj);
+ DECLARE_CAST(BreakPointInfo)
// Dispatched behavior.
DECLARE_PRINTER(BreakPointInfo)
#undef DECL_BOOLEAN_ACCESSORS
#undef DECL_ACCESSORS
+#undef DECLARE_CAST
#undef DECLARE_VERIFIER
#define VISITOR_SYNCHRONIZATION_TAGS_LIST(V) \