OLD | NEW |
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 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 void ReportStatistics(); | 640 void ReportStatistics(); |
641 #endif | 641 #endif |
642 | 642 |
643 // Due to encoding limitation, we can only have 8K chunks. | 643 // Due to encoding limitation, we can only have 8K chunks. |
644 static const int kMaxNofChunks = 1 << kPageSizeBits; | 644 static const int kMaxNofChunks = 1 << kPageSizeBits; |
645 // If a chunk has at least 16 pages, the maximum heap size is about | 645 // If a chunk has at least 16 pages, the maximum heap size is about |
646 // 8K * 8K * 16 = 1G bytes. | 646 // 8K * 8K * 16 = 1G bytes. |
647 #ifdef V8_TARGET_ARCH_X64 | 647 #ifdef V8_TARGET_ARCH_X64 |
648 static const int kPagesPerChunk = 32; | 648 static const int kPagesPerChunk = 32; |
649 // On 64 bit the chunk table consists of 4 levels of 4096-entry tables. | 649 // On 64 bit the chunk table consists of 4 levels of 4096-entry tables. |
650 static const int kPagesPerChunkLog2 = 5; | |
651 static const int kChunkTableLevels = 4; | 650 static const int kChunkTableLevels = 4; |
652 static const int kChunkTableBitsPerLevel = 12; | 651 static const int kChunkTableBitsPerLevel = 12; |
653 #else | 652 #else |
654 static const int kPagesPerChunk = 16; | 653 static const int kPagesPerChunk = 16; |
655 // On 32 bit the chunk table consists of 2 levels of 256-entry tables. | 654 // On 32 bit the chunk table consists of 2 levels of 256-entry tables. |
656 static const int kPagesPerChunkLog2 = 4; | |
657 static const int kChunkTableLevels = 2; | 655 static const int kChunkTableLevels = 2; |
658 static const int kChunkTableBitsPerLevel = 8; | 656 static const int kChunkTableBitsPerLevel = 8; |
659 #endif | 657 #endif |
660 | 658 |
661 private: | 659 private: |
662 MemoryAllocator(); | 660 MemoryAllocator(); |
663 | 661 |
664 static const int kChunkSize = kPagesPerChunk * Page::kPageSize; | 662 static const int kChunkSize = kPagesPerChunk * Page::kPageSize; |
665 static const int kChunkSizeLog2 = kPagesPerChunkLog2 + kPageSizeBits; | |
666 | 663 |
667 // Maximum space size in bytes. | 664 // Maximum space size in bytes. |
668 intptr_t capacity_; | 665 intptr_t capacity_; |
669 // Maximum subset of capacity_ that can be executable | 666 // Maximum subset of capacity_ that can be executable |
670 intptr_t capacity_executable_; | 667 intptr_t capacity_executable_; |
671 | 668 |
672 // Allocated space size in bytes. | 669 // Allocated space size in bytes. |
673 intptr_t size_; | 670 intptr_t size_; |
674 | 671 |
675 // Allocated executable space size in bytes. | 672 // Allocated executable space size in bytes. |
(...skipping 1635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2311 } | 2308 } |
2312 // Must be small, since an iteration is used for lookup. | 2309 // Must be small, since an iteration is used for lookup. |
2313 static const int kMaxComments = 64; | 2310 static const int kMaxComments = 64; |
2314 }; | 2311 }; |
2315 #endif | 2312 #endif |
2316 | 2313 |
2317 | 2314 |
2318 } } // namespace v8::internal | 2315 } } // namespace v8::internal |
2319 | 2316 |
2320 #endif // V8_SPACES_H_ | 2317 #endif // V8_SPACES_H_ |
OLD | NEW |