| Index: src/types.h
|
| diff --git a/src/types.h b/src/types.h
|
| index 31aa9512f4c3a44433412fc836df800ea5efe524..cd3c920642596e32f588a354dea1997d507ff20c 100644
|
| --- a/src/types.h
|
| +++ b/src/types.h
|
| @@ -274,6 +274,40 @@ class Type : public Object {
|
| Handle<Unioned> unioned, Handle<Type> type, int current_size);
|
| };
|
|
|
| +
|
| +// 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_
|
|
|