OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 void TransitionArray::set_elements_transition(Map* transition_map, | 76 void TransitionArray::set_elements_transition(Map* transition_map, |
77 WriteBarrierMode mode) { | 77 WriteBarrierMode mode) { |
78 Heap* heap = GetHeap(); | 78 Heap* heap = GetHeap(); |
79 WRITE_FIELD(this, kElementsTransitionOffset, transition_map); | 79 WRITE_FIELD(this, kElementsTransitionOffset, transition_map); |
80 CONDITIONAL_WRITE_BARRIER( | 80 CONDITIONAL_WRITE_BARRIER( |
81 heap, this, kElementsTransitionOffset, transition_map, mode); | 81 heap, this, kElementsTransitionOffset, transition_map, mode); |
82 } | 82 } |
83 | 83 |
84 | 84 |
85 DescriptorArray* TransitionArray::descriptors() { | 85 DescriptorArray* TransitionArray::descriptors() { |
86 return DescriptorArray::cast(descriptors_pointer()->value()); | 86 return DescriptorArray::cast(get(kDescriptorsIndex)); |
87 } | 87 } |
88 | 88 |
89 | 89 |
90 void TransitionArray::set_descriptors(DescriptorArray* descriptors) { | 90 void TransitionArray::set_descriptors(DescriptorArray* descriptors, |
91 ASSERT(!this->descriptors()->IsDescriptorArray() || | 91 WriteBarrierMode mode) { |
92 descriptors->number_of_descriptors() == 0 || | 92 Heap* heap = GetHeap(); |
93 descriptors->HasEnumCache() || | 93 WRITE_FIELD(this, kDescriptorsOffset, descriptors); |
94 !this->descriptors()->HasEnumCache()); | 94 CONDITIONAL_WRITE_BARRIER( |
95 descriptors_pointer()->set_value(descriptors); | 95 heap, this, kDescriptorsOffset, descriptors, mode); |
96 } | 96 } |
97 | 97 |
98 | 98 |
99 JSGlobalPropertyCell* TransitionArray::descriptors_pointer() { | 99 Object** TransitionArray::GetDescriptorsSlot() { |
100 return JSGlobalPropertyCell::cast(get(kDescriptorsPointerIndex)); | 100 return HeapObject::RawField(reinterpret_cast<HeapObject*>(this), |
| 101 kDescriptorsOffset); |
101 } | 102 } |
102 | 103 |
103 | 104 |
104 void TransitionArray::set_descriptors_pointer(JSGlobalPropertyCell* pointer) { | |
105 set(kDescriptorsPointerIndex, pointer); | |
106 } | |
107 | |
108 | |
109 Object* TransitionArray::back_pointer_storage() { | 105 Object* TransitionArray::back_pointer_storage() { |
110 return get(kBackPointerStorageIndex); | 106 return get(kBackPointerStorageIndex); |
111 } | 107 } |
112 | 108 |
113 | 109 |
114 void TransitionArray::set_back_pointer_storage(Object* back_pointer, | 110 void TransitionArray::set_back_pointer_storage(Object* back_pointer, |
115 WriteBarrierMode mode) { | 111 WriteBarrierMode mode) { |
116 Heap* heap = GetHeap(); | 112 Heap* heap = GetHeap(); |
117 WRITE_FIELD(this, kBackPointerStorageOffset, back_pointer); | 113 WRITE_FIELD(this, kBackPointerStorageOffset, back_pointer); |
118 CONDITIONAL_WRITE_BARRIER( | 114 CONDITIONAL_WRITE_BARRIER( |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 | 185 |
190 PropertyDetails TransitionArray::GetTargetDetails(int transition_number) { | 186 PropertyDetails TransitionArray::GetTargetDetails(int transition_number) { |
191 Map* map = GetTarget(transition_number); | 187 Map* map = GetTarget(transition_number); |
192 DescriptorArray* descriptors = map->instance_descriptors(); | 188 DescriptorArray* descriptors = map->instance_descriptors(); |
193 int descriptor = map->LastAdded(); | 189 int descriptor = map->LastAdded(); |
194 return descriptors->GetDetails(descriptor); | 190 return descriptors->GetDetails(descriptor); |
195 } | 191 } |
196 | 192 |
197 | 193 |
198 int TransitionArray::Search(String* name) { | 194 int TransitionArray::Search(String* name) { |
199 return internal::Search<ALL_ENTRIES>(this, name); | 195 return internal::Search(this, name); |
200 } | 196 } |
201 | 197 |
202 | 198 |
203 void TransitionArray::NoIncrementalWriteBarrierSet(int transition_number, | 199 void TransitionArray::NoIncrementalWriteBarrierSet(int transition_number, |
204 String* key, | 200 String* key, |
205 Map* target) { | 201 Map* target) { |
206 FixedArray::NoIncrementalWriteBarrierSet( | 202 FixedArray::NoIncrementalWriteBarrierSet( |
207 this, ToKeyIndex(transition_number), key); | 203 this, ToKeyIndex(transition_number), key); |
208 FixedArray::NoIncrementalWriteBarrierSet( | 204 FixedArray::NoIncrementalWriteBarrierSet( |
209 this, ToTargetIndex(transition_number), target); | 205 this, ToTargetIndex(transition_number), target); |
210 } | 206 } |
211 | 207 |
212 | 208 |
213 #undef FIELD_ADDR | 209 #undef FIELD_ADDR |
214 #undef WRITE_FIELD | 210 #undef WRITE_FIELD |
215 #undef CONDITIONAL_WRITE_BARRIER | 211 #undef CONDITIONAL_WRITE_BARRIER |
216 | 212 |
217 | 213 |
218 } } // namespace v8::internal | 214 } } // namespace v8::internal |
219 | 215 |
220 #endif // V8_TRANSITIONS_INL_H_ | 216 #endif // V8_TRANSITIONS_INL_H_ |
OLD | NEW |