Revision: 22903
Author: [email protected]
Date: Wed Aug 6 08:28:01 2014 UTC
Log: Remove non-trivial subtyping between bitset and non-bitset types.
[email protected]
BUG=
Review URL: https://codereview.chromium.org/444503005
http://code.google.com/p/v8/source/detail?r=22903
Modified:
/branches/bleeding_edge/src/types.cc
=======================================
--- /branches/bleeding_edge/src/types.cc Tue Aug 5 13:19:32 2014 UTC
+++ /branches/bleeding_edge/src/types.cc Wed Aug 6 08:28:01 2014 UTC
@@ -21,26 +21,9 @@
return type->AsBitset();
} else if (type->IsUnion()) {
UnionHandle unioned = handle(type->AsUnion());
- int bitset = kNone;
- for (int i = 0; i < unioned->Length(); ++i) {
- bitset |= unioned->Get(i)->BitsetGlb();
- }
- return bitset;
- } else if (type->IsClass()) {
- // Little hack to avoid the need for a region for handlification
here...
- return REPRESENTATION(Config::is_class(type)
- ? Lub(*Config::as_class(type))
- : type->AsClass()->Bound(NULL)->AsBitset());
- } else if (type->IsConstant()) {
- return REPRESENTATION(type->AsConstant()->Bound()->AsBitset());
- } else if (type->IsContext()) {
- return REPRESENTATION(type->AsContext()->Bound()->AsBitset());
- } else if (type->IsArray()) {
- return REPRESENTATION(type->AsArray()->Bound()->AsBitset());
- } else if (type->IsFunction()) {
- return REPRESENTATION(type->AsFunction()->Bound()->AsBitset());
+ DCHECK(unioned->Wellformed());
+ return unioned->Get(0)->BitsetGlb(); // Other BitsetGlb's are kNone
anyway.
} else {
- UNREACHABLE();
return kNone;
}
}
@@ -260,10 +243,6 @@
if (that->IsBitset()) {
return BitsetType::Is(BitsetType::Lub(this), that->AsBitset());
}
- if (this->IsBitset() && SEMANTIC(this->AsBitset()) == BitsetType::kNone)
{
- // Bitsets only have non-bitset supertypes along the representation
axis.
- return BitsetType::Is(this->AsBitset(), that->BitsetGlb());
- }
if (that->IsClass()) {
return this->IsClass()
@@ -553,26 +532,6 @@
}
return size;
}
-
-
-// If bitset is subsumed by another entry in the result, remove it.
-// (Only bitsets with empty semantic axis can be subtypes of non-bitsets.)
-template<class Config>
-int TypeImpl<Config>::NormalizeUnion(UnionHandle result, int size, int
bitset) {
- 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)) {
- for (int j = 1; j < size; ++j) {
- result->Set(j - 1, result->Get(j));
- }
- --size;
- break;
- }
- }
- }
- return size;
-}
// Union is O(1) on simple bitsets, but O(n*m) on structured unions.
@@ -613,7 +572,6 @@
}
size = ExtendUnion(unioned, size, type1, type2, false, region);
size = ExtendUnion(unioned, size, type2, type1, false, region);
- size = NormalizeUnion(unioned, size, bitset);
if (size == 1) {
return unioned->Get(0);
@@ -663,7 +621,6 @@
}
size = ExtendUnion(unioned, size, type1, type2, true, region);
size = ExtendUnion(unioned, size, type2, type1, true, region);
- size = NormalizeUnion(unioned, size, bitset);
if (size == 0) {
return None(region);
--
--
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.