| 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_AOT_OPTIMIZER_H_ | 5 #ifndef VM_AOT_OPTIMIZER_H_ |
| 6 #define VM_AOT_OPTIMIZER_H_ | 6 #define VM_AOT_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 |
| 11 namespace dart { | 11 namespace dart { |
| 12 | 12 |
| 13 class CSEInstructionMap; | 13 class CSEInstructionMap; |
| 14 template <typename T> class GrowableArray; | 14 template <typename T> class GrowableArray; |
| 15 class ParsedFunction; | 15 class ParsedFunction; |
| 16 class Precompiler; |
| 16 class RawBool; | 17 class RawBool; |
| 17 | 18 |
| 18 class AotOptimizer : public FlowGraphVisitor { | 19 class AotOptimizer : public FlowGraphVisitor { |
| 19 public: | 20 public: |
| 20 AotOptimizer(FlowGraph* flow_graph, | 21 AotOptimizer(Precompiler* precompiler, |
| 22 FlowGraph* flow_graph, |
| 21 bool use_speculative_inlining, | 23 bool use_speculative_inlining, |
| 22 GrowableArray<intptr_t>* inlining_black_list); | 24 GrowableArray<intptr_t>* inlining_black_list); |
| 25 |
| 23 virtual ~AotOptimizer() {} | 26 virtual ~AotOptimizer() {} |
| 24 | 27 |
| 25 FlowGraph* flow_graph() const { return flow_graph_; } | 28 FlowGraph* flow_graph() const { return flow_graph_; } |
| 26 | 29 |
| 27 // Add ICData to InstanceCalls, so that optimizations can be run on them. | 30 // Add ICData to InstanceCalls, so that optimizations can be run on them. |
| 28 // TODO(srdjan): StaticCals as well? | 31 // TODO(srdjan): StaticCals as well? |
| 29 void PopulateWithICData(); | 32 void PopulateWithICData(); |
| 30 | 33 |
| 31 // Use ICData to optimize, replace or eliminate instructions. | 34 // Use ICData to optimize, replace or eliminate instructions. |
| 32 void ApplyICData(); | 35 void ApplyICData(); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 Environment* deopt_environment, | 97 Environment* deopt_environment, |
| 95 Instruction* insert_before); | 98 Instruction* insert_before); |
| 96 | 99 |
| 97 // Add a class check for a call's first argument immediately before the | 100 // Add a class check for a call's first argument immediately before the |
| 98 // call, using the call's IC data to determine the check, and the call's | 101 // call, using the call's IC data to determine the check, and the call's |
| 99 // deopt ID and deoptimization environment if the check fails. | 102 // deopt ID and deoptimization environment if the check fails. |
| 100 void AddReceiverCheck(InstanceCallInstr* call); | 103 void AddReceiverCheck(InstanceCallInstr* call); |
| 101 | 104 |
| 102 void ReplaceCall(Definition* call, Definition* replacement); | 105 void ReplaceCall(Definition* call, Definition* replacement); |
| 103 | 106 |
| 107 bool RecognizeRuntimeTypeGetter(InstanceCallInstr* call); |
| 108 bool TryReplaceWithHaveSameRuntimeType(InstanceCallInstr* call); |
| 109 |
| 104 bool InstanceCallNeedsClassCheck(InstanceCallInstr* call, | 110 bool InstanceCallNeedsClassCheck(InstanceCallInstr* call, |
| 105 RawFunction::Kind kind) const; | 111 RawFunction::Kind kind) const; |
| 106 | 112 |
| 107 bool InlineFloat32x4BinaryOp(InstanceCallInstr* call, | 113 bool InlineFloat32x4BinaryOp(InstanceCallInstr* call, |
| 108 Token::Kind op_kind); | 114 Token::Kind op_kind); |
| 109 bool InlineInt32x4BinaryOp(InstanceCallInstr* call, | 115 bool InlineInt32x4BinaryOp(InstanceCallInstr* call, |
| 110 Token::Kind op_kind); | 116 Token::Kind op_kind); |
| 111 bool InlineFloat64x2BinaryOp(InstanceCallInstr* call, | 117 bool InlineFloat64x2BinaryOp(InstanceCallInstr* call, |
| 112 Token::Kind op_kind); | 118 Token::Kind op_kind); |
| 113 bool InlineImplicitInstanceGetter(InstanceCallInstr* call); | 119 bool InlineImplicitInstanceGetter(InstanceCallInstr* call); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 124 RawField* GetField(intptr_t class_id, const String& field_name); | 130 RawField* GetField(intptr_t class_id, const String& field_name); |
| 125 | 131 |
| 126 Thread* thread() const { return flow_graph_->thread(); } | 132 Thread* thread() const { return flow_graph_->thread(); } |
| 127 Isolate* isolate() const { return flow_graph_->isolate(); } | 133 Isolate* isolate() const { return flow_graph_->isolate(); } |
| 128 Zone* zone() const { return flow_graph_->zone(); } | 134 Zone* zone() const { return flow_graph_->zone(); } |
| 129 | 135 |
| 130 const Function& function() const { return flow_graph_->function(); } | 136 const Function& function() const { return flow_graph_->function(); } |
| 131 | 137 |
| 132 bool IsAllowedForInlining(intptr_t deopt_id); | 138 bool IsAllowedForInlining(intptr_t deopt_id); |
| 133 | 139 |
| 140 Precompiler* precompiler_; |
| 134 FlowGraph* flow_graph_; | 141 FlowGraph* flow_graph_; |
| 135 | 142 |
| 136 const bool use_speculative_inlining_; | 143 const bool use_speculative_inlining_; |
| 137 | 144 |
| 138 GrowableArray<intptr_t>* inlining_black_list_; | 145 GrowableArray<intptr_t>* inlining_black_list_; |
| 139 | 146 |
| 140 bool has_unique_no_such_method_; | 147 bool has_unique_no_such_method_; |
| 141 | 148 |
| 142 DISALLOW_COPY_AND_ASSIGN(AotOptimizer); | 149 DISALLOW_COPY_AND_ASSIGN(AotOptimizer); |
| 143 }; | 150 }; |
| 144 | 151 |
| 145 | 152 |
| 146 } // namespace dart | 153 } // namespace dart |
| 147 | 154 |
| 148 #endif // VM_AOT_OPTIMIZER_H_ | 155 #endif // VM_AOT_OPTIMIZER_H_ |
| OLD | NEW |