OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_RAW_MACHINE_ASSEMBLER_H_ | 5 #ifndef V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ |
6 #define V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ | 6 #define V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ |
7 | 7 |
8 #include "src/compiler/common-operator.h" | 8 #include "src/compiler/common-operator.h" |
9 #include "src/compiler/graph-builder.h" | 9 #include "src/compiler/graph-builder.h" |
10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 bool bound_; | 40 bool bound_; |
41 friend class RawMachineAssembler; | 41 friend class RawMachineAssembler; |
42 DISALLOW_COPY_AND_ASSIGN(Label); | 42 DISALLOW_COPY_AND_ASSIGN(Label); |
43 }; | 43 }; |
44 | 44 |
45 RawMachineAssembler(Isolate* isolate, Graph* graph, | 45 RawMachineAssembler(Isolate* isolate, Graph* graph, |
46 CallDescriptor* call_descriptor, | 46 CallDescriptor* call_descriptor, |
47 MachineType word = kMachPtr, | 47 MachineType word = kMachPtr, |
48 MachineOperatorBuilder::Flags flags = | 48 MachineOperatorBuilder::Flags flags = |
49 MachineOperatorBuilder::Flag::kNoFlags); | 49 MachineOperatorBuilder::Flag::kNoFlags); |
| 50 |
50 ~RawMachineAssembler() override {} | 51 ~RawMachineAssembler() override {} |
51 | 52 |
52 Zone* zone() const { return graph()->zone(); } | 53 Zone* zone() const { return graph()->zone(); } |
53 MachineOperatorBuilder* machine() { return &machine_; } | 54 MachineOperatorBuilder* machine() { return &machine_; } |
54 CommonOperatorBuilder* common() { return &common_; } | 55 CommonOperatorBuilder* common() { return &common_; } |
55 CallDescriptor* call_descriptor() const { return call_descriptor_; } | 56 CallDescriptor* call_descriptor() const { return call_descriptor_; } |
56 size_t parameter_count() const { return machine_sig()->parameter_count(); } | 57 size_t parameter_count() const { return machine_sig()->parameter_count(); } |
57 const MachineSignature* machine_sig() const { | 58 const MachineSignature* machine_sig() const { |
58 return call_descriptor_->GetMachineSignature(); | 59 return call_descriptor_->GetMachineSignature(); |
59 } | 60 } |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 Node* Phi(MachineType type, Node* n1, Node* n2, Node* n3) { | 505 Node* Phi(MachineType type, Node* n1, Node* n2, Node* n3) { |
505 return NewNode(common()->Phi(type, 3), n1, n2, n3); | 506 return NewNode(common()->Phi(type, 3), n1, n2, n3); |
506 } | 507 } |
507 Node* Phi(MachineType type, Node* n1, Node* n2, Node* n3, Node* n4) { | 508 Node* Phi(MachineType type, Node* n1, Node* n2, Node* n3, Node* n4) { |
508 return NewNode(common()->Phi(type, 4), n1, n2, n3, n4); | 509 return NewNode(common()->Phi(type, 4), n1, n2, n3, n4); |
509 } | 510 } |
510 | 511 |
511 // MachineAssembler is invalid after export. | 512 // MachineAssembler is invalid after export. |
512 Schedule* Export(); | 513 Schedule* Export(); |
513 | 514 |
| 515 Schedule* schedule() { |
| 516 DCHECK(ScheduleValid()); |
| 517 return schedule_; |
| 518 } |
| 519 |
| 520 BasicBlock* CurrentBlock(); |
| 521 |
514 protected: | 522 protected: |
515 Node* MakeNode(const Operator* op, int input_count, Node** inputs, | 523 Node* MakeNode(const Operator* op, int input_count, Node** inputs, |
516 bool incomplete) final; | 524 bool incomplete) final; |
517 | 525 |
518 bool ScheduleValid() { return schedule_ != NULL; } | 526 bool ScheduleValid() { return schedule_ != NULL; } |
519 | 527 |
520 Schedule* schedule() { | |
521 DCHECK(ScheduleValid()); | |
522 return schedule_; | |
523 } | |
524 | |
525 private: | 528 private: |
526 BasicBlock* Use(Label* label); | 529 BasicBlock* Use(Label* label); |
527 BasicBlock* EnsureBlock(Label* label); | 530 BasicBlock* EnsureBlock(Label* label); |
528 BasicBlock* CurrentBlock(); | |
529 | 531 |
530 Schedule* schedule_; | 532 Schedule* schedule_; |
531 MachineOperatorBuilder machine_; | 533 MachineOperatorBuilder machine_; |
532 CommonOperatorBuilder common_; | 534 CommonOperatorBuilder common_; |
533 CallDescriptor* call_descriptor_; | 535 CallDescriptor* call_descriptor_; |
534 Node** parameters_; | 536 Node** parameters_; |
535 BasicBlock* current_block_; | 537 BasicBlock* current_block_; |
536 | 538 |
537 DISALLOW_COPY_AND_ASSIGN(RawMachineAssembler); | 539 DISALLOW_COPY_AND_ASSIGN(RawMachineAssembler); |
538 }; | 540 }; |
539 | 541 |
540 } // namespace compiler | 542 } // namespace compiler |
541 } // namespace internal | 543 } // namespace internal |
542 } // namespace v8 | 544 } // namespace v8 |
543 | 545 |
544 #endif // V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ | 546 #endif // V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ |
OLD | NEW |