OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_FIELD_INDEX_H_ | 5 #ifndef V8_FIELD_INDEX_H_ |
6 #define V8_FIELD_INDEX_H_ | 6 #define V8_FIELD_INDEX_H_ |
7 | 7 |
8 #include "src/property-details.h" | 8 #include "src/property-details.h" |
9 #include "src/utils.h" | 9 #include "src/utils.h" |
10 | 10 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 return result; | 69 return result; |
70 } | 70 } |
71 | 71 |
72 int GetKeyedLookupCacheIndex() const; | 72 int GetKeyedLookupCacheIndex() const; |
73 | 73 |
74 int GetFieldAccessStubKey() const { | 74 int GetFieldAccessStubKey() const { |
75 return bit_field_ & | 75 return bit_field_ & |
76 (IsInObjectBits::kMask | IsDoubleBits::kMask | IndexBits::kMask); | 76 (IsInObjectBits::kMask | IsDoubleBits::kMask | IndexBits::kMask); |
77 } | 77 } |
78 | 78 |
| 79 // For GetLoadByFieldOffset. |
| 80 class FieldOffsetIsInobject : public BitField<bool, 1, 1> {}; |
| 81 class FieldOffsetIsDouble : public BitField<bool, 2, 1> {}; |
| 82 class FieldOffsetOffset : public BitField<int, 3, 27> {}; |
| 83 // Make sure we don't overflow into the sign bit. |
| 84 STATIC_ASSERT(FieldOffsetOffset::kNext <= kSmiValueSize - 1); |
| 85 |
79 private: | 86 private: |
80 FieldIndex(bool is_inobject, int local_index, bool is_double, | 87 FieldIndex(bool is_inobject, int local_index, bool is_double, |
81 int inobject_properties, int first_inobject_property_offset, | 88 int inobject_properties, int first_inobject_property_offset, |
82 bool is_hidden = false) { | 89 bool is_hidden = false) { |
83 DCHECK((first_inobject_property_offset & (kPointerSize - 1)) == 0); | 90 DCHECK((first_inobject_property_offset & (kPointerSize - 1)) == 0); |
84 bit_field_ = IsInObjectBits::encode(is_inobject) | | 91 bit_field_ = IsInObjectBits::encode(is_inobject) | |
85 IsDoubleBits::encode(is_double) | | 92 IsDoubleBits::encode(is_double) | |
86 FirstInobjectPropertyOffsetBits::encode(first_inobject_property_offset) | | 93 FirstInobjectPropertyOffsetBits::encode(first_inobject_property_offset) | |
87 IsHiddenField::encode(is_hidden) | | 94 IsHiddenField::encode(is_hidden) | |
88 IndexBits::encode(local_index) | | 95 IndexBits::encode(local_index) | |
(...skipping 23 matching lines...) Expand all Loading... |
112 : public BitField<bool, FirstInobjectPropertyOffsetBits::kNext, 1> {}; | 119 : public BitField<bool, FirstInobjectPropertyOffsetBits::kNext, 1> {}; |
113 STATIC_ASSERT(IsHiddenField::kNext <= 32); | 120 STATIC_ASSERT(IsHiddenField::kNext <= 32); |
114 | 121 |
115 int bit_field_; | 122 int bit_field_; |
116 }; | 123 }; |
117 | 124 |
118 } // namespace internal | 125 } // namespace internal |
119 } // namespace v8 | 126 } // namespace v8 |
120 | 127 |
121 #endif | 128 #endif |
OLD | NEW |