OLD | NEW |
1 // Copyright 2011 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 |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 isolate_->heap()->AllocateHeapNumber(answer); | 693 isolate_->heap()->AllocateHeapNumber(answer); |
694 if (!maybe_heap_number->ToObject(&heap_number)) return maybe_heap_number; | 694 if (!maybe_heap_number->ToObject(&heap_number)) return maybe_heap_number; |
695 } | 695 } |
696 elements_[hash].in[0] = c.integers[0]; | 696 elements_[hash].in[0] = c.integers[0]; |
697 elements_[hash].in[1] = c.integers[1]; | 697 elements_[hash].in[1] = c.integers[1]; |
698 elements_[hash].output = heap_number; | 698 elements_[hash].output = heap_number; |
699 return heap_number; | 699 return heap_number; |
700 } | 700 } |
701 | 701 |
702 | 702 |
703 Heap* _inline_get_heap_() { | 703 AlwaysAllocateScope::AlwaysAllocateScope() { |
704 return HEAP; | 704 // We shouldn't hit any nested scopes, because that requires |
| 705 // non-handle code to call handle code. The code still works but |
| 706 // performance will degrade, so we want to catch this situation |
| 707 // in debug mode. |
| 708 ASSERT(HEAP->always_allocate_scope_depth_ == 0); |
| 709 HEAP->always_allocate_scope_depth_++; |
705 } | 710 } |
706 | 711 |
707 | 712 |
| 713 AlwaysAllocateScope::~AlwaysAllocateScope() { |
| 714 HEAP->always_allocate_scope_depth_--; |
| 715 ASSERT(HEAP->always_allocate_scope_depth_ == 0); |
| 716 } |
| 717 |
| 718 |
| 719 LinearAllocationScope::LinearAllocationScope() { |
| 720 HEAP->linear_allocation_scope_depth_++; |
| 721 } |
| 722 |
| 723 |
| 724 LinearAllocationScope::~LinearAllocationScope() { |
| 725 HEAP->linear_allocation_scope_depth_--; |
| 726 ASSERT(HEAP->linear_allocation_scope_depth_ >= 0); |
| 727 } |
| 728 |
| 729 |
| 730 #ifdef DEBUG |
| 731 void VerifyPointersVisitor::VisitPointers(Object** start, Object** end) { |
| 732 for (Object** current = start; current < end; current++) { |
| 733 if ((*current)->IsHeapObject()) { |
| 734 HeapObject* object = HeapObject::cast(*current); |
| 735 ASSERT(HEAP->Contains(object)); |
| 736 ASSERT(object->map()->IsMap()); |
| 737 } |
| 738 } |
| 739 } |
| 740 #endif |
| 741 |
| 742 |
| 743 double GCTracer::SizeOfHeapObjects() { |
| 744 return (static_cast<double>(HEAP->SizeOfObjects())) / MB; |
| 745 } |
| 746 |
| 747 |
| 748 #ifdef DEBUG |
| 749 DisallowAllocationFailure::DisallowAllocationFailure() { |
| 750 old_state_ = HEAP->disallow_allocation_failure_; |
| 751 HEAP->disallow_allocation_failure_ = true; |
| 752 } |
| 753 |
| 754 |
| 755 DisallowAllocationFailure::~DisallowAllocationFailure() { |
| 756 HEAP->disallow_allocation_failure_ = old_state_; |
| 757 } |
| 758 #endif |
| 759 |
| 760 |
| 761 #ifdef DEBUG |
| 762 AssertNoAllocation::AssertNoAllocation() { |
| 763 old_state_ = HEAP->allow_allocation(false); |
| 764 } |
| 765 |
| 766 |
| 767 AssertNoAllocation::~AssertNoAllocation() { |
| 768 HEAP->allow_allocation(old_state_); |
| 769 } |
| 770 |
| 771 |
| 772 DisableAssertNoAllocation::DisableAssertNoAllocation() { |
| 773 old_state_ = HEAP->allow_allocation(true); |
| 774 } |
| 775 |
| 776 |
| 777 DisableAssertNoAllocation::~DisableAssertNoAllocation() { |
| 778 HEAP->allow_allocation(old_state_); |
| 779 } |
| 780 |
| 781 #else |
| 782 |
| 783 AssertNoAllocation::AssertNoAllocation() { } |
| 784 AssertNoAllocation::~AssertNoAllocation() { } |
| 785 DisableAssertNoAllocation::DisableAssertNoAllocation() { } |
| 786 DisableAssertNoAllocation::~DisableAssertNoAllocation() { } |
| 787 |
| 788 #endif |
| 789 |
| 790 |
708 } } // namespace v8::internal | 791 } } // namespace v8::internal |
709 | 792 |
710 #endif // V8_HEAP_INL_H_ | 793 #endif // V8_HEAP_INL_H_ |
OLD | NEW |