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/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
(...skipping 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1605 // Copy objects reachable from global property cells by scavenging global | 1605 // Copy objects reachable from global property cells by scavenging global |
1606 // property cell values directly. | 1606 // property cell values directly. |
1607 HeapObjectIterator js_global_property_cell_iterator(property_cell_space_); | 1607 HeapObjectIterator js_global_property_cell_iterator(property_cell_space_); |
1608 for (HeapObject* heap_object = js_global_property_cell_iterator.Next(); | 1608 for (HeapObject* heap_object = js_global_property_cell_iterator.Next(); |
1609 heap_object != NULL; | 1609 heap_object != NULL; |
1610 heap_object = js_global_property_cell_iterator.Next()) { | 1610 heap_object = js_global_property_cell_iterator.Next()) { |
1611 if (heap_object->IsPropertyCell()) { | 1611 if (heap_object->IsPropertyCell()) { |
1612 PropertyCell* cell = PropertyCell::cast(heap_object); | 1612 PropertyCell* cell = PropertyCell::cast(heap_object); |
1613 Address value_address = cell->ValueAddress(); | 1613 Address value_address = cell->ValueAddress(); |
1614 scavenge_visitor.VisitPointer(reinterpret_cast<Object**>(value_address)); | 1614 scavenge_visitor.VisitPointer(reinterpret_cast<Object**>(value_address)); |
1615 Address type_address = cell->TypeAddress(); | |
1616 scavenge_visitor.VisitPointer(reinterpret_cast<Object**>(type_address)); | |
1617 } | 1615 } |
1618 } | 1616 } |
1619 | 1617 |
1620 // Copy objects reachable from the encountered weak collections list. | 1618 // Copy objects reachable from the encountered weak collections list. |
1621 scavenge_visitor.VisitPointer(&encountered_weak_collections_); | 1619 scavenge_visitor.VisitPointer(&encountered_weak_collections_); |
1622 // Copy objects reachable from the encountered weak cells. | 1620 // Copy objects reachable from the encountered weak cells. |
1623 scavenge_visitor.VisitPointer(&encountered_weak_cells_); | 1621 scavenge_visitor.VisitPointer(&encountered_weak_cells_); |
1624 | 1622 |
1625 // Copy objects reachable from the code flushing candidates list. | 1623 // Copy objects reachable from the code flushing candidates list. |
1626 MarkCompactCollector* collector = mark_compact_collector(); | 1624 MarkCompactCollector* collector = mark_compact_collector(); |
(...skipping 1260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2887 HeapObject* result; | 2885 HeapObject* result; |
2888 AllocationResult allocation = | 2886 AllocationResult allocation = |
2889 AllocateRaw(size, PROPERTY_CELL_SPACE, PROPERTY_CELL_SPACE); | 2887 AllocateRaw(size, PROPERTY_CELL_SPACE, PROPERTY_CELL_SPACE); |
2890 if (!allocation.To(&result)) return allocation; | 2888 if (!allocation.To(&result)) return allocation; |
2891 | 2889 |
2892 result->set_map_no_write_barrier(global_property_cell_map()); | 2890 result->set_map_no_write_barrier(global_property_cell_map()); |
2893 PropertyCell* cell = PropertyCell::cast(result); | 2891 PropertyCell* cell = PropertyCell::cast(result); |
2894 cell->set_dependent_code(DependentCode::cast(empty_fixed_array()), | 2892 cell->set_dependent_code(DependentCode::cast(empty_fixed_array()), |
2895 SKIP_WRITE_BARRIER); | 2893 SKIP_WRITE_BARRIER); |
2896 cell->set_value(the_hole_value()); | 2894 cell->set_value(the_hole_value()); |
2897 cell->set_type(HeapType::None()); | |
2898 return result; | 2895 return result; |
2899 } | 2896 } |
2900 | 2897 |
2901 | 2898 |
2902 AllocationResult Heap::AllocateWeakCell(HeapObject* value) { | 2899 AllocationResult Heap::AllocateWeakCell(HeapObject* value) { |
2903 int size = WeakCell::kSize; | 2900 int size = WeakCell::kSize; |
2904 STATIC_ASSERT(WeakCell::kSize <= Page::kMaxRegularHeapObjectSize); | 2901 STATIC_ASSERT(WeakCell::kSize <= Page::kMaxRegularHeapObjectSize); |
2905 HeapObject* result; | 2902 HeapObject* result; |
2906 { | 2903 { |
2907 AllocationResult allocation = | 2904 AllocationResult allocation = |
(...skipping 3670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6578 static_cast<int>(object_sizes_last_time_[index])); | 6575 static_cast<int>(object_sizes_last_time_[index])); |
6579 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6576 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6580 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6577 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6581 | 6578 |
6582 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6579 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6583 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6580 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6584 ClearObjectStats(); | 6581 ClearObjectStats(); |
6585 } | 6582 } |
6586 } | 6583 } |
6587 } // namespace v8::internal | 6584 } // namespace v8::internal |
OLD | NEW |