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 6969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7076 #undef READ_UINT32_FIELD | 7069 #undef READ_UINT32_FIELD |
7077 #undef WRITE_UINT32_FIELD | 7070 #undef WRITE_UINT32_FIELD |
7078 #undef READ_SHORT_FIELD | 7071 #undef READ_SHORT_FIELD |
7079 #undef WRITE_SHORT_FIELD | 7072 #undef WRITE_SHORT_FIELD |
7080 #undef READ_BYTE_FIELD | 7073 #undef READ_BYTE_FIELD |
7081 #undef WRITE_BYTE_FIELD | 7074 #undef WRITE_BYTE_FIELD |
7082 | 7075 |
7083 } } // namespace v8::internal | 7076 } } // namespace v8::internal |
7084 | 7077 |
7085 #endif // V8_OBJECTS_INL_H_ | 7078 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |