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