156 #define MASK_BITSET_TYPE_LIST(V) \
157 V(Representation, 0xff800000u) \
158 V(Semantic, 0x007ffffeu)
160 #define REPRESENTATION(k) ((k) & BitsetType::kRepresentation)
161 #define SEMANTIC(k) ((k) & BitsetType::kSemantic)
163 #define REPRESENTATION_BITSET_TYPE_LIST(V) \
165 V(UntaggedInt1, 1u << 23 | kSemantic) \
166 V(UntaggedInt8, 1u << 24 | kSemantic) \
167 V(UntaggedInt16, 1u << 25 | kSemantic) \
168 V(UntaggedInt32, 1u << 26 | kSemantic) \
169 V(UntaggedFloat32, 1u << 27 | kSemantic) \
170 V(UntaggedFloat64, 1u << 28 | kSemantic) \
171 V(UntaggedPtr, 1u << 29 | kSemantic) \
172 V(TaggedInt, 1u << 30 | kSemantic) \
173 V(TaggedPtr, 1u << 31 | kSemantic) \
175 V(UntaggedInt, kUntaggedInt1 | kUntaggedInt8 | \
176 kUntaggedInt16 | kUntaggedInt32) \
177 V(UntaggedFloat, kUntaggedFloat32 | kUntaggedFloat64) \
178 V(UntaggedNumber, kUntaggedInt | kUntaggedFloat) \
179 V(Untagged, kUntaggedNumber | kUntaggedPtr) \
180 V(Tagged, kTaggedInt | kTaggedPtr)
182 #define SEMANTIC_BITSET_TYPE_LIST(V) \
183 V(Null, 1u << 1 | REPRESENTATION(kTaggedPtr)) \
184 V(Undefined, 1u << 2 | REPRESENTATION(kTaggedPtr)) \
185 V(Boolean, 1u << 3 | REPRESENTATION(kTaggedPtr)) \
186 V(UnsignedSmall, 1u << 4 | REPRESENTATION(kTagged | kUntaggedNumber)) \
187 V(OtherSignedSmall, 1u << 5 | REPRESENTATION(kTagged | kUntaggedNumber)) \
188 V(OtherUnsigned31, 1u << 6 | REPRESENTATION(kTagged | kUntaggedNumber)) \
189 V(OtherUnsigned32, 1u << 7 | REPRESENTATION(kTagged | kUntaggedNumber)) \
190 V(OtherSigned32, 1u << 8 | REPRESENTATION(kTagged | kUntaggedNumber)) \
191 V(MinusZero, 1u << 9 | REPRESENTATION(kTagged | kUntaggedNumber)) \
192 V(NaN, 1u << 10 | REPRESENTATION(kTagged | kUntaggedNumber)) \
193 V(OtherNumber, 1u << 11 | REPRESENTATION(kTagged | kUntaggedNumber)) \
194 V(Symbol, 1u << 12 | REPRESENTATION(kTaggedPtr)) \
195 V(InternalizedString, 1u << 13 | REPRESENTATION(kTaggedPtr)) \
196 V(OtherString, 1u << 14 | REPRESENTATION(kTaggedPtr)) \
197 V(Undetectable, 1u << 15 | REPRESENTATION(kTaggedPtr)) \
198 V(Array, 1u << 16 | REPRESENTATION(kTaggedPtr)) \
199 V(Buffer, 1u << 17 | REPRESENTATION(kTaggedPtr)) \
200 V(Function, 1u << 18 | REPRESENTATION(kTaggedPtr)) \
201 V(RegExp, 1u << 19 | REPRESENTATION(kTaggedPtr)) \
202 V(OtherObject, 1u << 20 | REPRESENTATION(kTaggedPtr)) \
203 V(Proxy, 1u << 21 | REPRESENTATION(kTaggedPtr)) \
204 V(Internal, 1u << 22 | REPRESENTATION(kTagged | kUntagged)) \
206 V(SignedSmall, kUnsignedSmall | kOtherSignedSmall) \
207 V(Signed32, kSignedSmall | kOtherUnsigned31 | kOtherSigned32) \
208 V(Unsigned32, kUnsignedSmall | kOtherUnsigned31 | kOtherUnsigned32) \
209 V(Integral32, kSigned32 | kUnsigned32) \
210 V(OrderedNumber, kIntegral32 | kMinusZero | kOtherNumber) \
211 V(Number, kOrderedNumber | kNaN) \
212 V(String, kInternalizedString | kOtherString) \
213 V(UniqueName, kSymbol | kInternalizedString) \
214 V(Name, kSymbol | kString) \
215 V(NumberOrString, kNumber | kString) \
216 V(Primitive, kNumber | kName | kBoolean | kNull | kUndefined) \
217 V(DetectableObject, kArray | kFunction | kRegExp | kOtherObject) \
218 V(DetectableReceiver, kDetectableObject | kProxy) \
219 V(Detectable, kDetectableReceiver | kNumber | kName) \
220 V(Object, kDetectableObject | kUndetectable) \
221 V(Receiver, kObject | kProxy) \
222 V(NonNumber, kBoolean | kName | kNull | kReceiver | \
223 kUndefined | kInternal) \
247 #define PROPER_BITSET_TYPE_LIST(V) \
248 REPRESENTATION_BITSET_TYPE_LIST(V) \
249 SEMANTIC_BITSET_TYPE_LIST(V)
251 #define BITSET_TYPE_LIST(V) \
252 MASK_BITSET_TYPE_LIST(V) \
253 PROPER_BITSET_TYPE_LIST(V)
288 template<
class Config>
317 #define DEFINE_TYPE_CONSTRUCTOR(type, value) \
318 static TypeImpl* type() { \
319 return BitsetType::New(BitsetType::k##type); \
321 static TypeHandle type(Region* region) { \
322 return BitsetType::New(BitsetType::k##type, region); \
325 #undef DEFINE_TYPE_CONSTRUCTOR
348 return Function(result, Any(region), 0, region);
353 function->InitParameter(0, param0);
359 function->InitParameter(0, param0);
360 function->InitParameter(1, param1);
367 function->InitParameter(0, param0);
368 function->InitParameter(1, param1);
369 function->InitParameter(2, param2);
383 return Of(*value, region);
391 template<
class TypeHandle>
395 template<
class TypeHandle>
399 template<
class TypeHandle>
410 return NowOf(*value, region);
413 template<
class TypeHandle>
423 return Config::is_class(
this)
471 static inline TypeImpl*
cast(
typename Config::Base*
object);
473 template<
class OtherTypeImpl>
475 typename OtherTypeImpl::TypeHandle type,
Region* region);
504 bool IsAny() {
return this == Any(); }
505 bool IsBitset() {
return Config::is_bitset(
this); }
510 return static_cast<BitsetType*
>(
this)->Bitset();
537 static Limits
Intersect(Limits lhs, Limits rhs);
538 static Limits
Union(Limits lhs, Limits rhs);
539 static bool Overlap(RangeType* lhs, RangeType* rhs);
548 template<
class TypeHandle>
563 template<
class Config>
569 #define DECLARE_TYPE(type, value) k##type = (value),
579 return Config::from_bitset(bits);
583 return Config::from_bitset(bits, region);
589 return bits & kSemantic;
593 return (bits1 | bits2) == bits2;
602 static bitset Lub(
double value);
611 static void Print(
bitset);
636 template<
class Config>
654 return Config::struct_length(Config::as_struct(
this));
657 DCHECK(0 <=
i && i < this->Length());
658 return Config::struct_get(Config::as_struct(
this),
i);
661 DCHECK(0 <=
i && i < this->Length());
662 Config::struct_set(Config::as_struct(
this),
i, type);
665 DCHECK(2 <= length && length <= this->Length());
666 Config::struct_shrink(Config::as_struct(
this), length);
669 DCHECK(0 <=
i && i < this->Length());
670 return Config::template struct_get_value<V>(Config::as_struct(
this),
i);
673 DCHECK(0 <=
i && i < this->Length());
674 Config::struct_set_value(Config::as_struct(
this),
i, x);
679 return Config::from_struct(Config::struct_create(tag, length, region));
691 template<
class Config>
695 return Config::template cast<UnionType>(
711 template<
class Config>
715 return Config::is_class(
this) ?
720 return Config::is_class(
this) ? Config::as_class(
this) :
721 this->
template GetValue<i::Map>(1);
726 Config::template cast<ClassType>(Config::from_class(
map, region));
727 if (!type->IsClass()) {
728 type = Config::template cast<ClassType>(
731 type->SetValue(1,
map);
746 template<
class Config>
754 StructuralType::New(StructuralType::kConstantTag, 2, region));
755 type->Set(0, BitsetType::New(BitsetType::Lub(*value), region));
756 type->SetValue(1, value);
772 template<
class Config>
782 RangeHandle type = Config::template cast<RangeType>(
783 StructuralType::New(StructuralType::kRangeTag, 3, region));
784 type->Set(0, BitsetType::New(BitsetType::Lub(
Limits(
min, max)), region));
785 type->SetValue(1,
min);
786 type->SetValue(2, max);
791 return New(lim.
min, lim.
max, region);
806 template<
class Config>
813 StructuralType::New(StructuralType::kContextTag, 1, region));
828 template<
class Config>
834 ArrayHandle type = Config::template cast<ArrayType>(
835 StructuralType::New(StructuralType::kArrayTag, 1, region));
836 type->Set(0, element);
850 template<
class Config>
853 int Arity() {
return this->Length() - 2; }
863 StructuralType::New(StructuralType::kFunctionTag, 2 + arity, region));
864 type->Set(0, result);
865 type->Set(1, receiver);
879 template<
class Config>
template<
class T>
882 bool Done()
const {
return index_ < 0; }
913 template<
class T>
static inline T*
handle(
T* type);
914 template<
class T>
static inline T* cast(
Type* type);
916 static inline bool is_bitset(
Type* type);
917 static inline bool is_class(
Type* type);
918 static inline bool is_struct(
Type* type,
int tag);
927 static inline Type* from_struct(
Struct* structured);
929 static inline Struct* struct_create(
int tag,
int length,
Zone* zone);
930 static inline void struct_shrink(
Struct* structure,
int length);
931 static inline int struct_tag(
Struct* structure);
932 static inline int struct_length(
Struct* structure);
933 static inline Type* struct_get(
Struct* structure,
int i);
934 static inline void struct_set(
Struct* structure,
int i,
Type* type);
937 template<
class V>
static inline void struct_set_value(
958 static inline bool is_bitset(
Type* type);
959 static inline bool is_class(
Type* type);
960 static inline bool is_struct(
Type* type,
int tag);
973 int tag,
int length,
Isolate* isolate);
978 static inline void struct_set(
984 static inline void struct_set_value(
994 template<
class Config>
1006 DCHECK(lower->Is(upper));
1043 return that.
lower->Is(this->lower) && this->upper->Is(that.
upper);
static ArrayType * cast(TypeImpl *type)
static ArrayHandle New(TypeHandle element, Region *region)
static size_t BitsetMinsSize()
static bool Is(bitset bits1, bitset bits2)
static TypeImpl * New(bitset bits)
static bool IsInhabited(bitset bits)
static bitset Lub(TypeImpl *type)
static TypeHandle New(bitset bits, Region *region)
static const BitsetMin * BitsetMins()
static bitset Glb(TypeImpl *type)
i::Handle< i::Map > Map()
static ClassHandle New(i::Handle< i::Map > map, Region *region)
TypeHandle Bound(Region *region)
static ClassType * cast(TypeImpl *type)
static ConstantHandle New(i::Handle< i::Object > value, Region *region)
i::Handle< i::Object > Value()
static ConstantType * cast(TypeImpl *type)
static ContextHandle New(TypeHandle outer, Region *region)
static ContextType * cast(TypeImpl *type)
static FunctionHandle New(TypeHandle result, TypeHandle receiver, int arity, Region *region)
void InitParameter(int i, TypeHandle type)
static FunctionType * cast(TypeImpl *type)
TypeHandle Parameter(int i)
Iterator(TypeHandle type)
i::Handle< i::Object > Min()
i::Handle< i::Object > Max()
static RangeHandle New(Limits lim, Region *region)
static RangeType * cast(TypeImpl *type)
static RangeHandle New(i::Handle< i::Object > min, i::Handle< i::Object > max, Region *region)
void SetValue(int i, i::Handle< V > x)
void Set(int i, TypeHandle type)
i::Handle< V > GetValue(int i)
static TypeHandle New(Tag tag, int length, Region *region)
static UnionType * cast(TypeImpl *type)
static UnionHandle New(int length, Region *region)
static bool IsInteger(double x)
static TypeHandle Function(TypeHandle result, TypeHandle param0, TypeHandle param1, TypeHandle param2, Region *region)
Config::template Handle< ContextType >::type ContextHandle
bool Maybe(TypeHandle that)
Config::template Handle< RangeType >::type RangeHandle
Config::template Handle< FunctionType >::type FunctionHandle
static bool Contains(RangeType *lhs, RangeType *rhs)
static TypeHandle Of(double value, Region *region)
static TypeHandle NowOf(i::Handle< i::Object > value, Region *region)
static Config::template Handle< T >::type handle(T *type)
bool NowIs(TypeImpl *that)
static TypeHandle Convert(typename OtherTypeImpl::TypeHandle type, Region *region)
static FunctionHandle Function(TypeHandle result, TypeHandle receiver, int arity, Region *region)
ContextType * AsContext()
static TypeHandle NormalizeUnion(UnionHandle unioned, int size)
Config::template Handle< TypeImpl >::type TypeHandle
Config::template Handle< ArrayType >::type ArrayHandle
static TypeHandle NowOf(i::Object *value, Region *region)
ConstantType * AsConstant()
bool SimplyEquals(TypeHandle that)
static TypeHandle Of(i::Handle< i::Object > value, Region *region)
Iterator< i::Map > Classes()
static TypeHandle Array(TypeHandle element, Region *region)
bool Equals(TypeHandle that)
bool SlowIs(TypeImpl *that)
static TypeHandle Constant(i::Handle< i::Object > value, Region *region)
static bool Contains(RangeType *range, i::Object *val)
bool NowContains(i::Object *val)
bool NowContains(i::Handle< i::Object > val)
Config::template Handle< ClassType >::type ClassHandle
static TypeImpl * cast(typename Config::Base *object)
bool Contains(i::Object *val)
bool Equals(TypeImpl *that)
void PrintTo(OStream &os, PrintDimension dim=BOTH_DIMS)
bool SimplyEquals(TypeImpl *that)
static TypeHandle Intersect(TypeHandle type1, TypeHandle type2, Region *reg)
Config::template Handle< UnionType >::type UnionHandle
bool NowIs(TypeHandle that)
static TypeHandle Class(i::Handle< i::Map > map, Region *region)
static TypeHandle Function(TypeHandle result, TypeHandle param0, Region *region)
static bool IsInteger(i::Object *x)
static TypeHandle Range(i::Handle< i::Object > min, i::Handle< i::Object > max, Region *region)
static TypeHandle Function(TypeHandle result, Region *region)
Config::template Handle< ConstantType >::type ConstantHandle
FunctionType * AsFunction()
static TypeHandle Of(i::Object *value, Region *region)
static TypeHandle Function(TypeHandle result, TypeHandle param0, TypeHandle param1, Region *region)
Iterator< i::Object > Constants()
static int IntersectAux(TypeHandle type, TypeHandle other, UnionHandle result, int size, Region *region)
static TypeHandle Union(TypeHandle type1, TypeHandle type2, Region *reg)
static int AddToUnion(TypeHandle type, UnionHandle result, int size, Region *region)
static bool Overlap(RangeType *lhs, RangeType *rhs)
bool Maybe(TypeImpl *that)
static TypeHandle Context(TypeHandle outer, Region *region)
static int UpdateRange(RangeHandle type, UnionHandle result, int size, Region *region)
bool Contains(i::Handle< i::Object > val)
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf map
enable harmony numeric enable harmony object literal extensions Optimize object size
#define DCHECK(condition)
TypeImpl< ZoneTypeConfig > Type
static int min(int a, int b)
TypeImpl< HeapTypeConfig > HeapType
Handle< T > handle(T *t, Isolate *isolate)
BoundsImpl< ZoneTypeConfig > Bounds
static bool SmiValuesAre31Bits()
static bool IsMinusZero(double value)
Debugger support for the V8 JavaScript engine.
static BoundsImpl NarrowLower(BoundsImpl b, TypeHandle t, Region *region)
static BoundsImpl Both(BoundsImpl b1, BoundsImpl b2, Region *region)
BoundsImpl(TypeHandle l, TypeHandle u)
static BoundsImpl NarrowUpper(BoundsImpl b, TypeHandle t, Region *region)
Type::TypeHandle TypeHandle
static BoundsImpl Unbounded(Region *region)
bool Narrows(BoundsImpl that)
static BoundsImpl Either(BoundsImpl b1, BoundsImpl b2, Region *region)
TypeImpl< HeapTypeConfig > Type
Limits(i::Handle< i::Object > min, i::Handle< i::Object > max)
i::Handle< i::Object > max
i::Handle< i::Object > min
TypeImpl< ZoneTypeConfig > Type
#define T(name, string, precedence)
#define PROPER_BITSET_TYPE_LIST(V)
#define DECLARE_TYPE(type, value)
#define DEFINE_TYPE_CONSTRUCTOR(type, value)
#define BITSET_TYPE_LIST(V)