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 3683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3694 // TODO(zerny): Add support for loading into UnboxedInt32x4. | 3694 // TODO(zerny): Add support for loading into UnboxedInt32x4. |
3695 class LoadCodeUnitsInstr : public TemplateDefinition<2, NoThrow> { | 3695 class LoadCodeUnitsInstr : public TemplateDefinition<2, NoThrow> { |
3696 public: | 3696 public: |
3697 LoadCodeUnitsInstr(Value* str, | 3697 LoadCodeUnitsInstr(Value* str, |
3698 Value* index, | 3698 Value* index, |
3699 intptr_t element_count, | 3699 intptr_t element_count, |
3700 intptr_t class_id, | 3700 intptr_t class_id, |
3701 intptr_t token_pos) | 3701 intptr_t token_pos) |
3702 : class_id_(class_id), | 3702 : class_id_(class_id), |
3703 token_pos_(token_pos), | 3703 token_pos_(token_pos), |
3704 element_count_(element_count) { | 3704 element_count_(element_count), |
| 3705 representation_(kTagged) { |
3705 ASSERT(element_count == 1 || element_count == 2 || element_count == 4); | 3706 ASSERT(element_count == 1 || element_count == 2 || element_count == 4); |
3706 ASSERT(class_id == kOneByteStringCid || class_id == kTwoByteStringCid); | 3707 ASSERT(class_id == kOneByteStringCid || class_id == kTwoByteStringCid); |
3707 SetInputAt(0, str); | 3708 SetInputAt(0, str); |
3708 SetInputAt(1, index); | 3709 SetInputAt(1, index); |
3709 } | 3710 } |
3710 | 3711 |
3711 intptr_t token_pos() const { return token_pos_; } | 3712 intptr_t token_pos() const { return token_pos_; } |
3712 | 3713 |
3713 DECLARE_INSTRUCTION(LoadCodeUnits) | 3714 DECLARE_INSTRUCTION(LoadCodeUnits) |
3714 virtual CompileType ComputeType() const; | 3715 virtual CompileType ComputeType() const; |
3715 | 3716 |
3716 bool IsExternal() const { | 3717 bool IsExternal() const { |
3717 return array()->definition()->representation() == kUntagged; | 3718 return array()->definition()->representation() == kUntagged; |
3718 } | 3719 } |
3719 | 3720 |
3720 Value* array() const { return inputs_[0]; } | 3721 Value* array() const { return inputs_[0]; } |
3721 Value* index() const { return inputs_[1]; } | 3722 Value* index() const { return inputs_[1]; } |
3722 intptr_t index_scale() const { return Instance::ElementSizeFor(class_id_); } | 3723 intptr_t index_scale() const { return Instance::ElementSizeFor(class_id_); } |
3723 intptr_t class_id() const { return class_id_; } | 3724 intptr_t class_id() const { return class_id_; } |
3724 intptr_t element_count() const { return element_count_; } | 3725 intptr_t element_count() const { return element_count_; } |
3725 | 3726 |
3726 bool can_pack_into_smi() const { | 3727 bool can_pack_into_smi() const { |
3727 return element_count() <= kSmiBits / (index_scale() * kBitsPerByte); | 3728 return element_count() <= kSmiBits / (index_scale() * kBitsPerByte); |
3728 } | 3729 } |
3729 | 3730 |
3730 virtual bool CanDeoptimize() const { return false; } | 3731 virtual bool CanDeoptimize() const { return false; } |
3731 | 3732 |
3732 virtual Representation representation() const; | 3733 virtual Representation representation() const { return representation_; } |
| 3734 void set_representation(Representation repr) { representation_ = repr; } |
3733 virtual void InferRange(RangeAnalysis* analysis, Range* range); | 3735 virtual void InferRange(RangeAnalysis* analysis, Range* range); |
3734 | 3736 |
3735 virtual EffectSet Effects() const { return EffectSet::None(); } | 3737 virtual EffectSet Effects() const { return EffectSet::None(); } |
3736 | 3738 |
3737 private: | 3739 private: |
3738 const intptr_t class_id_; | 3740 const intptr_t class_id_; |
3739 const intptr_t token_pos_; | 3741 const intptr_t token_pos_; |
3740 const intptr_t element_count_; | 3742 const intptr_t element_count_; |
| 3743 Representation representation_; |
3741 | 3744 |
3742 DISALLOW_COPY_AND_ASSIGN(LoadCodeUnitsInstr); | 3745 DISALLOW_COPY_AND_ASSIGN(LoadCodeUnitsInstr); |
3743 }; | 3746 }; |
3744 | 3747 |
3745 | 3748 |
3746 class StringFromCharCodeInstr : public TemplateDefinition<1, NoThrow, Pure> { | 3749 class StringFromCharCodeInstr : public TemplateDefinition<1, NoThrow, Pure> { |
3747 public: | 3750 public: |
3748 StringFromCharCodeInstr(Value* char_code, intptr_t cid) : cid_(cid) { | 3751 StringFromCharCodeInstr(Value* char_code, intptr_t cid) : cid_(cid) { |
3749 ASSERT(char_code != NULL); | 3752 ASSERT(char_code != NULL); |
3750 ASSERT(char_code->definition()->IsLoadIndexed()); | 3753 ASSERT(char_code->definition()->IsLoadIndexed()); |
(...skipping 4226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7977 Isolate* isolate, bool opt) const { \ | 7980 Isolate* isolate, bool opt) const { \ |
7978 UNIMPLEMENTED(); \ | 7981 UNIMPLEMENTED(); \ |
7979 return NULL; \ | 7982 return NULL; \ |
7980 } \ | 7983 } \ |
7981 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } | 7984 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } |
7982 | 7985 |
7983 | 7986 |
7984 } // namespace dart | 7987 } // namespace dart |
7985 | 7988 |
7986 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 7989 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
OLD | NEW |