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

Side by Side Diff: src/serialize.cc

Issue 155211: Create a new paged heap space for global property cells. The new... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « src/serialize.h ('k') | src/spaces.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 24 matching lines...) Expand all
35 #include "natives.h" 35 #include "natives.h"
36 #include "platform.h" 36 #include "platform.h"
37 #include "runtime.h" 37 #include "runtime.h"
38 #include "serialize.h" 38 #include "serialize.h"
39 #include "stub-cache.h" 39 #include "stub-cache.h"
40 #include "v8threads.h" 40 #include "v8threads.h"
41 41
42 namespace v8 { 42 namespace v8 {
43 namespace internal { 43 namespace internal {
44 44
45 // Encoding: a RelativeAddress must be able to fit in a pointer: 45 // 32-bit encoding: a RelativeAddress must be able to fit in a
46 // it is encoded as an Address with (from MS to LS bits): 46 // pointer: it is encoded as an Address with (from LS to MS bits):
47 // 27 bits identifying a word in the space, in one of three formats: 47 // - 2 bits identifying this as a HeapObject.
48 // - MAP and OLD spaces: 16 bits of page number, 11 bits of word offset in page 48 // - 4 bits to encode the AllocationSpace (including special values for
49 // - NEW space: 27 bits of word offset 49 // code and fixed arrays in LO space)
50 // - LO space: 27 bits of page number 50 // - 27 bits identifying a word in the space, in one of three formats:
51 // 3 bits to encode the AllocationSpace (special values for code in LO space) 51 // - paged spaces: 16 bits of page number, 11 bits of word offset in page
52 // 2 bits identifying this as a HeapObject 52 // - NEW space: 27 bits of word offset
53 // - LO space: 27 bits of page number
53 54
54 const int kSpaceShift = kHeapObjectTagSize; 55 const int kSpaceShift = kHeapObjectTagSize;
55 const int kSpaceBits = kSpaceTagSize; 56 const int kSpaceBits = 4;
56 const int kSpaceMask = kSpaceTagMask; 57 const int kSpaceMask = (1 << kSpaceBits) - 1;
57
58 // These value are used instead of space numbers when serializing/
59 // deserializing. They indicate an object that is in large object space, but
60 // should be treated specially.
61 // Make the pages executable on platforms that support it:
62 const int kLOSpaceExecutable = LAST_SPACE + 1;
63 // Reserve space for write barrier bits (for objects that can contain
64 // references to new space):
65 const int kLOSpacePointer = LAST_SPACE + 2;
66
67 58
68 const int kOffsetShift = kSpaceShift + kSpaceBits; 59 const int kOffsetShift = kSpaceShift + kSpaceBits;
69 const int kOffsetBits = 11; 60 const int kOffsetBits = 11;
70 const int kOffsetMask = (1 << kOffsetBits) - 1; 61 const int kOffsetMask = (1 << kOffsetBits) - 1;
71 62
63 const int kPageShift = kOffsetShift + kOffsetBits;
72 const int kPageBits = 32 - (kOffsetBits + kSpaceBits + kHeapObjectTagSize); 64 const int kPageBits = 32 - (kOffsetBits + kSpaceBits + kHeapObjectTagSize);
73 const int kPageShift = kOffsetShift + kOffsetBits;
74 const int kPageMask = (1 << kPageBits) - 1; 65 const int kPageMask = (1 << kPageBits) - 1;
75 66
76 const int kPageAndOffsetShift = kOffsetShift; 67 const int kPageAndOffsetShift = kOffsetShift;
77 const int kPageAndOffsetBits = kPageBits + kOffsetBits; 68 const int kPageAndOffsetBits = kPageBits + kOffsetBits;
78 const int kPageAndOffsetMask = (1 << kPageAndOffsetBits) - 1; 69 const int kPageAndOffsetMask = (1 << kPageAndOffsetBits) - 1;
79 70
71 // These values are special allocation space tags used for
72 // serialization.
73 // Mar the pages executable on platforms that support it.
74 const int kLargeCode = LAST_SPACE + 1;
75 // Allocate extra remembered-set bits.
76 const int kLargeFixedArray = LAST_SPACE + 2;
77
80 78
81 static inline AllocationSpace GetSpace(Address addr) { 79 static inline AllocationSpace GetSpace(Address addr) {
82 const intptr_t encoded = reinterpret_cast<intptr_t>(addr); 80 const intptr_t encoded = reinterpret_cast<intptr_t>(addr);
83 int space_number = (static_cast<int>(encoded >> kSpaceShift) & kSpaceMask); 81 int space_number = (static_cast<int>(encoded >> kSpaceShift) & kSpaceMask);
84 if (space_number == kLOSpaceExecutable) space_number = LO_SPACE; 82 if (space_number > LAST_SPACE) space_number = LO_SPACE;
85 else if (space_number == kLOSpacePointer) space_number = LO_SPACE;
86 return static_cast<AllocationSpace>(space_number); 83 return static_cast<AllocationSpace>(space_number);
87 } 84 }
88 85
89 86
90 static inline bool IsLargeExecutableObject(Address addr) { 87 static inline bool IsLargeExecutableObject(Address addr) {
91 const intptr_t encoded = reinterpret_cast<intptr_t>(addr); 88 const intptr_t encoded = reinterpret_cast<intptr_t>(addr);
92 const int space_number = 89 const int space_number =
93 (static_cast<int>(encoded >> kSpaceShift) & kSpaceMask); 90 (static_cast<int>(encoded >> kSpaceShift) & kSpaceMask);
94 return (space_number == kLOSpaceExecutable); 91 return (space_number == kLargeCode);
95 } 92 }
96 93
97 94
98 static inline bool IsLargeFixedArray(Address addr) { 95 static inline bool IsLargeFixedArray(Address addr) {
99 const intptr_t encoded = reinterpret_cast<intptr_t>(addr); 96 const intptr_t encoded = reinterpret_cast<intptr_t>(addr);
100 const int space_number = 97 const int space_number =
101 (static_cast<int>(encoded >> kSpaceShift) & kSpaceMask); 98 (static_cast<int>(encoded >> kSpaceShift) & kSpaceMask);
102 return (space_number == kLOSpacePointer); 99 return (space_number == kLargeFixedArray);
103 } 100 }
104 101
105 102
106 static inline int PageIndex(Address addr) { 103 static inline int PageIndex(Address addr) {
107 const intptr_t encoded = reinterpret_cast<intptr_t>(addr); 104 const intptr_t encoded = reinterpret_cast<intptr_t>(addr);
108 return static_cast<int>(encoded >> kPageShift) & kPageMask; 105 return static_cast<int>(encoded >> kPageShift) & kPageMask;
109 } 106 }
110 107
111 108
112 static inline int PageOffset(Address addr) { 109 static inline int PageOffset(Address addr) {
(...skipping 27 matching lines...) Expand all
140 // HeapObjects. The encoded Addresses are also encoded as HeapObjects 137 // HeapObjects. The encoded Addresses are also encoded as HeapObjects
141 // and allow for marking (is_marked() see mark(), clear_mark()...) as 138 // and allow for marking (is_marked() see mark(), clear_mark()...) as
142 // used by the Mark-Compact collector. 139 // used by the Mark-Compact collector.
143 140
144 class RelativeAddress { 141 class RelativeAddress {
145 public: 142 public:
146 RelativeAddress(AllocationSpace space, 143 RelativeAddress(AllocationSpace space,
147 int page_index, 144 int page_index,
148 int page_offset) 145 int page_offset)
149 : space_(space), page_index_(page_index), page_offset_(page_offset) { 146 : space_(space), page_index_(page_index), page_offset_(page_offset) {
147 // Assert that the space encoding (plus the two pseudo-spaces for
148 // special large objects) fits in the available bits.
149 ASSERT(((LAST_SPACE + 2) & ~kSpaceMask) == 0);
150 ASSERT(space <= LAST_SPACE && space >= 0); 150 ASSERT(space <= LAST_SPACE && space >= 0);
151 } 151 }
152 152
153 // Return the encoding of 'this' as an Address. Decode with constructor. 153 // Return the encoding of 'this' as an Address. Decode with constructor.
154 Address Encode() const; 154 Address Encode() const;
155 155
156 AllocationSpace space() const { 156 AllocationSpace space() const {
157 if (space_ == kLOSpaceExecutable) return LO_SPACE; 157 if (space_ > LAST_SPACE) return LO_SPACE;
158 if (space_ == kLOSpacePointer) return LO_SPACE;
159 return static_cast<AllocationSpace>(space_); 158 return static_cast<AllocationSpace>(space_);
160 } 159 }
161 int page_index() const { return page_index_; } 160 int page_index() const { return page_index_; }
162 int page_offset() const { return page_offset_; } 161 int page_offset() const { return page_offset_; }
163 162
164 bool in_paged_space() const { 163 bool in_paged_space() const {
165 return space_ == CODE_SPACE || 164 return space_ == CODE_SPACE ||
166 space_ == OLD_POINTER_SPACE || 165 space_ == OLD_POINTER_SPACE ||
167 space_ == OLD_DATA_SPACE || 166 space_ == OLD_DATA_SPACE ||
168 space_ == MAP_SPACE; 167 space_ == MAP_SPACE ||
168 space_ == CELL_SPACE;
169 } 169 }
170 170
171 void next_address(int offset) { page_offset_ += offset; } 171 void next_address(int offset) { page_offset_ += offset; }
172 void next_page(int init_offset = 0) { 172 void next_page(int init_offset = 0) {
173 page_index_++; 173 page_index_++;
174 page_offset_ = init_offset; 174 page_offset_ = init_offset;
175 } 175 }
176 176
177 #ifdef DEBUG 177 #ifdef DEBUG
178 void Verify(); 178 void Verify();
179 #endif 179 #endif
180 180
181 void set_to_large_code_object() { 181 void set_to_large_code_object() {
182 ASSERT(space_ == LO_SPACE); 182 ASSERT(space_ == LO_SPACE);
183 space_ = kLOSpaceExecutable; 183 space_ = kLargeCode;
184 } 184 }
185 void set_to_large_fixed_array() { 185 void set_to_large_fixed_array() {
186 ASSERT(space_ == LO_SPACE); 186 ASSERT(space_ == LO_SPACE);
187 space_ = kLOSpacePointer; 187 space_ = kLargeFixedArray;
188 } 188 }
189 189
190 190
191 private: 191 private:
192 int space_; 192 int space_;
193 int page_index_; 193 int page_index_;
194 int page_offset_; 194 int page_offset_;
195 }; 195 };
196 196
197 197
198 Address RelativeAddress::Encode() const { 198 Address RelativeAddress::Encode() const {
199 ASSERT(page_index_ >= 0); 199 ASSERT(page_index_ >= 0);
200 int word_offset = 0; 200 int word_offset = 0;
201 int result = 0; 201 int result = 0;
202 switch (space_) { 202 switch (space_) {
203 case MAP_SPACE: 203 case MAP_SPACE:
204 case CELL_SPACE:
204 case OLD_POINTER_SPACE: 205 case OLD_POINTER_SPACE:
205 case OLD_DATA_SPACE: 206 case OLD_DATA_SPACE:
206 case CODE_SPACE: 207 case CODE_SPACE:
207 ASSERT_EQ(0, page_index_ & ~kPageMask); 208 ASSERT_EQ(0, page_index_ & ~kPageMask);
208 word_offset = page_offset_ >> kObjectAlignmentBits; 209 word_offset = page_offset_ >> kObjectAlignmentBits;
209 ASSERT_EQ(0, word_offset & ~kOffsetMask); 210 ASSERT_EQ(0, word_offset & ~kOffsetMask);
210 result = (page_index_ << kPageShift) | (word_offset << kOffsetShift); 211 result = (page_index_ << kPageShift) | (word_offset << kOffsetShift);
211 break; 212 break;
212 case NEW_SPACE: 213 case NEW_SPACE:
213 ASSERT_EQ(0, page_index_); 214 ASSERT_EQ(0, page_index_);
214 word_offset = page_offset_ >> kObjectAlignmentBits; 215 word_offset = page_offset_ >> kObjectAlignmentBits;
215 ASSERT_EQ(0, word_offset & ~kPageAndOffsetMask); 216 ASSERT_EQ(0, word_offset & ~kPageAndOffsetMask);
216 result = word_offset << kPageAndOffsetShift; 217 result = word_offset << kPageAndOffsetShift;
217 break; 218 break;
218 case LO_SPACE: 219 case LO_SPACE:
219 case kLOSpaceExecutable: 220 case kLargeCode:
220 case kLOSpacePointer: 221 case kLargeFixedArray:
221 ASSERT_EQ(0, page_offset_); 222 ASSERT_EQ(0, page_offset_);
222 ASSERT_EQ(0, page_index_ & ~kPageAndOffsetMask); 223 ASSERT_EQ(0, page_index_ & ~kPageAndOffsetMask);
223 result = page_index_ << kPageAndOffsetShift; 224 result = page_index_ << kPageAndOffsetShift;
224 break; 225 break;
225 } 226 }
226 // OR in AllocationSpace and kHeapObjectTag 227 // OR in AllocationSpace and kHeapObjectTag
227 ASSERT_EQ(0, space_ & ~kSpaceMask); 228 ASSERT_EQ(0, space_ & ~kSpaceMask);
228 result |= (space_ << kSpaceShift) | kHeapObjectTag; 229 result |= (space_ << kSpaceShift) | kHeapObjectTag;
229 return reinterpret_cast<Address>(result); 230 return reinterpret_cast<Address>(result);
230 } 231 }
231 232
232 233
233 #ifdef DEBUG 234 #ifdef DEBUG
234 void RelativeAddress::Verify() { 235 void RelativeAddress::Verify() {
235 ASSERT(page_offset_ >= 0 && page_index_ >= 0); 236 ASSERT(page_offset_ >= 0 && page_index_ >= 0);
236 switch (space_) { 237 switch (space_) {
237 case MAP_SPACE: 238 case MAP_SPACE:
239 case CELL_SPACE:
238 case OLD_POINTER_SPACE: 240 case OLD_POINTER_SPACE:
239 case OLD_DATA_SPACE: 241 case OLD_DATA_SPACE:
240 case CODE_SPACE: 242 case CODE_SPACE:
241 ASSERT(Page::kObjectStartOffset <= page_offset_ && 243 ASSERT(Page::kObjectStartOffset <= page_offset_ &&
242 page_offset_ <= Page::kPageSize); 244 page_offset_ <= Page::kPageSize);
243 break; 245 break;
244 case NEW_SPACE: 246 case NEW_SPACE:
245 ASSERT(page_index_ == 0); 247 ASSERT(page_index_ == 0);
246 break; 248 break;
247 case LO_SPACE: 249 case LO_SPACE:
248 case kLOSpaceExecutable: 250 case kLargeCode:
249 case kLOSpacePointer: 251 case kLargeFixedArray:
250 ASSERT(page_offset_ == 0); 252 ASSERT(page_offset_ == 0);
251 break; 253 break;
252 } 254 }
253 } 255 }
254 #endif 256 #endif
255 257
256 enum GCTreatment { 258 enum GCTreatment {
257 DataObject, // Object that cannot contain a reference to new space. 259 DataObject, // Object that cannot contain a reference to new space.
258 PointerObject, // Object that can contain a reference to new space. 260 PointerObject, // Object that can contain a reference to new space.
259 CodeObject // Object that contains executable code. 261 CodeObject // Object that contains executable code.
(...skipping 24 matching lines...) Expand all
284 RelativeAddress Allocate(int size, GCTreatment special_gc_treatment); 286 RelativeAddress Allocate(int size, GCTreatment special_gc_treatment);
285 287
286 private: 288 private:
287 RelativeAddress current_; 289 RelativeAddress current_;
288 }; 290 };
289 291
290 292
291 void SimulatedHeapSpace::InitEmptyHeap(AllocationSpace space) { 293 void SimulatedHeapSpace::InitEmptyHeap(AllocationSpace space) {
292 switch (space) { 294 switch (space) {
293 case MAP_SPACE: 295 case MAP_SPACE:
296 case CELL_SPACE:
294 case OLD_POINTER_SPACE: 297 case OLD_POINTER_SPACE:
295 case OLD_DATA_SPACE: 298 case OLD_DATA_SPACE:
296 case CODE_SPACE: 299 case CODE_SPACE:
297 current_ = RelativeAddress(space, 0, Page::kObjectStartOffset); 300 current_ = RelativeAddress(space, 0, Page::kObjectStartOffset);
298 break; 301 break;
299 case NEW_SPACE: 302 case NEW_SPACE:
300 case LO_SPACE: 303 case LO_SPACE:
301 current_ = RelativeAddress(space, 0, 0); 304 current_ = RelativeAddress(space, 0, 0);
302 break; 305 break;
303 } 306 }
304 } 307 }
305 308
306 309
307 void SimulatedHeapSpace::InitCurrentHeap(AllocationSpace space) { 310 void SimulatedHeapSpace::InitCurrentHeap(AllocationSpace space) {
308 switch (space) { 311 switch (space) {
309 case MAP_SPACE: 312 case MAP_SPACE:
313 case CELL_SPACE:
310 case OLD_POINTER_SPACE: 314 case OLD_POINTER_SPACE:
311 case OLD_DATA_SPACE: 315 case OLD_DATA_SPACE:
312 case CODE_SPACE: { 316 case CODE_SPACE: {
313 PagedSpace* ps; 317 PagedSpace* ps;
314 if (space == MAP_SPACE) { 318 if (space == MAP_SPACE) {
315 ps = Heap::map_space(); 319 ps = Heap::map_space();
320 } else if (space == CELL_SPACE) {
321 ps = Heap::cell_space();
316 } else if (space == OLD_POINTER_SPACE) { 322 } else if (space == OLD_POINTER_SPACE) {
317 ps = Heap::old_pointer_space(); 323 ps = Heap::old_pointer_space();
318 } else if (space == OLD_DATA_SPACE) { 324 } else if (space == OLD_DATA_SPACE) {
319 ps = Heap::old_data_space(); 325 ps = Heap::old_data_space();
320 } else { 326 } else {
321 ASSERT(space == CODE_SPACE); 327 ASSERT(space == CODE_SPACE);
322 ps = Heap::code_space(); 328 ps = Heap::code_space();
323 } 329 }
324 Address top = ps->top(); 330 Address top = ps->top();
325 Page* top_page = Page::FromAllocationTop(top); 331 Page* top_page = Page::FromAllocationTop(top);
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
1114 writer_->PutC('S'); 1120 writer_->PutC('S');
1115 writer_->PutC('['); 1121 writer_->PutC('[');
1116 writer_->PutInt(Heap::old_pointer_space()->Size() + 1122 writer_->PutInt(Heap::old_pointer_space()->Size() +
1117 Heap::new_space()->Size()); 1123 Heap::new_space()->Size());
1118 writer_->PutC('|'); 1124 writer_->PutC('|');
1119 writer_->PutInt(Heap::old_data_space()->Size() + Heap::new_space()->Size()); 1125 writer_->PutInt(Heap::old_data_space()->Size() + Heap::new_space()->Size());
1120 writer_->PutC('|'); 1126 writer_->PutC('|');
1121 writer_->PutInt(Heap::code_space()->Size() + Heap::new_space()->Size()); 1127 writer_->PutInt(Heap::code_space()->Size() + Heap::new_space()->Size());
1122 writer_->PutC('|'); 1128 writer_->PutC('|');
1123 writer_->PutInt(Heap::map_space()->Size()); 1129 writer_->PutInt(Heap::map_space()->Size());
1130 writer_->PutC('|');
1131 writer_->PutInt(Heap::cell_space()->Size());
1124 writer_->PutC(']'); 1132 writer_->PutC(']');
1125 // Write global handles. 1133 // Write global handles.
1126 writer_->PutC('G'); 1134 writer_->PutC('G');
1127 writer_->PutC('['); 1135 writer_->PutC('[');
1128 GlobalHandlesRetriever ghr(&global_handles_); 1136 GlobalHandlesRetriever ghr(&global_handles_);
1129 GlobalHandles::IterateRoots(&ghr); 1137 GlobalHandles::IterateRoots(&ghr);
1130 for (int i = 0; i < global_handles_.length(); i++) { 1138 for (int i = 0; i < global_handles_.length(); i++) {
1131 writer_->PutC('N'); 1139 writer_->PutC('N');
1132 } 1140 }
1133 writer_->PutC(']'); 1141 writer_->PutC(']');
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1296 //------------------------------------------------------------------------------ 1304 //------------------------------------------------------------------------------
1297 // Implementation of Deserializer 1305 // Implementation of Deserializer
1298 1306
1299 1307
1300 static const int kInitArraySize = 32; 1308 static const int kInitArraySize = 32;
1301 1309
1302 1310
1303 Deserializer::Deserializer(const byte* str, int len) 1311 Deserializer::Deserializer(const byte* str, int len)
1304 : reader_(str, len), 1312 : reader_(str, len),
1305 map_pages_(kInitArraySize), 1313 map_pages_(kInitArraySize),
1314 cell_pages_(kInitArraySize),
1306 old_pointer_pages_(kInitArraySize), 1315 old_pointer_pages_(kInitArraySize),
1307 old_data_pages_(kInitArraySize), 1316 old_data_pages_(kInitArraySize),
1308 code_pages_(kInitArraySize), 1317 code_pages_(kInitArraySize),
1309 large_objects_(kInitArraySize), 1318 large_objects_(kInitArraySize),
1310 global_handles_(4) { 1319 global_handles_(4) {
1311 root_ = true; 1320 root_ = true;
1312 roots_ = 0; 1321 roots_ = 0;
1313 objects_ = 0; 1322 objects_ = 0;
1314 reference_decoder_ = NULL; 1323 reference_decoder_ = NULL;
1315 #ifdef DEBUG 1324 #ifdef DEBUG
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1468 reader_.ExpectC('['); 1477 reader_.ExpectC('[');
1469 InitPagedSpace(Heap::old_pointer_space(), 1478 InitPagedSpace(Heap::old_pointer_space(),
1470 reader_.GetInt(), 1479 reader_.GetInt(),
1471 &old_pointer_pages_); 1480 &old_pointer_pages_);
1472 reader_.ExpectC('|'); 1481 reader_.ExpectC('|');
1473 InitPagedSpace(Heap::old_data_space(), reader_.GetInt(), &old_data_pages_); 1482 InitPagedSpace(Heap::old_data_space(), reader_.GetInt(), &old_data_pages_);
1474 reader_.ExpectC('|'); 1483 reader_.ExpectC('|');
1475 InitPagedSpace(Heap::code_space(), reader_.GetInt(), &code_pages_); 1484 InitPagedSpace(Heap::code_space(), reader_.GetInt(), &code_pages_);
1476 reader_.ExpectC('|'); 1485 reader_.ExpectC('|');
1477 InitPagedSpace(Heap::map_space(), reader_.GetInt(), &map_pages_); 1486 InitPagedSpace(Heap::map_space(), reader_.GetInt(), &map_pages_);
1487 reader_.ExpectC('|');
1488 InitPagedSpace(Heap::cell_space(), reader_.GetInt(), &cell_pages_);
1478 reader_.ExpectC(']'); 1489 reader_.ExpectC(']');
1479 // Create placeholders for global handles later to be fill during 1490 // Create placeholders for global handles later to be fill during
1480 // IterateRoots. 1491 // IterateRoots.
1481 reader_.ExpectC('G'); 1492 reader_.ExpectC('G');
1482 reader_.ExpectC('['); 1493 reader_.ExpectC('[');
1483 int c = reader_.GetC(); 1494 int c = reader_.GetC();
1484 while (c != ']') { 1495 while (c != ']') {
1485 ASSERT(c == 'N'); 1496 ASSERT(c == 'N');
1486 global_handles_.Add(GlobalHandles::Create(NULL).location()); 1497 global_handles_.Add(GlobalHandles::Create(NULL).location());
1487 c = reader_.GetC(); 1498 c = reader_.GetC();
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1600 ASSERT(o->IsHeapObject()); 1611 ASSERT(o->IsHeapObject());
1601 1612
1602 switch (GetSpace(encoded)) { 1613 switch (GetSpace(encoded)) {
1603 // For Map space and Old space, we cache the known Pages in map_pages, 1614 // For Map space and Old space, we cache the known Pages in map_pages,
1604 // old_pointer_pages and old_data_pages. Even though MapSpace keeps a list 1615 // old_pointer_pages and old_data_pages. Even though MapSpace keeps a list
1605 // of page addresses, we don't rely on it since GetObject uses AllocateRaw, 1616 // of page addresses, we don't rely on it since GetObject uses AllocateRaw,
1606 // and that appears not to update the page list. 1617 // and that appears not to update the page list.
1607 case MAP_SPACE: 1618 case MAP_SPACE:
1608 return ResolvePaged(PageIndex(encoded), PageOffset(encoded), 1619 return ResolvePaged(PageIndex(encoded), PageOffset(encoded),
1609 Heap::map_space(), &map_pages_); 1620 Heap::map_space(), &map_pages_);
1621 case CELL_SPACE:
1622 return ResolvePaged(PageIndex(encoded), PageOffset(encoded),
1623 Heap::cell_space(), &cell_pages_);
1610 case OLD_POINTER_SPACE: 1624 case OLD_POINTER_SPACE:
1611 return ResolvePaged(PageIndex(encoded), PageOffset(encoded), 1625 return ResolvePaged(PageIndex(encoded), PageOffset(encoded),
1612 Heap::old_pointer_space(), &old_pointer_pages_); 1626 Heap::old_pointer_space(), &old_pointer_pages_);
1613 case OLD_DATA_SPACE: 1627 case OLD_DATA_SPACE:
1614 return ResolvePaged(PageIndex(encoded), PageOffset(encoded), 1628 return ResolvePaged(PageIndex(encoded), PageOffset(encoded),
1615 Heap::old_data_space(), &old_data_pages_); 1629 Heap::old_data_space(), &old_data_pages_);
1616 case CODE_SPACE: 1630 case CODE_SPACE:
1617 return ResolvePaged(PageIndex(encoded), PageOffset(encoded), 1631 return ResolvePaged(PageIndex(encoded), PageOffset(encoded),
1618 Heap::code_space(), &code_pages_); 1632 Heap::code_space(), &code_pages_);
1619 case NEW_SPACE: 1633 case NEW_SPACE:
(...skipping 19 matching lines...) Expand all
1639 ASSERT(index < large_objects_.length()); 1653 ASSERT(index < large_objects_.length());
1640 } 1654 }
1641 return large_objects_[index]; // s.page_offset() is ignored. 1655 return large_objects_[index]; // s.page_offset() is ignored.
1642 } 1656 }
1643 UNREACHABLE(); 1657 UNREACHABLE();
1644 return NULL; 1658 return NULL;
1645 } 1659 }
1646 1660
1647 1661
1648 } } // namespace v8::internal 1662 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/serialize.h ('k') | src/spaces.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698