|
|
@ -259,7 +259,11 @@ bool Range::AddAndCheckOverflow(const Representation& r, Range* other) { |
|
|
|
bool may_overflow = false; |
|
|
|
lower_ = AddWithoutOverflow(r, lower_, other->lower(), &may_overflow); |
|
|
|
upper_ = AddWithoutOverflow(r, upper_, other->upper(), &may_overflow); |
|
|
|
KeepOrder(); |
|
|
|
if (may_overflow) { |
|
|
|
Clear(); |
|
|
|
} else { |
|
|
|
KeepOrder(); |
|
|
|
} |
|
|
|
#ifdef DEBUG |
|
|
|
Verify(); |
|
|
|
#endif |
|
|
@ -271,13 +275,21 @@ bool Range::SubAndCheckOverflow(const Representation& r, Range* other) { |
|
|
|
bool may_overflow = false; |
|
|
|
lower_ = SubWithoutOverflow(r, lower_, other->upper(), &may_overflow); |
|
|
|
upper_ = SubWithoutOverflow(r, upper_, other->lower(), &may_overflow); |
|
|
|
KeepOrder(); |
|
|
|
if (may_overflow) { |
|
|
|
Clear(); |
|
|
|
} else { |
|
|
|
KeepOrder(); |
|
|
|
} |
|
|
|
#ifdef DEBUG |
|
|
|
Verify(); |
|
|
|
#endif |
|
|
|
return may_overflow; |
|
|
|
} |
|
|
|
|
|
|
|
void Range::Clear() { |
|
|
|
lower_ = kMinInt; |
|
|
|
upper_ = kMaxInt; |
|
|
|
} |
|
|
|
|
|
|
|
void Range::KeepOrder() { |
|
|
|
if (lower_ > upper_) { |
|
|
@ -301,8 +313,12 @@ bool Range::MulAndCheckOverflow(const Representation& r, Range* other) { |
|
|
|
int v2 = MulWithoutOverflow(r, lower_, other->upper(), &may_overflow); |
|
|
|
int v3 = MulWithoutOverflow(r, upper_, other->lower(), &may_overflow); |
|
|
|
int v4 = MulWithoutOverflow(r, upper_, other->upper(), &may_overflow); |
|
|
|
lower_ = Min(Min(v1, v2), Min(v3, v4)); |
|
|
|
upper_ = Max(Max(v1, v2), Max(v3, v4)); |
|
|
|
if (may_overflow) { |
|
|
|
Clear(); |
|
|
|
} else { |
|
|
|
lower_ = Min(Min(v1, v2), Min(v3, v4)); |
|
|
|
upper_ = Max(Max(v1, v2), Max(v3, v4)); |
|
|
|
} |
|
|
|
#ifdef DEBUG |
|
|
|
Verify(); |
|
|
|
#endif |
|
|
@ -3184,6 +3200,13 @@ bool HAllocate::HandleSideEffectDominator(GVNFlag side_effect, |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
if (IsAllocationFoldingDominator()) { |
|
|
|
if (FLAG_trace_allocation_folding) { |
|
|
|
PrintF("#%d (%s) cannot fold into #%d (%s), already dominator\n", id(), |
|
|
|
Mnemonic(), dominator->id(), dominator->Mnemonic()); |
|
|
|
} |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
if (!IsFoldable(dominator_allocate)) { |
|
|
|
if (FLAG_trace_allocation_folding) { |
|
|
@ -3235,17 +3258,6 @@ bool HAllocate::HandleSideEffectDominator(GVNFlag side_effect, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (IsAllocationFoldingDominator()) { |
|
|
|
DeleteAndReplaceWith(dominator_allocate); |
|
|
|
if (FLAG_trace_allocation_folding) { |
|
|
|
PrintF( |
|
|
|
"#%d (%s) folded dominator into #%d (%s), new dominator size: %d\n", |
|
|
|
id(), Mnemonic(), dominator_allocate->id(), |
|
|
|
dominator_allocate->Mnemonic(), new_dominator_size); |
|
|
|
} |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
if (!dominator_allocate->IsAllocationFoldingDominator()) { |
|
|
|
HAllocate* first_alloc = |
|
|
|
HAllocate::New(isolate, zone, dominator_allocate->context(), |
|
|
@ -3280,6 +3292,8 @@ std::ostream& HAllocate::PrintDataTo(std::ostream& os) const { // NOLINT |
|
|
|
if (IsOldSpaceAllocation()) os << "P"; |
|
|
|
if (MustAllocateDoubleAligned()) os << "A"; |
|
|
|
if (MustPrefillWithFiller()) os << "F"; |
|
|
|
if (IsAllocationFoldingDominator()) os << "d"; |
|
|
|
if (IsAllocationFolded()) os << "f"; |
|
|
|
return os << ")"; |
|
|
|
} |
|
|
|
|
|
|
|