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