| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
| 6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
| 7 | 7 |
| 8 #include <iosfwd> | 8 #include <iosfwd> |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 }; | 277 }; |
| 278 | 278 |
| 279 | 279 |
| 280 // Indicates whether we are only interested in the descriptors of a particular | 280 // Indicates whether we are only interested in the descriptors of a particular |
| 281 // map, or in all descriptors in the descriptor array. | 281 // map, or in all descriptors in the descriptor array. |
| 282 enum DescriptorFlag { | 282 enum DescriptorFlag { |
| 283 ALL_DESCRIPTORS, | 283 ALL_DESCRIPTORS, |
| 284 OWN_DESCRIPTORS | 284 OWN_DESCRIPTORS |
| 285 }; | 285 }; |
| 286 | 286 |
| 287 // The GC maintains a bit of information, the MarkingParity, which toggles | |
| 288 // from odd to even and back every time marking is completed. Incremental | |
| 289 // marking can visit an object twice during a marking phase, so algorithms that | |
| 290 // that piggy-back on marking can use the parity to ensure that they only | |
| 291 // perform an operation on an object once per marking phase: they record the | |
| 292 // MarkingParity when they visit an object, and only re-visit the object when it | |
| 293 // is marked again and the MarkingParity changes. | |
| 294 enum MarkingParity { | |
| 295 NO_MARKING_PARITY, | |
| 296 ODD_MARKING_PARITY, | |
| 297 EVEN_MARKING_PARITY | |
| 298 }; | |
| 299 | |
| 300 // ICs store extra state in a Code object. The default extra state is | 287 // ICs store extra state in a Code object. The default extra state is |
| 301 // kNoExtraICState. | 288 // kNoExtraICState. |
| 302 typedef int ExtraICState; | 289 typedef int ExtraICState; |
| 303 static const ExtraICState kNoExtraICState = 0; | 290 static const ExtraICState kNoExtraICState = 0; |
| 304 | 291 |
| 305 // Instance size sentinel for objects of variable size. | 292 // Instance size sentinel for objects of variable size. |
| 306 const int kVariableSizeSentinel = 0; | 293 const int kVariableSizeSentinel = 0; |
| 307 | 294 |
| 308 // We may store the unsigned bit field as signed Smi value and do not | 295 // We may store the unsigned bit field as signed Smi value and do not |
| 309 // use the sign bit. | 296 // use the sign bit. |
| (...skipping 5420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5730 | 5717 |
| 5731 // Code aging. Indicates how many full GCs this code has survived without | 5718 // Code aging. Indicates how many full GCs this code has survived without |
| 5732 // being entered through the prologue. Used to determine when it is | 5719 // being entered through the prologue. Used to determine when it is |
| 5733 // relatively safe to flush this code object and replace it with the lazy | 5720 // relatively safe to flush this code object and replace it with the lazy |
| 5734 // compilation stub. | 5721 // compilation stub. |
| 5735 static void MakeCodeAgeSequenceYoung(byte* sequence, Isolate* isolate); | 5722 static void MakeCodeAgeSequenceYoung(byte* sequence, Isolate* isolate); |
| 5736 static void MarkCodeAsExecuted(byte* sequence, Isolate* isolate); | 5723 static void MarkCodeAsExecuted(byte* sequence, Isolate* isolate); |
| 5737 void MakeYoung(Isolate* isolate); | 5724 void MakeYoung(Isolate* isolate); |
| 5738 void PreAge(Isolate* isolate); | 5725 void PreAge(Isolate* isolate); |
| 5739 void MarkToBeExecutedOnce(Isolate* isolate); | 5726 void MarkToBeExecutedOnce(Isolate* isolate); |
| 5740 void MakeOlder(MarkingParity); | 5727 void MakeOlder(); |
| 5741 static bool IsYoungSequence(Isolate* isolate, byte* sequence); | 5728 static bool IsYoungSequence(Isolate* isolate, byte* sequence); |
| 5742 bool IsOld(); | 5729 bool IsOld(); |
| 5743 Age GetAge(); | 5730 Age GetAge(); |
| 5744 static inline Code* GetPreAgedCodeAgeStub(Isolate* isolate) { | 5731 static inline Code* GetPreAgedCodeAgeStub(Isolate* isolate) { |
| 5745 return GetCodeAgeStub(isolate, kNotExecutedCodeAge, NO_MARKING_PARITY); | 5732 return GetCodeAgeStub(isolate, kNotExecutedCodeAge); |
| 5746 } | 5733 } |
| 5747 | 5734 |
| 5748 void PrintDeoptLocation(FILE* out, Address pc); | 5735 void PrintDeoptLocation(FILE* out, Address pc); |
| 5749 bool CanDeoptAt(Address pc); | 5736 bool CanDeoptAt(Address pc); |
| 5750 | 5737 |
| 5751 #ifdef VERIFY_HEAP | 5738 #ifdef VERIFY_HEAP |
| 5752 void VerifyEmbeddedObjectsDependency(); | 5739 void VerifyEmbeddedObjectsDependency(); |
| 5753 #endif | 5740 #endif |
| 5754 | 5741 |
| 5755 #ifdef DEBUG | 5742 #ifdef DEBUG |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5877 | 5864 |
| 5878 // This constant should be encodable in an ARM instruction. | 5865 // This constant should be encodable in an ARM instruction. |
| 5879 static const int kFlagsNotUsedInLookup = CacheHolderField::kMask; | 5866 static const int kFlagsNotUsedInLookup = CacheHolderField::kMask; |
| 5880 | 5867 |
| 5881 private: | 5868 private: |
| 5882 friend class RelocIterator; | 5869 friend class RelocIterator; |
| 5883 friend class Deoptimizer; // For FindCodeAgeSequence. | 5870 friend class Deoptimizer; // For FindCodeAgeSequence. |
| 5884 | 5871 |
| 5885 // Code aging | 5872 // Code aging |
| 5886 byte* FindCodeAgeSequence(); | 5873 byte* FindCodeAgeSequence(); |
| 5887 static void GetCodeAgeAndParity(Code* code, Age* age, | 5874 static Age GetCodeAge(Isolate* isolate, byte* sequence); |
| 5888 MarkingParity* parity); | 5875 static Age GetAgeOfCodeAgeStub(Code* code); |
| 5889 static void GetCodeAgeAndParity(Isolate* isolate, byte* sequence, Age* age, | 5876 static Code* GetCodeAgeStub(Isolate* isolate, Age age); |
| 5890 MarkingParity* parity); | |
| 5891 static Code* GetCodeAgeStub(Isolate* isolate, Age age, MarkingParity parity); | |
| 5892 | 5877 |
| 5893 // Code aging -- platform-specific | 5878 // Code aging -- platform-specific |
| 5894 static void PatchPlatformCodeAge(Isolate* isolate, | 5879 static void PatchPlatformCodeAge(Isolate* isolate, byte* sequence, Age age); |
| 5895 byte* sequence, Age age, | |
| 5896 MarkingParity parity); | |
| 5897 | 5880 |
| 5898 DISALLOW_IMPLICIT_CONSTRUCTORS(Code); | 5881 DISALLOW_IMPLICIT_CONSTRUCTORS(Code); |
| 5899 }; | 5882 }; |
| 5900 | 5883 |
| 5901 class AbstractCode : public HeapObject { | 5884 class AbstractCode : public HeapObject { |
| 5902 public: | 5885 public: |
| 5903 // All code kinds and INTERPRETED_FUNCTION. | 5886 // All code kinds and INTERPRETED_FUNCTION. |
| 5904 enum Kind { | 5887 enum Kind { |
| 5905 #define DEFINE_CODE_KIND_ENUM(name) name, | 5888 #define DEFINE_CODE_KIND_ENUM(name) name, |
| 5906 CODE_KIND_LIST(DEFINE_CODE_KIND_ENUM) | 5889 CODE_KIND_LIST(DEFINE_CODE_KIND_ENUM) |
| (...skipping 6012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11919 } | 11902 } |
| 11920 return value; | 11903 return value; |
| 11921 } | 11904 } |
| 11922 }; | 11905 }; |
| 11923 | 11906 |
| 11924 | 11907 |
| 11925 } // NOLINT, false-positive due to second-order macros. | 11908 } // NOLINT, false-positive due to second-order macros. |
| 11926 } // NOLINT, false-positive due to second-order macros. | 11909 } // NOLINT, false-positive due to second-order macros. |
| 11927 | 11910 |
| 11928 #endif // V8_OBJECTS_H_ | 11911 #endif // V8_OBJECTS_H_ |
| OLD | NEW |