Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(614)

Side by Side Diff: src/code-stubs.h

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

Powered by Google App Engine
This is Rietveld 408576698