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" |
11 #include "vm/code_generator.h" | 11 #include "vm/code_generator.h" |
12 #include "vm/intermediate_language.h" | 12 #include "vm/intermediate_language.h" |
13 | 13 |
14 namespace dart { | 14 namespace dart { |
15 | 15 |
16 // Forward declarations. | 16 // Forward declarations. |
17 class Code; | 17 class Code; |
18 class DeoptInfoBuilder; | 18 class DeoptInfoBuilder; |
19 class FlowGraph; | 19 class FlowGraph; |
20 class FlowGraphCompiler; | 20 class FlowGraphCompiler; |
21 class Function; | 21 class Function; |
22 template <typename T> class GrowableArray; | 22 template <typename T> class GrowableArray; |
23 class ParsedFunction; | 23 class ParsedFunction; |
24 | 24 |
25 | 25 |
| 26 struct BranchLabels { |
| 27 Label* true_label; |
| 28 Label* false_label; |
| 29 Label* fall_through; |
| 30 }; |
| 31 |
| 32 |
26 class ParallelMoveResolver : public ValueObject { | 33 class ParallelMoveResolver : public ValueObject { |
27 public: | 34 public: |
28 explicit ParallelMoveResolver(FlowGraphCompiler* compiler); | 35 explicit ParallelMoveResolver(FlowGraphCompiler* compiler); |
29 | 36 |
30 // Resolve a set of parallel moves, emitting assembler instructions. | 37 // Resolve a set of parallel moves, emitting assembler instructions. |
31 void EmitNativeCode(ParallelMoveInstr* parallel_move); | 38 void EmitNativeCode(ParallelMoveInstr* parallel_move); |
32 | 39 |
33 private: | 40 private: |
34 class ScratchFpuRegisterScope : public ValueObject { | 41 class ScratchFpuRegisterScope : public ValueObject { |
35 public: | 42 public: |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 intptr_t token_pos); | 388 intptr_t token_pos); |
382 | 389 |
383 void EmitTrySync(Instruction* instr, intptr_t try_index); | 390 void EmitTrySync(Instruction* instr, intptr_t try_index); |
384 | 391 |
385 intptr_t StackSize() const; | 392 intptr_t StackSize() const; |
386 | 393 |
387 // Returns assembler label associated with the given block entry. | 394 // Returns assembler label associated with the given block entry. |
388 Label* GetJumpLabel(BlockEntryInstr* block_entry) const; | 395 Label* GetJumpLabel(BlockEntryInstr* block_entry) const; |
389 bool WasCompacted(BlockEntryInstr* block_entry) const; | 396 bool WasCompacted(BlockEntryInstr* block_entry) const; |
390 | 397 |
| 398 // Returns the label of the fall-through of the current block. |
| 399 Label* NextNonEmptyLabel() const; |
| 400 |
391 // Returns true if there is a next block after the current one in | 401 // Returns true if there is a next block after the current one in |
392 // the block order and if it is the given block. | 402 // the block order and if it is the given block. |
393 bool CanFallThroughTo(BlockEntryInstr* block_entry) const; | 403 bool CanFallThroughTo(BlockEntryInstr* block_entry) const; |
394 | 404 |
| 405 // Return true-, false- and fall-through label for a branch instruction. |
| 406 BranchLabels CreateBranchLabels(BranchInstr* branch) const; |
| 407 |
395 void AddExceptionHandler(intptr_t try_index, | 408 void AddExceptionHandler(intptr_t try_index, |
396 intptr_t outer_try_index, | 409 intptr_t outer_try_index, |
397 intptr_t pc_offset, | 410 intptr_t pc_offset, |
398 const Array& handler_types, | 411 const Array& handler_types, |
399 bool needs_stacktrace); | 412 bool needs_stacktrace); |
400 void SetNeedsStacktrace(intptr_t try_index); | 413 void SetNeedsStacktrace(intptr_t try_index); |
401 void AddCurrentDescriptor(PcDescriptors::Kind kind, | 414 void AddCurrentDescriptor(PcDescriptors::Kind kind, |
402 intptr_t deopt_id, | 415 intptr_t deopt_id, |
403 intptr_t token_pos); | 416 intptr_t token_pos); |
404 | 417 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 // that should be used when deoptimizing we store it in this variable. | 612 // that should be used when deoptimizing we store it in this variable. |
600 // In future AddDeoptStub should be moved out of the instruction template. | 613 // In future AddDeoptStub should be moved out of the instruction template. |
601 Environment* pending_deoptimization_env_; | 614 Environment* pending_deoptimization_env_; |
602 | 615 |
603 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); | 616 DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler); |
604 }; | 617 }; |
605 | 618 |
606 } // namespace dart | 619 } // namespace dart |
607 | 620 |
608 #endif // VM_FLOW_GRAPH_COMPILER_H_ | 621 #endif // VM_FLOW_GRAPH_COMPILER_H_ |
OLD | NEW |