| 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 2703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2714 | 2714 |
| 2715 virtual bool HasSideEffect() const { return true; } | 2715 virtual bool HasSideEffect() const { return true; } |
| 2716 | 2716 |
| 2717 private: | 2717 private: |
| 2718 const NativeBodyNode& ast_node_; | 2718 const NativeBodyNode& ast_node_; |
| 2719 | 2719 |
| 2720 DISALLOW_COPY_AND_ASSIGN(NativeCallInstr); | 2720 DISALLOW_COPY_AND_ASSIGN(NativeCallInstr); |
| 2721 }; | 2721 }; |
| 2722 | 2722 |
| 2723 | 2723 |
| 2724 enum StoreBarrierType { |
| 2725 kNoStoreBarrier, |
| 2726 kEmitStoreBarrier |
| 2727 }; |
| 2728 |
| 2729 |
| 2724 class StoreInstanceFieldInstr : public TemplateDefinition<2> { | 2730 class StoreInstanceFieldInstr : public TemplateDefinition<2> { |
| 2725 public: | 2731 public: |
| 2726 StoreInstanceFieldInstr(const Field& field, | 2732 StoreInstanceFieldInstr(const Field& field, |
| 2727 Value* instance, | 2733 Value* instance, |
| 2728 Value* value, | 2734 Value* value, |
| 2729 bool emit_store_barrier) | 2735 StoreBarrierType emit_store_barrier) |
| 2730 : field_(field), emit_store_barrier_(emit_store_barrier) { | 2736 : field_(field), emit_store_barrier_(emit_store_barrier) { |
| 2731 SetInputAt(0, instance); | 2737 SetInputAt(0, instance); |
| 2732 SetInputAt(1, value); | 2738 SetInputAt(1, value); |
| 2733 } | 2739 } |
| 2734 | 2740 |
| 2735 DECLARE_INSTRUCTION(StoreInstanceField) | 2741 DECLARE_INSTRUCTION(StoreInstanceField) |
| 2736 virtual CompileType* ComputeInitialType() const; | 2742 virtual CompileType* ComputeInitialType() const; |
| 2737 | 2743 |
| 2738 const Field& field() const { return field_; } | 2744 const Field& field() const { return field_; } |
| 2739 | 2745 |
| 2740 Value* instance() const { return inputs_[0]; } | 2746 Value* instance() const { return inputs_[0]; } |
| 2741 Value* value() const { return inputs_[1]; } | 2747 Value* value() const { return inputs_[1]; } |
| 2742 bool ShouldEmitStoreBarrier() const { | 2748 bool ShouldEmitStoreBarrier() const { |
| 2743 return value()->NeedsStoreBuffer() && emit_store_barrier_; | 2749 return value()->NeedsStoreBuffer() |
| 2750 && (emit_store_barrier_ == kEmitStoreBarrier); |
| 2744 } | 2751 } |
| 2745 | 2752 |
| 2746 virtual void PrintOperandsTo(BufferFormatter* f) const; | 2753 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 2747 | 2754 |
| 2748 virtual bool CanDeoptimize() const { return false; } | 2755 virtual bool CanDeoptimize() const { return false; } |
| 2749 | 2756 |
| 2750 virtual bool HasSideEffect() const { return true; } | 2757 virtual bool HasSideEffect() const { return true; } |
| 2751 | 2758 |
| 2752 private: | 2759 private: |
| 2753 const Field& field_; | 2760 const Field& field_; |
| 2754 const bool emit_store_barrier_; | 2761 const StoreBarrierType emit_store_barrier_; |
| 2755 | 2762 |
| 2756 DISALLOW_COPY_AND_ASSIGN(StoreInstanceFieldInstr); | 2763 DISALLOW_COPY_AND_ASSIGN(StoreInstanceFieldInstr); |
| 2757 }; | 2764 }; |
| 2758 | 2765 |
| 2759 | 2766 |
| 2760 class LoadStaticFieldInstr : public TemplateDefinition<0> { | 2767 class LoadStaticFieldInstr : public TemplateDefinition<0> { |
| 2761 public: | 2768 public: |
| 2762 explicit LoadStaticFieldInstr(const Field& field) : field_(field) {} | 2769 explicit LoadStaticFieldInstr(const Field& field) : field_(field) {} |
| 2763 | 2770 |
| 2764 DECLARE_INSTRUCTION(LoadStaticField); | 2771 DECLARE_INSTRUCTION(LoadStaticField); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2880 | 2887 |
| 2881 DISALLOW_COPY_AND_ASSIGN(StringFromCharCodeInstr); | 2888 DISALLOW_COPY_AND_ASSIGN(StringFromCharCodeInstr); |
| 2882 }; | 2889 }; |
| 2883 | 2890 |
| 2884 | 2891 |
| 2885 class StoreIndexedInstr : public TemplateDefinition<3> { | 2892 class StoreIndexedInstr : public TemplateDefinition<3> { |
| 2886 public: | 2893 public: |
| 2887 StoreIndexedInstr(Value* array, | 2894 StoreIndexedInstr(Value* array, |
| 2888 Value* index, | 2895 Value* index, |
| 2889 Value* value, | 2896 Value* value, |
| 2890 bool emit_store_barrier, | 2897 StoreBarrierType emit_store_barrier, |
| 2891 intptr_t class_id, | 2898 intptr_t class_id, |
| 2892 intptr_t deopt_id) | 2899 intptr_t deopt_id) |
| 2893 : emit_store_barrier_(emit_store_barrier), | 2900 : emit_store_barrier_(emit_store_barrier), |
| 2894 class_id_(class_id), | 2901 class_id_(class_id), |
| 2895 deopt_id_(deopt_id) { | 2902 deopt_id_(deopt_id) { |
| 2896 SetInputAt(0, array); | 2903 SetInputAt(0, array); |
| 2897 SetInputAt(1, index); | 2904 SetInputAt(1, index); |
| 2898 SetInputAt(2, value); | 2905 SetInputAt(2, value); |
| 2899 } | 2906 } |
| 2900 | 2907 |
| 2901 DECLARE_INSTRUCTION(StoreIndexed) | 2908 DECLARE_INSTRUCTION(StoreIndexed) |
| 2902 | 2909 |
| 2903 Value* array() const { return inputs_[0]; } | 2910 Value* array() const { return inputs_[0]; } |
| 2904 Value* index() const { return inputs_[1]; } | 2911 Value* index() const { return inputs_[1]; } |
| 2905 Value* value() const { return inputs_[2]; } | 2912 Value* value() const { return inputs_[2]; } |
| 2906 intptr_t class_id() const { return class_id_; } | 2913 intptr_t class_id() const { return class_id_; } |
| 2907 | 2914 |
| 2908 bool ShouldEmitStoreBarrier() const { | 2915 bool ShouldEmitStoreBarrier() const { |
| 2909 return value()->NeedsStoreBuffer() && emit_store_barrier_; | 2916 return value()->NeedsStoreBuffer() |
| 2917 && (emit_store_barrier_ == kEmitStoreBarrier); |
| 2910 } | 2918 } |
| 2911 | 2919 |
| 2912 virtual bool CanDeoptimize() const { return false; } | 2920 virtual bool CanDeoptimize() const { return false; } |
| 2913 | 2921 |
| 2914 virtual bool HasSideEffect() const { return true; } | 2922 virtual bool HasSideEffect() const { return true; } |
| 2915 | 2923 |
| 2916 virtual Representation RequiredInputRepresentation(intptr_t idx) const; | 2924 virtual Representation RequiredInputRepresentation(intptr_t idx) const; |
| 2917 | 2925 |
| 2918 virtual intptr_t DeoptimizationTarget() const { | 2926 virtual intptr_t DeoptimizationTarget() const { |
| 2919 // Direct access since this instruction cannot deoptimize, and the deopt-id | 2927 // Direct access since this instruction cannot deoptimize, and the deopt-id |
| 2920 // was inherited from another instruction that could deoptimize. | 2928 // was inherited from another instruction that could deoptimize. |
| 2921 return deopt_id_; | 2929 return deopt_id_; |
| 2922 } | 2930 } |
| 2923 | 2931 |
| 2924 private: | 2932 private: |
| 2925 const bool emit_store_barrier_; | 2933 const StoreBarrierType emit_store_barrier_; |
| 2926 const intptr_t class_id_; | 2934 const intptr_t class_id_; |
| 2927 const intptr_t deopt_id_; | 2935 const intptr_t deopt_id_; |
| 2928 | 2936 |
| 2929 DISALLOW_COPY_AND_ASSIGN(StoreIndexedInstr); | 2937 DISALLOW_COPY_AND_ASSIGN(StoreIndexedInstr); |
| 2930 }; | 2938 }; |
| 2931 | 2939 |
| 2932 | 2940 |
| 2933 // Note overrideable, built-in: value? false : true. | 2941 // Note overrideable, built-in: value? false : true. |
| 2934 class BooleanNegateInstr : public TemplateDefinition<1> { | 2942 class BooleanNegateInstr : public TemplateDefinition<1> { |
| 2935 public: | 2943 public: |
| (...skipping 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4478 ForwardInstructionIterator* current_iterator_; | 4486 ForwardInstructionIterator* current_iterator_; |
| 4479 | 4487 |
| 4480 private: | 4488 private: |
| 4481 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 4489 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 4482 }; | 4490 }; |
| 4483 | 4491 |
| 4484 | 4492 |
| 4485 } // namespace dart | 4493 } // namespace dart |
| 4486 | 4494 |
| 4487 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 4495 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |