| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 GrowableArray<MoveOperands*> moves_; | 108 GrowableArray<MoveOperands*> moves_; |
| 109 }; | 109 }; |
| 110 | 110 |
| 111 | 111 |
| 112 // Used for describing a deoptimization point after call (lazy deoptimization). | 112 // Used for describing a deoptimization point after call (lazy deoptimization). |
| 113 // For deoptimization before instruction use class CompilerDeoptInfoWithStub. | 113 // For deoptimization before instruction use class CompilerDeoptInfoWithStub. |
| 114 class CompilerDeoptInfo : public ZoneAllocated { | 114 class CompilerDeoptInfo : public ZoneAllocated { |
| 115 public: | 115 public: |
| 116 CompilerDeoptInfo(intptr_t deopt_id, | 116 CompilerDeoptInfo(intptr_t deopt_id, |
| 117 ICData::DeoptReasonId reason, | 117 ICData::DeoptReasonId reason, |
| 118 uint32_t flags, |
| 118 Environment* deopt_env) | 119 Environment* deopt_env) |
| 119 : pc_offset_(-1), | 120 : pc_offset_(-1), |
| 120 deopt_id_(deopt_id), | 121 deopt_id_(deopt_id), |
| 121 reason_(reason), | 122 reason_(reason), |
| 123 flags_(flags), |
| 122 deopt_env_(deopt_env) { | 124 deopt_env_(deopt_env) { |
| 123 ASSERT(deopt_env != NULL); | 125 ASSERT(deopt_env != NULL); |
| 124 } | 126 } |
| 125 virtual ~CompilerDeoptInfo() { } | 127 virtual ~CompilerDeoptInfo() { } |
| 126 | 128 |
| 127 RawDeoptInfo* CreateDeoptInfo(FlowGraphCompiler* compiler, | 129 RawDeoptInfo* CreateDeoptInfo(FlowGraphCompiler* compiler, |
| 128 DeoptInfoBuilder* builder, | 130 DeoptInfoBuilder* builder, |
| 129 const Array& deopt_table); | 131 const Array& deopt_table); |
| 130 | 132 |
| 131 | 133 |
| 132 // No code needs to be generated. | 134 // No code needs to be generated. |
| 133 virtual void GenerateCode(FlowGraphCompiler* compiler, intptr_t stub_ix) {} | 135 virtual void GenerateCode(FlowGraphCompiler* compiler, intptr_t stub_ix) {} |
| 134 | 136 |
| 135 intptr_t pc_offset() const { return pc_offset_; } | 137 intptr_t pc_offset() const { return pc_offset_; } |
| 136 void set_pc_offset(intptr_t offset) { pc_offset_ = offset; } | 138 void set_pc_offset(intptr_t offset) { pc_offset_ = offset; } |
| 137 | 139 |
| 138 intptr_t deopt_id() const { return deopt_id_; } | 140 intptr_t deopt_id() const { return deopt_id_; } |
| 139 ICData::DeoptReasonId reason() const { return reason_; } | 141 ICData::DeoptReasonId reason() const { return reason_; } |
| 142 uint32_t flags() const { return flags_; } |
| 140 const Environment* deopt_env() const { return deopt_env_; } | 143 const Environment* deopt_env() const { return deopt_env_; } |
| 141 | 144 |
| 142 private: | 145 private: |
| 143 void EmitMaterializations(Environment* env, DeoptInfoBuilder* builder); | 146 void EmitMaterializations(Environment* env, DeoptInfoBuilder* builder); |
| 144 | 147 |
| 145 void AllocateIncomingParametersRecursive(Environment* env, | 148 void AllocateIncomingParametersRecursive(Environment* env, |
| 146 intptr_t* stack_height); | 149 intptr_t* stack_height); |
| 147 | 150 |
| 148 intptr_t pc_offset_; | 151 intptr_t pc_offset_; |
| 149 const intptr_t deopt_id_; | 152 const intptr_t deopt_id_; |
| 150 const ICData::DeoptReasonId reason_; | 153 const ICData::DeoptReasonId reason_; |
| 154 const uint32_t flags_; |
| 151 Environment* deopt_env_; | 155 Environment* deopt_env_; |
| 152 | 156 |
| 153 DISALLOW_COPY_AND_ASSIGN(CompilerDeoptInfo); | 157 DISALLOW_COPY_AND_ASSIGN(CompilerDeoptInfo); |
| 154 }; | 158 }; |
| 155 | 159 |
| 156 | 160 |
| 157 class CompilerDeoptInfoWithStub : public CompilerDeoptInfo { | 161 class CompilerDeoptInfoWithStub : public CompilerDeoptInfo { |
| 158 public: | 162 public: |
| 159 CompilerDeoptInfoWithStub(intptr_t deopt_id, | 163 CompilerDeoptInfoWithStub(intptr_t deopt_id, |
| 160 ICData::DeoptReasonId reason, | 164 ICData::DeoptReasonId reason, |
| 165 uint32_t flags, |
| 161 Environment* deopt_env) | 166 Environment* deopt_env) |
| 162 : CompilerDeoptInfo(deopt_id, reason, deopt_env), entry_label_() { | 167 : CompilerDeoptInfo(deopt_id, reason, flags, deopt_env), entry_label_() { |
| 163 ASSERT(reason != ICData::kDeoptAtCall); | 168 ASSERT(reason != ICData::kDeoptAtCall); |
| 164 } | 169 } |
| 165 | 170 |
| 166 Label* entry_label() { return &entry_label_; } | 171 Label* entry_label() { return &entry_label_; } |
| 167 | 172 |
| 168 // Implementation is in architecture specific file. | 173 // Implementation is in architecture specific file. |
| 169 virtual void GenerateCode(FlowGraphCompiler* compiler, intptr_t stub_ix); | 174 virtual void GenerateCode(FlowGraphCompiler* compiler, intptr_t stub_ix); |
| 170 | 175 |
| 171 const char* Name() const { | 176 const char* Name() const { |
| 172 const char* kFormat = "Deopt stub for id %d, reason: %s"; | 177 const char* kFormat = "Deopt stub for id %d, reason: %s"; |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 intptr_t pc_offset, | 445 intptr_t pc_offset, |
| 441 const Array& handler_types, | 446 const Array& handler_types, |
| 442 bool needs_stacktrace); | 447 bool needs_stacktrace); |
| 443 void SetNeedsStacktrace(intptr_t try_index); | 448 void SetNeedsStacktrace(intptr_t try_index); |
| 444 void AddCurrentDescriptor(RawPcDescriptors::Kind kind, | 449 void AddCurrentDescriptor(RawPcDescriptors::Kind kind, |
| 445 intptr_t deopt_id, | 450 intptr_t deopt_id, |
| 446 intptr_t token_pos); | 451 intptr_t token_pos); |
| 447 | 452 |
| 448 void RecordSafepoint(LocationSummary* locs); | 453 void RecordSafepoint(LocationSummary* locs); |
| 449 | 454 |
| 450 Label* AddDeoptStub(intptr_t deopt_id, ICData::DeoptReasonId reason); | 455 Label* AddDeoptStub(intptr_t deopt_id, |
| 456 ICData::DeoptReasonId reason, |
| 457 uint32_t flags = 0); |
| 451 | 458 |
| 452 void AddDeoptIndexAtCall(intptr_t deopt_id, intptr_t token_pos); | 459 void AddDeoptIndexAtCall(intptr_t deopt_id, intptr_t token_pos); |
| 453 | 460 |
| 454 void AddSlowPathCode(SlowPathCode* slow_path); | 461 void AddSlowPathCode(SlowPathCode* slow_path); |
| 455 | 462 |
| 456 void FinalizeExceptionHandlers(const Code& code); | 463 void FinalizeExceptionHandlers(const Code& code); |
| 457 void FinalizePcDescriptors(const Code& code); | 464 void FinalizePcDescriptors(const Code& code); |
| 458 void FinalizeDeoptInfo(const Code& code); | 465 void FinalizeDeoptInfo(const Code& code); |
| 459 void FinalizeStackmaps(const Code& code); | 466 void FinalizeStackmaps(const Code& code); |
| 460 void FinalizeVarDescriptors(const Code& code); | 467 void FinalizeVarDescriptors(const Code& code); |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 intptr_t lazy_deopt_pc_offset_; | 664 intptr_t lazy_deopt_pc_offset_; |
| 658 | 665 |
| 659 ZoneGrowableArray<const ICData*>* deopt_id_to_ic_data_; | 666 ZoneGrowableArray<const ICData*>* deopt_id_to_ic_data_; |
| 660 | 667 |
| 661 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); | 668 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); |
| 662 }; | 669 }; |
| 663 | 670 |
| 664 } // namespace dart | 671 } // namespace dart |
| 665 | 672 |
| 666 #endif // VM_FLOW_GRAPH_COMPILER_H_ | 673 #endif // VM_FLOW_GRAPH_COMPILER_H_ |
| OLD | NEW |