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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 bool operator==(FieldIndex const& other) const { | 79 bool operator==(FieldIndex const& other) const { |
80 return bit_field_ == other.bit_field_; | 80 return bit_field_ == other.bit_field_; |
81 } | 81 } |
82 bool operator!=(FieldIndex const& other) const { return !(*this == other); } | 82 bool operator!=(FieldIndex const& other) const { return !(*this == other); } |
83 | 83 |
| 84 // For GetLoadByFieldOffset. |
| 85 class FieldOffsetIsInobject : public BitField<bool, 1, 1> {}; |
| 86 class FieldOffsetIsDouble : public BitField<bool, 2, 1> {}; |
| 87 class FieldOffsetOffset : public BitField<int, 3, 27> {}; |
| 88 // Make sure we don't overflow into the sign bit. |
| 89 STATIC_ASSERT(FieldOffsetOffset::kNext <= kSmiValueSize - 1); |
| 90 |
84 private: | 91 private: |
85 FieldIndex(bool is_inobject, int local_index, bool is_double, | 92 FieldIndex(bool is_inobject, int local_index, bool is_double, |
86 int inobject_properties, int first_inobject_property_offset, | 93 int inobject_properties, int first_inobject_property_offset, |
87 bool is_hidden = false) { | 94 bool is_hidden = false) { |
88 DCHECK((first_inobject_property_offset & (kPointerSize - 1)) == 0); | 95 DCHECK((first_inobject_property_offset & (kPointerSize - 1)) == 0); |
89 bit_field_ = IsInObjectBits::encode(is_inobject) | | 96 bit_field_ = IsInObjectBits::encode(is_inobject) | |
90 IsDoubleBits::encode(is_double) | | 97 IsDoubleBits::encode(is_double) | |
91 FirstInobjectPropertyOffsetBits::encode(first_inobject_property_offset) | | 98 FirstInobjectPropertyOffsetBits::encode(first_inobject_property_offset) | |
92 IsHiddenField::encode(is_hidden) | | 99 IsHiddenField::encode(is_hidden) | |
93 IndexBits::encode(local_index) | | 100 IndexBits::encode(local_index) | |
(...skipping 23 matching lines...) Expand all Loading... |
117 : public BitField<bool, FirstInobjectPropertyOffsetBits::kNext, 1> {}; | 124 : public BitField<bool, FirstInobjectPropertyOffsetBits::kNext, 1> {}; |
118 STATIC_ASSERT(IsHiddenField::kNext <= 32); | 125 STATIC_ASSERT(IsHiddenField::kNext <= 32); |
119 | 126 |
120 int bit_field_; | 127 int bit_field_; |
121 }; | 128 }; |
122 | 129 |
123 } // namespace internal | 130 } // namespace internal |
124 } // namespace v8 | 131 } // namespace v8 |
125 | 132 |
126 #endif | 133 #endif |
OLD | NEW |