OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 } | 80 } |
81 | 81 |
82 | 82 |
83 #define CAST_ACCESSOR(type) \ | 83 #define CAST_ACCESSOR(type) \ |
84 type* type::cast(Object* object) { \ | 84 type* type::cast(Object* object) { \ |
85 SLOW_ASSERT(object->Is##type()); \ | 85 SLOW_ASSERT(object->Is##type()); \ |
86 return reinterpret_cast<type*>(object); \ | 86 return reinterpret_cast<type*>(object); \ |
87 } | 87 } |
88 | 88 |
89 | 89 |
90 #define FIXED_TYPED_ARRAY_CAST_ACCESSOR(type) \ | |
91 template<> \ | |
92 type* type::cast(Object* object) { \ | |
93 SLOW_ASSERT(object->Is##type()); \ | |
94 return reinterpret_cast<type*>(object); \ | |
95 } | |
96 | |
97 #define INT_ACCESSORS(holder, name, offset) \ | 90 #define INT_ACCESSORS(holder, name, offset) \ |
98 int holder::name() { return READ_INT_FIELD(this, offset); } \ | 91 int holder::name() { return READ_INT_FIELD(this, offset); } \ |
99 void holder::set_##name(int value) { WRITE_INT_FIELD(this, offset, value); } | 92 void holder::set_##name(int value) { WRITE_INT_FIELD(this, offset, value); } |
100 | 93 |
101 | 94 |
102 #define ACCESSORS(holder, name, type, offset) \ | 95 #define ACCESSORS(holder, name, type, offset) \ |
103 type* holder::name() { return type::cast(READ_FIELD(this, offset)); } \ | 96 type* holder::name() { return type::cast(READ_FIELD(this, offset)); } \ |
104 void holder::set_##name(type* value, WriteBarrierMode mode) { \ | 97 void holder::set_##name(type* value, WriteBarrierMode mode) { \ |
105 WRITE_FIELD(this, offset, value); \ | 98 WRITE_FIELD(this, offset, value); \ |
106 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, offset, value, mode); \ | 99 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, offset, value, mode); \ |
(...skipping 6880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6987 #undef READ_SHORT_FIELD | 6980 #undef READ_SHORT_FIELD |
6988 #undef WRITE_SHORT_FIELD | 6981 #undef WRITE_SHORT_FIELD |
6989 #undef READ_BYTE_FIELD | 6982 #undef READ_BYTE_FIELD |
6990 #undef WRITE_BYTE_FIELD | 6983 #undef WRITE_BYTE_FIELD |
6991 #undef NOBARRIER_READ_BYTE_FIELD | 6984 #undef NOBARRIER_READ_BYTE_FIELD |
6992 #undef NOBARRIER_WRITE_BYTE_FIELD | 6985 #undef NOBARRIER_WRITE_BYTE_FIELD |
6993 | 6986 |
6994 } } // namespace v8::internal | 6987 } } // namespace v8::internal |
6995 | 6988 |
6996 #endif // V8_OBJECTS_INL_H_ | 6989 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |