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 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 // Indicies for direct access into argument objects. | 693 // Indicies for direct access into argument objects. |
694 static const int kArgumentsLengthIndex = 0; | 694 static const int kArgumentsLengthIndex = 0; |
695 // callee is only valid in sloppy mode. | 695 // callee is only valid in sloppy mode. |
696 static const int kArgumentsCalleeIndex = 1; | 696 static const int kArgumentsCalleeIndex = 1; |
697 | 697 |
698 // Finalizes an external string by deleting the associated external | 698 // Finalizes an external string by deleting the associated external |
699 // data and clearing the resource pointer. | 699 // data and clearing the resource pointer. |
700 inline void FinalizeExternalString(String* string); | 700 inline void FinalizeExternalString(String* string); |
701 | 701 |
702 // Initialize a filler object to keep the ability to iterate over the heap | 702 // Initialize a filler object to keep the ability to iterate over the heap |
703 // when shortening objects. | 703 // when introducing gaps within pages. |
704 void CreateFillerObjectAt(Address addr, int size); | 704 void CreateFillerObjectAt(Address addr, int size); |
705 | 705 |
706 bool CanMoveObjectStart(HeapObject* object); | 706 bool CanMoveObjectStart(HeapObject* object); |
707 | 707 |
| 708 // Indicates whether live bytes adjustment is triggered from within the GC |
| 709 // code or from mutator code. |
708 enum InvocationMode { FROM_GC, FROM_MUTATOR }; | 710 enum InvocationMode { FROM_GC, FROM_MUTATOR }; |
709 | 711 |
710 // Maintain marking consistency for IncrementalMarking. | 712 // Maintain consistency of live bytes during incremental marking. |
711 void AdjustLiveBytes(Address address, int by, InvocationMode mode); | 713 void AdjustLiveBytes(Address address, int by, InvocationMode mode); |
712 | 714 |
| 715 // Trim the given array from the left. Note that this relocates the object |
| 716 // start and hence is only valid if there is only a single reference to it. |
| 717 FixedArrayBase* LeftTrimFixedArray(FixedArrayBase* obj, int elements_to_trim); |
| 718 |
| 719 // Trim the given array from the right. |
| 720 template<Heap::InvocationMode mode> |
| 721 void RightTrimFixedArray(FixedArrayBase* obj, int elements_to_trim); |
| 722 |
713 // Converts the given boolean condition to JavaScript boolean value. | 723 // Converts the given boolean condition to JavaScript boolean value. |
714 inline Object* ToBoolean(bool condition); | 724 inline Object* ToBoolean(bool condition); |
715 | 725 |
716 // Performs garbage collection operation. | 726 // Performs garbage collection operation. |
717 // Returns whether there is a chance that another major GC could | 727 // Returns whether there is a chance that another major GC could |
718 // collect more garbage. | 728 // collect more garbage. |
719 inline bool CollectGarbage( | 729 inline bool CollectGarbage( |
720 AllocationSpace space, const char* gc_reason = NULL, | 730 AllocationSpace space, const char* gc_reason = NULL, |
721 const GCCallbackFlags gc_callback_flags = kNoGCCallbackFlags); | 731 const GCCallbackFlags gc_callback_flags = kNoGCCallbackFlags); |
722 | 732 |
(...skipping 1805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2528 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2538 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
2529 | 2539 |
2530 private: | 2540 private: |
2531 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2541 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2532 }; | 2542 }; |
2533 #endif // DEBUG | 2543 #endif // DEBUG |
2534 } | 2544 } |
2535 } // namespace v8::internal | 2545 } // namespace v8::internal |
2536 | 2546 |
2537 #endif // V8_HEAP_HEAP_H_ | 2547 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |