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

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

Issue 893073006: Add map-based read barrier to WeakCell Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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
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 2685 matching lines...) Expand 10 before | Expand all | Expand 10 after
2696 2696
2697 TYPED_ARRAYS(ALLOCATE_FIXED_TYPED_ARRAY_MAP) 2697 TYPED_ARRAYS(ALLOCATE_FIXED_TYPED_ARRAY_MAP)
2698 #undef ALLOCATE_FIXED_TYPED_ARRAY_MAP 2698 #undef ALLOCATE_FIXED_TYPED_ARRAY_MAP
2699 2699
2700 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, sloppy_arguments_elements) 2700 ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, sloppy_arguments_elements)
2701 2701
2702 ALLOCATE_VARSIZE_MAP(CODE_TYPE, code) 2702 ALLOCATE_VARSIZE_MAP(CODE_TYPE, code)
2703 2703
2704 ALLOCATE_MAP(CELL_TYPE, Cell::kSize, cell) 2704 ALLOCATE_MAP(CELL_TYPE, Cell::kSize, cell)
2705 ALLOCATE_MAP(PROPERTY_CELL_TYPE, PropertyCell::kSize, global_property_cell) 2705 ALLOCATE_MAP(PROPERTY_CELL_TYPE, PropertyCell::kSize, global_property_cell)
2706 ALLOCATE_MAP(WEAK_CELL_TYPE, WeakCell::kSize, weak_cell) 2706 ALLOCATE_MAP(WEAK_CELL_TYPE, WeakCell::kSize, used_weak_cell)
2707 ALLOCATE_MAP(WEAK_CELL_TYPE, WeakCell::kSize, unused_weak_cell)
2707 ALLOCATE_MAP(FILLER_TYPE, kPointerSize, one_pointer_filler) 2708 ALLOCATE_MAP(FILLER_TYPE, kPointerSize, one_pointer_filler)
2708 ALLOCATE_MAP(FILLER_TYPE, 2 * kPointerSize, two_pointer_filler) 2709 ALLOCATE_MAP(FILLER_TYPE, 2 * kPointerSize, two_pointer_filler)
2709 2710
2710 2711
2711 for (unsigned i = 0; i < arraysize(struct_table); i++) { 2712 for (unsigned i = 0; i < arraysize(struct_table); i++) {
2712 const StructTable& entry = struct_table[i]; 2713 const StructTable& entry = struct_table[i];
2713 Map* map; 2714 Map* map;
2714 if (!AllocateMap(entry.type, entry.size).To(&map)) return false; 2715 if (!AllocateMap(entry.type, entry.size).To(&map)) return false;
2715 roots_[entry.index] = map; 2716 roots_[entry.index] = map;
2716 } 2717 }
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
2833 2834
2834 AllocationResult Heap::AllocateWeakCell(HeapObject* value) { 2835 AllocationResult Heap::AllocateWeakCell(HeapObject* value) {
2835 int size = WeakCell::kSize; 2836 int size = WeakCell::kSize;
2836 STATIC_ASSERT(WeakCell::kSize <= Page::kMaxRegularHeapObjectSize); 2837 STATIC_ASSERT(WeakCell::kSize <= Page::kMaxRegularHeapObjectSize);
2837 HeapObject* result; 2838 HeapObject* result;
2838 { 2839 {
2839 AllocationResult allocation = 2840 AllocationResult allocation =
2840 AllocateRaw(size, OLD_POINTER_SPACE, OLD_POINTER_SPACE); 2841 AllocateRaw(size, OLD_POINTER_SPACE, OLD_POINTER_SPACE);
2841 if (!allocation.To(&result)) return allocation; 2842 if (!allocation.To(&result)) return allocation;
2842 } 2843 }
2843 result->set_map_no_write_barrier(weak_cell_map()); 2844 result->set_map_no_write_barrier(used_weak_cell_map());
2844 WeakCell::cast(result)->initialize(value); 2845 WeakCell::cast(result)->initialize(value);
2845 WeakCell::cast(result)->set_next(undefined_value(), SKIP_WRITE_BARRIER); 2846 WeakCell::cast(result)->set_next(undefined_value(), SKIP_WRITE_BARRIER);
2846 return result; 2847 return result;
2847 } 2848 }
2848 2849
2849 2850
2850 void Heap::CreateApiObjects() { 2851 void Heap::CreateApiObjects() {
2851 HandleScope scope(isolate()); 2852 HandleScope scope(isolate());
2852 Factory* factory = isolate()->factory(); 2853 Factory* factory = isolate()->factory();
2853 Handle<Map> new_neander_map = 2854 Handle<Map> new_neander_map =
(...skipping 3633 matching lines...) Expand 10 before | Expand all | Expand 10 after
6487 static_cast<int>(object_sizes_last_time_[index])); 6488 static_cast<int>(object_sizes_last_time_[index]));
6488 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6489 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6489 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6490 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6490 6491
6491 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6492 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6492 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6493 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6493 ClearObjectStats(); 6494 ClearObjectStats();
6494 } 6495 }
6495 } 6496 }
6496 } // namespace v8::internal 6497 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/mark-compact.cc » ('j') | src/hydrogen-instructions.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698