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

Side by Side Diff: src/types.h

Issue 219523003: Provide Type::Contains methods. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Allow raw pointers Created 6 years, 8 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/ic.cc ('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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 static TypeHandle Union(TypeHandle type1, TypeHandle type2, Region* reg); 239 static TypeHandle Union(TypeHandle type1, TypeHandle type2, Region* reg);
240 static TypeHandle Intersect(TypeHandle type1, TypeHandle type2, Region* reg); 240 static TypeHandle Intersect(TypeHandle type1, TypeHandle type2, Region* reg);
241 241
242 static TypeHandle Of(i::Handle<i::Object> value, Region* region) { 242 static TypeHandle Of(i::Handle<i::Object> value, Region* region) {
243 return Config::from_bitset(LubBitset(*value), region); 243 return Config::from_bitset(LubBitset(*value), region);
244 } 244 }
245 245
246 bool Is(TypeImpl* that) { return this == that || this->SlowIs(that); } 246 bool Is(TypeImpl* that) { return this == that || this->SlowIs(that); }
247 template<class TypeHandle> 247 template<class TypeHandle>
248 bool Is(TypeHandle that) { return this->Is(*that); } 248 bool Is(TypeHandle that) { return this->Is(*that); }
249
249 bool Maybe(TypeImpl* that); 250 bool Maybe(TypeImpl* that);
250 template<class TypeHandle> 251 template<class TypeHandle>
251 bool Maybe(TypeHandle that) { return this->Maybe(*that); } 252 bool Maybe(TypeHandle that) { return this->Maybe(*that); }
252 253
254 // Equivalent to Constant(value)->Is(this), but avoiding allocation.
255 bool Contains(i::Object* val);
256 bool Contains(i::Handle<i::Object> val) { return this->Contains(*val); }
257
253 // State-dependent versions of Of and Is that consider subtyping between 258 // State-dependent versions of Of and Is that consider subtyping between
254 // a constant and its map class. 259 // a constant and its map class.
255 static TypeHandle OfCurrently(i::Handle<i::Object> value, Region* region); 260 static TypeHandle NowOf(i::Handle<i::Object> value, Region* region);
256 bool IsCurrently(TypeImpl* that); 261 bool NowIs(TypeImpl* that);
257 template<class TypeHandle> 262 template<class TypeHandle>
258 bool IsCurrently(TypeHandle that) { return this->IsCurrently(*that); } 263 bool NowIs(TypeHandle that) { return this->NowIs(*that); }
264 bool NowContains(i::Object* val);
265 bool NowContains(i::Handle<i::Object> val) { return this->NowContains(*val); }
259 266
260 bool IsClass() { return Config::is_class(this); } 267 bool IsClass() { return Config::is_class(this); }
261 bool IsConstant() { return Config::is_constant(this); } 268 bool IsConstant() { return Config::is_constant(this); }
262 i::Handle<i::Map> AsClass() { return Config::as_class(this); } 269 i::Handle<i::Map> AsClass() { return Config::as_class(this); }
263 i::Handle<i::Object> AsConstant() { return Config::as_constant(this); } 270 i::Handle<i::Object> AsConstant() { return Config::as_constant(this); }
264 271
265 int NumClasses(); 272 int NumClasses();
266 int NumConstants(); 273 int NumConstants();
267 274
268 template<class T> 275 template<class T>
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 return that.lower->Is(this->lower) && this->upper->Is(that.upper); 647 return that.lower->Is(this->lower) && this->upper->Is(that.upper);
641 } 648 }
642 }; 649 };
643 650
644 typedef BoundsImpl<ZoneTypeConfig> Bounds; 651 typedef BoundsImpl<ZoneTypeConfig> Bounds;
645 652
646 653
647 } } // namespace v8::internal 654 } } // namespace v8::internal
648 655
649 #endif // V8_TYPES_H_ 656 #endif // V8_TYPES_H_
OLDNEW
« no previous file with comments | « src/ic.cc ('k') | src/types.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698