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 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 intptr_t MaxOldGenerationSize() { return max_old_generation_size_; } | 600 intptr_t MaxOldGenerationSize() { return max_old_generation_size_; } |
601 intptr_t MaxExecutableSize() { return max_executable_size_; } | 601 intptr_t MaxExecutableSize() { return max_executable_size_; } |
602 | 602 |
603 // Returns the capacity of the heap in bytes w/o growing. Heap grows when | 603 // Returns the capacity of the heap in bytes w/o growing. Heap grows when |
604 // more spaces are needed until it reaches the limit. | 604 // more spaces are needed until it reaches the limit. |
605 intptr_t Capacity(); | 605 intptr_t Capacity(); |
606 | 606 |
607 // Returns the amount of memory currently committed for the heap. | 607 // Returns the amount of memory currently committed for the heap. |
608 intptr_t CommittedMemory(); | 608 intptr_t CommittedMemory(); |
609 | 609 |
| 610 // Returns the amount of memory currently committed for the old space. |
| 611 intptr_t CommittedOldGenerationMemory(); |
| 612 |
610 // Returns the amount of executable memory currently committed for the heap. | 613 // Returns the amount of executable memory currently committed for the heap. |
611 intptr_t CommittedMemoryExecutable(); | 614 intptr_t CommittedMemoryExecutable(); |
612 | 615 |
613 // Returns the amount of phyical memory currently committed for the heap. | 616 // Returns the amount of phyical memory currently committed for the heap. |
614 size_t CommittedPhysicalMemory(); | 617 size_t CommittedPhysicalMemory(); |
615 | 618 |
616 // Returns the maximum amount of memory ever committed for the heap. | 619 // Returns the maximum amount of memory ever committed for the heap. |
617 intptr_t MaximumCommittedMemory() { return maximum_committed_; } | 620 intptr_t MaximumCommittedMemory() { return maximum_committed_; } |
618 | 621 |
619 // Updates the maximum committed memory for the heap. Should be called | 622 // Updates the maximum committed memory for the heap. Should be called |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 return old_pointer_space_->allocation_limit_address(); | 686 return old_pointer_space_->allocation_limit_address(); |
684 } | 687 } |
685 | 688 |
686 Address* OldDataSpaceAllocationTopAddress() { | 689 Address* OldDataSpaceAllocationTopAddress() { |
687 return old_data_space_->allocation_top_address(); | 690 return old_data_space_->allocation_top_address(); |
688 } | 691 } |
689 Address* OldDataSpaceAllocationLimitAddress() { | 692 Address* OldDataSpaceAllocationLimitAddress() { |
690 return old_data_space_->allocation_limit_address(); | 693 return old_data_space_->allocation_limit_address(); |
691 } | 694 } |
692 | 695 |
| 696 // TODO(hpayer): There is still a missmatch between capacity and actual |
| 697 // committed memory size. |
| 698 bool CanExpandOldGeneration(int size) { |
| 699 return (CommittedOldGenerationMemory() + size) < MaxOldGenerationSize(); |
| 700 } |
| 701 |
693 // Returns a deep copy of the JavaScript object. | 702 // Returns a deep copy of the JavaScript object. |
694 // Properties and elements are copied too. | 703 // Properties and elements are copied too. |
695 // Optionally takes an AllocationSite to be appended in an AllocationMemento. | 704 // Optionally takes an AllocationSite to be appended in an AllocationMemento. |
696 MUST_USE_RESULT AllocationResult | 705 MUST_USE_RESULT AllocationResult |
697 CopyJSObject(JSObject* source, AllocationSite* site = NULL); | 706 CopyJSObject(JSObject* source, AllocationSite* site = NULL); |
698 | 707 |
699 // Clear the Instanceof cache (used when a prototype changes). | 708 // Clear the Instanceof cache (used when a prototype changes). |
700 inline void ClearInstanceofCache(); | 709 inline void ClearInstanceofCache(); |
701 | 710 |
702 // Iterates the whole code space to clear all ICs of the given kind. | 711 // Iterates the whole code space to clear all ICs of the given kind. |
(...skipping 1868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2571 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2580 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
2572 | 2581 |
2573 private: | 2582 private: |
2574 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2583 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2575 }; | 2584 }; |
2576 #endif // DEBUG | 2585 #endif // DEBUG |
2577 } | 2586 } |
2578 } // namespace v8::internal | 2587 } // namespace v8::internal |
2579 | 2588 |
2580 #endif // V8_HEAP_HEAP_H_ | 2589 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |