OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_CODE_STUBS_H_ | 5 #ifndef V8_CODE_STUBS_H_ |
6 #define V8_CODE_STUBS_H_ | 6 #define V8_CODE_STUBS_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/assembler.h" | 9 #include "src/assembler.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
11 #include "src/globals.h" | 11 #include "src/globals.h" |
12 #include "src/ic/ic.h" | 12 #include "src/ic/ic-state.h" |
13 #include "src/interface-descriptors.h" | 13 #include "src/interface-descriptors.h" |
14 #include "src/macro-assembler.h" | 14 #include "src/macro-assembler.h" |
15 #include "src/ostreams.h" | 15 #include "src/ostreams.h" |
16 | 16 |
17 namespace v8 { | 17 namespace v8 { |
18 namespace internal { | 18 namespace internal { |
19 | 19 |
20 // List of code stubs used on all platforms. | 20 // List of code stubs used on all platforms. |
21 #define CODE_STUB_LIST_ALL_PLATFORMS(V) \ | 21 #define CODE_STUB_LIST_ALL_PLATFORMS(V) \ |
22 /* PlatformCodeStubs */ \ | 22 /* PlatformCodeStubs */ \ |
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 } | 774 } |
775 | 775 |
776 class ExponentTypeBits : public BitField<ExponentType, 0, 2> {}; | 776 class ExponentTypeBits : public BitField<ExponentType, 0, 2> {}; |
777 | 777 |
778 DEFINE_PLATFORM_CODE_STUB(MathPow, PlatformCodeStub); | 778 DEFINE_PLATFORM_CODE_STUB(MathPow, PlatformCodeStub); |
779 }; | 779 }; |
780 | 780 |
781 | 781 |
782 class CallICStub: public PlatformCodeStub { | 782 class CallICStub: public PlatformCodeStub { |
783 public: | 783 public: |
784 CallICStub(Isolate* isolate, const CallIC::State& state) | 784 CallICStub(Isolate* isolate, const CallICState& state) |
785 : PlatformCodeStub(isolate) { | 785 : PlatformCodeStub(isolate) { |
786 minor_key_ = state.GetExtraICState(); | 786 minor_key_ = state.GetExtraICState(); |
787 } | 787 } |
788 | 788 |
789 static int ExtractArgcFromMinorKey(int minor_key) { | 789 static int ExtractArgcFromMinorKey(int minor_key) { |
790 CallIC::State state(static_cast<ExtraICState>(minor_key)); | 790 CallICState state(static_cast<ExtraICState>(minor_key)); |
791 return state.arg_count(); | 791 return state.arg_count(); |
792 } | 792 } |
793 | 793 |
794 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::CALL_IC; } | 794 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::CALL_IC; } |
795 | 795 |
796 virtual InlineCacheState GetICState() const OVERRIDE { return DEFAULT; } | 796 virtual InlineCacheState GetICState() const OVERRIDE { return DEFAULT; } |
797 | 797 |
798 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE { | 798 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE { |
799 return static_cast<ExtraICState>(minor_key_); | 799 return static_cast<ExtraICState>(minor_key_); |
800 } | 800 } |
801 | 801 |
802 protected: | 802 protected: |
803 bool CallAsMethod() const { return state().call_type() == CallIC::METHOD; } | 803 bool CallAsMethod() const { |
| 804 return state().call_type() == CallICState::METHOD; |
| 805 } |
804 | 806 |
805 int arg_count() const { return state().arg_count(); } | 807 int arg_count() const { return state().arg_count(); } |
806 | 808 |
807 CallIC::State state() const { | 809 CallICState state() const { |
808 return CallIC::State(static_cast<ExtraICState>(minor_key_)); | 810 return CallICState(static_cast<ExtraICState>(minor_key_)); |
809 } | 811 } |
810 | 812 |
811 // Code generation helpers. | 813 // Code generation helpers. |
812 void GenerateMiss(MacroAssembler* masm, IC::UtilityId id); | 814 void GenerateMiss(MacroAssembler* masm); |
813 | 815 |
814 private: | 816 private: |
815 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT | 817 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT |
816 | 818 |
817 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunctionWithFeedback); | 819 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunctionWithFeedback); |
818 DEFINE_PLATFORM_CODE_STUB(CallIC, PlatformCodeStub); | 820 DEFINE_PLATFORM_CODE_STUB(CallIC, PlatformCodeStub); |
819 }; | 821 }; |
820 | 822 |
821 | 823 |
822 class CallIC_ArrayStub: public CallICStub { | 824 class CallIC_ArrayStub: public CallICStub { |
823 public: | 825 public: |
824 CallIC_ArrayStub(Isolate* isolate, const CallIC::State& state_in) | 826 CallIC_ArrayStub(Isolate* isolate, const CallICState& state_in) |
825 : CallICStub(isolate, state_in) {} | 827 : CallICStub(isolate, state_in) {} |
826 | 828 |
827 virtual InlineCacheState GetICState() const FINAL OVERRIDE { | 829 virtual InlineCacheState GetICState() const FINAL OVERRIDE { |
828 return MONOMORPHIC; | 830 return MONOMORPHIC; |
829 } | 831 } |
830 | 832 |
831 private: | 833 private: |
832 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT | 834 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT |
833 | 835 |
834 DEFINE_PLATFORM_CODE_STUB(CallIC_Array, CallICStub); | 836 DEFINE_PLATFORM_CODE_STUB(CallIC_Array, CallICStub); |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1051 DEFINE_CALL_INTERFACE_DESCRIPTOR(ApiGetter); | 1053 DEFINE_CALL_INTERFACE_DESCRIPTOR(ApiGetter); |
1052 DEFINE_PLATFORM_CODE_STUB(CallApiGetter, PlatformCodeStub); | 1054 DEFINE_PLATFORM_CODE_STUB(CallApiGetter, PlatformCodeStub); |
1053 }; | 1055 }; |
1054 | 1056 |
1055 | 1057 |
1056 class BinaryOpICStub : public HydrogenCodeStub { | 1058 class BinaryOpICStub : public HydrogenCodeStub { |
1057 public: | 1059 public: |
1058 BinaryOpICStub(Isolate* isolate, Token::Value op, | 1060 BinaryOpICStub(Isolate* isolate, Token::Value op, |
1059 OverwriteMode mode = NO_OVERWRITE) | 1061 OverwriteMode mode = NO_OVERWRITE) |
1060 : HydrogenCodeStub(isolate, UNINITIALIZED) { | 1062 : HydrogenCodeStub(isolate, UNINITIALIZED) { |
1061 BinaryOpIC::State state(isolate, op, mode); | 1063 BinaryOpICState state(isolate, op, mode); |
1062 set_sub_minor_key(state.GetExtraICState()); | 1064 set_sub_minor_key(state.GetExtraICState()); |
1063 } | 1065 } |
1064 | 1066 |
1065 BinaryOpICStub(Isolate* isolate, const BinaryOpIC::State& state) | 1067 BinaryOpICStub(Isolate* isolate, const BinaryOpICState& state) |
1066 : HydrogenCodeStub(isolate) { | 1068 : HydrogenCodeStub(isolate) { |
1067 set_sub_minor_key(state.GetExtraICState()); | 1069 set_sub_minor_key(state.GetExtraICState()); |
1068 } | 1070 } |
1069 | 1071 |
1070 static void GenerateAheadOfTime(Isolate* isolate); | 1072 static void GenerateAheadOfTime(Isolate* isolate); |
1071 | 1073 |
1072 virtual Code::Kind GetCodeKind() const OVERRIDE { | 1074 virtual Code::Kind GetCodeKind() const OVERRIDE { |
1073 return Code::BINARY_OP_IC; | 1075 return Code::BINARY_OP_IC; |
1074 } | 1076 } |
1075 | 1077 |
1076 virtual InlineCacheState GetICState() const FINAL OVERRIDE { | 1078 virtual InlineCacheState GetICState() const FINAL OVERRIDE { |
1077 return state().GetICState(); | 1079 return state().GetICState(); |
1078 } | 1080 } |
1079 | 1081 |
1080 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE { | 1082 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE { |
1081 return static_cast<ExtraICState>(sub_minor_key()); | 1083 return static_cast<ExtraICState>(sub_minor_key()); |
1082 } | 1084 } |
1083 | 1085 |
1084 BinaryOpIC::State state() const { | 1086 BinaryOpICState state() const { |
1085 return BinaryOpIC::State(isolate(), GetExtraICState()); | 1087 return BinaryOpICState(isolate(), GetExtraICState()); |
1086 } | 1088 } |
1087 | 1089 |
1088 virtual void PrintState(OStream& os) const FINAL OVERRIDE; // NOLINT | 1090 virtual void PrintState(OStream& os) const FINAL OVERRIDE; // NOLINT |
1089 | 1091 |
1090 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 1092 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
1091 static const int kLeft = 0; | 1093 static const int kLeft = 0; |
1092 static const int kRight = 1; | 1094 static const int kRight = 1; |
1093 | 1095 |
1094 private: | 1096 private: |
1095 static void GenerateAheadOfTime(Isolate* isolate, | 1097 static void GenerateAheadOfTime(Isolate* isolate, |
1096 const BinaryOpIC::State& state); | 1098 const BinaryOpICState& state); |
1097 | 1099 |
1098 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); | 1100 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); |
1099 DEFINE_HYDROGEN_CODE_STUB(BinaryOpIC, HydrogenCodeStub); | 1101 DEFINE_HYDROGEN_CODE_STUB(BinaryOpIC, HydrogenCodeStub); |
1100 }; | 1102 }; |
1101 | 1103 |
1102 | 1104 |
1103 // TODO(bmeurer): Merge this into the BinaryOpICStub once we have proper tail | 1105 // TODO(bmeurer): Merge this into the BinaryOpICStub once we have proper tail |
1104 // call support for stubs in Hydrogen. | 1106 // call support for stubs in Hydrogen. |
1105 class BinaryOpICWithAllocationSiteStub FINAL : public PlatformCodeStub { | 1107 class BinaryOpICWithAllocationSiteStub FINAL : public PlatformCodeStub { |
1106 public: | 1108 public: |
1107 BinaryOpICWithAllocationSiteStub(Isolate* isolate, | 1109 BinaryOpICWithAllocationSiteStub(Isolate* isolate, |
1108 const BinaryOpIC::State& state) | 1110 const BinaryOpICState& state) |
1109 : PlatformCodeStub(isolate) { | 1111 : PlatformCodeStub(isolate) { |
1110 minor_key_ = state.GetExtraICState(); | 1112 minor_key_ = state.GetExtraICState(); |
1111 } | 1113 } |
1112 | 1114 |
1113 static void GenerateAheadOfTime(Isolate* isolate); | 1115 static void GenerateAheadOfTime(Isolate* isolate); |
1114 | 1116 |
1115 Handle<Code> GetCodeCopyFromTemplate(Handle<AllocationSite> allocation_site) { | 1117 Handle<Code> GetCodeCopyFromTemplate(Handle<AllocationSite> allocation_site) { |
1116 Code::FindAndReplacePattern pattern; | 1118 Code::FindAndReplacePattern pattern; |
1117 pattern.Add(isolate()->factory()->undefined_map(), allocation_site); | 1119 pattern.Add(isolate()->factory()->undefined_map(), allocation_site); |
1118 return CodeStub::GetCodeCopy(pattern); | 1120 return CodeStub::GetCodeCopy(pattern); |
1119 } | 1121 } |
1120 | 1122 |
1121 virtual Code::Kind GetCodeKind() const OVERRIDE { | 1123 virtual Code::Kind GetCodeKind() const OVERRIDE { |
1122 return Code::BINARY_OP_IC; | 1124 return Code::BINARY_OP_IC; |
1123 } | 1125 } |
1124 | 1126 |
1125 virtual InlineCacheState GetICState() const OVERRIDE { | 1127 virtual InlineCacheState GetICState() const OVERRIDE { |
1126 return state().GetICState(); | 1128 return state().GetICState(); |
1127 } | 1129 } |
1128 | 1130 |
1129 virtual ExtraICState GetExtraICState() const OVERRIDE { | 1131 virtual ExtraICState GetExtraICState() const OVERRIDE { |
1130 return static_cast<ExtraICState>(minor_key_); | 1132 return static_cast<ExtraICState>(minor_key_); |
1131 } | 1133 } |
1132 | 1134 |
1133 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT | 1135 virtual void PrintState(OStream& os) const OVERRIDE; // NOLINT |
1134 | 1136 |
1135 private: | 1137 private: |
1136 BinaryOpIC::State state() const { | 1138 BinaryOpICState state() const { |
1137 return BinaryOpIC::State(isolate(), static_cast<ExtraICState>(minor_key_)); | 1139 return BinaryOpICState(isolate(), static_cast<ExtraICState>(minor_key_)); |
1138 } | 1140 } |
1139 | 1141 |
1140 static void GenerateAheadOfTime(Isolate* isolate, | 1142 static void GenerateAheadOfTime(Isolate* isolate, |
1141 const BinaryOpIC::State& state); | 1143 const BinaryOpICState& state); |
1142 | 1144 |
1143 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOpWithAllocationSite); | 1145 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOpWithAllocationSite); |
1144 DEFINE_PLATFORM_CODE_STUB(BinaryOpICWithAllocationSite, PlatformCodeStub); | 1146 DEFINE_PLATFORM_CODE_STUB(BinaryOpICWithAllocationSite, PlatformCodeStub); |
1145 }; | 1147 }; |
1146 | 1148 |
1147 | 1149 |
1148 class BinaryOpWithAllocationSiteStub FINAL : public BinaryOpICStub { | 1150 class BinaryOpWithAllocationSiteStub FINAL : public BinaryOpICStub { |
1149 public: | 1151 public: |
1150 BinaryOpWithAllocationSiteStub(Isolate* isolate, | 1152 BinaryOpWithAllocationSiteStub(Isolate* isolate, |
1151 Token::Value op, | 1153 Token::Value op, |
1152 OverwriteMode mode) | 1154 OverwriteMode mode) |
1153 : BinaryOpICStub(isolate, op, mode) {} | 1155 : BinaryOpICStub(isolate, op, mode) {} |
1154 | 1156 |
1155 BinaryOpWithAllocationSiteStub(Isolate* isolate, | 1157 BinaryOpWithAllocationSiteStub(Isolate* isolate, const BinaryOpICState& state) |
1156 const BinaryOpIC::State& state) | |
1157 : BinaryOpICStub(isolate, state) {} | 1158 : BinaryOpICStub(isolate, state) {} |
1158 | 1159 |
1159 virtual Code::Kind GetCodeKind() const FINAL OVERRIDE { | 1160 virtual Code::Kind GetCodeKind() const FINAL OVERRIDE { |
1160 return Code::STUB; | 1161 return Code::STUB; |
1161 } | 1162 } |
1162 | 1163 |
1163 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 1164 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
1164 static const int kAllocationSite = 0; | 1165 static const int kAllocationSite = 0; |
1165 static const int kLeft = 1; | 1166 static const int kLeft = 1; |
1166 static const int kRight = 2; | 1167 static const int kRight = 2; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1209 | 1210 |
1210 virtual void PrintBaseName(OStream& os) const OVERRIDE; // NOLINT | 1211 virtual void PrintBaseName(OStream& os) const OVERRIDE; // NOLINT |
1211 | 1212 |
1212 DEFINE_CALL_INTERFACE_DESCRIPTOR(StringAdd); | 1213 DEFINE_CALL_INTERFACE_DESCRIPTOR(StringAdd); |
1213 DEFINE_HYDROGEN_CODE_STUB(StringAdd, HydrogenCodeStub); | 1214 DEFINE_HYDROGEN_CODE_STUB(StringAdd, HydrogenCodeStub); |
1214 }; | 1215 }; |
1215 | 1216 |
1216 | 1217 |
1217 class CompareICStub : public PlatformCodeStub { | 1218 class CompareICStub : public PlatformCodeStub { |
1218 public: | 1219 public: |
1219 CompareICStub(Isolate* isolate, Token::Value op, CompareIC::State left, | 1220 CompareICStub(Isolate* isolate, Token::Value op, CompareICState::State left, |
1220 CompareIC::State right, CompareIC::State state) | 1221 CompareICState::State right, CompareICState::State state) |
1221 : PlatformCodeStub(isolate) { | 1222 : PlatformCodeStub(isolate) { |
1222 DCHECK(Token::IsCompareOp(op)); | 1223 DCHECK(Token::IsCompareOp(op)); |
1223 minor_key_ = OpBits::encode(op - Token::EQ) | LeftStateBits::encode(left) | | 1224 minor_key_ = OpBits::encode(op - Token::EQ) | LeftStateBits::encode(left) | |
1224 RightStateBits::encode(right) | StateBits::encode(state); | 1225 RightStateBits::encode(right) | StateBits::encode(state); |
1225 } | 1226 } |
1226 | 1227 |
1227 void set_known_map(Handle<Map> map) { known_map_ = map; } | 1228 void set_known_map(Handle<Map> map) { known_map_ = map; } |
1228 | 1229 |
1229 virtual InlineCacheState GetICState() const; | 1230 virtual InlineCacheState GetICState() const; |
1230 | 1231 |
1231 Token::Value op() const { | 1232 Token::Value op() const { |
1232 return static_cast<Token::Value>(Token::EQ + OpBits::decode(minor_key_)); | 1233 return static_cast<Token::Value>(Token::EQ + OpBits::decode(minor_key_)); |
1233 } | 1234 } |
1234 | 1235 |
1235 CompareIC::State left() const { return LeftStateBits::decode(minor_key_); } | 1236 CompareICState::State left() const { |
1236 CompareIC::State right() const { return RightStateBits::decode(minor_key_); } | 1237 return LeftStateBits::decode(minor_key_); |
1237 CompareIC::State state() const { return StateBits::decode(minor_key_); } | 1238 } |
| 1239 CompareICState::State right() const { |
| 1240 return RightStateBits::decode(minor_key_); |
| 1241 } |
| 1242 CompareICState::State state() const { return StateBits::decode(minor_key_); } |
1238 | 1243 |
1239 private: | 1244 private: |
1240 virtual Code::Kind GetCodeKind() const { return Code::COMPARE_IC; } | 1245 virtual Code::Kind GetCodeKind() const { return Code::COMPARE_IC; } |
1241 | 1246 |
1242 void GenerateSmis(MacroAssembler* masm); | 1247 void GenerateSmis(MacroAssembler* masm); |
1243 void GenerateNumbers(MacroAssembler* masm); | 1248 void GenerateNumbers(MacroAssembler* masm); |
1244 void GenerateInternalizedStrings(MacroAssembler* masm); | 1249 void GenerateInternalizedStrings(MacroAssembler* masm); |
1245 void GenerateStrings(MacroAssembler* masm); | 1250 void GenerateStrings(MacroAssembler* masm); |
1246 void GenerateUniqueNames(MacroAssembler* masm); | 1251 void GenerateUniqueNames(MacroAssembler* masm); |
1247 void GenerateObjects(MacroAssembler* masm); | 1252 void GenerateObjects(MacroAssembler* masm); |
1248 void GenerateMiss(MacroAssembler* masm); | 1253 void GenerateMiss(MacroAssembler* masm); |
1249 void GenerateKnownObjects(MacroAssembler* masm); | 1254 void GenerateKnownObjects(MacroAssembler* masm); |
1250 void GenerateGeneric(MacroAssembler* masm); | 1255 void GenerateGeneric(MacroAssembler* masm); |
1251 | 1256 |
1252 bool strict() const { return op() == Token::EQ_STRICT; } | 1257 bool strict() const { return op() == Token::EQ_STRICT; } |
1253 Condition GetCondition() const { return CompareIC::ComputeCondition(op()); } | 1258 Condition GetCondition() const; |
1254 | 1259 |
1255 virtual void AddToSpecialCache(Handle<Code> new_object); | 1260 virtual void AddToSpecialCache(Handle<Code> new_object); |
1256 virtual bool FindCodeInSpecialCache(Code** code_out); | 1261 virtual bool FindCodeInSpecialCache(Code** code_out); |
1257 virtual bool UseSpecialCache() { return state() == CompareIC::KNOWN_OBJECT; } | 1262 virtual bool UseSpecialCache() { |
| 1263 return state() == CompareICState::KNOWN_OBJECT; |
| 1264 } |
1258 | 1265 |
1259 class OpBits : public BitField<int, 0, 3> {}; | 1266 class OpBits : public BitField<int, 0, 3> {}; |
1260 class LeftStateBits : public BitField<CompareIC::State, 3, 4> {}; | 1267 class LeftStateBits : public BitField<CompareICState::State, 3, 4> {}; |
1261 class RightStateBits : public BitField<CompareIC::State, 7, 4> {}; | 1268 class RightStateBits : public BitField<CompareICState::State, 7, 4> {}; |
1262 class StateBits : public BitField<CompareIC::State, 11, 4> {}; | 1269 class StateBits : public BitField<CompareICState::State, 11, 4> {}; |
1263 | 1270 |
1264 Handle<Map> known_map_; | 1271 Handle<Map> known_map_; |
1265 | 1272 |
1266 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); | 1273 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); |
1267 DEFINE_PLATFORM_CODE_STUB(CompareIC, PlatformCodeStub); | 1274 DEFINE_PLATFORM_CODE_STUB(CompareIC, PlatformCodeStub); |
1268 }; | 1275 }; |
1269 | 1276 |
1270 | 1277 |
1271 class CompareNilICStub : public HydrogenCodeStub { | 1278 class CompareNilICStub : public HydrogenCodeStub { |
1272 public: | 1279 public: |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1733 virtual Code::Kind GetCodeKind() const { return Code::KEYED_LOAD_IC; } | 1740 virtual Code::Kind GetCodeKind() const { return Code::KEYED_LOAD_IC; } |
1734 virtual InlineCacheState GetICState() const { return GENERIC; } | 1741 virtual InlineCacheState GetICState() const { return GENERIC; } |
1735 | 1742 |
1736 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load); | 1743 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load); |
1737 DEFINE_HYDROGEN_CODE_STUB(KeyedLoadGeneric, HydrogenCodeStub); | 1744 DEFINE_HYDROGEN_CODE_STUB(KeyedLoadGeneric, HydrogenCodeStub); |
1738 }; | 1745 }; |
1739 | 1746 |
1740 | 1747 |
1741 class LoadICTrampolineStub : public PlatformCodeStub { | 1748 class LoadICTrampolineStub : public PlatformCodeStub { |
1742 public: | 1749 public: |
1743 LoadICTrampolineStub(Isolate* isolate, const LoadIC::State& state) | 1750 LoadICTrampolineStub(Isolate* isolate, const LoadICState& state) |
1744 : PlatformCodeStub(isolate) { | 1751 : PlatformCodeStub(isolate) { |
1745 minor_key_ = state.GetExtraICState(); | 1752 minor_key_ = state.GetExtraICState(); |
1746 } | 1753 } |
1747 | 1754 |
1748 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::LOAD_IC; } | 1755 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::LOAD_IC; } |
1749 | 1756 |
1750 virtual InlineCacheState GetICState() const FINAL OVERRIDE { | 1757 virtual InlineCacheState GetICState() const FINAL OVERRIDE { |
1751 return GENERIC; | 1758 return GENERIC; |
1752 } | 1759 } |
1753 | 1760 |
1754 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE { | 1761 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE { |
1755 return static_cast<ExtraICState>(minor_key_); | 1762 return static_cast<ExtraICState>(minor_key_); |
1756 } | 1763 } |
1757 | 1764 |
1758 private: | 1765 private: |
1759 LoadIC::State state() const { | 1766 LoadICState state() const { |
1760 return LoadIC::State(static_cast<ExtraICState>(minor_key_)); | 1767 return LoadICState(static_cast<ExtraICState>(minor_key_)); |
1761 } | 1768 } |
1762 | 1769 |
1763 DEFINE_CALL_INTERFACE_DESCRIPTOR(VectorLoadICTrampoline); | 1770 DEFINE_CALL_INTERFACE_DESCRIPTOR(VectorLoadICTrampoline); |
1764 DEFINE_PLATFORM_CODE_STUB(LoadICTrampoline, PlatformCodeStub); | 1771 DEFINE_PLATFORM_CODE_STUB(LoadICTrampoline, PlatformCodeStub); |
1765 }; | 1772 }; |
1766 | 1773 |
1767 | 1774 |
1768 class KeyedLoadICTrampolineStub : public LoadICTrampolineStub { | 1775 class KeyedLoadICTrampolineStub : public LoadICTrampolineStub { |
1769 public: | 1776 public: |
1770 explicit KeyedLoadICTrampolineStub(Isolate* isolate) | 1777 explicit KeyedLoadICTrampolineStub(Isolate* isolate) |
1771 : LoadICTrampolineStub(isolate, LoadIC::State(0)) {} | 1778 : LoadICTrampolineStub(isolate, LoadICState(0)) {} |
1772 | 1779 |
1773 virtual Code::Kind GetCodeKind() const OVERRIDE { | 1780 virtual Code::Kind GetCodeKind() const OVERRIDE { |
1774 return Code::KEYED_LOAD_IC; | 1781 return Code::KEYED_LOAD_IC; |
1775 } | 1782 } |
1776 | 1783 |
1777 DEFINE_PLATFORM_CODE_STUB(KeyedLoadICTrampoline, LoadICTrampolineStub); | 1784 DEFINE_PLATFORM_CODE_STUB(KeyedLoadICTrampoline, LoadICTrampolineStub); |
1778 }; | 1785 }; |
1779 | 1786 |
1780 | 1787 |
1781 class MegamorphicLoadStub : public HydrogenCodeStub { | 1788 class MegamorphicLoadStub : public HydrogenCodeStub { |
1782 public: | 1789 public: |
1783 MegamorphicLoadStub(Isolate* isolate, const LoadIC::State& state) | 1790 MegamorphicLoadStub(Isolate* isolate, const LoadICState& state) |
1784 : HydrogenCodeStub(isolate) { | 1791 : HydrogenCodeStub(isolate) { |
1785 set_sub_minor_key(state.GetExtraICState()); | 1792 set_sub_minor_key(state.GetExtraICState()); |
1786 } | 1793 } |
1787 | 1794 |
1788 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::LOAD_IC; } | 1795 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::LOAD_IC; } |
1789 | 1796 |
1790 virtual InlineCacheState GetICState() const FINAL OVERRIDE { | 1797 virtual InlineCacheState GetICState() const FINAL OVERRIDE { |
1791 return MEGAMORPHIC; | 1798 return MEGAMORPHIC; |
1792 } | 1799 } |
1793 | 1800 |
1794 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE { | 1801 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE { |
1795 return static_cast<ExtraICState>(sub_minor_key()); | 1802 return static_cast<ExtraICState>(sub_minor_key()); |
1796 } | 1803 } |
1797 | 1804 |
1798 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load); | 1805 DEFINE_CALL_INTERFACE_DESCRIPTOR(Load); |
1799 DEFINE_HYDROGEN_CODE_STUB(MegamorphicLoad, HydrogenCodeStub); | 1806 DEFINE_HYDROGEN_CODE_STUB(MegamorphicLoad, HydrogenCodeStub); |
1800 }; | 1807 }; |
1801 | 1808 |
1802 | 1809 |
1803 class VectorLoadStub : public HydrogenCodeStub { | 1810 class VectorLoadStub : public HydrogenCodeStub { |
1804 public: | 1811 public: |
1805 explicit VectorLoadStub(Isolate* isolate, const LoadIC::State& state) | 1812 explicit VectorLoadStub(Isolate* isolate, const LoadICState& state) |
1806 : HydrogenCodeStub(isolate) { | 1813 : HydrogenCodeStub(isolate) { |
1807 set_sub_minor_key(state.GetExtraICState()); | 1814 set_sub_minor_key(state.GetExtraICState()); |
1808 } | 1815 } |
1809 | 1816 |
1810 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::LOAD_IC; } | 1817 virtual Code::Kind GetCodeKind() const OVERRIDE { return Code::LOAD_IC; } |
1811 | 1818 |
1812 virtual InlineCacheState GetICState() const FINAL OVERRIDE { | 1819 virtual InlineCacheState GetICState() const FINAL OVERRIDE { |
1813 return GENERIC; | 1820 return GENERIC; |
1814 } | 1821 } |
1815 | 1822 |
1816 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE { | 1823 virtual ExtraICState GetExtraICState() const FINAL OVERRIDE { |
1817 return static_cast<ExtraICState>(sub_minor_key()); | 1824 return static_cast<ExtraICState>(sub_minor_key()); |
1818 } | 1825 } |
1819 | 1826 |
1820 private: | 1827 private: |
1821 LoadIC::State state() const { return LoadIC::State(GetExtraICState()); } | 1828 LoadICState state() const { return LoadICState(GetExtraICState()); } |
1822 | 1829 |
1823 DEFINE_CALL_INTERFACE_DESCRIPTOR(VectorLoadIC); | 1830 DEFINE_CALL_INTERFACE_DESCRIPTOR(VectorLoadIC); |
1824 DEFINE_HYDROGEN_CODE_STUB(VectorLoad, HydrogenCodeStub); | 1831 DEFINE_HYDROGEN_CODE_STUB(VectorLoad, HydrogenCodeStub); |
1825 }; | 1832 }; |
1826 | 1833 |
1827 | 1834 |
1828 class VectorKeyedLoadStub : public VectorLoadStub { | 1835 class VectorKeyedLoadStub : public VectorLoadStub { |
1829 public: | 1836 public: |
1830 explicit VectorKeyedLoadStub(Isolate* isolate) | 1837 explicit VectorKeyedLoadStub(Isolate* isolate) |
1831 : VectorLoadStub(isolate, LoadIC::State(0)) {} | 1838 : VectorLoadStub(isolate, LoadICState(0)) {} |
1832 | 1839 |
1833 virtual Code::Kind GetCodeKind() const OVERRIDE { | 1840 virtual Code::Kind GetCodeKind() const OVERRIDE { |
1834 return Code::KEYED_LOAD_IC; | 1841 return Code::KEYED_LOAD_IC; |
1835 } | 1842 } |
1836 | 1843 |
1837 DEFINE_CALL_INTERFACE_DESCRIPTOR(VectorLoadIC); | 1844 DEFINE_CALL_INTERFACE_DESCRIPTOR(VectorLoadIC); |
1838 DEFINE_HYDROGEN_CODE_STUB(VectorKeyedLoad, VectorLoadStub); | 1845 DEFINE_HYDROGEN_CODE_STUB(VectorKeyedLoad, VectorLoadStub); |
1839 }; | 1846 }; |
1840 | 1847 |
1841 | 1848 |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2387 | 2394 |
2388 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR | 2395 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR |
2389 #undef DEFINE_PLATFORM_CODE_STUB | 2396 #undef DEFINE_PLATFORM_CODE_STUB |
2390 #undef DEFINE_HANDLER_CODE_STUB | 2397 #undef DEFINE_HANDLER_CODE_STUB |
2391 #undef DEFINE_HYDROGEN_CODE_STUB | 2398 #undef DEFINE_HYDROGEN_CODE_STUB |
2392 #undef DEFINE_CODE_STUB | 2399 #undef DEFINE_CODE_STUB |
2393 #undef DEFINE_CODE_STUB_BASE | 2400 #undef DEFINE_CODE_STUB_BASE |
2394 } } // namespace v8::internal | 2401 } } // namespace v8::internal |
2395 | 2402 |
2396 #endif // V8_CODE_STUBS_H_ | 2403 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |