| 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 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 class HydrogenCodeStub : public CodeStub { | 441 class HydrogenCodeStub : public CodeStub { |
| 442 public: | 442 public: |
| 443 enum InitializationState { | 443 enum InitializationState { |
| 444 UNINITIALIZED, | 444 UNINITIALIZED, |
| 445 INITIALIZED | 445 INITIALIZED |
| 446 }; | 446 }; |
| 447 | 447 |
| 448 explicit HydrogenCodeStub(Isolate* isolate, | 448 explicit HydrogenCodeStub(Isolate* isolate, |
| 449 InitializationState state = INITIALIZED) | 449 InitializationState state = INITIALIZED) |
| 450 : CodeStub(isolate) { | 450 : CodeStub(isolate) { |
| 451 is_uninitialized_ = (state == UNINITIALIZED); | 451 minor_key_ = IsMissBits::encode(state == UNINITIALIZED); |
| 452 } | 452 } |
| 453 | 453 |
| 454 virtual Code::Kind GetCodeKind() const { return Code::STUB; } | 454 virtual Code::Kind GetCodeKind() const { return Code::STUB; } |
| 455 | 455 |
| 456 CodeStubInterfaceDescriptor* GetInterfaceDescriptor() { | 456 CodeStubInterfaceDescriptor* GetInterfaceDescriptor() { |
| 457 return isolate()->code_stub_interface_descriptor(MajorKey()); | 457 return isolate()->code_stub_interface_descriptor(MajorKey()); |
| 458 } | 458 } |
| 459 | 459 |
| 460 bool IsUninitialized() { return is_uninitialized_; } | |
| 461 | |
| 462 template<class SubClass> | 460 template<class SubClass> |
| 463 static Handle<Code> GetUninitialized(Isolate* isolate) { | 461 static Handle<Code> GetUninitialized(Isolate* isolate) { |
| 464 SubClass::GenerateAheadOfTime(isolate); | 462 SubClass::GenerateAheadOfTime(isolate); |
| 465 return SubClass().GetCode(isolate); | 463 return SubClass().GetCode(isolate); |
| 466 } | 464 } |
| 467 | 465 |
| 468 virtual void InitializeInterfaceDescriptor( | 466 virtual void InitializeInterfaceDescriptor( |
| 469 CodeStubInterfaceDescriptor* descriptor) = 0; | 467 CodeStubInterfaceDescriptor* descriptor) = 0; |
| 470 | 468 |
| 471 // Retrieve the code for the stub. Generate the code if needed. | 469 // Retrieve the code for the stub. Generate the code if needed. |
| 472 virtual Handle<Code> GenerateCode() = 0; | 470 virtual Handle<Code> GenerateCode() = 0; |
| 473 | 471 |
| 474 virtual int NotMissMinorKey() const = 0; | 472 bool IsUninitialized() const { return IsMissBits::decode(minor_key_); } |
| 473 |
| 474 // TODO(yangguo): we use this temporarily to construct the minor key. |
| 475 // We want to remove NotMissMinorKey methods one by one and eventually |
| 476 // remove HydrogenStub::MinorKey and turn CodeStub::MinorKey into a |
| 477 // non-virtual method that directly returns minor_key_. |
| 478 virtual int NotMissMinorKey() const { |
| 479 return SubMinorKeyBits::decode(minor_key_); |
| 480 } |
| 475 | 481 |
| 476 Handle<Code> GenerateLightweightMissCode(); | 482 Handle<Code> GenerateLightweightMissCode(); |
| 477 | 483 |
| 478 template<class StateType> | 484 template<class StateType> |
| 479 void TraceTransition(StateType from, StateType to); | 485 void TraceTransition(StateType from, StateType to); |
| 480 | 486 |
| 487 protected: |
| 488 void set_sub_minor_key(uint32_t key) { |
| 489 minor_key_ = SubMinorKeyBits::update(minor_key_, key); |
| 490 } |
| 491 |
| 492 uint32_t sub_minor_key() const { return SubMinorKeyBits::decode(minor_key_); } |
| 493 |
| 494 static const int kSubMinorKeyBits = kStubMinorKeyBits - 1; |
| 495 |
| 481 private: | 496 private: |
| 482 class MinorKeyBits: public BitField<int, 0, kStubMinorKeyBits - 1> {}; | 497 class SubMinorKeyBits : public BitField<int, 0, kSubMinorKeyBits> {}; |
| 483 class IsMissBits: public BitField<bool, kStubMinorKeyBits - 1, 1> {}; | 498 class IsMissBits : public BitField<bool, kSubMinorKeyBits, 1> {}; |
| 484 | 499 |
| 485 void GenerateLightweightMiss(MacroAssembler* masm); | 500 void GenerateLightweightMiss(MacroAssembler* masm); |
| 486 virtual uint32_t MinorKey() const { | 501 virtual uint32_t MinorKey() const { |
| 487 return IsMissBits::encode(is_uninitialized_) | | 502 return IsMissBits::encode(IsUninitialized()) | |
| 488 MinorKeyBits::encode(NotMissMinorKey()); | 503 SubMinorKeyBits::encode(NotMissMinorKey()); |
| 489 } | 504 } |
| 490 | |
| 491 bool is_uninitialized_; | |
| 492 }; | 505 }; |
| 493 | 506 |
| 494 | 507 |
| 495 // Helper interface to prepare to/restore after making runtime calls. | 508 // Helper interface to prepare to/restore after making runtime calls. |
| 496 class RuntimeCallHelper { | 509 class RuntimeCallHelper { |
| 497 public: | 510 public: |
| 498 virtual ~RuntimeCallHelper() {} | 511 virtual ~RuntimeCallHelper() {} |
| 499 | 512 |
| 500 virtual void BeforeCall(MacroAssembler* masm) const = 0; | 513 virtual void BeforeCall(MacroAssembler* masm) const = 0; |
| 501 | 514 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 virtual void InitializeInterfaceDescriptor( | 578 virtual void InitializeInterfaceDescriptor( |
| 566 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 579 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| 567 | 580 |
| 568 static void InstallDescriptors(Isolate* isolate) { | 581 static void InstallDescriptors(Isolate* isolate) { |
| 569 ToNumberStub stub(isolate); | 582 ToNumberStub stub(isolate); |
| 570 stub.InitializeInterfaceDescriptor( | 583 stub.InitializeInterfaceDescriptor( |
| 571 isolate->code_stub_interface_descriptor(CodeStub::ToNumber)); | 584 isolate->code_stub_interface_descriptor(CodeStub::ToNumber)); |
| 572 } | 585 } |
| 573 | 586 |
| 574 private: | 587 private: |
| 575 Major MajorKey() const { return ToNumber; } | 588 virtual Major MajorKey() const V8_OVERRIDE { return ToNumber; } |
| 576 int NotMissMinorKey() const { return 0; } | |
| 577 }; | 589 }; |
| 578 | 590 |
| 579 | 591 |
| 580 class NumberToStringStub V8_FINAL : public HydrogenCodeStub { | 592 class NumberToStringStub V8_FINAL : public HydrogenCodeStub { |
| 581 public: | 593 public: |
| 582 explicit NumberToStringStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} | 594 explicit NumberToStringStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} |
| 583 | 595 |
| 584 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 596 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
| 585 | 597 |
| 586 virtual void InitializeInterfaceDescriptor( | 598 virtual void InitializeInterfaceDescriptor( |
| 587 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 599 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| 588 | 600 |
| 589 static void InstallDescriptors(Isolate* isolate); | 601 static void InstallDescriptors(Isolate* isolate); |
| 590 | 602 |
| 591 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 603 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
| 592 static const int kNumber = 0; | 604 static const int kNumber = 0; |
| 593 | 605 |
| 594 private: | 606 private: |
| 595 virtual Major MajorKey() const V8_OVERRIDE { return NumberToString; } | 607 virtual Major MajorKey() const V8_OVERRIDE { return NumberToString; } |
| 596 virtual int NotMissMinorKey() const V8_OVERRIDE { return 0; } | |
| 597 }; | 608 }; |
| 598 | 609 |
| 599 | 610 |
| 600 class FastNewClosureStub : public HydrogenCodeStub { | 611 class FastNewClosureStub : public HydrogenCodeStub { |
| 601 public: | 612 public: |
| 602 FastNewClosureStub(Isolate* isolate, | 613 FastNewClosureStub(Isolate* isolate, StrictMode strict_mode, |
| 603 StrictMode strict_mode, | |
| 604 bool is_generator) | 614 bool is_generator) |
| 605 : HydrogenCodeStub(isolate), | 615 : HydrogenCodeStub(isolate) { |
| 606 strict_mode_(strict_mode), | 616 set_sub_minor_key(StrictModeBits::encode(strict_mode) | |
| 607 is_generator_(is_generator) { } | 617 IsGeneratorBits::encode(is_generator)); |
| 618 } |
| 608 | 619 |
| 609 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 620 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
| 610 | 621 |
| 611 virtual void InitializeInterfaceDescriptor( | 622 virtual void InitializeInterfaceDescriptor( |
| 612 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 623 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| 613 | 624 |
| 614 static void InstallDescriptors(Isolate* isolate); | 625 static void InstallDescriptors(Isolate* isolate); |
| 615 | 626 |
| 616 StrictMode strict_mode() const { return strict_mode_; } | 627 StrictMode strict_mode() const { |
| 617 bool is_generator() const { return is_generator_; } | 628 return StrictModeBits::decode(sub_minor_key()); |
| 629 } |
| 630 |
| 631 bool is_generator() const { return IsGeneratorBits::decode(sub_minor_key()); } |
| 618 | 632 |
| 619 private: | 633 private: |
| 620 class StrictModeBits: public BitField<bool, 0, 1> {}; | 634 virtual Major MajorKey() const V8_OVERRIDE { return FastNewClosure; } |
| 621 class IsGeneratorBits: public BitField<bool, 1, 1> {}; | |
| 622 | 635 |
| 623 Major MajorKey() const { return FastNewClosure; } | 636 class StrictModeBits : public BitField<StrictMode, 0, 1> {}; |
| 624 int NotMissMinorKey() const { | 637 class IsGeneratorBits : public BitField<bool, 1, 1> {}; |
| 625 return StrictModeBits::encode(strict_mode_ == STRICT) | | |
| 626 IsGeneratorBits::encode(is_generator_); | |
| 627 } | |
| 628 | 638 |
| 629 StrictMode strict_mode_; | 639 DISALLOW_COPY_AND_ASSIGN(FastNewClosureStub); |
| 630 bool is_generator_; | |
| 631 }; | 640 }; |
| 632 | 641 |
| 633 | 642 |
| 634 class FastNewContextStub V8_FINAL : public HydrogenCodeStub { | 643 class FastNewContextStub V8_FINAL : public HydrogenCodeStub { |
| 635 public: | 644 public: |
| 636 static const int kMaximumSlots = 64; | 645 static const int kMaximumSlots = 64; |
| 637 | 646 |
| 638 FastNewContextStub(Isolate* isolate, int slots) | 647 FastNewContextStub(Isolate* isolate, int slots) |
| 639 : HydrogenCodeStub(isolate), slots_(slots) { | 648 : HydrogenCodeStub(isolate), slots_(slots) { |
| 640 DCHECK(slots_ > 0 && slots_ <= kMaximumSlots); | 649 DCHECK(slots_ > 0 && slots_ <= kMaximumSlots); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 virtual void InitializeInterfaceDescriptor( | 685 virtual void InitializeInterfaceDescriptor( |
| 677 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 686 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| 678 | 687 |
| 679 static void InstallDescriptors(Isolate* isolate); | 688 static void InstallDescriptors(Isolate* isolate); |
| 680 | 689 |
| 681 private: | 690 private: |
| 682 AllocationSiteMode allocation_site_mode_; | 691 AllocationSiteMode allocation_site_mode_; |
| 683 | 692 |
| 684 class AllocationSiteModeBits: public BitField<AllocationSiteMode, 0, 1> {}; | 693 class AllocationSiteModeBits: public BitField<AllocationSiteMode, 0, 1> {}; |
| 685 // Ensure data fits within available bits. | 694 // Ensure data fits within available bits. |
| 686 Major MajorKey() const { return FastCloneShallowArray; } | 695 virtual Major MajorKey() const V8_OVERRIDE { return FastCloneShallowArray; } |
| 687 int NotMissMinorKey() const { | 696 int NotMissMinorKey() const { |
| 688 return AllocationSiteModeBits::encode(allocation_site_mode_); | 697 return AllocationSiteModeBits::encode(allocation_site_mode_); |
| 689 } | 698 } |
| 690 }; | 699 }; |
| 691 | 700 |
| 692 | 701 |
| 693 class FastCloneShallowObjectStub : public HydrogenCodeStub { | 702 class FastCloneShallowObjectStub : public HydrogenCodeStub { |
| 694 public: | 703 public: |
| 695 // Maximum number of properties in copied object. | 704 // Maximum number of properties in copied object. |
| 696 static const int kMaximumClonedProperties = 6; | 705 static const int kMaximumClonedProperties = 6; |
| 697 | 706 |
| 698 FastCloneShallowObjectStub(Isolate* isolate, int length) | 707 FastCloneShallowObjectStub(Isolate* isolate, int length) |
| 699 : HydrogenCodeStub(isolate), length_(length) { | 708 : HydrogenCodeStub(isolate), length_(length) { |
| 700 DCHECK_GE(length_, 0); | 709 DCHECK_GE(length_, 0); |
| 701 DCHECK_LE(length_, kMaximumClonedProperties); | 710 DCHECK_LE(length_, kMaximumClonedProperties); |
| 702 } | 711 } |
| 703 | 712 |
| 704 int length() const { return length_; } | 713 int length() const { return length_; } |
| 705 | 714 |
| 706 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 715 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
| 707 | 716 |
| 708 virtual void InitializeInterfaceDescriptor( | 717 virtual void InitializeInterfaceDescriptor( |
| 709 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 718 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| 710 | 719 |
| 711 private: | 720 private: |
| 712 int length_; | 721 int length_; |
| 713 | 722 |
| 714 Major MajorKey() const { return FastCloneShallowObject; } | 723 virtual Major MajorKey() const V8_OVERRIDE { return FastCloneShallowObject; } |
| 715 int NotMissMinorKey() const { return length_; } | 724 int NotMissMinorKey() const { return length_; } |
| 716 | 725 |
| 717 DISALLOW_COPY_AND_ASSIGN(FastCloneShallowObjectStub); | 726 DISALLOW_COPY_AND_ASSIGN(FastCloneShallowObjectStub); |
| 718 }; | 727 }; |
| 719 | 728 |
| 720 | 729 |
| 721 class CreateAllocationSiteStub : public HydrogenCodeStub { | 730 class CreateAllocationSiteStub : public HydrogenCodeStub { |
| 722 public: | 731 public: |
| 723 explicit CreateAllocationSiteStub(Isolate* isolate) | 732 explicit CreateAllocationSiteStub(Isolate* isolate) |
| 724 : HydrogenCodeStub(isolate) { } | 733 : HydrogenCodeStub(isolate) { } |
| 725 | 734 |
| 726 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 735 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
| 727 | 736 |
| 728 static void GenerateAheadOfTime(Isolate* isolate); | 737 static void GenerateAheadOfTime(Isolate* isolate); |
| 729 | 738 |
| 730 virtual void InitializeInterfaceDescriptor( | 739 virtual void InitializeInterfaceDescriptor( |
| 731 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 740 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| 732 | 741 |
| 733 private: | 742 private: |
| 734 Major MajorKey() const { return CreateAllocationSite; } | 743 virtual Major MajorKey() const V8_OVERRIDE { return CreateAllocationSite; } |
| 735 int NotMissMinorKey() const { return 0; } | |
| 736 | 744 |
| 737 DISALLOW_COPY_AND_ASSIGN(CreateAllocationSiteStub); | 745 DISALLOW_COPY_AND_ASSIGN(CreateAllocationSiteStub); |
| 738 }; | 746 }; |
| 739 | 747 |
| 740 | 748 |
| 741 class InstanceofStub: public PlatformCodeStub { | 749 class InstanceofStub: public PlatformCodeStub { |
| 742 public: | 750 public: |
| 743 enum Flags { | 751 enum Flags { |
| 744 kNoFlags = 0, | 752 kNoFlags = 0, |
| 745 kArgsInRegisters = 1 << 0, | 753 kArgsInRegisters = 1 << 0, |
| 746 kCallSiteInlineCheck = 1 << 1, | 754 kCallSiteInlineCheck = 1 << 1, |
| 747 kReturnTrueFalseObject = 1 << 2 | 755 kReturnTrueFalseObject = 1 << 2 |
| 748 }; | 756 }; |
| 749 | 757 |
| 750 InstanceofStub(Isolate* isolate, Flags flags) : PlatformCodeStub(isolate) { | 758 InstanceofStub(Isolate* isolate, Flags flags) : PlatformCodeStub(isolate) { |
| 751 minor_key_ = FlagBits::encode(flags); | 759 minor_key_ = FlagBits::encode(flags); |
| 752 } | 760 } |
| 753 | 761 |
| 754 void Generate(MacroAssembler* masm); | 762 void Generate(MacroAssembler* masm); |
| 755 | 763 |
| 756 static Register left(); | 764 static Register left(); |
| 757 static Register right(); | 765 static Register right(); |
| 758 | 766 |
| 759 virtual void InitializeInterfaceDescriptor( | 767 virtual void InitializeInterfaceDescriptor( |
| 760 CodeStubInterfaceDescriptor* descriptor); | 768 CodeStubInterfaceDescriptor* descriptor); |
| 761 | 769 |
| 762 private: | 770 private: |
| 763 Major MajorKey() const { return Instanceof; } | 771 virtual Major MajorKey() const V8_OVERRIDE { return Instanceof; } |
| 764 | 772 |
| 765 Flags flags() const { return FlagBits::decode(minor_key_); } | 773 Flags flags() const { return FlagBits::decode(minor_key_); } |
| 766 | 774 |
| 767 bool HasArgsInRegisters() const { return (flags() & kArgsInRegisters) != 0; } | 775 bool HasArgsInRegisters() const { return (flags() & kArgsInRegisters) != 0; } |
| 768 | 776 |
| 769 bool HasCallSiteInlineCheck() const { | 777 bool HasCallSiteInlineCheck() const { |
| 770 return (flags() & kCallSiteInlineCheck) != 0; | 778 return (flags() & kCallSiteInlineCheck) != 0; |
| 771 } | 779 } |
| 772 | 780 |
| 773 bool ReturnTrueFalseObject() const { | 781 bool ReturnTrueFalseObject() const { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 792 class ArrayConstructorStub: public PlatformCodeStub { | 800 class ArrayConstructorStub: public PlatformCodeStub { |
| 793 public: | 801 public: |
| 794 enum ArgumentCountKey { ANY, NONE, ONE, MORE_THAN_ONE }; | 802 enum ArgumentCountKey { ANY, NONE, ONE, MORE_THAN_ONE }; |
| 795 ArrayConstructorStub(Isolate* isolate, int argument_count); | 803 ArrayConstructorStub(Isolate* isolate, int argument_count); |
| 796 | 804 |
| 797 explicit ArrayConstructorStub(Isolate* isolate); | 805 explicit ArrayConstructorStub(Isolate* isolate); |
| 798 | 806 |
| 799 void Generate(MacroAssembler* masm); | 807 void Generate(MacroAssembler* masm); |
| 800 | 808 |
| 801 private: | 809 private: |
| 802 virtual CodeStub::Major MajorKey() const { return ArrayConstructor; } | 810 virtual Major MajorKey() const V8_OVERRIDE { return ArrayConstructor; } |
| 803 | 811 |
| 804 ArgumentCountKey argument_count() const { | 812 ArgumentCountKey argument_count() const { |
| 805 return ArgumentCountBits::decode(minor_key_); | 813 return ArgumentCountBits::decode(minor_key_); |
| 806 } | 814 } |
| 807 | 815 |
| 808 void GenerateDispatchToArrayStub(MacroAssembler* masm, | 816 void GenerateDispatchToArrayStub(MacroAssembler* masm, |
| 809 AllocationSiteOverrideMode mode); | 817 AllocationSiteOverrideMode mode); |
| 810 | 818 |
| 811 virtual void PrintName(OStream& os) const V8_OVERRIDE; // NOLINT | 819 virtual void PrintName(OStream& os) const V8_OVERRIDE; // NOLINT |
| 812 | 820 |
| 813 class ArgumentCountBits : public BitField<ArgumentCountKey, 0, 2> {}; | 821 class ArgumentCountBits : public BitField<ArgumentCountKey, 0, 2> {}; |
| 814 | 822 |
| 815 DISALLOW_COPY_AND_ASSIGN(ArrayConstructorStub); | 823 DISALLOW_COPY_AND_ASSIGN(ArrayConstructorStub); |
| 816 }; | 824 }; |
| 817 | 825 |
| 818 | 826 |
| 819 class InternalArrayConstructorStub: public PlatformCodeStub { | 827 class InternalArrayConstructorStub: public PlatformCodeStub { |
| 820 public: | 828 public: |
| 821 explicit InternalArrayConstructorStub(Isolate* isolate); | 829 explicit InternalArrayConstructorStub(Isolate* isolate); |
| 822 | 830 |
| 823 void Generate(MacroAssembler* masm); | 831 void Generate(MacroAssembler* masm); |
| 824 | 832 |
| 825 private: | 833 private: |
| 826 virtual CodeStub::Major MajorKey() const { return InternalArrayConstructor; } | 834 virtual Major MajorKey() const V8_OVERRIDE { |
| 835 return InternalArrayConstructor; |
| 836 } |
| 827 | 837 |
| 828 void GenerateCase(MacroAssembler* masm, ElementsKind kind); | 838 void GenerateCase(MacroAssembler* masm, ElementsKind kind); |
| 829 | 839 |
| 830 DISALLOW_COPY_AND_ASSIGN(InternalArrayConstructorStub); | 840 DISALLOW_COPY_AND_ASSIGN(InternalArrayConstructorStub); |
| 831 }; | 841 }; |
| 832 | 842 |
| 833 | 843 |
| 834 class MathPowStub: public PlatformCodeStub { | 844 class MathPowStub: public PlatformCodeStub { |
| 835 public: | 845 public: |
| 836 enum ExponentType { INTEGER, DOUBLE, TAGGED, ON_STACK }; | 846 enum ExponentType { INTEGER, DOUBLE, TAGGED, ON_STACK }; |
| 837 | 847 |
| 838 MathPowStub(Isolate* isolate, ExponentType exponent_type) | 848 MathPowStub(Isolate* isolate, ExponentType exponent_type) |
| 839 : PlatformCodeStub(isolate) { | 849 : PlatformCodeStub(isolate) { |
| 840 minor_key_ = ExponentTypeBits::encode(exponent_type); | 850 minor_key_ = ExponentTypeBits::encode(exponent_type); |
| 841 } | 851 } |
| 842 | 852 |
| 843 virtual void Generate(MacroAssembler* masm); | 853 virtual void Generate(MacroAssembler* masm); |
| 844 | 854 |
| 845 private: | 855 private: |
| 846 virtual CodeStub::Major MajorKey() const { return MathPow; } | 856 virtual Major MajorKey() const V8_OVERRIDE { return MathPow; } |
| 847 | 857 |
| 848 ExponentType exponent_type() const { | 858 ExponentType exponent_type() const { |
| 849 return ExponentTypeBits::decode(minor_key_); | 859 return ExponentTypeBits::decode(minor_key_); |
| 850 } | 860 } |
| 851 | 861 |
| 852 class ExponentTypeBits : public BitField<ExponentType, 0, 2> {}; | 862 class ExponentTypeBits : public BitField<ExponentType, 0, 2> {}; |
| 853 | 863 |
| 854 DISALLOW_COPY_AND_ASSIGN(MathPowStub); | 864 DISALLOW_COPY_AND_ASSIGN(MathPowStub); |
| 855 }; | 865 }; |
| 856 | 866 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 883 int arg_count() const { return state().arg_count(); } | 893 int arg_count() const { return state().arg_count(); } |
| 884 | 894 |
| 885 CallIC::State state() const { | 895 CallIC::State state() const { |
| 886 return CallIC::State(static_cast<ExtraICState>(minor_key_)); | 896 return CallIC::State(static_cast<ExtraICState>(minor_key_)); |
| 887 } | 897 } |
| 888 | 898 |
| 889 // Code generation helpers. | 899 // Code generation helpers. |
| 890 void GenerateMiss(MacroAssembler* masm, IC::UtilityId id); | 900 void GenerateMiss(MacroAssembler* masm, IC::UtilityId id); |
| 891 | 901 |
| 892 private: | 902 private: |
| 893 virtual CodeStub::Major MajorKey() const { return CallIC; } | 903 virtual Major MajorKey() const V8_OVERRIDE { return CallIC; } |
| 894 | 904 |
| 895 virtual void PrintState(OStream& os) const V8_OVERRIDE; // NOLINT | 905 virtual void PrintState(OStream& os) const V8_OVERRIDE; // NOLINT |
| 896 | 906 |
| 897 DISALLOW_COPY_AND_ASSIGN(CallICStub); | 907 DISALLOW_COPY_AND_ASSIGN(CallICStub); |
| 898 }; | 908 }; |
| 899 | 909 |
| 900 | 910 |
| 901 class CallIC_ArrayStub: public CallICStub { | 911 class CallIC_ArrayStub: public CallICStub { |
| 902 public: | 912 public: |
| 903 CallIC_ArrayStub(Isolate* isolate, const CallIC::State& state_in) | 913 CallIC_ArrayStub(Isolate* isolate, const CallIC::State& state_in) |
| 904 : CallICStub(isolate, state_in) {} | 914 : CallICStub(isolate, state_in) {} |
| 905 | 915 |
| 906 virtual void Generate(MacroAssembler* masm); | 916 virtual void Generate(MacroAssembler* masm); |
| 907 | 917 |
| 908 virtual InlineCacheState GetICState() const V8_FINAL V8_OVERRIDE { | 918 virtual InlineCacheState GetICState() const V8_FINAL V8_OVERRIDE { |
| 909 return MONOMORPHIC; | 919 return MONOMORPHIC; |
| 910 } | 920 } |
| 911 | 921 |
| 912 private: | 922 private: |
| 913 virtual void PrintState(OStream& os) const V8_OVERRIDE; // NOLINT | 923 virtual void PrintState(OStream& os) const V8_OVERRIDE; // NOLINT |
| 914 | 924 |
| 915 virtual CodeStub::Major MajorKey() const { return CallIC_Array; } | 925 virtual Major MajorKey() const V8_OVERRIDE { return CallIC_Array; } |
| 916 | 926 |
| 917 DISALLOW_COPY_AND_ASSIGN(CallIC_ArrayStub); | 927 DISALLOW_COPY_AND_ASSIGN(CallIC_ArrayStub); |
| 918 }; | 928 }; |
| 919 | 929 |
| 920 | 930 |
| 921 // TODO(verwaest): Translate to hydrogen code stub. | 931 // TODO(verwaest): Translate to hydrogen code stub. |
| 922 class FunctionPrototypeStub : public PlatformCodeStub { | 932 class FunctionPrototypeStub : public PlatformCodeStub { |
| 923 public: | 933 public: |
| 924 explicit FunctionPrototypeStub(Isolate* isolate) | 934 explicit FunctionPrototypeStub(Isolate* isolate) |
| 925 : PlatformCodeStub(isolate) {} | 935 : PlatformCodeStub(isolate) {} |
| 926 virtual void Generate(MacroAssembler* masm); | 936 virtual void Generate(MacroAssembler* masm); |
| 927 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; } | 937 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; } |
| 928 | 938 |
| 929 private: | 939 private: |
| 930 virtual CodeStub::Major MajorKey() const { return FunctionPrototype; } | 940 virtual Major MajorKey() const V8_OVERRIDE { return FunctionPrototype; } |
| 931 | 941 |
| 932 DISALLOW_COPY_AND_ASSIGN(FunctionPrototypeStub); | 942 DISALLOW_COPY_AND_ASSIGN(FunctionPrototypeStub); |
| 933 }; | 943 }; |
| 934 | 944 |
| 935 | 945 |
| 936 class HandlerStub : public HydrogenCodeStub { | 946 class HandlerStub : public HydrogenCodeStub { |
| 937 public: | 947 public: |
| 938 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; } | 948 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; } |
| 939 virtual ExtraICState GetExtraICState() const { return kind(); } | 949 virtual ExtraICState GetExtraICState() const { return kind(); } |
| 940 virtual InlineCacheState GetICState() const { return MONOMORPHIC; } | 950 virtual InlineCacheState GetICState() const { return MONOMORPHIC; } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 963 | 973 |
| 964 FieldIndex index() const { return index_; } | 974 FieldIndex index() const { return index_; } |
| 965 | 975 |
| 966 protected: | 976 protected: |
| 967 explicit LoadFieldStub(Isolate* isolate); | 977 explicit LoadFieldStub(Isolate* isolate); |
| 968 virtual Code::Kind kind() const { return Code::LOAD_IC; } | 978 virtual Code::Kind kind() const { return Code::LOAD_IC; } |
| 969 virtual Code::StubType GetStubType() { return Code::FAST; } | 979 virtual Code::StubType GetStubType() { return Code::FAST; } |
| 970 | 980 |
| 971 private: | 981 private: |
| 972 class EncodedLoadFieldByIndexBits : public BitField<int, 0, 13> {}; | 982 class EncodedLoadFieldByIndexBits : public BitField<int, 0, 13> {}; |
| 973 virtual CodeStub::Major MajorKey() const { return LoadField; } | 983 virtual Major MajorKey() const V8_OVERRIDE { return LoadField; } |
| 974 FieldIndex index_; | 984 FieldIndex index_; |
| 975 }; | 985 }; |
| 976 | 986 |
| 977 | 987 |
| 978 class LoadConstantStub : public HandlerStub { | 988 class LoadConstantStub : public HandlerStub { |
| 979 public: | 989 public: |
| 980 LoadConstantStub(Isolate* isolate, int descriptor) : HandlerStub(isolate) { | 990 LoadConstantStub(Isolate* isolate, int descriptor) : HandlerStub(isolate) { |
| 981 bit_field_ = descriptor; | 991 bit_field_ = descriptor; |
| 982 } | 992 } |
| 983 | 993 |
| 984 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 994 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
| 985 | 995 |
| 986 int descriptor() const { return bit_field_; } | 996 int descriptor() const { return bit_field_; } |
| 987 | 997 |
| 988 protected: | 998 protected: |
| 989 explicit LoadConstantStub(Isolate* isolate); | 999 explicit LoadConstantStub(Isolate* isolate); |
| 990 virtual Code::Kind kind() const { return Code::LOAD_IC; } | 1000 virtual Code::Kind kind() const { return Code::LOAD_IC; } |
| 991 virtual Code::StubType GetStubType() { return Code::FAST; } | 1001 virtual Code::StubType GetStubType() { return Code::FAST; } |
| 992 | 1002 |
| 993 private: | 1003 private: |
| 994 virtual CodeStub::Major MajorKey() const { return LoadConstant; } | 1004 virtual Major MajorKey() const V8_OVERRIDE { return LoadConstant; } |
| 995 }; | 1005 }; |
| 996 | 1006 |
| 997 | 1007 |
| 998 class StringLengthStub: public HandlerStub { | 1008 class StringLengthStub: public HandlerStub { |
| 999 public: | 1009 public: |
| 1000 explicit StringLengthStub(Isolate* isolate) : HandlerStub(isolate) {} | 1010 explicit StringLengthStub(Isolate* isolate) : HandlerStub(isolate) {} |
| 1001 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 1011 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
| 1002 | 1012 |
| 1003 protected: | 1013 protected: |
| 1004 virtual Code::Kind kind() const { return Code::LOAD_IC; } | 1014 virtual Code::Kind kind() const { return Code::LOAD_IC; } |
| 1005 virtual Code::StubType GetStubType() { return Code::FAST; } | 1015 virtual Code::StubType GetStubType() { return Code::FAST; } |
| 1006 | 1016 |
| 1007 private: | 1017 private: |
| 1008 virtual CodeStub::Major MajorKey() const { return StringLength; } | 1018 virtual Major MajorKey() const V8_OVERRIDE { return StringLength; } |
| 1009 }; | 1019 }; |
| 1010 | 1020 |
| 1011 | 1021 |
| 1012 class StoreFieldStub : public HandlerStub { | 1022 class StoreFieldStub : public HandlerStub { |
| 1013 public: | 1023 public: |
| 1014 StoreFieldStub(Isolate* isolate, FieldIndex index, | 1024 StoreFieldStub(Isolate* isolate, FieldIndex index, |
| 1015 Representation representation) | 1025 Representation representation) |
| 1016 : HandlerStub(isolate), index_(index), representation_(representation) { | 1026 : HandlerStub(isolate), index_(index), representation_(representation) { |
| 1017 int property_index_key = index_.GetFieldAccessStubKey(); | 1027 int property_index_key = index_.GetFieldAccessStubKey(); |
| 1018 bit_field_ = EncodedStoreFieldByIndexBits::encode(property_index_key) | | 1028 bit_field_ = EncodedStoreFieldByIndexBits::encode(property_index_key) | |
| 1019 RepresentationBits::encode( | 1029 RepresentationBits::encode( |
| 1020 PropertyDetails::EncodeRepresentation(representation)); | 1030 PropertyDetails::EncodeRepresentation(representation)); |
| 1021 } | 1031 } |
| 1022 | 1032 |
| 1023 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 1033 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
| 1024 | 1034 |
| 1025 FieldIndex index() const { return index_; } | 1035 FieldIndex index() const { return index_; } |
| 1026 Representation representation() { return representation_; } | 1036 Representation representation() { return representation_; } |
| 1027 static void InstallDescriptors(Isolate* isolate); | 1037 static void InstallDescriptors(Isolate* isolate); |
| 1028 | 1038 |
| 1029 protected: | 1039 protected: |
| 1030 explicit StoreFieldStub(Isolate* isolate); | 1040 explicit StoreFieldStub(Isolate* isolate); |
| 1031 virtual Code::Kind kind() const { return Code::STORE_IC; } | 1041 virtual Code::Kind kind() const { return Code::STORE_IC; } |
| 1032 virtual Code::StubType GetStubType() { return Code::FAST; } | 1042 virtual Code::StubType GetStubType() { return Code::FAST; } |
| 1033 | 1043 |
| 1034 private: | 1044 private: |
| 1035 class EncodedStoreFieldByIndexBits : public BitField<int, 0, 13> {}; | 1045 class EncodedStoreFieldByIndexBits : public BitField<int, 0, 13> {}; |
| 1036 class RepresentationBits : public BitField<int, 13, 4> {}; | 1046 class RepresentationBits : public BitField<int, 13, 4> {}; |
| 1037 virtual CodeStub::Major MajorKey() const { return StoreField; } | 1047 virtual Major MajorKey() const V8_OVERRIDE { return StoreField; } |
| 1038 FieldIndex index_; | 1048 FieldIndex index_; |
| 1039 Representation representation_; | 1049 Representation representation_; |
| 1040 }; | 1050 }; |
| 1041 | 1051 |
| 1042 | 1052 |
| 1043 class StoreGlobalStub : public HandlerStub { | 1053 class StoreGlobalStub : public HandlerStub { |
| 1044 public: | 1054 public: |
| 1045 StoreGlobalStub(Isolate* isolate, bool is_constant, bool check_global) | 1055 StoreGlobalStub(Isolate* isolate, bool is_constant, bool check_global) |
| 1046 : HandlerStub(isolate) { | 1056 : HandlerStub(isolate) { |
| 1047 bit_field_ = IsConstantBits::encode(is_constant) | | 1057 bit_field_ = IsConstantBits::encode(is_constant) | |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1082 } | 1092 } |
| 1083 | 1093 |
| 1084 Representation representation() { | 1094 Representation representation() { |
| 1085 return Representation::FromKind(RepresentationBits::decode(bit_field_)); | 1095 return Representation::FromKind(RepresentationBits::decode(bit_field_)); |
| 1086 } | 1096 } |
| 1087 void set_representation(Representation r) { | 1097 void set_representation(Representation r) { |
| 1088 bit_field_ = RepresentationBits::update(bit_field_, r.kind()); | 1098 bit_field_ = RepresentationBits::update(bit_field_, r.kind()); |
| 1089 } | 1099 } |
| 1090 | 1100 |
| 1091 private: | 1101 private: |
| 1092 Major MajorKey() const { return StoreGlobal; } | 1102 virtual Major MajorKey() const V8_OVERRIDE { return StoreGlobal; } |
| 1093 | 1103 |
| 1094 class IsConstantBits: public BitField<bool, 0, 1> {}; | 1104 class IsConstantBits: public BitField<bool, 0, 1> {}; |
| 1095 class RepresentationBits: public BitField<Representation::Kind, 1, 8> {}; | 1105 class RepresentationBits: public BitField<Representation::Kind, 1, 8> {}; |
| 1096 class CheckGlobalBits: public BitField<bool, 9, 1> {}; | 1106 class CheckGlobalBits: public BitField<bool, 9, 1> {}; |
| 1097 | 1107 |
| 1098 DISALLOW_COPY_AND_ASSIGN(StoreGlobalStub); | 1108 DISALLOW_COPY_AND_ASSIGN(StoreGlobalStub); |
| 1099 }; | 1109 }; |
| 1100 | 1110 |
| 1101 | 1111 |
| 1102 class CallApiFunctionStub : public PlatformCodeStub { | 1112 class CallApiFunctionStub : public PlatformCodeStub { |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1355 CompareIC::State* handler_state, Token::Value* op); | 1365 CompareIC::State* handler_state, Token::Value* op); |
| 1356 | 1366 |
| 1357 virtual InlineCacheState GetICState() const; | 1367 virtual InlineCacheState GetICState() const; |
| 1358 | 1368 |
| 1359 private: | 1369 private: |
| 1360 class OpField: public BitField<int, 0, 3> { }; | 1370 class OpField: public BitField<int, 0, 3> { }; |
| 1361 class LeftStateField: public BitField<int, 3, 4> { }; | 1371 class LeftStateField: public BitField<int, 3, 4> { }; |
| 1362 class RightStateField: public BitField<int, 7, 4> { }; | 1372 class RightStateField: public BitField<int, 7, 4> { }; |
| 1363 class HandlerStateField: public BitField<int, 11, 4> { }; | 1373 class HandlerStateField: public BitField<int, 11, 4> { }; |
| 1364 | 1374 |
| 1365 virtual CodeStub::Major MajorKey() const { return CompareIC; } | 1375 virtual Major MajorKey() const V8_OVERRIDE { return CompareIC; } |
| 1366 virtual uint32_t MinorKey() const; | 1376 virtual uint32_t MinorKey() const; |
| 1367 | 1377 |
| 1368 virtual Code::Kind GetCodeKind() const { return Code::COMPARE_IC; } | 1378 virtual Code::Kind GetCodeKind() const { return Code::COMPARE_IC; } |
| 1369 | 1379 |
| 1370 void GenerateSmis(MacroAssembler* masm); | 1380 void GenerateSmis(MacroAssembler* masm); |
| 1371 void GenerateNumbers(MacroAssembler* masm); | 1381 void GenerateNumbers(MacroAssembler* masm); |
| 1372 void GenerateInternalizedStrings(MacroAssembler* masm); | 1382 void GenerateInternalizedStrings(MacroAssembler* masm); |
| 1373 void GenerateStrings(MacroAssembler* masm); | 1383 void GenerateStrings(MacroAssembler* masm); |
| 1374 void GenerateUniqueNames(MacroAssembler* masm); | 1384 void GenerateUniqueNames(MacroAssembler* masm); |
| 1375 void GenerateObjects(MacroAssembler* masm); | 1385 void GenerateObjects(MacroAssembler* masm); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1474 friend OStream& operator<<(OStream& os, const State& s); | 1484 friend OStream& operator<<(OStream& os, const State& s); |
| 1475 | 1485 |
| 1476 CompareNilICStub(Isolate* isolate, | 1486 CompareNilICStub(Isolate* isolate, |
| 1477 NilValue nil, | 1487 NilValue nil, |
| 1478 InitializationState init_state) | 1488 InitializationState init_state) |
| 1479 : HydrogenCodeStub(isolate, init_state), nil_value_(nil) { } | 1489 : HydrogenCodeStub(isolate, init_state), nil_value_(nil) { } |
| 1480 | 1490 |
| 1481 class NilValueField : public BitField<NilValue, 0, 1> {}; | 1491 class NilValueField : public BitField<NilValue, 0, 1> {}; |
| 1482 class TypesField : public BitField<byte, 1, NUMBER_OF_TYPES> {}; | 1492 class TypesField : public BitField<byte, 1, NUMBER_OF_TYPES> {}; |
| 1483 | 1493 |
| 1484 virtual CodeStub::Major MajorKey() const { return CompareNilIC; } | 1494 virtual Major MajorKey() const V8_OVERRIDE { return CompareNilIC; } |
| 1485 virtual int NotMissMinorKey() const { return GetExtraICState(); } | 1495 virtual int NotMissMinorKey() const { return GetExtraICState(); } |
| 1486 | 1496 |
| 1487 NilValue nil_value_; | 1497 NilValue nil_value_; |
| 1488 State state_; | 1498 State state_; |
| 1489 | 1499 |
| 1490 DISALLOW_COPY_AND_ASSIGN(CompareNilICStub); | 1500 DISALLOW_COPY_AND_ASSIGN(CompareNilICStub); |
| 1491 }; | 1501 }; |
| 1492 | 1502 |
| 1493 | 1503 |
| 1494 OStream& operator<<(OStream& os, const CompareNilICStub::State& s); | 1504 OStream& operator<<(OStream& os, const CompareNilICStub::State& s); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1508 | 1518 |
| 1509 void Generate(MacroAssembler* masm); | 1519 void Generate(MacroAssembler* masm); |
| 1510 | 1520 |
| 1511 // The version of this stub that doesn't save doubles is generated ahead of | 1521 // The version of this stub that doesn't save doubles is generated ahead of |
| 1512 // time, so it's OK to call it from other stubs that can't cope with GC during | 1522 // time, so it's OK to call it from other stubs that can't cope with GC during |
| 1513 // their code generation. On machines that always have gp registers (x64) we | 1523 // their code generation. On machines that always have gp registers (x64) we |
| 1514 // can generate both variants ahead of time. | 1524 // can generate both variants ahead of time. |
| 1515 static void GenerateAheadOfTime(Isolate* isolate); | 1525 static void GenerateAheadOfTime(Isolate* isolate); |
| 1516 | 1526 |
| 1517 private: | 1527 private: |
| 1518 Major MajorKey() const { return CEntry; } | 1528 virtual Major MajorKey() const V8_OVERRIDE { return CEntry; } |
| 1519 | 1529 |
| 1520 bool save_doubles() const { return SaveDoublesBits::decode(minor_key_); } | 1530 bool save_doubles() const { return SaveDoublesBits::decode(minor_key_); } |
| 1521 #ifdef _WIN64 | 1531 #ifdef _WIN64 |
| 1522 int result_size() const { return ResultSizeBits::decode(minor_key_); } | 1532 int result_size() const { return ResultSizeBits::decode(minor_key_); } |
| 1523 #endif // _WIN64 | 1533 #endif // _WIN64 |
| 1524 | 1534 |
| 1525 bool NeedsImmovableCode(); | 1535 bool NeedsImmovableCode(); |
| 1526 | 1536 |
| 1527 class SaveDoublesBits : public BitField<bool, 0, 1> {}; | 1537 class SaveDoublesBits : public BitField<bool, 0, 1> {}; |
| 1528 class ResultSizeBits : public BitField<int, 1, 3> {}; | 1538 class ResultSizeBits : public BitField<int, 1, 3> {}; |
| 1529 | 1539 |
| 1530 DISALLOW_COPY_AND_ASSIGN(CEntryStub); | 1540 DISALLOW_COPY_AND_ASSIGN(CEntryStub); |
| 1531 }; | 1541 }; |
| 1532 | 1542 |
| 1533 | 1543 |
| 1534 class JSEntryStub : public PlatformCodeStub { | 1544 class JSEntryStub : public PlatformCodeStub { |
| 1535 public: | 1545 public: |
| 1536 explicit JSEntryStub(Isolate* isolate) : PlatformCodeStub(isolate) { } | 1546 explicit JSEntryStub(Isolate* isolate) : PlatformCodeStub(isolate) { } |
| 1537 | 1547 |
| 1538 void Generate(MacroAssembler* masm) { GenerateBody(masm, false); } | 1548 void Generate(MacroAssembler* masm) { GenerateBody(masm, false); } |
| 1539 | 1549 |
| 1540 protected: | 1550 protected: |
| 1541 void GenerateBody(MacroAssembler* masm, bool is_construct); | 1551 void GenerateBody(MacroAssembler* masm, bool is_construct); |
| 1542 | 1552 |
| 1543 private: | 1553 private: |
| 1544 Major MajorKey() const { return JSEntry; } | 1554 virtual Major MajorKey() const V8_OVERRIDE { return JSEntry; } |
| 1545 | 1555 |
| 1546 virtual void FinishCode(Handle<Code> code); | 1556 virtual void FinishCode(Handle<Code> code); |
| 1547 | 1557 |
| 1548 int handler_offset_; | 1558 int handler_offset_; |
| 1549 | 1559 |
| 1550 DISALLOW_COPY_AND_ASSIGN(JSEntryStub); | 1560 DISALLOW_COPY_AND_ASSIGN(JSEntryStub); |
| 1551 }; | 1561 }; |
| 1552 | 1562 |
| 1553 | 1563 |
| 1554 class JSConstructEntryStub : public JSEntryStub { | 1564 class JSConstructEntryStub : public JSEntryStub { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1575 NEW_SLOPPY_FAST, | 1585 NEW_SLOPPY_FAST, |
| 1576 NEW_SLOPPY_SLOW, | 1586 NEW_SLOPPY_SLOW, |
| 1577 NEW_STRICT | 1587 NEW_STRICT |
| 1578 }; | 1588 }; |
| 1579 | 1589 |
| 1580 ArgumentsAccessStub(Isolate* isolate, Type type) : PlatformCodeStub(isolate) { | 1590 ArgumentsAccessStub(Isolate* isolate, Type type) : PlatformCodeStub(isolate) { |
| 1581 minor_key_ = TypeBits::encode(type); | 1591 minor_key_ = TypeBits::encode(type); |
| 1582 } | 1592 } |
| 1583 | 1593 |
| 1584 private: | 1594 private: |
| 1585 Major MajorKey() const { return ArgumentsAccess; } | 1595 virtual Major MajorKey() const V8_OVERRIDE { return ArgumentsAccess; } |
| 1586 | 1596 |
| 1587 Type type() const { return TypeBits::decode(minor_key_); } | 1597 Type type() const { return TypeBits::decode(minor_key_); } |
| 1588 | 1598 |
| 1589 void Generate(MacroAssembler* masm); | 1599 void Generate(MacroAssembler* masm); |
| 1590 void GenerateReadElement(MacroAssembler* masm); | 1600 void GenerateReadElement(MacroAssembler* masm); |
| 1591 void GenerateNewStrict(MacroAssembler* masm); | 1601 void GenerateNewStrict(MacroAssembler* masm); |
| 1592 void GenerateNewSloppyFast(MacroAssembler* masm); | 1602 void GenerateNewSloppyFast(MacroAssembler* masm); |
| 1593 void GenerateNewSloppySlow(MacroAssembler* masm); | 1603 void GenerateNewSloppySlow(MacroAssembler* masm); |
| 1594 | 1604 |
| 1595 virtual void PrintName(OStream& os) const V8_OVERRIDE; // NOLINT | 1605 virtual void PrintName(OStream& os) const V8_OVERRIDE; // NOLINT |
| 1596 | 1606 |
| 1597 class TypeBits : public BitField<Type, 0, 2> {}; | 1607 class TypeBits : public BitField<Type, 0, 2> {}; |
| 1598 | 1608 |
| 1599 DISALLOW_COPY_AND_ASSIGN(ArgumentsAccessStub); | 1609 DISALLOW_COPY_AND_ASSIGN(ArgumentsAccessStub); |
| 1600 }; | 1610 }; |
| 1601 | 1611 |
| 1602 | 1612 |
| 1603 class RegExpExecStub: public PlatformCodeStub { | 1613 class RegExpExecStub: public PlatformCodeStub { |
| 1604 public: | 1614 public: |
| 1605 explicit RegExpExecStub(Isolate* isolate) : PlatformCodeStub(isolate) { } | 1615 explicit RegExpExecStub(Isolate* isolate) : PlatformCodeStub(isolate) { } |
| 1606 | 1616 |
| 1607 private: | 1617 private: |
| 1608 Major MajorKey() const { return RegExpExec; } | 1618 virtual Major MajorKey() const V8_OVERRIDE { return RegExpExec; } |
| 1609 | 1619 |
| 1610 void Generate(MacroAssembler* masm); | 1620 void Generate(MacroAssembler* masm); |
| 1611 | 1621 |
| 1612 DISALLOW_COPY_AND_ASSIGN(RegExpExecStub); | 1622 DISALLOW_COPY_AND_ASSIGN(RegExpExecStub); |
| 1613 }; | 1623 }; |
| 1614 | 1624 |
| 1615 | 1625 |
| 1616 class RegExpConstructResultStub V8_FINAL : public HydrogenCodeStub { | 1626 class RegExpConstructResultStub V8_FINAL : public HydrogenCodeStub { |
| 1617 public: | 1627 public: |
| 1618 explicit RegExpConstructResultStub(Isolate* isolate) | 1628 explicit RegExpConstructResultStub(Isolate* isolate) |
| 1619 : HydrogenCodeStub(isolate) { } | 1629 : HydrogenCodeStub(isolate) { } |
| 1620 | 1630 |
| 1621 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 1631 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
| 1622 | 1632 |
| 1623 virtual void InitializeInterfaceDescriptor( | 1633 virtual void InitializeInterfaceDescriptor( |
| 1624 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 1634 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| 1625 | 1635 |
| 1626 virtual Major MajorKey() const V8_OVERRIDE { return RegExpConstructResult; } | 1636 virtual Major MajorKey() const V8_OVERRIDE { return RegExpConstructResult; } |
| 1627 virtual int NotMissMinorKey() const V8_OVERRIDE { return 0; } | |
| 1628 | 1637 |
| 1629 static void InstallDescriptors(Isolate* isolate); | 1638 static void InstallDescriptors(Isolate* isolate); |
| 1630 | 1639 |
| 1631 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 1640 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
| 1632 static const int kLength = 0; | 1641 static const int kLength = 0; |
| 1633 static const int kIndex = 1; | 1642 static const int kIndex = 1; |
| 1634 static const int kInput = 2; | 1643 static const int kInput = 2; |
| 1635 | 1644 |
| 1636 private: | 1645 private: |
| 1637 DISALLOW_COPY_AND_ASSIGN(RegExpConstructResultStub); | 1646 DISALLOW_COPY_AND_ASSIGN(RegExpConstructResultStub); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1649 void Generate(MacroAssembler* masm); | 1658 void Generate(MacroAssembler* masm); |
| 1650 | 1659 |
| 1651 static int ExtractArgcFromMinorKey(int minor_key) { | 1660 static int ExtractArgcFromMinorKey(int minor_key) { |
| 1652 return ArgcBits::decode(minor_key); | 1661 return ArgcBits::decode(minor_key); |
| 1653 } | 1662 } |
| 1654 | 1663 |
| 1655 virtual void InitializeInterfaceDescriptor( | 1664 virtual void InitializeInterfaceDescriptor( |
| 1656 CodeStubInterfaceDescriptor* descriptor); | 1665 CodeStubInterfaceDescriptor* descriptor); |
| 1657 | 1666 |
| 1658 private: | 1667 private: |
| 1659 Major MajorKey() const { return CallFunction; } | 1668 virtual Major MajorKey() const V8_OVERRIDE { return CallFunction; } |
| 1660 | 1669 |
| 1661 int argc() const { return ArgcBits::decode(minor_key_); } | 1670 int argc() const { return ArgcBits::decode(minor_key_); } |
| 1662 int flags() const { return FlagBits::decode(minor_key_); } | 1671 int flags() const { return FlagBits::decode(minor_key_); } |
| 1663 | 1672 |
| 1664 bool CallAsMethod() const { | 1673 bool CallAsMethod() const { |
| 1665 return flags() == CALL_AS_METHOD || flags() == WRAP_AND_CALL; | 1674 return flags() == CALL_AS_METHOD || flags() == WRAP_AND_CALL; |
| 1666 } | 1675 } |
| 1667 | 1676 |
| 1668 bool NeedsChecks() const { return flags() != WRAP_AND_CALL; } | 1677 bool NeedsChecks() const { return flags() != WRAP_AND_CALL; } |
| 1669 | 1678 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1688 void Generate(MacroAssembler* masm); | 1697 void Generate(MacroAssembler* masm); |
| 1689 | 1698 |
| 1690 virtual void FinishCode(Handle<Code> code) { | 1699 virtual void FinishCode(Handle<Code> code) { |
| 1691 code->set_has_function_cache(RecordCallTarget()); | 1700 code->set_has_function_cache(RecordCallTarget()); |
| 1692 } | 1701 } |
| 1693 | 1702 |
| 1694 virtual void InitializeInterfaceDescriptor( | 1703 virtual void InitializeInterfaceDescriptor( |
| 1695 CodeStubInterfaceDescriptor* descriptor); | 1704 CodeStubInterfaceDescriptor* descriptor); |
| 1696 | 1705 |
| 1697 private: | 1706 private: |
| 1698 Major MajorKey() const { return CallConstruct; } | 1707 virtual Major MajorKey() const V8_OVERRIDE { return CallConstruct; } |
| 1699 | 1708 |
| 1700 CallConstructorFlags flags() const { return FlagBits::decode(minor_key_); } | 1709 CallConstructorFlags flags() const { return FlagBits::decode(minor_key_); } |
| 1701 | 1710 |
| 1702 bool RecordCallTarget() const { | 1711 bool RecordCallTarget() const { |
| 1703 return (flags() & RECORD_CONSTRUCTOR_TARGET) != 0; | 1712 return (flags() & RECORD_CONSTRUCTOR_TARGET) != 0; |
| 1704 } | 1713 } |
| 1705 | 1714 |
| 1706 virtual void PrintName(OStream& os) const V8_OVERRIDE; // NOLINT | 1715 virtual void PrintName(OStream& os) const V8_OVERRIDE; // NOLINT |
| 1707 | 1716 |
| 1708 class FlagBits : public BitField<CallConstructorFlags, 0, 1> {}; | 1717 class FlagBits : public BitField<CallConstructorFlags, 0, 1> {}; |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1881 StringCharCodeAtGenerator char_code_at_generator_; | 1890 StringCharCodeAtGenerator char_code_at_generator_; |
| 1882 StringCharFromCodeGenerator char_from_code_generator_; | 1891 StringCharFromCodeGenerator char_from_code_generator_; |
| 1883 | 1892 |
| 1884 DISALLOW_COPY_AND_ASSIGN(StringCharAtGenerator); | 1893 DISALLOW_COPY_AND_ASSIGN(StringCharAtGenerator); |
| 1885 }; | 1894 }; |
| 1886 | 1895 |
| 1887 | 1896 |
| 1888 class LoadDictionaryElementStub : public HydrogenCodeStub { | 1897 class LoadDictionaryElementStub : public HydrogenCodeStub { |
| 1889 public: | 1898 public: |
| 1890 explicit LoadDictionaryElementStub(Isolate* isolate) | 1899 explicit LoadDictionaryElementStub(Isolate* isolate) |
| 1891 : HydrogenCodeStub(isolate) {} | 1900 : HydrogenCodeStub(isolate) { |
| 1901 set_sub_minor_key(DICTIONARY_ELEMENTS); |
| 1902 } |
| 1892 | 1903 |
| 1893 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 1904 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
| 1894 | 1905 |
| 1895 virtual void InitializeInterfaceDescriptor( | 1906 virtual void InitializeInterfaceDescriptor( |
| 1896 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 1907 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| 1897 | 1908 |
| 1898 private: | 1909 private: |
| 1899 Major MajorKey() const { return LoadElement; } | 1910 virtual Major MajorKey() const V8_OVERRIDE { return LoadElement; } |
| 1900 int NotMissMinorKey() const { return DICTIONARY_ELEMENTS; } | |
| 1901 | 1911 |
| 1902 DISALLOW_COPY_AND_ASSIGN(LoadDictionaryElementStub); | 1912 DISALLOW_COPY_AND_ASSIGN(LoadDictionaryElementStub); |
| 1903 }; | 1913 }; |
| 1904 | 1914 |
| 1905 | 1915 |
| 1906 class LoadDictionaryElementPlatformStub : public PlatformCodeStub { | 1916 class LoadDictionaryElementPlatformStub : public PlatformCodeStub { |
| 1907 public: | 1917 public: |
| 1908 explicit LoadDictionaryElementPlatformStub(Isolate* isolate) | 1918 explicit LoadDictionaryElementPlatformStub(Isolate* isolate) |
| 1909 : PlatformCodeStub(isolate) { | 1919 : PlatformCodeStub(isolate) { |
| 1910 minor_key_ = DICTIONARY_ELEMENTS; | 1920 minor_key_ = DICTIONARY_ELEMENTS; |
| 1911 } | 1921 } |
| 1912 | 1922 |
| 1913 void Generate(MacroAssembler* masm); | 1923 void Generate(MacroAssembler* masm); |
| 1914 | 1924 |
| 1915 private: | 1925 private: |
| 1916 Major MajorKey() const { return LoadElement; } | 1926 virtual Major MajorKey() const V8_OVERRIDE { return LoadElement; } |
| 1917 | 1927 |
| 1918 DISALLOW_COPY_AND_ASSIGN(LoadDictionaryElementPlatformStub); | 1928 DISALLOW_COPY_AND_ASSIGN(LoadDictionaryElementPlatformStub); |
| 1919 }; | 1929 }; |
| 1920 | 1930 |
| 1921 | 1931 |
| 1922 class KeyedLoadGenericStub : public HydrogenCodeStub { | 1932 class KeyedLoadGenericStub : public HydrogenCodeStub { |
| 1923 public: | 1933 public: |
| 1924 explicit KeyedLoadGenericStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} | 1934 explicit KeyedLoadGenericStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} |
| 1925 | 1935 |
| 1926 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 1936 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
| 1927 | 1937 |
| 1928 virtual void InitializeInterfaceDescriptor( | 1938 virtual void InitializeInterfaceDescriptor( |
| 1929 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 1939 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| 1930 | 1940 |
| 1931 static void InstallDescriptors(Isolate* isolate); | 1941 static void InstallDescriptors(Isolate* isolate); |
| 1932 | 1942 |
| 1933 virtual Code::Kind GetCodeKind() const { return Code::KEYED_LOAD_IC; } | 1943 virtual Code::Kind GetCodeKind() const { return Code::KEYED_LOAD_IC; } |
| 1934 virtual InlineCacheState GetICState() const { return GENERIC; } | 1944 virtual InlineCacheState GetICState() const { return GENERIC; } |
| 1935 | 1945 |
| 1936 private: | 1946 private: |
| 1937 Major MajorKey() const { return KeyedLoadGeneric; } | 1947 virtual Major MajorKey() const V8_OVERRIDE { return KeyedLoadGeneric; } |
| 1938 int NotMissMinorKey() const { return 0; } | |
| 1939 | 1948 |
| 1940 DISALLOW_COPY_AND_ASSIGN(KeyedLoadGenericStub); | 1949 DISALLOW_COPY_AND_ASSIGN(KeyedLoadGenericStub); |
| 1941 }; | 1950 }; |
| 1942 | 1951 |
| 1943 | 1952 |
| 1944 class LoadICTrampolineStub : public PlatformCodeStub { | 1953 class LoadICTrampolineStub : public PlatformCodeStub { |
| 1945 public: | 1954 public: |
| 1946 LoadICTrampolineStub(Isolate* isolate, const LoadIC::State& state) | 1955 LoadICTrampolineStub(Isolate* isolate, const LoadIC::State& state) |
| 1947 : PlatformCodeStub(isolate) { | 1956 : PlatformCodeStub(isolate) { |
| 1948 minor_key_ = state.GetExtraICState(); | 1957 minor_key_ = state.GetExtraICState(); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2056 IsTruncatingBits::encode(is_truncating) | | 2065 IsTruncatingBits::encode(is_truncating) | |
| 2057 SkipFastPathBits::encode(skip_fastpath) | | 2066 SkipFastPathBits::encode(skip_fastpath) | |
| 2058 SSE3Bits::encode(CpuFeatures::IsSupported(SSE3) ? 1 : 0); | 2067 SSE3Bits::encode(CpuFeatures::IsSupported(SSE3) ? 1 : 0); |
| 2059 } | 2068 } |
| 2060 | 2069 |
| 2061 void Generate(MacroAssembler* masm); | 2070 void Generate(MacroAssembler* masm); |
| 2062 | 2071 |
| 2063 virtual bool SometimesSetsUpAFrame() { return false; } | 2072 virtual bool SometimesSetsUpAFrame() { return false; } |
| 2064 | 2073 |
| 2065 private: | 2074 private: |
| 2066 Major MajorKey() const { return DoubleToI; } | 2075 virtual Major MajorKey() const V8_OVERRIDE { return DoubleToI; } |
| 2067 | 2076 |
| 2068 Register source() const { | 2077 Register source() const { |
| 2069 return Register::from_code(SourceRegisterBits::decode(minor_key_)); | 2078 return Register::from_code(SourceRegisterBits::decode(minor_key_)); |
| 2070 } | 2079 } |
| 2071 Register destination() const { | 2080 Register destination() const { |
| 2072 return Register::from_code(DestinationRegisterBits::decode(minor_key_)); | 2081 return Register::from_code(DestinationRegisterBits::decode(minor_key_)); |
| 2073 } | 2082 } |
| 2074 bool is_truncating() const { return IsTruncatingBits::decode(minor_key_); } | 2083 bool is_truncating() const { return IsTruncatingBits::decode(minor_key_); } |
| 2075 bool skip_fastpath() const { return SkipFastPathBits::decode(minor_key_); } | 2084 bool skip_fastpath() const { return SkipFastPathBits::decode(minor_key_); } |
| 2076 int offset() const { return OffsetBits::decode(minor_key_); } | 2085 int offset() const { return OffsetBits::decode(minor_key_); } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2117 static void InstallDescriptors(Isolate* isolate); | 2126 static void InstallDescriptors(Isolate* isolate); |
| 2118 | 2127 |
| 2119 virtual void InitializeInterfaceDescriptor( | 2128 virtual void InitializeInterfaceDescriptor( |
| 2120 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 2129 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| 2121 | 2130 |
| 2122 private: | 2131 private: |
| 2123 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; | 2132 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; |
| 2124 class IsJSArrayBits: public BitField<bool, 8, 1> {}; | 2133 class IsJSArrayBits: public BitField<bool, 8, 1> {}; |
| 2125 uint32_t bit_field_; | 2134 uint32_t bit_field_; |
| 2126 | 2135 |
| 2127 Major MajorKey() const { return LoadElement; } | 2136 virtual Major MajorKey() const V8_OVERRIDE { return LoadElement; } |
| 2128 int NotMissMinorKey() const { return bit_field_; } | 2137 int NotMissMinorKey() const { return bit_field_; } |
| 2129 | 2138 |
| 2130 DISALLOW_COPY_AND_ASSIGN(LoadFastElementStub); | 2139 DISALLOW_COPY_AND_ASSIGN(LoadFastElementStub); |
| 2131 }; | 2140 }; |
| 2132 | 2141 |
| 2133 | 2142 |
| 2134 class StoreFastElementStub : public HydrogenCodeStub { | 2143 class StoreFastElementStub : public HydrogenCodeStub { |
| 2135 public: | 2144 public: |
| 2136 StoreFastElementStub(Isolate* isolate, bool is_js_array, | 2145 StoreFastElementStub(Isolate* isolate, bool is_js_array, |
| 2137 ElementsKind elements_kind, KeyedAccessStoreMode mode) | 2146 ElementsKind elements_kind, KeyedAccessStoreMode mode) |
| (...skipping 19 matching lines...) Expand all Loading... |
| 2157 | 2166 |
| 2158 virtual void InitializeInterfaceDescriptor( | 2167 virtual void InitializeInterfaceDescriptor( |
| 2159 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 2168 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| 2160 | 2169 |
| 2161 private: | 2170 private: |
| 2162 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; | 2171 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; |
| 2163 class StoreModeBits: public BitField<KeyedAccessStoreMode, 8, 4> {}; | 2172 class StoreModeBits: public BitField<KeyedAccessStoreMode, 8, 4> {}; |
| 2164 class IsJSArrayBits: public BitField<bool, 12, 1> {}; | 2173 class IsJSArrayBits: public BitField<bool, 12, 1> {}; |
| 2165 uint32_t bit_field_; | 2174 uint32_t bit_field_; |
| 2166 | 2175 |
| 2167 Major MajorKey() const { return StoreElement; } | 2176 virtual Major MajorKey() const V8_OVERRIDE { return StoreElement; } |
| 2168 int NotMissMinorKey() const { return bit_field_; } | 2177 int NotMissMinorKey() const { return bit_field_; } |
| 2169 | 2178 |
| 2170 DISALLOW_COPY_AND_ASSIGN(StoreFastElementStub); | 2179 DISALLOW_COPY_AND_ASSIGN(StoreFastElementStub); |
| 2171 }; | 2180 }; |
| 2172 | 2181 |
| 2173 | 2182 |
| 2174 class TransitionElementsKindStub : public HydrogenCodeStub { | 2183 class TransitionElementsKindStub : public HydrogenCodeStub { |
| 2175 public: | 2184 public: |
| 2176 TransitionElementsKindStub(Isolate* isolate, | 2185 TransitionElementsKindStub(Isolate* isolate, |
| 2177 ElementsKind from_kind, | 2186 ElementsKind from_kind, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2198 | 2207 |
| 2199 virtual void InitializeInterfaceDescriptor( | 2208 virtual void InitializeInterfaceDescriptor( |
| 2200 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 2209 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| 2201 | 2210 |
| 2202 private: | 2211 private: |
| 2203 class FromKindBits: public BitField<ElementsKind, 8, 8> {}; | 2212 class FromKindBits: public BitField<ElementsKind, 8, 8> {}; |
| 2204 class ToKindBits: public BitField<ElementsKind, 0, 8> {}; | 2213 class ToKindBits: public BitField<ElementsKind, 0, 8> {}; |
| 2205 class IsJSArrayBits: public BitField<bool, 16, 1> {}; | 2214 class IsJSArrayBits: public BitField<bool, 16, 1> {}; |
| 2206 uint32_t bit_field_; | 2215 uint32_t bit_field_; |
| 2207 | 2216 |
| 2208 Major MajorKey() const { return TransitionElementsKind; } | 2217 virtual Major MajorKey() const V8_OVERRIDE { return TransitionElementsKind; } |
| 2209 int NotMissMinorKey() const { return bit_field_; } | 2218 int NotMissMinorKey() const { return bit_field_; } |
| 2210 | 2219 |
| 2211 DISALLOW_COPY_AND_ASSIGN(TransitionElementsKindStub); | 2220 DISALLOW_COPY_AND_ASSIGN(TransitionElementsKindStub); |
| 2212 }; | 2221 }; |
| 2213 | 2222 |
| 2214 | 2223 |
| 2215 class ArrayConstructorStubBase : public HydrogenCodeStub { | 2224 class ArrayConstructorStubBase : public HydrogenCodeStub { |
| 2216 public: | 2225 public: |
| 2217 ArrayConstructorStubBase(Isolate* isolate, | 2226 ArrayConstructorStubBase(Isolate* isolate, |
| 2218 ElementsKind kind, | 2227 ElementsKind kind, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2268 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) | 2277 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) |
| 2269 : ArrayConstructorStubBase(isolate, kind, override_mode) { | 2278 : ArrayConstructorStubBase(isolate, kind, override_mode) { |
| 2270 } | 2279 } |
| 2271 | 2280 |
| 2272 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 2281 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
| 2273 | 2282 |
| 2274 virtual void InitializeInterfaceDescriptor( | 2283 virtual void InitializeInterfaceDescriptor( |
| 2275 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 2284 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| 2276 | 2285 |
| 2277 private: | 2286 private: |
| 2278 Major MajorKey() const { return ArrayNoArgumentConstructor; } | 2287 virtual Major MajorKey() const V8_OVERRIDE { |
| 2288 return ArrayNoArgumentConstructor; |
| 2289 } |
| 2279 | 2290 |
| 2280 virtual void PrintName(OStream& os) const V8_OVERRIDE { // NOLINT | 2291 virtual void PrintName(OStream& os) const V8_OVERRIDE { // NOLINT |
| 2281 BasePrintName(os, "ArrayNoArgumentConstructorStub"); | 2292 BasePrintName(os, "ArrayNoArgumentConstructorStub"); |
| 2282 } | 2293 } |
| 2283 | 2294 |
| 2284 DISALLOW_COPY_AND_ASSIGN(ArrayNoArgumentConstructorStub); | 2295 DISALLOW_COPY_AND_ASSIGN(ArrayNoArgumentConstructorStub); |
| 2285 }; | 2296 }; |
| 2286 | 2297 |
| 2287 | 2298 |
| 2288 class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase { | 2299 class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase { |
| 2289 public: | 2300 public: |
| 2290 ArraySingleArgumentConstructorStub( | 2301 ArraySingleArgumentConstructorStub( |
| 2291 Isolate* isolate, | 2302 Isolate* isolate, |
| 2292 ElementsKind kind, | 2303 ElementsKind kind, |
| 2293 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) | 2304 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) |
| 2294 : ArrayConstructorStubBase(isolate, kind, override_mode) { | 2305 : ArrayConstructorStubBase(isolate, kind, override_mode) { |
| 2295 } | 2306 } |
| 2296 | 2307 |
| 2297 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 2308 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
| 2298 | 2309 |
| 2299 virtual void InitializeInterfaceDescriptor( | 2310 virtual void InitializeInterfaceDescriptor( |
| 2300 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 2311 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| 2301 | 2312 |
| 2302 private: | 2313 private: |
| 2303 Major MajorKey() const { return ArraySingleArgumentConstructor; } | 2314 virtual Major MajorKey() const V8_OVERRIDE { |
| 2315 return ArraySingleArgumentConstructor; |
| 2316 } |
| 2304 | 2317 |
| 2305 virtual void PrintName(OStream& os) const { // NOLINT | 2318 virtual void PrintName(OStream& os) const { // NOLINT |
| 2306 BasePrintName(os, "ArraySingleArgumentConstructorStub"); | 2319 BasePrintName(os, "ArraySingleArgumentConstructorStub"); |
| 2307 } | 2320 } |
| 2308 | 2321 |
| 2309 DISALLOW_COPY_AND_ASSIGN(ArraySingleArgumentConstructorStub); | 2322 DISALLOW_COPY_AND_ASSIGN(ArraySingleArgumentConstructorStub); |
| 2310 }; | 2323 }; |
| 2311 | 2324 |
| 2312 | 2325 |
| 2313 class ArrayNArgumentsConstructorStub : public ArrayConstructorStubBase { | 2326 class ArrayNArgumentsConstructorStub : public ArrayConstructorStubBase { |
| 2314 public: | 2327 public: |
| 2315 ArrayNArgumentsConstructorStub( | 2328 ArrayNArgumentsConstructorStub( |
| 2316 Isolate* isolate, | 2329 Isolate* isolate, |
| 2317 ElementsKind kind, | 2330 ElementsKind kind, |
| 2318 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) | 2331 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) |
| 2319 : ArrayConstructorStubBase(isolate, kind, override_mode) { | 2332 : ArrayConstructorStubBase(isolate, kind, override_mode) { |
| 2320 } | 2333 } |
| 2321 | 2334 |
| 2322 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 2335 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
| 2323 | 2336 |
| 2324 virtual void InitializeInterfaceDescriptor( | 2337 virtual void InitializeInterfaceDescriptor( |
| 2325 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 2338 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| 2326 | 2339 |
| 2327 private: | 2340 private: |
| 2328 Major MajorKey() const { return ArrayNArgumentsConstructor; } | 2341 virtual Major MajorKey() const V8_OVERRIDE { |
| 2342 return ArrayNArgumentsConstructor; |
| 2343 } |
| 2329 | 2344 |
| 2330 virtual void PrintName(OStream& os) const { // NOLINT | 2345 virtual void PrintName(OStream& os) const { // NOLINT |
| 2331 BasePrintName(os, "ArrayNArgumentsConstructorStub"); | 2346 BasePrintName(os, "ArrayNArgumentsConstructorStub"); |
| 2332 } | 2347 } |
| 2333 | 2348 |
| 2334 DISALLOW_COPY_AND_ASSIGN(ArrayNArgumentsConstructorStub); | 2349 DISALLOW_COPY_AND_ASSIGN(ArrayNArgumentsConstructorStub); |
| 2335 }; | 2350 }; |
| 2336 | 2351 |
| 2337 | 2352 |
| 2338 class InternalArrayConstructorStubBase : public HydrogenCodeStub { | 2353 class InternalArrayConstructorStubBase : public HydrogenCodeStub { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 2365 InternalArrayNoArgumentConstructorStub(Isolate* isolate, | 2380 InternalArrayNoArgumentConstructorStub(Isolate* isolate, |
| 2366 ElementsKind kind) | 2381 ElementsKind kind) |
| 2367 : InternalArrayConstructorStubBase(isolate, kind) { } | 2382 : InternalArrayConstructorStubBase(isolate, kind) { } |
| 2368 | 2383 |
| 2369 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 2384 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
| 2370 | 2385 |
| 2371 virtual void InitializeInterfaceDescriptor( | 2386 virtual void InitializeInterfaceDescriptor( |
| 2372 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 2387 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| 2373 | 2388 |
| 2374 private: | 2389 private: |
| 2375 Major MajorKey() const { return InternalArrayNoArgumentConstructor; } | 2390 virtual Major MajorKey() const V8_OVERRIDE { |
| 2391 return InternalArrayNoArgumentConstructor; |
| 2392 } |
| 2376 | 2393 |
| 2377 DISALLOW_COPY_AND_ASSIGN(InternalArrayNoArgumentConstructorStub); | 2394 DISALLOW_COPY_AND_ASSIGN(InternalArrayNoArgumentConstructorStub); |
| 2378 }; | 2395 }; |
| 2379 | 2396 |
| 2380 | 2397 |
| 2381 class InternalArraySingleArgumentConstructorStub : public | 2398 class InternalArraySingleArgumentConstructorStub : public |
| 2382 InternalArrayConstructorStubBase { | 2399 InternalArrayConstructorStubBase { |
| 2383 public: | 2400 public: |
| 2384 InternalArraySingleArgumentConstructorStub(Isolate* isolate, | 2401 InternalArraySingleArgumentConstructorStub(Isolate* isolate, |
| 2385 ElementsKind kind) | 2402 ElementsKind kind) |
| 2386 : InternalArrayConstructorStubBase(isolate, kind) { } | 2403 : InternalArrayConstructorStubBase(isolate, kind) { } |
| 2387 | 2404 |
| 2388 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 2405 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
| 2389 | 2406 |
| 2390 virtual void InitializeInterfaceDescriptor( | 2407 virtual void InitializeInterfaceDescriptor( |
| 2391 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 2408 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| 2392 | 2409 |
| 2393 private: | 2410 private: |
| 2394 Major MajorKey() const { return InternalArraySingleArgumentConstructor; } | 2411 virtual Major MajorKey() const V8_OVERRIDE { |
| 2412 return InternalArraySingleArgumentConstructor; |
| 2413 } |
| 2395 | 2414 |
| 2396 DISALLOW_COPY_AND_ASSIGN(InternalArraySingleArgumentConstructorStub); | 2415 DISALLOW_COPY_AND_ASSIGN(InternalArraySingleArgumentConstructorStub); |
| 2397 }; | 2416 }; |
| 2398 | 2417 |
| 2399 | 2418 |
| 2400 class InternalArrayNArgumentsConstructorStub : public | 2419 class InternalArrayNArgumentsConstructorStub : public |
| 2401 InternalArrayConstructorStubBase { | 2420 InternalArrayConstructorStubBase { |
| 2402 public: | 2421 public: |
| 2403 InternalArrayNArgumentsConstructorStub(Isolate* isolate, ElementsKind kind) | 2422 InternalArrayNArgumentsConstructorStub(Isolate* isolate, ElementsKind kind) |
| 2404 : InternalArrayConstructorStubBase(isolate, kind) { } | 2423 : InternalArrayConstructorStubBase(isolate, kind) { } |
| 2405 | 2424 |
| 2406 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 2425 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
| 2407 | 2426 |
| 2408 virtual void InitializeInterfaceDescriptor( | 2427 virtual void InitializeInterfaceDescriptor( |
| 2409 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 2428 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| 2410 | 2429 |
| 2411 private: | 2430 private: |
| 2412 Major MajorKey() const { return InternalArrayNArgumentsConstructor; } | 2431 virtual Major MajorKey() const V8_OVERRIDE { |
| 2432 return InternalArrayNArgumentsConstructor; |
| 2433 } |
| 2413 | 2434 |
| 2414 DISALLOW_COPY_AND_ASSIGN(InternalArrayNArgumentsConstructorStub); | 2435 DISALLOW_COPY_AND_ASSIGN(InternalArrayNArgumentsConstructorStub); |
| 2415 }; | 2436 }; |
| 2416 | 2437 |
| 2417 | 2438 |
| 2418 class StoreElementStub : public PlatformCodeStub { | 2439 class StoreElementStub : public PlatformCodeStub { |
| 2419 public: | 2440 public: |
| 2420 StoreElementStub(Isolate* isolate, ElementsKind elements_kind) | 2441 StoreElementStub(Isolate* isolate, ElementsKind elements_kind) |
| 2421 : PlatformCodeStub(isolate) { | 2442 : PlatformCodeStub(isolate) { |
| 2422 minor_key_ = ElementsKindBits::encode(elements_kind); | 2443 minor_key_ = ElementsKindBits::encode(elements_kind); |
| 2423 } | 2444 } |
| 2424 | 2445 |
| 2425 void Generate(MacroAssembler* masm); | 2446 void Generate(MacroAssembler* masm); |
| 2426 | 2447 |
| 2427 private: | 2448 private: |
| 2428 Major MajorKey() const { return StoreElement; } | 2449 virtual Major MajorKey() const V8_OVERRIDE { return StoreElement; } |
| 2429 | 2450 |
| 2430 ElementsKind elements_kind() const { | 2451 ElementsKind elements_kind() const { |
| 2431 return ElementsKindBits::decode(minor_key_); | 2452 return ElementsKindBits::decode(minor_key_); |
| 2432 } | 2453 } |
| 2433 | 2454 |
| 2434 class ElementsKindBits : public BitField<ElementsKind, 0, 8> {}; | 2455 class ElementsKindBits : public BitField<ElementsKind, 0, 8> {}; |
| 2435 | 2456 |
| 2436 DISALLOW_COPY_AND_ASSIGN(StoreElementStub); | 2457 DISALLOW_COPY_AND_ASSIGN(StoreElementStub); |
| 2437 }; | 2458 }; |
| 2438 | 2459 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2512 return ::v8::internal::UNINITIALIZED; | 2533 return ::v8::internal::UNINITIALIZED; |
| 2513 } else { | 2534 } else { |
| 2514 return MONOMORPHIC; | 2535 return MONOMORPHIC; |
| 2515 } | 2536 } |
| 2516 } | 2537 } |
| 2517 | 2538 |
| 2518 private: | 2539 private: |
| 2519 class TypesBits : public BitField<byte, 0, NUMBER_OF_TYPES> {}; | 2540 class TypesBits : public BitField<byte, 0, NUMBER_OF_TYPES> {}; |
| 2520 class ResultModeBits : public BitField<ResultMode, NUMBER_OF_TYPES, 2> {}; | 2541 class ResultModeBits : public BitField<ResultMode, NUMBER_OF_TYPES, 2> {}; |
| 2521 | 2542 |
| 2522 Major MajorKey() const { return ToBoolean; } | 2543 virtual Major MajorKey() const V8_OVERRIDE { return ToBoolean; } |
| 2523 int NotMissMinorKey() const { | 2544 int NotMissMinorKey() const { |
| 2524 return TypesBits::encode(types_.ToByte()) | ResultModeBits::encode(mode_); | 2545 return TypesBits::encode(types_.ToByte()) | ResultModeBits::encode(mode_); |
| 2525 } | 2546 } |
| 2526 | 2547 |
| 2527 ToBooleanStub(Isolate* isolate, InitializationState init_state) | 2548 ToBooleanStub(Isolate* isolate, InitializationState init_state) |
| 2528 : HydrogenCodeStub(isolate, init_state), mode_(RESULT_AS_SMI) {} | 2549 : HydrogenCodeStub(isolate, init_state), mode_(RESULT_AS_SMI) {} |
| 2529 | 2550 |
| 2530 Types types_; | 2551 Types types_; |
| 2531 ResultMode mode_; | 2552 ResultMode mode_; |
| 2532 }; | 2553 }; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2577 static const Register ObjectRegister() { | 2598 static const Register ObjectRegister() { |
| 2578 return StoreConvention::ReceiverRegister(); | 2599 return StoreConvention::ReceiverRegister(); |
| 2579 } | 2600 } |
| 2580 | 2601 |
| 2581 private: | 2602 private: |
| 2582 class FromBits: public BitField<ElementsKind, 0, 8> {}; | 2603 class FromBits: public BitField<ElementsKind, 0, 8> {}; |
| 2583 class ToBits: public BitField<ElementsKind, 8, 8> {}; | 2604 class ToBits: public BitField<ElementsKind, 8, 8> {}; |
| 2584 class IsJSArrayBits: public BitField<bool, 16, 1> {}; | 2605 class IsJSArrayBits: public BitField<bool, 16, 1> {}; |
| 2585 class StoreModeBits: public BitField<KeyedAccessStoreMode, 17, 4> {}; | 2606 class StoreModeBits: public BitField<KeyedAccessStoreMode, 17, 4> {}; |
| 2586 | 2607 |
| 2587 Major MajorKey() const { return ElementsTransitionAndStore; } | 2608 virtual Major MajorKey() const V8_OVERRIDE { |
| 2609 return ElementsTransitionAndStore; |
| 2610 } |
| 2588 int NotMissMinorKey() const { | 2611 int NotMissMinorKey() const { |
| 2589 return FromBits::encode(from_kind_) | | 2612 return FromBits::encode(from_kind_) | |
| 2590 ToBits::encode(to_kind_) | | 2613 ToBits::encode(to_kind_) | |
| 2591 IsJSArrayBits::encode(is_jsarray_) | | 2614 IsJSArrayBits::encode(is_jsarray_) | |
| 2592 StoreModeBits::encode(store_mode_); | 2615 StoreModeBits::encode(store_mode_); |
| 2593 } | 2616 } |
| 2594 | 2617 |
| 2595 ElementsKind from_kind_; | 2618 ElementsKind from_kind_; |
| 2596 ElementsKind to_kind_; | 2619 ElementsKind to_kind_; |
| 2597 bool is_jsarray_; | 2620 bool is_jsarray_; |
| 2598 KeyedAccessStoreMode store_mode_; | 2621 KeyedAccessStoreMode store_mode_; |
| 2599 | 2622 |
| 2600 DISALLOW_COPY_AND_ASSIGN(ElementsTransitionAndStoreStub); | 2623 DISALLOW_COPY_AND_ASSIGN(ElementsTransitionAndStoreStub); |
| 2601 }; | 2624 }; |
| 2602 | 2625 |
| 2603 | 2626 |
| 2604 class StoreArrayLiteralElementStub : public PlatformCodeStub { | 2627 class StoreArrayLiteralElementStub : public PlatformCodeStub { |
| 2605 public: | 2628 public: |
| 2606 explicit StoreArrayLiteralElementStub(Isolate* isolate) | 2629 explicit StoreArrayLiteralElementStub(Isolate* isolate) |
| 2607 : PlatformCodeStub(isolate) { } | 2630 : PlatformCodeStub(isolate) { } |
| 2608 | 2631 |
| 2609 private: | 2632 private: |
| 2610 Major MajorKey() const { return StoreArrayLiteralElement; } | 2633 virtual Major MajorKey() const V8_OVERRIDE { |
| 2634 return StoreArrayLiteralElement; |
| 2635 } |
| 2611 | 2636 |
| 2612 void Generate(MacroAssembler* masm); | 2637 void Generate(MacroAssembler* masm); |
| 2613 | 2638 |
| 2614 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); | 2639 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); |
| 2615 }; | 2640 }; |
| 2616 | 2641 |
| 2617 | 2642 |
| 2618 class StubFailureTrampolineStub : public PlatformCodeStub { | 2643 class StubFailureTrampolineStub : public PlatformCodeStub { |
| 2619 public: | 2644 public: |
| 2620 StubFailureTrampolineStub(Isolate* isolate, StubFunctionMode function_mode) | 2645 StubFailureTrampolineStub(Isolate* isolate, StubFunctionMode function_mode) |
| 2621 : PlatformCodeStub(isolate) { | 2646 : PlatformCodeStub(isolate) { |
| 2622 minor_key_ = FunctionModeField::encode(function_mode); | 2647 minor_key_ = FunctionModeField::encode(function_mode); |
| 2623 } | 2648 } |
| 2624 | 2649 |
| 2625 static void GenerateAheadOfTime(Isolate* isolate); | 2650 static void GenerateAheadOfTime(Isolate* isolate); |
| 2626 | 2651 |
| 2627 private: | 2652 private: |
| 2628 Major MajorKey() const { return StubFailureTrampoline; } | 2653 virtual Major MajorKey() const V8_OVERRIDE { return StubFailureTrampoline; } |
| 2629 | 2654 |
| 2630 StubFunctionMode function_mode() const { | 2655 StubFunctionMode function_mode() const { |
| 2631 return FunctionModeField::decode(minor_key_); | 2656 return FunctionModeField::decode(minor_key_); |
| 2632 } | 2657 } |
| 2633 | 2658 |
| 2634 void Generate(MacroAssembler* masm); | 2659 void Generate(MacroAssembler* masm); |
| 2635 | 2660 |
| 2636 class FunctionModeField : public BitField<StubFunctionMode, 0, 1> {}; | 2661 class FunctionModeField : public BitField<StubFunctionMode, 0, 1> {}; |
| 2637 | 2662 |
| 2638 DISALLOW_COPY_AND_ASSIGN(StubFailureTrampolineStub); | 2663 DISALLOW_COPY_AND_ASSIGN(StubFailureTrampolineStub); |
| 2639 }; | 2664 }; |
| 2640 | 2665 |
| 2641 | 2666 |
| 2642 class ProfileEntryHookStub : public PlatformCodeStub { | 2667 class ProfileEntryHookStub : public PlatformCodeStub { |
| 2643 public: | 2668 public: |
| 2644 explicit ProfileEntryHookStub(Isolate* isolate) : PlatformCodeStub(isolate) {} | 2669 explicit ProfileEntryHookStub(Isolate* isolate) : PlatformCodeStub(isolate) {} |
| 2645 | 2670 |
| 2646 // The profile entry hook function is not allowed to cause a GC. | 2671 // The profile entry hook function is not allowed to cause a GC. |
| 2647 virtual bool SometimesSetsUpAFrame() { return false; } | 2672 virtual bool SometimesSetsUpAFrame() { return false; } |
| 2648 | 2673 |
| 2649 // Generates a call to the entry hook if it's enabled. | 2674 // Generates a call to the entry hook if it's enabled. |
| 2650 static void MaybeCallEntryHook(MacroAssembler* masm); | 2675 static void MaybeCallEntryHook(MacroAssembler* masm); |
| 2651 | 2676 |
| 2652 private: | 2677 private: |
| 2653 static void EntryHookTrampoline(intptr_t function, | 2678 static void EntryHookTrampoline(intptr_t function, |
| 2654 intptr_t stack_pointer, | 2679 intptr_t stack_pointer, |
| 2655 Isolate* isolate); | 2680 Isolate* isolate); |
| 2656 | 2681 |
| 2657 Major MajorKey() const { return ProfileEntryHook; } | 2682 virtual Major MajorKey() const V8_OVERRIDE { return ProfileEntryHook; } |
| 2658 | 2683 |
| 2659 void Generate(MacroAssembler* masm); | 2684 void Generate(MacroAssembler* masm); |
| 2660 | 2685 |
| 2661 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 2686 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); |
| 2662 }; | 2687 }; |
| 2663 | 2688 |
| 2664 | 2689 |
| 2665 class CallDescriptors { | 2690 class CallDescriptors { |
| 2666 public: | 2691 public: |
| 2667 static void InitializeForIsolate(Isolate* isolate); | 2692 static void InitializeForIsolate(Isolate* isolate); |
| 2668 }; | 2693 }; |
| 2669 | 2694 |
| 2670 } } // namespace v8::internal | 2695 } } // namespace v8::internal |
| 2671 | 2696 |
| 2672 #endif // V8_CODE_STUBS_H_ | 2697 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |