Commit 395a55b3 authored by Jaroslav Sevcik's avatar Jaroslav Sevcik Committed by Commit Bot

[turbofan] Cleanup in types.

Remove unused methods, duplicate logic.

Bug: v8:7790
Change-Id: Ic8e47158084df5239e3f4b4bf1df7d266c7d2585
Reviewed-on: https://chromium-review.googlesource.com/1090490Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Jaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53568}
parent 5e31f9ff
......@@ -2178,9 +2178,6 @@ Type Typer::Visitor::TypeRuntimeAbort(Node* node) { UNREACHABLE(); }
// Heap constants.
Type Typer::Visitor::TypeConstant(Handle<Object> value) {
if (Type::IsInteger(*value)) {
return Type::Range(value->Number(), value->Number(), zone());
}
return Type::NewConstant(isolate(), value, zone());
}
......
......@@ -14,14 +14,6 @@ namespace v8 {
namespace internal {
namespace compiler {
// NOTE: If code is marked as being a "shortcut", this means that removing
// the code won't affect the semantics of the surrounding function definition.
// static
bool Type::IsInteger(i::Object* x) {
return x->IsNumber() && Type::IsInteger(x->Number());
}
// -----------------------------------------------------------------------------
// Range-related helper functions.
......@@ -57,12 +49,6 @@ bool Type::Contains(const RangeType* lhs, const RangeType* rhs) {
return lhs->Min() <= rhs->Min() && rhs->Max() <= lhs->Max();
}
bool Type::Contains(const RangeType* range, i::Object* val) {
DisallowHeapAllocation no_allocation;
return IsInteger(val) && range->Min() <= val->Number() &&
val->Number() <= range->Max();
}
// -----------------------------------------------------------------------------
// Min and Max computation.
......@@ -460,16 +446,10 @@ double BitsetType::Max(bitset bits) {
// static
bool OtherNumberConstantType::IsOtherNumberConstant(double value) {
// Not an integer, not NaN, and not -0.
return !std::isnan(value) && !Type::IsInteger(value) &&
return !std::isnan(value) && !RangeType::IsInteger(value) &&
!i::IsMinusZero(value);
}
// static
bool OtherNumberConstantType::IsOtherNumberConstant(Object* value) {
return value->IsHeapNumber() &&
IsOtherNumberConstant(HeapNumber::cast(value)->value());
}
HeapConstantType::HeapConstantType(BitsetType::bitset bitset,
i::Handle<i::HeapObject> object)
: TypeBase(kHeapConstant), bitset_(bitset), object_(object) {
......@@ -819,7 +799,7 @@ Type Type::NormalizeRangeAndBitset(Type range, bitset* bits, Zone* zone) {
}
Type Type::NewConstant(double value, Zone* zone) {
if (IsInteger(value)) {
if (RangeType::IsInteger(value)) {
return Range(value, value, zone);
} else if (i::IsMinusZero(value)) {
return Type::MinusZero();
......@@ -833,10 +813,7 @@ Type Type::NewConstant(double value, Zone* zone) {
Type Type::NewConstant(Isolate* isolate, i::Handle<i::Object> value,
Zone* zone) {
if (IsInteger(*value)) {
double v = value->Number();
return Range(v, v, zone);
} else if (value->IsHeapNumber()) {
if (value->IsNumber()) {
return NewConstant(value->Number(), zone);
} else if (value->IsString() && !value->IsInternalizedString()) {
return Type::String();
......
......@@ -312,6 +312,10 @@ class RangeType : public TypeBase {
double Min() const { return limits_.min; }
double Max() const { return limits_.max; }
static bool IsInteger(double x) {
return nearbyint(x) == x && !i::IsMinusZero(x); // Allows for infinities.
}
private:
friend class Type;
friend class BitsetType;
......@@ -321,10 +325,6 @@ class RangeType : public TypeBase {
return New(Limits(min, max), zone);
}
static bool IsInteger(double x) {
return nearbyint(x) == x && !i::IsMinusZero(x); // Allows for infinities.
}
static RangeType* New(Limits lim, Zone* zone) {
DCHECK(IsInteger(lim.min) && IsInteger(lim.max));
DCHECK(lim.min <= lim.max);
......@@ -419,11 +419,6 @@ class V8_EXPORT_PRIVATE Type {
// containing a range, that range is returned; otherwise, nullptr is returned.
Type GetRange() const;
static bool IsInteger(i::Object* x);
static bool IsInteger(double x) {
return nearbyint(x) == x && !i::IsMinusZero(x); // Allows for infinities.
}
int NumConstants() const;
static Type Invalid() { return Type(); }
......@@ -489,7 +484,6 @@ class V8_EXPORT_PRIVATE Type {
static bool Overlap(const RangeType* lhs, const RangeType* rhs);
static bool Contains(const RangeType* lhs, const RangeType* rhs);
static bool Contains(const RangeType* range, i::Object* val);
static int UpdateRange(Type type, UnionType* result, int size, Zone* zone);
......@@ -521,7 +515,6 @@ class OtherNumberConstantType : public TypeBase {
double Value() const { return value_; }
static bool IsOtherNumberConstant(double value);
static bool IsOtherNumberConstant(Object* value);
private:
friend class Type;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment