Commit 57f8e38e authored by danno's avatar danno Committed by Commit bot

[turbofan]: Convert StringFromCharCode to var-args style TF builtin

Review-Url: https://codereview.chromium.org/2448993002
Cr-Commit-Position: refs/heads/master@{#40814}
parent 7f801ff3
......@@ -1522,7 +1522,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
// Install the String.fromCharCode function.
SimpleInstallFunction(string_fun, "fromCharCode",
Builtins::kStringFromCharCode, 1, true);
Builtins::kStringFromCharCode, 1, false);
// Install the String.fromCodePoint function.
SimpleInstallFunction(string_fun, "fromCodePoint",
......
This diff is collapsed.
......@@ -84,7 +84,8 @@ Code* BuildWithCodeStubAssemblerJS(Isolate* isolate,
Code::Flags flags, const char* name) {
HandleScope scope(isolate);
Zone zone(isolate->allocator(), ZONE_NAME);
const int argc_with_recv = argc + 1;
const int argc_with_recv =
(argc == SharedFunctionInfo::kDontAdaptArgumentsSentinel) ? 0 : argc + 1;
CodeStubAssembler assembler(isolate, &zone, argc_with_recv, flags, name);
generator(&assembler);
Handle<Code> code = assembler.GenerateCode();
......
......@@ -620,7 +620,7 @@ namespace internal {
ASM(StringConstructor_ConstructStub) \
CPP(StringFromCodePoint) \
/* ES6 section 21.1.2.1 String.fromCharCode ( ...codeUnits ) */ \
TFJ(StringFromCharCode, 1) \
TFJ(StringFromCharCode, SharedFunctionInfo::kDontAdaptArgumentsSentinel) \
/* ES6 section 21.1.3.1 String.prototype.charAt ( pos ) */ \
TFJ(StringPrototypeCharAt, 1) \
/* ES6 section 21.1.3.2 String.prototype.charCodeAt ( pos ) */ \
......
......@@ -203,6 +203,12 @@ Callable CodeFactory::RegExpExec(Isolate* isolate) {
return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor());
}
// static
Callable CodeFactory::StringFromCharCode(Isolate* isolate) {
Handle<Code> code(isolate->builtins()->StringFromCharCode());
return Callable(code, BuiltinDescriptor(isolate));
}
#define DECLARE_TFS(Name, Kind, Extra, InterfaceDescriptor) \
typedef InterfaceDescriptor##Descriptor Name##Descriptor;
BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, IGNORE_BUILTIN, DECLARE_TFS,
......
......@@ -65,6 +65,8 @@ class V8_EXPORT_PRIVATE CodeFactory final {
// code-stubs.h.
static Callable InstanceOf(Isolate* isolate);
static Callable StringFromCharCode(Isolate* isolate);
static Callable GetProperty(Isolate* isolate);
static Callable ToBoolean(Isolate* isolate);
......
......@@ -1112,6 +1112,10 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
// TypedArray/ArrayBuffer helpers
compiler::Node* IsDetachedBuffer(compiler::Node* buffer);
compiler::Node* ElementOffsetFromIndex(compiler::Node* index,
ElementsKind kind, ParameterMode mode,
int base_size = 0);
private:
friend class CodeStubArguments;
......@@ -1172,10 +1176,6 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
Label* definitely_no_elements,
Label* possibly_elements);
compiler::Node* ElementOffsetFromIndex(compiler::Node* index,
ElementsKind kind, ParameterMode mode,
int base_size = 0);
compiler::Node* AllocateRawAligned(compiler::Node* size_in_bytes,
AllocationFlags flags,
compiler::Node* top_address,
......
......@@ -370,6 +370,27 @@ void CallFunctionWithFeedbackAndVectorDescriptor::InitializePlatformIndependent(
machine_types);
}
void BuiltinDescriptor::InitializePlatformIndependent(
CallInterfaceDescriptorData* data) {
MachineType machine_types[] = {MachineType::AnyTagged(),
MachineType::Int32()};
data->InitializePlatformIndependent(arraysize(machine_types), 0,
machine_types);
}
void BuiltinDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {NewTargetRegister(), ArgumentsCountRegister()};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
const Register BuiltinDescriptor::ArgumentsCountRegister() {
return kJavaScriptCallArgCountRegister;
}
const Register BuiltinDescriptor::NewTargetRegister() {
return kJavaScriptCallNewTargetRegister;
}
void ArrayNoArgumentConstructorDescriptor::InitializePlatformIndependent(
CallInterfaceDescriptorData* data) {
// kFunction, kAllocationSite, kActualArgumentsCount, kFunctionParameter
......
......@@ -62,6 +62,7 @@ class PlatformInterfaceDescriptor;
V(AllocateInt8x16) \
V(AllocateUint8x16) \
V(AllocateBool8x16) \
V(Builtin) \
V(ArrayNoArgumentConstructor) \
V(ArraySingleArgumentConstructor) \
V(ArrayNArgumentsConstructor) \
......@@ -597,6 +598,15 @@ class AllocateHeapNumberDescriptor : public CallInterfaceDescriptor {
SIMD128_TYPES(SIMD128_ALLOC_DESC)
#undef SIMD128_ALLOC_DESC
class BuiltinDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kNewTarget, kArgumentsCount)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(BuiltinDescriptor,
CallInterfaceDescriptor)
static const Register ArgumentsCountRegister();
static const Register NewTargetRegister();
};
class ArrayNoArgumentConstructorDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kFunction, kAllocationSite, kActualArgumentsCount,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment