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

Unified Diff: src/types.h

Issue 437393005: 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 | « no previous file | src/types.cc » ('j') | src/types.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/types.h
diff --git a/src/types.h b/src/types.h
index 0af790a5ad8cb860006e5955e3fa7e213f698809..c7bbfedf72d704623cfea32518c9a7690a6f2991 100644
--- a/src/types.h
+++ b/src/types.h
@@ -286,7 +286,7 @@ class TypeImpl : public Config::Base {
return ClassType::New(map, region);
}
static TypeHandle Constant(i::Handle<i::Object> value, Region* region) {
- // TODO(neis): return RangeType for numerical values
+ // TODO(neis): Return RangeType for numerical values.
return ConstantType::New(value, region);
}
static TypeHandle Range(double min, double max, Region* region) {
@@ -515,6 +515,7 @@ class TypeImpl<Config>::BitsetType : public TypeImpl<Config> {
static int Lub(int32_t value);
static int Lub(uint32_t value);
static int Lub(i::Map* map);
+ static int Lub(double min, double max);
static int InherentLub(TypeImpl* type);
static const char* Name(int bitset);
@@ -687,8 +688,7 @@ class TypeImpl<Config>::RangeType : public StructuralType {
static RangeHandle New(
double min, double max, TypeHandle bound, Region* region) {
- DCHECK(BitsetType::Is(bound->AsBitset(), BitsetType::kNumber));
- DCHECK(!std::isnan(min) && !std::isnan(max) && min <= max);
+ DCHECK(BitsetType::Is(bound->AsBitset(), BitsetType::Lub(min, max)));
RangeHandle type = Config::template cast<RangeType>(
StructuralType::New(StructuralType::kRangeTag, 3, region));
type->Set(0, bound);
@@ -701,7 +701,7 @@ class TypeImpl<Config>::RangeType : public StructuralType {
}
static RangeHandle New(double min, double max, Region* region) {
- TypeHandle bound = BitsetType::New(BitsetType::kNumber, region);
+ TypeHandle bound = BitsetType::New(BitsetType::Lub(min, max), region);
return New(min, max, bound, region);
}
« no previous file with comments | « no previous file | src/types.cc » ('j') | src/types.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698