| 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 1436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1447 delete mutex_; | 1447 delete mutex_; |
| 1448 } | 1448 } |
| 1449 | 1449 |
| 1450 intptr_t Concatenate(FreeListCategory* category); | 1450 intptr_t Concatenate(FreeListCategory* category); |
| 1451 | 1451 |
| 1452 void Reset(); | 1452 void Reset(); |
| 1453 | 1453 |
| 1454 void Free(FreeListNode* node, int size_in_bytes); | 1454 void Free(FreeListNode* node, int size_in_bytes); |
| 1455 | 1455 |
| 1456 FreeListNode* PickNodeFromList(int *node_size); | 1456 FreeListNode* PickNodeFromList(int *node_size); |
| 1457 FreeListNode* PickNodeFromList(int size_in_bytes, int *node_size); |
| 1457 | 1458 |
| 1458 intptr_t EvictFreeListItemsInList(Page* p); | 1459 intptr_t EvictFreeListItemsInList(Page* p); |
| 1459 | 1460 |
| 1460 void RepairFreeList(Heap* heap); | 1461 void RepairFreeList(Heap* heap); |
| 1461 | 1462 |
| 1462 FreeListNode** GetTopAddress() { return &top_; } | 1463 FreeListNode** GetTopAddress() { return &top_; } |
| 1463 FreeListNode* top() const { return top_; } | 1464 FreeListNode* top() const { return top_; } |
| 1464 void set_top(FreeListNode* top) { top_ = top; } | 1465 void set_top(FreeListNode* top) { top_ = top; } |
| 1465 | 1466 |
| 1466 FreeListNode** GetEndAddress() { return &end_; } | 1467 FreeListNode** GetEndAddress() { return &end_; } |
| (...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2619 } | 2620 } |
| 2620 | 2621 |
| 2621 const int max_map_space_pages_; | 2622 const int max_map_space_pages_; |
| 2622 | 2623 |
| 2623 public: | 2624 public: |
| 2624 TRACK_MEMORY("MapSpace") | 2625 TRACK_MEMORY("MapSpace") |
| 2625 }; | 2626 }; |
| 2626 | 2627 |
| 2627 | 2628 |
| 2628 // ----------------------------------------------------------------------------- | 2629 // ----------------------------------------------------------------------------- |
| 2629 // Old space for all global object property cell objects | 2630 // Old space for simple property cell objects |
| 2630 | 2631 |
| 2631 class CellSpace : public FixedSpace { | 2632 class CellSpace : public FixedSpace { |
| 2632 public: | 2633 public: |
| 2633 // Creates a property cell space object with a maximum capacity. | 2634 // Creates a property cell space object with a maximum capacity. |
| 2634 CellSpace(Heap* heap, intptr_t max_capacity, AllocationSpace id) | 2635 CellSpace(Heap* heap, intptr_t max_capacity, AllocationSpace id) |
| 2635 : FixedSpace(heap, max_capacity, id, JSGlobalPropertyCell::kSize) | 2636 : FixedSpace(heap, max_capacity, id, Cell::kSize) |
| 2636 {} | 2637 {} |
| 2637 | 2638 |
| 2638 virtual int RoundSizeDownToObjectAlignment(int size) { | 2639 virtual int RoundSizeDownToObjectAlignment(int size) { |
| 2639 if (IsPowerOf2(JSGlobalPropertyCell::kSize)) { | 2640 if (IsPowerOf2(Cell::kSize)) { |
| 2640 return RoundDown(size, JSGlobalPropertyCell::kSize); | 2641 return RoundDown(size, Cell::kSize); |
| 2641 } else { | 2642 } else { |
| 2642 return (size / JSGlobalPropertyCell::kSize) * JSGlobalPropertyCell::kSize; | 2643 return (size / Cell::kSize) * Cell::kSize; |
| 2643 } | 2644 } |
| 2644 } | 2645 } |
| 2645 | 2646 |
| 2646 protected: | 2647 protected: |
| 2647 virtual void VerifyObject(HeapObject* obj); | 2648 virtual void VerifyObject(HeapObject* obj); |
| 2648 | 2649 |
| 2649 public: | 2650 public: |
| 2650 TRACK_MEMORY("CellSpace") | 2651 TRACK_MEMORY("CellSpace") |
| 2651 }; | 2652 }; |
| 2652 | 2653 |
| 2653 | 2654 |
| 2654 // ----------------------------------------------------------------------------- | 2655 // ----------------------------------------------------------------------------- |
| 2656 // Old space for all global object property cell objects |
| 2657 |
| 2658 class PropertyCellSpace : public FixedSpace { |
| 2659 public: |
| 2660 // Creates a property cell space object with a maximum capacity. |
| 2661 PropertyCellSpace(Heap* heap, intptr_t max_capacity, |
| 2662 AllocationSpace id) |
| 2663 : FixedSpace(heap, max_capacity, id, PropertyCell::kSize) |
| 2664 {} |
| 2665 |
| 2666 virtual int RoundSizeDownToObjectAlignment(int size) { |
| 2667 if (IsPowerOf2(PropertyCell::kSize)) { |
| 2668 return RoundDown(size, PropertyCell::kSize); |
| 2669 } else { |
| 2670 return (size / PropertyCell::kSize) * PropertyCell::kSize; |
| 2671 } |
| 2672 } |
| 2673 |
| 2674 protected: |
| 2675 virtual void VerifyObject(HeapObject* obj); |
| 2676 |
| 2677 public: |
| 2678 TRACK_MEMORY("PropertyCellSpace") |
| 2679 }; |
| 2680 |
| 2681 |
| 2682 // ----------------------------------------------------------------------------- |
| 2655 // Large objects ( > Page::kMaxHeapObjectSize ) are allocated and managed by | 2683 // Large objects ( > Page::kMaxHeapObjectSize ) are allocated and managed by |
| 2656 // the large object space. A large object is allocated from OS heap with | 2684 // the large object space. A large object is allocated from OS heap with |
| 2657 // extra padding bytes (Page::kPageSize + Page::kObjectStartOffset). | 2685 // extra padding bytes (Page::kPageSize + Page::kObjectStartOffset). |
| 2658 // A large object always starts at Page::kObjectStartOffset to a page. | 2686 // A large object always starts at Page::kObjectStartOffset to a page. |
| 2659 // Large objects do not move during garbage collections. | 2687 // Large objects do not move during garbage collections. |
| 2660 | 2688 |
| 2661 class LargeObjectSpace : public Space { | 2689 class LargeObjectSpace : public Space { |
| 2662 public: | 2690 public: |
| 2663 LargeObjectSpace(Heap* heap, intptr_t max_capacity, AllocationSpace id); | 2691 LargeObjectSpace(Heap* heap, intptr_t max_capacity, AllocationSpace id); |
| 2664 virtual ~LargeObjectSpace() {} | 2692 virtual ~LargeObjectSpace() {} |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2845 } | 2873 } |
| 2846 // Must be small, since an iteration is used for lookup. | 2874 // Must be small, since an iteration is used for lookup. |
| 2847 static const int kMaxComments = 64; | 2875 static const int kMaxComments = 64; |
| 2848 }; | 2876 }; |
| 2849 #endif | 2877 #endif |
| 2850 | 2878 |
| 2851 | 2879 |
| 2852 } } // namespace v8::internal | 2880 } } // namespace v8::internal |
| 2853 | 2881 |
| 2854 #endif // V8_SPACES_H_ | 2882 #endif // V8_SPACES_H_ |
| OLD | NEW |