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 "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #include "accessors.h" | 7 #include "accessors.h" |
8 #include "api.h" | 8 #include "api.h" |
9 #include "bootstrapper.h" | 9 #include "bootstrapper.h" |
10 #include "codegen.h" | 10 #include "codegen.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 max_semi_space_size_ = reserved_semispace_size_ = V8_MAX_SEMISPACE_SIZE; | 138 max_semi_space_size_ = reserved_semispace_size_ = V8_MAX_SEMISPACE_SIZE; |
139 #endif | 139 #endif |
140 | 140 |
141 // Ensure old_generation_size_ is a multiple of kPageSize. | 141 // Ensure old_generation_size_ is a multiple of kPageSize. |
142 ASSERT(MB >= Page::kPageSize); | 142 ASSERT(MB >= Page::kPageSize); |
143 | 143 |
144 memset(roots_, 0, sizeof(roots_[0]) * kRootListLength); | 144 memset(roots_, 0, sizeof(roots_[0]) * kRootListLength); |
145 set_native_contexts_list(NULL); | 145 set_native_contexts_list(NULL); |
146 set_array_buffers_list(Smi::FromInt(0)); | 146 set_array_buffers_list(Smi::FromInt(0)); |
147 set_allocation_sites_list(Smi::FromInt(0)); | 147 set_allocation_sites_list(Smi::FromInt(0)); |
| 148 set_encountered_weak_collections(Smi::FromInt(0)); |
148 // Put a dummy entry in the remembered pages so we can find the list the | 149 // Put a dummy entry in the remembered pages so we can find the list the |
149 // minidump even if there are no real unmapped pages. | 150 // minidump even if there are no real unmapped pages. |
150 RememberUnmappedPage(NULL, false); | 151 RememberUnmappedPage(NULL, false); |
151 | 152 |
152 ClearObjectStats(true); | 153 ClearObjectStats(true); |
153 } | 154 } |
154 | 155 |
155 | 156 |
156 intptr_t Heap::Capacity() { | 157 intptr_t Heap::Capacity() { |
157 if (!HasBeenSetUp()) return 0; | 158 if (!HasBeenSetUp()) return 0; |
(...skipping 1343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1501 heap_object = js_global_property_cell_iterator.Next()) { | 1502 heap_object = js_global_property_cell_iterator.Next()) { |
1502 if (heap_object->IsPropertyCell()) { | 1503 if (heap_object->IsPropertyCell()) { |
1503 PropertyCell* cell = PropertyCell::cast(heap_object); | 1504 PropertyCell* cell = PropertyCell::cast(heap_object); |
1504 Address value_address = cell->ValueAddress(); | 1505 Address value_address = cell->ValueAddress(); |
1505 scavenge_visitor.VisitPointer(reinterpret_cast<Object**>(value_address)); | 1506 scavenge_visitor.VisitPointer(reinterpret_cast<Object**>(value_address)); |
1506 Address type_address = cell->TypeAddress(); | 1507 Address type_address = cell->TypeAddress(); |
1507 scavenge_visitor.VisitPointer(reinterpret_cast<Object**>(type_address)); | 1508 scavenge_visitor.VisitPointer(reinterpret_cast<Object**>(type_address)); |
1508 } | 1509 } |
1509 } | 1510 } |
1510 | 1511 |
| 1512 // Copy objects reachable from the encountered weak collections list. |
| 1513 scavenge_visitor.VisitPointer(&encountered_weak_collections_); |
| 1514 |
1511 // Copy objects reachable from the code flushing candidates list. | 1515 // Copy objects reachable from the code flushing candidates list. |
1512 MarkCompactCollector* collector = mark_compact_collector(); | 1516 MarkCompactCollector* collector = mark_compact_collector(); |
1513 if (collector->is_code_flushing_enabled()) { | 1517 if (collector->is_code_flushing_enabled()) { |
1514 collector->code_flusher()->IteratePointersToFromSpace(&scavenge_visitor); | 1518 collector->code_flusher()->IteratePointersToFromSpace(&scavenge_visitor); |
1515 } | 1519 } |
1516 | 1520 |
1517 new_space_front = DoScavenge(&scavenge_visitor, new_space_front); | 1521 new_space_front = DoScavenge(&scavenge_visitor, new_space_front); |
1518 | 1522 |
1519 while (isolate()->global_handles()->IterateObjectGroups( | 1523 while (isolate()->global_handles()->IterateObjectGroups( |
1520 &scavenge_visitor, &IsUnscavengedHeapObject)) { | 1524 &scavenge_visitor, &IsUnscavengedHeapObject)) { |
(...skipping 4896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6417 static_cast<int>(object_sizes_last_time_[index])); | 6421 static_cast<int>(object_sizes_last_time_[index])); |
6418 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6422 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6419 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6423 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6420 | 6424 |
6421 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6425 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6422 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6426 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6423 ClearObjectStats(); | 6427 ClearObjectStats(); |
6424 } | 6428 } |
6425 | 6429 |
6426 } } // namespace v8::internal | 6430 } } // namespace v8::internal |
OLD | NEW |