OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_COMPILER_CODE_ASSEMBLER_H_ | 5 #ifndef V8_COMPILER_CODE_ASSEMBLER_H_ |
6 #define V8_COMPILER_CODE_ASSEMBLER_H_ | 6 #define V8_COMPILER_CODE_ASSEMBLER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 MachineRepresentation rep() const; | 205 MachineRepresentation rep() const; |
206 bool IsBound() const; | 206 bool IsBound() const; |
207 | 207 |
208 private: | 208 private: |
209 friend class CodeAssembler; | 209 friend class CodeAssembler; |
210 class Impl; | 210 class Impl; |
211 Impl* impl_; | 211 Impl* impl_; |
212 CodeAssembler* assembler_; | 212 CodeAssembler* assembler_; |
213 }; | 213 }; |
214 | 214 |
| 215 typedef ZoneList<Variable*> VariableList; |
| 216 |
215 // =========================================================================== | 217 // =========================================================================== |
216 // Base Assembler | 218 // Base Assembler |
217 // =========================================================================== | 219 // =========================================================================== |
218 | 220 |
219 // Constants. | 221 // Constants. |
220 Node* Int32Constant(int32_t value); | 222 Node* Int32Constant(int32_t value); |
221 Node* Int64Constant(int64_t value); | 223 Node* Int64Constant(int64_t value); |
222 Node* IntPtrConstant(intptr_t value); | 224 Node* IntPtrConstant(intptr_t value); |
223 Node* NumberConstant(double value); | 225 Node* NumberConstant(double value); |
224 Node* SmiConstant(Smi* value); | 226 Node* SmiConstant(Smi* value); |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 }; | 487 }; |
486 | 488 |
487 class CodeAssembler::Label { | 489 class CodeAssembler::Label { |
488 public: | 490 public: |
489 enum Type { kDeferred, kNonDeferred }; | 491 enum Type { kDeferred, kNonDeferred }; |
490 | 492 |
491 explicit Label( | 493 explicit Label( |
492 CodeAssembler* assembler, | 494 CodeAssembler* assembler, |
493 CodeAssembler::Label::Type type = CodeAssembler::Label::kNonDeferred) | 495 CodeAssembler::Label::Type type = CodeAssembler::Label::kNonDeferred) |
494 : CodeAssembler::Label(assembler, 0, nullptr, type) {} | 496 : CodeAssembler::Label(assembler, 0, nullptr, type) {} |
| 497 Label(CodeAssembler* assembler, const VariableList& merged_variables, |
| 498 CodeAssembler::Label::Type type = CodeAssembler::Label::kNonDeferred) |
| 499 : CodeAssembler::Label(assembler, merged_variables.length(), |
| 500 &(merged_variables[0]), type) {} |
| 501 Label(CodeAssembler* assembler, size_t count, Variable** vars, |
| 502 CodeAssembler::Label::Type type = CodeAssembler::Label::kNonDeferred); |
495 Label(CodeAssembler* assembler, CodeAssembler::Variable* merged_variable, | 503 Label(CodeAssembler* assembler, CodeAssembler::Variable* merged_variable, |
496 CodeAssembler::Label::Type type = CodeAssembler::Label::kNonDeferred) | 504 CodeAssembler::Label::Type type = CodeAssembler::Label::kNonDeferred) |
497 : CodeAssembler::Label(assembler, 1, &merged_variable, type) {} | 505 : Label(assembler, 1, &merged_variable, type) {} |
498 Label(CodeAssembler* assembler, int merged_variable_count, | |
499 CodeAssembler::Variable** merged_variables, | |
500 CodeAssembler::Label::Type type = CodeAssembler::Label::kNonDeferred); | |
501 ~Label() {} | 506 ~Label() {} |
502 | 507 |
503 private: | 508 private: |
504 friend class CodeAssembler; | 509 friend class CodeAssembler; |
505 | 510 |
506 void Bind(); | 511 void Bind(); |
507 void MergeVariables(); | 512 void MergeVariables(); |
508 | 513 |
509 bool bound_; | 514 bool bound_; |
510 size_t merge_count_; | 515 size_t merge_count_; |
511 CodeAssembler* assembler_; | 516 CodeAssembler* assembler_; |
512 RawMachineLabel* label_; | 517 RawMachineLabel* label_; |
513 // Map of variables that need to be merged to their phi nodes (or placeholders | 518 // Map of variables that need to be merged to their phi nodes (or placeholders |
514 // for those phis). | 519 // for those phis). |
515 std::map<Variable::Impl*, Node*> variable_phis_; | 520 std::map<Variable::Impl*, Node*> variable_phis_; |
516 // Map of variables to the list of value nodes that have been added from each | 521 // Map of variables to the list of value nodes that have been added from each |
517 // merge path in their order of merging. | 522 // merge path in their order of merging. |
518 std::map<Variable::Impl*, std::vector<Node*>> variable_merges_; | 523 std::map<Variable::Impl*, std::vector<Node*>> variable_merges_; |
519 }; | 524 }; |
520 | 525 |
521 } // namespace compiler | 526 } // namespace compiler |
522 } // namespace internal | 527 } // namespace internal |
523 } // namespace v8 | 528 } // namespace v8 |
524 | 529 |
525 #endif // V8_COMPILER_CODE_ASSEMBLER_H_ | 530 #endif // V8_COMPILER_CODE_ASSEMBLER_H_ |
OLD | NEW |