Revert of Avoid number range holes in bitset types. (patchset #5 id:80001 of https://codereview.chromium.org/759013003/)
Reason for revert: For breaking the waterfall (run-json-stringify test). Original issue's description: > Avoid number range holes in bitset types. > > BUG= TBR=rossberg@chromium.org NOTREECHECKS=true NOTRY=true BUG= Review URL: https://codereview.chromium.org/794663002 Cr-Commit-Position: refs/heads/master@{#25756}
This commit is contained in:
parent
e51e86f459
commit
8a6cbf0a86
@ -165,6 +165,10 @@ Typer::Typer(Graph* graph, MaybeHandle<Context> context)
|
||||
boolean_or_number = Type::Union(Type::Boolean(), Type::Number(), zone);
|
||||
undefined_or_null = Type::Union(Type::Undefined(), Type::Null(), zone);
|
||||
undefined_or_number = Type::Union(Type::Undefined(), Type::Number(), zone);
|
||||
negative_signed32 = Type::Union(
|
||||
Type::SignedSmall(), Type::OtherSigned32(), zone);
|
||||
non_negative_signed32 = Type::Union(
|
||||
Type::UnsignedSmall(), Type::OtherUnsigned31(), zone);
|
||||
singleton_false = Type::Constant(f->false_value(), zone);
|
||||
singleton_true = Type::Constant(f->true_value(), zone);
|
||||
singleton_zero = Type::Range(zero, zero, zone);
|
||||
@ -189,7 +193,8 @@ Typer::Typer(Graph* graph, MaybeHandle<Context> context)
|
||||
number_fun2_ = Type::Function(number, number, number, zone);
|
||||
|
||||
weakint_fun1_ = Type::Function(weakint, number, zone);
|
||||
random_fun_ = Type::Function(Type::OrderedNumber(), zone);
|
||||
random_fun_ = Type::Function(Type::Union(
|
||||
Type::UnsignedSmall(), Type::OtherNumber(), zone), zone);
|
||||
|
||||
const int limits_count = 20;
|
||||
|
||||
@ -865,12 +870,11 @@ Type* Typer::Visitor::JSBitwiseXorTyper(Type* lhs, Type* rhs, Typer* t) {
|
||||
double rmax = rhs->Max();
|
||||
if ((lmin >= 0 && rmin >= 0) || (lmax < 0 && rmax < 0)) {
|
||||
// Xor-ing negative or non-negative values results in a non-negative value.
|
||||
return Type::NonNegativeSigned32();
|
||||
return t->non_negative_signed32;
|
||||
}
|
||||
if ((lmax < 0 && rmin >= 0) || (lmin >= 0 && rmax < 0)) {
|
||||
// Xor-ing a negative and a non-negative value results in a negative value.
|
||||
// TODO(jarin) Use a range here.
|
||||
return Type::NegativeSigned32();
|
||||
return t->negative_signed32;
|
||||
}
|
||||
return Type::Signed32();
|
||||
}
|
||||
|
40
src/types.cc
40
src/types.cc
@ -283,28 +283,30 @@ TypeImpl<Config>::BitsetType::Lub(double value) {
|
||||
|
||||
|
||||
// Minimum values of regular numeric bitsets when SmiValuesAre31Bits.
|
||||
template <class Config>
|
||||
template<class Config>
|
||||
const typename TypeImpl<Config>::BitsetType::BitsetMin
|
||||
TypeImpl<Config>::BitsetType::BitsetMins31[] = {
|
||||
{kOtherNumber, -V8_INFINITY},
|
||||
{kOtherSigned32, kMinInt},
|
||||
{kNegativeSignedSmall, -0x40000000},
|
||||
{kUnsignedSmall, 0},
|
||||
{kOtherUnsigned31, 0x40000000},
|
||||
{kOtherUnsigned32, 0x80000000},
|
||||
{kOtherNumber, static_cast<double>(kMaxUInt32) + 1}};
|
||||
TypeImpl<Config>::BitsetType::BitsetMins31[] = {
|
||||
{kOtherNumber, -V8_INFINITY},
|
||||
{kOtherSigned32, kMinInt},
|
||||
{kOtherSignedSmall, -0x40000000},
|
||||
{kUnsignedSmall, 0},
|
||||
{kOtherUnsigned31, 0x40000000},
|
||||
{kOtherUnsigned32, 0x80000000},
|
||||
{kOtherNumber, static_cast<double>(kMaxUInt32) + 1}
|
||||
};
|
||||
|
||||
|
||||
// Minimum values of regular numeric bitsets when SmiValuesAre32Bits.
|
||||
// OtherSigned32 and OtherUnsigned31 are empty (see the diagrams in types.h).
|
||||
template <class Config>
|
||||
template<class Config>
|
||||
const typename TypeImpl<Config>::BitsetType::BitsetMin
|
||||
TypeImpl<Config>::BitsetType::BitsetMins32[] = {
|
||||
{kOtherNumber, -V8_INFINITY},
|
||||
{kNegativeSignedSmall, kMinInt},
|
||||
{kUnsignedSmall, 0},
|
||||
{kOtherUnsigned32, 0x80000000},
|
||||
{kOtherNumber, static_cast<double>(kMaxUInt32) + 1}};
|
||||
TypeImpl<Config>::BitsetType::BitsetMins32[] = {
|
||||
{kOtherNumber, -V8_INFINITY},
|
||||
{kOtherSignedSmall, kMinInt},
|
||||
{kUnsignedSmall, 0},
|
||||
{kOtherUnsigned32, 0x80000000},
|
||||
{kOtherNumber, static_cast<double>(kMaxUInt32) + 1}
|
||||
};
|
||||
|
||||
|
||||
template<class Config>
|
||||
@ -314,11 +316,6 @@ TypeImpl<Config>::BitsetType::Lub(double min, double max) {
|
||||
int lub = kNone;
|
||||
const BitsetMin* mins = BitsetMins();
|
||||
|
||||
// Make sure the min-max range touches 0, so we are guaranteed no holes
|
||||
// in unions of valid bitsets.
|
||||
if (max < -1) max = -1;
|
||||
if (min > 0) min = 0;
|
||||
|
||||
for (size_t i = 1; i < BitsetMinsSize(); ++i) {
|
||||
if (min < mins[i].min) {
|
||||
lub |= mins[i-1].bits;
|
||||
@ -989,7 +986,6 @@ void TypeImpl<Config>::BitsetType::Print(std::ostream& os, // NOLINT
|
||||
#undef BITSET_CONSTANT
|
||||
|
||||
#define BITSET_CONSTANT(type, value) SEMANTIC(k##type),
|
||||
INTERNAL_BITSET_TYPE_LIST(BITSET_CONSTANT)
|
||||
SEMANTIC_BITSET_TYPE_LIST(BITSET_CONSTANT)
|
||||
#undef BITSET_CONSTANT
|
||||
};
|
||||
|
121
src/types.h
121
src/types.h
@ -160,8 +160,8 @@ namespace internal {
|
||||
#define REPRESENTATION(k) ((k) & BitsetType::kRepresentation)
|
||||
#define SEMANTIC(k) ((k) & BitsetType::kSemantic)
|
||||
|
||||
#define REPRESENTATION_BITSET_TYPE_LIST(V) \
|
||||
V(None, 0) \
|
||||
#define REPRESENTATION_BITSET_TYPE_LIST(V) \
|
||||
V(None, 0) \
|
||||
V(UntaggedInt1, 1u << 23 | kSemantic) \
|
||||
V(UntaggedInt8, 1u << 24 | kSemantic) \
|
||||
V(UntaggedInt16, 1u << 25 | kSemantic) \
|
||||
@ -179,56 +179,51 @@ namespace internal {
|
||||
V(Untagged, kUntaggedNumber | kUntaggedPtr) \
|
||||
V(Tagged, kTaggedInt | kTaggedPtr)
|
||||
|
||||
#define INTERNAL_BITSET_TYPE_LIST(V) \
|
||||
V(OtherUnsigned31, 1u << 1 | REPRESENTATION(kTagged | kUntaggedNumber)) \
|
||||
V(OtherUnsigned32, 1u << 2 | REPRESENTATION(kTagged | kUntaggedNumber)) \
|
||||
V(OtherSigned32, 1u << 3 | REPRESENTATION(kTagged | kUntaggedNumber)) \
|
||||
V(OtherNumber, 1u << 4 | REPRESENTATION(kTagged | kUntaggedNumber))
|
||||
|
||||
#define SEMANTIC_BITSET_TYPE_LIST(V) \
|
||||
V(NegativeSignedSmall, 1u << 5 | REPRESENTATION(kTagged | kUntaggedNumber)) \
|
||||
V(Null, 1u << 6 | REPRESENTATION(kTaggedPtr)) \
|
||||
V(Undefined, 1u << 7 | REPRESENTATION(kTaggedPtr)) \
|
||||
V(Boolean, 1u << 8 | REPRESENTATION(kTaggedPtr)) \
|
||||
V(UnsignedSmall, 1u << 9 | REPRESENTATION(kTagged | kUntaggedNumber)) \
|
||||
V(MinusZero, 1u << 10 | REPRESENTATION(kTagged | kUntaggedNumber)) \
|
||||
V(NaN, 1u << 11 | REPRESENTATION(kTagged | kUntaggedNumber)) \
|
||||
V(Symbol, 1u << 12 | REPRESENTATION(kTaggedPtr)) \
|
||||
V(InternalizedString, 1u << 13 | REPRESENTATION(kTaggedPtr)) \
|
||||
V(OtherString, 1u << 14 | REPRESENTATION(kTaggedPtr)) \
|
||||
V(Undetectable, 1u << 15 | REPRESENTATION(kTaggedPtr)) \
|
||||
V(Array, 1u << 16 | REPRESENTATION(kTaggedPtr)) \
|
||||
V(Buffer, 1u << 17 | REPRESENTATION(kTaggedPtr)) \
|
||||
V(Function, 1u << 18 | REPRESENTATION(kTaggedPtr)) \
|
||||
V(RegExp, 1u << 19 | REPRESENTATION(kTaggedPtr)) \
|
||||
V(OtherObject, 1u << 20 | REPRESENTATION(kTaggedPtr)) \
|
||||
V(Proxy, 1u << 21 | REPRESENTATION(kTaggedPtr)) \
|
||||
V(Internal, 1u << 22 | REPRESENTATION(kTagged | kUntagged)) \
|
||||
\
|
||||
V(SignedSmall, kUnsignedSmall | kNegativeSignedSmall) \
|
||||
V(Signed32, kSignedSmall | kOtherUnsigned31 | kOtherSigned32) \
|
||||
V(NegativeSigned32, kNegativeSignedSmall | kOtherSigned32) \
|
||||
V(NonNegativeSigned32, kUnsignedSmall | kOtherUnsigned31) \
|
||||
V(Unsigned32, kNonNegativeSigned32 | kOtherUnsigned32) \
|
||||
V(Integral32, kSigned32 | kUnsigned32) \
|
||||
V(PlainNumber, kIntegral32 | kOtherNumber) \
|
||||
V(OrderedNumber, kPlainNumber | kMinusZero) \
|
||||
V(Number, kOrderedNumber | kNaN) \
|
||||
V(String, kInternalizedString | kOtherString) \
|
||||
V(UniqueName, kSymbol | kInternalizedString) \
|
||||
V(Name, kSymbol | kString) \
|
||||
V(NumberOrString, kNumber | kString) \
|
||||
V(PlainPrimitive, kNumberOrString | kBoolean | kNull | kUndefined) \
|
||||
V(Primitive, kSymbol | kPlainPrimitive) \
|
||||
V(DetectableObject, kArray | kFunction | kRegExp | kOtherObject) \
|
||||
V(DetectableReceiver, kDetectableObject | kProxy) \
|
||||
V(Detectable, kDetectableReceiver | kNumber | kName) \
|
||||
V(Object, kDetectableObject | kUndetectable) \
|
||||
V(Receiver, kObject | kProxy) \
|
||||
V(Unique, kBoolean | kUniqueName | kNull | kUndefined | \
|
||||
kReceiver) \
|
||||
V(NonNumber, kUnique | kString | kInternal) \
|
||||
V(Any, 0xfffffffeu)
|
||||
#define SEMANTIC_BITSET_TYPE_LIST(V) \
|
||||
V(Null, 1u << 1 | REPRESENTATION(kTaggedPtr)) \
|
||||
V(Undefined, 1u << 2 | REPRESENTATION(kTaggedPtr)) \
|
||||
V(Boolean, 1u << 3 | REPRESENTATION(kTaggedPtr)) \
|
||||
V(UnsignedSmall, 1u << 4 | REPRESENTATION(kTagged | kUntaggedNumber)) \
|
||||
V(OtherSignedSmall, 1u << 5 | REPRESENTATION(kTagged | kUntaggedNumber)) \
|
||||
V(OtherUnsigned31, 1u << 6 | REPRESENTATION(kTagged | kUntaggedNumber)) \
|
||||
V(OtherUnsigned32, 1u << 7 | REPRESENTATION(kTagged | kUntaggedNumber)) \
|
||||
V(OtherSigned32, 1u << 8 | REPRESENTATION(kTagged | kUntaggedNumber)) \
|
||||
V(MinusZero, 1u << 9 | REPRESENTATION(kTagged | kUntaggedNumber)) \
|
||||
V(NaN, 1u << 10 | REPRESENTATION(kTagged | kUntaggedNumber)) \
|
||||
V(OtherNumber, 1u << 11 | REPRESENTATION(kTagged | kUntaggedNumber)) \
|
||||
V(Symbol, 1u << 12 | REPRESENTATION(kTaggedPtr)) \
|
||||
V(InternalizedString, 1u << 13 | REPRESENTATION(kTaggedPtr)) \
|
||||
V(OtherString, 1u << 14 | REPRESENTATION(kTaggedPtr)) \
|
||||
V(Undetectable, 1u << 15 | REPRESENTATION(kTaggedPtr)) \
|
||||
V(Array, 1u << 16 | REPRESENTATION(kTaggedPtr)) \
|
||||
V(Buffer, 1u << 17 | REPRESENTATION(kTaggedPtr)) \
|
||||
V(Function, 1u << 18 | REPRESENTATION(kTaggedPtr)) \
|
||||
V(RegExp, 1u << 19 | REPRESENTATION(kTaggedPtr)) \
|
||||
V(OtherObject, 1u << 20 | REPRESENTATION(kTaggedPtr)) \
|
||||
V(Proxy, 1u << 21 | REPRESENTATION(kTaggedPtr)) \
|
||||
V(Internal, 1u << 22 | REPRESENTATION(kTagged | kUntagged)) \
|
||||
\
|
||||
V(SignedSmall, kUnsignedSmall | kOtherSignedSmall) \
|
||||
V(Signed32, kSignedSmall | kOtherUnsigned31 | kOtherSigned32) \
|
||||
V(Unsigned32, kUnsignedSmall | kOtherUnsigned31 | kOtherUnsigned32) \
|
||||
V(Integral32, kSigned32 | kUnsigned32) \
|
||||
V(OrderedNumber, kIntegral32 | kMinusZero | kOtherNumber) \
|
||||
V(Number, kOrderedNumber | kNaN) \
|
||||
V(String, kInternalizedString | kOtherString) \
|
||||
V(UniqueName, kSymbol | kInternalizedString) \
|
||||
V(Name, kSymbol | kString) \
|
||||
V(NumberOrString, kNumber | kString) \
|
||||
V(PlainPrimitive, kNumberOrString | kBoolean | kNull | kUndefined) \
|
||||
V(Primitive, kSymbol | kPlainPrimitive) \
|
||||
V(DetectableObject, kArray | kFunction | kRegExp | kOtherObject) \
|
||||
V(DetectableReceiver, kDetectableObject | kProxy) \
|
||||
V(Detectable, kDetectableReceiver | kNumber | kName) \
|
||||
V(Object, kDetectableObject | kUndetectable) \
|
||||
V(Receiver, kObject | kProxy) \
|
||||
V(Unique, kBoolean | kUniqueName | kNull | kUndefined | \
|
||||
kReceiver) \
|
||||
V(NonNumber, kUnique | kString | kInternal) \
|
||||
V(Any, 0xfffffffeu)
|
||||
|
||||
/*
|
||||
* The following diagrams show how integers (in the mathematical sense) are
|
||||
@ -258,11 +253,9 @@ namespace internal {
|
||||
REPRESENTATION_BITSET_TYPE_LIST(V) \
|
||||
SEMANTIC_BITSET_TYPE_LIST(V)
|
||||
|
||||
#define BITSET_TYPE_LIST(V) \
|
||||
MASK_BITSET_TYPE_LIST(V) \
|
||||
REPRESENTATION_BITSET_TYPE_LIST(V) \
|
||||
INTERNAL_BITSET_TYPE_LIST(V) \
|
||||
SEMANTIC_BITSET_TYPE_LIST(V)
|
||||
#define BITSET_TYPE_LIST(V) \
|
||||
MASK_BITSET_TYPE_LIST(V) \
|
||||
PROPER_BITSET_TYPE_LIST(V)
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -599,20 +592,6 @@ class TypeImpl<Config>::BitsetType : public TypeImpl<Config> {
|
||||
|
||||
static TypeImpl* New(bitset bits) {
|
||||
DCHECK(bits == kNone || IsInhabited(bits));
|
||||
|
||||
if (FLAG_enable_slow_asserts) {
|
||||
// Check that the bitset does not contain any holes in number ranges.
|
||||
bitset mask = kSemantic;
|
||||
if (!i::SmiValuesAre31Bits()) {
|
||||
mask &= ~(kOtherUnsigned31 | kOtherSigned32);
|
||||
}
|
||||
bitset number_bits = bits & kPlainNumber & mask;
|
||||
if (number_bits != 0) {
|
||||
bitset lub = Lub(Min(number_bits), Max(number_bits)) & mask;
|
||||
CHECK(lub == number_bits);
|
||||
}
|
||||
}
|
||||
|
||||
return Config::from_bitset(bits);
|
||||
}
|
||||
static TypeHandle New(bitset bits, Region* region) {
|
||||
|
@ -167,19 +167,17 @@ static Type* kStringTypes[] = {Type::InternalizedString(), Type::OtherString(),
|
||||
|
||||
|
||||
static Type* kInt32Types[] = {
|
||||
Type::UnsignedSmall(), Type::NegativeSigned32(),
|
||||
Type::NonNegativeSigned32(), Type::SignedSmall(),
|
||||
Type::Signed32(), Type::Unsigned32(),
|
||||
Type::Integral32()};
|
||||
Type::UnsignedSmall(), Type::OtherSignedSmall(), Type::OtherUnsigned31(),
|
||||
Type::OtherUnsigned32(), Type::OtherSigned32(), Type::SignedSmall(),
|
||||
Type::Signed32(), Type::Unsigned32(), Type::Integral32()};
|
||||
|
||||
|
||||
static Type* kNumberTypes[] = {
|
||||
Type::UnsignedSmall(), Type::NegativeSigned32(),
|
||||
Type::NonNegativeSigned32(), Type::SignedSmall(),
|
||||
Type::Signed32(), Type::Unsigned32(),
|
||||
Type::Integral32(), Type::MinusZero(),
|
||||
Type::NaN(), Type::OrderedNumber(),
|
||||
Type::PlainNumber(), Type::Number()};
|
||||
Type::UnsignedSmall(), Type::OtherSignedSmall(), Type::OtherUnsigned31(),
|
||||
Type::OtherUnsigned32(), Type::OtherSigned32(), Type::SignedSmall(),
|
||||
Type::Signed32(), Type::Unsigned32(), Type::Integral32(),
|
||||
Type::MinusZero(), Type::NaN(), Type::OtherNumber(),
|
||||
Type::OrderedNumber(), Type::Number()};
|
||||
|
||||
|
||||
static Type* kJSTypes[] = {Type::Undefined(), Type::Null(), Type::Boolean(),
|
||||
@ -306,13 +304,12 @@ class JSBitwiseShiftTypedLoweringTester : public JSTypedLoweringTester {
|
||||
TEST(Int32BitwiseShifts) {
|
||||
JSBitwiseShiftTypedLoweringTester R;
|
||||
|
||||
Type* types[] = {Type::SignedSmall(), Type::UnsignedSmall(),
|
||||
Type::NegativeSigned32(), Type::NonNegativeSigned32(),
|
||||
Type::Unsigned32(), Type::Signed32(),
|
||||
Type::MinusZero(), Type::NaN(),
|
||||
Type::Undefined(), Type::Null(),
|
||||
Type::Boolean(), Type::Number(),
|
||||
Type::PlainNumber(), Type::String()};
|
||||
Type* types[] = {
|
||||
Type::SignedSmall(), Type::UnsignedSmall(), Type::OtherSigned32(),
|
||||
Type::Unsigned32(), Type::Signed32(), Type::MinusZero(),
|
||||
Type::NaN(), Type::OtherNumber(), Type::Undefined(),
|
||||
Type::Null(), Type::Boolean(), Type::Number(),
|
||||
Type::String()};
|
||||
|
||||
for (size_t i = 0; i < arraysize(types); ++i) {
|
||||
Node* p0 = R.Parameter(types[i], 0);
|
||||
@ -372,11 +369,10 @@ TEST(Int32BitwiseBinops) {
|
||||
JSBitwiseTypedLoweringTester R;
|
||||
|
||||
Type* types[] = {
|
||||
Type::SignedSmall(), Type::UnsignedSmall(), Type::Unsigned32(),
|
||||
Type::Signed32(), Type::MinusZero(), Type::NaN(),
|
||||
Type::OrderedNumber(), Type::PlainNumber(), Type::Undefined(),
|
||||
Type::Null(), Type::Boolean(), Type::Number(),
|
||||
Type::String()};
|
||||
Type::SignedSmall(), Type::UnsignedSmall(), Type::Unsigned32(),
|
||||
Type::Signed32(), Type::MinusZero(), Type::NaN(),
|
||||
Type::OtherNumber(), Type::Undefined(), Type::Null(),
|
||||
Type::Boolean(), Type::Number(), Type::String()};
|
||||
|
||||
for (size_t i = 0; i < arraysize(types); ++i) {
|
||||
Node* p0 = R.Parameter(types[i], 0);
|
||||
|
@ -294,55 +294,39 @@ struct Tests : Rep {
|
||||
CHECK(T.Constant(fac->NewNumber(0))->Is(T.UnsignedSmall));
|
||||
CHECK(T.Constant(fac->NewNumber(1))->Is(T.UnsignedSmall));
|
||||
CHECK(T.Constant(fac->NewNumber(0x3fffffff))->Is(T.UnsignedSmall));
|
||||
CHECK(T.Constant(fac->NewNumber(-1))->Is(T.NegativeSignedSmall));
|
||||
CHECK(T.Constant(fac->NewNumber(-0x3fffffff))->Is(T.NegativeSignedSmall));
|
||||
CHECK(T.Constant(fac->NewNumber(-0x40000000))->Is(T.NegativeSignedSmall));
|
||||
CHECK(T.Constant(fac->NewNumber(-1))->Is(T.OtherSignedSmall));
|
||||
CHECK(T.Constant(fac->NewNumber(-0x3fffffff))->Is(T.OtherSignedSmall));
|
||||
CHECK(T.Constant(fac->NewNumber(-0x40000000))->Is(T.OtherSignedSmall));
|
||||
if (SmiValuesAre31Bits()) {
|
||||
CHECK(T.Constant(fac->NewNumber(0x40000000))->Is(T.NonNegativeSigned32));
|
||||
CHECK(!T.Constant(fac->NewNumber(0x40000000))->Is(T.UnsignedSmall));
|
||||
CHECK(T.Constant(fac->NewNumber(0x7fffffff))->Is(T.NonNegativeSigned32));
|
||||
CHECK(!T.Constant(fac->NewNumber(0x7fffffff))->Is(T.UnsignedSmall));
|
||||
CHECK(T.Constant(fac->NewNumber(-0x40000001))->Is(T.NegativeSigned32));
|
||||
CHECK(
|
||||
!T.Constant(fac->NewNumber(-0x40000001))->Is(T.NegativeSignedSmall));
|
||||
CHECK(T.Constant(fac->NewNumber(-0x7fffffff))->Is(T.NegativeSigned32));
|
||||
CHECK(!T.Constant(fac->NewNumber(-0x7fffffff - 1))
|
||||
->Is(T.NegativeSignedSmall));
|
||||
CHECK(T.Constant(fac->NewNumber(0x40000000))->Is(T.OtherUnsigned31));
|
||||
CHECK(T.Constant(fac->NewNumber(0x7fffffff))->Is(T.OtherUnsigned31));
|
||||
CHECK(T.Constant(fac->NewNumber(-0x40000001))->Is(T.OtherSigned32));
|
||||
CHECK(T.Constant(fac->NewNumber(-0x7fffffff))->Is(T.OtherSigned32));
|
||||
CHECK(T.Constant(fac->NewNumber(-0x7fffffff-1))->Is(T.OtherSigned32));
|
||||
} else {
|
||||
CHECK(SmiValuesAre32Bits());
|
||||
CHECK(T.Constant(fac->NewNumber(0x40000000))->Is(T.UnsignedSmall));
|
||||
CHECK(T.Constant(fac->NewNumber(0x7fffffff))->Is(T.UnsignedSmall));
|
||||
CHECK(T.Constant(fac->NewNumber(0x40000000))->Is(T.NonNegativeSigned32));
|
||||
CHECK(T.Constant(fac->NewNumber(0x7fffffff))->Is(T.NonNegativeSigned32));
|
||||
CHECK(T.Constant(fac->NewNumber(-0x40000001))->Is(T.NegativeSignedSmall));
|
||||
CHECK(T.Constant(fac->NewNumber(-0x7fffffff))->Is(T.NegativeSignedSmall));
|
||||
CHECK(T.Constant(fac->NewNumber(-0x7fffffff - 1))
|
||||
->Is(T.NegativeSignedSmall));
|
||||
CHECK(T.Constant(fac->NewNumber(-0x40000001))->Is(T.NegativeSigned32));
|
||||
CHECK(T.Constant(fac->NewNumber(-0x7fffffff))->Is(T.NegativeSigned32));
|
||||
CHECK(
|
||||
T.Constant(fac->NewNumber(-0x7fffffff - 1))->Is(T.NegativeSigned32));
|
||||
CHECK(!T.Constant(fac->NewNumber(0x40000000))->Is(T.OtherUnsigned31));
|
||||
CHECK(!T.Constant(fac->NewNumber(0x7fffffff))->Is(T.OtherUnsigned31));
|
||||
CHECK(T.Constant(fac->NewNumber(-0x40000001))->Is(T.OtherSignedSmall));
|
||||
CHECK(T.Constant(fac->NewNumber(-0x7fffffff))->Is(T.OtherSignedSmall));
|
||||
CHECK(T.Constant(fac->NewNumber(-0x7fffffff-1))->Is(T.OtherSignedSmall));
|
||||
CHECK(!T.Constant(fac->NewNumber(-0x40000001))->Is(T.OtherSigned32));
|
||||
CHECK(!T.Constant(fac->NewNumber(-0x7fffffff))->Is(T.OtherSigned32));
|
||||
CHECK(!T.Constant(fac->NewNumber(-0x7fffffff-1))->Is(T.OtherSigned32));
|
||||
}
|
||||
CHECK(T.Constant(fac->NewNumber(0x80000000u))->Is(T.Unsigned32));
|
||||
CHECK(!T.Constant(fac->NewNumber(0x80000000u))->Is(T.NonNegativeSigned32));
|
||||
CHECK(T.Constant(fac->NewNumber(0xffffffffu))->Is(T.Unsigned32));
|
||||
CHECK(!T.Constant(fac->NewNumber(0xffffffffu))->Is(T.NonNegativeSigned32));
|
||||
CHECK(T.Constant(fac->NewNumber(0xffffffffu + 1.0))->Is(T.PlainNumber));
|
||||
CHECK(!T.Constant(fac->NewNumber(0xffffffffu + 1.0))->Is(T.Integral32));
|
||||
CHECK(T.Constant(fac->NewNumber(-0x7fffffff - 2.0))->Is(T.PlainNumber));
|
||||
CHECK(!T.Constant(fac->NewNumber(-0x7fffffff - 2.0))->Is(T.Integral32));
|
||||
CHECK(T.Constant(fac->NewNumber(0.1))->Is(T.PlainNumber));
|
||||
CHECK(!T.Constant(fac->NewNumber(0.1))->Is(T.Integral32));
|
||||
CHECK(T.Constant(fac->NewNumber(-10.1))->Is(T.PlainNumber));
|
||||
CHECK(!T.Constant(fac->NewNumber(-10.1))->Is(T.Integral32));
|
||||
CHECK(T.Constant(fac->NewNumber(10e60))->Is(T.PlainNumber));
|
||||
CHECK(!T.Constant(fac->NewNumber(10e60))->Is(T.Integral32));
|
||||
CHECK(T.Constant(fac->NewNumber(0x80000000u))->Is(T.OtherUnsigned32));
|
||||
CHECK(T.Constant(fac->NewNumber(0xffffffffu))->Is(T.OtherUnsigned32));
|
||||
CHECK(T.Constant(fac->NewNumber(0xffffffffu+1.0))->Is(T.OtherNumber));
|
||||
CHECK(T.Constant(fac->NewNumber(-0x7fffffff-2.0))->Is(T.OtherNumber));
|
||||
CHECK(T.Constant(fac->NewNumber(0.1))->Is(T.OtherNumber));
|
||||
CHECK(T.Constant(fac->NewNumber(-10.1))->Is(T.OtherNumber));
|
||||
CHECK(T.Constant(fac->NewNumber(10e60))->Is(T.OtherNumber));
|
||||
CHECK(T.Constant(fac->NewNumber(-1.0*0.0))->Is(T.MinusZero));
|
||||
CHECK(T.Constant(fac->NewNumber(v8::base::OS::nan_value()))->Is(T.NaN));
|
||||
CHECK(T.Constant(fac->NewNumber(V8_INFINITY))->Is(T.PlainNumber));
|
||||
CHECK(!T.Constant(fac->NewNumber(V8_INFINITY))->Is(T.Integral32));
|
||||
CHECK(T.Constant(fac->NewNumber(-V8_INFINITY))->Is(T.PlainNumber));
|
||||
CHECK(!T.Constant(fac->NewNumber(-V8_INFINITY))->Is(T.Integral32));
|
||||
CHECK(T.Constant(fac->NewNumber(V8_INFINITY))->Is(T.OtherNumber));
|
||||
CHECK(T.Constant(fac->NewNumber(-V8_INFINITY))->Is(T.OtherNumber));
|
||||
}
|
||||
|
||||
void Range() {
|
||||
@ -920,7 +904,7 @@ struct Tests : Rep {
|
||||
if (type->IsRange()) {
|
||||
TypeHandle lub = Rep::BitsetType::New(
|
||||
Rep::BitsetType::Lub(type), T.region());
|
||||
CHECK(lub->Is(T.PlainNumber));
|
||||
CHECK(lub->Is(T.Union(T.Integral32, T.OtherNumber)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,8 +40,13 @@ class Types {
|
||||
Types(Region* region, Isolate* isolate)
|
||||
: region_(region), rng_(isolate->random_number_generator()) {
|
||||
#define DECLARE_TYPE(name, value) \
|
||||
name = Type::name(region); \
|
||||
types.push_back(name);
|
||||
name = Type::name(region); \
|
||||
if (SmiValuesAre31Bits() || \
|
||||
(!Type::name(region)->Equals(Type::OtherSigned32()) && \
|
||||
!Type::name(region)->Equals(Type::OtherUnsigned31()))) { \
|
||||
/* Hack: Avoid generating those empty bitset types. */ \
|
||||
types.push_back(name); \
|
||||
}
|
||||
PROPER_BITSET_TYPE_LIST(DECLARE_TYPE)
|
||||
#undef DECLARE_TYPE
|
||||
|
||||
@ -128,7 +133,7 @@ class Types {
|
||||
Handle<i::Oddball> uninitialized;
|
||||
|
||||
#define DECLARE_TYPE(name, value) TypeHandle name;
|
||||
PROPER_BITSET_TYPE_LIST(DECLARE_TYPE)
|
||||
BITSET_TYPE_LIST(DECLARE_TYPE)
|
||||
#undef DECLARE_TYPE
|
||||
|
||||
TypeHandle ObjectClass;
|
||||
@ -233,6 +238,12 @@ class Types {
|
||||
int j = rng_->NextInt(n);
|
||||
#define PICK_BITSET_TYPE(type, value) \
|
||||
if (j-- == 0) { \
|
||||
if (!SmiValuesAre31Bits() && \
|
||||
(Type::type(region_)->Equals(Type::OtherSigned32()) || \
|
||||
Type::type(region_)->Equals(Type::OtherUnsigned31()))) { \
|
||||
/* Hack: Avoid generating those empty bitset types. */ \
|
||||
continue; \
|
||||
} \
|
||||
TypeHandle tmp = Type::Intersect( \
|
||||
result, Type::type(region_), region_); \
|
||||
if (tmp->Is(Type::None()) && i != 0) { \
|
||||
|
@ -58,12 +58,11 @@ namespace {
|
||||
|
||||
// TODO(mstarzinger): Find a common place and unify with test-js-typed-lowering.
|
||||
Type* const kNumberTypes[] = {
|
||||
Type::UnsignedSmall(), Type::NegativeSigned32(),
|
||||
Type::NonNegativeSigned32(), Type::SignedSmall(),
|
||||
Type::Signed32(), Type::Unsigned32(),
|
||||
Type::Integral32(), Type::MinusZero(),
|
||||
Type::NaN(), Type::OrderedNumber(),
|
||||
Type::PlainNumber(), Type::Number()};
|
||||
Type::UnsignedSmall(), Type::OtherSignedSmall(), Type::OtherUnsigned31(),
|
||||
Type::OtherUnsigned32(), Type::OtherSigned32(), Type::SignedSmall(),
|
||||
Type::Signed32(), Type::Unsigned32(), Type::Integral32(),
|
||||
Type::MinusZero(), Type::NaN(), Type::OtherNumber(),
|
||||
Type::OrderedNumber(), Type::Number()};
|
||||
|
||||
} // namespace
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user