| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_CODE_STUBS_H_ | 5 #ifndef V8_CODE_STUBS_H_ |
| 6 #define V8_CODE_STUBS_H_ | 6 #define V8_CODE_STUBS_H_ |
| 7 | 7 |
| 8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
| 9 #include "src/assembler.h" | 9 #include "src/assembler.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 | 260 |
| 261 Isolate* isolate_; | 261 Isolate* isolate_; |
| 262 }; | 262 }; |
| 263 | 263 |
| 264 | 264 |
| 265 class PlatformCodeStub : public CodeStub { | 265 class PlatformCodeStub : public CodeStub { |
| 266 public: | 266 public: |
| 267 explicit PlatformCodeStub(Isolate* isolate) : CodeStub(isolate) { } | 267 explicit PlatformCodeStub(Isolate* isolate) : CodeStub(isolate) { } |
| 268 | 268 |
| 269 // Retrieve the code for the stub. Generate the code if needed. | 269 // Retrieve the code for the stub. Generate the code if needed. |
| 270 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 270 virtual Handle<Code> GenerateCode() OVERRIDE; |
| 271 | 271 |
| 272 virtual Code::Kind GetCodeKind() const { return Code::STUB; } | 272 virtual Code::Kind GetCodeKind() const { return Code::STUB; } |
| 273 | 273 |
| 274 protected: | 274 protected: |
| 275 // Generates the assembler code for the stub. | 275 // Generates the assembler code for the stub. |
| 276 virtual void Generate(MacroAssembler* masm) = 0; | 276 virtual void Generate(MacroAssembler* masm) = 0; |
| 277 }; | 277 }; |
| 278 | 278 |
| 279 | 279 |
| 280 enum StubFunctionMode { NOT_JS_FUNCTION_STUB_MODE, JS_FUNCTION_STUB_MODE }; | 280 enum StubFunctionMode { NOT_JS_FUNCTION_STUB_MODE, JS_FUNCTION_STUB_MODE }; |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 virtual void BeforeCall(MacroAssembler* masm) const {} | 512 virtual void BeforeCall(MacroAssembler* masm) const {} |
| 513 | 513 |
| 514 virtual void AfterCall(MacroAssembler* masm) const {} | 514 virtual void AfterCall(MacroAssembler* masm) const {} |
| 515 }; | 515 }; |
| 516 | 516 |
| 517 | 517 |
| 518 class ToNumberStub: public HydrogenCodeStub { | 518 class ToNumberStub: public HydrogenCodeStub { |
| 519 public: | 519 public: |
| 520 explicit ToNumberStub(Isolate* isolate) : HydrogenCodeStub(isolate) { } | 520 explicit ToNumberStub(Isolate* isolate) : HydrogenCodeStub(isolate) { } |
| 521 | 521 |
| 522 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 522 virtual Handle<Code> GenerateCode() OVERRIDE; |
| 523 | 523 |
| 524 virtual void InitializeInterfaceDescriptor( | 524 virtual void InitializeInterfaceDescriptor( |
| 525 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 525 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
| 526 | 526 |
| 527 static void InstallDescriptors(Isolate* isolate) { | 527 static void InstallDescriptors(Isolate* isolate) { |
| 528 ToNumberStub stub(isolate); | 528 ToNumberStub stub(isolate); |
| 529 stub.InitializeInterfaceDescriptor( | 529 stub.InitializeInterfaceDescriptor( |
| 530 isolate->code_stub_interface_descriptor(CodeStub::ToNumber)); | 530 isolate->code_stub_interface_descriptor(CodeStub::ToNumber)); |
| 531 } | 531 } |
| 532 | 532 |
| 533 private: | 533 private: |
| 534 virtual Major MajorKey() const V8_OVERRIDE { return ToNumber; } | 534 virtual Major MajorKey() const OVERRIDE { return ToNumber; } |
| 535 }; | 535 }; |
| 536 | 536 |
| 537 | 537 |
| 538 class NumberToStringStub V8_FINAL : public HydrogenCodeStub { | 538 class NumberToStringStub FINAL : public HydrogenCodeStub { |
| 539 public: | 539 public: |
| 540 explicit NumberToStringStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} | 540 explicit NumberToStringStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} |
| 541 | 541 |
| 542 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 542 virtual Handle<Code> GenerateCode() OVERRIDE; |
| 543 | 543 |
| 544 virtual void InitializeInterfaceDescriptor( | 544 virtual void InitializeInterfaceDescriptor( |
| 545 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 545 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
| 546 | 546 |
| 547 static void InstallDescriptors(Isolate* isolate); | 547 static void InstallDescriptors(Isolate* isolate); |
| 548 | 548 |
| 549 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 549 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
| 550 static const int kNumber = 0; | 550 static const int kNumber = 0; |
| 551 | 551 |
| 552 private: | 552 private: |
| 553 virtual Major MajorKey() const V8_OVERRIDE { return NumberToString; } | 553 virtual Major MajorKey() const OVERRIDE { return NumberToString; } |
| 554 }; | 554 }; |
| 555 | 555 |
| 556 | 556 |
| 557 class FastNewClosureStub : public HydrogenCodeStub { | 557 class FastNewClosureStub : public HydrogenCodeStub { |
| 558 public: | 558 public: |
| 559 FastNewClosureStub(Isolate* isolate, StrictMode strict_mode, | 559 FastNewClosureStub(Isolate* isolate, StrictMode strict_mode, |
| 560 bool is_generator) | 560 bool is_generator) |
| 561 : HydrogenCodeStub(isolate) { | 561 : HydrogenCodeStub(isolate) { |
| 562 set_sub_minor_key(StrictModeBits::encode(strict_mode) | | 562 set_sub_minor_key(StrictModeBits::encode(strict_mode) | |
| 563 IsGeneratorBits::encode(is_generator)); | 563 IsGeneratorBits::encode(is_generator)); |
| 564 } | 564 } |
| 565 | 565 |
| 566 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 566 virtual Handle<Code> GenerateCode() OVERRIDE; |
| 567 | 567 |
| 568 virtual void InitializeInterfaceDescriptor( | 568 virtual void InitializeInterfaceDescriptor( |
| 569 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 569 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
| 570 | 570 |
| 571 static void InstallDescriptors(Isolate* isolate); | 571 static void InstallDescriptors(Isolate* isolate); |
| 572 | 572 |
| 573 StrictMode strict_mode() const { | 573 StrictMode strict_mode() const { |
| 574 return StrictModeBits::decode(sub_minor_key()); | 574 return StrictModeBits::decode(sub_minor_key()); |
| 575 } | 575 } |
| 576 | 576 |
| 577 bool is_generator() const { return IsGeneratorBits::decode(sub_minor_key()); } | 577 bool is_generator() const { return IsGeneratorBits::decode(sub_minor_key()); } |
| 578 | 578 |
| 579 private: | 579 private: |
| 580 virtual Major MajorKey() const V8_OVERRIDE { return FastNewClosure; } | 580 virtual Major MajorKey() const OVERRIDE { return FastNewClosure; } |
| 581 | 581 |
| 582 class StrictModeBits : public BitField<StrictMode, 0, 1> {}; | 582 class StrictModeBits : public BitField<StrictMode, 0, 1> {}; |
| 583 class IsGeneratorBits : public BitField<bool, 1, 1> {}; | 583 class IsGeneratorBits : public BitField<bool, 1, 1> {}; |
| 584 | 584 |
| 585 DISALLOW_COPY_AND_ASSIGN(FastNewClosureStub); | 585 DISALLOW_COPY_AND_ASSIGN(FastNewClosureStub); |
| 586 }; | 586 }; |
| 587 | 587 |
| 588 | 588 |
| 589 class FastNewContextStub V8_FINAL : public HydrogenCodeStub { | 589 class FastNewContextStub FINAL : public HydrogenCodeStub { |
| 590 public: | 590 public: |
| 591 static const int kMaximumSlots = 64; | 591 static const int kMaximumSlots = 64; |
| 592 | 592 |
| 593 FastNewContextStub(Isolate* isolate, int slots) : HydrogenCodeStub(isolate) { | 593 FastNewContextStub(Isolate* isolate, int slots) : HydrogenCodeStub(isolate) { |
| 594 DCHECK(slots > 0 && slots <= kMaximumSlots); | 594 DCHECK(slots > 0 && slots <= kMaximumSlots); |
| 595 set_sub_minor_key(SlotsBits::encode(slots)); | 595 set_sub_minor_key(SlotsBits::encode(slots)); |
| 596 } | 596 } |
| 597 | 597 |
| 598 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 598 virtual Handle<Code> GenerateCode() OVERRIDE; |
| 599 | 599 |
| 600 virtual void InitializeInterfaceDescriptor( | 600 virtual void InitializeInterfaceDescriptor( |
| 601 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 601 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
| 602 | 602 |
| 603 static void InstallDescriptors(Isolate* isolate); | 603 static void InstallDescriptors(Isolate* isolate); |
| 604 | 604 |
| 605 int slots() const { return SlotsBits::decode(sub_minor_key()); } | 605 int slots() const { return SlotsBits::decode(sub_minor_key()); } |
| 606 | 606 |
| 607 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 607 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
| 608 static const int kFunction = 0; | 608 static const int kFunction = 0; |
| 609 | 609 |
| 610 private: | 610 private: |
| 611 virtual Major MajorKey() const V8_OVERRIDE { return FastNewContext; } | 611 virtual Major MajorKey() const OVERRIDE { return FastNewContext; } |
| 612 | 612 |
| 613 class SlotsBits : public BitField<int, 0, 8> {}; | 613 class SlotsBits : public BitField<int, 0, 8> {}; |
| 614 | 614 |
| 615 DISALLOW_COPY_AND_ASSIGN(FastNewContextStub); | 615 DISALLOW_COPY_AND_ASSIGN(FastNewContextStub); |
| 616 }; | 616 }; |
| 617 | 617 |
| 618 | 618 |
| 619 class FastCloneShallowArrayStub : public HydrogenCodeStub { | 619 class FastCloneShallowArrayStub : public HydrogenCodeStub { |
| 620 public: | 620 public: |
| 621 FastCloneShallowArrayStub(Isolate* isolate, | 621 FastCloneShallowArrayStub(Isolate* isolate, |
| 622 AllocationSiteMode allocation_site_mode) | 622 AllocationSiteMode allocation_site_mode) |
| 623 : HydrogenCodeStub(isolate) { | 623 : HydrogenCodeStub(isolate) { |
| 624 set_sub_minor_key(AllocationSiteModeBits::encode(allocation_site_mode)); | 624 set_sub_minor_key(AllocationSiteModeBits::encode(allocation_site_mode)); |
| 625 } | 625 } |
| 626 | 626 |
| 627 AllocationSiteMode allocation_site_mode() const { | 627 AllocationSiteMode allocation_site_mode() const { |
| 628 return AllocationSiteModeBits::decode(sub_minor_key()); | 628 return AllocationSiteModeBits::decode(sub_minor_key()); |
| 629 } | 629 } |
| 630 | 630 |
| 631 virtual Handle<Code> GenerateCode(); | 631 virtual Handle<Code> GenerateCode(); |
| 632 | 632 |
| 633 virtual void InitializeInterfaceDescriptor( | 633 virtual void InitializeInterfaceDescriptor( |
| 634 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 634 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
| 635 | 635 |
| 636 static void InstallDescriptors(Isolate* isolate); | 636 static void InstallDescriptors(Isolate* isolate); |
| 637 | 637 |
| 638 private: | 638 private: |
| 639 virtual Major MajorKey() const V8_OVERRIDE { return FastCloneShallowArray; } | 639 virtual Major MajorKey() const OVERRIDE { return FastCloneShallowArray; } |
| 640 | 640 |
| 641 class AllocationSiteModeBits: public BitField<AllocationSiteMode, 0, 1> {}; | 641 class AllocationSiteModeBits: public BitField<AllocationSiteMode, 0, 1> {}; |
| 642 | 642 |
| 643 DISALLOW_COPY_AND_ASSIGN(FastCloneShallowArrayStub); | 643 DISALLOW_COPY_AND_ASSIGN(FastCloneShallowArrayStub); |
| 644 }; | 644 }; |
| 645 | 645 |
| 646 | 646 |
| 647 class FastCloneShallowObjectStub : public HydrogenCodeStub { | 647 class FastCloneShallowObjectStub : public HydrogenCodeStub { |
| 648 public: | 648 public: |
| 649 // Maximum number of properties in copied object. | 649 // Maximum number of properties in copied object. |
| 650 static const int kMaximumClonedProperties = 6; | 650 static const int kMaximumClonedProperties = 6; |
| 651 | 651 |
| 652 FastCloneShallowObjectStub(Isolate* isolate, int length) | 652 FastCloneShallowObjectStub(Isolate* isolate, int length) |
| 653 : HydrogenCodeStub(isolate) { | 653 : HydrogenCodeStub(isolate) { |
| 654 DCHECK_GE(length, 0); | 654 DCHECK_GE(length, 0); |
| 655 DCHECK_LE(length, kMaximumClonedProperties); | 655 DCHECK_LE(length, kMaximumClonedProperties); |
| 656 set_sub_minor_key(LengthBits::encode(length)); | 656 set_sub_minor_key(LengthBits::encode(length)); |
| 657 } | 657 } |
| 658 | 658 |
| 659 int length() const { return LengthBits::decode(sub_minor_key()); } | 659 int length() const { return LengthBits::decode(sub_minor_key()); } |
| 660 | 660 |
| 661 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 661 virtual Handle<Code> GenerateCode() OVERRIDE; |
| 662 | 662 |
| 663 virtual void InitializeInterfaceDescriptor( | 663 virtual void InitializeInterfaceDescriptor( |
| 664 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 664 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
| 665 | 665 |
| 666 private: | 666 private: |
| 667 virtual Major MajorKey() const V8_OVERRIDE { return FastCloneShallowObject; } | 667 virtual Major MajorKey() const OVERRIDE { return FastCloneShallowObject; } |
| 668 | 668 |
| 669 class LengthBits : public BitField<int, 0, 4> {}; | 669 class LengthBits : public BitField<int, 0, 4> {}; |
| 670 | 670 |
| 671 DISALLOW_COPY_AND_ASSIGN(FastCloneShallowObjectStub); | 671 DISALLOW_COPY_AND_ASSIGN(FastCloneShallowObjectStub); |
| 672 }; | 672 }; |
| 673 | 673 |
| 674 | 674 |
| 675 class CreateAllocationSiteStub : public HydrogenCodeStub { | 675 class CreateAllocationSiteStub : public HydrogenCodeStub { |
| 676 public: | 676 public: |
| 677 explicit CreateAllocationSiteStub(Isolate* isolate) | 677 explicit CreateAllocationSiteStub(Isolate* isolate) |
| 678 : HydrogenCodeStub(isolate) { } | 678 : HydrogenCodeStub(isolate) { } |
| 679 | 679 |
| 680 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 680 virtual Handle<Code> GenerateCode() OVERRIDE; |
| 681 | 681 |
| 682 static void GenerateAheadOfTime(Isolate* isolate); | 682 static void GenerateAheadOfTime(Isolate* isolate); |
| 683 | 683 |
| 684 virtual void InitializeInterfaceDescriptor( | 684 virtual void InitializeInterfaceDescriptor( |
| 685 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 685 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
| 686 | 686 |
| 687 private: | 687 private: |
| 688 virtual Major MajorKey() const V8_OVERRIDE { return CreateAllocationSite; } | 688 virtual Major MajorKey() const OVERRIDE { return CreateAllocationSite; } |
| 689 | 689 |
| 690 DISALLOW_COPY_AND_ASSIGN(CreateAllocationSiteStub); | 690 DISALLOW_COPY_AND_ASSIGN(CreateAllocationSiteStub); |
| 691 }; | 691 }; |
| 692 | 692 |
| 693 | 693 |
| 694 class InstanceofStub: public PlatformCodeStub { | 694 class InstanceofStub: public PlatformCodeStub { |
| 695 public: | 695 public: |
| 696 enum Flags { | 696 enum Flags { |
| 697 kNoFlags = 0, | 697 kNoFlags = 0, |
| 698 kArgsInRegisters = 1 << 0, | 698 kArgsInRegisters = 1 << 0, |
| 699 kCallSiteInlineCheck = 1 << 1, | 699 kCallSiteInlineCheck = 1 << 1, |
| 700 kReturnTrueFalseObject = 1 << 2 | 700 kReturnTrueFalseObject = 1 << 2 |
| 701 }; | 701 }; |
| 702 | 702 |
| 703 InstanceofStub(Isolate* isolate, Flags flags) : PlatformCodeStub(isolate) { | 703 InstanceofStub(Isolate* isolate, Flags flags) : PlatformCodeStub(isolate) { |
| 704 minor_key_ = FlagBits::encode(flags); | 704 minor_key_ = FlagBits::encode(flags); |
| 705 } | 705 } |
| 706 | 706 |
| 707 void Generate(MacroAssembler* masm); | 707 void Generate(MacroAssembler* masm); |
| 708 | 708 |
| 709 static Register left() { return InstanceofConvention::left(); } | 709 static Register left() { return InstanceofConvention::left(); } |
| 710 static Register right() { return InstanceofConvention::right(); } | 710 static Register right() { return InstanceofConvention::right(); } |
| 711 | 711 |
| 712 virtual void InitializeInterfaceDescriptor( | 712 virtual void InitializeInterfaceDescriptor( |
| 713 CodeStubInterfaceDescriptor* descriptor); | 713 CodeStubInterfaceDescriptor* descriptor); |
| 714 | 714 |
| 715 private: | 715 private: |
| 716 virtual Major MajorKey() const V8_OVERRIDE { return Instanceof; } | 716 virtual Major MajorKey() const OVERRIDE { return Instanceof; } |
| 717 | 717 |
| 718 Flags flags() const { return FlagBits::decode(minor_key_); } | 718 Flags flags() const { return FlagBits::decode(minor_key_); } |
| 719 | 719 |
| 720 bool HasArgsInRegisters() const { return (flags() & kArgsInRegisters) != 0; } | 720 bool HasArgsInRegisters() const { return (flags() & kArgsInRegisters) != 0; } |
| 721 | 721 |
| 722 bool HasCallSiteInlineCheck() const { | 722 bool HasCallSiteInlineCheck() const { |
| 723 return (flags() & kCallSiteInlineCheck) != 0; | 723 return (flags() & kCallSiteInlineCheck) != 0; |
| 724 } | 724 } |
| 725 | 725 |
| 726 bool ReturnTrueFalseObject() const { | 726 bool ReturnTrueFalseObject() const { |
| 727 return (flags() & kReturnTrueFalseObject) != 0; | 727 return (flags() & kReturnTrueFalseObject) != 0; |
| 728 } | 728 } |
| 729 | 729 |
| 730 virtual void PrintName(OStream& os) const V8_OVERRIDE; // NOLINT | 730 virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT |
| 731 | 731 |
| 732 class FlagBits : public BitField<Flags, 0, 3> {}; | 732 class FlagBits : public BitField<Flags, 0, 3> {}; |
| 733 | 733 |
| 734 DISALLOW_COPY_AND_ASSIGN(InstanceofStub); | 734 DISALLOW_COPY_AND_ASSIGN(InstanceofStub); |
| 735 }; | 735 }; |
| 736 | 736 |
| 737 | 737 |
| 738 enum AllocationSiteOverrideMode { | 738 enum AllocationSiteOverrideMode { |
| 739 DONT_OVERRIDE, | 739 DONT_OVERRIDE, |
| 740 DISABLE_ALLOCATION_SITES, | 740 DISABLE_ALLOCATION_SITES, |
| 741 LAST_ALLOCATION_SITE_OVERRIDE_MODE = DISABLE_ALLOCATION_SITES | 741 LAST_ALLOCATION_SITE_OVERRIDE_MODE = DISABLE_ALLOCATION_SITES |
| 742 }; | 742 }; |
| 743 | 743 |
| 744 | 744 |
| 745 class ArrayConstructorStub: public PlatformCodeStub { | 745 class ArrayConstructorStub: public PlatformCodeStub { |
| 746 public: | 746 public: |
| 747 enum ArgumentCountKey { ANY, NONE, ONE, MORE_THAN_ONE }; | 747 enum ArgumentCountKey { ANY, NONE, ONE, MORE_THAN_ONE }; |
| 748 ArrayConstructorStub(Isolate* isolate, int argument_count); | 748 ArrayConstructorStub(Isolate* isolate, int argument_count); |
| 749 | 749 |
| 750 explicit ArrayConstructorStub(Isolate* isolate); | 750 explicit ArrayConstructorStub(Isolate* isolate); |
| 751 | 751 |
| 752 void Generate(MacroAssembler* masm); | 752 void Generate(MacroAssembler* masm); |
| 753 | 753 |
| 754 private: | 754 private: |
| 755 virtual Major MajorKey() const V8_OVERRIDE { return ArrayConstructor; } | 755 virtual Major MajorKey() const OVERRIDE { return ArrayConstructor; } |
| 756 | 756 |
| 757 ArgumentCountKey argument_count() const { | 757 ArgumentCountKey argument_count() const { |
| 758 return ArgumentCountBits::decode(minor_key_); | 758 return ArgumentCountBits::decode(minor_key_); |
| 759 } | 759 } |
| 760 | 760 |
| 761 void GenerateDispatchToArrayStub(MacroAssembler* masm, | 761 void GenerateDispatchToArrayStub(MacroAssembler* masm, |
| 762 AllocationSiteOverrideMode mode); | 762 AllocationSiteOverrideMode mode); |
| 763 | 763 |
| 764 virtual void PrintName(OStream& os) const V8_OVERRIDE; // NOLINT | 764 virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT |
| 765 | 765 |
| 766 class ArgumentCountBits : public BitField<ArgumentCountKey, 0, 2> {}; | 766 class ArgumentCountBits : public BitField<ArgumentCountKey, 0, 2> {}; |
| 767 | 767 |
| 768 DISALLOW_COPY_AND_ASSIGN(ArrayConstructorStub); | 768 DISALLOW_COPY_AND_ASSIGN(ArrayConstructorStub); |
| 769 }; | 769 }; |
| 770 | 770 |
| 771 | 771 |
| 772 class InternalArrayConstructorStub: public PlatformCodeStub { | 772 class InternalArrayConstructorStub: public PlatformCodeStub { |
| 773 public: | 773 public: |
| 774 explicit InternalArrayConstructorStub(Isolate* isolate); | 774 explicit InternalArrayConstructorStub(Isolate* isolate); |
| 775 | 775 |
| 776 void Generate(MacroAssembler* masm); | 776 void Generate(MacroAssembler* masm); |
| 777 | 777 |
| 778 private: | 778 private: |
| 779 virtual Major MajorKey() const V8_OVERRIDE { | 779 virtual Major MajorKey() const OVERRIDE { |
| 780 return InternalArrayConstructor; | 780 return InternalArrayConstructor; |
| 781 } | 781 } |
| 782 | 782 |
| 783 void GenerateCase(MacroAssembler* masm, ElementsKind kind); | 783 void GenerateCase(MacroAssembler* masm, ElementsKind kind); |
| 784 | 784 |
| 785 DISALLOW_COPY_AND_ASSIGN(InternalArrayConstructorStub); | 785 DISALLOW_COPY_AND_ASSIGN(InternalArrayConstructorStub); |
| 786 }; | 786 }; |
| 787 | 787 |
| 788 | 788 |
| 789 class MathPowStub: public PlatformCodeStub { | 789 class MathPowStub: public PlatformCodeStub { |
| 790 public: | 790 public: |
| 791 enum ExponentType { INTEGER, DOUBLE, TAGGED, ON_STACK }; | 791 enum ExponentType { INTEGER, DOUBLE, TAGGED, ON_STACK }; |
| 792 | 792 |
| 793 MathPowStub(Isolate* isolate, ExponentType exponent_type) | 793 MathPowStub(Isolate* isolate, ExponentType exponent_type) |
| 794 : PlatformCodeStub(isolate) { | 794 : PlatformCodeStub(isolate) { |
| 795 minor_key_ = ExponentTypeBits::encode(exponent_type); | 795 minor_key_ = ExponentTypeBits::encode(exponent_type); |
| 796 } | 796 } |
| 797 | 797 |
| 798 virtual void Generate(MacroAssembler* masm); | 798 virtual void Generate(MacroAssembler* masm); |
| 799 | 799 |
| 800 private: | 800 private: |
| 801 virtual Major MajorKey() const V8_OVERRIDE { return MathPow; } | 801 virtual Major MajorKey() const OVERRIDE { return MathPow; } |
| 802 | 802 |
| 803 ExponentType exponent_type() const { | 803 ExponentType exponent_type() const { |
| 804 return ExponentTypeBits::decode(minor_key_); | 804 return ExponentTypeBits::decode(minor_key_); |
| 805 } | 805 } |
| 806 | 806 |
| 807 class ExponentTypeBits : public BitField<ExponentType, 0, 2> {}; | 807 class ExponentTypeBits : public BitField<ExponentType, 0, 2> {}; |
| 808 | 808 |
| 809 DISALLOW_COPY_AND_ASSIGN(MathPowStub); | 809 DISALLOW_COPY_AND_ASSIGN(MathPowStub); |
| 810 }; | 810 }; |
| 811 | 811 |
| 812 | 812 |
| 813 class CallICStub: public PlatformCodeStub { | 813 class CallICStub: public PlatformCodeStub { |
| 814 public: | 814 public: |
| 815 CallICStub(Isolate* isolate, const CallIC::State& state) | 815 CallICStub(Isolate* isolate, const CallIC::State& state) |
| 816 : PlatformCodeStub(isolate) { | 816 : PlatformCodeStub(isolate) { |
| 817 minor_key_ = state.GetExtraICState(); | 817 minor_key_ = state.GetExtraICState(); |
| 818 } | 818 } |
| 819 | 819 |
| 820 static int ExtractArgcFromMinorKey(int minor_key) { | 820 static int ExtractArgcFromMinorKey(int minor_key) { |
| 821 CallIC::State state(static_cast<ExtraICState>(minor_key)); | 821 CallIC::State state(static_cast<ExtraICState>(minor_key)); |
| 822 return state.arg_count(); | 822 return state.arg_count(); |
| 823 } | 823 } |
| 824 | 824 |
| 825 virtual void Generate(MacroAssembler* masm); | 825 virtual void Generate(MacroAssembler* masm); |
| 826 | 826 |
| 827 virtual Code::Kind GetCodeKind() const V8_OVERRIDE { return Code::CALL_IC; } | 827 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::CALL_IC; } |
| 828 | 828 |
| 829 virtual InlineCacheState GetICState() const V8_OVERRIDE { return DEFAULT; } | 829 virtual InlineCacheState GetICState() const OVERRIDE { return DEFAULT; } |
| 830 | 830 |
| 831 virtual ExtraICState GetExtraICState() const V8_FINAL V8_OVERRIDE { | 831 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE { |
| 832 return static_cast<ExtraICState>(minor_key_); | 832 return static_cast<ExtraICState>(minor_key_); |
| 833 } | 833 } |
| 834 | 834 |
| 835 protected: | 835 protected: |
| 836 bool CallAsMethod() const { return state().call_type() == CallIC::METHOD; } | 836 bool CallAsMethod() const { return state().call_type() == CallIC::METHOD; } |
| 837 | 837 |
| 838 int arg_count() const { return state().arg_count(); } | 838 int arg_count() const { return state().arg_count(); } |
| 839 | 839 |
| 840 CallIC::State state() const { | 840 CallIC::State state() const { |
| 841 return CallIC::State(static_cast<ExtraICState>(minor_key_)); | 841 return CallIC::State(static_cast<ExtraICState>(minor_key_)); |
| 842 } | 842 } |
| 843 | 843 |
| 844 // Code generation helpers. | 844 // Code generation helpers. |
| 845 void GenerateMiss(MacroAssembler* masm, IC::UtilityId id); | 845 void GenerateMiss(MacroAssembler* masm, IC::UtilityId id); |
| 846 | 846 |
| 847 private: | 847 private: |
| 848 virtual Major MajorKey() const V8_OVERRIDE { return CallIC; } | 848 virtual Major MajorKey() const OVERRIDE { return CallIC; } |
| 849 | 849 |
| 850 virtual void PrintState(OStream& os) const V8_OVERRIDE; // NOLINT | 850 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT |
| 851 | 851 |
| 852 DISALLOW_COPY_AND_ASSIGN(CallICStub); | 852 DISALLOW_COPY_AND_ASSIGN(CallICStub); |
| 853 }; | 853 }; |
| 854 | 854 |
| 855 | 855 |
| 856 class CallIC_ArrayStub: public CallICStub { | 856 class CallIC_ArrayStub: public CallICStub { |
| 857 public: | 857 public: |
| 858 CallIC_ArrayStub(Isolate* isolate, const CallIC::State& state_in) | 858 CallIC_ArrayStub(Isolate* isolate, const CallIC::State& state_in) |
| 859 : CallICStub(isolate, state_in) {} | 859 : CallICStub(isolate, state_in) {} |
| 860 | 860 |
| 861 virtual void Generate(MacroAssembler* masm); | 861 virtual void Generate(MacroAssembler* masm); |
| 862 | 862 |
| 863 virtual InlineCacheState GetICState() const V8_FINAL V8_OVERRIDE { | 863 virtual InlineCacheState GetICState() const FINAL OVERRIDE { |
| 864 return MONOMORPHIC; | 864 return MONOMORPHIC; |
| 865 } | 865 } |
| 866 | 866 |
| 867 private: | 867 private: |
| 868 virtual void PrintState(OStream& os) const V8_OVERRIDE; // NOLINT | 868 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT |
| 869 | 869 |
| 870 virtual Major MajorKey() const V8_OVERRIDE { return CallIC_Array; } | 870 virtual Major MajorKey() const OVERRIDE { return CallIC_Array; } |
| 871 | 871 |
| 872 DISALLOW_COPY_AND_ASSIGN(CallIC_ArrayStub); | 872 DISALLOW_COPY_AND_ASSIGN(CallIC_ArrayStub); |
| 873 }; | 873 }; |
| 874 | 874 |
| 875 | 875 |
| 876 // TODO(verwaest): Translate to hydrogen code stub. | 876 // TODO(verwaest): Translate to hydrogen code stub. |
| 877 class FunctionPrototypeStub : public PlatformCodeStub { | 877 class FunctionPrototypeStub : public PlatformCodeStub { |
| 878 public: | 878 public: |
| 879 explicit FunctionPrototypeStub(Isolate* isolate) | 879 explicit FunctionPrototypeStub(Isolate* isolate) |
| 880 : PlatformCodeStub(isolate) {} | 880 : PlatformCodeStub(isolate) {} |
| 881 virtual void Generate(MacroAssembler* masm); | 881 virtual void Generate(MacroAssembler* masm); |
| 882 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; } | 882 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; } |
| 883 | 883 |
| 884 private: | 884 private: |
| 885 virtual Major MajorKey() const V8_OVERRIDE { return FunctionPrototype; } | 885 virtual Major MajorKey() const OVERRIDE { return FunctionPrototype; } |
| 886 | 886 |
| 887 DISALLOW_COPY_AND_ASSIGN(FunctionPrototypeStub); | 887 DISALLOW_COPY_AND_ASSIGN(FunctionPrototypeStub); |
| 888 }; | 888 }; |
| 889 | 889 |
| 890 | 890 |
| 891 class HandlerStub : public HydrogenCodeStub { | 891 class HandlerStub : public HydrogenCodeStub { |
| 892 public: | 892 public: |
| 893 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; } | 893 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; } |
| 894 virtual ExtraICState GetExtraICState() const { return kind(); } | 894 virtual ExtraICState GetExtraICState() const { return kind(); } |
| 895 virtual InlineCacheState GetICState() const { return MONOMORPHIC; } | 895 virtual InlineCacheState GetICState() const { return MONOMORPHIC; } |
| 896 | 896 |
| 897 virtual void InitializeInterfaceDescriptor( | 897 virtual void InitializeInterfaceDescriptor( |
| 898 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 898 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
| 899 | 899 |
| 900 protected: | 900 protected: |
| 901 explicit HandlerStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} | 901 explicit HandlerStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} |
| 902 virtual Code::Kind kind() const = 0; | 902 virtual Code::Kind kind() const = 0; |
| 903 | 903 |
| 904 private: | 904 private: |
| 905 DISALLOW_COPY_AND_ASSIGN(HandlerStub); | 905 DISALLOW_COPY_AND_ASSIGN(HandlerStub); |
| 906 }; | 906 }; |
| 907 | 907 |
| 908 | 908 |
| 909 class LoadFieldStub: public HandlerStub { | 909 class LoadFieldStub: public HandlerStub { |
| 910 public: | 910 public: |
| 911 LoadFieldStub(Isolate* isolate, FieldIndex index) : HandlerStub(isolate) { | 911 LoadFieldStub(Isolate* isolate, FieldIndex index) : HandlerStub(isolate) { |
| 912 int property_index_key = index.GetFieldAccessStubKey(); | 912 int property_index_key = index.GetFieldAccessStubKey(); |
| 913 set_sub_minor_key(LoadFieldByIndexBits::encode(property_index_key)); | 913 set_sub_minor_key(LoadFieldByIndexBits::encode(property_index_key)); |
| 914 } | 914 } |
| 915 | 915 |
| 916 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 916 virtual Handle<Code> GenerateCode() OVERRIDE; |
| 917 | 917 |
| 918 FieldIndex index() const { | 918 FieldIndex index() const { |
| 919 int property_index_key = LoadFieldByIndexBits::decode(sub_minor_key()); | 919 int property_index_key = LoadFieldByIndexBits::decode(sub_minor_key()); |
| 920 return FieldIndex::FromFieldAccessStubKey(property_index_key); | 920 return FieldIndex::FromFieldAccessStubKey(property_index_key); |
| 921 } | 921 } |
| 922 | 922 |
| 923 protected: | 923 protected: |
| 924 explicit LoadFieldStub(Isolate* isolate); | 924 explicit LoadFieldStub(Isolate* isolate); |
| 925 virtual Code::Kind kind() const { return Code::LOAD_IC; } | 925 virtual Code::Kind kind() const { return Code::LOAD_IC; } |
| 926 virtual Code::StubType GetStubType() { return Code::FAST; } | 926 virtual Code::StubType GetStubType() { return Code::FAST; } |
| 927 | 927 |
| 928 private: | 928 private: |
| 929 virtual Major MajorKey() const V8_OVERRIDE { return LoadField; } | 929 virtual Major MajorKey() const OVERRIDE { return LoadField; } |
| 930 | 930 |
| 931 class LoadFieldByIndexBits : public BitField<int, 0, 13> {}; | 931 class LoadFieldByIndexBits : public BitField<int, 0, 13> {}; |
| 932 | 932 |
| 933 DISALLOW_COPY_AND_ASSIGN(LoadFieldStub); | 933 DISALLOW_COPY_AND_ASSIGN(LoadFieldStub); |
| 934 }; | 934 }; |
| 935 | 935 |
| 936 | 936 |
| 937 class LoadConstantStub : public HandlerStub { | 937 class LoadConstantStub : public HandlerStub { |
| 938 public: | 938 public: |
| 939 LoadConstantStub(Isolate* isolate, int constant_index) | 939 LoadConstantStub(Isolate* isolate, int constant_index) |
| 940 : HandlerStub(isolate) { | 940 : HandlerStub(isolate) { |
| 941 set_sub_minor_key(ConstantIndexBits::encode(constant_index)); | 941 set_sub_minor_key(ConstantIndexBits::encode(constant_index)); |
| 942 } | 942 } |
| 943 | 943 |
| 944 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 944 virtual Handle<Code> GenerateCode() OVERRIDE; |
| 945 | 945 |
| 946 int constant_index() const { | 946 int constant_index() const { |
| 947 return ConstantIndexBits::decode(sub_minor_key()); | 947 return ConstantIndexBits::decode(sub_minor_key()); |
| 948 } | 948 } |
| 949 | 949 |
| 950 protected: | 950 protected: |
| 951 explicit LoadConstantStub(Isolate* isolate); | 951 explicit LoadConstantStub(Isolate* isolate); |
| 952 virtual Code::Kind kind() const { return Code::LOAD_IC; } | 952 virtual Code::Kind kind() const { return Code::LOAD_IC; } |
| 953 virtual Code::StubType GetStubType() { return Code::FAST; } | 953 virtual Code::StubType GetStubType() { return Code::FAST; } |
| 954 | 954 |
| 955 private: | 955 private: |
| 956 virtual Major MajorKey() const V8_OVERRIDE { return LoadConstant; } | 956 virtual Major MajorKey() const OVERRIDE { return LoadConstant; } |
| 957 | 957 |
| 958 class ConstantIndexBits : public BitField<int, 0, kSubMinorKeyBits> {}; | 958 class ConstantIndexBits : public BitField<int, 0, kSubMinorKeyBits> {}; |
| 959 | 959 |
| 960 DISALLOW_COPY_AND_ASSIGN(LoadConstantStub); | 960 DISALLOW_COPY_AND_ASSIGN(LoadConstantStub); |
| 961 }; | 961 }; |
| 962 | 962 |
| 963 | 963 |
| 964 class StringLengthStub: public HandlerStub { | 964 class StringLengthStub: public HandlerStub { |
| 965 public: | 965 public: |
| 966 explicit StringLengthStub(Isolate* isolate) : HandlerStub(isolate) {} | 966 explicit StringLengthStub(Isolate* isolate) : HandlerStub(isolate) {} |
| 967 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 967 virtual Handle<Code> GenerateCode() OVERRIDE; |
| 968 | 968 |
| 969 protected: | 969 protected: |
| 970 virtual Code::Kind kind() const { return Code::LOAD_IC; } | 970 virtual Code::Kind kind() const { return Code::LOAD_IC; } |
| 971 virtual Code::StubType GetStubType() { return Code::FAST; } | 971 virtual Code::StubType GetStubType() { return Code::FAST; } |
| 972 | 972 |
| 973 private: | 973 private: |
| 974 virtual Major MajorKey() const V8_OVERRIDE { return StringLength; } | 974 virtual Major MajorKey() const OVERRIDE { return StringLength; } |
| 975 | 975 |
| 976 DISALLOW_COPY_AND_ASSIGN(StringLengthStub); | 976 DISALLOW_COPY_AND_ASSIGN(StringLengthStub); |
| 977 }; | 977 }; |
| 978 | 978 |
| 979 | 979 |
| 980 class StoreFieldStub : public HandlerStub { | 980 class StoreFieldStub : public HandlerStub { |
| 981 public: | 981 public: |
| 982 StoreFieldStub(Isolate* isolate, FieldIndex index, | 982 StoreFieldStub(Isolate* isolate, FieldIndex index, |
| 983 Representation representation) | 983 Representation representation) |
| 984 : HandlerStub(isolate) { | 984 : HandlerStub(isolate) { |
| 985 int property_index_key = index.GetFieldAccessStubKey(); | 985 int property_index_key = index.GetFieldAccessStubKey(); |
| 986 uint8_t repr = PropertyDetails::EncodeRepresentation(representation); | 986 uint8_t repr = PropertyDetails::EncodeRepresentation(representation); |
| 987 set_sub_minor_key(StoreFieldByIndexBits::encode(property_index_key) | | 987 set_sub_minor_key(StoreFieldByIndexBits::encode(property_index_key) | |
| 988 RepresentationBits::encode(repr)); | 988 RepresentationBits::encode(repr)); |
| 989 } | 989 } |
| 990 | 990 |
| 991 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 991 virtual Handle<Code> GenerateCode() OVERRIDE; |
| 992 | 992 |
| 993 FieldIndex index() const { | 993 FieldIndex index() const { |
| 994 int property_index_key = StoreFieldByIndexBits::decode(sub_minor_key()); | 994 int property_index_key = StoreFieldByIndexBits::decode(sub_minor_key()); |
| 995 return FieldIndex::FromFieldAccessStubKey(property_index_key); | 995 return FieldIndex::FromFieldAccessStubKey(property_index_key); |
| 996 } | 996 } |
| 997 | 997 |
| 998 Representation representation() { | 998 Representation representation() { |
| 999 uint8_t repr = RepresentationBits::decode(sub_minor_key()); | 999 uint8_t repr = RepresentationBits::decode(sub_minor_key()); |
| 1000 return PropertyDetails::DecodeRepresentation(repr); | 1000 return PropertyDetails::DecodeRepresentation(repr); |
| 1001 } | 1001 } |
| 1002 | 1002 |
| 1003 static void InstallDescriptors(Isolate* isolate); | 1003 static void InstallDescriptors(Isolate* isolate); |
| 1004 | 1004 |
| 1005 protected: | 1005 protected: |
| 1006 explicit StoreFieldStub(Isolate* isolate); | 1006 explicit StoreFieldStub(Isolate* isolate); |
| 1007 virtual Code::Kind kind() const { return Code::STORE_IC; } | 1007 virtual Code::Kind kind() const { return Code::STORE_IC; } |
| 1008 virtual Code::StubType GetStubType() { return Code::FAST; } | 1008 virtual Code::StubType GetStubType() { return Code::FAST; } |
| 1009 | 1009 |
| 1010 private: | 1010 private: |
| 1011 virtual Major MajorKey() const V8_OVERRIDE { return StoreField; } | 1011 virtual Major MajorKey() const OVERRIDE { return StoreField; } |
| 1012 | 1012 |
| 1013 class StoreFieldByIndexBits : public BitField<int, 0, 13> {}; | 1013 class StoreFieldByIndexBits : public BitField<int, 0, 13> {}; |
| 1014 class RepresentationBits : public BitField<uint8_t, 13, 4> {}; | 1014 class RepresentationBits : public BitField<uint8_t, 13, 4> {}; |
| 1015 | 1015 |
| 1016 DISALLOW_COPY_AND_ASSIGN(StoreFieldStub); | 1016 DISALLOW_COPY_AND_ASSIGN(StoreFieldStub); |
| 1017 }; | 1017 }; |
| 1018 | 1018 |
| 1019 | 1019 |
| 1020 class StoreGlobalStub : public HandlerStub { | 1020 class StoreGlobalStub : public HandlerStub { |
| 1021 public: | 1021 public: |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1039 return CodeStub::GetCodeCopy(pattern); | 1039 return CodeStub::GetCodeCopy(pattern); |
| 1040 } else { | 1040 } else { |
| 1041 Code::FindAndReplacePattern pattern; | 1041 Code::FindAndReplacePattern pattern; |
| 1042 pattern.Add(isolate()->factory()->global_property_cell_map(), cell); | 1042 pattern.Add(isolate()->factory()->global_property_cell_map(), cell); |
| 1043 return CodeStub::GetCodeCopy(pattern); | 1043 return CodeStub::GetCodeCopy(pattern); |
| 1044 } | 1044 } |
| 1045 } | 1045 } |
| 1046 | 1046 |
| 1047 virtual Code::Kind kind() const { return Code::STORE_IC; } | 1047 virtual Code::Kind kind() const { return Code::STORE_IC; } |
| 1048 | 1048 |
| 1049 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 1049 virtual Handle<Code> GenerateCode() OVERRIDE; |
| 1050 | 1050 |
| 1051 bool is_constant() const { return IsConstantBits::decode(sub_minor_key()); } | 1051 bool is_constant() const { return IsConstantBits::decode(sub_minor_key()); } |
| 1052 | 1052 |
| 1053 bool check_global() const { return CheckGlobalBits::decode(sub_minor_key()); } | 1053 bool check_global() const { return CheckGlobalBits::decode(sub_minor_key()); } |
| 1054 | 1054 |
| 1055 void set_is_constant(bool value) { | 1055 void set_is_constant(bool value) { |
| 1056 set_sub_minor_key(IsConstantBits::update(sub_minor_key(), value)); | 1056 set_sub_minor_key(IsConstantBits::update(sub_minor_key(), value)); |
| 1057 } | 1057 } |
| 1058 | 1058 |
| 1059 Representation representation() { | 1059 Representation representation() { |
| 1060 return Representation::FromKind( | 1060 return Representation::FromKind( |
| 1061 RepresentationBits::decode(sub_minor_key())); | 1061 RepresentationBits::decode(sub_minor_key())); |
| 1062 } | 1062 } |
| 1063 | 1063 |
| 1064 void set_representation(Representation r) { | 1064 void set_representation(Representation r) { |
| 1065 set_sub_minor_key(RepresentationBits::update(sub_minor_key(), r.kind())); | 1065 set_sub_minor_key(RepresentationBits::update(sub_minor_key(), r.kind())); |
| 1066 } | 1066 } |
| 1067 | 1067 |
| 1068 private: | 1068 private: |
| 1069 virtual Major MajorKey() const V8_OVERRIDE { return StoreGlobal; } | 1069 virtual Major MajorKey() const OVERRIDE { return StoreGlobal; } |
| 1070 | 1070 |
| 1071 class IsConstantBits: public BitField<bool, 0, 1> {}; | 1071 class IsConstantBits: public BitField<bool, 0, 1> {}; |
| 1072 class RepresentationBits: public BitField<Representation::Kind, 1, 8> {}; | 1072 class RepresentationBits: public BitField<Representation::Kind, 1, 8> {}; |
| 1073 class CheckGlobalBits: public BitField<bool, 9, 1> {}; | 1073 class CheckGlobalBits: public BitField<bool, 9, 1> {}; |
| 1074 | 1074 |
| 1075 DISALLOW_COPY_AND_ASSIGN(StoreGlobalStub); | 1075 DISALLOW_COPY_AND_ASSIGN(StoreGlobalStub); |
| 1076 }; | 1076 }; |
| 1077 | 1077 |
| 1078 | 1078 |
| 1079 class CallApiFunctionStub : public PlatformCodeStub { | 1079 class CallApiFunctionStub : public PlatformCodeStub { |
| 1080 public: | 1080 public: |
| 1081 CallApiFunctionStub(Isolate* isolate, | 1081 CallApiFunctionStub(Isolate* isolate, |
| 1082 bool is_store, | 1082 bool is_store, |
| 1083 bool call_data_undefined, | 1083 bool call_data_undefined, |
| 1084 int argc) : PlatformCodeStub(isolate) { | 1084 int argc) : PlatformCodeStub(isolate) { |
| 1085 minor_key_ = IsStoreBits::encode(is_store) | | 1085 minor_key_ = IsStoreBits::encode(is_store) | |
| 1086 CallDataUndefinedBits::encode(call_data_undefined) | | 1086 CallDataUndefinedBits::encode(call_data_undefined) | |
| 1087 ArgumentBits::encode(argc); | 1087 ArgumentBits::encode(argc); |
| 1088 DCHECK(!is_store || argc == 1); | 1088 DCHECK(!is_store || argc == 1); |
| 1089 } | 1089 } |
| 1090 | 1090 |
| 1091 private: | 1091 private: |
| 1092 virtual void Generate(MacroAssembler* masm) V8_OVERRIDE; | 1092 virtual void Generate(MacroAssembler* masm) OVERRIDE; |
| 1093 virtual Major MajorKey() const V8_OVERRIDE { return CallApiFunction; } | 1093 virtual Major MajorKey() const OVERRIDE { return CallApiFunction; } |
| 1094 | 1094 |
| 1095 bool is_store() const { return IsStoreBits::decode(minor_key_); } | 1095 bool is_store() const { return IsStoreBits::decode(minor_key_); } |
| 1096 bool call_data_undefined() const { | 1096 bool call_data_undefined() const { |
| 1097 return CallDataUndefinedBits::decode(minor_key_); | 1097 return CallDataUndefinedBits::decode(minor_key_); |
| 1098 } | 1098 } |
| 1099 int argc() const { return ArgumentBits::decode(minor_key_); } | 1099 int argc() const { return ArgumentBits::decode(minor_key_); } |
| 1100 | 1100 |
| 1101 class IsStoreBits: public BitField<bool, 0, 1> {}; | 1101 class IsStoreBits: public BitField<bool, 0, 1> {}; |
| 1102 class CallDataUndefinedBits: public BitField<bool, 1, 1> {}; | 1102 class CallDataUndefinedBits: public BitField<bool, 1, 1> {}; |
| 1103 class ArgumentBits: public BitField<int, 2, Code::kArgumentsBits> {}; | 1103 class ArgumentBits: public BitField<int, 2, Code::kArgumentsBits> {}; |
| 1104 STATIC_ASSERT(Code::kArgumentsBits + 2 <= kStubMinorKeyBits); | 1104 STATIC_ASSERT(Code::kArgumentsBits + 2 <= kStubMinorKeyBits); |
| 1105 | 1105 |
| 1106 DISALLOW_COPY_AND_ASSIGN(CallApiFunctionStub); | 1106 DISALLOW_COPY_AND_ASSIGN(CallApiFunctionStub); |
| 1107 }; | 1107 }; |
| 1108 | 1108 |
| 1109 | 1109 |
| 1110 class CallApiGetterStub : public PlatformCodeStub { | 1110 class CallApiGetterStub : public PlatformCodeStub { |
| 1111 public: | 1111 public: |
| 1112 explicit CallApiGetterStub(Isolate* isolate) : PlatformCodeStub(isolate) {} | 1112 explicit CallApiGetterStub(Isolate* isolate) : PlatformCodeStub(isolate) {} |
| 1113 | 1113 |
| 1114 private: | 1114 private: |
| 1115 virtual void Generate(MacroAssembler* masm) V8_OVERRIDE; | 1115 virtual void Generate(MacroAssembler* masm) OVERRIDE; |
| 1116 virtual Major MajorKey() const V8_OVERRIDE { return CallApiGetter; } | 1116 virtual Major MajorKey() const OVERRIDE { return CallApiGetter; } |
| 1117 | 1117 |
| 1118 DISALLOW_COPY_AND_ASSIGN(CallApiGetterStub); | 1118 DISALLOW_COPY_AND_ASSIGN(CallApiGetterStub); |
| 1119 }; | 1119 }; |
| 1120 | 1120 |
| 1121 | 1121 |
| 1122 class BinaryOpICStub : public HydrogenCodeStub { | 1122 class BinaryOpICStub : public HydrogenCodeStub { |
| 1123 public: | 1123 public: |
| 1124 BinaryOpICStub(Isolate* isolate, Token::Value op, | 1124 BinaryOpICStub(Isolate* isolate, Token::Value op, |
| 1125 OverwriteMode mode = NO_OVERWRITE) | 1125 OverwriteMode mode = NO_OVERWRITE) |
| 1126 : HydrogenCodeStub(isolate, UNINITIALIZED), state_(isolate, op, mode) {} | 1126 : HydrogenCodeStub(isolate, UNINITIALIZED), state_(isolate, op, mode) {} |
| 1127 | 1127 |
| 1128 explicit BinaryOpICStub(Isolate* isolate, const BinaryOpIC::State& state) | 1128 explicit BinaryOpICStub(Isolate* isolate, const BinaryOpIC::State& state) |
| 1129 : HydrogenCodeStub(isolate), state_(state) {} | 1129 : HydrogenCodeStub(isolate), state_(state) {} |
| 1130 | 1130 |
| 1131 static void GenerateAheadOfTime(Isolate* isolate); | 1131 static void GenerateAheadOfTime(Isolate* isolate); |
| 1132 | 1132 |
| 1133 virtual void InitializeInterfaceDescriptor( | 1133 virtual void InitializeInterfaceDescriptor( |
| 1134 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 1134 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
| 1135 | 1135 |
| 1136 static void InstallDescriptors(Isolate* isolate); | 1136 static void InstallDescriptors(Isolate* isolate); |
| 1137 | 1137 |
| 1138 virtual Code::Kind GetCodeKind() const V8_OVERRIDE { | 1138 virtual Code::Kind GetCodeKind() const OVERRIDE { |
| 1139 return Code::BINARY_OP_IC; | 1139 return Code::BINARY_OP_IC; |
| 1140 } | 1140 } |
| 1141 | 1141 |
| 1142 virtual InlineCacheState GetICState() const V8_FINAL V8_OVERRIDE { | 1142 virtual InlineCacheState GetICState() const FINAL OVERRIDE { |
| 1143 return state_.GetICState(); | 1143 return state_.GetICState(); |
| 1144 } | 1144 } |
| 1145 | 1145 |
| 1146 virtual ExtraICState GetExtraICState() const V8_FINAL V8_OVERRIDE { | 1146 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE { |
| 1147 return state_.GetExtraICState(); | 1147 return state_.GetExtraICState(); |
| 1148 } | 1148 } |
| 1149 | 1149 |
| 1150 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 1150 virtual Handle<Code> GenerateCode() OVERRIDE; |
| 1151 | 1151 |
| 1152 const BinaryOpIC::State& state() const { return state_; } | 1152 const BinaryOpIC::State& state() const { return state_; } |
| 1153 | 1153 |
| 1154 virtual void PrintState(OStream& os) const V8_FINAL V8_OVERRIDE; // NOLINT | 1154 virtual void PrintState(OStream& os) const FINAL OVERRIDE; // NOLINT |
| 1155 | 1155 |
| 1156 virtual Major MajorKey() const V8_OVERRIDE { return BinaryOpIC; } | 1156 virtual Major MajorKey() const OVERRIDE { return BinaryOpIC; } |
| 1157 virtual int NotMissMinorKey() const V8_FINAL V8_OVERRIDE { | 1157 virtual int NotMissMinorKey() const FINAL OVERRIDE { |
| 1158 return GetExtraICState(); | 1158 return GetExtraICState(); |
| 1159 } | 1159 } |
| 1160 | 1160 |
| 1161 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 1161 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
| 1162 static const int kLeft = 0; | 1162 static const int kLeft = 0; |
| 1163 static const int kRight = 1; | 1163 static const int kRight = 1; |
| 1164 | 1164 |
| 1165 private: | 1165 private: |
| 1166 static void GenerateAheadOfTime(Isolate* isolate, | 1166 static void GenerateAheadOfTime(Isolate* isolate, |
| 1167 const BinaryOpIC::State& state); | 1167 const BinaryOpIC::State& state); |
| 1168 | 1168 |
| 1169 BinaryOpIC::State state_; | 1169 BinaryOpIC::State state_; |
| 1170 | 1170 |
| 1171 DISALLOW_COPY_AND_ASSIGN(BinaryOpICStub); | 1171 DISALLOW_COPY_AND_ASSIGN(BinaryOpICStub); |
| 1172 }; | 1172 }; |
| 1173 | 1173 |
| 1174 | 1174 |
| 1175 // TODO(bmeurer): Merge this into the BinaryOpICStub once we have proper tail | 1175 // TODO(bmeurer): Merge this into the BinaryOpICStub once we have proper tail |
| 1176 // call support for stubs in Hydrogen. | 1176 // call support for stubs in Hydrogen. |
| 1177 class BinaryOpICWithAllocationSiteStub V8_FINAL : public PlatformCodeStub { | 1177 class BinaryOpICWithAllocationSiteStub FINAL : public PlatformCodeStub { |
| 1178 public: | 1178 public: |
| 1179 BinaryOpICWithAllocationSiteStub(Isolate* isolate, | 1179 BinaryOpICWithAllocationSiteStub(Isolate* isolate, |
| 1180 const BinaryOpIC::State& state) | 1180 const BinaryOpIC::State& state) |
| 1181 : PlatformCodeStub(isolate) { | 1181 : PlatformCodeStub(isolate) { |
| 1182 minor_key_ = state.GetExtraICState(); | 1182 minor_key_ = state.GetExtraICState(); |
| 1183 } | 1183 } |
| 1184 | 1184 |
| 1185 static void GenerateAheadOfTime(Isolate* isolate); | 1185 static void GenerateAheadOfTime(Isolate* isolate); |
| 1186 | 1186 |
| 1187 Handle<Code> GetCodeCopyFromTemplate(Handle<AllocationSite> allocation_site) { | 1187 Handle<Code> GetCodeCopyFromTemplate(Handle<AllocationSite> allocation_site) { |
| 1188 Code::FindAndReplacePattern pattern; | 1188 Code::FindAndReplacePattern pattern; |
| 1189 pattern.Add(isolate()->factory()->undefined_map(), allocation_site); | 1189 pattern.Add(isolate()->factory()->undefined_map(), allocation_site); |
| 1190 return CodeStub::GetCodeCopy(pattern); | 1190 return CodeStub::GetCodeCopy(pattern); |
| 1191 } | 1191 } |
| 1192 | 1192 |
| 1193 virtual Code::Kind GetCodeKind() const V8_OVERRIDE { | 1193 virtual Code::Kind GetCodeKind() const OVERRIDE { |
| 1194 return Code::BINARY_OP_IC; | 1194 return Code::BINARY_OP_IC; |
| 1195 } | 1195 } |
| 1196 | 1196 |
| 1197 virtual InlineCacheState GetICState() const V8_OVERRIDE { | 1197 virtual InlineCacheState GetICState() const OVERRIDE { |
| 1198 return state().GetICState(); | 1198 return state().GetICState(); |
| 1199 } | 1199 } |
| 1200 | 1200 |
| 1201 virtual ExtraICState GetExtraICState() const V8_OVERRIDE { | 1201 virtual ExtraICState GetExtraICState() const OVERRIDE { |
| 1202 return static_cast<ExtraICState>(minor_key_); | 1202 return static_cast<ExtraICState>(minor_key_); |
| 1203 } | 1203 } |
| 1204 | 1204 |
| 1205 virtual void Generate(MacroAssembler* masm) V8_OVERRIDE; | 1205 virtual void Generate(MacroAssembler* masm) OVERRIDE; |
| 1206 | 1206 |
| 1207 virtual void PrintState(OStream& os) const V8_OVERRIDE; // NOLINT | 1207 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT |
| 1208 | 1208 |
| 1209 virtual Major MajorKey() const V8_OVERRIDE { | 1209 virtual Major MajorKey() const OVERRIDE { |
| 1210 return BinaryOpICWithAllocationSite; | 1210 return BinaryOpICWithAllocationSite; |
| 1211 } | 1211 } |
| 1212 | 1212 |
| 1213 private: | 1213 private: |
| 1214 BinaryOpIC::State state() const { | 1214 BinaryOpIC::State state() const { |
| 1215 return BinaryOpIC::State(isolate(), static_cast<ExtraICState>(minor_key_)); | 1215 return BinaryOpIC::State(isolate(), static_cast<ExtraICState>(minor_key_)); |
| 1216 } | 1216 } |
| 1217 | 1217 |
| 1218 static void GenerateAheadOfTime(Isolate* isolate, | 1218 static void GenerateAheadOfTime(Isolate* isolate, |
| 1219 const BinaryOpIC::State& state); | 1219 const BinaryOpIC::State& state); |
| 1220 | 1220 |
| 1221 DISALLOW_COPY_AND_ASSIGN(BinaryOpICWithAllocationSiteStub); | 1221 DISALLOW_COPY_AND_ASSIGN(BinaryOpICWithAllocationSiteStub); |
| 1222 }; | 1222 }; |
| 1223 | 1223 |
| 1224 | 1224 |
| 1225 class BinaryOpWithAllocationSiteStub V8_FINAL : public BinaryOpICStub { | 1225 class BinaryOpWithAllocationSiteStub FINAL : public BinaryOpICStub { |
| 1226 public: | 1226 public: |
| 1227 BinaryOpWithAllocationSiteStub(Isolate* isolate, | 1227 BinaryOpWithAllocationSiteStub(Isolate* isolate, |
| 1228 Token::Value op, | 1228 Token::Value op, |
| 1229 OverwriteMode mode) | 1229 OverwriteMode mode) |
| 1230 : BinaryOpICStub(isolate, op, mode) {} | 1230 : BinaryOpICStub(isolate, op, mode) {} |
| 1231 | 1231 |
| 1232 BinaryOpWithAllocationSiteStub(Isolate* isolate, | 1232 BinaryOpWithAllocationSiteStub(Isolate* isolate, |
| 1233 const BinaryOpIC::State& state) | 1233 const BinaryOpIC::State& state) |
| 1234 : BinaryOpICStub(isolate, state) {} | 1234 : BinaryOpICStub(isolate, state) {} |
| 1235 | 1235 |
| 1236 virtual void InitializeInterfaceDescriptor( | 1236 virtual void InitializeInterfaceDescriptor( |
| 1237 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 1237 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
| 1238 | 1238 |
| 1239 static void InstallDescriptors(Isolate* isolate); | 1239 static void InstallDescriptors(Isolate* isolate); |
| 1240 | 1240 |
| 1241 virtual Code::Kind GetCodeKind() const V8_FINAL V8_OVERRIDE { | 1241 virtual Code::Kind GetCodeKind() const FINAL OVERRIDE { |
| 1242 return Code::STUB; | 1242 return Code::STUB; |
| 1243 } | 1243 } |
| 1244 | 1244 |
| 1245 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 1245 virtual Handle<Code> GenerateCode() OVERRIDE; |
| 1246 | 1246 |
| 1247 virtual Major MajorKey() const V8_OVERRIDE { | 1247 virtual Major MajorKey() const OVERRIDE { |
| 1248 return BinaryOpWithAllocationSite; | 1248 return BinaryOpWithAllocationSite; |
| 1249 } | 1249 } |
| 1250 | 1250 |
| 1251 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 1251 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
| 1252 static const int kAllocationSite = 0; | 1252 static const int kAllocationSite = 0; |
| 1253 static const int kLeft = 1; | 1253 static const int kLeft = 1; |
| 1254 static const int kRight = 2; | 1254 static const int kRight = 2; |
| 1255 }; | 1255 }; |
| 1256 | 1256 |
| 1257 | 1257 |
| 1258 enum StringAddFlags { | 1258 enum StringAddFlags { |
| 1259 // Omit both parameter checks. | 1259 // Omit both parameter checks. |
| 1260 STRING_ADD_CHECK_NONE = 0, | 1260 STRING_ADD_CHECK_NONE = 0, |
| 1261 // Check left parameter. | 1261 // Check left parameter. |
| 1262 STRING_ADD_CHECK_LEFT = 1 << 0, | 1262 STRING_ADD_CHECK_LEFT = 1 << 0, |
| 1263 // Check right parameter. | 1263 // Check right parameter. |
| 1264 STRING_ADD_CHECK_RIGHT = 1 << 1, | 1264 STRING_ADD_CHECK_RIGHT = 1 << 1, |
| 1265 // Check both parameters. | 1265 // Check both parameters. |
| 1266 STRING_ADD_CHECK_BOTH = STRING_ADD_CHECK_LEFT | STRING_ADD_CHECK_RIGHT | 1266 STRING_ADD_CHECK_BOTH = STRING_ADD_CHECK_LEFT | STRING_ADD_CHECK_RIGHT |
| 1267 }; | 1267 }; |
| 1268 | 1268 |
| 1269 | 1269 |
| 1270 class StringAddStub V8_FINAL : public HydrogenCodeStub { | 1270 class StringAddStub FINAL : public HydrogenCodeStub { |
| 1271 public: | 1271 public: |
| 1272 StringAddStub(Isolate* isolate, StringAddFlags flags, | 1272 StringAddStub(Isolate* isolate, StringAddFlags flags, |
| 1273 PretenureFlag pretenure_flag) | 1273 PretenureFlag pretenure_flag) |
| 1274 : HydrogenCodeStub(isolate) { | 1274 : HydrogenCodeStub(isolate) { |
| 1275 set_sub_minor_key(StringAddFlagsBits::encode(flags) | | 1275 set_sub_minor_key(StringAddFlagsBits::encode(flags) | |
| 1276 PretenureFlagBits::encode(pretenure_flag)); | 1276 PretenureFlagBits::encode(pretenure_flag)); |
| 1277 } | 1277 } |
| 1278 | 1278 |
| 1279 StringAddFlags flags() const { | 1279 StringAddFlags flags() const { |
| 1280 return StringAddFlagsBits::decode(sub_minor_key()); | 1280 return StringAddFlagsBits::decode(sub_minor_key()); |
| 1281 } | 1281 } |
| 1282 | 1282 |
| 1283 PretenureFlag pretenure_flag() const { | 1283 PretenureFlag pretenure_flag() const { |
| 1284 return PretenureFlagBits::decode(sub_minor_key()); | 1284 return PretenureFlagBits::decode(sub_minor_key()); |
| 1285 } | 1285 } |
| 1286 | 1286 |
| 1287 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 1287 virtual Handle<Code> GenerateCode() OVERRIDE; |
| 1288 | 1288 |
| 1289 virtual void InitializeInterfaceDescriptor( | 1289 virtual void InitializeInterfaceDescriptor( |
| 1290 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 1290 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
| 1291 | 1291 |
| 1292 static void InstallDescriptors(Isolate* isolate); | 1292 static void InstallDescriptors(Isolate* isolate); |
| 1293 | 1293 |
| 1294 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 1294 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
| 1295 static const int kLeft = 0; | 1295 static const int kLeft = 0; |
| 1296 static const int kRight = 1; | 1296 static const int kRight = 1; |
| 1297 | 1297 |
| 1298 private: | 1298 private: |
| 1299 virtual Major MajorKey() const V8_OVERRIDE { return StringAdd; } | 1299 virtual Major MajorKey() const OVERRIDE { return StringAdd; } |
| 1300 | 1300 |
| 1301 class StringAddFlagsBits: public BitField<StringAddFlags, 0, 2> {}; | 1301 class StringAddFlagsBits: public BitField<StringAddFlags, 0, 2> {}; |
| 1302 class PretenureFlagBits: public BitField<PretenureFlag, 2, 1> {}; | 1302 class PretenureFlagBits: public BitField<PretenureFlag, 2, 1> {}; |
| 1303 | 1303 |
| 1304 virtual void PrintBaseName(OStream& os) const V8_OVERRIDE; // NOLINT | 1304 virtual void PrintBaseName(OStream& os) const OVERRIDE; // NOLINT |
| 1305 | 1305 |
| 1306 DISALLOW_COPY_AND_ASSIGN(StringAddStub); | 1306 DISALLOW_COPY_AND_ASSIGN(StringAddStub); |
| 1307 }; | 1307 }; |
| 1308 | 1308 |
| 1309 | 1309 |
| 1310 class ICCompareStub: public PlatformCodeStub { | 1310 class ICCompareStub: public PlatformCodeStub { |
| 1311 public: | 1311 public: |
| 1312 ICCompareStub(Isolate* isolate, | 1312 ICCompareStub(Isolate* isolate, |
| 1313 Token::Value op, | 1313 Token::Value op, |
| 1314 CompareIC::State left, | 1314 CompareIC::State left, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1331 CompareIC::State* handler_state, Token::Value* op); | 1331 CompareIC::State* handler_state, Token::Value* op); |
| 1332 | 1332 |
| 1333 virtual InlineCacheState GetICState() const; | 1333 virtual InlineCacheState GetICState() const; |
| 1334 | 1334 |
| 1335 private: | 1335 private: |
| 1336 class OpField: public BitField<int, 0, 3> { }; | 1336 class OpField: public BitField<int, 0, 3> { }; |
| 1337 class LeftStateField: public BitField<int, 3, 4> { }; | 1337 class LeftStateField: public BitField<int, 3, 4> { }; |
| 1338 class RightStateField: public BitField<int, 7, 4> { }; | 1338 class RightStateField: public BitField<int, 7, 4> { }; |
| 1339 class HandlerStateField: public BitField<int, 11, 4> { }; | 1339 class HandlerStateField: public BitField<int, 11, 4> { }; |
| 1340 | 1340 |
| 1341 virtual Major MajorKey() const V8_OVERRIDE { return CompareIC; } | 1341 virtual Major MajorKey() const OVERRIDE { return CompareIC; } |
| 1342 virtual uint32_t MinorKey() const; | 1342 virtual uint32_t MinorKey() const; |
| 1343 | 1343 |
| 1344 virtual Code::Kind GetCodeKind() const { return Code::COMPARE_IC; } | 1344 virtual Code::Kind GetCodeKind() const { return Code::COMPARE_IC; } |
| 1345 | 1345 |
| 1346 void GenerateSmis(MacroAssembler* masm); | 1346 void GenerateSmis(MacroAssembler* masm); |
| 1347 void GenerateNumbers(MacroAssembler* masm); | 1347 void GenerateNumbers(MacroAssembler* masm); |
| 1348 void GenerateInternalizedStrings(MacroAssembler* masm); | 1348 void GenerateInternalizedStrings(MacroAssembler* masm); |
| 1349 void GenerateStrings(MacroAssembler* masm); | 1349 void GenerateStrings(MacroAssembler* masm); |
| 1350 void GenerateUniqueNames(MacroAssembler* masm); | 1350 void GenerateUniqueNames(MacroAssembler* masm); |
| 1351 void GenerateObjects(MacroAssembler* masm); | 1351 void GenerateObjects(MacroAssembler* masm); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1383 nil_value_(NilValueField::decode(ic_state)), | 1383 nil_value_(NilValueField::decode(ic_state)), |
| 1384 state_(State(TypesField::decode(ic_state))) { | 1384 state_(State(TypesField::decode(ic_state))) { |
| 1385 } | 1385 } |
| 1386 | 1386 |
| 1387 static Handle<Code> GetUninitialized(Isolate* isolate, | 1387 static Handle<Code> GetUninitialized(Isolate* isolate, |
| 1388 NilValue nil) { | 1388 NilValue nil) { |
| 1389 return CompareNilICStub(isolate, nil, UNINITIALIZED).GetCode(); | 1389 return CompareNilICStub(isolate, nil, UNINITIALIZED).GetCode(); |
| 1390 } | 1390 } |
| 1391 | 1391 |
| 1392 virtual void InitializeInterfaceDescriptor( | 1392 virtual void InitializeInterfaceDescriptor( |
| 1393 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 1393 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
| 1394 | 1394 |
| 1395 static void InstallDescriptors(Isolate* isolate) { | 1395 static void InstallDescriptors(Isolate* isolate) { |
| 1396 CompareNilICStub compare_stub(isolate, kNullValue, UNINITIALIZED); | 1396 CompareNilICStub compare_stub(isolate, kNullValue, UNINITIALIZED); |
| 1397 compare_stub.InitializeInterfaceDescriptor( | 1397 compare_stub.InitializeInterfaceDescriptor( |
| 1398 isolate->code_stub_interface_descriptor(CodeStub::CompareNilIC)); | 1398 isolate->code_stub_interface_descriptor(CodeStub::CompareNilIC)); |
| 1399 } | 1399 } |
| 1400 | 1400 |
| 1401 virtual InlineCacheState GetICState() const { | 1401 virtual InlineCacheState GetICState() const { |
| 1402 if (state_.Contains(GENERIC)) { | 1402 if (state_.Contains(GENERIC)) { |
| 1403 return MEGAMORPHIC; | 1403 return MEGAMORPHIC; |
| 1404 } else if (state_.Contains(MONOMORPHIC_MAP)) { | 1404 } else if (state_.Contains(MONOMORPHIC_MAP)) { |
| 1405 return MONOMORPHIC; | 1405 return MONOMORPHIC; |
| 1406 } else { | 1406 } else { |
| 1407 return PREMONOMORPHIC; | 1407 return PREMONOMORPHIC; |
| 1408 } | 1408 } |
| 1409 } | 1409 } |
| 1410 | 1410 |
| 1411 virtual Code::Kind GetCodeKind() const { return Code::COMPARE_NIL_IC; } | 1411 virtual Code::Kind GetCodeKind() const { return Code::COMPARE_NIL_IC; } |
| 1412 | 1412 |
| 1413 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 1413 virtual Handle<Code> GenerateCode() OVERRIDE; |
| 1414 | 1414 |
| 1415 virtual ExtraICState GetExtraICState() const { | 1415 virtual ExtraICState GetExtraICState() const { |
| 1416 return NilValueField::encode(nil_value_) | | 1416 return NilValueField::encode(nil_value_) | |
| 1417 TypesField::encode(state_.ToIntegral()); | 1417 TypesField::encode(state_.ToIntegral()); |
| 1418 } | 1418 } |
| 1419 | 1419 |
| 1420 void UpdateStatus(Handle<Object> object); | 1420 void UpdateStatus(Handle<Object> object); |
| 1421 | 1421 |
| 1422 bool IsMonomorphic() const { return state_.Contains(MONOMORPHIC_MAP); } | 1422 bool IsMonomorphic() const { return state_.Contains(MONOMORPHIC_MAP); } |
| 1423 NilValue GetNilValue() const { return nil_value_; } | 1423 NilValue GetNilValue() const { return nil_value_; } |
| 1424 void ClearState() { state_.RemoveAll(); } | 1424 void ClearState() { state_.RemoveAll(); } |
| 1425 | 1425 |
| 1426 virtual void PrintState(OStream& os) const V8_OVERRIDE; // NOLINT | 1426 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT |
| 1427 virtual void PrintBaseName(OStream& os) const V8_OVERRIDE; // NOLINT | 1427 virtual void PrintBaseName(OStream& os) const OVERRIDE; // NOLINT |
| 1428 | 1428 |
| 1429 private: | 1429 private: |
| 1430 friend class CompareNilIC; | 1430 friend class CompareNilIC; |
| 1431 | 1431 |
| 1432 enum CompareNilType { | 1432 enum CompareNilType { |
| 1433 UNDEFINED, | 1433 UNDEFINED, |
| 1434 NULL_TYPE, | 1434 NULL_TYPE, |
| 1435 MONOMORPHIC_MAP, | 1435 MONOMORPHIC_MAP, |
| 1436 GENERIC, | 1436 GENERIC, |
| 1437 NUMBER_OF_TYPES | 1437 NUMBER_OF_TYPES |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1450 friend OStream& operator<<(OStream& os, const State& s); | 1450 friend OStream& operator<<(OStream& os, const State& s); |
| 1451 | 1451 |
| 1452 CompareNilICStub(Isolate* isolate, | 1452 CompareNilICStub(Isolate* isolate, |
| 1453 NilValue nil, | 1453 NilValue nil, |
| 1454 InitializationState init_state) | 1454 InitializationState init_state) |
| 1455 : HydrogenCodeStub(isolate, init_state), nil_value_(nil) { } | 1455 : HydrogenCodeStub(isolate, init_state), nil_value_(nil) { } |
| 1456 | 1456 |
| 1457 class NilValueField : public BitField<NilValue, 0, 1> {}; | 1457 class NilValueField : public BitField<NilValue, 0, 1> {}; |
| 1458 class TypesField : public BitField<byte, 1, NUMBER_OF_TYPES> {}; | 1458 class TypesField : public BitField<byte, 1, NUMBER_OF_TYPES> {}; |
| 1459 | 1459 |
| 1460 virtual Major MajorKey() const V8_OVERRIDE { return CompareNilIC; } | 1460 virtual Major MajorKey() const OVERRIDE { return CompareNilIC; } |
| 1461 virtual int NotMissMinorKey() const { return GetExtraICState(); } | 1461 virtual int NotMissMinorKey() const { return GetExtraICState(); } |
| 1462 | 1462 |
| 1463 NilValue nil_value_; | 1463 NilValue nil_value_; |
| 1464 State state_; | 1464 State state_; |
| 1465 | 1465 |
| 1466 DISALLOW_COPY_AND_ASSIGN(CompareNilICStub); | 1466 DISALLOW_COPY_AND_ASSIGN(CompareNilICStub); |
| 1467 }; | 1467 }; |
| 1468 | 1468 |
| 1469 | 1469 |
| 1470 OStream& operator<<(OStream& os, const CompareNilICStub::State& s); | 1470 OStream& operator<<(OStream& os, const CompareNilICStub::State& s); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1484 | 1484 |
| 1485 void Generate(MacroAssembler* masm); | 1485 void Generate(MacroAssembler* masm); |
| 1486 | 1486 |
| 1487 // The version of this stub that doesn't save doubles is generated ahead of | 1487 // The version of this stub that doesn't save doubles is generated ahead of |
| 1488 // time, so it's OK to call it from other stubs that can't cope with GC during | 1488 // time, so it's OK to call it from other stubs that can't cope with GC during |
| 1489 // their code generation. On machines that always have gp registers (x64) we | 1489 // their code generation. On machines that always have gp registers (x64) we |
| 1490 // can generate both variants ahead of time. | 1490 // can generate both variants ahead of time. |
| 1491 static void GenerateAheadOfTime(Isolate* isolate); | 1491 static void GenerateAheadOfTime(Isolate* isolate); |
| 1492 | 1492 |
| 1493 private: | 1493 private: |
| 1494 virtual Major MajorKey() const V8_OVERRIDE { return CEntry; } | 1494 virtual Major MajorKey() const OVERRIDE { return CEntry; } |
| 1495 | 1495 |
| 1496 bool save_doubles() const { return SaveDoublesBits::decode(minor_key_); } | 1496 bool save_doubles() const { return SaveDoublesBits::decode(minor_key_); } |
| 1497 #ifdef _WIN64 | 1497 #ifdef _WIN64 |
| 1498 int result_size() const { return ResultSizeBits::decode(minor_key_); } | 1498 int result_size() const { return ResultSizeBits::decode(minor_key_); } |
| 1499 #endif // _WIN64 | 1499 #endif // _WIN64 |
| 1500 | 1500 |
| 1501 bool NeedsImmovableCode(); | 1501 bool NeedsImmovableCode(); |
| 1502 | 1502 |
| 1503 class SaveDoublesBits : public BitField<bool, 0, 1> {}; | 1503 class SaveDoublesBits : public BitField<bool, 0, 1> {}; |
| 1504 class ResultSizeBits : public BitField<int, 1, 3> {}; | 1504 class ResultSizeBits : public BitField<int, 1, 3> {}; |
| 1505 | 1505 |
| 1506 DISALLOW_COPY_AND_ASSIGN(CEntryStub); | 1506 DISALLOW_COPY_AND_ASSIGN(CEntryStub); |
| 1507 }; | 1507 }; |
| 1508 | 1508 |
| 1509 | 1509 |
| 1510 class JSEntryStub : public PlatformCodeStub { | 1510 class JSEntryStub : public PlatformCodeStub { |
| 1511 public: | 1511 public: |
| 1512 explicit JSEntryStub(Isolate* isolate) : PlatformCodeStub(isolate) { } | 1512 explicit JSEntryStub(Isolate* isolate) : PlatformCodeStub(isolate) { } |
| 1513 | 1513 |
| 1514 void Generate(MacroAssembler* masm) { GenerateBody(masm, false); } | 1514 void Generate(MacroAssembler* masm) { GenerateBody(masm, false); } |
| 1515 | 1515 |
| 1516 protected: | 1516 protected: |
| 1517 void GenerateBody(MacroAssembler* masm, bool is_construct); | 1517 void GenerateBody(MacroAssembler* masm, bool is_construct); |
| 1518 | 1518 |
| 1519 private: | 1519 private: |
| 1520 virtual Major MajorKey() const V8_OVERRIDE { return JSEntry; } | 1520 virtual Major MajorKey() const OVERRIDE { return JSEntry; } |
| 1521 | 1521 |
| 1522 virtual void FinishCode(Handle<Code> code); | 1522 virtual void FinishCode(Handle<Code> code); |
| 1523 | 1523 |
| 1524 int handler_offset_; | 1524 int handler_offset_; |
| 1525 | 1525 |
| 1526 DISALLOW_COPY_AND_ASSIGN(JSEntryStub); | 1526 DISALLOW_COPY_AND_ASSIGN(JSEntryStub); |
| 1527 }; | 1527 }; |
| 1528 | 1528 |
| 1529 | 1529 |
| 1530 class JSConstructEntryStub : public JSEntryStub { | 1530 class JSConstructEntryStub : public JSEntryStub { |
| 1531 public: | 1531 public: |
| 1532 explicit JSConstructEntryStub(Isolate* isolate) : JSEntryStub(isolate) { | 1532 explicit JSConstructEntryStub(Isolate* isolate) : JSEntryStub(isolate) { |
| 1533 minor_key_ = 1; | 1533 minor_key_ = 1; |
| 1534 } | 1534 } |
| 1535 | 1535 |
| 1536 void Generate(MacroAssembler* masm) { GenerateBody(masm, true); } | 1536 void Generate(MacroAssembler* masm) { GenerateBody(masm, true); } |
| 1537 | 1537 |
| 1538 private: | 1538 private: |
| 1539 virtual void PrintName(OStream& os) const V8_OVERRIDE { // NOLINT | 1539 virtual void PrintName(OStream& os) const OVERRIDE { // NOLINT |
| 1540 os << "JSConstructEntryStub"; | 1540 os << "JSConstructEntryStub"; |
| 1541 } | 1541 } |
| 1542 | 1542 |
| 1543 DISALLOW_COPY_AND_ASSIGN(JSConstructEntryStub); | 1543 DISALLOW_COPY_AND_ASSIGN(JSConstructEntryStub); |
| 1544 }; | 1544 }; |
| 1545 | 1545 |
| 1546 | 1546 |
| 1547 class ArgumentsAccessStub: public PlatformCodeStub { | 1547 class ArgumentsAccessStub: public PlatformCodeStub { |
| 1548 public: | 1548 public: |
| 1549 enum Type { | 1549 enum Type { |
| 1550 READ_ELEMENT, | 1550 READ_ELEMENT, |
| 1551 NEW_SLOPPY_FAST, | 1551 NEW_SLOPPY_FAST, |
| 1552 NEW_SLOPPY_SLOW, | 1552 NEW_SLOPPY_SLOW, |
| 1553 NEW_STRICT | 1553 NEW_STRICT |
| 1554 }; | 1554 }; |
| 1555 | 1555 |
| 1556 ArgumentsAccessStub(Isolate* isolate, Type type) : PlatformCodeStub(isolate) { | 1556 ArgumentsAccessStub(Isolate* isolate, Type type) : PlatformCodeStub(isolate) { |
| 1557 minor_key_ = TypeBits::encode(type); | 1557 minor_key_ = TypeBits::encode(type); |
| 1558 } | 1558 } |
| 1559 | 1559 |
| 1560 private: | 1560 private: |
| 1561 virtual Major MajorKey() const V8_OVERRIDE { return ArgumentsAccess; } | 1561 virtual Major MajorKey() const OVERRIDE { return ArgumentsAccess; } |
| 1562 | 1562 |
| 1563 Type type() const { return TypeBits::decode(minor_key_); } | 1563 Type type() const { return TypeBits::decode(minor_key_); } |
| 1564 | 1564 |
| 1565 void Generate(MacroAssembler* masm); | 1565 void Generate(MacroAssembler* masm); |
| 1566 void GenerateReadElement(MacroAssembler* masm); | 1566 void GenerateReadElement(MacroAssembler* masm); |
| 1567 void GenerateNewStrict(MacroAssembler* masm); | 1567 void GenerateNewStrict(MacroAssembler* masm); |
| 1568 void GenerateNewSloppyFast(MacroAssembler* masm); | 1568 void GenerateNewSloppyFast(MacroAssembler* masm); |
| 1569 void GenerateNewSloppySlow(MacroAssembler* masm); | 1569 void GenerateNewSloppySlow(MacroAssembler* masm); |
| 1570 | 1570 |
| 1571 virtual void PrintName(OStream& os) const V8_OVERRIDE; // NOLINT | 1571 virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT |
| 1572 | 1572 |
| 1573 class TypeBits : public BitField<Type, 0, 2> {}; | 1573 class TypeBits : public BitField<Type, 0, 2> {}; |
| 1574 | 1574 |
| 1575 DISALLOW_COPY_AND_ASSIGN(ArgumentsAccessStub); | 1575 DISALLOW_COPY_AND_ASSIGN(ArgumentsAccessStub); |
| 1576 }; | 1576 }; |
| 1577 | 1577 |
| 1578 | 1578 |
| 1579 class RegExpExecStub: public PlatformCodeStub { | 1579 class RegExpExecStub: public PlatformCodeStub { |
| 1580 public: | 1580 public: |
| 1581 explicit RegExpExecStub(Isolate* isolate) : PlatformCodeStub(isolate) { } | 1581 explicit RegExpExecStub(Isolate* isolate) : PlatformCodeStub(isolate) { } |
| 1582 | 1582 |
| 1583 private: | 1583 private: |
| 1584 virtual Major MajorKey() const V8_OVERRIDE { return RegExpExec; } | 1584 virtual Major MajorKey() const OVERRIDE { return RegExpExec; } |
| 1585 | 1585 |
| 1586 void Generate(MacroAssembler* masm); | 1586 void Generate(MacroAssembler* masm); |
| 1587 | 1587 |
| 1588 DISALLOW_COPY_AND_ASSIGN(RegExpExecStub); | 1588 DISALLOW_COPY_AND_ASSIGN(RegExpExecStub); |
| 1589 }; | 1589 }; |
| 1590 | 1590 |
| 1591 | 1591 |
| 1592 class RegExpConstructResultStub V8_FINAL : public HydrogenCodeStub { | 1592 class RegExpConstructResultStub FINAL : public HydrogenCodeStub { |
| 1593 public: | 1593 public: |
| 1594 explicit RegExpConstructResultStub(Isolate* isolate) | 1594 explicit RegExpConstructResultStub(Isolate* isolate) |
| 1595 : HydrogenCodeStub(isolate) { } | 1595 : HydrogenCodeStub(isolate) { } |
| 1596 | 1596 |
| 1597 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 1597 virtual Handle<Code> GenerateCode() OVERRIDE; |
| 1598 | 1598 |
| 1599 virtual void InitializeInterfaceDescriptor( | 1599 virtual void InitializeInterfaceDescriptor( |
| 1600 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 1600 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
| 1601 | 1601 |
| 1602 virtual Major MajorKey() const V8_OVERRIDE { return RegExpConstructResult; } | 1602 virtual Major MajorKey() const OVERRIDE { return RegExpConstructResult; } |
| 1603 | 1603 |
| 1604 static void InstallDescriptors(Isolate* isolate); | 1604 static void InstallDescriptors(Isolate* isolate); |
| 1605 | 1605 |
| 1606 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 1606 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
| 1607 static const int kLength = 0; | 1607 static const int kLength = 0; |
| 1608 static const int kIndex = 1; | 1608 static const int kIndex = 1; |
| 1609 static const int kInput = 2; | 1609 static const int kInput = 2; |
| 1610 | 1610 |
| 1611 private: | 1611 private: |
| 1612 DISALLOW_COPY_AND_ASSIGN(RegExpConstructResultStub); | 1612 DISALLOW_COPY_AND_ASSIGN(RegExpConstructResultStub); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1624 void Generate(MacroAssembler* masm); | 1624 void Generate(MacroAssembler* masm); |
| 1625 | 1625 |
| 1626 static int ExtractArgcFromMinorKey(int minor_key) { | 1626 static int ExtractArgcFromMinorKey(int minor_key) { |
| 1627 return ArgcBits::decode(minor_key); | 1627 return ArgcBits::decode(minor_key); |
| 1628 } | 1628 } |
| 1629 | 1629 |
| 1630 virtual void InitializeInterfaceDescriptor( | 1630 virtual void InitializeInterfaceDescriptor( |
| 1631 CodeStubInterfaceDescriptor* descriptor); | 1631 CodeStubInterfaceDescriptor* descriptor); |
| 1632 | 1632 |
| 1633 private: | 1633 private: |
| 1634 virtual Major MajorKey() const V8_OVERRIDE { return CallFunction; } | 1634 virtual Major MajorKey() const OVERRIDE { return CallFunction; } |
| 1635 | 1635 |
| 1636 int argc() const { return ArgcBits::decode(minor_key_); } | 1636 int argc() const { return ArgcBits::decode(minor_key_); } |
| 1637 int flags() const { return FlagBits::decode(minor_key_); } | 1637 int flags() const { return FlagBits::decode(minor_key_); } |
| 1638 | 1638 |
| 1639 bool CallAsMethod() const { | 1639 bool CallAsMethod() const { |
| 1640 return flags() == CALL_AS_METHOD || flags() == WRAP_AND_CALL; | 1640 return flags() == CALL_AS_METHOD || flags() == WRAP_AND_CALL; |
| 1641 } | 1641 } |
| 1642 | 1642 |
| 1643 bool NeedsChecks() const { return flags() != WRAP_AND_CALL; } | 1643 bool NeedsChecks() const { return flags() != WRAP_AND_CALL; } |
| 1644 | 1644 |
| 1645 virtual void PrintName(OStream& os) const V8_OVERRIDE; // NOLINT | 1645 virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT |
| 1646 | 1646 |
| 1647 // Minor key encoding in 32 bits with Bitfield <Type, shift, size>. | 1647 // Minor key encoding in 32 bits with Bitfield <Type, shift, size>. |
| 1648 class FlagBits : public BitField<CallFunctionFlags, 0, 2> {}; | 1648 class FlagBits : public BitField<CallFunctionFlags, 0, 2> {}; |
| 1649 class ArgcBits : public BitField<unsigned, 2, Code::kArgumentsBits> {}; | 1649 class ArgcBits : public BitField<unsigned, 2, Code::kArgumentsBits> {}; |
| 1650 STATIC_ASSERT(Code::kArgumentsBits + 2 <= kStubMinorKeyBits); | 1650 STATIC_ASSERT(Code::kArgumentsBits + 2 <= kStubMinorKeyBits); |
| 1651 | 1651 |
| 1652 DISALLOW_COPY_AND_ASSIGN(CallFunctionStub); | 1652 DISALLOW_COPY_AND_ASSIGN(CallFunctionStub); |
| 1653 }; | 1653 }; |
| 1654 | 1654 |
| 1655 | 1655 |
| 1656 class CallConstructStub: public PlatformCodeStub { | 1656 class CallConstructStub: public PlatformCodeStub { |
| 1657 public: | 1657 public: |
| 1658 CallConstructStub(Isolate* isolate, CallConstructorFlags flags) | 1658 CallConstructStub(Isolate* isolate, CallConstructorFlags flags) |
| 1659 : PlatformCodeStub(isolate) { | 1659 : PlatformCodeStub(isolate) { |
| 1660 minor_key_ = FlagBits::encode(flags); | 1660 minor_key_ = FlagBits::encode(flags); |
| 1661 } | 1661 } |
| 1662 | 1662 |
| 1663 void Generate(MacroAssembler* masm); | 1663 void Generate(MacroAssembler* masm); |
| 1664 | 1664 |
| 1665 virtual void FinishCode(Handle<Code> code) { | 1665 virtual void FinishCode(Handle<Code> code) { |
| 1666 code->set_has_function_cache(RecordCallTarget()); | 1666 code->set_has_function_cache(RecordCallTarget()); |
| 1667 } | 1667 } |
| 1668 | 1668 |
| 1669 virtual void InitializeInterfaceDescriptor( | 1669 virtual void InitializeInterfaceDescriptor( |
| 1670 CodeStubInterfaceDescriptor* descriptor); | 1670 CodeStubInterfaceDescriptor* descriptor); |
| 1671 | 1671 |
| 1672 private: | 1672 private: |
| 1673 virtual Major MajorKey() const V8_OVERRIDE { return CallConstruct; } | 1673 virtual Major MajorKey() const OVERRIDE { return CallConstruct; } |
| 1674 | 1674 |
| 1675 CallConstructorFlags flags() const { return FlagBits::decode(minor_key_); } | 1675 CallConstructorFlags flags() const { return FlagBits::decode(minor_key_); } |
| 1676 | 1676 |
| 1677 bool RecordCallTarget() const { | 1677 bool RecordCallTarget() const { |
| 1678 return (flags() & RECORD_CONSTRUCTOR_TARGET) != 0; | 1678 return (flags() & RECORD_CONSTRUCTOR_TARGET) != 0; |
| 1679 } | 1679 } |
| 1680 | 1680 |
| 1681 virtual void PrintName(OStream& os) const V8_OVERRIDE; // NOLINT | 1681 virtual void PrintName(OStream& os) const OVERRIDE; // NOLINT |
| 1682 | 1682 |
| 1683 class FlagBits : public BitField<CallConstructorFlags, 0, 1> {}; | 1683 class FlagBits : public BitField<CallConstructorFlags, 0, 1> {}; |
| 1684 | 1684 |
| 1685 DISALLOW_COPY_AND_ASSIGN(CallConstructStub); | 1685 DISALLOW_COPY_AND_ASSIGN(CallConstructStub); |
| 1686 }; | 1686 }; |
| 1687 | 1687 |
| 1688 | 1688 |
| 1689 enum StringIndexFlags { | 1689 enum StringIndexFlags { |
| 1690 // Accepts smis or heap numbers. | 1690 // Accepts smis or heap numbers. |
| 1691 STRING_INDEX_IS_NUMBER, | 1691 STRING_INDEX_IS_NUMBER, |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1860 }; | 1860 }; |
| 1861 | 1861 |
| 1862 | 1862 |
| 1863 class LoadDictionaryElementStub : public HydrogenCodeStub { | 1863 class LoadDictionaryElementStub : public HydrogenCodeStub { |
| 1864 public: | 1864 public: |
| 1865 explicit LoadDictionaryElementStub(Isolate* isolate) | 1865 explicit LoadDictionaryElementStub(Isolate* isolate) |
| 1866 : HydrogenCodeStub(isolate) { | 1866 : HydrogenCodeStub(isolate) { |
| 1867 set_sub_minor_key(DICTIONARY_ELEMENTS); | 1867 set_sub_minor_key(DICTIONARY_ELEMENTS); |
| 1868 } | 1868 } |
| 1869 | 1869 |
| 1870 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 1870 virtual Handle<Code> GenerateCode() OVERRIDE; |
| 1871 | 1871 |
| 1872 virtual void InitializeInterfaceDescriptor( | 1872 virtual void InitializeInterfaceDescriptor( |
| 1873 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 1873 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
| 1874 | 1874 |
| 1875 private: | 1875 private: |
| 1876 virtual Major MajorKey() const V8_OVERRIDE { return LoadElement; } | 1876 virtual Major MajorKey() const OVERRIDE { return LoadElement; } |
| 1877 | 1877 |
| 1878 DISALLOW_COPY_AND_ASSIGN(LoadDictionaryElementStub); | 1878 DISALLOW_COPY_AND_ASSIGN(LoadDictionaryElementStub); |
| 1879 }; | 1879 }; |
| 1880 | 1880 |
| 1881 | 1881 |
| 1882 class LoadDictionaryElementPlatformStub : public PlatformCodeStub { | 1882 class LoadDictionaryElementPlatformStub : public PlatformCodeStub { |
| 1883 public: | 1883 public: |
| 1884 explicit LoadDictionaryElementPlatformStub(Isolate* isolate) | 1884 explicit LoadDictionaryElementPlatformStub(Isolate* isolate) |
| 1885 : PlatformCodeStub(isolate) { | 1885 : PlatformCodeStub(isolate) { |
| 1886 minor_key_ = DICTIONARY_ELEMENTS; | 1886 minor_key_ = DICTIONARY_ELEMENTS; |
| 1887 } | 1887 } |
| 1888 | 1888 |
| 1889 void Generate(MacroAssembler* masm); | 1889 void Generate(MacroAssembler* masm); |
| 1890 | 1890 |
| 1891 private: | 1891 private: |
| 1892 virtual Major MajorKey() const V8_OVERRIDE { return LoadElement; } | 1892 virtual Major MajorKey() const OVERRIDE { return LoadElement; } |
| 1893 | 1893 |
| 1894 DISALLOW_COPY_AND_ASSIGN(LoadDictionaryElementPlatformStub); | 1894 DISALLOW_COPY_AND_ASSIGN(LoadDictionaryElementPlatformStub); |
| 1895 }; | 1895 }; |
| 1896 | 1896 |
| 1897 | 1897 |
| 1898 class KeyedLoadGenericStub : public HydrogenCodeStub { | 1898 class KeyedLoadGenericStub : public HydrogenCodeStub { |
| 1899 public: | 1899 public: |
| 1900 explicit KeyedLoadGenericStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} | 1900 explicit KeyedLoadGenericStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} |
| 1901 | 1901 |
| 1902 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 1902 virtual Handle<Code> GenerateCode() OVERRIDE; |
| 1903 | 1903 |
| 1904 virtual void InitializeInterfaceDescriptor( | 1904 virtual void InitializeInterfaceDescriptor( |
| 1905 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 1905 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
| 1906 | 1906 |
| 1907 static void InstallDescriptors(Isolate* isolate); | 1907 static void InstallDescriptors(Isolate* isolate); |
| 1908 | 1908 |
| 1909 virtual Code::Kind GetCodeKind() const { return Code::KEYED_LOAD_IC; } | 1909 virtual Code::Kind GetCodeKind() const { return Code::KEYED_LOAD_IC; } |
| 1910 virtual InlineCacheState GetICState() const { return GENERIC; } | 1910 virtual InlineCacheState GetICState() const { return GENERIC; } |
| 1911 | 1911 |
| 1912 private: | 1912 private: |
| 1913 virtual Major MajorKey() const V8_OVERRIDE { return KeyedLoadGeneric; } | 1913 virtual Major MajorKey() const OVERRIDE { return KeyedLoadGeneric; } |
| 1914 | 1914 |
| 1915 DISALLOW_COPY_AND_ASSIGN(KeyedLoadGenericStub); | 1915 DISALLOW_COPY_AND_ASSIGN(KeyedLoadGenericStub); |
| 1916 }; | 1916 }; |
| 1917 | 1917 |
| 1918 | 1918 |
| 1919 class LoadICTrampolineStub : public PlatformCodeStub { | 1919 class LoadICTrampolineStub : public PlatformCodeStub { |
| 1920 public: | 1920 public: |
| 1921 LoadICTrampolineStub(Isolate* isolate, const LoadIC::State& state) | 1921 LoadICTrampolineStub(Isolate* isolate, const LoadIC::State& state) |
| 1922 : PlatformCodeStub(isolate) { | 1922 : PlatformCodeStub(isolate) { |
| 1923 minor_key_ = state.GetExtraICState(); | 1923 minor_key_ = state.GetExtraICState(); |
| 1924 } | 1924 } |
| 1925 | 1925 |
| 1926 virtual Code::Kind GetCodeKind() const V8_OVERRIDE { return Code::LOAD_IC; } | 1926 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::LOAD_IC; } |
| 1927 | 1927 |
| 1928 virtual InlineCacheState GetICState() const V8_FINAL V8_OVERRIDE { | 1928 virtual InlineCacheState GetICState() const FINAL OVERRIDE { |
| 1929 return GENERIC; | 1929 return GENERIC; |
| 1930 } | 1930 } |
| 1931 | 1931 |
| 1932 virtual ExtraICState GetExtraICState() const V8_FINAL V8_OVERRIDE { | 1932 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE { |
| 1933 return static_cast<ExtraICState>(minor_key_); | 1933 return static_cast<ExtraICState>(minor_key_); |
| 1934 } | 1934 } |
| 1935 | 1935 |
| 1936 virtual Major MajorKey() const V8_OVERRIDE { return LoadICTrampoline; } | 1936 virtual Major MajorKey() const OVERRIDE { return LoadICTrampoline; } |
| 1937 | 1937 |
| 1938 private: | 1938 private: |
| 1939 LoadIC::State state() const { | 1939 LoadIC::State state() const { |
| 1940 return LoadIC::State(static_cast<ExtraICState>(minor_key_)); | 1940 return LoadIC::State(static_cast<ExtraICState>(minor_key_)); |
| 1941 } | 1941 } |
| 1942 | 1942 |
| 1943 virtual void Generate(MacroAssembler* masm); | 1943 virtual void Generate(MacroAssembler* masm); |
| 1944 | 1944 |
| 1945 DISALLOW_COPY_AND_ASSIGN(LoadICTrampolineStub); | 1945 DISALLOW_COPY_AND_ASSIGN(LoadICTrampolineStub); |
| 1946 }; | 1946 }; |
| 1947 | 1947 |
| 1948 | 1948 |
| 1949 class KeyedLoadICTrampolineStub : public LoadICTrampolineStub { | 1949 class KeyedLoadICTrampolineStub : public LoadICTrampolineStub { |
| 1950 public: | 1950 public: |
| 1951 explicit KeyedLoadICTrampolineStub(Isolate* isolate) | 1951 explicit KeyedLoadICTrampolineStub(Isolate* isolate) |
| 1952 : LoadICTrampolineStub(isolate, LoadIC::State(0)) {} | 1952 : LoadICTrampolineStub(isolate, LoadIC::State(0)) {} |
| 1953 | 1953 |
| 1954 virtual Code::Kind GetCodeKind() const V8_OVERRIDE { | 1954 virtual Code::Kind GetCodeKind() const OVERRIDE { |
| 1955 return Code::KEYED_LOAD_IC; | 1955 return Code::KEYED_LOAD_IC; |
| 1956 } | 1956 } |
| 1957 | 1957 |
| 1958 virtual Major MajorKey() const V8_OVERRIDE { return KeyedLoadICTrampoline; } | 1958 virtual Major MajorKey() const OVERRIDE { return KeyedLoadICTrampoline; } |
| 1959 | 1959 |
| 1960 private: | 1960 private: |
| 1961 virtual void Generate(MacroAssembler* masm); | 1961 virtual void Generate(MacroAssembler* masm); |
| 1962 | 1962 |
| 1963 DISALLOW_COPY_AND_ASSIGN(KeyedLoadICTrampolineStub); | 1963 DISALLOW_COPY_AND_ASSIGN(KeyedLoadICTrampolineStub); |
| 1964 }; | 1964 }; |
| 1965 | 1965 |
| 1966 | 1966 |
| 1967 class VectorLoadStub : public HydrogenCodeStub { | 1967 class VectorLoadStub : public HydrogenCodeStub { |
| 1968 public: | 1968 public: |
| 1969 explicit VectorLoadStub(Isolate* isolate, const LoadIC::State& state) | 1969 explicit VectorLoadStub(Isolate* isolate, const LoadIC::State& state) |
| 1970 : HydrogenCodeStub(isolate), state_(state) {} | 1970 : HydrogenCodeStub(isolate), state_(state) {} |
| 1971 | 1971 |
| 1972 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 1972 virtual Handle<Code> GenerateCode() OVERRIDE; |
| 1973 | 1973 |
| 1974 virtual void InitializeInterfaceDescriptor( | 1974 virtual void InitializeInterfaceDescriptor( |
| 1975 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 1975 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
| 1976 | 1976 |
| 1977 static void InstallDescriptors(Isolate* isolate); | 1977 static void InstallDescriptors(Isolate* isolate); |
| 1978 | 1978 |
| 1979 virtual Code::Kind GetCodeKind() const V8_OVERRIDE { return Code::LOAD_IC; } | 1979 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::LOAD_IC; } |
| 1980 | 1980 |
| 1981 virtual InlineCacheState GetICState() const V8_FINAL V8_OVERRIDE { | 1981 virtual InlineCacheState GetICState() const FINAL OVERRIDE { |
| 1982 return GENERIC; | 1982 return GENERIC; |
| 1983 } | 1983 } |
| 1984 | 1984 |
| 1985 virtual ExtraICState GetExtraICState() const V8_FINAL V8_OVERRIDE { | 1985 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE { |
| 1986 return state_.GetExtraICState(); | 1986 return state_.GetExtraICState(); |
| 1987 } | 1987 } |
| 1988 | 1988 |
| 1989 virtual Major MajorKey() const V8_OVERRIDE { return VectorLoad; } | 1989 virtual Major MajorKey() const OVERRIDE { return VectorLoad; } |
| 1990 | 1990 |
| 1991 private: | 1991 private: |
| 1992 int NotMissMinorKey() const { return state_.GetExtraICState(); } | 1992 int NotMissMinorKey() const { return state_.GetExtraICState(); } |
| 1993 | 1993 |
| 1994 const LoadIC::State state_; | 1994 const LoadIC::State state_; |
| 1995 | 1995 |
| 1996 DISALLOW_COPY_AND_ASSIGN(VectorLoadStub); | 1996 DISALLOW_COPY_AND_ASSIGN(VectorLoadStub); |
| 1997 }; | 1997 }; |
| 1998 | 1998 |
| 1999 | 1999 |
| 2000 class VectorKeyedLoadStub : public VectorLoadStub { | 2000 class VectorKeyedLoadStub : public VectorLoadStub { |
| 2001 public: | 2001 public: |
| 2002 explicit VectorKeyedLoadStub(Isolate* isolate) | 2002 explicit VectorKeyedLoadStub(Isolate* isolate) |
| 2003 : VectorLoadStub(isolate, LoadIC::State(0)) {} | 2003 : VectorLoadStub(isolate, LoadIC::State(0)) {} |
| 2004 | 2004 |
| 2005 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 2005 virtual Handle<Code> GenerateCode() OVERRIDE; |
| 2006 | 2006 |
| 2007 virtual void InitializeInterfaceDescriptor( | 2007 virtual void InitializeInterfaceDescriptor( |
| 2008 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 2008 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
| 2009 | 2009 |
| 2010 static void InstallDescriptors(Isolate* isolate); | 2010 static void InstallDescriptors(Isolate* isolate); |
| 2011 | 2011 |
| 2012 virtual Code::Kind GetCodeKind() const V8_OVERRIDE { | 2012 virtual Code::Kind GetCodeKind() const OVERRIDE { |
| 2013 return Code::KEYED_LOAD_IC; | 2013 return Code::KEYED_LOAD_IC; |
| 2014 } | 2014 } |
| 2015 | 2015 |
| 2016 virtual Major MajorKey() const V8_OVERRIDE { return VectorKeyedLoad; } | 2016 virtual Major MajorKey() const OVERRIDE { return VectorKeyedLoad; } |
| 2017 | 2017 |
| 2018 private: | 2018 private: |
| 2019 DISALLOW_COPY_AND_ASSIGN(VectorKeyedLoadStub); | 2019 DISALLOW_COPY_AND_ASSIGN(VectorKeyedLoadStub); |
| 2020 }; | 2020 }; |
| 2021 | 2021 |
| 2022 | 2022 |
| 2023 class DoubleToIStub : public PlatformCodeStub { | 2023 class DoubleToIStub : public PlatformCodeStub { |
| 2024 public: | 2024 public: |
| 2025 DoubleToIStub(Isolate* isolate, Register source, Register destination, | 2025 DoubleToIStub(Isolate* isolate, Register source, Register destination, |
| 2026 int offset, bool is_truncating, bool skip_fastpath = false) | 2026 int offset, bool is_truncating, bool skip_fastpath = false) |
| 2027 : PlatformCodeStub(isolate) { | 2027 : PlatformCodeStub(isolate) { |
| 2028 minor_key_ = SourceRegisterBits::encode(source.code()) | | 2028 minor_key_ = SourceRegisterBits::encode(source.code()) | |
| 2029 DestinationRegisterBits::encode(destination.code()) | | 2029 DestinationRegisterBits::encode(destination.code()) | |
| 2030 OffsetBits::encode(offset) | | 2030 OffsetBits::encode(offset) | |
| 2031 IsTruncatingBits::encode(is_truncating) | | 2031 IsTruncatingBits::encode(is_truncating) | |
| 2032 SkipFastPathBits::encode(skip_fastpath) | | 2032 SkipFastPathBits::encode(skip_fastpath) | |
| 2033 SSE3Bits::encode(CpuFeatures::IsSupported(SSE3) ? 1 : 0); | 2033 SSE3Bits::encode(CpuFeatures::IsSupported(SSE3) ? 1 : 0); |
| 2034 } | 2034 } |
| 2035 | 2035 |
| 2036 void Generate(MacroAssembler* masm); | 2036 void Generate(MacroAssembler* masm); |
| 2037 | 2037 |
| 2038 virtual bool SometimesSetsUpAFrame() { return false; } | 2038 virtual bool SometimesSetsUpAFrame() { return false; } |
| 2039 | 2039 |
| 2040 private: | 2040 private: |
| 2041 virtual Major MajorKey() const V8_OVERRIDE { return DoubleToI; } | 2041 virtual Major MajorKey() const OVERRIDE { return DoubleToI; } |
| 2042 | 2042 |
| 2043 Register source() const { | 2043 Register source() const { |
| 2044 return Register::from_code(SourceRegisterBits::decode(minor_key_)); | 2044 return Register::from_code(SourceRegisterBits::decode(minor_key_)); |
| 2045 } | 2045 } |
| 2046 Register destination() const { | 2046 Register destination() const { |
| 2047 return Register::from_code(DestinationRegisterBits::decode(minor_key_)); | 2047 return Register::from_code(DestinationRegisterBits::decode(minor_key_)); |
| 2048 } | 2048 } |
| 2049 bool is_truncating() const { return IsTruncatingBits::decode(minor_key_); } | 2049 bool is_truncating() const { return IsTruncatingBits::decode(minor_key_); } |
| 2050 bool skip_fastpath() const { return SkipFastPathBits::decode(minor_key_); } | 2050 bool skip_fastpath() const { return SkipFastPathBits::decode(minor_key_); } |
| 2051 int offset() const { return OffsetBits::decode(minor_key_); } | 2051 int offset() const { return OffsetBits::decode(minor_key_); } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 2078 set_sub_minor_key(ElementsKindBits::encode(elements_kind) | | 2078 set_sub_minor_key(ElementsKindBits::encode(elements_kind) | |
| 2079 IsJSArrayBits::encode(is_js_array)); | 2079 IsJSArrayBits::encode(is_js_array)); |
| 2080 } | 2080 } |
| 2081 | 2081 |
| 2082 bool is_js_array() const { return IsJSArrayBits::decode(sub_minor_key()); } | 2082 bool is_js_array() const { return IsJSArrayBits::decode(sub_minor_key()); } |
| 2083 | 2083 |
| 2084 ElementsKind elements_kind() const { | 2084 ElementsKind elements_kind() const { |
| 2085 return ElementsKindBits::decode(sub_minor_key()); | 2085 return ElementsKindBits::decode(sub_minor_key()); |
| 2086 } | 2086 } |
| 2087 | 2087 |
| 2088 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 2088 virtual Handle<Code> GenerateCode() OVERRIDE; |
| 2089 | 2089 |
| 2090 static void InstallDescriptors(Isolate* isolate); | 2090 static void InstallDescriptors(Isolate* isolate); |
| 2091 | 2091 |
| 2092 virtual void InitializeInterfaceDescriptor( | 2092 virtual void InitializeInterfaceDescriptor( |
| 2093 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 2093 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
| 2094 | 2094 |
| 2095 private: | 2095 private: |
| 2096 virtual Major MajorKey() const V8_OVERRIDE { return LoadElement; } | 2096 virtual Major MajorKey() const OVERRIDE { return LoadElement; } |
| 2097 | 2097 |
| 2098 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; | 2098 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; |
| 2099 class IsJSArrayBits: public BitField<bool, 8, 1> {}; | 2099 class IsJSArrayBits: public BitField<bool, 8, 1> {}; |
| 2100 | 2100 |
| 2101 DISALLOW_COPY_AND_ASSIGN(LoadFastElementStub); | 2101 DISALLOW_COPY_AND_ASSIGN(LoadFastElementStub); |
| 2102 }; | 2102 }; |
| 2103 | 2103 |
| 2104 | 2104 |
| 2105 class StoreFastElementStub : public HydrogenCodeStub { | 2105 class StoreFastElementStub : public HydrogenCodeStub { |
| 2106 public: | 2106 public: |
| 2107 StoreFastElementStub(Isolate* isolate, bool is_js_array, | 2107 StoreFastElementStub(Isolate* isolate, bool is_js_array, |
| 2108 ElementsKind elements_kind, KeyedAccessStoreMode mode) | 2108 ElementsKind elements_kind, KeyedAccessStoreMode mode) |
| 2109 : HydrogenCodeStub(isolate) { | 2109 : HydrogenCodeStub(isolate) { |
| 2110 set_sub_minor_key(ElementsKindBits::encode(elements_kind) | | 2110 set_sub_minor_key(ElementsKindBits::encode(elements_kind) | |
| 2111 IsJSArrayBits::encode(is_js_array) | | 2111 IsJSArrayBits::encode(is_js_array) | |
| 2112 StoreModeBits::encode(mode)); | 2112 StoreModeBits::encode(mode)); |
| 2113 } | 2113 } |
| 2114 | 2114 |
| 2115 bool is_js_array() const { return IsJSArrayBits::decode(sub_minor_key()); } | 2115 bool is_js_array() const { return IsJSArrayBits::decode(sub_minor_key()); } |
| 2116 | 2116 |
| 2117 ElementsKind elements_kind() const { | 2117 ElementsKind elements_kind() const { |
| 2118 return ElementsKindBits::decode(sub_minor_key()); | 2118 return ElementsKindBits::decode(sub_minor_key()); |
| 2119 } | 2119 } |
| 2120 | 2120 |
| 2121 KeyedAccessStoreMode store_mode() const { | 2121 KeyedAccessStoreMode store_mode() const { |
| 2122 return StoreModeBits::decode(sub_minor_key()); | 2122 return StoreModeBits::decode(sub_minor_key()); |
| 2123 } | 2123 } |
| 2124 | 2124 |
| 2125 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 2125 virtual Handle<Code> GenerateCode() OVERRIDE; |
| 2126 | 2126 |
| 2127 virtual void InitializeInterfaceDescriptor( | 2127 virtual void InitializeInterfaceDescriptor( |
| 2128 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 2128 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
| 2129 | 2129 |
| 2130 private: | 2130 private: |
| 2131 virtual Major MajorKey() const V8_OVERRIDE { return StoreElement; } | 2131 virtual Major MajorKey() const OVERRIDE { return StoreElement; } |
| 2132 | 2132 |
| 2133 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; | 2133 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; |
| 2134 class StoreModeBits: public BitField<KeyedAccessStoreMode, 8, 4> {}; | 2134 class StoreModeBits: public BitField<KeyedAccessStoreMode, 8, 4> {}; |
| 2135 class IsJSArrayBits: public BitField<bool, 12, 1> {}; | 2135 class IsJSArrayBits: public BitField<bool, 12, 1> {}; |
| 2136 | 2136 |
| 2137 DISALLOW_COPY_AND_ASSIGN(StoreFastElementStub); | 2137 DISALLOW_COPY_AND_ASSIGN(StoreFastElementStub); |
| 2138 }; | 2138 }; |
| 2139 | 2139 |
| 2140 | 2140 |
| 2141 class TransitionElementsKindStub : public HydrogenCodeStub { | 2141 class TransitionElementsKindStub : public HydrogenCodeStub { |
| 2142 public: | 2142 public: |
| 2143 TransitionElementsKindStub(Isolate* isolate, | 2143 TransitionElementsKindStub(Isolate* isolate, |
| 2144 ElementsKind from_kind, | 2144 ElementsKind from_kind, |
| 2145 ElementsKind to_kind, | 2145 ElementsKind to_kind, |
| 2146 bool is_js_array) : HydrogenCodeStub(isolate) { | 2146 bool is_js_array) : HydrogenCodeStub(isolate) { |
| 2147 set_sub_minor_key(FromKindBits::encode(from_kind) | | 2147 set_sub_minor_key(FromKindBits::encode(from_kind) | |
| 2148 ToKindBits::encode(to_kind) | | 2148 ToKindBits::encode(to_kind) | |
| 2149 IsJSArrayBits::encode(is_js_array)); | 2149 IsJSArrayBits::encode(is_js_array)); |
| 2150 } | 2150 } |
| 2151 | 2151 |
| 2152 ElementsKind from_kind() const { | 2152 ElementsKind from_kind() const { |
| 2153 return FromKindBits::decode(sub_minor_key()); | 2153 return FromKindBits::decode(sub_minor_key()); |
| 2154 } | 2154 } |
| 2155 | 2155 |
| 2156 ElementsKind to_kind() const { return ToKindBits::decode(sub_minor_key()); } | 2156 ElementsKind to_kind() const { return ToKindBits::decode(sub_minor_key()); } |
| 2157 | 2157 |
| 2158 bool is_js_array() const { return IsJSArrayBits::decode(sub_minor_key()); } | 2158 bool is_js_array() const { return IsJSArrayBits::decode(sub_minor_key()); } |
| 2159 | 2159 |
| 2160 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 2160 virtual Handle<Code> GenerateCode() OVERRIDE; |
| 2161 | 2161 |
| 2162 virtual void InitializeInterfaceDescriptor( | 2162 virtual void InitializeInterfaceDescriptor( |
| 2163 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 2163 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
| 2164 | 2164 |
| 2165 private: | 2165 private: |
| 2166 virtual Major MajorKey() const V8_OVERRIDE { return TransitionElementsKind; } | 2166 virtual Major MajorKey() const OVERRIDE { return TransitionElementsKind; } |
| 2167 | 2167 |
| 2168 class FromKindBits: public BitField<ElementsKind, 8, 8> {}; | 2168 class FromKindBits: public BitField<ElementsKind, 8, 8> {}; |
| 2169 class ToKindBits: public BitField<ElementsKind, 0, 8> {}; | 2169 class ToKindBits: public BitField<ElementsKind, 0, 8> {}; |
| 2170 class IsJSArrayBits: public BitField<bool, 16, 1> {}; | 2170 class IsJSArrayBits: public BitField<bool, 16, 1> {}; |
| 2171 | 2171 |
| 2172 DISALLOW_COPY_AND_ASSIGN(TransitionElementsKindStub); | 2172 DISALLOW_COPY_AND_ASSIGN(TransitionElementsKindStub); |
| 2173 }; | 2173 }; |
| 2174 | 2174 |
| 2175 | 2175 |
| 2176 class ArrayConstructorStubBase : public HydrogenCodeStub { | 2176 class ArrayConstructorStubBase : public HydrogenCodeStub { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2220 | 2220 |
| 2221 class ArrayNoArgumentConstructorStub : public ArrayConstructorStubBase { | 2221 class ArrayNoArgumentConstructorStub : public ArrayConstructorStubBase { |
| 2222 public: | 2222 public: |
| 2223 ArrayNoArgumentConstructorStub( | 2223 ArrayNoArgumentConstructorStub( |
| 2224 Isolate* isolate, | 2224 Isolate* isolate, |
| 2225 ElementsKind kind, | 2225 ElementsKind kind, |
| 2226 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) | 2226 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) |
| 2227 : ArrayConstructorStubBase(isolate, kind, override_mode) { | 2227 : ArrayConstructorStubBase(isolate, kind, override_mode) { |
| 2228 } | 2228 } |
| 2229 | 2229 |
| 2230 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 2230 virtual Handle<Code> GenerateCode() OVERRIDE; |
| 2231 | 2231 |
| 2232 virtual void InitializeInterfaceDescriptor( | 2232 virtual void InitializeInterfaceDescriptor( |
| 2233 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 2233 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
| 2234 | 2234 |
| 2235 private: | 2235 private: |
| 2236 virtual Major MajorKey() const V8_OVERRIDE { | 2236 virtual Major MajorKey() const OVERRIDE { |
| 2237 return ArrayNoArgumentConstructor; | 2237 return ArrayNoArgumentConstructor; |
| 2238 } | 2238 } |
| 2239 | 2239 |
| 2240 virtual void PrintName(OStream& os) const V8_OVERRIDE { // NOLINT | 2240 virtual void PrintName(OStream& os) const OVERRIDE { // NOLINT |
| 2241 BasePrintName(os, "ArrayNoArgumentConstructorStub"); | 2241 BasePrintName(os, "ArrayNoArgumentConstructorStub"); |
| 2242 } | 2242 } |
| 2243 | 2243 |
| 2244 DISALLOW_COPY_AND_ASSIGN(ArrayNoArgumentConstructorStub); | 2244 DISALLOW_COPY_AND_ASSIGN(ArrayNoArgumentConstructorStub); |
| 2245 }; | 2245 }; |
| 2246 | 2246 |
| 2247 | 2247 |
| 2248 class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase { | 2248 class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase { |
| 2249 public: | 2249 public: |
| 2250 ArraySingleArgumentConstructorStub( | 2250 ArraySingleArgumentConstructorStub( |
| 2251 Isolate* isolate, | 2251 Isolate* isolate, |
| 2252 ElementsKind kind, | 2252 ElementsKind kind, |
| 2253 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) | 2253 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) |
| 2254 : ArrayConstructorStubBase(isolate, kind, override_mode) { | 2254 : ArrayConstructorStubBase(isolate, kind, override_mode) { |
| 2255 } | 2255 } |
| 2256 | 2256 |
| 2257 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 2257 virtual Handle<Code> GenerateCode() OVERRIDE; |
| 2258 | 2258 |
| 2259 virtual void InitializeInterfaceDescriptor( | 2259 virtual void InitializeInterfaceDescriptor( |
| 2260 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 2260 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
| 2261 | 2261 |
| 2262 private: | 2262 private: |
| 2263 virtual Major MajorKey() const V8_OVERRIDE { | 2263 virtual Major MajorKey() const OVERRIDE { |
| 2264 return ArraySingleArgumentConstructor; | 2264 return ArraySingleArgumentConstructor; |
| 2265 } | 2265 } |
| 2266 | 2266 |
| 2267 virtual void PrintName(OStream& os) const { // NOLINT | 2267 virtual void PrintName(OStream& os) const { // NOLINT |
| 2268 BasePrintName(os, "ArraySingleArgumentConstructorStub"); | 2268 BasePrintName(os, "ArraySingleArgumentConstructorStub"); |
| 2269 } | 2269 } |
| 2270 | 2270 |
| 2271 DISALLOW_COPY_AND_ASSIGN(ArraySingleArgumentConstructorStub); | 2271 DISALLOW_COPY_AND_ASSIGN(ArraySingleArgumentConstructorStub); |
| 2272 }; | 2272 }; |
| 2273 | 2273 |
| 2274 | 2274 |
| 2275 class ArrayNArgumentsConstructorStub : public ArrayConstructorStubBase { | 2275 class ArrayNArgumentsConstructorStub : public ArrayConstructorStubBase { |
| 2276 public: | 2276 public: |
| 2277 ArrayNArgumentsConstructorStub( | 2277 ArrayNArgumentsConstructorStub( |
| 2278 Isolate* isolate, | 2278 Isolate* isolate, |
| 2279 ElementsKind kind, | 2279 ElementsKind kind, |
| 2280 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) | 2280 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) |
| 2281 : ArrayConstructorStubBase(isolate, kind, override_mode) { | 2281 : ArrayConstructorStubBase(isolate, kind, override_mode) { |
| 2282 } | 2282 } |
| 2283 | 2283 |
| 2284 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 2284 virtual Handle<Code> GenerateCode() OVERRIDE; |
| 2285 | 2285 |
| 2286 virtual void InitializeInterfaceDescriptor( | 2286 virtual void InitializeInterfaceDescriptor( |
| 2287 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 2287 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
| 2288 | 2288 |
| 2289 private: | 2289 private: |
| 2290 virtual Major MajorKey() const V8_OVERRIDE { | 2290 virtual Major MajorKey() const OVERRIDE { |
| 2291 return ArrayNArgumentsConstructor; | 2291 return ArrayNArgumentsConstructor; |
| 2292 } | 2292 } |
| 2293 | 2293 |
| 2294 virtual void PrintName(OStream& os) const { // NOLINT | 2294 virtual void PrintName(OStream& os) const { // NOLINT |
| 2295 BasePrintName(os, "ArrayNArgumentsConstructorStub"); | 2295 BasePrintName(os, "ArrayNArgumentsConstructorStub"); |
| 2296 } | 2296 } |
| 2297 | 2297 |
| 2298 DISALLOW_COPY_AND_ASSIGN(ArrayNArgumentsConstructorStub); | 2298 DISALLOW_COPY_AND_ASSIGN(ArrayNArgumentsConstructorStub); |
| 2299 }; | 2299 }; |
| 2300 | 2300 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 2323 }; | 2323 }; |
| 2324 | 2324 |
| 2325 | 2325 |
| 2326 class InternalArrayNoArgumentConstructorStub : public | 2326 class InternalArrayNoArgumentConstructorStub : public |
| 2327 InternalArrayConstructorStubBase { | 2327 InternalArrayConstructorStubBase { |
| 2328 public: | 2328 public: |
| 2329 InternalArrayNoArgumentConstructorStub(Isolate* isolate, | 2329 InternalArrayNoArgumentConstructorStub(Isolate* isolate, |
| 2330 ElementsKind kind) | 2330 ElementsKind kind) |
| 2331 : InternalArrayConstructorStubBase(isolate, kind) { } | 2331 : InternalArrayConstructorStubBase(isolate, kind) { } |
| 2332 | 2332 |
| 2333 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 2333 virtual Handle<Code> GenerateCode() OVERRIDE; |
| 2334 | 2334 |
| 2335 virtual void InitializeInterfaceDescriptor( | 2335 virtual void InitializeInterfaceDescriptor( |
| 2336 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 2336 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
| 2337 | 2337 |
| 2338 private: | 2338 private: |
| 2339 virtual Major MajorKey() const V8_OVERRIDE { | 2339 virtual Major MajorKey() const OVERRIDE { |
| 2340 return InternalArrayNoArgumentConstructor; | 2340 return InternalArrayNoArgumentConstructor; |
| 2341 } | 2341 } |
| 2342 | 2342 |
| 2343 DISALLOW_COPY_AND_ASSIGN(InternalArrayNoArgumentConstructorStub); | 2343 DISALLOW_COPY_AND_ASSIGN(InternalArrayNoArgumentConstructorStub); |
| 2344 }; | 2344 }; |
| 2345 | 2345 |
| 2346 | 2346 |
| 2347 class InternalArraySingleArgumentConstructorStub : public | 2347 class InternalArraySingleArgumentConstructorStub : public |
| 2348 InternalArrayConstructorStubBase { | 2348 InternalArrayConstructorStubBase { |
| 2349 public: | 2349 public: |
| 2350 InternalArraySingleArgumentConstructorStub(Isolate* isolate, | 2350 InternalArraySingleArgumentConstructorStub(Isolate* isolate, |
| 2351 ElementsKind kind) | 2351 ElementsKind kind) |
| 2352 : InternalArrayConstructorStubBase(isolate, kind) { } | 2352 : InternalArrayConstructorStubBase(isolate, kind) { } |
| 2353 | 2353 |
| 2354 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 2354 virtual Handle<Code> GenerateCode() OVERRIDE; |
| 2355 | 2355 |
| 2356 virtual void InitializeInterfaceDescriptor( | 2356 virtual void InitializeInterfaceDescriptor( |
| 2357 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 2357 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
| 2358 | 2358 |
| 2359 private: | 2359 private: |
| 2360 virtual Major MajorKey() const V8_OVERRIDE { | 2360 virtual Major MajorKey() const OVERRIDE { |
| 2361 return InternalArraySingleArgumentConstructor; | 2361 return InternalArraySingleArgumentConstructor; |
| 2362 } | 2362 } |
| 2363 | 2363 |
| 2364 DISALLOW_COPY_AND_ASSIGN(InternalArraySingleArgumentConstructorStub); | 2364 DISALLOW_COPY_AND_ASSIGN(InternalArraySingleArgumentConstructorStub); |
| 2365 }; | 2365 }; |
| 2366 | 2366 |
| 2367 | 2367 |
| 2368 class InternalArrayNArgumentsConstructorStub : public | 2368 class InternalArrayNArgumentsConstructorStub : public |
| 2369 InternalArrayConstructorStubBase { | 2369 InternalArrayConstructorStubBase { |
| 2370 public: | 2370 public: |
| 2371 InternalArrayNArgumentsConstructorStub(Isolate* isolate, ElementsKind kind) | 2371 InternalArrayNArgumentsConstructorStub(Isolate* isolate, ElementsKind kind) |
| 2372 : InternalArrayConstructorStubBase(isolate, kind) { } | 2372 : InternalArrayConstructorStubBase(isolate, kind) { } |
| 2373 | 2373 |
| 2374 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 2374 virtual Handle<Code> GenerateCode() OVERRIDE; |
| 2375 | 2375 |
| 2376 virtual void InitializeInterfaceDescriptor( | 2376 virtual void InitializeInterfaceDescriptor( |
| 2377 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 2377 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
| 2378 | 2378 |
| 2379 private: | 2379 private: |
| 2380 virtual Major MajorKey() const V8_OVERRIDE { | 2380 virtual Major MajorKey() const OVERRIDE { |
| 2381 return InternalArrayNArgumentsConstructor; | 2381 return InternalArrayNArgumentsConstructor; |
| 2382 } | 2382 } |
| 2383 | 2383 |
| 2384 DISALLOW_COPY_AND_ASSIGN(InternalArrayNArgumentsConstructorStub); | 2384 DISALLOW_COPY_AND_ASSIGN(InternalArrayNArgumentsConstructorStub); |
| 2385 }; | 2385 }; |
| 2386 | 2386 |
| 2387 | 2387 |
| 2388 class StoreElementStub : public PlatformCodeStub { | 2388 class StoreElementStub : public PlatformCodeStub { |
| 2389 public: | 2389 public: |
| 2390 StoreElementStub(Isolate* isolate, ElementsKind elements_kind) | 2390 StoreElementStub(Isolate* isolate, ElementsKind elements_kind) |
| 2391 : PlatformCodeStub(isolate) { | 2391 : PlatformCodeStub(isolate) { |
| 2392 minor_key_ = ElementsKindBits::encode(elements_kind); | 2392 minor_key_ = ElementsKindBits::encode(elements_kind); |
| 2393 } | 2393 } |
| 2394 | 2394 |
| 2395 void Generate(MacroAssembler* masm); | 2395 void Generate(MacroAssembler* masm); |
| 2396 | 2396 |
| 2397 private: | 2397 private: |
| 2398 virtual Major MajorKey() const V8_OVERRIDE { return StoreElement; } | 2398 virtual Major MajorKey() const OVERRIDE { return StoreElement; } |
| 2399 | 2399 |
| 2400 ElementsKind elements_kind() const { | 2400 ElementsKind elements_kind() const { |
| 2401 return ElementsKindBits::decode(minor_key_); | 2401 return ElementsKindBits::decode(minor_key_); |
| 2402 } | 2402 } |
| 2403 | 2403 |
| 2404 class ElementsKindBits : public BitField<ElementsKind, 0, 8> {}; | 2404 class ElementsKindBits : public BitField<ElementsKind, 0, 8> {}; |
| 2405 | 2405 |
| 2406 DISALLOW_COPY_AND_ASSIGN(StoreElementStub); | 2406 DISALLOW_COPY_AND_ASSIGN(StoreElementStub); |
| 2407 }; | 2407 }; |
| 2408 | 2408 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2454 ToBooleanStub(Isolate* isolate, ExtraICState state) | 2454 ToBooleanStub(Isolate* isolate, ExtraICState state) |
| 2455 : HydrogenCodeStub(isolate) { | 2455 : HydrogenCodeStub(isolate) { |
| 2456 set_sub_minor_key(TypesBits::encode(static_cast<byte>(state)) | | 2456 set_sub_minor_key(TypesBits::encode(static_cast<byte>(state)) | |
| 2457 ResultModeBits::encode(RESULT_AS_SMI)); | 2457 ResultModeBits::encode(RESULT_AS_SMI)); |
| 2458 } | 2458 } |
| 2459 | 2459 |
| 2460 bool UpdateStatus(Handle<Object> object); | 2460 bool UpdateStatus(Handle<Object> object); |
| 2461 Types types() const { return Types(TypesBits::decode(sub_minor_key())); } | 2461 Types types() const { return Types(TypesBits::decode(sub_minor_key())); } |
| 2462 ResultMode mode() const { return ResultModeBits::decode(sub_minor_key()); } | 2462 ResultMode mode() const { return ResultModeBits::decode(sub_minor_key()); } |
| 2463 | 2463 |
| 2464 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 2464 virtual Handle<Code> GenerateCode() OVERRIDE; |
| 2465 virtual void InitializeInterfaceDescriptor( | 2465 virtual void InitializeInterfaceDescriptor( |
| 2466 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 2466 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
| 2467 | 2467 |
| 2468 virtual Code::Kind GetCodeKind() const { return Code::TO_BOOLEAN_IC; } | 2468 virtual Code::Kind GetCodeKind() const { return Code::TO_BOOLEAN_IC; } |
| 2469 virtual void PrintState(OStream& os) const V8_OVERRIDE; // NOLINT | 2469 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT |
| 2470 | 2470 |
| 2471 virtual bool SometimesSetsUpAFrame() { return false; } | 2471 virtual bool SometimesSetsUpAFrame() { return false; } |
| 2472 | 2472 |
| 2473 static void InstallDescriptors(Isolate* isolate) { | 2473 static void InstallDescriptors(Isolate* isolate) { |
| 2474 ToBooleanStub stub(isolate, RESULT_AS_SMI); | 2474 ToBooleanStub stub(isolate, RESULT_AS_SMI); |
| 2475 stub.InitializeInterfaceDescriptor( | 2475 stub.InitializeInterfaceDescriptor( |
| 2476 isolate->code_stub_interface_descriptor(CodeStub::ToBoolean)); | 2476 isolate->code_stub_interface_descriptor(CodeStub::ToBoolean)); |
| 2477 } | 2477 } |
| 2478 | 2478 |
| 2479 static Handle<Code> GetUninitialized(Isolate* isolate) { | 2479 static Handle<Code> GetUninitialized(Isolate* isolate) { |
| 2480 return ToBooleanStub(isolate, UNINITIALIZED).GetCode(); | 2480 return ToBooleanStub(isolate, UNINITIALIZED).GetCode(); |
| 2481 } | 2481 } |
| 2482 | 2482 |
| 2483 virtual ExtraICState GetExtraICState() const { return types().ToIntegral(); } | 2483 virtual ExtraICState GetExtraICState() const { return types().ToIntegral(); } |
| 2484 | 2484 |
| 2485 virtual InlineCacheState GetICState() const { | 2485 virtual InlineCacheState GetICState() const { |
| 2486 if (types().IsEmpty()) { | 2486 if (types().IsEmpty()) { |
| 2487 return ::v8::internal::UNINITIALIZED; | 2487 return ::v8::internal::UNINITIALIZED; |
| 2488 } else { | 2488 } else { |
| 2489 return MONOMORPHIC; | 2489 return MONOMORPHIC; |
| 2490 } | 2490 } |
| 2491 } | 2491 } |
| 2492 | 2492 |
| 2493 private: | 2493 private: |
| 2494 virtual Major MajorKey() const V8_OVERRIDE { return ToBoolean; } | 2494 virtual Major MajorKey() const OVERRIDE { return ToBoolean; } |
| 2495 | 2495 |
| 2496 ToBooleanStub(Isolate* isolate, InitializationState init_state) | 2496 ToBooleanStub(Isolate* isolate, InitializationState init_state) |
| 2497 : HydrogenCodeStub(isolate, init_state) { | 2497 : HydrogenCodeStub(isolate, init_state) { |
| 2498 set_sub_minor_key(ResultModeBits::encode(RESULT_AS_SMI)); | 2498 set_sub_minor_key(ResultModeBits::encode(RESULT_AS_SMI)); |
| 2499 } | 2499 } |
| 2500 | 2500 |
| 2501 class TypesBits : public BitField<byte, 0, NUMBER_OF_TYPES> {}; | 2501 class TypesBits : public BitField<byte, 0, NUMBER_OF_TYPES> {}; |
| 2502 class ResultModeBits : public BitField<ResultMode, NUMBER_OF_TYPES, 2> {}; | 2502 class ResultModeBits : public BitField<ResultMode, NUMBER_OF_TYPES, 2> {}; |
| 2503 | 2503 |
| 2504 DISALLOW_COPY_AND_ASSIGN(ToBooleanStub); | 2504 DISALLOW_COPY_AND_ASSIGN(ToBooleanStub); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2519 StoreModeBits::encode(store_mode)); | 2519 StoreModeBits::encode(store_mode)); |
| 2520 } | 2520 } |
| 2521 | 2521 |
| 2522 ElementsKind from_kind() const { return FromBits::decode(sub_minor_key()); } | 2522 ElementsKind from_kind() const { return FromBits::decode(sub_minor_key()); } |
| 2523 ElementsKind to_kind() const { return ToBits::decode(sub_minor_key()); } | 2523 ElementsKind to_kind() const { return ToBits::decode(sub_minor_key()); } |
| 2524 bool is_jsarray() const { return IsJSArrayBits::decode(sub_minor_key()); } | 2524 bool is_jsarray() const { return IsJSArrayBits::decode(sub_minor_key()); } |
| 2525 KeyedAccessStoreMode store_mode() const { | 2525 KeyedAccessStoreMode store_mode() const { |
| 2526 return StoreModeBits::decode(sub_minor_key()); | 2526 return StoreModeBits::decode(sub_minor_key()); |
| 2527 } | 2527 } |
| 2528 | 2528 |
| 2529 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 2529 virtual Handle<Code> GenerateCode() OVERRIDE; |
| 2530 | 2530 |
| 2531 virtual void InitializeInterfaceDescriptor( | 2531 virtual void InitializeInterfaceDescriptor( |
| 2532 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 2532 CodeStubInterfaceDescriptor* descriptor) OVERRIDE; |
| 2533 | 2533 |
| 2534 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 2534 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
| 2535 enum ParameterIndices { | 2535 enum ParameterIndices { |
| 2536 kValueIndex, | 2536 kValueIndex, |
| 2537 kMapIndex, | 2537 kMapIndex, |
| 2538 kKeyIndex, | 2538 kKeyIndex, |
| 2539 kObjectIndex, | 2539 kObjectIndex, |
| 2540 kParameterCount | 2540 kParameterCount |
| 2541 }; | 2541 }; |
| 2542 | 2542 |
| 2543 static const Register ValueRegister() { | 2543 static const Register ValueRegister() { |
| 2544 return StoreConvention::ValueRegister(); | 2544 return StoreConvention::ValueRegister(); |
| 2545 } | 2545 } |
| 2546 static const Register MapRegister() { return StoreConvention::MapRegister(); } | 2546 static const Register MapRegister() { return StoreConvention::MapRegister(); } |
| 2547 static const Register KeyRegister() { | 2547 static const Register KeyRegister() { |
| 2548 return StoreConvention::NameRegister(); | 2548 return StoreConvention::NameRegister(); |
| 2549 } | 2549 } |
| 2550 static const Register ObjectRegister() { | 2550 static const Register ObjectRegister() { |
| 2551 return StoreConvention::ReceiverRegister(); | 2551 return StoreConvention::ReceiverRegister(); |
| 2552 } | 2552 } |
| 2553 | 2553 |
| 2554 private: | 2554 private: |
| 2555 virtual Major MajorKey() const V8_OVERRIDE { | 2555 virtual Major MajorKey() const OVERRIDE { |
| 2556 return ElementsTransitionAndStore; | 2556 return ElementsTransitionAndStore; |
| 2557 } | 2557 } |
| 2558 | 2558 |
| 2559 class FromBits : public BitField<ElementsKind, 0, 8> {}; | 2559 class FromBits : public BitField<ElementsKind, 0, 8> {}; |
| 2560 class ToBits : public BitField<ElementsKind, 8, 8> {}; | 2560 class ToBits : public BitField<ElementsKind, 8, 8> {}; |
| 2561 class IsJSArrayBits : public BitField<bool, 16, 1> {}; | 2561 class IsJSArrayBits : public BitField<bool, 16, 1> {}; |
| 2562 class StoreModeBits : public BitField<KeyedAccessStoreMode, 17, 4> {}; | 2562 class StoreModeBits : public BitField<KeyedAccessStoreMode, 17, 4> {}; |
| 2563 | 2563 |
| 2564 DISALLOW_COPY_AND_ASSIGN(ElementsTransitionAndStoreStub); | 2564 DISALLOW_COPY_AND_ASSIGN(ElementsTransitionAndStoreStub); |
| 2565 }; | 2565 }; |
| 2566 | 2566 |
| 2567 | 2567 |
| 2568 class StoreArrayLiteralElementStub : public PlatformCodeStub { | 2568 class StoreArrayLiteralElementStub : public PlatformCodeStub { |
| 2569 public: | 2569 public: |
| 2570 explicit StoreArrayLiteralElementStub(Isolate* isolate) | 2570 explicit StoreArrayLiteralElementStub(Isolate* isolate) |
| 2571 : PlatformCodeStub(isolate) { } | 2571 : PlatformCodeStub(isolate) { } |
| 2572 | 2572 |
| 2573 private: | 2573 private: |
| 2574 virtual Major MajorKey() const V8_OVERRIDE { | 2574 virtual Major MajorKey() const OVERRIDE { |
| 2575 return StoreArrayLiteralElement; | 2575 return StoreArrayLiteralElement; |
| 2576 } | 2576 } |
| 2577 | 2577 |
| 2578 void Generate(MacroAssembler* masm); | 2578 void Generate(MacroAssembler* masm); |
| 2579 | 2579 |
| 2580 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); | 2580 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); |
| 2581 }; | 2581 }; |
| 2582 | 2582 |
| 2583 | 2583 |
| 2584 class StubFailureTrampolineStub : public PlatformCodeStub { | 2584 class StubFailureTrampolineStub : public PlatformCodeStub { |
| 2585 public: | 2585 public: |
| 2586 StubFailureTrampolineStub(Isolate* isolate, StubFunctionMode function_mode) | 2586 StubFailureTrampolineStub(Isolate* isolate, StubFunctionMode function_mode) |
| 2587 : PlatformCodeStub(isolate) { | 2587 : PlatformCodeStub(isolate) { |
| 2588 minor_key_ = FunctionModeField::encode(function_mode); | 2588 minor_key_ = FunctionModeField::encode(function_mode); |
| 2589 } | 2589 } |
| 2590 | 2590 |
| 2591 static void GenerateAheadOfTime(Isolate* isolate); | 2591 static void GenerateAheadOfTime(Isolate* isolate); |
| 2592 | 2592 |
| 2593 private: | 2593 private: |
| 2594 virtual Major MajorKey() const V8_OVERRIDE { return StubFailureTrampoline; } | 2594 virtual Major MajorKey() const OVERRIDE { return StubFailureTrampoline; } |
| 2595 | 2595 |
| 2596 StubFunctionMode function_mode() const { | 2596 StubFunctionMode function_mode() const { |
| 2597 return FunctionModeField::decode(minor_key_); | 2597 return FunctionModeField::decode(minor_key_); |
| 2598 } | 2598 } |
| 2599 | 2599 |
| 2600 void Generate(MacroAssembler* masm); | 2600 void Generate(MacroAssembler* masm); |
| 2601 | 2601 |
| 2602 class FunctionModeField : public BitField<StubFunctionMode, 0, 1> {}; | 2602 class FunctionModeField : public BitField<StubFunctionMode, 0, 1> {}; |
| 2603 | 2603 |
| 2604 DISALLOW_COPY_AND_ASSIGN(StubFailureTrampolineStub); | 2604 DISALLOW_COPY_AND_ASSIGN(StubFailureTrampolineStub); |
| 2605 }; | 2605 }; |
| 2606 | 2606 |
| 2607 | 2607 |
| 2608 class ProfileEntryHookStub : public PlatformCodeStub { | 2608 class ProfileEntryHookStub : public PlatformCodeStub { |
| 2609 public: | 2609 public: |
| 2610 explicit ProfileEntryHookStub(Isolate* isolate) : PlatformCodeStub(isolate) {} | 2610 explicit ProfileEntryHookStub(Isolate* isolate) : PlatformCodeStub(isolate) {} |
| 2611 | 2611 |
| 2612 // The profile entry hook function is not allowed to cause a GC. | 2612 // The profile entry hook function is not allowed to cause a GC. |
| 2613 virtual bool SometimesSetsUpAFrame() { return false; } | 2613 virtual bool SometimesSetsUpAFrame() { return false; } |
| 2614 | 2614 |
| 2615 // Generates a call to the entry hook if it's enabled. | 2615 // Generates a call to the entry hook if it's enabled. |
| 2616 static void MaybeCallEntryHook(MacroAssembler* masm); | 2616 static void MaybeCallEntryHook(MacroAssembler* masm); |
| 2617 | 2617 |
| 2618 private: | 2618 private: |
| 2619 static void EntryHookTrampoline(intptr_t function, | 2619 static void EntryHookTrampoline(intptr_t function, |
| 2620 intptr_t stack_pointer, | 2620 intptr_t stack_pointer, |
| 2621 Isolate* isolate); | 2621 Isolate* isolate); |
| 2622 | 2622 |
| 2623 virtual Major MajorKey() const V8_OVERRIDE { return ProfileEntryHook; } | 2623 virtual Major MajorKey() const OVERRIDE { return ProfileEntryHook; } |
| 2624 | 2624 |
| 2625 void Generate(MacroAssembler* masm); | 2625 void Generate(MacroAssembler* masm); |
| 2626 | 2626 |
| 2627 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 2627 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); |
| 2628 }; | 2628 }; |
| 2629 | 2629 |
| 2630 | 2630 |
| 2631 } } // namespace v8::internal | 2631 } } // namespace v8::internal |
| 2632 | 2632 |
| 2633 #endif // V8_CODE_STUBS_H_ | 2633 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |