OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1804 public: | 1804 public: |
1805 // [map]: Contains a map which contains the object's reflective | 1805 // [map]: Contains a map which contains the object's reflective |
1806 // information. | 1806 // information. |
1807 inline Map* map(); | 1807 inline Map* map(); |
1808 inline void set_map(Map* value); | 1808 inline void set_map(Map* value); |
1809 // The no-write-barrier version. This is OK if the object is white and in | 1809 // The no-write-barrier version. This is OK if the object is white and in |
1810 // new space, or if the value is an immortal immutable object, like the maps | 1810 // new space, or if the value is an immortal immutable object, like the maps |
1811 // of primitive (non-JS) objects like strings, heap numbers etc. | 1811 // of primitive (non-JS) objects like strings, heap numbers etc. |
1812 inline void set_map_no_write_barrier(Map* value); | 1812 inline void set_map_no_write_barrier(Map* value); |
1813 | 1813 |
1814 // Get the map using acquire load. | |
Hannes Payer (out of office)
2014/03/31 09:42:27
We could templetize the getters and setters. I thi
| |
1815 inline Map* synchronized_map(); | |
1816 inline MapWord synchronized_map_word(); | |
1817 | |
1818 // Set the map using release store | |
1819 inline void synchronized_set_map(Map* value); | |
1820 inline void synchronized_set_map_word(MapWord map_word); | |
1821 | |
1822 // Get the map using no barrier load. | |
1823 inline Map* no_barrier_map(); | |
1824 inline MapWord no_barrier_map_word(); | |
1825 | |
1826 // Set the map using no barrier store store | |
1827 inline void no_barrier_set_map(Map* value); | |
1828 inline void no_barrier_set_map_word(MapWord map_word); | |
1829 | |
1814 // During garbage collection, the map word of a heap object does not | 1830 // During garbage collection, the map word of a heap object does not |
1815 // necessarily contain a map pointer. | 1831 // necessarily contain a map pointer. |
1816 inline MapWord map_word(); | 1832 inline MapWord map_word(); |
1817 inline void set_map_word(MapWord map_word); | 1833 inline void set_map_word(MapWord map_word); |
1818 | 1834 |
1835 | |
1819 // The Heap the object was allocated in. Used also to access Isolate. | 1836 // The Heap the object was allocated in. Used also to access Isolate. |
1820 inline Heap* GetHeap(); | 1837 inline Heap* GetHeap(); |
1821 | 1838 |
1822 // Convenience method to get current isolate. | 1839 // Convenience method to get current isolate. |
1823 inline Isolate* GetIsolate(); | 1840 inline Isolate* GetIsolate(); |
1824 | 1841 |
1825 // Converts an address to a HeapObject pointer. | 1842 // Converts an address to a HeapObject pointer. |
1826 static inline HeapObject* FromAddress(Address address); | 1843 static inline HeapObject* FromAddress(Address address); |
1827 | 1844 |
1828 // Returns the address of this HeapObject. | 1845 // Returns the address of this HeapObject. |
(...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2988 | 3005 |
2989 | 3006 |
2990 // Common superclass for FixedArrays that allow implementations to share | 3007 // Common superclass for FixedArrays that allow implementations to share |
2991 // common accessors and some code paths. | 3008 // common accessors and some code paths. |
2992 class FixedArrayBase: public HeapObject { | 3009 class FixedArrayBase: public HeapObject { |
2993 public: | 3010 public: |
2994 // [length]: length of the array. | 3011 // [length]: length of the array. |
2995 inline int length(); | 3012 inline int length(); |
2996 inline void set_length(int value); | 3013 inline void set_length(int value); |
2997 | 3014 |
3015 // Get and set the length using acquire loads and release stores. | |
3016 inline int synchronized_length(); | |
3017 inline void synchronized_set_length(int value); | |
3018 | |
3019 | |
2998 inline static FixedArrayBase* cast(Object* object); | 3020 inline static FixedArrayBase* cast(Object* object); |
2999 | 3021 |
3000 // Layout description. | 3022 // Layout description. |
3001 // Length is smi tagged when it is stored. | 3023 // Length is smi tagged when it is stored. |
3002 static const int kLengthOffset = HeapObject::kHeaderSize; | 3024 static const int kLengthOffset = HeapObject::kHeaderSize; |
3003 static const int kHeaderSize = kLengthOffset + kPointerSize; | 3025 static const int kHeaderSize = kLengthOffset + kPointerSize; |
3004 }; | 3026 }; |
3005 | 3027 |
3006 | 3028 |
3007 class FixedDoubleArray; | 3029 class FixedDoubleArray; |
(...skipping 5742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8750 Vector<const uint8_t> buffer_; | 8772 Vector<const uint8_t> buffer_; |
8751 State state_; | 8773 State state_; |
8752 | 8774 |
8753 friend class String; | 8775 friend class String; |
8754 }; | 8776 }; |
8755 | 8777 |
8756 // Get and set the length of the string. | 8778 // Get and set the length of the string. |
8757 inline int length(); | 8779 inline int length(); |
8758 inline void set_length(int value); | 8780 inline void set_length(int value); |
8759 | 8781 |
8782 // Get and set the length of the string using acquire loads and release | |
8783 // stores. | |
8784 inline int synchronized_length(); | |
8785 inline void synchronized_set_length(int value); | |
8786 | |
8760 // Returns whether this string has only ASCII chars, i.e. all of them can | 8787 // Returns whether this string has only ASCII chars, i.e. all of them can |
8761 // be ASCII encoded. This might be the case even if the string is | 8788 // be ASCII encoded. This might be the case even if the string is |
8762 // two-byte. Such strings may appear when the embedder prefers | 8789 // two-byte. Such strings may appear when the embedder prefers |
8763 // two-byte external representations even for ASCII data. | 8790 // two-byte external representations even for ASCII data. |
8764 inline bool IsOneByteRepresentation(); | 8791 inline bool IsOneByteRepresentation(); |
8765 inline bool IsTwoByteRepresentation(); | 8792 inline bool IsTwoByteRepresentation(); |
8766 | 8793 |
8767 // Cons and slices have an encoding flag that may not represent the actual | 8794 // Cons and slices have an encoding flag that may not represent the actual |
8768 // encoding of the underlying string. This is taken into account here. | 8795 // encoding of the underlying string. This is taken into account here. |
8769 // Requires: this->IsFlat() | 8796 // Requires: this->IsFlat() |
(...skipping 2016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10786 } else { | 10813 } else { |
10787 value &= ~(1 << bit_position); | 10814 value &= ~(1 << bit_position); |
10788 } | 10815 } |
10789 return value; | 10816 return value; |
10790 } | 10817 } |
10791 }; | 10818 }; |
10792 | 10819 |
10793 } } // namespace v8::internal | 10820 } } // namespace v8::internal |
10794 | 10821 |
10795 #endif // V8_OBJECTS_H_ | 10822 #endif // V8_OBJECTS_H_ |
OLD | NEW |