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

Side by Side Diff: src/spaces.h

Issue 145493004: Make the full object memory size of a page available for a single allocation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 11 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/heap.cc ('k') | src/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 // 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 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 Address OffsetToAddress(int offset) { 772 Address OffsetToAddress(int offset) {
773 ASSERT_PAGE_OFFSET(offset); 773 ASSERT_PAGE_OFFSET(offset);
774 return address() + offset; 774 return address() + offset;
775 } 775 }
776 776
777 // --------------------------------------------------------------------- 777 // ---------------------------------------------------------------------
778 778
779 // Page size in bytes. This must be a multiple of the OS page size. 779 // Page size in bytes. This must be a multiple of the OS page size.
780 static const int kPageSize = 1 << kPageSizeBits; 780 static const int kPageSize = 1 << kPageSizeBits;
781 781
782 // Object area size in bytes.
783 static const int kNonCodeObjectAreaSize = kPageSize - kObjectStartOffset;
784
785 // Maximum object size that fits in a page. Objects larger than that size 782 // Maximum object size that fits in a page. Objects larger than that size
786 // are allocated in large object space and are never moved in memory. This 783 // are allocated in large object space and are never moved in memory. This
787 // also applies to new space allocation, since objects are never migrated 784 // also applies to new space allocation, since objects are never migrated
788 // from new space to large object space. Takes double alignment into account. 785 // from new space to large object space. Takes double alignment into account.
789 static const int kMaxNonCodeHeapObjectSize = 786 static const int kMaxNonCodeHeapObjectSize = kPageSize - kObjectStartOffset;
790 kNonCodeObjectAreaSize - kPointerSize;
791 787
792 // Page size mask. 788 // Page size mask.
793 static const intptr_t kPageAlignmentMask = (1 << kPageSizeBits) - 1; 789 static const intptr_t kPageAlignmentMask = (1 << kPageSizeBits) - 1;
794 790
795 inline void ClearGCFields(); 791 inline void ClearGCFields();
796 792
797 static inline Page* Initialize(Heap* heap, 793 static inline Page* Initialize(Heap* heap,
798 MemoryChunk* chunk, 794 MemoryChunk* chunk,
799 Executability executable, 795 Executability executable,
800 PagedSpace* owner); 796 PagedSpace* owner);
(...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after
2006 2002
2007 class NewSpacePage : public MemoryChunk { 2003 class NewSpacePage : public MemoryChunk {
2008 public: 2004 public:
2009 // GC related flags copied from from-space to to-space when 2005 // GC related flags copied from from-space to to-space when
2010 // flipping semispaces. 2006 // flipping semispaces.
2011 static const intptr_t kCopyOnFlipFlagsMask = 2007 static const intptr_t kCopyOnFlipFlagsMask =
2012 (1 << MemoryChunk::POINTERS_TO_HERE_ARE_INTERESTING) | 2008 (1 << MemoryChunk::POINTERS_TO_HERE_ARE_INTERESTING) |
2013 (1 << MemoryChunk::POINTERS_FROM_HERE_ARE_INTERESTING) | 2009 (1 << MemoryChunk::POINTERS_FROM_HERE_ARE_INTERESTING) |
2014 (1 << MemoryChunk::SCAN_ON_SCAVENGE); 2010 (1 << MemoryChunk::SCAN_ON_SCAVENGE);
2015 2011
2016 static const int kAreaSize = Page::kNonCodeObjectAreaSize; 2012 static const int kAreaSize = Page::kMaxNonCodeHeapObjectSize;
2017 2013
2018 inline NewSpacePage* next_page() const { 2014 inline NewSpacePage* next_page() const {
2019 return static_cast<NewSpacePage*>(next_chunk()); 2015 return static_cast<NewSpacePage*>(next_chunk());
2020 } 2016 }
2021 2017
2022 inline void set_next_page(NewSpacePage* page) { 2018 inline void set_next_page(NewSpacePage* page) {
2023 set_next_chunk(page); 2019 set_next_chunk(page);
2024 } 2020 }
2025 2021
2026 inline NewSpacePage* prev_page() const { 2022 inline NewSpacePage* prev_page() const {
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
2666 return RoundDown(size, Map::kSize); 2662 return RoundDown(size, Map::kSize);
2667 } else { 2663 } else {
2668 return (size / Map::kSize) * Map::kSize; 2664 return (size / Map::kSize) * Map::kSize;
2669 } 2665 }
2670 } 2666 }
2671 2667
2672 protected: 2668 protected:
2673 virtual void VerifyObject(HeapObject* obj); 2669 virtual void VerifyObject(HeapObject* obj);
2674 2670
2675 private: 2671 private:
2676 static const int kMapsPerPage = Page::kNonCodeObjectAreaSize / Map::kSize; 2672 static const int kMapsPerPage = Page::kMaxNonCodeHeapObjectSize / Map::kSize;
2677 2673
2678 // Do map space compaction if there is a page gap. 2674 // Do map space compaction if there is a page gap.
2679 int CompactionThreshold() { 2675 int CompactionThreshold() {
2680 return kMapsPerPage * (max_map_space_pages_ - 1); 2676 return kMapsPerPage * (max_map_space_pages_ - 1);
2681 } 2677 }
2682 2678
2683 const int max_map_space_pages_; 2679 const int max_map_space_pages_;
2684 2680
2685 public: 2681 public:
2686 TRACK_MEMORY("MapSpace") 2682 TRACK_MEMORY("MapSpace")
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
2934 } 2930 }
2935 // Must be small, since an iteration is used for lookup. 2931 // Must be small, since an iteration is used for lookup.
2936 static const int kMaxComments = 64; 2932 static const int kMaxComments = 64;
2937 }; 2933 };
2938 #endif 2934 #endif
2939 2935
2940 2936
2941 } } // namespace v8::internal 2937 } } // namespace v8::internal
2942 2938
2943 #endif // V8_SPACES_H_ 2939 #endif // V8_SPACES_H_
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/spaces-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698