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 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 #define DECLARE_INSTRUCTION_BACKEND() \ | 529 #define DECLARE_INSTRUCTION_BACKEND() \ |
530 virtual LocationSummary* MakeLocationSummary(Zone* zone, bool optimizing) \ | 530 virtual LocationSummary* MakeLocationSummary(Zone* zone, bool optimizing) \ |
531 const; \ | 531 const; \ |
532 virtual void EmitNativeCode(FlowGraphCompiler* compiler); | 532 virtual void EmitNativeCode(FlowGraphCompiler* compiler); |
533 | 533 |
534 // Functions required in all concrete instruction classes. | 534 // Functions required in all concrete instruction classes. |
535 #define DECLARE_INSTRUCTION(type) \ | 535 #define DECLARE_INSTRUCTION(type) \ |
536 DECLARE_INSTRUCTION_NO_BACKEND(type) \ | 536 DECLARE_INSTRUCTION_NO_BACKEND(type) \ |
537 DECLARE_INSTRUCTION_BACKEND() | 537 DECLARE_INSTRUCTION_BACKEND() |
538 | 538 |
539 #if defined(TARGET_ARCH_DBC) | |
540 #define DECLARE_COMPARISON_METHODS \ | |
541 virtual LocationSummary* MakeLocationSummary(Zone* zone, bool optimizing) \ | |
542 const; \ | |
543 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler, \ | |
544 BranchLabels labels); \ | |
545 virtual Condition GetNextInstructionCondition(FlowGraphCompiler* compiler, \ | |
546 BranchLabels labels); | |
547 #else | |
548 #define DECLARE_COMPARISON_METHODS \ | |
549 virtual LocationSummary* MakeLocationSummary(Zone* zone, bool optimizing) \ | |
550 const; \ | |
551 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler, \ | |
552 BranchLabels labels); | |
553 #endif | |
554 | |
555 #define DECLARE_COMPARISON_INSTRUCTION(type) \ | |
556 DECLARE_INSTRUCTION_NO_BACKEND(type) \ | |
557 DECLARE_COMPARISON_METHODS | |
558 | |
559 #ifndef PRODUCT | 539 #ifndef PRODUCT |
560 #define PRINT_TO_SUPPORT virtual void PrintTo(BufferFormatter* f) const; | 540 #define PRINT_TO_SUPPORT virtual void PrintTo(BufferFormatter* f) const; |
561 #else | 541 #else |
562 #define PRINT_TO_SUPPORT | 542 #define PRINT_TO_SUPPORT |
563 #endif // !PRODUCT | 543 #endif // !PRODUCT |
564 | 544 |
565 #ifndef PRODUCT | 545 #ifndef PRODUCT |
566 #define PRINT_OPERANDS_TO_SUPPORT \ | 546 #define PRINT_OPERANDS_TO_SUPPORT \ |
567 virtual void PrintOperandsTo(BufferFormatter* f) const; | 547 virtual void PrintOperandsTo(BufferFormatter* f) const; |
568 #else | 548 #else |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
979 Instruction* previous_; | 959 Instruction* previous_; |
980 Instruction* next_; | 960 Instruction* next_; |
981 Environment* env_; | 961 Environment* env_; |
982 LocationSummary* locs_; | 962 LocationSummary* locs_; |
983 intptr_t inlining_id_; | 963 intptr_t inlining_id_; |
984 | 964 |
985 DISALLOW_COPY_AND_ASSIGN(Instruction); | 965 DISALLOW_COPY_AND_ASSIGN(Instruction); |
986 }; | 966 }; |
987 | 967 |
988 | 968 |
989 struct BranchLabels { | |
990 Label* true_label; | |
991 Label* false_label; | |
992 Label* fall_through; | |
993 }; | |
994 | |
995 | |
996 class PureInstruction : public Instruction { | 969 class PureInstruction : public Instruction { |
997 public: | 970 public: |
998 explicit PureInstruction(intptr_t deopt_id) : Instruction(deopt_id) {} | 971 explicit PureInstruction(intptr_t deopt_id) : Instruction(deopt_id) {} |
999 | 972 |
1000 virtual bool AllowsCSE() const { return true; } | 973 virtual bool AllowsCSE() const { return true; } |
1001 virtual EffectSet Dependencies() const { return EffectSet::None(); } | 974 virtual EffectSet Dependencies() const { return EffectSet::None(); } |
1002 | 975 |
1003 virtual EffectSet Effects() const { return EffectSet::None(); } | 976 virtual EffectSet Effects() const { return EffectSet::None(); } |
1004 }; | 977 }; |
1005 | 978 |
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1940 EmbeddedArray<Value*, N> inputs_; | 1913 EmbeddedArray<Value*, N> inputs_; |
1941 | 1914 |
1942 private: | 1915 private: |
1943 friend class BranchInstr; | 1916 friend class BranchInstr; |
1944 friend class IfThenElseInstr; | 1917 friend class IfThenElseInstr; |
1945 | 1918 |
1946 virtual void RawSetInputAt(intptr_t i, Value* value) { inputs_[i] = value; } | 1919 virtual void RawSetInputAt(intptr_t i, Value* value) { inputs_[i] = value; } |
1947 }; | 1920 }; |
1948 | 1921 |
1949 | 1922 |
| 1923 struct BranchLabels { |
| 1924 Label* true_label; |
| 1925 Label* false_label; |
| 1926 Label* fall_through; |
| 1927 }; |
| 1928 |
| 1929 |
1950 class InductionVariableInfo; | 1930 class InductionVariableInfo; |
1951 | 1931 |
1952 | 1932 |
1953 class PhiInstr : public Definition { | 1933 class PhiInstr : public Definition { |
1954 public: | 1934 public: |
1955 PhiInstr(JoinEntryInstr* block, intptr_t num_inputs) | 1935 PhiInstr(JoinEntryInstr* block, intptr_t num_inputs) |
1956 : block_(block), | 1936 : block_(block), |
1957 inputs_(num_inputs), | 1937 inputs_(num_inputs), |
1958 representation_(kTagged), | 1938 representation_(kTagged), |
1959 reaching_defs_(NULL), | 1939 reaching_defs_(NULL), |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2358 class ComparisonInstr : public Definition { | 2338 class ComparisonInstr : public Definition { |
2359 public: | 2339 public: |
2360 Value* left() const { return InputAt(0); } | 2340 Value* left() const { return InputAt(0); } |
2361 Value* right() const { return InputAt(1); } | 2341 Value* right() const { return InputAt(1); } |
2362 | 2342 |
2363 virtual TokenPosition token_pos() const { return token_pos_; } | 2343 virtual TokenPosition token_pos() const { return token_pos_; } |
2364 Token::Kind kind() const { return kind_; } | 2344 Token::Kind kind() const { return kind_; } |
2365 | 2345 |
2366 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right) = 0; | 2346 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right) = 0; |
2367 | 2347 |
2368 // Emits instructions to do the comparison and branch to the true or false | 2348 virtual void EmitBranchCode(FlowGraphCompiler* compiler, |
2369 // label depending on the result. This implementation will call | 2349 BranchInstr* branch) = 0; |
2370 // EmitComparisonCode and then generate the branch instructions afterwards. | |
2371 virtual void EmitBranchCode(FlowGraphCompiler* compiler, BranchInstr* branch); | |
2372 | 2350 |
2373 // Used by EmitBranchCode and EmitNativeCode depending on whether the boolean | |
2374 // is to be turned into branches or instantiated. May return a valid | |
2375 // condition in which case the caller is expected to emit a branch to the | |
2376 // true label based on that condition (or a branch to the false label on the | |
2377 // opposite condition). May also branch directly to the labels. | |
2378 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler, | 2351 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler, |
2379 BranchLabels labels) = 0; | 2352 BranchLabels labels) = 0; |
2380 | 2353 |
2381 #if defined(TARGET_ARCH_DBC) | |
2382 // On the DBC platform EmitNativeCode needs to know ahead of time what | |
2383 // 'Condition' will be returned by EmitComparisonCode. This call must return | |
2384 // the same result as EmitComparisonCode, but should not emit any | |
2385 // instructions. | |
2386 virtual Condition GetNextInstructionCondition(FlowGraphCompiler* compiler, | |
2387 BranchLabels labels) = 0; | |
2388 #endif | |
2389 | |
2390 // Emits code that generates 'true' or 'false', depending on the comparison. | |
2391 // This implementation will call EmitComparisonCode. If EmitComparisonCode | |
2392 // does not use the labels (merely returning a condition) then EmitNativeCode | |
2393 // may be able to use the condition to avoid a branch. | |
2394 virtual void EmitNativeCode(FlowGraphCompiler* compiler); | |
2395 | |
2396 void SetDeoptId(const Instruction& instr) { CopyDeoptIdFrom(instr); } | 2354 void SetDeoptId(const Instruction& instr) { CopyDeoptIdFrom(instr); } |
2397 | 2355 |
2398 // Operation class id is computed from collected ICData. | 2356 // Operation class id is computed from collected ICData. |
2399 void set_operation_cid(intptr_t value) { operation_cid_ = value; } | 2357 void set_operation_cid(intptr_t value) { operation_cid_ = value; } |
2400 intptr_t operation_cid() const { return operation_cid_; } | 2358 intptr_t operation_cid() const { return operation_cid_; } |
2401 | 2359 |
2402 virtual void NegateComparison() { kind_ = Token::NegateComparison(kind_); } | 2360 virtual void NegateComparison() { kind_ = Token::NegateComparison(kind_); } |
2403 | 2361 |
2404 virtual bool CanBecomeDeoptimizationTarget() const { return true; } | 2362 virtual bool CanBecomeDeoptimizationTarget() const { return true; } |
2405 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); } | 2363 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); } |
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3073 | 3031 |
3074 class StrictCompareInstr : public TemplateComparison<2, NoThrow, Pure> { | 3032 class StrictCompareInstr : public TemplateComparison<2, NoThrow, Pure> { |
3075 public: | 3033 public: |
3076 StrictCompareInstr(TokenPosition token_pos, | 3034 StrictCompareInstr(TokenPosition token_pos, |
3077 Token::Kind kind, | 3035 Token::Kind kind, |
3078 Value* left, | 3036 Value* left, |
3079 Value* right, | 3037 Value* right, |
3080 bool needs_number_check, | 3038 bool needs_number_check, |
3081 intptr_t deopt_id); | 3039 intptr_t deopt_id); |
3082 | 3040 |
3083 DECLARE_COMPARISON_INSTRUCTION(StrictCompare) | 3041 DECLARE_INSTRUCTION(StrictCompare) |
3084 | 3042 |
3085 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); | 3043 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); |
3086 | 3044 |
3087 virtual CompileType ComputeType() const; | 3045 virtual CompileType ComputeType() const; |
3088 | 3046 |
3089 virtual bool ComputeCanDeoptimize() const { return false; } | 3047 virtual bool ComputeCanDeoptimize() const { return false; } |
3090 | 3048 |
3091 virtual Definition* Canonicalize(FlowGraph* flow_graph); | 3049 virtual Definition* Canonicalize(FlowGraph* flow_graph); |
3092 | 3050 |
| 3051 virtual void EmitBranchCode(FlowGraphCompiler* compiler, BranchInstr* branch); |
| 3052 |
| 3053 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler, |
| 3054 BranchLabels labels); |
| 3055 |
3093 bool needs_number_check() const { return needs_number_check_; } | 3056 bool needs_number_check() const { return needs_number_check_; } |
3094 void set_needs_number_check(bool value) { needs_number_check_ = value; } | 3057 void set_needs_number_check(bool value) { needs_number_check_ = value; } |
3095 | 3058 |
3096 bool AttributesEqual(Instruction* other) const; | 3059 bool AttributesEqual(Instruction* other) const; |
3097 | 3060 |
3098 PRINT_OPERANDS_TO_SUPPORT | 3061 PRINT_OPERANDS_TO_SUPPORT |
3099 | 3062 |
3100 private: | 3063 private: |
3101 // True if the comparison must check for double, Mint or Bigint and | 3064 // True if the comparison must check for double, Mint or Bigint and |
3102 // use value comparison instead. | 3065 // use value comparison instead. |
(...skipping 10 matching lines...) Expand all Loading... |
3113 TestSmiInstr(TokenPosition token_pos, | 3076 TestSmiInstr(TokenPosition token_pos, |
3114 Token::Kind kind, | 3077 Token::Kind kind, |
3115 Value* left, | 3078 Value* left, |
3116 Value* right) | 3079 Value* right) |
3117 : TemplateComparison(token_pos, kind) { | 3080 : TemplateComparison(token_pos, kind) { |
3118 ASSERT(kind == Token::kEQ || kind == Token::kNE); | 3081 ASSERT(kind == Token::kEQ || kind == Token::kNE); |
3119 SetInputAt(0, left); | 3082 SetInputAt(0, left); |
3120 SetInputAt(1, right); | 3083 SetInputAt(1, right); |
3121 } | 3084 } |
3122 | 3085 |
3123 DECLARE_COMPARISON_INSTRUCTION(TestSmi); | 3086 DECLARE_INSTRUCTION(TestSmi); |
3124 | 3087 |
3125 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); | 3088 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); |
3126 | 3089 |
3127 virtual CompileType ComputeType() const; | 3090 virtual CompileType ComputeType() const; |
3128 | 3091 |
3129 virtual bool ComputeCanDeoptimize() const { return false; } | 3092 virtual bool ComputeCanDeoptimize() const { return false; } |
3130 | 3093 |
3131 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 3094 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
3132 return kTagged; | 3095 return kTagged; |
3133 } | 3096 } |
3134 | 3097 |
| 3098 virtual void EmitBranchCode(FlowGraphCompiler* compiler, BranchInstr* branch); |
| 3099 |
| 3100 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler, |
| 3101 BranchLabels labels); |
| 3102 |
3135 private: | 3103 private: |
3136 DISALLOW_COPY_AND_ASSIGN(TestSmiInstr); | 3104 DISALLOW_COPY_AND_ASSIGN(TestSmiInstr); |
3137 }; | 3105 }; |
3138 | 3106 |
3139 | 3107 |
3140 // Checks the input value cid against cids stored in a table and returns either | 3108 // Checks the input value cid against cids stored in a table and returns either |
3141 // a result or deoptimizes. If the cid is not in the list and there is a deopt | 3109 // a result or deoptimizes. If the cid is not in the list and there is a deopt |
3142 // id, then the instruction deoptimizes. If there is no deopt id, all the | 3110 // id, then the instruction deoptimizes. If there is no deopt id, all the |
3143 // results must be the same (all true or all false) and the instruction returns | 3111 // results must be the same (all true or all false) and the instruction returns |
3144 // the opposite for cids not on the list. The first element in the table must | 3112 // the opposite for cids not on the list. The first element in the table must |
3145 // always be the result for the Smi class-id and is allowed to differ from the | 3113 // always be the result for the Smi class-id and is allowed to differ from the |
3146 // other results even in the no-deopt case. | 3114 // other results even in the no-deopt case. |
3147 class TestCidsInstr : public TemplateComparison<1, NoThrow, Pure> { | 3115 class TestCidsInstr : public TemplateComparison<1, NoThrow, Pure> { |
3148 public: | 3116 public: |
3149 TestCidsInstr(TokenPosition token_pos, | 3117 TestCidsInstr(TokenPosition token_pos, |
3150 Token::Kind kind, | 3118 Token::Kind kind, |
3151 Value* value, | 3119 Value* value, |
3152 const ZoneGrowableArray<intptr_t>& cid_results, | 3120 const ZoneGrowableArray<intptr_t>& cid_results, |
3153 intptr_t deopt_id); | 3121 intptr_t deopt_id); |
3154 | 3122 |
3155 const ZoneGrowableArray<intptr_t>& cid_results() const { | 3123 const ZoneGrowableArray<intptr_t>& cid_results() const { |
3156 return cid_results_; | 3124 return cid_results_; |
3157 } | 3125 } |
3158 | 3126 |
3159 DECLARE_COMPARISON_INSTRUCTION(TestCids); | 3127 DECLARE_INSTRUCTION(TestCids); |
3160 | 3128 |
3161 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); | 3129 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); |
3162 | 3130 |
3163 virtual CompileType ComputeType() const; | 3131 virtual CompileType ComputeType() const; |
3164 | 3132 |
3165 virtual Definition* Canonicalize(FlowGraph* flow_graph); | 3133 virtual Definition* Canonicalize(FlowGraph* flow_graph); |
3166 | 3134 |
3167 virtual bool ComputeCanDeoptimize() const { | 3135 virtual bool ComputeCanDeoptimize() const { |
3168 return GetDeoptId() != Thread::kNoDeoptId; | 3136 return GetDeoptId() != Thread::kNoDeoptId; |
3169 } | 3137 } |
3170 | 3138 |
3171 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 3139 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
3172 return kTagged; | 3140 return kTagged; |
3173 } | 3141 } |
3174 | 3142 |
3175 virtual bool AttributesEqual(Instruction* other) const; | 3143 virtual bool AttributesEqual(Instruction* other) const; |
3176 | 3144 |
| 3145 virtual void EmitBranchCode(FlowGraphCompiler* compiler, BranchInstr* branch); |
| 3146 |
| 3147 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler, |
| 3148 BranchLabels labels); |
| 3149 |
3177 void set_licm_hoisted(bool value) { licm_hoisted_ = value; } | 3150 void set_licm_hoisted(bool value) { licm_hoisted_ = value; } |
3178 | 3151 |
3179 PRINT_OPERANDS_TO_SUPPORT | 3152 PRINT_OPERANDS_TO_SUPPORT |
3180 | 3153 |
3181 private: | 3154 private: |
3182 const ZoneGrowableArray<intptr_t>& cid_results_; | 3155 const ZoneGrowableArray<intptr_t>& cid_results_; |
3183 bool licm_hoisted_; | 3156 bool licm_hoisted_; |
3184 DISALLOW_COPY_AND_ASSIGN(TestCidsInstr); | 3157 DISALLOW_COPY_AND_ASSIGN(TestCidsInstr); |
3185 }; | 3158 }; |
3186 | 3159 |
3187 | 3160 |
3188 class EqualityCompareInstr : public TemplateComparison<2, NoThrow, Pure> { | 3161 class EqualityCompareInstr : public TemplateComparison<2, NoThrow, Pure> { |
3189 public: | 3162 public: |
3190 EqualityCompareInstr(TokenPosition token_pos, | 3163 EqualityCompareInstr(TokenPosition token_pos, |
3191 Token::Kind kind, | 3164 Token::Kind kind, |
3192 Value* left, | 3165 Value* left, |
3193 Value* right, | 3166 Value* right, |
3194 intptr_t cid, | 3167 intptr_t cid, |
3195 intptr_t deopt_id) | 3168 intptr_t deopt_id) |
3196 : TemplateComparison(token_pos, kind, deopt_id) { | 3169 : TemplateComparison(token_pos, kind, deopt_id) { |
3197 ASSERT(Token::IsEqualityOperator(kind)); | 3170 ASSERT(Token::IsEqualityOperator(kind)); |
3198 SetInputAt(0, left); | 3171 SetInputAt(0, left); |
3199 SetInputAt(1, right); | 3172 SetInputAt(1, right); |
3200 set_operation_cid(cid); | 3173 set_operation_cid(cid); |
3201 } | 3174 } |
3202 | 3175 |
3203 DECLARE_COMPARISON_INSTRUCTION(EqualityCompare) | 3176 DECLARE_INSTRUCTION(EqualityCompare) |
3204 | 3177 |
3205 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); | 3178 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); |
3206 | 3179 |
3207 virtual CompileType ComputeType() const; | 3180 virtual CompileType ComputeType() const; |
3208 | 3181 |
3209 virtual bool ComputeCanDeoptimize() const { return false; } | 3182 virtual bool ComputeCanDeoptimize() const { return false; } |
3210 | 3183 |
| 3184 virtual void EmitBranchCode(FlowGraphCompiler* compiler, BranchInstr* branch); |
| 3185 |
| 3186 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler, |
| 3187 BranchLabels labels); |
| 3188 |
3211 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 3189 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
3212 ASSERT((idx == 0) || (idx == 1)); | 3190 ASSERT((idx == 0) || (idx == 1)); |
3213 if (operation_cid() == kDoubleCid) return kUnboxedDouble; | 3191 if (operation_cid() == kDoubleCid) return kUnboxedDouble; |
3214 if (operation_cid() == kMintCid) return kUnboxedMint; | 3192 if (operation_cid() == kMintCid) return kUnboxedMint; |
3215 return kTagged; | 3193 return kTagged; |
3216 } | 3194 } |
3217 | 3195 |
3218 PRINT_OPERANDS_TO_SUPPORT | 3196 PRINT_OPERANDS_TO_SUPPORT |
3219 | 3197 |
3220 private: | 3198 private: |
3221 DISALLOW_COPY_AND_ASSIGN(EqualityCompareInstr); | 3199 DISALLOW_COPY_AND_ASSIGN(EqualityCompareInstr); |
3222 }; | 3200 }; |
3223 | 3201 |
3224 | 3202 |
3225 class RelationalOpInstr : public TemplateComparison<2, NoThrow, Pure> { | 3203 class RelationalOpInstr : public TemplateComparison<2, NoThrow, Pure> { |
3226 public: | 3204 public: |
3227 RelationalOpInstr(TokenPosition token_pos, | 3205 RelationalOpInstr(TokenPosition token_pos, |
3228 Token::Kind kind, | 3206 Token::Kind kind, |
3229 Value* left, | 3207 Value* left, |
3230 Value* right, | 3208 Value* right, |
3231 intptr_t cid, | 3209 intptr_t cid, |
3232 intptr_t deopt_id) | 3210 intptr_t deopt_id) |
3233 : TemplateComparison(token_pos, kind, deopt_id) { | 3211 : TemplateComparison(token_pos, kind, deopt_id) { |
3234 ASSERT(Token::IsRelationalOperator(kind)); | 3212 ASSERT(Token::IsRelationalOperator(kind)); |
3235 SetInputAt(0, left); | 3213 SetInputAt(0, left); |
3236 SetInputAt(1, right); | 3214 SetInputAt(1, right); |
3237 set_operation_cid(cid); | 3215 set_operation_cid(cid); |
3238 } | 3216 } |
3239 | 3217 |
3240 DECLARE_COMPARISON_INSTRUCTION(RelationalOp) | 3218 DECLARE_INSTRUCTION(RelationalOp) |
3241 | 3219 |
3242 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); | 3220 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); |
3243 | 3221 |
3244 virtual CompileType ComputeType() const; | 3222 virtual CompileType ComputeType() const; |
3245 | 3223 |
3246 virtual bool ComputeCanDeoptimize() const { return false; } | 3224 virtual bool ComputeCanDeoptimize() const { return false; } |
3247 | 3225 |
| 3226 virtual void EmitBranchCode(FlowGraphCompiler* compiler, BranchInstr* branch); |
| 3227 |
| 3228 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler, |
| 3229 BranchLabels labels); |
| 3230 |
3248 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 3231 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
3249 ASSERT((idx == 0) || (idx == 1)); | 3232 ASSERT((idx == 0) || (idx == 1)); |
3250 if (operation_cid() == kDoubleCid) return kUnboxedDouble; | 3233 if (operation_cid() == kDoubleCid) return kUnboxedDouble; |
3251 if (operation_cid() == kMintCid) return kUnboxedMint; | 3234 if (operation_cid() == kMintCid) return kUnboxedMint; |
3252 return kTagged; | 3235 return kTagged; |
3253 } | 3236 } |
3254 | 3237 |
3255 PRINT_OPERANDS_TO_SUPPORT | 3238 PRINT_OPERANDS_TO_SUPPORT |
3256 | 3239 |
3257 private: | 3240 private: |
(...skipping 2100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5358 | 5341 |
5359 virtual bool ComputeCanDeoptimize() const { return false; } | 5342 virtual bool ComputeCanDeoptimize() const { return false; } |
5360 | 5343 |
5361 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 5344 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
5362 ASSERT(idx == 0); | 5345 ASSERT(idx == 0); |
5363 return kUnboxedDouble; | 5346 return kUnboxedDouble; |
5364 } | 5347 } |
5365 | 5348 |
5366 PRINT_OPERANDS_TO_SUPPORT | 5349 PRINT_OPERANDS_TO_SUPPORT |
5367 | 5350 |
5368 DECLARE_COMPARISON_INSTRUCTION(DoubleTestOp) | 5351 DECLARE_INSTRUCTION(DoubleTestOp) |
5369 | |
5370 virtual CompileType ComputeType() const; | 5352 virtual CompileType ComputeType() const; |
5371 | 5353 |
5372 virtual Definition* Canonicalize(FlowGraph* flow_graph); | 5354 virtual Definition* Canonicalize(FlowGraph* flow_graph); |
5373 | 5355 |
5374 virtual bool AttributesEqual(Instruction* other) const { | 5356 virtual bool AttributesEqual(Instruction* other) const { |
5375 return op_kind_ == other->AsDoubleTestOp()->op_kind() && | 5357 return op_kind_ == other->AsDoubleTestOp()->op_kind() && |
5376 ComparisonInstr::AttributesEqual(other); | 5358 ComparisonInstr::AttributesEqual(other); |
5377 } | 5359 } |
5378 | 5360 |
5379 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); | 5361 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); |
5380 | 5362 |
| 5363 virtual void EmitBranchCode(FlowGraphCompiler* compiler, BranchInstr* branch); |
| 5364 |
| 5365 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler, |
| 5366 BranchLabels labels); |
| 5367 |
5381 private: | 5368 private: |
5382 const MethodRecognizer::Kind op_kind_; | 5369 const MethodRecognizer::Kind op_kind_; |
5383 | 5370 |
5384 DISALLOW_COPY_AND_ASSIGN(DoubleTestOpInstr); | 5371 DISALLOW_COPY_AND_ASSIGN(DoubleTestOpInstr); |
5385 }; | 5372 }; |
5386 | 5373 |
5387 | 5374 |
5388 class BinaryFloat32x4OpInstr : public TemplateDefinition<2, NoThrow, Pure> { | 5375 class BinaryFloat32x4OpInstr : public TemplateDefinition<2, NoThrow, Pure> { |
5389 public: | 5376 public: |
5390 BinaryFloat32x4OpInstr(Token::Kind op_kind, | 5377 BinaryFloat32x4OpInstr(Token::Kind op_kind, |
(...skipping 1549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6940 | 6927 |
6941 PRINT_OPERANDS_TO_SUPPORT | 6928 PRINT_OPERANDS_TO_SUPPORT |
6942 | 6929 |
6943 DECLARE_INSTRUCTION(CheckedSmiComparison) | 6930 DECLARE_INSTRUCTION(CheckedSmiComparison) |
6944 | 6931 |
6945 virtual void EmitBranchCode(FlowGraphCompiler* compiler, BranchInstr* branch); | 6932 virtual void EmitBranchCode(FlowGraphCompiler* compiler, BranchInstr* branch); |
6946 | 6933 |
6947 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler, | 6934 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler, |
6948 BranchLabels labels); | 6935 BranchLabels labels); |
6949 | 6936 |
6950 #if defined(TARGET_ARCH_DBC) | |
6951 virtual Condition GetNextInstructionCondition(FlowGraphCompiler* compiler, | |
6952 BranchLabels labels) { | |
6953 UNREACHABLE(); | |
6954 return INVALID_CONDITION; | |
6955 } | |
6956 #endif | |
6957 | |
6958 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); | 6937 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); |
6959 | 6938 |
6960 private: | 6939 private: |
6961 InstanceCallInstr* call_; | 6940 InstanceCallInstr* call_; |
6962 bool is_negated_; | 6941 bool is_negated_; |
6963 DISALLOW_COPY_AND_ASSIGN(CheckedSmiComparisonInstr); | 6942 DISALLOW_COPY_AND_ASSIGN(CheckedSmiComparisonInstr); |
6964 }; | 6943 }; |
6965 | 6944 |
6966 | 6945 |
6967 class BinaryIntegerOpInstr : public TemplateDefinition<2, NoThrow, Pure> { | 6946 class BinaryIntegerOpInstr : public TemplateDefinition<2, NoThrow, Pure> { |
(...skipping 1288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8256 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ | 8235 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ |
8257 UNIMPLEMENTED(); \ | 8236 UNIMPLEMENTED(); \ |
8258 return NULL; \ | 8237 return NULL; \ |
8259 } \ | 8238 } \ |
8260 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } | 8239 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } |
8261 | 8240 |
8262 | 8241 |
8263 } // namespace dart | 8242 } // namespace dart |
8264 | 8243 |
8265 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ | 8244 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ |
OLD | NEW |