| 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 RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ | 5 #ifndef RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ |
| 6 #define RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ | 6 #define RUNTIME_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 3862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3873 ASSERT(cid != kSmiCid); | 3873 ASSERT(cid != kSmiCid); |
| 3874 return (cid == kDynamicCid); | 3874 return (cid == kDynamicCid); |
| 3875 } | 3875 } |
| 3876 | 3876 |
| 3877 const Field& field_; | 3877 const Field& field_; |
| 3878 const TokenPosition token_pos_; | 3878 const TokenPosition token_pos_; |
| 3879 | 3879 |
| 3880 DISALLOW_COPY_AND_ASSIGN(StoreStaticFieldInstr); | 3880 DISALLOW_COPY_AND_ASSIGN(StoreStaticFieldInstr); |
| 3881 }; | 3881 }; |
| 3882 | 3882 |
| 3883 enum AlignmentType { |
| 3884 kUnalignedAccess, |
| 3885 kAlignedAccess, |
| 3886 }; |
| 3883 | 3887 |
| 3884 class LoadIndexedInstr : public TemplateDefinition<2, NoThrow> { | 3888 class LoadIndexedInstr : public TemplateDefinition<2, NoThrow> { |
| 3885 public: | 3889 public: |
| 3886 LoadIndexedInstr(Value* array, | 3890 LoadIndexedInstr(Value* array, |
| 3887 Value* index, | 3891 Value* index, |
| 3888 intptr_t index_scale, | 3892 intptr_t index_scale, |
| 3889 intptr_t class_id, | 3893 intptr_t class_id, |
| 3894 AlignmentType alignment, |
| 3890 intptr_t deopt_id, | 3895 intptr_t deopt_id, |
| 3891 TokenPosition token_pos) | 3896 TokenPosition token_pos); |
| 3892 : TemplateDefinition(deopt_id), | |
| 3893 index_scale_(index_scale), | |
| 3894 class_id_(class_id), | |
| 3895 token_pos_(token_pos) { | |
| 3896 SetInputAt(0, array); | |
| 3897 SetInputAt(1, index); | |
| 3898 } | |
| 3899 | 3897 |
| 3900 TokenPosition token_pos() const { return token_pos_; } | 3898 TokenPosition token_pos() const { return token_pos_; } |
| 3901 | 3899 |
| 3902 DECLARE_INSTRUCTION(LoadIndexed) | 3900 DECLARE_INSTRUCTION(LoadIndexed) |
| 3903 virtual CompileType ComputeType() const; | 3901 virtual CompileType ComputeType() const; |
| 3904 | 3902 |
| 3905 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 3903 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 3906 ASSERT(idx == 0 || idx == 1); | 3904 ASSERT(idx == 0 || idx == 1); |
| 3907 // The array may be tagged or untagged (for external arrays). | 3905 // The array may be tagged or untagged (for external arrays). |
| 3908 if (idx == 0) return kNoRepresentation; | 3906 if (idx == 0) return kNoRepresentation; |
| 3909 return kTagged; | 3907 return kTagged; |
| 3910 } | 3908 } |
| 3911 | 3909 |
| 3912 bool IsExternal() const { | 3910 bool IsExternal() const { |
| 3913 return array()->definition()->representation() == kUntagged; | 3911 return array()->definition()->representation() == kUntagged; |
| 3914 } | 3912 } |
| 3915 | 3913 |
| 3916 Value* array() const { return inputs_[0]; } | 3914 Value* array() const { return inputs_[0]; } |
| 3917 Value* index() const { return inputs_[1]; } | 3915 Value* index() const { return inputs_[1]; } |
| 3918 intptr_t index_scale() const { return index_scale_; } | 3916 intptr_t index_scale() const { return index_scale_; } |
| 3919 intptr_t class_id() const { return class_id_; } | 3917 intptr_t class_id() const { return class_id_; } |
| 3918 bool aligned() const { return alignment_ == kAlignedAccess; } |
| 3920 | 3919 |
| 3921 virtual bool CanDeoptimize() const { | 3920 virtual bool CanDeoptimize() const { |
| 3922 return GetDeoptId() != Thread::kNoDeoptId; | 3921 return GetDeoptId() != Thread::kNoDeoptId; |
| 3923 } | 3922 } |
| 3924 | 3923 |
| 3925 virtual Representation representation() const; | 3924 virtual Representation representation() const; |
| 3926 virtual void InferRange(RangeAnalysis* analysis, Range* range); | 3925 virtual void InferRange(RangeAnalysis* analysis, Range* range); |
| 3927 | 3926 |
| 3928 virtual EffectSet Effects() const { return EffectSet::None(); } | 3927 virtual EffectSet Effects() const { return EffectSet::None(); } |
| 3929 | 3928 |
| 3930 private: | 3929 private: |
| 3931 const intptr_t index_scale_; | 3930 const intptr_t index_scale_; |
| 3932 const intptr_t class_id_; | 3931 const intptr_t class_id_; |
| 3932 const AlignmentType alignment_; |
| 3933 const TokenPosition token_pos_; | 3933 const TokenPosition token_pos_; |
| 3934 | 3934 |
| 3935 DISALLOW_COPY_AND_ASSIGN(LoadIndexedInstr); | 3935 DISALLOW_COPY_AND_ASSIGN(LoadIndexedInstr); |
| 3936 }; | 3936 }; |
| 3937 | 3937 |
| 3938 | 3938 |
| 3939 // Loads the specified number of code units from the given string, packing | 3939 // Loads the specified number of code units from the given string, packing |
| 3940 // multiple code units into a single datatype. In essence, this is a specialized | 3940 // multiple code units into a single datatype. In essence, this is a specialized |
| 3941 // version of LoadIndexedInstr which accepts only string targets and can load | 3941 // version of LoadIndexedInstr which accepts only string targets and can load |
| 3942 // multiple elements at once. The result datatype differs depending on the | 3942 // multiple elements at once. The result datatype differs depending on the |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4086 | 4086 |
| 4087 | 4087 |
| 4088 class StoreIndexedInstr : public TemplateDefinition<3, NoThrow> { | 4088 class StoreIndexedInstr : public TemplateDefinition<3, NoThrow> { |
| 4089 public: | 4089 public: |
| 4090 StoreIndexedInstr(Value* array, | 4090 StoreIndexedInstr(Value* array, |
| 4091 Value* index, | 4091 Value* index, |
| 4092 Value* value, | 4092 Value* value, |
| 4093 StoreBarrierType emit_store_barrier, | 4093 StoreBarrierType emit_store_barrier, |
| 4094 intptr_t index_scale, | 4094 intptr_t index_scale, |
| 4095 intptr_t class_id, | 4095 intptr_t class_id, |
| 4096 AlignmentType alignment, |
| 4096 intptr_t deopt_id, | 4097 intptr_t deopt_id, |
| 4097 TokenPosition token_pos) | 4098 TokenPosition token_pos); |
| 4098 : TemplateDefinition(deopt_id), | |
| 4099 emit_store_barrier_(emit_store_barrier), | |
| 4100 index_scale_(index_scale), | |
| 4101 class_id_(class_id), | |
| 4102 token_pos_(token_pos) { | |
| 4103 SetInputAt(kArrayPos, array); | |
| 4104 SetInputAt(kIndexPos, index); | |
| 4105 SetInputAt(kValuePos, value); | |
| 4106 } | |
| 4107 | |
| 4108 DECLARE_INSTRUCTION(StoreIndexed) | 4099 DECLARE_INSTRUCTION(StoreIndexed) |
| 4109 | 4100 |
| 4110 enum { | 4101 enum { |
| 4111 kArrayPos = 0, | 4102 kArrayPos = 0, |
| 4112 kIndexPos = 1, | 4103 kIndexPos = 1, |
| 4113 kValuePos = 2 | 4104 kValuePos = 2 |
| 4114 }; | 4105 }; |
| 4115 | 4106 |
| 4116 Value* array() const { return inputs_[kArrayPos]; } | 4107 Value* array() const { return inputs_[kArrayPos]; } |
| 4117 Value* index() const { return inputs_[kIndexPos]; } | 4108 Value* index() const { return inputs_[kIndexPos]; } |
| 4118 Value* value() const { return inputs_[kValuePos]; } | 4109 Value* value() const { return inputs_[kValuePos]; } |
| 4119 | 4110 |
| 4120 intptr_t index_scale() const { return index_scale_; } | 4111 intptr_t index_scale() const { return index_scale_; } |
| 4121 intptr_t class_id() const { return class_id_; } | 4112 intptr_t class_id() const { return class_id_; } |
| 4113 bool aligned() const { return alignment_ == kAlignedAccess; } |
| 4122 | 4114 |
| 4123 bool ShouldEmitStoreBarrier() const { | 4115 bool ShouldEmitStoreBarrier() const { |
| 4124 return value()->NeedsStoreBuffer() | 4116 return value()->NeedsStoreBuffer() |
| 4125 && (emit_store_barrier_ == kEmitStoreBarrier); | 4117 && (emit_store_barrier_ == kEmitStoreBarrier); |
| 4126 } | 4118 } |
| 4127 | 4119 |
| 4128 virtual bool CanDeoptimize() const { return false; } | 4120 virtual bool CanDeoptimize() const { return false; } |
| 4129 | 4121 |
| 4130 virtual Representation RequiredInputRepresentation(intptr_t idx) const; | 4122 virtual Representation RequiredInputRepresentation(intptr_t idx) const; |
| 4131 | 4123 |
| 4132 bool IsExternal() const { | 4124 bool IsExternal() const { |
| 4133 return array()->definition()->representation() == kUntagged; | 4125 return array()->definition()->representation() == kUntagged; |
| 4134 } | 4126 } |
| 4135 | 4127 |
| 4136 virtual intptr_t DeoptimizationTarget() const { | 4128 virtual intptr_t DeoptimizationTarget() const { |
| 4137 // Direct access since this instruction cannot deoptimize, and the deopt-id | 4129 // Direct access since this instruction cannot deoptimize, and the deopt-id |
| 4138 // was inherited from another instruction that could deoptimize. | 4130 // was inherited from another instruction that could deoptimize. |
| 4139 return GetDeoptId(); | 4131 return GetDeoptId(); |
| 4140 } | 4132 } |
| 4141 | 4133 |
| 4142 virtual EffectSet Effects() const { return EffectSet::None(); } | 4134 virtual EffectSet Effects() const { return EffectSet::None(); } |
| 4143 | 4135 |
| 4144 private: | 4136 private: |
| 4145 const StoreBarrierType emit_store_barrier_; | 4137 const StoreBarrierType emit_store_barrier_; |
| 4146 const intptr_t index_scale_; | 4138 const intptr_t index_scale_; |
| 4147 const intptr_t class_id_; | 4139 const intptr_t class_id_; |
| 4140 const AlignmentType alignment_; |
| 4148 const TokenPosition token_pos_; | 4141 const TokenPosition token_pos_; |
| 4149 | 4142 |
| 4150 DISALLOW_COPY_AND_ASSIGN(StoreIndexedInstr); | 4143 DISALLOW_COPY_AND_ASSIGN(StoreIndexedInstr); |
| 4151 }; | 4144 }; |
| 4152 | 4145 |
| 4153 | 4146 |
| 4154 // Note overrideable, built-in: value ? false : true. | 4147 // Note overrideable, built-in: value ? false : true. |
| 4155 class BooleanNegateInstr : public TemplateDefinition<1, NoThrow> { | 4148 class BooleanNegateInstr : public TemplateDefinition<1, NoThrow> { |
| 4156 public: | 4149 public: |
| 4157 explicit BooleanNegateInstr(Value* value) { | 4150 explicit BooleanNegateInstr(Value* value) { |
| (...skipping 4264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8422 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ | 8415 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ |
| 8423 UNIMPLEMENTED(); \ | 8416 UNIMPLEMENTED(); \ |
| 8424 return NULL; \ | 8417 return NULL; \ |
| 8425 } \ | 8418 } \ |
| 8426 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } | 8419 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } |
| 8427 | 8420 |
| 8428 | 8421 |
| 8429 } // namespace dart | 8422 } // namespace dart |
| 8430 | 8423 |
| 8431 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ | 8424 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |