| 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 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1047 V(MapCache) \ | 1047 V(MapCache) \ |
| 1048 V(Primitive) \ | 1048 V(Primitive) \ |
| 1049 V(GlobalObject) \ | 1049 V(GlobalObject) \ |
| 1050 V(JSGlobalObject) \ | 1050 V(JSGlobalObject) \ |
| 1051 V(JSBuiltinsObject) \ | 1051 V(JSBuiltinsObject) \ |
| 1052 V(JSGlobalProxy) \ | 1052 V(JSGlobalProxy) \ |
| 1053 V(UndetectableObject) \ | 1053 V(UndetectableObject) \ |
| 1054 V(AccessCheckNeeded) \ | 1054 V(AccessCheckNeeded) \ |
| 1055 V(Cell) \ | 1055 V(Cell) \ |
| 1056 V(PropertyCell) \ | 1056 V(PropertyCell) \ |
| 1057 V(ObjectHashTable) | 1057 V(ObjectHashTable) \ |
| 1058 V(WeakHashTable) |
| 1058 | 1059 |
| 1059 | 1060 |
| 1060 #define ERROR_MESSAGES_LIST(V) \ | 1061 #define ERROR_MESSAGES_LIST(V) \ |
| 1061 V(kNoReason, "no reason") \ | 1062 V(kNoReason, "no reason") \ |
| 1062 \ | 1063 \ |
| 1063 V(k32BitValueInRegisterIsNotZeroExtended, \ | 1064 V(k32BitValueInRegisterIsNotZeroExtended, \ |
| 1064 "32 bit value in register is not zero-extended") \ | 1065 "32 bit value in register is not zero-extended") \ |
| 1065 V(kAlignmentMarkerExpected, "alignment marker expected") \ | 1066 V(kAlignmentMarkerExpected, "alignment marker expected") \ |
| 1066 V(kAllocationIsNotDoubleAligned, "Allocation is not double aligned") \ | 1067 V(kAllocationIsNotDoubleAligned, "Allocation is not double aligned") \ |
| 1067 V(kAPICallReturnedInvalidObject, "API call returned invalid object") \ | 1068 V(kAPICallReturnedInvalidObject, "API call returned invalid object") \ |
| (...skipping 1837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2905 inline void set_the_hole(int index); | 2906 inline void set_the_hole(int index); |
| 2906 | 2907 |
| 2907 inline Object** GetFirstElementAddress(); | 2908 inline Object** GetFirstElementAddress(); |
| 2908 inline bool ContainsOnlySmisOrHoles(); | 2909 inline bool ContainsOnlySmisOrHoles(); |
| 2909 | 2910 |
| 2910 // Gives access to raw memory which stores the array's data. | 2911 // Gives access to raw memory which stores the array's data. |
| 2911 inline Object** data_start(); | 2912 inline Object** data_start(); |
| 2912 | 2913 |
| 2913 // Copy operations. | 2914 // Copy operations. |
| 2914 MUST_USE_RESULT inline MaybeObject* Copy(); | 2915 MUST_USE_RESULT inline MaybeObject* Copy(); |
| 2915 MUST_USE_RESULT MaybeObject* CopySize(int new_length); | 2916 MUST_USE_RESULT MaybeObject* CopySize(int new_length, |
| 2917 PretenureFlag pretenure = NOT_TENURED); |
| 2916 | 2918 |
| 2917 // Add the elements of a JSArray to this FixedArray. | 2919 // Add the elements of a JSArray to this FixedArray. |
| 2918 MUST_USE_RESULT MaybeObject* AddKeysFromJSArray(JSArray* array); | 2920 MUST_USE_RESULT MaybeObject* AddKeysFromJSArray(JSArray* array); |
| 2919 | 2921 |
| 2920 // Compute the union of this and other. | 2922 // Compute the union of this and other. |
| 2921 MUST_USE_RESULT MaybeObject* UnionOfKeys(FixedArray* other); | 2923 MUST_USE_RESULT MaybeObject* UnionOfKeys(FixedArray* other); |
| 2922 | 2924 |
| 2923 // Copy a sub array from the receiver to dest. | 2925 // Copy a sub array from the receiver to dest. |
| 2924 void CopyTo(int pos, FixedArray* dest, int dest_pos, int len); | 2926 void CopyTo(int pos, FixedArray* dest, int dest_pos, int len); |
| 2925 | 2927 |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3529 | 3531 |
| 3530 void Swap(uint32_t entry1, uint32_t entry2, WriteBarrierMode mode); | 3532 void Swap(uint32_t entry1, uint32_t entry2, WriteBarrierMode mode); |
| 3531 | 3533 |
| 3532 // Rehashes this hash-table into the new table. | 3534 // Rehashes this hash-table into the new table. |
| 3533 MUST_USE_RESULT MaybeObject* Rehash(HashTable* new_table, Key key); | 3535 MUST_USE_RESULT MaybeObject* Rehash(HashTable* new_table, Key key); |
| 3534 | 3536 |
| 3535 // Attempt to shrink hash table after removal of key. | 3537 // Attempt to shrink hash table after removal of key. |
| 3536 MUST_USE_RESULT MaybeObject* Shrink(Key key); | 3538 MUST_USE_RESULT MaybeObject* Shrink(Key key); |
| 3537 | 3539 |
| 3538 // Ensure enough space for n additional elements. | 3540 // Ensure enough space for n additional elements. |
| 3539 MUST_USE_RESULT MaybeObject* EnsureCapacity(int n, Key key); | 3541 MUST_USE_RESULT MaybeObject* EnsureCapacity( |
| 3542 int n, |
| 3543 Key key, |
| 3544 PretenureFlag pretenure = NOT_TENURED); |
| 3540 }; | 3545 }; |
| 3541 | 3546 |
| 3542 | 3547 |
| 3543 // HashTableKey is an abstract superclass for virtual key behavior. | 3548 // HashTableKey is an abstract superclass for virtual key behavior. |
| 3544 class HashTableKey { | 3549 class HashTableKey { |
| 3545 public: | 3550 public: |
| 3546 // Returns whether the other object matches this key. | 3551 // Returns whether the other object matches this key. |
| 3547 virtual bool IsMatch(Object* other) = 0; | 3552 virtual bool IsMatch(Object* other) = 0; |
| 3548 // Returns the hash value for this key. | 3553 // Returns the hash value for this key. |
| 3549 virtual uint32_t Hash() = 0; | 3554 virtual uint32_t Hash() = 0; |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3968 void AddEntry(int entry, Object* key, Object* value); | 3973 void AddEntry(int entry, Object* key, Object* value); |
| 3969 void RemoveEntry(int entry); | 3974 void RemoveEntry(int entry); |
| 3970 | 3975 |
| 3971 // Returns the index to the value of an entry. | 3976 // Returns the index to the value of an entry. |
| 3972 static inline int EntryToValueIndex(int entry) { | 3977 static inline int EntryToValueIndex(int entry) { |
| 3973 return EntryToIndex(entry) + 1; | 3978 return EntryToIndex(entry) + 1; |
| 3974 } | 3979 } |
| 3975 }; | 3980 }; |
| 3976 | 3981 |
| 3977 | 3982 |
| 3983 template <int entrysize> |
| 3984 class WeakHashTableShape : public BaseShape<Object*> { |
| 3985 public: |
| 3986 static inline bool IsMatch(Object* key, Object* other); |
| 3987 static inline uint32_t Hash(Object* key); |
| 3988 static inline uint32_t HashForObject(Object* key, Object* object); |
| 3989 MUST_USE_RESULT static inline MaybeObject* AsObject(Heap* heap, |
| 3990 Object* key); |
| 3991 static const int kPrefixSize = 0; |
| 3992 static const int kEntrySize = entrysize; |
| 3993 }; |
| 3994 |
| 3995 |
| 3996 // WeakHashTable maps keys that are arbitrary objects to object values. |
| 3997 // It is used for the global weak hash table that maps objects |
| 3998 // embedded in optimized code to dependent code lists. |
| 3999 class WeakHashTable: public HashTable<WeakHashTableShape<2>, Object*> { |
| 4000 public: |
| 4001 static inline WeakHashTable* cast(Object* obj) { |
| 4002 ASSERT(obj->IsHashTable()); |
| 4003 return reinterpret_cast<WeakHashTable*>(obj); |
| 4004 } |
| 4005 |
| 4006 // Looks up the value associated with the given key. The hole value is |
| 4007 // returned in case the key is not present. |
| 4008 Object* Lookup(Object* key); |
| 4009 |
| 4010 // Adds (or overwrites) the value associated with the given key. Mapping a |
| 4011 // key to the hole value causes removal of the whole entry. |
| 4012 MUST_USE_RESULT MaybeObject* Put(Object* key, Object* value); |
| 4013 |
| 4014 private: |
| 4015 friend class MarkCompactCollector; |
| 4016 |
| 4017 void AddEntry(int entry, Object* key, Object* value); |
| 4018 |
| 4019 // Returns the index to the value of an entry. |
| 4020 static inline int EntryToValueIndex(int entry) { |
| 4021 return EntryToIndex(entry) + 1; |
| 4022 } |
| 4023 }; |
| 4024 |
| 4025 |
| 3978 // JSFunctionResultCache caches results of some JSFunction invocation. | 4026 // JSFunctionResultCache caches results of some JSFunction invocation. |
| 3979 // It is a fixed array with fixed structure: | 4027 // It is a fixed array with fixed structure: |
| 3980 // [0]: factory function | 4028 // [0]: factory function |
| 3981 // [1]: finger index | 4029 // [1]: finger index |
| 3982 // [2]: current cache size | 4030 // [2]: current cache size |
| 3983 // [3]: dummy field. | 4031 // [3]: dummy field. |
| 3984 // The rest of array are key/value pairs. | 4032 // The rest of array are key/value pairs. |
| 3985 class JSFunctionResultCache: public FixedArray { | 4033 class JSFunctionResultCache: public FixedArray { |
| 3986 public: | 4034 public: |
| 3987 static const int kFactoryIndex = 0; | 4035 static const int kFactoryIndex = 0; |
| (...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5150 static void MakeCodeAgeSequenceYoung(byte* sequence); | 5198 static void MakeCodeAgeSequenceYoung(byte* sequence); |
| 5151 void MakeOlder(MarkingParity); | 5199 void MakeOlder(MarkingParity); |
| 5152 static bool IsYoungSequence(byte* sequence); | 5200 static bool IsYoungSequence(byte* sequence); |
| 5153 bool IsOld(); | 5201 bool IsOld(); |
| 5154 int GetAge(); | 5202 int GetAge(); |
| 5155 | 5203 |
| 5156 void PrintDeoptLocation(int bailout_id); | 5204 void PrintDeoptLocation(int bailout_id); |
| 5157 bool CanDeoptAt(Address pc); | 5205 bool CanDeoptAt(Address pc); |
| 5158 | 5206 |
| 5159 #ifdef VERIFY_HEAP | 5207 #ifdef VERIFY_HEAP |
| 5160 void VerifyEmbeddedMapsDependency(); | 5208 void VerifyEmbeddedObjectsDependency(); |
| 5161 #endif | 5209 #endif |
| 5162 | 5210 |
| 5211 static bool IsWeakEmbeddedObject(Kind kind, Object* object); |
| 5212 |
| 5163 // Max loop nesting marker used to postpose OSR. We don't take loop | 5213 // Max loop nesting marker used to postpose OSR. We don't take loop |
| 5164 // nesting that is deeper than 5 levels into account. | 5214 // nesting that is deeper than 5 levels into account. |
| 5165 static const int kMaxLoopNestingMarker = 6; | 5215 static const int kMaxLoopNestingMarker = 6; |
| 5166 | 5216 |
| 5167 // Layout description. | 5217 // Layout description. |
| 5168 static const int kInstructionSizeOffset = HeapObject::kHeaderSize; | 5218 static const int kInstructionSizeOffset = HeapObject::kHeaderSize; |
| 5169 static const int kRelocationInfoOffset = kInstructionSizeOffset + kIntSize; | 5219 static const int kRelocationInfoOffset = kInstructionSizeOffset + kIntSize; |
| 5170 static const int kHandlerTableOffset = kRelocationInfoOffset + kPointerSize; | 5220 static const int kHandlerTableOffset = kRelocationInfoOffset + kPointerSize; |
| 5171 static const int kDeoptimizationDataOffset = | 5221 static const int kDeoptimizationDataOffset = |
| 5172 kHandlerTableOffset + kPointerSize; | 5222 kHandlerTableOffset + kPointerSize; |
| (...skipping 5061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10234 } else { | 10284 } else { |
| 10235 value &= ~(1 << bit_position); | 10285 value &= ~(1 << bit_position); |
| 10236 } | 10286 } |
| 10237 return value; | 10287 return value; |
| 10238 } | 10288 } |
| 10239 }; | 10289 }; |
| 10240 | 10290 |
| 10241 } } // namespace v8::internal | 10291 } } // namespace v8::internal |
| 10242 | 10292 |
| 10243 #endif // V8_OBJECTS_H_ | 10293 #endif // V8_OBJECTS_H_ |
| OLD | NEW |