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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 static Type* Intersect(Handle<Type> type1, Handle<Type> type2); | 156 static Type* Intersect(Handle<Type> type1, Handle<Type> type2); |
157 static Type* Optional(Handle<Type> type); // type \/ Undefined | 157 static Type* Optional(Handle<Type> type); // type \/ Undefined |
158 | 158 |
159 static Type* Of(Handle<i::Object> value) { | 159 static Type* Of(Handle<i::Object> value) { |
160 return from_bitset(LubBitset(*value)); | 160 return from_bitset(LubBitset(*value)); |
161 } | 161 } |
162 static Type* CurrentOf(Handle<i::Object> value); | 162 static Type* CurrentOf(Handle<i::Object> value); |
163 | 163 |
164 bool Is(Type* that) { return (this == that) ? true : SlowIs(that); } | 164 bool Is(Type* that) { return (this == that) ? true : SlowIs(that); } |
165 bool Is(Handle<Type> that) { return this->Is(*that); } | 165 bool Is(Handle<Type> that) { return this->Is(*that); } |
| 166 bool IsCurrently(Type* that) { |
| 167 if (this->Is(that)) return true; |
| 168 if (!IsConstant()) return false; |
| 169 Handle<i::Object> value = AsConstant(); |
| 170 if (!value->IsHeapObject()) return false; |
| 171 if (!that->IsClass()) return false; |
| 172 return HeapObject::cast(*value)->map() == *that->AsClass(); |
| 173 } |
| 174 bool IsCurrently(Handle<Type> that) { return this->IsCurrently(*that); } |
166 bool Maybe(Type* that); | 175 bool Maybe(Type* that); |
167 bool Maybe(Handle<Type> that) { return this->Maybe(*that); } | 176 bool Maybe(Handle<Type> that) { return this->Maybe(*that); } |
168 | 177 |
169 bool IsClass() { return is_class(); } | 178 bool IsClass() { return is_class(); } |
170 bool IsConstant() { return is_constant(); } | 179 bool IsConstant() { return is_constant(); } |
171 Handle<i::Map> AsClass() { return as_class(); } | 180 Handle<i::Map> AsClass() { return as_class(); } |
172 Handle<i::Object> AsConstant() { return as_constant(); } | 181 Handle<i::Object> AsConstant() { return as_constant(); } |
173 | 182 |
174 int NumClasses(); | 183 int NumClasses(); |
175 int NumConstants(); | 184 int NumConstants(); |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 static Bounds NarrowUpper(Bounds b, Handle<Type> t, Isolate* isl) { | 360 static Bounds NarrowUpper(Bounds b, Handle<Type> t, Isolate* isl) { |
352 return Bounds( | 361 return Bounds( |
353 handle(Type::Intersect(b.lower, t), isl), | 362 handle(Type::Intersect(b.lower, t), isl), |
354 handle(Type::Intersect(b.upper, t), isl)); | 363 handle(Type::Intersect(b.upper, t), isl)); |
355 } | 364 } |
356 }; | 365 }; |
357 | 366 |
358 } } // namespace v8::internal | 367 } } // namespace v8::internal |
359 | 368 |
360 #endif // V8_TYPES_H_ | 369 #endif // V8_TYPES_H_ |
OLD | NEW |