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/assembler_macros.h" | 10 #include "vm/assembler_macros.h" |
| 11 #include "vm/code_descriptors.h" | 11 #include "vm/code_descriptors.h" |
| 12 #include "vm/code_generator.h" | 12 #include "vm/code_generator.h" |
| 13 #include "vm/intermediate_language.h" | 13 #include "vm/intermediate_language.h" |
| 14 | 14 |
| 15 namespace dart { | 15 namespace dart { |
| 16 | 16 |
| 17 // Forward declarations. | 17 // Forward declarations. |
| 18 class FlowGraphCompiler; | 18 class FlowGraphCompiler; |
| 19 class DeoptimizationStub; | 19 class DeoptInfoBuilder; |
| 20 | |
| 21 | 20 |
| 22 class ParallelMoveResolver : public ValueObject { | 21 class ParallelMoveResolver : public ValueObject { |
| 23 public: | 22 public: |
| 24 explicit ParallelMoveResolver(FlowGraphCompiler* compiler); | 23 explicit ParallelMoveResolver(FlowGraphCompiler* compiler); |
| 25 | 24 |
| 26 // Resolve a set of parallel moves, emitting assembler instructions. | 25 // Resolve a set of parallel moves, emitting assembler instructions. |
| 27 void EmitNativeCode(ParallelMoveInstr* parallel_move); | 26 void EmitNativeCode(ParallelMoveInstr* parallel_move); |
| 28 | 27 |
| 29 private: | 28 private: |
| 30 // Build the initial list of moves. | 29 // Build the initial list of moves. |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 51 void Exchange(Register reg, const Address& mem); | 50 void Exchange(Register reg, const Address& mem); |
| 52 void Exchange(const Address& mem1, const Address& mem2); | 51 void Exchange(const Address& mem1, const Address& mem2); |
| 53 | 52 |
| 54 FlowGraphCompiler* compiler_; | 53 FlowGraphCompiler* compiler_; |
| 55 | 54 |
| 56 // List of moves not yet resolved. | 55 // List of moves not yet resolved. |
| 57 GrowableArray<MoveOperands*> moves_; | 56 GrowableArray<MoveOperands*> moves_; |
| 58 }; | 57 }; |
| 59 | 58 |
| 60 | 59 |
| 61 class DeoptimizationStub : public ZoneAllocated { | 60 // Used for describing a deoptimization point after call (lazy deoptimziation). |
|
regis
2012/08/31 20:08:50
typo: deoptimziation
srdjan
2012/08/31 20:18:43
Done.
| |
| 61 // For deoptimization before instruction use class CompilerDeoptInfoWithStub. | |
| 62 class CompilerDeoptInfo : public ZoneAllocated { | |
| 62 public: | 63 public: |
| 63 DeoptimizationStub(intptr_t deopt_id, | 64 CompilerDeoptInfo(intptr_t deopt_id, DeoptReasonId reason) |
| 64 DeoptReasonId reason) | 65 : deopt_id_(deopt_id), reason_(reason), deoptimization_env_(NULL) {} |
| 65 : deopt_id_(deopt_id), | |
| 66 reason_(reason), | |
| 67 deoptimization_env_(NULL), | |
| 68 entry_label_() {} | |
| 69 | |
| 70 Label* entry_label() { return &entry_label_; } | |
| 71 | |
| 72 // Implementation is in architecture specific file. | |
| 73 void GenerateCode(FlowGraphCompiler* compiler, intptr_t stub_ix); | |
| 74 | 66 |
| 75 void set_deoptimization_env(Environment* env) { | 67 void set_deoptimization_env(Environment* env) { |
| 76 deoptimization_env_ = env; | 68 deoptimization_env_ = env; |
| 77 } | 69 } |
| 78 | 70 |
| 79 RawDeoptInfo* CreateDeoptInfo(FlowGraphCompiler* compiler); | 71 RawDeoptInfo* CreateDeoptInfo(FlowGraphCompiler* compiler); |
| 80 | 72 |
| 73 // No code needs to be generated. | |
| 74 virtual void GenerateCode(FlowGraphCompiler* compiler, intptr_t stub_ix) {} | |
| 75 | |
| 76 // Builds deopt-after continuation point. | |
| 77 virtual void BuildReturnAddress(DeoptInfoBuilder* builder, | |
| 78 const Function& function, | |
| 79 intptr_t slot_ix); | |
| 80 | |
| 81 intptr_t deopt_id() const { return deopt_id_; } | |
| 82 DeoptReasonId reason() const { return reason_; } | |
| 83 const Environment* deoptimization_env() const { return deoptimization_env_; } | |
| 84 | |
| 81 private: | 85 private: |
| 82 const intptr_t deopt_id_; | 86 const intptr_t deopt_id_; |
| 83 const DeoptReasonId reason_; | 87 const DeoptReasonId reason_; |
| 84 const Environment* deoptimization_env_; | 88 const Environment* deoptimization_env_; |
| 85 Label entry_label_; | |
| 86 | 89 |
| 87 DISALLOW_COPY_AND_ASSIGN(DeoptimizationStub); | 90 DISALLOW_COPY_AND_ASSIGN(CompilerDeoptInfo); |
| 88 }; | 91 }; |
| 89 | 92 |
| 90 | 93 |
| 94 class CompilerDeoptInfoWithStub : public CompilerDeoptInfo { | |
| 95 public: | |
| 96 CompilerDeoptInfoWithStub(intptr_t deopt_id, | |
| 97 DeoptReasonId reason) | |
| 98 : CompilerDeoptInfo(deopt_id, reason), entry_label_() { | |
| 99 ASSERT(reason != kDeoptAtCall); | |
| 100 } | |
| 101 | |
| 102 Label* entry_label() { return &entry_label_; } | |
| 103 | |
| 104 // Implementation is in architecture specific file. | |
| 105 virtual void GenerateCode(FlowGraphCompiler* compiler, intptr_t stub_ix); | |
| 106 | |
| 107 // Builds deopt-before continuation point. | |
| 108 virtual void BuildReturnAddress(DeoptInfoBuilder* builder, | |
| 109 const Function& function, | |
| 110 intptr_t slot_ix); | |
| 111 | |
| 112 private: | |
| 113 Label entry_label_; | |
| 114 | |
| 115 DISALLOW_COPY_AND_ASSIGN(CompilerDeoptInfoWithStub); | |
| 116 }; | |
| 117 | |
| 118 | |
| 91 class SlowPathCode : public ZoneAllocated { | 119 class SlowPathCode : public ZoneAllocated { |
| 92 public: | 120 public: |
| 93 SlowPathCode() : entry_label_(), exit_label_() { } | 121 SlowPathCode() : entry_label_(), exit_label_() { } |
| 94 | 122 |
| 95 Label* entry_label() { return &entry_label_; } | 123 Label* entry_label() { return &entry_label_; } |
| 96 Label* exit_label() { return &exit_label_; } | 124 Label* exit_label() { return &exit_label_; } |
| 97 | 125 |
| 98 virtual void EmitNativeCode(FlowGraphCompiler* compiler) = 0; | 126 virtual void EmitNativeCode(FlowGraphCompiler* compiler) = 0; |
| 99 | 127 |
| 100 private: | 128 private: |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 111 #include "vm/flow_graph_compiler_ia32.h" | 139 #include "vm/flow_graph_compiler_ia32.h" |
| 112 #elif defined(TARGET_ARCH_X64) | 140 #elif defined(TARGET_ARCH_X64) |
| 113 #include "vm/flow_graph_compiler_x64.h" | 141 #include "vm/flow_graph_compiler_x64.h" |
| 114 #elif defined(TARGET_ARCH_ARM) | 142 #elif defined(TARGET_ARCH_ARM) |
| 115 #include "vm/flow_graph_compiler_arm.h" | 143 #include "vm/flow_graph_compiler_arm.h" |
| 116 #else | 144 #else |
| 117 #error Unknown architecture. | 145 #error Unknown architecture. |
| 118 #endif | 146 #endif |
| 119 | 147 |
| 120 #endif // VM_FLOW_GRAPH_COMPILER_H_ | 148 #endif // VM_FLOW_GRAPH_COMPILER_H_ |
| OLD | NEW |