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 2608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2619 } | 2619 } |
2620 | 2620 |
2621 const int max_map_space_pages_; | 2621 const int max_map_space_pages_; |
2622 | 2622 |
2623 public: | 2623 public: |
2624 TRACK_MEMORY("MapSpace") | 2624 TRACK_MEMORY("MapSpace") |
2625 }; | 2625 }; |
2626 | 2626 |
2627 | 2627 |
2628 // ----------------------------------------------------------------------------- | 2628 // ----------------------------------------------------------------------------- |
| 2629 // Old space for simple property cell objects |
| 2630 |
| 2631 class CellSpace : public FixedSpace { |
| 2632 public: |
| 2633 // Creates a property cell space object with a maximum capacity. |
| 2634 CellSpace(Heap* heap, intptr_t max_capacity, AllocationSpace id) |
| 2635 : FixedSpace(heap, max_capacity, id, Cell::kSize) |
| 2636 {} |
| 2637 |
| 2638 virtual int RoundSizeDownToObjectAlignment(int size) { |
| 2639 if (IsPowerOf2(Cell::kSize)) { |
| 2640 return RoundDown(size, Cell::kSize); |
| 2641 } else { |
| 2642 return (size / Cell::kSize) * Cell::kSize; |
| 2643 } |
| 2644 } |
| 2645 |
| 2646 protected: |
| 2647 virtual void VerifyObject(HeapObject* obj); |
| 2648 |
| 2649 public: |
| 2650 TRACK_MEMORY("CellSpace") |
| 2651 }; |
| 2652 |
| 2653 |
| 2654 // ----------------------------------------------------------------------------- |
2629 // Old space for all global object property cell objects | 2655 // Old space for all global object property cell objects |
2630 | 2656 |
2631 class CellSpace : public FixedSpace { | 2657 class PropertyCellSpace : public FixedSpace { |
2632 public: | 2658 public: |
2633 // Creates a property cell space object with a maximum capacity. | 2659 // Creates a property cell space object with a maximum capacity. |
2634 CellSpace(Heap* heap, intptr_t max_capacity, AllocationSpace id) | 2660 PropertyCellSpace(Heap* heap, intptr_t max_capacity, |
| 2661 AllocationSpace id) |
2635 : FixedSpace(heap, max_capacity, id, JSGlobalPropertyCell::kSize) | 2662 : FixedSpace(heap, max_capacity, id, JSGlobalPropertyCell::kSize) |
2636 {} | 2663 {} |
2637 | 2664 |
2638 virtual int RoundSizeDownToObjectAlignment(int size) { | 2665 virtual int RoundSizeDownToObjectAlignment(int size) { |
2639 if (IsPowerOf2(JSGlobalPropertyCell::kSize)) { | 2666 if (IsPowerOf2(JSGlobalPropertyCell::kSize)) { |
2640 return RoundDown(size, JSGlobalPropertyCell::kSize); | 2667 return RoundDown(size, JSGlobalPropertyCell::kSize); |
2641 } else { | 2668 } else { |
2642 return (size / JSGlobalPropertyCell::kSize) * JSGlobalPropertyCell::kSize; | 2669 return (size / JSGlobalPropertyCell::kSize) * JSGlobalPropertyCell::kSize; |
2643 } | 2670 } |
2644 } | 2671 } |
2645 | 2672 |
2646 protected: | 2673 protected: |
2647 virtual void VerifyObject(HeapObject* obj); | 2674 virtual void VerifyObject(HeapObject* obj); |
2648 | 2675 |
2649 public: | 2676 public: |
2650 TRACK_MEMORY("CellSpace") | 2677 TRACK_MEMORY("PropertyCellSpace") |
2651 }; | 2678 }; |
2652 | 2679 |
2653 | 2680 |
2654 // ----------------------------------------------------------------------------- | 2681 // ----------------------------------------------------------------------------- |
2655 // Large objects ( > Page::kMaxHeapObjectSize ) are allocated and managed by | 2682 // Large objects ( > Page::kMaxHeapObjectSize ) are allocated and managed by |
2656 // the large object space. A large object is allocated from OS heap with | 2683 // the large object space. A large object is allocated from OS heap with |
2657 // extra padding bytes (Page::kPageSize + Page::kObjectStartOffset). | 2684 // extra padding bytes (Page::kPageSize + Page::kObjectStartOffset). |
2658 // A large object always starts at Page::kObjectStartOffset to a page. | 2685 // A large object always starts at Page::kObjectStartOffset to a page. |
2659 // Large objects do not move during garbage collections. | 2686 // Large objects do not move during garbage collections. |
2660 | 2687 |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2845 } | 2872 } |
2846 // Must be small, since an iteration is used for lookup. | 2873 // Must be small, since an iteration is used for lookup. |
2847 static const int kMaxComments = 64; | 2874 static const int kMaxComments = 64; |
2848 }; | 2875 }; |
2849 #endif | 2876 #endif |
2850 | 2877 |
2851 | 2878 |
2852 } } // namespace v8::internal | 2879 } } // namespace v8::internal |
2853 | 2880 |
2854 #endif // V8_SPACES_H_ | 2881 #endif // V8_SPACES_H_ |
OLD | NEW |