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 | |
472 int NumClasses(); | 467 int NumClasses(); |
473 int NumConstants(); | 468 int NumConstants(); |
474 | 469 |
475 template<class T> class Iterator; | 470 template<class T> class Iterator; |
476 Iterator<i::Map> Classes() { | 471 Iterator<i::Map> Classes() { |
477 if (this->IsBitset()) return Iterator<i::Map>(); | 472 if (this->IsBitset()) return Iterator<i::Map>(); |
478 return Iterator<i::Map>(Config::handle(this)); | 473 return Iterator<i::Map>(Config::handle(this)); |
479 } | 474 } |
480 Iterator<i::Object> Constants() { | 475 Iterator<i::Object> Constants() { |
481 if (this->IsBitset()) return Iterator<i::Object>(); | 476 if (this->IsBitset()) return Iterator<i::Object>(); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 explicit Limits(RangeType* range) : | 544 explicit Limits(RangeType* range) : |
550 min(range->Min()), max(range->Max()) {} | 545 min(range->Min()), max(range->Max()) {} |
551 }; | 546 }; |
552 | 547 |
553 static Limits Intersect(Limits lhs, Limits rhs); | 548 static Limits Intersect(Limits lhs, Limits rhs); |
554 static Limits Union(Limits lhs, Limits rhs); | 549 static Limits Union(Limits lhs, Limits rhs); |
555 static bool Overlap(RangeType* lhs, RangeType* rhs); | 550 static bool Overlap(RangeType* lhs, RangeType* rhs); |
556 static bool Contains(RangeType* lhs, RangeType* rhs); | 551 static bool Contains(RangeType* lhs, RangeType* rhs); |
557 static bool Contains(RangeType* range, i::Object* val); | 552 static bool Contains(RangeType* range, i::Object* val); |
558 | 553 |
| 554 RangeType* GetRange(); |
559 static int UpdateRange( | 555 static int UpdateRange( |
560 RangeHandle type, UnionHandle result, int size, Region* region); | 556 RangeHandle type, UnionHandle result, int size, Region* region); |
561 | 557 |
562 bool SimplyEquals(TypeImpl* that); | 558 bool SimplyEquals(TypeImpl* that); |
563 template<class TypeHandle> | 559 template<class TypeHandle> |
564 bool SimplyEquals(TypeHandle that) { return this->SimplyEquals(*that); } | 560 bool SimplyEquals(TypeHandle that) { return this->SimplyEquals(*that); } |
565 | 561 |
566 static int AddToUnion( | 562 static int AddToUnion( |
567 TypeHandle type, UnionHandle result, int size, Region* region); | 563 TypeHandle type, UnionHandle result, int size, Region* region); |
568 static int IntersectAux( | 564 static int IntersectAux( |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1061 bool Narrows(BoundsImpl that) { | 1057 bool Narrows(BoundsImpl that) { |
1062 return that.lower->Is(this->lower) && this->upper->Is(that.upper); | 1058 return that.lower->Is(this->lower) && this->upper->Is(that.upper); |
1063 } | 1059 } |
1064 }; | 1060 }; |
1065 | 1061 |
1066 typedef BoundsImpl<ZoneTypeConfig> Bounds; | 1062 typedef BoundsImpl<ZoneTypeConfig> Bounds; |
1067 | 1063 |
1068 } } // namespace v8::internal | 1064 } } // namespace v8::internal |
1069 | 1065 |
1070 #endif // V8_TYPES_H_ | 1066 #endif // V8_TYPES_H_ |
OLD | NEW |