OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
750 } | 750 } |
751 } | 751 } |
752 #endif | 752 #endif |
753 | 753 |
754 | 754 |
755 double GCTracer::SizeOfHeapObjects() { | 755 double GCTracer::SizeOfHeapObjects() { |
756 return (static_cast<double>(HEAP->SizeOfObjects())) / MB; | 756 return (static_cast<double>(HEAP->SizeOfObjects())) / MB; |
757 } | 757 } |
758 | 758 |
759 | 759 |
| 760 DisallowAllocationFailure::DisallowAllocationFailure() { |
| 761 #ifdef DEBUG |
| 762 old_state_ = HEAP->disallow_allocation_failure_; |
| 763 HEAP->disallow_allocation_failure_ = true; |
| 764 #endif |
| 765 } |
| 766 |
| 767 |
| 768 DisallowAllocationFailure::~DisallowAllocationFailure() { |
| 769 #ifdef DEBUG |
| 770 HEAP->disallow_allocation_failure_ = old_state_; |
| 771 #endif |
| 772 } |
| 773 |
| 774 |
760 #ifdef DEBUG | 775 #ifdef DEBUG |
761 DisallowAllocationFailure::DisallowAllocationFailure() { | |
762 old_state_ = HEAP->disallow_allocation_failure_; | |
763 HEAP->disallow_allocation_failure_ = true; | |
764 } | |
765 | |
766 | |
767 DisallowAllocationFailure::~DisallowAllocationFailure() { | |
768 HEAP->disallow_allocation_failure_ = old_state_; | |
769 } | |
770 #endif | |
771 | |
772 | |
773 #ifdef DEBUG | |
774 AssertNoAllocation::AssertNoAllocation() { | 776 AssertNoAllocation::AssertNoAllocation() { |
775 Isolate* isolate = ISOLATE; | 777 Isolate* isolate = ISOLATE; |
776 active_ = !isolate->optimizing_compiler_thread()->IsOptimizerThread(); | 778 active_ = !isolate->optimizing_compiler_thread()->IsOptimizerThread(); |
777 if (active_) { | 779 if (active_) { |
778 old_state_ = isolate->heap()->allow_allocation(false); | 780 old_state_ = isolate->heap()->allow_allocation(false); |
779 } | 781 } |
780 } | 782 } |
781 | 783 |
782 | 784 |
783 AssertNoAllocation::~AssertNoAllocation() { | 785 AssertNoAllocation::~AssertNoAllocation() { |
(...skipping 20 matching lines...) Expand all Loading... |
804 AssertNoAllocation::~AssertNoAllocation() { } | 806 AssertNoAllocation::~AssertNoAllocation() { } |
805 DisableAssertNoAllocation::DisableAssertNoAllocation() { } | 807 DisableAssertNoAllocation::DisableAssertNoAllocation() { } |
806 DisableAssertNoAllocation::~DisableAssertNoAllocation() { } | 808 DisableAssertNoAllocation::~DisableAssertNoAllocation() { } |
807 | 809 |
808 #endif | 810 #endif |
809 | 811 |
810 | 812 |
811 } } // namespace v8::internal | 813 } } // namespace v8::internal |
812 | 814 |
813 #endif // V8_HEAP_INL_H_ | 815 #endif // V8_HEAP_INL_H_ |
OLD | NEW |