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

Side by Side Diff: src/types.h

Issue 145083007: Type representation converter (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 if (this->IsBitset()) return Iterator<i::Object>(); 236 if (this->IsBitset()) return Iterator<i::Object>();
237 return Iterator<i::Object>(Config::handle(this)); 237 return Iterator<i::Object>(Config::handle(this));
238 } 238 }
239 239
240 static TypeImpl* cast(typename Config::Base* object) { 240 static TypeImpl* cast(typename Config::Base* object) {
241 TypeImpl* t = static_cast<TypeImpl*>(object); 241 TypeImpl* t = static_cast<TypeImpl*>(object);
242 ASSERT(t->IsBitset() || t->IsClass() || t->IsConstant() || t->IsUnion()); 242 ASSERT(t->IsBitset() || t->IsClass() || t->IsConstant() || t->IsUnion());
243 return t; 243 return t;
244 } 244 }
245 245
246 template<class OtherTypeImpl>
247 static TypeHandle Convert(
248 typename OtherTypeImpl::TypeHandle type, Region* region);
249
246 #ifdef OBJECT_PRINT 250 #ifdef OBJECT_PRINT
247 void TypePrint(); 251 void TypePrint();
248 void TypePrint(FILE* out); 252 void TypePrint(FILE* out);
249 #endif 253 #endif
250 254
251 private: 255 private:
252 template<class> friend class Iterator; 256 template<class> friend class Iterator;
257 template<class> friend class TypeImpl;
253 258
254 // A union is a fixed array containing types. Invariants: 259 // A union is a fixed array containing types. Invariants:
255 // - its length is at least 2 260 // - its length is at least 2
256 // - at most one field is a bitset, and it must go into index 0 261 // - at most one field is a bitset, and it must go into index 0
257 // - no field is a union 262 // - no field is a union
258 typedef typename Config::Unioned Unioned; 263 typedef typename Config::Unioned Unioned;
259 typedef typename Config::template Handle<Unioned>::type UnionedHandle; 264 typedef typename Config::template Handle<Unioned>::type UnionedHandle;
260 265
261 enum { 266 enum {
262 #define DECLARE_TYPE(type, value) k##type = (value), 267 #define DECLARE_TYPE(type, value) k##type = (value),
263 BITSET_TYPE_LIST(DECLARE_TYPE) 268 BITSET_TYPE_LIST(DECLARE_TYPE)
264 #undef DECLARE_TYPE 269 #undef DECLARE_TYPE
265 kUnusedEOL = 0 270 kUnusedEOL = 0
266 }; 271 };
267 272
268 bool IsNone() { return this == None(); } 273 bool IsNone() { return this == None(); }
269 bool IsAny() { return this == Any(); } 274 bool IsAny() { return this == Any(); }
270 bool IsBitset() { return Config::is_bitset(this); } 275 bool IsBitset() { return Config::is_bitset(this); }
271 bool IsUnion() { return Config::is_union(this); } 276 bool IsUnion() { return Config::is_union(this); }
272 int AsBitset() { return Config::as_bitset(this); } 277 int AsBitset() { return Config::as_bitset(this); }
273 UnionedHandle AsUnion() { return Config::as_union(this); } 278 UnionedHandle AsUnion() { return Config::as_union(this); }
274 279
280 static int UnionLength(UnionedHandle unioned) {
281 return Config::union_length(unioned);
282 }
283 static TypeHandle UnionGet(UnionedHandle unioned, int i) {
284 return Config::union_get(unioned, i);
285 }
286
275 bool SlowIs(TypeImpl* that); 287 bool SlowIs(TypeImpl* that);
276 288
277 int LubBitset(); // least upper bound that's a bitset 289 int LubBitset(); // least upper bound that's a bitset
278 int GlbBitset(); // greatest lower bound that's a bitset 290 int GlbBitset(); // greatest lower bound that's a bitset
279 291
280 static int LubBitset(i::Object* value); 292 static int LubBitset(i::Object* value);
281 static int LubBitset(i::Map* map); 293 static int LubBitset(i::Map* map);
282 294
283 bool InUnion(UnionedHandle unioned, int current_size); 295 bool InUnion(UnionedHandle unioned, int current_size);
284 static int ExtendUnion( 296 static int ExtendUnion(
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 return BoundsImpl(lower, upper); 561 return BoundsImpl(lower, upper);
550 } 562 }
551 }; 563 };
552 564
553 typedef BoundsImpl<ZoneTypeConfig> Bounds; 565 typedef BoundsImpl<ZoneTypeConfig> Bounds;
554 566
555 567
556 } } // namespace v8::internal 568 } } // namespace v8::internal
557 569
558 #endif // V8_TYPES_H_ 570 #endif // V8_TYPES_H_
OLDNEW
« no previous file with comments | « no previous file | src/types.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698