Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1845)

Unified Diff: src/types.cc

Issue 450473002: Revert "Extend some operations to range types." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/types.h ('k') | test/cctest/test-types.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/types.cc
diff --git a/src/types.cc b/src/types.cc
index 558ee04b15d77dea09c0edd40266b6598d7f8c61..45dcea2de7d8c84f82ab7e3903fefd671ec2668e 100644
--- a/src/types.cc
+++ b/src/types.cc
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <math.h>
-
#include "src/types.h"
#include "src/ostreams.h"
@@ -12,21 +10,6 @@
namespace v8 {
namespace internal {
-
-// -----------------------------------------------------------------------------
-// Range-related custom order on doubles.
-// We want -0 to be less than +0.
-
-static bool dle(double x, double y) {
- return x <= y && copysign(1, x) <= copysign(1, y);
-}
-
-
-static bool deq(double x, double y) {
- return dle(x, y) && dle(y, x);
-}
-
-
// -----------------------------------------------------------------------------
// Glb and lub computation.
@@ -65,8 +48,6 @@ int TypeImpl<Config>::BitsetType::Lub(TypeImpl* type) {
type->AsClass()->Bound(NULL)->AsBitset();
} else if (type->IsConstant()) {
return type->AsConstant()->Bound()->AsBitset();
- } else if (type->IsRange()) {
- return type->AsRange()->Bound()->AsBitset();
} else if (type->IsContext()) {
return type->AsContext()->Bound()->AsBitset();
} else if (type->IsArray()) {
@@ -97,8 +78,6 @@ int TypeImpl<Config>::BitsetType::InherentLub(TypeImpl* type) {
return Lub(*type->AsClass()->Map());
} else if (type->IsConstant()) {
return Lub(*type->AsConstant()->Value());
- } else if (type->IsRange()) {
- return Lub(type->AsRange()->Min(), type->AsRange()->Max());
} else if (type->IsContext()) {
return kInternal & kTaggedPtr;
} else if (type->IsArray()) {
@@ -134,18 +113,6 @@ int TypeImpl<Config>::BitsetType::Lub(double value) {
template<class Config>
-int TypeImpl<Config>::BitsetType::Lub(double min, double max) {
- DisallowHeapAllocation no_allocation;
- DCHECK(dle(min, max));
- if (deq(min, max)) return BitsetType::Lub(min); // Singleton range.
- int bitset = BitsetType::kNumber ^ SEMANTIC(BitsetType::kNaN);
- if (dle(0, min) || max < 0) bitset ^= SEMANTIC(BitsetType::kMinusZero);
- return bitset;
- // TODO(neis): Could refine this further by doing more checks on min/max.
-}
-
-
-template<class Config>
int TypeImpl<Config>::BitsetType::Lub(int32_t value) {
if (value >= 0x40000000) {
return i::SmiValuesAre31Bits() ? kOtherUnsigned31 : kUnsignedSmall;
@@ -289,12 +256,6 @@ bool TypeImpl<Config>::SlowIs(TypeImpl* that) {
&& *this->AsConstant()->Value() == *that->AsConstant()->Value()
&& this->AsConstant()->Bound()->Is(that->AsConstant()->Bound());
}
- if (that->IsRange()) {
- return this->IsRange()
- && this->AsRange()->Bound()->Is(that->AsRange()->Bound())
- && dle(that->AsRange()->Min(), this->AsRange()->Min())
- && dle(this->AsRange()->Max(), that->AsRange()->Max());
- }
if (that->IsContext()) {
return this->IsContext()
&& this->AsContext()->Outer()->Equals(that->AsContext()->Outer());
@@ -427,12 +388,6 @@ bool TypeImpl<Config>::Maybe(TypeImpl* that) {
template<class Config>
bool TypeImpl<Config>::Contains(i::Object* value) {
DisallowHeapAllocation no_allocation;
- if (this->IsRange()) {
- return value->IsNumber() &&
- dle(this->AsRange()->Min(), value->Number()) &&
- dle(value->Number(), this->AsRange()->Max()) &&
- BitsetType::Is(BitsetType::Lub(value), this->BitsetLub());
- }
for (Iterator<i::Object> it = this->Constants(); !it.Done(); it.Advance()) {
if (*it.Current() == value) return true;
}
@@ -465,9 +420,6 @@ typename TypeImpl<Config>::TypeHandle TypeImpl<Config>::Rebound(
return ClassType::New(this->AsClass()->Map(), bound, region);
} else if (this->IsConstant()) {
return ConstantType::New(this->AsConstant()->Value(), bound, region);
- } else if (this->IsRange()) {
- return RangeType::New(
- this->AsRange()->Min(), this->AsRange()->Max(), bound, region);
} else if (this->IsContext()) {
return ContextType::New(this->AsContext()->Outer(), bound, region);
} else if (this->IsArray()) {
@@ -556,8 +508,8 @@ int TypeImpl<Config>::ExtendUnion(
}
}
} else if (!type->IsBitset()) {
- DCHECK(type->IsClass() || type->IsConstant() || type->IsRange() ||
- type->IsContext() || type->IsArray() || type->IsFunction());
+ DCHECK(type->IsClass() || type->IsConstant() ||
+ type->IsArray() || type->IsFunction() || type->IsContext());
int inherent_bound = type->InherentBitsetLub();
int old_bound = type->BitsetLub();
int other_bound = type->BoundBy(other->unhandle()) & inherent_bound;
@@ -800,10 +752,6 @@ typename TypeImpl<Config>::TypeHandle TypeImpl<Config>::Convert(
} else if (type->IsConstant()) {
TypeHandle bound = Convert<OtherType>(type->AsConstant()->Bound(), region);
return ConstantType::New(type->AsConstant()->Value(), bound, region);
- } else if (type->IsRange()) {
- TypeHandle bound = Convert<OtherType>(type->AsRange()->Bound(), region);
- return RangeType::New(
- type->AsRange()->Min(), type->AsRange()->Max(), bound, region);
} else if (type->IsContext()) {
TypeHandle bound = Convert<OtherType>(type->AsContext()->Bound(), region);
TypeHandle outer = Convert<OtherType>(type->AsContext()->Outer(), region);
« no previous file with comments | « src/types.h ('k') | test/cctest/test-types.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698