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

Side by Side Diff: src/spaces.h

Issue 304553002: Replace STATIC_CHECK with STATIC_ASSERT. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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/runtime.cc ('k') | src/x64/code-stubs-x64.cc » ('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_SPACES_H_ 5 #ifndef V8_SPACES_H_
6 #define V8_SPACES_H_ 6 #define V8_SPACES_H_
7 7
8 #include "allocation.h" 8 #include "allocation.h"
9 #include "hashmap.h" 9 #include "hashmap.h"
10 #include "list.h" 10 #include "list.h"
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 private: 727 private:
728 // next_chunk_ holds a pointer of type MemoryChunk 728 // next_chunk_ holds a pointer of type MemoryChunk
729 AtomicWord next_chunk_; 729 AtomicWord next_chunk_;
730 // prev_chunk_ holds a pointer of type MemoryChunk 730 // prev_chunk_ holds a pointer of type MemoryChunk
731 AtomicWord prev_chunk_; 731 AtomicWord prev_chunk_;
732 732
733 friend class MemoryAllocator; 733 friend class MemoryAllocator;
734 }; 734 };
735 735
736 736
737 STATIC_CHECK(sizeof(MemoryChunk) <= MemoryChunk::kHeaderSize); 737 STATIC_ASSERT(sizeof(MemoryChunk) <= MemoryChunk::kHeaderSize);
738 738
739 739
740 // ----------------------------------------------------------------------------- 740 // -----------------------------------------------------------------------------
741 // A page is a memory chunk of a size 1MB. Large object pages may be larger. 741 // A page is a memory chunk of a size 1MB. Large object pages may be larger.
742 // 742 //
743 // The only way to get a page pointer is by calling factory methods: 743 // The only way to get a page pointer is by calling factory methods:
744 // Page* p = Page::FromAddress(addr); or 744 // Page* p = Page::FromAddress(addr); or
745 // Page* p = Page::FromAllocationTop(top); 745 // Page* p = Page::FromAllocationTop(top);
746 class Page : public MemoryChunk { 746 class Page : public MemoryChunk {
747 public: 747 public:
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 #undef FRAGMENTATION_STATS_ACCESSORS 834 #undef FRAGMENTATION_STATS_ACCESSORS
835 835
836 #ifdef DEBUG 836 #ifdef DEBUG
837 void Print(); 837 void Print();
838 #endif // DEBUG 838 #endif // DEBUG
839 839
840 friend class MemoryAllocator; 840 friend class MemoryAllocator;
841 }; 841 };
842 842
843 843
844 STATIC_CHECK(sizeof(Page) <= MemoryChunk::kHeaderSize); 844 STATIC_ASSERT(sizeof(Page) <= MemoryChunk::kHeaderSize);
845 845
846 846
847 class LargePage : public MemoryChunk { 847 class LargePage : public MemoryChunk {
848 public: 848 public:
849 HeapObject* GetObject() { 849 HeapObject* GetObject() {
850 return HeapObject::FromAddress(area_start()); 850 return HeapObject::FromAddress(area_start());
851 } 851 }
852 852
853 inline LargePage* next_page() const { 853 inline LargePage* next_page() const {
854 return static_cast<LargePage*>(next_chunk()); 854 return static_cast<LargePage*>(next_chunk());
855 } 855 }
856 856
857 inline void set_next_page(LargePage* page) { 857 inline void set_next_page(LargePage* page) {
858 set_next_chunk(page); 858 set_next_chunk(page);
859 } 859 }
860 private: 860 private:
861 static inline LargePage* Initialize(Heap* heap, MemoryChunk* chunk); 861 static inline LargePage* Initialize(Heap* heap, MemoryChunk* chunk);
862 862
863 friend class MemoryAllocator; 863 friend class MemoryAllocator;
864 }; 864 };
865 865
866 STATIC_CHECK(sizeof(LargePage) <= MemoryChunk::kHeaderSize); 866 STATIC_ASSERT(sizeof(LargePage) <= MemoryChunk::kHeaderSize);
867 867
868 // ---------------------------------------------------------------------------- 868 // ----------------------------------------------------------------------------
869 // Space is the abstract superclass for all allocation spaces. 869 // Space is the abstract superclass for all allocation spaces.
870 class Space : public Malloced { 870 class Space : public Malloced {
871 public: 871 public:
872 Space(Heap* heap, AllocationSpace id, Executability executable) 872 Space(Heap* heap, AllocationSpace id, Executability executable)
873 : heap_(heap), id_(id), executable_(executable) {} 873 : heap_(heap), id_(id), executable_(executable) {}
874 874
875 virtual ~Space() {} 875 virtual ~Space() {}
876 876
(...skipping 2119 matching lines...) Expand 10 before | Expand all | Expand 10 after
2996 } 2996 }
2997 // Must be small, since an iteration is used for lookup. 2997 // Must be small, since an iteration is used for lookup.
2998 static const int kMaxComments = 64; 2998 static const int kMaxComments = 64;
2999 }; 2999 };
3000 #endif 3000 #endif
3001 3001
3002 3002
3003 } } // namespace v8::internal 3003 } } // namespace v8::internal
3004 3004
3005 #endif // V8_SPACES_H_ 3005 #endif // V8_SPACES_H_
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698