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

Unified Diff: src/types.h

Issue 444023002: 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') | no next file with comments »
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 6d60b38db99dce3fbe870abd280edcbfc795679a..cca8b3167b4bb9b86773d7fcf40959490a9164f0 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) {
@@ -518,6 +518,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);
@@ -690,8 +691,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);
@@ -704,7 +704,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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698