Chromium Code Reviews| Index: runtime/vm/intermediate_language.h |
| =================================================================== |
| --- runtime/vm/intermediate_language.h (revision 31125) |
| +++ runtime/vm/intermediate_language.h (working copy) |
| @@ -711,7 +711,7 @@ |
| virtual void Accept(FlowGraphVisitor* visitor); \ |
| virtual type##Instr* As##type() { return this; } \ |
| virtual const char* DebugName() const { return #type; } \ |
| - virtual LocationSummary* MakeLocationSummary() const; \ |
| + virtual LocationSummary* MakeLocationSummary(bool optimizing) const; \ |
| virtual void EmitNativeCode(FlowGraphCompiler* compiler); \ |
| @@ -729,6 +729,7 @@ |
| previous_(NULL), |
| next_(NULL), |
| env_(NULL), |
| + locs_(NULL), |
| place_id_(kNoPlaceId) { } |
| virtual Tag tag() const = 0; |
| @@ -830,14 +831,17 @@ |
| // Returns structure describing location constraints required |
| // to emit native code for this instruction. |
| virtual LocationSummary* locs() { |
| - // TODO(vegorov): This should be pure virtual method. |
| - // However we are temporary using NULL for instructions that |
| - // were not converted to the location based code generation yet. |
| - return NULL; |
| + ASSERT(locs_ != NULL); |
| + return locs_; |
| } |
| - virtual LocationSummary* MakeLocationSummary() const = 0; |
| + virtual LocationSummary* MakeLocationSummary(bool is_optimizing) const = 0; |
| + void InitializeLocationSummary(bool optimizing) { |
| + ASSERT(locs_ == NULL); |
| + locs_ = MakeLocationSummary(optimizing); |
| + } |
| + |
| static LocationSummary* MakeCallSummary(); |
| virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
| @@ -953,6 +957,7 @@ |
| } |
| private: |
| + friend class FlowGraphPrinter; |
| friend class Definition; // Needed for InsertBefore, InsertAfter. |
| // Classes that set or read deopt_id_. |
| @@ -1027,6 +1032,7 @@ |
| Instruction* previous_; |
| Instruction* next_; |
| Environment* env_; |
| + LocationSummary* locs_; |
| intptr_t place_id_; |
| DISALLOW_COPY_AND_ASSIGN(Instruction); |
| @@ -1036,18 +1042,11 @@ |
| template<intptr_t N> |
| class TemplateInstruction: public Instruction { |
| public: |
| - TemplateInstruction<N>() : locs_(NULL) { } |
| + TemplateInstruction<N>() : inputs_() { } |
| virtual intptr_t InputCount() const { return N; } |
| virtual Value* InputAt(intptr_t i) const { return inputs_[i]; } |
| - virtual LocationSummary* locs() { |
| - if (locs_ == NULL) { |
| - locs_ = MakeLocationSummary(); |
| - } |
| - return locs_; |
| - } |
| - |
| protected: |
| EmbeddedArray<Value*, N> inputs_; |
| @@ -1055,8 +1054,6 @@ |
| virtual void RawSetInputAt(intptr_t i, Value* value) { |
| inputs_[i] = value; |
| } |
| - |
| - LocationSummary* locs_; |
| }; |
| @@ -1929,7 +1926,7 @@ |
| class PushArgumentInstr : public Definition { |
| public: |
| - explicit PushArgumentInstr(Value* value) : locs_(NULL) { |
| + explicit PushArgumentInstr(Value* value) { |
| SetInputAt(0, value); |
| set_use_kind(kEffect); // Override the default. |
| } |
| @@ -1948,13 +1945,6 @@ |
| Value* value() const { return value_; } |
| - virtual LocationSummary* locs() { |
| - if (locs_ == NULL) { |
| - locs_ = MakeLocationSummary(); |
| - } |
| - return locs_; |
| - } |
| - |
| virtual intptr_t Hashcode() const { |
| UNREACHABLE(); |
| return 0; |
| @@ -1975,7 +1965,6 @@ |
| } |
| Value* value_; |
| - LocationSummary* locs_; |
| DISALLOW_COPY_AND_ASSIGN(PushArgumentInstr); |
| }; |
| @@ -2133,20 +2122,11 @@ |
| template<intptr_t N> |
| class TemplateDefinition : public Definition { |
| public: |
| - TemplateDefinition<N>() : locs_(NULL) { } |
| + TemplateDefinition<N>() : inputs_() { } |
| virtual intptr_t InputCount() const { return N; } |
| virtual Value* InputAt(intptr_t i) const { return inputs_[i]; } |
| - // Returns a structure describing the location constraints required |
| - // to emit native code for this definition. |
| - LocationSummary* locs() { |
| - if (locs_ == NULL) { |
| - locs_ = MakeLocationSummary(); |
| - } |
| - return locs_; |
| - } |
| - |
| protected: |
| EmbeddedArray<Value*, N> inputs_; |
| @@ -2157,8 +2137,6 @@ |
| virtual void RawSetInputAt(intptr_t i, Value* value) { |
| inputs_[i] = value; |
| } |
| - |
| - LocationSummary* locs_; |
| }; |
| @@ -2260,18 +2238,6 @@ |
| bool is_checked() const { return is_checked_; } |
| - virtual LocationSummary* locs() { |
| - if (comparison()->locs_ == NULL) { |
| - LocationSummary* summary = comparison()->MakeLocationSummary(); |
| - // Branches don't produce a result. |
| - summary->set_out(Location::NoLocation()); |
| - // The back-end expects the location summary to be stored in the |
| - // comparison. |
| - comparison()->locs_ = summary; |
| - } |
| - return comparison()->locs_; |
| - } |
| - |
| virtual intptr_t DeoptimizationTarget() const { |
| return comparison()->DeoptimizationTarget(); |
| } |
| @@ -3154,16 +3120,6 @@ |
| return comparison()->CanBecomeDeoptimizationTarget(); |
| } |
| - virtual LocationSummary* locs() { |
| - if (comparison()->locs_ == NULL) { |
| - LocationSummary* summary = MakeLocationSummary(); |
| - // The back-end expects the location summary to be stored in the |
| - // comparison. |
| - comparison()->locs_ = summary; |
| - } |
| - return comparison()->locs_; |
| - } |
| - |
| virtual intptr_t DeoptimizationTarget() const { |
| return comparison()->DeoptimizationTarget(); |
| } |
| @@ -3470,9 +3426,11 @@ |
| StoreInstanceFieldInstr(const Field& field, |
| Value* instance, |
| Value* value, |
| - StoreBarrierType emit_store_barrier) |
| + StoreBarrierType emit_store_barrier, |
| + bool initialization = false) |
| : field_(field), |
| - emit_store_barrier_(emit_store_barrier) { |
| + emit_store_barrier_(emit_store_barrier), |
| + initialization_(initialization) { |
| SetInputAt(kInstancePos, instance); |
| SetInputAt(kValuePos, value); |
| } |
| @@ -3500,6 +3458,11 @@ |
| virtual bool CanDeoptimize() const { return false; } |
| + // May require a deoptimziation target for input conversions. |
|
srdjan
2013/12/13 18:13:17
s/deoptimziation/deoptimization/
Florian Schneider
2013/12/16 13:08:09
Done.
|
| + virtual intptr_t DeoptimizationTarget() const { |
| + return deopt_id_; |
|
srdjan
2013/12/13 18:13:17
return GetDeoptId() (similar to other places).
Florian Schneider
2013/12/16 13:08:09
Done.
|
| + } |
| + |
| // Currently CSE/LICM don't operate on any instructions that can be affected |
| // by stores/loads. LoadOptimizer handles loads separately. Hence stores |
| // are marked as having no side-effects. |
| @@ -3507,7 +3470,19 @@ |
| virtual bool MayThrow() const { return false; } |
| + bool IsUnboxedStore() const; |
| + |
| + bool IsPotentialUnboxedStore() const; |
| + |
| + virtual Representation RequiredInputRepresentation(intptr_t index) const { |
| + ASSERT(index == 0 || index == 1); |
|
srdjan
2013/12/13 18:13:17
Add parentheses please. Introducing an abbreviatio
Florian Schneider
2013/12/16 13:08:09
Done.
|
| + if (index == 1 && IsUnboxedStore()) return kUnboxedDouble; |
|
srdjan
2013/12/13 18:13:17
APP
Florian Schneider
2013/12/16 13:08:09
Again? :)
|
| + return kTagged; |
| + } |
| + |
| private: |
| + friend class FlowGraphOptimizer; // For ASSERT(initialization_). |
| + |
| bool CanValueBeSmi() const { |
| const intptr_t cid = value()->Type()->ToNullableCid(); |
| // Write barrier is skipped for nullable and non-nullable smis. |
| @@ -3517,6 +3492,7 @@ |
| const Field& field_; |
| const StoreBarrierType emit_store_barrier_; |
| + const bool initialization_; |
|
srdjan
2013/12/13 18:13:17
Please add brief comment what initialization_ mean
Florian Schneider
2013/12/16 13:08:09
Done.
|
| DISALLOW_COPY_AND_ASSIGN(StoreInstanceFieldInstr); |
| }; |
| @@ -3997,11 +3973,6 @@ |
| virtual bool CanDeoptimize() const { return false; } |
| virtual EffectSet Effects() const { return EffectSet::None(); } |
| - LocationSummary* locs() { |
| - UNREACHABLE(); |
| - return NULL; |
| - } |
| - |
| Location* locations() { return locations_; } |
| void set_locations(Location* locations) { locations_ = locations; } |
| @@ -4217,6 +4188,14 @@ |
| const Field* field() const { return field_; } |
| void set_field(const Field* field) { field_ = field; } |
| + virtual Representation representation() const { |
| + return IsUnboxedLoad() ? kUnboxedDouble : kTagged; |
|
Cutch
2013/12/13 19:48:43
Can we not hardcode kUnboxedDouble as the represen
Florian Schneider
2013/12/16 13:08:09
Yes. I agree. I'd like to generalize the approach
|
| + } |
| + |
| + bool IsUnboxedLoad() const; |
| + |
| + bool IsPotentialUnboxedLoad() const; |
| + |
| void set_recognized_kind(MethodRecognizer::Kind kind) { |
| recognized_kind_ = kind; |
| } |
| @@ -6618,15 +6597,6 @@ |
| return (*inputs_)[i]; |
| } |
| - // Returns a structure describing the location constraints required |
| - // to emit native code for this definition. |
| - LocationSummary* locs() { |
| - if (locs_ == NULL) { |
| - locs_ = MakeLocationSummary(); |
| - } |
| - return locs_; |
| - } |
| - |
| virtual bool AllowsCSE() const { return true; } |
| virtual EffectSet Effects() const { return EffectSet::None(); } |
| virtual EffectSet Dependencies() const { return EffectSet::None(); } |
| @@ -6644,8 +6614,6 @@ |
| ZoneGrowableArray<Value*>* inputs_; |
| - LocationSummary* locs_; |
| - |
| const MethodRecognizer::Kind recognized_kind_; |
| DISALLOW_COPY_AND_ASSIGN(InvokeMathCFunctionInstr); |
| @@ -6728,15 +6696,6 @@ |
| DECLARE_INSTRUCTION(MergedMath) |
| - // Returns a structure describing the location constraints required |
| - // to emit native code for this definition. |
| - LocationSummary* locs() { |
| - if (locs_ == NULL) { |
| - locs_ = MakeLocationSummary(); |
| - } |
| - return locs_; |
| - } |
| - |
| virtual bool AllowsCSE() const { return true; } |
| virtual EffectSet Effects() const { return EffectSet::None(); } |
| virtual EffectSet Dependencies() const { return EffectSet::None(); } |
| @@ -6760,7 +6719,6 @@ |
| } |
| ZoneGrowableArray<Value*>* inputs_; |
| - LocationSummary* locs_; |
| MergedMathInstr::Kind kind_; |
| DISALLOW_COPY_AND_ASSIGN(MergedMathInstr); |