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 7126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7137 // TODO(mstarzinger): This method should be moved into MarkCompactCollector, | 7137 // TODO(mstarzinger): This method should be moved into MarkCompactCollector, |
7138 // because it cannot be called from outside the GC and we already have methods | 7138 // because it cannot be called from outside the GC and we already have methods |
7139 // depending on the transitions layout in the GC anyways. | 7139 // depending on the transitions layout in the GC anyways. |
7140 void Map::ClearNonLiveTransitions(Heap* heap) { | 7140 void Map::ClearNonLiveTransitions(Heap* heap) { |
7141 // If there are no transitions to be cleared, return. | 7141 // If there are no transitions to be cleared, return. |
7142 // TODO(verwaest) Should be an assert, otherwise back pointers are not | 7142 // TODO(verwaest) Should be an assert, otherwise back pointers are not |
7143 // properly cleared. | 7143 // properly cleared. |
7144 if (!HasTransitionArray()) return; | 7144 if (!HasTransitionArray()) return; |
7145 | 7145 |
7146 TransitionArray* t = transitions(); | 7146 TransitionArray* t = transitions(); |
| 7147 MarkCompactCollector* collector = heap->mark_compact_collector(); |
7147 | 7148 |
7148 int transition_index = 0; | 7149 int transition_index = 0; |
7149 | 7150 |
7150 // Compact all live descriptors to the left. | 7151 // Compact all live descriptors to the left. |
7151 for (int i = 0; i < t->number_of_transitions(); ++i) { | 7152 for (int i = 0; i < t->number_of_transitions(); ++i) { |
7152 if (!ClearBackPointer(heap, t->GetTarget(i))) { | 7153 if (!ClearBackPointer(heap, t->GetTarget(i))) { |
7153 if (i != transition_index) { | 7154 if (i != transition_index) { |
7154 String* key = t->GetKey(i); | 7155 String* key = t->GetKey(i); |
7155 Map* target = t->GetTarget(i); | |
7156 t->SetKey(transition_index, key); | 7156 t->SetKey(transition_index, key); |
7157 t->SetTarget(transition_index, target); | |
7158 MarkCompactCollector* collector = heap->mark_compact_collector(); | |
7159 Object** key_slot = t->GetKeySlot(transition_index); | 7157 Object** key_slot = t->GetKeySlot(transition_index); |
7160 collector->RecordSlot(key_slot, key_slot, key); | 7158 collector->RecordSlot(key_slot, key_slot, key); |
7161 Object** target_slot = t->GetTargetSlot(transition_index); | 7159 // Target slots do not need to be recorded since maps are not compacted. |
7162 collector->RecordSlot(target_slot, target_slot, target); | 7160 t->SetTarget(transition_index, t->GetTarget(i)); |
7163 } | 7161 } |
7164 transition_index++; | 7162 transition_index++; |
7165 } | 7163 } |
7166 } | 7164 } |
7167 | 7165 |
7168 if (t->HasElementsTransition() && | 7166 if (t->HasElementsTransition() && |
7169 ClearBackPointer(heap, t->elements_transition())) { | 7167 ClearBackPointer(heap, t->elements_transition())) { |
7170 t->ClearElementsTransition(); | 7168 t->ClearElementsTransition(); |
7171 } else { | 7169 } else { |
7172 // If there are no transitions to be cleared, return. | 7170 // If there are no transitions to be cleared, return. |
(...skipping 5868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13041 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 13039 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
13042 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 13040 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
13043 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 13041 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
13044 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 13042 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
13045 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 13043 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
13046 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 13044 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
13047 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 13045 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
13048 } | 13046 } |
13049 | 13047 |
13050 } } // namespace v8::internal | 13048 } } // namespace v8::internal |
OLD | NEW |