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 // Calculates the maximum amount of filler that could be required by the | 719 // This method assumes overallocation of one word. It will store a filler |
720 // given alignment. | 720 // before the object if the given object is not double aligned, otherwise |
721 static int GetMaximumFillToAlign(AllocationAlignment alignment); | 721 // it will place the filler after the object. |
722 // Calculates the actual amount of filler required for a given address at the | 722 MUST_USE_RESULT HeapObject* EnsureAligned(HeapObject* object, int size, |
723 // given alignment. | 723 AllocationAlignment alignment); |
724 static int GetFillToAlign(Address address, AllocationAlignment alignment); | |
725 | 724 |
726 // Creates a filler object and returns a heap object immediately after it. | 725 MUST_USE_RESULT HeapObject* PrecedeWithFiller(HeapObject* object); |
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); | |
736 | 726 |
737 // Clear the Instanceof cache (used when a prototype changes). | 727 // Clear the Instanceof cache (used when a prototype changes). |
738 inline void ClearInstanceofCache(); | 728 inline void ClearInstanceofCache(); |
739 | 729 |
740 // 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. |
741 void ClearAllICsByKind(Code::Kind kind); | 731 void ClearAllICsByKind(Code::Kind kind); |
742 | 732 |
743 // FreeSpace objects have a null map after deserialization. Update the map. | 733 // FreeSpace objects have a null map after deserialization. Update the map. |
744 void RepairFreeListsAfterDeserialization(); | 734 void RepairFreeListsAfterDeserialization(); |
745 | 735 |
(...skipping 1960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2706 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2696 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
2707 | 2697 |
2708 private: | 2698 private: |
2709 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2699 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2710 }; | 2700 }; |
2711 #endif // DEBUG | 2701 #endif // DEBUG |
2712 } | 2702 } |
2713 } // namespace v8::internal | 2703 } // namespace v8::internal |
2714 | 2704 |
2715 #endif // V8_HEAP_HEAP_H_ | 2705 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |