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_FEEDBACK_CELL_H_
6 : #define V8_OBJECTS_FEEDBACK_CELL_H_
7 :
8 : #include "src/objects/struct.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 : // This is a special cell used to maintain both the link between a
17 : // closure and it's feedback vector, as well as a way to count the
18 : // number of closures created for a certain function per native
19 : // context. There's at most one FeedbackCell for each function in
20 : // a native context.
21 : class FeedbackCell : public Struct {
22 : public:
23 : // [value]: value of the cell.
24 : DECL_ACCESSORS(value, HeapObject)
25 :
26 : DECL_CAST(FeedbackCell)
27 :
28 : // Dispatched behavior.
29 : DECL_PRINTER(FeedbackCell)
30 : DECL_VERIFIER(FeedbackCell)
31 :
32 : // Layout description.
33 : #define FEEDBACK_CELL_FIELDS(V) \
34 : V(kValueOffset, kTaggedSize) \
35 : /* Total size. */ \
36 : V(kSize, 0)
37 :
38 : DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize, FEEDBACK_CELL_FIELDS)
39 : #undef FEEDBACK_CELL_FIELDS
40 :
41 : typedef FixedBodyDescriptor<kValueOffset, kSize, kSize> BodyDescriptor;
42 :
43 9452753 : OBJECT_CONSTRUCTORS(FeedbackCell, Struct);
44 : };
45 :
46 : } // namespace internal
47 : } // namespace v8
48 :
49 : #include "src/objects/object-macros-undef.h"
50 :
51 : #endif // V8_OBJECTS_FEEDBACK_CELL_H_
|