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

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

Issue 246643014: CodeStubs contain their corresponding Isolate* now. (part 1) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Feedback. Rebased. Created 6 years, 8 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/stub-cache-arm64.cc ('k') | src/code-stubs.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 return MinorKeyBits::decode(key); 167 return MinorKeyBits::decode(key);
168 } 168 }
169 169
170 // Gets the major key from a code object that is a code stub or binary op IC. 170 // Gets the major key from a code object that is a code stub or binary op IC.
171 static Major GetMajorKey(Code* code_stub) { 171 static Major GetMajorKey(Code* code_stub) {
172 return static_cast<Major>(code_stub->major_key()); 172 return static_cast<Major>(code_stub->major_key());
173 } 173 }
174 174
175 static const char* MajorName(Major major_key, bool allow_unknown_keys); 175 static const char* MajorName(Major major_key, bool allow_unknown_keys);
176 176
177 explicit CodeStub(Isolate* isolate) : isolate_(isolate) { }
177 virtual ~CodeStub() {} 178 virtual ~CodeStub() {}
178 179
179 static void GenerateStubsAheadOfTime(Isolate* isolate); 180 static void GenerateStubsAheadOfTime(Isolate* isolate);
180 static void GenerateFPStubs(Isolate* isolate); 181 static void GenerateFPStubs(Isolate* isolate);
181 182
182 // Some stubs put untagged junk on the stack that cannot be scanned by the 183 // Some stubs put untagged junk on the stack that cannot be scanned by the
183 // GC. This means that we must be statically sure that no GC can occur while 184 // GC. This means that we must be statically sure that no GC can occur while
184 // they are running. If that is the case they should override this to return 185 // they are running. If that is the case they should override this to return
185 // true, which will cause an assertion if we try to call something that can 186 // true, which will cause an assertion if we try to call something that can
186 // GC or if we try to put a stack frame on top of the junk, which would not 187 // GC or if we try to put a stack frame on top of the junk, which would not
(...skipping 15 matching lines...) Expand all
202 } 203 }
203 virtual Code::StubType GetStubType() { 204 virtual Code::StubType GetStubType() {
204 return Code::NORMAL; 205 return Code::NORMAL;
205 } 206 }
206 207
207 virtual void PrintName(StringStream* stream); 208 virtual void PrintName(StringStream* stream);
208 209
209 // Returns a name for logging/debugging purposes. 210 // Returns a name for logging/debugging purposes.
210 SmartArrayPointer<const char> GetName(); 211 SmartArrayPointer<const char> GetName();
211 212
213 Isolate* isolate() const { return isolate_; }
214
212 protected: 215 protected:
213 static bool CanUseFPRegisters(); 216 static bool CanUseFPRegisters();
214 217
215 // Generates the assembler code for the stub. 218 // Generates the assembler code for the stub.
216 virtual Handle<Code> GenerateCode(Isolate* isolate) = 0; 219 virtual Handle<Code> GenerateCode(Isolate* isolate) = 0;
217 220
218 virtual void VerifyPlatformFeatures(Isolate* isolate); 221 virtual void VerifyPlatformFeatures(Isolate* isolate);
219 222
220 // Returns whether the code generated for this stub needs to be allocated as 223 // Returns whether the code generated for this stub needs to be allocated as
221 // a fixed (non-moveable) code object. 224 // a fixed (non-moveable) code object.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 return MinorKeyBits::encode(MinorKey()) | 261 return MinorKeyBits::encode(MinorKey()) |
259 MajorKeyBits::encode(MajorKey()); 262 MajorKeyBits::encode(MajorKey());
260 } 263 }
261 264
262 STATIC_ASSERT(NUMBER_OF_IDS < (1 << kStubMajorKeyBits)); 265 STATIC_ASSERT(NUMBER_OF_IDS < (1 << kStubMajorKeyBits));
263 class MajorKeyBits: public BitField<uint32_t, 0, kStubMajorKeyBits> {}; 266 class MajorKeyBits: public BitField<uint32_t, 0, kStubMajorKeyBits> {};
264 class MinorKeyBits: public BitField<uint32_t, 267 class MinorKeyBits: public BitField<uint32_t,
265 kStubMajorKeyBits, kStubMinorKeyBits> {}; // NOLINT 268 kStubMajorKeyBits, kStubMinorKeyBits> {}; // NOLINT
266 269
267 friend class BreakPointIterator; 270 friend class BreakPointIterator;
271
272 Isolate* isolate_;
268 }; 273 };
269 274
270 275
271 class PlatformCodeStub : public CodeStub { 276 class PlatformCodeStub : public CodeStub {
272 public: 277 public:
278 explicit PlatformCodeStub(Isolate* isolate) : CodeStub(isolate) { }
279
273 // Retrieve the code for the stub. Generate the code if needed. 280 // Retrieve the code for the stub. Generate the code if needed.
274 virtual Handle<Code> GenerateCode(Isolate* isolate); 281 virtual Handle<Code> GenerateCode(Isolate* isolate);
275 282
276 virtual Code::Kind GetCodeKind() const { return Code::STUB; } 283 virtual Code::Kind GetCodeKind() const { return Code::STUB; }
277 284
278 protected: 285 protected:
279 // Generates the assembler code for the stub. 286 // Generates the assembler code for the stub.
280 virtual void Generate(MacroAssembler* masm) = 0; 287 virtual void Generate(MacroAssembler* masm) = 0;
281 }; 288 };
282 289
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 }; 385 };
379 386
380 387
381 class HydrogenCodeStub : public CodeStub { 388 class HydrogenCodeStub : public CodeStub {
382 public: 389 public:
383 enum InitializationState { 390 enum InitializationState {
384 UNINITIALIZED, 391 UNINITIALIZED,
385 INITIALIZED 392 INITIALIZED
386 }; 393 };
387 394
388 explicit HydrogenCodeStub(InitializationState state = INITIALIZED) { 395 HydrogenCodeStub(Isolate* isolate, InitializationState state = INITIALIZED)
396 : CodeStub(isolate) {
389 is_uninitialized_ = (state == UNINITIALIZED); 397 is_uninitialized_ = (state == UNINITIALIZED);
390 } 398 }
391 399
392 virtual Code::Kind GetCodeKind() const { return Code::STUB; } 400 virtual Code::Kind GetCodeKind() const { return Code::STUB; }
393 401
394 CodeStubInterfaceDescriptor* GetInterfaceDescriptor(Isolate* isolate) { 402 CodeStubInterfaceDescriptor* GetInterfaceDescriptor(Isolate* isolate) {
395 return isolate->code_stub_interface_descriptor(MajorKey()); 403 return isolate->code_stub_interface_descriptor(MajorKey());
396 } 404 }
397 405
398 bool IsUninitialized() { return is_uninitialized_; } 406 bool IsUninitialized() { return is_uninitialized_; }
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 NopRuntimeCallHelper() {} 494 NopRuntimeCallHelper() {}
487 495
488 virtual void BeforeCall(MacroAssembler* masm) const {} 496 virtual void BeforeCall(MacroAssembler* masm) const {}
489 497
490 virtual void AfterCall(MacroAssembler* masm) const {} 498 virtual void AfterCall(MacroAssembler* masm) const {}
491 }; 499 };
492 500
493 501
494 class ToNumberStub: public HydrogenCodeStub { 502 class ToNumberStub: public HydrogenCodeStub {
495 public: 503 public:
496 ToNumberStub() { } 504 explicit ToNumberStub(Isolate* isolate) : HydrogenCodeStub(isolate) { }
497 505
498 virtual Handle<Code> GenerateCode(Isolate* isolate); 506 virtual Handle<Code> GenerateCode(Isolate* isolate);
499 507
500 virtual void InitializeInterfaceDescriptor( 508 virtual void InitializeInterfaceDescriptor(
501 Isolate* isolate, 509 Isolate* isolate,
502 CodeStubInterfaceDescriptor* descriptor); 510 CodeStubInterfaceDescriptor* descriptor);
503 511
504 static void InstallDescriptors(Isolate* isolate) { 512 static void InstallDescriptors(Isolate* isolate) {
505 ToNumberStub stub; 513 ToNumberStub stub(isolate);
506 stub.InitializeInterfaceDescriptor( 514 stub.InitializeInterfaceDescriptor(
507 isolate, 515 isolate,
508 isolate->code_stub_interface_descriptor(CodeStub::ToNumber)); 516 isolate->code_stub_interface_descriptor(CodeStub::ToNumber));
509 } 517 }
510 518
511 private: 519 private:
512 Major MajorKey() { return ToNumber; } 520 Major MajorKey() { return ToNumber; }
513 int NotMissMinorKey() { return 0; } 521 int NotMissMinorKey() { return 0; }
514 }; 522 };
515 523
516 524
517 class NumberToStringStub V8_FINAL : public HydrogenCodeStub { 525 class NumberToStringStub V8_FINAL : public HydrogenCodeStub {
518 public: 526 public:
519 NumberToStringStub() {} 527 explicit NumberToStringStub(Isolate* isolate) : HydrogenCodeStub(isolate) {}
520 528
521 virtual Handle<Code> GenerateCode(Isolate* isolate) V8_OVERRIDE; 529 virtual Handle<Code> GenerateCode(Isolate* isolate) V8_OVERRIDE;
522 530
523 virtual void InitializeInterfaceDescriptor( 531 virtual void InitializeInterfaceDescriptor(
524 Isolate* isolate, 532 Isolate* isolate,
525 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; 533 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE;
526 534
527 static void InstallDescriptors(Isolate* isolate); 535 static void InstallDescriptors(Isolate* isolate);
528 536
529 // Parameters accessed via CodeStubGraphBuilder::GetParameter() 537 // Parameters accessed via CodeStubGraphBuilder::GetParameter()
530 static const int kNumber = 0; 538 static const int kNumber = 0;
531 539
532 private: 540 private:
533 virtual Major MajorKey() V8_OVERRIDE { return NumberToString; } 541 virtual Major MajorKey() V8_OVERRIDE { return NumberToString; }
534 virtual int NotMissMinorKey() V8_OVERRIDE { return 0; } 542 virtual int NotMissMinorKey() V8_OVERRIDE { return 0; }
535 }; 543 };
536 544
537 545
538 class FastNewClosureStub : public HydrogenCodeStub { 546 class FastNewClosureStub : public HydrogenCodeStub {
539 public: 547 public:
540 explicit FastNewClosureStub(StrictMode strict_mode, bool is_generator) 548 FastNewClosureStub(Isolate* isolate,
541 : strict_mode_(strict_mode), 549 StrictMode strict_mode,
542 is_generator_(is_generator) { } 550 bool is_generator)
551 : HydrogenCodeStub(isolate),
552 strict_mode_(strict_mode),
553 is_generator_(is_generator) { }
543 554
544 virtual Handle<Code> GenerateCode(Isolate* isolate); 555 virtual Handle<Code> GenerateCode(Isolate* isolate);
545 556
546 virtual void InitializeInterfaceDescriptor( 557 virtual void InitializeInterfaceDescriptor(
547 Isolate* isolate, 558 Isolate* isolate,
548 CodeStubInterfaceDescriptor* descriptor); 559 CodeStubInterfaceDescriptor* descriptor);
549 560
550 static void InstallDescriptors(Isolate* isolate); 561 static void InstallDescriptors(Isolate* isolate);
551 562
552 StrictMode strict_mode() const { return strict_mode_; } 563 StrictMode strict_mode() const { return strict_mode_; }
(...skipping 11 matching lines...) Expand all
564 575
565 StrictMode strict_mode_; 576 StrictMode strict_mode_;
566 bool is_generator_; 577 bool is_generator_;
567 }; 578 };
568 579
569 580
570 class FastNewContextStub V8_FINAL : public HydrogenCodeStub { 581 class FastNewContextStub V8_FINAL : public HydrogenCodeStub {
571 public: 582 public:
572 static const int kMaximumSlots = 64; 583 static const int kMaximumSlots = 64;
573 584
574 explicit FastNewContextStub(int slots) : slots_(slots) { 585 FastNewContextStub(Isolate* isolate, int slots)
586 : HydrogenCodeStub(isolate), slots_(slots) {
575 ASSERT(slots_ > 0 && slots_ <= kMaximumSlots); 587 ASSERT(slots_ > 0 && slots_ <= kMaximumSlots);
576 } 588 }
577 589
578 virtual Handle<Code> GenerateCode(Isolate* isolate); 590 virtual Handle<Code> GenerateCode(Isolate* isolate);
579 591
580 virtual void InitializeInterfaceDescriptor( 592 virtual void InitializeInterfaceDescriptor(
581 Isolate* isolate, 593 Isolate* isolate,
582 CodeStubInterfaceDescriptor* descriptor); 594 CodeStubInterfaceDescriptor* descriptor);
583 595
584 static void InstallDescriptors(Isolate* isolate); 596 static void InstallDescriptors(Isolate* isolate);
(...skipping 18 matching lines...) Expand all
603 enum Mode { 615 enum Mode {
604 CLONE_ELEMENTS, 616 CLONE_ELEMENTS,
605 CLONE_DOUBLE_ELEMENTS, 617 CLONE_DOUBLE_ELEMENTS,
606 COPY_ON_WRITE_ELEMENTS, 618 COPY_ON_WRITE_ELEMENTS,
607 CLONE_ANY_ELEMENTS, 619 CLONE_ANY_ELEMENTS,
608 LAST_CLONE_MODE = CLONE_ANY_ELEMENTS 620 LAST_CLONE_MODE = CLONE_ANY_ELEMENTS
609 }; 621 };
610 622
611 static const int kFastCloneModeCount = LAST_CLONE_MODE + 1; 623 static const int kFastCloneModeCount = LAST_CLONE_MODE + 1;
612 624
613 FastCloneShallowArrayStub(Mode mode, 625 FastCloneShallowArrayStub(Isolate* isolate,
626 Mode mode,
614 AllocationSiteMode allocation_site_mode, 627 AllocationSiteMode allocation_site_mode,
615 int length) 628 int length)
616 : mode_(mode), 629 : HydrogenCodeStub(isolate),
630 mode_(mode),
617 allocation_site_mode_(allocation_site_mode), 631 allocation_site_mode_(allocation_site_mode),
618 length_((mode == COPY_ON_WRITE_ELEMENTS) ? 0 : length) { 632 length_((mode == COPY_ON_WRITE_ELEMENTS) ? 0 : length) {
619 ASSERT_GE(length_, 0); 633 ASSERT_GE(length_, 0);
620 ASSERT_LE(length_, kMaximumClonedLength); 634 ASSERT_LE(length_, kMaximumClonedLength);
621 } 635 }
622 636
623 Mode mode() const { return mode_; } 637 Mode mode() const { return mode_; }
624 int length() const { return length_; } 638 int length() const { return length_; }
625 AllocationSiteMode allocation_site_mode() const { 639 AllocationSiteMode allocation_site_mode() const {
626 return allocation_site_mode_; 640 return allocation_site_mode_;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 | LengthBits::encode(length_); 681 | LengthBits::encode(length_);
668 } 682 }
669 }; 683 };
670 684
671 685
672 class FastCloneShallowObjectStub : public HydrogenCodeStub { 686 class FastCloneShallowObjectStub : public HydrogenCodeStub {
673 public: 687 public:
674 // Maximum number of properties in copied object. 688 // Maximum number of properties in copied object.
675 static const int kMaximumClonedProperties = 6; 689 static const int kMaximumClonedProperties = 6;
676 690
677 explicit FastCloneShallowObjectStub(int length) : length_(length) { 691 FastCloneShallowObjectStub(Isolate* isolate, int length)
692 : HydrogenCodeStub(isolate), length_(length) {
678 ASSERT_GE(length_, 0); 693 ASSERT_GE(length_, 0);
679 ASSERT_LE(length_, kMaximumClonedProperties); 694 ASSERT_LE(length_, kMaximumClonedProperties);
680 } 695 }
681 696
682 int length() const { return length_; } 697 int length() const { return length_; }
683 698
684 virtual Handle<Code> GenerateCode(Isolate* isolate); 699 virtual Handle<Code> GenerateCode(Isolate* isolate);
685 700
686 virtual void InitializeInterfaceDescriptor( 701 virtual void InitializeInterfaceDescriptor(
687 Isolate* isolate, 702 Isolate* isolate,
688 CodeStubInterfaceDescriptor* descriptor); 703 CodeStubInterfaceDescriptor* descriptor);
689 704
690 private: 705 private:
691 int length_; 706 int length_;
692 707
693 Major MajorKey() { return FastCloneShallowObject; } 708 Major MajorKey() { return FastCloneShallowObject; }
694 int NotMissMinorKey() { return length_; } 709 int NotMissMinorKey() { return length_; }
695 710
696 DISALLOW_COPY_AND_ASSIGN(FastCloneShallowObjectStub); 711 DISALLOW_COPY_AND_ASSIGN(FastCloneShallowObjectStub);
697 }; 712 };
698 713
699 714
700 class CreateAllocationSiteStub : public HydrogenCodeStub { 715 class CreateAllocationSiteStub : public HydrogenCodeStub {
701 public: 716 public:
702 explicit CreateAllocationSiteStub() { } 717 explicit CreateAllocationSiteStub(Isolate* isolate)
718 : HydrogenCodeStub(isolate) { }
703 719
704 virtual Handle<Code> GenerateCode(Isolate* isolate); 720 virtual Handle<Code> GenerateCode(Isolate* isolate);
705 721
706 static void GenerateAheadOfTime(Isolate* isolate); 722 static void GenerateAheadOfTime(Isolate* isolate);
707 723
708 virtual void InitializeInterfaceDescriptor( 724 virtual void InitializeInterfaceDescriptor(
709 Isolate* isolate, 725 Isolate* isolate,
710 CodeStubInterfaceDescriptor* descriptor); 726 CodeStubInterfaceDescriptor* descriptor);
711 727
712 private: 728 private:
713 Major MajorKey() { return CreateAllocationSite; } 729 Major MajorKey() { return CreateAllocationSite; }
714 int NotMissMinorKey() { return 0; } 730 int NotMissMinorKey() { return 0; }
715 731
716 DISALLOW_COPY_AND_ASSIGN(CreateAllocationSiteStub); 732 DISALLOW_COPY_AND_ASSIGN(CreateAllocationSiteStub);
717 }; 733 };
718 734
719 735
720 class InstanceofStub: public PlatformCodeStub { 736 class InstanceofStub: public PlatformCodeStub {
721 public: 737 public:
722 enum Flags { 738 enum Flags {
723 kNoFlags = 0, 739 kNoFlags = 0,
724 kArgsInRegisters = 1 << 0, 740 kArgsInRegisters = 1 << 0,
725 kCallSiteInlineCheck = 1 << 1, 741 kCallSiteInlineCheck = 1 << 1,
726 kReturnTrueFalseObject = 1 << 2 742 kReturnTrueFalseObject = 1 << 2
727 }; 743 };
728 744
729 explicit InstanceofStub(Flags flags) : flags_(flags) { } 745 InstanceofStub(Isolate* isolate, Flags flags)
746 : PlatformCodeStub(isolate), flags_(flags) { }
730 747
731 static Register left(); 748 static Register left();
732 static Register right(); 749 static Register right();
733 750
734 void Generate(MacroAssembler* masm); 751 void Generate(MacroAssembler* masm);
735 752
736 private: 753 private:
737 Major MajorKey() { return Instanceof; } 754 Major MajorKey() { return Instanceof; }
738 int MinorKey() { return static_cast<int>(flags_); } 755 int MinorKey() { return static_cast<int>(flags_); }
739 756
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 virtual int MinorKey() { return 0; } 810 virtual int MinorKey() { return 0; }
794 811
795 void GenerateCase(MacroAssembler* masm, ElementsKind kind); 812 void GenerateCase(MacroAssembler* masm, ElementsKind kind);
796 }; 813 };
797 814
798 815
799 class MathPowStub: public PlatformCodeStub { 816 class MathPowStub: public PlatformCodeStub {
800 public: 817 public:
801 enum ExponentType { INTEGER, DOUBLE, TAGGED, ON_STACK }; 818 enum ExponentType { INTEGER, DOUBLE, TAGGED, ON_STACK };
802 819
803 explicit MathPowStub(ExponentType exponent_type) 820 MathPowStub(Isolate* isolate, ExponentType exponent_type)
804 : exponent_type_(exponent_type) { } 821 : PlatformCodeStub(isolate), exponent_type_(exponent_type) { }
805 virtual void Generate(MacroAssembler* masm); 822 virtual void Generate(MacroAssembler* masm);
806 823
807 private: 824 private:
808 virtual CodeStub::Major MajorKey() { return MathPow; } 825 virtual CodeStub::Major MajorKey() { return MathPow; }
809 virtual int MinorKey() { return exponent_type_; } 826 virtual int MinorKey() { return exponent_type_; }
810 827
811 ExponentType exponent_type_; 828 ExponentType exponent_type_;
812 }; 829 };
813 830
814 831
815 class ICStub: public PlatformCodeStub { 832 class ICStub: public PlatformCodeStub {
816 public: 833 public:
817 explicit ICStub(Code::Kind kind) : kind_(kind) { } 834 ICStub(Isolate* isolate, Code::Kind kind)
835 : PlatformCodeStub(isolate), kind_(kind) { }
818 virtual Code::Kind GetCodeKind() const { return kind_; } 836 virtual Code::Kind GetCodeKind() const { return kind_; }
819 virtual InlineCacheState GetICState() { return MONOMORPHIC; } 837 virtual InlineCacheState GetICState() { return MONOMORPHIC; }
820 838
821 bool Describes(Code* code) { 839 bool Describes(Code* code) {
822 return GetMajorKey(code) == MajorKey() && code->stub_info() == MinorKey(); 840 return GetMajorKey(code) == MajorKey() && code->stub_info() == MinorKey();
823 } 841 }
824 842
825 protected: 843 protected:
826 class KindBits: public BitField<Code::Kind, 0, 4> {}; 844 class KindBits: public BitField<Code::Kind, 0, 4> {};
827 virtual void FinishCode(Handle<Code> code) { 845 virtual void FinishCode(Handle<Code> code) {
828 code->set_stub_info(MinorKey()); 846 code->set_stub_info(MinorKey());
829 } 847 }
830 Code::Kind kind() { return kind_; } 848 Code::Kind kind() { return kind_; }
831 849
832 virtual int MinorKey() { 850 virtual int MinorKey() {
833 return KindBits::encode(kind_); 851 return KindBits::encode(kind_);
834 } 852 }
835 853
836 private: 854 private:
837 Code::Kind kind_; 855 Code::Kind kind_;
838 }; 856 };
839 857
840 858
841 class FunctionPrototypeStub: public ICStub { 859 class FunctionPrototypeStub: public ICStub {
842 public: 860 public:
843 explicit FunctionPrototypeStub(Code::Kind kind) : ICStub(kind) { } 861 FunctionPrototypeStub(Isolate* isolate, Code::Kind kind)
862 : ICStub(isolate, kind) { }
844 virtual void Generate(MacroAssembler* masm); 863 virtual void Generate(MacroAssembler* masm);
845 864
846 private: 865 private:
847 virtual CodeStub::Major MajorKey() { return FunctionPrototype; } 866 virtual CodeStub::Major MajorKey() { return FunctionPrototype; }
848 }; 867 };
849 868
850 869
851 class StoreICStub: public ICStub { 870 class StoreICStub: public ICStub {
852 public: 871 public:
853 StoreICStub(Code::Kind kind, StrictMode strict_mode) 872 StoreICStub(Isolate* isolate, Code::Kind kind, StrictMode strict_mode)
854 : ICStub(kind), strict_mode_(strict_mode) { } 873 : ICStub(isolate, kind), strict_mode_(strict_mode) { }
855 874
856 protected: 875 protected:
857 virtual ExtraICState GetExtraICState() { 876 virtual ExtraICState GetExtraICState() {
858 return StoreIC::ComputeExtraICState(strict_mode_); 877 return StoreIC::ComputeExtraICState(strict_mode_);
859 } 878 }
860 879
861 private: 880 private:
862 STATIC_ASSERT(KindBits::kSize == 4); 881 STATIC_ASSERT(KindBits::kSize == 4);
863 class StrictModeBits: public BitField<bool, 4, 1> {}; 882 class StrictModeBits: public BitField<bool, 4, 1> {};
864 virtual int MinorKey() { 883 virtual int MinorKey() {
865 return KindBits::encode(kind()) | StrictModeBits::encode(strict_mode_); 884 return KindBits::encode(kind()) | StrictModeBits::encode(strict_mode_);
866 } 885 }
867 886
868 StrictMode strict_mode_; 887 StrictMode strict_mode_;
869 }; 888 };
870 889
871 890
872 class HICStub: public HydrogenCodeStub { 891 class HICStub: public HydrogenCodeStub {
873 public: 892 public:
893 explicit HICStub(Isolate* isolate) : HydrogenCodeStub(isolate) { }
874 virtual Code::Kind GetCodeKind() const { return kind(); } 894 virtual Code::Kind GetCodeKind() const { return kind(); }
875 virtual InlineCacheState GetICState() { return MONOMORPHIC; } 895 virtual InlineCacheState GetICState() { return MONOMORPHIC; }
876 896
877 protected: 897 protected:
878 class KindBits: public BitField<Code::Kind, 0, 4> {}; 898 class KindBits: public BitField<Code::Kind, 0, 4> {};
879 virtual Code::Kind kind() const = 0; 899 virtual Code::Kind kind() const = 0;
880 }; 900 };
881 901
882 902
883 class HandlerStub: public HICStub { 903 class HandlerStub: public HICStub {
884 public: 904 public:
885 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; } 905 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; }
886 virtual ExtraICState GetExtraICState() { return kind(); } 906 virtual ExtraICState GetExtraICState() { return kind(); }
887 907
888 protected: 908 protected:
889 HandlerStub() : HICStub() { } 909 explicit HandlerStub(Isolate* isolate) : HICStub(isolate) { }
890 virtual int NotMissMinorKey() { return bit_field_; } 910 virtual int NotMissMinorKey() { return bit_field_; }
891 int bit_field_; 911 int bit_field_;
892 }; 912 };
893 913
894 914
895 class LoadFieldStub: public HandlerStub { 915 class LoadFieldStub: public HandlerStub {
896 public: 916 public:
897 LoadFieldStub(bool inobject, int index, Representation representation) { 917 LoadFieldStub(Isolate* isolate,
918 bool inobject,
919 int index, Representation representation)
920 : HandlerStub(isolate) {
898 Initialize(Code::LOAD_IC, inobject, index, representation); 921 Initialize(Code::LOAD_IC, inobject, index, representation);
899 } 922 }
900 923
901 virtual Handle<Code> GenerateCode(Isolate* isolate); 924 virtual Handle<Code> GenerateCode(Isolate* isolate);
902 925
903 virtual void InitializeInterfaceDescriptor( 926 virtual void InitializeInterfaceDescriptor(
904 Isolate* isolate, 927 Isolate* isolate,
905 CodeStubInterfaceDescriptor* descriptor); 928 CodeStubInterfaceDescriptor* descriptor);
906 929
907 Representation representation() { 930 Representation representation() {
(...skipping 16 matching lines...) Expand all
924 return FixedArray::kHeaderSize + offset; 947 return FixedArray::kHeaderSize + offset;
925 } 948 }
926 949
927 bool unboxed_double() { 950 bool unboxed_double() {
928 return UnboxedDoubleBits::decode(bit_field_); 951 return UnboxedDoubleBits::decode(bit_field_);
929 } 952 }
930 953
931 virtual Code::StubType GetStubType() { return Code::FAST; } 954 virtual Code::StubType GetStubType() { return Code::FAST; }
932 955
933 protected: 956 protected:
934 LoadFieldStub() : HandlerStub() { } 957 explicit LoadFieldStub(Isolate* isolate) : HandlerStub(isolate) { }
935 958
936 void Initialize(Code::Kind kind, 959 void Initialize(Code::Kind kind,
937 bool inobject, 960 bool inobject,
938 int index, 961 int index,
939 Representation representation) { 962 Representation representation) {
940 bit_field_ = KindBits::encode(kind) 963 bit_field_ = KindBits::encode(kind)
941 | InobjectBits::encode(inobject) 964 | InobjectBits::encode(inobject)
942 | IndexBits::encode(index) 965 | IndexBits::encode(index)
943 | UnboxedDoubleBits::encode(representation.IsDouble()); 966 | UnboxedDoubleBits::encode(representation.IsDouble());
944 } 967 }
945 968
946 private: 969 private:
947 STATIC_ASSERT(KindBits::kSize == 4); 970 STATIC_ASSERT(KindBits::kSize == 4);
948 class InobjectBits: public BitField<bool, 4, 1> {}; 971 class InobjectBits: public BitField<bool, 4, 1> {};
949 class IndexBits: public BitField<int, 5, 11> {}; 972 class IndexBits: public BitField<int, 5, 11> {};
950 class UnboxedDoubleBits: public BitField<bool, 16, 1> {}; 973 class UnboxedDoubleBits: public BitField<bool, 16, 1> {};
951 virtual CodeStub::Major MajorKey() { return LoadField; } 974 virtual CodeStub::Major MajorKey() { return LoadField; }
952 }; 975 };
953 976
954 977
955 class StringLengthStub: public HandlerStub { 978 class StringLengthStub: public HandlerStub {
956 public: 979 public:
957 explicit StringLengthStub() : HandlerStub() { 980 explicit StringLengthStub(Isolate* isolate) : HandlerStub(isolate) {
958 Initialize(Code::LOAD_IC); 981 Initialize(Code::LOAD_IC);
959 } 982 }
960 virtual Handle<Code> GenerateCode(Isolate* isolate); 983 virtual Handle<Code> GenerateCode(Isolate* isolate);
961 virtual void InitializeInterfaceDescriptor( 984 virtual void InitializeInterfaceDescriptor(
962 Isolate* isolate, 985 Isolate* isolate,
963 CodeStubInterfaceDescriptor* descriptor); 986 CodeStubInterfaceDescriptor* descriptor);
964 987
965 protected: 988 protected:
966 virtual Code::Kind kind() const { 989 virtual Code::Kind kind() const {
967 return KindBits::decode(bit_field_); 990 return KindBits::decode(bit_field_);
968 } 991 }
969 992
970 void Initialize(Code::Kind kind) { 993 void Initialize(Code::Kind kind) {
971 bit_field_ = KindBits::encode(kind); 994 bit_field_ = KindBits::encode(kind);
972 } 995 }
973 996
974 private: 997 private:
975 virtual CodeStub::Major MajorKey() { return StringLength; } 998 virtual CodeStub::Major MajorKey() { return StringLength; }
976 }; 999 };
977 1000
978 1001
979 class KeyedStringLengthStub: public StringLengthStub { 1002 class KeyedStringLengthStub: public StringLengthStub {
980 public: 1003 public:
981 explicit KeyedStringLengthStub() : StringLengthStub() { 1004 explicit KeyedStringLengthStub(Isolate* isolate) : StringLengthStub(isolate) {
982 Initialize(Code::KEYED_LOAD_IC); 1005 Initialize(Code::KEYED_LOAD_IC);
983 } 1006 }
984 virtual void InitializeInterfaceDescriptor( 1007 virtual void InitializeInterfaceDescriptor(
985 Isolate* isolate, 1008 Isolate* isolate,
986 CodeStubInterfaceDescriptor* descriptor); 1009 CodeStubInterfaceDescriptor* descriptor);
987 1010
988 private: 1011 private:
989 virtual CodeStub::Major MajorKey() { return KeyedStringLength; } 1012 virtual CodeStub::Major MajorKey() { return KeyedStringLength; }
990 }; 1013 };
991 1014
992 1015
993 class StoreGlobalStub : public HandlerStub { 1016 class StoreGlobalStub : public HandlerStub {
994 public: 1017 public:
995 explicit StoreGlobalStub(bool is_constant, bool check_global) { 1018 StoreGlobalStub(Isolate* isolate, bool is_constant, bool check_global)
1019 : HandlerStub(isolate) {
996 bit_field_ = IsConstantBits::encode(is_constant) | 1020 bit_field_ = IsConstantBits::encode(is_constant) |
997 CheckGlobalBits::encode(check_global); 1021 CheckGlobalBits::encode(check_global);
998 } 1022 }
999 1023
1000 static Handle<HeapObject> global_placeholder(Isolate* isolate) { 1024 static Handle<HeapObject> global_placeholder(Isolate* isolate) {
1001 return isolate->factory()->uninitialized_value(); 1025 return isolate->factory()->uninitialized_value();
1002 } 1026 }
1003 1027
1004 Handle<Code> GetCodeCopyFromTemplate(Isolate* isolate, 1028 Handle<Code> GetCodeCopyFromTemplate(Isolate* isolate,
1005 Handle<GlobalObject> global, 1029 Handle<GlobalObject> global,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1048 class IsConstantBits: public BitField<bool, 0, 1> {}; 1072 class IsConstantBits: public BitField<bool, 0, 1> {};
1049 class RepresentationBits: public BitField<Representation::Kind, 1, 8> {}; 1073 class RepresentationBits: public BitField<Representation::Kind, 1, 8> {};
1050 class CheckGlobalBits: public BitField<bool, 9, 1> {}; 1074 class CheckGlobalBits: public BitField<bool, 9, 1> {};
1051 1075
1052 DISALLOW_COPY_AND_ASSIGN(StoreGlobalStub); 1076 DISALLOW_COPY_AND_ASSIGN(StoreGlobalStub);
1053 }; 1077 };
1054 1078
1055 1079
1056 class CallApiFunctionStub : public PlatformCodeStub { 1080 class CallApiFunctionStub : public PlatformCodeStub {
1057 public: 1081 public:
1058 CallApiFunctionStub(bool is_store, 1082 CallApiFunctionStub(Isolate* isolate,
1083 bool is_store,
1059 bool call_data_undefined, 1084 bool call_data_undefined,
1060 int argc) { 1085 int argc) : PlatformCodeStub(isolate) {
1061 bit_field_ = 1086 bit_field_ =
1062 IsStoreBits::encode(is_store) | 1087 IsStoreBits::encode(is_store) |
1063 CallDataUndefinedBits::encode(call_data_undefined) | 1088 CallDataUndefinedBits::encode(call_data_undefined) |
1064 ArgumentBits::encode(argc); 1089 ArgumentBits::encode(argc);
1065 ASSERT(!is_store || argc == 1); 1090 ASSERT(!is_store || argc == 1);
1066 } 1091 }
1067 1092
1068 private: 1093 private:
1069 virtual void Generate(MacroAssembler* masm) V8_OVERRIDE; 1094 virtual void Generate(MacroAssembler* masm) V8_OVERRIDE;
1070 virtual Major MajorKey() V8_OVERRIDE { return CallApiFunction; } 1095 virtual Major MajorKey() V8_OVERRIDE { return CallApiFunction; }
1071 virtual int MinorKey() V8_OVERRIDE { return bit_field_; } 1096 virtual int MinorKey() V8_OVERRIDE { return bit_field_; }
1072 1097
1073 class IsStoreBits: public BitField<bool, 0, 1> {}; 1098 class IsStoreBits: public BitField<bool, 0, 1> {};
1074 class CallDataUndefinedBits: public BitField<bool, 1, 1> {}; 1099 class CallDataUndefinedBits: public BitField<bool, 1, 1> {};
1075 class ArgumentBits: public BitField<int, 2, Code::kArgumentsBits> {}; 1100 class ArgumentBits: public BitField<int, 2, Code::kArgumentsBits> {};
1076 1101
1077 int bit_field_; 1102 int bit_field_;
1078 1103
1079 DISALLOW_COPY_AND_ASSIGN(CallApiFunctionStub); 1104 DISALLOW_COPY_AND_ASSIGN(CallApiFunctionStub);
1080 }; 1105 };
1081 1106
1082 1107
1083 class CallApiGetterStub : public PlatformCodeStub { 1108 class CallApiGetterStub : public PlatformCodeStub {
1084 public: 1109 public:
1085 CallApiGetterStub() {} 1110 explicit CallApiGetterStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
1086 1111
1087 private: 1112 private:
1088 virtual void Generate(MacroAssembler* masm) V8_OVERRIDE; 1113 virtual void Generate(MacroAssembler* masm) V8_OVERRIDE;
1089 virtual Major MajorKey() V8_OVERRIDE { return CallApiGetter; } 1114 virtual Major MajorKey() V8_OVERRIDE { return CallApiGetter; }
1090 virtual int MinorKey() V8_OVERRIDE { return 0; } 1115 virtual int MinorKey() V8_OVERRIDE { return 0; }
1091 1116
1092 DISALLOW_COPY_AND_ASSIGN(CallApiGetterStub); 1117 DISALLOW_COPY_AND_ASSIGN(CallApiGetterStub);
1093 }; 1118 };
1094 1119
1095 1120
1096 class KeyedLoadFieldStub: public LoadFieldStub { 1121 class KeyedLoadFieldStub: public LoadFieldStub {
1097 public: 1122 public:
1098 KeyedLoadFieldStub(bool inobject, int index, Representation representation) 1123 KeyedLoadFieldStub(Isolate* isolate,
1099 : LoadFieldStub() { 1124 bool inobject,
1125 int index, Representation representation)
1126 : LoadFieldStub(isolate) {
1100 Initialize(Code::KEYED_LOAD_IC, inobject, index, representation); 1127 Initialize(Code::KEYED_LOAD_IC, inobject, index, representation);
1101 } 1128 }
1102 1129
1103 virtual void InitializeInterfaceDescriptor( 1130 virtual void InitializeInterfaceDescriptor(
1104 Isolate* isolate, 1131 Isolate* isolate,
1105 CodeStubInterfaceDescriptor* descriptor); 1132 CodeStubInterfaceDescriptor* descriptor);
1106 1133
1107 private: 1134 private:
1108 virtual CodeStub::Major MajorKey() { return KeyedLoadField; } 1135 virtual CodeStub::Major MajorKey() { return KeyedLoadField; }
1109 }; 1136 };
1110 1137
1111 1138
1112 class BinaryOpICStub : public HydrogenCodeStub { 1139 class BinaryOpICStub : public HydrogenCodeStub {
1113 public: 1140 public:
1114 BinaryOpICStub(Token::Value op, OverwriteMode mode) 1141 BinaryOpICStub(Isolate* isolate, Token::Value op, OverwriteMode mode)
1115 : HydrogenCodeStub(UNINITIALIZED), state_(op, mode) {} 1142 : HydrogenCodeStub(isolate, UNINITIALIZED), state_(op, mode) {}
1116 1143
1117 explicit BinaryOpICStub(const BinaryOpIC::State& state) : state_(state) {} 1144 BinaryOpICStub(Isolate* isolate, const BinaryOpIC::State& state)
1145 : HydrogenCodeStub(isolate), state_(state) {}
1118 1146
1119 static void GenerateAheadOfTime(Isolate* isolate); 1147 static void GenerateAheadOfTime(Isolate* isolate);
1120 1148
1121 virtual void InitializeInterfaceDescriptor( 1149 virtual void InitializeInterfaceDescriptor(
1122 Isolate* isolate, CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; 1150 Isolate* isolate, CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE;
1123 1151
1124 static void InstallDescriptors(Isolate* isolate); 1152 static void InstallDescriptors(Isolate* isolate);
1125 1153
1126 virtual Code::Kind GetCodeKind() const V8_OVERRIDE { 1154 virtual Code::Kind GetCodeKind() const V8_OVERRIDE {
1127 return Code::BINARY_OP_IC; 1155 return Code::BINARY_OP_IC;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1161 BinaryOpIC::State state_; 1189 BinaryOpIC::State state_;
1162 1190
1163 DISALLOW_COPY_AND_ASSIGN(BinaryOpICStub); 1191 DISALLOW_COPY_AND_ASSIGN(BinaryOpICStub);
1164 }; 1192 };
1165 1193
1166 1194
1167 // TODO(bmeurer): Merge this into the BinaryOpICStub once we have proper tail 1195 // TODO(bmeurer): Merge this into the BinaryOpICStub once we have proper tail
1168 // call support for stubs in Hydrogen. 1196 // call support for stubs in Hydrogen.
1169 class BinaryOpICWithAllocationSiteStub V8_FINAL : public PlatformCodeStub { 1197 class BinaryOpICWithAllocationSiteStub V8_FINAL : public PlatformCodeStub {
1170 public: 1198 public:
1171 explicit BinaryOpICWithAllocationSiteStub(const BinaryOpIC::State& state) 1199 BinaryOpICWithAllocationSiteStub(Isolate* isolate,
1172 : state_(state) {} 1200 const BinaryOpIC::State& state)
1201 : PlatformCodeStub(isolate), state_(state) {}
1173 1202
1174 static void GenerateAheadOfTime(Isolate* isolate); 1203 static void GenerateAheadOfTime(Isolate* isolate);
1175 1204
1176 Handle<Code> GetCodeCopyFromTemplate(Isolate* isolate, 1205 Handle<Code> GetCodeCopyFromTemplate(Isolate* isolate,
1177 Handle<AllocationSite> allocation_site) { 1206 Handle<AllocationSite> allocation_site) {
1178 Code::FindAndReplacePattern pattern; 1207 Code::FindAndReplacePattern pattern;
1179 pattern.Add(isolate->factory()->undefined_map(), allocation_site); 1208 pattern.Add(isolate->factory()->undefined_map(), allocation_site);
1180 return CodeStub::GetCodeCopy(isolate, pattern); 1209 return CodeStub::GetCodeCopy(isolate, pattern);
1181 } 1210 }
1182 1211
(...skipping 25 matching lines...) Expand all
1208 const BinaryOpIC::State& state); 1237 const BinaryOpIC::State& state);
1209 1238
1210 BinaryOpIC::State state_; 1239 BinaryOpIC::State state_;
1211 1240
1212 DISALLOW_COPY_AND_ASSIGN(BinaryOpICWithAllocationSiteStub); 1241 DISALLOW_COPY_AND_ASSIGN(BinaryOpICWithAllocationSiteStub);
1213 }; 1242 };
1214 1243
1215 1244
1216 class BinaryOpWithAllocationSiteStub V8_FINAL : public BinaryOpICStub { 1245 class BinaryOpWithAllocationSiteStub V8_FINAL : public BinaryOpICStub {
1217 public: 1246 public:
1218 BinaryOpWithAllocationSiteStub(Token::Value op, OverwriteMode mode) 1247 BinaryOpWithAllocationSiteStub(Isolate* isolate,
1219 : BinaryOpICStub(op, mode) {} 1248 Token::Value op,
1249 OverwriteMode mode)
1250 : BinaryOpICStub(isolate, op, mode) {}
1220 1251
1221 explicit BinaryOpWithAllocationSiteStub(const BinaryOpIC::State& state) 1252 BinaryOpWithAllocationSiteStub(Isolate* isolate,
1222 : BinaryOpICStub(state) {} 1253 const BinaryOpIC::State& state)
1254 : BinaryOpICStub(isolate, state) {}
1223 1255
1224 virtual void InitializeInterfaceDescriptor( 1256 virtual void InitializeInterfaceDescriptor(
1225 Isolate* isolate, CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; 1257 Isolate* isolate, CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE;
1226 1258
1227 static void InstallDescriptors(Isolate* isolate); 1259 static void InstallDescriptors(Isolate* isolate);
1228 1260
1229 virtual Code::Kind GetCodeKind() const V8_FINAL V8_OVERRIDE { 1261 virtual Code::Kind GetCodeKind() const V8_FINAL V8_OVERRIDE {
1230 return Code::STUB; 1262 return Code::STUB;
1231 } 1263 }
1232 1264
(...skipping 17 matching lines...) Expand all
1250 STRING_ADD_CHECK_LEFT = 1 << 0, 1282 STRING_ADD_CHECK_LEFT = 1 << 0,
1251 // Check right parameter. 1283 // Check right parameter.
1252 STRING_ADD_CHECK_RIGHT = 1 << 1, 1284 STRING_ADD_CHECK_RIGHT = 1 << 1,
1253 // Check both parameters. 1285 // Check both parameters.
1254 STRING_ADD_CHECK_BOTH = STRING_ADD_CHECK_LEFT | STRING_ADD_CHECK_RIGHT 1286 STRING_ADD_CHECK_BOTH = STRING_ADD_CHECK_LEFT | STRING_ADD_CHECK_RIGHT
1255 }; 1287 };
1256 1288
1257 1289
1258 class StringAddStub V8_FINAL : public HydrogenCodeStub { 1290 class StringAddStub V8_FINAL : public HydrogenCodeStub {
1259 public: 1291 public:
1260 StringAddStub(StringAddFlags flags, PretenureFlag pretenure_flag) 1292 StringAddStub(Isolate* isolate,
1261 : bit_field_(StringAddFlagsBits::encode(flags) | 1293 StringAddFlags flags,
1294 PretenureFlag pretenure_flag)
1295 : HydrogenCodeStub(isolate),
1296 bit_field_(StringAddFlagsBits::encode(flags) |
1262 PretenureFlagBits::encode(pretenure_flag)) {} 1297 PretenureFlagBits::encode(pretenure_flag)) {}
1263 1298
1264 StringAddFlags flags() const { 1299 StringAddFlags flags() const {
1265 return StringAddFlagsBits::decode(bit_field_); 1300 return StringAddFlagsBits::decode(bit_field_);
1266 } 1301 }
1267 1302
1268 PretenureFlag pretenure_flag() const { 1303 PretenureFlag pretenure_flag() const {
1269 return PretenureFlagBits::decode(bit_field_); 1304 return PretenureFlagBits::decode(bit_field_);
1270 } 1305 }
1271 1306
(...skipping 22 matching lines...) Expand all
1294 virtual int NotMissMinorKey() V8_OVERRIDE { return bit_field_; } 1329 virtual int NotMissMinorKey() V8_OVERRIDE { return bit_field_; }
1295 1330
1296 virtual void PrintBaseName(StringStream* stream) V8_OVERRIDE; 1331 virtual void PrintBaseName(StringStream* stream) V8_OVERRIDE;
1297 1332
1298 DISALLOW_COPY_AND_ASSIGN(StringAddStub); 1333 DISALLOW_COPY_AND_ASSIGN(StringAddStub);
1299 }; 1334 };
1300 1335
1301 1336
1302 class ICCompareStub: public PlatformCodeStub { 1337 class ICCompareStub: public PlatformCodeStub {
1303 public: 1338 public:
1304 ICCompareStub(Token::Value op, 1339 ICCompareStub(Isolate* isolate,
1340 Token::Value op,
1305 CompareIC::State left, 1341 CompareIC::State left,
1306 CompareIC::State right, 1342 CompareIC::State right,
1307 CompareIC::State handler) 1343 CompareIC::State handler)
1308 : op_(op), 1344 : PlatformCodeStub(isolate),
1345 op_(op),
1309 left_(left), 1346 left_(left),
1310 right_(right), 1347 right_(right),
1311 state_(handler) { 1348 state_(handler) {
1312 ASSERT(Token::IsCompareOp(op)); 1349 ASSERT(Token::IsCompareOp(op));
1313 } 1350 }
1314 1351
1315 virtual void Generate(MacroAssembler* masm); 1352 virtual void Generate(MacroAssembler* masm);
1316 1353
1317 void set_known_map(Handle<Map> map) { known_map_ = map; } 1354 void set_known_map(Handle<Map> map) { known_map_ = map; }
1318 1355
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1362 CompareIC::State state_; 1399 CompareIC::State state_;
1363 Handle<Map> known_map_; 1400 Handle<Map> known_map_;
1364 }; 1401 };
1365 1402
1366 1403
1367 class CompareNilICStub : public HydrogenCodeStub { 1404 class CompareNilICStub : public HydrogenCodeStub {
1368 public: 1405 public:
1369 Type* GetType(Zone* zone, Handle<Map> map = Handle<Map>()); 1406 Type* GetType(Zone* zone, Handle<Map> map = Handle<Map>());
1370 Type* GetInputType(Zone* zone, Handle<Map> map); 1407 Type* GetInputType(Zone* zone, Handle<Map> map);
1371 1408
1372 explicit CompareNilICStub(NilValue nil) : nil_value_(nil) { } 1409 CompareNilICStub(Isolate* isolate, NilValue nil)
1410 : HydrogenCodeStub(isolate), nil_value_(nil) { }
1373 1411
1374 CompareNilICStub(ExtraICState ic_state, 1412 CompareNilICStub(Isolate* isolate,
1413 ExtraICState ic_state,
1375 InitializationState init_state = INITIALIZED) 1414 InitializationState init_state = INITIALIZED)
1376 : HydrogenCodeStub(init_state), 1415 : HydrogenCodeStub(isolate, init_state),
1377 nil_value_(NilValueField::decode(ic_state)), 1416 nil_value_(NilValueField::decode(ic_state)),
1378 state_(State(TypesField::decode(ic_state))) { 1417 state_(State(TypesField::decode(ic_state))) {
1379 } 1418 }
1380 1419
1381 static Handle<Code> GetUninitialized(Isolate* isolate, 1420 static Handle<Code> GetUninitialized(Isolate* isolate,
1382 NilValue nil) { 1421 NilValue nil) {
1383 return CompareNilICStub(nil, UNINITIALIZED).GetCode(isolate); 1422 return CompareNilICStub(isolate, nil, UNINITIALIZED).GetCode(isolate);
1384 } 1423 }
1385 1424
1386 virtual void InitializeInterfaceDescriptor( 1425 virtual void InitializeInterfaceDescriptor(
1387 Isolate* isolate, 1426 Isolate* isolate,
1388 CodeStubInterfaceDescriptor* descriptor); 1427 CodeStubInterfaceDescriptor* descriptor);
1389 1428
1390 static void InstallDescriptors(Isolate* isolate) { 1429 static void InstallDescriptors(Isolate* isolate) {
1391 CompareNilICStub compare_stub(kNullValue, UNINITIALIZED); 1430 CompareNilICStub compare_stub(isolate, kNullValue, UNINITIALIZED);
1392 compare_stub.InitializeInterfaceDescriptor( 1431 compare_stub.InitializeInterfaceDescriptor(
1393 isolate, 1432 isolate,
1394 isolate->code_stub_interface_descriptor(CodeStub::CompareNilIC)); 1433 isolate->code_stub_interface_descriptor(CodeStub::CompareNilIC));
1395 } 1434 }
1396 1435
1397 virtual InlineCacheState GetICState() { 1436 virtual InlineCacheState GetICState() {
1398 if (state_.Contains(GENERIC)) { 1437 if (state_.Contains(GENERIC)) {
1399 return MEGAMORPHIC; 1438 return MEGAMORPHIC;
1400 } else if (state_.Contains(MONOMORPHIC_MAP)) { 1439 } else if (state_.Contains(MONOMORPHIC_MAP)) {
1401 return MONOMORPHIC; 1440 return MONOMORPHIC;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1439 STATIC_ASSERT(NUMBER_OF_TYPES <= 6); 1478 STATIC_ASSERT(NUMBER_OF_TYPES <= 6);
1440 1479
1441 class State : public EnumSet<CompareNilType, byte> { 1480 class State : public EnumSet<CompareNilType, byte> {
1442 public: 1481 public:
1443 State() : EnumSet<CompareNilType, byte>(0) { } 1482 State() : EnumSet<CompareNilType, byte>(0) { }
1444 explicit State(byte bits) : EnumSet<CompareNilType, byte>(bits) { } 1483 explicit State(byte bits) : EnumSet<CompareNilType, byte>(bits) { }
1445 1484
1446 void Print(StringStream* stream) const; 1485 void Print(StringStream* stream) const;
1447 }; 1486 };
1448 1487
1449 CompareNilICStub(NilValue nil, InitializationState init_state) 1488 CompareNilICStub(Isolate* isolate,
1450 : HydrogenCodeStub(init_state), nil_value_(nil) { } 1489 NilValue nil,
1490 InitializationState init_state)
1491 : HydrogenCodeStub(isolate, init_state), nil_value_(nil) { }
1451 1492
1452 class NilValueField : public BitField<NilValue, 0, 1> {}; 1493 class NilValueField : public BitField<NilValue, 0, 1> {};
1453 class TypesField : public BitField<byte, 1, NUMBER_OF_TYPES> {}; 1494 class TypesField : public BitField<byte, 1, NUMBER_OF_TYPES> {};
1454 1495
1455 virtual CodeStub::Major MajorKey() { return CompareNilIC; } 1496 virtual CodeStub::Major MajorKey() { return CompareNilIC; }
1456 virtual int NotMissMinorKey() { return GetExtraICState(); } 1497 virtual int NotMissMinorKey() { return GetExtraICState(); }
1457 1498
1458 NilValue nil_value_; 1499 NilValue nil_value_;
1459 State state_; 1500 State state_;
1460 1501
1461 DISALLOW_COPY_AND_ASSIGN(CompareNilICStub); 1502 DISALLOW_COPY_AND_ASSIGN(CompareNilICStub);
1462 }; 1503 };
1463 1504
1464 1505
1465 class CEntryStub : public PlatformCodeStub { 1506 class CEntryStub : public PlatformCodeStub {
1466 public: 1507 public:
1467 explicit CEntryStub(int result_size, 1508 CEntryStub(Isolate* isolate,
1468 SaveFPRegsMode save_doubles = kDontSaveFPRegs) 1509 int result_size,
1469 : result_size_(result_size), save_doubles_(save_doubles) { } 1510 SaveFPRegsMode save_doubles = kDontSaveFPRegs)
1511 : PlatformCodeStub(isolate),
1512 result_size_(result_size),
1513 save_doubles_(save_doubles) { }
1470 1514
1471 void Generate(MacroAssembler* masm); 1515 void Generate(MacroAssembler* masm);
1472 1516
1473 // The version of this stub that doesn't save doubles is generated ahead of 1517 // The version of this stub that doesn't save doubles is generated ahead of
1474 // time, so it's OK to call it from other stubs that can't cope with GC during 1518 // time, so it's OK to call it from other stubs that can't cope with GC during
1475 // their code generation. On machines that always have gp registers (x64) we 1519 // their code generation. On machines that always have gp registers (x64) we
1476 // can generate both variants ahead of time. 1520 // can generate both variants ahead of time.
1477 static void GenerateAheadOfTime(Isolate* isolate); 1521 static void GenerateAheadOfTime(Isolate* isolate);
1478 1522
1479 protected: 1523 protected:
1480 virtual void VerifyPlatformFeatures(Isolate* isolate) V8_OVERRIDE { 1524 virtual void VerifyPlatformFeatures(Isolate* isolate) V8_OVERRIDE {
1481 ASSERT(CpuFeatures::VerifyCrossCompiling(SSE2)); 1525 ASSERT(CpuFeatures::VerifyCrossCompiling(SSE2));
1482 }; 1526 };
1483 1527
1484 private: 1528 private:
1485 // Number of pointers/values returned. 1529 // Number of pointers/values returned.
1486 Isolate* isolate_; 1530 Isolate* isolate_;
1487 const int result_size_; 1531 const int result_size_;
1488 SaveFPRegsMode save_doubles_; 1532 SaveFPRegsMode save_doubles_;
1489 1533
1490 Major MajorKey() { return CEntry; } 1534 Major MajorKey() { return CEntry; }
1491 int MinorKey(); 1535 int MinorKey();
1492 1536
1493 bool NeedsImmovableCode(); 1537 bool NeedsImmovableCode();
1494 }; 1538 };
1495 1539
1496 1540
1497 class JSEntryStub : public PlatformCodeStub { 1541 class JSEntryStub : public PlatformCodeStub {
1498 public: 1542 public:
1499 JSEntryStub() { } 1543 explicit JSEntryStub(Isolate* isolate) : PlatformCodeStub(isolate) { }
1500 1544
1501 void Generate(MacroAssembler* masm) { GenerateBody(masm, false); } 1545 void Generate(MacroAssembler* masm) { GenerateBody(masm, false); }
1502 1546
1503 protected: 1547 protected:
1504 void GenerateBody(MacroAssembler* masm, bool is_construct); 1548 void GenerateBody(MacroAssembler* masm, bool is_construct);
1505 1549
1506 private: 1550 private:
1507 Major MajorKey() { return JSEntry; } 1551 Major MajorKey() { return JSEntry; }
1508 int MinorKey() { return 0; } 1552 int MinorKey() { return 0; }
1509 1553
1510 virtual void FinishCode(Handle<Code> code); 1554 virtual void FinishCode(Handle<Code> code);
1511 1555
1512 int handler_offset_; 1556 int handler_offset_;
1513 }; 1557 };
1514 1558
1515 1559
1516 class JSConstructEntryStub : public JSEntryStub { 1560 class JSConstructEntryStub : public JSEntryStub {
1517 public: 1561 public:
1518 JSConstructEntryStub() { } 1562 explicit JSConstructEntryStub(Isolate* isolate) : JSEntryStub(isolate) { }
1519 1563
1520 void Generate(MacroAssembler* masm) { GenerateBody(masm, true); } 1564 void Generate(MacroAssembler* masm) { GenerateBody(masm, true); }
1521 1565
1522 private: 1566 private:
1523 int MinorKey() { return 1; } 1567 int MinorKey() { return 1; }
1524 1568
1525 virtual void PrintName(StringStream* stream) { 1569 virtual void PrintName(StringStream* stream) {
1526 stream->Add("JSConstructEntryStub"); 1570 stream->Add("JSConstructEntryStub");
1527 } 1571 }
1528 }; 1572 };
1529 1573
1530 1574
1531 class ArgumentsAccessStub: public PlatformCodeStub { 1575 class ArgumentsAccessStub: public PlatformCodeStub {
1532 public: 1576 public:
1533 enum Type { 1577 enum Type {
1534 READ_ELEMENT, 1578 READ_ELEMENT,
1535 NEW_SLOPPY_FAST, 1579 NEW_SLOPPY_FAST,
1536 NEW_SLOPPY_SLOW, 1580 NEW_SLOPPY_SLOW,
1537 NEW_STRICT 1581 NEW_STRICT
1538 }; 1582 };
1539 1583
1540 explicit ArgumentsAccessStub(Type type) : type_(type) { } 1584 ArgumentsAccessStub(Isolate* isolate, Type type)
1585 : PlatformCodeStub(isolate), type_(type) { }
1541 1586
1542 private: 1587 private:
1543 Type type_; 1588 Type type_;
1544 1589
1545 Major MajorKey() { return ArgumentsAccess; } 1590 Major MajorKey() { return ArgumentsAccess; }
1546 int MinorKey() { return type_; } 1591 int MinorKey() { return type_; }
1547 1592
1548 void Generate(MacroAssembler* masm); 1593 void Generate(MacroAssembler* masm);
1549 void GenerateReadElement(MacroAssembler* masm); 1594 void GenerateReadElement(MacroAssembler* masm);
1550 void GenerateNewStrict(MacroAssembler* masm); 1595 void GenerateNewStrict(MacroAssembler* masm);
1551 void GenerateNewSloppyFast(MacroAssembler* masm); 1596 void GenerateNewSloppyFast(MacroAssembler* masm);
1552 void GenerateNewSloppySlow(MacroAssembler* masm); 1597 void GenerateNewSloppySlow(MacroAssembler* masm);
1553 1598
1554 virtual void PrintName(StringStream* stream); 1599 virtual void PrintName(StringStream* stream);
1555 }; 1600 };
1556 1601
1557 1602
1558 class RegExpExecStub: public PlatformCodeStub { 1603 class RegExpExecStub: public PlatformCodeStub {
1559 public: 1604 public:
1560 RegExpExecStub() { } 1605 explicit RegExpExecStub(Isolate* isolate) : PlatformCodeStub(isolate) { }
1561 1606
1562 private: 1607 private:
1563 Major MajorKey() { return RegExpExec; } 1608 Major MajorKey() { return RegExpExec; }
1564 int MinorKey() { return 0; } 1609 int MinorKey() { return 0; }
1565 1610
1566 void Generate(MacroAssembler* masm); 1611 void Generate(MacroAssembler* masm);
1567 }; 1612 };
1568 1613
1569 1614
1570 class RegExpConstructResultStub V8_FINAL : public HydrogenCodeStub { 1615 class RegExpConstructResultStub V8_FINAL : public HydrogenCodeStub {
1571 public: 1616 public:
1572 RegExpConstructResultStub() { } 1617 explicit RegExpConstructResultStub(Isolate* isolate)
1618 : HydrogenCodeStub(isolate) { }
1573 1619
1574 virtual Handle<Code> GenerateCode(Isolate* isolate) V8_OVERRIDE; 1620 virtual Handle<Code> GenerateCode(Isolate* isolate) V8_OVERRIDE;
1575 1621
1576 virtual void InitializeInterfaceDescriptor( 1622 virtual void InitializeInterfaceDescriptor(
1577 Isolate* isolate, 1623 Isolate* isolate,
1578 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; 1624 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE;
1579 1625
1580 virtual Major MajorKey() V8_OVERRIDE { return RegExpConstructResult; } 1626 virtual Major MajorKey() V8_OVERRIDE { return RegExpConstructResult; }
1581 virtual int NotMissMinorKey() V8_OVERRIDE { return 0; } 1627 virtual int NotMissMinorKey() V8_OVERRIDE { return 0; }
1582 1628
1583 static void InstallDescriptors(Isolate* isolate); 1629 static void InstallDescriptors(Isolate* isolate);
1584 1630
1585 // Parameters accessed via CodeStubGraphBuilder::GetParameter() 1631 // Parameters accessed via CodeStubGraphBuilder::GetParameter()
1586 static const int kLength = 0; 1632 static const int kLength = 0;
1587 static const int kIndex = 1; 1633 static const int kIndex = 1;
1588 static const int kInput = 2; 1634 static const int kInput = 2;
1589 1635
1590 private: 1636 private:
1591 DISALLOW_COPY_AND_ASSIGN(RegExpConstructResultStub); 1637 DISALLOW_COPY_AND_ASSIGN(RegExpConstructResultStub);
1592 }; 1638 };
1593 1639
1594 1640
1595 class CallFunctionStub: public PlatformCodeStub { 1641 class CallFunctionStub: public PlatformCodeStub {
1596 public: 1642 public:
1597 CallFunctionStub(int argc, CallFunctionFlags flags) 1643 CallFunctionStub(Isolate* isolate, int argc, CallFunctionFlags flags)
1598 : argc_(argc), flags_(flags) { } 1644 : PlatformCodeStub(isolate), argc_(argc), flags_(flags) { }
1599 1645
1600 void Generate(MacroAssembler* masm); 1646 void Generate(MacroAssembler* masm);
1601 1647
1602 virtual void FinishCode(Handle<Code> code) { 1648 virtual void FinishCode(Handle<Code> code) {
1603 code->set_has_function_cache(RecordCallTarget()); 1649 code->set_has_function_cache(RecordCallTarget());
1604 } 1650 }
1605 1651
1606 static int ExtractArgcFromMinorKey(int minor_key) { 1652 static int ExtractArgcFromMinorKey(int minor_key) {
1607 return ArgcBits::decode(minor_key); 1653 return ArgcBits::decode(minor_key);
1608 } 1654 }
(...skipping 23 matching lines...) Expand all
1632 } 1678 }
1633 1679
1634 bool NeedsChecks() { 1680 bool NeedsChecks() {
1635 return flags_ != WRAP_AND_CALL; 1681 return flags_ != WRAP_AND_CALL;
1636 } 1682 }
1637 }; 1683 };
1638 1684
1639 1685
1640 class CallConstructStub: public PlatformCodeStub { 1686 class CallConstructStub: public PlatformCodeStub {
1641 public: 1687 public:
1642 explicit CallConstructStub(CallFunctionFlags flags) : flags_(flags) {} 1688 CallConstructStub(Isolate* isolate, CallFunctionFlags flags)
1689 : PlatformCodeStub(isolate), flags_(flags) {}
1643 1690
1644 void Generate(MacroAssembler* masm); 1691 void Generate(MacroAssembler* masm);
1645 1692
1646 virtual void FinishCode(Handle<Code> code) { 1693 virtual void FinishCode(Handle<Code> code) {
1647 code->set_has_function_cache(RecordCallTarget()); 1694 code->set_has_function_cache(RecordCallTarget());
1648 } 1695 }
1649 1696
1650 private: 1697 private:
1651 CallFunctionFlags flags_; 1698 CallFunctionFlags flags_;
1652 1699
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1834 private: 1881 private:
1835 StringCharCodeAtGenerator char_code_at_generator_; 1882 StringCharCodeAtGenerator char_code_at_generator_;
1836 StringCharFromCodeGenerator char_from_code_generator_; 1883 StringCharFromCodeGenerator char_from_code_generator_;
1837 1884
1838 DISALLOW_COPY_AND_ASSIGN(StringCharAtGenerator); 1885 DISALLOW_COPY_AND_ASSIGN(StringCharAtGenerator);
1839 }; 1886 };
1840 1887
1841 1888
1842 class KeyedLoadDictionaryElementStub : public HydrogenCodeStub { 1889 class KeyedLoadDictionaryElementStub : public HydrogenCodeStub {
1843 public: 1890 public:
1844 KeyedLoadDictionaryElementStub() {} 1891 explicit KeyedLoadDictionaryElementStub(Isolate* isolate)
1892 : HydrogenCodeStub(isolate) {}
1845 1893
1846 virtual Handle<Code> GenerateCode(Isolate* isolate) V8_OVERRIDE; 1894 virtual Handle<Code> GenerateCode(Isolate* isolate) V8_OVERRIDE;
1847 1895
1848 virtual void InitializeInterfaceDescriptor( 1896 virtual void InitializeInterfaceDescriptor(
1849 Isolate* isolate, 1897 Isolate* isolate,
1850 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; 1898 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE;
1851 1899
1852 private: 1900 private:
1853 Major MajorKey() { return KeyedLoadElement; } 1901 Major MajorKey() { return KeyedLoadElement; }
1854 int NotMissMinorKey() { return DICTIONARY_ELEMENTS; } 1902 int NotMissMinorKey() { return DICTIONARY_ELEMENTS; }
1855 1903
1856 DISALLOW_COPY_AND_ASSIGN(KeyedLoadDictionaryElementStub); 1904 DISALLOW_COPY_AND_ASSIGN(KeyedLoadDictionaryElementStub);
1857 }; 1905 };
1858 1906
1859 1907
1860 class KeyedLoadDictionaryElementPlatformStub : public PlatformCodeStub { 1908 class KeyedLoadDictionaryElementPlatformStub : public PlatformCodeStub {
1861 public: 1909 public:
1862 KeyedLoadDictionaryElementPlatformStub() {} 1910 explicit KeyedLoadDictionaryElementPlatformStub(Isolate* isolate)
1911 : PlatformCodeStub(isolate) {}
1863 1912
1864 void Generate(MacroAssembler* masm); 1913 void Generate(MacroAssembler* masm);
1865 1914
1866 private: 1915 private:
1867 Major MajorKey() { return KeyedLoadElement; } 1916 Major MajorKey() { return KeyedLoadElement; }
1868 int MinorKey() { return DICTIONARY_ELEMENTS; } 1917 int MinorKey() { return DICTIONARY_ELEMENTS; }
1869 1918
1870 DISALLOW_COPY_AND_ASSIGN(KeyedLoadDictionaryElementPlatformStub); 1919 DISALLOW_COPY_AND_ASSIGN(KeyedLoadDictionaryElementPlatformStub);
1871 }; 1920 };
1872 1921
1873 1922
1874 class DoubleToIStub : public PlatformCodeStub { 1923 class DoubleToIStub : public PlatformCodeStub {
1875 public: 1924 public:
1876 DoubleToIStub(Register source, 1925 DoubleToIStub(Isolate* isolate,
1926 Register source,
1877 Register destination, 1927 Register destination,
1878 int offset, 1928 int offset,
1879 bool is_truncating, 1929 bool is_truncating,
1880 bool skip_fastpath = false) : bit_field_(0) { 1930 bool skip_fastpath = false)
1931 : PlatformCodeStub(isolate), bit_field_(0) {
1881 bit_field_ = SourceRegisterBits::encode(source.code()) | 1932 bit_field_ = SourceRegisterBits::encode(source.code()) |
1882 DestinationRegisterBits::encode(destination.code()) | 1933 DestinationRegisterBits::encode(destination.code()) |
1883 OffsetBits::encode(offset) | 1934 OffsetBits::encode(offset) |
1884 IsTruncatingBits::encode(is_truncating) | 1935 IsTruncatingBits::encode(is_truncating) |
1885 SkipFastPathBits::encode(skip_fastpath) | 1936 SkipFastPathBits::encode(skip_fastpath) |
1886 SSEBits::encode(CpuFeatures::IsSafeForSnapshot(SSE2) ? 1937 SSEBits::encode(CpuFeatures::IsSafeForSnapshot(SSE2) ?
1887 CpuFeatures::IsSafeForSnapshot(SSE3) ? 2 : 1 : 0); 1938 CpuFeatures::IsSafeForSnapshot(SSE3) ? 2 : 1 : 0);
1888 } 1939 }
1889 1940
1890 Register source() { 1941 Register source() {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1937 int MinorKey() { return bit_field_; } 1988 int MinorKey() { return bit_field_; }
1938 1989
1939 int bit_field_; 1990 int bit_field_;
1940 1991
1941 DISALLOW_COPY_AND_ASSIGN(DoubleToIStub); 1992 DISALLOW_COPY_AND_ASSIGN(DoubleToIStub);
1942 }; 1993 };
1943 1994
1944 1995
1945 class KeyedLoadFastElementStub : public HydrogenCodeStub { 1996 class KeyedLoadFastElementStub : public HydrogenCodeStub {
1946 public: 1997 public:
1947 KeyedLoadFastElementStub(bool is_js_array, ElementsKind elements_kind) { 1998 KeyedLoadFastElementStub(Isolate* isolate,
1999 bool is_js_array,
2000 ElementsKind elements_kind)
2001 : HydrogenCodeStub(isolate) {
1948 bit_field_ = ElementsKindBits::encode(elements_kind) | 2002 bit_field_ = ElementsKindBits::encode(elements_kind) |
1949 IsJSArrayBits::encode(is_js_array); 2003 IsJSArrayBits::encode(is_js_array);
1950 } 2004 }
1951 2005
1952 bool is_js_array() const { 2006 bool is_js_array() const {
1953 return IsJSArrayBits::decode(bit_field_); 2007 return IsJSArrayBits::decode(bit_field_);
1954 } 2008 }
1955 2009
1956 ElementsKind elements_kind() const { 2010 ElementsKind elements_kind() const {
1957 return ElementsKindBits::decode(bit_field_); 2011 return ElementsKindBits::decode(bit_field_);
(...skipping 12 matching lines...) Expand all
1970 2024
1971 Major MajorKey() { return KeyedLoadElement; } 2025 Major MajorKey() { return KeyedLoadElement; }
1972 int NotMissMinorKey() { return bit_field_; } 2026 int NotMissMinorKey() { return bit_field_; }
1973 2027
1974 DISALLOW_COPY_AND_ASSIGN(KeyedLoadFastElementStub); 2028 DISALLOW_COPY_AND_ASSIGN(KeyedLoadFastElementStub);
1975 }; 2029 };
1976 2030
1977 2031
1978 class KeyedStoreFastElementStub : public HydrogenCodeStub { 2032 class KeyedStoreFastElementStub : public HydrogenCodeStub {
1979 public: 2033 public:
1980 KeyedStoreFastElementStub(bool is_js_array, 2034 KeyedStoreFastElementStub(Isolate* isolate,
2035 bool is_js_array,
1981 ElementsKind elements_kind, 2036 ElementsKind elements_kind,
1982 KeyedAccessStoreMode mode) { 2037 KeyedAccessStoreMode mode)
2038 : HydrogenCodeStub(isolate) {
1983 bit_field_ = ElementsKindBits::encode(elements_kind) | 2039 bit_field_ = ElementsKindBits::encode(elements_kind) |
1984 IsJSArrayBits::encode(is_js_array) | 2040 IsJSArrayBits::encode(is_js_array) |
1985 StoreModeBits::encode(mode); 2041 StoreModeBits::encode(mode);
1986 } 2042 }
1987 2043
1988 bool is_js_array() const { 2044 bool is_js_array() const {
1989 return IsJSArrayBits::decode(bit_field_); 2045 return IsJSArrayBits::decode(bit_field_);
1990 } 2046 }
1991 2047
1992 ElementsKind elements_kind() const { 2048 ElementsKind elements_kind() const {
(...skipping 18 matching lines...) Expand all
2011 2067
2012 Major MajorKey() { return KeyedStoreElement; } 2068 Major MajorKey() { return KeyedStoreElement; }
2013 int NotMissMinorKey() { return bit_field_; } 2069 int NotMissMinorKey() { return bit_field_; }
2014 2070
2015 DISALLOW_COPY_AND_ASSIGN(KeyedStoreFastElementStub); 2071 DISALLOW_COPY_AND_ASSIGN(KeyedStoreFastElementStub);
2016 }; 2072 };
2017 2073
2018 2074
2019 class TransitionElementsKindStub : public HydrogenCodeStub { 2075 class TransitionElementsKindStub : public HydrogenCodeStub {
2020 public: 2076 public:
2021 TransitionElementsKindStub(ElementsKind from_kind, 2077 TransitionElementsKindStub(Isolate* isolate,
2078 ElementsKind from_kind,
2022 ElementsKind to_kind, 2079 ElementsKind to_kind,
2023 bool is_js_array) { 2080 bool is_js_array) : HydrogenCodeStub(isolate) {
2024 bit_field_ = FromKindBits::encode(from_kind) | 2081 bit_field_ = FromKindBits::encode(from_kind) |
2025 ToKindBits::encode(to_kind) | 2082 ToKindBits::encode(to_kind) |
2026 IsJSArrayBits::encode(is_js_array); 2083 IsJSArrayBits::encode(is_js_array);
2027 } 2084 }
2028 2085
2029 ElementsKind from_kind() const { 2086 ElementsKind from_kind() const {
2030 return FromKindBits::decode(bit_field_); 2087 return FromKindBits::decode(bit_field_);
2031 } 2088 }
2032 2089
2033 ElementsKind to_kind() const { 2090 ElementsKind to_kind() const {
(...skipping 18 matching lines...) Expand all
2052 2109
2053 Major MajorKey() { return TransitionElementsKind; } 2110 Major MajorKey() { return TransitionElementsKind; }
2054 int NotMissMinorKey() { return bit_field_; } 2111 int NotMissMinorKey() { return bit_field_; }
2055 2112
2056 DISALLOW_COPY_AND_ASSIGN(TransitionElementsKindStub); 2113 DISALLOW_COPY_AND_ASSIGN(TransitionElementsKindStub);
2057 }; 2114 };
2058 2115
2059 2116
2060 class ArrayConstructorStubBase : public HydrogenCodeStub { 2117 class ArrayConstructorStubBase : public HydrogenCodeStub {
2061 public: 2118 public:
2062 ArrayConstructorStubBase(ElementsKind kind, 2119 ArrayConstructorStubBase(Isolate* isolate,
2063 AllocationSiteOverrideMode override_mode) { 2120 ElementsKind kind,
2121 AllocationSiteOverrideMode override_mode)
2122 : HydrogenCodeStub(isolate) {
2064 // It only makes sense to override local allocation site behavior 2123 // It only makes sense to override local allocation site behavior
2065 // if there is a difference between the global allocation site policy 2124 // if there is a difference between the global allocation site policy
2066 // for an ElementsKind and the desired usage of the stub. 2125 // for an ElementsKind and the desired usage of the stub.
2067 ASSERT(override_mode != DISABLE_ALLOCATION_SITES || 2126 ASSERT(override_mode != DISABLE_ALLOCATION_SITES ||
2068 AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE); 2127 AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE);
2069 bit_field_ = ElementsKindBits::encode(kind) | 2128 bit_field_ = ElementsKindBits::encode(kind) |
2070 AllocationSiteOverrideModeBits::encode(override_mode); 2129 AllocationSiteOverrideModeBits::encode(override_mode);
2071 } 2130 }
2072 2131
2073 ElementsKind elements_kind() const { 2132 ElementsKind elements_kind() const {
(...skipping 25 matching lines...) Expand all
2099 BitField<AllocationSiteOverrideMode, 8, 1> {}; // NOLINT 2158 BitField<AllocationSiteOverrideMode, 8, 1> {}; // NOLINT
2100 uint32_t bit_field_; 2159 uint32_t bit_field_;
2101 2160
2102 DISALLOW_COPY_AND_ASSIGN(ArrayConstructorStubBase); 2161 DISALLOW_COPY_AND_ASSIGN(ArrayConstructorStubBase);
2103 }; 2162 };
2104 2163
2105 2164
2106 class ArrayNoArgumentConstructorStub : public ArrayConstructorStubBase { 2165 class ArrayNoArgumentConstructorStub : public ArrayConstructorStubBase {
2107 public: 2166 public:
2108 ArrayNoArgumentConstructorStub( 2167 ArrayNoArgumentConstructorStub(
2168 Isolate* isolate,
2109 ElementsKind kind, 2169 ElementsKind kind,
2110 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) 2170 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE)
2111 : ArrayConstructorStubBase(kind, override_mode) { 2171 : ArrayConstructorStubBase(isolate, kind, override_mode) {
2112 } 2172 }
2113 2173
2114 virtual Handle<Code> GenerateCode(Isolate* isolate); 2174 virtual Handle<Code> GenerateCode(Isolate* isolate);
2115 2175
2116 virtual void InitializeInterfaceDescriptor( 2176 virtual void InitializeInterfaceDescriptor(
2117 Isolate* isolate, 2177 Isolate* isolate,
2118 CodeStubInterfaceDescriptor* descriptor); 2178 CodeStubInterfaceDescriptor* descriptor);
2119 2179
2120 private: 2180 private:
2121 Major MajorKey() { return ArrayNoArgumentConstructor; } 2181 Major MajorKey() { return ArrayNoArgumentConstructor; }
2122 2182
2123 virtual void PrintName(StringStream* stream) { 2183 virtual void PrintName(StringStream* stream) {
2124 BasePrintName("ArrayNoArgumentConstructorStub", stream); 2184 BasePrintName("ArrayNoArgumentConstructorStub", stream);
2125 } 2185 }
2126 2186
2127 DISALLOW_COPY_AND_ASSIGN(ArrayNoArgumentConstructorStub); 2187 DISALLOW_COPY_AND_ASSIGN(ArrayNoArgumentConstructorStub);
2128 }; 2188 };
2129 2189
2130 2190
2131 class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase { 2191 class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase {
2132 public: 2192 public:
2133 ArraySingleArgumentConstructorStub( 2193 ArraySingleArgumentConstructorStub(
2194 Isolate* isolate,
2134 ElementsKind kind, 2195 ElementsKind kind,
2135 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) 2196 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE)
2136 : ArrayConstructorStubBase(kind, override_mode) { 2197 : ArrayConstructorStubBase(isolate, kind, override_mode) {
2137 } 2198 }
2138 2199
2139 virtual Handle<Code> GenerateCode(Isolate* isolate); 2200 virtual Handle<Code> GenerateCode(Isolate* isolate);
2140 2201
2141 virtual void InitializeInterfaceDescriptor( 2202 virtual void InitializeInterfaceDescriptor(
2142 Isolate* isolate, 2203 Isolate* isolate,
2143 CodeStubInterfaceDescriptor* descriptor); 2204 CodeStubInterfaceDescriptor* descriptor);
2144 2205
2145 private: 2206 private:
2146 Major MajorKey() { return ArraySingleArgumentConstructor; } 2207 Major MajorKey() { return ArraySingleArgumentConstructor; }
2147 2208
2148 virtual void PrintName(StringStream* stream) { 2209 virtual void PrintName(StringStream* stream) {
2149 BasePrintName("ArraySingleArgumentConstructorStub", stream); 2210 BasePrintName("ArraySingleArgumentConstructorStub", stream);
2150 } 2211 }
2151 2212
2152 DISALLOW_COPY_AND_ASSIGN(ArraySingleArgumentConstructorStub); 2213 DISALLOW_COPY_AND_ASSIGN(ArraySingleArgumentConstructorStub);
2153 }; 2214 };
2154 2215
2155 2216
2156 class ArrayNArgumentsConstructorStub : public ArrayConstructorStubBase { 2217 class ArrayNArgumentsConstructorStub : public ArrayConstructorStubBase {
2157 public: 2218 public:
2158 ArrayNArgumentsConstructorStub( 2219 ArrayNArgumentsConstructorStub(
2220 Isolate* isolate,
2159 ElementsKind kind, 2221 ElementsKind kind,
2160 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) 2222 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE)
2161 : ArrayConstructorStubBase(kind, override_mode) { 2223 : ArrayConstructorStubBase(isolate, kind, override_mode) {
2162 } 2224 }
2163 2225
2164 virtual Handle<Code> GenerateCode(Isolate* isolate); 2226 virtual Handle<Code> GenerateCode(Isolate* isolate);
2165 2227
2166 virtual void InitializeInterfaceDescriptor( 2228 virtual void InitializeInterfaceDescriptor(
2167 Isolate* isolate, 2229 Isolate* isolate,
2168 CodeStubInterfaceDescriptor* descriptor); 2230 CodeStubInterfaceDescriptor* descriptor);
2169 2231
2170 private: 2232 private:
2171 Major MajorKey() { return ArrayNArgumentsConstructor; } 2233 Major MajorKey() { return ArrayNArgumentsConstructor; }
2172 2234
2173 virtual void PrintName(StringStream* stream) { 2235 virtual void PrintName(StringStream* stream) {
2174 BasePrintName("ArrayNArgumentsConstructorStub", stream); 2236 BasePrintName("ArrayNArgumentsConstructorStub", stream);
2175 } 2237 }
2176 2238
2177 DISALLOW_COPY_AND_ASSIGN(ArrayNArgumentsConstructorStub); 2239 DISALLOW_COPY_AND_ASSIGN(ArrayNArgumentsConstructorStub);
2178 }; 2240 };
2179 2241
2180 2242
2181 class InternalArrayConstructorStubBase : public HydrogenCodeStub { 2243 class InternalArrayConstructorStubBase : public HydrogenCodeStub {
2182 public: 2244 public:
2183 explicit InternalArrayConstructorStubBase(ElementsKind kind) { 2245 InternalArrayConstructorStubBase(Isolate* isolate, ElementsKind kind)
2246 : HydrogenCodeStub(isolate) {
2184 kind_ = kind; 2247 kind_ = kind;
2185 } 2248 }
2186 2249
2187 static void GenerateStubsAheadOfTime(Isolate* isolate); 2250 static void GenerateStubsAheadOfTime(Isolate* isolate);
2188 static void InstallDescriptors(Isolate* isolate); 2251 static void InstallDescriptors(Isolate* isolate);
2189 2252
2190 // Parameters accessed via CodeStubGraphBuilder::GetParameter() 2253 // Parameters accessed via CodeStubGraphBuilder::GetParameter()
2191 static const int kConstructor = 0; 2254 static const int kConstructor = 0;
2192 2255
2193 ElementsKind elements_kind() const { return kind_; } 2256 ElementsKind elements_kind() const { return kind_; }
2194 2257
2195 private: 2258 private:
2196 int NotMissMinorKey() { return kind_; } 2259 int NotMissMinorKey() { return kind_; }
2197 2260
2198 ElementsKind kind_; 2261 ElementsKind kind_;
2199 2262
2200 DISALLOW_COPY_AND_ASSIGN(InternalArrayConstructorStubBase); 2263 DISALLOW_COPY_AND_ASSIGN(InternalArrayConstructorStubBase);
2201 }; 2264 };
2202 2265
2203 2266
2204 class InternalArrayNoArgumentConstructorStub : public 2267 class InternalArrayNoArgumentConstructorStub : public
2205 InternalArrayConstructorStubBase { 2268 InternalArrayConstructorStubBase {
2206 public: 2269 public:
2207 explicit InternalArrayNoArgumentConstructorStub(ElementsKind kind) 2270 InternalArrayNoArgumentConstructorStub(Isolate* isolate,
2208 : InternalArrayConstructorStubBase(kind) { } 2271 ElementsKind kind)
2272 : InternalArrayConstructorStubBase(isolate, kind) { }
2209 2273
2210 virtual Handle<Code> GenerateCode(Isolate* isolate); 2274 virtual Handle<Code> GenerateCode(Isolate* isolate);
2211 2275
2212 virtual void InitializeInterfaceDescriptor( 2276 virtual void InitializeInterfaceDescriptor(
2213 Isolate* isolate, 2277 Isolate* isolate,
2214 CodeStubInterfaceDescriptor* descriptor); 2278 CodeStubInterfaceDescriptor* descriptor);
2215 2279
2216 private: 2280 private:
2217 Major MajorKey() { return InternalArrayNoArgumentConstructor; } 2281 Major MajorKey() { return InternalArrayNoArgumentConstructor; }
2218 2282
2219 DISALLOW_COPY_AND_ASSIGN(InternalArrayNoArgumentConstructorStub); 2283 DISALLOW_COPY_AND_ASSIGN(InternalArrayNoArgumentConstructorStub);
2220 }; 2284 };
2221 2285
2222 2286
2223 class InternalArraySingleArgumentConstructorStub : public 2287 class InternalArraySingleArgumentConstructorStub : public
2224 InternalArrayConstructorStubBase { 2288 InternalArrayConstructorStubBase {
2225 public: 2289 public:
2226 explicit InternalArraySingleArgumentConstructorStub(ElementsKind kind) 2290 InternalArraySingleArgumentConstructorStub(Isolate* isolate,
2227 : InternalArrayConstructorStubBase(kind) { } 2291 ElementsKind kind)
2292 : InternalArrayConstructorStubBase(isolate, kind) { }
2228 2293
2229 virtual Handle<Code> GenerateCode(Isolate* isolate); 2294 virtual Handle<Code> GenerateCode(Isolate* isolate);
2230 2295
2231 virtual void InitializeInterfaceDescriptor( 2296 virtual void InitializeInterfaceDescriptor(
2232 Isolate* isolate, 2297 Isolate* isolate,
2233 CodeStubInterfaceDescriptor* descriptor); 2298 CodeStubInterfaceDescriptor* descriptor);
2234 2299
2235 private: 2300 private:
2236 Major MajorKey() { return InternalArraySingleArgumentConstructor; } 2301 Major MajorKey() { return InternalArraySingleArgumentConstructor; }
2237 2302
2238 DISALLOW_COPY_AND_ASSIGN(InternalArraySingleArgumentConstructorStub); 2303 DISALLOW_COPY_AND_ASSIGN(InternalArraySingleArgumentConstructorStub);
2239 }; 2304 };
2240 2305
2241 2306
2242 class InternalArrayNArgumentsConstructorStub : public 2307 class InternalArrayNArgumentsConstructorStub : public
2243 InternalArrayConstructorStubBase { 2308 InternalArrayConstructorStubBase {
2244 public: 2309 public:
2245 explicit InternalArrayNArgumentsConstructorStub(ElementsKind kind) 2310 InternalArrayNArgumentsConstructorStub(Isolate* isolate, ElementsKind kind)
2246 : InternalArrayConstructorStubBase(kind) { } 2311 : InternalArrayConstructorStubBase(isolate, kind) { }
2247 2312
2248 virtual Handle<Code> GenerateCode(Isolate* isolate); 2313 virtual Handle<Code> GenerateCode(Isolate* isolate);
2249 2314
2250 virtual void InitializeInterfaceDescriptor( 2315 virtual void InitializeInterfaceDescriptor(
2251 Isolate* isolate, 2316 Isolate* isolate,
2252 CodeStubInterfaceDescriptor* descriptor); 2317 CodeStubInterfaceDescriptor* descriptor);
2253 2318
2254 private: 2319 private:
2255 Major MajorKey() { return InternalArrayNArgumentsConstructor; } 2320 Major MajorKey() { return InternalArrayNArgumentsConstructor; }
2256 2321
2257 DISALLOW_COPY_AND_ASSIGN(InternalArrayNArgumentsConstructorStub); 2322 DISALLOW_COPY_AND_ASSIGN(InternalArrayNArgumentsConstructorStub);
2258 }; 2323 };
2259 2324
2260 2325
2261 class KeyedStoreElementStub : public PlatformCodeStub { 2326 class KeyedStoreElementStub : public PlatformCodeStub {
2262 public: 2327 public:
2263 KeyedStoreElementStub(bool is_js_array, 2328 KeyedStoreElementStub(Isolate* isolate,
2329 bool is_js_array,
2264 ElementsKind elements_kind, 2330 ElementsKind elements_kind,
2265 KeyedAccessStoreMode store_mode) 2331 KeyedAccessStoreMode store_mode)
2266 : is_js_array_(is_js_array), 2332 : PlatformCodeStub(isolate),
2333 is_js_array_(is_js_array),
2267 elements_kind_(elements_kind), 2334 elements_kind_(elements_kind),
2268 store_mode_(store_mode), 2335 store_mode_(store_mode),
2269 fp_registers_(CanUseFPRegisters()) { } 2336 fp_registers_(CanUseFPRegisters()) { }
2270 2337
2271 Major MajorKey() { return KeyedStoreElement; } 2338 Major MajorKey() { return KeyedStoreElement; }
2272 int MinorKey() { 2339 int MinorKey() {
2273 return ElementsKindBits::encode(elements_kind_) | 2340 return ElementsKindBits::encode(elements_kind_) |
2274 IsJSArrayBits::encode(is_js_array_) | 2341 IsJSArrayBits::encode(is_js_array_) |
2275 StoreModeBits::encode(store_mode_) | 2342 StoreModeBits::encode(store_mode_) |
2276 FPRegisters::encode(fp_registers_); 2343 FPRegisters::encode(fp_registers_);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2319 byte ToByte() const { return ToIntegral(); } 2386 byte ToByte() const { return ToIntegral(); }
2320 void Print(StringStream* stream) const; 2387 void Print(StringStream* stream) const;
2321 bool UpdateStatus(Handle<Object> object); 2388 bool UpdateStatus(Handle<Object> object);
2322 bool NeedsMap() const; 2389 bool NeedsMap() const;
2323 bool CanBeUndetectable() const; 2390 bool CanBeUndetectable() const;
2324 bool IsGeneric() const { return ToIntegral() == Generic().ToIntegral(); } 2391 bool IsGeneric() const { return ToIntegral() == Generic().ToIntegral(); }
2325 2392
2326 static Types Generic() { return Types((1 << NUMBER_OF_TYPES) - 1); } 2393 static Types Generic() { return Types((1 << NUMBER_OF_TYPES) - 1); }
2327 }; 2394 };
2328 2395
2329 explicit ToBooleanStub(Types types = Types()) 2396 ToBooleanStub(Isolate* isolate, Types types = Types())
2330 : types_(types) { } 2397 : HydrogenCodeStub(isolate), types_(types) { }
2331 explicit ToBooleanStub(ExtraICState state) 2398 ToBooleanStub(Isolate* isolate, ExtraICState state)
2332 : types_(static_cast<byte>(state)) { } 2399 : HydrogenCodeStub(isolate), types_(static_cast<byte>(state)) { }
2333 2400
2334 bool UpdateStatus(Handle<Object> object); 2401 bool UpdateStatus(Handle<Object> object);
2335 Types GetTypes() { return types_; } 2402 Types GetTypes() { return types_; }
2336 2403
2337 virtual Handle<Code> GenerateCode(Isolate* isolate); 2404 virtual Handle<Code> GenerateCode(Isolate* isolate);
2338 virtual void InitializeInterfaceDescriptor( 2405 virtual void InitializeInterfaceDescriptor(
2339 Isolate* isolate, 2406 Isolate* isolate,
2340 CodeStubInterfaceDescriptor* descriptor); 2407 CodeStubInterfaceDescriptor* descriptor);
2341 2408
2342 virtual Code::Kind GetCodeKind() const { return Code::TO_BOOLEAN_IC; } 2409 virtual Code::Kind GetCodeKind() const { return Code::TO_BOOLEAN_IC; }
2343 virtual void PrintState(StringStream* stream); 2410 virtual void PrintState(StringStream* stream);
2344 2411
2345 virtual bool SometimesSetsUpAFrame() { return false; } 2412 virtual bool SometimesSetsUpAFrame() { return false; }
2346 2413
2347 static void InstallDescriptors(Isolate* isolate) { 2414 static void InstallDescriptors(Isolate* isolate) {
2348 ToBooleanStub stub; 2415 ToBooleanStub stub(isolate);
2349 stub.InitializeInterfaceDescriptor( 2416 stub.InitializeInterfaceDescriptor(
2350 isolate, 2417 isolate,
2351 isolate->code_stub_interface_descriptor(CodeStub::ToBoolean)); 2418 isolate->code_stub_interface_descriptor(CodeStub::ToBoolean));
2352 } 2419 }
2353 2420
2354 static Handle<Code> GetUninitialized(Isolate* isolate) { 2421 static Handle<Code> GetUninitialized(Isolate* isolate) {
2355 return ToBooleanStub(UNINITIALIZED).GetCode(isolate); 2422 return ToBooleanStub(isolate, UNINITIALIZED).GetCode(isolate);
2356 } 2423 }
2357 2424
2358 virtual ExtraICState GetExtraICState() { 2425 virtual ExtraICState GetExtraICState() {
2359 return types_.ToIntegral(); 2426 return types_.ToIntegral();
2360 } 2427 }
2361 2428
2362 virtual InlineCacheState GetICState() { 2429 virtual InlineCacheState GetICState() {
2363 if (types_.IsEmpty()) { 2430 if (types_.IsEmpty()) {
2364 return ::v8::internal::UNINITIALIZED; 2431 return ::v8::internal::UNINITIALIZED;
2365 } else { 2432 } else {
2366 return MONOMORPHIC; 2433 return MONOMORPHIC;
2367 } 2434 }
2368 } 2435 }
2369 2436
2370 private: 2437 private:
2371 Major MajorKey() { return ToBoolean; } 2438 Major MajorKey() { return ToBoolean; }
2372 int NotMissMinorKey() { return GetExtraICState(); } 2439 int NotMissMinorKey() { return GetExtraICState(); }
2373 2440
2374 explicit ToBooleanStub(InitializationState init_state) : 2441 ToBooleanStub(Isolate* isolate, InitializationState init_state) :
2375 HydrogenCodeStub(init_state) {} 2442 HydrogenCodeStub(isolate, init_state) {}
2376 2443
2377 Types types_; 2444 Types types_;
2378 }; 2445 };
2379 2446
2380 2447
2381 class ElementsTransitionAndStoreStub : public HydrogenCodeStub { 2448 class ElementsTransitionAndStoreStub : public HydrogenCodeStub {
2382 public: 2449 public:
2383 ElementsTransitionAndStoreStub(ElementsKind from_kind, 2450 ElementsTransitionAndStoreStub(Isolate* isolate,
2451 ElementsKind from_kind,
2384 ElementsKind to_kind, 2452 ElementsKind to_kind,
2385 bool is_jsarray, 2453 bool is_jsarray,
2386 KeyedAccessStoreMode store_mode) 2454 KeyedAccessStoreMode store_mode)
2387 : from_kind_(from_kind), 2455 : HydrogenCodeStub(isolate),
2456 from_kind_(from_kind),
2388 to_kind_(to_kind), 2457 to_kind_(to_kind),
2389 is_jsarray_(is_jsarray), 2458 is_jsarray_(is_jsarray),
2390 store_mode_(store_mode) {} 2459 store_mode_(store_mode) {}
2391 2460
2392 ElementsKind from_kind() const { return from_kind_; } 2461 ElementsKind from_kind() const { return from_kind_; }
2393 ElementsKind to_kind() const { return to_kind_; } 2462 ElementsKind to_kind() const { return to_kind_; }
2394 bool is_jsarray() const { return is_jsarray_; } 2463 bool is_jsarray() const { return is_jsarray_; }
2395 KeyedAccessStoreMode store_mode() const { return store_mode_; } 2464 KeyedAccessStoreMode store_mode() const { return store_mode_; }
2396 2465
2397 virtual Handle<Code> GenerateCode(Isolate* isolate); 2466 virtual Handle<Code> GenerateCode(Isolate* isolate);
(...skipping 20 matching lines...) Expand all
2418 ElementsKind to_kind_; 2487 ElementsKind to_kind_;
2419 bool is_jsarray_; 2488 bool is_jsarray_;
2420 KeyedAccessStoreMode store_mode_; 2489 KeyedAccessStoreMode store_mode_;
2421 2490
2422 DISALLOW_COPY_AND_ASSIGN(ElementsTransitionAndStoreStub); 2491 DISALLOW_COPY_AND_ASSIGN(ElementsTransitionAndStoreStub);
2423 }; 2492 };
2424 2493
2425 2494
2426 class StoreArrayLiteralElementStub : public PlatformCodeStub { 2495 class StoreArrayLiteralElementStub : public PlatformCodeStub {
2427 public: 2496 public:
2428 StoreArrayLiteralElementStub() 2497 explicit StoreArrayLiteralElementStub(Isolate* isolate)
2429 : fp_registers_(CanUseFPRegisters()) { } 2498 : PlatformCodeStub(isolate), fp_registers_(CanUseFPRegisters()) { }
2430 2499
2431 private: 2500 private:
2432 class FPRegisters: public BitField<bool, 0, 1> {}; 2501 class FPRegisters: public BitField<bool, 0, 1> {};
2433 2502
2434 Major MajorKey() { return StoreArrayLiteralElement; } 2503 Major MajorKey() { return StoreArrayLiteralElement; }
2435 int MinorKey() { return FPRegisters::encode(fp_registers_); } 2504 int MinorKey() { return FPRegisters::encode(fp_registers_); }
2436 2505
2437 void Generate(MacroAssembler* masm); 2506 void Generate(MacroAssembler* masm);
2438 2507
2439 bool fp_registers_; 2508 bool fp_registers_;
2440 2509
2441 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); 2510 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub);
2442 }; 2511 };
2443 2512
2444 2513
2445 class StubFailureTrampolineStub : public PlatformCodeStub { 2514 class StubFailureTrampolineStub : public PlatformCodeStub {
2446 public: 2515 public:
2447 explicit StubFailureTrampolineStub(StubFunctionMode function_mode) 2516 StubFailureTrampolineStub(Isolate* isolate, StubFunctionMode function_mode)
2448 : fp_registers_(CanUseFPRegisters()), function_mode_(function_mode) {} 2517 : PlatformCodeStub(isolate),
2518 fp_registers_(CanUseFPRegisters()),
2519 function_mode_(function_mode) {}
2449 2520
2450 static void GenerateAheadOfTime(Isolate* isolate); 2521 static void GenerateAheadOfTime(Isolate* isolate);
2451 2522
2452 private: 2523 private:
2453 class FPRegisters: public BitField<bool, 0, 1> {}; 2524 class FPRegisters: public BitField<bool, 0, 1> {};
2454 class FunctionModeField: public BitField<StubFunctionMode, 1, 1> {}; 2525 class FunctionModeField: public BitField<StubFunctionMode, 1, 1> {};
2455 2526
2456 Major MajorKey() { return StubFailureTrampoline; } 2527 Major MajorKey() { return StubFailureTrampoline; }
2457 int MinorKey() { 2528 int MinorKey() {
2458 return FPRegisters::encode(fp_registers_) | 2529 return FPRegisters::encode(fp_registers_) |
2459 FunctionModeField::encode(function_mode_); 2530 FunctionModeField::encode(function_mode_);
2460 } 2531 }
2461 2532
2462 void Generate(MacroAssembler* masm); 2533 void Generate(MacroAssembler* masm);
2463 2534
2464 bool fp_registers_; 2535 bool fp_registers_;
2465 StubFunctionMode function_mode_; 2536 StubFunctionMode function_mode_;
2466 2537
2467 DISALLOW_COPY_AND_ASSIGN(StubFailureTrampolineStub); 2538 DISALLOW_COPY_AND_ASSIGN(StubFailureTrampolineStub);
2468 }; 2539 };
2469 2540
2470 2541
2471 class ProfileEntryHookStub : public PlatformCodeStub { 2542 class ProfileEntryHookStub : public PlatformCodeStub {
2472 public: 2543 public:
2473 explicit ProfileEntryHookStub() {} 2544 explicit ProfileEntryHookStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
2474 2545
2475 // The profile entry hook function is not allowed to cause a GC. 2546 // The profile entry hook function is not allowed to cause a GC.
2476 virtual bool SometimesSetsUpAFrame() { return false; } 2547 virtual bool SometimesSetsUpAFrame() { return false; }
2477 2548
2478 // Generates a call to the entry hook if it's enabled. 2549 // Generates a call to the entry hook if it's enabled.
2479 static void MaybeCallEntryHook(MacroAssembler* masm); 2550 static void MaybeCallEntryHook(MacroAssembler* masm);
2480 2551
2481 private: 2552 private:
2482 static void EntryHookTrampoline(intptr_t function, 2553 static void EntryHookTrampoline(intptr_t function,
2483 intptr_t stack_pointer, 2554 intptr_t stack_pointer,
2484 Isolate* isolate); 2555 Isolate* isolate);
2485 2556
2486 Major MajorKey() { return ProfileEntryHook; } 2557 Major MajorKey() { return ProfileEntryHook; }
2487 int MinorKey() { return 0; } 2558 int MinorKey() { return 0; }
2488 2559
2489 void Generate(MacroAssembler* masm); 2560 void Generate(MacroAssembler* masm);
2490 2561
2491 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); 2562 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub);
2492 }; 2563 };
2493 2564
2494 2565
2495 class CallDescriptors { 2566 class CallDescriptors {
2496 public: 2567 public:
2497 static void InitializeForIsolate(Isolate* isolate); 2568 static void InitializeForIsolate(Isolate* isolate);
2498 }; 2569 };
2499 2570
2500 } } // namespace v8::internal 2571 } } // namespace v8::internal
2501 2572
2502 #endif // V8_CODE_STUBS_H_ 2573 #endif // V8_CODE_STUBS_H_
OLDNEW
« no previous file with comments | « src/arm64/stub-cache-arm64.cc ('k') | src/code-stubs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698