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 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 | 765 |
766 | 766 |
767 DisallowAllocationFailure::~DisallowAllocationFailure() { | 767 DisallowAllocationFailure::~DisallowAllocationFailure() { |
768 HEAP->disallow_allocation_failure_ = old_state_; | 768 HEAP->disallow_allocation_failure_ = old_state_; |
769 } | 769 } |
770 #endif | 770 #endif |
771 | 771 |
772 | 772 |
773 #ifdef DEBUG | 773 #ifdef DEBUG |
774 AssertNoAllocation::AssertNoAllocation() { | 774 AssertNoAllocation::AssertNoAllocation() { |
775 old_state_ = HEAP->allow_allocation(false); | 775 Isolate* isolate = ISOLATE; |
| 776 active_ = !isolate->optimizing_compiler_thread()->IsOptimizerThread(); |
| 777 if (active_) { |
| 778 old_state_ = isolate->heap()->allow_allocation(false); |
| 779 } |
776 } | 780 } |
777 | 781 |
778 | 782 |
779 AssertNoAllocation::~AssertNoAllocation() { | 783 AssertNoAllocation::~AssertNoAllocation() { |
780 HEAP->allow_allocation(old_state_); | 784 if (active_) HEAP->allow_allocation(old_state_); |
781 } | 785 } |
782 | 786 |
783 | 787 |
784 DisableAssertNoAllocation::DisableAssertNoAllocation() { | 788 DisableAssertNoAllocation::DisableAssertNoAllocation() { |
785 old_state_ = HEAP->allow_allocation(true); | 789 Isolate* isolate = ISOLATE; |
| 790 active_ = !isolate->optimizing_compiler_thread()->IsOptimizerThread(); |
| 791 if (active_) { |
| 792 old_state_ = isolate->heap()->allow_allocation(true); |
| 793 } |
786 } | 794 } |
787 | 795 |
788 | 796 |
789 DisableAssertNoAllocation::~DisableAssertNoAllocation() { | 797 DisableAssertNoAllocation::~DisableAssertNoAllocation() { |
790 HEAP->allow_allocation(old_state_); | 798 if (active_) HEAP->allow_allocation(old_state_); |
791 } | 799 } |
792 | 800 |
793 #else | 801 #else |
794 | 802 |
795 AssertNoAllocation::AssertNoAllocation() { } | 803 AssertNoAllocation::AssertNoAllocation() { } |
796 AssertNoAllocation::~AssertNoAllocation() { } | 804 AssertNoAllocation::~AssertNoAllocation() { } |
797 DisableAssertNoAllocation::DisableAssertNoAllocation() { } | 805 DisableAssertNoAllocation::DisableAssertNoAllocation() { } |
798 DisableAssertNoAllocation::~DisableAssertNoAllocation() { } | 806 DisableAssertNoAllocation::~DisableAssertNoAllocation() { } |
799 | 807 |
800 #endif | 808 #endif |
801 | 809 |
802 | 810 |
803 } } // namespace v8::internal | 811 } } // namespace v8::internal |
804 | 812 |
805 #endif // V8_HEAP_INL_H_ | 813 #endif // V8_HEAP_INL_H_ |
OLD | NEW |