| 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 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 explicit RelocationLock(Heap* heap) : heap_(heap) { | 613 explicit RelocationLock(Heap* heap) : heap_(heap) { |
| 614 heap_->relocation_mutex_.Lock(); | 614 heap_->relocation_mutex_.Lock(); |
| 615 } | 615 } |
| 616 | 616 |
| 617 ~RelocationLock() { heap_->relocation_mutex_.Unlock(); } | 617 ~RelocationLock() { heap_->relocation_mutex_.Unlock(); } |
| 618 | 618 |
| 619 private: | 619 private: |
| 620 Heap* heap_; | 620 Heap* heap_; |
| 621 }; | 621 }; |
| 622 | 622 |
| 623 // An optional version of the above lock that can be used for some critical | |
| 624 // sections on the mutator thread; only safe since the GC currently does not | |
| 625 // do concurrent compaction. | |
| 626 class OptionalRelocationLock { | |
| 627 public: | |
| 628 OptionalRelocationLock(Heap* heap, bool concurrent) | |
| 629 : heap_(heap), concurrent_(concurrent) { | |
| 630 if (concurrent_) heap_->relocation_mutex_.Lock(); | |
| 631 } | |
| 632 | |
| 633 ~OptionalRelocationLock() { | |
| 634 if (concurrent_) heap_->relocation_mutex_.Unlock(); | |
| 635 } | |
| 636 | |
| 637 private: | |
| 638 Heap* heap_; | |
| 639 bool concurrent_; | |
| 640 }; | |
| 641 | |
| 642 // Support for partial snapshots. After calling this we have a linear | 623 // Support for partial snapshots. After calling this we have a linear |
| 643 // space to write objects in each space. | 624 // space to write objects in each space. |
| 644 struct Chunk { | 625 struct Chunk { |
| 645 uint32_t size; | 626 uint32_t size; |
| 646 Address start; | 627 Address start; |
| 647 Address end; | 628 Address end; |
| 648 }; | 629 }; |
| 649 typedef List<Chunk> Reservation; | 630 typedef List<Chunk> Reservation; |
| 650 | 631 |
| 651 static const intptr_t kMinimumOldGenerationAllocationLimit = | 632 static const intptr_t kMinimumOldGenerationAllocationLimit = |
| (...skipping 2083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2735 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2716 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
| 2736 | 2717 |
| 2737 private: | 2718 private: |
| 2738 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2719 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2739 }; | 2720 }; |
| 2740 #endif // DEBUG | 2721 #endif // DEBUG |
| 2741 } // namespace internal | 2722 } // namespace internal |
| 2742 } // namespace v8 | 2723 } // namespace v8 |
| 2743 | 2724 |
| 2744 #endif // V8_HEAP_HEAP_H_ | 2725 #endif // V8_HEAP_HEAP_H_ |
| OLD | NEW |