| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 // List of moves not yet resolved. | 103 // List of moves not yet resolved. |
| 104 GrowableArray<MoveOperands*> moves_; | 104 GrowableArray<MoveOperands*> moves_; |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 | 107 |
| 108 // Used for describing a deoptimization point after call (lazy deoptimization). | 108 // Used for describing a deoptimization point after call (lazy deoptimization). |
| 109 // For deoptimization before instruction use class CompilerDeoptInfoWithStub. | 109 // For deoptimization before instruction use class CompilerDeoptInfoWithStub. |
| 110 class CompilerDeoptInfo : public ZoneAllocated { | 110 class CompilerDeoptInfo : public ZoneAllocated { |
| 111 public: | 111 public: |
| 112 CompilerDeoptInfo(intptr_t deopt_id, | 112 CompilerDeoptInfo(intptr_t deopt_id, |
| 113 DeoptReasonId reason, | 113 ICData::DeoptReasonId reason, |
| 114 Environment* deopt_env) | 114 Environment* deopt_env) |
| 115 : pc_offset_(-1), | 115 : pc_offset_(-1), |
| 116 deopt_id_(deopt_id), | 116 deopt_id_(deopt_id), |
| 117 reason_(reason), | 117 reason_(reason), |
| 118 deopt_env_(deopt_env) { | 118 deopt_env_(deopt_env) { |
| 119 ASSERT(deopt_env != NULL); | 119 ASSERT(deopt_env != NULL); |
| 120 } | 120 } |
| 121 | 121 |
| 122 RawDeoptInfo* CreateDeoptInfo(FlowGraphCompiler* compiler, | 122 RawDeoptInfo* CreateDeoptInfo(FlowGraphCompiler* compiler, |
| 123 DeoptInfoBuilder* builder, | 123 DeoptInfoBuilder* builder, |
| 124 const Array& deopt_table); | 124 const Array& deopt_table); |
| 125 | 125 |
| 126 | 126 |
| 127 // No code needs to be generated. | 127 // No code needs to be generated. |
| 128 virtual void GenerateCode(FlowGraphCompiler* compiler, intptr_t stub_ix) {} | 128 virtual void GenerateCode(FlowGraphCompiler* compiler, intptr_t stub_ix) {} |
| 129 | 129 |
| 130 intptr_t pc_offset() const { return pc_offset_; } | 130 intptr_t pc_offset() const { return pc_offset_; } |
| 131 void set_pc_offset(intptr_t offset) { pc_offset_ = offset; } | 131 void set_pc_offset(intptr_t offset) { pc_offset_ = offset; } |
| 132 | 132 |
| 133 intptr_t deopt_id() const { return deopt_id_; } | 133 intptr_t deopt_id() const { return deopt_id_; } |
| 134 DeoptReasonId reason() const { return reason_; } | 134 ICData::DeoptReasonId reason() const { return reason_; } |
| 135 const Environment* deopt_env() const { return deopt_env_; } | 135 const Environment* deopt_env() const { return deopt_env_; } |
| 136 | 136 |
| 137 private: | 137 private: |
| 138 void EmitMaterializations(Environment* env, DeoptInfoBuilder* builder); | 138 void EmitMaterializations(Environment* env, DeoptInfoBuilder* builder); |
| 139 | 139 |
| 140 void AllocateIncomingParametersRecursive(Environment* env, | 140 void AllocateIncomingParametersRecursive(Environment* env, |
| 141 intptr_t* stack_height); | 141 intptr_t* stack_height); |
| 142 | 142 |
| 143 intptr_t pc_offset_; | 143 intptr_t pc_offset_; |
| 144 const intptr_t deopt_id_; | 144 const intptr_t deopt_id_; |
| 145 const DeoptReasonId reason_; | 145 const ICData::DeoptReasonId reason_; |
| 146 Environment* deopt_env_; | 146 Environment* deopt_env_; |
| 147 | 147 |
| 148 DISALLOW_COPY_AND_ASSIGN(CompilerDeoptInfo); | 148 DISALLOW_COPY_AND_ASSIGN(CompilerDeoptInfo); |
| 149 }; | 149 }; |
| 150 | 150 |
| 151 | 151 |
| 152 class CompilerDeoptInfoWithStub : public CompilerDeoptInfo { | 152 class CompilerDeoptInfoWithStub : public CompilerDeoptInfo { |
| 153 public: | 153 public: |
| 154 CompilerDeoptInfoWithStub(intptr_t deopt_id, | 154 CompilerDeoptInfoWithStub(intptr_t deopt_id, |
| 155 DeoptReasonId reason, | 155 ICData::DeoptReasonId reason, |
| 156 Environment* deopt_env) | 156 Environment* deopt_env) |
| 157 : CompilerDeoptInfo(deopt_id, reason, deopt_env), entry_label_() { | 157 : CompilerDeoptInfo(deopt_id, reason, deopt_env), entry_label_() { |
| 158 ASSERT(reason != kDeoptAtCall); | 158 ASSERT(reason != ICData::kDeoptAtCall); |
| 159 } | 159 } |
| 160 | 160 |
| 161 Label* entry_label() { return &entry_label_; } | 161 Label* entry_label() { return &entry_label_; } |
| 162 | 162 |
| 163 // Implementation is in architecture specific file. | 163 // Implementation is in architecture specific file. |
| 164 virtual void GenerateCode(FlowGraphCompiler* compiler, intptr_t stub_ix); | 164 virtual void GenerateCode(FlowGraphCompiler* compiler, intptr_t stub_ix); |
| 165 | 165 |
| 166 private: | 166 private: |
| 167 Label entry_label_; | 167 Label entry_label_; |
| 168 | 168 |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 intptr_t pc_offset, | 407 intptr_t pc_offset, |
| 408 const Array& handler_types, | 408 const Array& handler_types, |
| 409 bool needs_stacktrace); | 409 bool needs_stacktrace); |
| 410 void SetNeedsStacktrace(intptr_t try_index); | 410 void SetNeedsStacktrace(intptr_t try_index); |
| 411 void AddCurrentDescriptor(PcDescriptors::Kind kind, | 411 void AddCurrentDescriptor(PcDescriptors::Kind kind, |
| 412 intptr_t deopt_id, | 412 intptr_t deopt_id, |
| 413 intptr_t token_pos); | 413 intptr_t token_pos); |
| 414 | 414 |
| 415 void RecordSafepoint(LocationSummary* locs); | 415 void RecordSafepoint(LocationSummary* locs); |
| 416 | 416 |
| 417 Label* AddDeoptStub(intptr_t deopt_id, DeoptReasonId reason); | 417 Label* AddDeoptStub(intptr_t deopt_id, ICData::DeoptReasonId reason); |
| 418 | 418 |
| 419 void AddDeoptIndexAtCall(intptr_t deopt_id, intptr_t token_pos); | 419 void AddDeoptIndexAtCall(intptr_t deopt_id, intptr_t token_pos); |
| 420 | 420 |
| 421 void AddSlowPathCode(SlowPathCode* slow_path); | 421 void AddSlowPathCode(SlowPathCode* slow_path); |
| 422 | 422 |
| 423 void FinalizeExceptionHandlers(const Code& code); | 423 void FinalizeExceptionHandlers(const Code& code); |
| 424 void FinalizePcDescriptors(const Code& code); | 424 void FinalizePcDescriptors(const Code& code); |
| 425 void FinalizeDeoptInfo(const Code& code); | 425 void FinalizeDeoptInfo(const Code& code); |
| 426 void FinalizeStackmaps(const Code& code); | 426 void FinalizeStackmaps(const Code& code); |
| 427 void FinalizeVarDescriptors(const Code& code); | 427 void FinalizeVarDescriptors(const Code& code); |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 // that should be used when deoptimizing we store it in this variable. | 605 // that should be used when deoptimizing we store it in this variable. |
| 606 // In future AddDeoptStub should be moved out of the instruction template. | 606 // In future AddDeoptStub should be moved out of the instruction template. |
| 607 Environment* pending_deoptimization_env_; | 607 Environment* pending_deoptimization_env_; |
| 608 | 608 |
| 609 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); | 609 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); |
| 610 }; | 610 }; |
| 611 | 611 |
| 612 } // namespace dart | 612 } // namespace dart |
| 613 | 613 |
| 614 #endif // VM_FLOW_GRAPH_COMPILER_H_ | 614 #endif // VM_FLOW_GRAPH_COMPILER_H_ |
| OLD | NEW |