| 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 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 M(Float32x4With) \ | 761 M(Float32x4With) \ |
| 762 M(Float32x4ToInt32x4) \ | 762 M(Float32x4ToInt32x4) \ |
| 763 M(MaterializeObject) \ | 763 M(MaterializeObject) \ |
| 764 M(Int32x4BoolConstructor) \ | 764 M(Int32x4BoolConstructor) \ |
| 765 M(Int32x4GetFlag) \ | 765 M(Int32x4GetFlag) \ |
| 766 M(Int32x4Select) \ | 766 M(Int32x4Select) \ |
| 767 M(Int32x4SetFlag) \ | 767 M(Int32x4SetFlag) \ |
| 768 M(Int32x4ToFloat32x4) \ | 768 M(Int32x4ToFloat32x4) \ |
| 769 M(BinaryInt32x4Op) \ | 769 M(BinaryInt32x4Op) \ |
| 770 M(TestSmi) \ | 770 M(TestSmi) \ |
| 771 M(TestCids) \ |
| 771 M(BoxFloat64x2) \ | 772 M(BoxFloat64x2) \ |
| 772 M(UnboxFloat64x2) \ | 773 M(UnboxFloat64x2) \ |
| 773 M(BinaryFloat64x2Op) \ | 774 M(BinaryFloat64x2Op) \ |
| 774 M(Float64x2Zero) \ | 775 M(Float64x2Zero) \ |
| 775 M(Float64x2Constructor) \ | 776 M(Float64x2Constructor) \ |
| 776 M(Float64x2Splat) \ | 777 M(Float64x2Splat) \ |
| 777 M(Float32x4ToFloat64x2) \ | 778 M(Float32x4ToFloat64x2) \ |
| 778 M(Float64x2ToFloat32x4) \ | 779 M(Float64x2ToFloat32x4) \ |
| 779 M(Simd64x2Shuffle) \ | 780 M(Simd64x2Shuffle) \ |
| 780 M(Float64x2ZeroArg) \ | 781 M(Float64x2ZeroArg) \ |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1108 friend class TargetEntryInstr; | 1109 friend class TargetEntryInstr; |
| 1109 friend class JoinEntryInstr; | 1110 friend class JoinEntryInstr; |
| 1110 friend class InstanceOfInstr; | 1111 friend class InstanceOfInstr; |
| 1111 friend class PolymorphicInstanceCallInstr; | 1112 friend class PolymorphicInstanceCallInstr; |
| 1112 friend class SmiToDoubleInstr; | 1113 friend class SmiToDoubleInstr; |
| 1113 friend class DoubleToIntegerInstr; | 1114 friend class DoubleToIntegerInstr; |
| 1114 friend class BranchSimplifier; | 1115 friend class BranchSimplifier; |
| 1115 friend class BlockEntryInstr; | 1116 friend class BlockEntryInstr; |
| 1116 friend class RelationalOpInstr; | 1117 friend class RelationalOpInstr; |
| 1117 friend class EqualityCompareInstr; | 1118 friend class EqualityCompareInstr; |
| 1119 friend class TestCidsInstr; |
| 1118 | 1120 |
| 1119 virtual void RawSetInputAt(intptr_t i, Value* value) = 0; | 1121 virtual void RawSetInputAt(intptr_t i, Value* value) = 0; |
| 1120 | 1122 |
| 1121 enum { | 1123 enum { |
| 1122 kNoPlaceId = -1 | 1124 kNoPlaceId = -1 |
| 1123 }; | 1125 }; |
| 1124 | 1126 |
| 1125 intptr_t deopt_id_; | 1127 intptr_t deopt_id_; |
| 1126 intptr_t lifetime_position_; // Position used by register allocator. | 1128 intptr_t lifetime_position_; // Position used by register allocator. |
| 1127 Instruction* previous_; | 1129 Instruction* previous_; |
| (...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2302 kind_ = Token::NegateComparison(kind_); | 2304 kind_ = Token::NegateComparison(kind_); |
| 2303 } | 2305 } |
| 2304 | 2306 |
| 2305 protected: | 2307 protected: |
| 2306 ComparisonInstr(intptr_t token_pos, | 2308 ComparisonInstr(intptr_t token_pos, |
| 2307 Token::Kind kind, | 2309 Token::Kind kind, |
| 2308 Value* left, | 2310 Value* left, |
| 2309 Value* right) | 2311 Value* right) |
| 2310 : token_pos_(token_pos), kind_(kind), operation_cid_(kIllegalCid) { | 2312 : token_pos_(token_pos), kind_(kind), operation_cid_(kIllegalCid) { |
| 2311 SetInputAt(0, left); | 2313 SetInputAt(0, left); |
| 2312 SetInputAt(1, right); | 2314 if (right != NULL) { |
| 2315 SetInputAt(1, right); |
| 2316 } |
| 2313 } | 2317 } |
| 2314 | 2318 |
| 2315 private: | 2319 private: |
| 2316 const intptr_t token_pos_; | 2320 const intptr_t token_pos_; |
| 2317 Token::Kind kind_; | 2321 Token::Kind kind_; |
| 2318 intptr_t operation_cid_; // Set by optimizer. | 2322 intptr_t operation_cid_; // Set by optimizer. |
| 2319 | 2323 |
| 2320 DISALLOW_COPY_AND_ASSIGN(ComparisonInstr); | 2324 DISALLOW_COPY_AND_ASSIGN(ComparisonInstr); |
| 2321 }; | 2325 }; |
| 2322 | 2326 |
| (...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3093 BranchInstr* branch); | 3097 BranchInstr* branch); |
| 3094 | 3098 |
| 3095 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler, | 3099 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler, |
| 3096 BranchLabels labels); | 3100 BranchLabels labels); |
| 3097 | 3101 |
| 3098 private: | 3102 private: |
| 3099 DISALLOW_COPY_AND_ASSIGN(TestSmiInstr); | 3103 DISALLOW_COPY_AND_ASSIGN(TestSmiInstr); |
| 3100 }; | 3104 }; |
| 3101 | 3105 |
| 3102 | 3106 |
| 3107 // Checks the input value cid against cids stored in a table and returns either |
| 3108 // a result or deoptimizes. |
| 3109 // TODO(srdjan): Modify ComparisonInstr to allow 1 or 2 arguments, since |
| 3110 // TestCidInstr needs only one argument |
| 3111 class TestCidsInstr : public ComparisonInstr { |
| 3112 public: |
| 3113 TestCidsInstr(intptr_t token_pos, |
| 3114 Token::Kind kind, |
| 3115 Value* value, |
| 3116 const ZoneGrowableArray<intptr_t>& cid_results, |
| 3117 intptr_t deopt_id) |
| 3118 : ComparisonInstr(token_pos, kind, value, NULL), |
| 3119 cid_results_(cid_results) { |
| 3120 ASSERT((kind == Token::kIS) || (kind == Token::kISNOT)); |
| 3121 set_operation_cid(kObjectCid); |
| 3122 deopt_id_ = deopt_id; |
| 3123 } |
| 3124 |
| 3125 virtual intptr_t InputCount() const { return 1; } |
| 3126 |
| 3127 const ZoneGrowableArray<intptr_t>& cid_results() const { |
| 3128 return cid_results_; |
| 3129 } |
| 3130 |
| 3131 DECLARE_INSTRUCTION(TestCids); |
| 3132 |
| 3133 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); |
| 3134 |
| 3135 virtual CompileType ComputeType() const; |
| 3136 |
| 3137 virtual bool CanDeoptimize() const { |
| 3138 return deopt_id_ != Isolate::kNoDeoptId; |
| 3139 } |
| 3140 |
| 3141 virtual bool CanBecomeDeoptimizationTarget() const { |
| 3142 // TestCid can be merged into Branch and thus needs an environment. |
| 3143 return true; |
| 3144 } |
| 3145 |
| 3146 virtual intptr_t DeoptimizationTarget() const { |
| 3147 return GetDeoptId(); |
| 3148 } |
| 3149 |
| 3150 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 3151 return kTagged; |
| 3152 } |
| 3153 |
| 3154 virtual EffectSet Effects() const { return EffectSet::None(); } |
| 3155 virtual bool AllowsCSE() const { return true; } |
| 3156 virtual EffectSet Dependencies() const { return EffectSet::None(); } |
| 3157 |
| 3158 virtual bool MayThrow() const { return false; } |
| 3159 |
| 3160 virtual bool AttributesEqual(Instruction* other) const; |
| 3161 |
| 3162 virtual void EmitBranchCode(FlowGraphCompiler* compiler, |
| 3163 BranchInstr* branch); |
| 3164 |
| 3165 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler, |
| 3166 BranchLabels labels); |
| 3167 |
| 3168 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 3169 |
| 3170 private: |
| 3171 const ZoneGrowableArray<intptr_t>& cid_results_; |
| 3172 DISALLOW_COPY_AND_ASSIGN(TestCidsInstr); |
| 3173 }; |
| 3174 |
| 3175 |
| 3103 class EqualityCompareInstr : public ComparisonInstr { | 3176 class EqualityCompareInstr : public ComparisonInstr { |
| 3104 public: | 3177 public: |
| 3105 EqualityCompareInstr(intptr_t token_pos, | 3178 EqualityCompareInstr(intptr_t token_pos, |
| 3106 Token::Kind kind, | 3179 Token::Kind kind, |
| 3107 Value* left, | 3180 Value* left, |
| 3108 Value* right, | 3181 Value* right, |
| 3109 intptr_t cid, | 3182 intptr_t cid, |
| 3110 intptr_t deopt_id) | 3183 intptr_t deopt_id) |
| 3111 : ComparisonInstr(token_pos, kind, left, right) { | 3184 : ComparisonInstr(token_pos, kind, left, right) { |
| 3112 ASSERT(Token::IsEqualityOperator(kind)); | 3185 ASSERT(Token::IsEqualityOperator(kind)); |
| (...skipping 4669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7782 ForwardInstructionIterator* current_iterator_; | 7855 ForwardInstructionIterator* current_iterator_; |
| 7783 | 7856 |
| 7784 private: | 7857 private: |
| 7785 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 7858 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 7786 }; | 7859 }; |
| 7787 | 7860 |
| 7788 | 7861 |
| 7789 } // namespace dart | 7862 } // namespace dart |
| 7790 | 7863 |
| 7791 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 7864 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |