| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 inline bool IsInstanceOf(FunctionTemplateInfo* type); | 727 inline bool IsInstanceOf(FunctionTemplateInfo* type); |
| 728 | 728 |
| 729 inline bool IsStruct(); | 729 inline bool IsStruct(); |
| 730 #define DECLARE_STRUCT_PREDICATE(NAME, Name, name) inline bool Is##Name(); | 730 #define DECLARE_STRUCT_PREDICATE(NAME, Name, name) inline bool Is##Name(); |
| 731 STRUCT_LIST(DECLARE_STRUCT_PREDICATE) | 731 STRUCT_LIST(DECLARE_STRUCT_PREDICATE) |
| 732 #undef DECLARE_STRUCT_PREDICATE | 732 #undef DECLARE_STRUCT_PREDICATE |
| 733 | 733 |
| 734 // Oddball testing. | 734 // Oddball testing. |
| 735 INLINE(bool IsUndefined()); | 735 INLINE(bool IsUndefined()); |
| 736 INLINE(bool IsNull()); | 736 INLINE(bool IsNull()); |
| 737 INLINE(bool IsTheHole()); // Shadows MaybeObject's implementation. |
| 737 INLINE(bool IsTrue()); | 738 INLINE(bool IsTrue()); |
| 738 INLINE(bool IsFalse()); | 739 INLINE(bool IsFalse()); |
| 739 inline bool IsArgumentsMarker(); | 740 inline bool IsArgumentsMarker(); |
| 740 inline bool NonFailureIsHeapObject(); | 741 inline bool NonFailureIsHeapObject(); |
| 741 | 742 |
| 742 // Filler objects (fillers and free space objects). | 743 // Filler objects (fillers and free space objects). |
| 743 inline bool IsFiller(); | 744 inline bool IsFiller(); |
| 744 | 745 |
| 745 // Extract the number. | 746 // Extract the number. |
| 746 inline double Number(); | 747 inline double Number(); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 887 // Failure type tag info. | 888 // Failure type tag info. |
| 888 const int kFailureTypeTagSize = 2; | 889 const int kFailureTypeTagSize = 2; |
| 889 const int kFailureTypeTagMask = (1 << kFailureTypeTagSize) - 1; | 890 const int kFailureTypeTagMask = (1 << kFailureTypeTagSize) - 1; |
| 890 | 891 |
| 891 class Failure: public MaybeObject { | 892 class Failure: public MaybeObject { |
| 892 public: | 893 public: |
| 893 // RuntimeStubs assumes EXCEPTION = 1 in the compiler-generated code. | 894 // RuntimeStubs assumes EXCEPTION = 1 in the compiler-generated code. |
| 894 enum Type { | 895 enum Type { |
| 895 RETRY_AFTER_GC = 0, | 896 RETRY_AFTER_GC = 0, |
| 896 EXCEPTION = 1, // Returning this marker tells the real exception | 897 EXCEPTION = 1, // Returning this marker tells the real exception |
| 897 // is in Top::pending_exception. | 898 // is in Isolate::pending_exception. |
| 898 INTERNAL_ERROR = 2, | 899 INTERNAL_ERROR = 2, |
| 899 OUT_OF_MEMORY_EXCEPTION = 3 | 900 OUT_OF_MEMORY_EXCEPTION = 3 |
| 900 }; | 901 }; |
| 901 | 902 |
| 902 inline Type type() const; | 903 inline Type type() const; |
| 903 | 904 |
| 904 // Returns the space that needs to be collected for RetryAfterGC failures. | 905 // Returns the space that needs to be collected for RetryAfterGC failures. |
| 905 inline AllocationSpace allocation_space() const; | 906 inline AllocationSpace allocation_space() const; |
| 906 | 907 |
| 907 inline bool IsInternalError() const; | 908 inline bool IsInternalError() const; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 // [map]: Contains a map which contains the object's reflective | 988 // [map]: Contains a map which contains the object's reflective |
| 988 // information. | 989 // information. |
| 989 inline Map* map(); | 990 inline Map* map(); |
| 990 inline void set_map(Map* value); | 991 inline void set_map(Map* value); |
| 991 | 992 |
| 992 // During garbage collection, the map word of a heap object does not | 993 // During garbage collection, the map word of a heap object does not |
| 993 // necessarily contain a map pointer. | 994 // necessarily contain a map pointer. |
| 994 inline MapWord map_word(); | 995 inline MapWord map_word(); |
| 995 inline void set_map_word(MapWord map_word); | 996 inline void set_map_word(MapWord map_word); |
| 996 | 997 |
| 998 // The Heap the object was allocated in. Used also to access Isolate. |
| 999 // This method can not be used during GC, it ASSERTs this. |
| 1000 inline Heap* GetHeap(); |
| 1001 // Convenience method to get current isolate. This method can be |
| 1002 // accessed only when its result is the same as |
| 1003 // Isolate::Current(), it ASSERTs this. See also comment for GetHeap. |
| 1004 inline Isolate* GetIsolate(); |
| 1005 |
| 997 // Converts an address to a HeapObject pointer. | 1006 // Converts an address to a HeapObject pointer. |
| 998 static inline HeapObject* FromAddress(Address address); | 1007 static inline HeapObject* FromAddress(Address address); |
| 999 | 1008 |
| 1000 // Returns the address of this HeapObject. | 1009 // Returns the address of this HeapObject. |
| 1001 inline Address address(); | 1010 inline Address address(); |
| 1002 | 1011 |
| 1003 // Iterates over pointers contained in the object (including the Map) | 1012 // Iterates over pointers contained in the object (including the Map) |
| 1004 void Iterate(ObjectVisitor* v); | 1013 void Iterate(ObjectVisitor* v); |
| 1005 | 1014 |
| 1006 // Iterates over all pointers contained in the object except the | 1015 // Iterates over all pointers contained in the object except the |
| (...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1795 // Setter that uses write barrier. | 1804 // Setter that uses write barrier. |
| 1796 inline void set(int index, Object* value); | 1805 inline void set(int index, Object* value); |
| 1797 | 1806 |
| 1798 // Setter that doesn't need write barrier). | 1807 // Setter that doesn't need write barrier). |
| 1799 inline void set(int index, Smi* value); | 1808 inline void set(int index, Smi* value); |
| 1800 // Setter with explicit barrier mode. | 1809 // Setter with explicit barrier mode. |
| 1801 inline void set(int index, Object* value, WriteBarrierMode mode); | 1810 inline void set(int index, Object* value, WriteBarrierMode mode); |
| 1802 | 1811 |
| 1803 // Setters for frequently used oddballs located in old space. | 1812 // Setters for frequently used oddballs located in old space. |
| 1804 inline void set_undefined(int index); | 1813 inline void set_undefined(int index); |
| 1814 // TODO(isolates): duplicate. |
| 1815 inline void set_undefined(Heap* heap, int index); |
| 1805 inline void set_null(int index); | 1816 inline void set_null(int index); |
| 1817 // TODO(isolates): duplicate. |
| 1818 inline void set_null(Heap* heap, int index); |
| 1806 inline void set_the_hole(int index); | 1819 inline void set_the_hole(int index); |
| 1807 | 1820 |
| 1808 // Setters with less debug checks for the GC to use. | 1821 // Setters with less debug checks for the GC to use. |
| 1809 inline void set_unchecked(int index, Smi* value); | 1822 inline void set_unchecked(int index, Smi* value); |
| 1810 inline void set_null_unchecked(int index); | 1823 inline void set_null_unchecked(Heap* heap, int index); |
| 1811 inline void set_unchecked(int index, Object* value, WriteBarrierMode mode); | 1824 inline void set_unchecked(Heap* heap, int index, Object* value, |
| 1825 WriteBarrierMode mode); |
| 1812 | 1826 |
| 1813 // Gives access to raw memory which stores the array's data. | 1827 // Gives access to raw memory which stores the array's data. |
| 1814 inline Object** data_start(); | 1828 inline Object** data_start(); |
| 1815 | 1829 |
| 1816 // Copy operations. | 1830 // Copy operations. |
| 1817 MUST_USE_RESULT inline MaybeObject* Copy(); | 1831 MUST_USE_RESULT inline MaybeObject* Copy(); |
| 1818 MUST_USE_RESULT MaybeObject* CopySize(int new_length); | 1832 MUST_USE_RESULT MaybeObject* CopySize(int new_length); |
| 1819 | 1833 |
| 1820 // Add the elements of a JSArray to this FixedArray. | 1834 // Add the elements of a JSArray to this FixedArray. |
| 1821 MUST_USE_RESULT MaybeObject* AddKeysFromJSArray(JSArray* array); | 1835 MUST_USE_RESULT MaybeObject* AddKeysFromJSArray(JSArray* array); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1896 // [2]: first key | 1910 // [2]: first key |
| 1897 // [length() - 1]: last key | 1911 // [length() - 1]: last key |
| 1898 // | 1912 // |
| 1899 class DescriptorArray: public FixedArray { | 1913 class DescriptorArray: public FixedArray { |
| 1900 public: | 1914 public: |
| 1901 // Is this the singleton empty_descriptor_array? | 1915 // Is this the singleton empty_descriptor_array? |
| 1902 inline bool IsEmpty(); | 1916 inline bool IsEmpty(); |
| 1903 | 1917 |
| 1904 // Returns the number of descriptors in the array. | 1918 // Returns the number of descriptors in the array. |
| 1905 int number_of_descriptors() { | 1919 int number_of_descriptors() { |
| 1906 return IsEmpty() ? 0 : length() - kFirstIndex; | 1920 ASSERT(length() > kFirstIndex || IsEmpty()); |
| 1921 int len = length(); |
| 1922 return len <= kFirstIndex ? 0 : len - kFirstIndex; |
| 1907 } | 1923 } |
| 1908 | 1924 |
| 1909 int NextEnumerationIndex() { | 1925 int NextEnumerationIndex() { |
| 1910 if (IsEmpty()) return PropertyDetails::kInitialIndex; | 1926 if (IsEmpty()) return PropertyDetails::kInitialIndex; |
| 1911 Object* obj = get(kEnumerationIndexIndex); | 1927 Object* obj = get(kEnumerationIndexIndex); |
| 1912 if (obj->IsSmi()) { | 1928 if (obj->IsSmi()) { |
| 1913 return Smi::cast(obj)->value(); | 1929 return Smi::cast(obj)->value(); |
| 1914 } else { | 1930 } else { |
| 1915 Object* index = FixedArray::cast(obj)->get(kEnumCacheBridgeEnumIndex); | 1931 Object* index = FixedArray::cast(obj)->get(kEnumCacheBridgeEnumIndex); |
| 1916 return Smi::cast(index)->value(); | 1932 return Smi::cast(index)->value(); |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2188 // Constant used for denoting a absent entry. | 2204 // Constant used for denoting a absent entry. |
| 2189 static const int kNotFound = -1; | 2205 static const int kNotFound = -1; |
| 2190 | 2206 |
| 2191 // Maximal capacity of HashTable. Based on maximal length of underlying | 2207 // Maximal capacity of HashTable. Based on maximal length of underlying |
| 2192 // FixedArray. Staying below kMaxCapacity also ensures that EntryToIndex | 2208 // FixedArray. Staying below kMaxCapacity also ensures that EntryToIndex |
| 2193 // cannot overflow. | 2209 // cannot overflow. |
| 2194 static const int kMaxCapacity = | 2210 static const int kMaxCapacity = |
| 2195 (FixedArray::kMaxLength - kElementsStartOffset) / kEntrySize; | 2211 (FixedArray::kMaxLength - kElementsStartOffset) / kEntrySize; |
| 2196 | 2212 |
| 2197 // Find entry for key otherwise return kNotFound. | 2213 // Find entry for key otherwise return kNotFound. |
| 2198 int FindEntry(Key key); | 2214 inline int FindEntry(Key key); |
| 2215 int FindEntry(Isolate* isolate, Key key); |
| 2199 | 2216 |
| 2200 protected: | 2217 protected: |
| 2201 | 2218 |
| 2202 // Find the entry at which to insert element with the given key that | 2219 // Find the entry at which to insert element with the given key that |
| 2203 // has the given hash value. | 2220 // has the given hash value. |
| 2204 uint32_t FindInsertionEntry(uint32_t hash); | 2221 uint32_t FindInsertionEntry(uint32_t hash); |
| 2205 | 2222 |
| 2206 // Returns the index for an entry (of the key) | 2223 // Returns the index for an entry (of the key) |
| 2207 static inline int EntryToIndex(int entry) { | 2224 static inline int EntryToIndex(int entry) { |
| 2208 return (entry * kEntrySize) + kElementsStartIndex; | 2225 return (entry * kEntrySize) + kElementsStartIndex; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2260 virtual uint32_t HashForObject(Object* key) = 0; | 2277 virtual uint32_t HashForObject(Object* key) = 0; |
| 2261 // Returns the key object for storing into the hash table. | 2278 // Returns the key object for storing into the hash table. |
| 2262 // If allocations fails a failure object is returned. | 2279 // If allocations fails a failure object is returned. |
| 2263 MUST_USE_RESULT virtual MaybeObject* AsObject() = 0; | 2280 MUST_USE_RESULT virtual MaybeObject* AsObject() = 0; |
| 2264 // Required. | 2281 // Required. |
| 2265 virtual ~HashTableKey() {} | 2282 virtual ~HashTableKey() {} |
| 2266 }; | 2283 }; |
| 2267 | 2284 |
| 2268 class SymbolTableShape { | 2285 class SymbolTableShape { |
| 2269 public: | 2286 public: |
| 2270 static bool IsMatch(HashTableKey* key, Object* value) { | 2287 static inline bool IsMatch(HashTableKey* key, Object* value) { |
| 2271 return key->IsMatch(value); | 2288 return key->IsMatch(value); |
| 2272 } | 2289 } |
| 2273 static uint32_t Hash(HashTableKey* key) { | 2290 static inline uint32_t Hash(HashTableKey* key) { |
| 2274 return key->Hash(); | 2291 return key->Hash(); |
| 2275 } | 2292 } |
| 2276 static uint32_t HashForObject(HashTableKey* key, Object* object) { | 2293 static inline uint32_t HashForObject(HashTableKey* key, Object* object) { |
| 2277 return key->HashForObject(object); | 2294 return key->HashForObject(object); |
| 2278 } | 2295 } |
| 2279 MUST_USE_RESULT static MaybeObject* AsObject(HashTableKey* key) { | 2296 MUST_USE_RESULT static inline MaybeObject* AsObject(HashTableKey* key) { |
| 2280 return key->AsObject(); | 2297 return key->AsObject(); |
| 2281 } | 2298 } |
| 2282 | 2299 |
| 2283 static const int kPrefixSize = 0; | 2300 static const int kPrefixSize = 0; |
| 2284 static const int kEntrySize = 1; | 2301 static const int kEntrySize = 1; |
| 2285 }; | 2302 }; |
| 2286 | 2303 |
| 2287 // SymbolTable. | 2304 // SymbolTable. |
| 2288 // | 2305 // |
| 2289 // No special elements in the prefix and the element size is 1 | 2306 // No special elements in the prefix and the element size is 1 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 2312 | 2329 |
| 2313 private: | 2330 private: |
| 2314 MUST_USE_RESULT MaybeObject* LookupKey(HashTableKey* key, Object** s); | 2331 MUST_USE_RESULT MaybeObject* LookupKey(HashTableKey* key, Object** s); |
| 2315 | 2332 |
| 2316 DISALLOW_IMPLICIT_CONSTRUCTORS(SymbolTable); | 2333 DISALLOW_IMPLICIT_CONSTRUCTORS(SymbolTable); |
| 2317 }; | 2334 }; |
| 2318 | 2335 |
| 2319 | 2336 |
| 2320 class MapCacheShape { | 2337 class MapCacheShape { |
| 2321 public: | 2338 public: |
| 2322 static bool IsMatch(HashTableKey* key, Object* value) { | 2339 static inline bool IsMatch(HashTableKey* key, Object* value) { |
| 2323 return key->IsMatch(value); | 2340 return key->IsMatch(value); |
| 2324 } | 2341 } |
| 2325 static uint32_t Hash(HashTableKey* key) { | 2342 static inline uint32_t Hash(HashTableKey* key) { |
| 2326 return key->Hash(); | 2343 return key->Hash(); |
| 2327 } | 2344 } |
| 2328 | 2345 |
| 2329 static uint32_t HashForObject(HashTableKey* key, Object* object) { | 2346 static inline uint32_t HashForObject(HashTableKey* key, Object* object) { |
| 2330 return key->HashForObject(object); | 2347 return key->HashForObject(object); |
| 2331 } | 2348 } |
| 2332 | 2349 |
| 2333 MUST_USE_RESULT static MaybeObject* AsObject(HashTableKey* key) { | 2350 MUST_USE_RESULT static inline MaybeObject* AsObject(HashTableKey* key) { |
| 2334 return key->AsObject(); | 2351 return key->AsObject(); |
| 2335 } | 2352 } |
| 2336 | 2353 |
| 2337 static const int kPrefixSize = 0; | 2354 static const int kPrefixSize = 0; |
| 2338 static const int kEntrySize = 2; | 2355 static const int kEntrySize = 2; |
| 2339 }; | 2356 }; |
| 2340 | 2357 |
| 2341 | 2358 |
| 2342 // MapCache. | 2359 // MapCache. |
| 2343 // | 2360 // |
| (...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3372 int SourceStatementPosition(Address pc); | 3389 int SourceStatementPosition(Address pc); |
| 3373 | 3390 |
| 3374 // Casting. | 3391 // Casting. |
| 3375 static inline Code* cast(Object* obj); | 3392 static inline Code* cast(Object* obj); |
| 3376 | 3393 |
| 3377 // Dispatched behavior. | 3394 // Dispatched behavior. |
| 3378 int CodeSize() { return SizeFor(body_size()); } | 3395 int CodeSize() { return SizeFor(body_size()); } |
| 3379 inline void CodeIterateBody(ObjectVisitor* v); | 3396 inline void CodeIterateBody(ObjectVisitor* v); |
| 3380 | 3397 |
| 3381 template<typename StaticVisitor> | 3398 template<typename StaticVisitor> |
| 3382 inline void CodeIterateBody(); | 3399 inline void CodeIterateBody(Heap* heap); |
| 3383 #ifdef OBJECT_PRINT | 3400 #ifdef OBJECT_PRINT |
| 3384 inline void CodePrint() { | 3401 inline void CodePrint() { |
| 3385 CodePrint(stdout); | 3402 CodePrint(stdout); |
| 3386 } | 3403 } |
| 3387 void CodePrint(FILE* out); | 3404 void CodePrint(FILE* out); |
| 3388 #endif | 3405 #endif |
| 3389 #ifdef DEBUG | 3406 #ifdef DEBUG |
| 3390 void CodeVerify(); | 3407 void CodeVerify(); |
| 3391 #endif | 3408 #endif |
| 3392 | 3409 |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3660 | 3677 |
| 3661 // Casting. | 3678 // Casting. |
| 3662 static inline Map* cast(Object* obj); | 3679 static inline Map* cast(Object* obj); |
| 3663 | 3680 |
| 3664 // Locate an accessor in the instance descriptor. | 3681 // Locate an accessor in the instance descriptor. |
| 3665 AccessorDescriptor* FindAccessor(String* name); | 3682 AccessorDescriptor* FindAccessor(String* name); |
| 3666 | 3683 |
| 3667 // Code cache operations. | 3684 // Code cache operations. |
| 3668 | 3685 |
| 3669 // Clears the code cache. | 3686 // Clears the code cache. |
| 3670 inline void ClearCodeCache(); | 3687 inline void ClearCodeCache(Heap* heap); |
| 3671 | 3688 |
| 3672 // Update code cache. | 3689 // Update code cache. |
| 3673 MUST_USE_RESULT MaybeObject* UpdateCodeCache(String* name, Code* code); | 3690 MUST_USE_RESULT MaybeObject* UpdateCodeCache(String* name, Code* code); |
| 3674 | 3691 |
| 3675 // Returns the found code or undefined if absent. | 3692 // Returns the found code or undefined if absent. |
| 3676 Object* FindInCodeCache(String* name, Code::Flags flags); | 3693 Object* FindInCodeCache(String* name, Code::Flags flags); |
| 3677 | 3694 |
| 3678 // Returns the non-negative index of the code object if it is in the | 3695 // Returns the non-negative index of the code object if it is in the |
| 3679 // cache and -1 otherwise. | 3696 // cache and -1 otherwise. |
| 3680 int IndexInCodeCache(Object* name, Code* code); | 3697 int IndexInCodeCache(Object* name, Code* code); |
| 3681 | 3698 |
| 3682 // Removes a code object from the code cache at the given index. | 3699 // Removes a code object from the code cache at the given index. |
| 3683 void RemoveFromCodeCache(String* name, Code* code, int index); | 3700 void RemoveFromCodeCache(String* name, Code* code, int index); |
| 3684 | 3701 |
| 3685 // For every transition in this map, makes the transition's | 3702 // For every transition in this map, makes the transition's |
| 3686 // target's prototype pointer point back to this map. | 3703 // target's prototype pointer point back to this map. |
| 3687 // This is undone in MarkCompactCollector::ClearNonLiveTransitions(). | 3704 // This is undone in MarkCompactCollector::ClearNonLiveTransitions(). |
| 3688 void CreateBackPointers(); | 3705 void CreateBackPointers(); |
| 3689 | 3706 |
| 3690 // Set all map transitions from this map to dead maps to null. | 3707 // Set all map transitions from this map to dead maps to null. |
| 3691 // Also, restore the original prototype on the targets of these | 3708 // Also, restore the original prototype on the targets of these |
| 3692 // transitions, so that we do not process this map again while | 3709 // transitions, so that we do not process this map again while |
| 3693 // following back pointers. | 3710 // following back pointers. |
| 3694 void ClearNonLiveTransitions(Object* real_prototype); | 3711 void ClearNonLiveTransitions(Heap* heap, Object* real_prototype); |
| 3695 | 3712 |
| 3696 // Dispatched behavior. | 3713 // Dispatched behavior. |
| 3697 #ifdef OBJECT_PRINT | 3714 #ifdef OBJECT_PRINT |
| 3698 inline void MapPrint() { | 3715 inline void MapPrint() { |
| 3699 MapPrint(stdout); | 3716 MapPrint(stdout); |
| 3700 } | 3717 } |
| 3701 void MapPrint(FILE* out); | 3718 void MapPrint(FILE* out); |
| 3702 #endif | 3719 #endif |
| 3703 #ifdef DEBUG | 3720 #ifdef DEBUG |
| 3704 void MapVerify(); | 3721 void MapVerify(); |
| 3705 void SharedMapVerify(); | 3722 void SharedMapVerify(); |
| 3706 #endif | 3723 #endif |
| 3707 | 3724 |
| 3708 inline int visitor_id(); | 3725 inline int visitor_id(); |
| 3709 inline void set_visitor_id(int visitor_id); | 3726 inline void set_visitor_id(int visitor_id); |
| 3710 | 3727 |
| 3728 // Returns the heap this map belongs to. |
| 3729 inline Heap* heap(); |
| 3730 |
| 3711 typedef void (*TraverseCallback)(Map* map, void* data); | 3731 typedef void (*TraverseCallback)(Map* map, void* data); |
| 3712 | 3732 |
| 3713 void TraverseTransitionTree(TraverseCallback callback, void* data); | 3733 void TraverseTransitionTree(TraverseCallback callback, void* data); |
| 3714 | 3734 |
| 3715 static const int kMaxPreAllocatedPropertyFields = 255; | 3735 static const int kMaxPreAllocatedPropertyFields = 255; |
| 3716 | 3736 |
| 3717 // Layout description. | 3737 // Layout description. |
| 3718 static const int kInstanceSizesOffset = HeapObject::kHeaderSize; | 3738 static const int kInstanceSizesOffset = HeapObject::kHeaderSize; |
| 3719 static const int kInstanceAttributesOffset = kInstanceSizesOffset + kIntSize; | 3739 static const int kInstanceAttributesOffset = kInstanceSizesOffset + kIntSize; |
| 3720 static const int kPrototypeOffset = kInstanceAttributesOffset + kIntSize; | 3740 static const int kPrototypeOffset = kInstanceAttributesOffset + kIntSize; |
| (...skipping 2025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5746 private: | 5766 private: |
| 5747 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalTwoByteString); | 5767 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalTwoByteString); |
| 5748 }; | 5768 }; |
| 5749 | 5769 |
| 5750 | 5770 |
| 5751 // Utility superclass for stack-allocated objects that must be updated | 5771 // Utility superclass for stack-allocated objects that must be updated |
| 5752 // on gc. It provides two ways for the gc to update instances, either | 5772 // on gc. It provides two ways for the gc to update instances, either |
| 5753 // iterating or updating after gc. | 5773 // iterating or updating after gc. |
| 5754 class Relocatable BASE_EMBEDDED { | 5774 class Relocatable BASE_EMBEDDED { |
| 5755 public: | 5775 public: |
| 5756 inline Relocatable() : prev_(top_) { top_ = this; } | 5776 explicit inline Relocatable(Isolate* isolate); |
| 5757 virtual ~Relocatable() { | 5777 inline virtual ~Relocatable(); |
| 5758 ASSERT_EQ(top_, this); | |
| 5759 top_ = prev_; | |
| 5760 } | |
| 5761 virtual void IterateInstance(ObjectVisitor* v) { } | 5778 virtual void IterateInstance(ObjectVisitor* v) { } |
| 5762 virtual void PostGarbageCollection() { } | 5779 virtual void PostGarbageCollection() { } |
| 5763 | 5780 |
| 5764 static void PostGarbageCollectionProcessing(); | 5781 static void PostGarbageCollectionProcessing(); |
| 5765 static int ArchiveSpacePerThread(); | 5782 static int ArchiveSpacePerThread(); |
| 5766 static char* ArchiveState(char* to); | 5783 static char* ArchiveState(char* to); |
| 5767 static char* RestoreState(char* from); | 5784 static char* RestoreState(char* from); |
| 5768 static void Iterate(ObjectVisitor* v); | 5785 static void Iterate(ObjectVisitor* v); |
| 5769 static void Iterate(ObjectVisitor* v, Relocatable* top); | 5786 static void Iterate(ObjectVisitor* v, Relocatable* top); |
| 5770 static char* Iterate(ObjectVisitor* v, char* t); | 5787 static char* Iterate(ObjectVisitor* v, char* t); |
| 5771 private: | 5788 private: |
| 5772 static Relocatable* top_; | 5789 Isolate* isolate_; |
| 5773 Relocatable* prev_; | 5790 Relocatable* prev_; |
| 5774 }; | 5791 }; |
| 5775 | 5792 |
| 5776 | 5793 |
| 5777 // A flat string reader provides random access to the contents of a | 5794 // A flat string reader provides random access to the contents of a |
| 5778 // string independent of the character width of the string. The handle | 5795 // string independent of the character width of the string. The handle |
| 5779 // must be valid as long as the reader is being used. | 5796 // must be valid as long as the reader is being used. |
| 5780 class FlatStringReader : public Relocatable { | 5797 class FlatStringReader : public Relocatable { |
| 5781 public: | 5798 public: |
| 5782 explicit FlatStringReader(Handle<String> str); | 5799 FlatStringReader(Isolate* isolate, Handle<String> str); |
| 5783 explicit FlatStringReader(Vector<const char> input); | 5800 FlatStringReader(Isolate* isolate, Vector<const char> input); |
| 5784 void PostGarbageCollection(); | 5801 void PostGarbageCollection(); |
| 5785 inline uc32 Get(int index); | 5802 inline uc32 Get(int index); |
| 5786 int length() { return length_; } | 5803 int length() { return length_; } |
| 5787 private: | 5804 private: |
| 5788 String** str_; | 5805 String** str_; |
| 5789 bool is_ascii_; | 5806 bool is_ascii_; |
| 5790 int length_; | 5807 int length_; |
| 5791 const void* start_; | 5808 const void* start_; |
| 5792 }; | 5809 }; |
| 5793 | 5810 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5836 | 5853 |
| 5837 // The Oddball describes objects null, undefined, true, and false. | 5854 // The Oddball describes objects null, undefined, true, and false. |
| 5838 class Oddball: public HeapObject { | 5855 class Oddball: public HeapObject { |
| 5839 public: | 5856 public: |
| 5840 // [to_string]: Cached to_string computed at startup. | 5857 // [to_string]: Cached to_string computed at startup. |
| 5841 DECL_ACCESSORS(to_string, String) | 5858 DECL_ACCESSORS(to_string, String) |
| 5842 | 5859 |
| 5843 // [to_number]: Cached to_number computed at startup. | 5860 // [to_number]: Cached to_number computed at startup. |
| 5844 DECL_ACCESSORS(to_number, Object) | 5861 DECL_ACCESSORS(to_number, Object) |
| 5845 | 5862 |
| 5863 inline byte kind(); |
| 5864 inline void set_kind(byte kind); |
| 5865 |
| 5846 // Casting. | 5866 // Casting. |
| 5847 static inline Oddball* cast(Object* obj); | 5867 static inline Oddball* cast(Object* obj); |
| 5848 | 5868 |
| 5849 // Dispatched behavior. | 5869 // Dispatched behavior. |
| 5850 #ifdef DEBUG | 5870 #ifdef DEBUG |
| 5851 void OddballVerify(); | 5871 void OddballVerify(); |
| 5852 #endif | 5872 #endif |
| 5853 | 5873 |
| 5854 // Initialize the fields. | 5874 // Initialize the fields. |
| 5855 MUST_USE_RESULT MaybeObject* Initialize(const char* to_string, | 5875 MUST_USE_RESULT MaybeObject* Initialize(const char* to_string, |
| 5856 Object* to_number); | 5876 Object* to_number, |
| 5877 byte kind); |
| 5857 | 5878 |
| 5858 // Layout description. | 5879 // Layout description. |
| 5859 static const int kToStringOffset = HeapObject::kHeaderSize; | 5880 static const int kToStringOffset = HeapObject::kHeaderSize; |
| 5860 static const int kToNumberOffset = kToStringOffset + kPointerSize; | 5881 static const int kToNumberOffset = kToStringOffset + kPointerSize; |
| 5861 static const int kSize = kToNumberOffset + kPointerSize; | 5882 static const int kKindOffset = kToNumberOffset + kPointerSize; |
| 5883 static const int kSize = kKindOffset + kPointerSize; |
| 5884 |
| 5885 static const byte kFalse = 0; |
| 5886 static const byte kTrue = 1; |
| 5887 static const byte kNotBooleanMask = ~1; |
| 5888 static const byte kTheHole = 2; |
| 5889 static const byte kNull = 3; |
| 5890 static const byte kArgumentMarker = 4; |
| 5891 static const byte kUndefined = 5; |
| 5892 static const byte kOther = 6; |
| 5862 | 5893 |
| 5863 typedef FixedBodyDescriptor<kToStringOffset, | 5894 typedef FixedBodyDescriptor<kToStringOffset, |
| 5864 kToNumberOffset + kPointerSize, | 5895 kToNumberOffset + kPointerSize, |
| 5865 kSize> BodyDescriptor; | 5896 kSize> BodyDescriptor; |
| 5866 | 5897 |
| 5867 private: | 5898 private: |
| 5868 DISALLOW_IMPLICIT_CONSTRUCTORS(Oddball); | 5899 DISALLOW_IMPLICIT_CONSTRUCTORS(Oddball); |
| 5869 }; | 5900 }; |
| 5870 | 5901 |
| 5871 | 5902 |
| (...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6535 } else { | 6566 } else { |
| 6536 value &= ~(1 << bit_position); | 6567 value &= ~(1 << bit_position); |
| 6537 } | 6568 } |
| 6538 return value; | 6569 return value; |
| 6539 } | 6570 } |
| 6540 }; | 6571 }; |
| 6541 | 6572 |
| 6542 } } // namespace v8::internal | 6573 } } // namespace v8::internal |
| 6543 | 6574 |
| 6544 #endif // V8_OBJECTS_H_ | 6575 #endif // V8_OBJECTS_H_ |
| OLD | NEW |