| Index: src/types.cc
|
| diff --git a/src/types.cc b/src/types.cc
|
| index 22a108b7206b0bd657ae57e90af4c20a11770190..a3489e24609e3fa651f670da9394b9260feb7395 100644
|
| --- a/src/types.cc
|
| +++ b/src/types.cc
|
| @@ -336,6 +336,12 @@ Type* Type::Union(Handle<Type> type1, Handle<Type> type2) {
|
| return from_bitset(type1->as_bitset() | type2->as_bitset());
|
| }
|
|
|
| + // Fast case: top or bottom types.
|
| + if (type1->SameValue(Type::Any())) return *type1;
|
| + if (type2->SameValue(Type::Any())) return *type2;
|
| + if (type1->SameValue(Type::None())) return *type2;
|
| + if (type2->SameValue(Type::None())) return *type1;
|
| +
|
| // Semi-fast case: Unioned objects are neither involved nor produced.
|
| if (!(type1->is_union() || type2->is_union())) {
|
| if (type1->Is(type2)) return *type2;
|
| @@ -406,6 +412,12 @@ Type* Type::Intersect(Handle<Type> type1, Handle<Type> type2) {
|
| return from_bitset(type1->as_bitset() & type2->as_bitset());
|
| }
|
|
|
| + // Fast case: top or bottom types.
|
| + if (type1->SameValue(Type::None())) return *type1;
|
| + if (type2->SameValue(Type::None())) return *type2;
|
| + if (type1->SameValue(Type::Any())) return *type2;
|
| + if (type2->SameValue(Type::Any())) return *type1;
|
| +
|
| // Semi-fast case: Unioned objects are neither involved nor produced.
|
| if (!(type1->is_union() || type2->is_union())) {
|
| if (type1->Is(type2)) return *type1;
|
|
|