Chromium Code Reviews| Index: src/types.cc |
| diff --git a/src/types.cc b/src/types.cc |
| index 22a108b7206b0bd657ae57e90af4c20a11770190..4ca0042ff2f5b60dc6338421c7a2c590a9668693 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()) || type2->SameValue(Type::Any())) |
| + return Type::Any(); |
|
Jakob Kummerow
2013/06/20 14:08:55
nit: {} please, and 2-space indentation.
|
| + 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()) || type2->SameValue(Type::None())) |
| + return Type::None(); |
|
Jakob Kummerow
2013/06/20 14:08:55
nit: {} please, and 2-space indentation.
|
| + 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; |