| 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_INL_H_ | 5 #ifndef V8_HEAP_HEAP_INL_H_ |
| 6 #define V8_HEAP_HEAP_INL_H_ | 6 #define V8_HEAP_HEAP_INL_H_ |
| 7 | 7 |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 if (emergency_stack_ != NULL) { | 24 if (emergency_stack_ != NULL) { |
| 25 emergency_stack_->Add(Entry(target, size)); | 25 emergency_stack_->Add(Entry(target, size)); |
| 26 return; | 26 return; |
| 27 } | 27 } |
| 28 | 28 |
| 29 if (NewSpacePage::IsAtStart(reinterpret_cast<Address>(rear_))) { | 29 if (NewSpacePage::IsAtStart(reinterpret_cast<Address>(rear_))) { |
| 30 NewSpacePage* rear_page = | 30 NewSpacePage* rear_page = |
| 31 NewSpacePage::FromAddress(reinterpret_cast<Address>(rear_)); | 31 NewSpacePage::FromAddress(reinterpret_cast<Address>(rear_)); |
| 32 DCHECK(!rear_page->prev_page()->is_anchor()); | 32 DCHECK(!rear_page->prev_page()->is_anchor()); |
| 33 rear_ = reinterpret_cast<intptr_t*>(rear_page->prev_page()->area_end()); | 33 rear_ = reinterpret_cast<intptr_t*>(rear_page->prev_page()->area_end()); |
| 34 ActivateGuardIfOnTheSamePage(); | |
| 35 } | 34 } |
| 36 | 35 |
| 37 if (guard_) { | 36 if ((rear_ - 2) < limit_) { |
| 38 DCHECK(GetHeadPage() == | 37 RelocateQueueHead(); |
| 39 Page::FromAllocationTop(reinterpret_cast<Address>(limit_))); | 38 emergency_stack_->Add(Entry(target, size)); |
| 40 | 39 return; |
| 41 if ((rear_ - 2) < limit_) { | |
| 42 RelocateQueueHead(); | |
| 43 emergency_stack_->Add(Entry(target, size)); | |
| 44 return; | |
| 45 } | |
| 46 } | 40 } |
| 47 | 41 |
| 48 *(--rear_) = reinterpret_cast<intptr_t>(target); | 42 *(--rear_) = reinterpret_cast<intptr_t>(target); |
| 49 *(--rear_) = size; | 43 *(--rear_) = size; |
| 50 // Assert no overflow into live objects. | 44 // Assert no overflow into live objects. |
| 51 #ifdef DEBUG | 45 #ifdef DEBUG |
| 52 SemiSpace::AssertValidRange(target->GetIsolate()->heap()->new_space()->top(), | 46 SemiSpace::AssertValidRange(target->GetIsolate()->heap()->new_space()->top(), |
| 53 reinterpret_cast<Address>(rear_)); | 47 reinterpret_cast<Address>(rear_)); |
| 54 #endif | 48 #endif |
| 55 } | 49 } |
| 56 | 50 |
| 57 | 51 |
| 58 void PromotionQueue::ActivateGuardIfOnTheSamePage() { | |
| 59 guard_ = guard_ || | |
| 60 heap_->new_space()->active_space()->current_page()->address() == | |
| 61 GetHeadPage()->address(); | |
| 62 } | |
| 63 | |
| 64 | |
| 65 template <> | 52 template <> |
| 66 bool inline Heap::IsOneByte(Vector<const char> str, int chars) { | 53 bool inline Heap::IsOneByte(Vector<const char> str, int chars) { |
| 67 // TODO(dcarney): incorporate Latin-1 check when Latin-1 is supported? | 54 // TODO(dcarney): incorporate Latin-1 check when Latin-1 is supported? |
| 68 // ASCII only check. | 55 // ASCII only check. |
| 69 return chars == str.length(); | 56 return chars == str.length(); |
| 70 } | 57 } |
| 71 | 58 |
| 72 | 59 |
| 73 template <> | 60 template <> |
| 74 bool inline Heap::IsOneByte(String* str, int chars) { | 61 bool inline Heap::IsOneByte(String* str, int chars) { |
| (...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 | 767 |
| 781 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { | 768 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { |
| 782 for (Object** current = start; current < end; current++) { | 769 for (Object** current = start; current < end; current++) { |
| 783 CHECK((*current)->IsSmi()); | 770 CHECK((*current)->IsSmi()); |
| 784 } | 771 } |
| 785 } | 772 } |
| 786 } | 773 } |
| 787 } // namespace v8::internal | 774 } // namespace v8::internal |
| 788 | 775 |
| 789 #endif // V8_HEAP_HEAP_INL_H_ | 776 #endif // V8_HEAP_HEAP_INL_H_ |
| OLD | NEW |