Revert "Reland "More tests for Union & Intersect""

Need to reproduce wrong result only occurring with ASAN.

TBR=jarin@chromium.org
BUG=

Review URL: https://codereview.chromium.org/236873002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20712 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
rossberg@chromium.org 2014-04-14 09:46:56 +00:00
parent b44598b387
commit b73257b7a3
3 changed files with 346 additions and 449 deletions

View File

@ -306,9 +306,6 @@ bool TypeImpl<Config>::SlowIs(TypeImpl* that) {
template<class Config>
bool TypeImpl<Config>::NowIs(TypeImpl* that) {
// TODO(rossberg): this is incorrect for
// Union(Constant(V), T)->NowIs(Class(M))
// but fuzzing does not cover that!
DisallowHeapAllocation no_allocation;
if (this->IsConstant()) {
i::Object* object = *this->AsConstant();
@ -438,12 +435,12 @@ typename TypeImpl<Config>::TypeHandle TypeImpl<Config>::Union(
size += (type2->IsUnion() ? Config::struct_length(type2->AsUnion()) : 1);
}
int bitset = type1->GlbBitset() | type2->GlbBitset();
if (bitset != kNone) ++size;
if (IsInhabited(bitset)) ++size;
ASSERT(size >= 1);
StructHandle unioned = Config::struct_create(kUnionTag, size, region);
size = 0;
if (bitset != kNone) {
if (IsInhabited(bitset)) {
Config::struct_set(unioned, size++, Config::from_bitset(bitset, region));
}
size = ExtendUnion(unioned, type1, size);
@ -505,20 +502,21 @@ typename TypeImpl<Config>::TypeHandle TypeImpl<Config>::Intersect(
}
// Slow case: may need to produce a Unioned object.
int size = 0;
int size = INT_MAX;
if (!type1->IsBitset()) {
size += (type1->IsUnion() ? Config::struct_length(type1->AsUnion()) : 1);
size = (type1->IsUnion() ? Config::struct_length(type1->AsUnion()) : 1);
}
if (!type2->IsBitset()) {
size += (type2->IsUnion() ? Config::struct_length(type2->AsUnion()) : 1);
size = Min(size,
type2->IsUnion() ? Config::struct_length(type2->AsUnion()) : 1);
}
int bitset = type1->GlbBitset() & type2->GlbBitset();
if (bitset != kNone) ++size;
if (IsInhabited(bitset)) ++size;
ASSERT(size >= 1);
StructHandle unioned = Config::struct_create(kUnionTag, size, region);
size = 0;
if (bitset != kNone) {
if (IsInhabited(bitset)) {
Config::struct_set(unioned, size++, Config::from_bitset(bitset, region));
}
size = ExtendIntersection(unioned, type1, type2, size);

View File

@ -101,11 +101,11 @@ namespace internal {
// PROPERTIES
//
// Various formal properties hold for constructors, operators, and predicates
// over types. For example, constructors are injective, subtyping is a complete
// partial order, union and intersection satisfy the usual algebraic properties.
// over types. For example, constructors are injective, subtyping is a partial
// order, and union and intersection satisfy the usual algebraic properties.
//
// See test/cctest/test-types.cc for a comprehensive executable specification,
// especially with respect to the properties of the more exotic 'temporal'
// especially with respect to the proeprties of the more exotic 'temporal'
// constructors and predicates (those prefixed 'Now').
//
// IMPLEMENTATION

File diff suppressed because it is too large Load Diff