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

Unified Diff: src/types.h

Issue 148153010: Synchronize with r15701. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 11 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/typedarray.js ('k') | src/types.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/types.h
diff --git a/src/types.h b/src/types.h
index bc6e580a7515b990cf8137ee5a27205a86117641..b2eb60c69203b990a575346ab7eb41a3001405c0 100644
--- a/src/types.h
+++ b/src/types.h
@@ -291,6 +291,40 @@ class Type : public Object {
}
};
+
+// A simple struct to represent a pair of lower/upper type bounds.
+struct Bounds {
+ Handle<Type> lower;
+ Handle<Type> upper;
+
+ Bounds() {}
+ Bounds(Handle<Type> l, Handle<Type> u) : lower(l), upper(u) {}
+ Bounds(Type* l, Type* u, Isolate* isl) : lower(l, isl), upper(u, isl) {}
+ explicit Bounds(Handle<Type> t) : lower(t), upper(t) {}
+ Bounds(Type* t, Isolate* isl) : lower(t, isl), upper(t, isl) {}
+
+ // Meet: both b1 and b2 are known to hold.
+ static Bounds Both(Bounds b1, Bounds b2, Isolate* isl) {
+ return Bounds(
+ handle(Type::Union(b1.lower, b2.lower), isl),
+ handle(Type::Intersect(b1.upper, b2.upper), isl));
+ }
+
+ // Join: either b1 or b2 is known to hold.
+ static Bounds Either(Bounds b1, Bounds b2, Isolate* isl) {
+ return Bounds(
+ handle(Type::Intersect(b1.lower, b2.lower), isl),
+ handle(Type::Union(b1.upper, b2.upper), isl));
+ }
+
+ static Bounds NarrowLower(Bounds b, Handle<Type> t, Isolate* isl) {
+ return Bounds(handle(Type::Union(b.lower, t), isl), b.upper);
+ }
+ static Bounds NarrowUpper(Bounds b, Handle<Type> t, Isolate* isl) {
+ return Bounds(b.lower, handle(Type::Intersect(b.upper, t), isl));
+ }
+};
+
} } // namespace v8::internal
#endif // V8_TYPES_H_
« no previous file with comments | « src/typedarray.js ('k') | src/types.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698