| 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 | |
| 91 private: | 84 private: |
| 92 FieldIndex(bool is_inobject, int local_index, bool is_double, | 85 FieldIndex(bool is_inobject, int local_index, bool is_double, |
| 93 int inobject_properties, int first_inobject_property_offset, | 86 int inobject_properties, int first_inobject_property_offset, |
| 94 bool is_hidden = false) { | 87 bool is_hidden = false) { |
| 95 DCHECK((first_inobject_property_offset & (kPointerSize - 1)) == 0); | 88 DCHECK((first_inobject_property_offset & (kPointerSize - 1)) == 0); |
| 96 bit_field_ = IsInObjectBits::encode(is_inobject) | | 89 bit_field_ = IsInObjectBits::encode(is_inobject) | |
| 97 IsDoubleBits::encode(is_double) | | 90 IsDoubleBits::encode(is_double) | |
| 98 FirstInobjectPropertyOffsetBits::encode(first_inobject_property_offset) | | 91 FirstInobjectPropertyOffsetBits::encode(first_inobject_property_offset) | |
| 99 IsHiddenField::encode(is_hidden) | | 92 IsHiddenField::encode(is_hidden) | |
| 100 IndexBits::encode(local_index) | | 93 IndexBits::encode(local_index) | |
| (...skipping 23 matching lines...) Expand all Loading... |
| 124 : public BitField<bool, FirstInobjectPropertyOffsetBits::kNext, 1> {}; | 117 : public BitField<bool, FirstInobjectPropertyOffsetBits::kNext, 1> {}; |
| 125 STATIC_ASSERT(IsHiddenField::kNext <= 32); | 118 STATIC_ASSERT(IsHiddenField::kNext <= 32); |
| 126 | 119 |
| 127 int bit_field_; | 120 int bit_field_; |
| 128 }; | 121 }; |
| 129 | 122 |
| 130 } // namespace internal | 123 } // namespace internal |
| 131 } // namespace v8 | 124 } // namespace v8 |
| 132 | 125 |
| 133 #endif | 126 #endif |
| OLD | NEW |