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

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

Issue 545163002: Unify JSEntryStub and JSConstructEntryStub, and some more code stub cleanups. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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.cc ('k') | src/heap/heap.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 17 matching lines...) Expand all
28 V(CallConstruct) \ 28 V(CallConstruct) \
29 V(CallFunction) \ 29 V(CallFunction) \
30 V(CallIC) \ 30 V(CallIC) \
31 V(CallIC_Array) \ 31 V(CallIC_Array) \
32 V(CEntry) \ 32 V(CEntry) \
33 V(CompareIC) \ 33 V(CompareIC) \
34 V(DoubleToI) \ 34 V(DoubleToI) \
35 V(FunctionPrototype) \ 35 V(FunctionPrototype) \
36 V(Instanceof) \ 36 V(Instanceof) \
37 V(InternalArrayConstructor) \ 37 V(InternalArrayConstructor) \
38 V(JSConstructEntry) \
39 V(JSEntry) \ 38 V(JSEntry) \
40 V(KeyedLoadICTrampoline) \ 39 V(KeyedLoadICTrampoline) \
41 V(LoadICTrampoline) \ 40 V(LoadICTrampoline) \
42 V(MathPow) \ 41 V(MathPow) \
43 V(ProfileEntryHook) \ 42 V(ProfileEntryHook) \
44 V(RecordWrite) \ 43 V(RecordWrite) \
45 V(RegExpExec) \ 44 V(RegExpExec) \
46 V(StoreArrayLiteralElement) \ 45 V(StoreArrayLiteralElement) \
47 V(StoreBufferOverflow) \ 46 V(StoreBufferOverflow) \
48 V(StoreElement) \ 47 V(StoreElement) \
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 268
270 269
271 #define DEFINE_CODE_STUB(NAME, SUPER) \ 270 #define DEFINE_CODE_STUB(NAME, SUPER) \
272 protected: \ 271 protected: \
273 virtual inline Major MajorKey() const OVERRIDE { \ 272 virtual inline Major MajorKey() const OVERRIDE { \
274 return NAME; \ 273 return NAME; \
275 }; \ 274 }; \
276 DEFINE_CODE_STUB_BASE(NAME##Stub, SUPER) 275 DEFINE_CODE_STUB_BASE(NAME##Stub, SUPER)
277 276
278 277
278 #define DEFINE_PLATFORM_CODE_STUB(NAME, SUPER) \
279 private: \
280 virtual void Generate(MacroAssembler* masm) OVERRIDE; \
281 DEFINE_CODE_STUB(NAME, SUPER)
282
283
284 #define DEFINE_HYDROGEN_CODE_STUB(NAME, SUPER) \
285 public: \
286 virtual void InitializeInterfaceDescriptor( \
287 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; \
288 virtual Handle<Code> GenerateCode() OVERRIDE; \
289 DEFINE_CODE_STUB(NAME, SUPER)
290
291 #define DEFINE_HANDLER_CODE_STUB(NAME, SUPER) \
292 public: \
293 virtual Handle<Code> GenerateCode() OVERRIDE; \
294 DEFINE_CODE_STUB(NAME, SUPER)
295
296
279 class PlatformCodeStub : public CodeStub { 297 class PlatformCodeStub : public CodeStub {
280 public: 298 public:
281 // Retrieve the code for the stub. Generate the code if needed. 299 // Retrieve the code for the stub. Generate the code if needed.
282 virtual Handle<Code> GenerateCode() OVERRIDE; 300 virtual Handle<Code> GenerateCode() OVERRIDE;
283 301
284 virtual Code::Kind GetCodeKind() const { return Code::STUB; } 302 virtual Code::Kind GetCodeKind() const { return Code::STUB; }
285 303
286 protected: 304 protected:
287 explicit PlatformCodeStub(Isolate* isolate) : CodeStub(isolate) {} 305 explicit PlatformCodeStub(Isolate* isolate) : CodeStub(isolate) {}
288 306
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 virtual void BeforeCall(MacroAssembler* masm) const {} 535 virtual void BeforeCall(MacroAssembler* masm) const {}
518 536
519 virtual void AfterCall(MacroAssembler* masm) const {} 537 virtual void AfterCall(MacroAssembler* masm) const {}
520 }; 538 };
521 539
522 540
523 class ToNumberStub: public HydrogenCodeStub { 541 class ToNumberStub: public HydrogenCodeStub {
524 public: 542 public:
525 explicit ToNumberStub(Isolate* isolate) : HydrogenCodeStub(isolate) { } 543 explicit ToNumberStub(Isolate* isolate) : HydrogenCodeStub(isolate) { }
526 544
527 virtual Handle<Code> GenerateCode() OVERRIDE;
528
529 virtual void InitializeInterfaceDescriptor(
530 CodeStubInterfaceDescriptor* descriptor) OVERRIDE;
531
532 static void InstallDescriptors(Isolate* isolate) { 545 static void InstallDescriptors(Isolate* isolate) {
533 ToNumberStub stub(isolate); 546 ToNumberStub stub(isolate);
534 stub.InitializeInterfaceDescriptor( 547 stub.InitializeInterfaceDescriptor(
535 isolate->code_stub_interface_descriptor(CodeStub::ToNumber)); 548 isolate->code_stub_interface_descriptor(CodeStub::ToNumber));
536 } 549 }
537 550
538 DEFINE_CODE_STUB(ToNumber, HydrogenCodeStub); 551 DEFINE_HYDROGEN_CODE_STUB(ToNumber, HydrogenCodeStub);
539 }; 552 };
540 553
541 554
542 class NumberToStringStub FINAL : public HydrogenCodeStub { 555 class NumberToStringStub FINAL : public HydrogenCodeStub {
543 public: 556 public:
544 explicit NumberToStringStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} 557 explicit NumberToStringStub(Isolate* isolate) : HydrogenCodeStub(isolate) {}
545 558
546 virtual Handle<Code> GenerateCode() OVERRIDE;
547
548 virtual void InitializeInterfaceDescriptor(
549 CodeStubInterfaceDescriptor* descriptor) OVERRIDE;
550
551 static void InstallDescriptors(Isolate* isolate); 559 static void InstallDescriptors(Isolate* isolate);
552 560
553 // Parameters accessed via CodeStubGraphBuilder::GetParameter() 561 // Parameters accessed via CodeStubGraphBuilder::GetParameter()
554 static const int kNumber = 0; 562 static const int kNumber = 0;
555 563
556 DEFINE_CODE_STUB(NumberToString, HydrogenCodeStub); 564 DEFINE_HYDROGEN_CODE_STUB(NumberToString, HydrogenCodeStub);
557 }; 565 };
558 566
559 567
560 class FastNewClosureStub : public HydrogenCodeStub { 568 class FastNewClosureStub : public HydrogenCodeStub {
561 public: 569 public:
562 FastNewClosureStub(Isolate* isolate, StrictMode strict_mode, 570 FastNewClosureStub(Isolate* isolate, StrictMode strict_mode,
563 bool is_generator) 571 bool is_generator)
564 : HydrogenCodeStub(isolate) { 572 : HydrogenCodeStub(isolate) {
565 set_sub_minor_key(StrictModeBits::encode(strict_mode) | 573 set_sub_minor_key(StrictModeBits::encode(strict_mode) |
566 IsGeneratorBits::encode(is_generator)); 574 IsGeneratorBits::encode(is_generator));
567 } 575 }
568 576
569 virtual Handle<Code> GenerateCode() OVERRIDE;
570
571 virtual void InitializeInterfaceDescriptor(
572 CodeStubInterfaceDescriptor* descriptor) OVERRIDE;
573
574 static void InstallDescriptors(Isolate* isolate); 577 static void InstallDescriptors(Isolate* isolate);
575 578
576 StrictMode strict_mode() const { 579 StrictMode strict_mode() const {
577 return StrictModeBits::decode(sub_minor_key()); 580 return StrictModeBits::decode(sub_minor_key());
578 } 581 }
579 582
580 bool is_generator() const { return IsGeneratorBits::decode(sub_minor_key()); } 583 bool is_generator() const { return IsGeneratorBits::decode(sub_minor_key()); }
581 584
582 private: 585 private:
583 class StrictModeBits : public BitField<StrictMode, 0, 1> {}; 586 class StrictModeBits : public BitField<StrictMode, 0, 1> {};
584 class IsGeneratorBits : public BitField<bool, 1, 1> {}; 587 class IsGeneratorBits : public BitField<bool, 1, 1> {};
585 588
586 DEFINE_CODE_STUB(FastNewClosure, HydrogenCodeStub); 589 DEFINE_HYDROGEN_CODE_STUB(FastNewClosure, HydrogenCodeStub);
587 }; 590 };
588 591
589 592
590 class FastNewContextStub FINAL : public HydrogenCodeStub { 593 class FastNewContextStub FINAL : public HydrogenCodeStub {
591 public: 594 public:
592 static const int kMaximumSlots = 64; 595 static const int kMaximumSlots = 64;
593 596
594 FastNewContextStub(Isolate* isolate, int slots) : HydrogenCodeStub(isolate) { 597 FastNewContextStub(Isolate* isolate, int slots) : HydrogenCodeStub(isolate) {
595 DCHECK(slots > 0 && slots <= kMaximumSlots); 598 DCHECK(slots > 0 && slots <= kMaximumSlots);
596 set_sub_minor_key(SlotsBits::encode(slots)); 599 set_sub_minor_key(SlotsBits::encode(slots));
597 } 600 }
598 601
599 virtual Handle<Code> GenerateCode() OVERRIDE;
600
601 virtual void InitializeInterfaceDescriptor(
602 CodeStubInterfaceDescriptor* descriptor) OVERRIDE;
603
604 static void InstallDescriptors(Isolate* isolate); 602 static void InstallDescriptors(Isolate* isolate);
605 603
606 int slots() const { return SlotsBits::decode(sub_minor_key()); } 604 int slots() const { return SlotsBits::decode(sub_minor_key()); }
607 605
608 // Parameters accessed via CodeStubGraphBuilder::GetParameter() 606 // Parameters accessed via CodeStubGraphBuilder::GetParameter()
609 static const int kFunction = 0; 607 static const int kFunction = 0;
610 608
611 private: 609 private:
612 class SlotsBits : public BitField<int, 0, 8> {}; 610 class SlotsBits : public BitField<int, 0, 8> {};
613 611
614 DEFINE_CODE_STUB(FastNewContext, HydrogenCodeStub); 612 DEFINE_HYDROGEN_CODE_STUB(FastNewContext, HydrogenCodeStub);
615 }; 613 };
616 614
617 615
618 class FastCloneShallowArrayStub : public HydrogenCodeStub { 616 class FastCloneShallowArrayStub : public HydrogenCodeStub {
619 public: 617 public:
620 FastCloneShallowArrayStub(Isolate* isolate, 618 FastCloneShallowArrayStub(Isolate* isolate,
621 AllocationSiteMode allocation_site_mode) 619 AllocationSiteMode allocation_site_mode)
622 : HydrogenCodeStub(isolate) { 620 : HydrogenCodeStub(isolate) {
623 set_sub_minor_key(AllocationSiteModeBits::encode(allocation_site_mode)); 621 set_sub_minor_key(AllocationSiteModeBits::encode(allocation_site_mode));
624 } 622 }
625 623
626 AllocationSiteMode allocation_site_mode() const { 624 AllocationSiteMode allocation_site_mode() const {
627 return AllocationSiteModeBits::decode(sub_minor_key()); 625 return AllocationSiteModeBits::decode(sub_minor_key());
628 } 626 }
629 627
630 virtual Handle<Code> GenerateCode();
631
632 virtual void InitializeInterfaceDescriptor(
633 CodeStubInterfaceDescriptor* descriptor) OVERRIDE;
634
635 static void InstallDescriptors(Isolate* isolate); 628 static void InstallDescriptors(Isolate* isolate);
636 629
637 private: 630 private:
638 class AllocationSiteModeBits: public BitField<AllocationSiteMode, 0, 1> {}; 631 class AllocationSiteModeBits: public BitField<AllocationSiteMode, 0, 1> {};
639 632
640 DEFINE_CODE_STUB(FastCloneShallowArray, HydrogenCodeStub); 633 DEFINE_HYDROGEN_CODE_STUB(FastCloneShallowArray, HydrogenCodeStub);
641 }; 634 };
642 635
643 636
644 class FastCloneShallowObjectStub : public HydrogenCodeStub { 637 class FastCloneShallowObjectStub : public HydrogenCodeStub {
645 public: 638 public:
646 // Maximum number of properties in copied object. 639 // Maximum number of properties in copied object.
647 static const int kMaximumClonedProperties = 6; 640 static const int kMaximumClonedProperties = 6;
648 641
649 FastCloneShallowObjectStub(Isolate* isolate, int length) 642 FastCloneShallowObjectStub(Isolate* isolate, int length)
650 : HydrogenCodeStub(isolate) { 643 : HydrogenCodeStub(isolate) {
651 DCHECK_GE(length, 0); 644 DCHECK_GE(length, 0);
652 DCHECK_LE(length, kMaximumClonedProperties); 645 DCHECK_LE(length, kMaximumClonedProperties);
653 set_sub_minor_key(LengthBits::encode(length)); 646 set_sub_minor_key(LengthBits::encode(length));
654 } 647 }
655 648
656 int length() const { return LengthBits::decode(sub_minor_key()); } 649 int length() const { return LengthBits::decode(sub_minor_key()); }
657 650
658 virtual Handle<Code> GenerateCode() OVERRIDE;
659
660 virtual void InitializeInterfaceDescriptor(
661 CodeStubInterfaceDescriptor* descriptor) OVERRIDE;
662
663 private: 651 private:
664 class LengthBits : public BitField<int, 0, 4> {}; 652 class LengthBits : public BitField<int, 0, 4> {};
665 653
666 DEFINE_CODE_STUB(FastCloneShallowObject, HydrogenCodeStub); 654 DEFINE_HYDROGEN_CODE_STUB(FastCloneShallowObject, HydrogenCodeStub);
667 }; 655 };
668 656
669 657
670 class CreateAllocationSiteStub : public HydrogenCodeStub { 658 class CreateAllocationSiteStub : public HydrogenCodeStub {
671 public: 659 public:
672 explicit CreateAllocationSiteStub(Isolate* isolate) 660 explicit CreateAllocationSiteStub(Isolate* isolate)
673 : HydrogenCodeStub(isolate) { } 661 : HydrogenCodeStub(isolate) { }
674 662
675 virtual Handle<Code> GenerateCode() OVERRIDE;
676
677 static void GenerateAheadOfTime(Isolate* isolate); 663 static void GenerateAheadOfTime(Isolate* isolate);
678 664
679 virtual void InitializeInterfaceDescriptor( 665 DEFINE_HYDROGEN_CODE_STUB(CreateAllocationSite, HydrogenCodeStub);
680 CodeStubInterfaceDescriptor* descriptor) OVERRIDE;
681
682 DEFINE_CODE_STUB(CreateAllocationSite, HydrogenCodeStub);
683 }; 666 };
684 667
685 668
686 class InstanceofStub: public PlatformCodeStub { 669 class InstanceofStub: public PlatformCodeStub {
687 public: 670 public:
688 enum Flags { 671 enum Flags {
689 kNoFlags = 0, 672 kNoFlags = 0,
690 kArgsInRegisters = 1 << 0, 673 kArgsInRegisters = 1 << 0,
691 kCallSiteInlineCheck = 1 << 1, 674 kCallSiteInlineCheck = 1 << 1,
692 kReturnTrueFalseObject = 1 << 2 675 kReturnTrueFalseObject = 1 << 2
693 }; 676 };
694 677
695 InstanceofStub(Isolate* isolate, Flags flags) : PlatformCodeStub(isolate) { 678 InstanceofStub(Isolate* isolate, Flags flags) : PlatformCodeStub(isolate) {
696 minor_key_ = FlagBits::encode(flags); 679 minor_key_ = FlagBits::encode(flags);
697 } 680 }
698 681
699 void Generate(MacroAssembler* masm);
700
701 static Register left() { return InstanceofDescriptor::left(); } 682 static Register left() { return InstanceofDescriptor::left(); }
702 static Register right() { return InstanceofDescriptor::right(); } 683 static Register right() { return InstanceofDescriptor::right(); }
703 684
704 virtual void InitializeInterfaceDescriptor( 685 virtual void InitializeInterfaceDescriptor(
705 CodeStubInterfaceDescriptor* descriptor); 686 CodeStubInterfaceDescriptor* descriptor);
706 687
707 private: 688 private:
708 Flags flags() const { return FlagBits::decode(minor_key_); } 689 Flags flags() const { return FlagBits::decode(minor_key_); }
709 690
710 bool HasArgsInRegisters() const { return (flags() & kArgsInRegisters) != 0; } 691 bool HasArgsInRegisters() const { return (flags() & kArgsInRegisters) != 0; }
711 692
712 bool HasCallSiteInlineCheck() const { 693 bool HasCallSiteInlineCheck() const {
713 return (flags() & kCallSiteInlineCheck) != 0; 694 return (flags() & kCallSiteInlineCheck) != 0;
714 } 695 }
715 696
716 bool ReturnTrueFalseObject() const { 697 bool ReturnTrueFalseObject() const {
717 return (flags() & kReturnTrueFalseObject) != 0; 698 return (flags() & kReturnTrueFalseObject) != 0;
718 } 699 }
719 700
720 virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT 701 virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT
721 702
722 class FlagBits : public BitField<Flags, 0, 3> {}; 703 class FlagBits : public BitField<Flags, 0, 3> {};
723 704
724 DEFINE_CODE_STUB(Instanceof, PlatformCodeStub); 705 DEFINE_PLATFORM_CODE_STUB(Instanceof, PlatformCodeStub);
725 }; 706 };
726 707
727 708
728 enum AllocationSiteOverrideMode { 709 enum AllocationSiteOverrideMode {
729 DONT_OVERRIDE, 710 DONT_OVERRIDE,
730 DISABLE_ALLOCATION_SITES, 711 DISABLE_ALLOCATION_SITES,
731 LAST_ALLOCATION_SITE_OVERRIDE_MODE = DISABLE_ALLOCATION_SITES 712 LAST_ALLOCATION_SITE_OVERRIDE_MODE = DISABLE_ALLOCATION_SITES
732 }; 713 };
733 714
734 715
735 class ArrayConstructorStub: public PlatformCodeStub { 716 class ArrayConstructorStub: public PlatformCodeStub {
736 public: 717 public:
737 enum ArgumentCountKey { ANY, NONE, ONE, MORE_THAN_ONE }; 718 enum ArgumentCountKey { ANY, NONE, ONE, MORE_THAN_ONE };
738 719
739 ArrayConstructorStub(Isolate* isolate, int argument_count); 720 ArrayConstructorStub(Isolate* isolate, int argument_count);
740 721
741 explicit ArrayConstructorStub(Isolate* isolate); 722 explicit ArrayConstructorStub(Isolate* isolate);
742 723
743 void Generate(MacroAssembler* masm);
744
745 private: 724 private:
746 ArgumentCountKey argument_count() const { 725 ArgumentCountKey argument_count() const {
747 return ArgumentCountBits::decode(minor_key_); 726 return ArgumentCountBits::decode(minor_key_);
748 } 727 }
749 728
750 void GenerateDispatchToArrayStub(MacroAssembler* masm, 729 void GenerateDispatchToArrayStub(MacroAssembler* masm,
751 AllocationSiteOverrideMode mode); 730 AllocationSiteOverrideMode mode);
752 731
753 virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT 732 virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT
754 733
755 class ArgumentCountBits : public BitField<ArgumentCountKey, 0, 2> {}; 734 class ArgumentCountBits : public BitField<ArgumentCountKey, 0, 2> {};
756 735
757 DEFINE_CODE_STUB(ArrayConstructor, PlatformCodeStub); 736 DEFINE_PLATFORM_CODE_STUB(ArrayConstructor, PlatformCodeStub);
758 }; 737 };
759 738
760 739
761 class InternalArrayConstructorStub: public PlatformCodeStub { 740 class InternalArrayConstructorStub: public PlatformCodeStub {
762 public: 741 public:
763 explicit InternalArrayConstructorStub(Isolate* isolate); 742 explicit InternalArrayConstructorStub(Isolate* isolate);
764 743
765 void Generate(MacroAssembler* masm);
766
767 private: 744 private:
768 void GenerateCase(MacroAssembler* masm, ElementsKind kind); 745 void GenerateCase(MacroAssembler* masm, ElementsKind kind);
769 746
770 DEFINE_CODE_STUB(InternalArrayConstructor, PlatformCodeStub); 747 DEFINE_PLATFORM_CODE_STUB(InternalArrayConstructor, PlatformCodeStub);
771 }; 748 };
772 749
773 750
774 class MathPowStub: public PlatformCodeStub { 751 class MathPowStub: public PlatformCodeStub {
775 public: 752 public:
776 enum ExponentType { INTEGER, DOUBLE, TAGGED, ON_STACK }; 753 enum ExponentType { INTEGER, DOUBLE, TAGGED, ON_STACK };
777 754
778 MathPowStub(Isolate* isolate, ExponentType exponent_type) 755 MathPowStub(Isolate* isolate, ExponentType exponent_type)
779 : PlatformCodeStub(isolate) { 756 : PlatformCodeStub(isolate) {
780 minor_key_ = ExponentTypeBits::encode(exponent_type); 757 minor_key_ = ExponentTypeBits::encode(exponent_type);
781 } 758 }
782 759
783 virtual void Generate(MacroAssembler* masm);
784
785 private: 760 private:
786 ExponentType exponent_type() const { 761 ExponentType exponent_type() const {
787 return ExponentTypeBits::decode(minor_key_); 762 return ExponentTypeBits::decode(minor_key_);
788 } 763 }
789 764
790 class ExponentTypeBits : public BitField<ExponentType, 0, 2> {}; 765 class ExponentTypeBits : public BitField<ExponentType, 0, 2> {};
791 766
792 DEFINE_CODE_STUB(MathPow, PlatformCodeStub); 767 DEFINE_PLATFORM_CODE_STUB(MathPow, PlatformCodeStub);
793 }; 768 };
794 769
795 770
796 class CallICStub: public PlatformCodeStub { 771 class CallICStub: public PlatformCodeStub {
797 public: 772 public:
798 CallICStub(Isolate* isolate, const CallIC::State& state) 773 CallICStub(Isolate* isolate, const CallIC::State& state)
799 : PlatformCodeStub(isolate) { 774 : PlatformCodeStub(isolate) {
800 minor_key_ = state.GetExtraICState(); 775 minor_key_ = state.GetExtraICState();
801 } 776 }
802 777
803 static int ExtractArgcFromMinorKey(int minor_key) { 778 static int ExtractArgcFromMinorKey(int minor_key) {
804 CallIC::State state(static_cast<ExtraICState>(minor_key)); 779 CallIC::State state(static_cast<ExtraICState>(minor_key));
805 return state.arg_count(); 780 return state.arg_count();
806 } 781 }
807 782
808 virtual void Generate(MacroAssembler* masm);
809
810 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::CALL_IC; } 783 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::CALL_IC; }
811 784
812 virtual InlineCacheState GetICState() const OVERRIDE { return DEFAULT; } 785 virtual InlineCacheState GetICState() const OVERRIDE { return DEFAULT; }
813 786
814 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE { 787 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE {
815 return static_cast<ExtraICState>(minor_key_); 788 return static_cast<ExtraICState>(minor_key_);
816 } 789 }
817 790
818 protected: 791 protected:
819 bool CallAsMethod() const { return state().call_type() == CallIC::METHOD; } 792 bool CallAsMethod() const { return state().call_type() == CallIC::METHOD; }
820 793
821 int arg_count() const { return state().arg_count(); } 794 int arg_count() const { return state().arg_count(); }
822 795
823 CallIC::State state() const { 796 CallIC::State state() const {
824 return CallIC::State(static_cast<ExtraICState>(minor_key_)); 797 return CallIC::State(static_cast<ExtraICState>(minor_key_));
825 } 798 }
826 799
827 // Code generation helpers. 800 // Code generation helpers.
828 void GenerateMiss(MacroAssembler* masm, IC::UtilityId id); 801 void GenerateMiss(MacroAssembler* masm, IC::UtilityId id);
829 802
830 private: 803 private:
831 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT 804 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT
832 805
833 DEFINE_CODE_STUB(CallIC, PlatformCodeStub); 806 DEFINE_PLATFORM_CODE_STUB(CallIC, PlatformCodeStub);
834 }; 807 };
835 808
836 809
837 class CallIC_ArrayStub: public CallICStub { 810 class CallIC_ArrayStub: public CallICStub {
838 public: 811 public:
839 CallIC_ArrayStub(Isolate* isolate, const CallIC::State& state_in) 812 CallIC_ArrayStub(Isolate* isolate, const CallIC::State& state_in)
840 : CallICStub(isolate, state_in) {} 813 : CallICStub(isolate, state_in) {}
841 814
842 virtual void Generate(MacroAssembler* masm);
843
844 virtual InlineCacheState GetICState() const FINAL OVERRIDE { 815 virtual InlineCacheState GetICState() const FINAL OVERRIDE {
845 return MONOMORPHIC; 816 return MONOMORPHIC;
846 } 817 }
847 818
848 private: 819 private:
849 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT 820 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT
850 821
851 DEFINE_CODE_STUB(CallIC_Array, CallICStub); 822 DEFINE_PLATFORM_CODE_STUB(CallIC_Array, CallICStub);
852 }; 823 };
853 824
854 825
855 // TODO(verwaest): Translate to hydrogen code stub. 826 // TODO(verwaest): Translate to hydrogen code stub.
856 class FunctionPrototypeStub : public PlatformCodeStub { 827 class FunctionPrototypeStub : public PlatformCodeStub {
857 public: 828 public:
858 explicit FunctionPrototypeStub(Isolate* isolate) 829 explicit FunctionPrototypeStub(Isolate* isolate)
859 : PlatformCodeStub(isolate) {} 830 : PlatformCodeStub(isolate) {}
860 831
861 virtual void Generate(MacroAssembler* masm);
862
863 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; } 832 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; }
864 833
865 DEFINE_CODE_STUB(FunctionPrototype, PlatformCodeStub); 834 DEFINE_PLATFORM_CODE_STUB(FunctionPrototype, PlatformCodeStub);
866 }; 835 };
867 836
868 837
869 class HandlerStub : public HydrogenCodeStub { 838 class HandlerStub : public HydrogenCodeStub {
870 public: 839 public:
871 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; } 840 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; }
872 virtual ExtraICState GetExtraICState() const { return kind(); } 841 virtual ExtraICState GetExtraICState() const { return kind(); }
873 virtual InlineCacheState GetICState() const { return MONOMORPHIC; } 842 virtual InlineCacheState GetICState() const { return MONOMORPHIC; }
874 843
875 virtual void InitializeInterfaceDescriptor( 844 virtual void InitializeInterfaceDescriptor(
876 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; 845 CodeStubInterfaceDescriptor* descriptor) OVERRIDE;
877 846
878 protected: 847 protected:
879 explicit HandlerStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} 848 explicit HandlerStub(Isolate* isolate) : HydrogenCodeStub(isolate) {}
880 849
881 virtual Code::Kind kind() const = 0; 850 virtual Code::Kind kind() const = 0;
882 851
883 DEFINE_CODE_STUB_BASE(HandlerStub, HydrogenCodeStub); 852 DEFINE_CODE_STUB_BASE(HandlerStub, HydrogenCodeStub);
884 }; 853 };
885 854
886 855
887 class LoadFieldStub: public HandlerStub { 856 class LoadFieldStub: public HandlerStub {
888 public: 857 public:
889 LoadFieldStub(Isolate* isolate, FieldIndex index) : HandlerStub(isolate) { 858 LoadFieldStub(Isolate* isolate, FieldIndex index) : HandlerStub(isolate) {
890 int property_index_key = index.GetFieldAccessStubKey(); 859 int property_index_key = index.GetFieldAccessStubKey();
891 set_sub_minor_key(LoadFieldByIndexBits::encode(property_index_key)); 860 set_sub_minor_key(LoadFieldByIndexBits::encode(property_index_key));
892 } 861 }
893 862
894 virtual Handle<Code> GenerateCode() OVERRIDE;
895
896 FieldIndex index() const { 863 FieldIndex index() const {
897 int property_index_key = LoadFieldByIndexBits::decode(sub_minor_key()); 864 int property_index_key = LoadFieldByIndexBits::decode(sub_minor_key());
898 return FieldIndex::FromFieldAccessStubKey(property_index_key); 865 return FieldIndex::FromFieldAccessStubKey(property_index_key);
899 } 866 }
900 867
901 protected: 868 protected:
902 virtual Code::Kind kind() const { return Code::LOAD_IC; } 869 virtual Code::Kind kind() const { return Code::LOAD_IC; }
903 virtual Code::StubType GetStubType() { return Code::FAST; } 870 virtual Code::StubType GetStubType() { return Code::FAST; }
904 871
905 private: 872 private:
906 class LoadFieldByIndexBits : public BitField<int, 0, 13> {}; 873 class LoadFieldByIndexBits : public BitField<int, 0, 13> {};
907 874
908 DEFINE_CODE_STUB(LoadField, HandlerStub); 875 DEFINE_HANDLER_CODE_STUB(LoadField, HandlerStub);
909 }; 876 };
910 877
911 878
912 class LoadConstantStub : public HandlerStub { 879 class LoadConstantStub : public HandlerStub {
913 public: 880 public:
914 LoadConstantStub(Isolate* isolate, int constant_index) 881 LoadConstantStub(Isolate* isolate, int constant_index)
915 : HandlerStub(isolate) { 882 : HandlerStub(isolate) {
916 set_sub_minor_key(ConstantIndexBits::encode(constant_index)); 883 set_sub_minor_key(ConstantIndexBits::encode(constant_index));
917 } 884 }
918 885
919 virtual Handle<Code> GenerateCode() OVERRIDE;
920
921 int constant_index() const { 886 int constant_index() const {
922 return ConstantIndexBits::decode(sub_minor_key()); 887 return ConstantIndexBits::decode(sub_minor_key());
923 } 888 }
924 889
925 protected: 890 protected:
926 virtual Code::Kind kind() const { return Code::LOAD_IC; } 891 virtual Code::Kind kind() const { return Code::LOAD_IC; }
927 virtual Code::StubType GetStubType() { return Code::FAST; } 892 virtual Code::StubType GetStubType() { return Code::FAST; }
928 893
929 private: 894 private:
930 class ConstantIndexBits : public BitField<int, 0, kSubMinorKeyBits> {}; 895 class ConstantIndexBits : public BitField<int, 0, kSubMinorKeyBits> {};
931 896
932 DEFINE_CODE_STUB(LoadConstant, HandlerStub); 897 DEFINE_HANDLER_CODE_STUB(LoadConstant, HandlerStub);
933 }; 898 };
934 899
935 900
936 class StringLengthStub: public HandlerStub { 901 class StringLengthStub: public HandlerStub {
937 public: 902 public:
938 explicit StringLengthStub(Isolate* isolate) : HandlerStub(isolate) {} 903 explicit StringLengthStub(Isolate* isolate) : HandlerStub(isolate) {}
939 904
940 virtual Handle<Code> GenerateCode() OVERRIDE;
941
942 protected: 905 protected:
943 virtual Code::Kind kind() const { return Code::LOAD_IC; } 906 virtual Code::Kind kind() const { return Code::LOAD_IC; }
944 virtual Code::StubType GetStubType() { return Code::FAST; } 907 virtual Code::StubType GetStubType() { return Code::FAST; }
945 908
946 DEFINE_CODE_STUB(StringLength, HandlerStub); 909 DEFINE_HANDLER_CODE_STUB(StringLength, HandlerStub);
947 }; 910 };
948 911
949 912
950 class StoreFieldStub : public HandlerStub { 913 class StoreFieldStub : public HandlerStub {
951 public: 914 public:
952 StoreFieldStub(Isolate* isolate, FieldIndex index, 915 StoreFieldStub(Isolate* isolate, FieldIndex index,
953 Representation representation) 916 Representation representation)
954 : HandlerStub(isolate) { 917 : HandlerStub(isolate) {
955 int property_index_key = index.GetFieldAccessStubKey(); 918 int property_index_key = index.GetFieldAccessStubKey();
956 uint8_t repr = PropertyDetails::EncodeRepresentation(representation); 919 uint8_t repr = PropertyDetails::EncodeRepresentation(representation);
957 set_sub_minor_key(StoreFieldByIndexBits::encode(property_index_key) | 920 set_sub_minor_key(StoreFieldByIndexBits::encode(property_index_key) |
958 RepresentationBits::encode(repr)); 921 RepresentationBits::encode(repr));
959 } 922 }
960 923
961 virtual Handle<Code> GenerateCode() OVERRIDE;
962
963 FieldIndex index() const { 924 FieldIndex index() const {
964 int property_index_key = StoreFieldByIndexBits::decode(sub_minor_key()); 925 int property_index_key = StoreFieldByIndexBits::decode(sub_minor_key());
965 return FieldIndex::FromFieldAccessStubKey(property_index_key); 926 return FieldIndex::FromFieldAccessStubKey(property_index_key);
966 } 927 }
967 928
968 Representation representation() { 929 Representation representation() {
969 uint8_t repr = RepresentationBits::decode(sub_minor_key()); 930 uint8_t repr = RepresentationBits::decode(sub_minor_key());
970 return PropertyDetails::DecodeRepresentation(repr); 931 return PropertyDetails::DecodeRepresentation(repr);
971 } 932 }
972 933
973 static void InstallDescriptors(Isolate* isolate); 934 static void InstallDescriptors(Isolate* isolate);
974 935
975 protected: 936 protected:
976 virtual Code::Kind kind() const { return Code::STORE_IC; } 937 virtual Code::Kind kind() const { return Code::STORE_IC; }
977 virtual Code::StubType GetStubType() { return Code::FAST; } 938 virtual Code::StubType GetStubType() { return Code::FAST; }
978 939
979 private: 940 private:
980 class StoreFieldByIndexBits : public BitField<int, 0, 13> {}; 941 class StoreFieldByIndexBits : public BitField<int, 0, 13> {};
981 class RepresentationBits : public BitField<uint8_t, 13, 4> {}; 942 class RepresentationBits : public BitField<uint8_t, 13, 4> {};
982 943
983 DEFINE_CODE_STUB(StoreField, HandlerStub); 944 DEFINE_HANDLER_CODE_STUB(StoreField, HandlerStub);
984 }; 945 };
985 946
986 947
987 class StoreGlobalStub : public HandlerStub { 948 class StoreGlobalStub : public HandlerStub {
988 public: 949 public:
989 StoreGlobalStub(Isolate* isolate, bool is_constant, bool check_global) 950 StoreGlobalStub(Isolate* isolate, bool is_constant, bool check_global)
990 : HandlerStub(isolate) { 951 : HandlerStub(isolate) {
991 set_sub_minor_key(IsConstantBits::encode(is_constant) | 952 set_sub_minor_key(IsConstantBits::encode(is_constant) |
992 CheckGlobalBits::encode(check_global)); 953 CheckGlobalBits::encode(check_global));
993 } 954 }
(...skipping 12 matching lines...) Expand all
1006 return CodeStub::GetCodeCopy(pattern); 967 return CodeStub::GetCodeCopy(pattern);
1007 } else { 968 } else {
1008 Code::FindAndReplacePattern pattern; 969 Code::FindAndReplacePattern pattern;
1009 pattern.Add(isolate()->factory()->global_property_cell_map(), cell); 970 pattern.Add(isolate()->factory()->global_property_cell_map(), cell);
1010 return CodeStub::GetCodeCopy(pattern); 971 return CodeStub::GetCodeCopy(pattern);
1011 } 972 }
1012 } 973 }
1013 974
1014 virtual Code::Kind kind() const { return Code::STORE_IC; } 975 virtual Code::Kind kind() const { return Code::STORE_IC; }
1015 976
1016 virtual Handle<Code> GenerateCode() OVERRIDE;
1017
1018 bool is_constant() const { return IsConstantBits::decode(sub_minor_key()); } 977 bool is_constant() const { return IsConstantBits::decode(sub_minor_key()); }
1019 978
1020 bool check_global() const { return CheckGlobalBits::decode(sub_minor_key()); } 979 bool check_global() const { return CheckGlobalBits::decode(sub_minor_key()); }
1021 980
1022 void set_is_constant(bool value) { 981 void set_is_constant(bool value) {
1023 set_sub_minor_key(IsConstantBits::update(sub_minor_key(), value)); 982 set_sub_minor_key(IsConstantBits::update(sub_minor_key(), value));
1024 } 983 }
1025 984
1026 Representation representation() { 985 Representation representation() {
1027 return Representation::FromKind( 986 return Representation::FromKind(
1028 RepresentationBits::decode(sub_minor_key())); 987 RepresentationBits::decode(sub_minor_key()));
1029 } 988 }
1030 989
1031 void set_representation(Representation r) { 990 void set_representation(Representation r) {
1032 set_sub_minor_key(RepresentationBits::update(sub_minor_key(), r.kind())); 991 set_sub_minor_key(RepresentationBits::update(sub_minor_key(), r.kind()));
1033 } 992 }
1034 993
1035 private: 994 private:
1036 class IsConstantBits: public BitField<bool, 0, 1> {}; 995 class IsConstantBits: public BitField<bool, 0, 1> {};
1037 class RepresentationBits: public BitField<Representation::Kind, 1, 8> {}; 996 class RepresentationBits: public BitField<Representation::Kind, 1, 8> {};
1038 class CheckGlobalBits: public BitField<bool, 9, 1> {}; 997 class CheckGlobalBits: public BitField<bool, 9, 1> {};
1039 998
1040 DEFINE_CODE_STUB(StoreGlobal, HandlerStub); 999 DEFINE_HANDLER_CODE_STUB(StoreGlobal, HandlerStub);
1041 }; 1000 };
1042 1001
1043 1002
1044 class CallApiFunctionStub : public PlatformCodeStub { 1003 class CallApiFunctionStub : public PlatformCodeStub {
1045 public: 1004 public:
1046 CallApiFunctionStub(Isolate* isolate, 1005 CallApiFunctionStub(Isolate* isolate,
1047 bool is_store, 1006 bool is_store,
1048 bool call_data_undefined, 1007 bool call_data_undefined,
1049 int argc) : PlatformCodeStub(isolate) { 1008 int argc) : PlatformCodeStub(isolate) {
1050 minor_key_ = IsStoreBits::encode(is_store) | 1009 minor_key_ = IsStoreBits::encode(is_store) |
1051 CallDataUndefinedBits::encode(call_data_undefined) | 1010 CallDataUndefinedBits::encode(call_data_undefined) |
1052 ArgumentBits::encode(argc); 1011 ArgumentBits::encode(argc);
1053 DCHECK(!is_store || argc == 1); 1012 DCHECK(!is_store || argc == 1);
1054 } 1013 }
1055 1014
1056 private: 1015 private:
1057 virtual void Generate(MacroAssembler* masm) OVERRIDE;
1058
1059 bool is_store() const { return IsStoreBits::decode(minor_key_); } 1016 bool is_store() const { return IsStoreBits::decode(minor_key_); }
1060 bool call_data_undefined() const { 1017 bool call_data_undefined() const {
1061 return CallDataUndefinedBits::decode(minor_key_); 1018 return CallDataUndefinedBits::decode(minor_key_);
1062 } 1019 }
1063 int argc() const { return ArgumentBits::decode(minor_key_); } 1020 int argc() const { return ArgumentBits::decode(minor_key_); }
1064 1021
1065 class IsStoreBits: public BitField<bool, 0, 1> {}; 1022 class IsStoreBits: public BitField<bool, 0, 1> {};
1066 class CallDataUndefinedBits: public BitField<bool, 1, 1> {}; 1023 class CallDataUndefinedBits: public BitField<bool, 1, 1> {};
1067 class ArgumentBits: public BitField<int, 2, Code::kArgumentsBits> {}; 1024 class ArgumentBits: public BitField<int, 2, Code::kArgumentsBits> {};
1068 STATIC_ASSERT(Code::kArgumentsBits + 2 <= kStubMinorKeyBits); 1025 STATIC_ASSERT(Code::kArgumentsBits + 2 <= kStubMinorKeyBits);
1069 1026
1070 DEFINE_CODE_STUB(CallApiFunction, PlatformCodeStub); 1027 DEFINE_PLATFORM_CODE_STUB(CallApiFunction, PlatformCodeStub);
1071 }; 1028 };
1072 1029
1073 1030
1074 class CallApiGetterStub : public PlatformCodeStub { 1031 class CallApiGetterStub : public PlatformCodeStub {
1075 public: 1032 public:
1076 explicit CallApiGetterStub(Isolate* isolate) : PlatformCodeStub(isolate) {} 1033 explicit CallApiGetterStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
1077 1034
1078 private: 1035 DEFINE_PLATFORM_CODE_STUB(CallApiGetter, PlatformCodeStub);
1079 virtual void Generate(MacroAssembler* masm) OVERRIDE;
1080
1081 DEFINE_CODE_STUB(CallApiGetter, PlatformCodeStub);
1082 }; 1036 };
1083 1037
1084 1038
1085 class BinaryOpICStub : public HydrogenCodeStub { 1039 class BinaryOpICStub : public HydrogenCodeStub {
1086 public: 1040 public:
1087 BinaryOpICStub(Isolate* isolate, Token::Value op, 1041 BinaryOpICStub(Isolate* isolate, Token::Value op,
1088 OverwriteMode mode = NO_OVERWRITE) 1042 OverwriteMode mode = NO_OVERWRITE)
1089 : HydrogenCodeStub(isolate, UNINITIALIZED) { 1043 : HydrogenCodeStub(isolate, UNINITIALIZED) {
1090 BinaryOpIC::State state(isolate, op, mode); 1044 BinaryOpIC::State state(isolate, op, mode);
1091 set_sub_minor_key(state.GetExtraICState()); 1045 set_sub_minor_key(state.GetExtraICState());
1092 } 1046 }
1093 1047
1094 BinaryOpICStub(Isolate* isolate, const BinaryOpIC::State& state) 1048 BinaryOpICStub(Isolate* isolate, const BinaryOpIC::State& state)
1095 : HydrogenCodeStub(isolate) { 1049 : HydrogenCodeStub(isolate) {
1096 set_sub_minor_key(state.GetExtraICState()); 1050 set_sub_minor_key(state.GetExtraICState());
1097 } 1051 }
1098 1052
1099 static void GenerateAheadOfTime(Isolate* isolate); 1053 static void GenerateAheadOfTime(Isolate* isolate);
1100 1054
1101 virtual void InitializeInterfaceDescriptor(
1102 CodeStubInterfaceDescriptor* descriptor) OVERRIDE;
1103
1104 static void InstallDescriptors(Isolate* isolate); 1055 static void InstallDescriptors(Isolate* isolate);
1105 1056
1106 virtual Code::Kind GetCodeKind() const OVERRIDE { 1057 virtual Code::Kind GetCodeKind() const OVERRIDE {
1107 return Code::BINARY_OP_IC; 1058 return Code::BINARY_OP_IC;
1108 } 1059 }
1109 1060
1110 virtual InlineCacheState GetICState() const FINAL OVERRIDE { 1061 virtual InlineCacheState GetICState() const FINAL OVERRIDE {
1111 return state().GetICState(); 1062 return state().GetICState();
1112 } 1063 }
1113 1064
1114 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE { 1065 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE {
1115 return static_cast<ExtraICState>(sub_minor_key()); 1066 return static_cast<ExtraICState>(sub_minor_key());
1116 } 1067 }
1117 1068
1118 virtual Handle<Code> GenerateCode() OVERRIDE;
1119
1120 BinaryOpIC::State state() const { 1069 BinaryOpIC::State state() const {
1121 return BinaryOpIC::State(isolate(), GetExtraICState()); 1070 return BinaryOpIC::State(isolate(), GetExtraICState());
1122 } 1071 }
1123 1072
1124 virtual void PrintState(OStream& os) const FINAL OVERRIDE; // NOLINT 1073 virtual void PrintState(OStream& os) const FINAL OVERRIDE; // NOLINT
1125 1074
1126 // Parameters accessed via CodeStubGraphBuilder::GetParameter() 1075 // Parameters accessed via CodeStubGraphBuilder::GetParameter()
1127 static const int kLeft = 0; 1076 static const int kLeft = 0;
1128 static const int kRight = 1; 1077 static const int kRight = 1;
1129 1078
1130 private: 1079 private:
1131 static void GenerateAheadOfTime(Isolate* isolate, 1080 static void GenerateAheadOfTime(Isolate* isolate,
1132 const BinaryOpIC::State& state); 1081 const BinaryOpIC::State& state);
1133 1082
1134 DEFINE_CODE_STUB(BinaryOpIC, HydrogenCodeStub); 1083 DEFINE_HYDROGEN_CODE_STUB(BinaryOpIC, HydrogenCodeStub);
1135 }; 1084 };
1136 1085
1137 1086
1138 // TODO(bmeurer): Merge this into the BinaryOpICStub once we have proper tail 1087 // TODO(bmeurer): Merge this into the BinaryOpICStub once we have proper tail
1139 // call support for stubs in Hydrogen. 1088 // call support for stubs in Hydrogen.
1140 class BinaryOpICWithAllocationSiteStub FINAL : public PlatformCodeStub { 1089 class BinaryOpICWithAllocationSiteStub FINAL : public PlatformCodeStub {
1141 public: 1090 public:
1142 BinaryOpICWithAllocationSiteStub(Isolate* isolate, 1091 BinaryOpICWithAllocationSiteStub(Isolate* isolate,
1143 const BinaryOpIC::State& state) 1092 const BinaryOpIC::State& state)
1144 : PlatformCodeStub(isolate) { 1093 : PlatformCodeStub(isolate) {
(...skipping 13 matching lines...) Expand all
1158 } 1107 }
1159 1108
1160 virtual InlineCacheState GetICState() const OVERRIDE { 1109 virtual InlineCacheState GetICState() const OVERRIDE {
1161 return state().GetICState(); 1110 return state().GetICState();
1162 } 1111 }
1163 1112
1164 virtual ExtraICState GetExtraICState() const OVERRIDE { 1113 virtual ExtraICState GetExtraICState() const OVERRIDE {
1165 return static_cast<ExtraICState>(minor_key_); 1114 return static_cast<ExtraICState>(minor_key_);
1166 } 1115 }
1167 1116
1168 virtual void Generate(MacroAssembler* masm) OVERRIDE;
1169
1170 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT 1117 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT
1171 1118
1172 private: 1119 private:
1173 BinaryOpIC::State state() const { 1120 BinaryOpIC::State state() const {
1174 return BinaryOpIC::State(isolate(), static_cast<ExtraICState>(minor_key_)); 1121 return BinaryOpIC::State(isolate(), static_cast<ExtraICState>(minor_key_));
1175 } 1122 }
1176 1123
1177 static void GenerateAheadOfTime(Isolate* isolate, 1124 static void GenerateAheadOfTime(Isolate* isolate,
1178 const BinaryOpIC::State& state); 1125 const BinaryOpIC::State& state);
1179 1126
1180 DEFINE_CODE_STUB(BinaryOpICWithAllocationSite, PlatformCodeStub); 1127 DEFINE_PLATFORM_CODE_STUB(BinaryOpICWithAllocationSite, PlatformCodeStub);
1181 }; 1128 };
1182 1129
1183 1130
1184 class BinaryOpWithAllocationSiteStub FINAL : public BinaryOpICStub { 1131 class BinaryOpWithAllocationSiteStub FINAL : public BinaryOpICStub {
1185 public: 1132 public:
1186 BinaryOpWithAllocationSiteStub(Isolate* isolate, 1133 BinaryOpWithAllocationSiteStub(Isolate* isolate,
1187 Token::Value op, 1134 Token::Value op,
1188 OverwriteMode mode) 1135 OverwriteMode mode)
1189 : BinaryOpICStub(isolate, op, mode) {} 1136 : BinaryOpICStub(isolate, op, mode) {}
1190 1137
1191 BinaryOpWithAllocationSiteStub(Isolate* isolate, 1138 BinaryOpWithAllocationSiteStub(Isolate* isolate,
1192 const BinaryOpIC::State& state) 1139 const BinaryOpIC::State& state)
1193 : BinaryOpICStub(isolate, state) {} 1140 : BinaryOpICStub(isolate, state) {}
1194 1141
1195 virtual void InitializeInterfaceDescriptor(
1196 CodeStubInterfaceDescriptor* descriptor) OVERRIDE;
1197
1198 static void InstallDescriptors(Isolate* isolate); 1142 static void InstallDescriptors(Isolate* isolate);
1199 1143
1200 virtual Code::Kind GetCodeKind() const FINAL OVERRIDE { 1144 virtual Code::Kind GetCodeKind() const FINAL OVERRIDE {
1201 return Code::STUB; 1145 return Code::STUB;
1202 } 1146 }
1203 1147
1204 virtual Handle<Code> GenerateCode() OVERRIDE;
1205
1206 // Parameters accessed via CodeStubGraphBuilder::GetParameter() 1148 // Parameters accessed via CodeStubGraphBuilder::GetParameter()
1207 static const int kAllocationSite = 0; 1149 static const int kAllocationSite = 0;
1208 static const int kLeft = 1; 1150 static const int kLeft = 1;
1209 static const int kRight = 2; 1151 static const int kRight = 2;
1210 1152
1211 DEFINE_CODE_STUB(BinaryOpWithAllocationSite, BinaryOpICStub); 1153 DEFINE_HYDROGEN_CODE_STUB(BinaryOpWithAllocationSite, BinaryOpICStub);
1212 }; 1154 };
1213 1155
1214 1156
1215 enum StringAddFlags { 1157 enum StringAddFlags {
1216 // Omit both parameter checks. 1158 // Omit both parameter checks.
1217 STRING_ADD_CHECK_NONE = 0, 1159 STRING_ADD_CHECK_NONE = 0,
1218 // Check left parameter. 1160 // Check left parameter.
1219 STRING_ADD_CHECK_LEFT = 1 << 0, 1161 STRING_ADD_CHECK_LEFT = 1 << 0,
1220 // Check right parameter. 1162 // Check right parameter.
1221 STRING_ADD_CHECK_RIGHT = 1 << 1, 1163 STRING_ADD_CHECK_RIGHT = 1 << 1,
(...skipping 12 matching lines...) Expand all
1234 } 1176 }
1235 1177
1236 StringAddFlags flags() const { 1178 StringAddFlags flags() const {
1237 return StringAddFlagsBits::decode(sub_minor_key()); 1179 return StringAddFlagsBits::decode(sub_minor_key());
1238 } 1180 }
1239 1181
1240 PretenureFlag pretenure_flag() const { 1182 PretenureFlag pretenure_flag() const {
1241 return PretenureFlagBits::decode(sub_minor_key()); 1183 return PretenureFlagBits::decode(sub_minor_key());
1242 } 1184 }
1243 1185
1244 virtual Handle<Code> GenerateCode() OVERRIDE;
1245
1246 virtual void InitializeInterfaceDescriptor(
1247 CodeStubInterfaceDescriptor* descriptor) OVERRIDE;
1248
1249 static void InstallDescriptors(Isolate* isolate); 1186 static void InstallDescriptors(Isolate* isolate);
1250 1187
1251 // Parameters accessed via CodeStubGraphBuilder::GetParameter() 1188 // Parameters accessed via CodeStubGraphBuilder::GetParameter()
1252 static const int kLeft = 0; 1189 static const int kLeft = 0;
1253 static const int kRight = 1; 1190 static const int kRight = 1;
1254 1191
1255 private: 1192 private:
1256 class StringAddFlagsBits: public BitField<StringAddFlags, 0, 2> {}; 1193 class StringAddFlagsBits: public BitField<StringAddFlags, 0, 2> {};
1257 class PretenureFlagBits: public BitField<PretenureFlag, 2, 1> {}; 1194 class PretenureFlagBits: public BitField<PretenureFlag, 2, 1> {};
1258 1195
1259 virtual void PrintBaseName(OStream& os) const OVERRIDE; // NOLINT 1196 virtual void PrintBaseName(OStream& os) const OVERRIDE; // NOLINT
1260 1197
1261 DEFINE_CODE_STUB(StringAdd, HydrogenCodeStub); 1198 DEFINE_HYDROGEN_CODE_STUB(StringAdd, HydrogenCodeStub);
1262 }; 1199 };
1263 1200
1264 1201
1265 class CompareICStub : public PlatformCodeStub { 1202 class CompareICStub : public PlatformCodeStub {
1266 public: 1203 public:
1267 CompareICStub(Isolate* isolate, Token::Value op, CompareIC::State left, 1204 CompareICStub(Isolate* isolate, Token::Value op, CompareIC::State left,
1268 CompareIC::State right, CompareIC::State state) 1205 CompareIC::State right, CompareIC::State state)
1269 : PlatformCodeStub(isolate) { 1206 : PlatformCodeStub(isolate) {
1270 DCHECK(Token::IsCompareOp(op)); 1207 DCHECK(Token::IsCompareOp(op));
1271 minor_key_ = OpBits::encode(op - Token::EQ) | LeftStateBits::encode(left) | 1208 minor_key_ = OpBits::encode(op - Token::EQ) | LeftStateBits::encode(left) |
1272 RightStateBits::encode(right) | StateBits::encode(state); 1209 RightStateBits::encode(right) | StateBits::encode(state);
1273 } 1210 }
1274 1211
1275 virtual void Generate(MacroAssembler* masm);
1276
1277 void set_known_map(Handle<Map> map) { known_map_ = map; } 1212 void set_known_map(Handle<Map> map) { known_map_ = map; }
1278 1213
1279 virtual InlineCacheState GetICState() const; 1214 virtual InlineCacheState GetICState() const;
1280 1215
1281 Token::Value op() const { 1216 Token::Value op() const {
1282 return static_cast<Token::Value>(Token::EQ + OpBits::decode(minor_key_)); 1217 return static_cast<Token::Value>(Token::EQ + OpBits::decode(minor_key_));
1283 } 1218 }
1284 1219
1285 CompareIC::State left() const { return LeftStateBits::decode(minor_key_); } 1220 CompareIC::State left() const { return LeftStateBits::decode(minor_key_); }
1286 CompareIC::State right() const { return RightStateBits::decode(minor_key_); } 1221 CompareIC::State right() const { return RightStateBits::decode(minor_key_); }
(...skipping 19 matching lines...) Expand all
1306 virtual bool FindCodeInSpecialCache(Code** code_out); 1241 virtual bool FindCodeInSpecialCache(Code** code_out);
1307 virtual bool UseSpecialCache() { return state() == CompareIC::KNOWN_OBJECT; } 1242 virtual bool UseSpecialCache() { return state() == CompareIC::KNOWN_OBJECT; }
1308 1243
1309 class OpBits : public BitField<int, 0, 3> {}; 1244 class OpBits : public BitField<int, 0, 3> {};
1310 class LeftStateBits : public BitField<CompareIC::State, 3, 4> {}; 1245 class LeftStateBits : public BitField<CompareIC::State, 3, 4> {};
1311 class RightStateBits : public BitField<CompareIC::State, 7, 4> {}; 1246 class RightStateBits : public BitField<CompareIC::State, 7, 4> {};
1312 class StateBits : public BitField<CompareIC::State, 11, 4> {}; 1247 class StateBits : public BitField<CompareIC::State, 11, 4> {};
1313 1248
1314 Handle<Map> known_map_; 1249 Handle<Map> known_map_;
1315 1250
1316 DEFINE_CODE_STUB(CompareIC, PlatformCodeStub); 1251 DEFINE_PLATFORM_CODE_STUB(CompareIC, PlatformCodeStub);
1317 }; 1252 };
1318 1253
1319 1254
1320 class CompareNilICStub : public HydrogenCodeStub { 1255 class CompareNilICStub : public HydrogenCodeStub {
1321 public: 1256 public:
1322 Type* GetType(Zone* zone, Handle<Map> map = Handle<Map>()); 1257 Type* GetType(Zone* zone, Handle<Map> map = Handle<Map>());
1323 Type* GetInputType(Zone* zone, Handle<Map> map); 1258 Type* GetInputType(Zone* zone, Handle<Map> map);
1324 1259
1325 CompareNilICStub(Isolate* isolate, NilValue nil) : HydrogenCodeStub(isolate) { 1260 CompareNilICStub(Isolate* isolate, NilValue nil) : HydrogenCodeStub(isolate) {
1326 set_sub_minor_key(NilValueBits::encode(nil)); 1261 set_sub_minor_key(NilValueBits::encode(nil));
1327 } 1262 }
1328 1263
1329 CompareNilICStub(Isolate* isolate, ExtraICState ic_state, 1264 CompareNilICStub(Isolate* isolate, ExtraICState ic_state,
1330 InitializationState init_state = INITIALIZED) 1265 InitializationState init_state = INITIALIZED)
1331 : HydrogenCodeStub(isolate, init_state) { 1266 : HydrogenCodeStub(isolate, init_state) {
1332 set_sub_minor_key(ic_state); 1267 set_sub_minor_key(ic_state);
1333 } 1268 }
1334 1269
1335 static Handle<Code> GetUninitialized(Isolate* isolate, 1270 static Handle<Code> GetUninitialized(Isolate* isolate,
1336 NilValue nil) { 1271 NilValue nil) {
1337 return CompareNilICStub(isolate, nil, UNINITIALIZED).GetCode(); 1272 return CompareNilICStub(isolate, nil, UNINITIALIZED).GetCode();
1338 } 1273 }
1339 1274
1340 virtual void InitializeInterfaceDescriptor(
1341 CodeStubInterfaceDescriptor* descriptor) OVERRIDE;
1342
1343 static void InstallDescriptors(Isolate* isolate) { 1275 static void InstallDescriptors(Isolate* isolate) {
1344 CompareNilICStub compare_stub(isolate, kNullValue, UNINITIALIZED); 1276 CompareNilICStub compare_stub(isolate, kNullValue, UNINITIALIZED);
1345 compare_stub.InitializeInterfaceDescriptor( 1277 compare_stub.InitializeInterfaceDescriptor(
1346 isolate->code_stub_interface_descriptor(CodeStub::CompareNilIC)); 1278 isolate->code_stub_interface_descriptor(CodeStub::CompareNilIC));
1347 } 1279 }
1348 1280
1349 virtual InlineCacheState GetICState() const { 1281 virtual InlineCacheState GetICState() const {
1350 State state = this->state(); 1282 State state = this->state();
1351 if (state.Contains(GENERIC)) { 1283 if (state.Contains(GENERIC)) {
1352 return MEGAMORPHIC; 1284 return MEGAMORPHIC;
1353 } else if (state.Contains(MONOMORPHIC_MAP)) { 1285 } else if (state.Contains(MONOMORPHIC_MAP)) {
1354 return MONOMORPHIC; 1286 return MONOMORPHIC;
1355 } else { 1287 } else {
1356 return PREMONOMORPHIC; 1288 return PREMONOMORPHIC;
1357 } 1289 }
1358 } 1290 }
1359 1291
1360 virtual Code::Kind GetCodeKind() const { return Code::COMPARE_NIL_IC; } 1292 virtual Code::Kind GetCodeKind() const { return Code::COMPARE_NIL_IC; }
1361 1293
1362 virtual Handle<Code> GenerateCode() OVERRIDE;
1363
1364 virtual ExtraICState GetExtraICState() const { return sub_minor_key(); } 1294 virtual ExtraICState GetExtraICState() const { return sub_minor_key(); }
1365 1295
1366 void UpdateStatus(Handle<Object> object); 1296 void UpdateStatus(Handle<Object> object);
1367 1297
1368 bool IsMonomorphic() const { return state().Contains(MONOMORPHIC_MAP); } 1298 bool IsMonomorphic() const { return state().Contains(MONOMORPHIC_MAP); }
1369 1299
1370 NilValue nil_value() const { return NilValueBits::decode(sub_minor_key()); } 1300 NilValue nil_value() const { return NilValueBits::decode(sub_minor_key()); }
1371 1301
1372 void ClearState() { 1302 void ClearState() {
1373 set_sub_minor_key(TypesBits::update(sub_minor_key(), 0)); 1303 set_sub_minor_key(TypesBits::update(sub_minor_key(), 0));
(...skipping 29 matching lines...) Expand all
1403 }; 1333 };
1404 friend OStream& operator<<(OStream& os, const State& s); 1334 friend OStream& operator<<(OStream& os, const State& s);
1405 1335
1406 State state() const { return State(TypesBits::decode(sub_minor_key())); } 1336 State state() const { return State(TypesBits::decode(sub_minor_key())); }
1407 1337
1408 class NilValueBits : public BitField<NilValue, 0, 1> {}; 1338 class NilValueBits : public BitField<NilValue, 0, 1> {};
1409 class TypesBits : public BitField<byte, 1, NUMBER_OF_TYPES> {}; 1339 class TypesBits : public BitField<byte, 1, NUMBER_OF_TYPES> {};
1410 1340
1411 friend class CompareNilIC; 1341 friend class CompareNilIC;
1412 1342
1413 DEFINE_CODE_STUB(CompareNilIC, HydrogenCodeStub); 1343 DEFINE_HYDROGEN_CODE_STUB(CompareNilIC, HydrogenCodeStub);
1414 }; 1344 };
1415 1345
1416 1346
1417 OStream& operator<<(OStream& os, const CompareNilICStub::State& s); 1347 OStream& operator<<(OStream& os, const CompareNilICStub::State& s);
1418 1348
1419 1349
1420 class CEntryStub : public PlatformCodeStub { 1350 class CEntryStub : public PlatformCodeStub {
1421 public: 1351 public:
1422 CEntryStub(Isolate* isolate, int result_size, 1352 CEntryStub(Isolate* isolate, int result_size,
1423 SaveFPRegsMode save_doubles = kDontSaveFPRegs) 1353 SaveFPRegsMode save_doubles = kDontSaveFPRegs)
1424 : PlatformCodeStub(isolate) { 1354 : PlatformCodeStub(isolate) {
1425 minor_key_ = SaveDoublesBits::encode(save_doubles == kSaveFPRegs); 1355 minor_key_ = SaveDoublesBits::encode(save_doubles == kSaveFPRegs);
1426 DCHECK(result_size == 1 || result_size == 2); 1356 DCHECK(result_size == 1 || result_size == 2);
1427 #ifdef _WIN64 1357 #ifdef _WIN64
1428 minor_key_ = ResultSizeBits::update(minor_key_, result_size); 1358 minor_key_ = ResultSizeBits::update(minor_key_, result_size);
1429 #endif // _WIN64 1359 #endif // _WIN64
1430 } 1360 }
1431 1361
1432 void Generate(MacroAssembler* masm);
1433
1434 // The version of this stub that doesn't save doubles is generated ahead of 1362 // The version of this stub that doesn't save doubles is generated ahead of
1435 // time, so it's OK to call it from other stubs that can't cope with GC during 1363 // time, so it's OK to call it from other stubs that can't cope with GC during
1436 // their code generation. On machines that always have gp registers (x64) we 1364 // their code generation. On machines that always have gp registers (x64) we
1437 // can generate both variants ahead of time. 1365 // can generate both variants ahead of time.
1438 static void GenerateAheadOfTime(Isolate* isolate); 1366 static void GenerateAheadOfTime(Isolate* isolate);
1439 1367
1440 private: 1368 private:
1441 bool save_doubles() const { return SaveDoublesBits::decode(minor_key_); } 1369 bool save_doubles() const { return SaveDoublesBits::decode(minor_key_); }
1442 #ifdef _WIN64 1370 #ifdef _WIN64
1443 int result_size() const { return ResultSizeBits::decode(minor_key_); } 1371 int result_size() const { return ResultSizeBits::decode(minor_key_); }
1444 #endif // _WIN64 1372 #endif // _WIN64
1445 1373
1446 bool NeedsImmovableCode(); 1374 bool NeedsImmovableCode();
1447 1375
1448 class SaveDoublesBits : public BitField<bool, 0, 1> {}; 1376 class SaveDoublesBits : public BitField<bool, 0, 1> {};
1449 class ResultSizeBits : public BitField<int, 1, 3> {}; 1377 class ResultSizeBits : public BitField<int, 1, 3> {};
1450 1378
1451 DEFINE_CODE_STUB(CEntry, PlatformCodeStub); 1379 DEFINE_PLATFORM_CODE_STUB(CEntry, PlatformCodeStub);
1452 }; 1380 };
1453 1381
1454 1382
1455 class JSEntryStub : public PlatformCodeStub { 1383 class JSEntryStub : public PlatformCodeStub {
1456 public: 1384 public:
1457 explicit JSEntryStub(Isolate* isolate) : PlatformCodeStub(isolate) { } 1385 JSEntryStub(Isolate* isolate, StackFrame::Type type)
1458 1386 : PlatformCodeStub(isolate) {
1459 void Generate(MacroAssembler* masm) { GenerateBody(masm, false); } 1387 DCHECK(type == StackFrame::ENTRY || type == StackFrame::ENTRY_CONSTRUCT);
1460 1388 minor_key_ = StackFrameTypeBits::encode(type);
1461 protected: 1389 }
1462 void GenerateBody(MacroAssembler* masm, bool is_construct);
1463 1390
1464 private: 1391 private:
1465 virtual void FinishCode(Handle<Code> code); 1392 virtual void FinishCode(Handle<Code> code);
1466 1393
1394 virtual void PrintName(OStream& os) const OVERRIDE { // NOLINT
1395 os << (type() == StackFrame::ENTRY ? "JSEntryStub"
1396 : "JSConstructEntryStub");
1397 }
1398
1399 StackFrame::Type type() const {
1400 return StackFrameTypeBits::decode(minor_key_);
1401 }
1402
1403 class StackFrameTypeBits : public BitField<StackFrame::Type, 0, 5> {};
1404
1467 int handler_offset_; 1405 int handler_offset_;
1468 1406
1469 DEFINE_CODE_STUB(JSEntry, PlatformCodeStub); 1407 DEFINE_PLATFORM_CODE_STUB(JSEntry, PlatformCodeStub);
1470 }; 1408 };
1471 1409
1472 1410
1473 class JSConstructEntryStub : public JSEntryStub {
1474 public:
1475 explicit JSConstructEntryStub(Isolate* isolate) : JSEntryStub(isolate) {}
1476
1477 void Generate(MacroAssembler* masm) { GenerateBody(masm, true); }
1478
1479 private:
1480 virtual void PrintName(OStream& os) const OVERRIDE { // NOLINT
1481 os << "JSConstructEntryStub";
1482 }
1483
1484 DEFINE_CODE_STUB(JSConstructEntry, JSEntryStub);
1485 };
1486
1487
1488 class ArgumentsAccessStub: public PlatformCodeStub { 1411 class ArgumentsAccessStub: public PlatformCodeStub {
1489 public: 1412 public:
1490 enum Type { 1413 enum Type {
1491 READ_ELEMENT, 1414 READ_ELEMENT,
1492 NEW_SLOPPY_FAST, 1415 NEW_SLOPPY_FAST,
1493 NEW_SLOPPY_SLOW, 1416 NEW_SLOPPY_SLOW,
1494 NEW_STRICT 1417 NEW_STRICT
1495 }; 1418 };
1496 1419
1497 ArgumentsAccessStub(Isolate* isolate, Type type) : PlatformCodeStub(isolate) { 1420 ArgumentsAccessStub(Isolate* isolate, Type type) : PlatformCodeStub(isolate) {
1498 minor_key_ = TypeBits::encode(type); 1421 minor_key_ = TypeBits::encode(type);
1499 } 1422 }
1500 1423
1501 private: 1424 private:
1502 Type type() const { return TypeBits::decode(minor_key_); } 1425 Type type() const { return TypeBits::decode(minor_key_); }
1503 1426
1504 void Generate(MacroAssembler* masm);
1505 void GenerateReadElement(MacroAssembler* masm); 1427 void GenerateReadElement(MacroAssembler* masm);
1506 void GenerateNewStrict(MacroAssembler* masm); 1428 void GenerateNewStrict(MacroAssembler* masm);
1507 void GenerateNewSloppyFast(MacroAssembler* masm); 1429 void GenerateNewSloppyFast(MacroAssembler* masm);
1508 void GenerateNewSloppySlow(MacroAssembler* masm); 1430 void GenerateNewSloppySlow(MacroAssembler* masm);
1509 1431
1510 virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT 1432 virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT
1511 1433
1512 class TypeBits : public BitField<Type, 0, 2> {}; 1434 class TypeBits : public BitField<Type, 0, 2> {};
1513 1435
1514 DEFINE_CODE_STUB(ArgumentsAccess, PlatformCodeStub); 1436 DEFINE_PLATFORM_CODE_STUB(ArgumentsAccess, PlatformCodeStub);
1515 }; 1437 };
1516 1438
1517 1439
1518 class RegExpExecStub: public PlatformCodeStub { 1440 class RegExpExecStub: public PlatformCodeStub {
1519 public: 1441 public:
1520 explicit RegExpExecStub(Isolate* isolate) : PlatformCodeStub(isolate) { } 1442 explicit RegExpExecStub(Isolate* isolate) : PlatformCodeStub(isolate) { }
1521 1443
1522 private: 1444 DEFINE_PLATFORM_CODE_STUB(RegExpExec, PlatformCodeStub);
1523 void Generate(MacroAssembler* masm);
1524
1525 DEFINE_CODE_STUB(RegExpExec, PlatformCodeStub);
1526 }; 1445 };
1527 1446
1528 1447
1529 class RegExpConstructResultStub FINAL : public HydrogenCodeStub { 1448 class RegExpConstructResultStub FINAL : public HydrogenCodeStub {
1530 public: 1449 public:
1531 explicit RegExpConstructResultStub(Isolate* isolate) 1450 explicit RegExpConstructResultStub(Isolate* isolate)
1532 : HydrogenCodeStub(isolate) { } 1451 : HydrogenCodeStub(isolate) { }
1533 1452
1534 virtual Handle<Code> GenerateCode() OVERRIDE;
1535
1536 virtual void InitializeInterfaceDescriptor(
1537 CodeStubInterfaceDescriptor* descriptor) OVERRIDE;
1538
1539 static void InstallDescriptors(Isolate* isolate); 1453 static void InstallDescriptors(Isolate* isolate);
1540 1454
1541 // Parameters accessed via CodeStubGraphBuilder::GetParameter() 1455 // Parameters accessed via CodeStubGraphBuilder::GetParameter()
1542 static const int kLength = 0; 1456 static const int kLength = 0;
1543 static const int kIndex = 1; 1457 static const int kIndex = 1;
1544 static const int kInput = 2; 1458 static const int kInput = 2;
1545 1459
1546 DEFINE_CODE_STUB(RegExpConstructResult, HydrogenCodeStub); 1460 DEFINE_HYDROGEN_CODE_STUB(RegExpConstructResult, HydrogenCodeStub);
1547 }; 1461 };
1548 1462
1549 1463
1550 class CallFunctionStub: public PlatformCodeStub { 1464 class CallFunctionStub: public PlatformCodeStub {
1551 public: 1465 public:
1552 CallFunctionStub(Isolate* isolate, int argc, CallFunctionFlags flags) 1466 CallFunctionStub(Isolate* isolate, int argc, CallFunctionFlags flags)
1553 : PlatformCodeStub(isolate) { 1467 : PlatformCodeStub(isolate) {
1554 DCHECK(argc >= 0 && argc <= Code::kMaxArguments); 1468 DCHECK(argc >= 0 && argc <= Code::kMaxArguments);
1555 minor_key_ = ArgcBits::encode(argc) | FlagBits::encode(flags); 1469 minor_key_ = ArgcBits::encode(argc) | FlagBits::encode(flags);
1556 } 1470 }
1557 1471
1558 void Generate(MacroAssembler* masm); 1472 virtual void InitializeInterfaceDescriptor(
1473 CodeStubInterfaceDescriptor* descriptor);
1559 1474
1560 static int ExtractArgcFromMinorKey(int minor_key) { 1475 static int ExtractArgcFromMinorKey(int minor_key) {
1561 return ArgcBits::decode(minor_key); 1476 return ArgcBits::decode(minor_key);
1562 } 1477 }
1563 1478
1564 virtual void InitializeInterfaceDescriptor(
1565 CodeStubInterfaceDescriptor* descriptor);
1566
1567 private: 1479 private:
1568 int argc() const { return ArgcBits::decode(minor_key_); } 1480 int argc() const { return ArgcBits::decode(minor_key_); }
1569 int flags() const { return FlagBits::decode(minor_key_); } 1481 int flags() const { return FlagBits::decode(minor_key_); }
1570 1482
1571 bool CallAsMethod() const { 1483 bool CallAsMethod() const {
1572 return flags() == CALL_AS_METHOD || flags() == WRAP_AND_CALL; 1484 return flags() == CALL_AS_METHOD || flags() == WRAP_AND_CALL;
1573 } 1485 }
1574 1486
1575 bool NeedsChecks() const { return flags() != WRAP_AND_CALL; } 1487 bool NeedsChecks() const { return flags() != WRAP_AND_CALL; }
1576 1488
1577 virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT 1489 virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT
1578 1490
1579 // Minor key encoding in 32 bits with Bitfield <Type, shift, size>. 1491 // Minor key encoding in 32 bits with Bitfield <Type, shift, size>.
1580 class FlagBits : public BitField<CallFunctionFlags, 0, 2> {}; 1492 class FlagBits : public BitField<CallFunctionFlags, 0, 2> {};
1581 class ArgcBits : public BitField<unsigned, 2, Code::kArgumentsBits> {}; 1493 class ArgcBits : public BitField<unsigned, 2, Code::kArgumentsBits> {};
1582 STATIC_ASSERT(Code::kArgumentsBits + 2 <= kStubMinorKeyBits); 1494 STATIC_ASSERT(Code::kArgumentsBits + 2 <= kStubMinorKeyBits);
1583 1495
1584 DEFINE_CODE_STUB(CallFunction, PlatformCodeStub); 1496 DEFINE_PLATFORM_CODE_STUB(CallFunction, PlatformCodeStub);
1585 }; 1497 };
1586 1498
1587 1499
1588 class CallConstructStub: public PlatformCodeStub { 1500 class CallConstructStub: public PlatformCodeStub {
1589 public: 1501 public:
1590 CallConstructStub(Isolate* isolate, CallConstructorFlags flags) 1502 CallConstructStub(Isolate* isolate, CallConstructorFlags flags)
1591 : PlatformCodeStub(isolate) { 1503 : PlatformCodeStub(isolate) {
1592 minor_key_ = FlagBits::encode(flags); 1504 minor_key_ = FlagBits::encode(flags);
1593 } 1505 }
1594 1506
1595 void Generate(MacroAssembler* masm); 1507 virtual void InitializeInterfaceDescriptor(
1508 CodeStubInterfaceDescriptor* descriptor);
1596 1509
1597 virtual void FinishCode(Handle<Code> code) { 1510 virtual void FinishCode(Handle<Code> code) {
1598 code->set_has_function_cache(RecordCallTarget()); 1511 code->set_has_function_cache(RecordCallTarget());
1599 } 1512 }
1600 1513
1601 virtual void InitializeInterfaceDescriptor(
1602 CodeStubInterfaceDescriptor* descriptor);
1603
1604 private: 1514 private:
1605 CallConstructorFlags flags() const { return FlagBits::decode(minor_key_); } 1515 CallConstructorFlags flags() const { return FlagBits::decode(minor_key_); }
1606 1516
1607 bool RecordCallTarget() const { 1517 bool RecordCallTarget() const {
1608 return (flags() & RECORD_CONSTRUCTOR_TARGET) != 0; 1518 return (flags() & RECORD_CONSTRUCTOR_TARGET) != 0;
1609 } 1519 }
1610 1520
1611 virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT 1521 virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT
1612 1522
1613 class FlagBits : public BitField<CallConstructorFlags, 0, 1> {}; 1523 class FlagBits : public BitField<CallConstructorFlags, 0, 1> {};
1614 1524
1615 DEFINE_CODE_STUB(CallConstruct, PlatformCodeStub); 1525 DEFINE_PLATFORM_CODE_STUB(CallConstruct, PlatformCodeStub);
1616 }; 1526 };
1617 1527
1618 1528
1619 enum StringIndexFlags { 1529 enum StringIndexFlags {
1620 // Accepts smis or heap numbers. 1530 // Accepts smis or heap numbers.
1621 STRING_INDEX_IS_NUMBER, 1531 STRING_INDEX_IS_NUMBER,
1622 1532
1623 // Accepts smis or heap numbers that are valid array indices 1533 // Accepts smis or heap numbers that are valid array indices
1624 // (ECMA-262 15.4). Invalid indices are reported as being out of 1534 // (ECMA-262 15.4). Invalid indices are reported as being out of
1625 // range. 1535 // range.
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1788 1698
1789 DISALLOW_COPY_AND_ASSIGN(StringCharAtGenerator); 1699 DISALLOW_COPY_AND_ASSIGN(StringCharAtGenerator);
1790 }; 1700 };
1791 1701
1792 1702
1793 class LoadDictionaryElementStub : public HydrogenCodeStub { 1703 class LoadDictionaryElementStub : public HydrogenCodeStub {
1794 public: 1704 public:
1795 explicit LoadDictionaryElementStub(Isolate* isolate) 1705 explicit LoadDictionaryElementStub(Isolate* isolate)
1796 : HydrogenCodeStub(isolate) {} 1706 : HydrogenCodeStub(isolate) {}
1797 1707
1798 virtual Handle<Code> GenerateCode() OVERRIDE; 1708 DEFINE_HYDROGEN_CODE_STUB(LoadDictionaryElement, HydrogenCodeStub);
1799
1800 virtual void InitializeInterfaceDescriptor(
1801 CodeStubInterfaceDescriptor* descriptor) OVERRIDE;
1802
1803 DEFINE_CODE_STUB(LoadDictionaryElement, HydrogenCodeStub);
1804 }; 1709 };
1805 1710
1806 1711
1807 class KeyedLoadGenericStub : public HydrogenCodeStub { 1712 class KeyedLoadGenericStub : public HydrogenCodeStub {
1808 public: 1713 public:
1809 explicit KeyedLoadGenericStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} 1714 explicit KeyedLoadGenericStub(Isolate* isolate) : HydrogenCodeStub(isolate) {}
1810 1715
1811 virtual Handle<Code> GenerateCode() OVERRIDE;
1812
1813 virtual void InitializeInterfaceDescriptor(
1814 CodeStubInterfaceDescriptor* descriptor) OVERRIDE;
1815
1816 static void InstallDescriptors(Isolate* isolate); 1716 static void InstallDescriptors(Isolate* isolate);
1817 1717
1818 virtual Code::Kind GetCodeKind() const { return Code::KEYED_LOAD_IC; } 1718 virtual Code::Kind GetCodeKind() const { return Code::KEYED_LOAD_IC; }
1819 virtual InlineCacheState GetICState() const { return GENERIC; } 1719 virtual InlineCacheState GetICState() const { return GENERIC; }
1820 1720
1821 DEFINE_CODE_STUB(KeyedLoadGeneric, HydrogenCodeStub); 1721 DEFINE_HYDROGEN_CODE_STUB(KeyedLoadGeneric, HydrogenCodeStub);
1822 }; 1722 };
1823 1723
1824 1724
1825 class LoadICTrampolineStub : public PlatformCodeStub { 1725 class LoadICTrampolineStub : public PlatformCodeStub {
1826 public: 1726 public:
1827 LoadICTrampolineStub(Isolate* isolate, const LoadIC::State& state) 1727 LoadICTrampolineStub(Isolate* isolate, const LoadIC::State& state)
1828 : PlatformCodeStub(isolate) { 1728 : PlatformCodeStub(isolate) {
1829 minor_key_ = state.GetExtraICState(); 1729 minor_key_ = state.GetExtraICState();
1830 } 1730 }
1831 1731
1832 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::LOAD_IC; } 1732 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::LOAD_IC; }
1833 1733
1834 virtual InlineCacheState GetICState() const FINAL OVERRIDE { 1734 virtual InlineCacheState GetICState() const FINAL OVERRIDE {
1835 return GENERIC; 1735 return GENERIC;
1836 } 1736 }
1837 1737
1838 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE { 1738 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE {
1839 return static_cast<ExtraICState>(minor_key_); 1739 return static_cast<ExtraICState>(minor_key_);
1840 } 1740 }
1841 1741
1842 private: 1742 private:
1843 LoadIC::State state() const { 1743 LoadIC::State state() const {
1844 return LoadIC::State(static_cast<ExtraICState>(minor_key_)); 1744 return LoadIC::State(static_cast<ExtraICState>(minor_key_));
1845 } 1745 }
1846 1746
1847 virtual void Generate(MacroAssembler* masm); 1747 DEFINE_PLATFORM_CODE_STUB(LoadICTrampoline, PlatformCodeStub);
1848
1849 DEFINE_CODE_STUB(LoadICTrampoline, PlatformCodeStub);
1850 }; 1748 };
1851 1749
1852 1750
1853 class KeyedLoadICTrampolineStub : public LoadICTrampolineStub { 1751 class KeyedLoadICTrampolineStub : public LoadICTrampolineStub {
1854 public: 1752 public:
1855 explicit KeyedLoadICTrampolineStub(Isolate* isolate) 1753 explicit KeyedLoadICTrampolineStub(Isolate* isolate)
1856 : LoadICTrampolineStub(isolate, LoadIC::State(0)) {} 1754 : LoadICTrampolineStub(isolate, LoadIC::State(0)) {}
1857 1755
1858 virtual Code::Kind GetCodeKind() const OVERRIDE { 1756 virtual Code::Kind GetCodeKind() const OVERRIDE {
1859 return Code::KEYED_LOAD_IC; 1757 return Code::KEYED_LOAD_IC;
1860 } 1758 }
1861 1759
1862 private: 1760 DEFINE_PLATFORM_CODE_STUB(KeyedLoadICTrampoline, LoadICTrampolineStub);
1863 virtual void Generate(MacroAssembler* masm);
1864
1865 DEFINE_CODE_STUB(KeyedLoadICTrampoline, LoadICTrampolineStub);
1866 }; 1761 };
1867 1762
1868 1763
1869 class VectorLoadStub : public HydrogenCodeStub { 1764 class VectorLoadStub : public HydrogenCodeStub {
1870 public: 1765 public:
1871 explicit VectorLoadStub(Isolate* isolate, const LoadIC::State& state) 1766 explicit VectorLoadStub(Isolate* isolate, const LoadIC::State& state)
1872 : HydrogenCodeStub(isolate) { 1767 : HydrogenCodeStub(isolate) {
1873 set_sub_minor_key(state.GetExtraICState()); 1768 set_sub_minor_key(state.GetExtraICState());
1874 } 1769 }
1875 1770
1876 virtual Handle<Code> GenerateCode() OVERRIDE;
1877
1878 virtual void InitializeInterfaceDescriptor(
1879 CodeStubInterfaceDescriptor* descriptor) OVERRIDE;
1880
1881 static void InstallDescriptors(Isolate* isolate); 1771 static void InstallDescriptors(Isolate* isolate);
1882 1772
1883 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::LOAD_IC; } 1773 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::LOAD_IC; }
1884 1774
1885 virtual InlineCacheState GetICState() const FINAL OVERRIDE { 1775 virtual InlineCacheState GetICState() const FINAL OVERRIDE {
1886 return GENERIC; 1776 return GENERIC;
1887 } 1777 }
1888 1778
1889 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE { 1779 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE {
1890 return static_cast<ExtraICState>(sub_minor_key()); 1780 return static_cast<ExtraICState>(sub_minor_key());
1891 } 1781 }
1892 1782
1893 private: 1783 private:
1894 LoadIC::State state() const { return LoadIC::State(GetExtraICState()); } 1784 LoadIC::State state() const { return LoadIC::State(GetExtraICState()); }
1895 1785
1896 DEFINE_CODE_STUB(VectorLoad, HydrogenCodeStub); 1786 DEFINE_HYDROGEN_CODE_STUB(VectorLoad, HydrogenCodeStub);
1897 }; 1787 };
1898 1788
1899 1789
1900 class VectorKeyedLoadStub : public VectorLoadStub { 1790 class VectorKeyedLoadStub : public VectorLoadStub {
1901 public: 1791 public:
1902 explicit VectorKeyedLoadStub(Isolate* isolate) 1792 explicit VectorKeyedLoadStub(Isolate* isolate)
1903 : VectorLoadStub(isolate, LoadIC::State(0)) {} 1793 : VectorLoadStub(isolate, LoadIC::State(0)) {}
1904 1794
1905 virtual Handle<Code> GenerateCode() OVERRIDE;
1906
1907 virtual void InitializeInterfaceDescriptor(
1908 CodeStubInterfaceDescriptor* descriptor) OVERRIDE;
1909
1910 static void InstallDescriptors(Isolate* isolate); 1795 static void InstallDescriptors(Isolate* isolate);
1911 1796
1912 virtual Code::Kind GetCodeKind() const OVERRIDE { 1797 virtual Code::Kind GetCodeKind() const OVERRIDE {
1913 return Code::KEYED_LOAD_IC; 1798 return Code::KEYED_LOAD_IC;
1914 } 1799 }
1915 1800
1916 DEFINE_CODE_STUB(VectorKeyedLoad, VectorLoadStub); 1801 DEFINE_HYDROGEN_CODE_STUB(VectorKeyedLoad, VectorLoadStub);
1917 }; 1802 };
1918 1803
1919 1804
1920 class DoubleToIStub : public PlatformCodeStub { 1805 class DoubleToIStub : public PlatformCodeStub {
1921 public: 1806 public:
1922 DoubleToIStub(Isolate* isolate, Register source, Register destination, 1807 DoubleToIStub(Isolate* isolate, Register source, Register destination,
1923 int offset, bool is_truncating, bool skip_fastpath = false) 1808 int offset, bool is_truncating, bool skip_fastpath = false)
1924 : PlatformCodeStub(isolate) { 1809 : PlatformCodeStub(isolate) {
1925 minor_key_ = SourceRegisterBits::encode(source.code()) | 1810 minor_key_ = SourceRegisterBits::encode(source.code()) |
1926 DestinationRegisterBits::encode(destination.code()) | 1811 DestinationRegisterBits::encode(destination.code()) |
1927 OffsetBits::encode(offset) | 1812 OffsetBits::encode(offset) |
1928 IsTruncatingBits::encode(is_truncating) | 1813 IsTruncatingBits::encode(is_truncating) |
1929 SkipFastPathBits::encode(skip_fastpath) | 1814 SkipFastPathBits::encode(skip_fastpath) |
1930 SSE3Bits::encode(CpuFeatures::IsSupported(SSE3) ? 1 : 0); 1815 SSE3Bits::encode(CpuFeatures::IsSupported(SSE3) ? 1 : 0);
1931 } 1816 }
1932 1817
1933 void Generate(MacroAssembler* masm);
1934
1935 virtual bool SometimesSetsUpAFrame() { return false; } 1818 virtual bool SometimesSetsUpAFrame() { return false; }
1936 1819
1937 private: 1820 private:
1938 Register source() const { 1821 Register source() const {
1939 return Register::from_code(SourceRegisterBits::decode(minor_key_)); 1822 return Register::from_code(SourceRegisterBits::decode(minor_key_));
1940 } 1823 }
1941 Register destination() const { 1824 Register destination() const {
1942 return Register::from_code(DestinationRegisterBits::decode(minor_key_)); 1825 return Register::from_code(DestinationRegisterBits::decode(minor_key_));
1943 } 1826 }
1944 bool is_truncating() const { return IsTruncatingBits::decode(minor_key_); } 1827 bool is_truncating() const { return IsTruncatingBits::decode(minor_key_); }
1945 bool skip_fastpath() const { return SkipFastPathBits::decode(minor_key_); } 1828 bool skip_fastpath() const { return SkipFastPathBits::decode(minor_key_); }
1946 int offset() const { return OffsetBits::decode(minor_key_); } 1829 int offset() const { return OffsetBits::decode(minor_key_); }
1947 1830
1948 static const int kBitsPerRegisterNumber = 6; 1831 static const int kBitsPerRegisterNumber = 6;
1949 STATIC_ASSERT((1L << kBitsPerRegisterNumber) >= Register::kNumRegisters); 1832 STATIC_ASSERT((1L << kBitsPerRegisterNumber) >= Register::kNumRegisters);
1950 class SourceRegisterBits: 1833 class SourceRegisterBits:
1951 public BitField<int, 0, kBitsPerRegisterNumber> {}; // NOLINT 1834 public BitField<int, 0, kBitsPerRegisterNumber> {}; // NOLINT
1952 class DestinationRegisterBits: 1835 class DestinationRegisterBits:
1953 public BitField<int, kBitsPerRegisterNumber, 1836 public BitField<int, kBitsPerRegisterNumber,
1954 kBitsPerRegisterNumber> {}; // NOLINT 1837 kBitsPerRegisterNumber> {}; // NOLINT
1955 class IsTruncatingBits: 1838 class IsTruncatingBits:
1956 public BitField<bool, 2 * kBitsPerRegisterNumber, 1> {}; // NOLINT 1839 public BitField<bool, 2 * kBitsPerRegisterNumber, 1> {}; // NOLINT
1957 class OffsetBits: 1840 class OffsetBits:
1958 public BitField<int, 2 * kBitsPerRegisterNumber + 1, 3> {}; // NOLINT 1841 public BitField<int, 2 * kBitsPerRegisterNumber + 1, 3> {}; // NOLINT
1959 class SkipFastPathBits: 1842 class SkipFastPathBits:
1960 public BitField<int, 2 * kBitsPerRegisterNumber + 4, 1> {}; // NOLINT 1843 public BitField<int, 2 * kBitsPerRegisterNumber + 4, 1> {}; // NOLINT
1961 class SSE3Bits: 1844 class SSE3Bits:
1962 public BitField<int, 2 * kBitsPerRegisterNumber + 5, 1> {}; // NOLINT 1845 public BitField<int, 2 * kBitsPerRegisterNumber + 5, 1> {}; // NOLINT
1963 1846
1964 DEFINE_CODE_STUB(DoubleToI, PlatformCodeStub); 1847 DEFINE_PLATFORM_CODE_STUB(DoubleToI, PlatformCodeStub);
1965 }; 1848 };
1966 1849
1967 1850
1968 class LoadFastElementStub : public HydrogenCodeStub { 1851 class LoadFastElementStub : public HydrogenCodeStub {
1969 public: 1852 public:
1970 LoadFastElementStub(Isolate* isolate, bool is_js_array, 1853 LoadFastElementStub(Isolate* isolate, bool is_js_array,
1971 ElementsKind elements_kind) 1854 ElementsKind elements_kind)
1972 : HydrogenCodeStub(isolate) { 1855 : HydrogenCodeStub(isolate) {
1973 set_sub_minor_key(ElementsKindBits::encode(elements_kind) | 1856 set_sub_minor_key(ElementsKindBits::encode(elements_kind) |
1974 IsJSArrayBits::encode(is_js_array)); 1857 IsJSArrayBits::encode(is_js_array));
1975 } 1858 }
1976 1859
1977 bool is_js_array() const { return IsJSArrayBits::decode(sub_minor_key()); } 1860 bool is_js_array() const { return IsJSArrayBits::decode(sub_minor_key()); }
1978 1861
1979 ElementsKind elements_kind() const { 1862 ElementsKind elements_kind() const {
1980 return ElementsKindBits::decode(sub_minor_key()); 1863 return ElementsKindBits::decode(sub_minor_key());
1981 } 1864 }
1982 1865
1983 virtual Handle<Code> GenerateCode() OVERRIDE;
1984
1985 static void InstallDescriptors(Isolate* isolate); 1866 static void InstallDescriptors(Isolate* isolate);
1986 1867
1987 virtual void InitializeInterfaceDescriptor(
1988 CodeStubInterfaceDescriptor* descriptor) OVERRIDE;
1989
1990 private: 1868 private:
1991 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; 1869 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {};
1992 class IsJSArrayBits: public BitField<bool, 8, 1> {}; 1870 class IsJSArrayBits: public BitField<bool, 8, 1> {};
1993 1871
1994 DEFINE_CODE_STUB(LoadFastElement, HydrogenCodeStub); 1872 DEFINE_HYDROGEN_CODE_STUB(LoadFastElement, HydrogenCodeStub);
1995 }; 1873 };
1996 1874
1997 1875
1998 class StoreFastElementStub : public HydrogenCodeStub { 1876 class StoreFastElementStub : public HydrogenCodeStub {
1999 public: 1877 public:
2000 StoreFastElementStub(Isolate* isolate, bool is_js_array, 1878 StoreFastElementStub(Isolate* isolate, bool is_js_array,
2001 ElementsKind elements_kind, KeyedAccessStoreMode mode) 1879 ElementsKind elements_kind, KeyedAccessStoreMode mode)
2002 : HydrogenCodeStub(isolate) { 1880 : HydrogenCodeStub(isolate) {
2003 set_sub_minor_key(ElementsKindBits::encode(elements_kind) | 1881 set_sub_minor_key(ElementsKindBits::encode(elements_kind) |
2004 IsJSArrayBits::encode(is_js_array) | 1882 IsJSArrayBits::encode(is_js_array) |
2005 StoreModeBits::encode(mode)); 1883 StoreModeBits::encode(mode));
2006 } 1884 }
2007 1885
2008 bool is_js_array() const { return IsJSArrayBits::decode(sub_minor_key()); } 1886 bool is_js_array() const { return IsJSArrayBits::decode(sub_minor_key()); }
2009 1887
2010 ElementsKind elements_kind() const { 1888 ElementsKind elements_kind() const {
2011 return ElementsKindBits::decode(sub_minor_key()); 1889 return ElementsKindBits::decode(sub_minor_key());
2012 } 1890 }
2013 1891
2014 KeyedAccessStoreMode store_mode() const { 1892 KeyedAccessStoreMode store_mode() const {
2015 return StoreModeBits::decode(sub_minor_key()); 1893 return StoreModeBits::decode(sub_minor_key());
2016 } 1894 }
2017 1895
2018 virtual Handle<Code> GenerateCode() OVERRIDE;
2019
2020 virtual void InitializeInterfaceDescriptor(
2021 CodeStubInterfaceDescriptor* descriptor) OVERRIDE;
2022
2023 private: 1896 private:
2024 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; 1897 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {};
2025 class StoreModeBits: public BitField<KeyedAccessStoreMode, 8, 4> {}; 1898 class StoreModeBits: public BitField<KeyedAccessStoreMode, 8, 4> {};
2026 class IsJSArrayBits: public BitField<bool, 12, 1> {}; 1899 class IsJSArrayBits: public BitField<bool, 12, 1> {};
2027 1900
2028 DEFINE_CODE_STUB(StoreFastElement, HydrogenCodeStub); 1901 DEFINE_HYDROGEN_CODE_STUB(StoreFastElement, HydrogenCodeStub);
2029 }; 1902 };
2030 1903
2031 1904
2032 class TransitionElementsKindStub : public HydrogenCodeStub { 1905 class TransitionElementsKindStub : public HydrogenCodeStub {
2033 public: 1906 public:
2034 TransitionElementsKindStub(Isolate* isolate, 1907 TransitionElementsKindStub(Isolate* isolate,
2035 ElementsKind from_kind, 1908 ElementsKind from_kind,
2036 ElementsKind to_kind, 1909 ElementsKind to_kind,
2037 bool is_js_array) : HydrogenCodeStub(isolate) { 1910 bool is_js_array) : HydrogenCodeStub(isolate) {
2038 set_sub_minor_key(FromKindBits::encode(from_kind) | 1911 set_sub_minor_key(FromKindBits::encode(from_kind) |
2039 ToKindBits::encode(to_kind) | 1912 ToKindBits::encode(to_kind) |
2040 IsJSArrayBits::encode(is_js_array)); 1913 IsJSArrayBits::encode(is_js_array));
2041 } 1914 }
2042 1915
2043 ElementsKind from_kind() const { 1916 ElementsKind from_kind() const {
2044 return FromKindBits::decode(sub_minor_key()); 1917 return FromKindBits::decode(sub_minor_key());
2045 } 1918 }
2046 1919
2047 ElementsKind to_kind() const { return ToKindBits::decode(sub_minor_key()); } 1920 ElementsKind to_kind() const { return ToKindBits::decode(sub_minor_key()); }
2048 1921
2049 bool is_js_array() const { return IsJSArrayBits::decode(sub_minor_key()); } 1922 bool is_js_array() const { return IsJSArrayBits::decode(sub_minor_key()); }
2050 1923
2051 virtual Handle<Code> GenerateCode() OVERRIDE;
2052
2053 virtual void InitializeInterfaceDescriptor(
2054 CodeStubInterfaceDescriptor* descriptor) OVERRIDE;
2055
2056 private: 1924 private:
2057 class FromKindBits: public BitField<ElementsKind, 8, 8> {}; 1925 class FromKindBits: public BitField<ElementsKind, 8, 8> {};
2058 class ToKindBits: public BitField<ElementsKind, 0, 8> {}; 1926 class ToKindBits: public BitField<ElementsKind, 0, 8> {};
2059 class IsJSArrayBits: public BitField<bool, 16, 1> {}; 1927 class IsJSArrayBits: public BitField<bool, 16, 1> {};
2060 1928
2061 DEFINE_CODE_STUB(TransitionElementsKind, HydrogenCodeStub); 1929 DEFINE_HYDROGEN_CODE_STUB(TransitionElementsKind, HydrogenCodeStub);
2062 }; 1930 };
2063 1931
2064 1932
2065 class ArrayConstructorStubBase : public HydrogenCodeStub { 1933 class ArrayConstructorStubBase : public HydrogenCodeStub {
2066 public: 1934 public:
2067 ArrayConstructorStubBase(Isolate* isolate, 1935 ArrayConstructorStubBase(Isolate* isolate,
2068 ElementsKind kind, 1936 ElementsKind kind,
2069 AllocationSiteOverrideMode override_mode) 1937 AllocationSiteOverrideMode override_mode)
2070 : HydrogenCodeStub(isolate) { 1938 : HydrogenCodeStub(isolate) {
2071 // It only makes sense to override local allocation site behavior 1939 // It only makes sense to override local allocation site behavior
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
2109 1977
2110 class ArrayNoArgumentConstructorStub : public ArrayConstructorStubBase { 1978 class ArrayNoArgumentConstructorStub : public ArrayConstructorStubBase {
2111 public: 1979 public:
2112 ArrayNoArgumentConstructorStub( 1980 ArrayNoArgumentConstructorStub(
2113 Isolate* isolate, 1981 Isolate* isolate,
2114 ElementsKind kind, 1982 ElementsKind kind,
2115 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) 1983 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE)
2116 : ArrayConstructorStubBase(isolate, kind, override_mode) { 1984 : ArrayConstructorStubBase(isolate, kind, override_mode) {
2117 } 1985 }
2118 1986
2119 virtual Handle<Code> GenerateCode() OVERRIDE;
2120
2121 virtual void InitializeInterfaceDescriptor(
2122 CodeStubInterfaceDescriptor* descriptor) OVERRIDE;
2123
2124 private: 1987 private:
2125 virtual void PrintName(OStream& os) const OVERRIDE { // NOLINT 1988 virtual void PrintName(OStream& os) const OVERRIDE { // NOLINT
2126 BasePrintName(os, "ArrayNoArgumentConstructorStub"); 1989 BasePrintName(os, "ArrayNoArgumentConstructorStub");
2127 } 1990 }
2128 1991
2129 DEFINE_CODE_STUB(ArrayNoArgumentConstructor, ArrayConstructorStubBase); 1992 DEFINE_HYDROGEN_CODE_STUB(ArrayNoArgumentConstructor,
1993 ArrayConstructorStubBase);
2130 }; 1994 };
2131 1995
2132 1996
2133 class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase { 1997 class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase {
2134 public: 1998 public:
2135 ArraySingleArgumentConstructorStub( 1999 ArraySingleArgumentConstructorStub(
2136 Isolate* isolate, 2000 Isolate* isolate,
2137 ElementsKind kind, 2001 ElementsKind kind,
2138 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) 2002 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE)
2139 : ArrayConstructorStubBase(isolate, kind, override_mode) { 2003 : ArrayConstructorStubBase(isolate, kind, override_mode) {
2140 } 2004 }
2141 2005
2142 virtual Handle<Code> GenerateCode() OVERRIDE;
2143
2144 virtual void InitializeInterfaceDescriptor(
2145 CodeStubInterfaceDescriptor* descriptor) OVERRIDE;
2146
2147 private: 2006 private:
2148 virtual void PrintName(OStream& os) const { // NOLINT 2007 virtual void PrintName(OStream& os) const { // NOLINT
2149 BasePrintName(os, "ArraySingleArgumentConstructorStub"); 2008 BasePrintName(os, "ArraySingleArgumentConstructorStub");
2150 } 2009 }
2151 2010
2152 DEFINE_CODE_STUB(ArraySingleArgumentConstructor, ArrayConstructorStubBase); 2011 DEFINE_HYDROGEN_CODE_STUB(ArraySingleArgumentConstructor,
2012 ArrayConstructorStubBase);
2153 }; 2013 };
2154 2014
2155 2015
2156 class ArrayNArgumentsConstructorStub : public ArrayConstructorStubBase { 2016 class ArrayNArgumentsConstructorStub : public ArrayConstructorStubBase {
2157 public: 2017 public:
2158 ArrayNArgumentsConstructorStub( 2018 ArrayNArgumentsConstructorStub(
2159 Isolate* isolate, 2019 Isolate* isolate,
2160 ElementsKind kind, 2020 ElementsKind kind,
2161 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) 2021 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE)
2162 : ArrayConstructorStubBase(isolate, kind, override_mode) { 2022 : ArrayConstructorStubBase(isolate, kind, override_mode) {
2163 } 2023 }
2164 2024
2165 virtual Handle<Code> GenerateCode() OVERRIDE;
2166
2167 virtual void InitializeInterfaceDescriptor(
2168 CodeStubInterfaceDescriptor* descriptor) OVERRIDE;
2169
2170 private: 2025 private:
2171 virtual void PrintName(OStream& os) const { // NOLINT 2026 virtual void PrintName(OStream& os) const { // NOLINT
2172 BasePrintName(os, "ArrayNArgumentsConstructorStub"); 2027 BasePrintName(os, "ArrayNArgumentsConstructorStub");
2173 } 2028 }
2174 2029
2175 DEFINE_CODE_STUB(ArrayNArgumentsConstructor, ArrayConstructorStubBase); 2030 DEFINE_HYDROGEN_CODE_STUB(ArrayNArgumentsConstructor,
2031 ArrayConstructorStubBase);
2176 }; 2032 };
2177 2033
2178 2034
2179 class InternalArrayConstructorStubBase : public HydrogenCodeStub { 2035 class InternalArrayConstructorStubBase : public HydrogenCodeStub {
2180 public: 2036 public:
2181 InternalArrayConstructorStubBase(Isolate* isolate, ElementsKind kind) 2037 InternalArrayConstructorStubBase(Isolate* isolate, ElementsKind kind)
2182 : HydrogenCodeStub(isolate) { 2038 : HydrogenCodeStub(isolate) {
2183 set_sub_minor_key(ElementsKindBits::encode(kind)); 2039 set_sub_minor_key(ElementsKindBits::encode(kind));
2184 } 2040 }
2185 2041
(...skipping 14 matching lines...) Expand all
2200 }; 2056 };
2201 2057
2202 2058
2203 class InternalArrayNoArgumentConstructorStub : public 2059 class InternalArrayNoArgumentConstructorStub : public
2204 InternalArrayConstructorStubBase { 2060 InternalArrayConstructorStubBase {
2205 public: 2061 public:
2206 InternalArrayNoArgumentConstructorStub(Isolate* isolate, 2062 InternalArrayNoArgumentConstructorStub(Isolate* isolate,
2207 ElementsKind kind) 2063 ElementsKind kind)
2208 : InternalArrayConstructorStubBase(isolate, kind) { } 2064 : InternalArrayConstructorStubBase(isolate, kind) { }
2209 2065
2210 virtual Handle<Code> GenerateCode() OVERRIDE; 2066 DEFINE_HYDROGEN_CODE_STUB(InternalArrayNoArgumentConstructor,
2211 2067 InternalArrayConstructorStubBase);
2212 virtual void InitializeInterfaceDescriptor(
2213 CodeStubInterfaceDescriptor* descriptor) OVERRIDE;
2214
2215 DEFINE_CODE_STUB(InternalArrayNoArgumentConstructor,
2216 InternalArrayConstructorStubBase);
2217 }; 2068 };
2218 2069
2219 2070
2220 class InternalArraySingleArgumentConstructorStub : public 2071 class InternalArraySingleArgumentConstructorStub : public
2221 InternalArrayConstructorStubBase { 2072 InternalArrayConstructorStubBase {
2222 public: 2073 public:
2223 InternalArraySingleArgumentConstructorStub(Isolate* isolate, 2074 InternalArraySingleArgumentConstructorStub(Isolate* isolate,
2224 ElementsKind kind) 2075 ElementsKind kind)
2225 : InternalArrayConstructorStubBase(isolate, kind) { } 2076 : InternalArrayConstructorStubBase(isolate, kind) { }
2226 2077
2227 virtual Handle<Code> GenerateCode() OVERRIDE; 2078 DEFINE_HYDROGEN_CODE_STUB(InternalArraySingleArgumentConstructor,
2228 2079 InternalArrayConstructorStubBase);
2229 virtual void InitializeInterfaceDescriptor(
2230 CodeStubInterfaceDescriptor* descriptor) OVERRIDE;
2231
2232 DEFINE_CODE_STUB(InternalArraySingleArgumentConstructor,
2233 InternalArrayConstructorStubBase);
2234 }; 2080 };
2235 2081
2236 2082
2237 class InternalArrayNArgumentsConstructorStub : public 2083 class InternalArrayNArgumentsConstructorStub : public
2238 InternalArrayConstructorStubBase { 2084 InternalArrayConstructorStubBase {
2239 public: 2085 public:
2240 InternalArrayNArgumentsConstructorStub(Isolate* isolate, ElementsKind kind) 2086 InternalArrayNArgumentsConstructorStub(Isolate* isolate, ElementsKind kind)
2241 : InternalArrayConstructorStubBase(isolate, kind) { } 2087 : InternalArrayConstructorStubBase(isolate, kind) { }
2242 2088
2243 virtual Handle<Code> GenerateCode() OVERRIDE; 2089 DEFINE_HYDROGEN_CODE_STUB(InternalArrayNArgumentsConstructor,
2244 2090 InternalArrayConstructorStubBase);
2245 virtual void InitializeInterfaceDescriptor(
2246 CodeStubInterfaceDescriptor* descriptor) OVERRIDE;
2247
2248 DEFINE_CODE_STUB(InternalArrayNArgumentsConstructor,
2249 InternalArrayConstructorStubBase);
2250 }; 2091 };
2251 2092
2252 2093
2253 class StoreElementStub : public PlatformCodeStub { 2094 class StoreElementStub : public PlatformCodeStub {
2254 public: 2095 public:
2255 StoreElementStub(Isolate* isolate, ElementsKind elements_kind) 2096 StoreElementStub(Isolate* isolate, ElementsKind elements_kind)
2256 : PlatformCodeStub(isolate) { 2097 : PlatformCodeStub(isolate) {
2257 minor_key_ = ElementsKindBits::encode(elements_kind); 2098 minor_key_ = ElementsKindBits::encode(elements_kind);
2258 } 2099 }
2259 2100
2260 void Generate(MacroAssembler* masm);
2261
2262 private: 2101 private:
2263 ElementsKind elements_kind() const { 2102 ElementsKind elements_kind() const {
2264 return ElementsKindBits::decode(minor_key_); 2103 return ElementsKindBits::decode(minor_key_);
2265 } 2104 }
2266 2105
2267 class ElementsKindBits : public BitField<ElementsKind, 0, 8> {}; 2106 class ElementsKindBits : public BitField<ElementsKind, 0, 8> {};
2268 2107
2269 DEFINE_CODE_STUB(StoreElement, PlatformCodeStub); 2108 DEFINE_PLATFORM_CODE_STUB(StoreElement, PlatformCodeStub);
2270 }; 2109 };
2271 2110
2272 2111
2273 class ToBooleanStub: public HydrogenCodeStub { 2112 class ToBooleanStub: public HydrogenCodeStub {
2274 public: 2113 public:
2275 enum Type { 2114 enum Type {
2276 UNDEFINED, 2115 UNDEFINED,
2277 BOOLEAN, 2116 BOOLEAN,
2278 NULL_TYPE, 2117 NULL_TYPE,
2279 SMI, 2118 SMI,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
2317 ToBooleanStub(Isolate* isolate, ExtraICState state) 2156 ToBooleanStub(Isolate* isolate, ExtraICState state)
2318 : HydrogenCodeStub(isolate) { 2157 : HydrogenCodeStub(isolate) {
2319 set_sub_minor_key(TypesBits::encode(static_cast<byte>(state)) | 2158 set_sub_minor_key(TypesBits::encode(static_cast<byte>(state)) |
2320 ResultModeBits::encode(RESULT_AS_SMI)); 2159 ResultModeBits::encode(RESULT_AS_SMI));
2321 } 2160 }
2322 2161
2323 bool UpdateStatus(Handle<Object> object); 2162 bool UpdateStatus(Handle<Object> object);
2324 Types types() const { return Types(TypesBits::decode(sub_minor_key())); } 2163 Types types() const { return Types(TypesBits::decode(sub_minor_key())); }
2325 ResultMode mode() const { return ResultModeBits::decode(sub_minor_key()); } 2164 ResultMode mode() const { return ResultModeBits::decode(sub_minor_key()); }
2326 2165
2327 virtual Handle<Code> GenerateCode() OVERRIDE;
2328 virtual void InitializeInterfaceDescriptor(
2329 CodeStubInterfaceDescriptor* descriptor) OVERRIDE;
2330
2331 virtual Code::Kind GetCodeKind() const { return Code::TO_BOOLEAN_IC; } 2166 virtual Code::Kind GetCodeKind() const { return Code::TO_BOOLEAN_IC; }
2332 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT 2167 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT
2333 2168
2334 virtual bool SometimesSetsUpAFrame() { return false; } 2169 virtual bool SometimesSetsUpAFrame() { return false; }
2335 2170
2336 static void InstallDescriptors(Isolate* isolate) { 2171 static void InstallDescriptors(Isolate* isolate) {
2337 ToBooleanStub stub(isolate, RESULT_AS_SMI); 2172 ToBooleanStub stub(isolate, RESULT_AS_SMI);
2338 stub.InitializeInterfaceDescriptor( 2173 stub.InitializeInterfaceDescriptor(
2339 isolate->code_stub_interface_descriptor(CodeStub::ToBoolean)); 2174 isolate->code_stub_interface_descriptor(CodeStub::ToBoolean));
2340 } 2175 }
(...skipping 14 matching lines...) Expand all
2355 2190
2356 private: 2191 private:
2357 ToBooleanStub(Isolate* isolate, InitializationState init_state) 2192 ToBooleanStub(Isolate* isolate, InitializationState init_state)
2358 : HydrogenCodeStub(isolate, init_state) { 2193 : HydrogenCodeStub(isolate, init_state) {
2359 set_sub_minor_key(ResultModeBits::encode(RESULT_AS_SMI)); 2194 set_sub_minor_key(ResultModeBits::encode(RESULT_AS_SMI));
2360 } 2195 }
2361 2196
2362 class TypesBits : public BitField<byte, 0, NUMBER_OF_TYPES> {}; 2197 class TypesBits : public BitField<byte, 0, NUMBER_OF_TYPES> {};
2363 class ResultModeBits : public BitField<ResultMode, NUMBER_OF_TYPES, 2> {}; 2198 class ResultModeBits : public BitField<ResultMode, NUMBER_OF_TYPES, 2> {};
2364 2199
2365 DEFINE_CODE_STUB(ToBoolean, HydrogenCodeStub); 2200 DEFINE_HYDROGEN_CODE_STUB(ToBoolean, HydrogenCodeStub);
2366 }; 2201 };
2367 2202
2368 2203
2369 OStream& operator<<(OStream& os, const ToBooleanStub::Types& t); 2204 OStream& operator<<(OStream& os, const ToBooleanStub::Types& t);
2370 2205
2371 2206
2372 class ElementsTransitionAndStoreStub : public HydrogenCodeStub { 2207 class ElementsTransitionAndStoreStub : public HydrogenCodeStub {
2373 public: 2208 public:
2374 ElementsTransitionAndStoreStub(Isolate* isolate, ElementsKind from_kind, 2209 ElementsTransitionAndStoreStub(Isolate* isolate, ElementsKind from_kind,
2375 ElementsKind to_kind, bool is_jsarray, 2210 ElementsKind to_kind, bool is_jsarray,
2376 KeyedAccessStoreMode store_mode) 2211 KeyedAccessStoreMode store_mode)
2377 : HydrogenCodeStub(isolate) { 2212 : HydrogenCodeStub(isolate) {
2378 set_sub_minor_key(FromBits::encode(from_kind) | ToBits::encode(to_kind) | 2213 set_sub_minor_key(FromBits::encode(from_kind) | ToBits::encode(to_kind) |
2379 IsJSArrayBits::encode(is_jsarray) | 2214 IsJSArrayBits::encode(is_jsarray) |
2380 StoreModeBits::encode(store_mode)); 2215 StoreModeBits::encode(store_mode));
2381 } 2216 }
2382 2217
2383 ElementsKind from_kind() const { return FromBits::decode(sub_minor_key()); } 2218 ElementsKind from_kind() const { return FromBits::decode(sub_minor_key()); }
2384 ElementsKind to_kind() const { return ToBits::decode(sub_minor_key()); } 2219 ElementsKind to_kind() const { return ToBits::decode(sub_minor_key()); }
2385 bool is_jsarray() const { return IsJSArrayBits::decode(sub_minor_key()); } 2220 bool is_jsarray() const { return IsJSArrayBits::decode(sub_minor_key()); }
2386 KeyedAccessStoreMode store_mode() const { 2221 KeyedAccessStoreMode store_mode() const {
2387 return StoreModeBits::decode(sub_minor_key()); 2222 return StoreModeBits::decode(sub_minor_key());
2388 } 2223 }
2389 2224
2390 virtual Handle<Code> GenerateCode() OVERRIDE;
2391
2392 virtual void InitializeInterfaceDescriptor(
2393 CodeStubInterfaceDescriptor* descriptor) OVERRIDE;
2394
2395 // Parameters accessed via CodeStubGraphBuilder::GetParameter() 2225 // Parameters accessed via CodeStubGraphBuilder::GetParameter()
2396 enum ParameterIndices { 2226 enum ParameterIndices {
2397 kValueIndex, 2227 kValueIndex,
2398 kMapIndex, 2228 kMapIndex,
2399 kKeyIndex, 2229 kKeyIndex,
2400 kObjectIndex, 2230 kObjectIndex,
2401 kParameterCount 2231 kParameterCount
2402 }; 2232 };
2403 2233
2404 static const Register ValueRegister() { 2234 static const Register ValueRegister() {
2405 return ElementTransitionAndStoreDescriptor::ValueRegister(); 2235 return ElementTransitionAndStoreDescriptor::ValueRegister();
2406 } 2236 }
2407 static const Register MapRegister() { 2237 static const Register MapRegister() {
2408 return ElementTransitionAndStoreDescriptor::MapRegister(); 2238 return ElementTransitionAndStoreDescriptor::MapRegister();
2409 } 2239 }
2410 static const Register KeyRegister() { 2240 static const Register KeyRegister() {
2411 return ElementTransitionAndStoreDescriptor::NameRegister(); 2241 return ElementTransitionAndStoreDescriptor::NameRegister();
2412 } 2242 }
2413 static const Register ObjectRegister() { 2243 static const Register ObjectRegister() {
2414 return ElementTransitionAndStoreDescriptor::ReceiverRegister(); 2244 return ElementTransitionAndStoreDescriptor::ReceiverRegister();
2415 } 2245 }
2416 2246
2417 private: 2247 private:
2418 class FromBits : public BitField<ElementsKind, 0, 8> {}; 2248 class FromBits : public BitField<ElementsKind, 0, 8> {};
2419 class ToBits : public BitField<ElementsKind, 8, 8> {}; 2249 class ToBits : public BitField<ElementsKind, 8, 8> {};
2420 class IsJSArrayBits : public BitField<bool, 16, 1> {}; 2250 class IsJSArrayBits : public BitField<bool, 16, 1> {};
2421 class StoreModeBits : public BitField<KeyedAccessStoreMode, 17, 4> {}; 2251 class StoreModeBits : public BitField<KeyedAccessStoreMode, 17, 4> {};
2422 2252
2423 DEFINE_CODE_STUB(ElementsTransitionAndStore, HydrogenCodeStub); 2253 DEFINE_HYDROGEN_CODE_STUB(ElementsTransitionAndStore, HydrogenCodeStub);
2424 }; 2254 };
2425 2255
2426 2256
2427 class StoreArrayLiteralElementStub : public PlatformCodeStub { 2257 class StoreArrayLiteralElementStub : public PlatformCodeStub {
2428 public: 2258 public:
2429 explicit StoreArrayLiteralElementStub(Isolate* isolate) 2259 explicit StoreArrayLiteralElementStub(Isolate* isolate)
2430 : PlatformCodeStub(isolate) { } 2260 : PlatformCodeStub(isolate) { }
2431 2261
2432 private: 2262 DEFINE_PLATFORM_CODE_STUB(StoreArrayLiteralElement, PlatformCodeStub);
2433 void Generate(MacroAssembler* masm);
2434
2435 DEFINE_CODE_STUB(StoreArrayLiteralElement, PlatformCodeStub);
2436 }; 2263 };
2437 2264
2438 2265
2439 class StubFailureTrampolineStub : public PlatformCodeStub { 2266 class StubFailureTrampolineStub : public PlatformCodeStub {
2440 public: 2267 public:
2441 StubFailureTrampolineStub(Isolate* isolate, StubFunctionMode function_mode) 2268 StubFailureTrampolineStub(Isolate* isolate, StubFunctionMode function_mode)
2442 : PlatformCodeStub(isolate) { 2269 : PlatformCodeStub(isolate) {
2443 minor_key_ = FunctionModeField::encode(function_mode); 2270 minor_key_ = FunctionModeField::encode(function_mode);
2444 } 2271 }
2445 2272
2446 static void GenerateAheadOfTime(Isolate* isolate); 2273 static void GenerateAheadOfTime(Isolate* isolate);
2447 2274
2448 private: 2275 private:
2449 StubFunctionMode function_mode() const { 2276 StubFunctionMode function_mode() const {
2450 return FunctionModeField::decode(minor_key_); 2277 return FunctionModeField::decode(minor_key_);
2451 } 2278 }
2452 2279
2453 void Generate(MacroAssembler* masm);
2454
2455 class FunctionModeField : public BitField<StubFunctionMode, 0, 1> {}; 2280 class FunctionModeField : public BitField<StubFunctionMode, 0, 1> {};
2456 2281
2457 DEFINE_CODE_STUB(StubFailureTrampoline, PlatformCodeStub); 2282 DEFINE_PLATFORM_CODE_STUB(StubFailureTrampoline, PlatformCodeStub);
2458 }; 2283 };
2459 2284
2460 2285
2461 class ProfileEntryHookStub : public PlatformCodeStub { 2286 class ProfileEntryHookStub : public PlatformCodeStub {
2462 public: 2287 public:
2463 explicit ProfileEntryHookStub(Isolate* isolate) : PlatformCodeStub(isolate) {} 2288 explicit ProfileEntryHookStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
2464 2289
2465 // The profile entry hook function is not allowed to cause a GC. 2290 // The profile entry hook function is not allowed to cause a GC.
2466 virtual bool SometimesSetsUpAFrame() { return false; } 2291 virtual bool SometimesSetsUpAFrame() { return false; }
2467 2292
2468 // Generates a call to the entry hook if it's enabled. 2293 // Generates a call to the entry hook if it's enabled.
2469 static void MaybeCallEntryHook(MacroAssembler* masm); 2294 static void MaybeCallEntryHook(MacroAssembler* masm);
2470 2295
2471 private: 2296 private:
2472 static void EntryHookTrampoline(intptr_t function, 2297 static void EntryHookTrampoline(intptr_t function,
2473 intptr_t stack_pointer, 2298 intptr_t stack_pointer,
2474 Isolate* isolate); 2299 Isolate* isolate);
2475 2300
2476 void Generate(MacroAssembler* masm); 2301 DEFINE_PLATFORM_CODE_STUB(ProfileEntryHook, PlatformCodeStub);
2477
2478 DEFINE_CODE_STUB(ProfileEntryHook, PlatformCodeStub);
2479 }; 2302 };
2480 2303
2481 2304
2482 class StoreBufferOverflowStub : public PlatformCodeStub { 2305 class StoreBufferOverflowStub : public PlatformCodeStub {
2483 public: 2306 public:
2484 StoreBufferOverflowStub(Isolate* isolate, SaveFPRegsMode save_fp) 2307 StoreBufferOverflowStub(Isolate* isolate, SaveFPRegsMode save_fp)
2485 : PlatformCodeStub(isolate) { 2308 : PlatformCodeStub(isolate) {
2486 minor_key_ = SaveDoublesBits::encode(save_fp == kSaveFPRegs); 2309 minor_key_ = SaveDoublesBits::encode(save_fp == kSaveFPRegs);
2487 } 2310 }
2488 2311
2489 void Generate(MacroAssembler* masm);
2490
2491 static void GenerateFixedRegStubsAheadOfTime(Isolate* isolate); 2312 static void GenerateFixedRegStubsAheadOfTime(Isolate* isolate);
2492 virtual bool SometimesSetsUpAFrame() { return false; } 2313 virtual bool SometimesSetsUpAFrame() { return false; }
2493 2314
2494 private: 2315 private:
2495 bool save_doubles() const { return SaveDoublesBits::decode(minor_key_); } 2316 bool save_doubles() const { return SaveDoublesBits::decode(minor_key_); }
2496 2317
2497 class SaveDoublesBits : public BitField<bool, 0, 1> {}; 2318 class SaveDoublesBits : public BitField<bool, 0, 1> {};
2498 2319
2499 DEFINE_CODE_STUB(StoreBufferOverflow, PlatformCodeStub); 2320 DEFINE_PLATFORM_CODE_STUB(StoreBufferOverflow, PlatformCodeStub);
2500 }; 2321 };
2501 2322
2502 2323
2503 class SubStringStub : public PlatformCodeStub { 2324 class SubStringStub : public PlatformCodeStub {
2504 public: 2325 public:
2505 explicit SubStringStub(Isolate* isolate) : PlatformCodeStub(isolate) {} 2326 explicit SubStringStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
2506 2327
2507 private: 2328 DEFINE_PLATFORM_CODE_STUB(SubString, PlatformCodeStub);
2508 void Generate(MacroAssembler* masm);
2509
2510 DEFINE_CODE_STUB(SubString, PlatformCodeStub);
2511 }; 2329 };
2512 2330
2513 2331
2514 class StringCompareStub : public PlatformCodeStub { 2332 class StringCompareStub : public PlatformCodeStub {
2515 public: 2333 public:
2516 explicit StringCompareStub(Isolate* isolate) : PlatformCodeStub(isolate) {} 2334 explicit StringCompareStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
2517 2335
2518 private: 2336 DEFINE_PLATFORM_CODE_STUB(StringCompare, PlatformCodeStub);
2519 virtual void Generate(MacroAssembler* masm);
2520
2521 DEFINE_CODE_STUB(StringCompare, PlatformCodeStub);
2522 }; 2337 };
2523 2338
2524 2339
2340 #undef DEFINE_PLATFORM_CODE_STUB
2341 #undef DEFINE_HANDLER_CODE_STUB
2342 #undef DEFINE_HYDROGEN_CODE_STUB
2525 #undef DEFINE_CODE_STUB 2343 #undef DEFINE_CODE_STUB
2526 #undef DEFINE_CODE_STUB_BASE 2344 #undef DEFINE_CODE_STUB_BASE
2527 } } // namespace v8::internal 2345 } } // namespace v8::internal
2528 2346
2529 #endif // V8_CODE_STUBS_H_ 2347 #endif // V8_CODE_STUBS_H_
OLDNEW
« no previous file with comments | « src/arm64/code-stubs-arm64.cc ('k') | src/heap/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698