OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 struct Bounds { | 296 struct Bounds { |
297 Handle<Type> lower; | 297 Handle<Type> lower; |
298 Handle<Type> upper; | 298 Handle<Type> upper; |
299 | 299 |
300 Bounds() {} | 300 Bounds() {} |
301 Bounds(Handle<Type> l, Handle<Type> u) : lower(l), upper(u) {} | 301 Bounds(Handle<Type> l, Handle<Type> u) : lower(l), upper(u) {} |
302 Bounds(Type* l, Type* u, Isolate* isl) : lower(l, isl), upper(u, isl) {} | 302 Bounds(Type* l, Type* u, Isolate* isl) : lower(l, isl), upper(u, isl) {} |
303 explicit Bounds(Handle<Type> t) : lower(t), upper(t) {} | 303 explicit Bounds(Handle<Type> t) : lower(t), upper(t) {} |
304 Bounds(Type* t, Isolate* isl) : lower(t, isl), upper(t, isl) {} | 304 Bounds(Type* t, Isolate* isl) : lower(t, isl), upper(t, isl) {} |
305 | 305 |
306 // Unrestricted bounds. | |
307 static Bounds Unbounded(Isolate* isl) { | |
308 return Bounds(Type::None(), Type::Any(), isl); | |
309 } | |
310 | |
311 // Meet: both b1 and b2 are known to hold. | 306 // Meet: both b1 and b2 are known to hold. |
312 static Bounds Both(Bounds b1, Bounds b2, Isolate* isl) { | 307 static Bounds Both(Bounds b1, Bounds b2, Isolate* isl) { |
313 return Bounds( | 308 return Bounds( |
314 handle(Type::Union(b1.lower, b2.lower), isl), | 309 handle(Type::Union(b1.lower, b2.lower), isl), |
315 handle(Type::Intersect(b1.upper, b2.upper), isl)); | 310 handle(Type::Intersect(b1.upper, b2.upper), isl)); |
316 } | 311 } |
317 | 312 |
318 // Join: either b1 or b2 is known to hold. | 313 // Join: either b1 or b2 is known to hold. |
319 static Bounds Either(Bounds b1, Bounds b2, Isolate* isl) { | 314 static Bounds Either(Bounds b1, Bounds b2, Isolate* isl) { |
320 return Bounds( | 315 return Bounds( |
321 handle(Type::Intersect(b1.lower, b2.lower), isl), | 316 handle(Type::Intersect(b1.lower, b2.lower), isl), |
322 handle(Type::Union(b1.upper, b2.upper), isl)); | 317 handle(Type::Union(b1.upper, b2.upper), isl)); |
323 } | 318 } |
324 | 319 |
325 static Bounds NarrowLower(Bounds b, Handle<Type> t, Isolate* isl) { | 320 static Bounds NarrowLower(Bounds b, Handle<Type> t, Isolate* isl) { |
326 return Bounds(handle(Type::Union(b.lower, t), isl), b.upper); | 321 return Bounds(handle(Type::Union(b.lower, t), isl), b.upper); |
327 } | 322 } |
328 static Bounds NarrowUpper(Bounds b, Handle<Type> t, Isolate* isl) { | 323 static Bounds NarrowUpper(Bounds b, Handle<Type> t, Isolate* isl) { |
329 return Bounds(b.lower, handle(Type::Intersect(b.upper, t), isl)); | 324 return Bounds(b.lower, handle(Type::Intersect(b.upper, t), isl)); |
330 } | 325 } |
331 }; | 326 }; |
332 | 327 |
333 } } // namespace v8::internal | 328 } } // namespace v8::internal |
334 | 329 |
335 #endif // V8_TYPES_H_ | 330 #endif // V8_TYPES_H_ |
OLD | NEW |