blob: dd12b05a811ea91e40946f1ce8f6c43af9dc96af [file] [log] [blame]
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001// 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
3// found in the LICENSE file.
4
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00005#include "src/code-factory.h"
Ben Murdochb8a8cc12014-11-26 15:28:44 +00006
7#include "src/bootstrapper.h"
Ben Murdochb8a8cc12014-11-26 15:28:44 +00008#include "src/ic/ic.h"
9
10namespace v8 {
11namespace internal {
12
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000013
Ben Murdochb8a8cc12014-11-26 15:28:44 +000014// static
Ben Murdoch097c5b22016-05-18 11:27:45 +010015Callable CodeFactory::LoadIC(Isolate* isolate, TypeofMode typeof_mode) {
Ben Murdochc5610432016-08-08 18:44:38 +010016 LoadICTrampolineStub stub(isolate, LoadICState(typeof_mode));
17 return Callable(stub.GetCode(), LoadDescriptor(isolate));
Ben Murdochb8a8cc12014-11-26 15:28:44 +000018}
19
Ben Murdochc5610432016-08-08 18:44:38 +010020// static
21Callable CodeFactory::ApiGetter(Isolate* isolate) {
22 CallApiGetterStub stub(isolate);
23 return Callable(stub.GetCode(), ApiGetterDescriptor(isolate));
24}
Ben Murdochb8a8cc12014-11-26 15:28:44 +000025
26// static
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000027Callable CodeFactory::LoadICInOptimizedCode(
Ben Murdoch097c5b22016-05-18 11:27:45 +010028 Isolate* isolate, TypeofMode typeof_mode,
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000029 InlineCacheState initialization_state) {
30 auto code = LoadIC::initialize_stub_in_optimized_code(
Ben Murdoch097c5b22016-05-18 11:27:45 +010031 isolate, LoadICState(typeof_mode).GetExtraICState(),
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000032 initialization_state);
33 return Callable(code, LoadWithVectorDescriptor(isolate));
Emily Bernierd0a1eb72015-03-24 16:35:39 -040034}
35
36
37// static
Ben Murdoch097c5b22016-05-18 11:27:45 +010038Callable CodeFactory::KeyedLoadIC(Isolate* isolate) {
Ben Murdochc5610432016-08-08 18:44:38 +010039 KeyedLoadICTrampolineStub stub(isolate, LoadICState(kNoExtraICState));
40 return Callable(stub.GetCode(), LoadDescriptor(isolate));
Ben Murdochb8a8cc12014-11-26 15:28:44 +000041}
42
43
44// static
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000045Callable CodeFactory::KeyedLoadICInOptimizedCode(
Ben Murdoch097c5b22016-05-18 11:27:45 +010046 Isolate* isolate, InlineCacheState initialization_state) {
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000047 auto code = KeyedLoadIC::initialize_stub_in_optimized_code(
Ben Murdoch097c5b22016-05-18 11:27:45 +010048 isolate, initialization_state, kNoExtraICState);
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000049 if (initialization_state != MEGAMORPHIC) {
50 return Callable(code, LoadWithVectorDescriptor(isolate));
Emily Bernierd0a1eb72015-03-24 16:35:39 -040051 }
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000052 return Callable(code, LoadDescriptor(isolate));
Emily Bernierd0a1eb72015-03-24 16:35:39 -040053}
54
55
56// static
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000057Callable CodeFactory::CallIC(Isolate* isolate, int argc,
Ben Murdoch097c5b22016-05-18 11:27:45 +010058 ConvertReceiverMode mode,
59 TailCallMode tail_call_mode) {
Ben Murdochc5610432016-08-08 18:44:38 +010060 CallICTrampolineStub stub(isolate, CallICState(argc, mode, tail_call_mode));
61 return Callable(stub.GetCode(), CallFunctionWithFeedbackDescriptor(isolate));
Ben Murdochb8a8cc12014-11-26 15:28:44 +000062}
63
64
65// static
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000066Callable CodeFactory::CallICInOptimizedCode(Isolate* isolate, int argc,
Ben Murdoch097c5b22016-05-18 11:27:45 +010067 ConvertReceiverMode mode,
68 TailCallMode tail_call_mode) {
69 return Callable(CallIC::initialize_stub_in_optimized_code(isolate, argc, mode,
70 tail_call_mode),
71 CallFunctionWithFeedbackAndVectorDescriptor(isolate));
Ben Murdochb8a8cc12014-11-26 15:28:44 +000072}
73
74
75// static
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000076Callable CodeFactory::StoreIC(Isolate* isolate, LanguageMode language_mode) {
Ben Murdochc5610432016-08-08 18:44:38 +010077 VectorStoreICTrampolineStub stub(isolate, StoreICState(language_mode));
78 return Callable(stub.GetCode(), VectorStoreICTrampolineDescriptor(isolate));
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000079}
80
81
82// static
83Callable CodeFactory::StoreICInOptimizedCode(
84 Isolate* isolate, LanguageMode language_mode,
85 InlineCacheState initialization_state) {
86 CallInterfaceDescriptor descriptor = initialization_state != MEGAMORPHIC
87 ? VectorStoreICDescriptor(isolate)
88 : StoreDescriptor(isolate);
89 return Callable(StoreIC::initialize_stub_in_optimized_code(
90 isolate, language_mode, initialization_state),
91 descriptor);
92}
93
94
95// static
96Callable CodeFactory::KeyedStoreIC(Isolate* isolate,
97 LanguageMode language_mode) {
Ben Murdochc5610432016-08-08 18:44:38 +010098 VectorKeyedStoreICTrampolineStub stub(isolate, StoreICState(language_mode));
99 return Callable(stub.GetCode(), VectorStoreICTrampolineDescriptor(isolate));
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000100}
101
102
103// static
104Callable CodeFactory::KeyedStoreICInOptimizedCode(
105 Isolate* isolate, LanguageMode language_mode,
106 InlineCacheState initialization_state) {
107 CallInterfaceDescriptor descriptor = initialization_state != MEGAMORPHIC
108 ? VectorStoreICDescriptor(isolate)
109 : StoreDescriptor(isolate);
110 return Callable(KeyedStoreIC::initialize_stub_in_optimized_code(
111 isolate, language_mode, initialization_state),
112 descriptor);
113}
114
115
116// static
Ben Murdoch097c5b22016-05-18 11:27:45 +0100117Callable CodeFactory::CompareIC(Isolate* isolate, Token::Value op) {
118 Handle<Code> code = CompareIC::GetUninitialized(isolate, op);
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000119 return Callable(code, CompareDescriptor(isolate));
120}
121
122
123// static
Ben Murdoch097c5b22016-05-18 11:27:45 +0100124Callable CodeFactory::BinaryOpIC(Isolate* isolate, Token::Value op) {
125 BinaryOpICStub stub(isolate, op);
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000126 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
127}
128
129
130// static
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000131Callable CodeFactory::InstanceOf(Isolate* isolate) {
132 InstanceOfStub stub(isolate);
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000133 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
134}
135
136
137// static
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000138Callable CodeFactory::ToBoolean(Isolate* isolate) {
Ben Murdochda12d292016-06-02 14:46:10 +0100139 ToBooleanStub stub(isolate);
140 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000141}
142
143
144// static
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000145Callable CodeFactory::ToNumber(Isolate* isolate) {
146 ToNumberStub stub(isolate);
147 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
148}
149
150
151// static
Ben Murdochda12d292016-06-02 14:46:10 +0100152Callable CodeFactory::NonNumberToNumber(Isolate* isolate) {
153 NonNumberToNumberStub stub(isolate);
154 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
155}
156
157// static
158Callable CodeFactory::StringToNumber(Isolate* isolate) {
159 StringToNumberStub stub(isolate);
160 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
161}
162
163// static
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000164Callable CodeFactory::ToString(Isolate* isolate) {
165 ToStringStub stub(isolate);
166 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
167}
168
169
170// static
Ben Murdoch097c5b22016-05-18 11:27:45 +0100171Callable CodeFactory::ToName(Isolate* isolate) {
172 ToNameStub stub(isolate);
173 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
174}
175
176
177// static
Ben Murdochda12d292016-06-02 14:46:10 +0100178Callable CodeFactory::ToInteger(Isolate* isolate) {
179 ToIntegerStub stub(isolate);
180 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
181}
182
183// static
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000184Callable CodeFactory::ToLength(Isolate* isolate) {
185 ToLengthStub stub(isolate);
186 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
187}
188
189
190// static
191Callable CodeFactory::ToObject(Isolate* isolate) {
192 ToObjectStub stub(isolate);
193 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
194}
195
196
197// static
198Callable CodeFactory::NumberToString(Isolate* isolate) {
199 NumberToStringStub stub(isolate);
200 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
201}
202
203
204// static
205Callable CodeFactory::RegExpConstructResult(Isolate* isolate) {
206 RegExpConstructResultStub stub(isolate);
207 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
208}
209
210
211// static
212Callable CodeFactory::RegExpExec(Isolate* isolate) {
213 RegExpExecStub stub(isolate);
214 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
215}
216
Ben Murdochda12d292016-06-02 14:46:10 +0100217// static
218Callable CodeFactory::Add(Isolate* isolate) {
219 AddStub stub(isolate);
220 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
221}
222
223// static
224Callable CodeFactory::Subtract(Isolate* isolate) {
225 SubtractStub stub(isolate);
226 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
227}
228
229// static
Ben Murdochc5610432016-08-08 18:44:38 +0100230Callable CodeFactory::Multiply(Isolate* isolate) {
231 MultiplyStub stub(isolate);
232 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
233}
234
235// static
236Callable CodeFactory::Divide(Isolate* isolate) {
237 DivideStub stub(isolate);
238 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
239}
240
241// static
242Callable CodeFactory::Modulus(Isolate* isolate) {
243 ModulusStub stub(isolate);
244 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
245}
246
247// static
248Callable CodeFactory::ShiftRight(Isolate* isolate) {
249 ShiftRightStub stub(isolate);
250 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
251}
252
253// static
254Callable CodeFactory::ShiftRightLogical(Isolate* isolate) {
255 ShiftRightLogicalStub stub(isolate);
256 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
257}
258
259// static
260Callable CodeFactory::ShiftLeft(Isolate* isolate) {
261 ShiftLeftStub stub(isolate);
262 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
263}
264
265// static
Ben Murdochda12d292016-06-02 14:46:10 +0100266Callable CodeFactory::BitwiseAnd(Isolate* isolate) {
267 BitwiseAndStub stub(isolate);
268 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
269}
270
271// static
272Callable CodeFactory::BitwiseOr(Isolate* isolate) {
273 BitwiseOrStub stub(isolate);
274 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
275}
276
277// static
278Callable CodeFactory::BitwiseXor(Isolate* isolate) {
279 BitwiseXorStub stub(isolate);
280 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
281}
282
283// static
Ben Murdochc5610432016-08-08 18:44:38 +0100284Callable CodeFactory::Inc(Isolate* isolate) {
285 IncStub stub(isolate);
286 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
287}
288
289// static
290Callable CodeFactory::Dec(Isolate* isolate) {
291 DecStub stub(isolate);
292 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
293}
294
295// static
Ben Murdochda12d292016-06-02 14:46:10 +0100296Callable CodeFactory::LessThan(Isolate* isolate) {
297 LessThanStub stub(isolate);
298 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
299}
300
301// static
302Callable CodeFactory::LessThanOrEqual(Isolate* isolate) {
303 LessThanOrEqualStub stub(isolate);
304 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
305}
306
307// static
308Callable CodeFactory::GreaterThan(Isolate* isolate) {
309 GreaterThanStub stub(isolate);
310 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
311}
312
313// static
314Callable CodeFactory::GreaterThanOrEqual(Isolate* isolate) {
315 GreaterThanOrEqualStub stub(isolate);
316 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
317}
318
319// static
320Callable CodeFactory::Equal(Isolate* isolate) {
321 EqualStub stub(isolate);
322 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
323}
324
325// static
326Callable CodeFactory::NotEqual(Isolate* isolate) {
327 NotEqualStub stub(isolate);
328 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
329}
330
331// static
332Callable CodeFactory::StrictEqual(Isolate* isolate) {
333 StrictEqualStub stub(isolate);
334 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
335}
336
337// static
338Callable CodeFactory::StrictNotEqual(Isolate* isolate) {
339 StrictNotEqualStub stub(isolate);
340 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
341}
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000342
343// static
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000344Callable CodeFactory::StringAdd(Isolate* isolate, StringAddFlags flags,
345 PretenureFlag pretenure_flag) {
346 StringAddStub stub(isolate, flags, pretenure_flag);
347 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
348}
349
Ben Murdochda12d292016-06-02 14:46:10 +0100350// static
351Callable CodeFactory::StringCompare(Isolate* isolate, Token::Value token) {
352 switch (token) {
353 case Token::EQ:
354 case Token::EQ_STRICT:
355 return StringEqual(isolate);
356 case Token::NE:
357 case Token::NE_STRICT:
358 return StringNotEqual(isolate);
359 case Token::LT:
360 return StringLessThan(isolate);
361 case Token::GT:
362 return StringGreaterThan(isolate);
363 case Token::LTE:
364 return StringLessThanOrEqual(isolate);
365 case Token::GTE:
366 return StringGreaterThanOrEqual(isolate);
367 default:
368 break;
369 }
370 UNREACHABLE();
371 return StringEqual(isolate);
372}
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000373
374// static
Ben Murdochda12d292016-06-02 14:46:10 +0100375Callable CodeFactory::StringEqual(Isolate* isolate) {
376 StringEqualStub stub(isolate);
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000377 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
378}
379
Ben Murdochda12d292016-06-02 14:46:10 +0100380// static
381Callable CodeFactory::StringNotEqual(Isolate* isolate) {
382 StringNotEqualStub stub(isolate);
383 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
384}
385
386// static
387Callable CodeFactory::StringLessThan(Isolate* isolate) {
388 StringLessThanStub stub(isolate);
389 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
390}
391
392// static
393Callable CodeFactory::StringLessThanOrEqual(Isolate* isolate) {
394 StringLessThanOrEqualStub stub(isolate);
395 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
396}
397
398// static
399Callable CodeFactory::StringGreaterThan(Isolate* isolate) {
400 StringGreaterThanStub stub(isolate);
401 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
402}
403
404// static
405Callable CodeFactory::StringGreaterThanOrEqual(Isolate* isolate) {
406 StringGreaterThanOrEqualStub stub(isolate);
407 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
408}
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000409
410// static
411Callable CodeFactory::SubString(Isolate* isolate) {
412 SubStringStub stub(isolate);
413 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
414}
415
416
417// static
Ben Murdochc5610432016-08-08 18:44:38 +0100418Callable CodeFactory::ResumeGenerator(Isolate* isolate) {
419 return Callable(isolate->builtins()->ResumeGeneratorTrampoline(),
420 ResumeGeneratorDescriptor(isolate));
Ben Murdochda12d292016-06-02 14:46:10 +0100421}
422
423// static
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000424Callable CodeFactory::Typeof(Isolate* isolate) {
425 TypeofStub stub(isolate);
426 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
427}
428
429
430// static
431Callable CodeFactory::FastCloneRegExp(Isolate* isolate) {
432 FastCloneRegExpStub stub(isolate);
433 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
434}
435
436
437// static
438Callable CodeFactory::FastCloneShallowArray(Isolate* isolate) {
439 // TODO(mstarzinger): Thread through AllocationSiteMode at some point.
440 FastCloneShallowArrayStub stub(isolate, DONT_TRACK_ALLOCATION_SITE);
441 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
442}
443
444
445// static
446Callable CodeFactory::FastCloneShallowObject(Isolate* isolate, int length) {
447 FastCloneShallowObjectStub stub(isolate, length);
448 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
449}
450
451
452// static
453Callable CodeFactory::FastNewContext(Isolate* isolate, int slot_count) {
454 FastNewContextStub stub(isolate, slot_count);
455 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
456}
457
458
459// static
460Callable CodeFactory::FastNewClosure(Isolate* isolate,
461 LanguageMode language_mode,
462 FunctionKind kind) {
463 FastNewClosureStub stub(isolate, language_mode, kind);
464 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
465}
466
467
468// static
Ben Murdoch097c5b22016-05-18 11:27:45 +0100469Callable CodeFactory::FastNewObject(Isolate* isolate) {
470 FastNewObjectStub stub(isolate);
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000471 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
472}
473
474
475// static
Ben Murdochc5610432016-08-08 18:44:38 +0100476Callable CodeFactory::FastNewRestParameter(Isolate* isolate,
477 bool skip_stub_frame) {
478 FastNewRestParameterStub stub(isolate, skip_stub_frame);
Ben Murdoch097c5b22016-05-18 11:27:45 +0100479 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
480}
481
482
483// static
Ben Murdochc5610432016-08-08 18:44:38 +0100484Callable CodeFactory::FastNewSloppyArguments(Isolate* isolate,
485 bool skip_stub_frame) {
486 FastNewSloppyArgumentsStub stub(isolate, skip_stub_frame);
Ben Murdoch097c5b22016-05-18 11:27:45 +0100487 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
488}
489
490
491// static
Ben Murdochc5610432016-08-08 18:44:38 +0100492Callable CodeFactory::FastNewStrictArguments(Isolate* isolate,
493 bool skip_stub_frame) {
494 FastNewStrictArgumentsStub stub(isolate, skip_stub_frame);
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000495 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
496}
497
498
499// static
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400500Callable CodeFactory::AllocateHeapNumber(Isolate* isolate) {
501 AllocateHeapNumberStub stub(isolate);
502 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
503}
504
Ben Murdochda12d292016-06-02 14:46:10 +0100505#define SIMD128_ALLOC(TYPE, Type, type, lane_count, lane_type) \
506 Callable CodeFactory::Allocate##Type(Isolate* isolate) { \
507 Allocate##Type##Stub stub(isolate); \
508 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); \
509 }
510SIMD128_TYPES(SIMD128_ALLOC)
511#undef SIMD128_ALLOC
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000512
513// static
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000514Callable CodeFactory::ArgumentAdaptor(Isolate* isolate) {
515 return Callable(isolate->builtins()->ArgumentsAdaptorTrampoline(),
516 ArgumentAdaptorDescriptor(isolate));
517}
518
519
520// static
Ben Murdochda12d292016-06-02 14:46:10 +0100521Callable CodeFactory::Call(Isolate* isolate, ConvertReceiverMode mode,
522 TailCallMode tail_call_mode) {
523 return Callable(isolate->builtins()->Call(mode, tail_call_mode),
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000524 CallTrampolineDescriptor(isolate));
525}
526
527
528// static
529Callable CodeFactory::CallFunction(Isolate* isolate, ConvertReceiverMode mode) {
530 return Callable(isolate->builtins()->CallFunction(mode),
531 CallTrampolineDescriptor(isolate));
532}
533
534
535// static
536Callable CodeFactory::Construct(Isolate* isolate) {
537 return Callable(isolate->builtins()->Construct(),
538 ConstructTrampolineDescriptor(isolate));
539}
540
541
542// static
543Callable CodeFactory::ConstructFunction(Isolate* isolate) {
544 return Callable(isolate->builtins()->ConstructFunction(),
545 ConstructTrampolineDescriptor(isolate));
546}
547
Ben Murdochc5610432016-08-08 18:44:38 +0100548// static
549Callable CodeFactory::HasProperty(Isolate* isolate) {
550 HasPropertyStub stub(isolate);
551 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
552}
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000553
554// static
Ben Murdoch097c5b22016-05-18 11:27:45 +0100555Callable CodeFactory::InterpreterPushArgsAndCall(Isolate* isolate,
556 TailCallMode tail_call_mode) {
557 return Callable(
558 isolate->builtins()->InterpreterPushArgsAndCall(tail_call_mode),
559 InterpreterPushArgsAndCallDescriptor(isolate));
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000560}
561
562
563// static
564Callable CodeFactory::InterpreterPushArgsAndConstruct(Isolate* isolate) {
565 return Callable(isolate->builtins()->InterpreterPushArgsAndConstruct(),
566 InterpreterPushArgsAndConstructDescriptor(isolate));
567}
568
569
570// static
571Callable CodeFactory::InterpreterCEntry(Isolate* isolate, int result_size) {
572 // Note: If we ever use fpregs in the interpreter then we will need to
573 // save fpregs too.
574 CEntryStub stub(isolate, result_size, kDontSaveFPRegs, kArgvInRegister);
575 return Callable(stub.GetCode(), InterpreterCEntryDescriptor(isolate));
576}
577
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000578} // namespace internal
579} // namespace v8