2014-09-11 13:18:58 +00:00
|
|
|
// Copyright 2014 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2015-08-14 09:41:32 +00:00
|
|
|
#include "src/code-factory.h"
|
2014-09-11 13:18:58 +00:00
|
|
|
|
|
|
|
#include "src/bootstrapper.h"
|
|
|
|
#include "src/ic/ic.h"
|
|
|
|
|
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
|
|
|
|
2015-03-02 13:36:38 +00:00
|
|
|
|
2014-09-11 13:18:58 +00:00
|
|
|
// static
|
2016-06-14 13:20:42 +00:00
|
|
|
Callable CodeFactory::LoadIC(Isolate* isolate) {
|
2016-06-06 14:26:28 +00:00
|
|
|
if (FLAG_tf_load_ic_stub) {
|
2016-06-16 11:20:08 +00:00
|
|
|
LoadICTrampolineTFStub stub(isolate);
|
2016-06-06 14:26:28 +00:00
|
|
|
return Callable(stub.GetCode(), LoadDescriptor(isolate));
|
|
|
|
}
|
2016-06-16 11:20:08 +00:00
|
|
|
LoadICTrampolineStub stub(isolate);
|
2016-04-06 13:36:49 +00:00
|
|
|
return Callable(stub.GetCode(), LoadDescriptor(isolate));
|
2014-09-11 13:18:58 +00:00
|
|
|
}
|
|
|
|
|
2016-04-19 12:11:05 +00:00
|
|
|
// static
|
|
|
|
Callable CodeFactory::ApiGetter(Isolate* isolate) {
|
|
|
|
CallApiGetterStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), ApiGetterDescriptor(isolate));
|
|
|
|
}
|
2014-09-11 13:18:58 +00:00
|
|
|
|
2014-10-10 09:49:43 +00:00
|
|
|
// static
|
2016-06-14 13:20:42 +00:00
|
|
|
Callable CodeFactory::LoadICInOptimizedCode(Isolate* isolate) {
|
2016-06-16 11:20:08 +00:00
|
|
|
auto code = LoadIC::initialize_stub_in_optimized_code(isolate);
|
2015-05-20 13:19:11 +00:00
|
|
|
return Callable(code, LoadWithVectorDescriptor(isolate));
|
2014-10-10 09:49:43 +00:00
|
|
|
}
|
|
|
|
|
2016-06-14 13:20:42 +00:00
|
|
|
// static
|
|
|
|
Callable CodeFactory::LoadGlobalIC(Isolate* isolate, TypeofMode typeof_mode) {
|
2016-06-16 11:20:08 +00:00
|
|
|
LoadGlobalICTrampolineStub stub(isolate, LoadGlobalICState(typeof_mode));
|
2016-06-27 08:42:41 +00:00
|
|
|
return Callable(stub.GetCode(), LoadGlobalDescriptor(isolate));
|
2016-06-14 13:20:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
Callable CodeFactory::LoadGlobalICInOptimizedCode(Isolate* isolate,
|
|
|
|
TypeofMode typeof_mode) {
|
|
|
|
auto code = LoadGlobalIC::initialize_stub_in_optimized_code(
|
2016-06-16 11:20:08 +00:00
|
|
|
isolate, LoadGlobalICState(typeof_mode).GetExtraICState());
|
2016-06-27 08:42:41 +00:00
|
|
|
return Callable(code, LoadGlobalWithVectorDescriptor(isolate));
|
2016-06-14 13:20:42 +00:00
|
|
|
}
|
2014-10-10 09:49:43 +00:00
|
|
|
|
2014-09-11 13:18:58 +00:00
|
|
|
// static
|
2016-02-17 10:30:10 +00:00
|
|
|
Callable CodeFactory::KeyedLoadIC(Isolate* isolate) {
|
2016-06-16 11:20:08 +00:00
|
|
|
KeyedLoadICTrampolineStub stub(isolate);
|
2016-04-06 13:36:49 +00:00
|
|
|
return Callable(stub.GetCode(), LoadDescriptor(isolate));
|
2014-09-11 13:18:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-10-10 09:49:43 +00:00
|
|
|
// static
|
2016-05-30 19:26:02 +00:00
|
|
|
Callable CodeFactory::KeyedLoadICInOptimizedCode(Isolate* isolate) {
|
|
|
|
auto code =
|
|
|
|
KeyedLoadIC::initialize_stub_in_optimized_code(isolate, kNoExtraICState);
|
|
|
|
return Callable(code, LoadWithVectorDescriptor(isolate));
|
2014-10-10 09:49:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-01-27 11:23:51 +00:00
|
|
|
// static
|
2015-11-09 08:47:59 +00:00
|
|
|
Callable CodeFactory::CallIC(Isolate* isolate, int argc,
|
2016-01-26 11:07:15 +00:00
|
|
|
ConvertReceiverMode mode,
|
|
|
|
TailCallMode tail_call_mode) {
|
2016-04-06 13:36:49 +00:00
|
|
|
CallICTrampolineStub stub(isolate, CallICState(argc, mode, tail_call_mode));
|
|
|
|
return Callable(stub.GetCode(), CallFunctionWithFeedbackDescriptor(isolate));
|
2015-01-27 11:23:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// static
|
2015-11-09 08:47:59 +00:00
|
|
|
Callable CodeFactory::CallICInOptimizedCode(Isolate* isolate, int argc,
|
2016-01-26 11:07:15 +00:00
|
|
|
ConvertReceiverMode mode,
|
|
|
|
TailCallMode tail_call_mode) {
|
|
|
|
return Callable(CallIC::initialize_stub_in_optimized_code(isolate, argc, mode,
|
|
|
|
tail_call_mode),
|
|
|
|
CallFunctionWithFeedbackAndVectorDescriptor(isolate));
|
2015-01-27 11:23:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-09-11 13:18:58 +00:00
|
|
|
// static
|
2015-02-04 09:34:05 +00:00
|
|
|
Callable CodeFactory::StoreIC(Isolate* isolate, LanguageMode language_mode) {
|
2016-04-06 13:36:49 +00:00
|
|
|
VectorStoreICTrampolineStub stub(isolate, StoreICState(language_mode));
|
|
|
|
return Callable(stub.GetCode(), VectorStoreICTrampolineDescriptor(isolate));
|
2015-06-26 07:53:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// static
|
2016-05-30 19:26:02 +00:00
|
|
|
Callable CodeFactory::StoreICInOptimizedCode(Isolate* isolate,
|
|
|
|
LanguageMode language_mode) {
|
|
|
|
CallInterfaceDescriptor descriptor = VectorStoreICDescriptor(isolate);
|
|
|
|
return Callable(
|
|
|
|
StoreIC::initialize_stub_in_optimized_code(isolate, language_mode),
|
|
|
|
descriptor);
|
2014-09-11 13:18:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// static
|
2015-02-04 09:34:05 +00:00
|
|
|
Callable CodeFactory::KeyedStoreIC(Isolate* isolate,
|
|
|
|
LanguageMode language_mode) {
|
2016-04-06 13:36:49 +00:00
|
|
|
VectorKeyedStoreICTrampolineStub stub(isolate, StoreICState(language_mode));
|
|
|
|
return Callable(stub.GetCode(), VectorStoreICTrampolineDescriptor(isolate));
|
2015-02-25 19:32:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// static
|
2016-05-30 19:26:02 +00:00
|
|
|
Callable CodeFactory::KeyedStoreICInOptimizedCode(Isolate* isolate,
|
|
|
|
LanguageMode language_mode) {
|
|
|
|
CallInterfaceDescriptor descriptor = VectorStoreICDescriptor(isolate);
|
|
|
|
return Callable(
|
|
|
|
KeyedStoreIC::initialize_stub_in_optimized_code(isolate, language_mode),
|
|
|
|
descriptor);
|
2014-09-11 13:18:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// static
|
2016-02-16 13:54:51 +00:00
|
|
|
Callable CodeFactory::CompareIC(Isolate* isolate, Token::Value op) {
|
|
|
|
Handle<Code> code = CompareIC::GetUninitialized(isolate, op);
|
2015-03-19 13:09:26 +00:00
|
|
|
return Callable(code, CompareDescriptor(isolate));
|
2014-09-11 13:18:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// static
|
2016-02-16 13:54:51 +00:00
|
|
|
Callable CodeFactory::BinaryOpIC(Isolate* isolate, Token::Value op) {
|
|
|
|
BinaryOpICStub stub(isolate, op);
|
2014-09-11 13:18:58 +00:00
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
2015-07-13 09:18:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-22 12:15:55 +00:00
|
|
|
// static
|
2015-08-25 04:48:36 +00:00
|
|
|
Callable CodeFactory::InstanceOf(Isolate* isolate) {
|
|
|
|
InstanceOfStub stub(isolate);
|
2015-06-22 12:15:55 +00:00
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-09-11 13:18:58 +00:00
|
|
|
// static
|
2015-12-02 15:21:47 +00:00
|
|
|
Callable CodeFactory::ToBoolean(Isolate* isolate) {
|
2016-02-29 12:16:00 +00:00
|
|
|
ToBooleanStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
2014-09-11 13:18:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// static
|
|
|
|
Callable CodeFactory::ToNumber(Isolate* isolate) {
|
2016-06-09 15:36:12 +00:00
|
|
|
return Callable(isolate->builtins()->ToNumber(),
|
|
|
|
TypeConversionDescriptor(isolate));
|
2014-09-11 13:18:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-03-21 09:05:21 +00:00
|
|
|
// static
|
|
|
|
Callable CodeFactory::NonNumberToNumber(Isolate* isolate) {
|
2016-06-09 15:36:12 +00:00
|
|
|
return Callable(isolate->builtins()->NonNumberToNumber(),
|
|
|
|
TypeConversionDescriptor(isolate));
|
2016-03-21 09:05:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
Callable CodeFactory::StringToNumber(Isolate* isolate) {
|
2016-06-09 07:56:58 +00:00
|
|
|
return Callable(isolate->builtins()->StringToNumber(),
|
|
|
|
TypeConversionDescriptor(isolate));
|
2016-03-21 09:05:21 +00:00
|
|
|
}
|
|
|
|
|
2015-08-28 12:59:51 +00:00
|
|
|
// static
|
|
|
|
Callable CodeFactory::ToString(Isolate* isolate) {
|
|
|
|
ToStringStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-01-22 09:52:16 +00:00
|
|
|
// static
|
|
|
|
Callable CodeFactory::ToName(Isolate* isolate) {
|
|
|
|
ToNameStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-04-01 08:00:37 +00:00
|
|
|
// static
|
|
|
|
Callable CodeFactory::ToInteger(Isolate* isolate) {
|
|
|
|
ToIntegerStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
2015-10-19 08:35:00 +00:00
|
|
|
// static
|
|
|
|
Callable CodeFactory::ToLength(Isolate* isolate) {
|
|
|
|
ToLengthStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-07-31 12:25:28 +00:00
|
|
|
// static
|
|
|
|
Callable CodeFactory::ToObject(Isolate* isolate) {
|
|
|
|
ToObjectStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-10-19 11:59:24 +00:00
|
|
|
// static
|
|
|
|
Callable CodeFactory::NumberToString(Isolate* isolate) {
|
|
|
|
NumberToStringStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// static
|
|
|
|
Callable CodeFactory::RegExpConstructResult(Isolate* isolate) {
|
|
|
|
RegExpConstructResultStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-12-11 09:11:26 +00:00
|
|
|
// static
|
|
|
|
Callable CodeFactory::RegExpExec(Isolate* isolate) {
|
|
|
|
RegExpExecStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
2016-03-22 15:42:24 +00:00
|
|
|
// static
|
|
|
|
Callable CodeFactory::Add(Isolate* isolate) {
|
|
|
|
AddStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
Callable CodeFactory::Subtract(Isolate* isolate) {
|
|
|
|
SubtractStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
2016-04-06 09:04:54 +00:00
|
|
|
// static
|
|
|
|
Callable CodeFactory::Multiply(Isolate* isolate) {
|
|
|
|
MultiplyStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
2016-04-08 14:53:04 +00:00
|
|
|
// static
|
|
|
|
Callable CodeFactory::Divide(Isolate* isolate) {
|
|
|
|
DivideStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
2016-04-11 13:54:14 +00:00
|
|
|
// static
|
|
|
|
Callable CodeFactory::Modulus(Isolate* isolate) {
|
|
|
|
ModulusStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
2016-04-13 13:51:23 +00:00
|
|
|
|
|
|
|
// static
|
|
|
|
Callable CodeFactory::ShiftRight(Isolate* isolate) {
|
|
|
|
ShiftRightStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
Callable CodeFactory::ShiftRightLogical(Isolate* isolate) {
|
|
|
|
ShiftRightLogicalStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
Callable CodeFactory::ShiftLeft(Isolate* isolate) {
|
|
|
|
ShiftLeftStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
2016-04-13 08:53:29 +00:00
|
|
|
|
2016-03-23 13:44:32 +00:00
|
|
|
// static
|
|
|
|
Callable CodeFactory::BitwiseAnd(Isolate* isolate) {
|
|
|
|
BitwiseAndStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
Callable CodeFactory::BitwiseOr(Isolate* isolate) {
|
|
|
|
BitwiseOrStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
Callable CodeFactory::BitwiseXor(Isolate* isolate) {
|
|
|
|
BitwiseXorStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
2016-04-22 10:35:42 +00:00
|
|
|
// static
|
|
|
|
Callable CodeFactory::Inc(Isolate* isolate) {
|
|
|
|
IncStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
Callable CodeFactory::Dec(Isolate* isolate) {
|
|
|
|
DecStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
2016-03-03 16:38:55 +00:00
|
|
|
// static
|
|
|
|
Callable CodeFactory::LessThan(Isolate* isolate) {
|
|
|
|
LessThanStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
Callable CodeFactory::LessThanOrEqual(Isolate* isolate) {
|
|
|
|
LessThanOrEqualStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
Callable CodeFactory::GreaterThan(Isolate* isolate) {
|
|
|
|
GreaterThanStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
Callable CodeFactory::GreaterThanOrEqual(Isolate* isolate) {
|
|
|
|
GreaterThanOrEqualStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
2016-03-16 09:36:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
Callable CodeFactory::Equal(Isolate* isolate) {
|
|
|
|
EqualStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
Callable CodeFactory::NotEqual(Isolate* isolate) {
|
|
|
|
NotEqualStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
2016-03-03 16:38:55 +00:00
|
|
|
}
|
|
|
|
|
2016-03-02 11:46:57 +00:00
|
|
|
// static
|
|
|
|
Callable CodeFactory::StrictEqual(Isolate* isolate) {
|
|
|
|
StrictEqualStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
2015-12-11 09:11:26 +00:00
|
|
|
|
2016-03-02 12:34:36 +00:00
|
|
|
// static
|
|
|
|
Callable CodeFactory::StrictNotEqual(Isolate* isolate) {
|
|
|
|
StrictNotEqualStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
2014-09-11 13:18:58 +00:00
|
|
|
// static
|
|
|
|
Callable CodeFactory::StringAdd(Isolate* isolate, StringAddFlags flags,
|
|
|
|
PretenureFlag pretenure_flag) {
|
|
|
|
StringAddStub stub(isolate, flags, pretenure_flag);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
2015-09-18 08:30:22 +00:00
|
|
|
// static
|
2016-03-04 09:38:31 +00:00
|
|
|
Callable CodeFactory::StringCompare(Isolate* isolate, Token::Value token) {
|
|
|
|
switch (token) {
|
|
|
|
case Token::EQ:
|
|
|
|
case Token::EQ_STRICT:
|
|
|
|
return StringEqual(isolate);
|
|
|
|
case Token::NE:
|
|
|
|
case Token::NE_STRICT:
|
|
|
|
return StringNotEqual(isolate);
|
|
|
|
case Token::LT:
|
|
|
|
return StringLessThan(isolate);
|
|
|
|
case Token::GT:
|
|
|
|
return StringGreaterThan(isolate);
|
|
|
|
case Token::LTE:
|
|
|
|
return StringLessThanOrEqual(isolate);
|
|
|
|
case Token::GTE:
|
|
|
|
return StringGreaterThanOrEqual(isolate);
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
UNREACHABLE();
|
|
|
|
return StringEqual(isolate);
|
2015-09-18 08:30:22 +00:00
|
|
|
}
|
|
|
|
|
2016-03-03 10:10:30 +00:00
|
|
|
// static
|
|
|
|
Callable CodeFactory::StringEqual(Isolate* isolate) {
|
|
|
|
StringEqualStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
Callable CodeFactory::StringNotEqual(Isolate* isolate) {
|
|
|
|
StringNotEqualStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
2015-09-18 08:30:22 +00:00
|
|
|
|
2016-03-04 09:38:31 +00:00
|
|
|
// static
|
|
|
|
Callable CodeFactory::StringLessThan(Isolate* isolate) {
|
|
|
|
StringLessThanStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
Callable CodeFactory::StringLessThanOrEqual(Isolate* isolate) {
|
|
|
|
StringLessThanOrEqualStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
Callable CodeFactory::StringGreaterThan(Isolate* isolate) {
|
|
|
|
StringGreaterThanStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
Callable CodeFactory::StringGreaterThanOrEqual(Isolate* isolate) {
|
|
|
|
StringGreaterThanOrEqualStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
2015-12-11 09:11:26 +00:00
|
|
|
// static
|
|
|
|
Callable CodeFactory::SubString(Isolate* isolate) {
|
|
|
|
SubStringStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-04-06 08:37:09 +00:00
|
|
|
// static
|
|
|
|
Callable CodeFactory::ResumeGenerator(Isolate* isolate) {
|
|
|
|
return Callable(isolate->builtins()->ResumeGeneratorTrampoline(),
|
|
|
|
ResumeGeneratorDescriptor(isolate));
|
|
|
|
}
|
|
|
|
|
2015-05-06 13:31:00 +00:00
|
|
|
// static
|
|
|
|
Callable CodeFactory::Typeof(Isolate* isolate) {
|
|
|
|
TypeofStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-11-25 09:22:39 +00:00
|
|
|
// static
|
|
|
|
Callable CodeFactory::FastCloneRegExp(Isolate* isolate) {
|
|
|
|
FastCloneRegExpStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-04-21 15:43:31 +00:00
|
|
|
// static
|
|
|
|
Callable CodeFactory::FastCloneShallowArray(Isolate* isolate) {
|
|
|
|
// TODO(mstarzinger): Thread through AllocationSiteMode at some point.
|
|
|
|
FastCloneShallowArrayStub stub(isolate, DONT_TRACK_ALLOCATION_SITE);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// static
|
|
|
|
Callable CodeFactory::FastCloneShallowObject(Isolate* isolate, int length) {
|
|
|
|
FastCloneShallowObjectStub stub(isolate, length);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-10-02 09:30:15 +00:00
|
|
|
// static
|
|
|
|
Callable CodeFactory::FastNewContext(Isolate* isolate, int slot_count) {
|
|
|
|
FastNewContextStub stub(isolate, slot_count);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-04-27 09:08:20 +00:00
|
|
|
// static
|
2016-06-30 09:42:29 +00:00
|
|
|
Callable CodeFactory::FastNewClosure(Isolate* isolate) {
|
|
|
|
FastNewClosureStub stub(isolate);
|
2015-04-27 09:08:20 +00:00
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
2016-02-19 07:12:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// static
|
|
|
|
Callable CodeFactory::FastNewObject(Isolate* isolate) {
|
|
|
|
FastNewObjectStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
2015-04-27 09:08:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
[runtime] Optimize and unify rest parameters.
Replace the somewhat awkward RestParamAccessStub, which would always
call into the runtime anyway with a proper FastNewRestParameterStub,
which is basically based on the code that was already there for strict
arguments object materialization. But for rest parameters we could
optimize even further (leading to 8-10x improvements for functions with
rest parameters), by fixing the internal formal parameter count:
Every SharedFunctionInfo has a formal_parameter_count field, which
specifies the number of formal parameters, and is used to decide whether
we need to create an arguments adaptor frame when calling a function
(i.e. if there's a mismatch between the actual and expected parameters).
Previously the formal_parameter_count included the rest parameter, which
was sort of unfortunate, as that meant that calling a function with only
the non-rest parameters still required an arguments adaptor (plus some
other oddities). Now with this CL we fix, so that we do no longer
include the rest parameter in that count. Thereby checking for rest
parameters is very efficient, as we only need to check whether there is
an arguments adaptor frame, and if not create an empty array, otherwise
check whether the arguments adaptor frame has more parameters than
specified by the formal_parameter_count.
The FastNewRestParameterStub is written in a way that it can be directly
used by Ignition as well, and with some tweaks to the TurboFan backends
and the CodeStubAssembler, we should be able to rewrite it as
TurboFanCodeStub in the near future.
Drive-by-fix: Refactor and unify the CreateArgumentsType which was
different in TurboFan and Ignition; now we have a single enum class
which is used in both TurboFan and Ignition.
R=jarin@chromium.org, rmcilroy@chromium.org
TBR=rossberg@chromium.org
BUG=v8:2159
LOG=n
Review URL: https://codereview.chromium.org/1676883002
Cr-Commit-Position: refs/heads/master@{#33809}
2016-02-08 10:08:21 +00:00
|
|
|
// static
|
2016-05-11 15:06:40 +00:00
|
|
|
Callable CodeFactory::FastNewRestParameter(Isolate* isolate,
|
|
|
|
bool skip_stub_frame) {
|
|
|
|
FastNewRestParameterStub stub(isolate, skip_stub_frame);
|
[runtime] Optimize and unify rest parameters.
Replace the somewhat awkward RestParamAccessStub, which would always
call into the runtime anyway with a proper FastNewRestParameterStub,
which is basically based on the code that was already there for strict
arguments object materialization. But for rest parameters we could
optimize even further (leading to 8-10x improvements for functions with
rest parameters), by fixing the internal formal parameter count:
Every SharedFunctionInfo has a formal_parameter_count field, which
specifies the number of formal parameters, and is used to decide whether
we need to create an arguments adaptor frame when calling a function
(i.e. if there's a mismatch between the actual and expected parameters).
Previously the formal_parameter_count included the rest parameter, which
was sort of unfortunate, as that meant that calling a function with only
the non-rest parameters still required an arguments adaptor (plus some
other oddities). Now with this CL we fix, so that we do no longer
include the rest parameter in that count. Thereby checking for rest
parameters is very efficient, as we only need to check whether there is
an arguments adaptor frame, and if not create an empty array, otherwise
check whether the arguments adaptor frame has more parameters than
specified by the formal_parameter_count.
The FastNewRestParameterStub is written in a way that it can be directly
used by Ignition as well, and with some tweaks to the TurboFan backends
and the CodeStubAssembler, we should be able to rewrite it as
TurboFanCodeStub in the near future.
Drive-by-fix: Refactor and unify the CreateArgumentsType which was
different in TurboFan and Ignition; now we have a single enum class
which is used in both TurboFan and Ignition.
R=jarin@chromium.org, rmcilroy@chromium.org
TBR=rossberg@chromium.org
BUG=v8:2159
LOG=n
Review URL: https://codereview.chromium.org/1676883002
Cr-Commit-Position: refs/heads/master@{#33809}
2016-02-08 10:08:21 +00:00
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-02-12 05:10:38 +00:00
|
|
|
// static
|
2016-05-11 15:06:40 +00:00
|
|
|
Callable CodeFactory::FastNewSloppyArguments(Isolate* isolate,
|
|
|
|
bool skip_stub_frame) {
|
|
|
|
FastNewSloppyArgumentsStub stub(isolate, skip_stub_frame);
|
2016-02-12 05:10:38 +00:00
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-09-24 15:30:30 +00:00
|
|
|
// static
|
2016-05-11 15:06:40 +00:00
|
|
|
Callable CodeFactory::FastNewStrictArguments(Isolate* isolate,
|
|
|
|
bool skip_stub_frame) {
|
|
|
|
FastNewStrictArgumentsStub stub(isolate, skip_stub_frame);
|
2015-09-24 15:30:30 +00:00
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-11-04 12:58:17 +00:00
|
|
|
// static
|
|
|
|
Callable CodeFactory::AllocateHeapNumber(Isolate* isolate) {
|
|
|
|
AllocateHeapNumberStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
|
|
|
|
2016-03-21 15:45:32 +00:00
|
|
|
#define SIMD128_ALLOC(TYPE, Type, type, lane_count, lane_type) \
|
|
|
|
Callable CodeFactory::Allocate##Type(Isolate* isolate) { \
|
|
|
|
Allocate##Type##Stub stub(isolate); \
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); \
|
|
|
|
}
|
|
|
|
SIMD128_TYPES(SIMD128_ALLOC)
|
|
|
|
#undef SIMD128_ALLOC
|
2015-10-30 16:11:54 +00:00
|
|
|
|
2015-11-04 11:53:08 +00:00
|
|
|
// static
|
|
|
|
Callable CodeFactory::ArgumentAdaptor(Isolate* isolate) {
|
|
|
|
return Callable(isolate->builtins()->ArgumentsAdaptorTrampoline(),
|
|
|
|
ArgumentAdaptorDescriptor(isolate));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-11-04 15:04:19 +00:00
|
|
|
// static
|
2016-03-07 14:33:54 +00:00
|
|
|
Callable CodeFactory::Call(Isolate* isolate, ConvertReceiverMode mode,
|
|
|
|
TailCallMode tail_call_mode) {
|
|
|
|
return Callable(isolate->builtins()->Call(mode, tail_call_mode),
|
2015-11-04 15:04:19 +00:00
|
|
|
CallTrampolineDescriptor(isolate));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-11-05 13:30:41 +00:00
|
|
|
// static
|
2015-11-09 08:47:59 +00:00
|
|
|
Callable CodeFactory::CallFunction(Isolate* isolate, ConvertReceiverMode mode) {
|
|
|
|
return Callable(isolate->builtins()->CallFunction(mode),
|
2015-11-05 13:30:41 +00:00
|
|
|
CallTrampolineDescriptor(isolate));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-11-23 10:34:04 +00:00
|
|
|
// static
|
|
|
|
Callable CodeFactory::Construct(Isolate* isolate) {
|
|
|
|
return Callable(isolate->builtins()->Construct(),
|
|
|
|
ConstructTrampolineDescriptor(isolate));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-12-10 06:03:37 +00:00
|
|
|
// static
|
|
|
|
Callable CodeFactory::ConstructFunction(Isolate* isolate) {
|
|
|
|
return Callable(isolate->builtins()->ConstructFunction(),
|
|
|
|
ConstructTrampolineDescriptor(isolate));
|
|
|
|
}
|
|
|
|
|
2016-05-03 11:11:27 +00:00
|
|
|
// static
|
|
|
|
Callable CodeFactory::HasProperty(Isolate* isolate) {
|
|
|
|
HasPropertyStub stub(isolate);
|
|
|
|
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
|
|
|
|
}
|
2015-12-10 06:03:37 +00:00
|
|
|
|
2015-09-14 10:05:18 +00:00
|
|
|
// static
|
2016-02-17 15:19:02 +00:00
|
|
|
Callable CodeFactory::InterpreterPushArgsAndCall(Isolate* isolate,
|
|
|
|
TailCallMode tail_call_mode) {
|
|
|
|
return Callable(
|
|
|
|
isolate->builtins()->InterpreterPushArgsAndCall(tail_call_mode),
|
|
|
|
InterpreterPushArgsAndCallDescriptor(isolate));
|
2015-10-02 18:13:41 +00:00
|
|
|
}
|
|
|
|
|
2016-02-24 15:15:02 +00:00
|
|
|
|
2015-10-15 16:46:16 +00:00
|
|
|
// static
|
|
|
|
Callable CodeFactory::InterpreterPushArgsAndConstruct(Isolate* isolate) {
|
|
|
|
return Callable(isolate->builtins()->InterpreterPushArgsAndConstruct(),
|
|
|
|
InterpreterPushArgsAndConstructDescriptor(isolate));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-10-02 18:13:41 +00:00
|
|
|
// static
|
2016-01-08 15:15:52 +00:00
|
|
|
Callable CodeFactory::InterpreterCEntry(Isolate* isolate, int result_size) {
|
2015-10-02 18:13:41 +00:00
|
|
|
// Note: If we ever use fpregs in the interpreter then we will need to
|
|
|
|
// save fpregs too.
|
2016-01-08 15:15:52 +00:00
|
|
|
CEntryStub stub(isolate, result_size, kDontSaveFPRegs, kArgvInRegister);
|
2015-10-02 18:13:41 +00:00
|
|
|
return Callable(stub.GetCode(), InterpreterCEntryDescriptor(isolate));
|
2015-09-14 10:05:18 +00:00
|
|
|
}
|
|
|
|
|
2014-09-11 13:18:58 +00:00
|
|
|
} // namespace internal
|
|
|
|
} // namespace v8
|