| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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_FLOW_GRAPH_OPTIMIZER_H_ | 5 #ifndef VM_FLOW_GRAPH_OPTIMIZER_H_ |
| 6 #define VM_FLOW_GRAPH_OPTIMIZER_H_ | 6 #define VM_FLOW_GRAPH_OPTIMIZER_H_ |
| 7 | 7 |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 #include "vm/flow_graph.h" | 9 #include "vm/flow_graph.h" |
| 10 | 10 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 void InferSmiRanges(); | 45 void InferSmiRanges(); |
| 46 | 46 |
| 47 void AnalyzeTryCatch(); | 47 void AnalyzeTryCatch(); |
| 48 | 48 |
| 49 // Remove environments from the instructions which do not deoptimize. | 49 // Remove environments from the instructions which do not deoptimize. |
| 50 void EliminateEnvironments(); | 50 void EliminateEnvironments(); |
| 51 | 51 |
| 52 virtual void VisitStaticCall(StaticCallInstr* instr); | 52 virtual void VisitStaticCall(StaticCallInstr* instr); |
| 53 virtual void VisitInstanceCall(InstanceCallInstr* instr); | 53 virtual void VisitInstanceCall(InstanceCallInstr* instr); |
| 54 virtual void VisitRelationalOp(RelationalOpInstr* instr); | |
| 55 virtual void VisitEqualityCompare(EqualityCompareInstr* instr); | 54 virtual void VisitEqualityCompare(EqualityCompareInstr* instr); |
| 56 virtual void VisitBranch(BranchInstr* instr); | 55 virtual void VisitBranch(BranchInstr* instr); |
| 57 virtual void VisitStrictCompare(StrictCompareInstr* instr); | 56 virtual void VisitStrictCompare(StrictCompareInstr* instr); |
| 58 | 57 |
| 59 void InsertBefore(Instruction* next, | 58 void InsertBefore(Instruction* next, |
| 60 Instruction* instr, | 59 Instruction* instr, |
| 61 Environment* env, | 60 Environment* env, |
| 62 Definition::UseKind use_kind) { | 61 Definition::UseKind use_kind) { |
| 63 flow_graph_->InsertBefore(next, instr, env, use_kind); | 62 flow_graph_->InsertBefore(next, instr, env, use_kind); |
| 64 } | 63 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 75 Definition** index); | 74 Definition** index); |
| 76 bool TryReplaceWithStoreIndexed(InstanceCallInstr* call); | 75 bool TryReplaceWithStoreIndexed(InstanceCallInstr* call); |
| 77 void BuildStoreIndexed(InstanceCallInstr* call, | 76 void BuildStoreIndexed(InstanceCallInstr* call, |
| 78 const ICData& value_check, | 77 const ICData& value_check, |
| 79 intptr_t class_id); | 78 intptr_t class_id); |
| 80 bool TryReplaceWithLoadIndexed(InstanceCallInstr* call); | 79 bool TryReplaceWithLoadIndexed(InstanceCallInstr* call); |
| 81 | 80 |
| 82 bool TryReplaceWithBinaryOp(InstanceCallInstr* call, Token::Kind op_kind); | 81 bool TryReplaceWithBinaryOp(InstanceCallInstr* call, Token::Kind op_kind); |
| 83 bool TryReplaceWithUnaryOp(InstanceCallInstr* call, Token::Kind op_kind); | 82 bool TryReplaceWithUnaryOp(InstanceCallInstr* call, Token::Kind op_kind); |
| 84 | 83 |
| 84 bool TryReplaceWithRelationalOp(InstanceCallInstr* call, Token::Kind op_kind); |
| 85 |
| 85 bool TryInlineInstanceGetter(InstanceCallInstr* call); | 86 bool TryInlineInstanceGetter(InstanceCallInstr* call); |
| 86 bool TryInlineInstanceSetter(InstanceCallInstr* call, | 87 bool TryInlineInstanceSetter(InstanceCallInstr* call, |
| 87 const ICData& unary_ic_data); | 88 const ICData& unary_ic_data); |
| 88 | 89 |
| 89 bool TryInlineInstanceMethod(InstanceCallInstr* call); | 90 bool TryInlineInstanceMethod(InstanceCallInstr* call); |
| 90 bool TryInlineFloat32x4Constructor(StaticCallInstr* call, | 91 bool TryInlineFloat32x4Constructor(StaticCallInstr* call, |
| 91 MethodRecognizer::Kind recognized_kind); | 92 MethodRecognizer::Kind recognized_kind); |
| 92 bool TryInlineUint32x4Constructor(StaticCallInstr* call, | 93 bool TryInlineUint32x4Constructor(StaticCallInstr* call, |
| 93 MethodRecognizer::Kind recognized_kind); | 94 MethodRecognizer::Kind recognized_kind); |
| 94 bool TryInlineFloat32x4Method(InstanceCallInstr* call, | 95 bool TryInlineFloat32x4Method(InstanceCallInstr* call, |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 bool InlineUint32x4BinaryOp(InstanceCallInstr* call, | 157 bool InlineUint32x4BinaryOp(InstanceCallInstr* call, |
| 157 Token::Kind op_kind); | 158 Token::Kind op_kind); |
| 158 void InlineImplicitInstanceGetter(InstanceCallInstr* call); | 159 void InlineImplicitInstanceGetter(InstanceCallInstr* call); |
| 159 | 160 |
| 160 RawBool* InstanceOfAsBool(const ICData& ic_data, | 161 RawBool* InstanceOfAsBool(const ICData& ic_data, |
| 161 const AbstractType& type) const; | 162 const AbstractType& type) const; |
| 162 | 163 |
| 163 void ReplaceWithMathCFunction(InstanceCallInstr* call, | 164 void ReplaceWithMathCFunction(InstanceCallInstr* call, |
| 164 MethodRecognizer::Kind recognized_kind); | 165 MethodRecognizer::Kind recognized_kind); |
| 165 | 166 |
| 166 void HandleComparison(ComparisonInstr* comp, | |
| 167 const ICData& ic_data, | |
| 168 Instruction* current_instruction); | |
| 169 | |
| 170 void HandleRelationalOp(RelationalOpInstr* comp); | |
| 171 | |
| 172 // Visit an equality compare. The current instruction can be the | 167 // Visit an equality compare. The current instruction can be the |
| 173 // comparison itself or a branch on the comparison. | 168 // comparison itself or a branch on the comparison. |
| 174 template <typename T> | 169 template <typename T> |
| 175 void HandleEqualityCompare(EqualityCompareInstr* comp, | 170 void HandleEqualityCompare(EqualityCompareInstr* comp, |
| 176 T current_instruction); | 171 T current_instruction); |
| 177 | 172 |
| 178 static bool CanStrictifyEqualityCompare(EqualityCompareInstr* call); | 173 static bool CanStrictifyEqualityCompare(EqualityCompareInstr* call); |
| 179 | 174 |
| 180 template <typename T> | 175 template <typename T> |
| 181 bool StrictifyEqualityCompare(EqualityCompareInstr* compare, | 176 bool StrictifyEqualityCompare(EqualityCompareInstr* compare, |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 // Optimize spill stores inside try-blocks by identifying values that always | 365 // Optimize spill stores inside try-blocks by identifying values that always |
| 371 // contain a single known constant at catch block entry. | 366 // contain a single known constant at catch block entry. |
| 372 class TryCatchAnalyzer : public AllStatic { | 367 class TryCatchAnalyzer : public AllStatic { |
| 373 public: | 368 public: |
| 374 static void Optimize(FlowGraph* flow_graph); | 369 static void Optimize(FlowGraph* flow_graph); |
| 375 }; | 370 }; |
| 376 | 371 |
| 377 } // namespace dart | 372 } // namespace dart |
| 378 | 373 |
| 379 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ | 374 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ |
| OLD | NEW |