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

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

Issue 1816463002: [heap] Fix skip list for deserialized code objects. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: added comment 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 | « src/heap/heap.cc ('k') | src/heap/spaces-inl.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 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 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after
1193 starts_[idx] = reinterpret_cast<Address>(-1); 1193 starts_[idx] = reinterpret_cast<Address>(-1);
1194 } 1194 }
1195 } 1195 }
1196 1196
1197 Address StartFor(Address addr) { return starts_[RegionNumber(addr)]; } 1197 Address StartFor(Address addr) { return starts_[RegionNumber(addr)]; }
1198 1198
1199 void AddObject(Address addr, int size) { 1199 void AddObject(Address addr, int size) {
1200 int start_region = RegionNumber(addr); 1200 int start_region = RegionNumber(addr);
1201 int end_region = RegionNumber(addr + size - kPointerSize); 1201 int end_region = RegionNumber(addr + size - kPointerSize);
1202 for (int idx = start_region; idx <= end_region; idx++) { 1202 for (int idx = start_region; idx <= end_region; idx++) {
1203 if (starts_[idx] > addr) starts_[idx] = addr; 1203 if (starts_[idx] > addr) {
1204 starts_[idx] = addr;
1205 } else {
1206 // In the first region, there may already be an object closer to the
1207 // start of the region. Do not change the start in that case. If this
1208 // is not the first region, you probably added overlapping objects.
1209 DCHECK_EQ(start_region, idx);
1210 }
1204 } 1211 }
1205 } 1212 }
1206 1213
1207 static inline int RegionNumber(Address addr) { 1214 static inline int RegionNumber(Address addr) {
1208 return (OffsetFrom(addr) & Page::kPageAlignmentMask) >> kRegionSizeLog2; 1215 return (OffsetFrom(addr) & Page::kPageAlignmentMask) >> kRegionSizeLog2;
1209 } 1216 }
1210 1217
1211 static void Update(Address addr, int size) { 1218 static void Update(Address addr, int size) {
1212 Page* page = Page::FromAddress(addr); 1219 Page* page = Page::FromAddress(addr);
1213 SkipList* list = page->skip_list(); 1220 SkipList* list = page->skip_list();
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
2031 Address limit() { return allocation_info_.limit(); } 2038 Address limit() { return allocation_info_.limit(); }
2032 2039
2033 // The allocation top address. 2040 // The allocation top address.
2034 Address* allocation_top_address() { return allocation_info_.top_address(); } 2041 Address* allocation_top_address() { return allocation_info_.top_address(); }
2035 2042
2036 // The allocation limit address. 2043 // The allocation limit address.
2037 Address* allocation_limit_address() { 2044 Address* allocation_limit_address() {
2038 return allocation_info_.limit_address(); 2045 return allocation_info_.limit_address();
2039 } 2046 }
2040 2047
2048 enum UpdateSkipList { UPDATE_SKIP_LIST, IGNORE_SKIP_LIST };
2049
2041 // Allocate the requested number of bytes in the space if possible, return a 2050 // Allocate the requested number of bytes in the space if possible, return a
2042 // failure object if not. 2051 // failure object if not. Only use IGNORE_SKIP_LIST if the skip list is going
2052 // to be manually updated later.
2043 MUST_USE_RESULT inline AllocationResult AllocateRawUnaligned( 2053 MUST_USE_RESULT inline AllocationResult AllocateRawUnaligned(
2044 int size_in_bytes); 2054 int size_in_bytes, UpdateSkipList update_skip_list = UPDATE_SKIP_LIST);
2045 2055
2046 MUST_USE_RESULT inline AllocationResult AllocateRawUnalignedSynchronized( 2056 MUST_USE_RESULT inline AllocationResult AllocateRawUnalignedSynchronized(
2047 int size_in_bytes); 2057 int size_in_bytes);
2048 2058
2049 // Allocate the requested number of bytes in the space double aligned if 2059 // Allocate the requested number of bytes in the space double aligned if
2050 // possible, return a failure object if not. 2060 // possible, return a failure object if not.
2051 MUST_USE_RESULT inline AllocationResult AllocateRawAligned( 2061 MUST_USE_RESULT inline AllocationResult AllocateRawAligned(
2052 int size_in_bytes, AllocationAlignment alignment); 2062 int size_in_bytes, AllocationAlignment alignment);
2053 2063
2054 // Allocate the requested number of bytes in the space and consider allocation 2064 // Allocate the requested number of bytes in the space and consider allocation
(...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after
3082 count = 0; 3092 count = 0;
3083 } 3093 }
3084 // Must be small, since an iteration is used for lookup. 3094 // Must be small, since an iteration is used for lookup.
3085 static const int kMaxComments = 64; 3095 static const int kMaxComments = 64;
3086 }; 3096 };
3087 #endif 3097 #endif
3088 } // namespace internal 3098 } // namespace internal
3089 } // namespace v8 3099 } // namespace v8
3090 3100
3091 #endif // V8_HEAP_SPACES_H_ 3101 #endif // V8_HEAP_SPACES_H_
OLDNEW
« no previous file with comments | « src/heap/heap.cc ('k') | src/heap/spaces-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698