| OLD | NEW |
| 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 Address end, | 236 Address end, |
| 237 bool reaches_limit); | 237 bool reaches_limit); |
| 238 | 238 |
| 239 // Page size in bytes. This must be a multiple of the OS page size. | 239 // Page size in bytes. This must be a multiple of the OS page size. |
| 240 static const int kPageSize = 1 << kPageSizeBits; | 240 static const int kPageSize = 1 << kPageSizeBits; |
| 241 | 241 |
| 242 // Page size mask. | 242 // Page size mask. |
| 243 static const intptr_t kPageAlignmentMask = (1 << kPageSizeBits) - 1; | 243 static const intptr_t kPageAlignmentMask = (1 << kPageSizeBits) - 1; |
| 244 | 244 |
| 245 static const int kPageHeaderSize = kPointerSize + kPointerSize + kIntSize + | 245 static const int kPageHeaderSize = kPointerSize + kPointerSize + kIntSize + |
| 246 kIntSize + kPointerSize; | 246 kIntSize + kPointerSize + kPointerSize; |
| 247 | 247 |
| 248 // The start offset of the object area in a page. | 248 // The start offset of the object area in a page. |
| 249 static const int kObjectStartOffset = MAP_POINTER_ALIGN(kPageHeaderSize); | 249 static const int kObjectStartOffset = MAP_POINTER_ALIGN(kPageHeaderSize); |
| 250 | 250 |
| 251 // Object area size in bytes. | 251 // Object area size in bytes. |
| 252 static const int kObjectAreaSize = kPageSize - kObjectStartOffset; | 252 static const int kObjectAreaSize = kPageSize - kObjectStartOffset; |
| 253 | 253 |
| 254 // Maximum object size that fits in a page. | 254 // Maximum object size that fits in a page. |
| 255 static const int kMaxHeapObjectSize = kObjectAreaSize; | 255 static const int kMaxHeapObjectSize = kObjectAreaSize; |
| 256 | 256 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 279 // flag at the beginning of the next scavenge and each page becomes marked as | 279 // flag at the beginning of the next scavenge and each page becomes marked as |
| 280 // having a valid watermark. | 280 // having a valid watermark. |
| 281 // | 281 // |
| 282 // The following invariant must hold for pages in old pointer and map spaces: | 282 // The following invariant must hold for pages in old pointer and map spaces: |
| 283 // If page is in use then page is marked as having invalid watermark at | 283 // If page is in use then page is marked as having invalid watermark at |
| 284 // the beginning and at the end of any GC. | 284 // the beginning and at the end of any GC. |
| 285 // | 285 // |
| 286 // This invariant guarantees that after flipping flag meaning at the | 286 // This invariant guarantees that after flipping flag meaning at the |
| 287 // beginning of scavenge all pages in use will be marked as having valid | 287 // beginning of scavenge all pages in use will be marked as having valid |
| 288 // watermark. | 288 // watermark. |
| 289 static inline void FlipMeaningOfInvalidatedWatermarkFlag(); | 289 static inline void FlipMeaningOfInvalidatedWatermarkFlag(Heap* heap); |
| 290 | 290 |
| 291 // Returns true if the page allocation watermark was not altered during | 291 // Returns true if the page allocation watermark was not altered during |
| 292 // scavenge. | 292 // scavenge. |
| 293 inline bool IsWatermarkValid(); | 293 inline bool IsWatermarkValid(); |
| 294 | 294 |
| 295 inline void InvalidateWatermark(bool value); | 295 inline void InvalidateWatermark(bool value); |
| 296 | 296 |
| 297 inline bool GetPageFlag(PageFlag flag); | 297 inline bool GetPageFlag(PageFlag flag); |
| 298 inline void SetPageFlag(PageFlag flag, bool value); | 298 inline void SetPageFlag(PageFlag flag, bool value); |
| 299 inline void ClearPageFlags(); | 299 inline void ClearPageFlags(); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 uint32_t dirty_regions_; | 341 uint32_t dirty_regions_; |
| 342 | 342 |
| 343 // The index of the page in its owner space. | 343 // The index of the page in its owner space. |
| 344 int mc_page_index; | 344 int mc_page_index; |
| 345 | 345 |
| 346 // During mark-compact collections this field contains the forwarding address | 346 // During mark-compact collections this field contains the forwarding address |
| 347 // of the first live object in this page. | 347 // of the first live object in this page. |
| 348 // During scavenge collection this field is used to store allocation watermark | 348 // During scavenge collection this field is used to store allocation watermark |
| 349 // if it is altered during scavenge. | 349 // if it is altered during scavenge. |
| 350 Address mc_first_forwarded; | 350 Address mc_first_forwarded; |
| 351 |
| 352 Heap* heap_; |
| 351 }; | 353 }; |
| 352 | 354 |
| 353 | 355 |
| 354 // ---------------------------------------------------------------------------- | 356 // ---------------------------------------------------------------------------- |
| 355 // Space is the abstract superclass for all allocation spaces. | 357 // Space is the abstract superclass for all allocation spaces. |
| 356 class Space : public Malloced { | 358 class Space : public Malloced { |
| 357 public: | 359 public: |
| 358 Space(Heap* heap, AllocationSpace id, Executability executable) | 360 Space(Heap* heap, AllocationSpace id, Executability executable) |
| 359 : heap_(heap), id_(id), executable_(executable) {} | 361 : heap_(heap), id_(id), executable_(executable) {} |
| 360 | 362 |
| (...skipping 1930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2291 } | 2293 } |
| 2292 // Must be small, since an iteration is used for lookup. | 2294 // Must be small, since an iteration is used for lookup. |
| 2293 static const int kMaxComments = 64; | 2295 static const int kMaxComments = 64; |
| 2294 }; | 2296 }; |
| 2295 #endif | 2297 #endif |
| 2296 | 2298 |
| 2297 | 2299 |
| 2298 } } // namespace v8::internal | 2300 } } // namespace v8::internal |
| 2299 | 2301 |
| 2300 #endif // V8_SPACES_H_ | 2302 #endif // V8_SPACES_H_ |
| OLD | NEW |