OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #include "src/code-factory.h" | 5 #include "src/code-factory.h" |
6 | 6 |
7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
8 #include "src/ic/ic.h" | 8 #include "src/ic/ic.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
11 namespace internal { | 11 namespace internal { |
12 | 12 |
| 13 namespace { |
| 14 |
| 15 // TODO(ishell): make it (const Stub& stub) once CodeStub::GetCode() is const. |
| 16 template <typename Stub> |
| 17 Callable make_callable(Stub& stub) { |
| 18 typedef typename Stub::Descriptor Descriptor; |
| 19 return Callable(stub.GetCode(), Descriptor(stub.isolate())); |
| 20 } |
| 21 |
| 22 } // namespace |
13 | 23 |
14 // static | 24 // static |
15 Callable CodeFactory::LoadIC(Isolate* isolate) { | 25 Callable CodeFactory::LoadIC(Isolate* isolate) { |
16 if (FLAG_tf_load_ic_stub) { | 26 if (FLAG_tf_load_ic_stub) { |
17 LoadICTrampolineTFStub stub(isolate); | 27 LoadICTrampolineTFStub stub(isolate); |
18 return Callable(stub.GetCode(), LoadDescriptor(isolate)); | 28 return make_callable(stub); |
19 } | 29 } |
20 LoadICTrampolineStub stub(isolate); | 30 LoadICTrampolineStub stub(isolate); |
21 return Callable(stub.GetCode(), LoadDescriptor(isolate)); | 31 return make_callable(stub); |
22 } | 32 } |
23 | 33 |
24 // static | 34 // static |
25 Callable CodeFactory::ApiGetter(Isolate* isolate) { | 35 Callable CodeFactory::ApiGetter(Isolate* isolate) { |
26 CallApiGetterStub stub(isolate); | 36 CallApiGetterStub stub(isolate); |
27 return Callable(stub.GetCode(), ApiGetterDescriptor(isolate)); | 37 return make_callable(stub); |
28 } | 38 } |
29 | 39 |
30 // static | 40 // static |
31 Callable CodeFactory::LoadICInOptimizedCode(Isolate* isolate) { | 41 Callable CodeFactory::LoadICInOptimizedCode(Isolate* isolate) { |
32 auto code = LoadIC::initialize_stub_in_optimized_code(isolate); | 42 if (FLAG_tf_load_ic_stub) { |
33 return Callable(code, LoadWithVectorDescriptor(isolate)); | 43 LoadICTFStub stub(isolate); |
| 44 return make_callable(stub); |
| 45 } |
| 46 LoadICStub stub(isolate); |
| 47 return make_callable(stub); |
34 } | 48 } |
35 | 49 |
36 // static | 50 // static |
37 Callable CodeFactory::LoadGlobalIC(Isolate* isolate, TypeofMode typeof_mode) { | 51 Callable CodeFactory::LoadGlobalIC(Isolate* isolate, TypeofMode typeof_mode) { |
38 LoadGlobalICTrampolineStub stub(isolate, LoadGlobalICState(typeof_mode)); | 52 LoadGlobalICTrampolineStub stub(isolate, LoadGlobalICState(typeof_mode)); |
39 return Callable(stub.GetCode(), LoadGlobalDescriptor(isolate)); | 53 return make_callable(stub); |
40 } | 54 } |
41 | 55 |
42 // static | 56 // static |
43 Callable CodeFactory::LoadGlobalICInOptimizedCode(Isolate* isolate, | 57 Callable CodeFactory::LoadGlobalICInOptimizedCode(Isolate* isolate, |
44 TypeofMode typeof_mode) { | 58 TypeofMode typeof_mode) { |
45 auto code = LoadGlobalIC::initialize_stub_in_optimized_code( | 59 LoadGlobalICStub stub(isolate, LoadGlobalICState(typeof_mode)); |
46 isolate, LoadGlobalICState(typeof_mode).GetExtraICState()); | 60 return make_callable(stub); |
47 return Callable(code, LoadGlobalWithVectorDescriptor(isolate)); | |
48 } | 61 } |
49 | 62 |
50 // static | 63 // static |
51 Callable CodeFactory::KeyedLoadIC(Isolate* isolate) { | 64 Callable CodeFactory::KeyedLoadIC(Isolate* isolate) { |
52 if (FLAG_tf_load_ic_stub) { | 65 if (FLAG_tf_load_ic_stub) { |
53 KeyedLoadICTrampolineTFStub stub(isolate); | 66 KeyedLoadICTrampolineTFStub stub(isolate); |
54 return Callable(stub.GetCode(), LoadDescriptor(isolate)); | 67 return make_callable(stub); |
55 } | 68 } |
56 KeyedLoadICTrampolineStub stub(isolate); | 69 KeyedLoadICTrampolineStub stub(isolate); |
57 return Callable(stub.GetCode(), LoadDescriptor(isolate)); | 70 return make_callable(stub); |
58 } | 71 } |
59 | 72 |
60 | |
61 // static | 73 // static |
62 Callable CodeFactory::KeyedLoadICInOptimizedCode(Isolate* isolate) { | 74 Callable CodeFactory::KeyedLoadICInOptimizedCode(Isolate* isolate) { |
63 auto code = KeyedLoadIC::initialize_stub_in_optimized_code(isolate); | 75 if (FLAG_tf_load_ic_stub) { |
64 return Callable(code, LoadWithVectorDescriptor(isolate)); | 76 KeyedLoadICTFStub stub(isolate); |
| 77 return make_callable(stub); |
| 78 } |
| 79 KeyedLoadICStub stub(isolate); |
| 80 return make_callable(stub); |
65 } | 81 } |
66 | 82 |
67 // static | 83 // static |
68 Callable CodeFactory::KeyedLoadIC_Megamorphic(Isolate* isolate) { | 84 Callable CodeFactory::KeyedLoadIC_Megamorphic(Isolate* isolate) { |
69 return Callable(isolate->builtins()->KeyedLoadIC_Megamorphic(), | 85 return Callable(isolate->builtins()->KeyedLoadIC_Megamorphic(), |
70 LoadWithVectorDescriptor(isolate)); | 86 LoadWithVectorDescriptor(isolate)); |
71 } | 87 } |
72 | 88 |
73 // static | 89 // static |
74 Callable CodeFactory::CallIC(Isolate* isolate, int argc, | 90 Callable CodeFactory::CallIC(Isolate* isolate, int argc, |
75 ConvertReceiverMode mode, | 91 ConvertReceiverMode mode, |
76 TailCallMode tail_call_mode) { | 92 TailCallMode tail_call_mode) { |
77 CallICTrampolineStub stub(isolate, CallICState(argc, mode, tail_call_mode)); | 93 CallICTrampolineStub stub(isolate, CallICState(argc, mode, tail_call_mode)); |
78 return Callable(stub.GetCode(), CallFunctionWithFeedbackDescriptor(isolate)); | 94 return make_callable(stub); |
79 } | 95 } |
80 | 96 |
81 | |
82 // static | 97 // static |
83 Callable CodeFactory::CallICInOptimizedCode(Isolate* isolate, int argc, | 98 Callable CodeFactory::CallICInOptimizedCode(Isolate* isolate, int argc, |
84 ConvertReceiverMode mode, | 99 ConvertReceiverMode mode, |
85 TailCallMode tail_call_mode) { | 100 TailCallMode tail_call_mode) { |
86 return Callable(CallIC::initialize_stub_in_optimized_code(isolate, argc, mode, | 101 CallICStub stub(isolate, CallICState(argc, mode, tail_call_mode)); |
87 tail_call_mode), | 102 return make_callable(stub); |
88 CallFunctionWithFeedbackAndVectorDescriptor(isolate)); | |
89 } | 103 } |
90 | 104 |
91 | |
92 // static | 105 // static |
93 Callable CodeFactory::StoreIC(Isolate* isolate, LanguageMode language_mode) { | 106 Callable CodeFactory::StoreIC(Isolate* isolate, LanguageMode language_mode) { |
94 StoreICTrampolineStub stub(isolate, StoreICState(language_mode)); | 107 StoreICTrampolineStub stub(isolate, StoreICState(language_mode)); |
95 return Callable(stub.GetCode(), StoreDescriptor(isolate)); | 108 return make_callable(stub); |
96 } | 109 } |
97 | 110 |
98 | |
99 // static | 111 // static |
100 Callable CodeFactory::StoreICInOptimizedCode(Isolate* isolate, | 112 Callable CodeFactory::StoreICInOptimizedCode(Isolate* isolate, |
101 LanguageMode language_mode) { | 113 LanguageMode language_mode) { |
102 CallInterfaceDescriptor descriptor = StoreWithVectorDescriptor(isolate); | 114 StoreICStub stub(isolate, StoreICState(language_mode)); |
103 return Callable( | 115 return make_callable(stub); |
104 StoreIC::initialize_stub_in_optimized_code(isolate, language_mode), | |
105 descriptor); | |
106 } | 116 } |
107 | 117 |
108 | |
109 // static | 118 // static |
110 Callable CodeFactory::KeyedStoreIC(Isolate* isolate, | 119 Callable CodeFactory::KeyedStoreIC(Isolate* isolate, |
111 LanguageMode language_mode) { | 120 LanguageMode language_mode) { |
112 KeyedStoreICTrampolineStub stub(isolate, StoreICState(language_mode)); | 121 KeyedStoreICTrampolineStub stub(isolate, StoreICState(language_mode)); |
113 return Callable(stub.GetCode(), StoreDescriptor(isolate)); | 122 return make_callable(stub); |
114 } | 123 } |
115 | 124 |
116 | |
117 // static | 125 // static |
118 Callable CodeFactory::KeyedStoreICInOptimizedCode(Isolate* isolate, | 126 Callable CodeFactory::KeyedStoreICInOptimizedCode(Isolate* isolate, |
119 LanguageMode language_mode) { | 127 LanguageMode language_mode) { |
120 CallInterfaceDescriptor descriptor = StoreWithVectorDescriptor(isolate); | 128 KeyedStoreICStub stub(isolate, StoreICState(language_mode)); |
121 return Callable( | 129 return make_callable(stub); |
122 KeyedStoreIC::initialize_stub_in_optimized_code(isolate, language_mode), | |
123 descriptor); | |
124 } | 130 } |
125 | 131 |
126 | |
127 // static | 132 // static |
128 Callable CodeFactory::CompareIC(Isolate* isolate, Token::Value op) { | 133 Callable CodeFactory::CompareIC(Isolate* isolate, Token::Value op) { |
129 Handle<Code> code = CompareIC::GetUninitialized(isolate, op); | 134 CompareICStub stub(isolate, op); |
130 return Callable(code, CompareDescriptor(isolate)); | 135 return make_callable(stub); |
131 } | 136 } |
132 | 137 |
133 | |
134 // static | 138 // static |
135 Callable CodeFactory::BinaryOpIC(Isolate* isolate, Token::Value op) { | 139 Callable CodeFactory::BinaryOpIC(Isolate* isolate, Token::Value op) { |
136 BinaryOpICStub stub(isolate, op); | 140 BinaryOpICStub stub(isolate, op); |
137 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 141 return make_callable(stub); |
138 } | 142 } |
139 | 143 |
140 | |
141 // static | 144 // static |
142 Callable CodeFactory::InstanceOf(Isolate* isolate) { | 145 Callable CodeFactory::InstanceOf(Isolate* isolate) { |
143 InstanceOfStub stub(isolate); | 146 InstanceOfStub stub(isolate); |
144 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 147 return make_callable(stub); |
145 } | 148 } |
146 | 149 |
147 | |
148 // static | 150 // static |
149 Callable CodeFactory::GetProperty(Isolate* isolate) { | 151 Callable CodeFactory::GetProperty(Isolate* isolate) { |
150 GetPropertyStub stub(isolate); | 152 GetPropertyStub stub(isolate); |
151 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 153 return make_callable(stub); |
152 } | 154 } |
153 | 155 |
154 // static | 156 // static |
155 Callable CodeFactory::ToBoolean(Isolate* isolate) { | 157 Callable CodeFactory::ToBoolean(Isolate* isolate) { |
156 return Callable(isolate->builtins()->ToBoolean(), | 158 return Callable(isolate->builtins()->ToBoolean(), |
157 TypeConversionDescriptor(isolate)); | 159 TypeConversionDescriptor(isolate)); |
158 } | 160 } |
159 | 161 |
160 | |
161 // static | 162 // static |
162 Callable CodeFactory::ToNumber(Isolate* isolate) { | 163 Callable CodeFactory::ToNumber(Isolate* isolate) { |
163 return Callable(isolate->builtins()->ToNumber(), | 164 return Callable(isolate->builtins()->ToNumber(), |
164 TypeConversionDescriptor(isolate)); | 165 TypeConversionDescriptor(isolate)); |
165 } | 166 } |
166 | 167 |
167 | |
168 // static | 168 // static |
169 Callable CodeFactory::NonNumberToNumber(Isolate* isolate) { | 169 Callable CodeFactory::NonNumberToNumber(Isolate* isolate) { |
170 return Callable(isolate->builtins()->NonNumberToNumber(), | 170 return Callable(isolate->builtins()->NonNumberToNumber(), |
171 TypeConversionDescriptor(isolate)); | 171 TypeConversionDescriptor(isolate)); |
172 } | 172 } |
173 | 173 |
174 // static | 174 // static |
175 Callable CodeFactory::StringToNumber(Isolate* isolate) { | 175 Callable CodeFactory::StringToNumber(Isolate* isolate) { |
176 return Callable(isolate->builtins()->StringToNumber(), | 176 return Callable(isolate->builtins()->StringToNumber(), |
177 TypeConversionDescriptor(isolate)); | 177 TypeConversionDescriptor(isolate)); |
178 } | 178 } |
179 | 179 |
180 // static | 180 // static |
181 Callable CodeFactory::ToString(Isolate* isolate) { | 181 Callable CodeFactory::ToString(Isolate* isolate) { |
182 ToStringStub stub(isolate); | 182 ToStringStub stub(isolate); |
183 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 183 return make_callable(stub); |
184 } | 184 } |
185 | 185 |
186 | |
187 // static | 186 // static |
188 Callable CodeFactory::ToName(Isolate* isolate) { | 187 Callable CodeFactory::ToName(Isolate* isolate) { |
189 ToNameStub stub(isolate); | 188 ToNameStub stub(isolate); |
190 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 189 return make_callable(stub); |
191 } | 190 } |
192 | 191 |
193 | |
194 // static | 192 // static |
195 Callable CodeFactory::ToInteger(Isolate* isolate) { | 193 Callable CodeFactory::ToInteger(Isolate* isolate) { |
196 ToIntegerStub stub(isolate); | 194 ToIntegerStub stub(isolate); |
197 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 195 return make_callable(stub); |
198 } | 196 } |
199 | 197 |
200 // static | 198 // static |
201 Callable CodeFactory::ToLength(Isolate* isolate) { | 199 Callable CodeFactory::ToLength(Isolate* isolate) { |
202 ToLengthStub stub(isolate); | 200 ToLengthStub stub(isolate); |
203 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 201 return make_callable(stub); |
204 } | 202 } |
205 | 203 |
206 | |
207 // static | 204 // static |
208 Callable CodeFactory::ToObject(Isolate* isolate) { | 205 Callable CodeFactory::ToObject(Isolate* isolate) { |
209 ToObjectStub stub(isolate); | 206 ToObjectStub stub(isolate); |
210 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 207 return make_callable(stub); |
211 } | 208 } |
212 | 209 |
213 // static | 210 // static |
214 Callable CodeFactory::NonPrimitiveToPrimitive(Isolate* isolate, | 211 Callable CodeFactory::NonPrimitiveToPrimitive(Isolate* isolate, |
215 ToPrimitiveHint hint) { | 212 ToPrimitiveHint hint) { |
216 return Callable(isolate->builtins()->NonPrimitiveToPrimitive(hint), | 213 return Callable(isolate->builtins()->NonPrimitiveToPrimitive(hint), |
217 TypeConversionDescriptor(isolate)); | 214 TypeConversionDescriptor(isolate)); |
218 } | 215 } |
219 | 216 |
220 // static | 217 // static |
221 Callable CodeFactory::OrdinaryToPrimitive(Isolate* isolate, | 218 Callable CodeFactory::OrdinaryToPrimitive(Isolate* isolate, |
222 OrdinaryToPrimitiveHint hint) { | 219 OrdinaryToPrimitiveHint hint) { |
223 return Callable(isolate->builtins()->OrdinaryToPrimitive(hint), | 220 return Callable(isolate->builtins()->OrdinaryToPrimitive(hint), |
224 TypeConversionDescriptor(isolate)); | 221 TypeConversionDescriptor(isolate)); |
225 } | 222 } |
226 | 223 |
227 // static | 224 // static |
228 Callable CodeFactory::NumberToString(Isolate* isolate) { | 225 Callable CodeFactory::NumberToString(Isolate* isolate) { |
229 NumberToStringStub stub(isolate); | 226 NumberToStringStub stub(isolate); |
230 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 227 return make_callable(stub); |
231 } | 228 } |
232 | 229 |
233 // static | 230 // static |
234 Callable CodeFactory::RegExpConstructResult(Isolate* isolate) { | 231 Callable CodeFactory::RegExpConstructResult(Isolate* isolate) { |
235 RegExpConstructResultStub stub(isolate); | 232 RegExpConstructResultStub stub(isolate); |
236 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 233 return make_callable(stub); |
237 } | 234 } |
238 | 235 |
239 | |
240 // static | 236 // static |
241 Callable CodeFactory::RegExpExec(Isolate* isolate) { | 237 Callable CodeFactory::RegExpExec(Isolate* isolate) { |
242 RegExpExecStub stub(isolate); | 238 RegExpExecStub stub(isolate); |
243 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 239 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
244 } | 240 } |
245 | 241 |
246 // static | 242 // static |
247 Callable CodeFactory::Add(Isolate* isolate) { | 243 Callable CodeFactory::Add(Isolate* isolate) { |
248 AddStub stub(isolate); | 244 AddStub stub(isolate); |
249 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 245 return make_callable(stub); |
250 } | 246 } |
251 | 247 |
252 // static | 248 // static |
253 Callable CodeFactory::Subtract(Isolate* isolate) { | 249 Callable CodeFactory::Subtract(Isolate* isolate) { |
254 SubtractStub stub(isolate); | 250 SubtractStub stub(isolate); |
255 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 251 return make_callable(stub); |
256 } | 252 } |
257 | 253 |
258 // static | 254 // static |
259 Callable CodeFactory::Multiply(Isolate* isolate) { | 255 Callable CodeFactory::Multiply(Isolate* isolate) { |
260 MultiplyStub stub(isolate); | 256 MultiplyStub stub(isolate); |
261 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 257 return make_callable(stub); |
262 } | 258 } |
263 | 259 |
264 // static | 260 // static |
265 Callable CodeFactory::Divide(Isolate* isolate) { | 261 Callable CodeFactory::Divide(Isolate* isolate) { |
266 DivideStub stub(isolate); | 262 DivideStub stub(isolate); |
267 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 263 return make_callable(stub); |
268 } | 264 } |
269 | 265 |
270 // static | 266 // static |
271 Callable CodeFactory::Modulus(Isolate* isolate) { | 267 Callable CodeFactory::Modulus(Isolate* isolate) { |
272 ModulusStub stub(isolate); | 268 ModulusStub stub(isolate); |
273 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 269 return make_callable(stub); |
274 } | 270 } |
275 | 271 |
276 // static | 272 // static |
277 Callable CodeFactory::ShiftRight(Isolate* isolate) { | 273 Callable CodeFactory::ShiftRight(Isolate* isolate) { |
278 ShiftRightStub stub(isolate); | 274 ShiftRightStub stub(isolate); |
279 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 275 return make_callable(stub); |
280 } | 276 } |
281 | 277 |
282 // static | 278 // static |
283 Callable CodeFactory::ShiftRightLogical(Isolate* isolate) { | 279 Callable CodeFactory::ShiftRightLogical(Isolate* isolate) { |
284 ShiftRightLogicalStub stub(isolate); | 280 ShiftRightLogicalStub stub(isolate); |
285 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 281 return make_callable(stub); |
286 } | 282 } |
287 | 283 |
288 // static | 284 // static |
289 Callable CodeFactory::ShiftLeft(Isolate* isolate) { | 285 Callable CodeFactory::ShiftLeft(Isolate* isolate) { |
290 ShiftLeftStub stub(isolate); | 286 ShiftLeftStub stub(isolate); |
291 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 287 return make_callable(stub); |
292 } | 288 } |
293 | 289 |
294 // static | 290 // static |
295 Callable CodeFactory::BitwiseAnd(Isolate* isolate) { | 291 Callable CodeFactory::BitwiseAnd(Isolate* isolate) { |
296 BitwiseAndStub stub(isolate); | 292 BitwiseAndStub stub(isolate); |
297 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 293 return make_callable(stub); |
298 } | 294 } |
299 | 295 |
300 // static | 296 // static |
301 Callable CodeFactory::BitwiseOr(Isolate* isolate) { | 297 Callable CodeFactory::BitwiseOr(Isolate* isolate) { |
302 BitwiseOrStub stub(isolate); | 298 BitwiseOrStub stub(isolate); |
303 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 299 return make_callable(stub); |
304 } | 300 } |
305 | 301 |
306 // static | 302 // static |
307 Callable CodeFactory::BitwiseXor(Isolate* isolate) { | 303 Callable CodeFactory::BitwiseXor(Isolate* isolate) { |
308 BitwiseXorStub stub(isolate); | 304 BitwiseXorStub stub(isolate); |
309 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 305 return make_callable(stub); |
310 } | 306 } |
311 | 307 |
312 // static | 308 // static |
313 Callable CodeFactory::Inc(Isolate* isolate) { | 309 Callable CodeFactory::Inc(Isolate* isolate) { |
314 IncStub stub(isolate); | 310 IncStub stub(isolate); |
315 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 311 return make_callable(stub); |
316 } | 312 } |
317 | 313 |
318 // static | 314 // static |
319 Callable CodeFactory::Dec(Isolate* isolate) { | 315 Callable CodeFactory::Dec(Isolate* isolate) { |
320 DecStub stub(isolate); | 316 DecStub stub(isolate); |
321 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 317 return make_callable(stub); |
322 } | 318 } |
323 | 319 |
324 // static | 320 // static |
325 Callable CodeFactory::LessThan(Isolate* isolate) { | 321 Callable CodeFactory::LessThan(Isolate* isolate) { |
326 LessThanStub stub(isolate); | 322 LessThanStub stub(isolate); |
327 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 323 return make_callable(stub); |
328 } | 324 } |
329 | 325 |
330 // static | 326 // static |
331 Callable CodeFactory::LessThanOrEqual(Isolate* isolate) { | 327 Callable CodeFactory::LessThanOrEqual(Isolate* isolate) { |
332 LessThanOrEqualStub stub(isolate); | 328 LessThanOrEqualStub stub(isolate); |
333 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 329 return make_callable(stub); |
334 } | 330 } |
335 | 331 |
336 // static | 332 // static |
337 Callable CodeFactory::GreaterThan(Isolate* isolate) { | 333 Callable CodeFactory::GreaterThan(Isolate* isolate) { |
338 GreaterThanStub stub(isolate); | 334 GreaterThanStub stub(isolate); |
339 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 335 return make_callable(stub); |
340 } | 336 } |
341 | 337 |
342 // static | 338 // static |
343 Callable CodeFactory::GreaterThanOrEqual(Isolate* isolate) { | 339 Callable CodeFactory::GreaterThanOrEqual(Isolate* isolate) { |
344 GreaterThanOrEqualStub stub(isolate); | 340 GreaterThanOrEqualStub stub(isolate); |
345 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 341 return make_callable(stub); |
346 } | 342 } |
347 | 343 |
348 // static | 344 // static |
349 Callable CodeFactory::Equal(Isolate* isolate) { | 345 Callable CodeFactory::Equal(Isolate* isolate) { |
350 EqualStub stub(isolate); | 346 EqualStub stub(isolate); |
351 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 347 return make_callable(stub); |
352 } | 348 } |
353 | 349 |
354 // static | 350 // static |
355 Callable CodeFactory::NotEqual(Isolate* isolate) { | 351 Callable CodeFactory::NotEqual(Isolate* isolate) { |
356 NotEqualStub stub(isolate); | 352 NotEqualStub stub(isolate); |
357 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 353 return make_callable(stub); |
358 } | 354 } |
359 | 355 |
360 // static | 356 // static |
361 Callable CodeFactory::StrictEqual(Isolate* isolate) { | 357 Callable CodeFactory::StrictEqual(Isolate* isolate) { |
362 StrictEqualStub stub(isolate); | 358 StrictEqualStub stub(isolate); |
363 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 359 return make_callable(stub); |
364 } | 360 } |
365 | 361 |
366 // static | 362 // static |
367 Callable CodeFactory::StrictNotEqual(Isolate* isolate) { | 363 Callable CodeFactory::StrictNotEqual(Isolate* isolate) { |
368 StrictNotEqualStub stub(isolate); | 364 StrictNotEqualStub stub(isolate); |
369 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 365 return make_callable(stub); |
370 } | 366 } |
371 | 367 |
372 // static | 368 // static |
373 Callable CodeFactory::StringAdd(Isolate* isolate, StringAddFlags flags, | 369 Callable CodeFactory::StringAdd(Isolate* isolate, StringAddFlags flags, |
374 PretenureFlag pretenure_flag) { | 370 PretenureFlag pretenure_flag) { |
375 StringAddStub stub(isolate, flags, pretenure_flag); | 371 StringAddStub stub(isolate, flags, pretenure_flag); |
376 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 372 return make_callable(stub); |
377 } | 373 } |
378 | 374 |
379 // static | 375 // static |
380 Callable CodeFactory::StringCompare(Isolate* isolate, Token::Value token) { | 376 Callable CodeFactory::StringCompare(Isolate* isolate, Token::Value token) { |
381 switch (token) { | 377 switch (token) { |
382 case Token::EQ: | 378 case Token::EQ: |
383 case Token::EQ_STRICT: | 379 case Token::EQ_STRICT: |
384 return StringEqual(isolate); | 380 return StringEqual(isolate); |
385 case Token::NE: | 381 case Token::NE: |
386 case Token::NE_STRICT: | 382 case Token::NE_STRICT: |
387 return StringNotEqual(isolate); | 383 return StringNotEqual(isolate); |
388 case Token::LT: | 384 case Token::LT: |
389 return StringLessThan(isolate); | 385 return StringLessThan(isolate); |
390 case Token::GT: | 386 case Token::GT: |
391 return StringGreaterThan(isolate); | 387 return StringGreaterThan(isolate); |
392 case Token::LTE: | 388 case Token::LTE: |
393 return StringLessThanOrEqual(isolate); | 389 return StringLessThanOrEqual(isolate); |
394 case Token::GTE: | 390 case Token::GTE: |
395 return StringGreaterThanOrEqual(isolate); | 391 return StringGreaterThanOrEqual(isolate); |
396 default: | 392 default: |
397 break; | 393 break; |
398 } | 394 } |
399 UNREACHABLE(); | 395 UNREACHABLE(); |
400 return StringEqual(isolate); | 396 return StringEqual(isolate); |
401 } | 397 } |
402 | 398 |
403 // static | 399 // static |
404 Callable CodeFactory::StringEqual(Isolate* isolate) { | 400 Callable CodeFactory::StringEqual(Isolate* isolate) { |
405 StringEqualStub stub(isolate); | 401 StringEqualStub stub(isolate); |
406 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 402 return make_callable(stub); |
407 } | 403 } |
408 | 404 |
409 // static | 405 // static |
410 Callable CodeFactory::StringNotEqual(Isolate* isolate) { | 406 Callable CodeFactory::StringNotEqual(Isolate* isolate) { |
411 StringNotEqualStub stub(isolate); | 407 StringNotEqualStub stub(isolate); |
412 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 408 return make_callable(stub); |
413 } | 409 } |
414 | 410 |
415 // static | 411 // static |
416 Callable CodeFactory::StringLessThan(Isolate* isolate) { | 412 Callable CodeFactory::StringLessThan(Isolate* isolate) { |
417 StringLessThanStub stub(isolate); | 413 StringLessThanStub stub(isolate); |
418 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 414 return make_callable(stub); |
419 } | 415 } |
420 | 416 |
421 // static | 417 // static |
422 Callable CodeFactory::StringLessThanOrEqual(Isolate* isolate) { | 418 Callable CodeFactory::StringLessThanOrEqual(Isolate* isolate) { |
423 StringLessThanOrEqualStub stub(isolate); | 419 StringLessThanOrEqualStub stub(isolate); |
424 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 420 return make_callable(stub); |
425 } | 421 } |
426 | 422 |
427 // static | 423 // static |
428 Callable CodeFactory::StringGreaterThan(Isolate* isolate) { | 424 Callable CodeFactory::StringGreaterThan(Isolate* isolate) { |
429 StringGreaterThanStub stub(isolate); | 425 StringGreaterThanStub stub(isolate); |
430 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 426 return make_callable(stub); |
431 } | 427 } |
432 | 428 |
433 // static | 429 // static |
434 Callable CodeFactory::StringGreaterThanOrEqual(Isolate* isolate) { | 430 Callable CodeFactory::StringGreaterThanOrEqual(Isolate* isolate) { |
435 StringGreaterThanOrEqualStub stub(isolate); | 431 StringGreaterThanOrEqualStub stub(isolate); |
436 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 432 return make_callable(stub); |
437 } | 433 } |
438 | 434 |
439 // static | 435 // static |
440 Callable CodeFactory::SubString(Isolate* isolate) { | 436 Callable CodeFactory::SubString(Isolate* isolate) { |
441 SubStringStub stub(isolate); | 437 SubStringStub stub(isolate); |
442 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 438 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
443 } | 439 } |
444 | 440 |
445 | |
446 // static | 441 // static |
447 Callable CodeFactory::ResumeGenerator(Isolate* isolate) { | 442 Callable CodeFactory::ResumeGenerator(Isolate* isolate) { |
448 return Callable(isolate->builtins()->ResumeGeneratorTrampoline(), | 443 return Callable(isolate->builtins()->ResumeGeneratorTrampoline(), |
449 ResumeGeneratorDescriptor(isolate)); | 444 ResumeGeneratorDescriptor(isolate)); |
450 } | 445 } |
451 | 446 |
452 // static | 447 // static |
453 Callable CodeFactory::Typeof(Isolate* isolate) { | 448 Callable CodeFactory::Typeof(Isolate* isolate) { |
454 TypeofStub stub(isolate); | 449 TypeofStub stub(isolate); |
455 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 450 return make_callable(stub); |
456 } | 451 } |
457 | 452 |
458 | |
459 // static | 453 // static |
460 Callable CodeFactory::FastCloneRegExp(Isolate* isolate) { | 454 Callable CodeFactory::FastCloneRegExp(Isolate* isolate) { |
461 FastCloneRegExpStub stub(isolate); | 455 FastCloneRegExpStub stub(isolate); |
462 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 456 return make_callable(stub); |
463 } | 457 } |
464 | 458 |
465 | |
466 // static | 459 // static |
467 Callable CodeFactory::FastCloneShallowArray(Isolate* isolate) { | 460 Callable CodeFactory::FastCloneShallowArray(Isolate* isolate) { |
468 // TODO(mstarzinger): Thread through AllocationSiteMode at some point. | 461 // TODO(mstarzinger): Thread through AllocationSiteMode at some point. |
469 FastCloneShallowArrayStub stub(isolate, DONT_TRACK_ALLOCATION_SITE); | 462 FastCloneShallowArrayStub stub(isolate, DONT_TRACK_ALLOCATION_SITE); |
470 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 463 return make_callable(stub); |
471 } | 464 } |
472 | 465 |
473 | |
474 // static | 466 // static |
475 Callable CodeFactory::FastCloneShallowObject(Isolate* isolate, int length) { | 467 Callable CodeFactory::FastCloneShallowObject(Isolate* isolate, int length) { |
476 FastCloneShallowObjectStub stub(isolate, length); | 468 FastCloneShallowObjectStub stub(isolate, length); |
477 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 469 return make_callable(stub); |
478 } | 470 } |
479 | 471 |
480 | 472 |
481 // static | 473 // static |
482 Callable CodeFactory::FastNewContext(Isolate* isolate, int slot_count) { | 474 Callable CodeFactory::FastNewContext(Isolate* isolate, int slot_count) { |
483 FastNewFunctionContextStub stub(isolate, slot_count); | 475 FastNewFunctionContextStub stub(isolate, slot_count); |
484 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 476 return make_callable(stub); |
485 } | 477 } |
486 | 478 |
487 | |
488 // static | 479 // static |
489 Callable CodeFactory::FastNewClosure(Isolate* isolate) { | 480 Callable CodeFactory::FastNewClosure(Isolate* isolate) { |
490 FastNewClosureStub stub(isolate); | 481 FastNewClosureStub stub(isolate); |
491 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 482 return make_callable(stub); |
492 } | 483 } |
493 | 484 |
494 | |
495 // static | 485 // static |
496 Callable CodeFactory::FastNewObject(Isolate* isolate) { | 486 Callable CodeFactory::FastNewObject(Isolate* isolate) { |
497 FastNewObjectStub stub(isolate); | 487 FastNewObjectStub stub(isolate); |
498 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 488 return make_callable(stub); |
499 } | 489 } |
500 | 490 |
501 | |
502 // static | 491 // static |
503 Callable CodeFactory::FastNewRestParameter(Isolate* isolate, | 492 Callable CodeFactory::FastNewRestParameter(Isolate* isolate, |
504 bool skip_stub_frame) { | 493 bool skip_stub_frame) { |
505 FastNewRestParameterStub stub(isolate, skip_stub_frame); | 494 FastNewRestParameterStub stub(isolate, skip_stub_frame); |
506 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 495 return make_callable(stub); |
507 } | 496 } |
508 | 497 |
509 | |
510 // static | 498 // static |
511 Callable CodeFactory::FastNewSloppyArguments(Isolate* isolate, | 499 Callable CodeFactory::FastNewSloppyArguments(Isolate* isolate, |
512 bool skip_stub_frame) { | 500 bool skip_stub_frame) { |
513 FastNewSloppyArgumentsStub stub(isolate, skip_stub_frame); | 501 FastNewSloppyArgumentsStub stub(isolate, skip_stub_frame); |
514 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 502 return make_callable(stub); |
515 } | 503 } |
516 | 504 |
517 | |
518 // static | 505 // static |
519 Callable CodeFactory::FastNewStrictArguments(Isolate* isolate, | 506 Callable CodeFactory::FastNewStrictArguments(Isolate* isolate, |
520 bool skip_stub_frame) { | 507 bool skip_stub_frame) { |
521 FastNewStrictArgumentsStub stub(isolate, skip_stub_frame); | 508 FastNewStrictArgumentsStub stub(isolate, skip_stub_frame); |
522 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 509 return make_callable(stub); |
523 } | 510 } |
524 | 511 |
525 | |
526 // static | 512 // static |
527 Callable CodeFactory::AllocateHeapNumber(Isolate* isolate) { | 513 Callable CodeFactory::AllocateHeapNumber(Isolate* isolate) { |
528 AllocateHeapNumberStub stub(isolate); | 514 AllocateHeapNumberStub stub(isolate); |
529 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 515 return make_callable(stub); |
530 } | 516 } |
531 | 517 |
532 #define SIMD128_ALLOC(TYPE, Type, type, lane_count, lane_type) \ | 518 #define SIMD128_ALLOC(TYPE, Type, type, lane_count, lane_type) \ |
533 Callable CodeFactory::Allocate##Type(Isolate* isolate) { \ | 519 Callable CodeFactory::Allocate##Type(Isolate* isolate) { \ |
534 Allocate##Type##Stub stub(isolate); \ | 520 Allocate##Type##Stub stub(isolate); \ |
535 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); \ | 521 return make_callable(stub); \ |
536 } | 522 } |
537 SIMD128_TYPES(SIMD128_ALLOC) | 523 SIMD128_TYPES(SIMD128_ALLOC) |
538 #undef SIMD128_ALLOC | 524 #undef SIMD128_ALLOC |
539 | 525 |
540 // static | 526 // static |
541 Callable CodeFactory::ArgumentAdaptor(Isolate* isolate) { | 527 Callable CodeFactory::ArgumentAdaptor(Isolate* isolate) { |
542 return Callable(isolate->builtins()->ArgumentsAdaptorTrampoline(), | 528 return Callable(isolate->builtins()->ArgumentsAdaptorTrampoline(), |
543 ArgumentAdaptorDescriptor(isolate)); | 529 ArgumentAdaptorDescriptor(isolate)); |
544 } | 530 } |
545 | 531 |
546 | |
547 // static | 532 // static |
548 Callable CodeFactory::Call(Isolate* isolate, ConvertReceiverMode mode, | 533 Callable CodeFactory::Call(Isolate* isolate, ConvertReceiverMode mode, |
549 TailCallMode tail_call_mode) { | 534 TailCallMode tail_call_mode) { |
550 return Callable(isolate->builtins()->Call(mode, tail_call_mode), | 535 return Callable(isolate->builtins()->Call(mode, tail_call_mode), |
551 CallTrampolineDescriptor(isolate)); | 536 CallTrampolineDescriptor(isolate)); |
552 } | 537 } |
553 | 538 |
554 | |
555 // static | 539 // static |
556 Callable CodeFactory::CallFunction(Isolate* isolate, ConvertReceiverMode mode) { | 540 Callable CodeFactory::CallFunction(Isolate* isolate, ConvertReceiverMode mode) { |
557 return Callable(isolate->builtins()->CallFunction(mode), | 541 return Callable(isolate->builtins()->CallFunction(mode), |
558 CallTrampolineDescriptor(isolate)); | 542 CallTrampolineDescriptor(isolate)); |
559 } | 543 } |
560 | 544 |
561 | |
562 // static | 545 // static |
563 Callable CodeFactory::Construct(Isolate* isolate) { | 546 Callable CodeFactory::Construct(Isolate* isolate) { |
564 return Callable(isolate->builtins()->Construct(), | 547 return Callable(isolate->builtins()->Construct(), |
565 ConstructTrampolineDescriptor(isolate)); | 548 ConstructTrampolineDescriptor(isolate)); |
566 } | 549 } |
567 | 550 |
568 | |
569 // static | 551 // static |
570 Callable CodeFactory::ConstructFunction(Isolate* isolate) { | 552 Callable CodeFactory::ConstructFunction(Isolate* isolate) { |
571 return Callable(isolate->builtins()->ConstructFunction(), | 553 return Callable(isolate->builtins()->ConstructFunction(), |
572 ConstructTrampolineDescriptor(isolate)); | 554 ConstructTrampolineDescriptor(isolate)); |
573 } | 555 } |
574 | 556 |
575 // static | 557 // static |
576 Callable CodeFactory::HasProperty(Isolate* isolate) { | 558 Callable CodeFactory::HasProperty(Isolate* isolate) { |
577 HasPropertyStub stub(isolate); | 559 HasPropertyStub stub(isolate); |
578 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 560 return make_callable(stub); |
579 } | 561 } |
580 | 562 |
581 // static | 563 // static |
582 Callable CodeFactory::ForInFilter(Isolate* isolate) { | 564 Callable CodeFactory::ForInFilter(Isolate* isolate) { |
583 ForInFilterStub stub(isolate); | 565 ForInFilterStub stub(isolate); |
584 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | 566 return make_callable(stub); |
585 } | 567 } |
586 | 568 |
587 // static | 569 // static |
588 Callable CodeFactory::InterpreterPushArgsAndCall(Isolate* isolate, | 570 Callable CodeFactory::InterpreterPushArgsAndCall(Isolate* isolate, |
589 TailCallMode tail_call_mode, | 571 TailCallMode tail_call_mode, |
590 CallableType function_type) { | 572 CallableType function_type) { |
591 return Callable(isolate->builtins()->InterpreterPushArgsAndCall( | 573 return Callable(isolate->builtins()->InterpreterPushArgsAndCall( |
592 tail_call_mode, function_type), | 574 tail_call_mode, function_type), |
593 InterpreterPushArgsAndCallDescriptor(isolate)); | 575 InterpreterPushArgsAndCallDescriptor(isolate)); |
594 } | 576 } |
595 | 577 |
596 | |
597 // static | 578 // static |
598 Callable CodeFactory::InterpreterPushArgsAndConstruct(Isolate* isolate) { | 579 Callable CodeFactory::InterpreterPushArgsAndConstruct(Isolate* isolate) { |
599 return Callable(isolate->builtins()->InterpreterPushArgsAndConstruct(), | 580 return Callable(isolate->builtins()->InterpreterPushArgsAndConstruct(), |
600 InterpreterPushArgsAndConstructDescriptor(isolate)); | 581 InterpreterPushArgsAndConstructDescriptor(isolate)); |
601 } | 582 } |
602 | 583 |
603 | |
604 // static | 584 // static |
605 Callable CodeFactory::InterpreterCEntry(Isolate* isolate, int result_size) { | 585 Callable CodeFactory::InterpreterCEntry(Isolate* isolate, int result_size) { |
606 // Note: If we ever use fpregs in the interpreter then we will need to | 586 // Note: If we ever use fpregs in the interpreter then we will need to |
607 // save fpregs too. | 587 // save fpregs too. |
608 CEntryStub stub(isolate, result_size, kDontSaveFPRegs, kArgvInRegister); | 588 CEntryStub stub(isolate, result_size, kDontSaveFPRegs, kArgvInRegister); |
609 return Callable(stub.GetCode(), InterpreterCEntryDescriptor(isolate)); | 589 return Callable(stub.GetCode(), InterpreterCEntryDescriptor(isolate)); |
610 } | 590 } |
611 | 591 |
612 // static | 592 // static |
613 Callable CodeFactory::InterpreterOnStackReplacement(Isolate* isolate) { | 593 Callable CodeFactory::InterpreterOnStackReplacement(Isolate* isolate) { |
614 return Callable(isolate->builtins()->InterpreterOnStackReplacement(), | 594 return Callable(isolate->builtins()->InterpreterOnStackReplacement(), |
615 ContextOnlyDescriptor(isolate)); | 595 ContextOnlyDescriptor(isolate)); |
616 } | 596 } |
617 | 597 |
618 } // namespace internal | 598 } // namespace internal |
619 } // namespace v8 | 599 } // namespace v8 |
OLD | NEW |