Chromium Code Reviews| Index: src/objects.h |
| diff --git a/src/objects.h b/src/objects.h |
| index 756631068e719d0345e1889f9b2f63ff367237e8..90f368d389f19bf4a057cc4cddb63a7ad3d622e8 100644 |
| --- a/src/objects.h |
| +++ b/src/objects.h |
| @@ -348,6 +348,7 @@ const int kStubMinorKeyBits = kBitsPerInt - kSmiTagSize - kStubMajorKeyBits; |
| V(MAP_TYPE) \ |
| V(CODE_TYPE) \ |
| V(ODDBALL_TYPE) \ |
| + V(CELL_TYPE) \ |
|
Michael Starzinger
2013/06/12 13:23:25
Can we add the "Cell" type to the type hierarchy A
danno
2013/06/12 14:24:28
Done.
|
| V(JS_GLOBAL_PROPERTY_CELL_TYPE) \ |
| V(BOX_TYPE) \ |
| \ |
| @@ -669,6 +670,7 @@ enum InstanceType { |
| MAP_TYPE, |
| CODE_TYPE, |
| ODDBALL_TYPE, |
| + CELL_TYPE, |
| JS_GLOBAL_PROPERTY_CELL_TYPE, |
| BOX_TYPE, |
| @@ -841,6 +843,7 @@ class Failure; |
| class FixedArrayBase; |
| class ObjectVisitor; |
| class StringStream; |
| +class Type; |
| struct ValueInfo : public Malloced { |
| ValueInfo() : type(FIRST_TYPE), ptr(NULL), str(NULL), number(0) { } |
| @@ -1011,6 +1014,7 @@ class MaybeObject BASE_EMBEDDED { |
| V(JSGlobalProxy) \ |
| V(UndetectableObject) \ |
| V(AccessCheckNeeded) \ |
| + V(Cell) \ |
| V(JSGlobalPropertyCell) \ |
| V(ObjectHashTable) \ |
| @@ -4378,6 +4382,7 @@ class DeoptimizationOutputData: public FixedArray { |
| // Forward declaration. |
| +class Cell; |
| class JSGlobalPropertyCell; |
| // TypeFeedbackCells is a fixed array used to hold the association between |
| @@ -4395,8 +4400,8 @@ class TypeFeedbackCells: public FixedArray { |
| inline void SetAstId(int index, TypeFeedbackId id); |
| // Accessors for global property cells holding the cache values. |
| - inline JSGlobalPropertyCell* Cell(int index); |
| - inline void SetCell(int index, JSGlobalPropertyCell* cell); |
| + inline Cell* GetCell(int index); |
| + inline void SetCell(int index, Cell* cell); |
| // The object that indicates an uninitialized cache. |
| static inline Handle<Object> UninitializedSentinel(Isolate* isolate); |
| @@ -5403,7 +5408,7 @@ class Map: public HeapObject { |
| set_bit_field3(NumberOfOwnDescriptorsBits::update(bit_field3(), number)); |
| } |
| - inline JSGlobalPropertyCell* RetrieveDescriptorsPointer(); |
| + inline Cell* RetrieveDescriptorsPointer(); |
| int EnumLength() { |
| return EnumLengthBits::decode(bit_field3()); |
| @@ -8557,16 +8562,17 @@ class Oddball: public HeapObject { |
| }; |
| -class JSGlobalPropertyCell: public HeapObject { |
| +class Cell: public HeapObject { |
| public: |
| - // [value]: value of the global property. |
|
Michael Starzinger
2013/06/12 13:23:25
I actually like the comment lines and sometimes gr
danno
2013/06/12 14:24:28
Done.
|
| DECL_ACCESSORS(value, Object) |
| // Casting. |
| - static inline JSGlobalPropertyCell* cast(Object* obj); |
| + static inline Cell* cast(Object* obj); |
| - static inline JSGlobalPropertyCell* FromValueAddress(Address value) { |
| - return cast(FromAddress(value - kValueOffset)); |
| + static inline Cell* FromValueAddress(Address value) { |
| + Object* result = FromAddress(value - kValueOffset); |
| + ASSERT(result->IsCell() || result->IsJSGlobalPropertyCell()); |
| + return static_cast<Cell*>(result); |
| } |
| inline Address ValueAddress() { |
| @@ -8574,8 +8580,8 @@ class JSGlobalPropertyCell: public HeapObject { |
| } |
| // Dispatched behavior. |
| - DECLARE_PRINTER(JSGlobalPropertyCell) |
| - DECLARE_VERIFIER(JSGlobalPropertyCell) |
| + DECLARE_PRINTER(Cell) |
| + DECLARE_VERIFIER(Cell) |
| // Layout description. |
| static const int kValueOffset = HeapObject::kHeaderSize; |
| @@ -8586,6 +8592,37 @@ class JSGlobalPropertyCell: public HeapObject { |
| kSize> BodyDescriptor; |
| private: |
| + DISALLOW_IMPLICIT_CONSTRUCTORS(Cell); |
| +}; |
| + |
| + |
| +class JSGlobalPropertyCell: public Cell { |
| + public: |
| + Type* type(); |
| + void set_type(Type* value, WriteBarrierMode mode = UPDATE_WRITE_BARRIER); |
|
Michael Starzinger
2013/06/12 13:23:25
Can we use the DECL_ACCESSORS macro to declare thi
danno
2013/06/12 14:24:28
No, unfortunately not. Note that they are not inli
|
| + |
| + // Casting. |
| + static inline JSGlobalPropertyCell* cast(Object* obj); |
| + |
| + inline Address TypeAddress() { |
| + return address() + kTypeOffset; |
| + } |
| + |
| + // Dispatched behavior. |
| + DECLARE_PRINTER(JSGlobalPropertyCell) |
| + DECLARE_VERIFIER(JSGlobalPropertyCell) |
| + |
| + // Layout description. |
| + static const int kTypeOffset = kValueOffset + kPointerSize; |
| + static const int kSize = kTypeOffset + kPointerSize; |
| + |
| + typedef FixedBodyDescriptor< |
| + kValueOffset, |
|
Michael Starzinger
2013/06/12 13:23:25
nit: Should fit into three lines if we remove the
danno
2013/06/12 14:24:28
Done.
|
| + kTypeOffset + kPointerSize, |
| + JSGlobalPropertyCell::kSize> BodyDescriptor; |
| + |
| + private: |
| + DECL_ACCESSORS(type_raw, Object) |
| DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalPropertyCell); |
| }; |