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/factory.h" | 9 #include "src/factory.h" |
10 #include "src/handles.h" | 10 #include "src/handles.h" |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 ArrayType* AsArray() { return ArrayType::cast(this); } | 457 ArrayType* AsArray() { return ArrayType::cast(this); } |
458 FunctionType* AsFunction() { return FunctionType::cast(this); } | 458 FunctionType* AsFunction() { return FunctionType::cast(this); } |
459 | 459 |
460 // Minimum and maximum of a numeric type. | 460 // Minimum and maximum of a numeric type. |
461 // These functions do not distinguish between -0 and +0. If the type equals | 461 // These functions do not distinguish between -0 and +0. If the type equals |
462 // kNaN, they return NaN; otherwise kNaN is ignored. Only call these | 462 // kNaN, they return NaN; otherwise kNaN is ignored. Only call these |
463 // functions on subtypes of Number. | 463 // functions on subtypes of Number. |
464 double Min(); | 464 double Min(); |
465 double Max(); | 465 double Max(); |
466 | 466 |
| 467 // Extracts a range from the type. If the type is a range, it just |
| 468 // returns it; if it is a union, it returns the range component. |
| 469 // Note that it does not contain range for constants. |
| 470 RangeType* GetRange(); |
| 471 |
467 int NumClasses(); | 472 int NumClasses(); |
468 int NumConstants(); | 473 int NumConstants(); |
469 | 474 |
470 template<class T> class Iterator; | 475 template<class T> class Iterator; |
471 Iterator<i::Map> Classes() { | 476 Iterator<i::Map> Classes() { |
472 if (this->IsBitset()) return Iterator<i::Map>(); | 477 if (this->IsBitset()) return Iterator<i::Map>(); |
473 return Iterator<i::Map>(Config::handle(this)); | 478 return Iterator<i::Map>(Config::handle(this)); |
474 } | 479 } |
475 Iterator<i::Object> Constants() { | 480 Iterator<i::Object> Constants() { |
476 if (this->IsBitset()) return Iterator<i::Object>(); | 481 if (this->IsBitset()) return Iterator<i::Object>(); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 explicit Limits(RangeType* range) : | 549 explicit Limits(RangeType* range) : |
545 min(range->Min()), max(range->Max()) {} | 550 min(range->Min()), max(range->Max()) {} |
546 }; | 551 }; |
547 | 552 |
548 static Limits Intersect(Limits lhs, Limits rhs); | 553 static Limits Intersect(Limits lhs, Limits rhs); |
549 static Limits Union(Limits lhs, Limits rhs); | 554 static Limits Union(Limits lhs, Limits rhs); |
550 static bool Overlap(RangeType* lhs, RangeType* rhs); | 555 static bool Overlap(RangeType* lhs, RangeType* rhs); |
551 static bool Contains(RangeType* lhs, RangeType* rhs); | 556 static bool Contains(RangeType* lhs, RangeType* rhs); |
552 static bool Contains(RangeType* range, i::Object* val); | 557 static bool Contains(RangeType* range, i::Object* val); |
553 | 558 |
554 RangeType* GetRange(); | |
555 static int UpdateRange( | 559 static int UpdateRange( |
556 RangeHandle type, UnionHandle result, int size, Region* region); | 560 RangeHandle type, UnionHandle result, int size, Region* region); |
557 | 561 |
558 bool SimplyEquals(TypeImpl* that); | 562 bool SimplyEquals(TypeImpl* that); |
559 template<class TypeHandle> | 563 template<class TypeHandle> |
560 bool SimplyEquals(TypeHandle that) { return this->SimplyEquals(*that); } | 564 bool SimplyEquals(TypeHandle that) { return this->SimplyEquals(*that); } |
561 | 565 |
562 static int AddToUnion( | 566 static int AddToUnion( |
563 TypeHandle type, UnionHandle result, int size, Region* region); | 567 TypeHandle type, UnionHandle result, int size, Region* region); |
564 static int IntersectAux( | 568 static int IntersectAux( |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1057 bool Narrows(BoundsImpl that) { | 1061 bool Narrows(BoundsImpl that) { |
1058 return that.lower->Is(this->lower) && this->upper->Is(that.upper); | 1062 return that.lower->Is(this->lower) && this->upper->Is(that.upper); |
1059 } | 1063 } |
1060 }; | 1064 }; |
1061 | 1065 |
1062 typedef BoundsImpl<ZoneTypeConfig> Bounds; | 1066 typedef BoundsImpl<ZoneTypeConfig> Bounds; |
1063 | 1067 |
1064 } } // namespace v8::internal | 1068 } } // namespace v8::internal |
1065 | 1069 |
1066 #endif // V8_TYPES_H_ | 1070 #endif // V8_TYPES_H_ |
OLD | NEW |