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

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

Issue 2947633002: VM-codegen: Clean up the way we emit code for comparison instructions. (Closed)
Patch Set: Simplify DBC ComparisonInstr::EmitNativeCode 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
« no previous file with comments | « runtime/vm/disassembler_arm64.cc ('k') | runtime/vm/intermediate_language_arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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
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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
2338 class ComparisonInstr : public Definition { 2358 class ComparisonInstr : public Definition {
2339 public: 2359 public:
2340 Value* left() const { return InputAt(0); } 2360 Value* left() const { return InputAt(0); }
2341 Value* right() const { return InputAt(1); } 2361 Value* right() const { return InputAt(1); }
2342 2362
2343 virtual TokenPosition token_pos() const { return token_pos_; } 2363 virtual TokenPosition token_pos() const { return token_pos_; }
2344 Token::Kind kind() const { return kind_; } 2364 Token::Kind kind() const { return kind_; }
2345 2365
2346 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right) = 0; 2366 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right) = 0;
2347 2367
2348 virtual void EmitBranchCode(FlowGraphCompiler* compiler, 2368 // Emits instructions to do the comparison and branch to the true or false
2349 BranchInstr* branch) = 0; 2369 // label depending on the result. This implementation will call
2370 // EmitComparisonCode and then generate the branch instructions afterwards.
2371 virtual void EmitBranchCode(FlowGraphCompiler* compiler, BranchInstr* branch);
2350 2372
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.
2351 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler, 2378 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler,
2352 BranchLabels labels) = 0; 2379 BranchLabels labels) = 0;
2353 2380
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
2354 void SetDeoptId(const Instruction& instr) { CopyDeoptIdFrom(instr); } 2396 void SetDeoptId(const Instruction& instr) { CopyDeoptIdFrom(instr); }
2355 2397
2356 // Operation class id is computed from collected ICData. 2398 // Operation class id is computed from collected ICData.
2357 void set_operation_cid(intptr_t value) { operation_cid_ = value; } 2399 void set_operation_cid(intptr_t value) { operation_cid_ = value; }
2358 intptr_t operation_cid() const { return operation_cid_; } 2400 intptr_t operation_cid() const { return operation_cid_; }
2359 2401
2360 virtual void NegateComparison() { kind_ = Token::NegateComparison(kind_); } 2402 virtual void NegateComparison() { kind_ = Token::NegateComparison(kind_); }
2361 2403
2362 virtual bool CanBecomeDeoptimizationTarget() const { return true; } 2404 virtual bool CanBecomeDeoptimizationTarget() const { return true; }
2363 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); } 2405 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); }
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
3031 3073
3032 class StrictCompareInstr : public TemplateComparison<2, NoThrow, Pure> { 3074 class StrictCompareInstr : public TemplateComparison<2, NoThrow, Pure> {
3033 public: 3075 public:
3034 StrictCompareInstr(TokenPosition token_pos, 3076 StrictCompareInstr(TokenPosition token_pos,
3035 Token::Kind kind, 3077 Token::Kind kind,
3036 Value* left, 3078 Value* left,
3037 Value* right, 3079 Value* right,
3038 bool needs_number_check, 3080 bool needs_number_check,
3039 intptr_t deopt_id); 3081 intptr_t deopt_id);
3040 3082
3041 DECLARE_INSTRUCTION(StrictCompare) 3083 DECLARE_COMPARISON_INSTRUCTION(StrictCompare)
3042 3084
3043 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); 3085 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right);
3044 3086
3045 virtual CompileType ComputeType() const; 3087 virtual CompileType ComputeType() const;
3046 3088
3047 virtual bool ComputeCanDeoptimize() const { return false; } 3089 virtual bool ComputeCanDeoptimize() const { return false; }
3048 3090
3049 virtual Definition* Canonicalize(FlowGraph* flow_graph); 3091 virtual Definition* Canonicalize(FlowGraph* flow_graph);
3050 3092
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_; } 3093 bool needs_number_check() const { return needs_number_check_; }
3057 void set_needs_number_check(bool value) { needs_number_check_ = value; } 3094 void set_needs_number_check(bool value) { needs_number_check_ = value; }
3058 3095
3059 bool AttributesEqual(Instruction* other) const; 3096 bool AttributesEqual(Instruction* other) const;
3060 3097
3061 PRINT_OPERANDS_TO_SUPPORT 3098 PRINT_OPERANDS_TO_SUPPORT
3062 3099
3063 private: 3100 private:
3064 // True if the comparison must check for double, Mint or Bigint and 3101 // True if the comparison must check for double, Mint or Bigint and
3065 // use value comparison instead. 3102 // use value comparison instead.
(...skipping 10 matching lines...) Expand all
3076 TestSmiInstr(TokenPosition token_pos, 3113 TestSmiInstr(TokenPosition token_pos,
3077 Token::Kind kind, 3114 Token::Kind kind,
3078 Value* left, 3115 Value* left,
3079 Value* right) 3116 Value* right)
3080 : TemplateComparison(token_pos, kind) { 3117 : TemplateComparison(token_pos, kind) {
3081 ASSERT(kind == Token::kEQ || kind == Token::kNE); 3118 ASSERT(kind == Token::kEQ || kind == Token::kNE);
3082 SetInputAt(0, left); 3119 SetInputAt(0, left);
3083 SetInputAt(1, right); 3120 SetInputAt(1, right);
3084 } 3121 }
3085 3122
3086 DECLARE_INSTRUCTION(TestSmi); 3123 DECLARE_COMPARISON_INSTRUCTION(TestSmi);
3087 3124
3088 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); 3125 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right);
3089 3126
3090 virtual CompileType ComputeType() const; 3127 virtual CompileType ComputeType() const;
3091 3128
3092 virtual bool ComputeCanDeoptimize() const { return false; } 3129 virtual bool ComputeCanDeoptimize() const { return false; }
3093 3130
3094 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 3131 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
3095 return kTagged; 3132 return kTagged;
3096 } 3133 }
3097 3134
3098 virtual void EmitBranchCode(FlowGraphCompiler* compiler, BranchInstr* branch);
3099
3100 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler,
3101 BranchLabels labels);
3102
3103 private: 3135 private:
3104 DISALLOW_COPY_AND_ASSIGN(TestSmiInstr); 3136 DISALLOW_COPY_AND_ASSIGN(TestSmiInstr);
3105 }; 3137 };
3106 3138
3107 3139
3108 // Checks the input value cid against cids stored in a table and returns either 3140 // 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 3141 // 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 3142 // 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 3143 // 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 3144 // 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 3145 // 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. 3146 // other results even in the no-deopt case.
3115 class TestCidsInstr : public TemplateComparison<1, NoThrow, Pure> { 3147 class TestCidsInstr : public TemplateComparison<1, NoThrow, Pure> {
3116 public: 3148 public:
3117 TestCidsInstr(TokenPosition token_pos, 3149 TestCidsInstr(TokenPosition token_pos,
3118 Token::Kind kind, 3150 Token::Kind kind,
3119 Value* value, 3151 Value* value,
3120 const ZoneGrowableArray<intptr_t>& cid_results, 3152 const ZoneGrowableArray<intptr_t>& cid_results,
3121 intptr_t deopt_id); 3153 intptr_t deopt_id);
3122 3154
3123 const ZoneGrowableArray<intptr_t>& cid_results() const { 3155 const ZoneGrowableArray<intptr_t>& cid_results() const {
3124 return cid_results_; 3156 return cid_results_;
3125 } 3157 }
3126 3158
3127 DECLARE_INSTRUCTION(TestCids); 3159 DECLARE_COMPARISON_INSTRUCTION(TestCids);
3128 3160
3129 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); 3161 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right);
3130 3162
3131 virtual CompileType ComputeType() const; 3163 virtual CompileType ComputeType() const;
3132 3164
3133 virtual Definition* Canonicalize(FlowGraph* flow_graph); 3165 virtual Definition* Canonicalize(FlowGraph* flow_graph);
3134 3166
3135 virtual bool ComputeCanDeoptimize() const { 3167 virtual bool ComputeCanDeoptimize() const {
3136 return GetDeoptId() != Thread::kNoDeoptId; 3168 return GetDeoptId() != Thread::kNoDeoptId;
3137 } 3169 }
3138 3170
3139 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 3171 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
3140 return kTagged; 3172 return kTagged;
3141 } 3173 }
3142 3174
3143 virtual bool AttributesEqual(Instruction* other) const; 3175 virtual bool AttributesEqual(Instruction* other) const;
3144 3176
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; } 3177 void set_licm_hoisted(bool value) { licm_hoisted_ = value; }
3151 3178
3152 PRINT_OPERANDS_TO_SUPPORT 3179 PRINT_OPERANDS_TO_SUPPORT
3153 3180
3154 private: 3181 private:
3155 const ZoneGrowableArray<intptr_t>& cid_results_; 3182 const ZoneGrowableArray<intptr_t>& cid_results_;
3156 bool licm_hoisted_; 3183 bool licm_hoisted_;
3157 DISALLOW_COPY_AND_ASSIGN(TestCidsInstr); 3184 DISALLOW_COPY_AND_ASSIGN(TestCidsInstr);
3158 }; 3185 };
3159 3186
3160 3187
3161 class EqualityCompareInstr : public TemplateComparison<2, NoThrow, Pure> { 3188 class EqualityCompareInstr : public TemplateComparison<2, NoThrow, Pure> {
3162 public: 3189 public:
3163 EqualityCompareInstr(TokenPosition token_pos, 3190 EqualityCompareInstr(TokenPosition token_pos,
3164 Token::Kind kind, 3191 Token::Kind kind,
3165 Value* left, 3192 Value* left,
3166 Value* right, 3193 Value* right,
3167 intptr_t cid, 3194 intptr_t cid,
3168 intptr_t deopt_id) 3195 intptr_t deopt_id)
3169 : TemplateComparison(token_pos, kind, deopt_id) { 3196 : TemplateComparison(token_pos, kind, deopt_id) {
3170 ASSERT(Token::IsEqualityOperator(kind)); 3197 ASSERT(Token::IsEqualityOperator(kind));
3171 SetInputAt(0, left); 3198 SetInputAt(0, left);
3172 SetInputAt(1, right); 3199 SetInputAt(1, right);
3173 set_operation_cid(cid); 3200 set_operation_cid(cid);
3174 } 3201 }
3175 3202
3176 DECLARE_INSTRUCTION(EqualityCompare) 3203 DECLARE_COMPARISON_INSTRUCTION(EqualityCompare)
3177 3204
3178 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); 3205 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right);
3179 3206
3180 virtual CompileType ComputeType() const; 3207 virtual CompileType ComputeType() const;
3181 3208
3182 virtual bool ComputeCanDeoptimize() const { return false; } 3209 virtual bool ComputeCanDeoptimize() const { return false; }
3183 3210
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 { 3211 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
3190 ASSERT((idx == 0) || (idx == 1)); 3212 ASSERT((idx == 0) || (idx == 1));
3191 if (operation_cid() == kDoubleCid) return kUnboxedDouble; 3213 if (operation_cid() == kDoubleCid) return kUnboxedDouble;
3192 if (operation_cid() == kMintCid) return kUnboxedMint; 3214 if (operation_cid() == kMintCid) return kUnboxedMint;
3193 return kTagged; 3215 return kTagged;
3194 } 3216 }
3195 3217
3196 PRINT_OPERANDS_TO_SUPPORT 3218 PRINT_OPERANDS_TO_SUPPORT
3197 3219
3198 private: 3220 private:
3199 DISALLOW_COPY_AND_ASSIGN(EqualityCompareInstr); 3221 DISALLOW_COPY_AND_ASSIGN(EqualityCompareInstr);
3200 }; 3222 };
3201 3223
3202 3224
3203 class RelationalOpInstr : public TemplateComparison<2, NoThrow, Pure> { 3225 class RelationalOpInstr : public TemplateComparison<2, NoThrow, Pure> {
3204 public: 3226 public:
3205 RelationalOpInstr(TokenPosition token_pos, 3227 RelationalOpInstr(TokenPosition token_pos,
3206 Token::Kind kind, 3228 Token::Kind kind,
3207 Value* left, 3229 Value* left,
3208 Value* right, 3230 Value* right,
3209 intptr_t cid, 3231 intptr_t cid,
3210 intptr_t deopt_id) 3232 intptr_t deopt_id)
3211 : TemplateComparison(token_pos, kind, deopt_id) { 3233 : TemplateComparison(token_pos, kind, deopt_id) {
3212 ASSERT(Token::IsRelationalOperator(kind)); 3234 ASSERT(Token::IsRelationalOperator(kind));
3213 SetInputAt(0, left); 3235 SetInputAt(0, left);
3214 SetInputAt(1, right); 3236 SetInputAt(1, right);
3215 set_operation_cid(cid); 3237 set_operation_cid(cid);
3216 } 3238 }
3217 3239
3218 DECLARE_INSTRUCTION(RelationalOp) 3240 DECLARE_COMPARISON_INSTRUCTION(RelationalOp)
3219 3241
3220 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); 3242 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right);
3221 3243
3222 virtual CompileType ComputeType() const; 3244 virtual CompileType ComputeType() const;
3223 3245
3224 virtual bool ComputeCanDeoptimize() const { return false; } 3246 virtual bool ComputeCanDeoptimize() const { return false; }
3225 3247
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 { 3248 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
3232 ASSERT((idx == 0) || (idx == 1)); 3249 ASSERT((idx == 0) || (idx == 1));
3233 if (operation_cid() == kDoubleCid) return kUnboxedDouble; 3250 if (operation_cid() == kDoubleCid) return kUnboxedDouble;
3234 if (operation_cid() == kMintCid) return kUnboxedMint; 3251 if (operation_cid() == kMintCid) return kUnboxedMint;
3235 return kTagged; 3252 return kTagged;
3236 } 3253 }
3237 3254
3238 PRINT_OPERANDS_TO_SUPPORT 3255 PRINT_OPERANDS_TO_SUPPORT
3239 3256
3240 private: 3257 private:
(...skipping 2100 matching lines...) Expand 10 before | Expand all | Expand 10 after
5341 5358
5342 virtual bool ComputeCanDeoptimize() const { return false; } 5359 virtual bool ComputeCanDeoptimize() const { return false; }
5343 5360
5344 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 5361 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
5345 ASSERT(idx == 0); 5362 ASSERT(idx == 0);
5346 return kUnboxedDouble; 5363 return kUnboxedDouble;
5347 } 5364 }
5348 5365
5349 PRINT_OPERANDS_TO_SUPPORT 5366 PRINT_OPERANDS_TO_SUPPORT
5350 5367
5351 DECLARE_INSTRUCTION(DoubleTestOp) 5368 DECLARE_COMPARISON_INSTRUCTION(DoubleTestOp)
5369
5352 virtual CompileType ComputeType() const; 5370 virtual CompileType ComputeType() const;
5353 5371
5354 virtual Definition* Canonicalize(FlowGraph* flow_graph); 5372 virtual Definition* Canonicalize(FlowGraph* flow_graph);
5355 5373
5356 virtual bool AttributesEqual(Instruction* other) const { 5374 virtual bool AttributesEqual(Instruction* other) const {
5357 return op_kind_ == other->AsDoubleTestOp()->op_kind() && 5375 return op_kind_ == other->AsDoubleTestOp()->op_kind() &&
5358 ComparisonInstr::AttributesEqual(other); 5376 ComparisonInstr::AttributesEqual(other);
5359 } 5377 }
5360 5378
5361 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); 5379 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right);
5362 5380
5363 virtual void EmitBranchCode(FlowGraphCompiler* compiler, BranchInstr* branch);
5364
5365 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler,
5366 BranchLabels labels);
5367
5368 private: 5381 private:
5369 const MethodRecognizer::Kind op_kind_; 5382 const MethodRecognizer::Kind op_kind_;
5370 5383
5371 DISALLOW_COPY_AND_ASSIGN(DoubleTestOpInstr); 5384 DISALLOW_COPY_AND_ASSIGN(DoubleTestOpInstr);
5372 }; 5385 };
5373 5386
5374 5387
5375 class BinaryFloat32x4OpInstr : public TemplateDefinition<2, NoThrow, Pure> { 5388 class BinaryFloat32x4OpInstr : public TemplateDefinition<2, NoThrow, Pure> {
5376 public: 5389 public:
5377 BinaryFloat32x4OpInstr(Token::Kind op_kind, 5390 BinaryFloat32x4OpInstr(Token::Kind op_kind,
(...skipping 1549 matching lines...) Expand 10 before | Expand all | Expand 10 after
6927 6940
6928 PRINT_OPERANDS_TO_SUPPORT 6941 PRINT_OPERANDS_TO_SUPPORT
6929 6942
6930 DECLARE_INSTRUCTION(CheckedSmiComparison) 6943 DECLARE_INSTRUCTION(CheckedSmiComparison)
6931 6944
6932 virtual void EmitBranchCode(FlowGraphCompiler* compiler, BranchInstr* branch); 6945 virtual void EmitBranchCode(FlowGraphCompiler* compiler, BranchInstr* branch);
6933 6946
6934 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler, 6947 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler,
6935 BranchLabels labels); 6948 BranchLabels labels);
6936 6949
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
6937 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); 6958 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right);
6938 6959
6939 private: 6960 private:
6940 InstanceCallInstr* call_; 6961 InstanceCallInstr* call_;
6941 bool is_negated_; 6962 bool is_negated_;
6942 DISALLOW_COPY_AND_ASSIGN(CheckedSmiComparisonInstr); 6963 DISALLOW_COPY_AND_ASSIGN(CheckedSmiComparisonInstr);
6943 }; 6964 };
6944 6965
6945 6966
6946 class BinaryIntegerOpInstr : public TemplateDefinition<2, NoThrow, Pure> { 6967 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 { \ 8256 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \
8236 UNIMPLEMENTED(); \ 8257 UNIMPLEMENTED(); \
8237 return NULL; \ 8258 return NULL; \
8238 } \ 8259 } \
8239 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } 8260 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); }
8240 8261
8241 8262
8242 } // namespace dart 8263 } // namespace dart
8243 8264
8244 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ 8265 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/disassembler_arm64.cc ('k') | runtime/vm/intermediate_language_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698