OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_CODE_STUBS_H_ | 5 #ifndef V8_CODE_STUBS_H_ |
6 #define V8_CODE_STUBS_H_ | 6 #define V8_CODE_STUBS_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/assembler.h" | 9 #include "src/assembler.h" |
10 #include "src/code-stub-assembler.h" | 10 #include "src/code-stub-assembler.h" |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 public: \ | 394 public: \ |
395 void InitializeDescriptor(CodeStubDescriptor* descriptor) override; \ | 395 void InitializeDescriptor(CodeStubDescriptor* descriptor) override; \ |
396 Handle<Code> GenerateCode() override; \ | 396 Handle<Code> GenerateCode() override; \ |
397 DEFINE_CODE_STUB(NAME, SUPER) | 397 DEFINE_CODE_STUB(NAME, SUPER) |
398 | 398 |
399 #define DEFINE_TURBOFAN_CODE_STUB(NAME, SUPER) \ | 399 #define DEFINE_TURBOFAN_CODE_STUB(NAME, SUPER) \ |
400 public: \ | 400 public: \ |
401 void GenerateAssembly(CodeStubAssembler* assembler) const override; \ | 401 void GenerateAssembly(CodeStubAssembler* assembler) const override; \ |
402 DEFINE_CODE_STUB(NAME, SUPER) | 402 DEFINE_CODE_STUB(NAME, SUPER) |
403 | 403 |
| 404 #define DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(NAME, SUPER) \ |
| 405 public: \ |
| 406 static compiler::Node* Generate(CodeStubAssembler* assembler, \ |
| 407 compiler::Node* left, compiler::Node* right, \ |
| 408 compiler::Node* context); \ |
| 409 void GenerateAssembly(CodeStubAssembler* assembler) const override { \ |
| 410 assembler->Return(Generate(assembler, assembler->Parameter(0), \ |
| 411 assembler->Parameter(1), \ |
| 412 assembler->Parameter(2))); \ |
| 413 } \ |
| 414 DEFINE_CODE_STUB(NAME, SUPER) |
| 415 |
404 #define DEFINE_HANDLER_CODE_STUB(NAME, SUPER) \ | 416 #define DEFINE_HANDLER_CODE_STUB(NAME, SUPER) \ |
405 public: \ | 417 public: \ |
406 Handle<Code> GenerateCode() override; \ | 418 Handle<Code> GenerateCode() override; \ |
407 DEFINE_CODE_STUB(NAME, SUPER) | 419 DEFINE_CODE_STUB(NAME, SUPER) |
408 | 420 |
409 #define DEFINE_CALL_INTERFACE_DESCRIPTOR(NAME) \ | 421 #define DEFINE_CALL_INTERFACE_DESCRIPTOR(NAME) \ |
410 public: \ | 422 public: \ |
411 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { \ | 423 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { \ |
412 return NAME##Descriptor(isolate()); \ | 424 return NAME##Descriptor(isolate()); \ |
413 } | 425 } |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 | 685 |
674 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector); | 686 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector); |
675 DEFINE_TURBOFAN_CODE_STUB(StringLength, TurboFanCodeStub); | 687 DEFINE_TURBOFAN_CODE_STUB(StringLength, TurboFanCodeStub); |
676 }; | 688 }; |
677 | 689 |
678 class AddStub final : public TurboFanCodeStub { | 690 class AddStub final : public TurboFanCodeStub { |
679 public: | 691 public: |
680 explicit AddStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 692 explicit AddStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
681 | 693 |
682 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); | 694 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); |
683 DEFINE_TURBOFAN_CODE_STUB(Add, TurboFanCodeStub); | 695 DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(Add, TurboFanCodeStub); |
684 }; | 696 }; |
685 | 697 |
686 class SubtractStub final : public TurboFanCodeStub { | 698 class SubtractStub final : public TurboFanCodeStub { |
687 public: | 699 public: |
688 explicit SubtractStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 700 explicit SubtractStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
689 | 701 |
690 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); | 702 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); |
691 DEFINE_TURBOFAN_CODE_STUB(Subtract, TurboFanCodeStub); | 703 DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(Subtract, TurboFanCodeStub); |
692 }; | 704 }; |
693 | 705 |
694 class MultiplyStub final : public TurboFanCodeStub { | 706 class MultiplyStub final : public TurboFanCodeStub { |
695 public: | 707 public: |
696 explicit MultiplyStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 708 explicit MultiplyStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
697 | 709 |
698 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); | 710 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); |
699 DEFINE_TURBOFAN_CODE_STUB(Multiply, TurboFanCodeStub); | 711 DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(Multiply, TurboFanCodeStub); |
700 }; | 712 }; |
701 | 713 |
702 class DivideStub final : public TurboFanCodeStub { | 714 class DivideStub final : public TurboFanCodeStub { |
703 public: | 715 public: |
704 explicit DivideStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 716 explicit DivideStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
705 | 717 |
706 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); | 718 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); |
707 DEFINE_TURBOFAN_CODE_STUB(Divide, TurboFanCodeStub); | 719 DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(Divide, TurboFanCodeStub); |
708 }; | 720 }; |
709 | 721 |
710 class ModulusStub final : public TurboFanCodeStub { | 722 class ModulusStub final : public TurboFanCodeStub { |
711 public: | 723 public: |
712 explicit ModulusStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 724 explicit ModulusStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
713 | 725 |
714 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); | 726 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); |
715 DEFINE_TURBOFAN_CODE_STUB(Modulus, TurboFanCodeStub); | 727 DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(Modulus, TurboFanCodeStub); |
716 }; | 728 }; |
717 | 729 |
718 class ShiftRightStub final : public TurboFanCodeStub { | 730 class ShiftRightStub final : public TurboFanCodeStub { |
719 public: | 731 public: |
720 explicit ShiftRightStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 732 explicit ShiftRightStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
721 | 733 |
722 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); | 734 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); |
723 DEFINE_TURBOFAN_CODE_STUB(ShiftRight, TurboFanCodeStub); | 735 DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(ShiftRight, TurboFanCodeStub); |
724 }; | 736 }; |
725 | 737 |
726 class ShiftRightLogicalStub final : public TurboFanCodeStub { | 738 class ShiftRightLogicalStub final : public TurboFanCodeStub { |
727 public: | 739 public: |
728 explicit ShiftRightLogicalStub(Isolate* isolate) | 740 explicit ShiftRightLogicalStub(Isolate* isolate) |
729 : TurboFanCodeStub(isolate) {} | 741 : TurboFanCodeStub(isolate) {} |
730 | 742 |
731 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); | 743 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); |
732 DEFINE_TURBOFAN_CODE_STUB(ShiftRightLogical, TurboFanCodeStub); | 744 DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(ShiftRightLogical, TurboFanCodeStub); |
733 }; | 745 }; |
734 | 746 |
735 class ShiftLeftStub final : public TurboFanCodeStub { | 747 class ShiftLeftStub final : public TurboFanCodeStub { |
736 public: | 748 public: |
737 explicit ShiftLeftStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 749 explicit ShiftLeftStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
738 | 750 |
739 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); | 751 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); |
740 DEFINE_TURBOFAN_CODE_STUB(ShiftLeft, TurboFanCodeStub); | 752 DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(ShiftLeft, TurboFanCodeStub); |
741 }; | 753 }; |
742 | 754 |
743 class BitwiseAndStub final : public TurboFanCodeStub { | 755 class BitwiseAndStub final : public TurboFanCodeStub { |
744 public: | 756 public: |
745 explicit BitwiseAndStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 757 explicit BitwiseAndStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
746 | 758 |
747 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); | 759 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); |
748 DEFINE_TURBOFAN_CODE_STUB(BitwiseAnd, TurboFanCodeStub); | 760 DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(BitwiseAnd, TurboFanCodeStub); |
749 }; | 761 }; |
750 | 762 |
751 class BitwiseOrStub final : public TurboFanCodeStub { | 763 class BitwiseOrStub final : public TurboFanCodeStub { |
752 public: | 764 public: |
753 explicit BitwiseOrStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 765 explicit BitwiseOrStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
754 | 766 |
755 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); | 767 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); |
756 DEFINE_TURBOFAN_CODE_STUB(BitwiseOr, TurboFanCodeStub); | 768 DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(BitwiseOr, TurboFanCodeStub); |
757 }; | 769 }; |
758 | 770 |
759 class BitwiseXorStub final : public TurboFanCodeStub { | 771 class BitwiseXorStub final : public TurboFanCodeStub { |
760 public: | 772 public: |
761 explicit BitwiseXorStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 773 explicit BitwiseXorStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
762 | 774 |
763 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); | 775 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); |
764 DEFINE_TURBOFAN_CODE_STUB(BitwiseXor, TurboFanCodeStub); | 776 DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(BitwiseXor, TurboFanCodeStub); |
765 }; | 777 }; |
766 | 778 |
767 class LessThanStub final : public TurboFanCodeStub { | 779 class LessThanStub final : public TurboFanCodeStub { |
768 public: | 780 public: |
769 explicit LessThanStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 781 explicit LessThanStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
770 | 782 |
771 DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare); | 783 DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare); |
772 DEFINE_TURBOFAN_CODE_STUB(LessThan, TurboFanCodeStub); | 784 DEFINE_TURBOFAN_CODE_STUB(LessThan, TurboFanCodeStub); |
773 }; | 785 }; |
774 | 786 |
(...skipping 2401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3176 #undef DEFINE_HYDROGEN_CODE_STUB | 3188 #undef DEFINE_HYDROGEN_CODE_STUB |
3177 #undef DEFINE_CODE_STUB | 3189 #undef DEFINE_CODE_STUB |
3178 #undef DEFINE_CODE_STUB_BASE | 3190 #undef DEFINE_CODE_STUB_BASE |
3179 | 3191 |
3180 extern Representation RepresentationFromType(Type* type); | 3192 extern Representation RepresentationFromType(Type* type); |
3181 | 3193 |
3182 } // namespace internal | 3194 } // namespace internal |
3183 } // namespace v8 | 3195 } // namespace v8 |
3184 | 3196 |
3185 #endif // V8_CODE_STUBS_H_ | 3197 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |