| 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 4308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4515 inline void CodePrint() { | 4527 inline void CodePrint() { |
| 4516 CodePrint(stdout); | 4528 CodePrint(stdout); |
| 4517 } | 4529 } |
| 4518 void CodePrint(FILE* out); | 4530 void CodePrint(FILE* out); |
| 4519 #endif | 4531 #endif |
| 4520 DECLARE_VERIFIER(Code) | 4532 DECLARE_VERIFIER(Code) |
| 4521 | 4533 |
| 4522 void ClearInlineCaches(); | 4534 void ClearInlineCaches(); |
| 4523 void ClearTypeFeedbackCells(Heap* heap); | 4535 void ClearTypeFeedbackCells(Heap* heap); |
| 4524 | 4536 |
| 4537 #define DECLARE_CODE_AGE_ENUM(X) k##X##CodeAge, |
| 4538 enum Age { |
| 4539 kNoAge = 0, |
| 4540 CODE_AGE_LIST(DECLARE_CODE_AGE_ENUM) |
| 4541 kAfterLastCodeAge, |
| 4542 kLastCodeAge = kAfterLastCodeAge - 1, |
| 4543 kCodeAgeCount = kAfterLastCodeAge - 1 |
| 4544 }; |
| 4545 #undef DECLARE_CODE_AGE_ENUM |
| 4546 |
| 4547 // Code aging |
| 4548 static void MakeCodeAgeSequenceYoung(byte* sequence); |
| 4549 void MakeYoung(); |
| 4550 void MakeOlder(MarkingParity); |
| 4551 static bool IsYoungSequence(byte* sequence); |
| 4552 bool IsOld(); |
| 4553 |
| 4525 // Max loop nesting marker used to postpose OSR. We don't take loop | 4554 // Max loop nesting marker used to postpose OSR. We don't take loop |
| 4526 // nesting that is deeper than 5 levels into account. | 4555 // nesting that is deeper than 5 levels into account. |
| 4527 static const int kMaxLoopNestingMarker = 6; | 4556 static const int kMaxLoopNestingMarker = 6; |
| 4528 | 4557 |
| 4529 // Layout description. | 4558 // Layout description. |
| 4530 static const int kInstructionSizeOffset = HeapObject::kHeaderSize; | 4559 static const int kInstructionSizeOffset = HeapObject::kHeaderSize; |
| 4531 static const int kRelocationInfoOffset = kInstructionSizeOffset + kIntSize; | 4560 static const int kRelocationInfoOffset = kInstructionSizeOffset + kIntSize; |
| 4532 static const int kHandlerTableOffset = kRelocationInfoOffset + kPointerSize; | 4561 static const int kHandlerTableOffset = kRelocationInfoOffset + kPointerSize; |
| 4533 static const int kDeoptimizationDataOffset = | 4562 static const int kDeoptimizationDataOffset = |
| 4534 kHandlerTableOffset + kPointerSize; | 4563 kHandlerTableOffset + kPointerSize; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4643 | 4672 |
| 4644 // Signed field cannot be encoded using the BitField class. | 4673 // Signed field cannot be encoded using the BitField class. |
| 4645 static const int kArgumentsCountShift = 14; | 4674 static const int kArgumentsCountShift = 14; |
| 4646 static const int kArgumentsCountMask = ~((1 << kArgumentsCountShift) - 1); | 4675 static const int kArgumentsCountMask = ~((1 << kArgumentsCountShift) - 1); |
| 4647 | 4676 |
| 4648 // This constant should be encodable in an ARM instruction. | 4677 // This constant should be encodable in an ARM instruction. |
| 4649 static const int kFlagsNotUsedInLookup = | 4678 static const int kFlagsNotUsedInLookup = |
| 4650 TypeField::kMask | CacheHolderField::kMask; | 4679 TypeField::kMask | CacheHolderField::kMask; |
| 4651 | 4680 |
| 4652 private: | 4681 private: |
| 4682 friend class RelocIterator; |
| 4683 |
| 4684 // Code aging |
| 4685 byte* FindCodeAgeSequence(); |
| 4686 static void GetCodeAgeAndParity(Code* code, Age* age, |
| 4687 MarkingParity* parity); |
| 4688 static void GetCodeAgeAndParity(byte* sequence, Age* age, |
| 4689 MarkingParity* parity); |
| 4690 static Code* GetCodeAgeStub(Age age, MarkingParity parity); |
| 4691 |
| 4692 // Code aging -- platform-specific |
| 4693 byte* FindPlatformCodeAgeSequence(); |
| 4694 static void PatchPlatformCodeAge(byte* sequence, Age age, |
| 4695 MarkingParity parity); |
| 4696 |
| 4653 DISALLOW_IMPLICIT_CONSTRUCTORS(Code); | 4697 DISALLOW_IMPLICIT_CONSTRUCTORS(Code); |
| 4654 }; | 4698 }; |
| 4655 | 4699 |
| 4656 | 4700 |
| 4657 // All heap objects have a Map that describes their structure. | 4701 // All heap objects have a Map that describes their structure. |
| 4658 // A Map contains information about: | 4702 // A Map contains information about: |
| 4659 // - Size information about the object | 4703 // - Size information about the object |
| 4660 // - How to iterate over an object (for garbage collection) | 4704 // - How to iterate over an object (for garbage collection) |
| 4661 class Map: public HeapObject { | 4705 class Map: public HeapObject { |
| 4662 public: | 4706 public: |
| (...skipping 4227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8890 | 8934 |
| 8891 // Visits the resource of an ASCII or two-byte string. | 8935 // Visits the resource of an ASCII or two-byte string. |
| 8892 virtual void VisitExternalAsciiString( | 8936 virtual void VisitExternalAsciiString( |
| 8893 v8::String::ExternalAsciiStringResource** resource) {} | 8937 v8::String::ExternalAsciiStringResource** resource) {} |
| 8894 virtual void VisitExternalTwoByteString( | 8938 virtual void VisitExternalTwoByteString( |
| 8895 v8::String::ExternalStringResource** resource) {} | 8939 v8::String::ExternalStringResource** resource) {} |
| 8896 | 8940 |
| 8897 // Visits a debug call target in the instruction stream. | 8941 // Visits a debug call target in the instruction stream. |
| 8898 virtual void VisitDebugTarget(RelocInfo* rinfo); | 8942 virtual void VisitDebugTarget(RelocInfo* rinfo); |
| 8899 | 8943 |
| 8944 // Visits the byte sequence in a function's prologue that contains information |
| 8945 // about the code's age. |
| 8946 virtual void VisitCodeAgeSequence(RelocInfo* rinfo); |
| 8947 |
| 8900 // Handy shorthand for visiting a single pointer. | 8948 // Handy shorthand for visiting a single pointer. |
| 8901 virtual void VisitPointer(Object** p) { VisitPointers(p, p + 1); } | 8949 virtual void VisitPointer(Object** p) { VisitPointers(p, p + 1); } |
| 8902 | 8950 |
| 8903 // Visit pointer embedded into a code object. | 8951 // Visit pointer embedded into a code object. |
| 8904 virtual void VisitEmbeddedPointer(RelocInfo* rinfo); | 8952 virtual void VisitEmbeddedPointer(RelocInfo* rinfo); |
| 8905 | 8953 |
| 8906 // Visits a contiguous arrays of external references (references to the C++ | 8954 // Visits a contiguous arrays of external references (references to the C++ |
| 8907 // heap) in the half-open range [start, end). Any or all of the values | 8955 // heap) in the half-open range [start, end). Any or all of the values |
| 8908 // may be modified on return. | 8956 // may be modified on return. |
| 8909 virtual void VisitExternalReferences(Address* start, Address* end) {} | 8957 virtual void VisitExternalReferences(Address* start, Address* end) {} |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8955 } else { | 9003 } else { |
| 8956 value &= ~(1 << bit_position); | 9004 value &= ~(1 << bit_position); |
| 8957 } | 9005 } |
| 8958 return value; | 9006 return value; |
| 8959 } | 9007 } |
| 8960 }; | 9008 }; |
| 8961 | 9009 |
| 8962 } } // namespace v8::internal | 9010 } } // namespace v8::internal |
| 8963 | 9011 |
| 8964 #endif // V8_OBJECTS_H_ | 9012 #endif // V8_OBJECTS_H_ |
| OLD | NEW |