Revision: 22569
Author: [email protected]
Date: Wed Jul 23 15:39:08 2014 UTC
Log: Revert "Minor clarifications and simplifications as well as
additional checks."
This reverts commit d32eacbdea3fc0c119da06abe95b07a83c67aa48.
[email protected]
BUG=
Review URL: https://codereview.chromium.org/410083005
http://code.google.com/p/v8/source/detail?r=22569
Modified:
/branches/bleeding_edge/src/types.cc
/branches/bleeding_edge/src/types.h
=======================================
--- /branches/bleeding_edge/src/types.cc Wed Jul 23 15:30:34 2014 UTC
+++ /branches/bleeding_edge/src/types.cc Wed Jul 23 15:39:08 2014 UTC
@@ -262,7 +262,7 @@
if (this->IsBitset() && SEMANTIC(this->AsBitset()) == BitsetType::kNone)
{
// Bitsets only have non-bitset supertypes along the representation
axis.
int that_bitset = that->BitsetGlb();
- return (BitsetType::Is(this->AsBitset(), that_bitset));
+ return (this->AsBitset() | that_bitset) == that_bitset;
}
if (that->IsClass()) {
@@ -313,12 +313,16 @@
// T <= (T1 \/ ... \/ Tn) <=> (T <= T1) \/ ... \/ (T <= Tn)
// (iff T is not a union)
- ASSERT(!this->IsUnion() && that->IsUnion());
- UnionHandle unioned = handle(that->AsUnion());
- for (int i = 0; i < unioned->Length(); ++i) {
- if (this->Is(unioned->Get(i))) return true;
- if (this->IsBitset()) break; // Fast fail, only first field is a
bitset.
+ ASSERT(!this->IsUnion());
+ if (that->IsUnion()) {
+ UnionHandle unioned = handle(that->AsUnion());
+ for (int i = 0; i < unioned->Length(); ++i) {
+ if (this->Is(unioned->Get(i))) return true;
+ if (this->IsBitset()) break; // Fast fail, only first field is a
bitset.
+ }
+ return false;
}
+
return false;
}
@@ -378,8 +382,11 @@
}
ASSERT(!this->IsUnion() && !that->IsUnion());
- if (this->IsBitset() || that->IsBitset()) {
- return BitsetType::IsInhabited(this->BitsetLub() & that->BitsetLub());
+ if (this->IsBitset()) {
+ return BitsetType::IsInhabited(this->AsBitset() & that->BitsetLub());
+ }
+ if (that->IsBitset()) {
+ return BitsetType::IsInhabited(this->BitsetLub() & that->AsBitset());
}
if (this->IsClass()) {
return that->IsClass()
@@ -437,7 +444,6 @@
typename TypeImpl<Config>::TypeHandle TypeImpl<Config>::Narrow(
int bitset, Region* region) {
TypeHandle bound = BitsetType::New(bitset, region);
- ASSERT(!this->IsBitset() && this->Is(bound));
if (this->IsClass()) {
return ClassType::New(this->AsClass()->Map(), bound, region);
} else if (this->IsConstant()) {
@@ -564,7 +570,7 @@
if (bitset != BitsetType::kNone && SEMANTIC(bitset) ==
BitsetType::kNone) {
for (int i = 1; i < size; ++i) {
int glb = result->Get(i)->BitsetGlb();
- if (BitsetType::Is(bitset, glb)) {
+ if ((bitset | glb) == glb) {
for (int j = 1; j < size; ++j) {
result->Set(j - 1, result->Get(j));
}
=======================================
--- /branches/bleeding_edge/src/types.h Wed Jul 23 15:30:34 2014 UTC
+++ /branches/bleeding_edge/src/types.h Wed Jul 23 15:39:08 2014 UTC
@@ -68,12 +68,11 @@
// None <= R
// R <= Any
//
-// UntaggedInt = UntaggedInt1 \/ UntaggedInt8 \/
-// UntaggedInt16 \/ UntaggedInt32
-// UntaggedFloat = UntaggedFloat32 \/ UntaggedFloat64
-// UntaggedNumber = UntaggedInt \/ UntaggedFloat
-// Untagged = UntaggedNumber \/ UntaggedPtr
-// Tagged = TaggedInt \/ TaggedPtr
+// UntaggedInt <= UntaggedInt8 \/ UntaggedInt16 \/ UntaggedInt32)
+// UntaggedFloat <= UntaggedFloat32 \/ UntaggedFloat64
+// UntaggedNumber <= UntaggedInt \/ UntaggedFloat
+// Untagged <= UntaggedNumber \/ UntaggedPtr
+// Tagged <= TaggedInt \/ TaggedPtr
//
// Subtyping relates the two dimensions, for example:
//
@@ -502,10 +501,6 @@
static bool IsInhabited(int bitset) {
return (bitset & kRepresentation) && (bitset & kSemantic);
}
-
- static bool Is(int bitset1, int bitset2) {
- return (bitset1 | bitset2) == bitset2;
- }
static int Glb(TypeImpl* type); // greatest lower bound that's a bitset
static int Lub(TypeImpl* type); // least upper bound that's a bitset
@@ -617,7 +612,6 @@
static ClassHandle New(
i::Handle<i::Map> map, TypeHandle bound, Region* region) {
- ASSERT(BitsetType::Is(bound->AsBitset(), BitsetType::Lub(*map)));
ClassHandle type = Config::template cast<ClassType>(
StructuralType::New(StructuralType::kClassTag, 2, region));
type->Set(0, bound);
@@ -654,7 +648,6 @@
static ConstantHandle New(
i::Handle<i::Object> value, TypeHandle bound, Region* region) {
- ASSERT(BitsetType::Is(bound->AsBitset(), BitsetType::Lub(*value)));
ConstantHandle type = Config::template cast<ConstantType>(
StructuralType::New(StructuralType::kConstantTag, 2, region));
type->Set(0, bound);
@@ -686,7 +679,8 @@
static RangeHandle New(
double min, double max, TypeHandle bound, Region* region) {
- ASSERT(BitsetType::Is(bound->AsBitset(), BitsetType::kNumber));
+ ASSERT(SEMANTIC(bound->AsBitset() | BitsetType::kNumber)
+ == SEMANTIC(BitsetType::kNumber));
ASSERT(!std::isnan(min) && !std::isnan(max) && min <= max);
RangeHandle type = Config::template cast<RangeType>(
StructuralType::New(StructuralType::kRangeTag, 3, region));
@@ -721,8 +715,6 @@
TypeHandle Outer() { return this->Get(1); }
static ContextHandle New(TypeHandle outer, TypeHandle bound, Region*
region) {
- ASSERT(BitsetType::Is(
- bound->AsBitset(), BitsetType::kInternal &
BitsetType::kTaggedPtr));
ContextHandle type = Config::template cast<ContextType>(
StructuralType::New(StructuralType::kContextTag, 2, region));
type->Set(0, bound);
@@ -753,7 +745,7 @@
TypeHandle Element() { return this->Get(1); }
static ArrayHandle New(TypeHandle element, TypeHandle bound, Region*
region) {
- ASSERT(BitsetType::Is(bound->AsBitset(), BitsetType::kArray));
+ ASSERT(SEMANTIC(bound->AsBitset()) == SEMANTIC(BitsetType::kArray));
ArrayHandle type = Config::template cast<ArrayType>(
StructuralType::New(StructuralType::kArrayTag, 2, region));
type->Set(0, bound);
@@ -790,7 +782,7 @@
static FunctionHandle New(
TypeHandle result, TypeHandle receiver, TypeHandle bound,
int arity, Region* region) {
- ASSERT(BitsetType::Is(bound->AsBitset(), BitsetType::kFunction));
+ ASSERT(SEMANTIC(bound->AsBitset()) == SEMANTIC(BitsetType::kFunction));
FunctionHandle type = Config::template cast<FunctionType>(
StructuralType::New(StructuralType::kFunctionTag, 3 + arity,
region));
type->Set(0, bound);
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.