| 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 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 inline bool IsInstanceOf(FunctionTemplateInfo* type); | 722 inline bool IsInstanceOf(FunctionTemplateInfo* type); |
| 723 | 723 |
| 724 inline bool IsStruct(); | 724 inline bool IsStruct(); |
| 725 #define DECLARE_STRUCT_PREDICATE(NAME, Name, name) inline bool Is##Name(); | 725 #define DECLARE_STRUCT_PREDICATE(NAME, Name, name) inline bool Is##Name(); |
| 726 STRUCT_LIST(DECLARE_STRUCT_PREDICATE) | 726 STRUCT_LIST(DECLARE_STRUCT_PREDICATE) |
| 727 #undef DECLARE_STRUCT_PREDICATE | 727 #undef DECLARE_STRUCT_PREDICATE |
| 728 | 728 |
| 729 // Oddball testing. | 729 // Oddball testing. |
| 730 INLINE(bool IsUndefined()); | 730 INLINE(bool IsUndefined()); |
| 731 INLINE(bool IsNull()); | 731 INLINE(bool IsNull()); |
| 732 INLINE(bool IsTheHole()); // Shadows MaybeObject's implementation. |
| 732 INLINE(bool IsTrue()); | 733 INLINE(bool IsTrue()); |
| 733 INLINE(bool IsFalse()); | 734 INLINE(bool IsFalse()); |
| 734 inline bool IsArgumentsMarker(); | 735 inline bool IsArgumentsMarker(); |
| 735 | 736 |
| 736 // Extract the number. | 737 // Extract the number. |
| 737 inline double Number(); | 738 inline double Number(); |
| 738 | 739 |
| 739 inline bool HasSpecificClassOf(String* name); | 740 inline bool HasSpecificClassOf(String* name); |
| 740 | 741 |
| 741 MUST_USE_RESULT MaybeObject* ToObject(); // ECMA-262 9.9. | 742 MUST_USE_RESULT MaybeObject* ToObject(); // ECMA-262 9.9. |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 878 // Failure type tag info. | 879 // Failure type tag info. |
| 879 const int kFailureTypeTagSize = 2; | 880 const int kFailureTypeTagSize = 2; |
| 880 const int kFailureTypeTagMask = (1 << kFailureTypeTagSize) - 1; | 881 const int kFailureTypeTagMask = (1 << kFailureTypeTagSize) - 1; |
| 881 | 882 |
| 882 class Failure: public MaybeObject { | 883 class Failure: public MaybeObject { |
| 883 public: | 884 public: |
| 884 // RuntimeStubs assumes EXCEPTION = 1 in the compiler-generated code. | 885 // RuntimeStubs assumes EXCEPTION = 1 in the compiler-generated code. |
| 885 enum Type { | 886 enum Type { |
| 886 RETRY_AFTER_GC = 0, | 887 RETRY_AFTER_GC = 0, |
| 887 EXCEPTION = 1, // Returning this marker tells the real exception | 888 EXCEPTION = 1, // Returning this marker tells the real exception |
| 888 // is in Top::pending_exception. | 889 // is in Isolate::pending_exception. |
| 889 INTERNAL_ERROR = 2, | 890 INTERNAL_ERROR = 2, |
| 890 OUT_OF_MEMORY_EXCEPTION = 3 | 891 OUT_OF_MEMORY_EXCEPTION = 3 |
| 891 }; | 892 }; |
| 892 | 893 |
| 893 inline Type type() const; | 894 inline Type type() const; |
| 894 | 895 |
| 895 // Returns the space that needs to be collected for RetryAfterGC failures. | 896 // Returns the space that needs to be collected for RetryAfterGC failures. |
| 896 inline AllocationSpace allocation_space() const; | 897 inline AllocationSpace allocation_space() const; |
| 897 | 898 |
| 898 inline bool IsInternalError() const; | 899 inline bool IsInternalError() const; |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1066 // [map]: Contains a map which contains the object's reflective | 1067 // [map]: Contains a map which contains the object's reflective |
| 1067 // information. | 1068 // information. |
| 1068 inline Map* map(); | 1069 inline Map* map(); |
| 1069 inline void set_map(Map* value); | 1070 inline void set_map(Map* value); |
| 1070 | 1071 |
| 1071 // During garbage collection, the map word of a heap object does not | 1072 // During garbage collection, the map word of a heap object does not |
| 1072 // necessarily contain a map pointer. | 1073 // necessarily contain a map pointer. |
| 1073 inline MapWord map_word(); | 1074 inline MapWord map_word(); |
| 1074 inline void set_map_word(MapWord map_word); | 1075 inline void set_map_word(MapWord map_word); |
| 1075 | 1076 |
| 1077 // The Heap the object was allocated in. Used also to access Isolate. |
| 1078 // This method can not be used during GC, it ASSERTs this. |
| 1079 inline Heap* GetHeap(); |
| 1080 // Convenience method to get current isolate. This method can be |
| 1081 // accessed only when its result is the same as |
| 1082 // Isolate::Current(), it ASSERTs this. See also comment for GetHeap. |
| 1083 inline Isolate* GetIsolate(); |
| 1084 |
| 1076 // Converts an address to a HeapObject pointer. | 1085 // Converts an address to a HeapObject pointer. |
| 1077 static inline HeapObject* FromAddress(Address address); | 1086 static inline HeapObject* FromAddress(Address address); |
| 1078 | 1087 |
| 1079 // Returns the address of this HeapObject. | 1088 // Returns the address of this HeapObject. |
| 1080 inline Address address(); | 1089 inline Address address(); |
| 1081 | 1090 |
| 1082 // Iterates over pointers contained in the object (including the Map) | 1091 // Iterates over pointers contained in the object (including the Map) |
| 1083 void Iterate(ObjectVisitor* v); | 1092 void Iterate(ObjectVisitor* v); |
| 1084 | 1093 |
| 1085 // Iterates over all pointers contained in the object except the | 1094 // Iterates over all pointers contained in the object except the |
| (...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1885 // Setter that uses write barrier. | 1894 // Setter that uses write barrier. |
| 1886 inline void set(int index, Object* value); | 1895 inline void set(int index, Object* value); |
| 1887 | 1896 |
| 1888 // Setter that doesn't need write barrier). | 1897 // Setter that doesn't need write barrier). |
| 1889 inline void set(int index, Smi* value); | 1898 inline void set(int index, Smi* value); |
| 1890 // Setter with explicit barrier mode. | 1899 // Setter with explicit barrier mode. |
| 1891 inline void set(int index, Object* value, WriteBarrierMode mode); | 1900 inline void set(int index, Object* value, WriteBarrierMode mode); |
| 1892 | 1901 |
| 1893 // Setters for frequently used oddballs located in old space. | 1902 // Setters for frequently used oddballs located in old space. |
| 1894 inline void set_undefined(int index); | 1903 inline void set_undefined(int index); |
| 1904 // TODO(isolates): duplicate. |
| 1905 inline void set_undefined(Heap* heap, int index); |
| 1895 inline void set_null(int index); | 1906 inline void set_null(int index); |
| 1907 // TODO(isolates): duplicate. |
| 1908 inline void set_null(Heap* heap, int index); |
| 1896 inline void set_the_hole(int index); | 1909 inline void set_the_hole(int index); |
| 1897 | 1910 |
| 1898 // Setters with less debug checks for the GC to use. | 1911 // Setters with less debug checks for the GC to use. |
| 1899 inline void set_unchecked(int index, Smi* value); | 1912 inline void set_unchecked(int index, Smi* value); |
| 1900 inline void set_null_unchecked(int index); | 1913 inline void set_null_unchecked(Heap* heap, int index); |
| 1901 inline void set_unchecked(int index, Object* value, WriteBarrierMode mode); | 1914 inline void set_unchecked(Heap* heap, int index, Object* value, |
| 1915 WriteBarrierMode mode); |
| 1902 | 1916 |
| 1903 // Gives access to raw memory which stores the array's data. | 1917 // Gives access to raw memory which stores the array's data. |
| 1904 inline Object** data_start(); | 1918 inline Object** data_start(); |
| 1905 | 1919 |
| 1906 // Copy operations. | 1920 // Copy operations. |
| 1907 MUST_USE_RESULT inline MaybeObject* Copy(); | 1921 MUST_USE_RESULT inline MaybeObject* Copy(); |
| 1908 MUST_USE_RESULT MaybeObject* CopySize(int new_length); | 1922 MUST_USE_RESULT MaybeObject* CopySize(int new_length); |
| 1909 | 1923 |
| 1910 // Add the elements of a JSArray to this FixedArray. | 1924 // Add the elements of a JSArray to this FixedArray. |
| 1911 MUST_USE_RESULT MaybeObject* AddKeysFromJSArray(JSArray* array); | 1925 MUST_USE_RESULT MaybeObject* AddKeysFromJSArray(JSArray* array); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1986 // [2]: first key | 2000 // [2]: first key |
| 1987 // [length() - 1]: last key | 2001 // [length() - 1]: last key |
| 1988 // | 2002 // |
| 1989 class DescriptorArray: public FixedArray { | 2003 class DescriptorArray: public FixedArray { |
| 1990 public: | 2004 public: |
| 1991 // Is this the singleton empty_descriptor_array? | 2005 // Is this the singleton empty_descriptor_array? |
| 1992 inline bool IsEmpty(); | 2006 inline bool IsEmpty(); |
| 1993 | 2007 |
| 1994 // Returns the number of descriptors in the array. | 2008 // Returns the number of descriptors in the array. |
| 1995 int number_of_descriptors() { | 2009 int number_of_descriptors() { |
| 1996 return IsEmpty() ? 0 : length() - kFirstIndex; | 2010 ASSERT(length() > kFirstIndex || IsEmpty()); |
| 2011 int len = length(); |
| 2012 return len <= kFirstIndex ? 0 : len - kFirstIndex; |
| 1997 } | 2013 } |
| 1998 | 2014 |
| 1999 int NextEnumerationIndex() { | 2015 int NextEnumerationIndex() { |
| 2000 if (IsEmpty()) return PropertyDetails::kInitialIndex; | 2016 if (IsEmpty()) return PropertyDetails::kInitialIndex; |
| 2001 Object* obj = get(kEnumerationIndexIndex); | 2017 Object* obj = get(kEnumerationIndexIndex); |
| 2002 if (obj->IsSmi()) { | 2018 if (obj->IsSmi()) { |
| 2003 return Smi::cast(obj)->value(); | 2019 return Smi::cast(obj)->value(); |
| 2004 } else { | 2020 } else { |
| 2005 Object* index = FixedArray::cast(obj)->get(kEnumCacheBridgeEnumIndex); | 2021 Object* index = FixedArray::cast(obj)->get(kEnumCacheBridgeEnumIndex); |
| 2006 return Smi::cast(index)->value(); | 2022 return Smi::cast(index)->value(); |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2278 // Constant used for denoting a absent entry. | 2294 // Constant used for denoting a absent entry. |
| 2279 static const int kNotFound = -1; | 2295 static const int kNotFound = -1; |
| 2280 | 2296 |
| 2281 // Maximal capacity of HashTable. Based on maximal length of underlying | 2297 // Maximal capacity of HashTable. Based on maximal length of underlying |
| 2282 // FixedArray. Staying below kMaxCapacity also ensures that EntryToIndex | 2298 // FixedArray. Staying below kMaxCapacity also ensures that EntryToIndex |
| 2283 // cannot overflow. | 2299 // cannot overflow. |
| 2284 static const int kMaxCapacity = | 2300 static const int kMaxCapacity = |
| 2285 (FixedArray::kMaxLength - kElementsStartOffset) / kEntrySize; | 2301 (FixedArray::kMaxLength - kElementsStartOffset) / kEntrySize; |
| 2286 | 2302 |
| 2287 // Find entry for key otherwise return kNotFound. | 2303 // Find entry for key otherwise return kNotFound. |
| 2288 int FindEntry(Key key); | 2304 inline int FindEntry(Key key); |
| 2305 int FindEntry(Isolate* isolate, Key key); |
| 2289 | 2306 |
| 2290 protected: | 2307 protected: |
| 2291 | 2308 |
| 2292 // Find the entry at which to insert element with the given key that | 2309 // Find the entry at which to insert element with the given key that |
| 2293 // has the given hash value. | 2310 // has the given hash value. |
| 2294 uint32_t FindInsertionEntry(uint32_t hash); | 2311 uint32_t FindInsertionEntry(uint32_t hash); |
| 2295 | 2312 |
| 2296 // Returns the index for an entry (of the key) | 2313 // Returns the index for an entry (of the key) |
| 2297 static inline int EntryToIndex(int entry) { | 2314 static inline int EntryToIndex(int entry) { |
| 2298 return (entry * kEntrySize) + kElementsStartIndex; | 2315 return (entry * kEntrySize) + kElementsStartIndex; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2350 virtual uint32_t HashForObject(Object* key) = 0; | 2367 virtual uint32_t HashForObject(Object* key) = 0; |
| 2351 // Returns the key object for storing into the hash table. | 2368 // Returns the key object for storing into the hash table. |
| 2352 // If allocations fails a failure object is returned. | 2369 // If allocations fails a failure object is returned. |
| 2353 MUST_USE_RESULT virtual MaybeObject* AsObject() = 0; | 2370 MUST_USE_RESULT virtual MaybeObject* AsObject() = 0; |
| 2354 // Required. | 2371 // Required. |
| 2355 virtual ~HashTableKey() {} | 2372 virtual ~HashTableKey() {} |
| 2356 }; | 2373 }; |
| 2357 | 2374 |
| 2358 class SymbolTableShape { | 2375 class SymbolTableShape { |
| 2359 public: | 2376 public: |
| 2360 static bool IsMatch(HashTableKey* key, Object* value) { | 2377 static inline bool IsMatch(HashTableKey* key, Object* value) { |
| 2361 return key->IsMatch(value); | 2378 return key->IsMatch(value); |
| 2362 } | 2379 } |
| 2363 static uint32_t Hash(HashTableKey* key) { | 2380 static inline uint32_t Hash(HashTableKey* key) { |
| 2364 return key->Hash(); | 2381 return key->Hash(); |
| 2365 } | 2382 } |
| 2366 static uint32_t HashForObject(HashTableKey* key, Object* object) { | 2383 static inline uint32_t HashForObject(HashTableKey* key, Object* object) { |
| 2367 return key->HashForObject(object); | 2384 return key->HashForObject(object); |
| 2368 } | 2385 } |
| 2369 MUST_USE_RESULT static MaybeObject* AsObject(HashTableKey* key) { | 2386 MUST_USE_RESULT static inline MaybeObject* AsObject(HashTableKey* key) { |
| 2370 return key->AsObject(); | 2387 return key->AsObject(); |
| 2371 } | 2388 } |
| 2372 | 2389 |
| 2373 static const int kPrefixSize = 0; | 2390 static const int kPrefixSize = 0; |
| 2374 static const int kEntrySize = 1; | 2391 static const int kEntrySize = 1; |
| 2375 }; | 2392 }; |
| 2376 | 2393 |
| 2377 // SymbolTable. | 2394 // SymbolTable. |
| 2378 // | 2395 // |
| 2379 // No special elements in the prefix and the element size is 1 | 2396 // No special elements in the prefix and the element size is 1 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 2402 | 2419 |
| 2403 private: | 2420 private: |
| 2404 MUST_USE_RESULT MaybeObject* LookupKey(HashTableKey* key, Object** s); | 2421 MUST_USE_RESULT MaybeObject* LookupKey(HashTableKey* key, Object** s); |
| 2405 | 2422 |
| 2406 DISALLOW_IMPLICIT_CONSTRUCTORS(SymbolTable); | 2423 DISALLOW_IMPLICIT_CONSTRUCTORS(SymbolTable); |
| 2407 }; | 2424 }; |
| 2408 | 2425 |
| 2409 | 2426 |
| 2410 class MapCacheShape { | 2427 class MapCacheShape { |
| 2411 public: | 2428 public: |
| 2412 static bool IsMatch(HashTableKey* key, Object* value) { | 2429 static inline bool IsMatch(HashTableKey* key, Object* value) { |
| 2413 return key->IsMatch(value); | 2430 return key->IsMatch(value); |
| 2414 } | 2431 } |
| 2415 static uint32_t Hash(HashTableKey* key) { | 2432 static inline uint32_t Hash(HashTableKey* key) { |
| 2416 return key->Hash(); | 2433 return key->Hash(); |
| 2417 } | 2434 } |
| 2418 | 2435 |
| 2419 static uint32_t HashForObject(HashTableKey* key, Object* object) { | 2436 static inline uint32_t HashForObject(HashTableKey* key, Object* object) { |
| 2420 return key->HashForObject(object); | 2437 return key->HashForObject(object); |
| 2421 } | 2438 } |
| 2422 | 2439 |
| 2423 MUST_USE_RESULT static MaybeObject* AsObject(HashTableKey* key) { | 2440 MUST_USE_RESULT static inline MaybeObject* AsObject(HashTableKey* key) { |
| 2424 return key->AsObject(); | 2441 return key->AsObject(); |
| 2425 } | 2442 } |
| 2426 | 2443 |
| 2427 static const int kPrefixSize = 0; | 2444 static const int kPrefixSize = 0; |
| 2428 static const int kEntrySize = 2; | 2445 static const int kEntrySize = 2; |
| 2429 }; | 2446 }; |
| 2430 | 2447 |
| 2431 | 2448 |
| 2432 // MapCache. | 2449 // MapCache. |
| 2433 // | 2450 // |
| (...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3423 int SourceStatementPosition(Address pc); | 3440 int SourceStatementPosition(Address pc); |
| 3424 | 3441 |
| 3425 // Casting. | 3442 // Casting. |
| 3426 static inline Code* cast(Object* obj); | 3443 static inline Code* cast(Object* obj); |
| 3427 | 3444 |
| 3428 // Dispatched behavior. | 3445 // Dispatched behavior. |
| 3429 int CodeSize() { return SizeFor(body_size()); } | 3446 int CodeSize() { return SizeFor(body_size()); } |
| 3430 inline void CodeIterateBody(ObjectVisitor* v); | 3447 inline void CodeIterateBody(ObjectVisitor* v); |
| 3431 | 3448 |
| 3432 template<typename StaticVisitor> | 3449 template<typename StaticVisitor> |
| 3433 inline void CodeIterateBody(); | 3450 inline void CodeIterateBody(Heap* heap); |
| 3434 #ifdef OBJECT_PRINT | 3451 #ifdef OBJECT_PRINT |
| 3435 inline void CodePrint() { | 3452 inline void CodePrint() { |
| 3436 CodePrint(stdout); | 3453 CodePrint(stdout); |
| 3437 } | 3454 } |
| 3438 void CodePrint(FILE* out); | 3455 void CodePrint(FILE* out); |
| 3439 #endif | 3456 #endif |
| 3440 #ifdef DEBUG | 3457 #ifdef DEBUG |
| 3441 void CodeVerify(); | 3458 void CodeVerify(); |
| 3442 #endif | 3459 #endif |
| 3443 | 3460 |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3711 | 3728 |
| 3712 // Casting. | 3729 // Casting. |
| 3713 static inline Map* cast(Object* obj); | 3730 static inline Map* cast(Object* obj); |
| 3714 | 3731 |
| 3715 // Locate an accessor in the instance descriptor. | 3732 // Locate an accessor in the instance descriptor. |
| 3716 AccessorDescriptor* FindAccessor(String* name); | 3733 AccessorDescriptor* FindAccessor(String* name); |
| 3717 | 3734 |
| 3718 // Code cache operations. | 3735 // Code cache operations. |
| 3719 | 3736 |
| 3720 // Clears the code cache. | 3737 // Clears the code cache. |
| 3721 inline void ClearCodeCache(); | 3738 inline void ClearCodeCache(Heap* heap); |
| 3722 | 3739 |
| 3723 // Update code cache. | 3740 // Update code cache. |
| 3724 MUST_USE_RESULT MaybeObject* UpdateCodeCache(String* name, Code* code); | 3741 MUST_USE_RESULT MaybeObject* UpdateCodeCache(String* name, Code* code); |
| 3725 | 3742 |
| 3726 // Returns the found code or undefined if absent. | 3743 // Returns the found code or undefined if absent. |
| 3727 Object* FindInCodeCache(String* name, Code::Flags flags); | 3744 Object* FindInCodeCache(String* name, Code::Flags flags); |
| 3728 | 3745 |
| 3729 // Returns the non-negative index of the code object if it is in the | 3746 // Returns the non-negative index of the code object if it is in the |
| 3730 // cache and -1 otherwise. | 3747 // cache and -1 otherwise. |
| 3731 int IndexInCodeCache(Object* name, Code* code); | 3748 int IndexInCodeCache(Object* name, Code* code); |
| 3732 | 3749 |
| 3733 // Removes a code object from the code cache at the given index. | 3750 // Removes a code object from the code cache at the given index. |
| 3734 void RemoveFromCodeCache(String* name, Code* code, int index); | 3751 void RemoveFromCodeCache(String* name, Code* code, int index); |
| 3735 | 3752 |
| 3736 // For every transition in this map, makes the transition's | 3753 // For every transition in this map, makes the transition's |
| 3737 // target's prototype pointer point back to this map. | 3754 // target's prototype pointer point back to this map. |
| 3738 // This is undone in MarkCompactCollector::ClearNonLiveTransitions(). | 3755 // This is undone in MarkCompactCollector::ClearNonLiveTransitions(). |
| 3739 void CreateBackPointers(); | 3756 void CreateBackPointers(); |
| 3740 | 3757 |
| 3741 // Set all map transitions from this map to dead maps to null. | 3758 // Set all map transitions from this map to dead maps to null. |
| 3742 // Also, restore the original prototype on the targets of these | 3759 // Also, restore the original prototype on the targets of these |
| 3743 // transitions, so that we do not process this map again while | 3760 // transitions, so that we do not process this map again while |
| 3744 // following back pointers. | 3761 // following back pointers. |
| 3745 void ClearNonLiveTransitions(Object* real_prototype); | 3762 void ClearNonLiveTransitions(Heap* heap, Object* real_prototype); |
| 3746 | 3763 |
| 3747 // Dispatched behavior. | 3764 // Dispatched behavior. |
| 3748 #ifdef OBJECT_PRINT | 3765 #ifdef OBJECT_PRINT |
| 3749 inline void MapPrint() { | 3766 inline void MapPrint() { |
| 3750 MapPrint(stdout); | 3767 MapPrint(stdout); |
| 3751 } | 3768 } |
| 3752 void MapPrint(FILE* out); | 3769 void MapPrint(FILE* out); |
| 3753 #endif | 3770 #endif |
| 3754 #ifdef DEBUG | 3771 #ifdef DEBUG |
| 3755 void MapVerify(); | 3772 void MapVerify(); |
| 3756 void SharedMapVerify(); | 3773 void SharedMapVerify(); |
| 3757 #endif | 3774 #endif |
| 3758 | 3775 |
| 3759 inline int visitor_id(); | 3776 inline int visitor_id(); |
| 3760 inline void set_visitor_id(int visitor_id); | 3777 inline void set_visitor_id(int visitor_id); |
| 3761 | 3778 |
| 3779 // Returns the heap this map belongs to. |
| 3780 inline Heap* heap(); |
| 3781 |
| 3762 typedef void (*TraverseCallback)(Map* map, void* data); | 3782 typedef void (*TraverseCallback)(Map* map, void* data); |
| 3763 | 3783 |
| 3764 void TraverseTransitionTree(TraverseCallback callback, void* data); | 3784 void TraverseTransitionTree(TraverseCallback callback, void* data); |
| 3765 | 3785 |
| 3766 static const int kMaxPreAllocatedPropertyFields = 255; | 3786 static const int kMaxPreAllocatedPropertyFields = 255; |
| 3767 | 3787 |
| 3768 // Layout description. | 3788 // Layout description. |
| 3769 static const int kInstanceSizesOffset = HeapObject::kHeaderSize; | 3789 static const int kInstanceSizesOffset = HeapObject::kHeaderSize; |
| 3770 static const int kInstanceAttributesOffset = kInstanceSizesOffset + kIntSize; | 3790 static const int kInstanceAttributesOffset = kInstanceSizesOffset + kIntSize; |
| 3771 static const int kPrototypeOffset = kInstanceAttributesOffset + kIntSize; | 3791 static const int kPrototypeOffset = kInstanceAttributesOffset + kIntSize; |
| (...skipping 2025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5797 private: | 5817 private: |
| 5798 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalTwoByteString); | 5818 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalTwoByteString); |
| 5799 }; | 5819 }; |
| 5800 | 5820 |
| 5801 | 5821 |
| 5802 // Utility superclass for stack-allocated objects that must be updated | 5822 // Utility superclass for stack-allocated objects that must be updated |
| 5803 // on gc. It provides two ways for the gc to update instances, either | 5823 // on gc. It provides two ways for the gc to update instances, either |
| 5804 // iterating or updating after gc. | 5824 // iterating or updating after gc. |
| 5805 class Relocatable BASE_EMBEDDED { | 5825 class Relocatable BASE_EMBEDDED { |
| 5806 public: | 5826 public: |
| 5807 inline Relocatable() : prev_(top_) { top_ = this; } | 5827 explicit inline Relocatable(Isolate* isolate); |
| 5808 virtual ~Relocatable() { | 5828 inline virtual ~Relocatable(); |
| 5809 ASSERT_EQ(top_, this); | |
| 5810 top_ = prev_; | |
| 5811 } | |
| 5812 virtual void IterateInstance(ObjectVisitor* v) { } | 5829 virtual void IterateInstance(ObjectVisitor* v) { } |
| 5813 virtual void PostGarbageCollection() { } | 5830 virtual void PostGarbageCollection() { } |
| 5814 | 5831 |
| 5815 static void PostGarbageCollectionProcessing(); | 5832 static void PostGarbageCollectionProcessing(); |
| 5816 static int ArchiveSpacePerThread(); | 5833 static int ArchiveSpacePerThread(); |
| 5817 static char* ArchiveState(char* to); | 5834 static char* ArchiveState(char* to); |
| 5818 static char* RestoreState(char* from); | 5835 static char* RestoreState(char* from); |
| 5819 static void Iterate(ObjectVisitor* v); | 5836 static void Iterate(ObjectVisitor* v); |
| 5820 static void Iterate(ObjectVisitor* v, Relocatable* top); | 5837 static void Iterate(ObjectVisitor* v, Relocatable* top); |
| 5821 static char* Iterate(ObjectVisitor* v, char* t); | 5838 static char* Iterate(ObjectVisitor* v, char* t); |
| 5822 private: | 5839 private: |
| 5823 static Relocatable* top_; | 5840 Isolate* isolate_; |
| 5824 Relocatable* prev_; | 5841 Relocatable* prev_; |
| 5825 }; | 5842 }; |
| 5826 | 5843 |
| 5827 | 5844 |
| 5828 // A flat string reader provides random access to the contents of a | 5845 // A flat string reader provides random access to the contents of a |
| 5829 // string independent of the character width of the string. The handle | 5846 // string independent of the character width of the string. The handle |
| 5830 // must be valid as long as the reader is being used. | 5847 // must be valid as long as the reader is being used. |
| 5831 class FlatStringReader : public Relocatable { | 5848 class FlatStringReader : public Relocatable { |
| 5832 public: | 5849 public: |
| 5833 explicit FlatStringReader(Handle<String> str); | 5850 FlatStringReader(Isolate* isolate, Handle<String> str); |
| 5834 explicit FlatStringReader(Vector<const char> input); | 5851 FlatStringReader(Isolate* isolate, Vector<const char> input); |
| 5835 void PostGarbageCollection(); | 5852 void PostGarbageCollection(); |
| 5836 inline uc32 Get(int index); | 5853 inline uc32 Get(int index); |
| 5837 int length() { return length_; } | 5854 int length() { return length_; } |
| 5838 private: | 5855 private: |
| 5839 String** str_; | 5856 String** str_; |
| 5840 bool is_ascii_; | 5857 bool is_ascii_; |
| 5841 int length_; | 5858 int length_; |
| 5842 const void* start_; | 5859 const void* start_; |
| 5843 }; | 5860 }; |
| 5844 | 5861 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5887 | 5904 |
| 5888 // The Oddball describes objects null, undefined, true, and false. | 5905 // The Oddball describes objects null, undefined, true, and false. |
| 5889 class Oddball: public HeapObject { | 5906 class Oddball: public HeapObject { |
| 5890 public: | 5907 public: |
| 5891 // [to_string]: Cached to_string computed at startup. | 5908 // [to_string]: Cached to_string computed at startup. |
| 5892 DECL_ACCESSORS(to_string, String) | 5909 DECL_ACCESSORS(to_string, String) |
| 5893 | 5910 |
| 5894 // [to_number]: Cached to_number computed at startup. | 5911 // [to_number]: Cached to_number computed at startup. |
| 5895 DECL_ACCESSORS(to_number, Object) | 5912 DECL_ACCESSORS(to_number, Object) |
| 5896 | 5913 |
| 5914 inline byte kind(); |
| 5915 inline void set_kind(byte kind); |
| 5916 |
| 5897 // Casting. | 5917 // Casting. |
| 5898 static inline Oddball* cast(Object* obj); | 5918 static inline Oddball* cast(Object* obj); |
| 5899 | 5919 |
| 5900 // Dispatched behavior. | 5920 // Dispatched behavior. |
| 5901 #ifdef DEBUG | 5921 #ifdef DEBUG |
| 5902 void OddballVerify(); | 5922 void OddballVerify(); |
| 5903 #endif | 5923 #endif |
| 5904 | 5924 |
| 5905 // Initialize the fields. | 5925 // Initialize the fields. |
| 5906 MUST_USE_RESULT MaybeObject* Initialize(const char* to_string, | 5926 MUST_USE_RESULT MaybeObject* Initialize(const char* to_string, |
| 5907 Object* to_number); | 5927 Object* to_number, |
| 5928 byte kind); |
| 5908 | 5929 |
| 5909 // Layout description. | 5930 // Layout description. |
| 5910 static const int kToStringOffset = HeapObject::kHeaderSize; | 5931 static const int kToStringOffset = HeapObject::kHeaderSize; |
| 5911 static const int kToNumberOffset = kToStringOffset + kPointerSize; | 5932 static const int kToNumberOffset = kToStringOffset + kPointerSize; |
| 5912 static const int kSize = kToNumberOffset + kPointerSize; | 5933 static const int kKindOffset = kToNumberOffset + kPointerSize; |
| 5934 static const int kSize = kKindOffset + kPointerSize; |
| 5935 |
| 5936 static const byte kFalse = 0; |
| 5937 static const byte kTrue = 1; |
| 5938 static const byte kNotBooleanMask = ~1; |
| 5939 static const byte kTheHole = 2; |
| 5940 static const byte kNull = 3; |
| 5941 static const byte kArgumentMarker = 4; |
| 5942 static const byte kUndefined = 5; |
| 5943 static const byte kOther = 6; |
| 5913 | 5944 |
| 5914 typedef FixedBodyDescriptor<kToStringOffset, | 5945 typedef FixedBodyDescriptor<kToStringOffset, |
| 5915 kToNumberOffset + kPointerSize, | 5946 kToNumberOffset + kPointerSize, |
| 5916 kSize> BodyDescriptor; | 5947 kSize> BodyDescriptor; |
| 5917 | 5948 |
| 5918 private: | 5949 private: |
| 5919 DISALLOW_IMPLICIT_CONSTRUCTORS(Oddball); | 5950 DISALLOW_IMPLICIT_CONSTRUCTORS(Oddball); |
| 5920 }; | 5951 }; |
| 5921 | 5952 |
| 5922 | 5953 |
| (...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6586 } else { | 6617 } else { |
| 6587 value &= ~(1 << bit_position); | 6618 value &= ~(1 << bit_position); |
| 6588 } | 6619 } |
| 6589 return value; | 6620 return value; |
| 6590 } | 6621 } |
| 6591 }; | 6622 }; |
| 6592 | 6623 |
| 6593 } } // namespace v8::internal | 6624 } } // namespace v8::internal |
| 6594 | 6625 |
| 6595 #endif // V8_OBJECTS_H_ | 6626 #endif // V8_OBJECTS_H_ |
| OLD | NEW |