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/map.h" 10 11 namespace v8 { 12 namespace internal { 13 14 template <typename T> 15 class Handle; 16 17 class FieldType : public Object { 18 public: 19 static FieldType* None(); 20 static FieldType* Any(); 21 static Handle<FieldType> None(Isolate* isolate); 22 static Handle<FieldType> Any(Isolate* isolate); 23 static FieldType* Class(i::Map* map); 24 static Handle<FieldType> Class(i::Handle<i::Map> map, Isolate* isolate); 25 static FieldType* cast(Object* object); 26 27 bool NowContains(Object* value); 28 NowContains(Handle<Object> value)29 bool NowContains(Handle<Object> value) { return NowContains(*value); } 30 31 bool IsClass(); 32 Map* AsClass(); IsNone()33 bool IsNone() { return this == None(); } IsAny()34 bool IsAny() { return this == Any(); } 35 bool NowStable(); 36 bool NowIs(FieldType* other); 37 bool NowIs(Handle<FieldType> other); 38 39 void PrintTo(std::ostream& os); 40 }; 41 42 } // namespace internal 43 } // namespace v8 44 45 #endif // V8_FIELD_TYPE_H_ 46