OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 return from_handle(isolate->factory()->NewBox(value)); | 146 return from_handle(isolate->factory()->NewBox(value)); |
147 } | 147 } |
148 | 148 |
149 static Type* Union(Handle<Type> type1, Handle<Type> type2); | 149 static Type* Union(Handle<Type> type1, Handle<Type> type2); |
150 static Type* Intersect(Handle<Type> type1, Handle<Type> type2); | 150 static Type* Intersect(Handle<Type> type1, Handle<Type> type2); |
151 static Type* Optional(Handle<Type> type); // type \/ Undefined | 151 static Type* Optional(Handle<Type> type); // type \/ Undefined |
152 | 152 |
153 static Type* Of(Handle<i::Object> value) { | 153 static Type* Of(Handle<i::Object> value) { |
154 return from_bitset(LubBitset(*value)); | 154 return from_bitset(LubBitset(*value)); |
155 } | 155 } |
156 static Type* CurrentOf(Handle<i::Object> value); | |
157 | 156 |
158 bool Is(Type* that) { return (this == that) ? true : SlowIs(that); } | 157 bool Is(Type* that) { return (this == that) ? true : SlowIs(that); } |
159 bool Is(Handle<Type> that) { return this->Is(*that); } | 158 bool Is(Handle<Type> that) { return this->Is(*that); } |
160 bool Maybe(Type* that); | 159 bool Maybe(Type* that); |
161 bool Maybe(Handle<Type> that) { return this->Maybe(*that); } | 160 bool Maybe(Handle<Type> that) { return this->Maybe(*that); } |
162 | 161 |
| 162 // State-dependent versions of Of and Is that consider subtyping between |
| 163 // a constant and its map class. |
| 164 static Type* OfCurrently(Handle<i::Object> value); |
| 165 bool IsCurrently(Type* that); |
| 166 bool IsCurrently(Handle<Type> that) { return this->IsCurrently(*that); } |
| 167 |
163 bool IsClass() { return is_class(); } | 168 bool IsClass() { return is_class(); } |
164 bool IsConstant() { return is_constant(); } | 169 bool IsConstant() { return is_constant(); } |
165 Handle<i::Map> AsClass() { return as_class(); } | 170 Handle<i::Map> AsClass() { return as_class(); } |
166 Handle<i::Object> AsConstant() { return as_constant(); } | 171 Handle<i::Object> AsConstant() { return as_constant(); } |
167 | 172 |
168 int NumClasses(); | 173 int NumClasses(); |
169 int NumConstants(); | 174 int NumConstants(); |
170 | 175 |
171 template<class T> | 176 template<class T> |
172 class Iterator { | 177 class Iterator { |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 static Bounds NarrowUpper(Bounds b, Handle<Type> t, Isolate* isl) { | 328 static Bounds NarrowUpper(Bounds b, Handle<Type> t, Isolate* isl) { |
324 return Bounds( | 329 return Bounds( |
325 handle(Type::Intersect(b.lower, t), isl), | 330 handle(Type::Intersect(b.lower, t), isl), |
326 handle(Type::Intersect(b.upper, t), isl)); | 331 handle(Type::Intersect(b.upper, t), isl)); |
327 } | 332 } |
328 }; | 333 }; |
329 | 334 |
330 } } // namespace v8::internal | 335 } } // namespace v8::internal |
331 | 336 |
332 #endif // V8_TYPES_H_ | 337 #endif // V8_TYPES_H_ |
OLD | NEW |