| 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 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 | 591 |
| 592 static bool Is(bitset bits1, bitset bits2) { | 592 static bool Is(bitset bits1, bitset bits2) { |
| 593 return (bits1 | bits2) == bits2; | 593 return (bits1 | bits2) == bits2; |
| 594 } | 594 } |
| 595 | 595 |
| 596 static double Min(bitset); | 596 static double Min(bitset); |
| 597 static double Max(bitset); | 597 static double Max(bitset); |
| 598 | 598 |
| 599 static bitset Glb(TypeImpl* type); // greatest lower bound that's a bitset | 599 static bitset Glb(TypeImpl* type); // greatest lower bound that's a bitset |
| 600 static bitset Lub(TypeImpl* type); // least upper bound that's a bitset | 600 static bitset Lub(TypeImpl* type); // least upper bound that's a bitset |
| 601 static bitset Lub(i::Map* map); |
| 601 static bitset Lub(i::Object* value); | 602 static bitset Lub(i::Object* value); |
| 602 static bitset Lub(double value); | 603 static bitset Lub(double value); |
| 603 static bitset Lub(int32_t value); | 604 static bitset Lub(double min, double max); |
| 604 static bitset Lub(uint32_t value); | |
| 605 static bitset Lub(i::Map* map); | |
| 606 static bitset Lub(Limits lim); | |
| 607 | 605 |
| 608 static const char* Name(bitset); | 606 static const char* Name(bitset); |
| 609 static void Print(OStream& os, bitset); // NOLINT | 607 static void Print(OStream& os, bitset); // NOLINT |
| 610 #ifdef DEBUG | 608 #ifdef DEBUG |
| 611 static void Print(bitset); | 609 static void Print(bitset); |
| 612 #endif | 610 #endif |
| 613 | 611 |
| 614 private: | 612 private: |
| 615 struct BitsetMin{ | 613 struct BitsetMin{ |
| 616 bitset bits; | 614 bitset bits; |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 public: | 772 public: |
| 775 int BitsetLub() { return this->Get(0)->AsBitset(); } | 773 int BitsetLub() { return this->Get(0)->AsBitset(); } |
| 776 i::Handle<i::Object> Min() { return this->template GetValue<i::Object>(1); } | 774 i::Handle<i::Object> Min() { return this->template GetValue<i::Object>(1); } |
| 777 i::Handle<i::Object> Max() { return this->template GetValue<i::Object>(2); } | 775 i::Handle<i::Object> Max() { return this->template GetValue<i::Object>(2); } |
| 778 | 776 |
| 779 static RangeHandle New( | 777 static RangeHandle New( |
| 780 i::Handle<i::Object> min, i::Handle<i::Object> max, Region* region) { | 778 i::Handle<i::Object> min, i::Handle<i::Object> max, Region* region) { |
| 781 DCHECK(min->Number() <= max->Number()); | 779 DCHECK(min->Number() <= max->Number()); |
| 782 RangeHandle type = Config::template cast<RangeType>( | 780 RangeHandle type = Config::template cast<RangeType>( |
| 783 StructuralType::New(StructuralType::kRangeTag, 3, region)); | 781 StructuralType::New(StructuralType::kRangeTag, 3, region)); |
| 784 type->Set(0, BitsetType::New(BitsetType::Lub(Limits(min, max)), region)); | 782 type->Set(0, BitsetType::New( |
| 783 BitsetType::Lub(min->Number(), max->Number()), region)); |
| 785 type->SetValue(1, min); | 784 type->SetValue(1, min); |
| 786 type->SetValue(2, max); | 785 type->SetValue(2, max); |
| 787 return type; | 786 return type; |
| 788 } | 787 } |
| 789 | 788 |
| 790 static RangeHandle New(Limits lim, Region* region) { | 789 static RangeHandle New(Limits lim, Region* region) { |
| 791 return New(lim.min, lim.max, region); | 790 return New(lim.min, lim.max, region); |
| 792 } | 791 } |
| 793 | 792 |
| 794 static RangeType* cast(TypeImpl* type) { | 793 static RangeType* cast(TypeImpl* type) { |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1042 bool Narrows(BoundsImpl that) { | 1041 bool Narrows(BoundsImpl that) { |
| 1043 return that.lower->Is(this->lower) && this->upper->Is(that.upper); | 1042 return that.lower->Is(this->lower) && this->upper->Is(that.upper); |
| 1044 } | 1043 } |
| 1045 }; | 1044 }; |
| 1046 | 1045 |
| 1047 typedef BoundsImpl<ZoneTypeConfig> Bounds; | 1046 typedef BoundsImpl<ZoneTypeConfig> Bounds; |
| 1048 | 1047 |
| 1049 } } // namespace v8::internal | 1048 } } // namespace v8::internal |
| 1050 | 1049 |
| 1051 #endif // V8_TYPES_H_ | 1050 #endif // V8_TYPES_H_ |
| OLD | NEW |