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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
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 bool TransitionArray::HasPrototypeTransitions() { |
| 86 Object* prototype_transitions = get(kPrototypeTransitionsIndex); |
| 87 return prototype_transitions != Smi::FromInt(0); |
| 88 } |
| 89 |
| 90 |
| 91 FixedArray* TransitionArray::prototype_transitions() { |
| 92 Object* prototype_transitions = get(kPrototypeTransitionsIndex); |
| 93 return FixedArray::cast(prototype_transitions); |
| 94 } |
| 95 |
| 96 |
| 97 HeapObject* TransitionArray::unchecked_prototype_transitions() { |
| 98 Object* prototype_transitions = get(kPrototypeTransitionsIndex); |
| 99 if (prototype_transitions == Smi::FromInt(0)) return NULL; |
| 100 return reinterpret_cast<HeapObject*>(prototype_transitions); |
| 101 } |
| 102 |
| 103 |
| 104 void TransitionArray::set_prototype_transitions(FixedArray* transitions, |
| 105 WriteBarrierMode mode) { |
| 106 ASSERT(this != NULL); |
| 107 ASSERT(transitions->IsFixedArray()); |
| 108 Heap* heap = GetHeap(); |
| 109 WRITE_FIELD(this, kPrototypeTransitionsOffset, transitions); |
| 110 CONDITIONAL_WRITE_BARRIER( |
| 111 heap, this, kPrototypeTransitionsOffset, transitions, mode); |
| 112 } |
| 113 |
| 114 |
| 115 Object** TransitionArray::GetPrototypeTransitionsSlot() { |
| 116 return HeapObject::RawField(reinterpret_cast<HeapObject*>(this), |
| 117 kPrototypeTransitionsOffset); |
| 118 } |
| 119 |
| 120 |
85 Object** TransitionArray::GetKeySlot(int transition_number) { | 121 Object** TransitionArray::GetKeySlot(int transition_number) { |
86 ASSERT(transition_number < number_of_transitions()); | 122 ASSERT(transition_number < number_of_transitions()); |
87 return HeapObject::RawField( | 123 return HeapObject::RawField( |
88 reinterpret_cast<HeapObject*>(this), | 124 reinterpret_cast<HeapObject*>(this), |
89 OffsetOfElementAt(ToKeyIndex(transition_number))); | 125 OffsetOfElementAt(ToKeyIndex(transition_number))); |
90 } | 126 } |
91 | 127 |
92 | 128 |
93 String* TransitionArray::GetKey(int transition_number) { | 129 String* TransitionArray::GetKey(int transition_number) { |
94 ASSERT(transition_number < number_of_transitions()); | 130 ASSERT(transition_number < number_of_transitions()); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 | 209 |
174 | 210 |
175 #undef FIELD_ADDR | 211 #undef FIELD_ADDR |
176 #undef WRITE_FIELD | 212 #undef WRITE_FIELD |
177 #undef CONDITIONAL_WRITE_BARRIER | 213 #undef CONDITIONAL_WRITE_BARRIER |
178 | 214 |
179 | 215 |
180 } } // namespace v8::internal | 216 } } // namespace v8::internal |
181 | 217 |
182 #endif // V8_TRANSITIONS_INL_H_ | 218 #endif // V8_TRANSITIONS_INL_H_ |
OLD | NEW |