Commit 3c9f9851 authored by jarin's avatar jarin Committed by Commit bot

[turbofan] Use unboxed doubles in range types.

BUG=
R=bmeurer@chromium.org

Review URL: https://codereview.chromium.org/882063002

Cr-Commit-Position: refs/heads/master@{#26307}
parent b3de173d
...@@ -30,26 +30,23 @@ static void RelaxEffects(Node* node) { ...@@ -30,26 +30,23 @@ static void RelaxEffects(Node* node) {
JSTypedLowering::JSTypedLowering(JSGraph* jsgraph, Zone* zone) JSTypedLowering::JSTypedLowering(JSGraph* jsgraph, Zone* zone)
: jsgraph_(jsgraph), simplified_(graph()->zone()), conversions_(zone) { : jsgraph_(jsgraph), simplified_(graph()->zone()), conversions_(zone) {
Handle<Object> zero = factory()->NewNumber(0.0); zero_range_ = Type::Range(0.0, 1.0, graph()->zone());
Handle<Object> one = factory()->NewNumber(1.0); one_range_ = Type::Range(1.0, 1.0, graph()->zone());
zero_range_ = Type::Range(zero, zero, graph()->zone()); zero_thirtyone_range_ = Type::Range(0.0, 31.0, graph()->zone());
one_range_ = Type::Range(one, one, graph()->zone());
Handle<Object> thirtyone = factory()->NewNumber(31.0);
zero_thirtyone_range_ = Type::Range(zero, thirtyone, graph()->zone());
// TODO(jarin): Can we have a correctification of the stupid type system? // TODO(jarin): Can we have a correctification of the stupid type system?
// These stupid work-arounds are just stupid! // These stupid work-arounds are just stupid!
shifted_int32_ranges_[0] = Type::Signed32(); shifted_int32_ranges_[0] = Type::Signed32();
if (SmiValuesAre31Bits()) { if (SmiValuesAre31Bits()) {
shifted_int32_ranges_[1] = Type::SignedSmall(); shifted_int32_ranges_[1] = Type::SignedSmall();
for (size_t k = 2; k < arraysize(shifted_int32_ranges_); ++k) { for (size_t k = 2; k < arraysize(shifted_int32_ranges_); ++k) {
Handle<Object> min = factory()->NewNumber(kMinInt / (1 << k)); double min = kMinInt / (1 << k);
Handle<Object> max = factory()->NewNumber(kMaxInt / (1 << k)); double max = kMaxInt / (1 << k);
shifted_int32_ranges_[k] = Type::Range(min, max, graph()->zone()); shifted_int32_ranges_[k] = Type::Range(min, max, graph()->zone());
} }
} else { } else {
for (size_t k = 1; k < arraysize(shifted_int32_ranges_); ++k) { for (size_t k = 1; k < arraysize(shifted_int32_ranges_); ++k) {
Handle<Object> min = factory()->NewNumber(kMinInt / (1 << k)); double min = kMinInt / (1 << k);
Handle<Object> max = factory()->NewNumber(kMaxInt / (1 << k)); double max = kMaxInt / (1 << k);
shifted_int32_ranges_[k] = Type::Range(min, max, graph()->zone()); shifted_int32_ranges_[k] = Type::Range(min, max, graph()->zone());
} }
} }
......
...@@ -75,10 +75,8 @@ class RepresentationSelector { ...@@ -75,10 +75,8 @@ class RepresentationSelector {
queue_(zone) { queue_(zone) {
memset(info_, 0, sizeof(NodeInfo) * count_); memset(info_, 0, sizeof(NodeInfo) * count_);
Factory* f = jsgraph->isolate()->factory();
safe_int_additive_range_ = safe_int_additive_range_ =
Type::Range(f->NewNumber(-std::pow(2.0, 52.0)), Type::Range(-std::pow(2.0, 52.0), std::pow(2.0, 52.0), zone);
f->NewNumber(std::pow(2.0, 52.0)), zone);
} }
void Run(SimplifiedLowering* lowering) { void Run(SimplifiedLowering* lowering) {
......
This diff is collapsed.
...@@ -65,8 +65,8 @@ class Typer { ...@@ -65,8 +65,8 @@ class Typer {
Type* random_fun_; Type* random_fun_;
LazyTypeCache* cache_; LazyTypeCache* cache_;
ZoneVector<Handle<Object> > weaken_min_limits_; ZoneVector<double> weaken_min_limits_;
ZoneVector<Handle<Object> > weaken_max_limits_; ZoneVector<double> weaken_max_limits_;
DISALLOW_COPY_AND_ASSIGN(Typer); DISALLOW_COPY_AND_ASSIGN(Typer);
}; };
......
...@@ -96,7 +96,18 @@ bool ZoneTypeConfig::is_bitset(Type* type) { ...@@ -96,7 +96,18 @@ bool ZoneTypeConfig::is_bitset(Type* type) {
// static // static
bool ZoneTypeConfig::is_struct(Type* type, int tag) { bool ZoneTypeConfig::is_struct(Type* type, int tag) {
return !is_bitset(type) && struct_tag(as_struct(type)) == tag; DCHECK(tag != kRangeStructTag);
if (is_bitset(type)) return false;
int type_tag = struct_tag(as_struct(type));
return type_tag == tag;
}
// static
bool ZoneTypeConfig::is_range(Type* type) {
if (is_bitset(type)) return false;
int type_tag = struct_tag(as_struct(type));
return type_tag == kRangeStructTag;
} }
...@@ -120,6 +131,13 @@ ZoneTypeConfig::Struct* ZoneTypeConfig::as_struct(Type* type) { ...@@ -120,6 +131,13 @@ ZoneTypeConfig::Struct* ZoneTypeConfig::as_struct(Type* type) {
} }
// static
ZoneTypeConfig::Range* ZoneTypeConfig::as_range(Type* type) {
DCHECK(!is_bitset(type));
return reinterpret_cast<Range*>(type);
}
// static // static
i::Handle<i::Map> ZoneTypeConfig::as_class(Type* type) { i::Handle<i::Map> ZoneTypeConfig::as_class(Type* type) {
UNREACHABLE(); UNREACHABLE();
...@@ -146,6 +164,12 @@ ZoneTypeConfig::Type* ZoneTypeConfig::from_struct(Struct* structure) { ...@@ -146,6 +164,12 @@ ZoneTypeConfig::Type* ZoneTypeConfig::from_struct(Struct* structure) {
} }
// static
ZoneTypeConfig::Type* ZoneTypeConfig::from_range(Range* range) {
return reinterpret_cast<Type*>(range);
}
// static // static
ZoneTypeConfig::Type* ZoneTypeConfig::from_class( ZoneTypeConfig::Type* ZoneTypeConfig::from_class(
i::Handle<i::Map> map, Zone* zone) { i::Handle<i::Map> map, Zone* zone) {
...@@ -156,6 +180,7 @@ ZoneTypeConfig::Type* ZoneTypeConfig::from_class( ...@@ -156,6 +180,7 @@ ZoneTypeConfig::Type* ZoneTypeConfig::from_class(
// static // static
ZoneTypeConfig::Struct* ZoneTypeConfig::struct_create( ZoneTypeConfig::Struct* ZoneTypeConfig::struct_create(
int tag, int length, Zone* zone) { int tag, int length, Zone* zone) {
DCHECK(tag != kRangeStructTag);
Struct* structure = reinterpret_cast<Struct*>( Struct* structure = reinterpret_cast<Struct*>(
zone->New(sizeof(void*) * (length + 2))); // NOLINT zone->New(sizeof(void*) * (length + 2))); // NOLINT
structure[0] = reinterpret_cast<void*>(tag); structure[0] = reinterpret_cast<void*>(tag);
...@@ -214,6 +239,45 @@ void ZoneTypeConfig::struct_set_value( ...@@ -214,6 +239,45 @@ void ZoneTypeConfig::struct_set_value(
} }
// static
ZoneTypeConfig::Range* ZoneTypeConfig::range_create(Zone* zone) {
Range* range = reinterpret_cast<Range*>(zone->New(sizeof(Range))); // NOLINT
range->tag = reinterpret_cast<void*>(kRangeStructTag);
range->bitset = 0;
range->limits[0] = 1;
range->limits[1] = 0;
return range;
}
// static
int ZoneTypeConfig::range_get_bitset(ZoneTypeConfig::Range* range) {
return range->bitset;
}
// static
void ZoneTypeConfig::range_set_bitset(ZoneTypeConfig::Range* range, int value) {
range->bitset = value;
}
// static
double ZoneTypeConfig::range_get_double(ZoneTypeConfig::Range* range,
int index) {
DCHECK(index >= 0 && index < 2);
return range->limits[index];
}
// static
void ZoneTypeConfig::range_set_double(ZoneTypeConfig::Range* range, int index,
double value, Zone*) {
DCHECK(index >= 0 && index < 2);
range->limits[index] = value;
}
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// HeapTypeConfig // HeapTypeConfig
...@@ -252,10 +316,17 @@ bool HeapTypeConfig::is_class(Type* type) { ...@@ -252,10 +316,17 @@ bool HeapTypeConfig::is_class(Type* type) {
// static // static
bool HeapTypeConfig::is_struct(Type* type, int tag) { bool HeapTypeConfig::is_struct(Type* type, int tag) {
DCHECK(tag != kRangeStructTag);
return type->IsFixedArray() && struct_tag(as_struct(type)) == tag; return type->IsFixedArray() && struct_tag(as_struct(type)) == tag;
} }
// static
bool HeapTypeConfig::is_range(Type* type) {
return type->IsFixedArray() && struct_tag(as_struct(type)) == kRangeStructTag;
}
// static // static
HeapTypeConfig::Type::bitset HeapTypeConfig::as_bitset(Type* type) { HeapTypeConfig::Type::bitset HeapTypeConfig::as_bitset(Type* type) {
// TODO(rossberg): Breaks the Smi abstraction. Fix once there is a better way. // TODO(rossberg): Breaks the Smi abstraction. Fix once there is a better way.
...@@ -275,6 +346,12 @@ i::Handle<HeapTypeConfig::Struct> HeapTypeConfig::as_struct(Type* type) { ...@@ -275,6 +346,12 @@ i::Handle<HeapTypeConfig::Struct> HeapTypeConfig::as_struct(Type* type) {
} }
// static
i::Handle<HeapTypeConfig::Range> HeapTypeConfig::as_range(Type* type) {
return i::handle(Range::cast(type));
}
// static // static
HeapTypeConfig::Type* HeapTypeConfig::from_bitset(Type::bitset bitset) { HeapTypeConfig::Type* HeapTypeConfig::from_bitset(Type::bitset bitset) {
// TODO(rossberg): Breaks the Smi abstraction. Fix once there is a better way. // TODO(rossberg): Breaks the Smi abstraction. Fix once there is a better way.
...@@ -303,6 +380,13 @@ i::Handle<HeapTypeConfig::Type> HeapTypeConfig::from_struct( ...@@ -303,6 +380,13 @@ i::Handle<HeapTypeConfig::Type> HeapTypeConfig::from_struct(
} }
// static
i::Handle<HeapTypeConfig::Type> HeapTypeConfig::from_range(
i::Handle<Range> range) {
return i::Handle<Type>::cast(i::Handle<Object>::cast(range));
}
// static // static
i::Handle<HeapTypeConfig::Struct> HeapTypeConfig::struct_create( i::Handle<HeapTypeConfig::Struct> HeapTypeConfig::struct_create(
int tag, int length, Isolate* isolate) { int tag, int length, Isolate* isolate) {
...@@ -361,6 +445,46 @@ void HeapTypeConfig::struct_set_value( ...@@ -361,6 +445,46 @@ void HeapTypeConfig::struct_set_value(
structure->set(i + 1, *x); structure->set(i + 1, *x);
} }
// static
i::Handle<HeapTypeConfig::Range> HeapTypeConfig::range_create(
Isolate* isolate) {
i::Handle<Range> range = isolate->factory()->NewFixedArray(4);
range->set(0, i::Smi::FromInt(kRangeStructTag));
return range;
}
// static
int HeapTypeConfig::range_get_bitset(i::Handle<HeapTypeConfig::Range> range) {
Type* v = static_cast<Type*>(range->get(1));
return as_bitset(v);
}
// static
void HeapTypeConfig::range_set_bitset(i::Handle<HeapTypeConfig::Range> range,
int value) {
range->set(1, from_bitset(value));
}
// static
double HeapTypeConfig::range_get_double(i::Handle<HeapTypeConfig::Range> range,
int index) {
DCHECK(index >= 0 && index < 2);
return range->get(index + 2)->Number();
}
// static
void HeapTypeConfig::range_set_double(i::Handle<HeapTypeConfig::Range> range,
int index, double value,
Isolate* isolate) {
DCHECK(index >= 0 && index < 2);
i::Handle<Object> number = isolate->factory()->NewNumber(value);
range->set(index + 2, *number);
}
} } // namespace v8::internal } } // namespace v8::internal
#endif // V8_TYPES_INL_H_ #endif // V8_TYPES_INL_H_
...@@ -26,8 +26,8 @@ typename TypeImpl<Config>::Limits TypeImpl<Config>::Intersect( ...@@ -26,8 +26,8 @@ typename TypeImpl<Config>::Limits TypeImpl<Config>::Intersect(
Limits lhs, Limits rhs) { Limits lhs, Limits rhs) {
DisallowHeapAllocation no_allocation; DisallowHeapAllocation no_allocation;
Limits result(lhs); Limits result(lhs);
if (lhs.min->Number() < rhs.min->Number()) result.min = rhs.min; if (lhs.min < rhs.min) result.min = rhs.min;
if (lhs.max->Number() > rhs.max->Number()) result.max = rhs.max; if (lhs.max > rhs.max) result.max = rhs.max;
result.representation = lhs.representation & rhs.representation; result.representation = lhs.representation & rhs.representation;
return result; return result;
} }
...@@ -35,7 +35,7 @@ typename TypeImpl<Config>::Limits TypeImpl<Config>::Intersect( ...@@ -35,7 +35,7 @@ typename TypeImpl<Config>::Limits TypeImpl<Config>::Intersect(
template <class Config> template <class Config>
bool TypeImpl<Config>::IsEmpty(Limits lim) { bool TypeImpl<Config>::IsEmpty(Limits lim) {
return lim.min->Number() > lim.max->Number(); return lim.min > lim.max;
} }
...@@ -44,8 +44,8 @@ typename TypeImpl<Config>::Limits TypeImpl<Config>::Union(Limits lhs, ...@@ -44,8 +44,8 @@ typename TypeImpl<Config>::Limits TypeImpl<Config>::Union(Limits lhs,
Limits rhs) { Limits rhs) {
DisallowHeapAllocation no_allocation; DisallowHeapAllocation no_allocation;
Limits result(lhs); Limits result(lhs);
if (lhs.min->Number() > rhs.min->Number()) result.min = rhs.min; if (lhs.min > rhs.min) result.min = rhs.min;
if (lhs.max->Number() < rhs.max->Number()) result.max = rhs.max; if (lhs.max < rhs.max) result.max = rhs.max;
result.representation = lhs.representation | rhs.representation; result.representation = lhs.representation | rhs.representation;
return result; return result;
} }
...@@ -57,7 +57,7 @@ bool TypeImpl<Config>::Overlap( ...@@ -57,7 +57,7 @@ bool TypeImpl<Config>::Overlap(
typename TypeImpl<Config>::RangeType* rhs) { typename TypeImpl<Config>::RangeType* rhs) {
DisallowHeapAllocation no_allocation; DisallowHeapAllocation no_allocation;
typename TypeImpl<Config>::Limits lim = Intersect(Limits(lhs), Limits(rhs)); typename TypeImpl<Config>::Limits lim = Intersect(Limits(lhs), Limits(rhs));
return lim.min->Number() <= lim.max->Number(); return lim.min <= lim.max;
} }
...@@ -66,9 +66,8 @@ bool TypeImpl<Config>::Contains( ...@@ -66,9 +66,8 @@ bool TypeImpl<Config>::Contains(
typename TypeImpl<Config>::RangeType* lhs, typename TypeImpl<Config>::RangeType* lhs,
typename TypeImpl<Config>::RangeType* rhs) { typename TypeImpl<Config>::RangeType* rhs) {
DisallowHeapAllocation no_allocation; DisallowHeapAllocation no_allocation;
return rhs->Bound()->Is(lhs->Bound()) && return BitsetType::Is(rhs->Bound(), lhs->Bound()) &&
lhs->Min()->Number() <= rhs->Min()->Number() && lhs->Min() <= rhs->Min() && rhs->Max() <= lhs->Max();
rhs->Max()->Number() <= lhs->Max()->Number();
} }
...@@ -76,9 +75,10 @@ template <class Config> ...@@ -76,9 +75,10 @@ template <class Config>
bool TypeImpl<Config>::Contains(typename TypeImpl<Config>::RangeType* lhs, bool TypeImpl<Config>::Contains(typename TypeImpl<Config>::RangeType* lhs,
typename TypeImpl<Config>::ConstantType* rhs) { typename TypeImpl<Config>::ConstantType* rhs) {
DisallowHeapAllocation no_allocation; DisallowHeapAllocation no_allocation;
return IsInteger(*rhs->Value()) && rhs->Bound()->Is(lhs->Bound()) && return IsInteger(*rhs->Value()) &&
lhs->Min()->Number() <= rhs->Value()->Number() && BitsetType::Is(rhs->Bound()->AsBitset(), lhs->Bound()) &&
rhs->Value()->Number() <= lhs->Max()->Number(); lhs->Min() <= rhs->Value()->Number() &&
rhs->Value()->Number() <= lhs->Max();
} }
...@@ -87,9 +87,8 @@ bool TypeImpl<Config>::Contains( ...@@ -87,9 +87,8 @@ bool TypeImpl<Config>::Contains(
typename TypeImpl<Config>::RangeType* range, i::Object* val) { typename TypeImpl<Config>::RangeType* range, i::Object* val) {
DisallowHeapAllocation no_allocation; DisallowHeapAllocation no_allocation;
return IsInteger(val) && return IsInteger(val) &&
BitsetType::Is(BitsetType::Lub(val), range->Bound()->AsBitset()) && BitsetType::Is(BitsetType::Lub(val), range->Bound()) &&
range->Min()->Number() <= val->Number() && range->Min() <= val->Number() && val->Number() <= range->Max();
val->Number() <= range->Max()->Number();
} }
...@@ -107,7 +106,7 @@ double TypeImpl<Config>::Min() { ...@@ -107,7 +106,7 @@ double TypeImpl<Config>::Min() {
} }
return min; return min;
} }
if (this->IsRange()) return this->AsRange()->Min()->Number(); if (this->IsRange()) return this->AsRange()->Min();
if (this->IsConstant()) return this->AsConstant()->Value()->Number(); if (this->IsConstant()) return this->AsConstant()->Value()->Number();
UNREACHABLE(); UNREACHABLE();
return 0; return 0;
...@@ -125,7 +124,7 @@ double TypeImpl<Config>::Max() { ...@@ -125,7 +124,7 @@ double TypeImpl<Config>::Max() {
} }
return max; return max;
} }
if (this->IsRange()) return this->AsRange()->Max()->Number(); if (this->IsRange()) return this->AsRange()->Max();
if (this->IsConstant()) return this->AsConstant()->Value()->Number(); if (this->IsConstant()) return this->AsConstant()->Value()->Number();
UNREACHABLE(); UNREACHABLE();
return 0; return 0;
...@@ -148,8 +147,8 @@ TypeImpl<Config>::BitsetType::Glb(TypeImpl* type) { ...@@ -148,8 +147,8 @@ TypeImpl<Config>::BitsetType::Glb(TypeImpl* type) {
return type->AsUnion()->Get(0)->BitsetGlb() | return type->AsUnion()->Get(0)->BitsetGlb() |
type->AsUnion()->Get(1)->BitsetGlb(); // Shortcut. type->AsUnion()->Get(1)->BitsetGlb(); // Shortcut.
} else if (type->IsRange()) { } else if (type->IsRange()) {
bitset glb = SEMANTIC(BitsetType::Glb(type->AsRange()->Min()->Number(), bitset glb = SEMANTIC(
type->AsRange()->Max()->Number())); BitsetType::Glb(type->AsRange()->Min(), type->AsRange()->Max()));
if (glb == 0) { if (glb == 0) {
return kNone; return kNone;
} else { } else {
...@@ -181,7 +180,7 @@ TypeImpl<Config>::BitsetType::Lub(TypeImpl* type) { ...@@ -181,7 +180,7 @@ TypeImpl<Config>::BitsetType::Lub(TypeImpl* type) {
type->AsClass()->Bound(NULL)->AsBitset(); type->AsClass()->Bound(NULL)->AsBitset();
} }
if (type->IsConstant()) return type->AsConstant()->Bound()->AsBitset(); if (type->IsConstant()) return type->AsConstant()->Bound()->AsBitset();
if (type->IsRange()) return type->AsRange()->Bound()->AsBitset(); if (type->IsRange()) return type->AsRange()->Bound();
if (type->IsContext()) return kInternal & kTaggedPointer; if (type->IsContext()) return kInternal & kTaggedPointer;
if (type->IsArray()) return kArray; if (type->IsArray()) return kArray;
if (type->IsFunction()) return kOtherObject; // TODO(rossberg): kFunction if (type->IsFunction()) return kOtherObject; // TODO(rossberg): kFunction
...@@ -765,13 +764,7 @@ typename TypeImpl<Config>::Limits TypeImpl<Config>::ToLimits(bitset bits, ...@@ -765,13 +764,7 @@ typename TypeImpl<Config>::Limits TypeImpl<Config>::ToLimits(bitset bits,
return Limits::Empty(region); return Limits::Empty(region);
} }
double bitset_min = BitsetType::Min(number_bits); return Limits(BitsetType::Min(number_bits), BitsetType::Max(number_bits),
double bitset_max = BitsetType::Max(number_bits);
// TODO(jarin) Get rid of the heap numbers.
i::Factory* f = i::Isolate::Current()->factory();
return Limits(f->NewNumber(bitset_min), f->NewNumber(bitset_max),
representation); representation);
} }
...@@ -874,10 +867,8 @@ typename TypeImpl<Config>::TypeHandle TypeImpl<Config>::NormalizeRangeAndBitset( ...@@ -874,10 +867,8 @@ typename TypeImpl<Config>::TypeHandle TypeImpl<Config>::NormalizeRangeAndBitset(
double bitset_min = BitsetType::Min(number_bits); double bitset_min = BitsetType::Min(number_bits);
double bitset_max = BitsetType::Max(number_bits); double bitset_max = BitsetType::Max(number_bits);
i::Handle<i::Object> range_min_obj = range->Min(); double range_min = range->Min();
i::Handle<i::Object> range_max_obj = range->Max(); double range_max = range->Max();
double range_min = range_min_obj->Number();
double range_max = range_max_obj->Number();
bitset range_representation = REPRESENTATION(range->BitsetLub()); bitset range_representation = REPRESENTATION(range->BitsetLub());
bitset bits_representation = REPRESENTATION(*bits); bitset bits_representation = REPRESENTATION(*bits);
...@@ -897,14 +888,12 @@ typename TypeImpl<Config>::TypeHandle TypeImpl<Config>::NormalizeRangeAndBitset( ...@@ -897,14 +888,12 @@ typename TypeImpl<Config>::TypeHandle TypeImpl<Config>::NormalizeRangeAndBitset(
} }
if (bitset_min < range_min) { if (bitset_min < range_min) {
// TODO(jarin) Get rid of the heap numbers. range_min = bitset_min;
range_min_obj = i::Isolate::Current()->factory()->NewNumber(bitset_min);
} }
if (bitset_max > range_max) { if (bitset_max > range_max) {
// TODO(jarin) Get rid of the heap numbers. range_max = bitset_max;
range_max_obj = i::Isolate::Current()->factory()->NewNumber(bitset_max);
} }
return RangeType::New(range_min_obj, range_max_obj, return RangeType::New(range_min, range_max,
BitsetType::New(representation, region), region); BitsetType::New(representation, region), region);
} }
...@@ -1227,8 +1216,8 @@ void TypeImpl<Config>::PrintTo(std::ostream& os, PrintDimension dim) { ...@@ -1227,8 +1216,8 @@ void TypeImpl<Config>::PrintTo(std::ostream& os, PrintDimension dim) {
} else if (this->IsRange()) { } else if (this->IsRange()) {
std::ostream::fmtflags saved_flags = os.setf(std::ios::fixed); std::ostream::fmtflags saved_flags = os.setf(std::ios::fixed);
std::streamsize saved_precision = os.precision(0); std::streamsize saved_precision = os.precision(0);
os << "Range(" << this->AsRange()->Min()->Number() << ", " os << "Range(" << this->AsRange()->Min() << ", " << this->AsRange()->Max()
<< this->AsRange()->Max()->Number() << ")"; << ")";
os.flags(saved_flags); os.flags(saved_flags);
os.precision(saved_precision); os.precision(saved_precision);
} else if (this->IsContext()) { } else if (this->IsContext()) {
......
This diff is collapsed.
...@@ -972,11 +972,8 @@ TEST(LowerNumberCmp_to_float64) { ...@@ -972,11 +972,8 @@ TEST(LowerNumberCmp_to_float64) {
TEST(LowerNumberAddSub_to_int32) { TEST(LowerNumberAddSub_to_int32) {
HandleAndZoneScope scope; HandleAndZoneScope scope;
Factory* f = scope.main_isolate()->factory(); Type* small_range = Type::Range(1, 10, scope.main_zone());
Type* small_range = Type* large_range = Type::Range(-1e+13, 1e+14, scope.main_zone());
Type::Range(f->NewNumber(1), f->NewNumber(10), scope.main_zone());
Type* large_range =
Type::Range(f->NewNumber(-1e+13), f->NewNumber(1e+14), scope.main_zone());
static Type* types[] = {Type::Signed32(), Type::Integral32(), small_range, static Type* types[] = {Type::Signed32(), Type::Integral32(), small_range,
large_range}; large_range};
...@@ -996,11 +993,8 @@ TEST(LowerNumberAddSub_to_int32) { ...@@ -996,11 +993,8 @@ TEST(LowerNumberAddSub_to_int32) {
TEST(LowerNumberAddSub_to_uint32) { TEST(LowerNumberAddSub_to_uint32) {
HandleAndZoneScope scope; HandleAndZoneScope scope;
Factory* f = scope.main_isolate()->factory(); Type* small_range = Type::Range(1, 10, scope.main_zone());
Type* small_range = Type* large_range = Type::Range(-1e+13, 1e+14, scope.main_zone());
Type::Range(f->NewNumber(1), f->NewNumber(10), scope.main_zone());
Type* large_range =
Type::Range(f->NewNumber(-1e+13), f->NewNumber(1e+14), scope.main_zone());
static Type* types[] = {Type::Signed32(), Type::Integral32(), small_range, static Type* types[] = {Type::Signed32(), Type::Integral32(), small_range,
large_range}; large_range};
......
...@@ -87,11 +87,8 @@ class TyperTester : public HandleAndZoneScope, public GraphAndBuilders { ...@@ -87,11 +87,8 @@ class TyperTester : public HandleAndZoneScope, public GraphAndBuilders {
} }
Type* NewRange(double i, double j) { Type* NewRange(double i, double j) {
Factory* f = isolate()->factory(); if (i > j) std::swap(i, j);
i::Handle<i::Object> min = f->NewNumber(i); return Type::Range(i, j, main_zone());
i::Handle<i::Object> max = f->NewNumber(j);
if (min->Number() > max->Number()) std::swap(min, max);
return Type::Range(min, max, main_zone());
} }
double RandomInt(double min, double max) { double RandomInt(double min, double max) {
...@@ -113,7 +110,7 @@ class TyperTester : public HandleAndZoneScope, public GraphAndBuilders { ...@@ -113,7 +110,7 @@ class TyperTester : public HandleAndZoneScope, public GraphAndBuilders {
} }
double RandomInt(Type::RangeType* range) { double RandomInt(Type::RangeType* range) {
return RandomInt(range->Min()->Number(), range->Max()->Number()); return RandomInt(range->Min(), range->Max());
} }
// Careful, this function runs O(max_width^5) trials. // Careful, this function runs O(max_width^5) trials.
......
...@@ -36,7 +36,8 @@ struct ZoneRep { ...@@ -36,7 +36,8 @@ struct ZoneRep {
return !IsBitset(t) && reinterpret_cast<intptr_t>(AsStruct(t)[0]) == tag; return !IsBitset(t) && reinterpret_cast<intptr_t>(AsStruct(t)[0]) == tag;
} }
static bool IsBitset(Type* t) { return reinterpret_cast<uintptr_t>(t) & 1; } static bool IsBitset(Type* t) { return reinterpret_cast<uintptr_t>(t) & 1; }
static bool IsUnion(Type* t) { return IsStruct(t, 6); } // HACK: the number 5 below is the value of StructuralType::kUnionTag.
static bool IsUnion(Type* t) { return t->IsUnionForTesting(); }
static Struct* AsStruct(Type* t) { static Struct* AsStruct(Type* t) {
return reinterpret_cast<Struct*>(t); return reinterpret_cast<Struct*>(t);
...@@ -69,7 +70,8 @@ struct HeapRep { ...@@ -69,7 +70,8 @@ struct HeapRep {
return t->IsFixedArray() && Smi::cast(AsStruct(t)->get(0))->value() == tag; return t->IsFixedArray() && Smi::cast(AsStruct(t)->get(0))->value() == tag;
} }
static bool IsBitset(Handle<HeapType> t) { return t->IsSmi(); } static bool IsBitset(Handle<HeapType> t) { return t->IsSmi(); }
static bool IsUnion(Handle<HeapType> t) { return IsStruct(t, 6); } // HACK: the number 5 below is the value of StructuralType::kUnionTag.
static bool IsUnion(Handle<HeapType> t) { return t->IsUnionForTesting(); }
static Struct* AsStruct(Handle<HeapType> t) { return FixedArray::cast(*t); } static Struct* AsStruct(Handle<HeapType> t) { return FixedArray::cast(*t); }
static bitset AsBitset(Handle<HeapType> t) { static bitset AsBitset(Handle<HeapType> t) {
...@@ -351,9 +353,9 @@ struct Tests : Rep { ...@@ -351,9 +353,9 @@ struct Tests : Rep {
// Constructor // Constructor
for (ValueIterator i = T.integers.begin(); i != T.integers.end(); ++i) { for (ValueIterator i = T.integers.begin(); i != T.integers.end(); ++i) {
for (ValueIterator j = T.integers.begin(); j != T.integers.end(); ++j) { for (ValueIterator j = T.integers.begin(); j != T.integers.end(); ++j) {
i::Handle<i::Object> min = *i; double min = (*i)->Number();
i::Handle<i::Object> max = *j; double max = (*j)->Number();
if (min->Number() > max->Number()) std::swap(min, max); if (min > max) std::swap(min, max);
TypeHandle type = T.Range(min, max); TypeHandle type = T.Range(min, max);
CHECK(type->IsRange()); CHECK(type->IsRange());
} }
...@@ -362,12 +364,12 @@ struct Tests : Rep { ...@@ -362,12 +364,12 @@ struct Tests : Rep {
// Range attributes // Range attributes
for (ValueIterator i = T.integers.begin(); i != T.integers.end(); ++i) { for (ValueIterator i = T.integers.begin(); i != T.integers.end(); ++i) {
for (ValueIterator j = T.integers.begin(); j != T.integers.end(); ++j) { for (ValueIterator j = T.integers.begin(); j != T.integers.end(); ++j) {
i::Handle<i::Object> min = *i; double min = (*i)->Number();
i::Handle<i::Object> max = *j; double max = (*j)->Number();
if (min->Number() > max->Number()) std::swap(min, max); if (min > max) std::swap(min, max);
TypeHandle type = T.Range(min, max); TypeHandle type = T.Range(min, max);
CHECK(*min == *type->AsRange()->Min()); CHECK(min == type->AsRange()->Min());
CHECK(*max == *type->AsRange()->Max()); CHECK(max == type->AsRange()->Max());
} }
} }
...@@ -381,15 +383,15 @@ struct Tests : Rep { ...@@ -381,15 +383,15 @@ struct Tests : Rep {
i2 != T.integers.end(); ++i2) { i2 != T.integers.end(); ++i2) {
for (ValueIterator j2 = i2; for (ValueIterator j2 = i2;
j2 != T.integers.end(); ++j2) { j2 != T.integers.end(); ++j2) {
i::Handle<i::Object> min1 = *i1; double min1 = (*i1)->Number();
i::Handle<i::Object> max1 = *j1; double max1 = (*j1)->Number();
i::Handle<i::Object> min2 = *i2; double min2 = (*i2)->Number();
i::Handle<i::Object> max2 = *j2; double max2 = (*j2)->Number();
if (min1->Number() > max1->Number()) std::swap(min1, max1); if (min1 > max1) std::swap(min1, max1);
if (min2->Number() > max2->Number()) std::swap(min2, max2); if (min2 > max2) std::swap(min2, max2);
TypeHandle type1 = T.Range(min1, max1); TypeHandle type1 = T.Range(min1, max1);
TypeHandle type2 = T.Range(min2, max2); TypeHandle type2 = T.Range(min2, max2);
CHECK(Equal(type1, type2) == (*min1 == *min2 && *max1 == *max2)); CHECK(Equal(type1, type2) == (min1 == min2 && max1 == max2));
} }
} }
} }
...@@ -608,8 +610,6 @@ struct Tests : Rep { ...@@ -608,8 +610,6 @@ struct Tests : Rep {
} }
void MinMax() { void MinMax() {
Factory* fac = isolate->factory();
// If b is regular numeric bitset, then Range(b->Min(), b->Max())->Is(b). // If b is regular numeric bitset, then Range(b->Min(), b->Max())->Is(b).
// TODO(neis): Need to ignore representation for this to be true. // TODO(neis): Need to ignore representation for this to be true.
/* /*
...@@ -662,8 +662,7 @@ struct Tests : Rep { ...@@ -662,8 +662,7 @@ struct Tests : Rep {
for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) {
TypeHandle type = *it; TypeHandle type = *it;
CHECK(!(type->Is(T.Integer) && !type->Is(T.None)) || CHECK(!(type->Is(T.Integer) && !type->Is(T.None)) ||
type->Is(T.Range(fac->NewNumber(type->Min()), type->Is(T.Range(type->Min(), type->Max())));
fac->NewNumber(type->Max()))));
} }
} }
...@@ -828,17 +827,15 @@ struct Tests : Rep { ...@@ -828,17 +827,15 @@ struct Tests : Rep {
i2 != T.integers.end(); ++i2) { i2 != T.integers.end(); ++i2) {
for (ValueIterator j2 = i2; for (ValueIterator j2 = i2;
j2 != T.integers.end(); ++j2) { j2 != T.integers.end(); ++j2) {
i::Handle<i::Object> min1 = *i1; double min1 = (*i1)->Number();
i::Handle<i::Object> max1 = *j1; double max1 = (*j1)->Number();
i::Handle<i::Object> min2 = *i2; double min2 = (*i2)->Number();
i::Handle<i::Object> max2 = *j2; double max2 = (*j2)->Number();
if (min1->Number() > max1->Number()) std::swap(min1, max1); if (min1 > max1) std::swap(min1, max1);
if (min2->Number() > max2->Number()) std::swap(min2, max2); if (min2 > max2) std::swap(min2, max2);
TypeHandle type1 = T.Range(min1, max1); TypeHandle type1 = T.Range(min1, max1);
TypeHandle type2 = T.Range(min2, max2); TypeHandle type2 = T.Range(min2, max2);
CHECK(type1->Is(type2) == CHECK(type1->Is(type2) == (min1 >= min2 && max1 <= max2));
(min1->Number() >= min2->Number() &&
max1->Number() <= max2->Number()));
} }
} }
} }
...@@ -898,8 +895,8 @@ struct Tests : Rep { ...@@ -898,8 +895,8 @@ struct Tests : Rep {
for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) {
TypeHandle type = *it; TypeHandle type = *it;
if (type->IsConstant() && IsInteger(*type->AsConstant()->Value())) { if (type->IsConstant() && IsInteger(*type->AsConstant()->Value())) {
CHECK(type->Is( CHECK(type->Is(T.Range(type->AsConstant()->Value()->Number(),
T.Range(type->AsConstant()->Value(), type->AsConstant()->Value()))); type->AsConstant()->Value()->Number())));
} }
} }
...@@ -910,8 +907,8 @@ struct Tests : Rep { ...@@ -910,8 +907,8 @@ struct Tests : Rep {
TypeHandle type2 = *it2; TypeHandle type2 = *it2;
if (type1->IsConstant() && type2->IsRange() && type1->Is(type2)) { if (type1->IsConstant() && type2->IsRange() && type1->Is(type2)) {
double x = type1->AsConstant()->Value()->Number(); double x = type1->AsConstant()->Value()->Number();
double min = type2->AsRange()->Min()->Number(); double min = type2->AsRange()->Min();
double max = type2->AsRange()->Max()->Number(); double max = type2->AsRange()->Max();
CHECK(IsInteger(x) && min <= x && x <= max); CHECK(IsInteger(x) && min <= x && x <= max);
} }
} }
...@@ -1848,8 +1845,8 @@ struct Tests : Rep { ...@@ -1848,8 +1845,8 @@ struct Tests : Rep {
TypeHandle type1 = *it1; TypeHandle type1 = *it1;
if (type1->IsRange()) { if (type1->IsRange()) {
typename Type::RangeType* range = type1->GetRange(); typename Type::RangeType* range = type1->GetRange();
CHECK(type1->Min() == range->Min()->Number()); CHECK(type1->Min() == range->Min());
CHECK(type1->Max() == range->Max()->Number()); CHECK(type1->Max() == range->Max());
} }
} }
...@@ -1861,8 +1858,8 @@ struct Tests : Rep { ...@@ -1861,8 +1858,8 @@ struct Tests : Rep {
if (type1->IsConstant() && type2->IsRange()) { if (type1->IsConstant() && type2->IsRange()) {
TypeHandle u = T.Union(type1, type2); TypeHandle u = T.Union(type1, type2);
CHECK(type2->Min() == u->GetRange()->Min()->Number()); CHECK(type2->Min() == u->GetRange()->Min());
CHECK(type2->Max() == u->GetRange()->Max()->Number()); CHECK(type2->Max() == u->GetRange()->Max());
} }
} }
} }
......
...@@ -101,8 +101,7 @@ class Types { ...@@ -101,8 +101,7 @@ class Types {
if (!IsMinusZero(x)) integers.push_back(isolate->factory()->NewNumber(x)); if (!IsMinusZero(x)) integers.push_back(isolate->factory()->NewNumber(x));
} }
Integer = Type::Range(isolate->factory()->NewNumber(-V8_INFINITY), Integer = Type::Range(-V8_INFINITY, +V8_INFINITY, region);
isolate->factory()->NewNumber(+V8_INFINITY), region);
NumberArray = Type::Array(Number, region); NumberArray = Type::Array(Number, region);
StringArray = Type::Array(String, region); StringArray = Type::Array(String, region);
...@@ -184,7 +183,7 @@ class Types { ...@@ -184,7 +183,7 @@ class Types {
return Type::Constant(value, region_); return Type::Constant(value, region_);
} }
TypeHandle Range(Handle<i::Object> min, Handle<i::Object> max) { TypeHandle Range(double min, double max) {
return Type::Range(min, max, region_); return Type::Range(min, max, region_);
} }
...@@ -263,9 +262,9 @@ class Types { ...@@ -263,9 +262,9 @@ class Types {
case 3: { // range case 3: { // range
int i = rng_->NextInt(static_cast<int>(integers.size())); int i = rng_->NextInt(static_cast<int>(integers.size()));
int j = rng_->NextInt(static_cast<int>(integers.size())); int j = rng_->NextInt(static_cast<int>(integers.size()));
i::Handle<i::Object> min = integers[i]; double min = integers[i]->Number();
i::Handle<i::Object> max = integers[j]; double max = integers[j]->Number();
if (min->Number() > max->Number()) std::swap(min, max); if (min > max) std::swap(min, max);
return Type::Range(min, max, region_); return Type::Range(min, max, region_);
} }
case 4: { // context case 4: { // context
......
...@@ -119,7 +119,6 @@ TEST_F(JSTypedLoweringTest, JSUnaryNotWithBoolean) { ...@@ -119,7 +119,6 @@ TEST_F(JSTypedLoweringTest, JSUnaryNotWithBoolean) {
TEST_F(JSTypedLoweringTest, JSUnaryNotWithFalsish) { TEST_F(JSTypedLoweringTest, JSUnaryNotWithFalsish) {
Handle<Object> zero = factory()->NewNumber(0);
Node* input = Parameter( Node* input = Parameter(
Type::Union( Type::Union(
Type::MinusZero(), Type::MinusZero(),
...@@ -133,7 +132,7 @@ TEST_F(JSTypedLoweringTest, JSUnaryNotWithFalsish) { ...@@ -133,7 +132,7 @@ TEST_F(JSTypedLoweringTest, JSUnaryNotWithFalsish) {
Type::Undetectable(), Type::Undetectable(),
Type::Union( Type::Union(
Type::Constant(factory()->false_value(), zone()), Type::Constant(factory()->false_value(), zone()),
Type::Range(zero, zero, zone()), zone()), Type::Range(0.0, 0.0, zone()), zone()),
zone()), zone()),
zone()), zone()),
zone()), zone()),
...@@ -164,9 +163,7 @@ TEST_F(JSTypedLoweringTest, JSUnaryNotWithTruish) { ...@@ -164,9 +163,7 @@ TEST_F(JSTypedLoweringTest, JSUnaryNotWithTruish) {
TEST_F(JSTypedLoweringTest, JSUnaryNotWithNonZeroPlainNumber) { TEST_F(JSTypedLoweringTest, JSUnaryNotWithNonZeroPlainNumber) {
Node* input = Parameter( Node* input = Parameter(Type::Range(1.0, 42.0, zone()), 0);
Type::Range(factory()->NewNumber(1), factory()->NewNumber(42), zone()),
0);
Node* context = Parameter(Type::Any(), 1); Node* context = Parameter(Type::Any(), 1);
Reduction r = Reduction r =
Reduce(graph()->NewNode(javascript()->UnaryNot(), input, context)); Reduce(graph()->NewNode(javascript()->UnaryNot(), input, context));
...@@ -259,8 +256,7 @@ TEST_F(JSTypedLoweringTest, ParameterWithPlainNumber) { ...@@ -259,8 +256,7 @@ TEST_F(JSTypedLoweringTest, ParameterWithPlainNumber) {
EXPECT_THAT(r.replacement(), IsNumberConstant(value)); EXPECT_THAT(r.replacement(), IsNumberConstant(value));
} }
TRACED_FOREACH(double, value, kIntegerValues) { TRACED_FOREACH(double, value, kIntegerValues) {
Handle<Object> constant = factory()->NewNumber(value); Reduction r = Reduce(Parameter(Type::Range(value, value, zone())));
Reduction r = Reduce(Parameter(Type::Range(constant, constant, zone())));
ASSERT_TRUE(r.Changed()); ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(), IsNumberConstant(value)); EXPECT_THAT(r.replacement(), IsNumberConstant(value));
} }
...@@ -299,7 +295,6 @@ TEST_F(JSTypedLoweringTest, JSToBooleanWithBoolean) { ...@@ -299,7 +295,6 @@ TEST_F(JSTypedLoweringTest, JSToBooleanWithBoolean) {
TEST_F(JSTypedLoweringTest, JSToBooleanWithFalsish) { TEST_F(JSTypedLoweringTest, JSToBooleanWithFalsish) {
Handle<Object> zero = factory()->NewNumber(0);
Node* input = Parameter( Node* input = Parameter(
Type::Union( Type::Union(
Type::MinusZero(), Type::MinusZero(),
...@@ -313,7 +308,7 @@ TEST_F(JSTypedLoweringTest, JSToBooleanWithFalsish) { ...@@ -313,7 +308,7 @@ TEST_F(JSTypedLoweringTest, JSToBooleanWithFalsish) {
Type::Undetectable(), Type::Undetectable(),
Type::Union( Type::Union(
Type::Constant(factory()->false_value(), zone()), Type::Constant(factory()->false_value(), zone()),
Type::Range(zero, zero, zone()), zone()), Type::Range(0.0, 0.0, zone()), zone()),
zone()), zone()),
zone()), zone()),
zone()), zone()),
...@@ -344,10 +339,7 @@ TEST_F(JSTypedLoweringTest, JSToBooleanWithTruish) { ...@@ -344,10 +339,7 @@ TEST_F(JSTypedLoweringTest, JSToBooleanWithTruish) {
TEST_F(JSTypedLoweringTest, JSToBooleanWithNonZeroPlainNumber) { TEST_F(JSTypedLoweringTest, JSToBooleanWithNonZeroPlainNumber) {
Node* input = Node* input = Parameter(Type::Range(1, V8_INFINITY, zone()), 0);
Parameter(Type::Range(factory()->NewNumber(1),
factory()->NewNumber(V8_INFINITY), zone()),
0);
Node* context = Parameter(Type::Any(), 1); Node* context = Parameter(Type::Any(), 1);
Reduction r = Reduction r =
Reduce(graph()->NewNode(javascript()->ToBoolean(), input, context)); Reduce(graph()->NewNode(javascript()->ToBoolean(), input, context));
...@@ -593,8 +585,7 @@ TEST_F(JSTypedLoweringTest, JSLoadPropertyFromExternalTypedArray) { ...@@ -593,8 +585,7 @@ TEST_F(JSTypedLoweringTest, JSLoadPropertyFromExternalTypedArray) {
int const element_size = static_cast<int>(array->element_size()); int const element_size = static_cast<int>(array->element_size());
Node* key = Parameter( Node* key = Parameter(
Type::Range(factory()->NewNumber(kMinInt / element_size), Type::Range(kMinInt / element_size, kMaxInt / element_size, zone()));
factory()->NewNumber(kMaxInt / element_size), zone()));
Node* base = HeapConstant(array); Node* base = HeapConstant(array);
Node* context = UndefinedConstant(); Node* context = UndefinedConstant();
Node* effect = graph()->start(); Node* effect = graph()->start();
...@@ -640,8 +631,7 @@ TEST_F(JSTypedLoweringTest, JSLoadPropertyFromExternalTypedArrayWithSafeKey) { ...@@ -640,8 +631,7 @@ TEST_F(JSTypedLoweringTest, JSLoadPropertyFromExternalTypedArrayWithSafeKey) {
int min = random_number_generator()->NextInt(static_cast<int>(kLength)); int min = random_number_generator()->NextInt(static_cast<int>(kLength));
int max = random_number_generator()->NextInt(static_cast<int>(kLength)); int max = random_number_generator()->NextInt(static_cast<int>(kLength));
if (min > max) std::swap(min, max); if (min > max) std::swap(min, max);
Node* key = Parameter(Type::Range(factory()->NewNumber(min), Node* key = Parameter(Type::Range(min, max, zone()));
factory()->NewNumber(max), zone()));
Node* base = HeapConstant(array); Node* base = HeapConstant(array);
Node* context = UndefinedConstant(); Node* context = UndefinedConstant();
Node* effect = graph()->start(); Node* effect = graph()->start();
...@@ -681,8 +671,7 @@ TEST_F(JSTypedLoweringTest, JSStorePropertyToExternalTypedArray) { ...@@ -681,8 +671,7 @@ TEST_F(JSTypedLoweringTest, JSStorePropertyToExternalTypedArray) {
int const element_size = static_cast<int>(array->element_size()); int const element_size = static_cast<int>(array->element_size());
Node* key = Parameter( Node* key = Parameter(
Type::Range(factory()->NewNumber(kMinInt / element_size), Type::Range(kMinInt / element_size, kMaxInt / element_size, zone()));
factory()->NewNumber(kMaxInt / element_size), zone()));
Node* base = HeapConstant(array); Node* base = HeapConstant(array);
Node* value = Node* value =
Parameter(AccessBuilder::ForTypedArrayElement(type, true).type); Parameter(AccessBuilder::ForTypedArrayElement(type, true).type);
...@@ -728,8 +717,7 @@ TEST_F(JSTypedLoweringTest, JSStorePropertyToExternalTypedArrayWithConversion) { ...@@ -728,8 +717,7 @@ TEST_F(JSTypedLoweringTest, JSStorePropertyToExternalTypedArrayWithConversion) {
int const element_size = static_cast<int>(array->element_size()); int const element_size = static_cast<int>(array->element_size());
Node* key = Parameter( Node* key = Parameter(
Type::Range(factory()->NewNumber(kMinInt / element_size), Type::Range(kMinInt / element_size, kMaxInt / element_size, zone()));
factory()->NewNumber(kMaxInt / element_size), zone()));
Node* base = HeapConstant(array); Node* base = HeapConstant(array);
Node* value = Parameter(Type::Any()); Node* value = Parameter(Type::Any());
Node* context = UndefinedConstant(); Node* context = UndefinedConstant();
...@@ -787,8 +775,7 @@ TEST_F(JSTypedLoweringTest, JSStorePropertyToExternalTypedArrayWithSafeKey) { ...@@ -787,8 +775,7 @@ TEST_F(JSTypedLoweringTest, JSStorePropertyToExternalTypedArrayWithSafeKey) {
int min = random_number_generator()->NextInt(static_cast<int>(kLength)); int min = random_number_generator()->NextInt(static_cast<int>(kLength));
int max = random_number_generator()->NextInt(static_cast<int>(kLength)); int max = random_number_generator()->NextInt(static_cast<int>(kLength));
if (min > max) std::swap(min, max); if (min > max) std::swap(min, max);
Node* key = Parameter(Type::Range(factory()->NewNumber(min), Node* key = Parameter(Type::Range(min, max, zone()));
factory()->NewNumber(max), zone()));
Node* base = HeapConstant(array); Node* base = HeapConstant(array);
Node* value = Parameter(access.type); Node* value = Parameter(access.type);
Node* context = UndefinedConstant(); Node* context = UndefinedConstant();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment