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/struct.h"
9
10// Has to be the last include (doesn't have include guards):
11#include "src/objects/object-macros.h"
12
13namespace v8 {
14namespace internal {
15
16#include "torque-generated/src/objects/data-handler-tq.inc"
17
18// DataHandler is a base class for load and store handlers that can't be
19// encoded in one Smi. Kind of a handler can be deduced from instance type.
20class DataHandler : public TorqueGeneratedDataHandler<DataHandler, Struct> {
21 public:
22  // Returns number of optional data fields available in the object.
23  inline int data_field_count() const;
24
25  // [data1-3]: These are optional general-purpose fields whose content and
26  // presence depends on the handler kind.
27  DECL_ACCESSORS(data1, MaybeObject)
28  DECL_ACCESSORS(data2, MaybeObject)
29  DECL_ACCESSORS(data3, MaybeObject)
30
31  static const int kSizeWithData0 = kData1Offset;
32  static const int kSizeWithData1 = kData2Offset;
33  static const int kSizeWithData2 = kData3Offset;
34  static const int kSizeWithData3 = kHeaderSize;
35
36  DECL_VERIFIER(DataHandler)
37
38  class BodyDescriptor;
39
40  TQ_OBJECT_CONSTRUCTORS(DataHandler)
41};
42
43}  // namespace internal
44}  // namespace v8
45
46#include "src/objects/object-macros-undef.h"
47
48#endif  // V8_OBJECTS_DATA_HANDLER_H_
49