| 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/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 V(StoreScriptContextField) \ | 94 V(StoreScriptContextField) \ |
| 95 V(StringAdd) \ | 95 V(StringAdd) \ |
| 96 V(ToBooleanIC) \ | 96 V(ToBooleanIC) \ |
| 97 V(TransitionElementsKind) \ | 97 V(TransitionElementsKind) \ |
| 98 V(KeyedLoadIC) \ | 98 V(KeyedLoadIC) \ |
| 99 V(LoadIC) \ | 99 V(LoadIC) \ |
| 100 /* TurboFanCodeStubs */ \ | 100 /* TurboFanCodeStubs */ \ |
| 101 V(AllocateHeapNumber) \ | 101 V(AllocateHeapNumber) \ |
| 102 V(AllocateMutableHeapNumber) \ | 102 V(AllocateMutableHeapNumber) \ |
| 103 V(StringLength) \ | 103 V(StringLength) \ |
| 104 V(LessThan) \ |
| 105 V(LessThanOrEqual) \ |
| 106 V(GreaterThan) \ |
| 107 V(GreaterThanOrEqual) \ |
| 104 V(StrictEqual) \ | 108 V(StrictEqual) \ |
| 105 V(StrictNotEqual) \ | 109 V(StrictNotEqual) \ |
| 106 V(StringEqual) \ | 110 V(StringEqual) \ |
| 107 V(StringNotEqual) \ | 111 V(StringNotEqual) \ |
| 108 V(ToBoolean) \ | 112 V(ToBoolean) \ |
| 109 /* IC Handler stubs */ \ | 113 /* IC Handler stubs */ \ |
| 110 V(ArrayBufferViewLoadField) \ | 114 V(ArrayBufferViewLoadField) \ |
| 111 V(LoadConstant) \ | 115 V(LoadConstant) \ |
| 112 V(LoadFastElement) \ | 116 V(LoadFastElement) \ |
| 113 V(LoadField) \ | 117 V(LoadField) \ |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 void Generate(MacroAssembler* masm) override; \ | 348 void Generate(MacroAssembler* masm) override; \ |
| 345 DEFINE_CODE_STUB(NAME, SUPER) | 349 DEFINE_CODE_STUB(NAME, SUPER) |
| 346 | 350 |
| 347 | 351 |
| 348 #define DEFINE_HYDROGEN_CODE_STUB(NAME, SUPER) \ | 352 #define DEFINE_HYDROGEN_CODE_STUB(NAME, SUPER) \ |
| 349 public: \ | 353 public: \ |
| 350 void InitializeDescriptor(CodeStubDescriptor* descriptor) override; \ | 354 void InitializeDescriptor(CodeStubDescriptor* descriptor) override; \ |
| 351 Handle<Code> GenerateCode() override; \ | 355 Handle<Code> GenerateCode() override; \ |
| 352 DEFINE_CODE_STUB(NAME, SUPER) | 356 DEFINE_CODE_STUB(NAME, SUPER) |
| 353 | 357 |
| 354 #define DEFINE_TURBOFAN_CODE_STUB(NAME, SUPER) \ | 358 #define DEFINE_TURBOFAN_CODE_STUB(NAME, SUPER) \ |
| 355 public: \ | 359 public: \ |
| 356 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { \ | 360 void GenerateAssembly(compiler::CodeStubAssembler* assembler) \ |
| 357 return DESC##Descriptor(isolate()); \ | 361 const override; \ |
| 358 }; \ | |
| 359 DEFINE_CODE_STUB(NAME, SUPER) | 362 DEFINE_CODE_STUB(NAME, SUPER) |
| 360 | 363 |
| 361 #define DEFINE_HANDLER_CODE_STUB(NAME, SUPER) \ | 364 #define DEFINE_HANDLER_CODE_STUB(NAME, SUPER) \ |
| 362 public: \ | 365 public: \ |
| 363 Handle<Code> GenerateCode() override; \ | 366 Handle<Code> GenerateCode() override; \ |
| 364 DEFINE_CODE_STUB(NAME, SUPER) | 367 DEFINE_CODE_STUB(NAME, SUPER) |
| 365 | 368 |
| 366 #define DEFINE_CALL_INTERFACE_DESCRIPTOR(NAME) \ | 369 #define DEFINE_CALL_INTERFACE_DESCRIPTOR(NAME) \ |
| 367 public: \ | 370 public: \ |
| 368 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { \ | 371 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { \ |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 | 625 |
| 623 | 626 |
| 624 class StringLengthStub : public TurboFanCodeStub { | 627 class StringLengthStub : public TurboFanCodeStub { |
| 625 public: | 628 public: |
| 626 explicit StringLengthStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 629 explicit StringLengthStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
| 627 | 630 |
| 628 Code::Kind GetCodeKind() const override { return Code::HANDLER; } | 631 Code::Kind GetCodeKind() const override { return Code::HANDLER; } |
| 629 InlineCacheState GetICState() const override { return MONOMORPHIC; } | 632 InlineCacheState GetICState() const override { return MONOMORPHIC; } |
| 630 ExtraICState GetExtraICState() const override { return Code::LOAD_IC; } | 633 ExtraICState GetExtraICState() const override { return Code::LOAD_IC; } |
| 631 | 634 |
| 632 void GenerateAssembly(compiler::CodeStubAssembler* assembler) const override; | 635 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector); |
| 636 DEFINE_TURBOFAN_CODE_STUB(StringLength, TurboFanCodeStub); |
| 637 }; |
| 633 | 638 |
| 634 DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector); | 639 class LessThanStub final : public TurboFanCodeStub { |
| 635 DEFINE_CODE_STUB(StringLength, TurboFanCodeStub); | 640 public: |
| 641 explicit LessThanStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
| 642 |
| 643 DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare); |
| 644 DEFINE_TURBOFAN_CODE_STUB(LessThan, TurboFanCodeStub); |
| 645 }; |
| 646 |
| 647 class LessThanOrEqualStub final : public TurboFanCodeStub { |
| 648 public: |
| 649 explicit LessThanOrEqualStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
| 650 |
| 651 DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare); |
| 652 DEFINE_TURBOFAN_CODE_STUB(LessThanOrEqual, TurboFanCodeStub); |
| 653 }; |
| 654 |
| 655 class GreaterThanStub final : public TurboFanCodeStub { |
| 656 public: |
| 657 explicit GreaterThanStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
| 658 |
| 659 DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare); |
| 660 DEFINE_TURBOFAN_CODE_STUB(GreaterThan, TurboFanCodeStub); |
| 661 }; |
| 662 |
| 663 class GreaterThanOrEqualStub final : public TurboFanCodeStub { |
| 664 public: |
| 665 explicit GreaterThanOrEqualStub(Isolate* isolate) |
| 666 : TurboFanCodeStub(isolate) {} |
| 667 |
| 668 DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare); |
| 669 DEFINE_TURBOFAN_CODE_STUB(GreaterThanOrEqual, TurboFanCodeStub); |
| 636 }; | 670 }; |
| 637 | 671 |
| 638 class StrictEqualStub final : public TurboFanCodeStub { | 672 class StrictEqualStub final : public TurboFanCodeStub { |
| 639 public: | 673 public: |
| 640 explicit StrictEqualStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 674 explicit StrictEqualStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
| 641 | 675 |
| 642 void GenerateAssembly(compiler::CodeStubAssembler* assembler) const final; | |
| 643 | |
| 644 DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare); | 676 DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare); |
| 645 DEFINE_CODE_STUB(StrictEqual, TurboFanCodeStub); | 677 DEFINE_TURBOFAN_CODE_STUB(StrictEqual, TurboFanCodeStub); |
| 646 }; | 678 }; |
| 647 | 679 |
| 648 class StrictNotEqualStub final : public TurboFanCodeStub { | 680 class StrictNotEqualStub final : public TurboFanCodeStub { |
| 649 public: | 681 public: |
| 650 explicit StrictNotEqualStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 682 explicit StrictNotEqualStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
| 651 | 683 |
| 652 void GenerateAssembly(compiler::CodeStubAssembler* assembler) const final; | |
| 653 | |
| 654 DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare); | 684 DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare); |
| 655 DEFINE_CODE_STUB(StrictNotEqual, TurboFanCodeStub); | 685 DEFINE_TURBOFAN_CODE_STUB(StrictNotEqual, TurboFanCodeStub); |
| 656 }; | 686 }; |
| 657 | 687 |
| 658 class StringEqualStub final : public TurboFanCodeStub { | 688 class StringEqualStub final : public TurboFanCodeStub { |
| 659 public: | 689 public: |
| 660 explicit StringEqualStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 690 explicit StringEqualStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
| 661 | 691 |
| 662 void GenerateAssembly(compiler::CodeStubAssembler* assembler) const final; | |
| 663 | |
| 664 DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare); | 692 DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare); |
| 665 DEFINE_CODE_STUB(StringEqual, TurboFanCodeStub); | 693 DEFINE_TURBOFAN_CODE_STUB(StringEqual, TurboFanCodeStub); |
| 666 }; | 694 }; |
| 667 | 695 |
| 668 class StringNotEqualStub final : public TurboFanCodeStub { | 696 class StringNotEqualStub final : public TurboFanCodeStub { |
| 669 public: | 697 public: |
| 670 explicit StringNotEqualStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 698 explicit StringNotEqualStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
| 671 | 699 |
| 672 void GenerateAssembly(compiler::CodeStubAssembler* assembler) const final; | |
| 673 | |
| 674 DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare); | 700 DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare); |
| 675 DEFINE_CODE_STUB(StringNotEqual, TurboFanCodeStub); | 701 DEFINE_TURBOFAN_CODE_STUB(StringNotEqual, TurboFanCodeStub); |
| 676 }; | 702 }; |
| 677 | 703 |
| 678 class ToBooleanStub final : public TurboFanCodeStub { | 704 class ToBooleanStub final : public TurboFanCodeStub { |
| 679 public: | 705 public: |
| 680 explicit ToBooleanStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} | 706 explicit ToBooleanStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} |
| 681 | 707 |
| 682 void GenerateAssembly(compiler::CodeStubAssembler* assembler) const final; | |
| 683 | |
| 684 DEFINE_CALL_INTERFACE_DESCRIPTOR(ToBoolean); | 708 DEFINE_CALL_INTERFACE_DESCRIPTOR(ToBoolean); |
| 685 DEFINE_CODE_STUB(ToBoolean, TurboFanCodeStub); | 709 DEFINE_TURBOFAN_CODE_STUB(ToBoolean, TurboFanCodeStub); |
| 686 }; | 710 }; |
| 687 | 711 |
| 688 enum StringAddFlags { | 712 enum StringAddFlags { |
| 689 // Omit both parameter checks. | 713 // Omit both parameter checks. |
| 690 STRING_ADD_CHECK_NONE = 0, | 714 STRING_ADD_CHECK_NONE = 0, |
| 691 // Check left parameter. | 715 // Check left parameter. |
| 692 STRING_ADD_CHECK_LEFT = 1 << 0, | 716 STRING_ADD_CHECK_LEFT = 1 << 0, |
| 693 // Check right parameter. | 717 // Check right parameter. |
| 694 STRING_ADD_CHECK_RIGHT = 1 << 1, | 718 STRING_ADD_CHECK_RIGHT = 1 << 1, |
| 695 // Check both parameters. | 719 // Check both parameters. |
| (...skipping 2231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2927 #undef DEFINE_HYDROGEN_CODE_STUB | 2951 #undef DEFINE_HYDROGEN_CODE_STUB |
| 2928 #undef DEFINE_CODE_STUB | 2952 #undef DEFINE_CODE_STUB |
| 2929 #undef DEFINE_CODE_STUB_BASE | 2953 #undef DEFINE_CODE_STUB_BASE |
| 2930 | 2954 |
| 2931 extern Representation RepresentationFromType(Type* type); | 2955 extern Representation RepresentationFromType(Type* type); |
| 2932 | 2956 |
| 2933 } // namespace internal | 2957 } // namespace internal |
| 2934 } // namespace v8 | 2958 } // namespace v8 |
| 2935 | 2959 |
| 2936 #endif // V8_CODE_STUBS_H_ | 2960 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |