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 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
841 if (mode == UPDATE_WRITE_BARRIER) { \ | 841 if (mode == UPDATE_WRITE_BARRIER) { \ |
842 heap->RecordWrite(object->address(), offset); \ | 842 heap->RecordWrite(object->address(), offset); \ |
843 } else { \ | 843 } else { \ |
844 ASSERT(mode == SKIP_WRITE_BARRIER); \ | 844 ASSERT(mode == SKIP_WRITE_BARRIER); \ |
845 ASSERT(heap->InNewSpace(object) || \ | 845 ASSERT(heap->InNewSpace(object) || \ |
846 !heap->InNewSpace(READ_FIELD(object, offset)) || \ | 846 !heap->InNewSpace(READ_FIELD(object, offset)) || \ |
847 Page::FromAddress(object->address())-> \ | 847 Page::FromAddress(object->address())-> \ |
848 IsRegionDirty(object->address() + offset)); \ | 848 IsRegionDirty(object->address() + offset)); \ |
849 } | 849 } |
850 | 850 |
851 #define READ_DOUBLE_FIELD(p, offset) \ | 851 #ifndef V8_TARGET_ARCH_MIPS |
852 (*reinterpret_cast<double*>(FIELD_ADDR(p, offset))) | 852 #define READ_DOUBLE_FIELD(p, offset) \ |
| 853 (*reinterpret_cast<double*>(FIELD_ADDR(p, offset))) |
| 854 #else // V8_TARGET_ARCH_MIPS |
| 855 // Prevent gcc from using load-double (mips ldc1) on (possibly) |
| 856 // non-64-bit aligned HeapNumber::value. |
| 857 static inline double read_double_field(HeapNumber* p, int offset) { |
| 858 union conversion { |
| 859 double d; |
| 860 uint32_t u[2]; |
| 861 } c; |
| 862 c.u[0] = (*reinterpret_cast<uint32_t*>(FIELD_ADDR(p, offset))); |
| 863 c.u[1] = (*reinterpret_cast<uint32_t*>(FIELD_ADDR(p, offset + 4))); |
| 864 return c.d; |
| 865 } |
| 866 #define READ_DOUBLE_FIELD(p, offset) read_double_field(p, offset) |
| 867 #endif // V8_TARGET_ARCH_MIPS |
853 | 868 |
854 #define WRITE_DOUBLE_FIELD(p, offset, value) \ | 869 |
855 (*reinterpret_cast<double*>(FIELD_ADDR(p, offset)) = value) | 870 #ifndef V8_TARGET_ARCH_MIPS |
| 871 #define WRITE_DOUBLE_FIELD(p, offset, value) \ |
| 872 (*reinterpret_cast<double*>(FIELD_ADDR(p, offset)) = value) |
| 873 #else // V8_TARGET_ARCH_MIPS |
| 874 // Prevent gcc from using store-double (mips sdc1) on (possibly) |
| 875 // non-64-bit aligned HeapNumber::value. |
| 876 static inline void write_double_field(HeapNumber* p, int offset, |
| 877 double value) { |
| 878 union conversion { |
| 879 double d; |
| 880 uint32_t u[2]; |
| 881 } c; |
| 882 c.d = value; |
| 883 (*reinterpret_cast<uint32_t*>(FIELD_ADDR(p, offset))) = c.u[0]; |
| 884 (*reinterpret_cast<uint32_t*>(FIELD_ADDR(p, offset + 4))) = c.u[1]; |
| 885 } |
| 886 #define WRITE_DOUBLE_FIELD(p, offset, value) \ |
| 887 write_double_field(p, offset, value) |
| 888 #endif // V8_TARGET_ARCH_MIPS |
| 889 |
856 | 890 |
857 #define READ_INT_FIELD(p, offset) \ | 891 #define READ_INT_FIELD(p, offset) \ |
858 (*reinterpret_cast<int*>(FIELD_ADDR(p, offset))) | 892 (*reinterpret_cast<int*>(FIELD_ADDR(p, offset))) |
859 | 893 |
860 #define WRITE_INT_FIELD(p, offset, value) \ | 894 #define WRITE_INT_FIELD(p, offset, value) \ |
861 (*reinterpret_cast<int*>(FIELD_ADDR(p, offset)) = value) | 895 (*reinterpret_cast<int*>(FIELD_ADDR(p, offset)) = value) |
862 | 896 |
863 #define READ_INTPTR_FIELD(p, offset) \ | 897 #define READ_INTPTR_FIELD(p, offset) \ |
864 (*reinterpret_cast<intptr_t*>(FIELD_ADDR(p, offset))) | 898 (*reinterpret_cast<intptr_t*>(FIELD_ADDR(p, offset))) |
865 | 899 |
(...skipping 3233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4099 #undef WRITE_INT_FIELD | 4133 #undef WRITE_INT_FIELD |
4100 #undef READ_SHORT_FIELD | 4134 #undef READ_SHORT_FIELD |
4101 #undef WRITE_SHORT_FIELD | 4135 #undef WRITE_SHORT_FIELD |
4102 #undef READ_BYTE_FIELD | 4136 #undef READ_BYTE_FIELD |
4103 #undef WRITE_BYTE_FIELD | 4137 #undef WRITE_BYTE_FIELD |
4104 | 4138 |
4105 | 4139 |
4106 } } // namespace v8::internal | 4140 } } // namespace v8::internal |
4107 | 4141 |
4108 #endif // V8_OBJECTS_INL_H_ | 4142 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |