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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 177 |
178 Iterator<Map> Classes() { | 178 Iterator<Map> Classes() { |
179 if (this->is_bitset()) return Iterator<Map>(); | 179 if (this->is_bitset()) return Iterator<Map>(); |
180 return Iterator<Map>(this->handle()); | 180 return Iterator<Map>(this->handle()); |
181 } | 181 } |
182 Iterator<v8::internal::Object> Constants() { | 182 Iterator<v8::internal::Object> Constants() { |
183 if (this->is_bitset()) return Iterator<v8::internal::Object>(); | 183 if (this->is_bitset()) return Iterator<v8::internal::Object>(); |
184 return Iterator<v8::internal::Object>(this->handle()); | 184 return Iterator<v8::internal::Object>(this->handle()); |
185 } | 185 } |
186 | 186 |
| 187 static Type* cast(v8::internal::Object* object) { |
| 188 Type* t = static_cast<Type*>(object); |
| 189 ASSERT(t->is_bitset() || t->is_class() || |
| 190 t->is_constant() || t->is_union()); |
| 191 return t; |
| 192 } |
| 193 |
187 private: | 194 private: |
188 // A union is a fixed array containing types. Invariants: | 195 // A union is a fixed array containing types. Invariants: |
189 // - its length is at least 2 | 196 // - its length is at least 2 |
190 // - at most one field is a bitset, and it must go into index 0 | 197 // - at most one field is a bitset, and it must go into index 0 |
191 // - no field is a union | 198 // - no field is a union |
192 typedef FixedArray Unioned; | 199 typedef FixedArray Unioned; |
193 | 200 |
194 enum { | 201 enum { |
195 kNull = 1 << 0, | 202 kNull = 1 << 0, |
196 kUndefined = 1 << 1, | 203 kUndefined = 1 << 1, |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 int GlbBitset(); // greatest lower bound that's a bitset | 270 int GlbBitset(); // greatest lower bound that's a bitset |
264 bool InUnion(Handle<Unioned> unioned, int current_size); | 271 bool InUnion(Handle<Unioned> unioned, int current_size); |
265 int ExtendUnion(Handle<Unioned> unioned, int current_size); | 272 int ExtendUnion(Handle<Unioned> unioned, int current_size); |
266 int ExtendIntersection( | 273 int ExtendIntersection( |
267 Handle<Unioned> unioned, Handle<Type> type, int current_size); | 274 Handle<Unioned> unioned, Handle<Type> type, int current_size); |
268 }; | 275 }; |
269 | 276 |
270 } } // namespace v8::internal | 277 } } // namespace v8::internal |
271 | 278 |
272 #endif // V8_TYPES_H_ | 279 #endif // V8_TYPES_H_ |
OLD | NEW |