Chromium Code Reviews| Index: src/objects.h |
| diff --git a/src/objects.h b/src/objects.h |
| index f35c056f4e7f6bc2ee8ed3c7274cbca7ff49485d..d990dd3335d90f043070d71eedce893ead2d01b3 100644 |
| --- a/src/objects.h |
| +++ b/src/objects.h |
| @@ -854,6 +854,12 @@ enum CompareResult { |
| 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; |
| @@ -1367,6 +1373,11 @@ class Object { |
| 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. |
| @@ -1544,8 +1555,7 @@ class Object { |
| // 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. |
| @@ -1582,8 +1592,7 @@ class Smi: public Object { |
| // 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); |
| @@ -1716,8 +1725,7 @@ class HeapObject: public Object { |
| 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 |
| @@ -1812,8 +1820,7 @@ class HeapNumber: public HeapObject { |
| inline double value(); |
| inline void set_value(double value); |
| - // Casting. |
| - static inline HeapNumber* cast(Object* obj); |
| + DECLARE_CAST(HeapNumber) |
| // Dispatched behavior. |
| bool HeapNumberBooleanValue(); |
| @@ -1907,8 +1914,7 @@ class JSReceiver: public HeapObject { |
| 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( |
| @@ -2522,8 +2528,7 @@ class JSObject: public JSReceiver { |
| 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); |
| @@ -2873,7 +2878,7 @@ class FixedArrayBase: public HeapObject { |
| 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. |
| @@ -2947,8 +2952,7 @@ class FixedArray: public FixedArrayBase { |
| 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 |
| @@ -3033,8 +3037,7 @@ class FixedDoubleArray: public FixedArrayBase { |
| 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 |
| @@ -3285,8 +3288,7 @@ class ConstantPoolArray: public HeapObject { |
| return offset; |
| } |
| - // Casting. |
| - static inline ConstantPoolArray* cast(Object* obj); |
| + DECLARE_CAST(ConstantPoolArray) |
| // Garbage collection support. |
| Object** RawFieldOfElementAt(int index) { |
| @@ -3479,8 +3481,7 @@ class DescriptorArray: public FixedArray { |
| 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; |
| @@ -3733,8 +3734,7 @@ class HashTable: public FixedArray { |
| 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)) { |
| @@ -3907,8 +3907,7 @@ class StringTable: public HashTable<StringTable, |
| uint16_t c1, |
| uint16_t c2); |
| - // Casting. |
| - static inline StringTable* cast(Object* obj); |
| + DECLARE_CAST(StringTable) |
| private: |
| template <bool seq_ascii> friend class JsonParser; |
| @@ -3948,7 +3947,7 @@ class MapCache: public HashTable<MapCache, MapCacheShape, HashTableKey*> { |
| 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); |
| @@ -3961,10 +3960,6 @@ class Dictionary: public HashTable<Derived, Shape, Key> { |
| typedef HashTable<Derived, Shape, Key> DerivedHashTable; |
| public: |
| - static inline Dictionary* cast(Object* obj) { |
|
Michael Starzinger
2014/06/23 08:37:12
+1 on dropping this!
|
| - return reinterpret_cast<Dictionary*>(obj); |
| - } |
| - |
| // Returns the value at entry. |
| Object* ValueAt(int entry) { |
| return this->get(DerivedHashTable::EntryToIndex(entry) + 1); |
| @@ -4102,10 +4097,7 @@ class NameDictionary: public Dictionary<NameDictionary, |
| 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); |
| @@ -4153,10 +4145,7 @@ class SeededNumberDictionary |
| 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( |
| @@ -4204,10 +4193,7 @@ class UnseededNumberDictionary |
| 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( |
| @@ -4247,10 +4233,7 @@ class ObjectHashTable: public HashTable<ObjectHashTable, |
| 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( |
| @@ -4459,10 +4442,7 @@ class JSSetIterator; |
| 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( |
| @@ -4476,10 +4456,7 @@ class JSMapIterator; |
| 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( |
| @@ -4517,10 +4494,7 @@ class WeakHashTable: public HashTable<WeakHashTable, |
| 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. |
| @@ -4582,8 +4556,7 @@ class JSFunctionResultCache: public FixedArray { |
| 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) |
| }; |
| @@ -4598,7 +4571,7 @@ class JSFunctionResultCache: public FixedArray { |
| // routines. |
| class ScopeInfo : public FixedArray { |
| public: |
| - static inline ScopeInfo* cast(Object* object); |
| + DECLARE_CAST(ScopeInfo) |
| // Return the type of this scope. |
| ScopeType scope_type(); |
| @@ -4813,8 +4786,8 @@ class NormalizedMapCache: public FixedArray { |
| void Clear(); |
| - // Casting |
| - static inline NormalizedMapCache* cast(Object* obj); |
| + DECLARE_CAST(NormalizedMapCache) |
| + |
| static inline bool IsNormalizedMapCache(Object* obj); |
| DECLARE_VERIFIER(NormalizedMapCache) |
| @@ -4861,8 +4834,7 @@ class ByteArray: public FixedArrayBase { |
| // 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() { |
| @@ -4897,8 +4869,7 @@ class FreeSpace: public HeapObject { |
| inline int Size() { return size(); } |
| - // Casting. |
| - static inline FreeSpace* cast(Object* obj); |
| + DECLARE_CAST(FreeSpace) |
| // Dispatched behavior. |
| DECLARE_PRINTER(FreeSpace) |
| @@ -4949,8 +4920,7 @@ class ExternalArray: public FixedArrayBase { |
| // 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; |
| @@ -4990,8 +4960,7 @@ class ExternalUint8ClampedArray: public ExternalArray { |
| uint32_t index, |
| Handle<Object> value); |
| - // Casting. |
| - static inline ExternalUint8ClampedArray* cast(Object* obj); |
| + DECLARE_CAST(ExternalUint8ClampedArray) |
| // Dispatched behavior. |
| DECLARE_PRINTER(ExternalUint8ClampedArray) |
| @@ -5015,8 +4984,7 @@ class ExternalInt8Array: public ExternalArray { |
| uint32_t index, |
| Handle<Object> value); |
| - // Casting. |
| - static inline ExternalInt8Array* cast(Object* obj); |
| + DECLARE_CAST(ExternalInt8Array) |
| // Dispatched behavior. |
| DECLARE_PRINTER(ExternalInt8Array) |
| @@ -5040,8 +5008,7 @@ class ExternalUint8Array: public ExternalArray { |
| uint32_t index, |
| Handle<Object> value); |
| - // Casting. |
| - static inline ExternalUint8Array* cast(Object* obj); |
| + DECLARE_CAST(ExternalUint8Array) |
| // Dispatched behavior. |
| DECLARE_PRINTER(ExternalUint8Array) |
| @@ -5065,8 +5032,7 @@ class ExternalInt16Array: public ExternalArray { |
| uint32_t index, |
| Handle<Object> value); |
| - // Casting. |
| - static inline ExternalInt16Array* cast(Object* obj); |
| + DECLARE_CAST(ExternalInt16Array) |
| // Dispatched behavior. |
| DECLARE_PRINTER(ExternalInt16Array) |
| @@ -5091,8 +5057,7 @@ class ExternalUint16Array: public ExternalArray { |
| uint32_t index, |
| Handle<Object> value); |
| - // Casting. |
| - static inline ExternalUint16Array* cast(Object* obj); |
| + DECLARE_CAST(ExternalUint16Array) |
| // Dispatched behavior. |
| DECLARE_PRINTER(ExternalUint16Array) |
| @@ -5116,8 +5081,7 @@ class ExternalInt32Array: public ExternalArray { |
| uint32_t index, |
| Handle<Object> value); |
| - // Casting. |
| - static inline ExternalInt32Array* cast(Object* obj); |
| + DECLARE_CAST(ExternalInt32Array) |
| // Dispatched behavior. |
| DECLARE_PRINTER(ExternalInt32Array) |
| @@ -5142,8 +5106,7 @@ class ExternalUint32Array: public ExternalArray { |
| uint32_t index, |
| Handle<Object> value); |
| - // Casting. |
| - static inline ExternalUint32Array* cast(Object* obj); |
| + DECLARE_CAST(ExternalUint32Array) |
| // Dispatched behavior. |
| DECLARE_PRINTER(ExternalUint32Array) |
| @@ -5168,8 +5131,7 @@ class ExternalFloat32Array: public ExternalArray { |
| uint32_t index, |
| Handle<Object> value); |
| - // Casting. |
| - static inline ExternalFloat32Array* cast(Object* obj); |
| + DECLARE_CAST(ExternalFloat32Array) |
| // Dispatched behavior. |
| DECLARE_PRINTER(ExternalFloat32Array) |
| @@ -5194,8 +5156,7 @@ class ExternalFloat64Array: public ExternalArray { |
| uint32_t index, |
| Handle<Object> value); |
| - // Casting. |
| - static inline ExternalFloat64Array* cast(Object* obj); |
| + DECLARE_CAST(ExternalFloat64Array) |
| // Dispatched behavior. |
| DECLARE_PRINTER(ExternalFloat64Array) |
| @@ -5208,8 +5169,7 @@ class ExternalFloat64Array: public ExternalArray { |
| class FixedTypedArrayBase: public FixedArrayBase { |
| public: |
| - // Casting: |
| - static inline FixedTypedArrayBase* cast(Object* obj); |
| + DECLARE_CAST(FixedTypedArrayBase) |
| static const int kDataOffset = kHeaderSize; |
| @@ -5235,8 +5195,7 @@ class FixedTypedArray: public FixedTypedArrayBase { |
| 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); |
| @@ -5361,8 +5320,7 @@ class DeoptimizationInputData: public FixedArray { |
| int deopt_entry_count, |
| PretenureFlag pretenure); |
| - // Casting. |
| - static inline DeoptimizationInputData* cast(Object* obj); |
| + DECLARE_CAST(DeoptimizationInputData) |
| #ifdef ENABLE_DISASSEMBLER |
| void DeoptimizationInputDataPrint(FILE* out); |
| @@ -5408,8 +5366,7 @@ class DeoptimizationOutputData: public FixedArray { |
| 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); |
| @@ -5766,8 +5723,7 @@ class Code: public HeapObject { |
| 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()); } |
| @@ -6084,7 +6040,7 @@ class DependentCode: public FixedArray { |
| 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); |
| @@ -6549,8 +6505,7 @@ class Map: public HeapObject { |
| inobject_properties(); |
| } |
| - // Casting. |
| - static inline Map* cast(Object* obj); |
| + DECLARE_CAST(Map) |
| // Code cache operations. |
| @@ -6842,7 +6797,7 @@ class Map: public HeapObject { |
| class Struct: public HeapObject { |
| public: |
| inline void InitializeBody(int object_size); |
| - static inline Struct* cast(Object* that); |
| + DECLARE_CAST(Struct) |
| }; |
| @@ -6852,7 +6807,7 @@ class Box : public Struct { |
| // [value]: the boxed contents. |
| DECL_ACCESSORS(value, Object) |
| - static inline Box* cast(Object* obj); |
| + DECLARE_CAST(Box) |
| // Dispatched behavior. |
| DECLARE_PRINTER(Box) |
| @@ -6943,7 +6898,7 @@ class Script: public Struct { |
| // 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. |
| @@ -7351,8 +7306,7 @@ class SharedFunctionInfo: public HeapObject { |
| void ResetForNewContext(int new_ic_age); |
| - // Casting. |
| - static inline SharedFunctionInfo* cast(Object* obj); |
| + DECLARE_CAST(SharedFunctionInfo) |
| // Constants. |
| static const int kDontAdaptArgumentsSentinel = -1; |
| @@ -7564,8 +7518,7 @@ class JSGeneratorObject: public JSObject { |
| 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) |
| @@ -7613,8 +7566,7 @@ class JSModule: public JSObject { |
| // [scope_info]: Scope info. |
| DECL_ACCESSORS(scope_info, ScopeInfo) |
| - // Casting. |
| - static inline JSModule* cast(Object* obj); |
| + DECLARE_CAST(JSModule) |
| // Dispatched behavior. |
| DECLARE_PRINTER(JSModule) |
| @@ -7799,8 +7751,7 @@ class JSFunction: public JSObject { |
| // 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. |
| @@ -7863,8 +7814,7 @@ class JSGlobalProxy : public JSObject { |
| // [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); |
| @@ -7904,8 +7854,7 @@ class GlobalObject: public JSObject { |
| // 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; |
| @@ -7922,8 +7871,7 @@ class GlobalObject: public JSObject { |
| // 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, |
| @@ -7955,8 +7903,7 @@ class JSBuiltinsObject: public GlobalObject { |
| 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) |
| @@ -7991,8 +7938,7 @@ class JSValue: public JSObject { |
| // [value]: the object being wrapped. |
| DECL_ACCESSORS(value, Object) |
| - // Casting. |
| - static inline JSValue* cast(Object* obj); |
| + DECLARE_CAST(JSValue) |
| // Dispatched behavior. |
| DECLARE_PRINTER(JSValue) |
| @@ -8033,8 +7979,7 @@ class JSDate: public JSObject { |
| // 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. |
| @@ -8129,8 +8074,7 @@ class JSMessageObject: public JSObject { |
| 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) |
| @@ -8214,7 +8158,7 @@ class JSRegExp: public JSObject { |
| } |
| } |
| - static inline JSRegExp* cast(Object* obj); |
| + DECLARE_CAST(JSRegExp) |
| // Dispatched behavior. |
| DECLARE_VERIFIER(JSRegExp) |
| @@ -8332,7 +8276,7 @@ class CompilationCacheTable: public HashTable<CompilationCacheTable, |
| JSRegExp::Flags flags, Handle<FixedArray> value); |
| void Remove(Object* value); |
| - static inline CompilationCacheTable* cast(Object* obj); |
| + DECLARE_CAST(CompilationCacheTable) |
| private: |
| DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheTable); |
| @@ -8361,7 +8305,7 @@ class CodeCache: public Struct { |
| // 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) |
| @@ -8424,7 +8368,7 @@ class CodeCacheHashTable: public HashTable<CodeCacheHashTable, |
| 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; |
| @@ -8447,7 +8391,7 @@ class PolymorphicCodeCache: public Struct { |
| // 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) |
| @@ -8474,7 +8418,7 @@ class PolymorphicCodeCacheHashTable |
| int code_kind, |
| Handle<Code> code); |
| - static inline PolymorphicCodeCacheHashTable* cast(Object* obj); |
| + DECLARE_CAST(PolymorphicCodeCacheHashTable) |
| static const int kInitialSize = 64; |
| private: |
| @@ -8499,7 +8443,7 @@ class TypeFeedbackInfo: public Struct { |
| inline bool matches_inlined_type_change_checksum(int checksum); |
| - static inline TypeFeedbackInfo* cast(Object* obj); |
| + DECLARE_CAST(TypeFeedbackInfo) |
| // Dispatched behavior. |
| DECLARE_PRINTER(TypeFeedbackInfo) |
| @@ -8708,7 +8652,7 @@ class AllocationSite: public Struct { |
| 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); |
| @@ -8763,7 +8707,7 @@ class AllocationMemento: public Struct { |
| DECLARE_PRINTER(AllocationMemento) |
| DECLARE_VERIFIER(AllocationMemento) |
| - static inline AllocationMemento* cast(Object* obj); |
| + DECLARE_CAST(AllocationMemento) |
| private: |
| DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationMemento); |
| @@ -8783,7 +8727,7 @@ class AliasedArgumentsEntry: public Struct { |
| 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) |
| @@ -8925,8 +8869,7 @@ class Name: public HeapObject { |
| // Conversion. |
| inline bool AsArrayIndex(uint32_t* index); |
| - // Casting. |
| - static inline Name* cast(Object* obj); |
| + DECLARE_CAST(Name) |
| DECLARE_PRINTER(Name) |
| @@ -9000,8 +8943,7 @@ class Symbol: public 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) |
| @@ -9222,8 +9164,7 @@ class String: public Name { |
| // Conversion. |
| inline bool AsArrayIndex(uint32_t* index); |
| - // Casting. |
| - static inline String* cast(Object* obj); |
| + DECLARE_CAST(String) |
| void PrintOn(FILE* out); |
| @@ -9359,8 +9300,7 @@ class String: public Name { |
| // 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; |
| @@ -9390,8 +9330,7 @@ class SeqOneByteString: public SeqString { |
| 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 |
| @@ -9430,8 +9369,7 @@ class SeqTwoByteString: public SeqString { |
| // 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 |
| @@ -9482,8 +9420,7 @@ class ConsString: public String { |
| // 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); |
| @@ -9526,8 +9463,7 @@ class SlicedString: public String { |
| // 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); |
| @@ -9559,8 +9495,7 @@ class SlicedString: public String { |
| // 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); |
| @@ -9604,8 +9539,7 @@ class ExternalAsciiString: public ExternalString { |
| // 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); |
| @@ -9644,8 +9578,7 @@ class ExternalTwoByteString: public ExternalString { |
| // 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); |
| @@ -9810,8 +9743,7 @@ class Oddball: public HeapObject { |
| inline byte kind(); |
| inline void set_kind(byte kind); |
| - // Casting. |
| - static inline Oddball* cast(Object* obj); |
| + DECLARE_CAST(Oddball) |
| // Dispatched behavior. |
| DECLARE_VERIFIER(Oddball) |
| @@ -9858,8 +9790,7 @@ class Cell: public HeapObject { |
| // [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); |
| @@ -9913,8 +9844,7 @@ class PropertyCell: public Cell { |
| static void AddDependentCompilationInfo(Handle<PropertyCell> cell, |
| CompilationInfo* info); |
| - // Casting. |
| - static inline PropertyCell* cast(Object* obj); |
| + DECLARE_CAST(PropertyCell) |
| inline Address TypeAddress() { |
| return address() + kTypeOffset; |
| @@ -9951,8 +9881,7 @@ class JSProxy: public JSReceiver { |
| // [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, |
| @@ -10067,8 +9996,7 @@ class JSFunctionProxy: public JSProxy { |
| // [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) |
| @@ -10098,8 +10026,7 @@ class JSSet: public JSObject { |
| // [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) |
| @@ -10119,8 +10046,7 @@ class JSMap: public JSObject { |
| // [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) |
| @@ -10194,8 +10120,7 @@ class JSSetIterator: public OrderedHashTableIterator<JSSetIterator, |
| DECLARE_PRINTER(JSSetIterator) |
| DECLARE_VERIFIER(JSSetIterator) |
| - // Casting. |
| - static inline JSSetIterator* cast(Object* obj); |
| + DECLARE_CAST(JSSetIterator) |
| static Handle<Object> ValueForKind( |
| Handle<JSSetIterator> iterator, |
| @@ -10213,8 +10138,7 @@ class JSMapIterator: public OrderedHashTableIterator<JSMapIterator, |
| DECLARE_PRINTER(JSMapIterator) |
| DECLARE_VERIFIER(JSMapIterator) |
| - // Casting. |
| - static inline JSMapIterator* cast(Object* obj); |
| + DECLARE_CAST(JSMapIterator) |
| static Handle<Object> ValueForKind( |
| Handle<JSMapIterator> iterator, |
| @@ -10246,8 +10170,7 @@ class JSWeakCollection: public JSObject { |
| // 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) |
| @@ -10261,8 +10184,7 @@ class JSWeakMap: public JSWeakCollection { |
| // 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) |
| @@ -10296,8 +10218,7 @@ class JSArrayBuffer: public JSObject { |
| // [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(); |
| @@ -10339,8 +10260,7 @@ class JSArrayBufferView: public JSObject { |
| // [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) |
| @@ -10366,8 +10286,7 @@ class JSTypedArray: public 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(); |
| @@ -10397,8 +10316,7 @@ class JSDataView: public JSArrayBufferView { |
| // Only neuters this DataView |
| void Neuter(); |
| - // Casting. |
| - static inline JSDataView* cast(Object* obj); |
| + DECLARE_CAST(JSDataView) |
| // Dispatched behavior. |
| DECLARE_PRINTER(JSDataView) |
| @@ -10423,8 +10341,7 @@ class Foreign: public HeapObject { |
| 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); |
| @@ -10486,8 +10403,7 @@ class JSArray: public JSObject { |
| 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. |
| @@ -10557,7 +10473,7 @@ class AccessorInfo: public Struct { |
| // 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) |
| @@ -10655,7 +10571,7 @@ class DeclaredAccessorDescriptor: public Struct { |
| public: |
| DECL_ACCESSORS(serialized_data, ByteArray) |
| - static inline DeclaredAccessorDescriptor* cast(Object* obj); |
| + DECLARE_CAST(DeclaredAccessorDescriptor) |
| static Handle<DeclaredAccessorDescriptor> Create( |
| Isolate* isolate, |
| @@ -10678,7 +10594,7 @@ class DeclaredAccessorInfo: public AccessorInfo { |
| public: |
| DECL_ACCESSORS(descriptor, DeclaredAccessorDescriptor) |
| - static inline DeclaredAccessorInfo* cast(Object* obj); |
| + DECLARE_CAST(DeclaredAccessorInfo) |
| // Dispatched behavior. |
| DECLARE_PRINTER(DeclaredAccessorInfo) |
| @@ -10707,7 +10623,7 @@ class ExecutableAccessorInfo: public AccessorInfo { |
| DECL_ACCESSORS(setter, Object) |
| DECL_ACCESSORS(data, Object) |
| - static inline ExecutableAccessorInfo* cast(Object* obj); |
| + DECLARE_CAST(ExecutableAccessorInfo) |
| // Dispatched behavior. |
| DECLARE_PRINTER(ExecutableAccessorInfo) |
| @@ -10743,7 +10659,7 @@ class AccessorPair: public Struct { |
| 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); |
| @@ -10804,7 +10720,7 @@ class AccessCheckInfo: public Struct { |
| DECL_ACCESSORS(indexed_callback, Object) |
| DECL_ACCESSORS(data, Object) |
| - static inline AccessCheckInfo* cast(Object* obj); |
| + DECLARE_CAST(AccessCheckInfo) |
| // Dispatched behavior. |
| DECLARE_PRINTER(AccessCheckInfo) |
| @@ -10829,7 +10745,7 @@ class InterceptorInfo: public Struct { |
| DECL_ACCESSORS(enumerator, Object) |
| DECL_ACCESSORS(data, Object) |
| - static inline InterceptorInfo* cast(Object* obj); |
| + DECLARE_CAST(InterceptorInfo) |
| // Dispatched behavior. |
| DECLARE_PRINTER(InterceptorInfo) |
| @@ -10853,7 +10769,7 @@ class CallHandlerInfo: public Struct { |
| DECL_ACCESSORS(callback, Object) |
| DECL_ACCESSORS(data, Object) |
| - static inline CallHandlerInfo* cast(Object* obj); |
| + DECLARE_CAST(CallHandlerInfo) |
| // Dispatched behavior. |
| DECLARE_PRINTER(CallHandlerInfo) |
| @@ -10915,7 +10831,7 @@ class FunctionTemplateInfo: public TemplateInfo { |
| 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) |
| @@ -10964,7 +10880,7 @@ class ObjectTemplateInfo: public TemplateInfo { |
| DECL_ACCESSORS(constructor, Object) |
| DECL_ACCESSORS(internal_field_count, Object) |
| - static inline ObjectTemplateInfo* cast(Object* obj); |
| + DECLARE_CAST(ObjectTemplateInfo) |
| // Dispatched behavior. |
| DECLARE_PRINTER(ObjectTemplateInfo) |
| @@ -10982,7 +10898,7 @@ class SignatureInfo: public Struct { |
| DECL_ACCESSORS(receiver, Object) |
| DECL_ACCESSORS(args, Object) |
| - static inline SignatureInfo* cast(Object* obj); |
| + DECLARE_CAST(SignatureInfo) |
| // Dispatched behavior. |
| DECLARE_PRINTER(SignatureInfo) |
| @@ -11001,7 +10917,7 @@ class TypeSwitchInfo: public Struct { |
| public: |
| DECL_ACCESSORS(types, Object) |
| - static inline TypeSwitchInfo* cast(Object* obj); |
| + DECLARE_CAST(TypeSwitchInfo) |
| // Dispatched behavior. |
| DECLARE_PRINTER(TypeSwitchInfo) |
| @@ -11046,7 +10962,7 @@ class DebugInfo: public Struct { |
| // 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) |
| @@ -11100,7 +11016,7 @@ class BreakPointInfo: public Struct { |
| // 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) |
| @@ -11121,6 +11037,7 @@ class BreakPointInfo: public Struct { |
| #undef DECL_BOOLEAN_ACCESSORS |
| #undef DECL_ACCESSORS |
| +#undef DECLARE_CAST |
| #undef DECLARE_VERIFIER |
| #define VISITOR_SYNCHRONIZATION_TAGS_LIST(V) \ |