OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/base/atomicops.h" | 7 #include "src/base/atomicops.h" |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/compilation-cache.h" | 10 #include "src/compilation-cache.h" |
(...skipping 2135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2146 // The map has aged. Do not retain this map. | 2146 // The map has aged. Do not retain this map. |
2147 continue; | 2147 continue; |
2148 } | 2148 } |
2149 Object* constructor = map->GetConstructor(); | 2149 Object* constructor = map->GetConstructor(); |
2150 if (!constructor->IsHeapObject() || | 2150 if (!constructor->IsHeapObject() || |
2151 !Marking::MarkBitFrom(HeapObject::cast(constructor)).Get()) { | 2151 !Marking::MarkBitFrom(HeapObject::cast(constructor)).Get()) { |
2152 // The constructor is dead, no new objects with this map can | 2152 // The constructor is dead, no new objects with this map can |
2153 // be created. Do not retain this map. | 2153 // be created. Do not retain this map. |
2154 continue; | 2154 continue; |
2155 } | 2155 } |
2156 new_age = age - 1; | 2156 Object* prototype = map->prototype(); |
| 2157 if (prototype->IsHeapObject() && |
| 2158 !Marking::MarkBitFrom(HeapObject::cast(prototype)).Get()) { |
| 2159 // The prototype is not marked, age the map. |
| 2160 new_age = age - 1; |
| 2161 } else { |
| 2162 // The prototype and the constructor are marked, this map keeps only |
| 2163 // transition tree alive, not JSObjects. Do not age the map. |
| 2164 new_age = age; |
| 2165 } |
2157 MarkObject(map, map_mark); | 2166 MarkObject(map, map_mark); |
2158 } else { | 2167 } else { |
2159 new_age = FLAG_retain_maps_for_n_gc; | 2168 new_age = FLAG_retain_maps_for_n_gc; |
2160 } | 2169 } |
2161 if (i != new_length) { | 2170 if (i != new_length) { |
2162 retained_maps->Set(new_length, cell); | 2171 retained_maps->Set(new_length, cell); |
2163 Object** slot = retained_maps->Slot(new_length); | 2172 Object** slot = retained_maps->Slot(new_length); |
2164 RecordSlot(slot, slot, cell); | 2173 RecordSlot(slot, slot, cell); |
2165 retained_maps->Set(new_length + 1, Smi::FromInt(new_age)); | 2174 retained_maps->Set(new_length + 1, Smi::FromInt(new_age)); |
2166 } else if (new_age != age) { | 2175 } else if (new_age != age) { |
(...skipping 2450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4617 SlotsBuffer* buffer = *buffer_address; | 4626 SlotsBuffer* buffer = *buffer_address; |
4618 while (buffer != NULL) { | 4627 while (buffer != NULL) { |
4619 SlotsBuffer* next_buffer = buffer->next(); | 4628 SlotsBuffer* next_buffer = buffer->next(); |
4620 DeallocateBuffer(buffer); | 4629 DeallocateBuffer(buffer); |
4621 buffer = next_buffer; | 4630 buffer = next_buffer; |
4622 } | 4631 } |
4623 *buffer_address = NULL; | 4632 *buffer_address = NULL; |
4624 } | 4633 } |
4625 } | 4634 } |
4626 } // namespace v8::internal | 4635 } // namespace v8::internal |
OLD | NEW |