| 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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 | 282 |
| 283 | 283 |
| 284 #define DEFINE_CODE_STUB_BASE(NAME, SUPER) \ | 284 #define DEFINE_CODE_STUB_BASE(NAME, SUPER) \ |
| 285 public: \ | 285 public: \ |
| 286 NAME(uint32_t key, Isolate* isolate) : SUPER(key, isolate) {} \ | 286 NAME(uint32_t key, Isolate* isolate) : SUPER(key, isolate) {} \ |
| 287 \ | 287 \ |
| 288 private: \ | 288 private: \ |
| 289 DISALLOW_COPY_AND_ASSIGN(NAME) | 289 DISALLOW_COPY_AND_ASSIGN(NAME) |
| 290 | 290 |
| 291 | 291 |
| 292 #define DEFINE_CODE_STUB(NAME, SUPER) \ | 292 #define DEFINE_CODE_STUB(NAME, SUPER) \ |
| 293 protected: \ | 293 protected: \ |
| 294 virtual inline Major MajorKey() const OVERRIDE { \ | 294 inline Major MajorKey() const OVERRIDE { return NAME; }; \ |
| 295 return NAME; \ | |
| 296 }; \ | |
| 297 DEFINE_CODE_STUB_BASE(NAME##Stub, SUPER) | 295 DEFINE_CODE_STUB_BASE(NAME##Stub, SUPER) |
| 298 | 296 |
| 299 | 297 |
| 300 #define DEFINE_PLATFORM_CODE_STUB(NAME, SUPER) \ | 298 #define DEFINE_PLATFORM_CODE_STUB(NAME, SUPER) \ |
| 301 private: \ | 299 private: \ |
| 302 virtual void Generate(MacroAssembler* masm) OVERRIDE; \ | 300 void Generate(MacroAssembler* masm) OVERRIDE; \ |
| 303 DEFINE_CODE_STUB(NAME, SUPER) | 301 DEFINE_CODE_STUB(NAME, SUPER) |
| 304 | 302 |
| 305 | 303 |
| 306 #define DEFINE_HYDROGEN_CODE_STUB(NAME, SUPER) \ | 304 #define DEFINE_HYDROGEN_CODE_STUB(NAME, SUPER) \ |
| 307 public: \ | 305 public: \ |
| 308 virtual void InitializeDescriptor(CodeStubDescriptor* descriptor) OVERRIDE; \ | 306 void InitializeDescriptor(CodeStubDescriptor* descriptor) OVERRIDE; \ |
| 309 virtual Handle<Code> GenerateCode() OVERRIDE; \ | 307 Handle<Code> GenerateCode() OVERRIDE; \ |
| 310 DEFINE_CODE_STUB(NAME, SUPER) | 308 DEFINE_CODE_STUB(NAME, SUPER) |
| 311 | 309 |
| 312 #define DEFINE_HANDLER_CODE_STUB(NAME, SUPER) \ | 310 #define DEFINE_HANDLER_CODE_STUB(NAME, SUPER) \ |
| 313 public: \ | 311 public: \ |
| 314 virtual Handle<Code> GenerateCode() OVERRIDE; \ | 312 Handle<Code> GenerateCode() OVERRIDE; \ |
| 315 DEFINE_CODE_STUB(NAME, SUPER) | 313 DEFINE_CODE_STUB(NAME, SUPER) |
| 316 | 314 |
| 317 #define DEFINE_CALL_INTERFACE_DESCRIPTOR(NAME) \ | 315 #define DEFINE_CALL_INTERFACE_DESCRIPTOR(NAME) \ |
| 318 public: \ | 316 public: \ |
| 319 virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE { \ | 317 CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE { \ |
| 320 return NAME##Descriptor(isolate()); \ | 318 return NAME##Descriptor(isolate()); \ |
| 321 } | 319 } |
| 322 | 320 |
| 323 // There are some code stubs we just can't describe right now with a | 321 // There are some code stubs we just can't describe right now with a |
| 324 // CallInterfaceDescriptor. Isolate behavior for those cases with this macro. | 322 // CallInterfaceDescriptor. Isolate behavior for those cases with this macro. |
| 325 // An attempt to retrieve a descriptor will fail. | 323 // An attempt to retrieve a descriptor will fail. |
| 326 #define DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR() \ | 324 #define DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR() \ |
| 327 public: \ | 325 public: \ |
| 328 virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE { \ | 326 CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE { \ |
| 329 UNREACHABLE(); \ | 327 UNREACHABLE(); \ |
| 330 return CallInterfaceDescriptor(); \ | 328 return CallInterfaceDescriptor(); \ |
| 331 } | 329 } |
| 332 | 330 |
| 333 | 331 |
| 334 class PlatformCodeStub : public CodeStub { | 332 class PlatformCodeStub : public CodeStub { |
| 335 public: | 333 public: |
| 336 // Retrieve the code for the stub. Generate the code if needed. | 334 // Retrieve the code for the stub. Generate the code if needed. |
| 337 virtual Handle<Code> GenerateCode() OVERRIDE; | 335 Handle<Code> GenerateCode() OVERRIDE; |
| 338 | 336 |
| 339 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::STUB; } | 337 Code::Kind GetCodeKind() const OVERRIDE { return Code::STUB; } |
| 340 | 338 |
| 341 protected: | 339 protected: |
| 342 explicit PlatformCodeStub(Isolate* isolate) : CodeStub(isolate) {} | 340 explicit PlatformCodeStub(Isolate* isolate) : CodeStub(isolate) {} |
| 343 | 341 |
| 344 // Generates the assembler code for the stub. | 342 // Generates the assembler code for the stub. |
| 345 virtual void Generate(MacroAssembler* masm) = 0; | 343 virtual void Generate(MacroAssembler* masm) = 0; |
| 346 | 344 |
| 347 DEFINE_CODE_STUB_BASE(PlatformCodeStub, CodeStub); | 345 DEFINE_CODE_STUB_BASE(PlatformCodeStub, CodeStub); |
| 348 }; | 346 }; |
| 349 | 347 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 }; | 427 }; |
| 430 | 428 |
| 431 | 429 |
| 432 class HydrogenCodeStub : public CodeStub { | 430 class HydrogenCodeStub : public CodeStub { |
| 433 public: | 431 public: |
| 434 enum InitializationState { | 432 enum InitializationState { |
| 435 UNINITIALIZED, | 433 UNINITIALIZED, |
| 436 INITIALIZED | 434 INITIALIZED |
| 437 }; | 435 }; |
| 438 | 436 |
| 439 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::STUB; } | 437 Code::Kind GetCodeKind() const OVERRIDE { return Code::STUB; } |
| 440 | 438 |
| 441 template<class SubClass> | 439 template<class SubClass> |
| 442 static Handle<Code> GetUninitialized(Isolate* isolate) { | 440 static Handle<Code> GetUninitialized(Isolate* isolate) { |
| 443 SubClass::GenerateAheadOfTime(isolate); | 441 SubClass::GenerateAheadOfTime(isolate); |
| 444 return SubClass().GetCode(isolate); | 442 return SubClass().GetCode(isolate); |
| 445 } | 443 } |
| 446 | 444 |
| 447 // Retrieve the code for the stub. Generate the code if needed. | 445 // Retrieve the code for the stub. Generate the code if needed. |
| 448 virtual Handle<Code> GenerateCode() = 0; | 446 Handle<Code> GenerateCode() OVERRIDE = 0; |
| 449 | 447 |
| 450 bool IsUninitialized() const { return IsMissBits::decode(minor_key_); } | 448 bool IsUninitialized() const { return IsMissBits::decode(minor_key_); } |
| 451 | 449 |
| 452 Handle<Code> GenerateLightweightMissCode(ExternalReference miss); | 450 Handle<Code> GenerateLightweightMissCode(ExternalReference miss); |
| 453 | 451 |
| 454 template<class StateType> | 452 template<class StateType> |
| 455 void TraceTransition(StateType from, StateType to); | 453 void TraceTransition(StateType from, StateType to); |
| 456 | 454 |
| 457 protected: | 455 protected: |
| 458 explicit HydrogenCodeStub(Isolate* isolate, | 456 explicit HydrogenCodeStub(Isolate* isolate, |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 kReturnTrueFalseObject = 1 << 2 | 669 kReturnTrueFalseObject = 1 << 2 |
| 672 }; | 670 }; |
| 673 | 671 |
| 674 InstanceofStub(Isolate* isolate, Flags flags) : PlatformCodeStub(isolate) { | 672 InstanceofStub(Isolate* isolate, Flags flags) : PlatformCodeStub(isolate) { |
| 675 minor_key_ = FlagBits::encode(flags); | 673 minor_key_ = FlagBits::encode(flags); |
| 676 } | 674 } |
| 677 | 675 |
| 678 static Register left() { return InstanceofDescriptor::left(); } | 676 static Register left() { return InstanceofDescriptor::left(); } |
| 679 static Register right() { return InstanceofDescriptor::right(); } | 677 static Register right() { return InstanceofDescriptor::right(); } |
| 680 | 678 |
| 681 virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE { | 679 CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE { |
| 682 if (HasArgsInRegisters()) { | 680 if (HasArgsInRegisters()) { |
| 683 return InstanceofDescriptor(isolate()); | 681 return InstanceofDescriptor(isolate()); |
| 684 } | 682 } |
| 685 return ContextOnlyDescriptor(isolate()); | 683 return ContextOnlyDescriptor(isolate()); |
| 686 } | 684 } |
| 687 | 685 |
| 688 private: | 686 private: |
| 689 Flags flags() const { return FlagBits::decode(minor_key_); } | 687 Flags flags() const { return FlagBits::decode(minor_key_); } |
| 690 | 688 |
| 691 bool HasArgsInRegisters() const { return (flags() & kArgsInRegisters) != 0; } | 689 bool HasArgsInRegisters() const { return (flags() & kArgsInRegisters) != 0; } |
| 692 | 690 |
| 693 bool HasCallSiteInlineCheck() const { | 691 bool HasCallSiteInlineCheck() const { |
| 694 return (flags() & kCallSiteInlineCheck) != 0; | 692 return (flags() & kCallSiteInlineCheck) != 0; |
| 695 } | 693 } |
| 696 | 694 |
| 697 bool ReturnTrueFalseObject() const { | 695 bool ReturnTrueFalseObject() const { |
| 698 return (flags() & kReturnTrueFalseObject) != 0; | 696 return (flags() & kReturnTrueFalseObject) != 0; |
| 699 } | 697 } |
| 700 | 698 |
| 701 virtual void PrintName(std::ostream& os) const OVERRIDE; // NOLINT | 699 void PrintName(std::ostream& os) const OVERRIDE; // NOLINT |
| 702 | 700 |
| 703 class FlagBits : public BitField<Flags, 0, 3> {}; | 701 class FlagBits : public BitField<Flags, 0, 3> {}; |
| 704 | 702 |
| 705 DEFINE_PLATFORM_CODE_STUB(Instanceof, PlatformCodeStub); | 703 DEFINE_PLATFORM_CODE_STUB(Instanceof, PlatformCodeStub); |
| 706 }; | 704 }; |
| 707 | 705 |
| 708 | 706 |
| 709 enum AllocationSiteOverrideMode { | 707 enum AllocationSiteOverrideMode { |
| 710 DONT_OVERRIDE, | 708 DONT_OVERRIDE, |
| 711 DISABLE_ALLOCATION_SITES, | 709 DISABLE_ALLOCATION_SITES, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 722 explicit ArrayConstructorStub(Isolate* isolate); | 720 explicit ArrayConstructorStub(Isolate* isolate); |
| 723 | 721 |
| 724 private: | 722 private: |
| 725 ArgumentCountKey argument_count() const { | 723 ArgumentCountKey argument_count() const { |
| 726 return ArgumentCountBits::decode(minor_key_); | 724 return ArgumentCountBits::decode(minor_key_); |
| 727 } | 725 } |
| 728 | 726 |
| 729 void GenerateDispatchToArrayStub(MacroAssembler* masm, | 727 void GenerateDispatchToArrayStub(MacroAssembler* masm, |
| 730 AllocationSiteOverrideMode mode); | 728 AllocationSiteOverrideMode mode); |
| 731 | 729 |
| 732 virtual void PrintName(std::ostream& os) const OVERRIDE; // NOLINT | 730 void PrintName(std::ostream& os) const OVERRIDE; // NOLINT |
| 733 | 731 |
| 734 class ArgumentCountBits : public BitField<ArgumentCountKey, 0, 2> {}; | 732 class ArgumentCountBits : public BitField<ArgumentCountKey, 0, 2> {}; |
| 735 | 733 |
| 736 DEFINE_CALL_INTERFACE_DESCRIPTOR(ArrayConstructor); | 734 DEFINE_CALL_INTERFACE_DESCRIPTOR(ArrayConstructor); |
| 737 DEFINE_PLATFORM_CODE_STUB(ArrayConstructor, PlatformCodeStub); | 735 DEFINE_PLATFORM_CODE_STUB(ArrayConstructor, PlatformCodeStub); |
| 738 }; | 736 }; |
| 739 | 737 |
| 740 | 738 |
| 741 class InternalArrayConstructorStub: public PlatformCodeStub { | 739 class InternalArrayConstructorStub: public PlatformCodeStub { |
| 742 public: | 740 public: |
| 743 explicit InternalArrayConstructorStub(Isolate* isolate); | 741 explicit InternalArrayConstructorStub(Isolate* isolate); |
| 744 | 742 |
| 745 private: | 743 private: |
| 746 void GenerateCase(MacroAssembler* masm, ElementsKind kind); | 744 void GenerateCase(MacroAssembler* masm, ElementsKind kind); |
| 747 | 745 |
| 748 DEFINE_CALL_INTERFACE_DESCRIPTOR(InternalArrayConstructor); | 746 DEFINE_CALL_INTERFACE_DESCRIPTOR(InternalArrayConstructor); |
| 749 DEFINE_PLATFORM_CODE_STUB(InternalArrayConstructor, PlatformCodeStub); | 747 DEFINE_PLATFORM_CODE_STUB(InternalArrayConstructor, PlatformCodeStub); |
| 750 }; | 748 }; |
| 751 | 749 |
| 752 | 750 |
| 753 class MathPowStub: public PlatformCodeStub { | 751 class MathPowStub: public PlatformCodeStub { |
| 754 public: | 752 public: |
| 755 enum ExponentType { INTEGER, DOUBLE, TAGGED, ON_STACK }; | 753 enum ExponentType { INTEGER, DOUBLE, TAGGED, ON_STACK }; |
| 756 | 754 |
| 757 MathPowStub(Isolate* isolate, ExponentType exponent_type) | 755 MathPowStub(Isolate* isolate, ExponentType exponent_type) |
| 758 : PlatformCodeStub(isolate) { | 756 : PlatformCodeStub(isolate) { |
| 759 minor_key_ = ExponentTypeBits::encode(exponent_type); | 757 minor_key_ = ExponentTypeBits::encode(exponent_type); |
| 760 } | 758 } |
| 761 | 759 |
| 762 virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE { | 760 CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE { |
| 763 if (exponent_type() == TAGGED) { | 761 if (exponent_type() == TAGGED) { |
| 764 return MathPowTaggedDescriptor(isolate()); | 762 return MathPowTaggedDescriptor(isolate()); |
| 765 } else if (exponent_type() == INTEGER) { | 763 } else if (exponent_type() == INTEGER) { |
| 766 return MathPowIntegerDescriptor(isolate()); | 764 return MathPowIntegerDescriptor(isolate()); |
| 767 } | 765 } |
| 768 // A CallInterfaceDescriptor doesn't specify double registers (yet). | 766 // A CallInterfaceDescriptor doesn't specify double registers (yet). |
| 769 return ContextOnlyDescriptor(isolate()); | 767 return ContextOnlyDescriptor(isolate()); |
| 770 } | 768 } |
| 771 | 769 |
| 772 private: | 770 private: |
| (...skipping 12 matching lines...) Expand all Loading... |
| 785 CallICStub(Isolate* isolate, const CallICState& state) | 783 CallICStub(Isolate* isolate, const CallICState& state) |
| 786 : PlatformCodeStub(isolate) { | 784 : PlatformCodeStub(isolate) { |
| 787 minor_key_ = state.GetExtraICState(); | 785 minor_key_ = state.GetExtraICState(); |
| 788 } | 786 } |
| 789 | 787 |
| 790 static int ExtractArgcFromMinorKey(int minor_key) { | 788 static int ExtractArgcFromMinorKey(int minor_key) { |
| 791 CallICState state(static_cast<ExtraICState>(minor_key)); | 789 CallICState state(static_cast<ExtraICState>(minor_key)); |
| 792 return state.arg_count(); | 790 return state.arg_count(); |
| 793 } | 791 } |
| 794 | 792 |
| 795 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::CALL_IC; } | 793 Code::Kind GetCodeKind() const OVERRIDE { return Code::CALL_IC; } |
| 796 | 794 |
| 797 virtual InlineCacheState GetICState() const OVERRIDE { return DEFAULT; } | 795 InlineCacheState GetICState() const OVERRIDE { return DEFAULT; } |
| 798 | 796 |
| 799 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE { | 797 ExtraICState GetExtraICState() const FINAL { |
| 800 return static_cast<ExtraICState>(minor_key_); | 798 return static_cast<ExtraICState>(minor_key_); |
| 801 } | 799 } |
| 802 | 800 |
| 803 protected: | 801 protected: |
| 804 bool CallAsMethod() const { | 802 bool CallAsMethod() const { |
| 805 return state().call_type() == CallICState::METHOD; | 803 return state().call_type() == CallICState::METHOD; |
| 806 } | 804 } |
| 807 | 805 |
| 808 int arg_count() const { return state().arg_count(); } | 806 int arg_count() const { return state().arg_count(); } |
| 809 | 807 |
| 810 CallICState state() const { | 808 CallICState state() const { |
| 811 return CallICState(static_cast<ExtraICState>(minor_key_)); | 809 return CallICState(static_cast<ExtraICState>(minor_key_)); |
| 812 } | 810 } |
| 813 | 811 |
| 814 // Code generation helpers. | 812 // Code generation helpers. |
| 815 void GenerateMiss(MacroAssembler* masm); | 813 void GenerateMiss(MacroAssembler* masm); |
| 816 | 814 |
| 817 private: | 815 private: |
| 818 virtual void PrintState(std::ostream& os) const OVERRIDE; // NOLINT | 816 void PrintState(std::ostream& os) const OVERRIDE; // NOLINT |
| 819 | 817 |
| 820 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunctionWithFeedback); | 818 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunctionWithFeedback); |
| 821 DEFINE_PLATFORM_CODE_STUB(CallIC, PlatformCodeStub); | 819 DEFINE_PLATFORM_CODE_STUB(CallIC, PlatformCodeStub); |
| 822 }; | 820 }; |
| 823 | 821 |
| 824 | 822 |
| 825 class CallIC_ArrayStub: public CallICStub { | 823 class CallIC_ArrayStub: public CallICStub { |
| 826 public: | 824 public: |
| 827 CallIC_ArrayStub(Isolate* isolate, const CallICState& state_in) | 825 CallIC_ArrayStub(Isolate* isolate, const CallICState& state_in) |
| 828 : CallICStub(isolate, state_in) {} | 826 : CallICStub(isolate, state_in) {} |
| 829 | 827 |
| 830 virtual InlineCacheState GetICState() const FINAL OVERRIDE { | 828 InlineCacheState GetICState() const FINAL { return MONOMORPHIC; } |
| 831 return MONOMORPHIC; | |
| 832 } | |
| 833 | 829 |
| 834 private: | 830 private: |
| 835 virtual void PrintState(std::ostream& os) const OVERRIDE; // NOLINT | 831 void PrintState(std::ostream& os) const OVERRIDE; // NOLINT |
| 836 | 832 |
| 837 DEFINE_PLATFORM_CODE_STUB(CallIC_Array, CallICStub); | 833 DEFINE_PLATFORM_CODE_STUB(CallIC_Array, CallICStub); |
| 838 }; | 834 }; |
| 839 | 835 |
| 840 | 836 |
| 841 // TODO(verwaest): Translate to hydrogen code stub. | 837 // TODO(verwaest): Translate to hydrogen code stub. |
| 842 class FunctionPrototypeStub : public PlatformCodeStub { | 838 class FunctionPrototypeStub : public PlatformCodeStub { |
| 843 public: | 839 public: |
| 844 explicit FunctionPrototypeStub(Isolate* isolate) | 840 explicit FunctionPrototypeStub(Isolate* isolate) |
| 845 : PlatformCodeStub(isolate) {} | 841 : PlatformCodeStub(isolate) {} |
| 846 | 842 |
| 847 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::HANDLER; } | 843 Code::Kind GetCodeKind() const OVERRIDE { return Code::HANDLER; } |
| 848 | 844 |
| 849 // TODO(mvstanton): only the receiver register is accessed. When this is | 845 // TODO(mvstanton): only the receiver register is accessed. When this is |
| 850 // translated to a hydrogen code stub, a new CallInterfaceDescriptor | 846 // translated to a hydrogen code stub, a new CallInterfaceDescriptor |
| 851 // should be created that just uses that register for more efficient code. | 847 // should be created that just uses that register for more efficient code. |
| 852 virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE { | 848 CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE { |
| 853 if (FLAG_vector_ics) { | 849 if (FLAG_vector_ics) { |
| 854 return VectorLoadICDescriptor(isolate()); | 850 return VectorLoadICDescriptor(isolate()); |
| 855 } | 851 } |
| 856 return LoadDescriptor(isolate()); | 852 return LoadDescriptor(isolate()); |
| 857 } | 853 } |
| 858 | 854 |
| 859 DEFINE_PLATFORM_CODE_STUB(FunctionPrototype, PlatformCodeStub); | 855 DEFINE_PLATFORM_CODE_STUB(FunctionPrototype, PlatformCodeStub); |
| 860 }; | 856 }; |
| 861 | 857 |
| 862 | 858 |
| 863 // TODO(mvstanton): Translate to hydrogen code stub. | 859 // TODO(mvstanton): Translate to hydrogen code stub. |
| 864 class LoadIndexedInterceptorStub : public PlatformCodeStub { | 860 class LoadIndexedInterceptorStub : public PlatformCodeStub { |
| 865 public: | 861 public: |
| 866 explicit LoadIndexedInterceptorStub(Isolate* isolate) | 862 explicit LoadIndexedInterceptorStub(Isolate* isolate) |
| 867 : PlatformCodeStub(isolate) {} | 863 : PlatformCodeStub(isolate) {} |
| 868 | 864 |
| 869 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::HANDLER; } | 865 Code::Kind GetCodeKind() const OVERRIDE { return Code::HANDLER; } |
| 870 virtual Code::StubType GetStubType() OVERRIDE { return Code::FAST; } | 866 Code::StubType GetStubType() OVERRIDE { return Code::FAST; } |
| 871 | 867 |
| 872 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load); | 868 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load); |
| 873 DEFINE_PLATFORM_CODE_STUB(LoadIndexedInterceptor, PlatformCodeStub); | 869 DEFINE_PLATFORM_CODE_STUB(LoadIndexedInterceptor, PlatformCodeStub); |
| 874 }; | 870 }; |
| 875 | 871 |
| 876 | 872 |
| 877 class LoadIndexedStringStub : public PlatformCodeStub { | 873 class LoadIndexedStringStub : public PlatformCodeStub { |
| 878 public: | 874 public: |
| 879 explicit LoadIndexedStringStub(Isolate* isolate) | 875 explicit LoadIndexedStringStub(Isolate* isolate) |
| 880 : PlatformCodeStub(isolate) {} | 876 : PlatformCodeStub(isolate) {} |
| 881 | 877 |
| 882 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::HANDLER; } | 878 Code::Kind GetCodeKind() const OVERRIDE { return Code::HANDLER; } |
| 883 virtual Code::StubType GetStubType() OVERRIDE { return Code::FAST; } | 879 Code::StubType GetStubType() OVERRIDE { return Code::FAST; } |
| 884 | 880 |
| 885 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load); | 881 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load); |
| 886 DEFINE_PLATFORM_CODE_STUB(LoadIndexedString, PlatformCodeStub); | 882 DEFINE_PLATFORM_CODE_STUB(LoadIndexedString, PlatformCodeStub); |
| 887 }; | 883 }; |
| 888 | 884 |
| 889 | 885 |
| 890 class HandlerStub : public HydrogenCodeStub { | 886 class HandlerStub : public HydrogenCodeStub { |
| 891 public: | 887 public: |
| 892 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::HANDLER; } | 888 Code::Kind GetCodeKind() const OVERRIDE { return Code::HANDLER; } |
| 893 virtual ExtraICState GetExtraICState() const OVERRIDE { return kind(); } | 889 ExtraICState GetExtraICState() const OVERRIDE { return kind(); } |
| 894 virtual InlineCacheState GetICState() const OVERRIDE { return MONOMORPHIC; } | 890 InlineCacheState GetICState() const OVERRIDE { return MONOMORPHIC; } |
| 895 | 891 |
| 896 virtual void InitializeDescriptor(CodeStubDescriptor* descriptor) OVERRIDE; | 892 void InitializeDescriptor(CodeStubDescriptor* descriptor) OVERRIDE; |
| 897 | 893 |
| 898 virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE; | 894 CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE; |
| 899 | 895 |
| 900 protected: | 896 protected: |
| 901 explicit HandlerStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} | 897 explicit HandlerStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} |
| 902 | 898 |
| 903 virtual Code::Kind kind() const = 0; | 899 virtual Code::Kind kind() const = 0; |
| 904 | 900 |
| 905 DEFINE_CODE_STUB_BASE(HandlerStub, HydrogenCodeStub); | 901 DEFINE_CODE_STUB_BASE(HandlerStub, HydrogenCodeStub); |
| 906 }; | 902 }; |
| 907 | 903 |
| 908 | 904 |
| 909 class LoadFieldStub: public HandlerStub { | 905 class LoadFieldStub: public HandlerStub { |
| 910 public: | 906 public: |
| 911 LoadFieldStub(Isolate* isolate, FieldIndex index) : HandlerStub(isolate) { | 907 LoadFieldStub(Isolate* isolate, FieldIndex index) : HandlerStub(isolate) { |
| 912 int property_index_key = index.GetFieldAccessStubKey(); | 908 int property_index_key = index.GetFieldAccessStubKey(); |
| 913 set_sub_minor_key(LoadFieldByIndexBits::encode(property_index_key)); | 909 set_sub_minor_key(LoadFieldByIndexBits::encode(property_index_key)); |
| 914 } | 910 } |
| 915 | 911 |
| 916 FieldIndex index() const { | 912 FieldIndex index() const { |
| 917 int property_index_key = LoadFieldByIndexBits::decode(sub_minor_key()); | 913 int property_index_key = LoadFieldByIndexBits::decode(sub_minor_key()); |
| 918 return FieldIndex::FromFieldAccessStubKey(property_index_key); | 914 return FieldIndex::FromFieldAccessStubKey(property_index_key); |
| 919 } | 915 } |
| 920 | 916 |
| 921 protected: | 917 protected: |
| 922 virtual Code::Kind kind() const { return Code::LOAD_IC; } | 918 Code::Kind kind() const OVERRIDE { return Code::LOAD_IC; } |
| 923 virtual Code::StubType GetStubType() OVERRIDE { return Code::FAST; } | 919 Code::StubType GetStubType() OVERRIDE { return Code::FAST; } |
| 924 | 920 |
| 925 private: | 921 private: |
| 926 class LoadFieldByIndexBits : public BitField<int, 0, 13> {}; | 922 class LoadFieldByIndexBits : public BitField<int, 0, 13> {}; |
| 927 | 923 |
| 928 DEFINE_HANDLER_CODE_STUB(LoadField, HandlerStub); | 924 DEFINE_HANDLER_CODE_STUB(LoadField, HandlerStub); |
| 929 }; | 925 }; |
| 930 | 926 |
| 931 | 927 |
| 932 class KeyedLoadSloppyArgumentsStub : public HandlerStub { | 928 class KeyedLoadSloppyArgumentsStub : public HandlerStub { |
| 933 public: | 929 public: |
| 934 explicit KeyedLoadSloppyArgumentsStub(Isolate* isolate) | 930 explicit KeyedLoadSloppyArgumentsStub(Isolate* isolate) |
| 935 : HandlerStub(isolate) {} | 931 : HandlerStub(isolate) {} |
| 936 | 932 |
| 937 protected: | 933 protected: |
| 938 virtual Code::Kind kind() const OVERRIDE { return Code::KEYED_LOAD_IC; } | 934 Code::Kind kind() const OVERRIDE { return Code::KEYED_LOAD_IC; } |
| 939 virtual Code::StubType GetStubType() OVERRIDE { return Code::FAST; } | 935 Code::StubType GetStubType() OVERRIDE { return Code::FAST; } |
| 940 | 936 |
| 941 private: | 937 private: |
| 942 DEFINE_HANDLER_CODE_STUB(KeyedLoadSloppyArguments, HandlerStub); | 938 DEFINE_HANDLER_CODE_STUB(KeyedLoadSloppyArguments, HandlerStub); |
| 943 }; | 939 }; |
| 944 | 940 |
| 945 | 941 |
| 946 class LoadConstantStub : public HandlerStub { | 942 class LoadConstantStub : public HandlerStub { |
| 947 public: | 943 public: |
| 948 LoadConstantStub(Isolate* isolate, int constant_index) | 944 LoadConstantStub(Isolate* isolate, int constant_index) |
| 949 : HandlerStub(isolate) { | 945 : HandlerStub(isolate) { |
| 950 set_sub_minor_key(ConstantIndexBits::encode(constant_index)); | 946 set_sub_minor_key(ConstantIndexBits::encode(constant_index)); |
| 951 } | 947 } |
| 952 | 948 |
| 953 int constant_index() const { | 949 int constant_index() const { |
| 954 return ConstantIndexBits::decode(sub_minor_key()); | 950 return ConstantIndexBits::decode(sub_minor_key()); |
| 955 } | 951 } |
| 956 | 952 |
| 957 protected: | 953 protected: |
| 958 virtual Code::Kind kind() const OVERRIDE { return Code::LOAD_IC; } | 954 Code::Kind kind() const OVERRIDE { return Code::LOAD_IC; } |
| 959 virtual Code::StubType GetStubType() OVERRIDE { return Code::FAST; } | 955 Code::StubType GetStubType() OVERRIDE { return Code::FAST; } |
| 960 | 956 |
| 961 private: | 957 private: |
| 962 class ConstantIndexBits : public BitField<int, 0, kSubMinorKeyBits> {}; | 958 class ConstantIndexBits : public BitField<int, 0, kSubMinorKeyBits> {}; |
| 963 | 959 |
| 964 DEFINE_HANDLER_CODE_STUB(LoadConstant, HandlerStub); | 960 DEFINE_HANDLER_CODE_STUB(LoadConstant, HandlerStub); |
| 965 }; | 961 }; |
| 966 | 962 |
| 967 | 963 |
| 968 class StringLengthStub: public HandlerStub { | 964 class StringLengthStub: public HandlerStub { |
| 969 public: | 965 public: |
| 970 explicit StringLengthStub(Isolate* isolate) : HandlerStub(isolate) {} | 966 explicit StringLengthStub(Isolate* isolate) : HandlerStub(isolate) {} |
| 971 | 967 |
| 972 protected: | 968 protected: |
| 973 virtual Code::Kind kind() const OVERRIDE { return Code::LOAD_IC; } | 969 Code::Kind kind() const OVERRIDE { return Code::LOAD_IC; } |
| 974 virtual Code::StubType GetStubType() OVERRIDE { return Code::FAST; } | 970 Code::StubType GetStubType() OVERRIDE { return Code::FAST; } |
| 975 | 971 |
| 976 DEFINE_HANDLER_CODE_STUB(StringLength, HandlerStub); | 972 DEFINE_HANDLER_CODE_STUB(StringLength, HandlerStub); |
| 977 }; | 973 }; |
| 978 | 974 |
| 979 | 975 |
| 980 class StoreFieldStub : public HandlerStub { | 976 class StoreFieldStub : public HandlerStub { |
| 981 public: | 977 public: |
| 982 StoreFieldStub(Isolate* isolate, FieldIndex index, | 978 StoreFieldStub(Isolate* isolate, FieldIndex index, |
| 983 Representation representation) | 979 Representation representation) |
| 984 : HandlerStub(isolate) { | 980 : HandlerStub(isolate) { |
| 985 int property_index_key = index.GetFieldAccessStubKey(); | 981 int property_index_key = index.GetFieldAccessStubKey(); |
| 986 uint8_t repr = PropertyDetails::EncodeRepresentation(representation); | 982 uint8_t repr = PropertyDetails::EncodeRepresentation(representation); |
| 987 set_sub_minor_key(StoreFieldByIndexBits::encode(property_index_key) | | 983 set_sub_minor_key(StoreFieldByIndexBits::encode(property_index_key) | |
| 988 RepresentationBits::encode(repr)); | 984 RepresentationBits::encode(repr)); |
| 989 } | 985 } |
| 990 | 986 |
| 991 FieldIndex index() const { | 987 FieldIndex index() const { |
| 992 int property_index_key = StoreFieldByIndexBits::decode(sub_minor_key()); | 988 int property_index_key = StoreFieldByIndexBits::decode(sub_minor_key()); |
| 993 return FieldIndex::FromFieldAccessStubKey(property_index_key); | 989 return FieldIndex::FromFieldAccessStubKey(property_index_key); |
| 994 } | 990 } |
| 995 | 991 |
| 996 Representation representation() { | 992 Representation representation() { |
| 997 uint8_t repr = RepresentationBits::decode(sub_minor_key()); | 993 uint8_t repr = RepresentationBits::decode(sub_minor_key()); |
| 998 return PropertyDetails::DecodeRepresentation(repr); | 994 return PropertyDetails::DecodeRepresentation(repr); |
| 999 } | 995 } |
| 1000 | 996 |
| 1001 protected: | 997 protected: |
| 1002 virtual Code::Kind kind() const OVERRIDE { return Code::STORE_IC; } | 998 Code::Kind kind() const OVERRIDE { return Code::STORE_IC; } |
| 1003 virtual Code::StubType GetStubType() OVERRIDE { return Code::FAST; } | 999 Code::StubType GetStubType() OVERRIDE { return Code::FAST; } |
| 1004 | 1000 |
| 1005 private: | 1001 private: |
| 1006 class StoreFieldByIndexBits : public BitField<int, 0, 13> {}; | 1002 class StoreFieldByIndexBits : public BitField<int, 0, 13> {}; |
| 1007 class RepresentationBits : public BitField<uint8_t, 13, 4> {}; | 1003 class RepresentationBits : public BitField<uint8_t, 13, 4> {}; |
| 1008 | 1004 |
| 1009 DEFINE_HANDLER_CODE_STUB(StoreField, HandlerStub); | 1005 DEFINE_HANDLER_CODE_STUB(StoreField, HandlerStub); |
| 1010 }; | 1006 }; |
| 1011 | 1007 |
| 1012 | 1008 |
| 1013 class StoreTransitionStub : public HandlerStub { | 1009 class StoreTransitionStub : public HandlerStub { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1042 Representation representation() { | 1038 Representation representation() { |
| 1043 DCHECK(store_mode() != StoreMapOnly); | 1039 DCHECK(store_mode() != StoreMapOnly); |
| 1044 uint8_t repr = RepresentationBits::decode(sub_minor_key()); | 1040 uint8_t repr = RepresentationBits::decode(sub_minor_key()); |
| 1045 return PropertyDetails::DecodeRepresentation(repr); | 1041 return PropertyDetails::DecodeRepresentation(repr); |
| 1046 } | 1042 } |
| 1047 | 1043 |
| 1048 StoreMode store_mode() const { | 1044 StoreMode store_mode() const { |
| 1049 return StoreModeBits::decode(sub_minor_key()); | 1045 return StoreModeBits::decode(sub_minor_key()); |
| 1050 } | 1046 } |
| 1051 | 1047 |
| 1052 virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE; | 1048 CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE; |
| 1053 | 1049 |
| 1054 protected: | 1050 protected: |
| 1055 virtual Code::Kind kind() const OVERRIDE { return Code::STORE_IC; } | 1051 Code::Kind kind() const OVERRIDE { return Code::STORE_IC; } |
| 1056 virtual Code::StubType GetStubType() OVERRIDE { return Code::FAST; } | 1052 Code::StubType GetStubType() OVERRIDE { return Code::FAST; } |
| 1057 | 1053 |
| 1058 private: | 1054 private: |
| 1059 class StoreFieldByIndexBits : public BitField<int, 0, 13> {}; | 1055 class StoreFieldByIndexBits : public BitField<int, 0, 13> {}; |
| 1060 class RepresentationBits : public BitField<uint8_t, 13, 4> {}; | 1056 class RepresentationBits : public BitField<uint8_t, 13, 4> {}; |
| 1061 class StoreModeBits : public BitField<StoreMode, 17, 2> {}; | 1057 class StoreModeBits : public BitField<StoreMode, 17, 2> {}; |
| 1062 | 1058 |
| 1063 DEFINE_HANDLER_CODE_STUB(StoreTransition, HandlerStub); | 1059 DEFINE_HANDLER_CODE_STUB(StoreTransition, HandlerStub); |
| 1064 }; | 1060 }; |
| 1065 | 1061 |
| 1066 | 1062 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1084 pattern.Add(isolate()->factory()->meta_map(), Handle<Map>(global->map())); | 1080 pattern.Add(isolate()->factory()->meta_map(), Handle<Map>(global->map())); |
| 1085 pattern.Add(isolate()->factory()->global_property_cell_map(), cell); | 1081 pattern.Add(isolate()->factory()->global_property_cell_map(), cell); |
| 1086 return CodeStub::GetCodeCopy(pattern); | 1082 return CodeStub::GetCodeCopy(pattern); |
| 1087 } else { | 1083 } else { |
| 1088 Code::FindAndReplacePattern pattern; | 1084 Code::FindAndReplacePattern pattern; |
| 1089 pattern.Add(isolate()->factory()->global_property_cell_map(), cell); | 1085 pattern.Add(isolate()->factory()->global_property_cell_map(), cell); |
| 1090 return CodeStub::GetCodeCopy(pattern); | 1086 return CodeStub::GetCodeCopy(pattern); |
| 1091 } | 1087 } |
| 1092 } | 1088 } |
| 1093 | 1089 |
| 1094 virtual Code::Kind kind() const OVERRIDE { return Code::STORE_IC; } | 1090 Code::Kind kind() const OVERRIDE { return Code::STORE_IC; } |
| 1095 | 1091 |
| 1096 bool is_constant() const { return IsConstantBits::decode(sub_minor_key()); } | 1092 bool is_constant() const { return IsConstantBits::decode(sub_minor_key()); } |
| 1097 | 1093 |
| 1098 bool check_global() const { return CheckGlobalBits::decode(sub_minor_key()); } | 1094 bool check_global() const { return CheckGlobalBits::decode(sub_minor_key()); } |
| 1099 | 1095 |
| 1100 void set_is_constant(bool value) { | 1096 void set_is_constant(bool value) { |
| 1101 set_sub_minor_key(IsConstantBits::update(sub_minor_key(), value)); | 1097 set_sub_minor_key(IsConstantBits::update(sub_minor_key(), value)); |
| 1102 } | 1098 } |
| 1103 | 1099 |
| 1104 Representation representation() { | 1100 Representation representation() { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1166 set_sub_minor_key(state.GetExtraICState()); | 1162 set_sub_minor_key(state.GetExtraICState()); |
| 1167 } | 1163 } |
| 1168 | 1164 |
| 1169 BinaryOpICStub(Isolate* isolate, const BinaryOpICState& state) | 1165 BinaryOpICStub(Isolate* isolate, const BinaryOpICState& state) |
| 1170 : HydrogenCodeStub(isolate) { | 1166 : HydrogenCodeStub(isolate) { |
| 1171 set_sub_minor_key(state.GetExtraICState()); | 1167 set_sub_minor_key(state.GetExtraICState()); |
| 1172 } | 1168 } |
| 1173 | 1169 |
| 1174 static void GenerateAheadOfTime(Isolate* isolate); | 1170 static void GenerateAheadOfTime(Isolate* isolate); |
| 1175 | 1171 |
| 1176 virtual Code::Kind GetCodeKind() const OVERRIDE { | 1172 Code::Kind GetCodeKind() const OVERRIDE { return Code::BINARY_OP_IC; } |
| 1177 return Code::BINARY_OP_IC; | |
| 1178 } | |
| 1179 | 1173 |
| 1180 virtual InlineCacheState GetICState() const FINAL OVERRIDE { | 1174 InlineCacheState GetICState() const FINAL { return state().GetICState(); } |
| 1181 return state().GetICState(); | |
| 1182 } | |
| 1183 | 1175 |
| 1184 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE { | 1176 ExtraICState GetExtraICState() const FINAL { |
| 1185 return static_cast<ExtraICState>(sub_minor_key()); | 1177 return static_cast<ExtraICState>(sub_minor_key()); |
| 1186 } | 1178 } |
| 1187 | 1179 |
| 1188 BinaryOpICState state() const { | 1180 BinaryOpICState state() const { |
| 1189 return BinaryOpICState(isolate(), GetExtraICState()); | 1181 return BinaryOpICState(isolate(), GetExtraICState()); |
| 1190 } | 1182 } |
| 1191 | 1183 |
| 1192 virtual void PrintState(std::ostream& os) const FINAL OVERRIDE; // NOLINT | 1184 void PrintState(std::ostream& os) const FINAL; // NOLINT |
| 1193 | 1185 |
| 1194 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 1186 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
| 1195 static const int kLeft = 0; | 1187 static const int kLeft = 0; |
| 1196 static const int kRight = 1; | 1188 static const int kRight = 1; |
| 1197 | 1189 |
| 1198 private: | 1190 private: |
| 1199 static void GenerateAheadOfTime(Isolate* isolate, | 1191 static void GenerateAheadOfTime(Isolate* isolate, |
| 1200 const BinaryOpICState& state); | 1192 const BinaryOpICState& state); |
| 1201 | 1193 |
| 1202 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); | 1194 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1215 } | 1207 } |
| 1216 | 1208 |
| 1217 static void GenerateAheadOfTime(Isolate* isolate); | 1209 static void GenerateAheadOfTime(Isolate* isolate); |
| 1218 | 1210 |
| 1219 Handle<Code> GetCodeCopyFromTemplate(Handle<AllocationSite> allocation_site) { | 1211 Handle<Code> GetCodeCopyFromTemplate(Handle<AllocationSite> allocation_site) { |
| 1220 Code::FindAndReplacePattern pattern; | 1212 Code::FindAndReplacePattern pattern; |
| 1221 pattern.Add(isolate()->factory()->undefined_map(), allocation_site); | 1213 pattern.Add(isolate()->factory()->undefined_map(), allocation_site); |
| 1222 return CodeStub::GetCodeCopy(pattern); | 1214 return CodeStub::GetCodeCopy(pattern); |
| 1223 } | 1215 } |
| 1224 | 1216 |
| 1225 virtual Code::Kind GetCodeKind() const OVERRIDE { | 1217 Code::Kind GetCodeKind() const OVERRIDE { return Code::BINARY_OP_IC; } |
| 1226 return Code::BINARY_OP_IC; | |
| 1227 } | |
| 1228 | 1218 |
| 1229 virtual InlineCacheState GetICState() const OVERRIDE { | 1219 InlineCacheState GetICState() const OVERRIDE { return state().GetICState(); } |
| 1230 return state().GetICState(); | |
| 1231 } | |
| 1232 | 1220 |
| 1233 virtual ExtraICState GetExtraICState() const OVERRIDE { | 1221 ExtraICState GetExtraICState() const OVERRIDE { |
| 1234 return static_cast<ExtraICState>(minor_key_); | 1222 return static_cast<ExtraICState>(minor_key_); |
| 1235 } | 1223 } |
| 1236 | 1224 |
| 1237 virtual void PrintState(std::ostream& os) const OVERRIDE; // NOLINT | 1225 void PrintState(std::ostream& os) const OVERRIDE; // NOLINT |
| 1238 | 1226 |
| 1239 private: | 1227 private: |
| 1240 BinaryOpICState state() const { | 1228 BinaryOpICState state() const { |
| 1241 return BinaryOpICState(isolate(), static_cast<ExtraICState>(minor_key_)); | 1229 return BinaryOpICState(isolate(), static_cast<ExtraICState>(minor_key_)); |
| 1242 } | 1230 } |
| 1243 | 1231 |
| 1244 static void GenerateAheadOfTime(Isolate* isolate, | 1232 static void GenerateAheadOfTime(Isolate* isolate, |
| 1245 const BinaryOpICState& state); | 1233 const BinaryOpICState& state); |
| 1246 | 1234 |
| 1247 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOpWithAllocationSite); | 1235 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOpWithAllocationSite); |
| 1248 DEFINE_PLATFORM_CODE_STUB(BinaryOpICWithAllocationSite, PlatformCodeStub); | 1236 DEFINE_PLATFORM_CODE_STUB(BinaryOpICWithAllocationSite, PlatformCodeStub); |
| 1249 }; | 1237 }; |
| 1250 | 1238 |
| 1251 | 1239 |
| 1252 class BinaryOpWithAllocationSiteStub FINAL : public BinaryOpICStub { | 1240 class BinaryOpWithAllocationSiteStub FINAL : public BinaryOpICStub { |
| 1253 public: | 1241 public: |
| 1254 BinaryOpWithAllocationSiteStub(Isolate* isolate, | 1242 BinaryOpWithAllocationSiteStub(Isolate* isolate, |
| 1255 Token::Value op, | 1243 Token::Value op, |
| 1256 OverwriteMode mode) | 1244 OverwriteMode mode) |
| 1257 : BinaryOpICStub(isolate, op, mode) {} | 1245 : BinaryOpICStub(isolate, op, mode) {} |
| 1258 | 1246 |
| 1259 BinaryOpWithAllocationSiteStub(Isolate* isolate, const BinaryOpICState& state) | 1247 BinaryOpWithAllocationSiteStub(Isolate* isolate, const BinaryOpICState& state) |
| 1260 : BinaryOpICStub(isolate, state) {} | 1248 : BinaryOpICStub(isolate, state) {} |
| 1261 | 1249 |
| 1262 virtual Code::Kind GetCodeKind() const FINAL OVERRIDE { | 1250 Code::Kind GetCodeKind() const FINAL { return Code::STUB; } |
| 1263 return Code::STUB; | |
| 1264 } | |
| 1265 | 1251 |
| 1266 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 1252 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
| 1267 static const int kAllocationSite = 0; | 1253 static const int kAllocationSite = 0; |
| 1268 static const int kLeft = 1; | 1254 static const int kLeft = 1; |
| 1269 static const int kRight = 2; | 1255 static const int kRight = 2; |
| 1270 | 1256 |
| 1271 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOpWithAllocationSite); | 1257 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOpWithAllocationSite); |
| 1272 DEFINE_HYDROGEN_CODE_STUB(BinaryOpWithAllocationSite, BinaryOpICStub); | 1258 DEFINE_HYDROGEN_CODE_STUB(BinaryOpWithAllocationSite, BinaryOpICStub); |
| 1273 }; | 1259 }; |
| 1274 | 1260 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1303 } | 1289 } |
| 1304 | 1290 |
| 1305 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 1291 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
| 1306 static const int kLeft = 0; | 1292 static const int kLeft = 0; |
| 1307 static const int kRight = 1; | 1293 static const int kRight = 1; |
| 1308 | 1294 |
| 1309 private: | 1295 private: |
| 1310 class StringAddFlagsBits: public BitField<StringAddFlags, 0, 2> {}; | 1296 class StringAddFlagsBits: public BitField<StringAddFlags, 0, 2> {}; |
| 1311 class PretenureFlagBits: public BitField<PretenureFlag, 2, 1> {}; | 1297 class PretenureFlagBits: public BitField<PretenureFlag, 2, 1> {}; |
| 1312 | 1298 |
| 1313 virtual void PrintBaseName(std::ostream& os) const OVERRIDE; // NOLINT | 1299 void PrintBaseName(std::ostream& os) const OVERRIDE; // NOLINT |
| 1314 | 1300 |
| 1315 DEFINE_CALL_INTERFACE_DESCRIPTOR(StringAdd); | 1301 DEFINE_CALL_INTERFACE_DESCRIPTOR(StringAdd); |
| 1316 DEFINE_HYDROGEN_CODE_STUB(StringAdd, HydrogenCodeStub); | 1302 DEFINE_HYDROGEN_CODE_STUB(StringAdd, HydrogenCodeStub); |
| 1317 }; | 1303 }; |
| 1318 | 1304 |
| 1319 | 1305 |
| 1320 class CompareICStub : public PlatformCodeStub { | 1306 class CompareICStub : public PlatformCodeStub { |
| 1321 public: | 1307 public: |
| 1322 CompareICStub(Isolate* isolate, Token::Value op, CompareICState::State left, | 1308 CompareICStub(Isolate* isolate, Token::Value op, CompareICState::State left, |
| 1323 CompareICState::State right, CompareICState::State state) | 1309 CompareICState::State right, CompareICState::State state) |
| 1324 : PlatformCodeStub(isolate) { | 1310 : PlatformCodeStub(isolate) { |
| 1325 DCHECK(Token::IsCompareOp(op)); | 1311 DCHECK(Token::IsCompareOp(op)); |
| 1326 minor_key_ = OpBits::encode(op - Token::EQ) | LeftStateBits::encode(left) | | 1312 minor_key_ = OpBits::encode(op - Token::EQ) | LeftStateBits::encode(left) | |
| 1327 RightStateBits::encode(right) | StateBits::encode(state); | 1313 RightStateBits::encode(right) | StateBits::encode(state); |
| 1328 } | 1314 } |
| 1329 | 1315 |
| 1330 void set_known_map(Handle<Map> map) { known_map_ = map; } | 1316 void set_known_map(Handle<Map> map) { known_map_ = map; } |
| 1331 | 1317 |
| 1332 virtual InlineCacheState GetICState() const OVERRIDE; | 1318 InlineCacheState GetICState() const OVERRIDE; |
| 1333 | 1319 |
| 1334 Token::Value op() const { | 1320 Token::Value op() const { |
| 1335 return static_cast<Token::Value>(Token::EQ + OpBits::decode(minor_key_)); | 1321 return static_cast<Token::Value>(Token::EQ + OpBits::decode(minor_key_)); |
| 1336 } | 1322 } |
| 1337 | 1323 |
| 1338 CompareICState::State left() const { | 1324 CompareICState::State left() const { |
| 1339 return LeftStateBits::decode(minor_key_); | 1325 return LeftStateBits::decode(minor_key_); |
| 1340 } | 1326 } |
| 1341 CompareICState::State right() const { | 1327 CompareICState::State right() const { |
| 1342 return RightStateBits::decode(minor_key_); | 1328 return RightStateBits::decode(minor_key_); |
| 1343 } | 1329 } |
| 1344 CompareICState::State state() const { return StateBits::decode(minor_key_); } | 1330 CompareICState::State state() const { return StateBits::decode(minor_key_); } |
| 1345 | 1331 |
| 1346 private: | 1332 private: |
| 1347 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::COMPARE_IC; } | 1333 Code::Kind GetCodeKind() const OVERRIDE { return Code::COMPARE_IC; } |
| 1348 | 1334 |
| 1349 void GenerateSmis(MacroAssembler* masm); | 1335 void GenerateSmis(MacroAssembler* masm); |
| 1350 void GenerateNumbers(MacroAssembler* masm); | 1336 void GenerateNumbers(MacroAssembler* masm); |
| 1351 void GenerateInternalizedStrings(MacroAssembler* masm); | 1337 void GenerateInternalizedStrings(MacroAssembler* masm); |
| 1352 void GenerateStrings(MacroAssembler* masm); | 1338 void GenerateStrings(MacroAssembler* masm); |
| 1353 void GenerateUniqueNames(MacroAssembler* masm); | 1339 void GenerateUniqueNames(MacroAssembler* masm); |
| 1354 void GenerateObjects(MacroAssembler* masm); | 1340 void GenerateObjects(MacroAssembler* masm); |
| 1355 void GenerateMiss(MacroAssembler* masm); | 1341 void GenerateMiss(MacroAssembler* masm); |
| 1356 void GenerateKnownObjects(MacroAssembler* masm); | 1342 void GenerateKnownObjects(MacroAssembler* masm); |
| 1357 void GenerateGeneric(MacroAssembler* masm); | 1343 void GenerateGeneric(MacroAssembler* masm); |
| 1358 | 1344 |
| 1359 bool strict() const { return op() == Token::EQ_STRICT; } | 1345 bool strict() const { return op() == Token::EQ_STRICT; } |
| 1360 Condition GetCondition() const; | 1346 Condition GetCondition() const; |
| 1361 | 1347 |
| 1362 virtual void AddToSpecialCache(Handle<Code> new_object) OVERRIDE; | 1348 void AddToSpecialCache(Handle<Code> new_object) OVERRIDE; |
| 1363 virtual bool FindCodeInSpecialCache(Code** code_out) OVERRIDE; | 1349 bool FindCodeInSpecialCache(Code** code_out) OVERRIDE; |
| 1364 virtual bool UseSpecialCache() OVERRIDE { | 1350 bool UseSpecialCache() OVERRIDE { |
| 1365 return state() == CompareICState::KNOWN_OBJECT; | 1351 return state() == CompareICState::KNOWN_OBJECT; |
| 1366 } | 1352 } |
| 1367 | 1353 |
| 1368 class OpBits : public BitField<int, 0, 3> {}; | 1354 class OpBits : public BitField<int, 0, 3> {}; |
| 1369 class LeftStateBits : public BitField<CompareICState::State, 3, 4> {}; | 1355 class LeftStateBits : public BitField<CompareICState::State, 3, 4> {}; |
| 1370 class RightStateBits : public BitField<CompareICState::State, 7, 4> {}; | 1356 class RightStateBits : public BitField<CompareICState::State, 7, 4> {}; |
| 1371 class StateBits : public BitField<CompareICState::State, 11, 4> {}; | 1357 class StateBits : public BitField<CompareICState::State, 11, 4> {}; |
| 1372 | 1358 |
| 1373 Handle<Map> known_map_; | 1359 Handle<Map> known_map_; |
| 1374 | 1360 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1390 InitializationState init_state = INITIALIZED) | 1376 InitializationState init_state = INITIALIZED) |
| 1391 : HydrogenCodeStub(isolate, init_state) { | 1377 : HydrogenCodeStub(isolate, init_state) { |
| 1392 set_sub_minor_key(ic_state); | 1378 set_sub_minor_key(ic_state); |
| 1393 } | 1379 } |
| 1394 | 1380 |
| 1395 static Handle<Code> GetUninitialized(Isolate* isolate, | 1381 static Handle<Code> GetUninitialized(Isolate* isolate, |
| 1396 NilValue nil) { | 1382 NilValue nil) { |
| 1397 return CompareNilICStub(isolate, nil, UNINITIALIZED).GetCode(); | 1383 return CompareNilICStub(isolate, nil, UNINITIALIZED).GetCode(); |
| 1398 } | 1384 } |
| 1399 | 1385 |
| 1400 virtual InlineCacheState GetICState() const OVERRIDE { | 1386 InlineCacheState GetICState() const OVERRIDE { |
| 1401 State state = this->state(); | 1387 State state = this->state(); |
| 1402 if (state.Contains(GENERIC)) { | 1388 if (state.Contains(GENERIC)) { |
| 1403 return MEGAMORPHIC; | 1389 return MEGAMORPHIC; |
| 1404 } else if (state.Contains(MONOMORPHIC_MAP)) { | 1390 } else if (state.Contains(MONOMORPHIC_MAP)) { |
| 1405 return MONOMORPHIC; | 1391 return MONOMORPHIC; |
| 1406 } else { | 1392 } else { |
| 1407 return PREMONOMORPHIC; | 1393 return PREMONOMORPHIC; |
| 1408 } | 1394 } |
| 1409 } | 1395 } |
| 1410 | 1396 |
| 1411 virtual Code::Kind GetCodeKind() const OVERRIDE { | 1397 Code::Kind GetCodeKind() const OVERRIDE { return Code::COMPARE_NIL_IC; } |
| 1412 return Code::COMPARE_NIL_IC; | |
| 1413 } | |
| 1414 | 1398 |
| 1415 virtual ExtraICState GetExtraICState() const OVERRIDE { | 1399 ExtraICState GetExtraICState() const OVERRIDE { return sub_minor_key(); } |
| 1416 return sub_minor_key(); | |
| 1417 } | |
| 1418 | 1400 |
| 1419 void UpdateStatus(Handle<Object> object); | 1401 void UpdateStatus(Handle<Object> object); |
| 1420 | 1402 |
| 1421 bool IsMonomorphic() const { return state().Contains(MONOMORPHIC_MAP); } | 1403 bool IsMonomorphic() const { return state().Contains(MONOMORPHIC_MAP); } |
| 1422 | 1404 |
| 1423 NilValue nil_value() const { return NilValueBits::decode(sub_minor_key()); } | 1405 NilValue nil_value() const { return NilValueBits::decode(sub_minor_key()); } |
| 1424 | 1406 |
| 1425 void ClearState() { | 1407 void ClearState() { |
| 1426 set_sub_minor_key(TypesBits::update(sub_minor_key(), 0)); | 1408 set_sub_minor_key(TypesBits::update(sub_minor_key(), 0)); |
| 1427 } | 1409 } |
| 1428 | 1410 |
| 1429 virtual void PrintState(std::ostream& os) const OVERRIDE; // NOLINT | 1411 void PrintState(std::ostream& os) const OVERRIDE; // NOLINT |
| 1430 virtual void PrintBaseName(std::ostream& os) const OVERRIDE; // NOLINT | 1412 void PrintBaseName(std::ostream& os) const OVERRIDE; // NOLINT |
| 1431 | 1413 |
| 1432 private: | 1414 private: |
| 1433 CompareNilICStub(Isolate* isolate, NilValue nil, | 1415 CompareNilICStub(Isolate* isolate, NilValue nil, |
| 1434 InitializationState init_state) | 1416 InitializationState init_state) |
| 1435 : HydrogenCodeStub(isolate, init_state) { | 1417 : HydrogenCodeStub(isolate, init_state) { |
| 1436 set_sub_minor_key(NilValueBits::encode(nil)); | 1418 set_sub_minor_key(NilValueBits::encode(nil)); |
| 1437 } | 1419 } |
| 1438 | 1420 |
| 1439 enum CompareNilType { | 1421 enum CompareNilType { |
| 1440 UNDEFINED, | 1422 UNDEFINED, |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1507 | 1489 |
| 1508 class JSEntryStub : public PlatformCodeStub { | 1490 class JSEntryStub : public PlatformCodeStub { |
| 1509 public: | 1491 public: |
| 1510 JSEntryStub(Isolate* isolate, StackFrame::Type type) | 1492 JSEntryStub(Isolate* isolate, StackFrame::Type type) |
| 1511 : PlatformCodeStub(isolate) { | 1493 : PlatformCodeStub(isolate) { |
| 1512 DCHECK(type == StackFrame::ENTRY || type == StackFrame::ENTRY_CONSTRUCT); | 1494 DCHECK(type == StackFrame::ENTRY || type == StackFrame::ENTRY_CONSTRUCT); |
| 1513 minor_key_ = StackFrameTypeBits::encode(type); | 1495 minor_key_ = StackFrameTypeBits::encode(type); |
| 1514 } | 1496 } |
| 1515 | 1497 |
| 1516 private: | 1498 private: |
| 1517 virtual void FinishCode(Handle<Code> code) OVERRIDE; | 1499 void FinishCode(Handle<Code> code) OVERRIDE; |
| 1518 | 1500 |
| 1519 virtual void PrintName(std::ostream& os) const OVERRIDE { // NOLINT | 1501 void PrintName(std::ostream& os) const OVERRIDE { // NOLINT |
| 1520 os << (type() == StackFrame::ENTRY ? "JSEntryStub" | 1502 os << (type() == StackFrame::ENTRY ? "JSEntryStub" |
| 1521 : "JSConstructEntryStub"); | 1503 : "JSConstructEntryStub"); |
| 1522 } | 1504 } |
| 1523 | 1505 |
| 1524 StackFrame::Type type() const { | 1506 StackFrame::Type type() const { |
| 1525 return StackFrameTypeBits::decode(minor_key_); | 1507 return StackFrameTypeBits::decode(minor_key_); |
| 1526 } | 1508 } |
| 1527 | 1509 |
| 1528 class StackFrameTypeBits : public BitField<StackFrame::Type, 0, 5> {}; | 1510 class StackFrameTypeBits : public BitField<StackFrame::Type, 0, 5> {}; |
| 1529 | 1511 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1540 READ_ELEMENT, | 1522 READ_ELEMENT, |
| 1541 NEW_SLOPPY_FAST, | 1523 NEW_SLOPPY_FAST, |
| 1542 NEW_SLOPPY_SLOW, | 1524 NEW_SLOPPY_SLOW, |
| 1543 NEW_STRICT | 1525 NEW_STRICT |
| 1544 }; | 1526 }; |
| 1545 | 1527 |
| 1546 ArgumentsAccessStub(Isolate* isolate, Type type) : PlatformCodeStub(isolate) { | 1528 ArgumentsAccessStub(Isolate* isolate, Type type) : PlatformCodeStub(isolate) { |
| 1547 minor_key_ = TypeBits::encode(type); | 1529 minor_key_ = TypeBits::encode(type); |
| 1548 } | 1530 } |
| 1549 | 1531 |
| 1550 virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE { | 1532 CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE { |
| 1551 if (type() == READ_ELEMENT) { | 1533 if (type() == READ_ELEMENT) { |
| 1552 return ArgumentsAccessReadDescriptor(isolate()); | 1534 return ArgumentsAccessReadDescriptor(isolate()); |
| 1553 } | 1535 } |
| 1554 return ContextOnlyDescriptor(isolate()); | 1536 return ContextOnlyDescriptor(isolate()); |
| 1555 } | 1537 } |
| 1556 | 1538 |
| 1557 private: | 1539 private: |
| 1558 Type type() const { return TypeBits::decode(minor_key_); } | 1540 Type type() const { return TypeBits::decode(minor_key_); } |
| 1559 | 1541 |
| 1560 void GenerateReadElement(MacroAssembler* masm); | 1542 void GenerateReadElement(MacroAssembler* masm); |
| 1561 void GenerateNewStrict(MacroAssembler* masm); | 1543 void GenerateNewStrict(MacroAssembler* masm); |
| 1562 void GenerateNewSloppyFast(MacroAssembler* masm); | 1544 void GenerateNewSloppyFast(MacroAssembler* masm); |
| 1563 void GenerateNewSloppySlow(MacroAssembler* masm); | 1545 void GenerateNewSloppySlow(MacroAssembler* masm); |
| 1564 | 1546 |
| 1565 virtual void PrintName(std::ostream& os) const OVERRIDE; // NOLINT | 1547 void PrintName(std::ostream& os) const OVERRIDE; // NOLINT |
| 1566 | 1548 |
| 1567 class TypeBits : public BitField<Type, 0, 2> {}; | 1549 class TypeBits : public BitField<Type, 0, 2> {}; |
| 1568 | 1550 |
| 1569 DEFINE_PLATFORM_CODE_STUB(ArgumentsAccess, PlatformCodeStub); | 1551 DEFINE_PLATFORM_CODE_STUB(ArgumentsAccess, PlatformCodeStub); |
| 1570 }; | 1552 }; |
| 1571 | 1553 |
| 1572 | 1554 |
| 1573 class RegExpExecStub: public PlatformCodeStub { | 1555 class RegExpExecStub: public PlatformCodeStub { |
| 1574 public: | 1556 public: |
| 1575 explicit RegExpExecStub(Isolate* isolate) : PlatformCodeStub(isolate) { } | 1557 explicit RegExpExecStub(Isolate* isolate) : PlatformCodeStub(isolate) { } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1609 private: | 1591 private: |
| 1610 int argc() const { return ArgcBits::decode(minor_key_); } | 1592 int argc() const { return ArgcBits::decode(minor_key_); } |
| 1611 int flags() const { return FlagBits::decode(minor_key_); } | 1593 int flags() const { return FlagBits::decode(minor_key_); } |
| 1612 | 1594 |
| 1613 bool CallAsMethod() const { | 1595 bool CallAsMethod() const { |
| 1614 return flags() == CALL_AS_METHOD || flags() == WRAP_AND_CALL; | 1596 return flags() == CALL_AS_METHOD || flags() == WRAP_AND_CALL; |
| 1615 } | 1597 } |
| 1616 | 1598 |
| 1617 bool NeedsChecks() const { return flags() != WRAP_AND_CALL; } | 1599 bool NeedsChecks() const { return flags() != WRAP_AND_CALL; } |
| 1618 | 1600 |
| 1619 virtual void PrintName(std::ostream& os) const OVERRIDE; // NOLINT | 1601 void PrintName(std::ostream& os) const OVERRIDE; // NOLINT |
| 1620 | 1602 |
| 1621 // Minor key encoding in 32 bits with Bitfield <Type, shift, size>. | 1603 // Minor key encoding in 32 bits with Bitfield <Type, shift, size>. |
| 1622 class FlagBits : public BitField<CallFunctionFlags, 0, 2> {}; | 1604 class FlagBits : public BitField<CallFunctionFlags, 0, 2> {}; |
| 1623 class ArgcBits : public BitField<unsigned, 2, Code::kArgumentsBits> {}; | 1605 class ArgcBits : public BitField<unsigned, 2, Code::kArgumentsBits> {}; |
| 1624 STATIC_ASSERT(Code::kArgumentsBits + 2 <= kStubMinorKeyBits); | 1606 STATIC_ASSERT(Code::kArgumentsBits + 2 <= kStubMinorKeyBits); |
| 1625 | 1607 |
| 1626 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunction); | 1608 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunction); |
| 1627 DEFINE_PLATFORM_CODE_STUB(CallFunction, PlatformCodeStub); | 1609 DEFINE_PLATFORM_CODE_STUB(CallFunction, PlatformCodeStub); |
| 1628 }; | 1610 }; |
| 1629 | 1611 |
| 1630 | 1612 |
| 1631 class CallConstructStub: public PlatformCodeStub { | 1613 class CallConstructStub: public PlatformCodeStub { |
| 1632 public: | 1614 public: |
| 1633 CallConstructStub(Isolate* isolate, CallConstructorFlags flags) | 1615 CallConstructStub(Isolate* isolate, CallConstructorFlags flags) |
| 1634 : PlatformCodeStub(isolate) { | 1616 : PlatformCodeStub(isolate) { |
| 1635 minor_key_ = FlagBits::encode(flags); | 1617 minor_key_ = FlagBits::encode(flags); |
| 1636 } | 1618 } |
| 1637 | 1619 |
| 1638 virtual void FinishCode(Handle<Code> code) OVERRIDE { | 1620 void FinishCode(Handle<Code> code) OVERRIDE { |
| 1639 code->set_has_function_cache(RecordCallTarget()); | 1621 code->set_has_function_cache(RecordCallTarget()); |
| 1640 } | 1622 } |
| 1641 | 1623 |
| 1642 private: | 1624 private: |
| 1643 CallConstructorFlags flags() const { return FlagBits::decode(minor_key_); } | 1625 CallConstructorFlags flags() const { return FlagBits::decode(minor_key_); } |
| 1644 | 1626 |
| 1645 bool RecordCallTarget() const { | 1627 bool RecordCallTarget() const { |
| 1646 return (flags() & RECORD_CONSTRUCTOR_TARGET) != 0; | 1628 return (flags() & RECORD_CONSTRUCTOR_TARGET) != 0; |
| 1647 } | 1629 } |
| 1648 | 1630 |
| 1649 virtual void PrintName(std::ostream& os) const OVERRIDE; // NOLINT | 1631 void PrintName(std::ostream& os) const OVERRIDE; // NOLINT |
| 1650 | 1632 |
| 1651 class FlagBits : public BitField<CallConstructorFlags, 0, 1> {}; | 1633 class FlagBits : public BitField<CallConstructorFlags, 0, 1> {}; |
| 1652 | 1634 |
| 1653 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallConstruct); | 1635 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallConstruct); |
| 1654 DEFINE_PLATFORM_CODE_STUB(CallConstruct, PlatformCodeStub); | 1636 DEFINE_PLATFORM_CODE_STUB(CallConstruct, PlatformCodeStub); |
| 1655 }; | 1637 }; |
| 1656 | 1638 |
| 1657 | 1639 |
| 1658 enum StringIndexFlags { | 1640 enum StringIndexFlags { |
| 1659 // Accepts smis or heap numbers. | 1641 // Accepts smis or heap numbers. |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1829 | 1811 |
| 1830 DISALLOW_COPY_AND_ASSIGN(StringCharAtGenerator); | 1812 DISALLOW_COPY_AND_ASSIGN(StringCharAtGenerator); |
| 1831 }; | 1813 }; |
| 1832 | 1814 |
| 1833 | 1815 |
| 1834 class LoadDictionaryElementStub : public HydrogenCodeStub { | 1816 class LoadDictionaryElementStub : public HydrogenCodeStub { |
| 1835 public: | 1817 public: |
| 1836 explicit LoadDictionaryElementStub(Isolate* isolate) | 1818 explicit LoadDictionaryElementStub(Isolate* isolate) |
| 1837 : HydrogenCodeStub(isolate) {} | 1819 : HydrogenCodeStub(isolate) {} |
| 1838 | 1820 |
| 1839 virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE { | 1821 CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE { |
| 1840 if (FLAG_vector_ics) { | 1822 if (FLAG_vector_ics) { |
| 1841 return VectorLoadICDescriptor(isolate()); | 1823 return VectorLoadICDescriptor(isolate()); |
| 1842 } | 1824 } |
| 1843 return LoadDescriptor(isolate()); | 1825 return LoadDescriptor(isolate()); |
| 1844 } | 1826 } |
| 1845 | 1827 |
| 1846 DEFINE_HYDROGEN_CODE_STUB(LoadDictionaryElement, HydrogenCodeStub); | 1828 DEFINE_HYDROGEN_CODE_STUB(LoadDictionaryElement, HydrogenCodeStub); |
| 1847 }; | 1829 }; |
| 1848 | 1830 |
| 1849 | 1831 |
| 1850 class KeyedLoadGenericStub : public HydrogenCodeStub { | 1832 class KeyedLoadGenericStub : public HydrogenCodeStub { |
| 1851 public: | 1833 public: |
| 1852 explicit KeyedLoadGenericStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} | 1834 explicit KeyedLoadGenericStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} |
| 1853 | 1835 |
| 1854 virtual Code::Kind GetCodeKind() const OVERRIDE { | 1836 Code::Kind GetCodeKind() const OVERRIDE { return Code::KEYED_LOAD_IC; } |
| 1855 return Code::KEYED_LOAD_IC; | 1837 InlineCacheState GetICState() const OVERRIDE { return GENERIC; } |
| 1856 } | |
| 1857 virtual InlineCacheState GetICState() const OVERRIDE { return GENERIC; } | |
| 1858 | 1838 |
| 1859 // Since KeyedLoadGeneric stub doesn't miss (simply calls runtime), it | 1839 // Since KeyedLoadGeneric stub doesn't miss (simply calls runtime), it |
| 1860 // doesn't need to use the VectorLoadICDescriptor for the case when | 1840 // doesn't need to use the VectorLoadICDescriptor for the case when |
| 1861 // flag --vector-ics is true. | 1841 // flag --vector-ics is true. |
| 1862 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load); | 1842 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load); |
| 1863 | 1843 |
| 1864 DEFINE_HYDROGEN_CODE_STUB(KeyedLoadGeneric, HydrogenCodeStub); | 1844 DEFINE_HYDROGEN_CODE_STUB(KeyedLoadGeneric, HydrogenCodeStub); |
| 1865 }; | 1845 }; |
| 1866 | 1846 |
| 1867 | 1847 |
| 1868 class LoadICTrampolineStub : public PlatformCodeStub { | 1848 class LoadICTrampolineStub : public PlatformCodeStub { |
| 1869 public: | 1849 public: |
| 1870 LoadICTrampolineStub(Isolate* isolate, const LoadICState& state) | 1850 LoadICTrampolineStub(Isolate* isolate, const LoadICState& state) |
| 1871 : PlatformCodeStub(isolate) { | 1851 : PlatformCodeStub(isolate) { |
| 1872 minor_key_ = state.GetExtraICState(); | 1852 minor_key_ = state.GetExtraICState(); |
| 1873 } | 1853 } |
| 1874 | 1854 |
| 1875 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::LOAD_IC; } | 1855 Code::Kind GetCodeKind() const OVERRIDE { return Code::LOAD_IC; } |
| 1876 | 1856 |
| 1877 virtual InlineCacheState GetICState() const FINAL OVERRIDE { return DEFAULT; } | 1857 InlineCacheState GetICState() const FINAL { return DEFAULT; } |
| 1878 | 1858 |
| 1879 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE { | 1859 ExtraICState GetExtraICState() const FINAL { |
| 1880 return static_cast<ExtraICState>(minor_key_); | 1860 return static_cast<ExtraICState>(minor_key_); |
| 1881 } | 1861 } |
| 1882 | 1862 |
| 1883 private: | 1863 private: |
| 1884 LoadICState state() const { | 1864 LoadICState state() const { |
| 1885 return LoadICState(static_cast<ExtraICState>(minor_key_)); | 1865 return LoadICState(static_cast<ExtraICState>(minor_key_)); |
| 1886 } | 1866 } |
| 1887 | 1867 |
| 1888 DEFINE_CALL_INTERFACE_DESCRIPTOR(VectorLoadICTrampoline); | 1868 DEFINE_CALL_INTERFACE_DESCRIPTOR(VectorLoadICTrampoline); |
| 1889 DEFINE_PLATFORM_CODE_STUB(LoadICTrampoline, PlatformCodeStub); | 1869 DEFINE_PLATFORM_CODE_STUB(LoadICTrampoline, PlatformCodeStub); |
| 1890 }; | 1870 }; |
| 1891 | 1871 |
| 1892 | 1872 |
| 1893 class KeyedLoadICTrampolineStub : public LoadICTrampolineStub { | 1873 class KeyedLoadICTrampolineStub : public LoadICTrampolineStub { |
| 1894 public: | 1874 public: |
| 1895 explicit KeyedLoadICTrampolineStub(Isolate* isolate) | 1875 explicit KeyedLoadICTrampolineStub(Isolate* isolate) |
| 1896 : LoadICTrampolineStub(isolate, LoadICState(0)) {} | 1876 : LoadICTrampolineStub(isolate, LoadICState(0)) {} |
| 1897 | 1877 |
| 1898 virtual Code::Kind GetCodeKind() const OVERRIDE { | 1878 Code::Kind GetCodeKind() const OVERRIDE { return Code::KEYED_LOAD_IC; } |
| 1899 return Code::KEYED_LOAD_IC; | |
| 1900 } | |
| 1901 | 1879 |
| 1902 DEFINE_PLATFORM_CODE_STUB(KeyedLoadICTrampoline, LoadICTrampolineStub); | 1880 DEFINE_PLATFORM_CODE_STUB(KeyedLoadICTrampoline, LoadICTrampolineStub); |
| 1903 }; | 1881 }; |
| 1904 | 1882 |
| 1905 | 1883 |
| 1906 class MegamorphicLoadStub : public HydrogenCodeStub { | 1884 class MegamorphicLoadStub : public HydrogenCodeStub { |
| 1907 public: | 1885 public: |
| 1908 MegamorphicLoadStub(Isolate* isolate, const LoadICState& state) | 1886 MegamorphicLoadStub(Isolate* isolate, const LoadICState& state) |
| 1909 : HydrogenCodeStub(isolate) { | 1887 : HydrogenCodeStub(isolate) { |
| 1910 set_sub_minor_key(state.GetExtraICState()); | 1888 set_sub_minor_key(state.GetExtraICState()); |
| 1911 } | 1889 } |
| 1912 | 1890 |
| 1913 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::LOAD_IC; } | 1891 Code::Kind GetCodeKind() const OVERRIDE { return Code::LOAD_IC; } |
| 1914 | 1892 |
| 1915 virtual InlineCacheState GetICState() const FINAL OVERRIDE { | 1893 InlineCacheState GetICState() const FINAL { return MEGAMORPHIC; } |
| 1916 return MEGAMORPHIC; | |
| 1917 } | |
| 1918 | 1894 |
| 1919 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE { | 1895 ExtraICState GetExtraICState() const FINAL { |
| 1920 return static_cast<ExtraICState>(sub_minor_key()); | 1896 return static_cast<ExtraICState>(sub_minor_key()); |
| 1921 } | 1897 } |
| 1922 | 1898 |
| 1923 virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE { | 1899 CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE { |
| 1924 if (FLAG_vector_ics) { | 1900 if (FLAG_vector_ics) { |
| 1925 return VectorLoadICDescriptor(isolate()); | 1901 return VectorLoadICDescriptor(isolate()); |
| 1926 } | 1902 } |
| 1927 return LoadDescriptor(isolate()); | 1903 return LoadDescriptor(isolate()); |
| 1928 } | 1904 } |
| 1929 | 1905 |
| 1930 DEFINE_HYDROGEN_CODE_STUB(MegamorphicLoad, HydrogenCodeStub); | 1906 DEFINE_HYDROGEN_CODE_STUB(MegamorphicLoad, HydrogenCodeStub); |
| 1931 }; | 1907 }; |
| 1932 | 1908 |
| 1933 | 1909 |
| 1934 class VectorLoadStub : public HydrogenCodeStub { | 1910 class VectorLoadStub : public HydrogenCodeStub { |
| 1935 public: | 1911 public: |
| 1936 explicit VectorLoadStub(Isolate* isolate, const LoadICState& state) | 1912 explicit VectorLoadStub(Isolate* isolate, const LoadICState& state) |
| 1937 : HydrogenCodeStub(isolate) { | 1913 : HydrogenCodeStub(isolate) { |
| 1938 set_sub_minor_key(state.GetExtraICState()); | 1914 set_sub_minor_key(state.GetExtraICState()); |
| 1939 } | 1915 } |
| 1940 | 1916 |
| 1941 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::LOAD_IC; } | 1917 Code::Kind GetCodeKind() const OVERRIDE { return Code::LOAD_IC; } |
| 1942 | 1918 |
| 1943 virtual InlineCacheState GetICState() const FINAL OVERRIDE { return DEFAULT; } | 1919 InlineCacheState GetICState() const FINAL { return DEFAULT; } |
| 1944 | 1920 |
| 1945 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE { | 1921 ExtraICState GetExtraICState() const FINAL { |
| 1946 return static_cast<ExtraICState>(sub_minor_key()); | 1922 return static_cast<ExtraICState>(sub_minor_key()); |
| 1947 } | 1923 } |
| 1948 | 1924 |
| 1949 private: | 1925 private: |
| 1950 LoadICState state() const { return LoadICState(GetExtraICState()); } | 1926 LoadICState state() const { return LoadICState(GetExtraICState()); } |
| 1951 | 1927 |
| 1952 DEFINE_CALL_INTERFACE_DESCRIPTOR(VectorLoadIC); | 1928 DEFINE_CALL_INTERFACE_DESCRIPTOR(VectorLoadIC); |
| 1953 DEFINE_HYDROGEN_CODE_STUB(VectorLoad, HydrogenCodeStub); | 1929 DEFINE_HYDROGEN_CODE_STUB(VectorLoad, HydrogenCodeStub); |
| 1954 }; | 1930 }; |
| 1955 | 1931 |
| 1956 | 1932 |
| 1957 class VectorKeyedLoadStub : public VectorLoadStub { | 1933 class VectorKeyedLoadStub : public VectorLoadStub { |
| 1958 public: | 1934 public: |
| 1959 explicit VectorKeyedLoadStub(Isolate* isolate) | 1935 explicit VectorKeyedLoadStub(Isolate* isolate) |
| 1960 : VectorLoadStub(isolate, LoadICState(0)) {} | 1936 : VectorLoadStub(isolate, LoadICState(0)) {} |
| 1961 | 1937 |
| 1962 virtual Code::Kind GetCodeKind() const OVERRIDE { | 1938 Code::Kind GetCodeKind() const OVERRIDE { return Code::KEYED_LOAD_IC; } |
| 1963 return Code::KEYED_LOAD_IC; | |
| 1964 } | |
| 1965 | 1939 |
| 1966 DEFINE_CALL_INTERFACE_DESCRIPTOR(VectorLoadIC); | 1940 DEFINE_CALL_INTERFACE_DESCRIPTOR(VectorLoadIC); |
| 1967 DEFINE_HYDROGEN_CODE_STUB(VectorKeyedLoad, VectorLoadStub); | 1941 DEFINE_HYDROGEN_CODE_STUB(VectorKeyedLoad, VectorLoadStub); |
| 1968 }; | 1942 }; |
| 1969 | 1943 |
| 1970 | 1944 |
| 1971 class DoubleToIStub : public PlatformCodeStub { | 1945 class DoubleToIStub : public PlatformCodeStub { |
| 1972 public: | 1946 public: |
| 1973 DoubleToIStub(Isolate* isolate, Register source, Register destination, | 1947 DoubleToIStub(Isolate* isolate, Register source, Register destination, |
| 1974 int offset, bool is_truncating, bool skip_fastpath = false) | 1948 int offset, bool is_truncating, bool skip_fastpath = false) |
| 1975 : PlatformCodeStub(isolate) { | 1949 : PlatformCodeStub(isolate) { |
| 1976 minor_key_ = SourceRegisterBits::encode(source.code()) | | 1950 minor_key_ = SourceRegisterBits::encode(source.code()) | |
| 1977 DestinationRegisterBits::encode(destination.code()) | | 1951 DestinationRegisterBits::encode(destination.code()) | |
| 1978 OffsetBits::encode(offset) | | 1952 OffsetBits::encode(offset) | |
| 1979 IsTruncatingBits::encode(is_truncating) | | 1953 IsTruncatingBits::encode(is_truncating) | |
| 1980 SkipFastPathBits::encode(skip_fastpath) | | 1954 SkipFastPathBits::encode(skip_fastpath) | |
| 1981 SSE3Bits::encode(CpuFeatures::IsSupported(SSE3) ? 1 : 0); | 1955 SSE3Bits::encode(CpuFeatures::IsSupported(SSE3) ? 1 : 0); |
| 1982 } | 1956 } |
| 1983 | 1957 |
| 1984 virtual bool SometimesSetsUpAFrame() OVERRIDE { return false; } | 1958 bool SometimesSetsUpAFrame() OVERRIDE { return false; } |
| 1985 | 1959 |
| 1986 private: | 1960 private: |
| 1987 Register source() const { | 1961 Register source() const { |
| 1988 return Register::from_code(SourceRegisterBits::decode(minor_key_)); | 1962 return Register::from_code(SourceRegisterBits::decode(minor_key_)); |
| 1989 } | 1963 } |
| 1990 Register destination() const { | 1964 Register destination() const { |
| 1991 return Register::from_code(DestinationRegisterBits::decode(minor_key_)); | 1965 return Register::from_code(DestinationRegisterBits::decode(minor_key_)); |
| 1992 } | 1966 } |
| 1993 bool is_truncating() const { return IsTruncatingBits::decode(minor_key_); } | 1967 bool is_truncating() const { return IsTruncatingBits::decode(minor_key_); } |
| 1994 bool skip_fastpath() const { return SkipFastPathBits::decode(minor_key_); } | 1968 bool skip_fastpath() const { return SkipFastPathBits::decode(minor_key_); } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2036 SlotIndexBits::is_valid(lookup_result->slot_index); | 2010 SlotIndexBits::is_valid(lookup_result->slot_index); |
| 2037 } | 2011 } |
| 2038 | 2012 |
| 2039 private: | 2013 private: |
| 2040 static const int kContextIndexBits = 13; | 2014 static const int kContextIndexBits = 13; |
| 2041 static const int kSlotIndexBits = 13; | 2015 static const int kSlotIndexBits = 13; |
| 2042 class ContextIndexBits : public BitField<int, 0, kContextIndexBits> {}; | 2016 class ContextIndexBits : public BitField<int, 0, kContextIndexBits> {}; |
| 2043 class SlotIndexBits | 2017 class SlotIndexBits |
| 2044 : public BitField<int, kContextIndexBits, kSlotIndexBits> {}; | 2018 : public BitField<int, kContextIndexBits, kSlotIndexBits> {}; |
| 2045 | 2019 |
| 2046 virtual Code::StubType GetStubType() OVERRIDE { return Code::FAST; } | 2020 Code::StubType GetStubType() OVERRIDE { return Code::FAST; } |
| 2047 | 2021 |
| 2048 DEFINE_CODE_STUB_BASE(ScriptContextFieldStub, HandlerStub); | 2022 DEFINE_CODE_STUB_BASE(ScriptContextFieldStub, HandlerStub); |
| 2049 }; | 2023 }; |
| 2050 | 2024 |
| 2051 | 2025 |
| 2052 class LoadScriptContextFieldStub : public ScriptContextFieldStub { | 2026 class LoadScriptContextFieldStub : public ScriptContextFieldStub { |
| 2053 public: | 2027 public: |
| 2054 LoadScriptContextFieldStub( | 2028 LoadScriptContextFieldStub( |
| 2055 Isolate* isolate, const ScriptContextTable::LookupResult* lookup_result) | 2029 Isolate* isolate, const ScriptContextTable::LookupResult* lookup_result) |
| 2056 : ScriptContextFieldStub(isolate, lookup_result) {} | 2030 : ScriptContextFieldStub(isolate, lookup_result) {} |
| 2057 | 2031 |
| 2058 private: | 2032 private: |
| 2059 virtual Code::Kind kind() const OVERRIDE { return Code::LOAD_IC; } | 2033 Code::Kind kind() const OVERRIDE { return Code::LOAD_IC; } |
| 2060 | 2034 |
| 2061 DEFINE_HANDLER_CODE_STUB(LoadScriptContextField, ScriptContextFieldStub); | 2035 DEFINE_HANDLER_CODE_STUB(LoadScriptContextField, ScriptContextFieldStub); |
| 2062 }; | 2036 }; |
| 2063 | 2037 |
| 2064 | 2038 |
| 2065 class StoreScriptContextFieldStub : public ScriptContextFieldStub { | 2039 class StoreScriptContextFieldStub : public ScriptContextFieldStub { |
| 2066 public: | 2040 public: |
| 2067 StoreScriptContextFieldStub( | 2041 StoreScriptContextFieldStub( |
| 2068 Isolate* isolate, const ScriptContextTable::LookupResult* lookup_result) | 2042 Isolate* isolate, const ScriptContextTable::LookupResult* lookup_result) |
| 2069 : ScriptContextFieldStub(isolate, lookup_result) {} | 2043 : ScriptContextFieldStub(isolate, lookup_result) {} |
| 2070 | 2044 |
| 2071 private: | 2045 private: |
| 2072 virtual Code::Kind kind() const OVERRIDE { return Code::STORE_IC; } | 2046 Code::Kind kind() const OVERRIDE { return Code::STORE_IC; } |
| 2073 | 2047 |
| 2074 DEFINE_HANDLER_CODE_STUB(StoreScriptContextField, ScriptContextFieldStub); | 2048 DEFINE_HANDLER_CODE_STUB(StoreScriptContextField, ScriptContextFieldStub); |
| 2075 }; | 2049 }; |
| 2076 | 2050 |
| 2077 | 2051 |
| 2078 class LoadFastElementStub : public HydrogenCodeStub { | 2052 class LoadFastElementStub : public HydrogenCodeStub { |
| 2079 public: | 2053 public: |
| 2080 LoadFastElementStub(Isolate* isolate, bool is_js_array, | 2054 LoadFastElementStub(Isolate* isolate, bool is_js_array, |
| 2081 ElementsKind elements_kind) | 2055 ElementsKind elements_kind) |
| 2082 : HydrogenCodeStub(isolate) { | 2056 : HydrogenCodeStub(isolate) { |
| 2083 set_sub_minor_key(ElementsKindBits::encode(elements_kind) | | 2057 set_sub_minor_key(ElementsKindBits::encode(elements_kind) | |
| 2084 IsJSArrayBits::encode(is_js_array)); | 2058 IsJSArrayBits::encode(is_js_array)); |
| 2085 } | 2059 } |
| 2086 | 2060 |
| 2087 bool is_js_array() const { return IsJSArrayBits::decode(sub_minor_key()); } | 2061 bool is_js_array() const { return IsJSArrayBits::decode(sub_minor_key()); } |
| 2088 | 2062 |
| 2089 ElementsKind elements_kind() const { | 2063 ElementsKind elements_kind() const { |
| 2090 return ElementsKindBits::decode(sub_minor_key()); | 2064 return ElementsKindBits::decode(sub_minor_key()); |
| 2091 } | 2065 } |
| 2092 | 2066 |
| 2093 private: | 2067 private: |
| 2094 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; | 2068 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; |
| 2095 class IsJSArrayBits: public BitField<bool, 8, 1> {}; | 2069 class IsJSArrayBits: public BitField<bool, 8, 1> {}; |
| 2096 | 2070 |
| 2097 virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE { | 2071 CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE { |
| 2098 if (FLAG_vector_ics) { | 2072 if (FLAG_vector_ics) { |
| 2099 return VectorLoadICDescriptor(isolate()); | 2073 return VectorLoadICDescriptor(isolate()); |
| 2100 } | 2074 } |
| 2101 return LoadDescriptor(isolate()); | 2075 return LoadDescriptor(isolate()); |
| 2102 } | 2076 } |
| 2103 | 2077 |
| 2104 DEFINE_HYDROGEN_CODE_STUB(LoadFastElement, HydrogenCodeStub); | 2078 DEFINE_HYDROGEN_CODE_STUB(LoadFastElement, HydrogenCodeStub); |
| 2105 }; | 2079 }; |
| 2106 | 2080 |
| 2107 | 2081 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2223 class ArrayNoArgumentConstructorStub : public ArrayConstructorStubBase { | 2197 class ArrayNoArgumentConstructorStub : public ArrayConstructorStubBase { |
| 2224 public: | 2198 public: |
| 2225 ArrayNoArgumentConstructorStub( | 2199 ArrayNoArgumentConstructorStub( |
| 2226 Isolate* isolate, | 2200 Isolate* isolate, |
| 2227 ElementsKind kind, | 2201 ElementsKind kind, |
| 2228 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) | 2202 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) |
| 2229 : ArrayConstructorStubBase(isolate, kind, override_mode) { | 2203 : ArrayConstructorStubBase(isolate, kind, override_mode) { |
| 2230 } | 2204 } |
| 2231 | 2205 |
| 2232 private: | 2206 private: |
| 2233 virtual void PrintName(std::ostream& os) const OVERRIDE { // NOLINT | 2207 void PrintName(std::ostream& os) const OVERRIDE { // NOLINT |
| 2234 BasePrintName(os, "ArrayNoArgumentConstructorStub"); | 2208 BasePrintName(os, "ArrayNoArgumentConstructorStub"); |
| 2235 } | 2209 } |
| 2236 | 2210 |
| 2237 DEFINE_CALL_INTERFACE_DESCRIPTOR(ArrayConstructorConstantArgCount); | 2211 DEFINE_CALL_INTERFACE_DESCRIPTOR(ArrayConstructorConstantArgCount); |
| 2238 DEFINE_HYDROGEN_CODE_STUB(ArrayNoArgumentConstructor, | 2212 DEFINE_HYDROGEN_CODE_STUB(ArrayNoArgumentConstructor, |
| 2239 ArrayConstructorStubBase); | 2213 ArrayConstructorStubBase); |
| 2240 }; | 2214 }; |
| 2241 | 2215 |
| 2242 | 2216 |
| 2243 class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase { | 2217 class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase { |
| 2244 public: | 2218 public: |
| 2245 ArraySingleArgumentConstructorStub( | 2219 ArraySingleArgumentConstructorStub( |
| 2246 Isolate* isolate, | 2220 Isolate* isolate, |
| 2247 ElementsKind kind, | 2221 ElementsKind kind, |
| 2248 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) | 2222 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) |
| 2249 : ArrayConstructorStubBase(isolate, kind, override_mode) { | 2223 : ArrayConstructorStubBase(isolate, kind, override_mode) { |
| 2250 } | 2224 } |
| 2251 | 2225 |
| 2252 private: | 2226 private: |
| 2253 virtual void PrintName(std::ostream& os) const OVERRIDE { // NOLINT | 2227 void PrintName(std::ostream& os) const OVERRIDE { // NOLINT |
| 2254 BasePrintName(os, "ArraySingleArgumentConstructorStub"); | 2228 BasePrintName(os, "ArraySingleArgumentConstructorStub"); |
| 2255 } | 2229 } |
| 2256 | 2230 |
| 2257 DEFINE_CALL_INTERFACE_DESCRIPTOR(ArrayConstructor); | 2231 DEFINE_CALL_INTERFACE_DESCRIPTOR(ArrayConstructor); |
| 2258 DEFINE_HYDROGEN_CODE_STUB(ArraySingleArgumentConstructor, | 2232 DEFINE_HYDROGEN_CODE_STUB(ArraySingleArgumentConstructor, |
| 2259 ArrayConstructorStubBase); | 2233 ArrayConstructorStubBase); |
| 2260 }; | 2234 }; |
| 2261 | 2235 |
| 2262 | 2236 |
| 2263 class ArrayNArgumentsConstructorStub : public ArrayConstructorStubBase { | 2237 class ArrayNArgumentsConstructorStub : public ArrayConstructorStubBase { |
| 2264 public: | 2238 public: |
| 2265 ArrayNArgumentsConstructorStub( | 2239 ArrayNArgumentsConstructorStub( |
| 2266 Isolate* isolate, | 2240 Isolate* isolate, |
| 2267 ElementsKind kind, | 2241 ElementsKind kind, |
| 2268 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) | 2242 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) |
| 2269 : ArrayConstructorStubBase(isolate, kind, override_mode) { | 2243 : ArrayConstructorStubBase(isolate, kind, override_mode) { |
| 2270 } | 2244 } |
| 2271 | 2245 |
| 2272 private: | 2246 private: |
| 2273 virtual void PrintName(std::ostream& os) const OVERRIDE { // NOLINT | 2247 void PrintName(std::ostream& os) const OVERRIDE { // NOLINT |
| 2274 BasePrintName(os, "ArrayNArgumentsConstructorStub"); | 2248 BasePrintName(os, "ArrayNArgumentsConstructorStub"); |
| 2275 } | 2249 } |
| 2276 | 2250 |
| 2277 DEFINE_CALL_INTERFACE_DESCRIPTOR(ArrayConstructor); | 2251 DEFINE_CALL_INTERFACE_DESCRIPTOR(ArrayConstructor); |
| 2278 DEFINE_HYDROGEN_CODE_STUB(ArrayNArgumentsConstructor, | 2252 DEFINE_HYDROGEN_CODE_STUB(ArrayNArgumentsConstructor, |
| 2279 ArrayConstructorStubBase); | 2253 ArrayConstructorStubBase); |
| 2280 }; | 2254 }; |
| 2281 | 2255 |
| 2282 | 2256 |
| 2283 class InternalArrayConstructorStubBase : public HydrogenCodeStub { | 2257 class InternalArrayConstructorStubBase : public HydrogenCodeStub { |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2407 ToBooleanStub(Isolate* isolate, ExtraICState state) | 2381 ToBooleanStub(Isolate* isolate, ExtraICState state) |
| 2408 : HydrogenCodeStub(isolate) { | 2382 : HydrogenCodeStub(isolate) { |
| 2409 set_sub_minor_key(TypesBits::encode(static_cast<byte>(state)) | | 2383 set_sub_minor_key(TypesBits::encode(static_cast<byte>(state)) | |
| 2410 ResultModeBits::encode(RESULT_AS_SMI)); | 2384 ResultModeBits::encode(RESULT_AS_SMI)); |
| 2411 } | 2385 } |
| 2412 | 2386 |
| 2413 bool UpdateStatus(Handle<Object> object); | 2387 bool UpdateStatus(Handle<Object> object); |
| 2414 Types types() const { return Types(TypesBits::decode(sub_minor_key())); } | 2388 Types types() const { return Types(TypesBits::decode(sub_minor_key())); } |
| 2415 ResultMode mode() const { return ResultModeBits::decode(sub_minor_key()); } | 2389 ResultMode mode() const { return ResultModeBits::decode(sub_minor_key()); } |
| 2416 | 2390 |
| 2417 virtual Code::Kind GetCodeKind() const OVERRIDE { | 2391 Code::Kind GetCodeKind() const OVERRIDE { return Code::TO_BOOLEAN_IC; } |
| 2418 return Code::TO_BOOLEAN_IC; | 2392 void PrintState(std::ostream& os) const OVERRIDE; // NOLINT |
| 2419 } | |
| 2420 virtual void PrintState(std::ostream& os) const OVERRIDE; // NOLINT | |
| 2421 | 2393 |
| 2422 virtual bool SometimesSetsUpAFrame() OVERRIDE { return false; } | 2394 bool SometimesSetsUpAFrame() OVERRIDE { return false; } |
| 2423 | 2395 |
| 2424 static Handle<Code> GetUninitialized(Isolate* isolate) { | 2396 static Handle<Code> GetUninitialized(Isolate* isolate) { |
| 2425 return ToBooleanStub(isolate, UNINITIALIZED).GetCode(); | 2397 return ToBooleanStub(isolate, UNINITIALIZED).GetCode(); |
| 2426 } | 2398 } |
| 2427 | 2399 |
| 2428 virtual ExtraICState GetExtraICState() const OVERRIDE { | 2400 ExtraICState GetExtraICState() const OVERRIDE { return types().ToIntegral(); } |
| 2429 return types().ToIntegral(); | |
| 2430 } | |
| 2431 | 2401 |
| 2432 virtual InlineCacheState GetICState() const OVERRIDE { | 2402 InlineCacheState GetICState() const OVERRIDE { |
| 2433 if (types().IsEmpty()) { | 2403 if (types().IsEmpty()) { |
| 2434 return ::v8::internal::UNINITIALIZED; | 2404 return ::v8::internal::UNINITIALIZED; |
| 2435 } else { | 2405 } else { |
| 2436 return MONOMORPHIC; | 2406 return MONOMORPHIC; |
| 2437 } | 2407 } |
| 2438 } | 2408 } |
| 2439 | 2409 |
| 2440 private: | 2410 private: |
| 2441 ToBooleanStub(Isolate* isolate, InitializationState init_state) | 2411 ToBooleanStub(Isolate* isolate, InitializationState init_state) |
| 2442 : HydrogenCodeStub(isolate, init_state) { | 2412 : HydrogenCodeStub(isolate, init_state) { |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2534 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); | 2504 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); |
| 2535 DEFINE_PLATFORM_CODE_STUB(StubFailureTrampoline, PlatformCodeStub); | 2505 DEFINE_PLATFORM_CODE_STUB(StubFailureTrampoline, PlatformCodeStub); |
| 2536 }; | 2506 }; |
| 2537 | 2507 |
| 2538 | 2508 |
| 2539 class ProfileEntryHookStub : public PlatformCodeStub { | 2509 class ProfileEntryHookStub : public PlatformCodeStub { |
| 2540 public: | 2510 public: |
| 2541 explicit ProfileEntryHookStub(Isolate* isolate) : PlatformCodeStub(isolate) {} | 2511 explicit ProfileEntryHookStub(Isolate* isolate) : PlatformCodeStub(isolate) {} |
| 2542 | 2512 |
| 2543 // The profile entry hook function is not allowed to cause a GC. | 2513 // The profile entry hook function is not allowed to cause a GC. |
| 2544 virtual bool SometimesSetsUpAFrame() OVERRIDE { return false; } | 2514 bool SometimesSetsUpAFrame() OVERRIDE { return false; } |
| 2545 | 2515 |
| 2546 // Generates a call to the entry hook if it's enabled. | 2516 // Generates a call to the entry hook if it's enabled. |
| 2547 static void MaybeCallEntryHook(MacroAssembler* masm); | 2517 static void MaybeCallEntryHook(MacroAssembler* masm); |
| 2548 | 2518 |
| 2549 private: | 2519 private: |
| 2550 static void EntryHookTrampoline(intptr_t function, | 2520 static void EntryHookTrampoline(intptr_t function, |
| 2551 intptr_t stack_pointer, | 2521 intptr_t stack_pointer, |
| 2552 Isolate* isolate); | 2522 Isolate* isolate); |
| 2553 | 2523 |
| 2554 // ProfileEntryHookStub is called at the start of a function, so it has the | 2524 // ProfileEntryHookStub is called at the start of a function, so it has the |
| 2555 // same register set. | 2525 // same register set. |
| 2556 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunction) | 2526 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunction) |
| 2557 DEFINE_PLATFORM_CODE_STUB(ProfileEntryHook, PlatformCodeStub); | 2527 DEFINE_PLATFORM_CODE_STUB(ProfileEntryHook, PlatformCodeStub); |
| 2558 }; | 2528 }; |
| 2559 | 2529 |
| 2560 | 2530 |
| 2561 class StoreBufferOverflowStub : public PlatformCodeStub { | 2531 class StoreBufferOverflowStub : public PlatformCodeStub { |
| 2562 public: | 2532 public: |
| 2563 StoreBufferOverflowStub(Isolate* isolate, SaveFPRegsMode save_fp) | 2533 StoreBufferOverflowStub(Isolate* isolate, SaveFPRegsMode save_fp) |
| 2564 : PlatformCodeStub(isolate) { | 2534 : PlatformCodeStub(isolate) { |
| 2565 minor_key_ = SaveDoublesBits::encode(save_fp == kSaveFPRegs); | 2535 minor_key_ = SaveDoublesBits::encode(save_fp == kSaveFPRegs); |
| 2566 } | 2536 } |
| 2567 | 2537 |
| 2568 static void GenerateFixedRegStubsAheadOfTime(Isolate* isolate); | 2538 static void GenerateFixedRegStubsAheadOfTime(Isolate* isolate); |
| 2569 virtual bool SometimesSetsUpAFrame() OVERRIDE { return false; } | 2539 bool SometimesSetsUpAFrame() OVERRIDE { return false; } |
| 2570 | 2540 |
| 2571 private: | 2541 private: |
| 2572 bool save_doubles() const { return SaveDoublesBits::decode(minor_key_); } | 2542 bool save_doubles() const { return SaveDoublesBits::decode(minor_key_); } |
| 2573 | 2543 |
| 2574 class SaveDoublesBits : public BitField<bool, 0, 1> {}; | 2544 class SaveDoublesBits : public BitField<bool, 0, 1> {}; |
| 2575 | 2545 |
| 2576 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); | 2546 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); |
| 2577 DEFINE_PLATFORM_CODE_STUB(StoreBufferOverflow, PlatformCodeStub); | 2547 DEFINE_PLATFORM_CODE_STUB(StoreBufferOverflow, PlatformCodeStub); |
| 2578 }; | 2548 }; |
| 2579 | 2549 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 2607 | 2577 |
| 2608 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR | 2578 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR |
| 2609 #undef DEFINE_PLATFORM_CODE_STUB | 2579 #undef DEFINE_PLATFORM_CODE_STUB |
| 2610 #undef DEFINE_HANDLER_CODE_STUB | 2580 #undef DEFINE_HANDLER_CODE_STUB |
| 2611 #undef DEFINE_HYDROGEN_CODE_STUB | 2581 #undef DEFINE_HYDROGEN_CODE_STUB |
| 2612 #undef DEFINE_CODE_STUB | 2582 #undef DEFINE_CODE_STUB |
| 2613 #undef DEFINE_CODE_STUB_BASE | 2583 #undef DEFINE_CODE_STUB_BASE |
| 2614 } } // namespace v8::internal | 2584 } } // namespace v8::internal |
| 2615 | 2585 |
| 2616 #endif // V8_CODE_STUBS_H_ | 2586 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |