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

Side by Side Diff: src/heap/spaces.h

Issue 1780663002: [heap] Remove dead code in map space class. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 #ifndef V8_HEAP_SPACES_H_ 5 #ifndef V8_HEAP_SPACES_H_
6 #define V8_HEAP_SPACES_H_ 6 #define V8_HEAP_SPACES_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/atomic-utils.h" 9 #include "src/atomic-utils.h"
10 #include "src/base/atomicops.h" 10 #include "src/base/atomicops.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 99
100 #define DCHECK_OBJECT_SIZE(size) \ 100 #define DCHECK_OBJECT_SIZE(size) \
101 DCHECK((0 < size) && (size <= Page::kMaxRegularHeapObjectSize)) 101 DCHECK((0 < size) && (size <= Page::kMaxRegularHeapObjectSize))
102 102
103 #define DCHECK_CODEOBJECT_SIZE(size, code_space) \ 103 #define DCHECK_CODEOBJECT_SIZE(size, code_space) \
104 DCHECK((0 < size) && (size <= code_space->AreaSize())) 104 DCHECK((0 < size) && (size <= code_space->AreaSize()))
105 105
106 #define DCHECK_PAGE_OFFSET(offset) \ 106 #define DCHECK_PAGE_OFFSET(offset) \
107 DCHECK((Page::kObjectStartOffset <= offset) && (offset <= Page::kPageSize)) 107 DCHECK((Page::kObjectStartOffset <= offset) && (offset <= Page::kPageSize))
108 108
109 #define DCHECK_MAP_PAGE_INDEX(index) \
110 DCHECK((0 <= index) && (index <= MapSpace::kMaxMapPageIndex))
111
112
113 class MarkBit { 109 class MarkBit {
114 public: 110 public:
115 typedef uint32_t CellType; 111 typedef uint32_t CellType;
116 112
117 inline MarkBit(CellType* cell, CellType mask) : cell_(cell), mask_(mask) {} 113 inline MarkBit(CellType* cell, CellType mask) : cell_(cell), mask_(mask) {}
118 114
119 #ifdef DEBUG 115 #ifdef DEBUG
120 bool operator==(const MarkBit& other) { 116 bool operator==(const MarkBit& other) {
121 return cell_ == other.cell_ && mask_ == other.mask_; 117 return cell_ == other.cell_ && mask_ == other.mask_;
122 } 118 }
(...skipping 2735 matching lines...) Expand 10 before | Expand all | Expand 10 after
2858 (info).limit() <= (space).page_high()) 2854 (info).limit() <= (space).page_high())
2859 2855
2860 2856
2861 // ----------------------------------------------------------------------------- 2857 // -----------------------------------------------------------------------------
2862 // Old space for all map objects 2858 // Old space for all map objects
2863 2859
2864 class MapSpace : public PagedSpace { 2860 class MapSpace : public PagedSpace {
2865 public: 2861 public:
2866 // Creates a map space object. 2862 // Creates a map space object.
2867 MapSpace(Heap* heap, AllocationSpace id) 2863 MapSpace(Heap* heap, AllocationSpace id)
2868 : PagedSpace(heap, id, NOT_EXECUTABLE), 2864 : PagedSpace(heap, id, NOT_EXECUTABLE) {}
2869 max_map_space_pages_(kMaxMapPageIndex - 1) {}
2870
2871 // Given an index, returns the page address.
2872 // TODO(1600): this limit is artifical just to keep code compilable
2873 static const int kMaxMapPageIndex = 1 << 16;
2874 2865
2875 int RoundSizeDownToObjectAlignment(int size) override { 2866 int RoundSizeDownToObjectAlignment(int size) override {
2876 if (base::bits::IsPowerOfTwo32(Map::kSize)) { 2867 if (base::bits::IsPowerOfTwo32(Map::kSize)) {
2877 return RoundDown(size, Map::kSize); 2868 return RoundDown(size, Map::kSize);
2878 } else { 2869 } else {
2879 return (size / Map::kSize) * Map::kSize; 2870 return (size / Map::kSize) * Map::kSize;
2880 } 2871 }
2881 } 2872 }
2882 2873
2883 #ifdef VERIFY_HEAP 2874 #ifdef VERIFY_HEAP
2884 void VerifyObject(HeapObject* obj) override; 2875 void VerifyObject(HeapObject* obj) override;
2885 #endif 2876 #endif
2886
2887 private:
2888 static const int kMapsPerPage = Page::kAllocatableMemory / Map::kSize;
2889
2890 // Do map space compaction if there is a page gap.
2891 int CompactionThreshold() {
2892 return kMapsPerPage * (max_map_space_pages_ - 1);
2893 }
2894
2895 const int max_map_space_pages_;
2896 }; 2877 };
2897 2878
2898 2879
2899 // ----------------------------------------------------------------------------- 2880 // -----------------------------------------------------------------------------
2900 // Large objects ( > Page::kMaxRegularHeapObjectSize ) are allocated and 2881 // Large objects ( > Page::kMaxRegularHeapObjectSize ) are allocated and
2901 // managed by the large object space. A large object is allocated from OS 2882 // managed by the large object space. A large object is allocated from OS
2902 // heap with extra padding bytes (Page::kPageSize + Page::kObjectStartOffset). 2883 // heap with extra padding bytes (Page::kPageSize + Page::kObjectStartOffset).
2903 // A large object always starts at Page::kObjectStartOffset to a page. 2884 // A large object always starts at Page::kObjectStartOffset to a page.
2904 // Large objects do not move during garbage collections. 2885 // Large objects do not move during garbage collections.
2905 2886
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
3044 count = 0; 3025 count = 0;
3045 } 3026 }
3046 // Must be small, since an iteration is used for lookup. 3027 // Must be small, since an iteration is used for lookup.
3047 static const int kMaxComments = 64; 3028 static const int kMaxComments = 64;
3048 }; 3029 };
3049 #endif 3030 #endif
3050 } // namespace internal 3031 } // namespace internal
3051 } // namespace v8 3032 } // namespace v8
3052 3033
3053 #endif // V8_HEAP_SPACES_H_ 3034 #endif // V8_HEAP_SPACES_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698