| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 #include "macro-assembler.h" | 35 #include "macro-assembler.h" |
| 36 | 36 |
| 37 namespace v8 { | 37 namespace v8 { |
| 38 namespace internal { | 38 namespace internal { |
| 39 | 39 |
| 40 // List of code stubs used on all platforms. | 40 // List of code stubs used on all platforms. |
| 41 #define CODE_STUB_LIST_ALL_PLATFORMS(V) \ | 41 #define CODE_STUB_LIST_ALL_PLATFORMS(V) \ |
| 42 V(CallFunction) \ | 42 V(CallFunction) \ |
| 43 V(CallConstruct) \ | 43 V(CallConstruct) \ |
| 44 V(BinaryOpIC) \ | 44 V(BinaryOpIC) \ |
| 45 V(BinaryOpICWithAllocationSite) \ |
| 46 V(BinaryOpWithAllocationSite) \ |
| 45 V(StringAdd) \ | 47 V(StringAdd) \ |
| 46 V(NewStringAdd) \ | 48 V(NewStringAdd) \ |
| 47 V(SubString) \ | 49 V(SubString) \ |
| 48 V(StringCompare) \ | 50 V(StringCompare) \ |
| 49 V(Compare) \ | 51 V(Compare) \ |
| 50 V(CompareIC) \ | 52 V(CompareIC) \ |
| 51 V(CompareNilIC) \ | 53 V(CompareNilIC) \ |
| 52 V(MathPow) \ | 54 V(MathPow) \ |
| 53 V(StringLength) \ | 55 V(StringLength) \ |
| 54 V(FunctionPrototype) \ | 56 V(FunctionPrototype) \ |
| (...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1052 STATIC_ASSERT(CallICBase::Contextual::kSize == ContextualBits::kSize); | 1054 STATIC_ASSERT(CallICBase::Contextual::kSize == ContextualBits::kSize); |
| 1053 class HoleyBits: public BitField<bool, 1, 1> {}; | 1055 class HoleyBits: public BitField<bool, 1, 1> {}; |
| 1054 STATIC_ASSERT(Code::kArgumentsBits <= kStubMinorKeyBits - 2); | 1056 STATIC_ASSERT(Code::kArgumentsBits <= kStubMinorKeyBits - 2); |
| 1055 class ArgcBits: public BitField<int, 2, Code::kArgumentsBits> {}; | 1057 class ArgcBits: public BitField<int, 2, Code::kArgumentsBits> {}; |
| 1056 virtual CodeStub::Major MajorKey() { return KeyedArrayCall; } | 1058 virtual CodeStub::Major MajorKey() { return KeyedArrayCall; } |
| 1057 int bit_field_; | 1059 int bit_field_; |
| 1058 int argc_; | 1060 int argc_; |
| 1059 }; | 1061 }; |
| 1060 | 1062 |
| 1061 | 1063 |
| 1062 class BinaryOpICStub V8_FINAL : public HydrogenCodeStub { | 1064 class BinaryOpICStub : public HydrogenCodeStub { |
| 1063 public: | 1065 public: |
| 1064 BinaryOpICStub(Token::Value op, OverwriteMode mode) | 1066 BinaryOpICStub(Token::Value op, OverwriteMode mode) |
| 1065 : HydrogenCodeStub(UNINITIALIZED), state_(op, mode) {} | 1067 : HydrogenCodeStub(UNINITIALIZED), state_(op, mode) {} |
| 1066 | 1068 |
| 1067 explicit BinaryOpICStub(const BinaryOpIC::State& state) : state_(state) {} | 1069 explicit BinaryOpICStub(const BinaryOpIC::State& state) : state_(state) {} |
| 1068 | 1070 |
| 1069 static void GenerateAheadOfTime(Isolate* isolate); | 1071 static void GenerateAheadOfTime(Isolate* isolate); |
| 1070 | 1072 |
| 1071 virtual void InitializeInterfaceDescriptor( | 1073 virtual void InitializeInterfaceDescriptor( |
| 1072 Isolate* isolate, CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 1074 Isolate* isolate, CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| 1073 | 1075 |
| 1074 static void InstallDescriptors(Isolate* isolate); | 1076 static void InstallDescriptors(Isolate* isolate); |
| 1075 | 1077 |
| 1076 virtual Code::Kind GetCodeKind() const V8_OVERRIDE { | 1078 virtual Code::Kind GetCodeKind() const V8_FINAL V8_OVERRIDE { |
| 1077 return Code::BINARY_OP_IC; | 1079 return Code::BINARY_OP_IC; |
| 1078 } | 1080 } |
| 1079 | 1081 |
| 1080 virtual InlineCacheState GetICState() V8_OVERRIDE { | 1082 virtual InlineCacheState GetICState() V8_FINAL V8_OVERRIDE { |
| 1081 return state_.GetICState(); | 1083 return state_.GetICState(); |
| 1082 } | 1084 } |
| 1083 | 1085 |
| 1084 virtual ExtraICState GetExtraICState() V8_OVERRIDE { | 1086 virtual ExtraICState GetExtraICState() V8_FINAL V8_OVERRIDE { |
| 1085 return state_.GetExtraICState(); | 1087 return state_.GetExtraICState(); |
| 1086 } | 1088 } |
| 1087 | 1089 |
| 1088 virtual void VerifyPlatformFeatures(Isolate* isolate) V8_OVERRIDE { | 1090 virtual void VerifyPlatformFeatures(Isolate* isolate) V8_FINAL V8_OVERRIDE { |
| 1089 ASSERT(CpuFeatures::VerifyCrossCompiling(SSE2)); | 1091 ASSERT(CpuFeatures::VerifyCrossCompiling(SSE2)); |
| 1090 } | 1092 } |
| 1091 | 1093 |
| 1092 virtual Handle<Code> GenerateCode(Isolate* isolate) V8_OVERRIDE; | 1094 virtual Handle<Code> GenerateCode(Isolate* isolate) V8_OVERRIDE; |
| 1093 | 1095 |
| 1094 const BinaryOpIC::State& state() const { return state_; } | 1096 const BinaryOpIC::State& state() const { return state_; } |
| 1095 | 1097 |
| 1096 virtual void PrintState(StringStream* stream) V8_OVERRIDE; | 1098 virtual void PrintState(StringStream* stream) V8_FINAL V8_OVERRIDE; |
| 1099 |
| 1100 virtual Major MajorKey() V8_OVERRIDE { return BinaryOpIC; } |
| 1101 virtual int NotMissMinorKey() V8_FINAL V8_OVERRIDE { |
| 1102 return GetExtraICState(); |
| 1103 } |
| 1097 | 1104 |
| 1098 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 1105 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
| 1099 static const int kLeft = 0; | 1106 static const int kLeft = 0; |
| 1100 static const int kRight = 1; | 1107 static const int kRight = 1; |
| 1101 | 1108 |
| 1102 private: | 1109 private: |
| 1103 static void GenerateAheadOfTime(Isolate* isolate, | 1110 static void GenerateAheadOfTime(Isolate* isolate, |
| 1104 const BinaryOpIC::State& state); | 1111 const BinaryOpIC::State& state); |
| 1105 | 1112 |
| 1106 virtual Major MajorKey() V8_OVERRIDE { return BinaryOpIC; } | |
| 1107 virtual int NotMissMinorKey() V8_OVERRIDE { return GetExtraICState(); } | |
| 1108 | |
| 1109 BinaryOpIC::State state_; | 1113 BinaryOpIC::State state_; |
| 1110 | 1114 |
| 1111 DISALLOW_COPY_AND_ASSIGN(BinaryOpICStub); | 1115 DISALLOW_COPY_AND_ASSIGN(BinaryOpICStub); |
| 1112 }; | 1116 }; |
| 1113 | 1117 |
| 1114 | 1118 |
| 1119 // TODO(bmeurer): Merge this into the BinaryOpICStub once we have proper tail |
| 1120 // call support for stubs in Hydrogen. |
| 1121 class BinaryOpICWithAllocationSiteStub V8_FINAL : public PlatformCodeStub { |
| 1122 public: |
| 1123 explicit BinaryOpICWithAllocationSiteStub(const BinaryOpIC::State& state) |
| 1124 : state_(state) {} |
| 1125 |
| 1126 static void GenerateAheadOfTime(Isolate* isolate); |
| 1127 |
| 1128 Handle<Code> GetCodeCopyFromTemplate(Isolate* isolate, |
| 1129 Handle<AllocationSite> allocation_site) { |
| 1130 Handle<Code> code = CodeStub::GetCodeCopyFromTemplate(isolate); |
| 1131 // Replace the placeholder oddball with the actual allocation site. |
| 1132 code->ReplaceNthObject(1, isolate->heap()->oddball_map(), *allocation_site); |
| 1133 return code; |
| 1134 } |
| 1135 |
| 1136 virtual Code::Kind GetCodeKind() const V8_OVERRIDE { |
| 1137 return Code::BINARY_OP_IC; |
| 1138 } |
| 1139 |
| 1140 virtual InlineCacheState GetICState() V8_OVERRIDE { |
| 1141 return state_.GetICState(); |
| 1142 } |
| 1143 |
| 1144 virtual ExtraICState GetExtraICState() V8_OVERRIDE { |
| 1145 return state_.GetExtraICState(); |
| 1146 } |
| 1147 |
| 1148 virtual void VerifyPlatformFeatures(Isolate* isolate) V8_OVERRIDE { |
| 1149 ASSERT(CpuFeatures::VerifyCrossCompiling(SSE2)); |
| 1150 } |
| 1151 |
| 1152 virtual void Generate(MacroAssembler* masm) V8_OVERRIDE; |
| 1153 |
| 1154 virtual void PrintState(StringStream* stream) V8_OVERRIDE; |
| 1155 |
| 1156 virtual Major MajorKey() V8_OVERRIDE { return BinaryOpICWithAllocationSite; } |
| 1157 virtual int MinorKey() V8_OVERRIDE { return GetExtraICState(); } |
| 1158 |
| 1159 private: |
| 1160 static void GenerateAheadOfTime(Isolate* isolate, |
| 1161 const BinaryOpIC::State& state); |
| 1162 |
| 1163 BinaryOpIC::State state_; |
| 1164 |
| 1165 DISALLOW_COPY_AND_ASSIGN(BinaryOpICWithAllocationSiteStub); |
| 1166 }; |
| 1167 |
| 1168 |
| 1169 class BinaryOpWithAllocationSiteStub V8_FINAL : public BinaryOpICStub { |
| 1170 public: |
| 1171 explicit BinaryOpWithAllocationSiteStub(const BinaryOpIC::State& state) |
| 1172 : BinaryOpICStub(state) {} |
| 1173 |
| 1174 virtual void InitializeInterfaceDescriptor( |
| 1175 Isolate* isolate, CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| 1176 |
| 1177 static void InstallDescriptors(Isolate* isolate); |
| 1178 |
| 1179 virtual Code::Kind GetCodeKind() const V8_FINAL V8_OVERRIDE { |
| 1180 return Code::STUB; |
| 1181 } |
| 1182 |
| 1183 virtual Handle<Code> GenerateCode(Isolate* isolate) V8_OVERRIDE; |
| 1184 |
| 1185 virtual Major MajorKey() V8_OVERRIDE { |
| 1186 return BinaryOpWithAllocationSite; |
| 1187 } |
| 1188 |
| 1189 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
| 1190 static const int kAllocationSite = 0; |
| 1191 static const int kLeft = 1; |
| 1192 static const int kRight = 2; |
| 1193 }; |
| 1194 |
| 1195 |
| 1115 // TODO(bmeurer): Rename to StringAddStub once we dropped the old StringAddStub. | 1196 // TODO(bmeurer): Rename to StringAddStub once we dropped the old StringAddStub. |
| 1116 class NewStringAddStub V8_FINAL : public HydrogenCodeStub { | 1197 class NewStringAddStub V8_FINAL : public HydrogenCodeStub { |
| 1117 public: | 1198 public: |
| 1118 NewStringAddStub(StringAddFlags flags, PretenureFlag pretenure_flag) | 1199 NewStringAddStub(StringAddFlags flags, PretenureFlag pretenure_flag) |
| 1119 : bit_field_(StringAddFlagsBits::encode(flags) | | 1200 : bit_field_(StringAddFlagsBits::encode(flags) | |
| 1120 PretenureFlagBits::encode(pretenure_flag)) {} | 1201 PretenureFlagBits::encode(pretenure_flag)) {} |
| 1121 | 1202 |
| 1122 StringAddFlags flags() const { | 1203 StringAddFlags flags() const { |
| 1123 return StringAddFlagsBits::decode(bit_field_); | 1204 return StringAddFlagsBits::decode(bit_field_); |
| 1124 } | 1205 } |
| 1125 | 1206 |
| 1126 PretenureFlag pretenure_flag() const { | 1207 PretenureFlag pretenure_flag() const { |
| 1127 return PretenureFlagBits::decode(bit_field_); | 1208 return PretenureFlagBits::decode(bit_field_); |
| 1128 } | 1209 } |
| 1129 | 1210 |
| 1211 virtual void VerifyPlatformFeatures(Isolate* isolate) V8_OVERRIDE { |
| 1212 ASSERT(CpuFeatures::VerifyCrossCompiling(SSE2)); |
| 1213 } |
| 1214 |
| 1130 virtual Handle<Code> GenerateCode(Isolate* isolate) V8_OVERRIDE; | 1215 virtual Handle<Code> GenerateCode(Isolate* isolate) V8_OVERRIDE; |
| 1131 | 1216 |
| 1132 virtual void InitializeInterfaceDescriptor( | 1217 virtual void InitializeInterfaceDescriptor( |
| 1133 Isolate* isolate, | 1218 Isolate* isolate, |
| 1134 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 1219 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| 1135 | 1220 |
| 1136 static void InstallDescriptors(Isolate* isolate); | 1221 static void InstallDescriptors(Isolate* isolate); |
| 1137 | 1222 |
| 1138 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 1223 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
| 1139 static const int kLeft = 0; | 1224 static const int kLeft = 0; |
| (...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2348 int MinorKey() { return 0; } | 2433 int MinorKey() { return 0; } |
| 2349 | 2434 |
| 2350 void Generate(MacroAssembler* masm); | 2435 void Generate(MacroAssembler* masm); |
| 2351 | 2436 |
| 2352 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 2437 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); |
| 2353 }; | 2438 }; |
| 2354 | 2439 |
| 2355 } } // namespace v8::internal | 2440 } } // namespace v8::internal |
| 2356 | 2441 |
| 2357 #endif // V8_CODE_STUBS_H_ | 2442 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |