Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: src/heap/heap.cc

Issue 996133002: correctly invalidate global cells (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: cleanup Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/heap-snapshot-generator.cc ('k') | src/hydrogen.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 3541 matching lines...) Expand 10 before | Expand all | Expand 10 after
6449 static_cast<int>(object_sizes_last_time_[index])); 6446 static_cast<int>(object_sizes_last_time_[index]));
6450 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6447 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6451 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6448 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6452 6449
6453 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6450 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6454 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6451 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6455 ClearObjectStats(); 6452 ClearObjectStats();
6456 } 6453 }
6457 } 6454 }
6458 } // namespace v8::internal 6455 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap-snapshot-generator.cc ('k') | src/hydrogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698