| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 |
| (...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 #define READ_FIELD(p, offset) \ | 788 #define READ_FIELD(p, offset) \ |
| 789 (*reinterpret_cast<Object**>(FIELD_ADDR(p, offset))) | 789 (*reinterpret_cast<Object**>(FIELD_ADDR(p, offset))) |
| 790 | 790 |
| 791 #define WRITE_FIELD(p, offset, value) \ | 791 #define WRITE_FIELD(p, offset, value) \ |
| 792 (*reinterpret_cast<Object**>(FIELD_ADDR(p, offset)) = value) | 792 (*reinterpret_cast<Object**>(FIELD_ADDR(p, offset)) = value) |
| 793 | 793 |
| 794 | 794 |
| 795 #define WRITE_BARRIER(object, offset) \ | 795 #define WRITE_BARRIER(object, offset) \ |
| 796 Heap::RecordWrite(object->address(), offset); | 796 Heap::RecordWrite(object->address(), offset); |
| 797 | 797 |
| 798 #ifndef BASELINE_GC |
| 798 // CONDITIONAL_WRITE_BARRIER must be issued after the actual | 799 // CONDITIONAL_WRITE_BARRIER must be issued after the actual |
| 799 // write due to the assert validating the written value. | 800 // write due to the assert validating the written value. |
| 800 #define CONDITIONAL_WRITE_BARRIER(object, offset, mode) \ | 801 #define CONDITIONAL_WRITE_BARRIER(object, offset, mode) \ |
| 801 if (mode == UPDATE_WRITE_BARRIER) { \ | 802 if (mode == UPDATE_WRITE_BARRIER) { \ |
| 802 Heap::RecordWrite(object->address(), offset); \ | 803 Heap::RecordWrite(object->address(), offset); \ |
| 803 } else { \ | 804 } else { \ |
| 804 ASSERT(mode == SKIP_WRITE_BARRIER); \ | 805 ASSERT(mode == SKIP_WRITE_BARRIER); \ |
| 805 ASSERT(Heap::InNewSpace(object) || \ | 806 ASSERT(Heap::InNewSpace(object) || \ |
| 806 !Heap::InNewSpace(READ_FIELD(object, offset)) || \ | 807 !Heap::InNewSpace(READ_FIELD(object, offset)) || \ |
| 807 Page::FromAddress(object->address())-> \ | 808 Page::FromAddress(object->address())-> \ |
| 808 IsRegionDirty(object->address() + offset)); \ | 809 IsRegionDirty(object->address() + offset)); \ |
| 809 } | 810 } |
| 811 #else |
| 812 #define CONDITIONAL_WRITE_BARRIER(object, offset, mode) |
| 813 #endif |
| 810 | 814 |
| 811 #define READ_DOUBLE_FIELD(p, offset) \ | 815 #define READ_DOUBLE_FIELD(p, offset) \ |
| 812 (*reinterpret_cast<double*>(FIELD_ADDR(p, offset))) | 816 (*reinterpret_cast<double*>(FIELD_ADDR(p, offset))) |
| 813 | 817 |
| 814 #define WRITE_DOUBLE_FIELD(p, offset, value) \ | 818 #define WRITE_DOUBLE_FIELD(p, offset, value) \ |
| 815 (*reinterpret_cast<double*>(FIELD_ADDR(p, offset)) = value) | 819 (*reinterpret_cast<double*>(FIELD_ADDR(p, offset)) = value) |
| 816 | 820 |
| 817 #define READ_INT_FIELD(p, offset) \ | 821 #define READ_INT_FIELD(p, offset) \ |
| 818 (*reinterpret_cast<int*>(FIELD_ADDR(p, offset))) | 822 (*reinterpret_cast<int*>(FIELD_ADDR(p, offset))) |
| 819 | 823 |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1009 | 1013 |
| 1010 void MapWord::SetOverflow() { | 1014 void MapWord::SetOverflow() { |
| 1011 value_ |= kOverflowMask; | 1015 value_ |= kOverflowMask; |
| 1012 } | 1016 } |
| 1013 | 1017 |
| 1014 | 1018 |
| 1015 void MapWord::ClearOverflow() { | 1019 void MapWord::ClearOverflow() { |
| 1016 value_ &= ~kOverflowMask; | 1020 value_ &= ~kOverflowMask; |
| 1017 } | 1021 } |
| 1018 | 1022 |
| 1019 | 1023 #ifndef BASELINE_GC |
| 1020 MapWord MapWord::EncodeAddress(Address map_address, int offset) { | 1024 MapWord MapWord::EncodeAddress(Address map_address, int offset) { |
| 1021 // Offset is the distance in live bytes from the first live object in the | 1025 // Offset is the distance in live bytes from the first live object in the |
| 1022 // same page. The offset between two objects in the same page should not | 1026 // same page. The offset between two objects in the same page should not |
| 1023 // exceed the object area size of a page. | 1027 // exceed the object area size of a page. |
| 1024 ASSERT(0 <= offset && offset < Page::kObjectAreaSize); | 1028 ASSERT(0 <= offset && offset < Page::kObjectAreaSize); |
| 1025 | 1029 |
| 1026 uintptr_t compact_offset = offset >> kObjectAlignmentBits; | 1030 uintptr_t compact_offset = offset >> kObjectAlignmentBits; |
| 1027 ASSERT(compact_offset < (1 << kForwardingOffsetBits)); | 1031 ASSERT(compact_offset < (1 << kForwardingOffsetBits)); |
| 1028 | 1032 |
| 1029 Page* map_page = Page::FromAddress(map_address); | 1033 Page* map_page = Page::FromAddress(map_address); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1063 | 1067 |
| 1064 | 1068 |
| 1065 MapWord MapWord::FromEncodedAddress(Address address) { | 1069 MapWord MapWord::FromEncodedAddress(Address address) { |
| 1066 return MapWord(reinterpret_cast<uintptr_t>(address)); | 1070 return MapWord(reinterpret_cast<uintptr_t>(address)); |
| 1067 } | 1071 } |
| 1068 | 1072 |
| 1069 | 1073 |
| 1070 Address MapWord::ToEncodedAddress() { | 1074 Address MapWord::ToEncodedAddress() { |
| 1071 return reinterpret_cast<Address>(value_); | 1075 return reinterpret_cast<Address>(value_); |
| 1072 } | 1076 } |
| 1073 | 1077 #endif |
| 1074 | 1078 |
| 1075 #ifdef DEBUG | 1079 #ifdef DEBUG |
| 1076 void HeapObject::VerifyObjectField(int offset) { | 1080 void HeapObject::VerifyObjectField(int offset) { |
| 1077 VerifyPointer(READ_FIELD(this, offset)); | 1081 VerifyPointer(READ_FIELD(this, offset)); |
| 1078 } | 1082 } |
| 1079 | 1083 |
| 1080 void HeapObject::VerifySmiField(int offset) { | 1084 void HeapObject::VerifySmiField(int offset) { |
| 1081 ASSERT(READ_FIELD(this, offset)->IsSmi()); | 1085 ASSERT(READ_FIELD(this, offset)->IsSmi()); |
| 1082 } | 1086 } |
| 1083 #endif | 1087 #endif |
| (...skipping 2768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3852 #undef WRITE_INT_FIELD | 3856 #undef WRITE_INT_FIELD |
| 3853 #undef READ_SHORT_FIELD | 3857 #undef READ_SHORT_FIELD |
| 3854 #undef WRITE_SHORT_FIELD | 3858 #undef WRITE_SHORT_FIELD |
| 3855 #undef READ_BYTE_FIELD | 3859 #undef READ_BYTE_FIELD |
| 3856 #undef WRITE_BYTE_FIELD | 3860 #undef WRITE_BYTE_FIELD |
| 3857 | 3861 |
| 3858 | 3862 |
| 3859 } } // namespace v8::internal | 3863 } } // namespace v8::internal |
| 3860 | 3864 |
| 3861 #endif // V8_OBJECTS_INL_H_ | 3865 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |