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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 }; | 187 }; |
188 | 188 |
189 | 189 |
190 // Indicates whether we are only interested in the descriptors of a particular | 190 // Indicates whether we are only interested in the descriptors of a particular |
191 // map, or in all descriptors in the descriptor array. | 191 // map, or in all descriptors in the descriptor array. |
192 enum DescriptorFlag { | 192 enum DescriptorFlag { |
193 ALL_DESCRIPTORS, | 193 ALL_DESCRIPTORS, |
194 OWN_DESCRIPTORS | 194 OWN_DESCRIPTORS |
195 }; | 195 }; |
196 | 196 |
| 197 // The GC maintains a bit of information, the MarkingParity, which toggles |
| 198 // from odd to even and back every time marking is completed. Incremental |
| 199 // marking can visit an object twice during a marking phase, so algorithms that |
| 200 // that piggy-back on marking can use the parity to ensure that they only |
| 201 // perform an operation on an object once per marking phase: they record the |
| 202 // MarkingParity when they visit an object, and only re-visit the object when it |
| 203 // is marked again and the MarkingParity changes. |
| 204 enum MarkingParity { |
| 205 NO_MARKING_PARITY, |
| 206 ODD_MARKING_PARITY, |
| 207 EVEN_MARKING_PARITY |
| 208 }; |
197 | 209 |
198 // Instance size sentinel for objects of variable size. | 210 // Instance size sentinel for objects of variable size. |
199 const int kVariableSizeSentinel = 0; | 211 const int kVariableSizeSentinel = 0; |
200 | 212 |
201 const int kStubMajorKeyBits = 6; | 213 const int kStubMajorKeyBits = 6; |
202 const int kStubMinorKeyBits = kBitsPerInt - kSmiTagSize - kStubMajorKeyBits; | 214 const int kStubMinorKeyBits = kBitsPerInt - kSmiTagSize - kStubMajorKeyBits; |
203 | 215 |
204 // All Maps have a field instance_type containing a InstanceType. | 216 // All Maps have a field instance_type containing a InstanceType. |
205 // It describes the type of the instances. | 217 // It describes the type of the instances. |
206 // | 218 // |
(...skipping 4326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4533 inline void CodePrint() { | 4545 inline void CodePrint() { |
4534 CodePrint(stdout); | 4546 CodePrint(stdout); |
4535 } | 4547 } |
4536 void CodePrint(FILE* out); | 4548 void CodePrint(FILE* out); |
4537 #endif | 4549 #endif |
4538 DECLARE_VERIFIER(Code) | 4550 DECLARE_VERIFIER(Code) |
4539 | 4551 |
4540 void ClearInlineCaches(); | 4552 void ClearInlineCaches(); |
4541 void ClearTypeFeedbackCells(Heap* heap); | 4553 void ClearTypeFeedbackCells(Heap* heap); |
4542 | 4554 |
| 4555 #define DECLARE_CODE_AGE_ENUM(X) k##X##CodeAge, |
| 4556 enum Age { |
| 4557 kNoAge = 0, |
| 4558 CODE_AGE_LIST(DECLARE_CODE_AGE_ENUM) |
| 4559 kAfterLastCodeAge, |
| 4560 kLastCodeAge = kAfterLastCodeAge - 1, |
| 4561 kCodeAgeCount = kAfterLastCodeAge - 1 |
| 4562 }; |
| 4563 #undef DECLARE_CODE_AGE_ENUM |
| 4564 |
| 4565 // Code aging |
| 4566 static void MakeCodeAgeSequenceYoung(byte* sequence); |
| 4567 void MakeYoung(); |
| 4568 void MakeOlder(MarkingParity); |
| 4569 static bool IsYoungSequence(byte* sequence); |
| 4570 bool IsOld(); |
| 4571 |
4543 // Max loop nesting marker used to postpose OSR. We don't take loop | 4572 // Max loop nesting marker used to postpose OSR. We don't take loop |
4544 // nesting that is deeper than 5 levels into account. | 4573 // nesting that is deeper than 5 levels into account. |
4545 static const int kMaxLoopNestingMarker = 6; | 4574 static const int kMaxLoopNestingMarker = 6; |
4546 | 4575 |
4547 // Layout description. | 4576 // Layout description. |
4548 static const int kInstructionSizeOffset = HeapObject::kHeaderSize; | 4577 static const int kInstructionSizeOffset = HeapObject::kHeaderSize; |
4549 static const int kRelocationInfoOffset = kInstructionSizeOffset + kIntSize; | 4578 static const int kRelocationInfoOffset = kInstructionSizeOffset + kIntSize; |
4550 static const int kHandlerTableOffset = kRelocationInfoOffset + kPointerSize; | 4579 static const int kHandlerTableOffset = kRelocationInfoOffset + kPointerSize; |
4551 static const int kDeoptimizationDataOffset = | 4580 static const int kDeoptimizationDataOffset = |
4552 kHandlerTableOffset + kPointerSize; | 4581 kHandlerTableOffset + kPointerSize; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4661 | 4690 |
4662 // Signed field cannot be encoded using the BitField class. | 4691 // Signed field cannot be encoded using the BitField class. |
4663 static const int kArgumentsCountShift = 14; | 4692 static const int kArgumentsCountShift = 14; |
4664 static const int kArgumentsCountMask = ~((1 << kArgumentsCountShift) - 1); | 4693 static const int kArgumentsCountMask = ~((1 << kArgumentsCountShift) - 1); |
4665 | 4694 |
4666 // This constant should be encodable in an ARM instruction. | 4695 // This constant should be encodable in an ARM instruction. |
4667 static const int kFlagsNotUsedInLookup = | 4696 static const int kFlagsNotUsedInLookup = |
4668 TypeField::kMask | CacheHolderField::kMask; | 4697 TypeField::kMask | CacheHolderField::kMask; |
4669 | 4698 |
4670 private: | 4699 private: |
| 4700 friend class RelocIterator; |
| 4701 |
| 4702 // Code aging |
| 4703 byte* FindCodeAgeSequence(); |
| 4704 static void GetCodeAgeAndParity(Code* code, Age* age, |
| 4705 MarkingParity* parity); |
| 4706 static void GetCodeAgeAndParity(byte* sequence, Age* age, |
| 4707 MarkingParity* parity); |
| 4708 static Code* GetCodeAgeStub(Age age, MarkingParity parity); |
| 4709 |
| 4710 // Code aging -- platform-specific |
| 4711 byte* FindPlatformCodeAgeSequence(); |
| 4712 static void PatchPlatformCodeAge(byte* sequence, Age age, |
| 4713 MarkingParity parity); |
| 4714 |
4671 DISALLOW_IMPLICIT_CONSTRUCTORS(Code); | 4715 DISALLOW_IMPLICIT_CONSTRUCTORS(Code); |
4672 }; | 4716 }; |
4673 | 4717 |
4674 | 4718 |
4675 // All heap objects have a Map that describes their structure. | 4719 // All heap objects have a Map that describes their structure. |
4676 // A Map contains information about: | 4720 // A Map contains information about: |
4677 // - Size information about the object | 4721 // - Size information about the object |
4678 // - How to iterate over an object (for garbage collection) | 4722 // - How to iterate over an object (for garbage collection) |
4679 class Map: public HeapObject { | 4723 class Map: public HeapObject { |
4680 public: | 4724 public: |
(...skipping 4230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8911 | 8955 |
8912 // Visits the resource of an ASCII or two-byte string. | 8956 // Visits the resource of an ASCII or two-byte string. |
8913 virtual void VisitExternalAsciiString( | 8957 virtual void VisitExternalAsciiString( |
8914 v8::String::ExternalAsciiStringResource** resource) {} | 8958 v8::String::ExternalAsciiStringResource** resource) {} |
8915 virtual void VisitExternalTwoByteString( | 8959 virtual void VisitExternalTwoByteString( |
8916 v8::String::ExternalStringResource** resource) {} | 8960 v8::String::ExternalStringResource** resource) {} |
8917 | 8961 |
8918 // Visits a debug call target in the instruction stream. | 8962 // Visits a debug call target in the instruction stream. |
8919 virtual void VisitDebugTarget(RelocInfo* rinfo); | 8963 virtual void VisitDebugTarget(RelocInfo* rinfo); |
8920 | 8964 |
| 8965 // Visits the byte sequence in a function's prologue that contains information |
| 8966 // about the code's age. |
| 8967 virtual void VisitCodeAgeSequence(RelocInfo* rinfo); |
| 8968 |
8921 // Handy shorthand for visiting a single pointer. | 8969 // Handy shorthand for visiting a single pointer. |
8922 virtual void VisitPointer(Object** p) { VisitPointers(p, p + 1); } | 8970 virtual void VisitPointer(Object** p) { VisitPointers(p, p + 1); } |
8923 | 8971 |
8924 // Visit pointer embedded into a code object. | 8972 // Visit pointer embedded into a code object. |
8925 virtual void VisitEmbeddedPointer(RelocInfo* rinfo); | 8973 virtual void VisitEmbeddedPointer(RelocInfo* rinfo); |
8926 | 8974 |
8927 // Visits a contiguous arrays of external references (references to the C++ | 8975 // Visits a contiguous arrays of external references (references to the C++ |
8928 // heap) in the half-open range [start, end). Any or all of the values | 8976 // heap) in the half-open range [start, end). Any or all of the values |
8929 // may be modified on return. | 8977 // may be modified on return. |
8930 virtual void VisitExternalReferences(Address* start, Address* end) {} | 8978 virtual void VisitExternalReferences(Address* start, Address* end) {} |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8976 } else { | 9024 } else { |
8977 value &= ~(1 << bit_position); | 9025 value &= ~(1 << bit_position); |
8978 } | 9026 } |
8979 return value; | 9027 return value; |
8980 } | 9028 } |
8981 }; | 9029 }; |
8982 | 9030 |
8983 } } // namespace v8::internal | 9031 } } // namespace v8::internal |
8984 | 9032 |
8985 #endif // V8_OBJECTS_H_ | 9033 #endif // V8_OBJECTS_H_ |
OLD | NEW |