OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 // Note 1: Any file that includes this one should include object-macros-undef.h | 5 // Note 1: Any file that includes this one should include object-macros-undef.h |
6 // at the bottom. | 6 // at the bottom. |
7 | 7 |
8 // Note 2: This file is deliberately missing the include guards (the undeffing | 8 // Note 2: This file is deliberately missing the include guards (the undeffing |
9 // approach wouldn't work otherwise). | 9 // approach wouldn't work otherwise). |
10 | 10 |
11 // The accessors with RELAXED_, ACQUIRE_, and RELEASE_ prefixes should be used | 11 // The accessors with RELAXED_, ACQUIRE_, and RELEASE_ prefixes should be used |
12 // for fields that can be written to and read from multiple threads at the same | 12 // for fields that can be written to and read from multiple threads at the same |
13 // time. See comments in src/base/atomicops.h for the memory ordering sematics. | 13 // time. See comments in src/base/atomicops.h for the memory ordering sematics. |
14 | 14 |
15 #define DECL_BOOLEAN_ACCESSORS(name) \ | 15 #define DECL_BOOLEAN_ACCESSORS(name) \ |
16 inline bool name() const; \ | 16 inline bool name() const; \ |
17 inline void set_##name(bool value); | 17 inline void set_##name(bool value); |
18 | 18 |
19 #define DECL_INT_ACCESSORS(name) \ | 19 #define DECL_INT_ACCESSORS(name) \ |
20 inline int name() const; \ | 20 inline int name() const; \ |
21 inline void set_##name(int value); | 21 inline void set_##name(int value); |
22 | 22 |
23 #define DECL_ACCESSORS(name, type) \ | 23 #define DECL_ACCESSORS(name, type) \ |
24 inline type* name() const; \ | 24 inline type* name() const; \ |
25 inline void set_##name(type* value, \ | 25 inline void set_##name(type* value, \ |
26 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); | 26 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); |
27 | 27 |
28 #define DECLARE_CAST(type) \ | 28 #define DECL_CAST(type) \ |
29 INLINE(static type* cast(Object* object)); \ | 29 INLINE(static type* cast(Object* object)); \ |
30 INLINE(static const type* cast(const Object* object)); | 30 INLINE(static const type* cast(const Object* object)); |
31 | 31 |
32 #define CAST_ACCESSOR(type) \ | 32 #define CAST_ACCESSOR(type) \ |
33 type* type::cast(Object* object) { \ | 33 type* type::cast(Object* object) { \ |
34 SLOW_DCHECK(object->Is##type()); \ | 34 SLOW_DCHECK(object->Is##type()); \ |
35 return reinterpret_cast<type*>(object); \ | 35 return reinterpret_cast<type*>(object); \ |
36 } \ | 36 } \ |
37 const type* type::cast(const Object* object) { \ | 37 const type* type::cast(const Object* object) { \ |
38 SLOW_DCHECK(object->Is##type()); \ | 38 SLOW_DCHECK(object->Is##type()); \ |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 reinterpret_cast<base::Atomic8*>(FIELD_ADDR(p, offset)))) | 251 reinterpret_cast<base::Atomic8*>(FIELD_ADDR(p, offset)))) |
252 | 252 |
253 #define WRITE_BYTE_FIELD(p, offset, value) \ | 253 #define WRITE_BYTE_FIELD(p, offset, value) \ |
254 (*reinterpret_cast<byte*>(FIELD_ADDR(p, offset)) = value) | 254 (*reinterpret_cast<byte*>(FIELD_ADDR(p, offset)) = value) |
255 | 255 |
256 #define RELAXED_WRITE_BYTE_FIELD(p, offset, value) \ | 256 #define RELAXED_WRITE_BYTE_FIELD(p, offset, value) \ |
257 base::Relaxed_Store(reinterpret_cast<base::Atomic8*>(FIELD_ADDR(p, offset)), \ | 257 base::Relaxed_Store(reinterpret_cast<base::Atomic8*>(FIELD_ADDR(p, offset)), \ |
258 static_cast<base::Atomic8>(value)); | 258 static_cast<base::Atomic8>(value)); |
259 | 259 |
260 #ifdef VERIFY_HEAP | 260 #ifdef VERIFY_HEAP |
261 #define DECLARE_VERIFIER(Name) void Name##Verify(); | 261 #define DECL_VERIFIER(Name) void Name##Verify(); |
262 #else | 262 #else |
263 #define DECLARE_VERIFIER(Name) | 263 #define DECL_VERIFIER(Name) |
264 #endif | 264 #endif |
265 | 265 |
266 #define DEFINE_DEOPT_ELEMENT_ACCESSORS(name, type) \ | 266 #define DEFINE_DEOPT_ELEMENT_ACCESSORS(name, type) \ |
267 type* DeoptimizationInputData::name() { \ | 267 type* DeoptimizationInputData::name() { \ |
268 return type::cast(get(k##name##Index)); \ | 268 return type::cast(get(k##name##Index)); \ |
269 } \ | 269 } \ |
270 void DeoptimizationInputData::Set##name(type* value) { \ | 270 void DeoptimizationInputData::Set##name(type* value) { \ |
271 set(k##name##Index, value); \ | 271 set(k##name##Index, value); \ |
272 } | 272 } |
273 | 273 |
274 #define DEFINE_DEOPT_ENTRY_ACCESSORS(name, type) \ | 274 #define DEFINE_DEOPT_ENTRY_ACCESSORS(name, type) \ |
275 type* DeoptimizationInputData::name(int i) { \ | 275 type* DeoptimizationInputData::name(int i) { \ |
276 return type::cast(get(IndexForEntry(i) + k##name##Offset)); \ | 276 return type::cast(get(IndexForEntry(i) + k##name##Offset)); \ |
277 } \ | 277 } \ |
278 void DeoptimizationInputData::Set##name(int i, type* value) { \ | 278 void DeoptimizationInputData::Set##name(int i, type* value) { \ |
279 set(IndexForEntry(i) + k##name##Offset, value); \ | 279 set(IndexForEntry(i) + k##name##Offset, value); \ |
280 } | 280 } |
OLD | NEW |