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 3168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3179 | 3179 |
3180 // Search the instance descriptors for given name. | 3180 // Search the instance descriptors for given name. |
3181 INLINE(int Search(Name* name, int number_of_own_descriptors)); | 3181 INLINE(int Search(Name* name, int number_of_own_descriptors)); |
3182 | 3182 |
3183 // As the above, but uses DescriptorLookupCache and updates it when | 3183 // As the above, but uses DescriptorLookupCache and updates it when |
3184 // necessary. | 3184 // necessary. |
3185 INLINE(int SearchWithCache(Name* name, Map* map)); | 3185 INLINE(int SearchWithCache(Name* name, Map* map)); |
3186 | 3186 |
3187 // Allocates a DescriptorArray, but returns the singleton | 3187 // Allocates a DescriptorArray, but returns the singleton |
3188 // empty descriptor array object if number_of_descriptors is 0. | 3188 // empty descriptor array object if number_of_descriptors is 0. |
3189 MUST_USE_RESULT static MaybeObject* Allocate(int number_of_descriptors, | 3189 MUST_USE_RESULT static MaybeObject* Allocate(Isolate* isolate, |
| 3190 int number_of_descriptors, |
3190 int slack = 0); | 3191 int slack = 0); |
3191 | 3192 |
3192 // Casting. | 3193 // Casting. |
3193 static inline DescriptorArray* cast(Object* obj); | 3194 static inline DescriptorArray* cast(Object* obj); |
3194 | 3195 |
3195 // Constant for denoting key was not found. | 3196 // Constant for denoting key was not found. |
3196 static const int kNotFound = -1; | 3197 static const int kNotFound = -1; |
3197 | 3198 |
3198 static const int kDescriptorLengthIndex = 0; | 3199 static const int kDescriptorLengthIndex = 0; |
3199 static const int kEnumCacheIndex = 1; | 3200 static const int kEnumCacheIndex = 1; |
(...skipping 5517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8717 // Utility superclass for stack-allocated objects that must be updated | 8718 // Utility superclass for stack-allocated objects that must be updated |
8718 // on gc. It provides two ways for the gc to update instances, either | 8719 // on gc. It provides two ways for the gc to update instances, either |
8719 // iterating or updating after gc. | 8720 // iterating or updating after gc. |
8720 class Relocatable BASE_EMBEDDED { | 8721 class Relocatable BASE_EMBEDDED { |
8721 public: | 8722 public: |
8722 explicit inline Relocatable(Isolate* isolate); | 8723 explicit inline Relocatable(Isolate* isolate); |
8723 inline virtual ~Relocatable(); | 8724 inline virtual ~Relocatable(); |
8724 virtual void IterateInstance(ObjectVisitor* v) { } | 8725 virtual void IterateInstance(ObjectVisitor* v) { } |
8725 virtual void PostGarbageCollection() { } | 8726 virtual void PostGarbageCollection() { } |
8726 | 8727 |
8727 static void PostGarbageCollectionProcessing(); | 8728 static void PostGarbageCollectionProcessing(Isolate* isolate); |
8728 static int ArchiveSpacePerThread(); | 8729 static int ArchiveSpacePerThread(Isolate* isolate); |
8729 static char* ArchiveState(Isolate* isolate, char* to); | 8730 static char* ArchiveState(Isolate* isolate, char* to); |
8730 static char* RestoreState(Isolate* isolate, char* from); | 8731 static char* RestoreState(Isolate* isolate, char* from); |
8731 static void Iterate(ObjectVisitor* v); | 8732 static void Iterate(Isolate* isolate, ObjectVisitor* v); |
8732 static void Iterate(ObjectVisitor* v, Relocatable* top); | 8733 static void Iterate(ObjectVisitor* v, Relocatable* top); |
8733 static char* Iterate(ObjectVisitor* v, char* t); | 8734 static char* Iterate(Isolate* isolate, ObjectVisitor* v, char* t); |
| 8735 |
8734 private: | 8736 private: |
8735 Isolate* isolate_; | 8737 Isolate* isolate_; |
8736 Relocatable* prev_; | 8738 Relocatable* prev_; |
8737 }; | 8739 }; |
8738 | 8740 |
8739 | 8741 |
8740 // A flat string reader provides random access to the contents of a | 8742 // A flat string reader provides random access to the contents of a |
8741 // string independent of the character width of the string. The handle | 8743 // string independent of the character width of the string. The handle |
8742 // must be valid as long as the reader is being used. | 8744 // must be valid as long as the reader is being used. |
8743 class FlatStringReader : public Relocatable { | 8745 class FlatStringReader : public Relocatable { |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8859 inline byte kind(); | 8861 inline byte kind(); |
8860 inline void set_kind(byte kind); | 8862 inline void set_kind(byte kind); |
8861 | 8863 |
8862 // Casting. | 8864 // Casting. |
8863 static inline Oddball* cast(Object* obj); | 8865 static inline Oddball* cast(Object* obj); |
8864 | 8866 |
8865 // Dispatched behavior. | 8867 // Dispatched behavior. |
8866 DECLARE_VERIFIER(Oddball) | 8868 DECLARE_VERIFIER(Oddball) |
8867 | 8869 |
8868 // Initialize the fields. | 8870 // Initialize the fields. |
8869 MUST_USE_RESULT MaybeObject* Initialize(const char* to_string, | 8871 MUST_USE_RESULT MaybeObject* Initialize(Heap* heap, |
| 8872 const char* to_string, |
8870 Object* to_number, | 8873 Object* to_number, |
8871 byte kind); | 8874 byte kind); |
8872 | 8875 |
8873 // Layout description. | 8876 // Layout description. |
8874 static const int kToStringOffset = HeapObject::kHeaderSize; | 8877 static const int kToStringOffset = HeapObject::kHeaderSize; |
8875 static const int kToNumberOffset = kToStringOffset + kPointerSize; | 8878 static const int kToNumberOffset = kToStringOffset + kPointerSize; |
8876 static const int kKindOffset = kToNumberOffset + kPointerSize; | 8879 static const int kKindOffset = kToNumberOffset + kPointerSize; |
8877 static const int kSize = kKindOffset + kPointerSize; | 8880 static const int kSize = kKindOffset + kPointerSize; |
8878 | 8881 |
8879 static const byte kFalse = 0; | 8882 static const byte kFalse = 0; |
(...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10171 } else { | 10174 } else { |
10172 value &= ~(1 << bit_position); | 10175 value &= ~(1 << bit_position); |
10173 } | 10176 } |
10174 return value; | 10177 return value; |
10175 } | 10178 } |
10176 }; | 10179 }; |
10177 | 10180 |
10178 } } // namespace v8::internal | 10181 } } // namespace v8::internal |
10179 | 10182 |
10180 #endif // V8_OBJECTS_H_ | 10183 #endif // V8_OBJECTS_H_ |
OLD | NEW |