OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 2825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2836 | 2836 |
2837 // Fields in kSmallLayout2Offset. | 2837 // Fields in kSmallLayout2Offset. |
2838 class Int32CountField: public BitField<int, 1, kSmallLayoutCountBits> {}; | 2838 class Int32CountField: public BitField<int, 1, kSmallLayoutCountBits> {}; |
2839 class TotalCountField: public BitField<int, 11, 12> {}; | 2839 class TotalCountField: public BitField<int, 11, 12> {}; |
2840 class WeakObjectStateField: public BitField<WeakObjectState, 23, 2> {}; | 2840 class WeakObjectStateField: public BitField<WeakObjectState, 23, 2> {}; |
2841 | 2841 |
2842 // Extended layout description, which starts at | 2842 // Extended layout description, which starts at |
2843 // get_extended_section_header_offset(). | 2843 // get_extended_section_header_offset(). |
2844 static const int kExtendedInt64CountOffset = 0; | 2844 static const int kExtendedInt64CountOffset = 0; |
2845 static const int kExtendedCodePtrCountOffset = | 2845 static const int kExtendedCodePtrCountOffset = |
2846 kExtendedInt64CountOffset + kPointerSize; | 2846 kExtendedInt64CountOffset + kInt32Size; |
2847 static const int kExtendedHeapPtrCountOffset = | 2847 static const int kExtendedHeapPtrCountOffset = |
2848 kExtendedCodePtrCountOffset + kPointerSize; | 2848 kExtendedCodePtrCountOffset + kInt32Size; |
2849 static const int kExtendedInt32CountOffset = | 2849 static const int kExtendedInt32CountOffset = |
2850 kExtendedHeapPtrCountOffset + kPointerSize; | 2850 kExtendedHeapPtrCountOffset + kInt32Size; |
2851 static const int kExtendedFirstOffset = | 2851 static const int kExtendedFirstOffset = |
2852 kExtendedInt32CountOffset + kPointerSize; | 2852 kExtendedInt32CountOffset + kInt32Size; |
2853 | 2853 |
2854 // Dispatched behavior. | 2854 // Dispatched behavior. |
2855 void ConstantPoolIterateBody(ObjectVisitor* v); | 2855 void ConstantPoolIterateBody(ObjectVisitor* v); |
2856 | 2856 |
2857 DECLARE_PRINTER(ConstantPoolArray) | 2857 DECLARE_PRINTER(ConstantPoolArray) |
2858 DECLARE_VERIFIER(ConstantPoolArray) | 2858 DECLARE_VERIFIER(ConstantPoolArray) |
2859 | 2859 |
2860 private: | 2860 private: |
2861 inline int first_extended_section_index(); | 2861 inline int first_extended_section_index(); |
2862 inline int get_extended_section_header_offset(); | 2862 inline int get_extended_section_header_offset(); |
(...skipping 2495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5358 static const int kICAgeOffset = | 5358 static const int kICAgeOffset = |
5359 kGCMetadataOffset + kPointerSize; | 5359 kGCMetadataOffset + kPointerSize; |
5360 static const int kFlagsOffset = kICAgeOffset + kIntSize; | 5360 static const int kFlagsOffset = kICAgeOffset + kIntSize; |
5361 static const int kKindSpecificFlags1Offset = kFlagsOffset + kIntSize; | 5361 static const int kKindSpecificFlags1Offset = kFlagsOffset + kIntSize; |
5362 static const int kKindSpecificFlags2Offset = | 5362 static const int kKindSpecificFlags2Offset = |
5363 kKindSpecificFlags1Offset + kIntSize; | 5363 kKindSpecificFlags1Offset + kIntSize; |
5364 // Note: We might be able to squeeze this into the flags above. | 5364 // Note: We might be able to squeeze this into the flags above. |
5365 static const int kPrologueOffset = kKindSpecificFlags2Offset + kIntSize; | 5365 static const int kPrologueOffset = kKindSpecificFlags2Offset + kIntSize; |
5366 static const int kConstantPoolOffset = kPrologueOffset + kPointerSize; | 5366 static const int kConstantPoolOffset = kPrologueOffset + kPointerSize; |
5367 | 5367 |
5368 static const int kHeaderPaddingStart = kConstantPoolOffset + kIntSize; | 5368 static const int kHeaderPaddingStart = kConstantPoolOffset + kPointerSize; |
5369 | 5369 |
5370 // Add padding to align the instruction start following right after | 5370 // Add padding to align the instruction start following right after |
5371 // the Code object header. | 5371 // the Code object header. |
5372 static const int kHeaderSize = | 5372 static const int kHeaderSize = |
5373 (kHeaderPaddingStart + kCodeAlignmentMask) & ~kCodeAlignmentMask; | 5373 (kHeaderPaddingStart + kCodeAlignmentMask) & ~kCodeAlignmentMask; |
5374 | 5374 |
5375 // Byte offsets within kKindSpecificFlags1Offset. | 5375 // Byte offsets within kKindSpecificFlags1Offset. |
5376 static const int kOptimizableOffset = kKindSpecificFlags1Offset; | 5376 static const int kOptimizableOffset = kKindSpecificFlags1Offset; |
5377 | 5377 |
5378 static const int kFullCodeFlags = kOptimizableOffset + 1; | 5378 static const int kFullCodeFlags = kOptimizableOffset + 1; |
(...skipping 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6929 kAstNodeCountOffset + kPointerSize; | 6929 kAstNodeCountOffset + kPointerSize; |
6930 | 6930 |
6931 // Total size. | 6931 // Total size. |
6932 static const int kSize = kProfilerTicksOffset + kPointerSize; | 6932 static const int kSize = kProfilerTicksOffset + kPointerSize; |
6933 #else | 6933 #else |
6934 // The only reason to use smi fields instead of int fields | 6934 // The only reason to use smi fields instead of int fields |
6935 // is to allow iteration without maps decoding during | 6935 // is to allow iteration without maps decoding during |
6936 // garbage collections. | 6936 // garbage collections. |
6937 // To avoid wasting space on 64-bit architectures we use | 6937 // To avoid wasting space on 64-bit architectures we use |
6938 // the following trick: we group integer fields into pairs | 6938 // the following trick: we group integer fields into pairs |
6939 // First integer in each pair is shifted left by 1. | 6939 // The least significant integer in each pair is shifted left by 1. |
6940 // By doing this we guarantee that LSB of each kPointerSize aligned | 6940 // By doing this we guarantee that LSB of each kPointerSize aligned |
6941 // word is not set and thus this word cannot be treated as pointer | 6941 // word is not set and thus this word cannot be treated as pointer |
6942 // to HeapObject during old space traversal. | 6942 // to HeapObject during old space traversal. |
| 6943 #if V8_TARGET_LITTLE_ENDIAN |
6943 static const int kLengthOffset = | 6944 static const int kLengthOffset = |
6944 kFeedbackVectorOffset + kPointerSize; | 6945 kFeedbackVectorOffset + kPointerSize; |
6945 static const int kFormalParameterCountOffset = | 6946 static const int kFormalParameterCountOffset = |
6946 kLengthOffset + kIntSize; | 6947 kLengthOffset + kIntSize; |
6947 | 6948 |
6948 static const int kExpectedNofPropertiesOffset = | 6949 static const int kExpectedNofPropertiesOffset = |
6949 kFormalParameterCountOffset + kIntSize; | 6950 kFormalParameterCountOffset + kIntSize; |
6950 static const int kNumLiteralsOffset = | 6951 static const int kNumLiteralsOffset = |
6951 kExpectedNofPropertiesOffset + kIntSize; | 6952 kExpectedNofPropertiesOffset + kIntSize; |
6952 | 6953 |
(...skipping 13 matching lines...) Expand all Loading... |
6966 kOptCountAndBailoutReasonOffset + kIntSize; | 6967 kOptCountAndBailoutReasonOffset + kIntSize; |
6967 | 6968 |
6968 static const int kAstNodeCountOffset = | 6969 static const int kAstNodeCountOffset = |
6969 kCountersOffset + kIntSize; | 6970 kCountersOffset + kIntSize; |
6970 static const int kProfilerTicksOffset = | 6971 static const int kProfilerTicksOffset = |
6971 kAstNodeCountOffset + kIntSize; | 6972 kAstNodeCountOffset + kIntSize; |
6972 | 6973 |
6973 // Total size. | 6974 // Total size. |
6974 static const int kSize = kProfilerTicksOffset + kIntSize; | 6975 static const int kSize = kProfilerTicksOffset + kIntSize; |
6975 | 6976 |
6976 #endif | 6977 #elif V8_TARGET_BIG_ENDIAN |
| 6978 static const int kFormalParameterCountOffset = |
| 6979 kFeedbackVectorOffset + kPointerSize; |
| 6980 static const int kLengthOffset = kFormalParameterCountOffset + kIntSize; |
| 6981 |
| 6982 static const int kNumLiteralsOffset = kLengthOffset + kIntSize; |
| 6983 static const int kExpectedNofPropertiesOffset = kNumLiteralsOffset + kIntSize; |
| 6984 |
| 6985 static const int kStartPositionAndTypeOffset = |
| 6986 kExpectedNofPropertiesOffset + kIntSize; |
| 6987 static const int kEndPositionOffset = kStartPositionAndTypeOffset + kIntSize; |
| 6988 |
| 6989 static const int kCompilerHintsOffset = kEndPositionOffset + kIntSize; |
| 6990 static const int kFunctionTokenPositionOffset = |
| 6991 kCompilerHintsOffset + kIntSize; |
| 6992 |
| 6993 static const int kCountersOffset = kFunctionTokenPositionOffset + kIntSize; |
| 6994 static const int kOptCountAndBailoutReasonOffset = kCountersOffset + kIntSize; |
| 6995 |
| 6996 static const int kProfilerTicksOffset = |
| 6997 kOptCountAndBailoutReasonOffset + kIntSize; |
| 6998 static const int kAstNodeCountOffset = kProfilerTicksOffset + kIntSize; |
| 6999 |
| 7000 // Total size. |
| 7001 static const int kSize = kAstNodeCountOffset + kIntSize; |
| 7002 |
| 7003 #else |
| 7004 #error Unknown byte ordering |
| 7005 #endif // Big endian |
| 7006 #endif // 64-bit |
| 7007 |
6977 | 7008 |
6978 static const int kAlignedSize = POINTER_SIZE_ALIGN(kSize); | 7009 static const int kAlignedSize = POINTER_SIZE_ALIGN(kSize); |
6979 | 7010 |
6980 typedef FixedBodyDescriptor<kNameOffset, | 7011 typedef FixedBodyDescriptor<kNameOffset, |
6981 kFeedbackVectorOffset + kPointerSize, | 7012 kFeedbackVectorOffset + kPointerSize, |
6982 kSize> BodyDescriptor; | 7013 kSize> BodyDescriptor; |
6983 | 7014 |
6984 // Bit positions in start_position_and_type. | 7015 // Bit positions in start_position_and_type. |
6985 // The source code start position is in the 30 most significant bits of | 7016 // The source code start position is in the 30 most significant bits of |
6986 // the start_position_and_type field. | 7017 // the start_position_and_type field. |
(...skipping 1488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8475 inline bool AsArrayIndex(uint32_t* index); | 8506 inline bool AsArrayIndex(uint32_t* index); |
8476 | 8507 |
8477 // Whether name can only name own properties. | 8508 // Whether name can only name own properties. |
8478 inline bool IsOwn(); | 8509 inline bool IsOwn(); |
8479 | 8510 |
8480 DECLARE_CAST(Name) | 8511 DECLARE_CAST(Name) |
8481 | 8512 |
8482 DECLARE_PRINTER(Name) | 8513 DECLARE_PRINTER(Name) |
8483 | 8514 |
8484 // Layout description. | 8515 // Layout description. |
8485 static const int kHashFieldOffset = HeapObject::kHeaderSize; | 8516 static const int kHashFieldSlot = HeapObject::kHeaderSize; |
8486 static const int kSize = kHashFieldOffset + kPointerSize; | 8517 #if V8_TARGET_LITTLE_ENDIAN || !V8_HOST_ARCH_64_BIT |
| 8518 static const int kHashFieldOffset = kHashFieldSlot; |
| 8519 #else |
| 8520 static const int kHashFieldOffset = kHashFieldSlot + kIntSize; |
| 8521 #endif |
| 8522 static const int kSize = kHashFieldSlot + kPointerSize; |
8487 | 8523 |
8488 // Mask constant for checking if a name has a computed hash code | 8524 // Mask constant for checking if a name has a computed hash code |
8489 // and if it is a string that is an array index. The least significant bit | 8525 // and if it is a string that is an array index. The least significant bit |
8490 // indicates whether a hash code has been computed. If the hash code has | 8526 // indicates whether a hash code has been computed. If the hash code has |
8491 // been computed the 2nd bit tells whether the string can be used as an | 8527 // been computed the 2nd bit tells whether the string can be used as an |
8492 // array index. | 8528 // array index. |
8493 static const int kHashNotComputedMask = 1; | 8529 static const int kHashNotComputedMask = 1; |
8494 static const int kIsNotArrayIndexMask = 1 << 1; | 8530 static const int kIsNotArrayIndexMask = 1 << 1; |
8495 static const int kNofHashBitFields = 2; | 8531 static const int kNofHashBitFields = 2; |
8496 | 8532 |
(...skipping 2308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10805 } else { | 10841 } else { |
10806 value &= ~(1 << bit_position); | 10842 value &= ~(1 << bit_position); |
10807 } | 10843 } |
10808 return value; | 10844 return value; |
10809 } | 10845 } |
10810 }; | 10846 }; |
10811 | 10847 |
10812 } } // namespace v8::internal | 10848 } } // namespace v8::internal |
10813 | 10849 |
10814 #endif // V8_OBJECTS_H_ | 10850 #endif // V8_OBJECTS_H_ |
OLD | NEW |