Chromium Code Reviews| 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_COMPILER_H_ | 5 #ifndef VM_FLOW_GRAPH_COMPILER_H_ |
| 6 #define VM_FLOW_GRAPH_COMPILER_H_ | 6 #define VM_FLOW_GRAPH_COMPILER_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 10 #include "vm/code_descriptors.h" | 10 #include "vm/code_descriptors.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 | 100 |
| 101 // List of moves not yet resolved. | 101 // List of moves not yet resolved. |
| 102 GrowableArray<MoveOperands*> moves_; | 102 GrowableArray<MoveOperands*> moves_; |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 | 105 |
| 106 // Used for describing a deoptimization point after call (lazy deoptimization). | 106 // Used for describing a deoptimization point after call (lazy deoptimization). |
| 107 // For deoptimization before instruction use class CompilerDeoptInfoWithStub. | 107 // For deoptimization before instruction use class CompilerDeoptInfoWithStub. |
| 108 class CompilerDeoptInfo : public ZoneAllocated { | 108 class CompilerDeoptInfo : public ZoneAllocated { |
| 109 public: | 109 public: |
| 110 CompilerDeoptInfo(intptr_t deopt_id, DeoptReasonId reason) | 110 CompilerDeoptInfo(intptr_t deopt_id, |
| 111 DeoptReasonId reason, | |
| 112 Environment* deopt_env) | |
| 111 : pc_offset_(-1), | 113 : pc_offset_(-1), |
| 112 deopt_id_(deopt_id), | 114 deopt_id_(deopt_id), |
| 113 reason_(reason), | 115 reason_(reason), |
| 114 deoptimization_env_(NULL) {} | 116 deopt_env_(deopt_env) { |
| 117 ASSERT(deopt_env != NULL); | |
| 118 } | |
| 115 | 119 |
| 116 RawDeoptInfo* CreateDeoptInfo(FlowGraphCompiler* compiler, | 120 RawDeoptInfo* CreateDeoptInfo(FlowGraphCompiler* compiler, |
| 117 DeoptInfoBuilder* builder); | 121 DeoptInfoBuilder* builder); |
| 118 | 122 |
| 119 | 123 |
| 120 // No code needs to be generated. | 124 // No code needs to be generated. |
| 121 virtual void GenerateCode(FlowGraphCompiler* compiler, intptr_t stub_ix) {} | 125 virtual void GenerateCode(FlowGraphCompiler* compiler, intptr_t stub_ix) {} |
| 122 | 126 |
| 123 intptr_t pc_offset() const { return pc_offset_; } | 127 intptr_t pc_offset() const { return pc_offset_; } |
| 124 void set_pc_offset(intptr_t offset) { pc_offset_ = offset; } | 128 void set_pc_offset(intptr_t offset) { pc_offset_ = offset; } |
| 125 | 129 |
| 126 intptr_t deopt_id() const { return deopt_id_; } | 130 intptr_t deopt_id() const { return deopt_id_; } |
| 127 | |
| 128 DeoptReasonId reason() const { return reason_; } | 131 DeoptReasonId reason() const { return reason_; } |
| 129 | 132 const Environment* deopt_env() const { return deopt_env_; } |
| 130 const Environment* deoptimization_env() const { return deoptimization_env_; } | |
| 131 void set_deoptimization_env(Environment* env) { deoptimization_env_ = env; } | |
| 132 | 133 |
| 133 private: | 134 private: |
| 134 void EmitMaterializations(Environment* env, DeoptInfoBuilder* builder); | 135 void EmitMaterializations(Environment* env, DeoptInfoBuilder* builder); |
| 135 | 136 |
| 136 void AllocateIncomingParametersRecursive(Environment* env, | 137 void AllocateIncomingParametersRecursive(Environment* env, |
| 137 intptr_t* stack_height); | 138 intptr_t* stack_height); |
| 138 | 139 |
| 139 intptr_t pc_offset_; | 140 intptr_t pc_offset_; |
| 140 const intptr_t deopt_id_; | 141 const intptr_t deopt_id_; |
| 141 const DeoptReasonId reason_; | 142 const DeoptReasonId reason_; |
| 142 Environment* deoptimization_env_; | 143 Environment* deopt_env_; |
|
Florian Schneider
2013/05/21 13:47:11
Can you make this const as well?
| |
| 143 | 144 |
| 144 DISALLOW_COPY_AND_ASSIGN(CompilerDeoptInfo); | 145 DISALLOW_COPY_AND_ASSIGN(CompilerDeoptInfo); |
| 145 }; | 146 }; |
| 146 | 147 |
| 147 | 148 |
| 148 class CompilerDeoptInfoWithStub : public CompilerDeoptInfo { | 149 class CompilerDeoptInfoWithStub : public CompilerDeoptInfo { |
| 149 public: | 150 public: |
| 150 CompilerDeoptInfoWithStub(intptr_t deopt_id, | 151 CompilerDeoptInfoWithStub(intptr_t deopt_id, |
| 151 DeoptReasonId reason) | 152 DeoptReasonId reason, |
| 152 : CompilerDeoptInfo(deopt_id, reason), entry_label_() { | 153 Environment* deopt_env) |
| 154 : CompilerDeoptInfo(deopt_id, reason, deopt_env), entry_label_() { | |
| 153 ASSERT(reason != kDeoptAtCall); | 155 ASSERT(reason != kDeoptAtCall); |
| 154 } | 156 } |
| 155 | 157 |
| 156 Label* entry_label() { return &entry_label_; } | 158 Label* entry_label() { return &entry_label_; } |
| 157 | 159 |
| 158 // Implementation is in architecture specific file. | 160 // Implementation is in architecture specific file. |
| 159 virtual void GenerateCode(FlowGraphCompiler* compiler, intptr_t stub_ix); | 161 virtual void GenerateCode(FlowGraphCompiler* compiler, intptr_t stub_ix); |
| 160 | 162 |
| 161 private: | 163 private: |
| 162 Label entry_label_; | 164 Label entry_label_; |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 590 // that should be used when deoptimizing we store it in this variable. | 592 // that should be used when deoptimizing we store it in this variable. |
| 591 // In future AddDeoptStub should be moved out of the instruction template. | 593 // In future AddDeoptStub should be moved out of the instruction template. |
| 592 Environment* pending_deoptimization_env_; | 594 Environment* pending_deoptimization_env_; |
| 593 | 595 |
| 594 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); | 596 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); |
| 595 }; | 597 }; |
| 596 | 598 |
| 597 } // namespace dart | 599 } // namespace dart |
| 598 | 600 |
| 599 #endif // VM_FLOW_GRAPH_COMPILER_H_ | 601 #endif // VM_FLOW_GRAPH_COMPILER_H_ |
| OLD | NEW |