Chromium Code Reviews| 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 void VerifyPointersVisitor::VisitPointers(Object** start, Object** end) { | |
|
Vyacheslav Egorov (Chromium)
2012/01/27 08:41:04
I think this will not compile in release mode (cla
| |
| 731 for (Object** current = start; current < end; current++) { | |
| 732 if ((*current)->IsHeapObject()) { | |
| 733 HeapObject* object = HeapObject::cast(*current); | |
| 734 ASSERT(HEAP->Contains(object)); | |
| 735 ASSERT(object->map()->IsMap()); | |
| 736 } | |
| 737 } | |
| 738 } | |
| 739 | |
| 740 | |
| 741 double GCTracer::SizeOfHeapObjects() { | |
| 742 return (static_cast<double>(HEAP->SizeOfObjects())) / MB; | |
| 743 } | |
| 744 | |
| 745 | |
| 746 #ifdef DEBUG | |
| 747 DisallowAllocationFailure::DisallowAllocationFailure() { | |
| 748 old_state_ = HEAP->disallow_allocation_failure_; | |
| 749 HEAP->disallow_allocation_failure_ = true; | |
| 750 } | |
| 751 | |
| 752 | |
| 753 DisallowAllocationFailure::~DisallowAllocationFailure() { | |
| 754 HEAP->disallow_allocation_failure_ = old_state_; | |
| 755 } | |
| 756 #endif | |
| 757 | |
| 758 | |
| 759 #ifdef DEBUG | |
| 760 AssertNoAllocation::AssertNoAllocation() { | |
| 761 old_state_ = HEAP->allow_allocation(false); | |
| 762 } | |
| 763 | |
| 764 | |
| 765 AssertNoAllocation::~AssertNoAllocation() { | |
| 766 HEAP->allow_allocation(old_state_); | |
| 767 } | |
| 768 | |
| 769 | |
| 770 DisableAssertNoAllocation::DisableAssertNoAllocation() { | |
| 771 old_state_ = HEAP->allow_allocation(true); | |
| 772 } | |
| 773 | |
| 774 | |
| 775 DisableAssertNoAllocation::~DisableAssertNoAllocation() { | |
| 776 HEAP->allow_allocation(old_state_); | |
| 777 } | |
| 778 | |
| 779 #else | |
| 780 | |
| 781 AssertNoAllocation::AssertNoAllocation() { } | |
| 782 AssertNoAllocation::~AssertNoAllocation() { } | |
| 783 DisableAssertNoAllocation::DisableAssertNoAllocation() { } | |
| 784 pDisableAssertNoAllocation::~DisableAssertNoAllocation() { } | |
|
Vyacheslav Egorov (Chromium)
2012/01/27 08:41:04
I think this will not compile.
| |
| 785 | |
| 786 #endif | |
| 787 | |
| 788 | |
| 708 } } // namespace v8::internal | 789 } } // namespace v8::internal |
| 709 | 790 |
| 710 #endif // V8_HEAP_INL_H_ | 791 #endif // V8_HEAP_INL_H_ |
| OLD | NEW |