V8 API Reference, 7.2.502.16 (for Deno 0.2.4)
data-handler.h
1 // Copyright 2017 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_DATA_HANDLER_H_
6 #define V8_OBJECTS_DATA_HANDLER_H_
7 
8 #include "src/objects.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 // DataHandler is a base class for load and store handlers that can't be
17 // encoded in one Smi. Kind of a handler can be deduced from instance type.
18 class DataHandler : public Struct {
19  public:
20  // [smi_handler]: A Smi which encodes a handler or Code object (we still
21  // use code handlers for accessing lexical environment variables, but soon
22  // only smi handlers will remain). See LoadHandler and StoreHandler for
23  // details about encoding.
24  DECL_ACCESSORS(smi_handler, Object)
25 
26  // [validity_cell]: A validity Cell that guards prototype chain modifications.
27  DECL_ACCESSORS(validity_cell, Object)
28 
29  // Returns number of optional data fields available in the object.
30  inline int data_field_count() const;
31 
32  // [data1-3]: These are optional general-purpose fields whose content and
33  // presence depends on the handler kind.
34  DECL_ACCESSORS2(data1, MaybeObject)
35  DECL_ACCESSORS2(data2, MaybeObject)
36  DECL_ACCESSORS2(data3, MaybeObject)
37 
38 // Layout description.
39 #define DATA_HANDLER_FIELDS(V) \
40  V(kSmiHandlerOffset, kTaggedSize) \
41  V(kValidityCellOffset, kTaggedSize) \
42  V(kSizeWithData0, 0) \
43  V(kData1Offset, kTaggedSize) \
44  V(kSizeWithData1, 0) \
45  V(kData2Offset, kTaggedSize) \
46  V(kSizeWithData2, 0) \
47  V(kData3Offset, kTaggedSize) \
48  V(kSizeWithData3, 0)
49 
50  DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize, DATA_HANDLER_FIELDS)
51 #undef DATA_HANDLER_FIELDS
52 
53  DECL_CAST(DataHandler)
54 
55  DECL_VERIFIER(DataHandler)
56 
57  class BodyDescriptor;
58 };
59 
60 } // namespace internal
61 } // namespace v8
62 
63 #include "src/objects/object-macros-undef.h"
64 
65 #endif // V8_OBJECTS_DATA_HANDLER_H_
Definition: libplatform.h:13