OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
80 V(KeyedStoreElement) \ | 80 V(KeyedStoreElement) \ |
81 V(DebuggerStatement) \ | 81 V(DebuggerStatement) \ |
82 V(NameDictionaryLookup) \ | 82 V(NameDictionaryLookup) \ |
83 V(ElementsTransitionAndStore) \ | 83 V(ElementsTransitionAndStore) \ |
84 V(TransitionElementsKind) \ | 84 V(TransitionElementsKind) \ |
85 V(StoreArrayLiteralElement) \ | 85 V(StoreArrayLiteralElement) \ |
86 V(StubFailureTrampoline) \ | 86 V(StubFailureTrampoline) \ |
87 V(ArrayConstructor) \ | 87 V(ArrayConstructor) \ |
88 V(ProfileEntryHook) \ | 88 V(ProfileEntryHook) \ |
89 /* IC Handler stubs */ \ | 89 /* IC Handler stubs */ \ |
90 V(LoadField) | 90 V(LoadField) \ |
91 V(KeyedLoadField) | |
91 | 92 |
92 // List of code stubs only used on ARM platforms. | 93 // List of code stubs only used on ARM platforms. |
93 #ifdef V8_TARGET_ARCH_ARM | 94 #ifdef V8_TARGET_ARCH_ARM |
94 #define CODE_STUB_LIST_ARM(V) \ | 95 #define CODE_STUB_LIST_ARM(V) \ |
95 V(GetProperty) \ | 96 V(GetProperty) \ |
96 V(SetProperty) \ | 97 V(SetProperty) \ |
97 V(InvokeBuiltin) \ | 98 V(InvokeBuiltin) \ |
98 V(RegExpCEntry) \ | 99 V(RegExpCEntry) \ |
99 V(DirectCEntry) | 100 V(DirectCEntry) |
100 #else | 101 #else |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
178 // Returns information for computing the number key. | 179 // Returns information for computing the number key. |
179 virtual Major MajorKey() = 0; | 180 virtual Major MajorKey() = 0; |
180 virtual int MinorKey() = 0; | 181 virtual int MinorKey() = 0; |
181 | 182 |
182 virtual InlineCacheState GetICState() { | 183 virtual InlineCacheState GetICState() { |
183 return UNINITIALIZED; | 184 return UNINITIALIZED; |
184 } | 185 } |
185 virtual Code::ExtraICState GetExtraICState() { | 186 virtual Code::ExtraICState GetExtraICState() { |
186 return Code::kNoExtraICState; | 187 return Code::kNoExtraICState; |
187 } | 188 } |
189 virtual Code::StubType GetStubType() { | |
190 return Code::NORMAL; | |
191 } | |
192 virtual int GetStubFlags() { | |
193 return -1; | |
194 } | |
188 | 195 |
189 protected: | 196 protected: |
190 static bool CanUseFPRegisters(); | 197 static bool CanUseFPRegisters(); |
191 | 198 |
192 // Generates the assembler code for the stub. | 199 // Generates the assembler code for the stub. |
193 virtual Handle<Code> GenerateCode() = 0; | 200 virtual Handle<Code> GenerateCode() = 0; |
194 | 201 |
195 virtual Code::StubType GetStubType() { | |
196 return Code::NORMAL; | |
197 } | |
198 | 202 |
199 // Returns whether the code generated for this stub needs to be allocated as | 203 // Returns whether the code generated for this stub needs to be allocated as |
200 // a fixed (non-moveable) code object. | 204 // a fixed (non-moveable) code object. |
201 virtual bool NeedsImmovableCode() { return false; } | 205 virtual bool NeedsImmovableCode() { return false; } |
202 | 206 |
203 private: | 207 private: |
204 // Perform bookkeeping required after code generation when stub code is | 208 // Perform bookkeeping required after code generation when stub code is |
205 // initially generated. | 209 // initially generated. |
206 void RecordCodeGeneration(Code* code, Isolate* isolate); | 210 void RecordCodeGeneration(Code* code, Isolate* isolate); |
207 | 211 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
246 friend class BreakPointIterator; | 250 friend class BreakPointIterator; |
247 }; | 251 }; |
248 | 252 |
249 | 253 |
250 class PlatformCodeStub : public CodeStub { | 254 class PlatformCodeStub : public CodeStub { |
251 public: | 255 public: |
252 // Retrieve the code for the stub. Generate the code if needed. | 256 // Retrieve the code for the stub. Generate the code if needed. |
253 virtual Handle<Code> GenerateCode(); | 257 virtual Handle<Code> GenerateCode(); |
254 | 258 |
255 virtual Code::Kind GetCodeKind() const { return Code::STUB; } | 259 virtual Code::Kind GetCodeKind() const { return Code::STUB; } |
256 virtual int GetStubFlags() { return -1; } | |
257 | 260 |
258 protected: | 261 protected: |
259 // Generates the assembler code for the stub. | 262 // Generates the assembler code for the stub. |
260 virtual void Generate(MacroAssembler* masm) = 0; | 263 virtual void Generate(MacroAssembler* masm) = 0; |
261 }; | 264 }; |
262 | 265 |
263 | 266 |
264 enum StubFunctionMode { NOT_JS_FUNCTION_STUB_MODE, JS_FUNCTION_STUB_MODE }; | 267 enum StubFunctionMode { NOT_JS_FUNCTION_STUB_MODE, JS_FUNCTION_STUB_MODE }; |
265 | 268 |
266 | 269 |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
747 public: | 750 public: |
748 explicit StoreArrayLengthStub(Code::Kind kind, StrictModeFlag strict_mode) | 751 explicit StoreArrayLengthStub(Code::Kind kind, StrictModeFlag strict_mode) |
749 : StoreICStub(kind, strict_mode) { } | 752 : StoreICStub(kind, strict_mode) { } |
750 virtual void Generate(MacroAssembler* masm); | 753 virtual void Generate(MacroAssembler* masm); |
751 | 754 |
752 private: | 755 private: |
753 virtual CodeStub::Major MajorKey() { return StoreArrayLength; } | 756 virtual CodeStub::Major MajorKey() { return StoreArrayLength; } |
754 }; | 757 }; |
755 | 758 |
756 | 759 |
757 class HandlerStub: public ICStub { | 760 class HICStub: public HydrogenCodeStub { |
758 public: | 761 public: |
759 explicit HandlerStub(Code::Kind kind) : ICStub(kind) { } | 762 explicit HICStub() |
danno
2013/05/02 16:29:54
no explicit here, only for single argument constru
| |
763 : HydrogenCodeStub(CODE_STUB_IS_NOT_MISS) { } | |
764 virtual Code::Kind GetCodeKind() const { return kind(); } | |
765 virtual InlineCacheState GetICState() { return MONOMORPHIC; } | |
766 | |
767 protected: | |
768 class KindBits: public BitField<Code::Kind, 0, 4> {}; | |
769 virtual Code::Kind kind() const = 0; | |
770 }; | |
771 | |
772 | |
773 class HandlerStub: public HICStub { | |
774 public: | |
775 explicit HandlerStub() : HICStub() { } | |
760 virtual Code::Kind GetCodeKind() const { return Code::STUB; } | 776 virtual Code::Kind GetCodeKind() const { return Code::STUB; } |
761 virtual int GetStubFlags() { return kind(); } | 777 virtual int GetStubFlags() { return kind(); } |
762 }; | 778 }; |
763 | 779 |
764 | 780 |
765 class LoadFieldStub: public HandlerStub { | 781 class LoadFieldStub: public HandlerStub { |
766 public: | 782 public: |
767 LoadFieldStub(Register reg, bool inobject, int index) | 783 LoadFieldStub(bool inobject, int index) : HandlerStub() { |
768 : HandlerStub(Code::LOAD_IC), | 784 Initialize(Code::LOAD_IC, inobject, index); |
769 reg_(reg), | 785 } |
770 inobject_(inobject), | 786 |
771 index_(index) { } | 787 explicit LoadFieldStub() : HandlerStub() { } |
danno
2013/05/02 16:29:54
no explicit here either, there are no arguments. A
| |
772 virtual void Generate(MacroAssembler* masm); | 788 |
789 virtual Handle<Code> GenerateCode(); | |
790 | |
791 virtual void InitializeInterfaceDescriptor( | |
792 Isolate* isolate, | |
793 CodeStubInterfaceDescriptor* descriptor); | |
794 | |
795 Representation representation() { | |
796 return Representation::Tagged(); | |
797 } | |
798 | |
799 virtual Code::Kind kind() const { | |
800 return KindBits::decode(bit_field_); | |
801 } | |
802 | |
803 bool is_inobject() { | |
804 return InobjectBits::decode(bit_field_); | |
805 } | |
806 | |
807 int offset() { | |
808 int index = IndexBits::decode(bit_field_); | |
809 int offset = index * kPointerSize; | |
810 if (is_inobject()) return offset; | |
811 return FixedArray::kHeaderSize + offset; | |
812 } | |
813 | |
814 virtual Code::StubType GetStubType() { return Code::FIELD; } | |
773 | 815 |
774 protected: | 816 protected: |
775 virtual Code::StubType GetStubType() { return Code::FIELD; } | 817 void Initialize(Code::Kind kind, bool inobject, int index) { |
818 bit_field_ = KindBits::encode(kind) | |
819 | InobjectBits::encode(inobject) | |
820 | IndexBits::encode(index); | |
821 } | |
776 | 822 |
777 private: | 823 private: |
778 STATIC_ASSERT(KindBits::kSize == 4); | 824 STATIC_ASSERT(KindBits::kSize == 4); |
779 class RegisterBits: public BitField<int, 4, 6> {}; | 825 class InobjectBits: public BitField<bool, 4, 1> {}; |
780 class InobjectBits: public BitField<bool, 10, 1> {}; | 826 class IndexBits: public BitField<int, 5, 11> {}; |
781 class IndexBits: public BitField<int, 11, 11> {}; | |
782 virtual CodeStub::Major MajorKey() { return LoadField; } | 827 virtual CodeStub::Major MajorKey() { return LoadField; } |
783 virtual int MinorKey() { | 828 virtual int NotMissMinorKey() { return bit_field_; } |
784 return KindBits::encode(kind()) | |
785 | RegisterBits::encode(reg_.code()) | |
786 | InobjectBits::encode(inobject_) | |
787 | IndexBits::encode(index_); | |
788 } | |
789 | 829 |
790 Register reg_; | 830 int bit_field_; |
791 bool inobject_; | |
792 int index_; | |
793 }; | 831 }; |
794 | 832 |
795 | 833 |
834 class KeyedLoadFieldStub: public LoadFieldStub { | |
835 public: | |
836 KeyedLoadFieldStub(bool inobject, int index) : LoadFieldStub() { | |
837 Initialize(Code::KEYED_LOAD_IC, inobject, index); | |
838 } | |
839 | |
840 virtual void InitializeInterfaceDescriptor( | |
841 Isolate* isolate, | |
842 CodeStubInterfaceDescriptor* descriptor); | |
843 | |
844 virtual Handle<Code> GenerateCode(); | |
845 | |
846 private: | |
847 virtual CodeStub::Major MajorKey() { return KeyedLoadField; } | |
848 }; | |
849 | |
850 | |
796 class BinaryOpStub: public PlatformCodeStub { | 851 class BinaryOpStub: public PlatformCodeStub { |
797 public: | 852 public: |
798 BinaryOpStub(Token::Value op, OverwriteMode mode) | 853 BinaryOpStub(Token::Value op, OverwriteMode mode) |
799 : op_(op), | 854 : op_(op), |
800 mode_(mode), | 855 mode_(mode), |
801 platform_specific_bit_(false), | 856 platform_specific_bit_(false), |
802 left_type_(BinaryOpIC::UNINITIALIZED), | 857 left_type_(BinaryOpIC::UNINITIALIZED), |
803 right_type_(BinaryOpIC::UNINITIALIZED), | 858 right_type_(BinaryOpIC::UNINITIALIZED), |
804 result_type_(BinaryOpIC::UNINITIALIZED) { | 859 result_type_(BinaryOpIC::UNINITIALIZED) { |
805 Initialize(); | 860 Initialize(); |
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1894 | 1949 |
1895 // The current function entry hook. | 1950 // The current function entry hook. |
1896 static FunctionEntryHook entry_hook_; | 1951 static FunctionEntryHook entry_hook_; |
1897 | 1952 |
1898 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 1953 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); |
1899 }; | 1954 }; |
1900 | 1955 |
1901 } } // namespace v8::internal | 1956 } } // namespace v8::internal |
1902 | 1957 |
1903 #endif // V8_CODE_STUBS_H_ | 1958 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |