| 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 "handles.h" | 8 #include "handles.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 static TypeImpl* cast(typename Config::Base* object) { | 286 static TypeImpl* cast(typename Config::Base* object) { |
| 287 TypeImpl* t = static_cast<TypeImpl*>(object); | 287 TypeImpl* t = static_cast<TypeImpl*>(object); |
| 288 ASSERT(t->IsBitset() || t->IsClass() || t->IsConstant() || t->IsUnion()); | 288 ASSERT(t->IsBitset() || t->IsClass() || t->IsConstant() || t->IsUnion()); |
| 289 return t; | 289 return t; |
| 290 } | 290 } |
| 291 | 291 |
| 292 template<class OtherTypeImpl> | 292 template<class OtherTypeImpl> |
| 293 static TypeHandle Convert( | 293 static TypeHandle Convert( |
| 294 typename OtherTypeImpl::TypeHandle type, Region* region); | 294 typename OtherTypeImpl::TypeHandle type, Region* region); |
| 295 | 295 |
| 296 #ifdef OBJECT_PRINT | |
| 297 enum PrintDimension { BOTH_DIMS, SEMANTIC_DIM, REPRESENTATION_DIM }; | 296 enum PrintDimension { BOTH_DIMS, SEMANTIC_DIM, REPRESENTATION_DIM }; |
| 298 void TypePrint(PrintDimension = BOTH_DIMS); | 297 void TypePrint(PrintDimension = BOTH_DIMS); |
| 299 void TypePrint(FILE* out, PrintDimension = BOTH_DIMS); | 298 void TypePrint(FILE* out, PrintDimension = BOTH_DIMS); |
| 300 #endif | |
| 301 | 299 |
| 302 private: | 300 private: |
| 303 template<class> friend class Iterator; | 301 template<class> friend class Iterator; |
| 304 template<class> friend class TypeImpl; | 302 template<class> friend class TypeImpl; |
| 305 | 303 |
| 306 // A union is a fixed array containing types. Invariants: | 304 // A union is a fixed array containing types. Invariants: |
| 307 // - its length is at least 2 | 305 // - its length is at least 2 |
| 308 // - at most one field is a bitset, and it must go into index 0 | 306 // - at most one field is a bitset, and it must go into index 0 |
| 309 // - no field is a union | 307 // - no field is a union |
| 310 typedef typename Config::Unioned Unioned; | 308 typedef typename Config::Unioned Unioned; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 | 340 |
| 343 static int LubBitset(i::Object* value); | 341 static int LubBitset(i::Object* value); |
| 344 static int LubBitset(i::Map* map); | 342 static int LubBitset(i::Map* map); |
| 345 | 343 |
| 346 bool InUnion(UnionedHandle unioned, int current_size); | 344 bool InUnion(UnionedHandle unioned, int current_size); |
| 347 static int ExtendUnion( | 345 static int ExtendUnion( |
| 348 UnionedHandle unioned, TypeHandle t, int current_size); | 346 UnionedHandle unioned, TypeHandle t, int current_size); |
| 349 static int ExtendIntersection( | 347 static int ExtendIntersection( |
| 350 UnionedHandle unioned, TypeHandle t, TypeHandle other, int current_size); | 348 UnionedHandle unioned, TypeHandle t, TypeHandle other, int current_size); |
| 351 | 349 |
| 352 #ifdef OBJECT_PRINT | |
| 353 static const char* bitset_name(int bitset); | 350 static const char* bitset_name(int bitset); |
| 354 static void BitsetTypePrint(FILE* out, int bitset); | 351 static void BitsetTypePrint(FILE* out, int bitset); |
| 355 #endif | |
| 356 }; | 352 }; |
| 357 | 353 |
| 358 | 354 |
| 359 // Zone-allocated types are either (odd) integers to represent bitsets, or | 355 // Zone-allocated types are either (odd) integers to represent bitsets, or |
| 360 // (even) pointers to zone lists for everything else. The first slot of every | 356 // (even) pointers to zone lists for everything else. The first slot of every |
| 361 // list is an explicit tag value to distinguish representation. | 357 // list is an explicit tag value to distinguish representation. |
| 362 struct ZoneTypeConfig { | 358 struct ZoneTypeConfig { |
| 363 private: | 359 private: |
| 364 typedef i::ZoneList<void*> Tagged; | 360 typedef i::ZoneList<void*> Tagged; |
| 365 | 361 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 bool Narrows(BoundsImpl that) { | 501 bool Narrows(BoundsImpl that) { |
| 506 return that.lower->Is(this->lower) && this->upper->Is(that.upper); | 502 return that.lower->Is(this->lower) && this->upper->Is(that.upper); |
| 507 } | 503 } |
| 508 }; | 504 }; |
| 509 | 505 |
| 510 typedef BoundsImpl<ZoneTypeConfig> Bounds; | 506 typedef BoundsImpl<ZoneTypeConfig> Bounds; |
| 511 | 507 |
| 512 } } // namespace v8::internal | 508 } } // namespace v8::internal |
| 513 | 509 |
| 514 #endif // V8_TYPES_H_ | 510 #endif // V8_TYPES_H_ |
| OLD | NEW |