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