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