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_INL_H_ | 5 #ifndef V8_FIELD_INDEX_INL_H_ |
6 #define V8_FIELD_INDEX_INL_H_ | 6 #define V8_FIELD_INDEX_INL_H_ |
7 | 7 |
8 #include "src/field-index.h" | 8 #include "src/field-index.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 25 matching lines...) Expand all Loading... |
36 } | 36 } |
37 return FieldIndex(is_inobject, | 37 return FieldIndex(is_inobject, |
38 property_index + first_inobject_offset / kPointerSize, | 38 property_index + first_inobject_offset / kPointerSize, |
39 is_double, inobject_properties, first_inobject_offset); | 39 is_double, inobject_properties, first_inobject_offset); |
40 } | 40 } |
41 | 41 |
42 // Takes an index as computed by GetLoadByFieldIndex and reconstructs a | 42 // Takes an index as computed by GetLoadByFieldIndex and reconstructs a |
43 // FieldIndex object from it. | 43 // FieldIndex object from it. |
44 inline FieldIndex FieldIndex::ForLoadByFieldIndex(Map* map, int orig_index) { | 44 inline FieldIndex FieldIndex::ForLoadByFieldIndex(Map* map, int orig_index) { |
45 int field_index = orig_index; | 45 int field_index = orig_index; |
46 int is_inobject = true; | 46 bool is_inobject = true; |
47 bool is_double = field_index & 1; | 47 bool is_double = field_index & 1; |
48 int first_inobject_offset = 0; | 48 int first_inobject_offset = 0; |
49 field_index >>= 1; | 49 field_index >>= 1; |
50 if (field_index < 0) { | 50 if (field_index < 0) { |
51 field_index = -(field_index + 1); | 51 field_index = -(field_index + 1); |
52 is_inobject = false; | 52 is_inobject = false; |
53 first_inobject_offset = FixedArray::kHeaderSize; | 53 first_inobject_offset = FixedArray::kHeaderSize; |
54 field_index += FixedArray::kHeaderSize / kPointerSize; | 54 field_index += FixedArray::kHeaderSize / kPointerSize; |
55 } else { | 55 } else { |
56 first_inobject_offset = map->GetInObjectPropertyOffset(0); | 56 first_inobject_offset = map->GetInObjectPropertyOffset(0); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 } | 93 } |
94 | 94 |
95 inline FieldIndex FieldIndex::FromFieldAccessStubKey(int key) { | 95 inline FieldIndex FieldIndex::FromFieldAccessStubKey(int key) { |
96 return FieldIndex(key); | 96 return FieldIndex(key); |
97 } | 97 } |
98 | 98 |
99 } // namespace internal | 99 } // namespace internal |
100 } // namespace v8 | 100 } // namespace v8 |
101 | 101 |
102 #endif | 102 #endif |
OLD | NEW |