Commit 33629651 authored by mtrofin's avatar mtrofin Committed by Commit bot

[turbofan] Avoid large deopt blocks

Treat allocation of splintered ranges differently, by optimizing for move
counts (i.e. try to have less move counts), rather than optimizing for
quality of moves (which is what normal allocation does).

We can see reductions in code size in the benchmarks that measure it
(e.g. Unity)

BUG=

Review-Url: https://codereview.chromium.org/2347563004
Cr-Commit-Position: refs/heads/master@{#40178}
parent e46f1016
......@@ -589,9 +589,7 @@ InstructionBlock::InstructionBlock(Zone* zone, RpoNumber rpo_number,
handler_(handler),
needs_frame_(false),
must_construct_frame_(false),
must_deconstruct_frame_(false),
last_deferred_(RpoNumber::Invalid()) {}
must_deconstruct_frame_(false) {}
size_t InstructionBlock::PredecessorIndexOf(RpoNumber rpo_number) const {
size_t j = 0;
......
......@@ -1300,9 +1300,6 @@ class InstructionBlock final : public ZoneObject {
bool must_deconstruct_frame() const { return must_deconstruct_frame_; }
void mark_must_deconstruct_frame() { must_deconstruct_frame_ = true; }
void set_last_deferred(RpoNumber last) { last_deferred_ = last; }
RpoNumber last_deferred() const { return last_deferred_; }
private:
Successors successors_;
Predecessors predecessors_;
......@@ -1318,7 +1315,6 @@ class InstructionBlock final : public ZoneObject {
bool needs_frame_;
bool must_construct_frame_;
bool must_deconstruct_frame_;
RpoNumber last_deferred_;
};
class InstructionSequence;
......
This diff is collapsed.
......@@ -275,6 +275,7 @@ class UsePosition final : public ZoneObject {
}
bool HasHint() const;
bool HintRegister(int* register_code) const;
void SetHint(UsePosition* use_pos);
void ResolveHint(UsePosition* use_pos);
bool IsResolved() const {
return hint_type() != UsePositionHintType::kUnresolved;
......@@ -368,8 +369,12 @@ class LiveRange : public ZoneObject {
// live range to the result live range.
// The current range will terminate at position, while result will start from
// position.
enum HintConnectionOption : bool {
DoNotConnectHints = false,
ConnectHints = true
};
UsePosition* DetachAt(LifetimePosition position, LiveRange* result,
Zone* zone);
Zone* zone, HintConnectionOption connect_hints);
// Detaches at position, and then links the resulting ranges. Returns the
// child, which starts at position.
......@@ -1047,8 +1052,15 @@ class LinearScanAllocator final : public RegisterAllocator {
// Helper methods for allocating registers.
bool TryReuseSpillForPhi(TopLevelLiveRange* range);
bool TryAllocateFreeReg(LiveRange* range);
bool TryAllocateFreeReg(LiveRange* range,
const Vector<LifetimePosition>& free_until_pos);
bool TryAllocatePreferredReg(LiveRange* range,
const Vector<LifetimePosition>& free_until_pos);
void FindFreeRegistersForRange(LiveRange* range,
Vector<LifetimePosition> free_until_pos);
void ProcessCurrentRange(LiveRange* current);
void AllocateBlockedReg(LiveRange* range);
bool TrySplitAndSpillSplinter(LiveRange* range);
// Spill the given life range after position pos.
void SpillAfter(LiveRange* range, LifetimePosition pos);
......
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