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

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

Issue 2937933002: Reduce copying, redundancy & repetition for codegen of comparison instructions (Closed)
Patch Set: Created 3 years, 6 months 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 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
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 GetPredictedCondition(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
539 #ifndef PRODUCT 559 #ifndef PRODUCT
540 #define PRINT_TO_SUPPORT virtual void PrintTo(BufferFormatter* f) const; 560 #define PRINT_TO_SUPPORT virtual void PrintTo(BufferFormatter* f) const;
541 #else 561 #else
542 #define PRINT_TO_SUPPORT 562 #define PRINT_TO_SUPPORT
543 #endif // !PRODUCT 563 #endif // !PRODUCT
544 564
545 #ifndef PRODUCT 565 #ifndef PRODUCT
546 #define PRINT_OPERANDS_TO_SUPPORT \ 566 #define PRINT_OPERANDS_TO_SUPPORT \
547 virtual void PrintOperandsTo(BufferFormatter* f) const; 567 virtual void PrintOperandsTo(BufferFormatter* f) const;
548 #else 568 #else
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
959 Instruction* previous_; 979 Instruction* previous_;
960 Instruction* next_; 980 Instruction* next_;
961 Environment* env_; 981 Environment* env_;
962 LocationSummary* locs_; 982 LocationSummary* locs_;
963 intptr_t inlining_id_; 983 intptr_t inlining_id_;
964 984
965 DISALLOW_COPY_AND_ASSIGN(Instruction); 985 DISALLOW_COPY_AND_ASSIGN(Instruction);
966 }; 986 };
967 987
968 988
989 struct BranchLabels {
990 Label* true_label;
991 Label* false_label;
992 Label* fall_through;
993 };
994
995
969 class PureInstruction : public Instruction { 996 class PureInstruction : public Instruction {
970 public: 997 public:
971 explicit PureInstruction(intptr_t deopt_id) : Instruction(deopt_id) {} 998 explicit PureInstruction(intptr_t deopt_id) : Instruction(deopt_id) {}
972 999
973 virtual bool AllowsCSE() const { return true; } 1000 virtual bool AllowsCSE() const { return true; }
974 virtual EffectSet Dependencies() const { return EffectSet::None(); } 1001 virtual EffectSet Dependencies() const { return EffectSet::None(); }
975 1002
976 virtual EffectSet Effects() const { return EffectSet::None(); } 1003 virtual EffectSet Effects() const { return EffectSet::None(); }
977 }; 1004 };
978 1005
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after
1913 EmbeddedArray<Value*, N> inputs_; 1940 EmbeddedArray<Value*, N> inputs_;
1914 1941
1915 private: 1942 private:
1916 friend class BranchInstr; 1943 friend class BranchInstr;
1917 friend class IfThenElseInstr; 1944 friend class IfThenElseInstr;
1918 1945
1919 virtual void RawSetInputAt(intptr_t i, Value* value) { inputs_[i] = value; } 1946 virtual void RawSetInputAt(intptr_t i, Value* value) { inputs_[i] = value; }
1920 }; 1947 };
1921 1948
1922 1949
1923 struct BranchLabels {
1924 Label* true_label;
1925 Label* false_label;
1926 Label* fall_through;
1927 };
1928
1929
1930 class InductionVariableInfo; 1950 class InductionVariableInfo;
1931 1951
1932 1952
1933 class PhiInstr : public Definition { 1953 class PhiInstr : public Definition {
1934 public: 1954 public:
1935 PhiInstr(JoinEntryInstr* block, intptr_t num_inputs) 1955 PhiInstr(JoinEntryInstr* block, intptr_t num_inputs)
1936 : block_(block), 1956 : block_(block),
1937 inputs_(num_inputs), 1957 inputs_(num_inputs),
1938 representation_(kTagged), 1958 representation_(kTagged),
1939 reaching_defs_(NULL), 1959 reaching_defs_(NULL),
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
2413 : CSETrait<ComparisonInstr, PureComparison>::Base(token_pos, 2433 : CSETrait<ComparisonInstr, PureComparison>::Base(token_pos,
2414 kind, 2434 kind,
2415 deopt_id), 2435 deopt_id),
2416 inputs_() {} 2436 inputs_() {}
2417 2437
2418 virtual intptr_t InputCount() const { return N; } 2438 virtual intptr_t InputCount() const { return N; }
2419 virtual Value* InputAt(intptr_t i) const { return inputs_[i]; } 2439 virtual Value* InputAt(intptr_t i) const { return inputs_[i]; }
2420 2440
2421 virtual bool MayThrow() const { return ThrowsTrait::kCanThrow; } 2441 virtual bool MayThrow() const { return ThrowsTrait::kCanThrow; }
2422 2442
2443 virtual void EmitBranchCode(FlowGraphCompiler* compiler, BranchInstr* branch);
Vyacheslav Egorov (Google) 2017/06/15 11:32:46 I think all of these methods should simply go into
Vyacheslav Egorov (Google) 2017/06/15 11:32:46 Also comment what this does.
erikcorry 2017/06/19 07:15:09 I was sure there was some reason that would not wo
erikcorry 2017/06/19 07:15:09 Done.
2444
2445 // Used by EmitBranchCode and EmitNativeCode depending on whether the boolean
2446 // is to be turned into branches or instantiated.
2447 // May return a valid condition in which case the caller is expected to emit
2448 // a branch based on that condition. May also branch directly to the labels.
Vyacheslav Egorov (Google) 2017/06/15 11:32:46 "emit a branch based on that condition" <- specify
erikcorry 2017/06/19 07:15:09 Done.
2449 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler,
2450 BranchLabels labels) = 0;
2451
2452 #if defined(TARGET_ARCH_DBC)
2453 virtual Condition GetPredictedCondition(FlowGraphCompiler* compiler,
Vyacheslav Egorov (Google) 2017/06/15 11:32:46 Comment what this does.
erikcorry 2017/06/19 07:15:09 Done.
2454 BranchLabels labels) = 0;
2455 #endif
2456
2457 virtual void EmitNativeCode(FlowGraphCompiler* compiler);
2458
2423 protected: 2459 protected:
2424 EmbeddedArray<Value*, N> inputs_; 2460 EmbeddedArray<Value*, N> inputs_;
2425 2461
2426 private: 2462 private:
2427 virtual void RawSetInputAt(intptr_t i, Value* value) { inputs_[i] = value; } 2463 virtual void RawSetInputAt(intptr_t i, Value* value) { inputs_[i] = value; }
2428 }; 2464 };
2429 2465
2430 2466
2431 class BranchInstr : public Instruction { 2467 class BranchInstr : public Instruction {
2432 public: 2468 public:
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
3031 3067
3032 class StrictCompareInstr : public TemplateComparison<2, NoThrow, Pure> { 3068 class StrictCompareInstr : public TemplateComparison<2, NoThrow, Pure> {
3033 public: 3069 public:
3034 StrictCompareInstr(TokenPosition token_pos, 3070 StrictCompareInstr(TokenPosition token_pos,
3035 Token::Kind kind, 3071 Token::Kind kind,
3036 Value* left, 3072 Value* left,
3037 Value* right, 3073 Value* right,
3038 bool needs_number_check, 3074 bool needs_number_check,
3039 intptr_t deopt_id); 3075 intptr_t deopt_id);
3040 3076
3041 DECLARE_INSTRUCTION(StrictCompare) 3077 DECLARE_COMPARISON_INSTRUCTION(StrictCompare)
3042 3078
3043 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); 3079 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right);
3044 3080
3045 virtual CompileType ComputeType() const; 3081 virtual CompileType ComputeType() const;
3046 3082
3047 virtual bool ComputeCanDeoptimize() const { return false; } 3083 virtual bool ComputeCanDeoptimize() const { return false; }
3048 3084
3049 virtual Definition* Canonicalize(FlowGraph* flow_graph); 3085 virtual Definition* Canonicalize(FlowGraph* flow_graph);
3050 3086
3051 virtual void EmitBranchCode(FlowGraphCompiler* compiler, BranchInstr* branch);
3052
3053 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler,
3054 BranchLabels labels);
3055
3056 bool needs_number_check() const { return needs_number_check_; } 3087 bool needs_number_check() const { return needs_number_check_; }
3057 void set_needs_number_check(bool value) { needs_number_check_ = value; } 3088 void set_needs_number_check(bool value) { needs_number_check_ = value; }
3058 3089
3059 bool AttributesEqual(Instruction* other) const; 3090 bool AttributesEqual(Instruction* other) const;
3060 3091
3061 PRINT_OPERANDS_TO_SUPPORT 3092 PRINT_OPERANDS_TO_SUPPORT
3062 3093
3063 private: 3094 private:
3064 // True if the comparison must check for double, Mint or Bigint and 3095 // True if the comparison must check for double, Mint or Bigint and
3065 // use value comparison instead. 3096 // use value comparison instead.
(...skipping 10 matching lines...) Expand all
3076 TestSmiInstr(TokenPosition token_pos, 3107 TestSmiInstr(TokenPosition token_pos,
3077 Token::Kind kind, 3108 Token::Kind kind,
3078 Value* left, 3109 Value* left,
3079 Value* right) 3110 Value* right)
3080 : TemplateComparison(token_pos, kind) { 3111 : TemplateComparison(token_pos, kind) {
3081 ASSERT(kind == Token::kEQ || kind == Token::kNE); 3112 ASSERT(kind == Token::kEQ || kind == Token::kNE);
3082 SetInputAt(0, left); 3113 SetInputAt(0, left);
3083 SetInputAt(1, right); 3114 SetInputAt(1, right);
3084 } 3115 }
3085 3116
3086 DECLARE_INSTRUCTION(TestSmi); 3117 DECLARE_COMPARISON_INSTRUCTION(TestSmi);
3087 3118
3088 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); 3119 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right);
3089 3120
3090 virtual CompileType ComputeType() const; 3121 virtual CompileType ComputeType() const;
3091 3122
3092 virtual bool ComputeCanDeoptimize() const { return false; } 3123 virtual bool ComputeCanDeoptimize() const { return false; }
3093 3124
3094 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 3125 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
3095 return kTagged; 3126 return kTagged;
3096 } 3127 }
3097 3128
3098 virtual void EmitBranchCode(FlowGraphCompiler* compiler, BranchInstr* branch);
3099
3100 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler,
3101 BranchLabels labels);
3102
3103 private: 3129 private:
3104 DISALLOW_COPY_AND_ASSIGN(TestSmiInstr); 3130 DISALLOW_COPY_AND_ASSIGN(TestSmiInstr);
3105 }; 3131 };
3106 3132
3107 3133
3108 // Checks the input value cid against cids stored in a table and returns either 3134 // Checks the input value cid against cids stored in a table and returns either
3109 // a result or deoptimizes. If the cid is not in the list and there is a deopt 3135 // a result or deoptimizes. If the cid is not in the list and there is a deopt
3110 // id, then the instruction deoptimizes. If there is no deopt id, all the 3136 // id, then the instruction deoptimizes. If there is no deopt id, all the
3111 // results must be the same (all true or all false) and the instruction returns 3137 // results must be the same (all true or all false) and the instruction returns
3112 // the opposite for cids not on the list. The first element in the table must 3138 // the opposite for cids not on the list. The first element in the table must
3113 // always be the result for the Smi class-id and is allowed to differ from the 3139 // always be the result for the Smi class-id and is allowed to differ from the
3114 // other results even in the no-deopt case. 3140 // other results even in the no-deopt case.
3115 class TestCidsInstr : public TemplateComparison<1, NoThrow, Pure> { 3141 class TestCidsInstr : public TemplateComparison<1, NoThrow, Pure> {
3116 public: 3142 public:
3117 TestCidsInstr(TokenPosition token_pos, 3143 TestCidsInstr(TokenPosition token_pos,
3118 Token::Kind kind, 3144 Token::Kind kind,
3119 Value* value, 3145 Value* value,
3120 const ZoneGrowableArray<intptr_t>& cid_results, 3146 const ZoneGrowableArray<intptr_t>& cid_results,
3121 intptr_t deopt_id); 3147 intptr_t deopt_id);
3122 3148
3123 const ZoneGrowableArray<intptr_t>& cid_results() const { 3149 const ZoneGrowableArray<intptr_t>& cid_results() const {
3124 return cid_results_; 3150 return cid_results_;
3125 } 3151 }
3126 3152
3127 DECLARE_INSTRUCTION(TestCids); 3153 DECLARE_COMPARISON_INSTRUCTION(TestCids);
3128 3154
3129 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); 3155 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right);
3130 3156
3131 virtual CompileType ComputeType() const; 3157 virtual CompileType ComputeType() const;
3132 3158
3133 virtual Definition* Canonicalize(FlowGraph* flow_graph); 3159 virtual Definition* Canonicalize(FlowGraph* flow_graph);
3134 3160
3135 virtual bool ComputeCanDeoptimize() const { 3161 virtual bool ComputeCanDeoptimize() const {
3136 return GetDeoptId() != Thread::kNoDeoptId; 3162 return GetDeoptId() != Thread::kNoDeoptId;
3137 } 3163 }
3138 3164
3139 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 3165 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
3140 return kTagged; 3166 return kTagged;
3141 } 3167 }
3142 3168
3143 virtual bool AttributesEqual(Instruction* other) const; 3169 virtual bool AttributesEqual(Instruction* other) const;
3144 3170
3145 virtual void EmitBranchCode(FlowGraphCompiler* compiler, BranchInstr* branch);
3146
3147 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler,
3148 BranchLabels labels);
3149
3150 void set_licm_hoisted(bool value) { licm_hoisted_ = value; } 3171 void set_licm_hoisted(bool value) { licm_hoisted_ = value; }
3151 3172
3152 PRINT_OPERANDS_TO_SUPPORT 3173 PRINT_OPERANDS_TO_SUPPORT
3153 3174
3154 private: 3175 private:
3155 const ZoneGrowableArray<intptr_t>& cid_results_; 3176 const ZoneGrowableArray<intptr_t>& cid_results_;
3156 bool licm_hoisted_; 3177 bool licm_hoisted_;
3157 DISALLOW_COPY_AND_ASSIGN(TestCidsInstr); 3178 DISALLOW_COPY_AND_ASSIGN(TestCidsInstr);
3158 }; 3179 };
3159 3180
3160 3181
3161 class EqualityCompareInstr : public TemplateComparison<2, NoThrow, Pure> { 3182 class EqualityCompareInstr : public TemplateComparison<2, NoThrow, Pure> {
3162 public: 3183 public:
3163 EqualityCompareInstr(TokenPosition token_pos, 3184 EqualityCompareInstr(TokenPosition token_pos,
3164 Token::Kind kind, 3185 Token::Kind kind,
3165 Value* left, 3186 Value* left,
3166 Value* right, 3187 Value* right,
3167 intptr_t cid, 3188 intptr_t cid,
3168 intptr_t deopt_id) 3189 intptr_t deopt_id)
3169 : TemplateComparison(token_pos, kind, deopt_id) { 3190 : TemplateComparison(token_pos, kind, deopt_id) {
3170 ASSERT(Token::IsEqualityOperator(kind)); 3191 ASSERT(Token::IsEqualityOperator(kind));
3171 SetInputAt(0, left); 3192 SetInputAt(0, left);
3172 SetInputAt(1, right); 3193 SetInputAt(1, right);
3173 set_operation_cid(cid); 3194 set_operation_cid(cid);
3174 } 3195 }
3175 3196
3176 DECLARE_INSTRUCTION(EqualityCompare) 3197 DECLARE_COMPARISON_INSTRUCTION(EqualityCompare)
3177 3198
3178 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); 3199 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right);
3179 3200
3180 virtual CompileType ComputeType() const; 3201 virtual CompileType ComputeType() const;
3181 3202
3182 virtual bool ComputeCanDeoptimize() const { return false; } 3203 virtual bool ComputeCanDeoptimize() const { return false; }
3183 3204
3184 virtual void EmitBranchCode(FlowGraphCompiler* compiler, BranchInstr* branch);
3185
3186 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler,
3187 BranchLabels labels);
3188
3189 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 3205 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
3190 ASSERT((idx == 0) || (idx == 1)); 3206 ASSERT((idx == 0) || (idx == 1));
3191 if (operation_cid() == kDoubleCid) return kUnboxedDouble; 3207 if (operation_cid() == kDoubleCid) return kUnboxedDouble;
3192 if (operation_cid() == kMintCid) return kUnboxedMint; 3208 if (operation_cid() == kMintCid) return kUnboxedMint;
3193 return kTagged; 3209 return kTagged;
3194 } 3210 }
3195 3211
3196 PRINT_OPERANDS_TO_SUPPORT 3212 PRINT_OPERANDS_TO_SUPPORT
3197 3213
3198 private: 3214 private:
3199 DISALLOW_COPY_AND_ASSIGN(EqualityCompareInstr); 3215 DISALLOW_COPY_AND_ASSIGN(EqualityCompareInstr);
3200 }; 3216 };
3201 3217
3202 3218
3203 class RelationalOpInstr : public TemplateComparison<2, NoThrow, Pure> { 3219 class RelationalOpInstr : public TemplateComparison<2, NoThrow, Pure> {
3204 public: 3220 public:
3205 RelationalOpInstr(TokenPosition token_pos, 3221 RelationalOpInstr(TokenPosition token_pos,
3206 Token::Kind kind, 3222 Token::Kind kind,
3207 Value* left, 3223 Value* left,
3208 Value* right, 3224 Value* right,
3209 intptr_t cid, 3225 intptr_t cid,
3210 intptr_t deopt_id) 3226 intptr_t deopt_id)
3211 : TemplateComparison(token_pos, kind, deopt_id) { 3227 : TemplateComparison(token_pos, kind, deopt_id) {
3212 ASSERT(Token::IsRelationalOperator(kind)); 3228 ASSERT(Token::IsRelationalOperator(kind));
3213 SetInputAt(0, left); 3229 SetInputAt(0, left);
3214 SetInputAt(1, right); 3230 SetInputAt(1, right);
3215 set_operation_cid(cid); 3231 set_operation_cid(cid);
3216 } 3232 }
3217 3233
3218 DECLARE_INSTRUCTION(RelationalOp) 3234 DECLARE_COMPARISON_INSTRUCTION(RelationalOp)
3219 3235
3220 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); 3236 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right);
3221 3237
3222 virtual CompileType ComputeType() const; 3238 virtual CompileType ComputeType() const;
3223 3239
3224 virtual bool ComputeCanDeoptimize() const { return false; } 3240 virtual bool ComputeCanDeoptimize() const { return false; }
3225 3241
3226 virtual void EmitBranchCode(FlowGraphCompiler* compiler, BranchInstr* branch);
3227
3228 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler,
3229 BranchLabels labels);
3230
3231 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 3242 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
3232 ASSERT((idx == 0) || (idx == 1)); 3243 ASSERT((idx == 0) || (idx == 1));
3233 if (operation_cid() == kDoubleCid) return kUnboxedDouble; 3244 if (operation_cid() == kDoubleCid) return kUnboxedDouble;
3234 if (operation_cid() == kMintCid) return kUnboxedMint; 3245 if (operation_cid() == kMintCid) return kUnboxedMint;
3235 return kTagged; 3246 return kTagged;
3236 } 3247 }
3237 3248
3238 PRINT_OPERANDS_TO_SUPPORT 3249 PRINT_OPERANDS_TO_SUPPORT
3239 3250
3240 private: 3251 private:
(...skipping 2100 matching lines...) Expand 10 before | Expand all | Expand 10 after
5341 5352
5342 virtual bool ComputeCanDeoptimize() const { return false; } 5353 virtual bool ComputeCanDeoptimize() const { return false; }
5343 5354
5344 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 5355 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
5345 ASSERT(idx == 0); 5356 ASSERT(idx == 0);
5346 return kUnboxedDouble; 5357 return kUnboxedDouble;
5347 } 5358 }
5348 5359
5349 PRINT_OPERANDS_TO_SUPPORT 5360 PRINT_OPERANDS_TO_SUPPORT
5350 5361
5351 DECLARE_INSTRUCTION(DoubleTestOp) 5362 DECLARE_COMPARISON_INSTRUCTION(DoubleTestOp)
5363
5352 virtual CompileType ComputeType() const; 5364 virtual CompileType ComputeType() const;
5353 5365
5354 virtual Definition* Canonicalize(FlowGraph* flow_graph); 5366 virtual Definition* Canonicalize(FlowGraph* flow_graph);
5355 5367
5356 virtual bool AttributesEqual(Instruction* other) const { 5368 virtual bool AttributesEqual(Instruction* other) const {
5357 return op_kind_ == other->AsDoubleTestOp()->op_kind() && 5369 return op_kind_ == other->AsDoubleTestOp()->op_kind() &&
5358 ComparisonInstr::AttributesEqual(other); 5370 ComparisonInstr::AttributesEqual(other);
5359 } 5371 }
5360 5372
5361 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); 5373 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right);
5362 5374
5363 virtual void EmitBranchCode(FlowGraphCompiler* compiler, BranchInstr* branch);
5364
5365 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler,
5366 BranchLabels labels);
5367
5368 private: 5375 private:
5369 const MethodRecognizer::Kind op_kind_; 5376 const MethodRecognizer::Kind op_kind_;
5370 5377
5371 DISALLOW_COPY_AND_ASSIGN(DoubleTestOpInstr); 5378 DISALLOW_COPY_AND_ASSIGN(DoubleTestOpInstr);
5372 }; 5379 };
5373 5380
5374 5381
5375 class BinaryFloat32x4OpInstr : public TemplateDefinition<2, NoThrow, Pure> { 5382 class BinaryFloat32x4OpInstr : public TemplateDefinition<2, NoThrow, Pure> {
5376 public: 5383 public:
5377 BinaryFloat32x4OpInstr(Token::Kind op_kind, 5384 BinaryFloat32x4OpInstr(Token::Kind op_kind,
(...skipping 1549 matching lines...) Expand 10 before | Expand all | Expand 10 after
6927 6934
6928 PRINT_OPERANDS_TO_SUPPORT 6935 PRINT_OPERANDS_TO_SUPPORT
6929 6936
6930 DECLARE_INSTRUCTION(CheckedSmiComparison) 6937 DECLARE_INSTRUCTION(CheckedSmiComparison)
6931 6938
6932 virtual void EmitBranchCode(FlowGraphCompiler* compiler, BranchInstr* branch); 6939 virtual void EmitBranchCode(FlowGraphCompiler* compiler, BranchInstr* branch);
6933 6940
6934 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler, 6941 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler,
6935 BranchLabels labels); 6942 BranchLabels labels);
6936 6943
6944 #if defined(TARGET_ARCH_DBC)
6945 virtual Condition GetPredictedCondition(FlowGraphCompiler* compiler,
6946 BranchLabels labels) {
6947 UNREACHABLE();
6948 return INVALID_CONDITION;
6949 }
6950 #endif
6951
6937 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); 6952 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right);
6938 6953
6939 private: 6954 private:
6940 InstanceCallInstr* call_; 6955 InstanceCallInstr* call_;
6941 bool is_negated_; 6956 bool is_negated_;
6942 DISALLOW_COPY_AND_ASSIGN(CheckedSmiComparisonInstr); 6957 DISALLOW_COPY_AND_ASSIGN(CheckedSmiComparisonInstr);
6943 }; 6958 };
6944 6959
6945 6960
6946 class BinaryIntegerOpInstr : public TemplateDefinition<2, NoThrow, Pure> { 6961 class BinaryIntegerOpInstr : public TemplateDefinition<2, NoThrow, Pure> {
(...skipping 1288 matching lines...) Expand 10 before | Expand all | Expand 10 after
8235 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ 8250 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \
8236 UNIMPLEMENTED(); \ 8251 UNIMPLEMENTED(); \
8237 return NULL; \ 8252 return NULL; \
8238 } \ 8253 } \
8239 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } 8254 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); }
8240 8255
8241 8256
8242 } // namespace dart 8257 } // namespace dart
8243 8258
8244 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ 8259 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698