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_LAYOUT_DESCRIPTOR_INL_H_ | 5 #ifndef V8_LAYOUT_DESCRIPTOR_INL_H_ |
6 #define V8_LAYOUT_DESCRIPTOR_INL_H_ | 6 #define V8_LAYOUT_DESCRIPTOR_INL_H_ |
7 | 7 |
8 #include "src/layout-descriptor.h" | 8 #include "src/layout-descriptor.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 uint32_t value = get_scalar(layout_word_index); | 113 uint32_t value = get_scalar(layout_word_index); |
114 return (value & layout_mask) == 0; | 114 return (value & layout_mask) == 0; |
115 } else { | 115 } else { |
116 uint32_t value = static_cast<uint32_t>(Smi::cast(this)->value()); | 116 uint32_t value = static_cast<uint32_t>(Smi::cast(this)->value()); |
117 return (value & layout_mask) == 0; | 117 return (value & layout_mask) == 0; |
118 } | 118 } |
119 } | 119 } |
120 | 120 |
121 | 121 |
122 bool LayoutDescriptor::IsFastPointerLayout() { | 122 bool LayoutDescriptor::IsFastPointerLayout() { |
123 return IsSmi() && (Smi::cast(this)->value() == 0); | 123 return this == FastPointerLayout(); |
124 } | 124 } |
125 | 125 |
126 | 126 |
| 127 bool LayoutDescriptor::IsFastPointerLayout(Object* layout_descriptor) { |
| 128 return layout_descriptor == FastPointerLayout(); |
| 129 } |
| 130 |
| 131 |
127 bool LayoutDescriptor::IsSlowLayout() { return !IsSmi(); } | 132 bool LayoutDescriptor::IsSlowLayout() { return !IsSmi(); } |
128 | 133 |
129 | 134 |
130 int LayoutDescriptor::capacity() { | 135 int LayoutDescriptor::capacity() { |
131 return IsSlowLayout() ? (length() * kNumberOfBits) : kSmiValueSize; | 136 return IsSlowLayout() ? (length() * kNumberOfBits) : kSmiValueSize; |
132 } | 137 } |
133 | 138 |
134 | 139 |
135 LayoutDescriptor* LayoutDescriptor::cast_gc_safe(Object* object) { | 140 LayoutDescriptor* LayoutDescriptor::cast_gc_safe(Object* object) { |
136 if (object->IsSmi()) { | 141 if (object->IsSmi()) { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 // Object headers do not contain non-tagged fields. | 181 // Object headers do not contain non-tagged fields. |
177 if (offset_in_bytes < header_size_) return true; | 182 if (offset_in_bytes < header_size_) return true; |
178 int field_index = (offset_in_bytes - header_size_) / kPointerSize; | 183 int field_index = (offset_in_bytes - header_size_) / kPointerSize; |
179 | 184 |
180 return layout_descriptor_->IsTagged(field_index); | 185 return layout_descriptor_->IsTagged(field_index); |
181 } | 186 } |
182 } | 187 } |
183 } // namespace v8::internal | 188 } // namespace v8::internal |
184 | 189 |
185 #endif // V8_LAYOUT_DESCRIPTOR_INL_H_ | 190 #endif // V8_LAYOUT_DESCRIPTOR_INL_H_ |
OLD | NEW |