Chromium Code Reviews| 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 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 630 Address base, | 630 Address base, |
| 631 size_t size, | 631 size_t size, |
| 632 Address area_start, | 632 Address area_start, |
| 633 Address area_end, | 633 Address area_end, |
| 634 Executability executable, | 634 Executability executable, |
| 635 Space* owner); | 635 Space* owner); |
| 636 | 636 |
| 637 friend class MemoryAllocator; | 637 friend class MemoryAllocator; |
| 638 }; | 638 }; |
| 639 | 639 |
| 640 | |
| 640 STATIC_CHECK(sizeof(MemoryChunk) <= MemoryChunk::kHeaderSize); | 641 STATIC_CHECK(sizeof(MemoryChunk) <= MemoryChunk::kHeaderSize); |
| 641 | 642 |
| 643 | |
| 642 // ----------------------------------------------------------------------------- | 644 // ----------------------------------------------------------------------------- |
| 643 // A page is a memory chunk of a size 1MB. Large object pages may be larger. | 645 // A page is a memory chunk of a size 1MB. Large object pages may be larger. |
| 644 // | 646 // |
| 645 // The only way to get a page pointer is by calling factory methods: | 647 // The only way to get a page pointer is by calling factory methods: |
| 646 // Page* p = Page::FromAddress(addr); or | 648 // Page* p = Page::FromAddress(addr); or |
| 647 // Page* p = Page::FromAllocationTop(top); | 649 // Page* p = Page::FromAllocationTop(top); |
| 648 class Page : public MemoryChunk { | 650 class Page : public MemoryChunk { |
| 649 public: | 651 public: |
| 650 // Returns the page containing a given address. The address ranges | 652 // Returns the page containing a given address. The address ranges |
| 651 // from [page_addr .. page_addr + kPageSize[ | 653 // from [page_addr .. page_addr + kPageSize[ |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 943 class MemoryAllocator { | 945 class MemoryAllocator { |
| 944 public: | 946 public: |
| 945 explicit MemoryAllocator(Isolate* isolate); | 947 explicit MemoryAllocator(Isolate* isolate); |
| 946 | 948 |
| 947 // Initializes its internal bookkeeping structures. | 949 // Initializes its internal bookkeeping structures. |
| 948 // Max capacity of the total space and executable memory limit. | 950 // Max capacity of the total space and executable memory limit. |
| 949 bool SetUp(intptr_t max_capacity, intptr_t capacity_executable); | 951 bool SetUp(intptr_t max_capacity, intptr_t capacity_executable); |
| 950 | 952 |
| 951 void TearDown(); | 953 void TearDown(); |
| 952 | 954 |
| 953 Page* AllocatePage(PagedSpace* owner, Executability executable); | 955 Page* AllocatePage( |
| 956 intptr_t size, PagedSpace* owner, Executability executable); | |
| 954 | 957 |
| 955 LargePage* AllocateLargePage(intptr_t object_size, | 958 LargePage* AllocateLargePage(intptr_t object_size, |
| 956 Executability executable, | 959 Executability executable, |
|
Michael Starzinger
2012/04/02 08:25:05
I know you didn't touch that line, but something i
| |
| 957 Space* owner); | 960 Space* owner); |
| 958 | 961 |
| 959 void Free(MemoryChunk* chunk); | 962 void Free(MemoryChunk* chunk); |
| 960 | 963 |
| 961 // Returns the maximum available bytes of heaps. | 964 // Returns the maximum available bytes of heaps. |
| 962 intptr_t Available() { return capacity_ < size_ ? 0 : capacity_ - size_; } | 965 intptr_t Available() { return capacity_ < size_ ? 0 : capacity_ - size_; } |
| 963 | 966 |
| 964 // Returns allocated spaces in bytes. | 967 // Returns allocated spaces in bytes. |
| 965 intptr_t Size() { return size_; } | 968 intptr_t Size() { return size_; } |
| 966 | 969 |
| (...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1618 inline int AreaSize() { | 1621 inline int AreaSize() { |
| 1619 return area_size_; | 1622 return area_size_; |
| 1620 } | 1623 } |
| 1621 | 1624 |
| 1622 protected: | 1625 protected: |
| 1623 int area_size_; | 1626 int area_size_; |
| 1624 | 1627 |
| 1625 // Maximum capacity of this space. | 1628 // Maximum capacity of this space. |
| 1626 intptr_t max_capacity_; | 1629 intptr_t max_capacity_; |
| 1627 | 1630 |
| 1631 intptr_t SizeOfFirstPage(); | |
| 1632 | |
| 1628 // Accounting information for this space. | 1633 // Accounting information for this space. |
| 1629 AllocationStats accounting_stats_; | 1634 AllocationStats accounting_stats_; |
| 1630 | 1635 |
| 1631 // The dummy page that anchors the double linked list of pages. | 1636 // The dummy page that anchors the double linked list of pages. |
| 1632 Page anchor_; | 1637 Page anchor_; |
| 1633 | 1638 |
| 1634 // The space's free list. | 1639 // The space's free list. |
| 1635 FreeList free_list_; | 1640 FreeList free_list_; |
| 1636 | 1641 |
| 1637 // Normal allocation information. | 1642 // Normal allocation information. |
| (...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2636 } | 2641 } |
| 2637 // Must be small, since an iteration is used for lookup. | 2642 // Must be small, since an iteration is used for lookup. |
| 2638 static const int kMaxComments = 64; | 2643 static const int kMaxComments = 64; |
| 2639 }; | 2644 }; |
| 2640 #endif | 2645 #endif |
| 2641 | 2646 |
| 2642 | 2647 |
| 2643 } } // namespace v8::internal | 2648 } } // namespace v8::internal |
| 2644 | 2649 |
| 2645 #endif // V8_SPACES_H_ | 2650 #endif // V8_SPACES_H_ |
| OLD | NEW |