Chromium Code Reviews| 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 "src/allocation.h" | 8 #include "src/allocation.h" |
| 9 #include "src/assert-scope.h" | 9 #include "src/assert-scope.h" |
| 10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
| (...skipping 3150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3161 | 3161 |
| 3162 // Fields in kSmallLayout2Offset. | 3162 // Fields in kSmallLayout2Offset. |
| 3163 class Int32CountField: public BitField<int, 1, kSmallLayoutCountBits> {}; | 3163 class Int32CountField: public BitField<int, 1, kSmallLayoutCountBits> {}; |
| 3164 class TotalCountField: public BitField<int, 11, 12> {}; | 3164 class TotalCountField: public BitField<int, 11, 12> {}; |
| 3165 class WeakObjectStateField: public BitField<WeakObjectState, 23, 2> {}; | 3165 class WeakObjectStateField: public BitField<WeakObjectState, 23, 2> {}; |
| 3166 | 3166 |
| 3167 // Extended layout description, which starts at | 3167 // Extended layout description, which starts at |
| 3168 // get_extended_section_header_offset(). | 3168 // get_extended_section_header_offset(). |
| 3169 static const int kExtendedInt64CountOffset = 0; | 3169 static const int kExtendedInt64CountOffset = 0; |
| 3170 static const int kExtendedCodePtrCountOffset = | 3170 static const int kExtendedCodePtrCountOffset = |
| 3171 kExtendedInt64CountOffset + kPointerSize; | 3171 kExtendedInt64CountOffset + kInt32Size; |
|
Sven Panne
2014/09/16 10:48:40
I think that this is wrong: We access this via REA
rmcilroy
2014/09/18 10:54:44
Yeah I agree - Andrew - could you change the acces
andrew_low
2014/09/22 17:49:18
Done.
| |
| 3172 static const int kExtendedHeapPtrCountOffset = | 3172 static const int kExtendedHeapPtrCountOffset = |
| 3173 kExtendedCodePtrCountOffset + kPointerSize; | 3173 kExtendedCodePtrCountOffset + kInt32Size; |
| 3174 static const int kExtendedInt32CountOffset = | 3174 static const int kExtendedInt32CountOffset = |
| 3175 kExtendedHeapPtrCountOffset + kPointerSize; | 3175 kExtendedHeapPtrCountOffset + kInt32Size; |
| 3176 static const int kExtendedFirstOffset = | 3176 static const int kExtendedFirstOffset = |
| 3177 kExtendedInt32CountOffset + kPointerSize; | 3177 kExtendedInt32CountOffset + kInt32Size; |
| 3178 | 3178 |
| 3179 // Dispatched behavior. | 3179 // Dispatched behavior. |
| 3180 void ConstantPoolIterateBody(ObjectVisitor* v); | 3180 void ConstantPoolIterateBody(ObjectVisitor* v); |
| 3181 | 3181 |
| 3182 DECLARE_PRINTER(ConstantPoolArray) | 3182 DECLARE_PRINTER(ConstantPoolArray) |
| 3183 DECLARE_VERIFIER(ConstantPoolArray) | 3183 DECLARE_VERIFIER(ConstantPoolArray) |
| 3184 | 3184 |
| 3185 private: | 3185 private: |
| 3186 inline int first_extended_section_index(); | 3186 inline int first_extended_section_index(); |
| 3187 inline int get_extended_section_header_offset(); | 3187 inline int get_extended_section_header_offset(); |
| (...skipping 2487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5675 static const int kICAgeOffset = | 5675 static const int kICAgeOffset = |
| 5676 kGCMetadataOffset + kPointerSize; | 5676 kGCMetadataOffset + kPointerSize; |
| 5677 static const int kFlagsOffset = kICAgeOffset + kIntSize; | 5677 static const int kFlagsOffset = kICAgeOffset + kIntSize; |
| 5678 static const int kKindSpecificFlags1Offset = kFlagsOffset + kIntSize; | 5678 static const int kKindSpecificFlags1Offset = kFlagsOffset + kIntSize; |
| 5679 static const int kKindSpecificFlags2Offset = | 5679 static const int kKindSpecificFlags2Offset = |
| 5680 kKindSpecificFlags1Offset + kIntSize; | 5680 kKindSpecificFlags1Offset + kIntSize; |
| 5681 // Note: We might be able to squeeze this into the flags above. | 5681 // Note: We might be able to squeeze this into the flags above. |
| 5682 static const int kPrologueOffset = kKindSpecificFlags2Offset + kIntSize; | 5682 static const int kPrologueOffset = kKindSpecificFlags2Offset + kIntSize; |
| 5683 static const int kConstantPoolOffset = kPrologueOffset + kPointerSize; | 5683 static const int kConstantPoolOffset = kPrologueOffset + kPointerSize; |
| 5684 | 5684 |
| 5685 static const int kHeaderPaddingStart = kConstantPoolOffset + kIntSize; | 5685 static const int kHeaderPaddingStart = kConstantPoolOffset + kPointerSize; |
| 5686 | 5686 |
| 5687 // Add padding to align the instruction start following right after | 5687 // Add padding to align the instruction start following right after |
| 5688 // the Code object header. | 5688 // the Code object header. |
| 5689 static const int kHeaderSize = | 5689 static const int kHeaderSize = |
| 5690 (kHeaderPaddingStart + kCodeAlignmentMask) & ~kCodeAlignmentMask; | 5690 (kHeaderPaddingStart + kCodeAlignmentMask) & ~kCodeAlignmentMask; |
| 5691 | 5691 |
| 5692 // Byte offsets within kKindSpecificFlags1Offset. | 5692 // Byte offsets within kKindSpecificFlags1Offset. |
| 5693 static const int kOptimizableOffset = kKindSpecificFlags1Offset; | 5693 static const int kOptimizableOffset = kKindSpecificFlags1Offset; |
| 5694 | 5694 |
| 5695 static const int kFullCodeFlags = kOptimizableOffset + 1; | 5695 static const int kFullCodeFlags = kOptimizableOffset + 1; |
| (...skipping 1549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7245 kAstNodeCountOffset + kPointerSize; | 7245 kAstNodeCountOffset + kPointerSize; |
| 7246 | 7246 |
| 7247 // Total size. | 7247 // Total size. |
| 7248 static const int kSize = kProfilerTicksOffset + kPointerSize; | 7248 static const int kSize = kProfilerTicksOffset + kPointerSize; |
| 7249 #else | 7249 #else |
| 7250 // The only reason to use smi fields instead of int fields | 7250 // The only reason to use smi fields instead of int fields |
| 7251 // is to allow iteration without maps decoding during | 7251 // is to allow iteration without maps decoding during |
| 7252 // garbage collections. | 7252 // garbage collections. |
| 7253 // To avoid wasting space on 64-bit architectures we use | 7253 // To avoid wasting space on 64-bit architectures we use |
| 7254 // the following trick: we group integer fields into pairs | 7254 // the following trick: we group integer fields into pairs |
| 7255 // First integer in each pair is shifted left by 1. | 7255 // The least significant integer in each pair is shifted left by 1. |
| 7256 // By doing this we guarantee that LSB of each kPointerSize aligned | 7256 // By doing this we guarantee that LSB of each kPointerSize aligned |
| 7257 // word is not set and thus this word cannot be treated as pointer | 7257 // word is not set and thus this word cannot be treated as pointer |
| 7258 // to HeapObject during old space traversal. | 7258 // to HeapObject during old space traversal. |
| 7259 #if V8_TARGET_LITTLE_ENDIAN | |
| 7259 static const int kLengthOffset = | 7260 static const int kLengthOffset = |
| 7260 kFeedbackVectorOffset + kPointerSize; | 7261 kFeedbackVectorOffset + kPointerSize; |
| 7261 static const int kFormalParameterCountOffset = | 7262 static const int kFormalParameterCountOffset = |
| 7262 kLengthOffset + kIntSize; | 7263 kLengthOffset + kIntSize; |
| 7263 | 7264 |
| 7264 static const int kExpectedNofPropertiesOffset = | 7265 static const int kExpectedNofPropertiesOffset = |
| 7265 kFormalParameterCountOffset + kIntSize; | 7266 kFormalParameterCountOffset + kIntSize; |
| 7266 static const int kNumLiteralsOffset = | 7267 static const int kNumLiteralsOffset = |
| 7267 kExpectedNofPropertiesOffset + kIntSize; | 7268 kExpectedNofPropertiesOffset + kIntSize; |
| 7268 | 7269 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 7282 kOptCountAndBailoutReasonOffset + kIntSize; | 7283 kOptCountAndBailoutReasonOffset + kIntSize; |
| 7283 | 7284 |
| 7284 static const int kAstNodeCountOffset = | 7285 static const int kAstNodeCountOffset = |
| 7285 kCountersOffset + kIntSize; | 7286 kCountersOffset + kIntSize; |
| 7286 static const int kProfilerTicksOffset = | 7287 static const int kProfilerTicksOffset = |
| 7287 kAstNodeCountOffset + kIntSize; | 7288 kAstNodeCountOffset + kIntSize; |
| 7288 | 7289 |
| 7289 // Total size. | 7290 // Total size. |
| 7290 static const int kSize = kProfilerTicksOffset + kIntSize; | 7291 static const int kSize = kProfilerTicksOffset + kIntSize; |
| 7291 | 7292 |
| 7292 #endif | 7293 #elif V8_TARGET_BIG_ENDIAN |
|
Sven Panne
2014/09/16 10:48:40
This is very fragile: At least we have to cross-re
andrew_low
2014/09/22 17:49:18
It's not clear what you're suggesting should be do
| |
| 7294 static const int kFormalParameterCountOffset = | |
| 7295 kFeedbackVectorOffset + kPointerSize; | |
| 7296 static const int kLengthOffset = kFormalParameterCountOffset + kIntSize; | |
| 7297 | |
| 7298 static const int kNumLiteralsOffset = kLengthOffset + kIntSize; | |
| 7299 static const int kExpectedNofPropertiesOffset = kNumLiteralsOffset + kIntSize; | |
| 7300 | |
| 7301 static const int kStartPositionAndTypeOffset = | |
| 7302 kExpectedNofPropertiesOffset + kIntSize; | |
| 7303 static const int kEndPositionOffset = kStartPositionAndTypeOffset + kIntSize; | |
| 7304 | |
| 7305 static const int kCompilerHintsOffset = kEndPositionOffset + kIntSize; | |
| 7306 static const int kFunctionTokenPositionOffset = | |
| 7307 kCompilerHintsOffset + kIntSize; | |
| 7308 | |
| 7309 static const int kCountersOffset = kFunctionTokenPositionOffset + kIntSize; | |
| 7310 static const int kOptCountAndBailoutReasonOffset = kCountersOffset + kIntSize; | |
| 7311 | |
| 7312 static const int kProfilerTicksOffset = | |
| 7313 kOptCountAndBailoutReasonOffset + kIntSize; | |
| 7314 static const int kAstNodeCountOffset = kProfilerTicksOffset + kIntSize; | |
| 7315 | |
| 7316 // Total size. | |
| 7317 static const int kSize = kAstNodeCountOffset + kIntSize; | |
| 7318 | |
| 7319 #else | |
| 7320 #error Unknown byte ordering | |
| 7321 #endif // Big endian | |
| 7322 #endif // 64-bit | |
| 7323 | |
| 7293 | 7324 |
| 7294 static const int kAlignedSize = POINTER_SIZE_ALIGN(kSize); | 7325 static const int kAlignedSize = POINTER_SIZE_ALIGN(kSize); |
| 7295 | 7326 |
| 7296 typedef FixedBodyDescriptor<kNameOffset, | 7327 typedef FixedBodyDescriptor<kNameOffset, |
| 7297 kFeedbackVectorOffset + kPointerSize, | 7328 kFeedbackVectorOffset + kPointerSize, |
| 7298 kSize> BodyDescriptor; | 7329 kSize> BodyDescriptor; |
| 7299 | 7330 |
| 7300 // Bit positions in start_position_and_type. | 7331 // Bit positions in start_position_and_type. |
| 7301 // The source code start position is in the 30 most significant bits of | 7332 // The source code start position is in the 30 most significant bits of |
| 7302 // the start_position_and_type field. | 7333 // the start_position_and_type field. |
| (...skipping 1502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8805 inline bool AsArrayIndex(uint32_t* index); | 8836 inline bool AsArrayIndex(uint32_t* index); |
| 8806 | 8837 |
| 8807 // Whether name can only name own properties. | 8838 // Whether name can only name own properties. |
| 8808 inline bool IsOwn(); | 8839 inline bool IsOwn(); |
| 8809 | 8840 |
| 8810 DECLARE_CAST(Name) | 8841 DECLARE_CAST(Name) |
| 8811 | 8842 |
| 8812 DECLARE_PRINTER(Name) | 8843 DECLARE_PRINTER(Name) |
| 8813 | 8844 |
| 8814 // Layout description. | 8845 // Layout description. |
| 8815 static const int kHashFieldOffset = HeapObject::kHeaderSize; | 8846 static const int kHashFieldSlot = HeapObject::kHeaderSize; |
| 8816 static const int kSize = kHashFieldOffset + kPointerSize; | 8847 #if V8_TARGET_LITTLE_ENDIAN || !V8_HOST_ARCH_64_BIT |
| 8848 static const int kHashFieldOffset = kHashFieldSlot; | |
| 8849 #else | |
| 8850 static const int kHashFieldOffset = kHashFieldSlot + kIntSize; | |
| 8851 #endif | |
| 8852 static const int kSize = kHashFieldSlot + kPointerSize; | |
| 8817 | 8853 |
| 8818 // Mask constant for checking if a name has a computed hash code | 8854 // Mask constant for checking if a name has a computed hash code |
| 8819 // and if it is a string that is an array index. The least significant bit | 8855 // and if it is a string that is an array index. The least significant bit |
| 8820 // indicates whether a hash code has been computed. If the hash code has | 8856 // indicates whether a hash code has been computed. If the hash code has |
| 8821 // been computed the 2nd bit tells whether the string can be used as an | 8857 // been computed the 2nd bit tells whether the string can be used as an |
| 8822 // array index. | 8858 // array index. |
| 8823 static const int kHashNotComputedMask = 1; | 8859 static const int kHashNotComputedMask = 1; |
| 8824 static const int kIsNotArrayIndexMask = 1 << 1; | 8860 static const int kIsNotArrayIndexMask = 1 << 1; |
| 8825 static const int kNofHashBitFields = 2; | 8861 static const int kNofHashBitFields = 2; |
| 8826 | 8862 |
| (...skipping 2308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11135 } else { | 11171 } else { |
| 11136 value &= ~(1 << bit_position); | 11172 value &= ~(1 << bit_position); |
| 11137 } | 11173 } |
| 11138 return value; | 11174 return value; |
| 11139 } | 11175 } |
| 11140 }; | 11176 }; |
| 11141 | 11177 |
| 11142 } } // namespace v8::internal | 11178 } } // namespace v8::internal |
| 11143 | 11179 |
| 11144 #endif // V8_OBJECTS_H_ | 11180 #endif // V8_OBJECTS_H_ |
| OLD | NEW |