| 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 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 | 735 |
| 736 void Heap::ExternalStringTable::ShrinkNewStrings(int position) { | 736 void Heap::ExternalStringTable::ShrinkNewStrings(int position) { |
| 737 new_space_strings_.Rewind(position); | 737 new_space_strings_.Rewind(position); |
| 738 #ifdef VERIFY_HEAP | 738 #ifdef VERIFY_HEAP |
| 739 if (FLAG_verify_heap) { | 739 if (FLAG_verify_heap) { |
| 740 Verify(); | 740 Verify(); |
| 741 } | 741 } |
| 742 #endif | 742 #endif |
| 743 } | 743 } |
| 744 | 744 |
| 745 void Heap::ClearInstanceofCache() { | 745 void Heap::ClearInstanceofCache() { set_instanceof_cache_function(Smi::kZero); } |
| 746 set_instanceof_cache_function(Smi::FromInt(0)); | |
| 747 } | |
| 748 | 746 |
| 749 Oddball* Heap::ToBoolean(bool condition) { | 747 Oddball* Heap::ToBoolean(bool condition) { |
| 750 return condition ? true_value() : false_value(); | 748 return condition ? true_value() : false_value(); |
| 751 } | 749 } |
| 752 | 750 |
| 753 | 751 |
| 754 void Heap::CompletelyClearInstanceofCache() { | 752 void Heap::CompletelyClearInstanceofCache() { |
| 755 set_instanceof_cache_map(Smi::FromInt(0)); | 753 set_instanceof_cache_map(Smi::kZero); |
| 756 set_instanceof_cache_function(Smi::FromInt(0)); | 754 set_instanceof_cache_function(Smi::kZero); |
| 757 } | 755 } |
| 758 | 756 |
| 759 | 757 |
| 760 uint32_t Heap::HashSeed() { | 758 uint32_t Heap::HashSeed() { |
| 761 uint32_t seed = static_cast<uint32_t>(hash_seed()->value()); | 759 uint32_t seed = static_cast<uint32_t>(hash_seed()->value()); |
| 762 DCHECK(FLAG_randomize_hashes || seed == 0); | 760 DCHECK(FLAG_randomize_hashes || seed == 0); |
| 763 return seed; | 761 return seed; |
| 764 } | 762 } |
| 765 | 763 |
| 766 | 764 |
| 767 int Heap::NextScriptId() { | 765 int Heap::NextScriptId() { |
| 768 int last_id = last_script_id()->value(); | 766 int last_id = last_script_id()->value(); |
| 769 if (last_id == Smi::kMaxValue) { | 767 if (last_id == Smi::kMaxValue) { |
| 770 last_id = 1; | 768 last_id = 1; |
| 771 } else { | 769 } else { |
| 772 last_id++; | 770 last_id++; |
| 773 } | 771 } |
| 774 set_last_script_id(Smi::FromInt(last_id)); | 772 set_last_script_id(Smi::FromInt(last_id)); |
| 775 return last_id; | 773 return last_id; |
| 776 } | 774 } |
| 777 | 775 |
| 778 void Heap::SetArgumentsAdaptorDeoptPCOffset(int pc_offset) { | 776 void Heap::SetArgumentsAdaptorDeoptPCOffset(int pc_offset) { |
| 779 DCHECK(arguments_adaptor_deopt_pc_offset() == Smi::FromInt(0)); | 777 DCHECK(arguments_adaptor_deopt_pc_offset() == Smi::kZero); |
| 780 set_arguments_adaptor_deopt_pc_offset(Smi::FromInt(pc_offset)); | 778 set_arguments_adaptor_deopt_pc_offset(Smi::FromInt(pc_offset)); |
| 781 } | 779 } |
| 782 | 780 |
| 783 void Heap::SetConstructStubDeoptPCOffset(int pc_offset) { | 781 void Heap::SetConstructStubDeoptPCOffset(int pc_offset) { |
| 784 DCHECK(construct_stub_deopt_pc_offset() == Smi::FromInt(0)); | 782 DCHECK(construct_stub_deopt_pc_offset() == Smi::kZero); |
| 785 set_construct_stub_deopt_pc_offset(Smi::FromInt(pc_offset)); | 783 set_construct_stub_deopt_pc_offset(Smi::FromInt(pc_offset)); |
| 786 } | 784 } |
| 787 | 785 |
| 788 void Heap::SetGetterStubDeoptPCOffset(int pc_offset) { | 786 void Heap::SetGetterStubDeoptPCOffset(int pc_offset) { |
| 789 DCHECK(getter_stub_deopt_pc_offset() == Smi::FromInt(0)); | 787 DCHECK(getter_stub_deopt_pc_offset() == Smi::kZero); |
| 790 set_getter_stub_deopt_pc_offset(Smi::FromInt(pc_offset)); | 788 set_getter_stub_deopt_pc_offset(Smi::FromInt(pc_offset)); |
| 791 } | 789 } |
| 792 | 790 |
| 793 void Heap::SetSetterStubDeoptPCOffset(int pc_offset) { | 791 void Heap::SetSetterStubDeoptPCOffset(int pc_offset) { |
| 794 DCHECK(setter_stub_deopt_pc_offset() == Smi::FromInt(0)); | 792 DCHECK(setter_stub_deopt_pc_offset() == Smi::kZero); |
| 795 set_setter_stub_deopt_pc_offset(Smi::FromInt(pc_offset)); | 793 set_setter_stub_deopt_pc_offset(Smi::FromInt(pc_offset)); |
| 796 } | 794 } |
| 797 | 795 |
| 798 void Heap::SetInterpreterEntryReturnPCOffset(int pc_offset) { | 796 void Heap::SetInterpreterEntryReturnPCOffset(int pc_offset) { |
| 799 DCHECK(interpreter_entry_return_pc_offset() == Smi::FromInt(0)); | 797 DCHECK(interpreter_entry_return_pc_offset() == Smi::kZero); |
| 800 set_interpreter_entry_return_pc_offset(Smi::FromInt(pc_offset)); | 798 set_interpreter_entry_return_pc_offset(Smi::FromInt(pc_offset)); |
| 801 } | 799 } |
| 802 | 800 |
| 803 int Heap::GetNextTemplateSerialNumber() { | 801 int Heap::GetNextTemplateSerialNumber() { |
| 804 int next_serial_number = next_template_serial_number()->value() + 1; | 802 int next_serial_number = next_template_serial_number()->value() + 1; |
| 805 set_next_template_serial_number(Smi::FromInt(next_serial_number)); | 803 set_next_template_serial_number(Smi::FromInt(next_serial_number)); |
| 806 return next_serial_number; | 804 return next_serial_number; |
| 807 } | 805 } |
| 808 | 806 |
| 809 void Heap::SetSerializedTemplates(FixedArray* templates) { | 807 void Heap::SetSerializedTemplates(FixedArray* templates) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 835 | 833 |
| 836 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { | 834 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { |
| 837 for (Object** current = start; current < end; current++) { | 835 for (Object** current = start; current < end; current++) { |
| 838 CHECK((*current)->IsSmi()); | 836 CHECK((*current)->IsSmi()); |
| 839 } | 837 } |
| 840 } | 838 } |
| 841 } // namespace internal | 839 } // namespace internal |
| 842 } // namespace v8 | 840 } // namespace v8 |
| 843 | 841 |
| 844 #endif // V8_HEAP_HEAP_INL_H_ | 842 #endif // V8_HEAP_HEAP_INL_H_ |
| OLD | NEW |