22 template<
class Config>
27 if (lhs.
min->Number() < rhs.
min->Number()) result.
min = rhs.
min;
28 if (lhs.
max->Number() > rhs.
max->Number()) result.
max = rhs.
max;
33 template<
class Config>
38 if (lhs.
min->Number() > rhs.
min->Number()) result.
min = rhs.
min;
39 if (lhs.
max->Number() < rhs.
max->Number()) result.
max = rhs.
max;
44 template<
class Config>
50 return lim.
min->Number() <= lim.
max->Number();
54 template<
class Config>
59 return lhs->
Min()->Number() <= rhs->
Min()->Number()
60 && rhs->
Max()->Number() <= lhs->
Max()->Number();
64 template<
class Config>
66 typename TypeImpl<Config>::RangeType* range,
i::Object* val) {
69 && range->Min()->Number() <= val->
Number()
70 && val->
Number() <= range->Max()->Number();
77 template<
class Config>
81 if (this->IsUnion()) {
83 for (
int i = 0, n = this->AsUnion()->Length();
i < n; ++
i) {
88 if (this->IsRange())
return this->AsRange()->Min()->Number();
89 if (this->IsConstant())
return this->AsConstant()->Value()->Number();
95 template<
class Config>
99 if (this->IsUnion()) {
101 for (
int i = 0, n = this->AsUnion()->Length();
i < n; ++
i) {
102 max = std::max(max, this->AsUnion()->Get(
i)->
Max());
106 if (this->IsRange())
return this->AsRange()->Max()->Number();
107 if (this->IsConstant())
return this->AsConstant()->Value()->Number();
118 template<
class Config>
135 template<
class Config>
149 return Config::is_class(type) ? Lub(*Config::as_class(type)) :
154 if (type->
IsContext())
return kInternal & kTaggedPtr;
155 if (type->
IsArray())
return kArray;
162 template<
class Config>
166 switch (
map->instance_type()) {
188 return kInternalizedString;
193 if (
map == heap->undefined_map())
return kUndefined;
194 if (
map == heap->null_map())
return kNull;
195 if (
map == heap->boolean_map())
return kBoolean;
197 map == heap->uninitialized_map() ||
198 map == heap->no_interceptor_result_sentinel_map() ||
199 map == heap->termination_exception_map() ||
200 map == heap->arguments_marker_map());
201 return kInternal & kTaggedPtr;
204 return kNumber & kTaggedPtr;
223 if (
map->is_undetectable())
return kUndetectable;
252 return kInternal & kTaggedPtr;
260 template<
class Config>
264 if (value->IsNumber()) {
265 return Lub(value->
Number()) & (value->IsSmi() ? kTaggedInt : kTaggedPtr);
267 return Lub(i::HeapObject::cast(value)->
map());
271 template<
class Config>
276 if (std::isnan(value))
return kNaN;
283 template<
class Config>
287 if (value >= 0x40000000) {
290 if (value >= 0)
return kUnsignedSmall;
291 if (value >= -0x40000000)
return kOtherSignedSmall;
296 template<
class Config>
300 if (value >= 0x80000000u)
return kOtherUnsigned32;
301 if (value >= 0x40000000u) {
304 return kUnsignedSmall;
309 template<
class Config>
314 {kOtherSignedSmall, -0x40000000},
316 {kOtherUnsigned31, 0x40000000},
317 {kOtherUnsigned32, 0x80000000},
318 {kOtherNumber,
static_cast<double>(
kMaxUInt32) + 1}
324 template<
class Config>
325 const typename TypeImpl<Config>::BitsetType::BitsetMin
330 {kOtherUnsigned32, 0x80000000},
331 {kOtherNumber,
static_cast<double>(
kMaxUInt32) + 1}
335 template<
class Config>
339 double min = lim.
min->Number();
340 double max = lim.
max->Number();
344 for (
size_t i = 1;
i < BitsetMinsSize(); ++
i) {
346 lub |= mins[
i-1].
bits;
347 if (max < mins[
i].
min)
return lub;
350 return lub |= mins[BitsetMinsSize()-1].
bits;
354 template<
class Config>
359 bool mz =
SEMANTIC(bits & kMinusZero);
360 for (
size_t i = 0;
i < BitsetMinsSize(); ++
i) {
370 template<
class Config>
374 const BitsetMin* mins = BitsetMins();
375 bool mz = bits & kMinusZero;
379 for (
size_t i = BitsetMinsSize()-1;
i-- > 0; ) {
382 std::max(0.0, mins[
i+1].
min - 1) : mins[
i+1].
min - 1;
394 template<
class Config>
417 if (this_fun->Arity() != that_fun->Arity() ||
418 !this_fun->Result()->Equals(that_fun->Result()) ||
419 !this_fun->Receiver()->Equals(that_fun->Receiver())) {
422 for (
int i = 0, n = this_fun->Arity();
i < n; ++
i) {
423 if (!this_fun->Parameter(
i)->Equals(that_fun->Parameter(
i)))
return false;
433 template<
class Config>
446 for (
int i = 0, n = this->
AsUnion()->Length();
i < n; ++
i) {
447 if (!this->
AsUnion()->Get(
i)->
Is(that))
return false;
466 if (this->
IsRange())
return false;
471 template<
class Config>
480 if (object->IsHeapObject()) {
482 for (Iterator<i::Map> it = that->
Classes(); !it.Done(); it.Advance()) {
483 if (*it.Current() ==
map)
return true;
487 return this->
Is(that);
492 template<
class Config>
496 if (!it.Current()->is_stable())
return false;
503 template<
class Config>
509 for (
int i = 0, n = this->
AsUnion()->Length();
i < n; ++
i) {
547 template<
class Config>
558 template<
class Config>
562 if (*it.Current() == value)
return true;
566 if (range !=
NULL &&
Contains(range, value))
return true;
572 template<
class Config>
582 DCHECK(this->Length() >= 2);
583 for (
int i = 0;
i < this->Length(); ++
i) {
587 for (
int j = 0; j < this->Length(); ++j) {
588 if (
i != j)
DCHECK(!this->Get(
i)->
Is(this->Get(j)));
601 y <= std::numeric_limits<int>::max() - x :
606 template<
class Config>
609 bitset bits = type1->BitsetGlb() & type2->BitsetGlb();
613 if (type1->IsBitset() && type2->IsBitset()) {
618 if (type1->IsNone() || type2->IsAny())
return type1;
619 if (type2->IsNone() || type1->IsAny())
return type2;
622 if (type1->Is(type2))
return type1;
623 if (type2->Is(type1))
return type2;
626 int size1 = type1->IsUnion() ? type1->AsUnion()->Length() : 1;
627 int size2 = type2->IsUnion() ? type2->AsUnion()->Length() : 1;
628 if (!
AddIsSafe(size1, size2))
return Any(region);
629 int size = size1 + size2;
640 RangeType* range1 = type1->GetRange();
641 RangeType* range2 = type2->GetRange();
642 if (range1 !=
NULL && range2 !=
NULL) {
643 Limits lim =
Intersect(Limits(range1), Limits(range2));
644 if (lim.min->Number() <= lim.max->Number()) {
648 result->Set(
size++, range);
655 template<
class Config>
659 DCHECK(old_range->IsRange() || old_range->IsNone());
660 if (range->Is(old_range))
return size;
661 if (!old_range->Is(range->unhandle())) {
665 result->Set(1, range);
668 for (
int i = 2;
i <
size; ) {
669 if (result->Get(
i)->Is(range->unhandle())) {
670 result->Set(
i, result->Get(--
size));
679 template<
class Config>
683 if (lhs->IsUnion()) {
684 for (
int i = 0, n = lhs->AsUnion()->Length();
i < n; ++
i) {
689 if (rhs->IsUnion()) {
690 for (
int i = 0, n = rhs->AsUnion()->Length();
i < n; ++
i) {
700 if (lhs->IsRange()) {
701 if (rhs->IsBitset() || rhs->IsClass()) {
703 Config::template cast<RangeType>(lhs), result,
size, region);
705 if (rhs->IsConstant() &&
706 Contains(lhs->AsRange(), *rhs->AsConstant()->Value())) {
711 if (rhs->IsRange()) {
712 if (lhs->IsBitset() || lhs->IsClass()) {
714 Config::template cast<RangeType>(rhs), result,
size, region);
716 if (lhs->IsConstant() &&
717 Contains(rhs->AsRange(), *lhs->AsConstant()->Value())) {
723 if (lhs->IsBitset() || rhs->IsBitset()) {
724 return AddToUnion(lhs->IsBitset() ? rhs : lhs, result,
size, region);
726 if (lhs->IsClass() != rhs->IsClass()) {
727 return AddToUnion(lhs->IsClass() ? rhs : lhs, result,
size, region);
729 if (lhs->SimplyEquals(rhs->unhandle())) {
736 template<
class Config>
741 if (type1->IsBitset() && type2->IsBitset()) {
746 if (type1->IsAny() || type2->IsNone())
return type1;
747 if (type2->IsAny() || type1->IsNone())
return type2;
750 if (type1->Is(type2))
return type2;
751 if (type2->Is(type1))
return type1;
754 int size1 = type1->IsUnion() ? type1->AsUnion()->Length() : 1;
755 int size2 = type2->IsUnion() ? type2->AsUnion()->Length() : 1;
756 if (!
AddIsSafe(size1, size2))
return Any(region);
757 int size = size1 + size2;
765 type1->BitsetGlb() | type2->BitsetGlb(), region);
766 result->Set(
size++, bits);
772 if (range1 !=
NULL && range2 !=
NULL) {
774 }
else if (range1 !=
NULL) {
776 }
else if (range2 !=
NULL) {
779 result->Set(
size++, range);
789 template<
class Config>
792 if (type->IsBitset() || type->IsRange())
return size;
793 if (type->IsUnion()) {
794 for (
int i = 0, n = type->AsUnion()->Length();
i < n; ++
i) {
799 for (
int i = 0;
i <
size; ++
i) {
800 if (type->Is(result->Get(
i)))
return size;
802 result->Set(
size++, type);
807 template<
class Config>
812 if (unioned->Get(1)->Is(unioned->Get(0))) {
813 unioned->Set(1, unioned->Get(--
size));
816 if (
size >= 2 && unioned->Get(0)->IsNone()) {
817 unioned->Set(0, unioned->Get(--
size));
819 if (
size == 1)
return unioned->Get(0);
820 unioned->Shrink(
size);
829 template<
class Config>
836 for (
int i = 0, n = this->
AsUnion()->Length();
i < n; ++
i) {
846 template<
class Config>
853 for (
int i = 0, n = this->
AsUnion()->Length();
i < n; ++
i) {
863 template<
class Config>
template<
class T>
867 return type_->IsUnion() ? type_->AsUnion()->Get(index_) : type_;
873 template<
class Config,
class T>
879 template<
class Config>
889 template<
class Config>
900 template<
class Config>
template<
class T>
905 template<
class Config>
template<
class T>
911 template<
class Config>
template<
class T>
915 if (type_->IsUnion()) {
916 for (
int n = type_->AsUnion()->Length(); index_ < n; ++index_) {
917 if (matches(type_->AsUnion()->Get(index_)))
return;
919 }
else if (index_ == 0 && matches(type_)) {
929 template<
class Config>
930 template<
class OtherType>
932 typename OtherType::TypeHandle type,
Region* region) {
933 if (type->IsBitset()) {
935 }
else if (type->IsClass()) {
937 }
else if (type->IsConstant()) {
939 }
else if (type->IsRange()) {
941 type->AsRange()->Min(), type->AsRange()->Max(), region);
942 }
else if (type->IsContext()) {
943 TypeHandle outer = Convert<OtherType>(type->AsContext()->Outer(), region);
945 }
else if (type->IsUnion()) {
946 int length = type->AsUnion()->Length();
948 for (
int i = 0;
i < length; ++
i) {
949 TypeHandle t = Convert<OtherType>(type->AsUnion()->Get(
i), region);
953 }
else if (type->IsArray()) {
954 TypeHandle element = Convert<OtherType>(type->AsArray()->Element(), region);
956 }
else if (type->IsFunction()) {
957 TypeHandle res = Convert<OtherType>(type->AsFunction()->Result(), region);
958 TypeHandle rcv = Convert<OtherType>(type->AsFunction()->Receiver(), region);
960 res, rcv, type->AsFunction()->Arity(), region);
961 for (
int i = 0;
i <
function->Arity(); ++
i) {
963 type->AsFunction()->Parameter(
i), region);
964 function->InitParameter(
i, param);
977 template<
class Config>
981 #define RETURN_NAMED_REPRESENTATION_TYPE(type, value) \
982 case REPRESENTATION(k##type): return #type;
984 #undef RETURN_NAMED_REPRESENTATION_TYPE
986 #define RETURN_NAMED_SEMANTIC_TYPE(type, value) \
987 case SEMANTIC(k##type): return #type;
989 #undef RETURN_NAMED_SEMANTIC_TYPE
997 template <
class Config>
1007 static const bitset named_bitsets[] = {
1008 #define BITSET_CONSTANT(type, value) REPRESENTATION(k##type),
1010 #undef BITSET_CONSTANT
1012 #define BITSET_CONSTANT(type, value) SEMANTIC(k##type),
1014 #undef BITSET_CONSTANT
1017 bool is_first =
true;
1019 for (
int i(
arraysize(named_bitsets) - 1); bits != 0 &&
i >= 0; --
i) {
1020 bitset subset = named_bitsets[
i];
1021 if ((bits & subset) == subset) {
1022 if (!is_first) os <<
" | ";
1033 template <
class Config>
1040 os <<
"Class(" <<
static_cast<void*
>(*this->
AsClass()->
Map()) <<
" < ";
1046 os <<
"Range(" << this->
AsRange()->
Min()->Number()
1047 <<
", " << this->
AsRange()->
Max()->Number() <<
")";
1054 for (
int i = 0, n = this->
AsUnion()->Length();
i < n; ++
i) {
1056 if (
i > 0) os <<
" | ";
1057 type_i->PrintTo(os, dim);
1071 if (
i > 0) os <<
", ";
1088 template <
class Config>
1094 template <
class Config>
1096 OFStream os(stdout);
1106 template class TypeImpl<ZoneTypeConfig>;
1110 template class TypeImpl<HeapTypeConfig>;
1115 TypeImpl<ZoneTypeConfig>::Convert<HeapType>(
1118 TypeImpl<HeapTypeConfig>::Convert<Type>(
#define SLOW_DCHECK(condition)
A JavaScript number value (ECMA-262, 4.3.20)
The superclass of all JavaScript values and objects.
static double nan_value()
static ArrayHandle New(TypeHandle element, Region *region)
static const char * Name(bitset)
static bool Is(bitset bits1, bitset bits2)
static const BitsetMin BitsetMins32[]
static TypeImpl * New(bitset bits)
static void Print(OStream &os, bitset)
static bitset Lub(TypeImpl *type)
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 ConstantHandle New(i::Handle< i::Object > value, Region *region)
i::Handle< i::Object > Value()
static ContextHandle New(TypeHandle outer, Region *region)
static FunctionHandle New(TypeHandle result, TypeHandle receiver, int arity, Region *region)
TypeHandle Parameter(int i)
i::Handle< i::Object > Min()
i::Handle< i::Object > Max()
static RangeHandle New(i::Handle< i::Object > min, i::Handle< i::Object > max, Region *region)
static UnionHandle New(int length, Region *region)
static bool IsInteger(double x)
Config::template Handle< RangeType >::type RangeHandle
Config::template Handle< FunctionType >::type FunctionHandle
static Config::template Handle< T >::type handle(T *type)
bool NowIs(TypeImpl *that)
static TypeHandle Convert(typename OtherTypeImpl::TypeHandle type, Region *region)
ContextType * AsContext()
static TypeHandle NormalizeUnion(UnionHandle unioned, int size)
Config::template Handle< TypeImpl >::type TypeHandle
ConstantType * AsConstant()
Iterator< i::Map > Classes()
bool SlowIs(TypeImpl *that)
bool Contains(i::Object *val)
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
FunctionType * AsFunction()
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 int UpdateRange(RangeHandle type, UnionHandle result, int size, Region *region)
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
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 deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in name
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 deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL
#define DCHECK(condition)
static LifetimePosition Max(LifetimePosition a, LifetimePosition b)
static LifetimePosition Min(LifetimePosition a, LifetimePosition b)
static bool IsUint32Double(double value)
PerThreadAssertScopeDebugOnly< HEAP_ALLOCATION_ASSERT, false > DisallowHeapAllocation
static int min(int a, int b)
static LifetimePosition Min(LifetimePosition a, LifetimePosition b)
static bool IsInt32Double(double value)
unsigned int FastD2UI(double x)
OStream & endl(OStream &os)
@ SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE
@ SHORT_EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE
@ DECLARED_ACCESSOR_INFO_TYPE
@ CONS_ONE_BYTE_STRING_TYPE
@ JS_GENERATOR_OBJECT_TYPE
@ EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE
@ SLICED_ONE_BYTE_STRING_TYPE
@ JS_CONTEXT_EXTENSION_OBJECT_TYPE
@ EXECUTABLE_ACCESSOR_INFO_TYPE
@ SHARED_FUNCTION_INFO_TYPE
@ EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE
@ INTERNALIZED_STRING_TYPE
@ SHORT_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE
@ EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE
@ SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE
@ EXTERNAL_INTERNALIZED_STRING_TYPE
@ EXTERNAL_ONE_BYTE_STRING_TYPE
@ SHORT_EXTERNAL_ONE_BYTE_STRING_TYPE
@ JS_BUILTINS_OBJECT_TYPE
@ ONE_BYTE_INTERNALIZED_STRING_TYPE
@ SHORT_EXTERNAL_STRING_TYPE
static LifetimePosition Max(LifetimePosition a, LifetimePosition b)
static bool AddIsSafe(int x, int y)
static bool SmiValuesAre31Bits()
static bool IsMinusZero(double value)
const uint32_t kMaxUInt32
Debugger support for the V8 JavaScript engine.
static bool matches(typename TypeImpl< Config >::TypeHandle type)
static bool matches(typename TypeImpl< Config >::TypeHandle type)
static i::Handle< i::Object > current(typename TypeImpl< Config >::TypeHandle type)
static bool matches(typename TypeImpl< Config >::TypeHandle type)
static i::Handle< T > current(typename TypeImpl< Config >::TypeHandle type)
i::Handle< i::Object > max
i::Handle< i::Object > min
#define RETURN_NAMED_SEMANTIC_TYPE(type, value)
#define BITSET_CONSTANT(type, value)
#define RETURN_NAMED_REPRESENTATION_TYPE(type, value)
#define REPRESENTATION_BITSET_TYPE_LIST(V)
#define REPRESENTATION(k)
#define SEMANTIC_BITSET_TYPE_LIST(V)