OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_TYPES_H_ | 5 #ifndef V8_TYPES_H_ |
6 #define V8_TYPES_H_ | 6 #define V8_TYPES_H_ |
7 | 7 |
8 #include "src/conversions.h" | 8 #include "src/conversions.h" |
9 #include "src/handles.h" | 9 #include "src/handles.h" |
10 #include "src/objects.h" | 10 #include "src/objects.h" |
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1135 | 1135 |
1136 bool Narrows(BoundsImpl that) { | 1136 bool Narrows(BoundsImpl that) { |
1137 return that.lower->Is(this->lower) && this->upper->Is(that.upper); | 1137 return that.lower->Is(this->lower) && this->upper->Is(that.upper); |
1138 } | 1138 } |
1139 }; | 1139 }; |
1140 | 1140 |
1141 typedef BoundsImpl<ZoneTypeConfig> Bounds; | 1141 typedef BoundsImpl<ZoneTypeConfig> Bounds; |
1142 | 1142 |
1143 class FieldType : public Object { | 1143 class FieldType : public Object { |
1144 public: | 1144 public: |
1145 class Iterator; | |
1146 | |
1147 // static Handle<FieldType> Create(Isolate* isolate, int length); | |
1148 static FieldType* None(); | 1145 static FieldType* None(); |
1149 static FieldType* Any(); | 1146 static FieldType* Any(); |
1150 static Handle<FieldType> None(Isolate* isolate); | 1147 static Handle<FieldType> None(Isolate* isolate); |
1151 static Handle<FieldType> Any(Isolate* isolate); | 1148 static Handle<FieldType> Any(Isolate* isolate); |
1152 static FieldType* Class(i::Map* map); | 1149 static FieldType* Class(i::Map* map); |
1153 static Handle<FieldType> Class(i::Handle<i::Map> map, Isolate* isolate); | 1150 static Handle<FieldType> Class(i::Handle<i::Map> map, Isolate* isolate); |
1154 static FieldType* cast(Object* object); | 1151 static FieldType* cast(Object* object); |
1155 | 1152 |
1156 bool NowContains(Object* value); | 1153 bool NowContains(Object* value); |
1157 bool NowContains(Handle<Object> value); | 1154 bool NowContains(Handle<Object> value); |
1158 bool IsClass(); | 1155 bool IsClass(); |
1159 Handle<i::Map> AsClass(); | 1156 Handle<i::Map> AsClass(); |
1160 bool IsNone() { return this == None(); } | 1157 bool IsNone() { return this == None(); } |
1161 bool IsAny() { return this == Any(); } | 1158 bool IsAny() { return this == Any(); } |
1162 bool NowStable(); | 1159 bool NowStable(); |
1163 bool NowIs(FieldType* other); | 1160 bool NowIs(FieldType* other); |
1164 bool NowIs(Handle<FieldType> other); | 1161 bool NowIs(Handle<FieldType> other); |
1165 Type* Convert(Zone* zone); | 1162 Type* Convert(Zone* zone); |
1166 Iterator Classes(); | |
1167 int ClassCount() { return IsClass() ? 1 : 0; } | |
1168 | 1163 |
1169 void PrintTo(std::ostream& os); | 1164 void PrintTo(std::ostream& os); |
1170 }; | 1165 }; |
1171 | 1166 |
1172 class FieldType::Iterator { | |
1173 public: | |
1174 bool Done() const { return done_; } | |
1175 i::Handle<i::Map> Current() { | |
1176 DCHECK(!Done()); | |
1177 return map_.ToHandleChecked(); | |
1178 } | |
1179 void Advance() { | |
1180 if (!done_) done_ = true; | |
1181 } | |
1182 | |
1183 private: | |
1184 friend FieldType; | |
1185 | |
1186 Iterator() : done_(true) {} | |
1187 explicit Iterator(MaybeHandle<i::Map> map) | |
1188 : done_(map.is_null()), map_(map) {} | |
1189 | |
1190 bool done_; | |
1191 MaybeHandle<i::Map> map_; | |
1192 }; | |
1193 | |
1194 } // namespace internal | 1167 } // namespace internal |
1195 } // namespace v8 | 1168 } // namespace v8 |
1196 | 1169 |
1197 #endif // V8_TYPES_H_ | 1170 #endif // V8_TYPES_H_ |
OLD | NEW |