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

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

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