Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: runtime/vm/intermediate_language.h

Issue 2452453002: Support unaligned integer loads on ARM and MIPS. (Closed)
Patch Set: . Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 3829 matching lines...) Expand 10 before | Expand all | Expand 10 after
3840 DISALLOW_COPY_AND_ASSIGN(StoreStaticFieldInstr); 3840 DISALLOW_COPY_AND_ASSIGN(StoreStaticFieldInstr);
3841 }; 3841 };
3842 3842
3843 3843
3844 class LoadIndexedInstr : public TemplateDefinition<2, NoThrow> { 3844 class LoadIndexedInstr : public TemplateDefinition<2, NoThrow> {
3845 public: 3845 public:
3846 LoadIndexedInstr(Value* array, 3846 LoadIndexedInstr(Value* array,
3847 Value* index, 3847 Value* index,
3848 intptr_t index_scale, 3848 intptr_t index_scale,
3849 intptr_t class_id, 3849 intptr_t class_id,
3850 bool aligned,
Cutch 2016/10/26 09:00:29 Consider defining an enum: enum MemoryAccessKind
3850 intptr_t deopt_id, 3851 intptr_t deopt_id,
3851 TokenPosition token_pos) 3852 TokenPosition token_pos);
3852 : TemplateDefinition(deopt_id),
3853 index_scale_(index_scale),
3854 class_id_(class_id),
3855 token_pos_(token_pos) {
3856 SetInputAt(0, array);
3857 SetInputAt(1, index);
3858 }
3859 3853
3860 TokenPosition token_pos() const { return token_pos_; } 3854 TokenPosition token_pos() const { return token_pos_; }
3861 3855
3862 DECLARE_INSTRUCTION(LoadIndexed) 3856 DECLARE_INSTRUCTION(LoadIndexed)
3863 virtual CompileType ComputeType() const; 3857 virtual CompileType ComputeType() const;
3864 3858
3865 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 3859 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
3866 ASSERT(idx == 0 || idx == 1); 3860 ASSERT(idx == 0 || idx == 1);
3867 // The array may be tagged or untagged (for external arrays). 3861 // The array may be tagged or untagged (for external arrays).
3868 if (idx == 0) return kNoRepresentation; 3862 if (idx == 0) return kNoRepresentation;
3869 return kTagged; 3863 return kTagged;
3870 } 3864 }
3871 3865
3872 bool IsExternal() const { 3866 bool IsExternal() const {
3873 return array()->definition()->representation() == kUntagged; 3867 return array()->definition()->representation() == kUntagged;
3874 } 3868 }
3875 3869
3876 Value* array() const { return inputs_[0]; } 3870 Value* array() const { return inputs_[0]; }
3877 Value* index() const { return inputs_[1]; } 3871 Value* index() const { return inputs_[1]; }
3878 intptr_t index_scale() const { return index_scale_; } 3872 intptr_t index_scale() const { return index_scale_; }
3879 intptr_t class_id() const { return class_id_; } 3873 intptr_t class_id() const { return class_id_; }
3874 bool aligned() const { return aligned_; }
3880 3875
3881 virtual bool CanDeoptimize() const { 3876 virtual bool CanDeoptimize() const {
3882 return GetDeoptId() != Thread::kNoDeoptId; 3877 return GetDeoptId() != Thread::kNoDeoptId;
3883 } 3878 }
3884 3879
3885 virtual Representation representation() const; 3880 virtual Representation representation() const;
3886 virtual void InferRange(RangeAnalysis* analysis, Range* range); 3881 virtual void InferRange(RangeAnalysis* analysis, Range* range);
3887 3882
3888 virtual EffectSet Effects() const { return EffectSet::None(); } 3883 virtual EffectSet Effects() const { return EffectSet::None(); }
3889 3884
3890 private: 3885 private:
3891 const intptr_t index_scale_; 3886 const intptr_t index_scale_;
3892 const intptr_t class_id_; 3887 const intptr_t class_id_;
3888 intptr_t aligned_;
3893 const TokenPosition token_pos_; 3889 const TokenPosition token_pos_;
3894 3890
3895 DISALLOW_COPY_AND_ASSIGN(LoadIndexedInstr); 3891 DISALLOW_COPY_AND_ASSIGN(LoadIndexedInstr);
3896 }; 3892 };
3897 3893
3898 3894
3899 // Loads the specified number of code units from the given string, packing 3895 // Loads the specified number of code units from the given string, packing
3900 // multiple code units into a single datatype. In essence, this is a specialized 3896 // multiple code units into a single datatype. In essence, this is a specialized
3901 // version of LoadIndexedInstr which accepts only string targets and can load 3897 // version of LoadIndexedInstr which accepts only string targets and can load
3902 // multiple elements at once. The result datatype differs depending on the 3898 // multiple elements at once. The result datatype differs depending on the
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
4046 4042
4047 4043
4048 class StoreIndexedInstr : public TemplateDefinition<3, NoThrow> { 4044 class StoreIndexedInstr : public TemplateDefinition<3, NoThrow> {
4049 public: 4045 public:
4050 StoreIndexedInstr(Value* array, 4046 StoreIndexedInstr(Value* array,
4051 Value* index, 4047 Value* index,
4052 Value* value, 4048 Value* value,
4053 StoreBarrierType emit_store_barrier, 4049 StoreBarrierType emit_store_barrier,
4054 intptr_t index_scale, 4050 intptr_t index_scale,
4055 intptr_t class_id, 4051 intptr_t class_id,
4052 bool aligned,
4056 intptr_t deopt_id, 4053 intptr_t deopt_id,
4057 TokenPosition token_pos) 4054 TokenPosition token_pos);
4058 : TemplateDefinition(deopt_id),
4059 emit_store_barrier_(emit_store_barrier),
4060 index_scale_(index_scale),
4061 class_id_(class_id),
4062 token_pos_(token_pos) {
4063 SetInputAt(kArrayPos, array);
4064 SetInputAt(kIndexPos, index);
4065 SetInputAt(kValuePos, value);
4066 }
4067
4068 DECLARE_INSTRUCTION(StoreIndexed) 4055 DECLARE_INSTRUCTION(StoreIndexed)
4069 4056
4070 enum { 4057 enum {
4071 kArrayPos = 0, 4058 kArrayPos = 0,
4072 kIndexPos = 1, 4059 kIndexPos = 1,
4073 kValuePos = 2 4060 kValuePos = 2
4074 }; 4061 };
4075 4062
4076 Value* array() const { return inputs_[kArrayPos]; } 4063 Value* array() const { return inputs_[kArrayPos]; }
4077 Value* index() const { return inputs_[kIndexPos]; } 4064 Value* index() const { return inputs_[kIndexPos]; }
4078 Value* value() const { return inputs_[kValuePos]; } 4065 Value* value() const { return inputs_[kValuePos]; }
4079 4066
4080 intptr_t index_scale() const { return index_scale_; } 4067 intptr_t index_scale() const { return index_scale_; }
4081 intptr_t class_id() const { return class_id_; } 4068 intptr_t class_id() const { return class_id_; }
4069 bool aligned() const { return aligned_; }
4082 4070
4083 bool ShouldEmitStoreBarrier() const { 4071 bool ShouldEmitStoreBarrier() const {
4084 return value()->NeedsStoreBuffer() 4072 return value()->NeedsStoreBuffer()
4085 && (emit_store_barrier_ == kEmitStoreBarrier); 4073 && (emit_store_barrier_ == kEmitStoreBarrier);
4086 } 4074 }
4087 4075
4088 virtual bool CanDeoptimize() const { return false; } 4076 virtual bool CanDeoptimize() const { return false; }
4089 4077
4090 virtual Representation RequiredInputRepresentation(intptr_t idx) const; 4078 virtual Representation RequiredInputRepresentation(intptr_t idx) const;
4091 4079
4092 bool IsExternal() const { 4080 bool IsExternal() const {
4093 return array()->definition()->representation() == kUntagged; 4081 return array()->definition()->representation() == kUntagged;
4094 } 4082 }
4095 4083
4096 virtual intptr_t DeoptimizationTarget() const { 4084 virtual intptr_t DeoptimizationTarget() const {
4097 // Direct access since this instruction cannot deoptimize, and the deopt-id 4085 // Direct access since this instruction cannot deoptimize, and the deopt-id
4098 // was inherited from another instruction that could deoptimize. 4086 // was inherited from another instruction that could deoptimize.
4099 return GetDeoptId(); 4087 return GetDeoptId();
4100 } 4088 }
4101 4089
4102 virtual EffectSet Effects() const { return EffectSet::None(); } 4090 virtual EffectSet Effects() const { return EffectSet::None(); }
4103 4091
4104 private: 4092 private:
4105 const StoreBarrierType emit_store_barrier_; 4093 const StoreBarrierType emit_store_barrier_;
4106 const intptr_t index_scale_; 4094 const intptr_t index_scale_;
4107 const intptr_t class_id_; 4095 const intptr_t class_id_;
4096 bool aligned_;
4108 const TokenPosition token_pos_; 4097 const TokenPosition token_pos_;
4109 4098
4110 DISALLOW_COPY_AND_ASSIGN(StoreIndexedInstr); 4099 DISALLOW_COPY_AND_ASSIGN(StoreIndexedInstr);
4111 }; 4100 };
4112 4101
4113 4102
4114 // Note overrideable, built-in: value ? false : true. 4103 // Note overrideable, built-in: value ? false : true.
4115 class BooleanNegateInstr : public TemplateDefinition<1, NoThrow> { 4104 class BooleanNegateInstr : public TemplateDefinition<1, NoThrow> {
4116 public: 4105 public:
4117 explicit BooleanNegateInstr(Value* value) { 4106 explicit BooleanNegateInstr(Value* value) {
(...skipping 4265 matching lines...) Expand 10 before | Expand all | Expand 10 after
8383 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ 8372 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \
8384 UNIMPLEMENTED(); \ 8373 UNIMPLEMENTED(); \
8385 return NULL; \ 8374 return NULL; \
8386 } \ 8375 } \
8387 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } 8376 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); }
8388 8377
8389 8378
8390 } // namespace dart 8379 } // namespace dart
8391 8380
8392 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 8381 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698