V8 API Reference, 7.2.502.16 (for Deno 0.2.4)
field-type.h
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
3 // found in the LICENSE file.
4 
5 #ifndef V8_FIELD_TYPE_H_
6 #define V8_FIELD_TYPE_H_
7 
8 #include "src/objects.h"
9 #include "src/objects/heap-object.h"
10 #include "src/objects/map.h"
11 
12 namespace v8 {
13 namespace internal {
14 
15 template <typename T>
16 class Handle;
17 
18 class FieldType : public ObjectPtr {
19  public:
20  static FieldType None();
21  static FieldType Any();
22  static Handle<FieldType> None(Isolate* isolate);
23  static Handle<FieldType> Any(Isolate* isolate);
24  static FieldType Class(Map map);
25  static Handle<FieldType> Class(Handle<Map> map, Isolate* isolate);
26  static FieldType cast(Object* object);
27  static FieldType unchecked_cast(ObjectPtr object) {
28  return FieldType(object.ptr());
29  }
30 
31  bool NowContains(Object* value) const;
32 
33  bool NowContains(Handle<Object> value) const { return NowContains(*value); }
34 
35  bool IsClass() const;
36  Map AsClass() const;
37  bool IsNone() const { return *this == None(); }
38  bool IsAny() const { return *this == Any(); }
39  bool NowStable() const;
40  bool NowIs(FieldType other) const;
41  bool NowIs(Handle<FieldType> other) const;
42 
43  void PrintTo(std::ostream& os) const;
44 
45  FieldType* operator->() { return this; }
46  const FieldType* operator->() const { return this; }
47 
48  private:
49  explicit constexpr FieldType(Address ptr) : ObjectPtr(ptr) {}
50 };
51 
52 } // namespace internal
53 } // namespace v8
54 
55 #endif // V8_FIELD_TYPE_H_
Definition: libplatform.h:13
Definition: v8.h:3134