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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
164 // they are running. If that is the case they should override this to return | 164 // they are running. If that is the case they should override this to return |
165 // true, which will cause an assertion if we try to call something that can | 165 // true, which will cause an assertion if we try to call something that can |
166 // GC or if we try to put a stack frame on top of the junk, which would not | 166 // GC or if we try to put a stack frame on top of the junk, which would not |
167 // result in a traversable stack. | 167 // result in a traversable stack. |
168 virtual bool SometimesSetsUpAFrame() { return true; } | 168 virtual bool SometimesSetsUpAFrame() { return true; } |
169 | 169 |
170 // Lookup the code in the (possibly custom) cache. | 170 // Lookup the code in the (possibly custom) cache. |
171 bool FindCodeInCache(Code** code_out); | 171 bool FindCodeInCache(Code** code_out); |
172 | 172 |
173 // Returns information for computing the number key. | 173 // Returns information for computing the number key. |
174 virtual Major MajorKey() = 0; | 174 virtual Major MajorKey() const = 0; |
175 virtual int MinorKey() = 0; | 175 virtual int MinorKey() const = 0; |
176 | 176 |
177 virtual InlineCacheState GetICState() { | 177 virtual InlineCacheState GetICState() { |
178 return UNINITIALIZED; | 178 return UNINITIALIZED; |
179 } | 179 } |
180 virtual ExtraICState GetExtraICState() { | 180 virtual ExtraICState GetExtraICState() const { |
181 return kNoExtraICState; | 181 return kNoExtraICState; |
182 } | 182 } |
183 virtual Code::StubType GetStubType() { | 183 virtual Code::StubType GetStubType() { |
184 return Code::NORMAL; | 184 return Code::NORMAL; |
185 } | 185 } |
186 | 186 |
187 virtual void PrintName(StringStream* stream); | 187 friend OStream& operator<<(OStream& os, const CodeStub& s) { |
188 | 188 return s.PrintName(os); |
189 // Returns a name for logging/debugging purposes. | 189 } |
190 SmartArrayPointer<const char> GetName(); | |
191 | 190 |
192 Isolate* isolate() const { return isolate_; } | 191 Isolate* isolate() const { return isolate_; } |
193 | 192 |
194 protected: | 193 protected: |
195 // Generates the assembler code for the stub. | 194 // Generates the assembler code for the stub. |
196 virtual Handle<Code> GenerateCode() = 0; | 195 virtual Handle<Code> GenerateCode() = 0; |
197 | 196 |
198 // Returns whether the code generated for this stub needs to be allocated as | 197 // Returns whether the code generated for this stub needs to be allocated as |
199 // a fixed (non-moveable) code object. | 198 // a fixed (non-moveable) code object. |
200 virtual bool NeedsImmovableCode() { return false; } | 199 virtual bool NeedsImmovableCode() { return false; } |
201 | 200 |
202 virtual void PrintBaseName(StringStream* stream); | 201 virtual OStream& PrintName(OStream& os) const; // NOLINT |
Michael Starzinger
2014/07/02 15:14:58
suggestion: We could switch the PrintFoo methods t
Sven Panne
2014/07/03 07:18:52
Done.
| |
203 virtual void PrintState(StringStream* stream) { } | 202 virtual OStream& PrintBaseName(OStream& os) const; // NOLINT |
203 virtual OStream& PrintState(OStream& os) const { return os; } // NOLINT | |
204 | 204 |
205 private: | 205 private: |
206 // Perform bookkeeping required after code generation when stub code is | 206 // Perform bookkeeping required after code generation when stub code is |
207 // initially generated. | 207 // initially generated. |
208 void RecordCodeGeneration(Handle<Code> code); | 208 void RecordCodeGeneration(Handle<Code> code); |
209 | 209 |
210 // Finish the code object after it has been generated. | 210 // Finish the code object after it has been generated. |
211 virtual void FinishCode(Handle<Code> code) { } | 211 virtual void FinishCode(Handle<Code> code) { } |
212 | 212 |
213 // Activate newly generated stub. Is called after | 213 // Activate newly generated stub. Is called after |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
440 SubClass::GenerateAheadOfTime(isolate); | 440 SubClass::GenerateAheadOfTime(isolate); |
441 return SubClass().GetCode(isolate); | 441 return SubClass().GetCode(isolate); |
442 } | 442 } |
443 | 443 |
444 virtual void InitializeInterfaceDescriptor( | 444 virtual void InitializeInterfaceDescriptor( |
445 CodeStubInterfaceDescriptor* descriptor) = 0; | 445 CodeStubInterfaceDescriptor* descriptor) = 0; |
446 | 446 |
447 // Retrieve the code for the stub. Generate the code if needed. | 447 // Retrieve the code for the stub. Generate the code if needed. |
448 virtual Handle<Code> GenerateCode() = 0; | 448 virtual Handle<Code> GenerateCode() = 0; |
449 | 449 |
450 virtual int NotMissMinorKey() = 0; | 450 virtual int NotMissMinorKey() const = 0; |
451 | 451 |
452 Handle<Code> GenerateLightweightMissCode(); | 452 Handle<Code> GenerateLightweightMissCode(); |
453 | 453 |
454 template<class StateType> | 454 template<class StateType> |
455 void TraceTransition(StateType from, StateType to); | 455 void TraceTransition(StateType from, StateType to); |
456 | 456 |
457 private: | 457 private: |
458 class MinorKeyBits: public BitField<int, 0, kStubMinorKeyBits - 1> {}; | 458 class MinorKeyBits: public BitField<int, 0, kStubMinorKeyBits - 1> {}; |
459 class IsMissBits: public BitField<bool, kStubMinorKeyBits - 1, 1> {}; | 459 class IsMissBits: public BitField<bool, kStubMinorKeyBits - 1, 1> {}; |
460 | 460 |
461 void GenerateLightweightMiss(MacroAssembler* masm); | 461 void GenerateLightweightMiss(MacroAssembler* masm); |
462 virtual int MinorKey() { | 462 virtual int MinorKey() const { |
463 return IsMissBits::encode(is_uninitialized_) | | 463 return IsMissBits::encode(is_uninitialized_) | |
464 MinorKeyBits::encode(NotMissMinorKey()); | 464 MinorKeyBits::encode(NotMissMinorKey()); |
465 } | 465 } |
466 | 466 |
467 bool is_uninitialized_; | 467 bool is_uninitialized_; |
468 }; | 468 }; |
469 | 469 |
470 | 470 |
471 // Helper interface to prepare to/restore after making runtime calls. | 471 // Helper interface to prepare to/restore after making runtime calls. |
472 class RuntimeCallHelper { | 472 class RuntimeCallHelper { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
539 virtual void InitializeInterfaceDescriptor( | 539 virtual void InitializeInterfaceDescriptor( |
540 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 540 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
541 | 541 |
542 static void InstallDescriptors(Isolate* isolate) { | 542 static void InstallDescriptors(Isolate* isolate) { |
543 ToNumberStub stub(isolate); | 543 ToNumberStub stub(isolate); |
544 stub.InitializeInterfaceDescriptor( | 544 stub.InitializeInterfaceDescriptor( |
545 isolate->code_stub_interface_descriptor(CodeStub::ToNumber)); | 545 isolate->code_stub_interface_descriptor(CodeStub::ToNumber)); |
546 } | 546 } |
547 | 547 |
548 private: | 548 private: |
549 Major MajorKey() { return ToNumber; } | 549 Major MajorKey() const { return ToNumber; } |
550 int NotMissMinorKey() { return 0; } | 550 int NotMissMinorKey() const { return 0; } |
551 }; | 551 }; |
552 | 552 |
553 | 553 |
554 class NumberToStringStub V8_FINAL : public HydrogenCodeStub { | 554 class NumberToStringStub V8_FINAL : public HydrogenCodeStub { |
555 public: | 555 public: |
556 explicit NumberToStringStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} | 556 explicit NumberToStringStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} |
557 | 557 |
558 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 558 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
559 | 559 |
560 virtual void InitializeInterfaceDescriptor( | 560 virtual void InitializeInterfaceDescriptor( |
561 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 561 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
562 | 562 |
563 static void InstallDescriptors(Isolate* isolate); | 563 static void InstallDescriptors(Isolate* isolate); |
564 | 564 |
565 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 565 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
566 static const int kNumber = 0; | 566 static const int kNumber = 0; |
567 | 567 |
568 private: | 568 private: |
569 virtual Major MajorKey() V8_OVERRIDE { return NumberToString; } | 569 virtual Major MajorKey() const V8_OVERRIDE { return NumberToString; } |
570 virtual int NotMissMinorKey() V8_OVERRIDE { return 0; } | 570 virtual int NotMissMinorKey() const V8_OVERRIDE { return 0; } |
571 }; | 571 }; |
572 | 572 |
573 | 573 |
574 class FastNewClosureStub : public HydrogenCodeStub { | 574 class FastNewClosureStub : public HydrogenCodeStub { |
575 public: | 575 public: |
576 FastNewClosureStub(Isolate* isolate, | 576 FastNewClosureStub(Isolate* isolate, |
577 StrictMode strict_mode, | 577 StrictMode strict_mode, |
578 bool is_generator) | 578 bool is_generator) |
579 : HydrogenCodeStub(isolate), | 579 : HydrogenCodeStub(isolate), |
580 strict_mode_(strict_mode), | 580 strict_mode_(strict_mode), |
581 is_generator_(is_generator) { } | 581 is_generator_(is_generator) { } |
582 | 582 |
583 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 583 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
584 | 584 |
585 virtual void InitializeInterfaceDescriptor( | 585 virtual void InitializeInterfaceDescriptor( |
586 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 586 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
587 | 587 |
588 static void InstallDescriptors(Isolate* isolate); | 588 static void InstallDescriptors(Isolate* isolate); |
589 | 589 |
590 StrictMode strict_mode() const { return strict_mode_; } | 590 StrictMode strict_mode() const { return strict_mode_; } |
591 bool is_generator() const { return is_generator_; } | 591 bool is_generator() const { return is_generator_; } |
592 | 592 |
593 private: | 593 private: |
594 class StrictModeBits: public BitField<bool, 0, 1> {}; | 594 class StrictModeBits: public BitField<bool, 0, 1> {}; |
595 class IsGeneratorBits: public BitField<bool, 1, 1> {}; | 595 class IsGeneratorBits: public BitField<bool, 1, 1> {}; |
596 | 596 |
597 Major MajorKey() { return FastNewClosure; } | 597 Major MajorKey() const { return FastNewClosure; } |
598 int NotMissMinorKey() { | 598 int NotMissMinorKey() const { |
599 return StrictModeBits::encode(strict_mode_ == STRICT) | | 599 return StrictModeBits::encode(strict_mode_ == STRICT) | |
600 IsGeneratorBits::encode(is_generator_); | 600 IsGeneratorBits::encode(is_generator_); |
601 } | 601 } |
602 | 602 |
603 StrictMode strict_mode_; | 603 StrictMode strict_mode_; |
604 bool is_generator_; | 604 bool is_generator_; |
605 }; | 605 }; |
606 | 606 |
607 | 607 |
608 class FastNewContextStub V8_FINAL : public HydrogenCodeStub { | 608 class FastNewContextStub V8_FINAL : public HydrogenCodeStub { |
609 public: | 609 public: |
610 static const int kMaximumSlots = 64; | 610 static const int kMaximumSlots = 64; |
611 | 611 |
612 FastNewContextStub(Isolate* isolate, int slots) | 612 FastNewContextStub(Isolate* isolate, int slots) |
613 : HydrogenCodeStub(isolate), slots_(slots) { | 613 : HydrogenCodeStub(isolate), slots_(slots) { |
614 ASSERT(slots_ > 0 && slots_ <= kMaximumSlots); | 614 ASSERT(slots_ > 0 && slots_ <= kMaximumSlots); |
615 } | 615 } |
616 | 616 |
617 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 617 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
618 | 618 |
619 virtual void InitializeInterfaceDescriptor( | 619 virtual void InitializeInterfaceDescriptor( |
620 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 620 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
621 | 621 |
622 static void InstallDescriptors(Isolate* isolate); | 622 static void InstallDescriptors(Isolate* isolate); |
623 | 623 |
624 int slots() const { return slots_; } | 624 int slots() const { return slots_; } |
625 | 625 |
626 virtual Major MajorKey() V8_OVERRIDE { return FastNewContext; } | 626 virtual Major MajorKey() const V8_OVERRIDE { return FastNewContext; } |
627 virtual int NotMissMinorKey() V8_OVERRIDE { return slots_; } | 627 virtual int NotMissMinorKey() const V8_OVERRIDE { return slots_; } |
628 | 628 |
629 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 629 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
630 static const int kFunction = 0; | 630 static const int kFunction = 0; |
631 | 631 |
632 private: | 632 private: |
633 int slots_; | 633 int slots_; |
634 }; | 634 }; |
635 | 635 |
636 | 636 |
637 class FastCloneShallowArrayStub : public HydrogenCodeStub { | 637 class FastCloneShallowArrayStub : public HydrogenCodeStub { |
(...skipping 12 matching lines...) Expand all Loading... | |
650 virtual void InitializeInterfaceDescriptor( | 650 virtual void InitializeInterfaceDescriptor( |
651 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 651 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
652 | 652 |
653 static void InstallDescriptors(Isolate* isolate); | 653 static void InstallDescriptors(Isolate* isolate); |
654 | 654 |
655 private: | 655 private: |
656 AllocationSiteMode allocation_site_mode_; | 656 AllocationSiteMode allocation_site_mode_; |
657 | 657 |
658 class AllocationSiteModeBits: public BitField<AllocationSiteMode, 0, 1> {}; | 658 class AllocationSiteModeBits: public BitField<AllocationSiteMode, 0, 1> {}; |
659 // Ensure data fits within available bits. | 659 // Ensure data fits within available bits. |
660 Major MajorKey() { return FastCloneShallowArray; } | 660 Major MajorKey() const { return FastCloneShallowArray; } |
661 int NotMissMinorKey() { | 661 int NotMissMinorKey() const { |
662 return AllocationSiteModeBits::encode(allocation_site_mode_); | 662 return AllocationSiteModeBits::encode(allocation_site_mode_); |
663 } | 663 } |
664 }; | 664 }; |
665 | 665 |
666 | 666 |
667 class FastCloneShallowObjectStub : public HydrogenCodeStub { | 667 class FastCloneShallowObjectStub : public HydrogenCodeStub { |
668 public: | 668 public: |
669 // Maximum number of properties in copied object. | 669 // Maximum number of properties in copied object. |
670 static const int kMaximumClonedProperties = 6; | 670 static const int kMaximumClonedProperties = 6; |
671 | 671 |
672 FastCloneShallowObjectStub(Isolate* isolate, int length) | 672 FastCloneShallowObjectStub(Isolate* isolate, int length) |
673 : HydrogenCodeStub(isolate), length_(length) { | 673 : HydrogenCodeStub(isolate), length_(length) { |
674 ASSERT_GE(length_, 0); | 674 ASSERT_GE(length_, 0); |
675 ASSERT_LE(length_, kMaximumClonedProperties); | 675 ASSERT_LE(length_, kMaximumClonedProperties); |
676 } | 676 } |
677 | 677 |
678 int length() const { return length_; } | 678 int length() const { return length_; } |
679 | 679 |
680 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 680 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
681 | 681 |
682 virtual void InitializeInterfaceDescriptor( | 682 virtual void InitializeInterfaceDescriptor( |
683 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 683 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
684 | 684 |
685 private: | 685 private: |
686 int length_; | 686 int length_; |
687 | 687 |
688 Major MajorKey() { return FastCloneShallowObject; } | 688 Major MajorKey() const { return FastCloneShallowObject; } |
689 int NotMissMinorKey() { return length_; } | 689 int NotMissMinorKey() const { return length_; } |
690 | 690 |
691 DISALLOW_COPY_AND_ASSIGN(FastCloneShallowObjectStub); | 691 DISALLOW_COPY_AND_ASSIGN(FastCloneShallowObjectStub); |
692 }; | 692 }; |
693 | 693 |
694 | 694 |
695 class CreateAllocationSiteStub : public HydrogenCodeStub { | 695 class CreateAllocationSiteStub : public HydrogenCodeStub { |
696 public: | 696 public: |
697 explicit CreateAllocationSiteStub(Isolate* isolate) | 697 explicit CreateAllocationSiteStub(Isolate* isolate) |
698 : HydrogenCodeStub(isolate) { } | 698 : HydrogenCodeStub(isolate) { } |
699 | 699 |
700 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 700 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
701 | 701 |
702 static void GenerateAheadOfTime(Isolate* isolate); | 702 static void GenerateAheadOfTime(Isolate* isolate); |
703 | 703 |
704 virtual void InitializeInterfaceDescriptor( | 704 virtual void InitializeInterfaceDescriptor( |
705 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 705 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
706 | 706 |
707 private: | 707 private: |
708 Major MajorKey() { return CreateAllocationSite; } | 708 Major MajorKey() const { return CreateAllocationSite; } |
709 int NotMissMinorKey() { return 0; } | 709 int NotMissMinorKey() const { return 0; } |
710 | 710 |
711 DISALLOW_COPY_AND_ASSIGN(CreateAllocationSiteStub); | 711 DISALLOW_COPY_AND_ASSIGN(CreateAllocationSiteStub); |
712 }; | 712 }; |
713 | 713 |
714 | 714 |
715 class InstanceofStub: public PlatformCodeStub { | 715 class InstanceofStub: public PlatformCodeStub { |
716 public: | 716 public: |
717 enum Flags { | 717 enum Flags { |
718 kNoFlags = 0, | 718 kNoFlags = 0, |
719 kArgsInRegisters = 1 << 0, | 719 kArgsInRegisters = 1 << 0, |
720 kCallSiteInlineCheck = 1 << 1, | 720 kCallSiteInlineCheck = 1 << 1, |
721 kReturnTrueFalseObject = 1 << 2 | 721 kReturnTrueFalseObject = 1 << 2 |
722 }; | 722 }; |
723 | 723 |
724 InstanceofStub(Isolate* isolate, Flags flags) | 724 InstanceofStub(Isolate* isolate, Flags flags) |
725 : PlatformCodeStub(isolate), flags_(flags) { } | 725 : PlatformCodeStub(isolate), flags_(flags) { } |
726 | 726 |
727 static Register left(); | 727 static Register left(); |
728 static Register right(); | 728 static Register right(); |
729 | 729 |
730 void Generate(MacroAssembler* masm); | 730 void Generate(MacroAssembler* masm); |
731 | 731 |
732 private: | 732 private: |
733 Major MajorKey() { return Instanceof; } | 733 Major MajorKey() const { return Instanceof; } |
734 int MinorKey() { return static_cast<int>(flags_); } | 734 int MinorKey() const { return static_cast<int>(flags_); } |
735 | 735 |
736 bool HasArgsInRegisters() const { | 736 bool HasArgsInRegisters() const { |
737 return (flags_ & kArgsInRegisters) != 0; | 737 return (flags_ & kArgsInRegisters) != 0; |
738 } | 738 } |
739 | 739 |
740 bool HasCallSiteInlineCheck() const { | 740 bool HasCallSiteInlineCheck() const { |
741 return (flags_ & kCallSiteInlineCheck) != 0; | 741 return (flags_ & kCallSiteInlineCheck) != 0; |
742 } | 742 } |
743 | 743 |
744 bool ReturnTrueFalseObject() const { | 744 bool ReturnTrueFalseObject() const { |
745 return (flags_ & kReturnTrueFalseObject) != 0; | 745 return (flags_ & kReturnTrueFalseObject) != 0; |
746 } | 746 } |
747 | 747 |
748 virtual void PrintName(StringStream* stream); | 748 virtual OStream& PrintName(OStream& os) const V8_OVERRIDE; // NOLINT |
749 | 749 |
750 Flags flags_; | 750 Flags flags_; |
751 }; | 751 }; |
752 | 752 |
753 | 753 |
754 enum AllocationSiteOverrideMode { | 754 enum AllocationSiteOverrideMode { |
755 DONT_OVERRIDE, | 755 DONT_OVERRIDE, |
756 DISABLE_ALLOCATION_SITES, | 756 DISABLE_ALLOCATION_SITES, |
757 LAST_ALLOCATION_SITE_OVERRIDE_MODE = DISABLE_ALLOCATION_SITES | 757 LAST_ALLOCATION_SITE_OVERRIDE_MODE = DISABLE_ALLOCATION_SITES |
758 }; | 758 }; |
759 | 759 |
760 | 760 |
761 class ArrayConstructorStub: public PlatformCodeStub { | 761 class ArrayConstructorStub: public PlatformCodeStub { |
762 public: | 762 public: |
763 enum ArgumentCountKey { ANY, NONE, ONE, MORE_THAN_ONE }; | 763 enum ArgumentCountKey { ANY, NONE, ONE, MORE_THAN_ONE }; |
764 ArrayConstructorStub(Isolate* isolate, int argument_count); | 764 ArrayConstructorStub(Isolate* isolate, int argument_count); |
765 explicit ArrayConstructorStub(Isolate* isolate); | 765 explicit ArrayConstructorStub(Isolate* isolate); |
766 | 766 |
767 void Generate(MacroAssembler* masm); | 767 void Generate(MacroAssembler* masm); |
768 | 768 |
769 private: | 769 private: |
770 void GenerateDispatchToArrayStub(MacroAssembler* masm, | 770 void GenerateDispatchToArrayStub(MacroAssembler* masm, |
771 AllocationSiteOverrideMode mode); | 771 AllocationSiteOverrideMode mode); |
772 virtual void PrintName(StringStream* stream); | 772 virtual OStream& PrintName(OStream& os) const V8_OVERRIDE; // NOLINT |
773 | 773 |
774 virtual CodeStub::Major MajorKey() { return ArrayConstructor; } | 774 virtual CodeStub::Major MajorKey() const { return ArrayConstructor; } |
775 virtual int MinorKey() { return argument_count_; } | 775 virtual int MinorKey() const { return argument_count_; } |
776 | 776 |
777 ArgumentCountKey argument_count_; | 777 ArgumentCountKey argument_count_; |
778 }; | 778 }; |
779 | 779 |
780 | 780 |
781 class InternalArrayConstructorStub: public PlatformCodeStub { | 781 class InternalArrayConstructorStub: public PlatformCodeStub { |
782 public: | 782 public: |
783 explicit InternalArrayConstructorStub(Isolate* isolate); | 783 explicit InternalArrayConstructorStub(Isolate* isolate); |
784 | 784 |
785 void Generate(MacroAssembler* masm); | 785 void Generate(MacroAssembler* masm); |
786 | 786 |
787 private: | 787 private: |
788 virtual CodeStub::Major MajorKey() { return InternalArrayConstructor; } | 788 virtual CodeStub::Major MajorKey() const { return InternalArrayConstructor; } |
789 virtual int MinorKey() { return 0; } | 789 virtual int MinorKey() const { return 0; } |
790 | 790 |
791 void GenerateCase(MacroAssembler* masm, ElementsKind kind); | 791 void GenerateCase(MacroAssembler* masm, ElementsKind kind); |
792 }; | 792 }; |
793 | 793 |
794 | 794 |
795 class MathPowStub: public PlatformCodeStub { | 795 class MathPowStub: public PlatformCodeStub { |
796 public: | 796 public: |
797 enum ExponentType { INTEGER, DOUBLE, TAGGED, ON_STACK }; | 797 enum ExponentType { INTEGER, DOUBLE, TAGGED, ON_STACK }; |
798 | 798 |
799 MathPowStub(Isolate* isolate, ExponentType exponent_type) | 799 MathPowStub(Isolate* isolate, ExponentType exponent_type) |
800 : PlatformCodeStub(isolate), exponent_type_(exponent_type) { } | 800 : PlatformCodeStub(isolate), exponent_type_(exponent_type) { } |
801 virtual void Generate(MacroAssembler* masm); | 801 virtual void Generate(MacroAssembler* masm); |
802 | 802 |
803 private: | 803 private: |
804 virtual CodeStub::Major MajorKey() { return MathPow; } | 804 virtual CodeStub::Major MajorKey() const { return MathPow; } |
805 virtual int MinorKey() { return exponent_type_; } | 805 virtual int MinorKey() const { return exponent_type_; } |
806 | 806 |
807 ExponentType exponent_type_; | 807 ExponentType exponent_type_; |
808 }; | 808 }; |
809 | 809 |
810 | 810 |
811 class ICStub: public PlatformCodeStub { | 811 class ICStub: public PlatformCodeStub { |
812 public: | 812 public: |
813 ICStub(Isolate* isolate, Code::Kind kind) | 813 ICStub(Isolate* isolate, Code::Kind kind) |
814 : PlatformCodeStub(isolate), kind_(kind) { } | 814 : PlatformCodeStub(isolate), kind_(kind) { } |
815 virtual Code::Kind GetCodeKind() const { return kind_; } | 815 virtual Code::Kind GetCodeKind() const { return kind_; } |
816 virtual InlineCacheState GetICState() { return MONOMORPHIC; } | 816 virtual InlineCacheState GetICState() { return MONOMORPHIC; } |
817 | 817 |
818 bool Describes(Code* code) { | 818 bool Describes(Code* code) { |
819 return GetMajorKey(code) == MajorKey() && code->stub_info() == MinorKey(); | 819 return GetMajorKey(code) == MajorKey() && code->stub_info() == MinorKey(); |
820 } | 820 } |
821 | 821 |
822 protected: | 822 protected: |
823 class KindBits: public BitField<Code::Kind, 0, 4> {}; | 823 class KindBits: public BitField<Code::Kind, 0, 4> {}; |
824 virtual void FinishCode(Handle<Code> code) { | 824 virtual void FinishCode(Handle<Code> code) { |
825 code->set_stub_info(MinorKey()); | 825 code->set_stub_info(MinorKey()); |
826 } | 826 } |
827 Code::Kind kind() { return kind_; } | 827 Code::Kind kind() const { return kind_; } |
828 | 828 |
829 virtual int MinorKey() { | 829 virtual int MinorKey() const { |
830 return KindBits::encode(kind_); | 830 return KindBits::encode(kind_); |
831 } | 831 } |
832 | 832 |
833 private: | 833 private: |
834 Code::Kind kind_; | 834 Code::Kind kind_; |
835 }; | 835 }; |
836 | 836 |
837 | 837 |
838 class CallICStub: public PlatformCodeStub { | 838 class CallICStub: public PlatformCodeStub { |
839 public: | 839 public: |
(...skipping 12 matching lines...) Expand all Loading... | |
852 virtual void Generate(MacroAssembler* masm); | 852 virtual void Generate(MacroAssembler* masm); |
853 | 853 |
854 virtual Code::Kind GetCodeKind() const V8_OVERRIDE { | 854 virtual Code::Kind GetCodeKind() const V8_OVERRIDE { |
855 return Code::CALL_IC; | 855 return Code::CALL_IC; |
856 } | 856 } |
857 | 857 |
858 virtual InlineCacheState GetICState() V8_FINAL V8_OVERRIDE { | 858 virtual InlineCacheState GetICState() V8_FINAL V8_OVERRIDE { |
859 return state_.GetICState(); | 859 return state_.GetICState(); |
860 } | 860 } |
861 | 861 |
862 virtual ExtraICState GetExtraICState() V8_FINAL V8_OVERRIDE { | 862 virtual ExtraICState GetExtraICState() const V8_FINAL V8_OVERRIDE { |
863 return state_.GetExtraICState(); | 863 return state_.GetExtraICState(); |
864 } | 864 } |
865 | 865 |
866 protected: | 866 protected: |
867 virtual int MinorKey() { return GetExtraICState(); } | 867 virtual int MinorKey() const { return GetExtraICState(); } |
868 virtual void PrintState(StringStream* stream) V8_OVERRIDE; | 868 virtual OStream& PrintState(OStream& os) const V8_OVERRIDE; // NOLINT |
869 | 869 |
870 virtual CodeStub::Major MajorKey() { return CallIC; } | 870 virtual CodeStub::Major MajorKey() const { return CallIC; } |
871 | 871 |
872 // Code generation helpers. | 872 // Code generation helpers. |
873 void GenerateMiss(MacroAssembler* masm, IC::UtilityId id); | 873 void GenerateMiss(MacroAssembler* masm, IC::UtilityId id); |
874 | 874 |
875 const CallIC::State state_; | 875 const CallIC::State state_; |
876 }; | 876 }; |
877 | 877 |
878 | 878 |
879 class CallIC_ArrayStub: public CallICStub { | 879 class CallIC_ArrayStub: public CallICStub { |
880 public: | 880 public: |
881 CallIC_ArrayStub(Isolate* isolate, const CallIC::State& state_in) | 881 CallIC_ArrayStub(Isolate* isolate, const CallIC::State& state_in) |
882 : CallICStub(isolate, state_in) {} | 882 : CallICStub(isolate, state_in) {} |
883 | 883 |
884 virtual void Generate(MacroAssembler* masm); | 884 virtual void Generate(MacroAssembler* masm); |
885 | 885 |
886 protected: | 886 protected: |
887 virtual void PrintState(StringStream* stream) V8_OVERRIDE; | 887 virtual OStream& PrintState(OStream& os) const V8_OVERRIDE; // NOLINT |
888 | 888 |
889 virtual CodeStub::Major MajorKey() { return CallIC_Array; } | 889 virtual CodeStub::Major MajorKey() const { return CallIC_Array; } |
890 }; | 890 }; |
891 | 891 |
892 | 892 |
893 class FunctionPrototypeStub: public ICStub { | 893 class FunctionPrototypeStub: public ICStub { |
894 public: | 894 public: |
895 FunctionPrototypeStub(Isolate* isolate, Code::Kind kind) | 895 FunctionPrototypeStub(Isolate* isolate, Code::Kind kind) |
896 : ICStub(isolate, kind) { } | 896 : ICStub(isolate, kind) { } |
897 virtual void Generate(MacroAssembler* masm); | 897 virtual void Generate(MacroAssembler* masm); |
898 | 898 |
899 private: | 899 private: |
900 virtual CodeStub::Major MajorKey() { return FunctionPrototype; } | 900 virtual CodeStub::Major MajorKey() const { return FunctionPrototype; } |
901 }; | 901 }; |
902 | 902 |
903 | 903 |
904 class StoreICStub: public ICStub { | 904 class StoreICStub: public ICStub { |
905 public: | 905 public: |
906 StoreICStub(Isolate* isolate, Code::Kind kind, StrictMode strict_mode) | 906 StoreICStub(Isolate* isolate, Code::Kind kind, StrictMode strict_mode) |
907 : ICStub(isolate, kind), strict_mode_(strict_mode) { } | 907 : ICStub(isolate, kind), strict_mode_(strict_mode) { } |
908 | 908 |
909 protected: | 909 protected: |
910 virtual ExtraICState GetExtraICState() { | 910 virtual ExtraICState GetExtraICState() const { |
911 return StoreIC::ComputeExtraICState(strict_mode_); | 911 return StoreIC::ComputeExtraICState(strict_mode_); |
912 } | 912 } |
913 | 913 |
914 private: | 914 private: |
915 STATIC_ASSERT(KindBits::kSize == 4); | 915 STATIC_ASSERT(KindBits::kSize == 4); |
916 class StrictModeBits: public BitField<bool, 4, 1> {}; | 916 class StrictModeBits: public BitField<bool, 4, 1> {}; |
917 virtual int MinorKey() { | 917 virtual int MinorKey() const { |
918 return KindBits::encode(kind()) | StrictModeBits::encode(strict_mode_); | 918 return KindBits::encode(kind()) | StrictModeBits::encode(strict_mode_); |
919 } | 919 } |
920 | 920 |
921 StrictMode strict_mode_; | 921 StrictMode strict_mode_; |
922 }; | 922 }; |
923 | 923 |
924 | 924 |
925 class HICStub: public HydrogenCodeStub { | 925 class HICStub: public HydrogenCodeStub { |
926 public: | 926 public: |
927 explicit HICStub(Isolate* isolate) : HydrogenCodeStub(isolate) { } | 927 explicit HICStub(Isolate* isolate) : HydrogenCodeStub(isolate) { } |
928 virtual Code::Kind GetCodeKind() const { return kind(); } | 928 virtual Code::Kind GetCodeKind() const { return kind(); } |
929 virtual InlineCacheState GetICState() { return MONOMORPHIC; } | 929 virtual InlineCacheState GetICState() { return MONOMORPHIC; } |
930 | 930 |
931 protected: | 931 protected: |
932 class KindBits: public BitField<Code::Kind, 0, 4> {}; | 932 class KindBits: public BitField<Code::Kind, 0, 4> {}; |
933 virtual Code::Kind kind() const = 0; | 933 virtual Code::Kind kind() const = 0; |
934 }; | 934 }; |
935 | 935 |
936 | 936 |
937 class HandlerStub: public HICStub { | 937 class HandlerStub: public HICStub { |
938 public: | 938 public: |
939 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; } | 939 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; } |
940 virtual ExtraICState GetExtraICState() { return kind(); } | 940 virtual ExtraICState GetExtraICState() const { return kind(); } |
941 | 941 |
942 protected: | 942 protected: |
943 explicit HandlerStub(Isolate* isolate) : HICStub(isolate) { } | 943 explicit HandlerStub(Isolate* isolate) : HICStub(isolate) { } |
944 virtual int NotMissMinorKey() { return bit_field_; } | 944 virtual int NotMissMinorKey() const { return bit_field_; } |
945 int bit_field_; | 945 int bit_field_; |
946 }; | 946 }; |
947 | 947 |
948 | 948 |
949 class LoadFieldStub: public HandlerStub { | 949 class LoadFieldStub: public HandlerStub { |
950 public: | 950 public: |
951 LoadFieldStub(Isolate* isolate, FieldIndex index) | 951 LoadFieldStub(Isolate* isolate, FieldIndex index) |
952 : HandlerStub(isolate), index_(index) { | 952 : HandlerStub(isolate), index_(index) { |
953 Initialize(Code::LOAD_IC); | 953 Initialize(Code::LOAD_IC); |
954 } | 954 } |
(...skipping 27 matching lines...) Expand all Loading... | |
982 int property_index_key = index_.GetLoadFieldStubKey(); | 982 int property_index_key = index_.GetLoadFieldStubKey(); |
983 // Save a copy of the essence of the property index into the bit field to | 983 // Save a copy of the essence of the property index into the bit field to |
984 // make sure that hashing of unique stubs works correctly.. | 984 // make sure that hashing of unique stubs works correctly.. |
985 bit_field_ = KindBits::encode(kind) | | 985 bit_field_ = KindBits::encode(kind) | |
986 EncodedLoadFieldByIndexBits::encode(property_index_key); | 986 EncodedLoadFieldByIndexBits::encode(property_index_key); |
987 } | 987 } |
988 | 988 |
989 private: | 989 private: |
990 STATIC_ASSERT(KindBits::kSize == 4); | 990 STATIC_ASSERT(KindBits::kSize == 4); |
991 class EncodedLoadFieldByIndexBits: public BitField<int, 4, 13> {}; | 991 class EncodedLoadFieldByIndexBits: public BitField<int, 4, 13> {}; |
992 virtual CodeStub::Major MajorKey() { return LoadField; } | 992 virtual CodeStub::Major MajorKey() const { return LoadField; } |
993 FieldIndex index_; | 993 FieldIndex index_; |
994 }; | 994 }; |
995 | 995 |
996 | 996 |
997 class StringLengthStub: public HandlerStub { | 997 class StringLengthStub: public HandlerStub { |
998 public: | 998 public: |
999 explicit StringLengthStub(Isolate* isolate) : HandlerStub(isolate) { | 999 explicit StringLengthStub(Isolate* isolate) : HandlerStub(isolate) { |
1000 Initialize(Code::LOAD_IC); | 1000 Initialize(Code::LOAD_IC); |
1001 } | 1001 } |
1002 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 1002 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
1003 virtual void InitializeInterfaceDescriptor( | 1003 virtual void InitializeInterfaceDescriptor( |
1004 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 1004 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
1005 | 1005 |
1006 protected: | 1006 protected: |
1007 virtual Code::Kind kind() const { | 1007 virtual Code::Kind kind() const { |
1008 return KindBits::decode(bit_field_); | 1008 return KindBits::decode(bit_field_); |
1009 } | 1009 } |
1010 | 1010 |
1011 void Initialize(Code::Kind kind) { | 1011 void Initialize(Code::Kind kind) { |
1012 bit_field_ = KindBits::encode(kind); | 1012 bit_field_ = KindBits::encode(kind); |
1013 } | 1013 } |
1014 | 1014 |
1015 private: | 1015 private: |
1016 virtual CodeStub::Major MajorKey() { return StringLength; } | 1016 virtual CodeStub::Major MajorKey() const { return StringLength; } |
1017 }; | 1017 }; |
1018 | 1018 |
1019 | 1019 |
1020 class KeyedStringLengthStub: public StringLengthStub { | 1020 class KeyedStringLengthStub: public StringLengthStub { |
1021 public: | 1021 public: |
1022 explicit KeyedStringLengthStub(Isolate* isolate) : StringLengthStub(isolate) { | 1022 explicit KeyedStringLengthStub(Isolate* isolate) : StringLengthStub(isolate) { |
1023 Initialize(Code::KEYED_LOAD_IC); | 1023 Initialize(Code::KEYED_LOAD_IC); |
1024 } | 1024 } |
1025 virtual void InitializeInterfaceDescriptor( | 1025 virtual void InitializeInterfaceDescriptor( |
1026 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 1026 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
1027 | 1027 |
1028 private: | 1028 private: |
1029 virtual CodeStub::Major MajorKey() { return KeyedStringLength; } | 1029 virtual CodeStub::Major MajorKey() const { return KeyedStringLength; } |
1030 }; | 1030 }; |
1031 | 1031 |
1032 | 1032 |
1033 class StoreGlobalStub : public HandlerStub { | 1033 class StoreGlobalStub : public HandlerStub { |
1034 public: | 1034 public: |
1035 StoreGlobalStub(Isolate* isolate, bool is_constant, bool check_global) | 1035 StoreGlobalStub(Isolate* isolate, bool is_constant, bool check_global) |
1036 : HandlerStub(isolate) { | 1036 : HandlerStub(isolate) { |
1037 bit_field_ = IsConstantBits::encode(is_constant) | | 1037 bit_field_ = IsConstantBits::encode(is_constant) | |
1038 CheckGlobalBits::encode(check_global); | 1038 CheckGlobalBits::encode(check_global); |
1039 } | 1039 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1075 } | 1075 } |
1076 | 1076 |
1077 Representation representation() { | 1077 Representation representation() { |
1078 return Representation::FromKind(RepresentationBits::decode(bit_field_)); | 1078 return Representation::FromKind(RepresentationBits::decode(bit_field_)); |
1079 } | 1079 } |
1080 void set_representation(Representation r) { | 1080 void set_representation(Representation r) { |
1081 bit_field_ = RepresentationBits::update(bit_field_, r.kind()); | 1081 bit_field_ = RepresentationBits::update(bit_field_, r.kind()); |
1082 } | 1082 } |
1083 | 1083 |
1084 private: | 1084 private: |
1085 Major MajorKey() { return StoreGlobal; } | 1085 Major MajorKey() const { return StoreGlobal; } |
1086 | 1086 |
1087 class IsConstantBits: public BitField<bool, 0, 1> {}; | 1087 class IsConstantBits: public BitField<bool, 0, 1> {}; |
1088 class RepresentationBits: public BitField<Representation::Kind, 1, 8> {}; | 1088 class RepresentationBits: public BitField<Representation::Kind, 1, 8> {}; |
1089 class CheckGlobalBits: public BitField<bool, 9, 1> {}; | 1089 class CheckGlobalBits: public BitField<bool, 9, 1> {}; |
1090 | 1090 |
1091 DISALLOW_COPY_AND_ASSIGN(StoreGlobalStub); | 1091 DISALLOW_COPY_AND_ASSIGN(StoreGlobalStub); |
1092 }; | 1092 }; |
1093 | 1093 |
1094 | 1094 |
1095 class CallApiFunctionStub : public PlatformCodeStub { | 1095 class CallApiFunctionStub : public PlatformCodeStub { |
1096 public: | 1096 public: |
1097 CallApiFunctionStub(Isolate* isolate, | 1097 CallApiFunctionStub(Isolate* isolate, |
1098 bool is_store, | 1098 bool is_store, |
1099 bool call_data_undefined, | 1099 bool call_data_undefined, |
1100 int argc) : PlatformCodeStub(isolate) { | 1100 int argc) : PlatformCodeStub(isolate) { |
1101 bit_field_ = | 1101 bit_field_ = |
1102 IsStoreBits::encode(is_store) | | 1102 IsStoreBits::encode(is_store) | |
1103 CallDataUndefinedBits::encode(call_data_undefined) | | 1103 CallDataUndefinedBits::encode(call_data_undefined) | |
1104 ArgumentBits::encode(argc); | 1104 ArgumentBits::encode(argc); |
1105 ASSERT(!is_store || argc == 1); | 1105 ASSERT(!is_store || argc == 1); |
1106 } | 1106 } |
1107 | 1107 |
1108 private: | 1108 private: |
1109 virtual void Generate(MacroAssembler* masm) V8_OVERRIDE; | 1109 virtual void Generate(MacroAssembler* masm) V8_OVERRIDE; |
1110 virtual Major MajorKey() V8_OVERRIDE { return CallApiFunction; } | 1110 virtual Major MajorKey() const V8_OVERRIDE { return CallApiFunction; } |
1111 virtual int MinorKey() V8_OVERRIDE { return bit_field_; } | 1111 virtual int MinorKey() const V8_OVERRIDE { return bit_field_; } |
1112 | 1112 |
1113 class IsStoreBits: public BitField<bool, 0, 1> {}; | 1113 class IsStoreBits: public BitField<bool, 0, 1> {}; |
1114 class CallDataUndefinedBits: public BitField<bool, 1, 1> {}; | 1114 class CallDataUndefinedBits: public BitField<bool, 1, 1> {}; |
1115 class ArgumentBits: public BitField<int, 2, Code::kArgumentsBits> {}; | 1115 class ArgumentBits: public BitField<int, 2, Code::kArgumentsBits> {}; |
1116 | 1116 |
1117 int bit_field_; | 1117 int bit_field_; |
1118 | 1118 |
1119 DISALLOW_COPY_AND_ASSIGN(CallApiFunctionStub); | 1119 DISALLOW_COPY_AND_ASSIGN(CallApiFunctionStub); |
1120 }; | 1120 }; |
1121 | 1121 |
1122 | 1122 |
1123 class CallApiGetterStub : public PlatformCodeStub { | 1123 class CallApiGetterStub : public PlatformCodeStub { |
1124 public: | 1124 public: |
1125 explicit CallApiGetterStub(Isolate* isolate) : PlatformCodeStub(isolate) {} | 1125 explicit CallApiGetterStub(Isolate* isolate) : PlatformCodeStub(isolate) {} |
1126 | 1126 |
1127 private: | 1127 private: |
1128 virtual void Generate(MacroAssembler* masm) V8_OVERRIDE; | 1128 virtual void Generate(MacroAssembler* masm) V8_OVERRIDE; |
1129 virtual Major MajorKey() V8_OVERRIDE { return CallApiGetter; } | 1129 virtual Major MajorKey() const V8_OVERRIDE { return CallApiGetter; } |
1130 virtual int MinorKey() V8_OVERRIDE { return 0; } | 1130 virtual int MinorKey() const V8_OVERRIDE { return 0; } |
1131 | 1131 |
1132 DISALLOW_COPY_AND_ASSIGN(CallApiGetterStub); | 1132 DISALLOW_COPY_AND_ASSIGN(CallApiGetterStub); |
1133 }; | 1133 }; |
1134 | 1134 |
1135 | 1135 |
1136 class KeyedLoadFieldStub: public LoadFieldStub { | 1136 class KeyedLoadFieldStub: public LoadFieldStub { |
1137 public: | 1137 public: |
1138 KeyedLoadFieldStub(Isolate* isolate, FieldIndex index) | 1138 KeyedLoadFieldStub(Isolate* isolate, FieldIndex index) |
1139 : LoadFieldStub(isolate, index) { | 1139 : LoadFieldStub(isolate, index) { |
1140 Initialize(Code::KEYED_LOAD_IC); | 1140 Initialize(Code::KEYED_LOAD_IC); |
1141 } | 1141 } |
1142 | 1142 |
1143 virtual void InitializeInterfaceDescriptor( | 1143 virtual void InitializeInterfaceDescriptor( |
1144 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 1144 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
1145 | 1145 |
1146 private: | 1146 private: |
1147 virtual CodeStub::Major MajorKey() { return KeyedLoadField; } | 1147 virtual CodeStub::Major MajorKey() const { return KeyedLoadField; } |
1148 }; | 1148 }; |
1149 | 1149 |
1150 | 1150 |
1151 class BinaryOpICStub : public HydrogenCodeStub { | 1151 class BinaryOpICStub : public HydrogenCodeStub { |
1152 public: | 1152 public: |
1153 BinaryOpICStub(Isolate* isolate, Token::Value op, OverwriteMode mode) | 1153 BinaryOpICStub(Isolate* isolate, Token::Value op, OverwriteMode mode) |
1154 : HydrogenCodeStub(isolate, UNINITIALIZED), state_(isolate, op, mode) {} | 1154 : HydrogenCodeStub(isolate, UNINITIALIZED), state_(isolate, op, mode) {} |
1155 | 1155 |
1156 BinaryOpICStub(Isolate* isolate, const BinaryOpIC::State& state) | 1156 BinaryOpICStub(Isolate* isolate, const BinaryOpIC::State& state) |
1157 : HydrogenCodeStub(isolate), state_(state) {} | 1157 : HydrogenCodeStub(isolate), state_(state) {} |
1158 | 1158 |
1159 static void GenerateAheadOfTime(Isolate* isolate); | 1159 static void GenerateAheadOfTime(Isolate* isolate); |
1160 | 1160 |
1161 virtual void InitializeInterfaceDescriptor( | 1161 virtual void InitializeInterfaceDescriptor( |
1162 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 1162 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
1163 | 1163 |
1164 static void InstallDescriptors(Isolate* isolate); | 1164 static void InstallDescriptors(Isolate* isolate); |
1165 | 1165 |
1166 virtual Code::Kind GetCodeKind() const V8_OVERRIDE { | 1166 virtual Code::Kind GetCodeKind() const V8_OVERRIDE { |
1167 return Code::BINARY_OP_IC; | 1167 return Code::BINARY_OP_IC; |
1168 } | 1168 } |
1169 | 1169 |
1170 virtual InlineCacheState GetICState() V8_FINAL V8_OVERRIDE { | 1170 virtual InlineCacheState GetICState() V8_FINAL V8_OVERRIDE { |
1171 return state_.GetICState(); | 1171 return state_.GetICState(); |
1172 } | 1172 } |
1173 | 1173 |
1174 virtual ExtraICState GetExtraICState() V8_FINAL V8_OVERRIDE { | 1174 virtual ExtraICState GetExtraICState() const V8_FINAL V8_OVERRIDE { |
1175 return state_.GetExtraICState(); | 1175 return state_.GetExtraICState(); |
1176 } | 1176 } |
1177 | 1177 |
1178 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 1178 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
1179 | 1179 |
1180 const BinaryOpIC::State& state() const { return state_; } | 1180 const BinaryOpIC::State& state() const { return state_; } |
1181 | 1181 |
1182 virtual void PrintState(StringStream* stream) V8_FINAL V8_OVERRIDE; | 1182 virtual OStream& PrintState(OStream& os) const V8_FINAL V8_OVERRIDE; // NOLIN T |
1183 | 1183 |
1184 virtual Major MajorKey() V8_OVERRIDE { return BinaryOpIC; } | 1184 virtual Major MajorKey() const V8_OVERRIDE { return BinaryOpIC; } |
1185 virtual int NotMissMinorKey() V8_FINAL V8_OVERRIDE { | 1185 virtual int NotMissMinorKey() const V8_FINAL V8_OVERRIDE { |
1186 return GetExtraICState(); | 1186 return GetExtraICState(); |
1187 } | 1187 } |
1188 | 1188 |
1189 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 1189 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
1190 static const int kLeft = 0; | 1190 static const int kLeft = 0; |
1191 static const int kRight = 1; | 1191 static const int kRight = 1; |
1192 | 1192 |
1193 private: | 1193 private: |
1194 static void GenerateAheadOfTime(Isolate* isolate, | 1194 static void GenerateAheadOfTime(Isolate* isolate, |
1195 const BinaryOpIC::State& state); | 1195 const BinaryOpIC::State& state); |
(...skipping 21 matching lines...) Expand all Loading... | |
1217 } | 1217 } |
1218 | 1218 |
1219 virtual Code::Kind GetCodeKind() const V8_OVERRIDE { | 1219 virtual Code::Kind GetCodeKind() const V8_OVERRIDE { |
1220 return Code::BINARY_OP_IC; | 1220 return Code::BINARY_OP_IC; |
1221 } | 1221 } |
1222 | 1222 |
1223 virtual InlineCacheState GetICState() V8_OVERRIDE { | 1223 virtual InlineCacheState GetICState() V8_OVERRIDE { |
1224 return state_.GetICState(); | 1224 return state_.GetICState(); |
1225 } | 1225 } |
1226 | 1226 |
1227 virtual ExtraICState GetExtraICState() V8_OVERRIDE { | 1227 virtual ExtraICState GetExtraICState() const V8_OVERRIDE { |
1228 return state_.GetExtraICState(); | 1228 return state_.GetExtraICState(); |
1229 } | 1229 } |
1230 | 1230 |
1231 virtual void Generate(MacroAssembler* masm) V8_OVERRIDE; | 1231 virtual void Generate(MacroAssembler* masm) V8_OVERRIDE; |
1232 | 1232 |
1233 virtual void PrintState(StringStream* stream) V8_OVERRIDE; | 1233 virtual OStream& PrintState(OStream& os) const V8_OVERRIDE; // NOLINT |
1234 | 1234 |
1235 virtual Major MajorKey() V8_OVERRIDE { return BinaryOpICWithAllocationSite; } | 1235 virtual Major MajorKey() const V8_OVERRIDE { |
1236 virtual int MinorKey() V8_OVERRIDE { return GetExtraICState(); } | 1236 return BinaryOpICWithAllocationSite; |
1237 } | |
1238 virtual int MinorKey() const V8_OVERRIDE { return GetExtraICState(); } | |
1237 | 1239 |
1238 private: | 1240 private: |
1239 static void GenerateAheadOfTime(Isolate* isolate, | 1241 static void GenerateAheadOfTime(Isolate* isolate, |
1240 const BinaryOpIC::State& state); | 1242 const BinaryOpIC::State& state); |
1241 | 1243 |
1242 BinaryOpIC::State state_; | 1244 BinaryOpIC::State state_; |
1243 | 1245 |
1244 DISALLOW_COPY_AND_ASSIGN(BinaryOpICWithAllocationSiteStub); | 1246 DISALLOW_COPY_AND_ASSIGN(BinaryOpICWithAllocationSiteStub); |
1245 }; | 1247 }; |
1246 | 1248 |
(...skipping 13 matching lines...) Expand all Loading... | |
1260 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 1262 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
1261 | 1263 |
1262 static void InstallDescriptors(Isolate* isolate); | 1264 static void InstallDescriptors(Isolate* isolate); |
1263 | 1265 |
1264 virtual Code::Kind GetCodeKind() const V8_FINAL V8_OVERRIDE { | 1266 virtual Code::Kind GetCodeKind() const V8_FINAL V8_OVERRIDE { |
1265 return Code::STUB; | 1267 return Code::STUB; |
1266 } | 1268 } |
1267 | 1269 |
1268 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 1270 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
1269 | 1271 |
1270 virtual Major MajorKey() V8_OVERRIDE { | 1272 virtual Major MajorKey() const V8_OVERRIDE { |
1271 return BinaryOpWithAllocationSite; | 1273 return BinaryOpWithAllocationSite; |
1272 } | 1274 } |
1273 | 1275 |
1274 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 1276 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
1275 static const int kAllocationSite = 0; | 1277 static const int kAllocationSite = 0; |
1276 static const int kLeft = 1; | 1278 static const int kLeft = 1; |
1277 static const int kRight = 2; | 1279 static const int kRight = 2; |
1278 }; | 1280 }; |
1279 | 1281 |
1280 | 1282 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1316 | 1318 |
1317 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 1319 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
1318 static const int kLeft = 0; | 1320 static const int kLeft = 0; |
1319 static const int kRight = 1; | 1321 static const int kRight = 1; |
1320 | 1322 |
1321 private: | 1323 private: |
1322 class StringAddFlagsBits: public BitField<StringAddFlags, 0, 2> {}; | 1324 class StringAddFlagsBits: public BitField<StringAddFlags, 0, 2> {}; |
1323 class PretenureFlagBits: public BitField<PretenureFlag, 2, 1> {}; | 1325 class PretenureFlagBits: public BitField<PretenureFlag, 2, 1> {}; |
1324 uint32_t bit_field_; | 1326 uint32_t bit_field_; |
1325 | 1327 |
1326 virtual Major MajorKey() V8_OVERRIDE { return StringAdd; } | 1328 virtual Major MajorKey() const V8_OVERRIDE { return StringAdd; } |
1327 virtual int NotMissMinorKey() V8_OVERRIDE { return bit_field_; } | 1329 virtual int NotMissMinorKey() const V8_OVERRIDE { return bit_field_; } |
1328 | 1330 |
1329 virtual void PrintBaseName(StringStream* stream) V8_OVERRIDE; | 1331 virtual OStream& PrintBaseName(OStream& os) const V8_OVERRIDE; // NOLINT |
1330 | 1332 |
1331 DISALLOW_COPY_AND_ASSIGN(StringAddStub); | 1333 DISALLOW_COPY_AND_ASSIGN(StringAddStub); |
1332 }; | 1334 }; |
1333 | 1335 |
1334 | 1336 |
1335 class ICCompareStub: public PlatformCodeStub { | 1337 class ICCompareStub: public PlatformCodeStub { |
1336 public: | 1338 public: |
1337 ICCompareStub(Isolate* isolate, | 1339 ICCompareStub(Isolate* isolate, |
1338 Token::Value op, | 1340 Token::Value op, |
1339 CompareIC::State left, | 1341 CompareIC::State left, |
(...skipping 22 matching lines...) Expand all Loading... | |
1362 private: | 1364 private: |
1363 class OpField: public BitField<int, 0, 3> { }; | 1365 class OpField: public BitField<int, 0, 3> { }; |
1364 class LeftStateField: public BitField<int, 3, 4> { }; | 1366 class LeftStateField: public BitField<int, 3, 4> { }; |
1365 class RightStateField: public BitField<int, 7, 4> { }; | 1367 class RightStateField: public BitField<int, 7, 4> { }; |
1366 class HandlerStateField: public BitField<int, 11, 4> { }; | 1368 class HandlerStateField: public BitField<int, 11, 4> { }; |
1367 | 1369 |
1368 virtual void FinishCode(Handle<Code> code) { | 1370 virtual void FinishCode(Handle<Code> code) { |
1369 code->set_stub_info(MinorKey()); | 1371 code->set_stub_info(MinorKey()); |
1370 } | 1372 } |
1371 | 1373 |
1372 virtual CodeStub::Major MajorKey() { return CompareIC; } | 1374 virtual CodeStub::Major MajorKey() const { return CompareIC; } |
1373 virtual int MinorKey(); | 1375 virtual int MinorKey() const; |
1374 | 1376 |
1375 virtual Code::Kind GetCodeKind() const { return Code::COMPARE_IC; } | 1377 virtual Code::Kind GetCodeKind() const { return Code::COMPARE_IC; } |
1376 | 1378 |
1377 void GenerateSmis(MacroAssembler* masm); | 1379 void GenerateSmis(MacroAssembler* masm); |
1378 void GenerateNumbers(MacroAssembler* masm); | 1380 void GenerateNumbers(MacroAssembler* masm); |
1379 void GenerateInternalizedStrings(MacroAssembler* masm); | 1381 void GenerateInternalizedStrings(MacroAssembler* masm); |
1380 void GenerateStrings(MacroAssembler* masm); | 1382 void GenerateStrings(MacroAssembler* masm); |
1381 void GenerateUniqueNames(MacroAssembler* masm); | 1383 void GenerateUniqueNames(MacroAssembler* masm); |
1382 void GenerateObjects(MacroAssembler* masm); | 1384 void GenerateObjects(MacroAssembler* masm); |
1383 void GenerateMiss(MacroAssembler* masm); | 1385 void GenerateMiss(MacroAssembler* masm); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1436 return MONOMORPHIC; | 1438 return MONOMORPHIC; |
1437 } else { | 1439 } else { |
1438 return PREMONOMORPHIC; | 1440 return PREMONOMORPHIC; |
1439 } | 1441 } |
1440 } | 1442 } |
1441 | 1443 |
1442 virtual Code::Kind GetCodeKind() const { return Code::COMPARE_NIL_IC; } | 1444 virtual Code::Kind GetCodeKind() const { return Code::COMPARE_NIL_IC; } |
1443 | 1445 |
1444 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 1446 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
1445 | 1447 |
1446 virtual ExtraICState GetExtraICState() { | 1448 virtual ExtraICState GetExtraICState() const { |
1447 return NilValueField::encode(nil_value_) | | 1449 return NilValueField::encode(nil_value_) | |
1448 TypesField::encode(state_.ToIntegral()); | 1450 TypesField::encode(state_.ToIntegral()); |
1449 } | 1451 } |
1450 | 1452 |
1451 void UpdateStatus(Handle<Object> object); | 1453 void UpdateStatus(Handle<Object> object); |
1452 | 1454 |
1453 bool IsMonomorphic() const { return state_.Contains(MONOMORPHIC_MAP); } | 1455 bool IsMonomorphic() const { return state_.Contains(MONOMORPHIC_MAP); } |
1454 NilValue GetNilValue() const { return nil_value_; } | 1456 NilValue GetNilValue() const { return nil_value_; } |
1455 void ClearState() { state_.RemoveAll(); } | 1457 void ClearState() { state_.RemoveAll(); } |
1456 | 1458 |
1457 virtual void PrintState(StringStream* stream); | 1459 virtual OStream& PrintState(OStream& os) const V8_OVERRIDE; // NOLINT |
1458 virtual void PrintBaseName(StringStream* stream); | 1460 virtual OStream& PrintBaseName(OStream& os) const V8_OVERRIDE; // NOLINT |
1459 | 1461 |
1460 private: | 1462 private: |
1461 friend class CompareNilIC; | 1463 friend class CompareNilIC; |
1462 | 1464 |
1463 enum CompareNilType { | 1465 enum CompareNilType { |
1464 UNDEFINED, | 1466 UNDEFINED, |
1465 NULL_TYPE, | 1467 NULL_TYPE, |
1466 MONOMORPHIC_MAP, | 1468 MONOMORPHIC_MAP, |
1467 GENERIC, | 1469 GENERIC, |
1468 NUMBER_OF_TYPES | 1470 NUMBER_OF_TYPES |
1469 }; | 1471 }; |
1470 | 1472 |
1471 // At most 6 different types can be distinguished, because the Code object | 1473 // At most 6 different types can be distinguished, because the Code object |
1472 // only has room for a single byte to hold a set and there are two more | 1474 // only has room for a single byte to hold a set and there are two more |
1473 // boolean flags we need to store. :-P | 1475 // boolean flags we need to store. :-P |
1474 STATIC_ASSERT(NUMBER_OF_TYPES <= 6); | 1476 STATIC_ASSERT(NUMBER_OF_TYPES <= 6); |
1475 | 1477 |
1476 class State : public EnumSet<CompareNilType, byte> { | 1478 class State : public EnumSet<CompareNilType, byte> { |
1477 public: | 1479 public: |
1478 State() : EnumSet<CompareNilType, byte>(0) { } | 1480 State() : EnumSet<CompareNilType, byte>(0) { } |
1479 explicit State(byte bits) : EnumSet<CompareNilType, byte>(bits) { } | 1481 explicit State(byte bits) : EnumSet<CompareNilType, byte>(bits) { } |
1480 | |
1481 void Print(StringStream* stream) const; | |
1482 }; | 1482 }; |
1483 friend OStream& operator<<(OStream& os, const State& s); | |
1483 | 1484 |
1484 CompareNilICStub(Isolate* isolate, | 1485 CompareNilICStub(Isolate* isolate, |
1485 NilValue nil, | 1486 NilValue nil, |
1486 InitializationState init_state) | 1487 InitializationState init_state) |
1487 : HydrogenCodeStub(isolate, init_state), nil_value_(nil) { } | 1488 : HydrogenCodeStub(isolate, init_state), nil_value_(nil) { } |
1488 | 1489 |
1489 class NilValueField : public BitField<NilValue, 0, 1> {}; | 1490 class NilValueField : public BitField<NilValue, 0, 1> {}; |
1490 class TypesField : public BitField<byte, 1, NUMBER_OF_TYPES> {}; | 1491 class TypesField : public BitField<byte, 1, NUMBER_OF_TYPES> {}; |
1491 | 1492 |
1492 virtual CodeStub::Major MajorKey() { return CompareNilIC; } | 1493 virtual CodeStub::Major MajorKey() const { return CompareNilIC; } |
1493 virtual int NotMissMinorKey() { return GetExtraICState(); } | 1494 virtual int NotMissMinorKey() const { return GetExtraICState(); } |
1494 | 1495 |
1495 NilValue nil_value_; | 1496 NilValue nil_value_; |
1496 State state_; | 1497 State state_; |
1497 | 1498 |
1498 DISALLOW_COPY_AND_ASSIGN(CompareNilICStub); | 1499 DISALLOW_COPY_AND_ASSIGN(CompareNilICStub); |
1499 }; | 1500 }; |
1500 | 1501 |
1501 | 1502 |
1503 OStream& operator<<(OStream& os, const CompareNilICStub::State& s); | |
1504 | |
1505 | |
1502 class CEntryStub : public PlatformCodeStub { | 1506 class CEntryStub : public PlatformCodeStub { |
1503 public: | 1507 public: |
1504 CEntryStub(Isolate* isolate, | 1508 CEntryStub(Isolate* isolate, |
1505 int result_size, | 1509 int result_size, |
1506 SaveFPRegsMode save_doubles = kDontSaveFPRegs) | 1510 SaveFPRegsMode save_doubles = kDontSaveFPRegs) |
1507 : PlatformCodeStub(isolate), | 1511 : PlatformCodeStub(isolate), |
1508 result_size_(result_size), | 1512 result_size_(result_size), |
1509 save_doubles_(save_doubles) { } | 1513 save_doubles_(save_doubles) { } |
1510 | 1514 |
1511 void Generate(MacroAssembler* masm); | 1515 void Generate(MacroAssembler* masm); |
1512 | 1516 |
1513 // The version of this stub that doesn't save doubles is generated ahead of | 1517 // The version of this stub that doesn't save doubles is generated ahead of |
1514 // time, so it's OK to call it from other stubs that can't cope with GC during | 1518 // time, so it's OK to call it from other stubs that can't cope with GC during |
1515 // their code generation. On machines that always have gp registers (x64) we | 1519 // their code generation. On machines that always have gp registers (x64) we |
1516 // can generate both variants ahead of time. | 1520 // can generate both variants ahead of time. |
1517 static void GenerateAheadOfTime(Isolate* isolate); | 1521 static void GenerateAheadOfTime(Isolate* isolate); |
1518 | 1522 |
1519 private: | 1523 private: |
1520 // Number of pointers/values returned. | 1524 // Number of pointers/values returned. |
1521 const int result_size_; | 1525 const int result_size_; |
1522 SaveFPRegsMode save_doubles_; | 1526 SaveFPRegsMode save_doubles_; |
1523 | 1527 |
1524 Major MajorKey() { return CEntry; } | 1528 Major MajorKey() const { return CEntry; } |
1525 int MinorKey(); | 1529 int MinorKey() const; |
1526 | 1530 |
1527 bool NeedsImmovableCode(); | 1531 bool NeedsImmovableCode(); |
1528 }; | 1532 }; |
1529 | 1533 |
1530 | 1534 |
1531 class JSEntryStub : public PlatformCodeStub { | 1535 class JSEntryStub : public PlatformCodeStub { |
1532 public: | 1536 public: |
1533 explicit JSEntryStub(Isolate* isolate) : PlatformCodeStub(isolate) { } | 1537 explicit JSEntryStub(Isolate* isolate) : PlatformCodeStub(isolate) { } |
1534 | 1538 |
1535 void Generate(MacroAssembler* masm) { GenerateBody(masm, false); } | 1539 void Generate(MacroAssembler* masm) { GenerateBody(masm, false); } |
1536 | 1540 |
1537 protected: | 1541 protected: |
1538 void GenerateBody(MacroAssembler* masm, bool is_construct); | 1542 void GenerateBody(MacroAssembler* masm, bool is_construct); |
1539 | 1543 |
1540 private: | 1544 private: |
1541 Major MajorKey() { return JSEntry; } | 1545 Major MajorKey() const { return JSEntry; } |
1542 int MinorKey() { return 0; } | 1546 int MinorKey() const { return 0; } |
1543 | 1547 |
1544 virtual void FinishCode(Handle<Code> code); | 1548 virtual void FinishCode(Handle<Code> code); |
1545 | 1549 |
1546 int handler_offset_; | 1550 int handler_offset_; |
1547 }; | 1551 }; |
1548 | 1552 |
1549 | 1553 |
1550 class JSConstructEntryStub : public JSEntryStub { | 1554 class JSConstructEntryStub : public JSEntryStub { |
1551 public: | 1555 public: |
1552 explicit JSConstructEntryStub(Isolate* isolate) : JSEntryStub(isolate) { } | 1556 explicit JSConstructEntryStub(Isolate* isolate) : JSEntryStub(isolate) { } |
1553 | 1557 |
1554 void Generate(MacroAssembler* masm) { GenerateBody(masm, true); } | 1558 void Generate(MacroAssembler* masm) { GenerateBody(masm, true); } |
1555 | 1559 |
1556 private: | 1560 private: |
1557 int MinorKey() { return 1; } | 1561 int MinorKey() const { return 1; } |
1558 | 1562 |
1559 virtual void PrintName(StringStream* stream) { | 1563 virtual OStream& PrintName(OStream& os) const V8_OVERRIDE { // NOLINT |
1560 stream->Add("JSConstructEntryStub"); | 1564 return os << "JSConstructEntryStub"; |
1561 } | 1565 } |
1562 }; | 1566 }; |
1563 | 1567 |
1564 | 1568 |
1565 class ArgumentsAccessStub: public PlatformCodeStub { | 1569 class ArgumentsAccessStub: public PlatformCodeStub { |
1566 public: | 1570 public: |
1567 enum Type { | 1571 enum Type { |
1568 READ_ELEMENT, | 1572 READ_ELEMENT, |
1569 NEW_SLOPPY_FAST, | 1573 NEW_SLOPPY_FAST, |
1570 NEW_SLOPPY_SLOW, | 1574 NEW_SLOPPY_SLOW, |
1571 NEW_STRICT | 1575 NEW_STRICT |
1572 }; | 1576 }; |
1573 | 1577 |
1574 ArgumentsAccessStub(Isolate* isolate, Type type) | 1578 ArgumentsAccessStub(Isolate* isolate, Type type) |
1575 : PlatformCodeStub(isolate), type_(type) { } | 1579 : PlatformCodeStub(isolate), type_(type) { } |
1576 | 1580 |
1577 private: | 1581 private: |
1578 Type type_; | 1582 Type type_; |
1579 | 1583 |
1580 Major MajorKey() { return ArgumentsAccess; } | 1584 Major MajorKey() const { return ArgumentsAccess; } |
1581 int MinorKey() { return type_; } | 1585 int MinorKey() const { return type_; } |
1582 | 1586 |
1583 void Generate(MacroAssembler* masm); | 1587 void Generate(MacroAssembler* masm); |
1584 void GenerateReadElement(MacroAssembler* masm); | 1588 void GenerateReadElement(MacroAssembler* masm); |
1585 void GenerateNewStrict(MacroAssembler* masm); | 1589 void GenerateNewStrict(MacroAssembler* masm); |
1586 void GenerateNewSloppyFast(MacroAssembler* masm); | 1590 void GenerateNewSloppyFast(MacroAssembler* masm); |
1587 void GenerateNewSloppySlow(MacroAssembler* masm); | 1591 void GenerateNewSloppySlow(MacroAssembler* masm); |
1588 | 1592 |
1589 virtual void PrintName(StringStream* stream); | 1593 virtual OStream& PrintName(OStream& os) const V8_OVERRIDE; // NOLINT |
1590 }; | 1594 }; |
1591 | 1595 |
1592 | 1596 |
1593 class RegExpExecStub: public PlatformCodeStub { | 1597 class RegExpExecStub: public PlatformCodeStub { |
1594 public: | 1598 public: |
1595 explicit RegExpExecStub(Isolate* isolate) : PlatformCodeStub(isolate) { } | 1599 explicit RegExpExecStub(Isolate* isolate) : PlatformCodeStub(isolate) { } |
1596 | 1600 |
1597 private: | 1601 private: |
1598 Major MajorKey() { return RegExpExec; } | 1602 Major MajorKey() const { return RegExpExec; } |
1599 int MinorKey() { return 0; } | 1603 int MinorKey() const { return 0; } |
1600 | 1604 |
1601 void Generate(MacroAssembler* masm); | 1605 void Generate(MacroAssembler* masm); |
1602 }; | 1606 }; |
1603 | 1607 |
1604 | 1608 |
1605 class RegExpConstructResultStub V8_FINAL : public HydrogenCodeStub { | 1609 class RegExpConstructResultStub V8_FINAL : public HydrogenCodeStub { |
1606 public: | 1610 public: |
1607 explicit RegExpConstructResultStub(Isolate* isolate) | 1611 explicit RegExpConstructResultStub(Isolate* isolate) |
1608 : HydrogenCodeStub(isolate) { } | 1612 : HydrogenCodeStub(isolate) { } |
1609 | 1613 |
1610 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 1614 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
1611 | 1615 |
1612 virtual void InitializeInterfaceDescriptor( | 1616 virtual void InitializeInterfaceDescriptor( |
1613 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 1617 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
1614 | 1618 |
1615 virtual Major MajorKey() V8_OVERRIDE { return RegExpConstructResult; } | 1619 virtual Major MajorKey() const V8_OVERRIDE { return RegExpConstructResult; } |
1616 virtual int NotMissMinorKey() V8_OVERRIDE { return 0; } | 1620 virtual int NotMissMinorKey() const V8_OVERRIDE { return 0; } |
1617 | 1621 |
1618 static void InstallDescriptors(Isolate* isolate); | 1622 static void InstallDescriptors(Isolate* isolate); |
1619 | 1623 |
1620 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 1624 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
1621 static const int kLength = 0; | 1625 static const int kLength = 0; |
1622 static const int kIndex = 1; | 1626 static const int kIndex = 1; |
1623 static const int kInput = 2; | 1627 static const int kInput = 2; |
1624 | 1628 |
1625 private: | 1629 private: |
1626 DISALLOW_COPY_AND_ASSIGN(RegExpConstructResultStub); | 1630 DISALLOW_COPY_AND_ASSIGN(RegExpConstructResultStub); |
1627 }; | 1631 }; |
1628 | 1632 |
1629 | 1633 |
1630 class CallFunctionStub: public PlatformCodeStub { | 1634 class CallFunctionStub: public PlatformCodeStub { |
1631 public: | 1635 public: |
1632 CallFunctionStub(Isolate* isolate, int argc, CallFunctionFlags flags) | 1636 CallFunctionStub(Isolate* isolate, int argc, CallFunctionFlags flags) |
1633 : PlatformCodeStub(isolate), argc_(argc), flags_(flags) { } | 1637 : PlatformCodeStub(isolate), argc_(argc), flags_(flags) { } |
1634 | 1638 |
1635 void Generate(MacroAssembler* masm); | 1639 void Generate(MacroAssembler* masm); |
1636 | 1640 |
1637 static int ExtractArgcFromMinorKey(int minor_key) { | 1641 static int ExtractArgcFromMinorKey(int minor_key) { |
1638 return ArgcBits::decode(minor_key); | 1642 return ArgcBits::decode(minor_key); |
1639 } | 1643 } |
1640 | 1644 |
1641 private: | 1645 private: |
1642 int argc_; | 1646 int argc_; |
1643 CallFunctionFlags flags_; | 1647 CallFunctionFlags flags_; |
1644 | 1648 |
1645 virtual void PrintName(StringStream* stream); | 1649 virtual OStream& PrintName(OStream& os) const V8_OVERRIDE; // NOLINT |
1646 | 1650 |
1647 // Minor key encoding in 32 bits with Bitfield <Type, shift, size>. | 1651 // Minor key encoding in 32 bits with Bitfield <Type, shift, size>. |
1648 class FlagBits: public BitField<CallFunctionFlags, 0, 2> {}; | 1652 class FlagBits: public BitField<CallFunctionFlags, 0, 2> {}; |
1649 class ArgcBits: public BitField<unsigned, 2, 32 - 2> {}; | 1653 class ArgcBits: public BitField<unsigned, 2, 32 - 2> {}; |
1650 | 1654 |
1651 Major MajorKey() { return CallFunction; } | 1655 Major MajorKey() const { return CallFunction; } |
1652 int MinorKey() { | 1656 int MinorKey() const { |
1653 // Encode the parameters in a unique 32 bit value. | 1657 // Encode the parameters in a unique 32 bit value. |
1654 return FlagBits::encode(flags_) | ArgcBits::encode(argc_); | 1658 return FlagBits::encode(flags_) | ArgcBits::encode(argc_); |
1655 } | 1659 } |
1656 | 1660 |
1657 bool CallAsMethod() { | 1661 bool CallAsMethod() { |
1658 return flags_ == CALL_AS_METHOD || flags_ == WRAP_AND_CALL; | 1662 return flags_ == CALL_AS_METHOD || flags_ == WRAP_AND_CALL; |
1659 } | 1663 } |
1660 | 1664 |
1661 bool NeedsChecks() { | 1665 bool NeedsChecks() { |
1662 return flags_ != WRAP_AND_CALL; | 1666 return flags_ != WRAP_AND_CALL; |
1663 } | 1667 } |
1664 }; | 1668 }; |
1665 | 1669 |
1666 | 1670 |
1667 class CallConstructStub: public PlatformCodeStub { | 1671 class CallConstructStub: public PlatformCodeStub { |
1668 public: | 1672 public: |
1669 CallConstructStub(Isolate* isolate, CallConstructorFlags flags) | 1673 CallConstructStub(Isolate* isolate, CallConstructorFlags flags) |
1670 : PlatformCodeStub(isolate), flags_(flags) {} | 1674 : PlatformCodeStub(isolate), flags_(flags) {} |
1671 | 1675 |
1672 void Generate(MacroAssembler* masm); | 1676 void Generate(MacroAssembler* masm); |
1673 | 1677 |
1674 virtual void FinishCode(Handle<Code> code) { | 1678 virtual void FinishCode(Handle<Code> code) { |
1675 code->set_has_function_cache(RecordCallTarget()); | 1679 code->set_has_function_cache(RecordCallTarget()); |
1676 } | 1680 } |
1677 | 1681 |
1678 private: | 1682 private: |
1679 CallConstructorFlags flags_; | 1683 CallConstructorFlags flags_; |
1680 | 1684 |
1681 virtual void PrintName(StringStream* stream); | 1685 virtual OStream& PrintName(OStream& os) const V8_OVERRIDE; // NOLINT |
1682 | 1686 |
1683 Major MajorKey() { return CallConstruct; } | 1687 Major MajorKey() const { return CallConstruct; } |
1684 int MinorKey() { return flags_; } | 1688 int MinorKey() const { return flags_; } |
1685 | 1689 |
1686 bool RecordCallTarget() { | 1690 bool RecordCallTarget() const { |
1687 return (flags_ & RECORD_CONSTRUCTOR_TARGET) != 0; | 1691 return (flags_ & RECORD_CONSTRUCTOR_TARGET) != 0; |
1688 } | 1692 } |
1689 }; | 1693 }; |
1690 | 1694 |
1691 | 1695 |
1692 enum StringIndexFlags { | 1696 enum StringIndexFlags { |
1693 // Accepts smis or heap numbers. | 1697 // Accepts smis or heap numbers. |
1694 STRING_INDEX_IS_NUMBER, | 1698 STRING_INDEX_IS_NUMBER, |
1695 | 1699 |
1696 // Accepts smis or heap numbers that are valid array indices | 1700 // Accepts smis or heap numbers that are valid array indices |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1867 public: | 1871 public: |
1868 explicit KeyedLoadDictionaryElementStub(Isolate* isolate) | 1872 explicit KeyedLoadDictionaryElementStub(Isolate* isolate) |
1869 : HydrogenCodeStub(isolate) {} | 1873 : HydrogenCodeStub(isolate) {} |
1870 | 1874 |
1871 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 1875 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
1872 | 1876 |
1873 virtual void InitializeInterfaceDescriptor( | 1877 virtual void InitializeInterfaceDescriptor( |
1874 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 1878 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
1875 | 1879 |
1876 private: | 1880 private: |
1877 Major MajorKey() { return KeyedLoadElement; } | 1881 Major MajorKey() const { return KeyedLoadElement; } |
1878 int NotMissMinorKey() { return DICTIONARY_ELEMENTS; } | 1882 int NotMissMinorKey() const { return DICTIONARY_ELEMENTS; } |
1879 | 1883 |
1880 DISALLOW_COPY_AND_ASSIGN(KeyedLoadDictionaryElementStub); | 1884 DISALLOW_COPY_AND_ASSIGN(KeyedLoadDictionaryElementStub); |
1881 }; | 1885 }; |
1882 | 1886 |
1883 | 1887 |
1884 class KeyedLoadDictionaryElementPlatformStub : public PlatformCodeStub { | 1888 class KeyedLoadDictionaryElementPlatformStub : public PlatformCodeStub { |
1885 public: | 1889 public: |
1886 explicit KeyedLoadDictionaryElementPlatformStub(Isolate* isolate) | 1890 explicit KeyedLoadDictionaryElementPlatformStub(Isolate* isolate) |
1887 : PlatformCodeStub(isolate) {} | 1891 : PlatformCodeStub(isolate) {} |
1888 | 1892 |
1889 void Generate(MacroAssembler* masm); | 1893 void Generate(MacroAssembler* masm); |
1890 | 1894 |
1891 private: | 1895 private: |
1892 Major MajorKey() { return KeyedLoadElement; } | 1896 Major MajorKey() const { return KeyedLoadElement; } |
1893 int MinorKey() { return DICTIONARY_ELEMENTS; } | 1897 int MinorKey() const { return DICTIONARY_ELEMENTS; } |
1894 | 1898 |
1895 DISALLOW_COPY_AND_ASSIGN(KeyedLoadDictionaryElementPlatformStub); | 1899 DISALLOW_COPY_AND_ASSIGN(KeyedLoadDictionaryElementPlatformStub); |
1896 }; | 1900 }; |
1897 | 1901 |
1898 | 1902 |
1899 class KeyedLoadGenericElementStub : public HydrogenCodeStub { | 1903 class KeyedLoadGenericElementStub : public HydrogenCodeStub { |
1900 public: | 1904 public: |
1901 explicit KeyedLoadGenericElementStub(Isolate *isolate) | 1905 explicit KeyedLoadGenericElementStub(Isolate *isolate) |
1902 : HydrogenCodeStub(isolate) {} | 1906 : HydrogenCodeStub(isolate) {} |
1903 | 1907 |
1904 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 1908 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
1905 | 1909 |
1906 virtual void InitializeInterfaceDescriptor( | 1910 virtual void InitializeInterfaceDescriptor( |
1907 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 1911 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
1908 | 1912 |
1909 static void InstallDescriptors(Isolate* isolate); | 1913 static void InstallDescriptors(Isolate* isolate); |
1910 | 1914 |
1911 virtual Code::Kind GetCodeKind() const { return Code::KEYED_LOAD_IC; } | 1915 virtual Code::Kind GetCodeKind() const { return Code::KEYED_LOAD_IC; } |
1912 virtual InlineCacheState GetICState() { return GENERIC; } | 1916 virtual InlineCacheState GetICState() { return GENERIC; } |
1913 | 1917 |
1914 private: | 1918 private: |
1915 Major MajorKey() { return KeyedLoadGeneric; } | 1919 Major MajorKey() const { return KeyedLoadGeneric; } |
1916 int NotMissMinorKey() { return 0; } | 1920 int NotMissMinorKey() const { return 0; } |
1917 | 1921 |
1918 DISALLOW_COPY_AND_ASSIGN(KeyedLoadGenericElementStub); | 1922 DISALLOW_COPY_AND_ASSIGN(KeyedLoadGenericElementStub); |
1919 }; | 1923 }; |
1920 | 1924 |
1921 | 1925 |
1922 class DoubleToIStub : public PlatformCodeStub { | 1926 class DoubleToIStub : public PlatformCodeStub { |
1923 public: | 1927 public: |
1924 DoubleToIStub(Isolate* isolate, | 1928 DoubleToIStub(Isolate* isolate, |
1925 Register source, | 1929 Register source, |
1926 Register destination, | 1930 Register destination, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1970 kBitsPerRegisterNumber> {}; // NOLINT | 1974 kBitsPerRegisterNumber> {}; // NOLINT |
1971 class IsTruncatingBits: | 1975 class IsTruncatingBits: |
1972 public BitField<bool, 2 * kBitsPerRegisterNumber, 1> {}; // NOLINT | 1976 public BitField<bool, 2 * kBitsPerRegisterNumber, 1> {}; // NOLINT |
1973 class OffsetBits: | 1977 class OffsetBits: |
1974 public BitField<int, 2 * kBitsPerRegisterNumber + 1, 3> {}; // NOLINT | 1978 public BitField<int, 2 * kBitsPerRegisterNumber + 1, 3> {}; // NOLINT |
1975 class SkipFastPathBits: | 1979 class SkipFastPathBits: |
1976 public BitField<int, 2 * kBitsPerRegisterNumber + 4, 1> {}; // NOLINT | 1980 public BitField<int, 2 * kBitsPerRegisterNumber + 4, 1> {}; // NOLINT |
1977 class SSE3Bits: | 1981 class SSE3Bits: |
1978 public BitField<int, 2 * kBitsPerRegisterNumber + 5, 1> {}; // NOLINT | 1982 public BitField<int, 2 * kBitsPerRegisterNumber + 5, 1> {}; // NOLINT |
1979 | 1983 |
1980 Major MajorKey() { return DoubleToI; } | 1984 Major MajorKey() const { return DoubleToI; } |
1981 int MinorKey() { return bit_field_; } | 1985 int MinorKey() const { return bit_field_; } |
1982 | 1986 |
1983 int bit_field_; | 1987 int bit_field_; |
1984 | 1988 |
1985 DISALLOW_COPY_AND_ASSIGN(DoubleToIStub); | 1989 DISALLOW_COPY_AND_ASSIGN(DoubleToIStub); |
1986 }; | 1990 }; |
1987 | 1991 |
1988 | 1992 |
1989 class KeyedLoadFastElementStub : public HydrogenCodeStub { | 1993 class KeyedLoadFastElementStub : public HydrogenCodeStub { |
1990 public: | 1994 public: |
1991 KeyedLoadFastElementStub(Isolate* isolate, | 1995 KeyedLoadFastElementStub(Isolate* isolate, |
(...skipping 15 matching lines...) Expand all Loading... | |
2007 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 2011 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
2008 | 2012 |
2009 virtual void InitializeInterfaceDescriptor( | 2013 virtual void InitializeInterfaceDescriptor( |
2010 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 2014 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
2011 | 2015 |
2012 private: | 2016 private: |
2013 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; | 2017 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; |
2014 class IsJSArrayBits: public BitField<bool, 8, 1> {}; | 2018 class IsJSArrayBits: public BitField<bool, 8, 1> {}; |
2015 uint32_t bit_field_; | 2019 uint32_t bit_field_; |
2016 | 2020 |
2017 Major MajorKey() { return KeyedLoadElement; } | 2021 Major MajorKey() const { return KeyedLoadElement; } |
2018 int NotMissMinorKey() { return bit_field_; } | 2022 int NotMissMinorKey() const { return bit_field_; } |
2019 | 2023 |
2020 DISALLOW_COPY_AND_ASSIGN(KeyedLoadFastElementStub); | 2024 DISALLOW_COPY_AND_ASSIGN(KeyedLoadFastElementStub); |
2021 }; | 2025 }; |
2022 | 2026 |
2023 | 2027 |
2024 class KeyedStoreFastElementStub : public HydrogenCodeStub { | 2028 class KeyedStoreFastElementStub : public HydrogenCodeStub { |
2025 public: | 2029 public: |
2026 KeyedStoreFastElementStub(Isolate* isolate, | 2030 KeyedStoreFastElementStub(Isolate* isolate, |
2027 bool is_js_array, | 2031 bool is_js_array, |
2028 ElementsKind elements_kind, | 2032 ElementsKind elements_kind, |
(...skipping 20 matching lines...) Expand all Loading... | |
2049 | 2053 |
2050 virtual void InitializeInterfaceDescriptor( | 2054 virtual void InitializeInterfaceDescriptor( |
2051 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 2055 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
2052 | 2056 |
2053 private: | 2057 private: |
2054 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; | 2058 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; |
2055 class StoreModeBits: public BitField<KeyedAccessStoreMode, 8, 4> {}; | 2059 class StoreModeBits: public BitField<KeyedAccessStoreMode, 8, 4> {}; |
2056 class IsJSArrayBits: public BitField<bool, 12, 1> {}; | 2060 class IsJSArrayBits: public BitField<bool, 12, 1> {}; |
2057 uint32_t bit_field_; | 2061 uint32_t bit_field_; |
2058 | 2062 |
2059 Major MajorKey() { return KeyedStoreElement; } | 2063 Major MajorKey() const { return KeyedStoreElement; } |
2060 int NotMissMinorKey() { return bit_field_; } | 2064 int NotMissMinorKey() const { return bit_field_; } |
2061 | 2065 |
2062 DISALLOW_COPY_AND_ASSIGN(KeyedStoreFastElementStub); | 2066 DISALLOW_COPY_AND_ASSIGN(KeyedStoreFastElementStub); |
2063 }; | 2067 }; |
2064 | 2068 |
2065 | 2069 |
2066 class TransitionElementsKindStub : public HydrogenCodeStub { | 2070 class TransitionElementsKindStub : public HydrogenCodeStub { |
2067 public: | 2071 public: |
2068 TransitionElementsKindStub(Isolate* isolate, | 2072 TransitionElementsKindStub(Isolate* isolate, |
2069 ElementsKind from_kind, | 2073 ElementsKind from_kind, |
2070 ElementsKind to_kind, | 2074 ElementsKind to_kind, |
(...skipping 19 matching lines...) Expand all Loading... | |
2090 | 2094 |
2091 virtual void InitializeInterfaceDescriptor( | 2095 virtual void InitializeInterfaceDescriptor( |
2092 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 2096 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
2093 | 2097 |
2094 private: | 2098 private: |
2095 class FromKindBits: public BitField<ElementsKind, 8, 8> {}; | 2099 class FromKindBits: public BitField<ElementsKind, 8, 8> {}; |
2096 class ToKindBits: public BitField<ElementsKind, 0, 8> {}; | 2100 class ToKindBits: public BitField<ElementsKind, 0, 8> {}; |
2097 class IsJSArrayBits: public BitField<bool, 16, 1> {}; | 2101 class IsJSArrayBits: public BitField<bool, 16, 1> {}; |
2098 uint32_t bit_field_; | 2102 uint32_t bit_field_; |
2099 | 2103 |
2100 Major MajorKey() { return TransitionElementsKind; } | 2104 Major MajorKey() const { return TransitionElementsKind; } |
2101 int NotMissMinorKey() { return bit_field_; } | 2105 int NotMissMinorKey() const { return bit_field_; } |
2102 | 2106 |
2103 DISALLOW_COPY_AND_ASSIGN(TransitionElementsKindStub); | 2107 DISALLOW_COPY_AND_ASSIGN(TransitionElementsKindStub); |
2104 }; | 2108 }; |
2105 | 2109 |
2106 | 2110 |
2107 class ArrayConstructorStubBase : public HydrogenCodeStub { | 2111 class ArrayConstructorStubBase : public HydrogenCodeStub { |
2108 public: | 2112 public: |
2109 ArrayConstructorStubBase(Isolate* isolate, | 2113 ArrayConstructorStubBase(Isolate* isolate, |
2110 ElementsKind kind, | 2114 ElementsKind kind, |
2111 AllocationSiteOverrideMode override_mode) | 2115 AllocationSiteOverrideMode override_mode) |
(...skipping 16 matching lines...) Expand all Loading... | |
2128 } | 2132 } |
2129 | 2133 |
2130 static void GenerateStubsAheadOfTime(Isolate* isolate); | 2134 static void GenerateStubsAheadOfTime(Isolate* isolate); |
2131 static void InstallDescriptors(Isolate* isolate); | 2135 static void InstallDescriptors(Isolate* isolate); |
2132 | 2136 |
2133 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 2137 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
2134 static const int kConstructor = 0; | 2138 static const int kConstructor = 0; |
2135 static const int kAllocationSite = 1; | 2139 static const int kAllocationSite = 1; |
2136 | 2140 |
2137 protected: | 2141 protected: |
2138 void BasePrintName(const char* name, StringStream* stream); | 2142 OStream& BasePrintName(OStream& os, const char* name) const; // NOLINT |
2139 | 2143 |
2140 private: | 2144 private: |
2141 int NotMissMinorKey() { return bit_field_; } | 2145 int NotMissMinorKey() const { return bit_field_; } |
2142 | 2146 |
2143 // Ensure data fits within available bits. | 2147 // Ensure data fits within available bits. |
2144 STATIC_ASSERT(LAST_ALLOCATION_SITE_OVERRIDE_MODE == 1); | 2148 STATIC_ASSERT(LAST_ALLOCATION_SITE_OVERRIDE_MODE == 1); |
2145 | 2149 |
2146 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; | 2150 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; |
2147 class AllocationSiteOverrideModeBits: public | 2151 class AllocationSiteOverrideModeBits: public |
2148 BitField<AllocationSiteOverrideMode, 8, 1> {}; // NOLINT | 2152 BitField<AllocationSiteOverrideMode, 8, 1> {}; // NOLINT |
2149 uint32_t bit_field_; | 2153 uint32_t bit_field_; |
2150 | 2154 |
2151 DISALLOW_COPY_AND_ASSIGN(ArrayConstructorStubBase); | 2155 DISALLOW_COPY_AND_ASSIGN(ArrayConstructorStubBase); |
2152 }; | 2156 }; |
2153 | 2157 |
2154 | 2158 |
2155 class ArrayNoArgumentConstructorStub : public ArrayConstructorStubBase { | 2159 class ArrayNoArgumentConstructorStub : public ArrayConstructorStubBase { |
2156 public: | 2160 public: |
2157 ArrayNoArgumentConstructorStub( | 2161 ArrayNoArgumentConstructorStub( |
2158 Isolate* isolate, | 2162 Isolate* isolate, |
2159 ElementsKind kind, | 2163 ElementsKind kind, |
2160 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) | 2164 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) |
2161 : ArrayConstructorStubBase(isolate, kind, override_mode) { | 2165 : ArrayConstructorStubBase(isolate, kind, override_mode) { |
2162 } | 2166 } |
2163 | 2167 |
2164 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 2168 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
2165 | 2169 |
2166 virtual void InitializeInterfaceDescriptor( | 2170 virtual void InitializeInterfaceDescriptor( |
2167 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 2171 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
2168 | 2172 |
2169 private: | 2173 private: |
2170 Major MajorKey() { return ArrayNoArgumentConstructor; } | 2174 Major MajorKey() const { return ArrayNoArgumentConstructor; } |
2171 | 2175 |
2172 virtual void PrintName(StringStream* stream) { | 2176 virtual OStream& PrintName(OStream& os) const V8_OVERRIDE { // NOLINT |
2173 BasePrintName("ArrayNoArgumentConstructorStub", stream); | 2177 return BasePrintName(os, "ArrayNoArgumentConstructorStub"); |
2174 } | 2178 } |
2175 | 2179 |
2176 DISALLOW_COPY_AND_ASSIGN(ArrayNoArgumentConstructorStub); | 2180 DISALLOW_COPY_AND_ASSIGN(ArrayNoArgumentConstructorStub); |
2177 }; | 2181 }; |
2178 | 2182 |
2179 | 2183 |
2180 class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase { | 2184 class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase { |
2181 public: | 2185 public: |
2182 ArraySingleArgumentConstructorStub( | 2186 ArraySingleArgumentConstructorStub( |
2183 Isolate* isolate, | 2187 Isolate* isolate, |
2184 ElementsKind kind, | 2188 ElementsKind kind, |
2185 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) | 2189 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) |
2186 : ArrayConstructorStubBase(isolate, kind, override_mode) { | 2190 : ArrayConstructorStubBase(isolate, kind, override_mode) { |
2187 } | 2191 } |
2188 | 2192 |
2189 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 2193 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
2190 | 2194 |
2191 virtual void InitializeInterfaceDescriptor( | 2195 virtual void InitializeInterfaceDescriptor( |
2192 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 2196 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
2193 | 2197 |
2194 private: | 2198 private: |
2195 Major MajorKey() { return ArraySingleArgumentConstructor; } | 2199 Major MajorKey() const { return ArraySingleArgumentConstructor; } |
2196 | 2200 |
2197 virtual void PrintName(StringStream* stream) { | 2201 virtual OStream& PrintName(OStream& os) const { // NOLINT |
2198 BasePrintName("ArraySingleArgumentConstructorStub", stream); | 2202 return BasePrintName(os, "ArraySingleArgumentConstructorStub"); |
2199 } | 2203 } |
2200 | 2204 |
2201 DISALLOW_COPY_AND_ASSIGN(ArraySingleArgumentConstructorStub); | 2205 DISALLOW_COPY_AND_ASSIGN(ArraySingleArgumentConstructorStub); |
2202 }; | 2206 }; |
2203 | 2207 |
2204 | 2208 |
2205 class ArrayNArgumentsConstructorStub : public ArrayConstructorStubBase { | 2209 class ArrayNArgumentsConstructorStub : public ArrayConstructorStubBase { |
2206 public: | 2210 public: |
2207 ArrayNArgumentsConstructorStub( | 2211 ArrayNArgumentsConstructorStub( |
2208 Isolate* isolate, | 2212 Isolate* isolate, |
2209 ElementsKind kind, | 2213 ElementsKind kind, |
2210 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) | 2214 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) |
2211 : ArrayConstructorStubBase(isolate, kind, override_mode) { | 2215 : ArrayConstructorStubBase(isolate, kind, override_mode) { |
2212 } | 2216 } |
2213 | 2217 |
2214 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 2218 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
2215 | 2219 |
2216 virtual void InitializeInterfaceDescriptor( | 2220 virtual void InitializeInterfaceDescriptor( |
2217 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 2221 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
2218 | 2222 |
2219 private: | 2223 private: |
2220 Major MajorKey() { return ArrayNArgumentsConstructor; } | 2224 Major MajorKey() const { return ArrayNArgumentsConstructor; } |
2221 | 2225 |
2222 virtual void PrintName(StringStream* stream) { | 2226 virtual OStream& PrintName(OStream& os) const { // NOLINT |
2223 BasePrintName("ArrayNArgumentsConstructorStub", stream); | 2227 return BasePrintName(os, "ArrayNArgumentsConstructorStub"); |
2224 } | 2228 } |
2225 | 2229 |
2226 DISALLOW_COPY_AND_ASSIGN(ArrayNArgumentsConstructorStub); | 2230 DISALLOW_COPY_AND_ASSIGN(ArrayNArgumentsConstructorStub); |
2227 }; | 2231 }; |
2228 | 2232 |
2229 | 2233 |
2230 class InternalArrayConstructorStubBase : public HydrogenCodeStub { | 2234 class InternalArrayConstructorStubBase : public HydrogenCodeStub { |
2231 public: | 2235 public: |
2232 InternalArrayConstructorStubBase(Isolate* isolate, ElementsKind kind) | 2236 InternalArrayConstructorStubBase(Isolate* isolate, ElementsKind kind) |
2233 : HydrogenCodeStub(isolate) { | 2237 : HydrogenCodeStub(isolate) { |
2234 kind_ = kind; | 2238 kind_ = kind; |
2235 } | 2239 } |
2236 | 2240 |
2237 static void GenerateStubsAheadOfTime(Isolate* isolate); | 2241 static void GenerateStubsAheadOfTime(Isolate* isolate); |
2238 static void InstallDescriptors(Isolate* isolate); | 2242 static void InstallDescriptors(Isolate* isolate); |
2239 | 2243 |
2240 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 2244 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
2241 static const int kConstructor = 0; | 2245 static const int kConstructor = 0; |
2242 | 2246 |
2243 ElementsKind elements_kind() const { return kind_; } | 2247 ElementsKind elements_kind() const { return kind_; } |
2244 | 2248 |
2245 private: | 2249 private: |
2246 int NotMissMinorKey() { return kind_; } | 2250 int NotMissMinorKey() const { return kind_; } |
2247 | 2251 |
2248 ElementsKind kind_; | 2252 ElementsKind kind_; |
2249 | 2253 |
2250 DISALLOW_COPY_AND_ASSIGN(InternalArrayConstructorStubBase); | 2254 DISALLOW_COPY_AND_ASSIGN(InternalArrayConstructorStubBase); |
2251 }; | 2255 }; |
2252 | 2256 |
2253 | 2257 |
2254 class InternalArrayNoArgumentConstructorStub : public | 2258 class InternalArrayNoArgumentConstructorStub : public |
2255 InternalArrayConstructorStubBase { | 2259 InternalArrayConstructorStubBase { |
2256 public: | 2260 public: |
2257 InternalArrayNoArgumentConstructorStub(Isolate* isolate, | 2261 InternalArrayNoArgumentConstructorStub(Isolate* isolate, |
2258 ElementsKind kind) | 2262 ElementsKind kind) |
2259 : InternalArrayConstructorStubBase(isolate, kind) { } | 2263 : InternalArrayConstructorStubBase(isolate, kind) { } |
2260 | 2264 |
2261 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 2265 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
2262 | 2266 |
2263 virtual void InitializeInterfaceDescriptor( | 2267 virtual void InitializeInterfaceDescriptor( |
2264 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 2268 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
2265 | 2269 |
2266 private: | 2270 private: |
2267 Major MajorKey() { return InternalArrayNoArgumentConstructor; } | 2271 Major MajorKey() const { return InternalArrayNoArgumentConstructor; } |
2268 | 2272 |
2269 DISALLOW_COPY_AND_ASSIGN(InternalArrayNoArgumentConstructorStub); | 2273 DISALLOW_COPY_AND_ASSIGN(InternalArrayNoArgumentConstructorStub); |
2270 }; | 2274 }; |
2271 | 2275 |
2272 | 2276 |
2273 class InternalArraySingleArgumentConstructorStub : public | 2277 class InternalArraySingleArgumentConstructorStub : public |
2274 InternalArrayConstructorStubBase { | 2278 InternalArrayConstructorStubBase { |
2275 public: | 2279 public: |
2276 InternalArraySingleArgumentConstructorStub(Isolate* isolate, | 2280 InternalArraySingleArgumentConstructorStub(Isolate* isolate, |
2277 ElementsKind kind) | 2281 ElementsKind kind) |
2278 : InternalArrayConstructorStubBase(isolate, kind) { } | 2282 : InternalArrayConstructorStubBase(isolate, kind) { } |
2279 | 2283 |
2280 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 2284 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
2281 | 2285 |
2282 virtual void InitializeInterfaceDescriptor( | 2286 virtual void InitializeInterfaceDescriptor( |
2283 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 2287 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
2284 | 2288 |
2285 private: | 2289 private: |
2286 Major MajorKey() { return InternalArraySingleArgumentConstructor; } | 2290 Major MajorKey() const { return InternalArraySingleArgumentConstructor; } |
2287 | 2291 |
2288 DISALLOW_COPY_AND_ASSIGN(InternalArraySingleArgumentConstructorStub); | 2292 DISALLOW_COPY_AND_ASSIGN(InternalArraySingleArgumentConstructorStub); |
2289 }; | 2293 }; |
2290 | 2294 |
2291 | 2295 |
2292 class InternalArrayNArgumentsConstructorStub : public | 2296 class InternalArrayNArgumentsConstructorStub : public |
2293 InternalArrayConstructorStubBase { | 2297 InternalArrayConstructorStubBase { |
2294 public: | 2298 public: |
2295 InternalArrayNArgumentsConstructorStub(Isolate* isolate, ElementsKind kind) | 2299 InternalArrayNArgumentsConstructorStub(Isolate* isolate, ElementsKind kind) |
2296 : InternalArrayConstructorStubBase(isolate, kind) { } | 2300 : InternalArrayConstructorStubBase(isolate, kind) { } |
2297 | 2301 |
2298 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 2302 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
2299 | 2303 |
2300 virtual void InitializeInterfaceDescriptor( | 2304 virtual void InitializeInterfaceDescriptor( |
2301 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 2305 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
2302 | 2306 |
2303 private: | 2307 private: |
2304 Major MajorKey() { return InternalArrayNArgumentsConstructor; } | 2308 Major MajorKey() const { return InternalArrayNArgumentsConstructor; } |
2305 | 2309 |
2306 DISALLOW_COPY_AND_ASSIGN(InternalArrayNArgumentsConstructorStub); | 2310 DISALLOW_COPY_AND_ASSIGN(InternalArrayNArgumentsConstructorStub); |
2307 }; | 2311 }; |
2308 | 2312 |
2309 | 2313 |
2310 class KeyedStoreElementStub : public PlatformCodeStub { | 2314 class KeyedStoreElementStub : public PlatformCodeStub { |
2311 public: | 2315 public: |
2312 KeyedStoreElementStub(Isolate* isolate, | 2316 KeyedStoreElementStub(Isolate* isolate, |
2313 bool is_js_array, | 2317 bool is_js_array, |
2314 ElementsKind elements_kind, | 2318 ElementsKind elements_kind, |
2315 KeyedAccessStoreMode store_mode) | 2319 KeyedAccessStoreMode store_mode) |
2316 : PlatformCodeStub(isolate), | 2320 : PlatformCodeStub(isolate), |
2317 is_js_array_(is_js_array), | 2321 is_js_array_(is_js_array), |
2318 elements_kind_(elements_kind), | 2322 elements_kind_(elements_kind), |
2319 store_mode_(store_mode) { } | 2323 store_mode_(store_mode) { } |
2320 | 2324 |
2321 Major MajorKey() { return KeyedStoreElement; } | 2325 Major MajorKey() const { return KeyedStoreElement; } |
2322 int MinorKey() { | 2326 int MinorKey() const { |
2323 return ElementsKindBits::encode(elements_kind_) | | 2327 return ElementsKindBits::encode(elements_kind_) | |
2324 IsJSArrayBits::encode(is_js_array_) | | 2328 IsJSArrayBits::encode(is_js_array_) | |
2325 StoreModeBits::encode(store_mode_); | 2329 StoreModeBits::encode(store_mode_); |
2326 } | 2330 } |
2327 | 2331 |
2328 void Generate(MacroAssembler* masm); | 2332 void Generate(MacroAssembler* masm); |
2329 | 2333 |
2330 private: | 2334 private: |
2331 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; | 2335 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; |
2332 class StoreModeBits: public BitField<KeyedAccessStoreMode, 8, 4> {}; | 2336 class StoreModeBits: public BitField<KeyedAccessStoreMode, 8, 4> {}; |
(...skipping 24 matching lines...) Expand all Loading... | |
2357 // At most 8 different types can be distinguished, because the Code object | 2361 // At most 8 different types can be distinguished, because the Code object |
2358 // only has room for a single byte to hold a set of these types. :-P | 2362 // only has room for a single byte to hold a set of these types. :-P |
2359 STATIC_ASSERT(NUMBER_OF_TYPES <= 8); | 2363 STATIC_ASSERT(NUMBER_OF_TYPES <= 8); |
2360 | 2364 |
2361 class Types : public EnumSet<Type, byte> { | 2365 class Types : public EnumSet<Type, byte> { |
2362 public: | 2366 public: |
2363 Types() : EnumSet<Type, byte>(0) {} | 2367 Types() : EnumSet<Type, byte>(0) {} |
2364 explicit Types(byte bits) : EnumSet<Type, byte>(bits) {} | 2368 explicit Types(byte bits) : EnumSet<Type, byte>(bits) {} |
2365 | 2369 |
2366 byte ToByte() const { return ToIntegral(); } | 2370 byte ToByte() const { return ToIntegral(); } |
2367 void Print(StringStream* stream) const; | |
2368 bool UpdateStatus(Handle<Object> object); | 2371 bool UpdateStatus(Handle<Object> object); |
2369 bool NeedsMap() const; | 2372 bool NeedsMap() const; |
2370 bool CanBeUndetectable() const; | 2373 bool CanBeUndetectable() const; |
2371 bool IsGeneric() const { return ToIntegral() == Generic().ToIntegral(); } | 2374 bool IsGeneric() const { return ToIntegral() == Generic().ToIntegral(); } |
2372 | 2375 |
2373 static Types Generic() { return Types((1 << NUMBER_OF_TYPES) - 1); } | 2376 static Types Generic() { return Types((1 << NUMBER_OF_TYPES) - 1); } |
2374 }; | 2377 }; |
2375 | 2378 |
2376 ToBooleanStub(Isolate* isolate, Types types = Types()) | 2379 ToBooleanStub(Isolate* isolate, Types types = Types()) |
2377 : HydrogenCodeStub(isolate), types_(types) { } | 2380 : HydrogenCodeStub(isolate), types_(types) { } |
2378 ToBooleanStub(Isolate* isolate, ExtraICState state) | 2381 ToBooleanStub(Isolate* isolate, ExtraICState state) |
2379 : HydrogenCodeStub(isolate), types_(static_cast<byte>(state)) { } | 2382 : HydrogenCodeStub(isolate), types_(static_cast<byte>(state)) { } |
2380 | 2383 |
2381 bool UpdateStatus(Handle<Object> object); | 2384 bool UpdateStatus(Handle<Object> object); |
2382 Types GetTypes() { return types_; } | 2385 Types GetTypes() { return types_; } |
2383 | 2386 |
2384 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 2387 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
2385 virtual void InitializeInterfaceDescriptor( | 2388 virtual void InitializeInterfaceDescriptor( |
2386 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 2389 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
2387 | 2390 |
2388 virtual Code::Kind GetCodeKind() const { return Code::TO_BOOLEAN_IC; } | 2391 virtual Code::Kind GetCodeKind() const { return Code::TO_BOOLEAN_IC; } |
2389 virtual void PrintState(StringStream* stream); | 2392 virtual OStream& PrintState(OStream& os) const V8_OVERRIDE; // NOLINT |
2390 | 2393 |
2391 virtual bool SometimesSetsUpAFrame() { return false; } | 2394 virtual bool SometimesSetsUpAFrame() { return false; } |
2392 | 2395 |
2393 static void InstallDescriptors(Isolate* isolate) { | 2396 static void InstallDescriptors(Isolate* isolate) { |
2394 ToBooleanStub stub(isolate); | 2397 ToBooleanStub stub(isolate); |
2395 stub.InitializeInterfaceDescriptor( | 2398 stub.InitializeInterfaceDescriptor( |
2396 isolate->code_stub_interface_descriptor(CodeStub::ToBoolean)); | 2399 isolate->code_stub_interface_descriptor(CodeStub::ToBoolean)); |
2397 } | 2400 } |
2398 | 2401 |
2399 static Handle<Code> GetUninitialized(Isolate* isolate) { | 2402 static Handle<Code> GetUninitialized(Isolate* isolate) { |
2400 return ToBooleanStub(isolate, UNINITIALIZED).GetCode(); | 2403 return ToBooleanStub(isolate, UNINITIALIZED).GetCode(); |
2401 } | 2404 } |
2402 | 2405 |
2403 virtual ExtraICState GetExtraICState() { | 2406 virtual ExtraICState GetExtraICState() const { |
2404 return types_.ToIntegral(); | 2407 return types_.ToIntegral(); |
2405 } | 2408 } |
2406 | 2409 |
2407 virtual InlineCacheState GetICState() { | 2410 virtual InlineCacheState GetICState() { |
2408 if (types_.IsEmpty()) { | 2411 if (types_.IsEmpty()) { |
2409 return ::v8::internal::UNINITIALIZED; | 2412 return ::v8::internal::UNINITIALIZED; |
2410 } else { | 2413 } else { |
2411 return MONOMORPHIC; | 2414 return MONOMORPHIC; |
2412 } | 2415 } |
2413 } | 2416 } |
2414 | 2417 |
2415 private: | 2418 private: |
2416 Major MajorKey() { return ToBoolean; } | 2419 Major MajorKey() const { return ToBoolean; } |
2417 int NotMissMinorKey() { return GetExtraICState(); } | 2420 int NotMissMinorKey() const { return GetExtraICState(); } |
2418 | 2421 |
2419 ToBooleanStub(Isolate* isolate, InitializationState init_state) : | 2422 ToBooleanStub(Isolate* isolate, InitializationState init_state) : |
2420 HydrogenCodeStub(isolate, init_state) {} | 2423 HydrogenCodeStub(isolate, init_state) {} |
2421 | 2424 |
2422 Types types_; | 2425 Types types_; |
2423 }; | 2426 }; |
2424 | 2427 |
2425 | 2428 |
2429 OStream& operator<<(OStream& os, const ToBooleanStub::Types& t); | |
2430 | |
2431 | |
2426 class ElementsTransitionAndStoreStub : public HydrogenCodeStub { | 2432 class ElementsTransitionAndStoreStub : public HydrogenCodeStub { |
2427 public: | 2433 public: |
2428 ElementsTransitionAndStoreStub(Isolate* isolate, | 2434 ElementsTransitionAndStoreStub(Isolate* isolate, |
2429 ElementsKind from_kind, | 2435 ElementsKind from_kind, |
2430 ElementsKind to_kind, | 2436 ElementsKind to_kind, |
2431 bool is_jsarray, | 2437 bool is_jsarray, |
2432 KeyedAccessStoreMode store_mode) | 2438 KeyedAccessStoreMode store_mode) |
2433 : HydrogenCodeStub(isolate), | 2439 : HydrogenCodeStub(isolate), |
2434 from_kind_(from_kind), | 2440 from_kind_(from_kind), |
2435 to_kind_(to_kind), | 2441 to_kind_(to_kind), |
2436 is_jsarray_(is_jsarray), | 2442 is_jsarray_(is_jsarray), |
2437 store_mode_(store_mode) {} | 2443 store_mode_(store_mode) {} |
2438 | 2444 |
2439 ElementsKind from_kind() const { return from_kind_; } | 2445 ElementsKind from_kind() const { return from_kind_; } |
2440 ElementsKind to_kind() const { return to_kind_; } | 2446 ElementsKind to_kind() const { return to_kind_; } |
2441 bool is_jsarray() const { return is_jsarray_; } | 2447 bool is_jsarray() const { return is_jsarray_; } |
2442 KeyedAccessStoreMode store_mode() const { return store_mode_; } | 2448 KeyedAccessStoreMode store_mode() const { return store_mode_; } |
2443 | 2449 |
2444 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 2450 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
2445 | 2451 |
2446 virtual void InitializeInterfaceDescriptor( | 2452 virtual void InitializeInterfaceDescriptor( |
2447 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 2453 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
2448 | 2454 |
2449 private: | 2455 private: |
2450 class FromBits: public BitField<ElementsKind, 0, 8> {}; | 2456 class FromBits: public BitField<ElementsKind, 0, 8> {}; |
2451 class ToBits: public BitField<ElementsKind, 8, 8> {}; | 2457 class ToBits: public BitField<ElementsKind, 8, 8> {}; |
2452 class IsJSArrayBits: public BitField<bool, 16, 1> {}; | 2458 class IsJSArrayBits: public BitField<bool, 16, 1> {}; |
2453 class StoreModeBits: public BitField<KeyedAccessStoreMode, 17, 4> {}; | 2459 class StoreModeBits: public BitField<KeyedAccessStoreMode, 17, 4> {}; |
2454 | 2460 |
2455 Major MajorKey() { return ElementsTransitionAndStore; } | 2461 Major MajorKey() const { return ElementsTransitionAndStore; } |
2456 int NotMissMinorKey() { | 2462 int NotMissMinorKey() const { |
2457 return FromBits::encode(from_kind_) | | 2463 return FromBits::encode(from_kind_) | |
2458 ToBits::encode(to_kind_) | | 2464 ToBits::encode(to_kind_) | |
2459 IsJSArrayBits::encode(is_jsarray_) | | 2465 IsJSArrayBits::encode(is_jsarray_) | |
2460 StoreModeBits::encode(store_mode_); | 2466 StoreModeBits::encode(store_mode_); |
2461 } | 2467 } |
2462 | 2468 |
2463 ElementsKind from_kind_; | 2469 ElementsKind from_kind_; |
2464 ElementsKind to_kind_; | 2470 ElementsKind to_kind_; |
2465 bool is_jsarray_; | 2471 bool is_jsarray_; |
2466 KeyedAccessStoreMode store_mode_; | 2472 KeyedAccessStoreMode store_mode_; |
2467 | 2473 |
2468 DISALLOW_COPY_AND_ASSIGN(ElementsTransitionAndStoreStub); | 2474 DISALLOW_COPY_AND_ASSIGN(ElementsTransitionAndStoreStub); |
2469 }; | 2475 }; |
2470 | 2476 |
2471 | 2477 |
2472 class StoreArrayLiteralElementStub : public PlatformCodeStub { | 2478 class StoreArrayLiteralElementStub : public PlatformCodeStub { |
2473 public: | 2479 public: |
2474 explicit StoreArrayLiteralElementStub(Isolate* isolate) | 2480 explicit StoreArrayLiteralElementStub(Isolate* isolate) |
2475 : PlatformCodeStub(isolate) { } | 2481 : PlatformCodeStub(isolate) { } |
2476 | 2482 |
2477 private: | 2483 private: |
2478 Major MajorKey() { return StoreArrayLiteralElement; } | 2484 Major MajorKey() const { return StoreArrayLiteralElement; } |
2479 int MinorKey() { return 0; } | 2485 int MinorKey() const { return 0; } |
2480 | 2486 |
2481 void Generate(MacroAssembler* masm); | 2487 void Generate(MacroAssembler* masm); |
2482 | 2488 |
2483 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); | 2489 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); |
2484 }; | 2490 }; |
2485 | 2491 |
2486 | 2492 |
2487 class StubFailureTrampolineStub : public PlatformCodeStub { | 2493 class StubFailureTrampolineStub : public PlatformCodeStub { |
2488 public: | 2494 public: |
2489 StubFailureTrampolineStub(Isolate* isolate, StubFunctionMode function_mode) | 2495 StubFailureTrampolineStub(Isolate* isolate, StubFunctionMode function_mode) |
2490 : PlatformCodeStub(isolate), | 2496 : PlatformCodeStub(isolate), |
2491 function_mode_(function_mode) {} | 2497 function_mode_(function_mode) {} |
2492 | 2498 |
2493 static void GenerateAheadOfTime(Isolate* isolate); | 2499 static void GenerateAheadOfTime(Isolate* isolate); |
2494 | 2500 |
2495 private: | 2501 private: |
2496 class FunctionModeField: public BitField<StubFunctionMode, 0, 1> {}; | 2502 class FunctionModeField: public BitField<StubFunctionMode, 0, 1> {}; |
2497 | 2503 |
2498 Major MajorKey() { return StubFailureTrampoline; } | 2504 Major MajorKey() const { return StubFailureTrampoline; } |
2499 int MinorKey() { | 2505 int MinorKey() const { |
2500 return FunctionModeField::encode(function_mode_); | 2506 return FunctionModeField::encode(function_mode_); |
2501 } | 2507 } |
2502 | 2508 |
2503 void Generate(MacroAssembler* masm); | 2509 void Generate(MacroAssembler* masm); |
2504 | 2510 |
2505 StubFunctionMode function_mode_; | 2511 StubFunctionMode function_mode_; |
2506 | 2512 |
2507 DISALLOW_COPY_AND_ASSIGN(StubFailureTrampolineStub); | 2513 DISALLOW_COPY_AND_ASSIGN(StubFailureTrampolineStub); |
2508 }; | 2514 }; |
2509 | 2515 |
2510 | 2516 |
2511 class ProfileEntryHookStub : public PlatformCodeStub { | 2517 class ProfileEntryHookStub : public PlatformCodeStub { |
2512 public: | 2518 public: |
2513 explicit ProfileEntryHookStub(Isolate* isolate) : PlatformCodeStub(isolate) {} | 2519 explicit ProfileEntryHookStub(Isolate* isolate) : PlatformCodeStub(isolate) {} |
2514 | 2520 |
2515 // The profile entry hook function is not allowed to cause a GC. | 2521 // The profile entry hook function is not allowed to cause a GC. |
2516 virtual bool SometimesSetsUpAFrame() { return false; } | 2522 virtual bool SometimesSetsUpAFrame() { return false; } |
2517 | 2523 |
2518 // Generates a call to the entry hook if it's enabled. | 2524 // Generates a call to the entry hook if it's enabled. |
2519 static void MaybeCallEntryHook(MacroAssembler* masm); | 2525 static void MaybeCallEntryHook(MacroAssembler* masm); |
2520 | 2526 |
2521 private: | 2527 private: |
2522 static void EntryHookTrampoline(intptr_t function, | 2528 static void EntryHookTrampoline(intptr_t function, |
2523 intptr_t stack_pointer, | 2529 intptr_t stack_pointer, |
2524 Isolate* isolate); | 2530 Isolate* isolate); |
2525 | 2531 |
2526 Major MajorKey() { return ProfileEntryHook; } | 2532 Major MajorKey() const { return ProfileEntryHook; } |
2527 int MinorKey() { return 0; } | 2533 int MinorKey() const { return 0; } |
2528 | 2534 |
2529 void Generate(MacroAssembler* masm); | 2535 void Generate(MacroAssembler* masm); |
2530 | 2536 |
2531 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 2537 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); |
2532 }; | 2538 }; |
2533 | 2539 |
2534 | 2540 |
2535 class CallDescriptors { | 2541 class CallDescriptors { |
2536 public: | 2542 public: |
2537 static void InitializeForIsolate(Isolate* isolate); | 2543 static void InitializeForIsolate(Isolate* isolate); |
2538 }; | 2544 }; |
2539 | 2545 |
2540 } } // namespace v8::internal | 2546 } } // namespace v8::internal |
2541 | 2547 |
2542 #endif // V8_CODE_STUBS_H_ | 2548 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |