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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 public: \ | 396 public: \ |
397 void InitializeDescriptor(CodeStubDescriptor* descriptor) override; \ | 397 void InitializeDescriptor(CodeStubDescriptor* descriptor) override; \ |
398 Handle<Code> GenerateCode() override; \ | 398 Handle<Code> GenerateCode() override; \ |
399 DEFINE_CODE_STUB(NAME, SUPER) | 399 DEFINE_CODE_STUB(NAME, SUPER) |
400 | 400 |
401 #define DEFINE_TURBOFAN_CODE_STUB(NAME, SUPER) \ | 401 #define DEFINE_TURBOFAN_CODE_STUB(NAME, SUPER) \ |
402 public: \ | 402 public: \ |
403 void GenerateAssembly(CodeStubAssembler* assembler) const override; \ | 403 void GenerateAssembly(CodeStubAssembler* assembler) const override; \ |
404 DEFINE_CODE_STUB(NAME, SUPER) | 404 DEFINE_CODE_STUB(NAME, SUPER) |
405 | 405 |
406 #define DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(NAME, SUPER) \ | |
407 public: \ | |
408 static compiler::Node* Generate(CodeStubAssembler* assembler, \ | |
409 compiler::Node* left, compiler::Node* right, \ | |
410 compiler::Node* context); \ | |
411 void GenerateAssembly(CodeStubAssembler* assembler) const override { \ | |
412 assembler->Return(Generate(assembler, assembler->Parameter(0), \ | |
413 assembler->Parameter(1), \ | |
414 assembler->Parameter(2))); \ | |
415 } \ | |
416 DEFINE_CODE_STUB(NAME, SUPER) | |
417 | |
418 #define DEFINE_HANDLER_CODE_STUB(NAME, SUPER) \ | 406 #define DEFINE_HANDLER_CODE_STUB(NAME, SUPER) \ |
419 public: \ | 407 public: \ |
420 Handle<Code> GenerateCode() override; \ | 408 Handle<Code> GenerateCode() override; \ |
421 DEFINE_CODE_STUB(NAME, SUPER) | 409 DEFINE_CODE_STUB(NAME, SUPER) |
422 | 410 |
423 #define DEFINE_CALL_INTERFACE_DESCRIPTOR(NAME) \ | 411 #define DEFINE_CALL_INTERFACE_DESCRIPTOR(NAME) \ |
424 public: \ | 412 public: \ |
425 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { \ | 413 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { \ |
426 return NAME##Descriptor(isolate()); \ | 414 return NAME##Descriptor(isolate()); \ |
427 } | 415 } |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 | 675 |
688 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector); | 676 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector); |
689 DEFINE_TURBOFAN_CODE_STUB(StringLength, TurboFanCodeStub); | 677 DEFINE_TURBOFAN_CODE_STUB(StringLength, TurboFanCodeStub); |
690 }; | 678 }; |
691 | 679 |
692 class AddStub final : public TurboFanCodeStub { | 680 class AddStub final : public TurboFanCodeStub { |
693 public: | 681 public: |
694 explicit AddStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 682 explicit AddStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
695 | 683 |
696 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); | 684 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); |
697 DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(Add, TurboFanCodeStub); | 685 DEFINE_TURBOFAN_CODE_STUB(Add, TurboFanCodeStub); |
698 }; | 686 }; |
699 | 687 |
700 class SubtractStub final : public TurboFanCodeStub { | 688 class SubtractStub final : public TurboFanCodeStub { |
701 public: | 689 public: |
702 explicit SubtractStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 690 explicit SubtractStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
703 | 691 |
704 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); | 692 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); |
705 DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(Subtract, TurboFanCodeStub); | 693 DEFINE_TURBOFAN_CODE_STUB(Subtract, TurboFanCodeStub); |
706 }; | 694 }; |
707 | 695 |
708 class MultiplyStub final : public TurboFanCodeStub { | 696 class MultiplyStub final : public TurboFanCodeStub { |
709 public: | 697 public: |
710 explicit MultiplyStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 698 explicit MultiplyStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
711 | 699 |
712 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); | 700 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); |
713 DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(Multiply, TurboFanCodeStub); | 701 DEFINE_TURBOFAN_CODE_STUB(Multiply, TurboFanCodeStub); |
714 }; | 702 }; |
715 | 703 |
716 class DivideStub final : public TurboFanCodeStub { | 704 class DivideStub final : public TurboFanCodeStub { |
717 public: | 705 public: |
718 explicit DivideStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 706 explicit DivideStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
719 | 707 |
720 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); | 708 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); |
721 DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(Divide, TurboFanCodeStub); | 709 DEFINE_TURBOFAN_CODE_STUB(Divide, TurboFanCodeStub); |
722 }; | 710 }; |
723 | 711 |
724 class ModulusStub final : public TurboFanCodeStub { | 712 class ModulusStub final : public TurboFanCodeStub { |
725 public: | 713 public: |
726 explicit ModulusStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 714 explicit ModulusStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
727 | 715 |
728 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); | 716 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); |
729 DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(Modulus, TurboFanCodeStub); | 717 DEFINE_TURBOFAN_CODE_STUB(Modulus, TurboFanCodeStub); |
730 }; | 718 }; |
731 | 719 |
732 class ShiftRightStub final : public TurboFanCodeStub { | 720 class ShiftRightStub final : public TurboFanCodeStub { |
733 public: | 721 public: |
734 explicit ShiftRightStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 722 explicit ShiftRightStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
735 | 723 |
736 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); | 724 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); |
737 DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(ShiftRight, TurboFanCodeStub); | 725 DEFINE_TURBOFAN_CODE_STUB(ShiftRight, TurboFanCodeStub); |
738 }; | 726 }; |
739 | 727 |
740 class ShiftRightLogicalStub final : public TurboFanCodeStub { | 728 class ShiftRightLogicalStub final : public TurboFanCodeStub { |
741 public: | 729 public: |
742 explicit ShiftRightLogicalStub(Isolate* isolate) | 730 explicit ShiftRightLogicalStub(Isolate* isolate) |
743 : TurboFanCodeStub(isolate) {} | 731 : TurboFanCodeStub(isolate) {} |
744 | 732 |
745 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); | 733 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); |
746 DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(ShiftRightLogical, TurboFanCodeStub); | 734 DEFINE_TURBOFAN_CODE_STUB(ShiftRightLogical, TurboFanCodeStub); |
747 }; | 735 }; |
748 | 736 |
749 class ShiftLeftStub final : public TurboFanCodeStub { | 737 class ShiftLeftStub final : public TurboFanCodeStub { |
750 public: | 738 public: |
751 explicit ShiftLeftStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 739 explicit ShiftLeftStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
752 | 740 |
753 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); | 741 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); |
754 DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(ShiftLeft, TurboFanCodeStub); | 742 DEFINE_TURBOFAN_CODE_STUB(ShiftLeft, TurboFanCodeStub); |
755 }; | 743 }; |
756 | 744 |
757 class BitwiseAndStub final : public TurboFanCodeStub { | 745 class BitwiseAndStub final : public TurboFanCodeStub { |
758 public: | 746 public: |
759 explicit BitwiseAndStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 747 explicit BitwiseAndStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
760 | 748 |
761 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); | 749 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); |
762 DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(BitwiseAnd, TurboFanCodeStub); | 750 DEFINE_TURBOFAN_CODE_STUB(BitwiseAnd, TurboFanCodeStub); |
763 }; | 751 }; |
764 | 752 |
765 class BitwiseOrStub final : public TurboFanCodeStub { | 753 class BitwiseOrStub final : public TurboFanCodeStub { |
766 public: | 754 public: |
767 explicit BitwiseOrStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 755 explicit BitwiseOrStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
768 | 756 |
769 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); | 757 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); |
770 DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(BitwiseOr, TurboFanCodeStub); | 758 DEFINE_TURBOFAN_CODE_STUB(BitwiseOr, TurboFanCodeStub); |
771 }; | 759 }; |
772 | 760 |
773 class BitwiseXorStub final : public TurboFanCodeStub { | 761 class BitwiseXorStub final : public TurboFanCodeStub { |
774 public: | 762 public: |
775 explicit BitwiseXorStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 763 explicit BitwiseXorStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
776 | 764 |
777 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); | 765 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); |
778 DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(BitwiseXor, TurboFanCodeStub); | 766 DEFINE_TURBOFAN_CODE_STUB(BitwiseXor, TurboFanCodeStub); |
779 }; | 767 }; |
780 | 768 |
781 class IncStub final : public TurboFanCodeStub { | 769 class IncStub final : public TurboFanCodeStub { |
782 public: | 770 public: |
783 explicit IncStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 771 explicit IncStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
784 | 772 |
785 DEFINE_CALL_INTERFACE_DESCRIPTOR(CountOp); | 773 DEFINE_CALL_INTERFACE_DESCRIPTOR(CountOp); |
786 DEFINE_TURBOFAN_CODE_STUB(Inc, TurboFanCodeStub); | 774 DEFINE_TURBOFAN_CODE_STUB(Inc, TurboFanCodeStub); |
787 }; | 775 }; |
788 | 776 |
(...skipping 2417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3206 #undef DEFINE_HYDROGEN_CODE_STUB | 3194 #undef DEFINE_HYDROGEN_CODE_STUB |
3207 #undef DEFINE_CODE_STUB | 3195 #undef DEFINE_CODE_STUB |
3208 #undef DEFINE_CODE_STUB_BASE | 3196 #undef DEFINE_CODE_STUB_BASE |
3209 | 3197 |
3210 extern Representation RepresentationFromType(Type* type); | 3198 extern Representation RepresentationFromType(Type* type); |
3211 | 3199 |
3212 } // namespace internal | 3200 } // namespace internal |
3213 } // namespace v8 | 3201 } // namespace v8 |
3214 | 3202 |
3215 #endif // V8_CODE_STUBS_H_ | 3203 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |