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 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 bool CanExpandOldGeneration(int size) { | 709 bool CanExpandOldGeneration(int size) { |
710 return (CommittedOldGenerationMemory() + size) < MaxOldGenerationSize(); | 710 return (CommittedOldGenerationMemory() + size) < MaxOldGenerationSize(); |
711 } | 711 } |
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 // Calculates the maximum amount of filler that could be required by the |
720 // before the object if the given object is not double aligned, otherwise | 720 // given alignment. |
721 // it will place the filler after the object. | 721 static int GetMaximumFillToAlign(AllocationAlignment alignment); |
722 MUST_USE_RESULT HeapObject* EnsureAligned(HeapObject* object, int size, | 722 // Calculates the actual amount of filler required for a given address at the |
723 AllocationAlignment alignment); | 723 // given alignment. |
| 724 static int GetFillToAlign(Address address, AllocationAlignment alignment); |
724 | 725 |
725 MUST_USE_RESULT HeapObject* PrecedeWithFiller(HeapObject* object); | 726 // Creates a filler object and returns a heap object immediately after it. |
| 727 MUST_USE_RESULT HeapObject* PrecedeWithFiller(HeapObject* object, |
| 728 int filler_size); |
| 729 // Creates a filler object if needed for alignment and returns a heap object |
| 730 // immediately after it. If any space is left after the returned object, |
| 731 // another filler object is created so the over allocated memory is iterable. |
| 732 MUST_USE_RESULT HeapObject* AlignWithFiller(HeapObject* object, |
| 733 int object_size, |
| 734 int allocation_size, |
| 735 AllocationAlignment alignment); |
726 | 736 |
727 // Clear the Instanceof cache (used when a prototype changes). | 737 // Clear the Instanceof cache (used when a prototype changes). |
728 inline void ClearInstanceofCache(); | 738 inline void ClearInstanceofCache(); |
729 | 739 |
730 // Iterates the whole code space to clear all ICs of the given kind. | 740 // Iterates the whole code space to clear all ICs of the given kind. |
731 void ClearAllICsByKind(Code::Kind kind); | 741 void ClearAllICsByKind(Code::Kind kind); |
732 | 742 |
733 // FreeSpace objects have a null map after deserialization. Update the map. | 743 // FreeSpace objects have a null map after deserialization. Update the map. |
734 void RepairFreeListsAfterDeserialization(); | 744 void RepairFreeListsAfterDeserialization(); |
735 | 745 |
(...skipping 1987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2723 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2733 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
2724 | 2734 |
2725 private: | 2735 private: |
2726 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2736 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2727 }; | 2737 }; |
2728 #endif // DEBUG | 2738 #endif // DEBUG |
2729 } | 2739 } |
2730 } // namespace v8::internal | 2740 } // namespace v8::internal |
2731 | 2741 |
2732 #endif // V8_HEAP_HEAP_H_ | 2742 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |