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 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
690 M(Float32x4Clamp) \ | 690 M(Float32x4Clamp) \ |
691 M(Float32x4With) \ | 691 M(Float32x4With) \ |
692 M(Float32x4ToInt32x4) \ | 692 M(Float32x4ToInt32x4) \ |
693 M(MaterializeObject) \ | 693 M(MaterializeObject) \ |
694 M(Int32x4BoolConstructor) \ | 694 M(Int32x4BoolConstructor) \ |
695 M(Int32x4GetFlag) \ | 695 M(Int32x4GetFlag) \ |
696 M(Int32x4Select) \ | 696 M(Int32x4Select) \ |
697 M(Int32x4SetFlag) \ | 697 M(Int32x4SetFlag) \ |
698 M(Int32x4ToFloat32x4) \ | 698 M(Int32x4ToFloat32x4) \ |
699 M(BinaryInt32x4Op) \ | 699 M(BinaryInt32x4Op) \ |
700 M(TestSmi) | |
zra
2013/11/05 18:38:03
It looks like we usually put a trailing \ after th
Florian Schneider
2013/11/06 12:13:42
Done.
| |
700 | 701 |
701 | 702 |
702 #define FORWARD_DECLARATION(type) class type##Instr; | 703 #define FORWARD_DECLARATION(type) class type##Instr; |
703 FOR_EACH_INSTRUCTION(FORWARD_DECLARATION) | 704 FOR_EACH_INSTRUCTION(FORWARD_DECLARATION) |
704 #undef FORWARD_DECLARATION | 705 #undef FORWARD_DECLARATION |
705 | 706 |
706 | 707 |
707 // Functions required in all concrete instruction classes. | 708 // Functions required in all concrete instruction classes. |
708 #define DECLARE_INSTRUCTION(type) \ | 709 #define DECLARE_INSTRUCTION(type) \ |
709 virtual Tag tag() const { return k##type; } \ | 710 virtual Tag tag() const { return k##type; } \ |
(...skipping 2268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2978 | 2979 |
2979 private: | 2980 private: |
2980 // True if the comparison must check for double, Mint or Bigint and | 2981 // True if the comparison must check for double, Mint or Bigint and |
2981 // use value comparison instead. | 2982 // use value comparison instead. |
2982 bool needs_number_check_; | 2983 bool needs_number_check_; |
2983 | 2984 |
2984 DISALLOW_COPY_AND_ASSIGN(StrictCompareInstr); | 2985 DISALLOW_COPY_AND_ASSIGN(StrictCompareInstr); |
2985 }; | 2986 }; |
2986 | 2987 |
2987 | 2988 |
2989 // Comparison instruction that is equivalent to the (left & right) == 0 | |
2990 // comparison pattern. | |
2991 class TestSmiInstr : public ComparisonInstr { | |
2992 public: | |
2993 TestSmiInstr(intptr_t token_pos, Token::Kind kind, Value* left, Value* right) | |
2994 : ComparisonInstr(token_pos, kind, left, right) { | |
2995 ASSERT(kind == Token::kEQ || kind == Token::kNE); | |
2996 } | |
2997 | |
2998 DECLARE_INSTRUCTION(TestSmi); | |
2999 virtual CompileType ComputeType() const; | |
3000 | |
3001 virtual bool CanDeoptimize() const { return false; } | |
3002 | |
3003 virtual bool CanBecomeDeoptimizationTarget() const { | |
3004 // TestSmi can be merged into Branch and thus needs an environment. | |
3005 return true; | |
3006 } | |
3007 | |
3008 virtual intptr_t DeoptimizationTarget() const { | |
3009 return GetDeoptId(); | |
3010 } | |
3011 | |
3012 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | |
3013 return kTagged; | |
3014 } | |
3015 | |
3016 virtual EffectSet Effects() const { return EffectSet::None(); } | |
3017 | |
3018 virtual bool MayThrow() const { return false; } | |
3019 | |
3020 virtual void EmitBranchCode(FlowGraphCompiler* compiler, | |
3021 BranchInstr* branch); | |
3022 | |
3023 private: | |
3024 DISALLOW_COPY_AND_ASSIGN(TestSmiInstr); | |
3025 }; | |
3026 | |
3027 | |
2988 class EqualityCompareInstr : public ComparisonInstr { | 3028 class EqualityCompareInstr : public ComparisonInstr { |
2989 public: | 3029 public: |
2990 EqualityCompareInstr(intptr_t token_pos, | 3030 EqualityCompareInstr(intptr_t token_pos, |
2991 Token::Kind kind, | 3031 Token::Kind kind, |
2992 Value* left, | 3032 Value* left, |
2993 Value* right, | 3033 Value* right, |
2994 intptr_t cid, | 3034 intptr_t cid, |
2995 intptr_t deopt_id) | 3035 intptr_t deopt_id) |
2996 : ComparisonInstr(token_pos, kind, left, right) { | 3036 : ComparisonInstr(token_pos, kind, left, right) { |
2997 ASSERT(Token::IsEqualityOperator(kind)); | 3037 ASSERT(Token::IsEqualityOperator(kind)); |
2998 set_operation_cid(cid); | 3038 set_operation_cid(cid); |
2999 deopt_id_ = deopt_id; // Override generated deopt-id. | 3039 deopt_id_ = deopt_id; // Override generated deopt-id. |
3000 } | 3040 } |
3001 | 3041 |
3002 DECLARE_INSTRUCTION(EqualityCompare) | 3042 DECLARE_INSTRUCTION(EqualityCompare) |
3003 virtual CompileType ComputeType() const; | 3043 virtual CompileType ComputeType() const; |
3004 virtual bool RecomputeType(); | |
3005 | 3044 |
3006 virtual void PrintOperandsTo(BufferFormatter* f) const; | 3045 virtual void PrintOperandsTo(BufferFormatter* f) const; |
3007 | 3046 |
3008 virtual bool CanDeoptimize() const { return false; } | 3047 virtual bool CanDeoptimize() const { return false; } |
3009 | 3048 |
3010 virtual bool CanBecomeDeoptimizationTarget() const { | 3049 virtual bool CanBecomeDeoptimizationTarget() const { |
3011 // EqualityCompare can be merged into Branch and thus needs an environment. | 3050 // EqualityCompare can be merged into Branch and thus needs an environment. |
3012 return true; | 3051 return true; |
3013 } | 3052 } |
3014 | 3053 |
(...skipping 29 matching lines...) Expand all Loading... | |
3044 intptr_t cid, | 3083 intptr_t cid, |
3045 intptr_t deopt_id) | 3084 intptr_t deopt_id) |
3046 : ComparisonInstr(token_pos, kind, left, right) { | 3085 : ComparisonInstr(token_pos, kind, left, right) { |
3047 ASSERT(Token::IsRelationalOperator(kind)); | 3086 ASSERT(Token::IsRelationalOperator(kind)); |
3048 set_operation_cid(cid); | 3087 set_operation_cid(cid); |
3049 deopt_id_ = deopt_id; // Override generated deopt-id. | 3088 deopt_id_ = deopt_id; // Override generated deopt-id. |
3050 } | 3089 } |
3051 | 3090 |
3052 DECLARE_INSTRUCTION(RelationalOp) | 3091 DECLARE_INSTRUCTION(RelationalOp) |
3053 virtual CompileType ComputeType() const; | 3092 virtual CompileType ComputeType() const; |
3054 virtual bool RecomputeType(); | |
3055 | 3093 |
3056 virtual void PrintOperandsTo(BufferFormatter* f) const; | 3094 virtual void PrintOperandsTo(BufferFormatter* f) const; |
3057 | 3095 |
3058 virtual bool CanDeoptimize() const { return false; } | 3096 virtual bool CanDeoptimize() const { return false; } |
3059 | 3097 |
3060 virtual bool CanBecomeDeoptimizationTarget() const { | 3098 virtual bool CanBecomeDeoptimizationTarget() const { |
3061 // RelationalOp can be merged into Branch and thus needs an environment. | 3099 // RelationalOp can be merged into Branch and thus needs an environment. |
3062 return true; | 3100 return true; |
3063 } | 3101 } |
3064 | 3102 |
(...skipping 3839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6904 ForwardInstructionIterator* current_iterator_; | 6942 ForwardInstructionIterator* current_iterator_; |
6905 | 6943 |
6906 private: | 6944 private: |
6907 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 6945 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
6908 }; | 6946 }; |
6909 | 6947 |
6910 | 6948 |
6911 } // namespace dart | 6949 } // namespace dart |
6912 | 6950 |
6913 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 6951 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
OLD | NEW |