Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Unified Diff: src/types.cc

Issue 17468003: Use AST's type field and merge types for unary, binary & compare ICs (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comments Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/type-info.cc ('k') | src/typing.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « src/type-info.cc ('k') | src/typing.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698