| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ | 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ |
| 6 #define VM_INTERMEDIATE_LANGUAGE_H_ | 6 #define VM_INTERMEDIATE_LANGUAGE_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/ast.h" | 9 #include "vm/ast.h" |
| 10 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
| (...skipping 3259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3270 } | 3270 } |
| 3271 | 3271 |
| 3272 void mark_last() { is_last_ = true; } | 3272 void mark_last() { is_last_ = true; } |
| 3273 bool is_last() const { return is_last_; } | 3273 bool is_last() const { return is_last_; } |
| 3274 | 3274 |
| 3275 virtual intptr_t token_pos() const { return token_pos_; } | 3275 virtual intptr_t token_pos() const { return token_pos_; } |
| 3276 | 3276 |
| 3277 private: | 3277 private: |
| 3278 const LocalVariable& local_; | 3278 const LocalVariable& local_; |
| 3279 bool is_last_; | 3279 bool is_last_; |
| 3280 intptr_t token_pos_; | 3280 const intptr_t token_pos_; |
| 3281 | 3281 |
| 3282 DISALLOW_COPY_AND_ASSIGN(LoadLocalInstr); | 3282 DISALLOW_COPY_AND_ASSIGN(LoadLocalInstr); |
| 3283 }; | 3283 }; |
| 3284 | 3284 |
| 3285 | 3285 |
| 3286 class PushTempInstr : public TemplateDefinition<1, NoThrow> { | 3286 class PushTempInstr : public TemplateDefinition<1, NoThrow> { |
| 3287 public: | 3287 public: |
| 3288 explicit PushTempInstr(Value* value) { | 3288 explicit PushTempInstr(Value* value) { |
| 3289 SetInputAt(0, value); | 3289 SetInputAt(0, value); |
| 3290 } | 3290 } |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3385 UNREACHABLE(); // Eliminated by SSA construction. | 3385 UNREACHABLE(); // Eliminated by SSA construction. |
| 3386 return EffectSet::None(); | 3386 return EffectSet::None(); |
| 3387 } | 3387 } |
| 3388 | 3388 |
| 3389 virtual intptr_t token_pos() const { return token_pos_; } | 3389 virtual intptr_t token_pos() const { return token_pos_; } |
| 3390 | 3390 |
| 3391 private: | 3391 private: |
| 3392 const LocalVariable& local_; | 3392 const LocalVariable& local_; |
| 3393 bool is_dead_; | 3393 bool is_dead_; |
| 3394 bool is_last_; | 3394 bool is_last_; |
| 3395 intptr_t token_pos_; | 3395 const intptr_t token_pos_; |
| 3396 | 3396 |
| 3397 DISALLOW_COPY_AND_ASSIGN(StoreLocalInstr); | 3397 DISALLOW_COPY_AND_ASSIGN(StoreLocalInstr); |
| 3398 }; | 3398 }; |
| 3399 | 3399 |
| 3400 | 3400 |
| 3401 class NativeCallInstr : public TemplateDefinition<0, Throws> { | 3401 class NativeCallInstr : public TemplateDefinition<0, Throws> { |
| 3402 public: | 3402 public: |
| 3403 explicit NativeCallInstr(NativeBodyNode* node) | 3403 explicit NativeCallInstr(NativeBodyNode* node) |
| 3404 : ast_node_(*node), | 3404 : ast_node_(*node), |
| 3405 native_c_function_(NULL), | 3405 native_c_function_(NULL), |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3672 virtual bool CanDeoptimize() const { return false; } | 3672 virtual bool CanDeoptimize() const { return false; } |
| 3673 | 3673 |
| 3674 virtual bool AllowsCSE() const { return StaticField().is_final(); } | 3674 virtual bool AllowsCSE() const { return StaticField().is_final(); } |
| 3675 virtual EffectSet Effects() const { return EffectSet::None(); } | 3675 virtual EffectSet Effects() const { return EffectSet::None(); } |
| 3676 virtual EffectSet Dependencies() const; | 3676 virtual EffectSet Dependencies() const; |
| 3677 virtual bool AttributesEqual(Instruction* other) const; | 3677 virtual bool AttributesEqual(Instruction* other) const; |
| 3678 | 3678 |
| 3679 virtual intptr_t token_pos() const { return token_pos_; } | 3679 virtual intptr_t token_pos() const { return token_pos_; } |
| 3680 | 3680 |
| 3681 private: | 3681 private: |
| 3682 intptr_t token_pos_; | 3682 const intptr_t token_pos_; |
| 3683 | 3683 |
| 3684 DISALLOW_COPY_AND_ASSIGN(LoadStaticFieldInstr); | 3684 DISALLOW_COPY_AND_ASSIGN(LoadStaticFieldInstr); |
| 3685 }; | 3685 }; |
| 3686 | 3686 |
| 3687 | 3687 |
| 3688 class StoreStaticFieldInstr : public TemplateDefinition<1, NoThrow> { | 3688 class StoreStaticFieldInstr : public TemplateDefinition<1, NoThrow> { |
| 3689 public: | 3689 public: |
| 3690 StoreStaticFieldInstr(const Field& field, Value* value) | 3690 StoreStaticFieldInstr(const Field& field, |
| 3691 : field_(field) { | 3691 Value* value, |
| 3692 intptr_t token_pos = Scanner::kNoSourcePos) |
| 3693 : field_(field), |
| 3694 token_pos_(token_pos) { |
| 3692 ASSERT(field.IsZoneHandle()); | 3695 ASSERT(field.IsZoneHandle()); |
| 3693 SetInputAt(kValuePos, value); | 3696 SetInputAt(kValuePos, value); |
| 3694 } | 3697 } |
| 3695 | 3698 |
| 3696 enum { | 3699 enum { |
| 3697 kValuePos = 0 | 3700 kValuePos = 0 |
| 3698 }; | 3701 }; |
| 3699 | 3702 |
| 3700 DECLARE_INSTRUCTION(StoreStaticField) | 3703 DECLARE_INSTRUCTION(StoreStaticField) |
| 3701 | 3704 |
| 3702 const Field& field() const { return field_; } | 3705 const Field& field() const { return field_; } |
| 3703 Value* value() const { return inputs_[kValuePos]; } | 3706 Value* value() const { return inputs_[kValuePos]; } |
| 3704 | 3707 |
| 3705 virtual void PrintOperandsTo(BufferFormatter* f) const; | 3708 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 3706 | 3709 |
| 3707 virtual bool CanDeoptimize() const { return false; } | 3710 virtual bool CanDeoptimize() const { return false; } |
| 3708 | 3711 |
| 3709 // Currently CSE/LICM don't operate on any instructions that can be affected | 3712 // Currently CSE/LICM don't operate on any instructions that can be affected |
| 3710 // by stores/loads. LoadOptimizer handles loads separately. Hence stores | 3713 // by stores/loads. LoadOptimizer handles loads separately. Hence stores |
| 3711 // are marked as having no side-effects. | 3714 // are marked as having no side-effects. |
| 3712 virtual EffectSet Effects() const { return EffectSet::None(); } | 3715 virtual EffectSet Effects() const { return EffectSet::None(); } |
| 3713 | 3716 |
| 3717 virtual intptr_t token_pos() const { return token_pos_; } |
| 3718 |
| 3714 private: | 3719 private: |
| 3715 bool CanValueBeSmi() const { | 3720 bool CanValueBeSmi() const { |
| 3716 const intptr_t cid = value()->Type()->ToNullableCid(); | 3721 const intptr_t cid = value()->Type()->ToNullableCid(); |
| 3717 // Write barrier is skipped for nullable and non-nullable smis. | 3722 // Write barrier is skipped for nullable and non-nullable smis. |
| 3718 ASSERT(cid != kSmiCid); | 3723 ASSERT(cid != kSmiCid); |
| 3719 return (cid == kDynamicCid); | 3724 return (cid == kDynamicCid); |
| 3720 } | 3725 } |
| 3721 | 3726 |
| 3722 const Field& field_; | 3727 const Field& field_; |
| 3728 const intptr_t token_pos_; |
| 3723 | 3729 |
| 3724 DISALLOW_COPY_AND_ASSIGN(StoreStaticFieldInstr); | 3730 DISALLOW_COPY_AND_ASSIGN(StoreStaticFieldInstr); |
| 3725 }; | 3731 }; |
| 3726 | 3732 |
| 3727 | 3733 |
| 3728 class LoadIndexedInstr : public TemplateDefinition<2, NoThrow> { | 3734 class LoadIndexedInstr : public TemplateDefinition<2, NoThrow> { |
| 3729 public: | 3735 public: |
| 3730 LoadIndexedInstr(Value* array, | 3736 LoadIndexedInstr(Value* array, |
| 3731 Value* index, | 3737 Value* index, |
| 3732 intptr_t index_scale, | 3738 intptr_t index_scale, |
| (...skipping 4401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8134 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ | 8140 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ |
| 8135 UNIMPLEMENTED(); \ | 8141 UNIMPLEMENTED(); \ |
| 8136 return NULL; \ | 8142 return NULL; \ |
| 8137 } \ | 8143 } \ |
| 8138 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } | 8144 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } |
| 8139 | 8145 |
| 8140 | 8146 |
| 8141 } // namespace dart | 8147 } // namespace dart |
| 8142 | 8148 |
| 8143 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 8149 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |