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

Side by Side 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, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/typedarray.js ('k') | src/types.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 return # type; 284 return # type;
285 PRIMITIVE_TYPE_LIST(PRINT_PRIMITIVE_TYPE) 285 PRIMITIVE_TYPE_LIST(PRINT_PRIMITIVE_TYPE)
286 #undef PRINT_PRIMITIVE_TYPE 286 #undef PRINT_PRIMITIVE_TYPE
287 default: 287 default:
288 UNREACHABLE(); 288 UNREACHABLE();
289 return "InvalidType"; 289 return "InvalidType";
290 } 290 }
291 } 291 }
292 }; 292 };
293 293
294
295 // A simple struct to represent a pair of lower/upper type bounds.
296 struct Bounds {
297 Handle<Type> lower;
298 Handle<Type> upper;
299
300 Bounds() {}
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) {}
303 explicit Bounds(Handle<Type> t) : lower(t), upper(t) {}
304 Bounds(Type* t, Isolate* isl) : lower(t, isl), upper(t, isl) {}
305
306 // Meet: both b1 and b2 are known to hold.
307 static Bounds Both(Bounds b1, Bounds b2, Isolate* isl) {
308 return Bounds(
309 handle(Type::Union(b1.lower, b2.lower), isl),
310 handle(Type::Intersect(b1.upper, b2.upper), isl));
311 }
312
313 // Join: either b1 or b2 is known to hold.
314 static Bounds Either(Bounds b1, Bounds b2, Isolate* isl) {
315 return Bounds(
316 handle(Type::Intersect(b1.lower, b2.lower), isl),
317 handle(Type::Union(b1.upper, b2.upper), isl));
318 }
319
320 static Bounds NarrowLower(Bounds b, Handle<Type> t, Isolate* isl) {
321 return Bounds(handle(Type::Union(b.lower, t), isl), b.upper);
322 }
323 static Bounds NarrowUpper(Bounds b, Handle<Type> t, Isolate* isl) {
324 return Bounds(b.lower, handle(Type::Intersect(b.upper, t), isl));
325 }
326 };
327
294 } } // namespace v8::internal 328 } } // namespace v8::internal
295 329
296 #endif // V8_TYPES_H_ 330 #endif // V8_TYPES_H_
OLDNEW
« 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