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

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

Issue 502713003: Encode CEntryStub properties in the minor key. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: encode Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm64/code-stubs-arm64.cc ('k') | src/code-stubs.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 143
144 // Retrieve the code for the stub. Generate the code if needed. 144 // Retrieve the code for the stub. Generate the code if needed.
145 Handle<Code> GetCode(); 145 Handle<Code> GetCode();
146 146
147 // Retrieve the code for the stub, make and return a copy of the code. 147 // Retrieve the code for the stub, make and return a copy of the code.
148 Handle<Code> GetCodeCopy(const Code::FindAndReplacePattern& pattern); 148 Handle<Code> GetCodeCopy(const Code::FindAndReplacePattern& pattern);
149 149
150 static Major MajorKeyFromKey(uint32_t key) { 150 static Major MajorKeyFromKey(uint32_t key) {
151 return static_cast<Major>(MajorKeyBits::decode(key)); 151 return static_cast<Major>(MajorKeyBits::decode(key));
152 } 152 }
153 static int MinorKeyFromKey(uint32_t key) { 153 static uint32_t MinorKeyFromKey(uint32_t key) {
154 return MinorKeyBits::decode(key); 154 return MinorKeyBits::decode(key);
155 } 155 }
156 156
157 // Gets the major key from a code object that is a code stub or binary op IC. 157 // Gets the major key from a code object that is a code stub or binary op IC.
158 static Major GetMajorKey(Code* code_stub) { 158 static Major GetMajorKey(Code* code_stub) {
159 return MajorKeyFromKey(code_stub->stub_key()); 159 return MajorKeyFromKey(code_stub->stub_key());
160 } 160 }
161 161
162 static uint32_t NoCacheKey() { return MajorKeyBits::encode(NoCache); } 162 static uint32_t NoCacheKey() { return MajorKeyBits::encode(NoCache); }
163 163
164 static const char* MajorName(Major major_key, bool allow_unknown_keys); 164 static const char* MajorName(Major major_key, bool allow_unknown_keys);
165 165
166 explicit CodeStub(Isolate* isolate) : isolate_(isolate) { } 166 explicit CodeStub(Isolate* isolate) : minor_key_(0), isolate_(isolate) {}
167 virtual ~CodeStub() {} 167 virtual ~CodeStub() {}
168 168
169 static void GenerateStubsAheadOfTime(Isolate* isolate); 169 static void GenerateStubsAheadOfTime(Isolate* isolate);
170 static void GenerateFPStubs(Isolate* isolate); 170 static void GenerateFPStubs(Isolate* isolate);
171 171
172 // Some stubs put untagged junk on the stack that cannot be scanned by the 172 // Some stubs put untagged junk on the stack that cannot be scanned by the
173 // GC. This means that we must be statically sure that no GC can occur while 173 // GC. This means that we must be statically sure that no GC can occur while
174 // they are running. If that is the case they should override this to return 174 // they are running. If that is the case they should override this to return
175 // true, which will cause an assertion if we try to call something that can 175 // true, which will cause an assertion if we try to call something that can
176 // GC or if we try to put a stack frame on top of the junk, which would not 176 // GC or if we try to put a stack frame on top of the junk, which would not
177 // result in a traversable stack. 177 // result in a traversable stack.
178 virtual bool SometimesSetsUpAFrame() { return true; } 178 virtual bool SometimesSetsUpAFrame() { return true; }
179 179
180 // Lookup the code in the (possibly custom) cache. 180 // Lookup the code in the (possibly custom) cache.
181 bool FindCodeInCache(Code** code_out); 181 bool FindCodeInCache(Code** code_out);
182 182
183 // Returns information for computing the number key. 183 // Returns information for computing the number key.
184 virtual Major MajorKey() const = 0; 184 virtual Major MajorKey() const = 0;
185 virtual int MinorKey() const = 0; 185 virtual uint32_t MinorKey() const { return minor_key_; }
186 186
187 virtual InlineCacheState GetICState() const { return UNINITIALIZED; } 187 virtual InlineCacheState GetICState() const { return UNINITIALIZED; }
188 virtual ExtraICState GetExtraICState() const { return kNoExtraICState; } 188 virtual ExtraICState GetExtraICState() const { return kNoExtraICState; }
189 virtual Code::StubType GetStubType() { 189 virtual Code::StubType GetStubType() {
190 return Code::NORMAL; 190 return Code::NORMAL;
191 } 191 }
192 192
193 friend OStream& operator<<(OStream& os, const CodeStub& s) { 193 friend OStream& operator<<(OStream& os, const CodeStub& s) {
194 s.PrintName(os); 194 s.PrintName(os);
195 return os; 195 return os;
(...skipping 12 matching lines...) Expand all
208 virtual void PrintName(OStream& os) const; // NOLINT 208 virtual void PrintName(OStream& os) const; // NOLINT
209 virtual void PrintBaseName(OStream& os) const; // NOLINT 209 virtual void PrintBaseName(OStream& os) const; // NOLINT
210 virtual void PrintState(OStream& os) const { ; } // NOLINT 210 virtual void PrintState(OStream& os) const { ; } // NOLINT
211 211
212 // Computes the key based on major and minor. 212 // Computes the key based on major and minor.
213 uint32_t GetKey() { 213 uint32_t GetKey() {
214 DCHECK(static_cast<int>(MajorKey()) < NUMBER_OF_IDS); 214 DCHECK(static_cast<int>(MajorKey()) < NUMBER_OF_IDS);
215 return MinorKeyBits::encode(MinorKey()) | MajorKeyBits::encode(MajorKey()); 215 return MinorKeyBits::encode(MinorKey()) | MajorKeyBits::encode(MajorKey());
216 } 216 }
217 217
218 uint32_t minor_key_;
219
218 private: 220 private:
219 // Perform bookkeeping required after code generation when stub code is 221 // Perform bookkeeping required after code generation when stub code is
220 // initially generated. 222 // initially generated.
221 void RecordCodeGeneration(Handle<Code> code); 223 void RecordCodeGeneration(Handle<Code> code);
222 224
223 // Finish the code object after it has been generated. 225 // Finish the code object after it has been generated.
224 virtual void FinishCode(Handle<Code> code) { } 226 virtual void FinishCode(Handle<Code> code) { }
225 227
226 // Activate newly generated stub. Is called after 228 // Activate newly generated stub. Is called after
227 // registering stub in the stub cache. 229 // registering stub in the stub cache.
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 Handle<Code> GenerateLightweightMissCode(); 471 Handle<Code> GenerateLightweightMissCode();
470 472
471 template<class StateType> 473 template<class StateType>
472 void TraceTransition(StateType from, StateType to); 474 void TraceTransition(StateType from, StateType to);
473 475
474 private: 476 private:
475 class MinorKeyBits: public BitField<int, 0, kStubMinorKeyBits - 1> {}; 477 class MinorKeyBits: public BitField<int, 0, kStubMinorKeyBits - 1> {};
476 class IsMissBits: public BitField<bool, kStubMinorKeyBits - 1, 1> {}; 478 class IsMissBits: public BitField<bool, kStubMinorKeyBits - 1, 1> {};
477 479
478 void GenerateLightweightMiss(MacroAssembler* masm); 480 void GenerateLightweightMiss(MacroAssembler* masm);
479 virtual int MinorKey() const { 481 virtual uint32_t MinorKey() const {
480 return IsMissBits::encode(is_uninitialized_) | 482 return IsMissBits::encode(is_uninitialized_) |
481 MinorKeyBits::encode(NotMissMinorKey()); 483 MinorKeyBits::encode(NotMissMinorKey());
482 } 484 }
483 485
484 bool is_uninitialized_; 486 bool is_uninitialized_;
485 }; 487 };
486 488
487 489
488 // Helper interface to prepare to/restore after making runtime calls. 490 // Helper interface to prepare to/restore after making runtime calls.
489 class RuntimeCallHelper { 491 class RuntimeCallHelper {
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 static Register left(); 748 static Register left();
747 static Register right(); 749 static Register right();
748 750
749 void Generate(MacroAssembler* masm); 751 void Generate(MacroAssembler* masm);
750 752
751 virtual void InitializeInterfaceDescriptor( 753 virtual void InitializeInterfaceDescriptor(
752 CodeStubInterfaceDescriptor* descriptor); 754 CodeStubInterfaceDescriptor* descriptor);
753 755
754 private: 756 private:
755 Major MajorKey() const { return Instanceof; } 757 Major MajorKey() const { return Instanceof; }
756 int MinorKey() const { return static_cast<int>(flags_); } 758 uint32_t MinorKey() const { return static_cast<int>(flags_); }
757 759
758 bool HasArgsInRegisters() const { 760 bool HasArgsInRegisters() const {
759 return (flags_ & kArgsInRegisters) != 0; 761 return (flags_ & kArgsInRegisters) != 0;
760 } 762 }
761 763
762 bool HasCallSiteInlineCheck() const { 764 bool HasCallSiteInlineCheck() const {
763 return (flags_ & kCallSiteInlineCheck) != 0; 765 return (flags_ & kCallSiteInlineCheck) != 0;
764 } 766 }
765 767
766 bool ReturnTrueFalseObject() const { 768 bool ReturnTrueFalseObject() const {
(...skipping 20 matching lines...) Expand all
787 explicit ArrayConstructorStub(Isolate* isolate); 789 explicit ArrayConstructorStub(Isolate* isolate);
788 790
789 void Generate(MacroAssembler* masm); 791 void Generate(MacroAssembler* masm);
790 792
791 private: 793 private:
792 void GenerateDispatchToArrayStub(MacroAssembler* masm, 794 void GenerateDispatchToArrayStub(MacroAssembler* masm,
793 AllocationSiteOverrideMode mode); 795 AllocationSiteOverrideMode mode);
794 virtual void PrintName(OStream& os) const V8_OVERRIDE; // NOLINT 796 virtual void PrintName(OStream& os) const V8_OVERRIDE; // NOLINT
795 797
796 virtual CodeStub::Major MajorKey() const { return ArrayConstructor; } 798 virtual CodeStub::Major MajorKey() const { return ArrayConstructor; }
797 virtual int MinorKey() const { return argument_count_; } 799 virtual uint32_t MinorKey() const { return argument_count_; }
798 800
799 ArgumentCountKey argument_count_; 801 ArgumentCountKey argument_count_;
800 }; 802 };
801 803
802 804
803 class InternalArrayConstructorStub: public PlatformCodeStub { 805 class InternalArrayConstructorStub: public PlatformCodeStub {
804 public: 806 public:
805 explicit InternalArrayConstructorStub(Isolate* isolate); 807 explicit InternalArrayConstructorStub(Isolate* isolate);
806 808
807 void Generate(MacroAssembler* masm); 809 void Generate(MacroAssembler* masm);
808 810
809 private: 811 private:
810 virtual CodeStub::Major MajorKey() const { return InternalArrayConstructor; } 812 virtual CodeStub::Major MajorKey() const { return InternalArrayConstructor; }
811 virtual int MinorKey() const { return 0; } 813 virtual uint32_t MinorKey() const { return 0; }
812 814
813 void GenerateCase(MacroAssembler* masm, ElementsKind kind); 815 void GenerateCase(MacroAssembler* masm, ElementsKind kind);
814 }; 816 };
815 817
816 818
817 class MathPowStub: public PlatformCodeStub { 819 class MathPowStub: public PlatformCodeStub {
818 public: 820 public:
819 enum ExponentType { INTEGER, DOUBLE, TAGGED, ON_STACK }; 821 enum ExponentType { INTEGER, DOUBLE, TAGGED, ON_STACK };
820 822
821 MathPowStub(Isolate* isolate, ExponentType exponent_type) 823 MathPowStub(Isolate* isolate, ExponentType exponent_type)
822 : PlatformCodeStub(isolate), exponent_type_(exponent_type) { } 824 : PlatformCodeStub(isolate), exponent_type_(exponent_type) { }
823 virtual void Generate(MacroAssembler* masm); 825 virtual void Generate(MacroAssembler* masm);
824 826
825 private: 827 private:
826 virtual CodeStub::Major MajorKey() const { return MathPow; } 828 virtual CodeStub::Major MajorKey() const { return MathPow; }
827 virtual int MinorKey() const { return exponent_type_; } 829 virtual uint32_t MinorKey() const { return exponent_type_; }
828 830
829 ExponentType exponent_type_; 831 ExponentType exponent_type_;
830 }; 832 };
831 833
832 834
833 class CallICStub: public PlatformCodeStub { 835 class CallICStub: public PlatformCodeStub {
834 public: 836 public:
835 CallICStub(Isolate* isolate, const CallIC::State& state) 837 CallICStub(Isolate* isolate, const CallIC::State& state)
836 : PlatformCodeStub(isolate), state_(state) {} 838 : PlatformCodeStub(isolate), state_(state) {}
837 839
(...skipping 12 matching lines...) Expand all
850 return Code::CALL_IC; 852 return Code::CALL_IC;
851 } 853 }
852 854
853 virtual InlineCacheState GetICState() const V8_OVERRIDE { return DEFAULT; } 855 virtual InlineCacheState GetICState() const V8_OVERRIDE { return DEFAULT; }
854 856
855 virtual ExtraICState GetExtraICState() const V8_FINAL V8_OVERRIDE { 857 virtual ExtraICState GetExtraICState() const V8_FINAL V8_OVERRIDE {
856 return state_.GetExtraICState(); 858 return state_.GetExtraICState();
857 } 859 }
858 860
859 protected: 861 protected:
860 virtual int MinorKey() const { return GetExtraICState(); } 862 virtual uint32_t MinorKey() const { return GetExtraICState(); }
861 virtual void PrintState(OStream& os) const V8_OVERRIDE; // NOLINT 863 virtual void PrintState(OStream& os) const V8_OVERRIDE; // NOLINT
862 864
863 virtual CodeStub::Major MajorKey() const { return CallIC; } 865 virtual CodeStub::Major MajorKey() const { return CallIC; }
864 866
865 // Code generation helpers. 867 // Code generation helpers.
866 void GenerateMiss(MacroAssembler* masm, IC::UtilityId id); 868 void GenerateMiss(MacroAssembler* masm, IC::UtilityId id);
867 869
868 const CallIC::State state_; 870 const CallIC::State state_;
869 }; 871 };
870 872
(...skipping 19 matching lines...) Expand all
890 // TODO(verwaest): Translate to hydrogen code stub. 892 // TODO(verwaest): Translate to hydrogen code stub.
891 class FunctionPrototypeStub : public PlatformCodeStub { 893 class FunctionPrototypeStub : public PlatformCodeStub {
892 public: 894 public:
893 explicit FunctionPrototypeStub(Isolate* isolate) 895 explicit FunctionPrototypeStub(Isolate* isolate)
894 : PlatformCodeStub(isolate) {} 896 : PlatformCodeStub(isolate) {}
895 virtual void Generate(MacroAssembler* masm); 897 virtual void Generate(MacroAssembler* masm);
896 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; } 898 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; }
897 899
898 private: 900 private:
899 virtual CodeStub::Major MajorKey() const { return FunctionPrototype; } 901 virtual CodeStub::Major MajorKey() const { return FunctionPrototype; }
900 virtual int MinorKey() const { return 0; } 902 virtual uint32_t MinorKey() const { return 0; }
901 }; 903 };
902 904
903 905
904 class HandlerStub : public HydrogenCodeStub { 906 class HandlerStub : public HydrogenCodeStub {
905 public: 907 public:
906 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; } 908 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; }
907 virtual ExtraICState GetExtraICState() const { return kind(); } 909 virtual ExtraICState GetExtraICState() const { return kind(); }
908 virtual InlineCacheState GetICState() const { return MONOMORPHIC; } 910 virtual InlineCacheState GetICState() const { return MONOMORPHIC; }
909 911
910 virtual void InitializeInterfaceDescriptor( 912 virtual void InitializeInterfaceDescriptor(
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 bit_field_ = 1078 bit_field_ =
1077 IsStoreBits::encode(is_store) | 1079 IsStoreBits::encode(is_store) |
1078 CallDataUndefinedBits::encode(call_data_undefined) | 1080 CallDataUndefinedBits::encode(call_data_undefined) |
1079 ArgumentBits::encode(argc); 1081 ArgumentBits::encode(argc);
1080 DCHECK(!is_store || argc == 1); 1082 DCHECK(!is_store || argc == 1);
1081 } 1083 }
1082 1084
1083 private: 1085 private:
1084 virtual void Generate(MacroAssembler* masm) V8_OVERRIDE; 1086 virtual void Generate(MacroAssembler* masm) V8_OVERRIDE;
1085 virtual Major MajorKey() const V8_OVERRIDE { return CallApiFunction; } 1087 virtual Major MajorKey() const V8_OVERRIDE { return CallApiFunction; }
1086 virtual int MinorKey() const V8_OVERRIDE { return bit_field_; } 1088 virtual uint32_t MinorKey() const V8_OVERRIDE { return bit_field_; }
1087 1089
1088 class IsStoreBits: public BitField<bool, 0, 1> {}; 1090 class IsStoreBits: public BitField<bool, 0, 1> {};
1089 class CallDataUndefinedBits: public BitField<bool, 1, 1> {}; 1091 class CallDataUndefinedBits: public BitField<bool, 1, 1> {};
1090 class ArgumentBits: public BitField<int, 2, Code::kArgumentsBits> {}; 1092 class ArgumentBits: public BitField<int, 2, Code::kArgumentsBits> {};
1091 1093
1092 int bit_field_; 1094 int bit_field_;
1093 1095
1094 DISALLOW_COPY_AND_ASSIGN(CallApiFunctionStub); 1096 DISALLOW_COPY_AND_ASSIGN(CallApiFunctionStub);
1095 }; 1097 };
1096 1098
1097 1099
1098 class CallApiGetterStub : public PlatformCodeStub { 1100 class CallApiGetterStub : public PlatformCodeStub {
1099 public: 1101 public:
1100 explicit CallApiGetterStub(Isolate* isolate) : PlatformCodeStub(isolate) {} 1102 explicit CallApiGetterStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
1101 1103
1102 private: 1104 private:
1103 virtual void Generate(MacroAssembler* masm) V8_OVERRIDE; 1105 virtual void Generate(MacroAssembler* masm) V8_OVERRIDE;
1104 virtual Major MajorKey() const V8_OVERRIDE { return CallApiGetter; } 1106 virtual Major MajorKey() const V8_OVERRIDE { return CallApiGetter; }
1105 virtual int MinorKey() const V8_OVERRIDE { return 0; } 1107 virtual uint32_t MinorKey() const V8_OVERRIDE { return 0; }
1106 1108
1107 DISALLOW_COPY_AND_ASSIGN(CallApiGetterStub); 1109 DISALLOW_COPY_AND_ASSIGN(CallApiGetterStub);
1108 }; 1110 };
1109 1111
1110 1112
1111 class BinaryOpICStub : public HydrogenCodeStub { 1113 class BinaryOpICStub : public HydrogenCodeStub {
1112 public: 1114 public:
1113 BinaryOpICStub(Isolate* isolate, Token::Value op, 1115 BinaryOpICStub(Isolate* isolate, Token::Value op,
1114 OverwriteMode mode = NO_OVERWRITE) 1116 OverwriteMode mode = NO_OVERWRITE)
1115 : HydrogenCodeStub(isolate, UNINITIALIZED), state_(isolate, op, mode) {} 1117 : HydrogenCodeStub(isolate, UNINITIALIZED), state_(isolate, op, mode) {}
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 return state_.GetExtraICState(); 1191 return state_.GetExtraICState();
1190 } 1192 }
1191 1193
1192 virtual void Generate(MacroAssembler* masm) V8_OVERRIDE; 1194 virtual void Generate(MacroAssembler* masm) V8_OVERRIDE;
1193 1195
1194 virtual void PrintState(OStream& os) const V8_OVERRIDE; // NOLINT 1196 virtual void PrintState(OStream& os) const V8_OVERRIDE; // NOLINT
1195 1197
1196 virtual Major MajorKey() const V8_OVERRIDE { 1198 virtual Major MajorKey() const V8_OVERRIDE {
1197 return BinaryOpICWithAllocationSite; 1199 return BinaryOpICWithAllocationSite;
1198 } 1200 }
1199 virtual int MinorKey() const V8_OVERRIDE { return GetExtraICState(); } 1201 virtual uint32_t MinorKey() const V8_OVERRIDE { return GetExtraICState(); }
1200 1202
1201 private: 1203 private:
1202 static void GenerateAheadOfTime(Isolate* isolate, 1204 static void GenerateAheadOfTime(Isolate* isolate,
1203 const BinaryOpIC::State& state); 1205 const BinaryOpIC::State& state);
1204 1206
1205 BinaryOpIC::State state_; 1207 BinaryOpIC::State state_;
1206 1208
1207 DISALLOW_COPY_AND_ASSIGN(BinaryOpICWithAllocationSiteStub); 1209 DISALLOW_COPY_AND_ASSIGN(BinaryOpICWithAllocationSiteStub);
1208 }; 1210 };
1209 1211
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1320 1322
1321 virtual InlineCacheState GetICState() const; 1323 virtual InlineCacheState GetICState() const;
1322 1324
1323 private: 1325 private:
1324 class OpField: public BitField<int, 0, 3> { }; 1326 class OpField: public BitField<int, 0, 3> { };
1325 class LeftStateField: public BitField<int, 3, 4> { }; 1327 class LeftStateField: public BitField<int, 3, 4> { };
1326 class RightStateField: public BitField<int, 7, 4> { }; 1328 class RightStateField: public BitField<int, 7, 4> { };
1327 class HandlerStateField: public BitField<int, 11, 4> { }; 1329 class HandlerStateField: public BitField<int, 11, 4> { };
1328 1330
1329 virtual CodeStub::Major MajorKey() const { return CompareIC; } 1331 virtual CodeStub::Major MajorKey() const { return CompareIC; }
1330 virtual int MinorKey() const; 1332 virtual uint32_t MinorKey() const;
1331 1333
1332 virtual Code::Kind GetCodeKind() const { return Code::COMPARE_IC; } 1334 virtual Code::Kind GetCodeKind() const { return Code::COMPARE_IC; }
1333 1335
1334 void GenerateSmis(MacroAssembler* masm); 1336 void GenerateSmis(MacroAssembler* masm);
1335 void GenerateNumbers(MacroAssembler* masm); 1337 void GenerateNumbers(MacroAssembler* masm);
1336 void GenerateInternalizedStrings(MacroAssembler* masm); 1338 void GenerateInternalizedStrings(MacroAssembler* masm);
1337 void GenerateStrings(MacroAssembler* masm); 1339 void GenerateStrings(MacroAssembler* masm);
1338 void GenerateUniqueNames(MacroAssembler* masm); 1340 void GenerateUniqueNames(MacroAssembler* masm);
1339 void GenerateObjects(MacroAssembler* masm); 1341 void GenerateObjects(MacroAssembler* masm);
1340 void GenerateMiss(MacroAssembler* masm); 1342 void GenerateMiss(MacroAssembler* masm);
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1453 1455
1454 DISALLOW_COPY_AND_ASSIGN(CompareNilICStub); 1456 DISALLOW_COPY_AND_ASSIGN(CompareNilICStub);
1455 }; 1457 };
1456 1458
1457 1459
1458 OStream& operator<<(OStream& os, const CompareNilICStub::State& s); 1460 OStream& operator<<(OStream& os, const CompareNilICStub::State& s);
1459 1461
1460 1462
1461 class CEntryStub : public PlatformCodeStub { 1463 class CEntryStub : public PlatformCodeStub {
1462 public: 1464 public:
1463 CEntryStub(Isolate* isolate, 1465 CEntryStub(Isolate* isolate, int result_size,
1464 int result_size,
1465 SaveFPRegsMode save_doubles = kDontSaveFPRegs) 1466 SaveFPRegsMode save_doubles = kDontSaveFPRegs)
1466 : PlatformCodeStub(isolate), 1467 : PlatformCodeStub(isolate) {
1467 result_size_(result_size), 1468 minor_key_ = SaveDoublesBits::encode(save_doubles == kSaveFPRegs);
1468 save_doubles_(save_doubles) { } 1469 DCHECK(result_size == 1 || result_size == 2);
1470 #ifdef _WIN64
1471 minor_key_ = ResultSizeBits::update(minor_key_, result_size);
1472 #endif // _WIN64
1473 }
1469 1474
1470 void Generate(MacroAssembler* masm); 1475 void Generate(MacroAssembler* masm);
1476 bool save_doubles() const { return SaveDoublesBits::decode(minor_key_); }
1477 #ifdef _WIN64
1478 int result_size() const { ResultSizeBits::decode(minor_key_); }
1479 #endif // _WIN64
1480
1471 1481
1472 // The version of this stub that doesn't save doubles is generated ahead of 1482 // The version of this stub that doesn't save doubles is generated ahead of
1473 // time, so it's OK to call it from other stubs that can't cope with GC during 1483 // time, so it's OK to call it from other stubs that can't cope with GC during
1474 // their code generation. On machines that always have gp registers (x64) we 1484 // their code generation. On machines that always have gp registers (x64) we
1475 // can generate both variants ahead of time. 1485 // can generate both variants ahead of time.
1476 static void GenerateAheadOfTime(Isolate* isolate); 1486 static void GenerateAheadOfTime(Isolate* isolate);
1477 1487
1478 private: 1488 private:
1479 // Number of pointers/values returned.
1480 const int result_size_;
1481 SaveFPRegsMode save_doubles_;
1482
1483 Major MajorKey() const { return CEntry; } 1489 Major MajorKey() const { return CEntry; }
1484 int MinorKey() const;
1485 1490
1486 bool NeedsImmovableCode(); 1491 bool NeedsImmovableCode();
1492
1493 class SaveDoublesBits : public BitField<bool, 0, 1> {};
1494 class ResultSizeBits : public BitField<int, 3, 1> {};
1487 }; 1495 };
1488 1496
1489 1497
1490 class JSEntryStub : public PlatformCodeStub { 1498 class JSEntryStub : public PlatformCodeStub {
1491 public: 1499 public:
1492 explicit JSEntryStub(Isolate* isolate) : PlatformCodeStub(isolate) { } 1500 explicit JSEntryStub(Isolate* isolate) : PlatformCodeStub(isolate) { }
1493 1501
1494 void Generate(MacroAssembler* masm) { GenerateBody(masm, false); } 1502 void Generate(MacroAssembler* masm) { GenerateBody(masm, false); }
1495 1503
1496 protected: 1504 protected:
1497 void GenerateBody(MacroAssembler* masm, bool is_construct); 1505 void GenerateBody(MacroAssembler* masm, bool is_construct);
1498 1506
1499 private: 1507 private:
1500 Major MajorKey() const { return JSEntry; } 1508 Major MajorKey() const { return JSEntry; }
1501 int MinorKey() const { return 0; } 1509 uint32_t MinorKey() const { return 0; }
1502 1510
1503 virtual void FinishCode(Handle<Code> code); 1511 virtual void FinishCode(Handle<Code> code);
1504 1512
1505 int handler_offset_; 1513 int handler_offset_;
1506 }; 1514 };
1507 1515
1508 1516
1509 class JSConstructEntryStub : public JSEntryStub { 1517 class JSConstructEntryStub : public JSEntryStub {
1510 public: 1518 public:
1511 explicit JSConstructEntryStub(Isolate* isolate) : JSEntryStub(isolate) { } 1519 explicit JSConstructEntryStub(Isolate* isolate) : JSEntryStub(isolate) { }
1512 1520
1513 void Generate(MacroAssembler* masm) { GenerateBody(masm, true); } 1521 void Generate(MacroAssembler* masm) { GenerateBody(masm, true); }
1514 1522
1515 private: 1523 private:
1516 int MinorKey() const { return 1; } 1524 uint32_t MinorKey() const { return 1; }
1517 1525
1518 virtual void PrintName(OStream& os) const V8_OVERRIDE { // NOLINT 1526 virtual void PrintName(OStream& os) const V8_OVERRIDE { // NOLINT
1519 os << "JSConstructEntryStub"; 1527 os << "JSConstructEntryStub";
1520 } 1528 }
1521 }; 1529 };
1522 1530
1523 1531
1524 class ArgumentsAccessStub: public PlatformCodeStub { 1532 class ArgumentsAccessStub: public PlatformCodeStub {
1525 public: 1533 public:
1526 enum Type { 1534 enum Type {
1527 READ_ELEMENT, 1535 READ_ELEMENT,
1528 NEW_SLOPPY_FAST, 1536 NEW_SLOPPY_FAST,
1529 NEW_SLOPPY_SLOW, 1537 NEW_SLOPPY_SLOW,
1530 NEW_STRICT 1538 NEW_STRICT
1531 }; 1539 };
1532 1540
1533 ArgumentsAccessStub(Isolate* isolate, Type type) 1541 ArgumentsAccessStub(Isolate* isolate, Type type)
1534 : PlatformCodeStub(isolate), type_(type) { } 1542 : PlatformCodeStub(isolate), type_(type) { }
1535 1543
1536 private: 1544 private:
1537 Type type_; 1545 Type type_;
1538 1546
1539 Major MajorKey() const { return ArgumentsAccess; } 1547 Major MajorKey() const { return ArgumentsAccess; }
1540 int MinorKey() const { return type_; } 1548 uint32_t MinorKey() const { return type_; }
1541 1549
1542 void Generate(MacroAssembler* masm); 1550 void Generate(MacroAssembler* masm);
1543 void GenerateReadElement(MacroAssembler* masm); 1551 void GenerateReadElement(MacroAssembler* masm);
1544 void GenerateNewStrict(MacroAssembler* masm); 1552 void GenerateNewStrict(MacroAssembler* masm);
1545 void GenerateNewSloppyFast(MacroAssembler* masm); 1553 void GenerateNewSloppyFast(MacroAssembler* masm);
1546 void GenerateNewSloppySlow(MacroAssembler* masm); 1554 void GenerateNewSloppySlow(MacroAssembler* masm);
1547 1555
1548 virtual void PrintName(OStream& os) const V8_OVERRIDE; // NOLINT 1556 virtual void PrintName(OStream& os) const V8_OVERRIDE; // NOLINT
1549 }; 1557 };
1550 1558
1551 1559
1552 class RegExpExecStub: public PlatformCodeStub { 1560 class RegExpExecStub: public PlatformCodeStub {
1553 public: 1561 public:
1554 explicit RegExpExecStub(Isolate* isolate) : PlatformCodeStub(isolate) { } 1562 explicit RegExpExecStub(Isolate* isolate) : PlatformCodeStub(isolate) { }
1555 1563
1556 private: 1564 private:
1557 Major MajorKey() const { return RegExpExec; } 1565 Major MajorKey() const { return RegExpExec; }
1558 int MinorKey() const { return 0; } 1566 uint32_t MinorKey() const { return 0; }
1559 1567
1560 void Generate(MacroAssembler* masm); 1568 void Generate(MacroAssembler* masm);
1561 }; 1569 };
1562 1570
1563 1571
1564 class RegExpConstructResultStub V8_FINAL : public HydrogenCodeStub { 1572 class RegExpConstructResultStub V8_FINAL : public HydrogenCodeStub {
1565 public: 1573 public:
1566 explicit RegExpConstructResultStub(Isolate* isolate) 1574 explicit RegExpConstructResultStub(Isolate* isolate)
1567 : HydrogenCodeStub(isolate) { } 1575 : HydrogenCodeStub(isolate) { }
1568 1576
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1608 1616
1609 virtual void PrintName(OStream& os) const V8_OVERRIDE; // NOLINT 1617 virtual void PrintName(OStream& os) const V8_OVERRIDE; // NOLINT
1610 1618
1611 // Minor key encoding in 32 bits with Bitfield <Type, shift, size>. 1619 // Minor key encoding in 32 bits with Bitfield <Type, shift, size>.
1612 class FlagBits: public BitField<CallFunctionFlags, 0, 2> {}; 1620 class FlagBits: public BitField<CallFunctionFlags, 0, 2> {};
1613 class ArgcBits : public BitField<unsigned, 2, Code::kArgumentsBits> {}; 1621 class ArgcBits : public BitField<unsigned, 2, Code::kArgumentsBits> {};
1614 1622
1615 STATIC_ASSERT(Code::kArgumentsBits + 2 <= kStubMinorKeyBits); 1623 STATIC_ASSERT(Code::kArgumentsBits + 2 <= kStubMinorKeyBits);
1616 1624
1617 Major MajorKey() const { return CallFunction; } 1625 Major MajorKey() const { return CallFunction; }
1618 int MinorKey() const { 1626 uint32_t MinorKey() const {
1619 // Encode the parameters in a unique 32 bit value. 1627 // Encode the parameters in a unique 32 bit value.
1620 return FlagBits::encode(flags_) | ArgcBits::encode(argc_); 1628 return FlagBits::encode(flags_) | ArgcBits::encode(argc_);
1621 } 1629 }
1622 1630
1623 bool CallAsMethod() { 1631 bool CallAsMethod() {
1624 return flags_ == CALL_AS_METHOD || flags_ == WRAP_AND_CALL; 1632 return flags_ == CALL_AS_METHOD || flags_ == WRAP_AND_CALL;
1625 } 1633 }
1626 1634
1627 bool NeedsChecks() { 1635 bool NeedsChecks() {
1628 return flags_ != WRAP_AND_CALL; 1636 return flags_ != WRAP_AND_CALL;
(...skipping 14 matching lines...) Expand all
1643 1651
1644 virtual void InitializeInterfaceDescriptor( 1652 virtual void InitializeInterfaceDescriptor(
1645 CodeStubInterfaceDescriptor* descriptor); 1653 CodeStubInterfaceDescriptor* descriptor);
1646 1654
1647 private: 1655 private:
1648 CallConstructorFlags flags_; 1656 CallConstructorFlags flags_;
1649 1657
1650 virtual void PrintName(OStream& os) const V8_OVERRIDE; // NOLINT 1658 virtual void PrintName(OStream& os) const V8_OVERRIDE; // NOLINT
1651 1659
1652 Major MajorKey() const { return CallConstruct; } 1660 Major MajorKey() const { return CallConstruct; }
1653 int MinorKey() const { return flags_; } 1661 uint32_t MinorKey() const { return flags_; }
1654 1662
1655 bool RecordCallTarget() const { 1663 bool RecordCallTarget() const {
1656 return (flags_ & RECORD_CONSTRUCTOR_TARGET) != 0; 1664 return (flags_ & RECORD_CONSTRUCTOR_TARGET) != 0;
1657 } 1665 }
1658 }; 1666 };
1659 1667
1660 1668
1661 enum StringIndexFlags { 1669 enum StringIndexFlags {
1662 // Accepts smis or heap numbers. 1670 // Accepts smis or heap numbers.
1663 STRING_INDEX_IS_NUMBER, 1671 STRING_INDEX_IS_NUMBER,
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1852 1860
1853 class LoadDictionaryElementPlatformStub : public PlatformCodeStub { 1861 class LoadDictionaryElementPlatformStub : public PlatformCodeStub {
1854 public: 1862 public:
1855 explicit LoadDictionaryElementPlatformStub(Isolate* isolate) 1863 explicit LoadDictionaryElementPlatformStub(Isolate* isolate)
1856 : PlatformCodeStub(isolate) {} 1864 : PlatformCodeStub(isolate) {}
1857 1865
1858 void Generate(MacroAssembler* masm); 1866 void Generate(MacroAssembler* masm);
1859 1867
1860 private: 1868 private:
1861 Major MajorKey() const { return LoadElement; } 1869 Major MajorKey() const { return LoadElement; }
1862 int MinorKey() const { return DICTIONARY_ELEMENTS; } 1870 uint32_t MinorKey() const { return DICTIONARY_ELEMENTS; }
1863 1871
1864 DISALLOW_COPY_AND_ASSIGN(LoadDictionaryElementPlatformStub); 1872 DISALLOW_COPY_AND_ASSIGN(LoadDictionaryElementPlatformStub);
1865 }; 1873 };
1866 1874
1867 1875
1868 class KeyedLoadGenericStub : public HydrogenCodeStub { 1876 class KeyedLoadGenericStub : public HydrogenCodeStub {
1869 public: 1877 public:
1870 explicit KeyedLoadGenericStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} 1878 explicit KeyedLoadGenericStub(Isolate* isolate) : HydrogenCodeStub(isolate) {}
1871 1879
1872 virtual Handle<Code> GenerateCode() V8_OVERRIDE; 1880 virtual Handle<Code> GenerateCode() V8_OVERRIDE;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1939 class IsTruncatingBits: 1947 class IsTruncatingBits:
1940 public BitField<bool, 2 * kBitsPerRegisterNumber, 1> {}; // NOLINT 1948 public BitField<bool, 2 * kBitsPerRegisterNumber, 1> {}; // NOLINT
1941 class OffsetBits: 1949 class OffsetBits:
1942 public BitField<int, 2 * kBitsPerRegisterNumber + 1, 3> {}; // NOLINT 1950 public BitField<int, 2 * kBitsPerRegisterNumber + 1, 3> {}; // NOLINT
1943 class SkipFastPathBits: 1951 class SkipFastPathBits:
1944 public BitField<int, 2 * kBitsPerRegisterNumber + 4, 1> {}; // NOLINT 1952 public BitField<int, 2 * kBitsPerRegisterNumber + 4, 1> {}; // NOLINT
1945 class SSE3Bits: 1953 class SSE3Bits:
1946 public BitField<int, 2 * kBitsPerRegisterNumber + 5, 1> {}; // NOLINT 1954 public BitField<int, 2 * kBitsPerRegisterNumber + 5, 1> {}; // NOLINT
1947 1955
1948 Major MajorKey() const { return DoubleToI; } 1956 Major MajorKey() const { return DoubleToI; }
1949 int MinorKey() const { return bit_field_; } 1957 uint32_t MinorKey() const { return bit_field_; }
1950 1958
1951 int bit_field_; 1959 int bit_field_;
1952 1960
1953 DISALLOW_COPY_AND_ASSIGN(DoubleToIStub); 1961 DISALLOW_COPY_AND_ASSIGN(DoubleToIStub);
1954 }; 1962 };
1955 1963
1956 1964
1957 class LoadFastElementStub : public HydrogenCodeStub { 1965 class LoadFastElementStub : public HydrogenCodeStub {
1958 public: 1966 public:
1959 LoadFastElementStub(Isolate* isolate, bool is_js_array, 1967 LoadFastElementStub(Isolate* isolate, bool is_js_array,
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
2275 class StoreElementStub : public PlatformCodeStub { 2283 class StoreElementStub : public PlatformCodeStub {
2276 public: 2284 public:
2277 StoreElementStub(Isolate* isolate, bool is_js_array, 2285 StoreElementStub(Isolate* isolate, bool is_js_array,
2278 ElementsKind elements_kind, KeyedAccessStoreMode store_mode) 2286 ElementsKind elements_kind, KeyedAccessStoreMode store_mode)
2279 : PlatformCodeStub(isolate), 2287 : PlatformCodeStub(isolate),
2280 is_js_array_(is_js_array), 2288 is_js_array_(is_js_array),
2281 elements_kind_(elements_kind), 2289 elements_kind_(elements_kind),
2282 store_mode_(store_mode) {} 2290 store_mode_(store_mode) {}
2283 2291
2284 Major MajorKey() const { return StoreElement; } 2292 Major MajorKey() const { return StoreElement; }
2285 int MinorKey() const { 2293 uint32_t MinorKey() const {
2286 return ElementsKindBits::encode(elements_kind_) | 2294 return ElementsKindBits::encode(elements_kind_) |
2287 IsJSArrayBits::encode(is_js_array_) | 2295 IsJSArrayBits::encode(is_js_array_) |
2288 StoreModeBits::encode(store_mode_); 2296 StoreModeBits::encode(store_mode_);
2289 } 2297 }
2290 2298
2291 void Generate(MacroAssembler* masm); 2299 void Generate(MacroAssembler* masm);
2292 2300
2293 private: 2301 private:
2294 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; 2302 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {};
2295 class StoreModeBits: public BitField<KeyedAccessStoreMode, 8, 4> {}; 2303 class StoreModeBits: public BitField<KeyedAccessStoreMode, 8, 4> {};
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
2465 }; 2473 };
2466 2474
2467 2475
2468 class StoreArrayLiteralElementStub : public PlatformCodeStub { 2476 class StoreArrayLiteralElementStub : public PlatformCodeStub {
2469 public: 2477 public:
2470 explicit StoreArrayLiteralElementStub(Isolate* isolate) 2478 explicit StoreArrayLiteralElementStub(Isolate* isolate)
2471 : PlatformCodeStub(isolate) { } 2479 : PlatformCodeStub(isolate) { }
2472 2480
2473 private: 2481 private:
2474 Major MajorKey() const { return StoreArrayLiteralElement; } 2482 Major MajorKey() const { return StoreArrayLiteralElement; }
2475 int MinorKey() const { return 0; } 2483 uint32_t MinorKey() const { return 0; }
2476 2484
2477 void Generate(MacroAssembler* masm); 2485 void Generate(MacroAssembler* masm);
2478 2486
2479 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); 2487 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub);
2480 }; 2488 };
2481 2489
2482 2490
2483 class StubFailureTrampolineStub : public PlatformCodeStub { 2491 class StubFailureTrampolineStub : public PlatformCodeStub {
2484 public: 2492 public:
2485 StubFailureTrampolineStub(Isolate* isolate, StubFunctionMode function_mode) 2493 StubFailureTrampolineStub(Isolate* isolate, StubFunctionMode function_mode)
2486 : PlatformCodeStub(isolate), 2494 : PlatformCodeStub(isolate),
2487 function_mode_(function_mode) {} 2495 function_mode_(function_mode) {}
2488 2496
2489 static void GenerateAheadOfTime(Isolate* isolate); 2497 static void GenerateAheadOfTime(Isolate* isolate);
2490 2498
2491 private: 2499 private:
2492 class FunctionModeField: public BitField<StubFunctionMode, 0, 1> {}; 2500 class FunctionModeField: public BitField<StubFunctionMode, 0, 1> {};
2493 2501
2494 Major MajorKey() const { return StubFailureTrampoline; } 2502 Major MajorKey() const { return StubFailureTrampoline; }
2495 int MinorKey() const { return FunctionModeField::encode(function_mode_); } 2503 uint32_t MinorKey() const {
2504 return FunctionModeField::encode(function_mode_);
2505 }
2496 2506
2497 void Generate(MacroAssembler* masm); 2507 void Generate(MacroAssembler* masm);
2498 2508
2499 StubFunctionMode function_mode_; 2509 StubFunctionMode function_mode_;
2500 2510
2501 DISALLOW_COPY_AND_ASSIGN(StubFailureTrampolineStub); 2511 DISALLOW_COPY_AND_ASSIGN(StubFailureTrampolineStub);
2502 }; 2512 };
2503 2513
2504 2514
2505 class ProfileEntryHookStub : public PlatformCodeStub { 2515 class ProfileEntryHookStub : public PlatformCodeStub {
2506 public: 2516 public:
2507 explicit ProfileEntryHookStub(Isolate* isolate) : PlatformCodeStub(isolate) {} 2517 explicit ProfileEntryHookStub(Isolate* isolate) : PlatformCodeStub(isolate) {}
2508 2518
2509 // The profile entry hook function is not allowed to cause a GC. 2519 // The profile entry hook function is not allowed to cause a GC.
2510 virtual bool SometimesSetsUpAFrame() { return false; } 2520 virtual bool SometimesSetsUpAFrame() { return false; }
2511 2521
2512 // Generates a call to the entry hook if it's enabled. 2522 // Generates a call to the entry hook if it's enabled.
2513 static void MaybeCallEntryHook(MacroAssembler* masm); 2523 static void MaybeCallEntryHook(MacroAssembler* masm);
2514 2524
2515 private: 2525 private:
2516 static void EntryHookTrampoline(intptr_t function, 2526 static void EntryHookTrampoline(intptr_t function,
2517 intptr_t stack_pointer, 2527 intptr_t stack_pointer,
2518 Isolate* isolate); 2528 Isolate* isolate);
2519 2529
2520 Major MajorKey() const { return ProfileEntryHook; } 2530 Major MajorKey() const { return ProfileEntryHook; }
2521 int MinorKey() const { return 0; } 2531 uint32_t MinorKey() const { return 0; }
2522 2532
2523 void Generate(MacroAssembler* masm); 2533 void Generate(MacroAssembler* masm);
2524 2534
2525 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); 2535 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub);
2526 }; 2536 };
2527 2537
2528 2538
2529 class CallDescriptors { 2539 class CallDescriptors {
2530 public: 2540 public:
2531 static void InitializeForIsolate(Isolate* isolate); 2541 static void InitializeForIsolate(Isolate* isolate);
2532 }; 2542 };
2533 2543
2534 } } // namespace v8::internal 2544 } } // namespace v8::internal
2535 2545
2536 #endif // V8_CODE_STUBS_H_ 2546 #endif // V8_CODE_STUBS_H_
OLDNEW
« no previous file with comments | « src/arm64/code-stubs-arm64.cc ('k') | src/code-stubs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698