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/assembler.h" | 8 #include "src/assembler.h" |
9 #include "src/compiler/common-operator.h" | 9 #include "src/compiler/common-operator.h" |
10 #include "src/compiler/graph.h" | 10 #include "src/compiler/graph.h" |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
542 } | 542 } |
543 Node* Phi(MachineType type, Node* n1, Node* n2, Node* n3, Node* n4) { | 543 Node* Phi(MachineType type, Node* n1, Node* n2, Node* n3, Node* n4) { |
544 return NewNode(common()->Phi(type, 4), n1, n2, n3, n4); | 544 return NewNode(common()->Phi(type, 4), n1, n2, n3, n4); |
545 } | 545 } |
546 | 546 |
547 // =========================================================================== | 547 // =========================================================================== |
548 // The following generic node creation methods can be used for operators that | 548 // The following generic node creation methods can be used for operators that |
549 // are not covered by the above utility methods. There should rarely be a need | 549 // are not covered by the above utility methods. There should rarely be a need |
550 // to do that outside of testing though. | 550 // to do that outside of testing though. |
551 | 551 |
552 Node* NewNode(const Operator* op) { | 552 Node* NewNode(const Operator* op, int value_input_count, |
553 return MakeNode(op, 0, static_cast<Node**>(NULL)); | 553 Node** value_inputs) { |
554 return AddNode(op, value_input_count, value_inputs); | |
554 } | 555 } |
555 | 556 |
556 Node* NewNode(const Operator* op, Node* n1) { return MakeNode(op, 1, &n1); } | 557 Node* NewNode(const Operator* op) { |
557 | 558 return AddNode(op, 0, static_cast<Node**>(NULL)); |
Benedikt Meurer
2015/09/23 06:57:12
Nit: use nullptr here, you don't need static_cast
Jarin
2015/09/23 07:09:34
Done.
| |
558 Node* NewNode(const Operator* op, Node* n1, Node* n2) { | |
559 Node* buffer[] = {n1, n2}; | |
560 return MakeNode(op, arraysize(buffer), buffer); | |
561 } | 559 } |
562 | 560 |
563 Node* NewNode(const Operator* op, Node* n1, Node* n2, Node* n3) { | 561 Node* NewNode(const Operator* op, Node* n1) { return AddNode(op, 1, &n1); } |
564 Node* buffer[] = {n1, n2, n3}; | |
565 return MakeNode(op, arraysize(buffer), buffer); | |
566 } | |
567 | 562 |
568 Node* NewNode(const Operator* op, Node* n1, Node* n2, Node* n3, Node* n4) { | 563 template <class... TArgs> |
569 Node* buffer[] = {n1, n2, n3, n4}; | 564 Node* NewNode(const Operator* op, Node* n1, Node* n2, TArgs... args) { |
570 return MakeNode(op, arraysize(buffer), buffer); | 565 Node* buffer[] = {n1, n2, args...}; |
571 } | 566 return AddNode(op, arraysize(buffer), buffer); |
572 | |
573 Node* NewNode(const Operator* op, Node* n1, Node* n2, Node* n3, Node* n4, | |
574 Node* n5) { | |
575 Node* buffer[] = {n1, n2, n3, n4, n5}; | |
576 return MakeNode(op, arraysize(buffer), buffer); | |
577 } | |
578 | |
579 Node* NewNode(const Operator* op, Node* n1, Node* n2, Node* n3, Node* n4, | |
580 Node* n5, Node* n6) { | |
581 Node* nodes[] = {n1, n2, n3, n4, n5, n6}; | |
582 return MakeNode(op, arraysize(nodes), nodes); | |
583 } | |
584 | |
585 Node* NewNode(const Operator* op, int value_input_count, | |
586 Node** value_inputs) { | |
587 return MakeNode(op, value_input_count, value_inputs); | |
588 } | 567 } |
589 | 568 |
590 private: | 569 private: |
570 Node* AddNode(const Operator* op, int input_count, Node** inputs); | |
591 Node* MakeNode(const Operator* op, int input_count, Node** inputs); | 571 Node* MakeNode(const Operator* op, int input_count, Node** inputs); |
592 BasicBlock* Use(Label* label); | 572 BasicBlock* Use(Label* label); |
593 BasicBlock* EnsureBlock(Label* label); | 573 BasicBlock* EnsureBlock(Label* label); |
594 | 574 |
595 Isolate* isolate_; | 575 Isolate* isolate_; |
596 Graph* graph_; | 576 Graph* graph_; |
597 Schedule* schedule_; | 577 Schedule* schedule_; |
598 MachineOperatorBuilder machine_; | 578 MachineOperatorBuilder machine_; |
599 CommonOperatorBuilder common_; | 579 CommonOperatorBuilder common_; |
600 CallDescriptor* call_descriptor_; | 580 CallDescriptor* call_descriptor_; |
601 Node** parameters_; | 581 Node** parameters_; |
602 BasicBlock* current_block_; | 582 BasicBlock* current_block_; |
603 | 583 |
604 DISALLOW_COPY_AND_ASSIGN(RawMachineAssembler); | 584 DISALLOW_COPY_AND_ASSIGN(RawMachineAssembler); |
605 }; | 585 }; |
606 | 586 |
607 } // namespace compiler | 587 } // namespace compiler |
608 } // namespace internal | 588 } // namespace internal |
609 } // namespace v8 | 589 } // namespace v8 |
610 | 590 |
611 #endif // V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ | 591 #endif // V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ |
OLD | NEW |