OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_HEAP_HEAP_H_ | 5 #ifndef V8_HEAP_HEAP_H_ |
6 #define V8_HEAP_HEAP_H_ | 6 #define V8_HEAP_HEAP_H_ |
7 | 7 |
8 #include <cmath> | 8 #include <cmath> |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 | 712 |
713 // Returns a deep copy of the JavaScript object. | 713 // Returns a deep copy of the JavaScript object. |
714 // Properties and elements are copied too. | 714 // Properties and elements are copied too. |
715 // Optionally takes an AllocationSite to be appended in an AllocationMemento. | 715 // Optionally takes an AllocationSite to be appended in an AllocationMemento. |
716 MUST_USE_RESULT AllocationResult | 716 MUST_USE_RESULT AllocationResult |
717 CopyJSObject(JSObject* source, AllocationSite* site = NULL); | 717 CopyJSObject(JSObject* source, AllocationSite* site = NULL); |
718 | 718 |
719 // This method assumes overallocation of one word. It will store a filler | 719 // This method assumes overallocation of one word. It will store a filler |
720 // before the object if the given object is not double aligned, otherwise | 720 // before the object if the given object is not double aligned, otherwise |
721 // it will place the filler after the object. | 721 // it will place the filler after the object. |
722 MUST_USE_RESULT HeapObject* EnsureDoubleAligned(HeapObject* object, int size); | 722 MUST_USE_RESULT HeapObject* EnsureAligned(HeapObject* object, int size, |
| 723 AllocationAlignment alignment); |
| 724 |
| 725 MUST_USE_RESULT HeapObject* PrecedeWithFiller(HeapObject* object); |
723 | 726 |
724 // Clear the Instanceof cache (used when a prototype changes). | 727 // Clear the Instanceof cache (used when a prototype changes). |
725 inline void ClearInstanceofCache(); | 728 inline void ClearInstanceofCache(); |
726 | 729 |
727 // Iterates the whole code space to clear all ICs of the given kind. | 730 // Iterates the whole code space to clear all ICs of the given kind. |
728 void ClearAllICsByKind(Code::Kind kind); | 731 void ClearAllICsByKind(Code::Kind kind); |
729 | 732 |
730 // FreeSpace objects have a null map after deserialization. Update the map. | 733 // FreeSpace objects have a null map after deserialization. Update the map. |
731 void RepairFreeListsAfterDeserialization(); | 734 void RepairFreeListsAfterDeserialization(); |
732 | 735 |
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1812 // Selects the proper allocation space depending on the given object | 1815 // Selects the proper allocation space depending on the given object |
1813 // size and pretenuring decision. | 1816 // size and pretenuring decision. |
1814 static AllocationSpace SelectSpace(int object_size, | 1817 static AllocationSpace SelectSpace(int object_size, |
1815 PretenureFlag pretenure) { | 1818 PretenureFlag pretenure) { |
1816 if (object_size > Page::kMaxRegularHeapObjectSize) return LO_SPACE; | 1819 if (object_size > Page::kMaxRegularHeapObjectSize) return LO_SPACE; |
1817 return (pretenure == TENURED) ? OLD_SPACE : NEW_SPACE; | 1820 return (pretenure == TENURED) ? OLD_SPACE : NEW_SPACE; |
1818 } | 1821 } |
1819 | 1822 |
1820 HeapObject* DoubleAlignForDeserialization(HeapObject* object, int size); | 1823 HeapObject* DoubleAlignForDeserialization(HeapObject* object, int size); |
1821 | 1824 |
1822 enum Alignment { kWordAligned, kDoubleAligned }; | |
1823 | |
1824 // Allocate an uninitialized object. The memory is non-executable if the | 1825 // Allocate an uninitialized object. The memory is non-executable if the |
1825 // hardware and OS allow. This is the single choke-point for allocations | 1826 // hardware and OS allow. This is the single choke-point for allocations |
1826 // performed by the runtime and should not be bypassed (to extend this to | 1827 // performed by the runtime and should not be bypassed (to extend this to |
1827 // inlined allocations, use the Heap::DisableInlineAllocation() support). | 1828 // inlined allocations, use the Heap::DisableInlineAllocation() support). |
1828 MUST_USE_RESULT inline AllocationResult AllocateRaw( | 1829 MUST_USE_RESULT inline AllocationResult AllocateRaw( |
1829 int size_in_bytes, AllocationSpace space, AllocationSpace retry_space, | 1830 int size_in_bytes, AllocationSpace space, AllocationSpace retry_space, |
1830 Alignment aligment = kWordAligned); | 1831 AllocationAlignment aligment = kWordAligned); |
1831 | 1832 |
1832 // Allocates a heap object based on the map. | 1833 // Allocates a heap object based on the map. |
1833 MUST_USE_RESULT AllocationResult | 1834 MUST_USE_RESULT AllocationResult |
1834 Allocate(Map* map, AllocationSpace space, | 1835 Allocate(Map* map, AllocationSpace space, |
1835 AllocationSite* allocation_site = NULL); | 1836 AllocationSite* allocation_site = NULL); |
1836 | 1837 |
1837 // Allocates a partial map for bootstrapping. | 1838 // Allocates a partial map for bootstrapping. |
1838 MUST_USE_RESULT AllocationResult | 1839 MUST_USE_RESULT AllocationResult |
1839 AllocatePartialMap(InstanceType instance_type, int instance_size); | 1840 AllocatePartialMap(InstanceType instance_type, int instance_size); |
1840 | 1841 |
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2648 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2649 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
2649 | 2650 |
2650 private: | 2651 private: |
2651 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2652 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2652 }; | 2653 }; |
2653 #endif // DEBUG | 2654 #endif // DEBUG |
2654 } | 2655 } |
2655 } // namespace v8::internal | 2656 } // namespace v8::internal |
2656 | 2657 |
2657 #endif // V8_HEAP_HEAP_H_ | 2658 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |