Line data Source code
1 : // Copyright 2018 the V8 project authors. All rights reserved.
2 : // Use of this source code is governed by a BSD-style license that can be
3 : // found in the LICENSE file.
4 :
5 : #ifndef V8_OBJECTS_CELL_H_
6 : #define V8_OBJECTS_CELL_H_
7 :
8 : #include "src/objects/heap-object.h"
9 :
10 : // Has to be the last include (doesn't have include guards):
11 : #include "src/objects/object-macros.h"
12 :
13 : namespace v8 {
14 : namespace internal {
15 :
16 : class Cell : public HeapObject {
17 : public:
18 : // [value]: value of the cell.
19 : DECL_ACCESSORS(value, Object)
20 :
21 : DECL_CAST(Cell)
22 :
23 : static inline Cell FromValueAddress(Address value);
24 :
25 0 : inline Address ValueAddress() { return address() + kValueOffset; }
26 :
27 : // Dispatched behavior.
28 : DECL_PRINTER(Cell)
29 : DECL_VERIFIER(Cell)
30 :
31 : // Layout description.
32 : #define CELL_FIELDS(V) \
33 : V(kValueOffset, kTaggedSize) \
34 : /* Total size. */ \
35 : V(kSize, 0)
36 :
37 : DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize, CELL_FIELDS)
38 : #undef CELL_FIELDS
39 :
40 : typedef FixedBodyDescriptor<kValueOffset, kSize, kSize> BodyDescriptor;
41 :
42 634930 : OBJECT_CONSTRUCTORS(Cell, HeapObject);
43 : };
44 :
45 : } // namespace internal
46 : } // namespace v8
47 :
48 : #include "src/objects/object-macros-undef.h"
49 :
50 : #endif // V8_OBJECTS_CELL_H_
|