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

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

Issue 14847004: Turn the load field code stub into a hydrogen code stub. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
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
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(Code::Kind kind)
763 : HydrogenCodeStub(CODE_STUB_IS_NOT_MISS), kind_(kind) { }
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 Code::Kind kind() { return kind_; }
770
771 private:
772 Code::Kind kind_;
773 };
774
775
776 class HandlerStub: public HICStub {
777 public:
778 explicit HandlerStub(Code::Kind kind) : HICStub(kind) { }
760 virtual Code::Kind GetCodeKind() const { return Code::STUB; } 779 virtual Code::Kind GetCodeKind() const { return Code::STUB; }
761 virtual int GetStubFlags() { return kind(); } 780 virtual int GetStubFlags() { return kind(); }
762 }; 781 };
763 782
764 783
765 class LoadFieldStub: public HandlerStub { 784 class LoadFieldStub: public HandlerStub {
766 public: 785 public:
767 LoadFieldStub(Register reg, bool inobject, int index) 786 LoadFieldStub(bool inobject,
768 : HandlerStub(Code::LOAD_IC), 787 int index,
769 reg_(reg), 788 Representation representation,
789 Code::Kind kind = Code::LOAD_IC)
790 : HandlerStub(kind),
770 inobject_(inobject), 791 inobject_(inobject),
771 index_(index) { } 792 index_(index) {
772 virtual void Generate(MacroAssembler* masm); 793 unboxed_double_ = FLAG_track_double_fields && representation.IsDouble();
794 }
795 virtual Handle<Code> GenerateCode();
773 796
774 protected: 797 virtual void InitializeInterfaceDescriptor(
798 Isolate* isolate,
799 CodeStubInterfaceDescriptor* descriptor);
800
801 Representation representation() {
802 if (unboxed_double_) return Representation::Double();
danno 2013/05/02 11:41:48 Not yet?
803 return Representation::Tagged();
804 }
805
806 bool is_inobject() { return inobject_; }
807
808 int offset() {
809 int offset = index_ * kPointerSize;
810 if (is_inobject()) return offset;
811 return FixedArray::kHeaderSize + offset;
812 }
813
775 virtual Code::StubType GetStubType() { return Code::FIELD; } 814 virtual Code::StubType GetStubType() { return Code::FIELD; }
776 815
777 private: 816 private:
778 STATIC_ASSERT(KindBits::kSize == 4); 817 STATIC_ASSERT(KindBits::kSize == 4);
779 class RegisterBits: public BitField<int, 4, 6> {}; 818 class InobjectBits: public BitField<bool, 4, 1> {};
780 class InobjectBits: public BitField<bool, 10, 1> {}; 819 class IndexBits: public BitField<int, 5, 11> {};
781 class IndexBits: public BitField<int, 11, 11> {}; 820 class UnboxedDoubleBits: public BitField<bool, 16, 1> {};
danno 2013/05/02 10:56:59 Seems premature for this CL?
782 virtual CodeStub::Major MajorKey() { return LoadField; } 821 virtual CodeStub::Major MajorKey() { return LoadField; }
783 virtual int MinorKey() { 822
823 virtual int NotMissMinorKey() {
784 return KindBits::encode(kind()) 824 return KindBits::encode(kind())
785 | RegisterBits::encode(reg_.code())
786 | InobjectBits::encode(inobject_) 825 | InobjectBits::encode(inobject_)
787 | IndexBits::encode(index_); 826 | IndexBits::encode(index_)
827 | UnboxedDoubleBits::encode(unboxed_double_);
788 } 828 }
789 829
790 Register reg_;
791 bool inobject_; 830 bool inobject_;
danno 2013/05/02 10:56:59 Other stubs store the |'ed version in a field call
792 int index_; 831 int index_;
832 bool unboxed_double_;
793 }; 833 };
794 834
795 835
836 class KeyedLoadFieldStub: public LoadFieldStub {
837 public:
838 KeyedLoadFieldStub(bool inobject,
839 int index,
840 Representation representation)
841 : LoadFieldStub(inobject, index, representation, Code::KEYED_LOAD_IC) { }
842
843 virtual void InitializeInterfaceDescriptor(
844 Isolate* isolate,
845 CodeStubInterfaceDescriptor* descriptor);
846
847 virtual Handle<Code> GenerateCode();
848
849 private:
850 virtual CodeStub::Major MajorKey() { return KeyedLoadField; }
851 };
852
853
796 class BinaryOpStub: public PlatformCodeStub { 854 class BinaryOpStub: public PlatformCodeStub {
797 public: 855 public:
798 BinaryOpStub(Token::Value op, OverwriteMode mode) 856 BinaryOpStub(Token::Value op, OverwriteMode mode)
799 : op_(op), 857 : op_(op),
800 mode_(mode), 858 mode_(mode),
801 platform_specific_bit_(false), 859 platform_specific_bit_(false),
802 left_type_(BinaryOpIC::UNINITIALIZED), 860 left_type_(BinaryOpIC::UNINITIALIZED),
803 right_type_(BinaryOpIC::UNINITIALIZED), 861 right_type_(BinaryOpIC::UNINITIALIZED),
804 result_type_(BinaryOpIC::UNINITIALIZED) { 862 result_type_(BinaryOpIC::UNINITIALIZED) {
805 Initialize(); 863 Initialize();
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after
1894 1952
1895 // The current function entry hook. 1953 // The current function entry hook.
1896 static FunctionEntryHook entry_hook_; 1954 static FunctionEntryHook entry_hook_;
1897 1955
1898 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); 1956 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub);
1899 }; 1957 };
1900 1958
1901 } } // namespace v8::internal 1959 } } // namespace v8::internal
1902 1960
1903 #endif // V8_CODE_STUBS_H_ 1961 #endif // V8_CODE_STUBS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698