| Index: runtime/vm/intermediate_language.h
|
| diff --git a/runtime/vm/intermediate_language.h b/runtime/vm/intermediate_language.h
|
| index 0e0df87ef5f76cac15da353b8611cddc2f7996e4..1cffa5d77fdb8e5fca6c0218697dc28b4a658053 100644
|
| --- a/runtime/vm/intermediate_language.h
|
| +++ b/runtime/vm/intermediate_language.h
|
| @@ -1149,6 +1149,7 @@ class BlockEntryInstr : public Instruction {
|
| // entry point.
|
| bool PruneUnreachable(FlowGraphBuilder* builder,
|
| GraphEntryInstr* graph_entry,
|
| + Instruction* parent,
|
| intptr_t osr_id,
|
| BitVector* block_marks);
|
|
|
| @@ -1314,6 +1315,9 @@ class GraphEntryInstr : public BlockEntryInstr {
|
|
|
| bool IsCompiledForOsr() const { return osr_id_ != Isolate::kNoDeoptId; }
|
|
|
| + intptr_t entry_count() const { return entry_count_; }
|
| + void set_entry_count(intptr_t count) { entry_count_ = count; }
|
| +
|
| intptr_t spill_slot_count() const { return spill_slot_count_; }
|
| void set_spill_slot_count(intptr_t count) {
|
| ASSERT(count >= 0);
|
| @@ -1349,6 +1353,7 @@ class GraphEntryInstr : public BlockEntryInstr {
|
| GrowableArray<CatchBlockEntryInstr*> catch_entries_;
|
| GrowableArray<Definition*> initial_definitions_;
|
| const intptr_t osr_id_;
|
| + intptr_t entry_count_;
|
| intptr_t spill_slot_count_;
|
| intptr_t fixed_slot_count_; // For try-catch in optimized code.
|
|
|
| @@ -1432,10 +1437,17 @@ class PhiIterator : public ValueObject {
|
| class TargetEntryInstr : public BlockEntryInstr {
|
| public:
|
| TargetEntryInstr(intptr_t block_id, intptr_t try_index)
|
| - : BlockEntryInstr(block_id, try_index), predecessor_(NULL) { }
|
| + : BlockEntryInstr(block_id, try_index),
|
| + predecessor_(NULL),
|
| + edge_weight_(0.0) {
|
| + }
|
|
|
| DECLARE_INSTRUCTION(TargetEntry)
|
|
|
| + double edge_weight() const { return edge_weight_; }
|
| + void set_edge_weight(double weight) { edge_weight_ = weight; }
|
| + void adjust_edge_weight(double scale_factor) { edge_weight_ *= scale_factor; }
|
| +
|
| virtual intptr_t PredecessorCount() const {
|
| return (predecessor_ == NULL) ? 0 : 1;
|
| }
|
| @@ -1456,6 +1468,7 @@ class TargetEntryInstr : public BlockEntryInstr {
|
| }
|
|
|
| BlockEntryInstr* predecessor_;
|
| + double edge_weight_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(TargetEntryInstr);
|
| };
|
| @@ -1526,6 +1539,12 @@ class Definition : public Instruction {
|
| // Overridden by definitions that push arguments.
|
| virtual intptr_t ArgumentCount() const { return 0; }
|
|
|
| + // Overridden by definitions that have call counts.
|
| + virtual intptr_t CallCount() const {
|
| + UNREACHABLE();
|
| + return -1;
|
| + }
|
| +
|
| intptr_t temp_index() const { return temp_index_; }
|
| void set_temp_index(intptr_t index) { temp_index_ = index; }
|
| void ClearTempIndex() { temp_index_ = -1; }
|
| @@ -1943,7 +1962,9 @@ class GotoInstr : public TemplateInstruction<0> {
|
| public:
|
| explicit GotoInstr(JoinEntryInstr* entry)
|
| : successor_(entry),
|
| - parallel_move_(NULL) { }
|
| + edge_weight_(0.0),
|
| + parallel_move_(NULL) {
|
| + }
|
|
|
| DECLARE_INSTRUCTION(Goto)
|
|
|
| @@ -1954,6 +1975,10 @@ class GotoInstr : public TemplateInstruction<0> {
|
| virtual intptr_t SuccessorCount() const;
|
| virtual BlockEntryInstr* SuccessorAt(intptr_t index) const;
|
|
|
| + double edge_weight() const { return edge_weight_; }
|
| + void set_edge_weight(double weight) { edge_weight_ = weight; }
|
| + void adjust_edge_weight(double scale_factor) { edge_weight_ *= scale_factor; }
|
| +
|
| virtual bool CanBecomeDeoptimizationTarget() const {
|
| // Goto instruction can be used as a deoptimization target when LICM
|
| // hoists instructions out of the loop.
|
| @@ -1985,6 +2010,7 @@ class GotoInstr : public TemplateInstruction<0> {
|
|
|
| private:
|
| JoinEntryInstr* successor_;
|
| + double edge_weight_;
|
|
|
| // Parallel move that will be used by linear scan register allocator to
|
| // connect live ranges at the end of the block and resolve phis.
|
| @@ -2552,6 +2578,9 @@ class ClosureCallInstr : public TemplateDefinition<0> {
|
| return (*arguments_)[index];
|
| }
|
|
|
| + // TODO(kmillikin): implement exact call counts for closure calls.
|
| + virtual intptr_t CallCount() const { return 1; }
|
| +
|
| virtual void PrintOperandsTo(BufferFormatter* f) const;
|
|
|
| virtual bool CanDeoptimize() const { return true; }
|
| @@ -2664,6 +2693,8 @@ class PolymorphicInstanceCallInstr : public TemplateDefinition<0> {
|
| return instance_call()->PushArgumentAt(index);
|
| }
|
|
|
| + virtual intptr_t CallCount() const { return ic_data().AggregateCount(); }
|
| +
|
| DECLARE_INSTRUCTION(PolymorphicInstanceCall)
|
|
|
| const ICData& ic_data() const { return ic_data_; }
|
| @@ -3075,6 +3106,8 @@ class StaticCallInstr : public TemplateDefinition<0> {
|
| return (*arguments_)[index];
|
| }
|
|
|
| + virtual intptr_t CallCount() const { return ic_data()->AggregateCount(); }
|
| +
|
| virtual void PrintOperandsTo(BufferFormatter* f) const;
|
|
|
| virtual bool CanDeoptimize() const { return true; }
|
|
|